@kabmo-labs/kabmo 0.59.0 → 0.59.1
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/dist/client/index.html +1 -1
- package/dist/client/index.js +1 -1
- package/dist/client/static/js/{Body-jqq4654r.js → Body-5yedtmnk.js} +1 -1
- package/dist/client/static/js/{CsvGrid-avw0taqb.js → CsvGrid-39m8pp1c.js} +1 -1
- package/dist/client/static/js/{DocxView-d221vr6g.js → DocxView-vd99cv12.js} +1 -1
- package/dist/client/static/js/{DrawioView-gjsy7p01.js → DrawioView-6nq4412n.js} +1 -1
- package/dist/client/static/js/{HtmlPreview-949393v1.js → HtmlPreview-cs51gszy.js} +1 -1
- package/dist/client/static/js/{ImageView-pan9pqtm.js → ImageView-nc2n0w6s.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-p0qmghgt.js → LayoutWrapper-j7786frq.js} +1 -1
- package/dist/client/static/js/MergeDiffView-0rn5zsy5.js +1 -0
- package/dist/client/static/js/{Modal-4spmcn44.js → Modal-7ag7a9qq.js} +1 -1
- package/dist/client/static/js/{PdfView-dzj2s6rj.js → PdfView-0zab721q.js} +1 -1
- package/dist/client/static/js/{SessionsView-b6szjdg5.js → SessionsView-t9rhx472.js} +1 -1
- package/dist/client/static/js/{SheetView-jpc178g5.js → SheetView-2wdn5hkd.js} +1 -1
- package/dist/client/static/js/{SvgPreview-94fap32p.js → SvgPreview-fmrfxd7z.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-a6eyfzrj.js → abnfDiagram-O67JEVCF-41scfh9v.js} +1 -1
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-pgmyfncy.js → architectureDiagram-NJMV4G6O-fp6etjvt.js} +1 -1
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-rf51jyb2.js → blockDiagram-BEXU5L5S-pespk9mt.js} +1 -1
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-0faj48jp.js → c4Diagram-YGBWAQC7-rt4z91dx.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-bvzsws8x.js → classDiagram-v2-NBCMYWYE-6bzaq8sd.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-j1amnd3m.js → cose-bilkent-JH36ORCC-z3fhgcba.js} +1 -1
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-f73w6zzz.js → cynefinDiagram-VND7K2PF-8endeh4p.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-a5vgvjsg.js → dagre-6A5THRUB-2a2f32dv.js} +1 -1
- package/dist/client/static/js/{diagram-22UHCM2B-6y9efamp.js → diagram-22UHCM2B-wgbyr6b7.js} +1 -1
- package/dist/client/static/js/{diagram-3UASUU5V-2mycy7xm.js → diagram-3UASUU5V-5122b41x.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-10zgjb66.js → diagram-ATOU4E4O-1gt9fr7e.js} +1 -1
- package/dist/client/static/js/{diagram-CDSNMT55-bewa52yf.js → diagram-CDSNMT55-v6hs59jb.js} +1 -1
- package/dist/client/static/js/{diagram-MLGK6HIB-mh3b7gd3.js → diagram-MLGK6HIB-yey2m5nm.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-gvdrbdm5.js → diagram-MPIPVDR6-hg4f3q4d.js} +1 -1
- package/dist/client/static/js/{dockerfile-6bn19kg0.js → dockerfile-56tfnp5r.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-2prre93c.js → ebnfDiagram-ZINNZB2B-2mhc9aar.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-9t6t9kc6.js → elk-276RUBZZ-wedtvz9y.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-etcggr5n.js → erDiagram-OPXOYQCR-1kysnby9.js} +1 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-vd4z6bvy.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-cdc4mwhs.js → ganttDiagram-FUAMR5RP-j4g65rpm.js} +1 -1
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-55d0fa7x.js → gitGraphDiagram-X574FWY7-vcwmj4b3.js} +1 -1
- package/dist/client/static/js/{index-eggbcdwx.js → index-1mkn5fbf.js} +8 -8
- package/dist/client/static/js/{index-j1ksa4x2.js → index-2h7xh93h.js} +1 -1
- package/dist/client/static/js/{index-2f6afhze.js → index-3kedv94b.js} +1 -1
- package/dist/client/static/js/{index-xe447cw3.js → index-42k78whj.js} +1 -1
- package/dist/client/static/js/{index-yg38s8t3.js → index-42q5gg7t.js} +1 -1
- package/dist/client/static/js/{index-pe5f2gmn.js → index-6vbra7p9.js} +1 -1
- package/dist/client/static/js/{index-gcad7b6g.js → index-7enfdvh0.js} +1 -1
- package/dist/client/static/js/{index-me0b6wkw.js → index-9mgpbwfr.js} +1 -1
- package/dist/client/static/js/{index-fyt8m8ah.js → index-a70sk36c.js} +1 -1
- package/dist/client/static/js/{index-pzwf6hwe.js → index-c5401dqs.js} +2 -2
- package/dist/client/static/js/{index-a5ecn5yx.js → index-csxnqgzw.js} +1 -1
- package/dist/client/static/js/{index-jpvng27a.js → index-d201jvs9.js} +1 -1
- package/dist/client/static/js/{index-wwyjzhgs.js → index-dbsy29gn.js} +1 -1
- package/dist/client/static/js/{index-rw84kefb.js → index-dw9epydj.js} +1 -1
- package/dist/client/static/js/{index-537m8a3x.js → index-e39m185a.js} +1 -1
- package/dist/client/static/js/{index-yh7gngsh.js → index-fg0ne74z.js} +1 -1
- package/dist/client/static/js/{index-skvfxcd8.js → index-fnaq8baz.js} +1 -1
- package/dist/client/static/js/{index-fr91ghwb.js → index-fvphmwkf.js} +1 -1
- package/dist/client/static/js/{index-s9ts6qbj.js → index-gajpd90b.js} +1 -1
- package/dist/client/static/js/{index-pgy7ree5.js → index-hgzf4ask.js} +1 -1
- package/dist/client/static/js/{index-c253x7vt.js → index-hrez92pw.js} +1 -1
- package/dist/client/static/js/{index-8z9aqgf3.js → index-jaf968hx.js} +2 -2
- package/dist/client/static/js/{index-mx5y9vt9.js → index-kt77dwsg.js} +1 -1
- package/dist/client/static/js/{index-27gwghmp.js → index-m62sf9wn.js} +1 -1
- package/dist/client/static/js/{index-sx2yz2wx.js → index-n7bmqeqz.js} +1 -1
- package/dist/client/static/js/{index-3akjcs82.js → index-pn0ja904.js} +1 -1
- package/dist/client/static/js/{index-ax8gaayq.js → index-pr8wsq24.js} +1 -1
- package/dist/client/static/js/{index-pa70qj4p.js → index-qc3de995.js} +1 -1
- package/dist/client/static/js/{index-9rvjegmy.js → index-r42f3r1p.js} +1 -1
- package/dist/client/static/js/{index-f13ern5e.js → index-s7p2wdr1.js} +1 -1
- package/dist/client/static/js/{index-y09de44h.js → index-skp6991n.js} +1 -1
- package/dist/client/static/js/{index-f6t91mpp.js → index-spnrx2c0.js} +1 -1
- package/dist/client/static/js/{index-mngpcca7.js → index-sqyvj03y.js} +1 -1
- package/dist/client/static/js/{index-njhrm5qa.js → index-tz5ewsza.js} +1 -1
- package/dist/client/static/js/{index-6bsez5n6.js → index-vs3g6njv.js} +1 -1
- package/dist/client/static/js/{index-nnwcbp2d.js → index-wkxsypj1.js} +1 -1
- package/dist/client/static/js/{index-60cxxnpk.js → index-xqz7bqcn.js} +2 -2
- package/dist/client/static/js/{index-trq7bdvk.js → index-y5pkqrga.js} +1 -1
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-9xph6cr5.js → infoDiagram-VRGFBTTK-7craq9x2.js} +1 -1
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-3gshs3v8.js → ishikawaDiagram-OU5B5YK6-ncjty2re.js} +1 -1
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-fa8x56mf.js → journeyDiagram-ZHPQQLJL-yx222bzt.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-fybp2hh4.js → kanban-definition-PNTS6WVX-a2f84qmn.js} +1 -1
- package/dist/client/static/js/{mermaid.core-jjh5ggp0.js → mermaid.core-9vfwthw3.js} +2 -2
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-gtfbg619.js → mindmap-definition-NLK3R4M7-fsxysg6f.js} +1 -1
- package/dist/client/static/js/one-dark-pro-7v4by00h.js +1 -0
- package/dist/client/static/js/one-light-5rfzh8p4.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-1a51sbqv.js → pegDiagram-GJSIUBJH-77wxmp9g.js} +1 -1
- package/dist/client/static/js/{pieDiagram-5QR66LMP-zd9svyyn.js → pieDiagram-5QR66LMP-gvgfhez0.js} +1 -1
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-5gtw2m6s.js → quadrantDiagram-O4NWA36T-9zkbt5h8.js} +1 -1
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-3ccwpfzz.js → railroadDiagram-XR7U4H2S-w55bsyw6.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-sasndrrp.js → requirementDiagram-PLB6GJNP-828s1e5g.js} +1 -1
- package/dist/client/static/js/{rust-n9z2c9m3.js → rust-csv5f258.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-2ahb4sda.js → sankeyDiagram-IPEJSGJF-34f3fyvg.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-bfj90kz1.js → sequenceDiagram-PO4LG4MO-nnta2hn0.js} +1 -1
- package/dist/client/static/js/{sizeCapture-INFHLROL-5tygxmtc.js → sizeCapture-INFHLROL-gpcramga.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-533xw76e.js → stateDiagram-v2-GCMORJYK-3f2en220.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-gd3d04pk.js → swimlanes-2SLR337P-jgqt12z9.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-xxmvdyg4.js → swimlanesDiagram-TC7HE7FX-xx1z57df.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-fvqvgqvg.js → timeline-definition-EJHVYXUP-sgchcs11.js} +1 -1
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-tm1f0m4x.js → usecaseDiagram-POWQR4AR-znkg9pkq.js} +1 -1
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-2vdvv1hd.js → vennDiagram-UO4OBE2U-dncg96ej.js} +1 -1
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-7avcjznx.js → wardleyDiagram-VNRHLVJA-77xz2d49.js} +1 -1
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-g39y526n.js → xychartDiagram-PMCCYNJV-40j1aqyf.js} +1 -1
- package/package.json +1 -1
- package/src/client/components/common/session-row/TrailingSlot.tsx +8 -1
- package/src/client/components/common/session-row/index.tsx +4 -0
- package/src/client/components/common/session-row/session-row.test.tsx +5 -0
- package/src/client/components/layout/session-sidebar/modern/RevealRow.tsx +36 -5
- package/src/client/components/layout/session-sidebar/modern/WorkspaceSection.tsx +1 -0
- package/src/client/components/layout/session-sidebar/modern/reveal-row.test.tsx +28 -1
- package/src/client/components/workspace/model-dropdown/CloseButton.tsx +2 -2
- package/src/client/components/workspace/model-dropdown/Fullscreen.tsx +2 -2
- package/src/client/components/workspace/model-dropdown/HarnessTabs.tsx +10 -1
- package/src/client/components/workspace/model-dropdown/Header.tsx +27 -20
- package/src/client/components/workspace/model-dropdown/Panel.tsx +1 -1
- package/src/client/components/workspace/model-dropdown/harness-tabs.test.tsx +18 -0
- package/src/client/components/workspace/model-dropdown/picker-close.test.tsx +34 -4
- package/dist/client/static/js/MergeDiffView-swt467g7.js +0 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7c2ncsw7.js +0 -1
- package/dist/client/static/js/one-dark-pro-vht9rv39.js +0 -1
- package/dist/client/static/js/one-light-arxc5whh.js +0 -1
package/dist/client/index.html
CHANGED
|
@@ -65,7 +65,7 @@
|
|
|
65
65
|
by `scripts/build-client.ts`. A page that ships an external font must
|
|
66
66
|
name it somewhere; this one did not. -->
|
|
67
67
|
<!--app-head-->
|
|
68
|
-
<link rel="stylesheet" crossorigin href="./static/js/index-mttx9327.css"><script type="module" crossorigin src="./static/js/index-
|
|
68
|
+
<link rel="stylesheet" crossorigin href="./static/js/index-mttx9327.css"><script type="module" crossorigin src="./static/js/index-1mkn5fbf.js"></script></head>
|
|
69
69
|
<body>
|
|
70
70
|
<div id="app"></div>
|
|
71
71
|
<!--app-bootstrap-->
|
package/dist/client/index.js
CHANGED
|
@@ -663,7 +663,7 @@ return u.substring(s,qi)
|
|
|
663
663
|
`:`c.headers={}
|
|
664
664
|
for(const [k,v] of c.request.headers.entries())c.headers[k]=v
|
|
665
665
|
`},listen(e){return(t,n)=>{if(typeof Bun>"u")throw Error(".listen() is designed to run on Bun only. If you are running Elysia in other environment please use a dedicated plugin or export the handler via Elysia.fetch");if(e.compile(),typeof t=="string"){if(!sx(t))throw Error("Port must be a numeric value");t=parseInt(t)}let r=(s,{withAsync:a=!1}={})=>{let c={},l=[];if(e.event.request?.length||e.event.trace?.length||e.extender.higherOrderFunctions.length)return a?Promise.resolve(c):c;for(let[u,d]of Object.entries(s))if(u=encodeURI(u),cx){if(!d)continue;for(let[p,m]of Object.entries(d))if(!(!m||!(p in vH))){if(m instanceof Promise){a&&(c[u]||(c[u]={}),l.push(m.then((h)=>{h instanceof Response&&(c[u][p]=h),pb(h)&&(c[u][p]=h)})));continue}!(m instanceof Response)&&!pb(m)||(c[u]||(c[u]={}),c[u][p]=m)}}else{if(!d)continue;if(d instanceof Promise){a&&(c[u]||(c[u]={}),l.push(d.then((p)=>{p instanceof Response&&(c[u]=p)})));continue}if(!(d instanceof Response))continue;c[u]=d}return a?Promise.all(l).then(()=>c):c},o=kH(qx(qx(r(e.router.response),SH(e)),e.config.serve?.routes)),i=typeof t=="object"?{development:!Va,reusePort:!0,idleTimeout:30,...e.config.serve||{},...t||{},routes:o,websocket:{...e.config.websocket||{},...uM||{},...t.websocket||{}},fetch:e.fetch}:{development:!Va,reusePort:!0,idleTimeout:30,...e.config.serve||{},routes:o,websocket:{...e.config.websocket||{},...uM||{}},port:t,fetch:e.fetch};if(e.server=Bun.serve(i),e.event.start)for(let s=0;s<e.event.start.length;s++)e.event.start[s].fn(e);n&&n(e.server),process.on("beforeExit",async()=>{if(e.server&&(await e.server.stop?.(),e.server=null,e.event.stop))for(let s=0;s<e.event.stop.length;s++)e.event.stop[s].fn(e)}),e.promisedModules.then(async()=>{e.config.aot,e.compile();let s=kH(qx(qx(await r(e.router.response,{withAsync:!0}),SH(e)),e.config.serve?.routes));e.server?.reload({...i,fetch:e.fetch,routes:s}),Bun?.gc(!1)})}},async stop(e,t){if(e.server){if(await e.server.stop(t),e.server=null,e.event.stop?.length)for(let n=0;n<e.event.stop.length;n++)e.event.stop[n].fn(e)}else console.log("Elysia isn't running. Call `app.listen` to start the server.",Error().stack)},ws(e,t,n){let{parse:r,body:o,response:i,...s}=n,a=Qt(o,{modules:e.definitions.typebox,models:e.definitions.type,normalize:e.config.normalize}),c=a?a.provider==="standard"?(u)=>a.schema["~standard"].validate(u).issues:(u)=>a.Check(u)===!1:void 0,l=Qt(i,{modules:e.definitions.typebox,models:e.definitions.type,normalize:e.config.normalize});e.route("WS",t,async(u)=>{let d=u.server??e.server,{set:p,path:m,qi:h,headers:g,query:y,params:b}=u;if(u.validator=l,n.upgrade)if(typeof n.upgrade=="function"){let x=n.upgrade(u);x instanceof Promise&&await x}else n.upgrade&&Object.assign(p.headers,n.upgrade);if(p.cookie&&Je(p.cookie)){let x=nb(p.cookie);x&&(p.headers["set-cookie"]=x)}p.headers["set-cookie"]&&Array.isArray(p.headers["set-cookie"])&&(p.headers=XC(new Headers(p.headers),p.headers["set-cookie"]));let S=wH(l),P=bH(r),E;if(typeof n.beforeHandle=="function"){let x=n.beforeHandle(u);x instanceof Promise&&await x}let T=[...n.error?Array.isArray(n.error)?n.error:[n.error]:[],...(e.event.error??[]).map((x)=>typeof x=="function"?x:x.fn)].filter((x)=>x),I=T.length>0,v=I?async(x,R)=>{for(let C of T){let A=C(Object.assign(u,{error:R}));if(A instanceof Promise&&(A=await A),await S(x,A),A)break}}:()=>{};if(!d?.upgrade(u.request,{headers:Je(p.headers)?p.headers:void 0,data:{...u,get id(){return E||(E=qa())},validator:l,ping(x,R){n.ping?.(x,R)},pong(x,R){n.pong?.(x,R)},open:async(x)=>{try{await S(x,n.open?.(new uf(x,u)))}catch(R){v(x,R)}},message:async(x,R)=>{let C=await P(x,R);if(c&&c(C)){let A=new me("message",a,C);return I?v(x,A):void x.send(A.message)}try{await S(x,n.message?.(new uf(x,u,C),C))}catch(A){v(x,A)}},drain:async(x)=>{try{await S(x,n.drain?.(new uf(x,u)))}catch(R){v(x,R)}},close:async(x,R,C)=>{try{await S(x,n.close?.(new uf(x,u),R,C))}catch(A){v(x,A)}}}}))return $s(400,"Expected a websocket connection")},{...s,websocket:n})}};var _x=Lo?Bun.env:typeof process<"u"&&process?.env?process.env:{};var IH=/^(.+)\[(\d+)\]$/,TH=new Set(["__proto__","constructor","prototype"]),EH=(e)=>{if(TH.has(e))return!0;let t=e.match(IH);return t?TH.has(t[1]):!1},RH=(e)=>{let t=e.match(IH);return t?{name:t[1],index:parseInt(t[2],10)}:null},KMe=(e)=>{if(!(typeof e!="string"||e.charCodeAt(0)!==123))try{let t=JSON.parse(e);if(t&&typeof t=="object"&&!Array.isArray(t))return t}catch{return}},dM=(e,t,n)=>{let r=t.split("."),o=r.pop();if(EH(o)||r.some(EH))return;let i=e;for(let a of r){let c=RH(a);if(c){Array.isArray(i[c.name])||(i[c.name]=[]);let l=i[c.name][c.index],u=typeof File<"u"&&l instanceof File;(!l||typeof l!="object"||Array.isArray(l)||u)&&(i[c.name][c.index]=KMe(l)??{}),i=i[c.name][c.index]}else(!i[a]||typeof i[a]!="object")&&(i[a]={}),i=i[a]}let s=RH(o);s?(Array.isArray(i[s.name])||(i[s.name]=[]),i[s.name][s.index]=n):i[o]=n},pM=(e)=>{if(e.length===1){let o=e[0];if(typeof o=="string"&&(o.charCodeAt(0)===123||o.charCodeAt(0)===91))try{let i=JSON.parse(o);if(i&&typeof i=="object")return i}catch{}return e[0]}let t=e.find((o)=>typeof o=="string");if(!t||typeof File>"u")return e;let n=e.filter((o)=>o instanceof File);if(!n.length||t.charCodeAt(0)!==123)return e;let r;try{r=JSON.parse(t)}catch{return e}return typeof r!="object"||r===null?e:(!("file"in r)&&n.length===1?r.file=n[0]:!("files"in r)&&n.length>1&&(r.files=n),r)},mM=(e,t)=>{let n=e.schema;if(!n)return;n.$defs?.[n.$ref]&&(n=n.$defs[n.$ref]);let r=_s(n);if(r)for(let[o,i]of Object.entries(r))t[o]??=i.default};async function Td(e,t,n){let r=await t.Validate(n);if(r.issues)throw new me(e,t,n,!1,r.issues);return r.value}var fM=(e)=>{let{mapResponse:t,mapEarlyResponse:n}=e["~adapter"].handler,r=e.setHeaders;return async(o)=>{let i=o.url,s=i.indexOf("/",11),a=i.indexOf("?",s+1),c=a===-1?i.substring(s):i.substring(s,a),l={cookie:{},status:200,headers:r?{...r}:{}},u=Object.assign({},e.singleton.decorator,{set:l,store:e.singleton.store,request:o,path:c,qi:a,error:$s,status:$s,redirect:ad}),d;try{if(e.event.request)for(let R=0;R<e.event.request.length;R++){let C=e.event.request[R].fn,A=C(u);if(A instanceof Promise&&(A=await A),A=n(A,l),A)return u.response=A}let p=o.method==="GET"&&o.headers.get("upgrade")?.toLowerCase()==="websocket"?"WS":o.method,m=e.router.dynamic.find(o.method,c)??e.router.dynamic.find(p,c)??e.router.dynamic.find("ALL",c);if(!m)throw u.query=a===-1?{}:il(i.substring(a+1)),new zm;let{handle:h,validator:g,content:y,route:b}=m.store;if(d=m.store.hooks,d.config?.mount)return await d.config.mount(o);let S;if(o.method!=="GET"&&o.method!=="HEAD")if(y)switch(y){case"application/json":S=await o.json();break;case"text/plain":S=await o.text();break;case"application/x-www-form-urlencoded":S=il(await o.text());break;case"application/octet-stream":S=await o.arrayBuffer();break;case"multipart/form-data":{S={};let R=await o.formData(),C=new Map;R.forEach((A,N)=>{let O=C.get(N);O?O.push(A):C.set(N,[A])});for(let[A,N]of C){if(S[A])continue;let O=pM(N);A.includes(".")||A.includes("[")?dM(S,A,O):S[A]=O}break}}else{let R;if(o.body&&(R=o.headers.get("content-type")),R){let C=R.indexOf(";");if(C!==-1&&(R=R.slice(0,C)),u.contentType=R,d.parse)for(let A=0;A<d.parse.length;A++){let N=d.parse[A].fn;if(typeof N=="string")switch(N){case"json":case"application/json":S=await o.json();break;case"text":case"text/plain":S=await o.text();break;case"urlencoded":case"application/x-www-form-urlencoded":S=il(await o.text());break;case"arrayBuffer":case"application/octet-stream":S=await o.arrayBuffer();break;case"formdata":case"multipart/form-data":{S={};let O=await o.formData(),H=new Map;O.forEach((z,te)=>{let Y=H.get(te);Y?Y.push(z):H.set(te,[z])});for(let[z,te]of H){if(S[z])continue;let Y=pM(te);z.includes(".")||z.includes("[")?dM(S,z,Y):S[z]=Y}break}default:{let O=e["~parser"][N];if(O){let H=O(u,R);if(H instanceof Promise&&(H=await H),H){S=H;break}}break}}else{let O=N(u,R);if(O instanceof Promise&&(O=await O),O){S=O;break}}}if(delete u.contentType,S===void 0)switch(R){case"application/json":S=await o.json();break;case"text/plain":S=await o.text();break;case"application/x-www-form-urlencoded":S=il(await o.text());break;case"application/octet-stream":S=await o.arrayBuffer();break;case"multipart/form-data":{S={};let A=await o.formData(),N=new Map;A.forEach((O,H)=>{let z=N.get(H);z?z.push(O):N.set(H,[O])});for(let[O,H]of N){if(S[O])continue;let z=pM(H);O.includes(".")||O.includes("[")?dM(S,O,z):S[O]=z}break}}}}u.route=b,u.body=S,u.params=m?.params||void 0,u.query=a===-1?{}:il(i.substring(a+1)),u.headers={};for(let[R,C]of o.headers.entries())u.headers[R]=C;let P={domain:e.config.cookie?.domain??g?.cookie?.config.domain,expires:e.config.cookie?.expires??g?.cookie?.config.expires,httpOnly:e.config.cookie?.httpOnly??g?.cookie?.config.httpOnly,maxAge:e.config.cookie?.maxAge??g?.cookie?.config.maxAge,path:e.config.cookie?.path??g?.cookie?.config.path,priority:e.config.cookie?.priority??g?.cookie?.config.priority,partitioned:e.config.cookie?.partitioned??g?.cookie?.config.partitioned,sameSite:e.config.cookie?.sameSite??g?.cookie?.config.sameSite,secure:e.config.cookie?.secure??g?.cookie?.config.secure,secrets:e.config.cookie?.secrets??g?.cookie?.config.secrets,sign:e.config.cookie?.sign??g?.cookie?.config.sign},E=o.headers.get("cookie");u.cookie=await Ox(u.set,E,P);let T=g?.createHeaders?.();T&&mM(T,u.headers);let I=g?.createParams?.();I&&mM(I,u.params);let v=g?.createQuery?.();if(v&&mM(v,u.query),d.transform)for(let R=0;R<d.transform.length;R++){let C=d.transform[R],A=C.fn(u);if(A instanceof Promise&&(A=await A),A instanceof Yt){let N=n(A,u.set);if(N)return u.response=N}C.subType==="derive"&&Object.assign(u,A)}if(g){if(T){let C=structuredClone(u.headers);for(let[A,N]of o.headers)C[A]=N;if(T.provider==="standard")u.headers=await Td("header",T,C);else if(g.headers.Check(C)===!1)throw new me("header",g.headers,C)}else g.headers?.Decode&&(u.headers=g.headers.Decode(u.headers));if(I?.provider==="standard")u.params=await Td("params",I,u.params);else{if(I?.Check(u.params)===!1)throw new me("params",g.params,u.params);g.params?.Decode&&(u.params=g.params.Decode(u.params))}if(g.query?.schema){let C=g.query.schema;C.$defs?.[C.$ref]&&(C=C.$defs[C.$ref]);let A=_s(C);if(A)for(let N of Object.keys(A)){let O=A[N];(O.type==="array"||O.items?.type==="string")&&typeof u.query[N]=="string"&&u.query[N]&&(u.query[N]=u.query[N].split(","))}}if(v?.provider==="standard")u.query=await Td("query",v,u.query);else{if(v?.Check(u.query)===!1)throw new me("query",g.query,u.query);g.query?.Decode&&(u.query=g.query.Decode(u.query))}if(g.createCookie?.()){let C={};for(let[A,N]of Object.entries(u.cookie))C[A]=N.value;if(g.cookie.provider==="standard"){C=await Td("cookie",g.cookie,C);for(let A of Object.keys(C))u.cookie[A].value=C[A]}else{if(g.cookie.Check(C)===!1)throw new me("cookie",g.cookie,C);g.cookie?.Decode&&(C=g.cookie.Decode(C))}}let R=g.createBody?.();if(R?.provider==="standard")u.body=await Td("body",R,S);else{if(R?.Check(S)===!1)throw new me("body",g.body,S);if(g.body?.Decode){let C=g.body.Decode(S);C instanceof Promise&&(C=await C),u.body=C?.value??C}}}if(d.beforeHandle)for(let R=0;R<d.beforeHandle.length;R++){let C=d.beforeHandle[R],A=C.fn(u);if(A instanceof Promise&&(A=await A),A instanceof Yt){let N=n(A,u.set);if(N)return u.response=N}if(C.subType==="resolve"){Object.assign(u,A);continue}if(A!==void 0){if(u.response=A,d.afterHandle)for(let O=0;O<d.afterHandle.length;O++){let H=d.afterHandle[O].fn(u);H instanceof Promise&&(H=await H),H&&(A=H)}let N=n(A,u.set);if(N)return u.response=N}}let x=typeof h=="function"?h(u):h;if(x instanceof Promise&&(x=await x),d.afterHandle?.length){u.response=x;for(let R=0;R<d.afterHandle.length;R++){let C=d.afterHandle[R].fn(u);C instanceof Promise&&(C=await C);let A=C instanceof Yt,N=A?C.code:l.status?typeof l.status=="string"?Ws[l.status]:l.status:200;A&&(l.status=N,C=C.response);let O=g?.createResponse?.()?.[N];if(O?.provider==="standard")C=await Td("response",O,C);else if(O?.Check(C)===!1)if(O?.Clean)try{let z=O.Clean(C);if(O?.Check(z)===!1)throw new me("response",O,C);C=z}catch(z){throw z instanceof me?z:new me("response",O,C)}else throw new me("response",O,C);if(O?.Encode&&(u.response=C=O.Encode(C)),O?.Clean)try{u.response=C=O.Clean(C)}catch{}let H=n(C,u.set);if(H!==void 0)return u.response=H}}else{let R=x instanceof Yt,C=R?x.code:l.status?typeof l.status=="string"?Ws[l.status]:l.status:200;R&&(l.status=C,x=x.response);let A=g?.createResponse?.()?.[C];if(A?.provider==="standard")x=await Td("response",A,x);else if(A?.Check(x)===!1)if(A?.Clean)try{let N=A.Clean(x);if(A?.Check(N)===!1)throw new me("response",A,x);x=N}catch(N){throw N instanceof me?N:new me("response",A,x)}else throw new me("response",A,x);if(A?.Encode&&(x=A.Encode(x)),A?.Clean)try{x=A.Clean(x)}catch{}}if(u.set.cookie&&P?.sign){let R=P.secrets?typeof P.secrets=="string"?P.secrets:P.secrets[0]:void 0;if(P.sign===!0){if(R)for(let[C,A]of Object.entries(u.set.cookie))u.set.cookie[C].value=await _m(A.value,R)}else{let C=_s(g?.cookie?.schema);if(R)for(let A of P.sign)!C||!(A in C)||u.set.cookie[A]?.value&&(u.set.cookie[A].value=await _m(u.set.cookie[A].value,R))}}return t(u.response=x,u.set)}catch(p){let m=p instanceof od&&p.error?p.error:p;return e.handleError(u,m)}finally{let p=d?d.afterResponse:e.event.afterResponse;p&&(ox?setImmediate(async()=>{for(let m of p)await m.fn(u)}):Promise.resolve().then(async()=>{for(let m of p)await m.fn(u)}))}}},PH=(e)=>{let{mapResponse:t}=e["~adapter"].handler;return async(n,r)=>{let o=Object.assign(n,{error:r,code:r.code});if(o.set=n.set,typeof r?.toResponse=="function"&&!(r instanceof me)&&!(r instanceof od))try{let i=r.toResponse();typeof i?.then=="function"&&(i=await i),i instanceof Response&&(n.set.status=i.status),n.response=i}catch{}if(!n.response&&e.event.error)for(let i=0;i<e.event.error.length;i++){let s=e.event.error[i].fn(o);if(s instanceof Promise&&(s=await s),s!=null)return n.response=t(s,n.set)}if(n.response){if(e.event.mapResponse)for(let i=0;i<e.event.mapResponse.length;i++){let s=e.event.mapResponse[i].fn(o);s instanceof Promise&&(s=await s),s!=null&&(n.response=s)}return t(n.response,n.set)}return n.set.status=r.status??500,t(typeof r.cause=="string"?r.cause:r.message,n.set)}};var CH;CH=Symbol.dispose;var GMe=class e{constructor(t={}){this.server=null,this.dependencies={},this["~Prefix"]="",this["~Singleton"]=null,this["~Definitions"]=null,this["~Metadata"]=null,this["~Ephemeral"]=null,this["~Volatile"]=null,this["~Routes"]=null,this.singleton={decorator:{},store:{},derive:{},resolve:{}},this.definitions={typebox:X.Module({}),type:{},error:{}},this.extender={macro:{},higherOrderFunctions:[]},this.validator={global:null,scoped:null,local:null,getCandidate(){return!this.global&&!this.scoped&&!this.local?{body:void 0,headers:void 0,params:void 0,query:void 0,cookie:void 0,response:void 0}:qm(qm(this.global,this.scoped),this.local)}},this.standaloneValidator={global:null,scoped:null,local:null},this.event={},this.router={"~http":void 0,get http(){return this["~http"]||(this["~http"]=new Hu({lazy:!0,onParam:gM.default})),this["~http"]},"~dynamic":void 0,get dynamic(){return this["~dynamic"]||(this["~dynamic"]=new Hu({onParam:gM.default})),this["~dynamic"]},static:{},response:{},history:[]},this.routeTree={},this.inference={body:!1,cookie:!1,headers:!1,query:!1,set:!1,server:!1,path:!1,route:!1,url:!1},this["~parser"]={},this.handle=async(n)=>this.fetch(n),this.handleError=async(n,r)=>(this.handleError=this.config.aot?lM(this):PH(this))(n,r),this.listen=(n,r)=>(this["~adapter"].listen(this)(n,r),this),this.stop=async(n)=>(await this["~adapter"].stop?.(this,n),this),this[CH]=()=>{this.server&&this.stop()},t.tags&&(t.detail?t.detail.tags=t.tags:t.detail={tags:t.tags}),this.config={aot:_x.ELYSIA_AOT!=="false",nativeStaticResponse:!0,encodeSchema:!0,normalize:!0,...t,prefix:t.prefix?t.prefix.charCodeAt(0)===47?t.prefix:`/${t.prefix}`:void 0,cookie:{path:"/",...t?.cookie},experimental:t?.experimental??{},seed:t?.seed===void 0?"":t?.seed},this["~adapter"]=t.adapter??(typeof Bun<"u"?AH:ib),t?.analytic&&(t?.name||t?.seed!==void 0)&&(this.telemetry={stack:Error().stack})}get store(){return this.singleton.store}get decorator(){return this.singleton.decorator}get routes(){return this.router.history}getGlobalRoutes(){return this.router.history}getGlobalDefinitions(){return this.definitions}getServer(){return this.server}getParent(){return null}get promisedModules(){return this._promisedModules||(this._promisedModules=new wC(console.error,()=>{})),this._promisedModules}env(t,n=_x){if(Qt(t,{modules:this.definitions.typebox,dynamic:!0,additionalProperties:!0,coerce:!0,sanitize:()=>this.config.sanitize}).Check(n)===!1){let r=new me("env",t,n);throw Error(r.all.map((o)=>o.summary).join(`
|
|
666
|
-
`))}return this}wrap(t){return this.extender.higherOrderFunctions.push({checksum:Ka(JSON.stringify({name:this.config.name,seed:this.config.seed,content:t.toString()})),fn:t}),this}get models(){let t={};for(let n of Object.keys(this.definitions.type))t[n]=Qt(this.definitions.typebox.Import(n),{models:this.definitions.type});return t.modules=this.definitions.typebox,t}add(t,n,r,o,i){let s=i?.skipPrefix??!1,a=i?.allowMeta??!1;o??={},this.applyMacro(o);let c=[];if(o.standaloneValidator&&(c=c.concat(o.standaloneValidator)),this.standaloneValidator.local&&(c=c.concat(this.standaloneValidator.local)),this.standaloneValidator.scoped&&(c=c.concat(this.standaloneValidator.scoped)),this.standaloneValidator.global&&(c=c.concat(this.standaloneValidator.global)),n!==""&&n.charCodeAt(0)!==47&&(n="/"+n),this.config.prefix&&!s&&(n=this.config.prefix+n),o?.type)switch(o.type){case"text":o.type="text/plain";break;case"json":o.type="application/json";break;case"formdata":o.type="multipart/form-data";break;case"urlencoded":o.type="application/x-www-form-urlencoded";break;case"arrayBuffer":o.type="application/octet-stream";break;default:break}let l=this.validator.getCandidate(),u={body:o?.body??l?.body,headers:o?.headers??l?.headers,params:o?.params??l?.params,query:o?.query??l?.query,cookie:o?.cookie??l?.cookie,response:o?.response??l?.response},d=this.config.precompile===!0||typeof this.config.precompile=="object"&&this.config.precompile.compose===!0,p=()=>{let A=this.definitions.type,N=!this.config.aot,O=this.config.normalize,H=this.definitions.typebox,z=()=>this.config.sanitize,te=()=>{if(u.cookie||c.find((Y)=>Y.cookie))return mH({modules:H,validator:u.cookie,defaultConfig:this.config.cookie,normalize:O,config:u.cookie?.config??{},dynamic:N,models:A,validators:c.map((Y)=>Y.cookie),sanitize:z})};return d?{body:Qt(u.body,{modules:H,dynamic:N,models:A,normalize:O,additionalCoerce:(()=>{let Y=sM(u.body,A,H);return Y&&F in Y&&(Gn("File",Y)||Gn("Files",Y))?oM():cb()})(),validators:c.map((Y)=>Y.body),sanitize:z}),headers:Qt(u.headers,{modules:H,dynamic:N,models:A,additionalProperties:!0,coerce:!0,additionalCoerce:vd(),validators:c.map((Y)=>Y.headers),sanitize:z}),params:Qt(u.params,{modules:H,dynamic:N,models:A,coerce:!0,additionalCoerce:vd(),validators:c.map((Y)=>Y.params),sanitize:z}),query:Qt(u.query,{modules:H,dynamic:N,models:A,normalize:O,coerce:!0,additionalCoerce:rM(),validators:c.map((Y)=>Y.query),sanitize:z}),cookie:te(),response:Hx(u.response,{modules:H,dynamic:N,models:A,normalize:O,validators:c.map((Y)=>Y.response),sanitize:z})}:{createBody(){return this.body?this.body:this.body=Qt(u.body,{modules:H,dynamic:N,models:A,normalize:O,additionalCoerce:(()=>{let Y=sM(u.body,A,H);return Y&&F in Y&&(Gn("File",Y)||Gn("Files",Y))?oM():cb()})(),validators:c.map((Y)=>Y.body),sanitize:z})},createHeaders(){return this.headers?this.headers:this.headers=Qt(u.headers,{modules:H,dynamic:N,models:A,normalize:O,additionalProperties:!O,coerce:!0,additionalCoerce:vd(),validators:c.map((Y)=>Y.headers),sanitize:z})},createParams(){return this.params?this.params:this.params=Qt(u.params,{modules:H,dynamic:N,models:A,normalize:O,coerce:!0,additionalCoerce:vd(),validators:c.map((Y)=>Y.params),sanitize:z})},createQuery(){return this.query?this.query:this.query=Qt(u.query,{modules:H,dynamic:N,models:A,normalize:O,coerce:!0,additionalCoerce:rM(),validators:c.map((Y)=>Y.query),sanitize:z})},createCookie(){return this.cookie?this.cookie:this.cookie=te()},createResponse(){return this.response?this.response:this.response=Hx(u.response,{modules:H,dynamic:N,models:A,normalize:O,validators:c.map((Y)=>Y.response),sanitize:z})}}};(l.body||l.cookie||l.headers||l.params||l.query||l.response)&&(o=Hs(o,l)),o.tags&&(o.detail?o.detail.tags=o.tags:o.detail={tags:o.tags}),Je(this.config.detail)&&(o.detail=wn(Object.assign({},this.config.detail),o.detail));let m=Je(this.event)?Hs(this.event,SC(o)):{...dj(SC(o))};if(c.length&&Object.assign(m,{standaloneValidator:c}),this.config.aot===!1){let A=p();this.router.dynamic.add(t,n,{validator:A,hooks:m,content:o?.type,handle:r,route:n});let N=ld(n,{dynamic:!0});if(n!==N&&this.router.dynamic.add(t,N,{validator:A,hooks:m,content:o?.type,handle:r,route:n}),!this.config.strictPath){let O=cd(n);this.router.dynamic.add(t,O,{validator:A,hooks:m,content:o?.type,handle:r,route:n});let H=ld(O);O!==H&&this.router.dynamic.add(t,O,{validator:A,hooks:m,content:o?.type,handle:r,route:n})}this.router.history.push({method:t,path:n,composed:null,handler:r,compile:void 0,hooks:m});return}let h=this["~adapter"].handler,g=typeof r!="function"?()=>{let A=h.createNativeStaticHandler?.(r,m,{headers:Object.assign({},this.setHeaders)});return A instanceof Promise?A.then((N)=>{if(N)return N}):A?.()}:void 0,y=this.config.nativeStaticResponse===!0,b=(A)=>{!y||!g||(cx?this.router.response[A]?this.router.response[A][t]=g():this.router.response[A]={[t]:g()}:this.router.response[A]=g())};b(n);let S,P=()=>{if(S)return S;let A=gH({app:this,path:n,method:t,hooks:m,validator:p(),handler:typeof r!="function"&&typeof h.createStaticHandler!="function"?()=>r:r,allowMeta:a,inference:this.inference});return this.router.history[T]&&(S=this.router.history[T].composed=A),A},E;if(`${t}_${n}`in this.routeTree)for(let A=0;A<this.router.history.length;A++){let N=this.router.history[A];if(N.path===n&&N.method===t){E=A;break}}else this.routeTree[`${t}_${n}`]=this.router.history.length;let T=E??this.router.history.length,I=this.router.history,v=d?P():(A)=>S?S(A):(I[T].composed=P())(A);E!==void 0?this.router.history[E]=Object.assign({method:t,path:n,composed:v,compile:P,handler:r,hooks:m},c.length?{standaloneValidators:c}:void 0,o.webSocket?{websocket:o.websocket}:void 0):this.router.history.push(Object.assign({method:t,path:n,composed:v,compile:P,handler:r,hooks:m},o.webSocket?{websocket:o.websocket}:void 0));let x={handler:d?I[T].composed:void 0,compile(){return this.handler=P()}},R=this.router.static,C=n.indexOf(":")===-1&&n.indexOf("*")===-1;if(t==="WS"){if(C){n in R?R[n][t]=T:R[n]={[t]:T};return}this.router.http.add("WS",n,x),this.config.strictPath||this.router.http.add("WS",cd(n),x);let A=ld(n,{dynamic:!0});n!==A&&this.router.http.add("WS",A,x);return}if(C)n in R?R[n][t]=T:R[n]={[t]:T},this.config.strictPath||b(cd(n));else{if(this.router.http.add(t,n,x),!this.config.strictPath){let N=cd(n);b(N),this.router.http.add(t,N,x)}let A=ld(n,{dynamic:!0});n!==A&&(this.router.http.add(t,A,x),b(A))}}headers(t){return t?(this.setHeaders||(this.setHeaders={}),this.setHeaders=wn(this.setHeaders,t),this):this}onStart(t){return this.on("start",t),this}onRequest(t){return this.on("request",t),this}onParse(t,n){return n?this.on(t,"parse",n):typeof t=="string"?this.on("parse",this["~parser"][t]):this.on("parse",t)}parser(t,n){return this["~parser"][t]=n,this}onTransform(t,n){return n?this.on(t,"transform",n):this.on("transform",t)}resolve(t,n){n||(n=t,t={as:"local"});let r={subType:"resolve",fn:n};return this.onBeforeHandle(t,r)}mapResolve(t,n){n||(n=t,t={as:"local"});let r={subType:"mapResolve",fn:n};return this.onBeforeHandle(t,r)}onBeforeHandle(t,n){return n?this.on(t,"beforeHandle",n):this.on("beforeHandle",t)}onAfterHandle(t,n){return n?this.on(t,"afterHandle",n):this.on("afterHandle",t)}mapResponse(t,n){return n?this.on(t,"mapResponse",n):this.on("mapResponse",t)}onAfterResponse(t,n){return n?this.on(t,"afterResponse",n):this.on("afterResponse",t)}trace(t,n){n||(n=t,t={as:"local"}),Array.isArray(n)||(n=[n]);for(let r of n)this.on(t,"trace",sH(r));return this}error(t,n){switch(typeof t){case"string":return n.prototype[ud]=t,this.definitions.error[t]=n,this;case"function":return this.definitions.error=t(this.definitions.error),this}for(let[r,o]of Object.entries(t))o.prototype[ud]=r,this.definitions.error[r]=o;return this}onError(t,n){return n?this.on(t,"error",n):this.on("error",t)}onStop(t){return this.on("stop",t),this}on(t,n,r){let o;switch(typeof t){case"string":o=t,r=n;break;case"object":o=n,!Array.isArray(n)&&typeof n=="object"&&(r=n);break}Array.isArray(r)?r=bn(r):typeof r=="function"?r=[{fn:r}]:r=[r];let i=r;for(let s of i)s.scope=typeof t=="string"?"local":t?.as??"local",(o==="resolve"||o==="derive")&&(s.subType=o);o!=="trace"&&(this.inference=wd({[o]:i.map((s)=>s.fn)},this.inference,this.config.sucrose));for(let s of i){let a=pj(s,"global",{skipIfHasType:!0});switch((this.config.name||this.config.seed)&&(a.checksum=Ka(this.config.name+JSON.stringify(this.config.seed))),o){case"start":this.event.start??=[],this.event.start.push(a);break;case"request":this.event.request??=[],this.event.request.push(a);break;case"parse":this.event.parse??=[],this.event.parse.push(a);break;case"transform":this.event.transform??=[],this.event.transform.push(a);break;case"derive":this.event.transform??=[],this.event.transform.push(bn(a,"derive"));break;case"beforeHandle":this.event.beforeHandle??=[],this.event.beforeHandle.push(a);break;case"resolve":this.event.beforeHandle??=[],this.event.beforeHandle.push(bn(a,"resolve"));break;case"afterHandle":this.event.afterHandle??=[],this.event.afterHandle.push(a);break;case"mapResponse":this.event.mapResponse??=[],this.event.mapResponse.push(a);break;case"afterResponse":this.event.afterResponse??=[],this.event.afterResponse.push(a);break;case"trace":this.event.trace??=[],this.event.trace.push(a);break;case"error":this.event.error??=[],this.event.error.push(a);break;case"stop":this.event.stop??=[],this.event.stop.push(a);break}}return this}as(t){return _a(this.event.parse,t),_a(this.event.transform,t),_a(this.event.beforeHandle,t),_a(this.event.afterHandle,t),_a(this.event.mapResponse,t),_a(this.event.afterResponse,t),_a(this.event.trace,t),_a(this.event.error,t),t==="scoped"?(this.validator.scoped=qm(this.validator.scoped,this.validator.local),this.validator.local=null,this.standaloneValidator.local!==null&&(this.standaloneValidator.scoped||=[],this.standaloneValidator.scoped.push(...this.standaloneValidator.local),this.standaloneValidator.local=null)):t==="global"&&(this.validator.global=qm(this.validator.global,qm(this.validator.scoped,this.validator.local)),this.validator.scoped=null,this.validator.local=null,this.standaloneValidator.local!==null&&(this.standaloneValidator.scoped||=[],this.standaloneValidator.scoped.push(...this.standaloneValidator.local),this.standaloneValidator.local=null),this.standaloneValidator.scoped!==null&&(this.standaloneValidator.global||=[],this.standaloneValidator.global.push(...this.standaloneValidator.scoped),this.standaloneValidator.scoped=null)),this}group(t,n,r){let o=new e({...this.config,prefix:""});o.singleton={...this.singleton},o.definitions={...this.definitions},o.getServer=()=>this.getServer(),o.inference=ax(this.inference),o.extender={...this.extender},o["~parser"]=this["~parser"],o.standaloneValidator={local:[...this.standaloneValidator.local??[]],scoped:[...this.standaloneValidator.scoped??[]],global:[...this.standaloneValidator.global??[]]};let i=typeof n=="object",s=(i?r:n)(o);return this.singleton=wn(this.singleton,o.singleton),this.definitions=wn(this.definitions,o.definitions),s.event.request?.length&&(this.event.request=[...this.event.request||[],...s.event.request||[]]),s.event.mapResponse?.length&&(this.event.mapResponse=[...this.event.mapResponse||[],...s.event.mapResponse||[]]),this.model(s.definitions.type),Object.values(o.router.history).forEach(({method:a,path:c,handler:l,hooks:u})=>{if(c=(i?"":this.config.prefix??"")+t+c,i){let{body:d,headers:p,query:m,params:h,cookie:g,response:y,...b}=n,S=u;this.applyMacro(b);let P=d||p||m||h||g||y;this.add(a,c,l,Hs(b,{...S||{},error:S.error?Array.isArray(S.error)?[...S.error??[],...s.event.error??[]]:[S.error,...s.event.error??[]]:s.event.error,standaloneValidator:b.standaloneValidator||S.standaloneValidator||P?[...b.standaloneValidator??[],...S.standaloneValidator??[],...P?[{body:d,headers:p,query:m,params:h,cookie:g,response:y}]:[]]:void 0}),void 0)}else this.add(a,c,l,Hs(u,{error:s.event.error}),{skipPrefix:!0})}),this}guard(t,n){if(!n){if(typeof t=="object"){this.applyMacro(t),t.detail&&(this.config.detail?this.config.detail=wn(Object.assign({},this.config.detail),t.detail):this.config.detail=t.detail),t.tags&&(this.config.detail?this.config.detail.tags=t.tags:this.config.detail={tags:t.tags});let i=t.as??"local";if(t.schema==="standalone"){this.standaloneValidator[i]||(this.standaloneValidator[i]=[]);let s=t?.response?typeof t.response=="string"||F in t.response||"~standard"in t.response?{200:t.response}:t?.response:void 0;this.standaloneValidator[i].push({body:t.body,headers:t.headers,params:t.params,query:t.query,response:s,cookie:t.cookie})}else this.validator[i]={body:t.body??this.validator[i]?.body,headers:t.headers??this.validator[i]?.headers,params:t.params??this.validator[i]?.params,query:t.query??this.validator[i]?.query,response:t.response??this.validator[i]?.response,cookie:t.cookie??this.validator[i]?.cookie};return t.parse&&this.on({as:i},"parse",t.parse),t.transform&&this.on({as:i},"transform",t.transform),t.derive&&this.on({as:i},"derive",t.derive),t.beforeHandle&&this.on({as:i},"beforeHandle",t.beforeHandle),t.resolve&&this.on({as:i},"resolve",t.resolve),t.afterHandle&&this.on({as:i},"afterHandle",t.afterHandle),t.mapResponse&&this.on({as:i},"mapResponse",t.mapResponse),t.afterResponse&&this.on({as:i},"afterResponse",t.afterResponse),t.error&&this.on({as:i},"error",t.error),this}return this.guard({},t)}let r=new e({...this.config,prefix:""});r.singleton={...this.singleton},r.definitions={...this.definitions},r.inference=ax(this.inference),r.extender={...this.extender},r.getServer=()=>this.getServer();let o=n(r);if(this.singleton=wn(this.singleton,r.singleton),this.definitions=wn(this.definitions,r.definitions),o.getServer=()=>this.server,o.event.request?.length&&(this.event.request=[...this.event.request||[],...o.event.request||[]]),o.event.mapResponse?.length&&(this.event.mapResponse=[...this.event.mapResponse||[],...o.event.mapResponse||[]]),this.model(o.definitions.type),Object.values(r.router.history).forEach(({method:i,path:s,handler:a,hooks:c})=>{let{body:l,headers:u,query:d,params:p,cookie:m,response:h,...g}=t,y=l||u||d||p||m||h;this.add(i,s,a,Hs(g,{...c||{},error:c.error?Array.isArray(c.error)?[...c.error??[],...o.event.error??[]]:[c.error,...o.event.error??[]]:o.event.error,standaloneValidator:y?[...c.standaloneValidator??[],{body:l,headers:u,query:d,params:p,cookie:m,response:h}]:c.standaloneValidator}))}),r.promisedModules.size>0){let i=r.router.history.length;for(let s of r.promisedModules.promises)this.promisedModules.add(s.then(()=>{let{body:a,headers:c,query:l,params:u,cookie:d,response:p,...m}=t,h=a||c||l||u||d||p,g=i;i=r.router.history.length;for(let y=g;y<r.router.history.length;y++){let{method:b,path:S,handler:P,hooks:E}=r.router.history[y];this.add(b,S,P,Hs(m,{...E||{},error:E.error?Array.isArray(E.error)?[...E.error??[],...o.event.error??[]]:[E.error,...o.event.error??[]]:o.event.error,standaloneValidator:h?[...E.standaloneValidator??[],{body:a,headers:c,query:l,params:u,cookie:d,response:p}]:E.standaloneValidator}))}}))}return this}use(t){if(!t)return this;if(Array.isArray(t)){let n=this;for(let r of t)n=n.use(r);return n}return t instanceof Promise?(this.promisedModules.add(t.then((n)=>{if(typeof n=="function")return n(this);if(n instanceof e)return this._use(n).compile();if(n.constructor?.name==="Elysia")return this._use(n).compile();if(typeof n.default=="function")return n.default(this);if(n.default instanceof e)return this._use(n.default);if(n.constructor?.name==="Elysia")return this._use(n.default);if(n.constructor?.name==="_Elysia")return this._use(n.default);try{return this._use(n.default)}catch(r){throw console.error('Invalid plugin type. Expected Elysia instance, function, or module with "default" as Elysia instance or function that returns Elysia instance.'),r}}).then((n)=>(n&&typeof n.compile=="function"&&n.compile(),n))),this):this._use(t)}propagatePromiseModules(t){if(t.promisedModules.size<=0)return this;for(let n of t.promisedModules.promises)this.promisedModules.add(n.then((r)=>{if(!r)return;let o=this._use(r);return o instanceof Promise?o.then((i)=>{i?i.compile():r.compile()}):r.compile()}));return this}_use(t){if(typeof t=="function"){let o=t(this);return o instanceof Promise?(this.promisedModules.add(o.then((i)=>{if(i instanceof e){i.getServer=()=>this.getServer(),i.getGlobalRoutes=()=>this.getGlobalRoutes(),i.getGlobalDefinitions=()=>this.getGlobalDefinitions(),i.model(this.definitions.type),i.error(this.definitions.error);for(let{method:s,path:a,handler:c,hooks:l}of Object.values(i.router.history))this.add(s,a,c,l,void 0);return i===this?void 0:(this.propagatePromiseModules(i),i)}return typeof i=="function"?i(this):typeof i.default=="function"?i.default(this):this._use(i)}).then((i)=>(i&&typeof i.compile=="function"&&i.compile(),i))),this):o}this.propagatePromiseModules(t);let n=t.config.name,r=t.config.seed;if(t.getParent=()=>this,t.getServer=()=>this.getServer(),t.getGlobalRoutes=()=>this.getGlobalRoutes(),t.getGlobalDefinitions=()=>this.getGlobalDefinitions(),t.standaloneValidator?.scoped&&(this.standaloneValidator.local?this.standaloneValidator.local=this.standaloneValidator.local.concat(t.standaloneValidator.scoped):this.standaloneValidator.local=t.standaloneValidator.scoped),t.standaloneValidator?.global&&(this.standaloneValidator.global?this.standaloneValidator.global=this.standaloneValidator.global.concat(t.standaloneValidator.global):this.standaloneValidator.global=t.standaloneValidator.global),Je(t["~parser"])&&(this["~parser"]={...t["~parser"],...this["~parser"]}),t.setHeaders&&this.headers(t.setHeaders),n){n in this.dependencies||(this.dependencies[n]=[]);let o=r!==void 0?Ka(n+JSON.stringify(r)):0;this.dependencies[n].some(({checksum:i})=>o===i)||(this.extender.macro={...this.extender.macro,...t.extender.macro},this.extender.higherOrderFunctions=this.extender.higherOrderFunctions.concat(t.extender.higherOrderFunctions))}else Je(t.extender.macro)&&(this.extender.macro={...this.extender.macro,...t.extender.macro}),t.extender.higherOrderFunctions.length&&(this.extender.higherOrderFunctions=this.extender.higherOrderFunctions.concat(t.extender.higherOrderFunctions));if(t.extender.higherOrderFunctions.length){vC(this.extender.higherOrderFunctions);let o=[];for(let i=0;i<this.extender.higherOrderFunctions.length;i++){let s=this.extender.higherOrderFunctions[i];s.checksum&&(o.includes(s.checksum)&&(this.extender.higherOrderFunctions.splice(i,1),i--),o.push(s.checksum))}o.length=0}this.inference=Px(this.inference,t.inference),Je(t.singleton.decorator)&&this.decorate(t.singleton.decorator),Je(t.singleton.store)&&this.state(t.singleton.store),Je(t.definitions.type)&&this.model(t.definitions.type),Je(t.definitions.error)&&this.error(t.definitions.error),Je(t.extender.macro)&&(this.extender.macro={...this.extender.macro,...t.extender.macro});for(let{method:o,path:i,handler:s,hooks:a}of Object.values(t.router.history))this.add(o,i,s,a);if(n){n in this.dependencies||(this.dependencies[n]=[]);let o=r!==void 0?Ka(n+JSON.stringify(r)):0;if(this.dependencies[n].some(({checksum:i})=>o===i))return this;this.dependencies[n].push(this.config?.analytic?{name:t.config.name,seed:t.config.seed,checksum:o,dependencies:t.dependencies,stack:t.telemetry?.stack,routes:t.router.history,decorators:t.singleton,store:t.singleton.store,error:t.definitions.error,derive:t.event.transform?.filter((i)=>i?.subType==="derive").map((i)=>({fn:i.toString(),stack:Error().stack??""})),resolve:t.event.transform?.filter((i)=>i?.subType==="resolve").map((i)=>({fn:i.toString(),stack:Error().stack??""}))}:{name:t.config.name,seed:t.config.seed,checksum:o,dependencies:t.dependencies}),Je(t.event)&&(this.event=hC(this.event,yC(t.event),o))}else Je(t.event)&&(this.event=hC(this.event,yC(t.event)));return t.validator.global&&(this.validator.global=Hs(this.validator.global,{...t.validator.global})),t.validator.scoped&&(this.validator.local=Hs(this.validator.local,{...t.validator.scoped})),this}macro(t,n){if(typeof t=="string"&&!n)throw Error("Macro function is required");return typeof t=="string"?this.extender.macro[t]=n:this.extender.macro={...this.extender.macro,...t},this}applyMacro(t,n=t,{iteration:r=0,applied:o={}}={}){if(r>=16)return;let i=this.extender.macro;for(let[s,a]of Object.entries(n)){if(!(s in i))continue;let c=typeof i[s]=="function"?i[s](a):i[s];if(!c||typeof i[s]=="object"&&a===!1)return;let l=Ka(s+JSON.stringify(c.seed??a));if(!(l in o)){o[l]=!0;for(let[u,d]of Object.entries(c))if(u!=="seed"){if(u in gj){mj(t,u,d),delete t[s];continue}if(u==="introspect"){d?.(t),delete t[s];continue}if(u==="detail"){t.detail||(t.detail={}),t.detail=wn(t.detail,d,{mergeArray:!0}),delete t[s];continue}if(u in i){this.applyMacro(t,{[u]:d},{applied:o,iteration:r+1}),delete t[s];continue}switch((u==="derive"||u==="resolve")&&typeof d=="function"&&(d={fn:d,subType:u}),typeof t[u]){case"function":t[u]=[t[u],d];break;case"object":Array.isArray(t[u])?t[u].push(d):t[u]=[t[u],d];break;case"undefined":t[u]=d;break}delete t[s]}}}}mount(t,n,r){if(t instanceof e||typeof t=="function"||t.length===0||t==="/"){let a=typeof t=="function"?t:t instanceof e?t.compile().fetch:n instanceof e?n.compile().fetch:typeof n=="function"?n:(()=>{throw Error("Invalid handler")})(),c=({request:l,path:u})=>a(new Request(rx(l.url,u),l));return this.route("ALL","/*",c,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:a}}),this}let o=n instanceof e?n.compile().fetch:typeof n=="function"?n:(()=>{throw Error("Invalid handler")})(),i=(typeof t=="string"&&this.config.prefix?this.config.prefix+t:t).length-(t.endsWith("*")?1:0),s=({request:a,path:c})=>o(new Request(rx(a.url,c.slice(i)||"/"),a));return this.route("ALL",t,s,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:o}}),this.route("ALL",t+(t.endsWith("/")?"*":"/*"),s,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:o}}),this}get(t,n,r){return this.add("GET",t,n,r),this}post(t,n,r){return this.add("POST",t,n,r),this}put(t,n,r){return this.add("PUT",t,n,r),this}patch(t,n,r){return this.add("PATCH",t,n,r),this}delete(t,n,r){return this.add("DELETE",t,n,r),this}options(t,n,r){return this.add("OPTIONS",t,n,r),this}all(t,n,r){return this.add("ALL",t,n,r),this}head(t,n,r){return this.add("HEAD",t,n,r),this}connect(t,n,r){return this.add("CONNECT",t,n,r),this}route(t,n,r,o){return this.add(t.toUpperCase(),n,r,o,o?.config),this}ws(t,n){return this["~adapter"].ws?this["~adapter"].ws(this,t,n):console.warn("Current adapter doesn't support WebSocket"),this}state(t,n,r){n===void 0?(r=t,t={as:"append"},n=""):r===void 0&&(typeof t=="string"?(r=n,n=t,t={as:"append"}):typeof t=="object"&&(r=n,n=""));let{as:o}=t;if(typeof n!="string")return this;switch(typeof r){case"object":return!r||!Je(r)?this:n?((n in this.singleton.store)?this.singleton.store[n]=wn(this.singleton.store[n],r,{override:o==="override"}):this.singleton.store[n]=r,this):r===null?this:(this.singleton.store=wn(this.singleton.store,r,{override:o==="override"}),this);case"function":return n?(o==="override"||!(n in this.singleton.store))&&(this.singleton.store[n]=r):this.singleton.store=r(this.singleton.store),this;default:return(o==="override"||!(n in this.singleton.store))&&(this.singleton.store[n]=r),this}}decorate(t,n,r){n===void 0?(r=t,t={as:"append"},n=""):r===void 0&&(typeof t=="string"?(r=n,n=t,t={as:"append"}):typeof t=="object"&&(r=n,n=""));let{as:o}=t;if(typeof n!="string")return this;switch(typeof r){case"object":return n?((n in this.singleton.decorator)?this.singleton.decorator[n]=wn(this.singleton.decorator[n],r,{override:o==="override"}):this.singleton.decorator[n]=r,this):r===null?this:(this.singleton.decorator=wn(this.singleton.decorator,r,{override:o==="override"}),this);case"function":return n?(o==="override"||!(n in this.singleton.decorator))&&(this.singleton.decorator[n]=r):this.singleton.decorator=r(this.singleton.decorator),this;default:return(o==="override"||!(n in this.singleton.decorator))&&(this.singleton.decorator[n]=r),this}}derive(t,n){n||(n=t,t={as:"local"});let r={subType:"derive",fn:n};return this.onTransform(t,r)}model(t,n){let r=(o)=>{let i={};for(let s in o)"~standard"in o[s]||(i[s]=o[s]);return i};switch(typeof t){case"object":let o={},i=Object.entries(t);if(!i.length)return this;for(let[c,l]of i)c in this.definitions.type||("~standard"in l?this.definitions.type[c]=l:(o[c]=this.definitions.type[c]=l,o[c].$id??=`#/components/schemas/${c}`));return this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,...o}),this;case"function":let s=t(this.definitions.type);return this.definitions.type=s,this.definitions.typebox=X.Module(r(s)),this;case"string":if(!n)break;if(this.definitions.type[t]=n,"~standard"in n)return this;let a={...n,id:n.$id??`#/components/schemas/${t}`};return this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,...a}),this}return n?(this.definitions.type[t]=n,("~standard"in n)?this:(this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,[t]:n}),this)):this}Ref(t){return X.Ref(t)}mapDerive(t,n){n||(n=t,t={as:"local"});let r={subType:"mapDerive",fn:n};return this.onTransform(t,r)}affix(t,n,r){if(r==="")return this;let o=["_","-"," "],i=(l)=>l[0].toUpperCase()+l.slice(1),s=t==="prefix"?(l,u)=>o.includes(l.at(-1)??"")?l+u:l+i(u):o.includes(r.at(-1)??"")?(l,u)=>u+l:(l,u)=>u+i(l),a=(l)=>{let u={};switch(l){case"decorator":for(let d in this.singleton.decorator)u[s(r,d)]=this.singleton.decorator[d];this.singleton.decorator=u;break;case"state":for(let d in this.singleton.store)u[s(r,d)]=this.singleton.store[d];this.singleton.store=u;break;case"model":for(let d in this.definitions.type)u[s(r,d)]=this.definitions.type[d];this.definitions.type=u;break;case"error":for(let d in this.definitions.error)u[s(r,d)]=this.definitions.error[d];this.definitions.error=u;break}},c=Array.isArray(n)?n:[n];for(let l of c.some((u)=>u==="all")?["decorator","state","model","error"]:c)a(l);return this}prefix(t,n){return this.affix("prefix",t,n)}suffix(t,n){return this.affix("suffix",t,n)}compile(){return this["~adapter"].beforeCompile?.(this),this["~adapter"].isWebStandard?(this._handle=this.config.aot?Kx(this):fM(this),Object.defineProperty(this,"fetch",{value:this._handle,configurable:!0,writable:!0}),typeof this.server?.reload=="function"&&this.server.reload({...this.server||{},fetch:this.fetch}),this):(typeof this.server?.reload=="function"&&this.server.reload(this.server||{}),this._handle=Kx(this),this)}get fetch(){let t=this.config.aot?Kx(this):fM(this);return Object.defineProperty(this,"fetch",{value:t,configurable:!0,writable:!0}),t}get modules(){return this.promisedModules}},fi=GMe;var df={name:"@kabmo-labs/kabmo",version:"0.59.0",description:"Web console and diagnostic workbench for AI coding agents: Elysia + Preact on Bun.",license:"MIT",author:"Wijanarko Putra Rajeb <wijanarko.rajeb@gmail.com>",type:"module",engines:{bun:">=1.4.0"},publishConfig:{access:"public"},bin:{kabmo:"./src/cli/kabmo.js"},repository:{type:"git",url:"git+https://github.com/kabmo-labs/kabmo.git"},homepage:"https://github.com/kabmo-labs/kabmo#readme",bugs:{url:"https://github.com/kabmo-labs/kabmo/issues"},keywords:["kabmo","coding-agent","agent","console","elysia","preact","bun"],files:["src","extensions","index.html","bunfig.toml","public","tsconfig.json","marketplace","dist/client"],scripts:{dev:"bun run --hot src/server/index.ts --kabmo-server","dev:lan":"HOST=0.0.0.0 bun run --hot src/server/index.ts --kabmo-server",build:"bun run scripts/build-client.ts","editor:themes":"bun run scripts/editor-themes.mjs","icons:tints":"bun run scripts/icon-tints.mjs","icons:tints:check":"bun run scripts/icon-tints.mjs --check","tray:icons":"bun run scripts/tray-icon.mjs","tray:icons:check":"bun run scripts/tray-icon.mjs --check","editor:themes:check":"bun run scripts/editor-themes.mjs --check","omp:schema":"bun run scripts/omp-schema.mjs","omp:schema:check":"bun run scripts/omp-schema.mjs --check",start:"NODE_ENV=production bun run src/server/index.ts --kabmo-server",typecheck:"tsc",clean:"rm -rf dist",lint:"tsc --noEmit","check:fast":"bun check --no-script",test:"bun test","test:e2e":"playwright test --config tests/e2e/playwright.config.ts","readme:media":"bun run scripts/readme-media.ts","shell:wordmark":"bun run scripts/shell-wordmark.mjs","shell:docs":"bun run scripts/shell-document-types.mjs --write","shell:docs:check":"bun run scripts/shell-document-types.mjs --check","typecheck:e2e":"tsc --noEmit -p tests/e2e","typecheck:consumer":"tsc --noEmit -p tsconfig.consumer.json","publish:plugins":"bash .github/scripts/publish-plugin-packages.sh packages/kabmo-sdk packages/kabmo-ui"},dependencies:{"@codemirror/autocomplete":"6.20.4","@codemirror/commands":"6.11.1","@codemirror/language":"6.13.1","@codemirror/legacy-modes":"^6.5.5","@codemirror/lint":"^6.9.7","@codemirror/merge":"6.12.3","@codemirror/search":"6.7.2","@codemirror/state":"6.7.6","@codemirror/view":"6.43.15","@dskripchenko/drawio":"^0.1.0","@fontsource/fira-code":"^5.3.0","@shikijs/langs":"^4.4.3","@shikijs/themes":"^4.4.3","@tailwindcss/postcss":"^4.1.14",dompurify:"^3.4.15",elysia:"^1.4.30","ghostty-web":"0.4.0-next.21.g640db46","jsonc-parser":"^3.3.1",katex:"^0.18.7","lucide-preact":"^1.47.0",mammoth:"^1.13.0",marked:"^18.0.11","marked-linkify-it":"^4.0.2",mermaid:"^12.0.0",postcss:"^8.5.16",preact:"^10.29.8","qrcode-generator":"^2.0.4",remend:"^1.3.1",ripgrep:"^0.3.1","sherpa-onnx-node":"^2.0.2",shiki:"^4.4.3","smol-toml":"^1.9.1",tailwindcss:"^4.1.14",xlsx:"https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",yaml:"^2.9.1","@kabmo-labs/kabmo-acp":"workspace:*","@kabmo-labs/kabmo-app-contracts":"workspace:*","@kabmo-labs/kabmo-auth":"workspace:*","@kabmo-labs/kabmo-bytes":"workspace:*","@kabmo-labs/kabmo-chat":"workspace:*","@kabmo-labs/kabmo-db":"workspace:*","@kabmo-labs/kabmo-format":"workspace:*","@kabmo-labs/kabmo-fs":"workspace:*","@kabmo-labs/kabmo-git":"workspace:*","@kabmo-labs/kabmo-guards":"workspace:*","@kabmo-labs/kabmo-harness":"workspace:*","@kabmo-labs/kabmo-http":"workspace:*","@kabmo-labs/kabmo-idle-reaper":"workspace:*","@kabmo-labs/kabmo-live-sessions":"workspace:*","@kabmo-labs/kabmo-mcp-contracts":"workspace:*","@kabmo-labs/kabmo-model-contracts":"workspace:*","@kabmo-labs/kabmo-omp":"workspace:*","@kabmo-labs/kabmo-paths":"workspace:*","@kabmo-labs/kabmo-platform":"workspace:*","@kabmo-labs/kabmo-process":"workspace:*","@kabmo-labs/kabmo-provider-contracts":"workspace:*","@kabmo-labs/kabmo-realtime-signals":"workspace:*","@kabmo-labs/kabmo-refresh-cadence":"workspace:*","@kabmo-labs/kabmo-rpc-lines":"workspace:*","@kabmo-labs/kabmo-runtime-flags":"workspace:*","@kabmo-labs/kabmo-sdk":"workspace:*","@kabmo-labs/kabmo-session":"workspace:*","@kabmo-labs/kabmo-settings":"workspace:*","@kabmo-labs/kabmo-ui":"workspace:*","@kabmo-labs/kabmo-workspace":"workspace:*","@kabmo-labs/kabmo-worktree":"workspace:*"},devDependencies:{"@playwright/test":"^1.64.0","@semantic-release/changelog":"^7.0.0","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^11.0.1","@semantic-release/github":"^12.0.10","@semantic-release/npm":"^13.2.0","@semantic-release/release-notes-generator":"^14.1.1","@types/bun":"1.4.4","@types/node":"^22.14.0","@types/qrcode-generator":"^0.0.16","bun-types":"1.4.4","conventional-changelog-conventionalcommits":"^9.3.1","happy-dom":"^20.14.5",jsqr:"^1.4.0","semantic-release":"^25.0.9",typescript:"~5.8.2"},overrides:{katex:"^0.18.7"},workspaces:["packages/*"],"$comment-workspaces":"Only `packages/*` are Bun workspaces. The native shells live in `apps/` and the sound and QR inputs in `assets/`; they have no package.json, so they are never installed, published or typechecked as libraries."};function Vx(e,t,n){let r=e.headers.get("if-none-match");if(r!==null){if(!t)return!1;let i=t.trim().replace(/^W\//,"");return r.split(",").some((s)=>s.trim().replace(/^W\//,"")===i)}let o=e.headers.get("if-modified-since");if(o&&n!==null){let i=Date.parse(o);if(!Number.isNaN(i))return Math.floor(n/1000)*1000<=i}return!1}import{brotliCompressSync as _Me,constants as VMe}from"zlib";function Uo(e){if(e.buffer instanceof ArrayBuffer)return e;return new Uint8Array(e)}var hM=1024,MH=/^(text\/|application\/(json|javascript|xml|wasm|svg))/,zMe=["zstd","br","gzip"];function OH(e){return MH.test(e)}function yM(e){if(!e)return null;for(let t of zMe)if(e.includes(t))return t;return null}function bM(e,t){if(t==="zstd")return Uo(Bun.zstdCompressSync(e,{level:3}));if(t==="br")return Uo(_Me(e,{params:{[VMe.BROTLI_PARAM_QUALITY]:4}}));return Uo(Bun.gzipSync(e,{level:6}))}async function Vs(e,t){if(!t)return e;let n=e.headers.get("content-type")??"";if(n.includes("text/event-stream"))return e;if(!MH.test(n))return e;if(e.status===204||e.status===304)return e;let r=yM(t);if(!r)return e;let o=Uo(new Uint8Array(await e.arrayBuffer()));if(o.byteLength<hM)return JMe(e,o);let i=bM(o,r),s=new Headers(e.headers);return s.set("content-encoding",r),s.set("content-length",String(i.byteLength)),s.append("vary","accept-encoding"),new Response(i,{status:e.status,headers:s})}function JMe(e,t){return new Response(t,{status:e.status,headers:e.headers})}var ec=Bun.env.NODE_ENV!=="production",LH="/_bun/",DH=["/_bun/client/","/_bun/asset/"],wM="/_dev-assets/",NH="no-cache";function FH(e){let t=e;for(let n of DH)t=t.replaceAll(n,wM+n.slice(LH.length));return t}function SM(e){if(!e.startsWith(wM))return null;let t=LH+e.slice(wM.length);return DH.some((n)=>t.startsWith(n))?t:null}async function UH(e,t,n,r={}){let o=SM(t);if(!o)return null;let i=await fetch(new URL(o,n),r),s=i.headers.get("content-type")??"";if(!i.ok||s.startsWith("text/html"))return new Response(`No dev asset at ${o}
|
|
666
|
+
`))}return this}wrap(t){return this.extender.higherOrderFunctions.push({checksum:Ka(JSON.stringify({name:this.config.name,seed:this.config.seed,content:t.toString()})),fn:t}),this}get models(){let t={};for(let n of Object.keys(this.definitions.type))t[n]=Qt(this.definitions.typebox.Import(n),{models:this.definitions.type});return t.modules=this.definitions.typebox,t}add(t,n,r,o,i){let s=i?.skipPrefix??!1,a=i?.allowMeta??!1;o??={},this.applyMacro(o);let c=[];if(o.standaloneValidator&&(c=c.concat(o.standaloneValidator)),this.standaloneValidator.local&&(c=c.concat(this.standaloneValidator.local)),this.standaloneValidator.scoped&&(c=c.concat(this.standaloneValidator.scoped)),this.standaloneValidator.global&&(c=c.concat(this.standaloneValidator.global)),n!==""&&n.charCodeAt(0)!==47&&(n="/"+n),this.config.prefix&&!s&&(n=this.config.prefix+n),o?.type)switch(o.type){case"text":o.type="text/plain";break;case"json":o.type="application/json";break;case"formdata":o.type="multipart/form-data";break;case"urlencoded":o.type="application/x-www-form-urlencoded";break;case"arrayBuffer":o.type="application/octet-stream";break;default:break}let l=this.validator.getCandidate(),u={body:o?.body??l?.body,headers:o?.headers??l?.headers,params:o?.params??l?.params,query:o?.query??l?.query,cookie:o?.cookie??l?.cookie,response:o?.response??l?.response},d=this.config.precompile===!0||typeof this.config.precompile=="object"&&this.config.precompile.compose===!0,p=()=>{let A=this.definitions.type,N=!this.config.aot,O=this.config.normalize,H=this.definitions.typebox,z=()=>this.config.sanitize,te=()=>{if(u.cookie||c.find((Y)=>Y.cookie))return mH({modules:H,validator:u.cookie,defaultConfig:this.config.cookie,normalize:O,config:u.cookie?.config??{},dynamic:N,models:A,validators:c.map((Y)=>Y.cookie),sanitize:z})};return d?{body:Qt(u.body,{modules:H,dynamic:N,models:A,normalize:O,additionalCoerce:(()=>{let Y=sM(u.body,A,H);return Y&&F in Y&&(Gn("File",Y)||Gn("Files",Y))?oM():cb()})(),validators:c.map((Y)=>Y.body),sanitize:z}),headers:Qt(u.headers,{modules:H,dynamic:N,models:A,additionalProperties:!0,coerce:!0,additionalCoerce:vd(),validators:c.map((Y)=>Y.headers),sanitize:z}),params:Qt(u.params,{modules:H,dynamic:N,models:A,coerce:!0,additionalCoerce:vd(),validators:c.map((Y)=>Y.params),sanitize:z}),query:Qt(u.query,{modules:H,dynamic:N,models:A,normalize:O,coerce:!0,additionalCoerce:rM(),validators:c.map((Y)=>Y.query),sanitize:z}),cookie:te(),response:Hx(u.response,{modules:H,dynamic:N,models:A,normalize:O,validators:c.map((Y)=>Y.response),sanitize:z})}:{createBody(){return this.body?this.body:this.body=Qt(u.body,{modules:H,dynamic:N,models:A,normalize:O,additionalCoerce:(()=>{let Y=sM(u.body,A,H);return Y&&F in Y&&(Gn("File",Y)||Gn("Files",Y))?oM():cb()})(),validators:c.map((Y)=>Y.body),sanitize:z})},createHeaders(){return this.headers?this.headers:this.headers=Qt(u.headers,{modules:H,dynamic:N,models:A,normalize:O,additionalProperties:!O,coerce:!0,additionalCoerce:vd(),validators:c.map((Y)=>Y.headers),sanitize:z})},createParams(){return this.params?this.params:this.params=Qt(u.params,{modules:H,dynamic:N,models:A,normalize:O,coerce:!0,additionalCoerce:vd(),validators:c.map((Y)=>Y.params),sanitize:z})},createQuery(){return this.query?this.query:this.query=Qt(u.query,{modules:H,dynamic:N,models:A,normalize:O,coerce:!0,additionalCoerce:rM(),validators:c.map((Y)=>Y.query),sanitize:z})},createCookie(){return this.cookie?this.cookie:this.cookie=te()},createResponse(){return this.response?this.response:this.response=Hx(u.response,{modules:H,dynamic:N,models:A,normalize:O,validators:c.map((Y)=>Y.response),sanitize:z})}}};(l.body||l.cookie||l.headers||l.params||l.query||l.response)&&(o=Hs(o,l)),o.tags&&(o.detail?o.detail.tags=o.tags:o.detail={tags:o.tags}),Je(this.config.detail)&&(o.detail=wn(Object.assign({},this.config.detail),o.detail));let m=Je(this.event)?Hs(this.event,SC(o)):{...dj(SC(o))};if(c.length&&Object.assign(m,{standaloneValidator:c}),this.config.aot===!1){let A=p();this.router.dynamic.add(t,n,{validator:A,hooks:m,content:o?.type,handle:r,route:n});let N=ld(n,{dynamic:!0});if(n!==N&&this.router.dynamic.add(t,N,{validator:A,hooks:m,content:o?.type,handle:r,route:n}),!this.config.strictPath){let O=cd(n);this.router.dynamic.add(t,O,{validator:A,hooks:m,content:o?.type,handle:r,route:n});let H=ld(O);O!==H&&this.router.dynamic.add(t,O,{validator:A,hooks:m,content:o?.type,handle:r,route:n})}this.router.history.push({method:t,path:n,composed:null,handler:r,compile:void 0,hooks:m});return}let h=this["~adapter"].handler,g=typeof r!="function"?()=>{let A=h.createNativeStaticHandler?.(r,m,{headers:Object.assign({},this.setHeaders)});return A instanceof Promise?A.then((N)=>{if(N)return N}):A?.()}:void 0,y=this.config.nativeStaticResponse===!0,b=(A)=>{!y||!g||(cx?this.router.response[A]?this.router.response[A][t]=g():this.router.response[A]={[t]:g()}:this.router.response[A]=g())};b(n);let S,P=()=>{if(S)return S;let A=gH({app:this,path:n,method:t,hooks:m,validator:p(),handler:typeof r!="function"&&typeof h.createStaticHandler!="function"?()=>r:r,allowMeta:a,inference:this.inference});return this.router.history[T]&&(S=this.router.history[T].composed=A),A},E;if(`${t}_${n}`in this.routeTree)for(let A=0;A<this.router.history.length;A++){let N=this.router.history[A];if(N.path===n&&N.method===t){E=A;break}}else this.routeTree[`${t}_${n}`]=this.router.history.length;let T=E??this.router.history.length,I=this.router.history,v=d?P():(A)=>S?S(A):(I[T].composed=P())(A);E!==void 0?this.router.history[E]=Object.assign({method:t,path:n,composed:v,compile:P,handler:r,hooks:m},c.length?{standaloneValidators:c}:void 0,o.webSocket?{websocket:o.websocket}:void 0):this.router.history.push(Object.assign({method:t,path:n,composed:v,compile:P,handler:r,hooks:m},o.webSocket?{websocket:o.websocket}:void 0));let x={handler:d?I[T].composed:void 0,compile(){return this.handler=P()}},R=this.router.static,C=n.indexOf(":")===-1&&n.indexOf("*")===-1;if(t==="WS"){if(C){n in R?R[n][t]=T:R[n]={[t]:T};return}this.router.http.add("WS",n,x),this.config.strictPath||this.router.http.add("WS",cd(n),x);let A=ld(n,{dynamic:!0});n!==A&&this.router.http.add("WS",A,x);return}if(C)n in R?R[n][t]=T:R[n]={[t]:T},this.config.strictPath||b(cd(n));else{if(this.router.http.add(t,n,x),!this.config.strictPath){let N=cd(n);b(N),this.router.http.add(t,N,x)}let A=ld(n,{dynamic:!0});n!==A&&(this.router.http.add(t,A,x),b(A))}}headers(t){return t?(this.setHeaders||(this.setHeaders={}),this.setHeaders=wn(this.setHeaders,t),this):this}onStart(t){return this.on("start",t),this}onRequest(t){return this.on("request",t),this}onParse(t,n){return n?this.on(t,"parse",n):typeof t=="string"?this.on("parse",this["~parser"][t]):this.on("parse",t)}parser(t,n){return this["~parser"][t]=n,this}onTransform(t,n){return n?this.on(t,"transform",n):this.on("transform",t)}resolve(t,n){n||(n=t,t={as:"local"});let r={subType:"resolve",fn:n};return this.onBeforeHandle(t,r)}mapResolve(t,n){n||(n=t,t={as:"local"});let r={subType:"mapResolve",fn:n};return this.onBeforeHandle(t,r)}onBeforeHandle(t,n){return n?this.on(t,"beforeHandle",n):this.on("beforeHandle",t)}onAfterHandle(t,n){return n?this.on(t,"afterHandle",n):this.on("afterHandle",t)}mapResponse(t,n){return n?this.on(t,"mapResponse",n):this.on("mapResponse",t)}onAfterResponse(t,n){return n?this.on(t,"afterResponse",n):this.on("afterResponse",t)}trace(t,n){n||(n=t,t={as:"local"}),Array.isArray(n)||(n=[n]);for(let r of n)this.on(t,"trace",sH(r));return this}error(t,n){switch(typeof t){case"string":return n.prototype[ud]=t,this.definitions.error[t]=n,this;case"function":return this.definitions.error=t(this.definitions.error),this}for(let[r,o]of Object.entries(t))o.prototype[ud]=r,this.definitions.error[r]=o;return this}onError(t,n){return n?this.on(t,"error",n):this.on("error",t)}onStop(t){return this.on("stop",t),this}on(t,n,r){let o;switch(typeof t){case"string":o=t,r=n;break;case"object":o=n,!Array.isArray(n)&&typeof n=="object"&&(r=n);break}Array.isArray(r)?r=bn(r):typeof r=="function"?r=[{fn:r}]:r=[r];let i=r;for(let s of i)s.scope=typeof t=="string"?"local":t?.as??"local",(o==="resolve"||o==="derive")&&(s.subType=o);o!=="trace"&&(this.inference=wd({[o]:i.map((s)=>s.fn)},this.inference,this.config.sucrose));for(let s of i){let a=pj(s,"global",{skipIfHasType:!0});switch((this.config.name||this.config.seed)&&(a.checksum=Ka(this.config.name+JSON.stringify(this.config.seed))),o){case"start":this.event.start??=[],this.event.start.push(a);break;case"request":this.event.request??=[],this.event.request.push(a);break;case"parse":this.event.parse??=[],this.event.parse.push(a);break;case"transform":this.event.transform??=[],this.event.transform.push(a);break;case"derive":this.event.transform??=[],this.event.transform.push(bn(a,"derive"));break;case"beforeHandle":this.event.beforeHandle??=[],this.event.beforeHandle.push(a);break;case"resolve":this.event.beforeHandle??=[],this.event.beforeHandle.push(bn(a,"resolve"));break;case"afterHandle":this.event.afterHandle??=[],this.event.afterHandle.push(a);break;case"mapResponse":this.event.mapResponse??=[],this.event.mapResponse.push(a);break;case"afterResponse":this.event.afterResponse??=[],this.event.afterResponse.push(a);break;case"trace":this.event.trace??=[],this.event.trace.push(a);break;case"error":this.event.error??=[],this.event.error.push(a);break;case"stop":this.event.stop??=[],this.event.stop.push(a);break}}return this}as(t){return _a(this.event.parse,t),_a(this.event.transform,t),_a(this.event.beforeHandle,t),_a(this.event.afterHandle,t),_a(this.event.mapResponse,t),_a(this.event.afterResponse,t),_a(this.event.trace,t),_a(this.event.error,t),t==="scoped"?(this.validator.scoped=qm(this.validator.scoped,this.validator.local),this.validator.local=null,this.standaloneValidator.local!==null&&(this.standaloneValidator.scoped||=[],this.standaloneValidator.scoped.push(...this.standaloneValidator.local),this.standaloneValidator.local=null)):t==="global"&&(this.validator.global=qm(this.validator.global,qm(this.validator.scoped,this.validator.local)),this.validator.scoped=null,this.validator.local=null,this.standaloneValidator.local!==null&&(this.standaloneValidator.scoped||=[],this.standaloneValidator.scoped.push(...this.standaloneValidator.local),this.standaloneValidator.local=null),this.standaloneValidator.scoped!==null&&(this.standaloneValidator.global||=[],this.standaloneValidator.global.push(...this.standaloneValidator.scoped),this.standaloneValidator.scoped=null)),this}group(t,n,r){let o=new e({...this.config,prefix:""});o.singleton={...this.singleton},o.definitions={...this.definitions},o.getServer=()=>this.getServer(),o.inference=ax(this.inference),o.extender={...this.extender},o["~parser"]=this["~parser"],o.standaloneValidator={local:[...this.standaloneValidator.local??[]],scoped:[...this.standaloneValidator.scoped??[]],global:[...this.standaloneValidator.global??[]]};let i=typeof n=="object",s=(i?r:n)(o);return this.singleton=wn(this.singleton,o.singleton),this.definitions=wn(this.definitions,o.definitions),s.event.request?.length&&(this.event.request=[...this.event.request||[],...s.event.request||[]]),s.event.mapResponse?.length&&(this.event.mapResponse=[...this.event.mapResponse||[],...s.event.mapResponse||[]]),this.model(s.definitions.type),Object.values(o.router.history).forEach(({method:a,path:c,handler:l,hooks:u})=>{if(c=(i?"":this.config.prefix??"")+t+c,i){let{body:d,headers:p,query:m,params:h,cookie:g,response:y,...b}=n,S=u;this.applyMacro(b);let P=d||p||m||h||g||y;this.add(a,c,l,Hs(b,{...S||{},error:S.error?Array.isArray(S.error)?[...S.error??[],...s.event.error??[]]:[S.error,...s.event.error??[]]:s.event.error,standaloneValidator:b.standaloneValidator||S.standaloneValidator||P?[...b.standaloneValidator??[],...S.standaloneValidator??[],...P?[{body:d,headers:p,query:m,params:h,cookie:g,response:y}]:[]]:void 0}),void 0)}else this.add(a,c,l,Hs(u,{error:s.event.error}),{skipPrefix:!0})}),this}guard(t,n){if(!n){if(typeof t=="object"){this.applyMacro(t),t.detail&&(this.config.detail?this.config.detail=wn(Object.assign({},this.config.detail),t.detail):this.config.detail=t.detail),t.tags&&(this.config.detail?this.config.detail.tags=t.tags:this.config.detail={tags:t.tags});let i=t.as??"local";if(t.schema==="standalone"){this.standaloneValidator[i]||(this.standaloneValidator[i]=[]);let s=t?.response?typeof t.response=="string"||F in t.response||"~standard"in t.response?{200:t.response}:t?.response:void 0;this.standaloneValidator[i].push({body:t.body,headers:t.headers,params:t.params,query:t.query,response:s,cookie:t.cookie})}else this.validator[i]={body:t.body??this.validator[i]?.body,headers:t.headers??this.validator[i]?.headers,params:t.params??this.validator[i]?.params,query:t.query??this.validator[i]?.query,response:t.response??this.validator[i]?.response,cookie:t.cookie??this.validator[i]?.cookie};return t.parse&&this.on({as:i},"parse",t.parse),t.transform&&this.on({as:i},"transform",t.transform),t.derive&&this.on({as:i},"derive",t.derive),t.beforeHandle&&this.on({as:i},"beforeHandle",t.beforeHandle),t.resolve&&this.on({as:i},"resolve",t.resolve),t.afterHandle&&this.on({as:i},"afterHandle",t.afterHandle),t.mapResponse&&this.on({as:i},"mapResponse",t.mapResponse),t.afterResponse&&this.on({as:i},"afterResponse",t.afterResponse),t.error&&this.on({as:i},"error",t.error),this}return this.guard({},t)}let r=new e({...this.config,prefix:""});r.singleton={...this.singleton},r.definitions={...this.definitions},r.inference=ax(this.inference),r.extender={...this.extender},r.getServer=()=>this.getServer();let o=n(r);if(this.singleton=wn(this.singleton,r.singleton),this.definitions=wn(this.definitions,r.definitions),o.getServer=()=>this.server,o.event.request?.length&&(this.event.request=[...this.event.request||[],...o.event.request||[]]),o.event.mapResponse?.length&&(this.event.mapResponse=[...this.event.mapResponse||[],...o.event.mapResponse||[]]),this.model(o.definitions.type),Object.values(r.router.history).forEach(({method:i,path:s,handler:a,hooks:c})=>{let{body:l,headers:u,query:d,params:p,cookie:m,response:h,...g}=t,y=l||u||d||p||m||h;this.add(i,s,a,Hs(g,{...c||{},error:c.error?Array.isArray(c.error)?[...c.error??[],...o.event.error??[]]:[c.error,...o.event.error??[]]:o.event.error,standaloneValidator:y?[...c.standaloneValidator??[],{body:l,headers:u,query:d,params:p,cookie:m,response:h}]:c.standaloneValidator}))}),r.promisedModules.size>0){let i=r.router.history.length;for(let s of r.promisedModules.promises)this.promisedModules.add(s.then(()=>{let{body:a,headers:c,query:l,params:u,cookie:d,response:p,...m}=t,h=a||c||l||u||d||p,g=i;i=r.router.history.length;for(let y=g;y<r.router.history.length;y++){let{method:b,path:S,handler:P,hooks:E}=r.router.history[y];this.add(b,S,P,Hs(m,{...E||{},error:E.error?Array.isArray(E.error)?[...E.error??[],...o.event.error??[]]:[E.error,...o.event.error??[]]:o.event.error,standaloneValidator:h?[...E.standaloneValidator??[],{body:a,headers:c,query:l,params:u,cookie:d,response:p}]:E.standaloneValidator}))}}))}return this}use(t){if(!t)return this;if(Array.isArray(t)){let n=this;for(let r of t)n=n.use(r);return n}return t instanceof Promise?(this.promisedModules.add(t.then((n)=>{if(typeof n=="function")return n(this);if(n instanceof e)return this._use(n).compile();if(n.constructor?.name==="Elysia")return this._use(n).compile();if(typeof n.default=="function")return n.default(this);if(n.default instanceof e)return this._use(n.default);if(n.constructor?.name==="Elysia")return this._use(n.default);if(n.constructor?.name==="_Elysia")return this._use(n.default);try{return this._use(n.default)}catch(r){throw console.error('Invalid plugin type. Expected Elysia instance, function, or module with "default" as Elysia instance or function that returns Elysia instance.'),r}}).then((n)=>(n&&typeof n.compile=="function"&&n.compile(),n))),this):this._use(t)}propagatePromiseModules(t){if(t.promisedModules.size<=0)return this;for(let n of t.promisedModules.promises)this.promisedModules.add(n.then((r)=>{if(!r)return;let o=this._use(r);return o instanceof Promise?o.then((i)=>{i?i.compile():r.compile()}):r.compile()}));return this}_use(t){if(typeof t=="function"){let o=t(this);return o instanceof Promise?(this.promisedModules.add(o.then((i)=>{if(i instanceof e){i.getServer=()=>this.getServer(),i.getGlobalRoutes=()=>this.getGlobalRoutes(),i.getGlobalDefinitions=()=>this.getGlobalDefinitions(),i.model(this.definitions.type),i.error(this.definitions.error);for(let{method:s,path:a,handler:c,hooks:l}of Object.values(i.router.history))this.add(s,a,c,l,void 0);return i===this?void 0:(this.propagatePromiseModules(i),i)}return typeof i=="function"?i(this):typeof i.default=="function"?i.default(this):this._use(i)}).then((i)=>(i&&typeof i.compile=="function"&&i.compile(),i))),this):o}this.propagatePromiseModules(t);let n=t.config.name,r=t.config.seed;if(t.getParent=()=>this,t.getServer=()=>this.getServer(),t.getGlobalRoutes=()=>this.getGlobalRoutes(),t.getGlobalDefinitions=()=>this.getGlobalDefinitions(),t.standaloneValidator?.scoped&&(this.standaloneValidator.local?this.standaloneValidator.local=this.standaloneValidator.local.concat(t.standaloneValidator.scoped):this.standaloneValidator.local=t.standaloneValidator.scoped),t.standaloneValidator?.global&&(this.standaloneValidator.global?this.standaloneValidator.global=this.standaloneValidator.global.concat(t.standaloneValidator.global):this.standaloneValidator.global=t.standaloneValidator.global),Je(t["~parser"])&&(this["~parser"]={...t["~parser"],...this["~parser"]}),t.setHeaders&&this.headers(t.setHeaders),n){n in this.dependencies||(this.dependencies[n]=[]);let o=r!==void 0?Ka(n+JSON.stringify(r)):0;this.dependencies[n].some(({checksum:i})=>o===i)||(this.extender.macro={...this.extender.macro,...t.extender.macro},this.extender.higherOrderFunctions=this.extender.higherOrderFunctions.concat(t.extender.higherOrderFunctions))}else Je(t.extender.macro)&&(this.extender.macro={...this.extender.macro,...t.extender.macro}),t.extender.higherOrderFunctions.length&&(this.extender.higherOrderFunctions=this.extender.higherOrderFunctions.concat(t.extender.higherOrderFunctions));if(t.extender.higherOrderFunctions.length){vC(this.extender.higherOrderFunctions);let o=[];for(let i=0;i<this.extender.higherOrderFunctions.length;i++){let s=this.extender.higherOrderFunctions[i];s.checksum&&(o.includes(s.checksum)&&(this.extender.higherOrderFunctions.splice(i,1),i--),o.push(s.checksum))}o.length=0}this.inference=Px(this.inference,t.inference),Je(t.singleton.decorator)&&this.decorate(t.singleton.decorator),Je(t.singleton.store)&&this.state(t.singleton.store),Je(t.definitions.type)&&this.model(t.definitions.type),Je(t.definitions.error)&&this.error(t.definitions.error),Je(t.extender.macro)&&(this.extender.macro={...this.extender.macro,...t.extender.macro});for(let{method:o,path:i,handler:s,hooks:a}of Object.values(t.router.history))this.add(o,i,s,a);if(n){n in this.dependencies||(this.dependencies[n]=[]);let o=r!==void 0?Ka(n+JSON.stringify(r)):0;if(this.dependencies[n].some(({checksum:i})=>o===i))return this;this.dependencies[n].push(this.config?.analytic?{name:t.config.name,seed:t.config.seed,checksum:o,dependencies:t.dependencies,stack:t.telemetry?.stack,routes:t.router.history,decorators:t.singleton,store:t.singleton.store,error:t.definitions.error,derive:t.event.transform?.filter((i)=>i?.subType==="derive").map((i)=>({fn:i.toString(),stack:Error().stack??""})),resolve:t.event.transform?.filter((i)=>i?.subType==="resolve").map((i)=>({fn:i.toString(),stack:Error().stack??""}))}:{name:t.config.name,seed:t.config.seed,checksum:o,dependencies:t.dependencies}),Je(t.event)&&(this.event=hC(this.event,yC(t.event),o))}else Je(t.event)&&(this.event=hC(this.event,yC(t.event)));return t.validator.global&&(this.validator.global=Hs(this.validator.global,{...t.validator.global})),t.validator.scoped&&(this.validator.local=Hs(this.validator.local,{...t.validator.scoped})),this}macro(t,n){if(typeof t=="string"&&!n)throw Error("Macro function is required");return typeof t=="string"?this.extender.macro[t]=n:this.extender.macro={...this.extender.macro,...t},this}applyMacro(t,n=t,{iteration:r=0,applied:o={}}={}){if(r>=16)return;let i=this.extender.macro;for(let[s,a]of Object.entries(n)){if(!(s in i))continue;let c=typeof i[s]=="function"?i[s](a):i[s];if(!c||typeof i[s]=="object"&&a===!1)return;let l=Ka(s+JSON.stringify(c.seed??a));if(!(l in o)){o[l]=!0;for(let[u,d]of Object.entries(c))if(u!=="seed"){if(u in gj){mj(t,u,d),delete t[s];continue}if(u==="introspect"){d?.(t),delete t[s];continue}if(u==="detail"){t.detail||(t.detail={}),t.detail=wn(t.detail,d,{mergeArray:!0}),delete t[s];continue}if(u in i){this.applyMacro(t,{[u]:d},{applied:o,iteration:r+1}),delete t[s];continue}switch((u==="derive"||u==="resolve")&&typeof d=="function"&&(d={fn:d,subType:u}),typeof t[u]){case"function":t[u]=[t[u],d];break;case"object":Array.isArray(t[u])?t[u].push(d):t[u]=[t[u],d];break;case"undefined":t[u]=d;break}delete t[s]}}}}mount(t,n,r){if(t instanceof e||typeof t=="function"||t.length===0||t==="/"){let a=typeof t=="function"?t:t instanceof e?t.compile().fetch:n instanceof e?n.compile().fetch:typeof n=="function"?n:(()=>{throw Error("Invalid handler")})(),c=({request:l,path:u})=>a(new Request(rx(l.url,u),l));return this.route("ALL","/*",c,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:a}}),this}let o=n instanceof e?n.compile().fetch:typeof n=="function"?n:(()=>{throw Error("Invalid handler")})(),i=(typeof t=="string"&&this.config.prefix?this.config.prefix+t:t).length-(t.endsWith("*")?1:0),s=({request:a,path:c})=>o(new Request(rx(a.url,c.slice(i)||"/"),a));return this.route("ALL",t,s,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:o}}),this.route("ALL",t+(t.endsWith("/")?"*":"/*"),s,{parse:"none",...r,detail:{...r?.detail,hide:!0},config:{mount:o}}),this}get(t,n,r){return this.add("GET",t,n,r),this}post(t,n,r){return this.add("POST",t,n,r),this}put(t,n,r){return this.add("PUT",t,n,r),this}patch(t,n,r){return this.add("PATCH",t,n,r),this}delete(t,n,r){return this.add("DELETE",t,n,r),this}options(t,n,r){return this.add("OPTIONS",t,n,r),this}all(t,n,r){return this.add("ALL",t,n,r),this}head(t,n,r){return this.add("HEAD",t,n,r),this}connect(t,n,r){return this.add("CONNECT",t,n,r),this}route(t,n,r,o){return this.add(t.toUpperCase(),n,r,o,o?.config),this}ws(t,n){return this["~adapter"].ws?this["~adapter"].ws(this,t,n):console.warn("Current adapter doesn't support WebSocket"),this}state(t,n,r){n===void 0?(r=t,t={as:"append"},n=""):r===void 0&&(typeof t=="string"?(r=n,n=t,t={as:"append"}):typeof t=="object"&&(r=n,n=""));let{as:o}=t;if(typeof n!="string")return this;switch(typeof r){case"object":return!r||!Je(r)?this:n?((n in this.singleton.store)?this.singleton.store[n]=wn(this.singleton.store[n],r,{override:o==="override"}):this.singleton.store[n]=r,this):r===null?this:(this.singleton.store=wn(this.singleton.store,r,{override:o==="override"}),this);case"function":return n?(o==="override"||!(n in this.singleton.store))&&(this.singleton.store[n]=r):this.singleton.store=r(this.singleton.store),this;default:return(o==="override"||!(n in this.singleton.store))&&(this.singleton.store[n]=r),this}}decorate(t,n,r){n===void 0?(r=t,t={as:"append"},n=""):r===void 0&&(typeof t=="string"?(r=n,n=t,t={as:"append"}):typeof t=="object"&&(r=n,n=""));let{as:o}=t;if(typeof n!="string")return this;switch(typeof r){case"object":return n?((n in this.singleton.decorator)?this.singleton.decorator[n]=wn(this.singleton.decorator[n],r,{override:o==="override"}):this.singleton.decorator[n]=r,this):r===null?this:(this.singleton.decorator=wn(this.singleton.decorator,r,{override:o==="override"}),this);case"function":return n?(o==="override"||!(n in this.singleton.decorator))&&(this.singleton.decorator[n]=r):this.singleton.decorator=r(this.singleton.decorator),this;default:return(o==="override"||!(n in this.singleton.decorator))&&(this.singleton.decorator[n]=r),this}}derive(t,n){n||(n=t,t={as:"local"});let r={subType:"derive",fn:n};return this.onTransform(t,r)}model(t,n){let r=(o)=>{let i={};for(let s in o)"~standard"in o[s]||(i[s]=o[s]);return i};switch(typeof t){case"object":let o={},i=Object.entries(t);if(!i.length)return this;for(let[c,l]of i)c in this.definitions.type||("~standard"in l?this.definitions.type[c]=l:(o[c]=this.definitions.type[c]=l,o[c].$id??=`#/components/schemas/${c}`));return this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,...o}),this;case"function":let s=t(this.definitions.type);return this.definitions.type=s,this.definitions.typebox=X.Module(r(s)),this;case"string":if(!n)break;if(this.definitions.type[t]=n,"~standard"in n)return this;let a={...n,id:n.$id??`#/components/schemas/${t}`};return this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,...a}),this}return n?(this.definitions.type[t]=n,("~standard"in n)?this:(this.definitions.typebox=X.Module({...this.definitions.typebox.$defs,[t]:n}),this)):this}Ref(t){return X.Ref(t)}mapDerive(t,n){n||(n=t,t={as:"local"});let r={subType:"mapDerive",fn:n};return this.onTransform(t,r)}affix(t,n,r){if(r==="")return this;let o=["_","-"," "],i=(l)=>l[0].toUpperCase()+l.slice(1),s=t==="prefix"?(l,u)=>o.includes(l.at(-1)??"")?l+u:l+i(u):o.includes(r.at(-1)??"")?(l,u)=>u+l:(l,u)=>u+i(l),a=(l)=>{let u={};switch(l){case"decorator":for(let d in this.singleton.decorator)u[s(r,d)]=this.singleton.decorator[d];this.singleton.decorator=u;break;case"state":for(let d in this.singleton.store)u[s(r,d)]=this.singleton.store[d];this.singleton.store=u;break;case"model":for(let d in this.definitions.type)u[s(r,d)]=this.definitions.type[d];this.definitions.type=u;break;case"error":for(let d in this.definitions.error)u[s(r,d)]=this.definitions.error[d];this.definitions.error=u;break}},c=Array.isArray(n)?n:[n];for(let l of c.some((u)=>u==="all")?["decorator","state","model","error"]:c)a(l);return this}prefix(t,n){return this.affix("prefix",t,n)}suffix(t,n){return this.affix("suffix",t,n)}compile(){return this["~adapter"].beforeCompile?.(this),this["~adapter"].isWebStandard?(this._handle=this.config.aot?Kx(this):fM(this),Object.defineProperty(this,"fetch",{value:this._handle,configurable:!0,writable:!0}),typeof this.server?.reload=="function"&&this.server.reload({...this.server||{},fetch:this.fetch}),this):(typeof this.server?.reload=="function"&&this.server.reload(this.server||{}),this._handle=Kx(this),this)}get fetch(){let t=this.config.aot?Kx(this):fM(this);return Object.defineProperty(this,"fetch",{value:t,configurable:!0,writable:!0}),t}get modules(){return this.promisedModules}},fi=GMe;var df={name:"@kabmo-labs/kabmo",version:"0.59.1",description:"Web console and diagnostic workbench for AI coding agents: Elysia + Preact on Bun.",license:"MIT",author:"Wijanarko Putra Rajeb <wijanarko.rajeb@gmail.com>",type:"module",engines:{bun:">=1.4.0"},publishConfig:{access:"public"},bin:{kabmo:"./src/cli/kabmo.js"},repository:{type:"git",url:"git+https://github.com/kabmo-labs/kabmo.git"},homepage:"https://github.com/kabmo-labs/kabmo#readme",bugs:{url:"https://github.com/kabmo-labs/kabmo/issues"},keywords:["kabmo","coding-agent","agent","console","elysia","preact","bun"],files:["src","extensions","index.html","bunfig.toml","public","tsconfig.json","marketplace","dist/client"],scripts:{dev:"bun run --hot src/server/index.ts --kabmo-server","dev:lan":"HOST=0.0.0.0 bun run --hot src/server/index.ts --kabmo-server",build:"bun run scripts/build-client.ts","editor:themes":"bun run scripts/editor-themes.mjs","icons:tints":"bun run scripts/icon-tints.mjs","icons:tints:check":"bun run scripts/icon-tints.mjs --check","tray:icons":"bun run scripts/tray-icon.mjs","tray:icons:check":"bun run scripts/tray-icon.mjs --check","editor:themes:check":"bun run scripts/editor-themes.mjs --check","omp:schema":"bun run scripts/omp-schema.mjs","omp:schema:check":"bun run scripts/omp-schema.mjs --check",start:"NODE_ENV=production bun run src/server/index.ts --kabmo-server",typecheck:"tsc",clean:"rm -rf dist",lint:"tsc --noEmit","check:fast":"bun check --no-script",test:"bun test","test:e2e":"playwright test --config tests/e2e/playwright.config.ts","readme:media":"bun run scripts/readme-media.ts","shell:wordmark":"bun run scripts/shell-wordmark.mjs","shell:docs":"bun run scripts/shell-document-types.mjs --write","shell:docs:check":"bun run scripts/shell-document-types.mjs --check","typecheck:e2e":"tsc --noEmit -p tests/e2e","typecheck:consumer":"tsc --noEmit -p tsconfig.consumer.json","publish:plugins":"bash .github/scripts/publish-plugin-packages.sh packages/kabmo-sdk packages/kabmo-ui"},dependencies:{"@codemirror/autocomplete":"6.20.4","@codemirror/commands":"6.11.1","@codemirror/language":"6.13.1","@codemirror/legacy-modes":"^6.5.5","@codemirror/lint":"^6.9.7","@codemirror/merge":"6.12.3","@codemirror/search":"6.7.2","@codemirror/state":"6.7.6","@codemirror/view":"6.43.15","@dskripchenko/drawio":"^0.1.0","@fontsource/fira-code":"^5.3.0","@shikijs/langs":"^4.4.3","@shikijs/themes":"^4.4.3","@tailwindcss/postcss":"^4.1.14",dompurify:"^3.4.15",elysia:"^1.4.30","ghostty-web":"0.4.0-next.21.g640db46","jsonc-parser":"^3.3.1",katex:"^0.18.7","lucide-preact":"^1.47.0",mammoth:"^1.13.0",marked:"^18.0.11","marked-linkify-it":"^4.0.2",mermaid:"^12.0.0",postcss:"^8.5.16",preact:"^10.29.8","qrcode-generator":"^2.0.4",remend:"^1.3.1",ripgrep:"^0.3.1","sherpa-onnx-node":"^2.0.2",shiki:"^4.4.3","smol-toml":"^1.9.1",tailwindcss:"^4.1.14",xlsx:"https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",yaml:"^2.9.1","@kabmo-labs/kabmo-acp":"workspace:*","@kabmo-labs/kabmo-app-contracts":"workspace:*","@kabmo-labs/kabmo-auth":"workspace:*","@kabmo-labs/kabmo-bytes":"workspace:*","@kabmo-labs/kabmo-chat":"workspace:*","@kabmo-labs/kabmo-db":"workspace:*","@kabmo-labs/kabmo-format":"workspace:*","@kabmo-labs/kabmo-fs":"workspace:*","@kabmo-labs/kabmo-git":"workspace:*","@kabmo-labs/kabmo-guards":"workspace:*","@kabmo-labs/kabmo-harness":"workspace:*","@kabmo-labs/kabmo-http":"workspace:*","@kabmo-labs/kabmo-idle-reaper":"workspace:*","@kabmo-labs/kabmo-live-sessions":"workspace:*","@kabmo-labs/kabmo-mcp-contracts":"workspace:*","@kabmo-labs/kabmo-model-contracts":"workspace:*","@kabmo-labs/kabmo-omp":"workspace:*","@kabmo-labs/kabmo-paths":"workspace:*","@kabmo-labs/kabmo-platform":"workspace:*","@kabmo-labs/kabmo-process":"workspace:*","@kabmo-labs/kabmo-provider-contracts":"workspace:*","@kabmo-labs/kabmo-realtime-signals":"workspace:*","@kabmo-labs/kabmo-refresh-cadence":"workspace:*","@kabmo-labs/kabmo-rpc-lines":"workspace:*","@kabmo-labs/kabmo-runtime-flags":"workspace:*","@kabmo-labs/kabmo-sdk":"workspace:*","@kabmo-labs/kabmo-session":"workspace:*","@kabmo-labs/kabmo-settings":"workspace:*","@kabmo-labs/kabmo-ui":"workspace:*","@kabmo-labs/kabmo-workspace":"workspace:*","@kabmo-labs/kabmo-worktree":"workspace:*"},devDependencies:{"@playwright/test":"^1.64.0","@semantic-release/changelog":"^7.0.0","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/git":"^11.0.1","@semantic-release/github":"^12.0.10","@semantic-release/npm":"^13.2.0","@semantic-release/release-notes-generator":"^14.1.1","@types/bun":"1.4.4","@types/node":"^22.14.0","@types/qrcode-generator":"^0.0.16","bun-types":"1.4.4","conventional-changelog-conventionalcommits":"^9.3.1","happy-dom":"^20.14.5",jsqr:"^1.4.0","semantic-release":"^25.0.9",typescript:"~5.8.2"},overrides:{katex:"^0.18.7"},workspaces:["packages/*"],"$comment-workspaces":"Only `packages/*` are Bun workspaces. The native shells live in `apps/` and the sound and QR inputs in `assets/`; they have no package.json, so they are never installed, published or typechecked as libraries."};function Vx(e,t,n){let r=e.headers.get("if-none-match");if(r!==null){if(!t)return!1;let i=t.trim().replace(/^W\//,"");return r.split(",").some((s)=>s.trim().replace(/^W\//,"")===i)}let o=e.headers.get("if-modified-since");if(o&&n!==null){let i=Date.parse(o);if(!Number.isNaN(i))return Math.floor(n/1000)*1000<=i}return!1}import{brotliCompressSync as _Me,constants as VMe}from"zlib";function Uo(e){if(e.buffer instanceof ArrayBuffer)return e;return new Uint8Array(e)}var hM=1024,MH=/^(text\/|application\/(json|javascript|xml|wasm|svg))/,zMe=["zstd","br","gzip"];function OH(e){return MH.test(e)}function yM(e){if(!e)return null;for(let t of zMe)if(e.includes(t))return t;return null}function bM(e,t){if(t==="zstd")return Uo(Bun.zstdCompressSync(e,{level:3}));if(t==="br")return Uo(_Me(e,{params:{[VMe.BROTLI_PARAM_QUALITY]:4}}));return Uo(Bun.gzipSync(e,{level:6}))}async function Vs(e,t){if(!t)return e;let n=e.headers.get("content-type")??"";if(n.includes("text/event-stream"))return e;if(!MH.test(n))return e;if(e.status===204||e.status===304)return e;let r=yM(t);if(!r)return e;let o=Uo(new Uint8Array(await e.arrayBuffer()));if(o.byteLength<hM)return JMe(e,o);let i=bM(o,r),s=new Headers(e.headers);return s.set("content-encoding",r),s.set("content-length",String(i.byteLength)),s.append("vary","accept-encoding"),new Response(i,{status:e.status,headers:s})}function JMe(e,t){return new Response(t,{status:e.status,headers:e.headers})}var ec=Bun.env.NODE_ENV!=="production",LH="/_bun/",DH=["/_bun/client/","/_bun/asset/"],wM="/_dev-assets/",NH="no-cache";function FH(e){let t=e;for(let n of DH)t=t.replaceAll(n,wM+n.slice(LH.length));return t}function SM(e){if(!e.startsWith(wM))return null;let t=LH+e.slice(wM.length);return DH.some((n)=>t.startsWith(n))?t:null}async function UH(e,t,n,r={}){let o=SM(t);if(!o)return null;let i=await fetch(new URL(o,n),r),s=i.headers.get("content-type")??"";if(!i.ok||s.startsWith("text/html"))return new Response(`No dev asset at ${o}
|
|
667
667
|
`,{status:404,headers:{"content-type":"text/plain; charset=utf-8"}});let a=new Uint8Array(await i.arrayBuffer()),c=`"${Bun.hash(a).toString(16)}"`;if(Vx(e,c,null))return new Response(null,{status:304,headers:{etag:c,"cache-control":NH}});return Vs(new Response(a,{headers:{"content-type":s||"application/octet-stream","cache-control":NH,etag:c}}),e.headers.get("accept-encoding"))}var kM=ec?(await import("@/../index.html")).default:null;function f(e,t={}){let n=new Headers(t.headers);if(!n.has("content-type"))n.set("content-type","application/json; charset=utf-8");return new Response(JSON.stringify(e),{status:t.status??200,headers:n})}var ee={"cache-control":"no-store"};function V(e,t,n={}){let r=[];if(e.loader)r.push({method:"GET",path:t,handler:e.loader});else if(e.action)r.push({method:"GET",path:t,handler:K});if(e.action)for(let o of n.mutating??["POST","PUT","PATCH","DELETE"])r.push({method:o,path:t,handler:e.action});return r}var K=()=>zs();function zs(){return new Response(JSON.stringify({error:"Method not allowed"}),{status:405,headers:{"content-type":"application/json; charset=utf-8"}})}async function Kt(e){try{return{ok:!0,body:await e.json()}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}function Cn(e,t){let n=e[t];return n?n:null}function Bo(e,t=500){return f({error:e instanceof Error?e.message:String(e)},{status:t})}async function YMe(e){if(e instanceof Response)return e;if(e instanceof ReadableStream)return new Response(e,{headers:{"content-type":"text/event-stream","cache-control":"no-cache"}});return new Response(JSON.stringify(e??null),{status:200,headers:{"content-type":"application/json; charset=utf-8"}})}function XMe(e){return async({request:t,params:n})=>{try{let r=await YMe(await e({request:t,params:n}));return await Vs(r,t.headers.get("accept-encoding"))}catch(r){let o=r instanceof Error?r.message:String(r);return new Response(JSON.stringify({error:o}),{status:500,headers:{"content-type":"application/json; charset=utf-8"}})}}}function BH(e,t){let n=e;for(let{method:r,path:o,handler:i}of t){let s=XMe(i);if(r==="GET")n=n.get(o,s);else if(r==="POST")n=n.post(o,s);else if(r==="PUT")n=n.put(o,s);else if(r==="PATCH")n=n.patch(o,s);else n=n.delete(o,s)}return n}function dt(e,t,n){return[{method:"GET",path:t,handler:n??K},...["POST","PUT","PATCH","DELETE"].map((r)=>({method:r,path:t,handler:e}))]}import{existsSync as xM,realpathSync as QMe}from"fs";import{homedir as jH,tmpdir as oMt}from"os";import*as pn from"path";var HH="omp",ZMe=".omp";function WH(){return Bun.env.PI_CONFIG_DIR||ZMe}function jo(){return pn.join(jH(),WH())}function pe(){let e=Bun.env.PI_CODING_AGENT_DIR;if(e)return pn.resolve(e);return pn.join(jo(),"agent")}function $H(){let e=Bun.env.PI_CODING_AGENT_DIR;if(e)return pn.resolve(e)===pn.join(jo(),"agent");return!0}function eOe(){if(process.platform!=="linux"&&process.platform!=="darwin")return;if(!$H())return;let e=Bun.env.XDG_DATA_HOME;if(!e)return;try{let t=pn.join(e,HH);return xM(t)?t:void 0}catch{return}}function tOe(e){let t=eOe();return pn.join(t??pe(),e)}function Ho(){return tOe("sessions")}function KH(){return pn.join(pe(),"projects.json")}function GH(){if(process.platform!=="linux"&&process.platform!=="darwin")return jo();if(!$H())return jo();let e=Bun.env.XDG_DATA_HOME;if(!e)return jo();try{let t=pn.join(e,HH);return xM(t)?t:jo()}catch{return jo()}}function qH(){return pn.join(GH(),"plugins")}function vM(){return pn.join(GH(),"marketplaces.json")}function _H(e){let t=jH(),n=WH(),r=pn.resolve(e);for(let o of[n,".git"]){let i=r;while(i!==t){if(xM(pn.join(i,o)))return pn.join(i,n,"plugins");let s=pn.dirname(i);if(s===i)break;i=s}}return pn.join(r,n,"plugins")}function Ed(e){try{return QMe.native(e)}catch{return e}}async function Z(e){try{return await Bun.file(e).stat(),!0}catch{return!1}}function Wo(e){let t=Ed(e);return t.replace(/\/+$/,"")||t}import TM from"fs";import*as zx from"path";function w(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function kn(e){let t=[];for(let n of e.split(`
|
|
668
668
|
`)){let r=n.trim();if(!r)continue;try{t.push(JSON.parse(r))}catch{}}return t}function VH(e){let t=e.endsWith("\\")?e.slice(0,-1):e;try{return JSON.parse(`"${t}"`)}catch{return t.replace(/\\n/g,`
|
|
669
669
|
`).replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\"/g,'"').replace(/\\\\/g,"\\")}}function Mn(e,t,n=0){let r=e.indexOf(`"${t}"`,n);if(r===-1)return;let o=e.indexOf(":",r+t.length+2);if(o===-1)return;let i=o+1;while(i<e.length){let c=e.charCodeAt(i);if(c!==32&&c!==9&&c!==10&&c!==13)break;i++}if(e.charCodeAt(i)!==34)return;let s=i+1,a=!1;for(let c=s;c<e.length;c++){let l=e.charCodeAt(c);if(a){a=!1;continue}if(l===92){a=!0;continue}if(l===34)return VH(e.slice(s,c))}return VH(e.slice(s))}function JH(e){let t=0,n=0;while(n<e.length){let r=e.indexOf('"type"',n);if(r===-1)break;let o=e.indexOf(":",r+6);if(o===-1)break;if(Mn(e,"type",r)==="message")t++;n=o+1}return t}function zH(e){if(e===void 0)return;return e.trim()?e:null}function nOe(e,t){if(e?.type!=="session"||typeof e.id!=="string")return;return{id:e.id,cwd:typeof e.cwd==="string"?e.cwd:void 0,title:t===null?void 0:t??(typeof e.title==="string"?e.title:void 0),parentSession:typeof e.parentSession==="string"?e.parentSession:void 0,timestamp:typeof e.timestamp==="string"?e.timestamp:void 0}}function rOe(e,t){if(Mn(e,"type")!=="session")return;let n=Mn(e,"id");if(!n)return;return{id:n,cwd:Mn(e,"cwd"),title:t===null?void 0:t??Mn(e,"title"),parentSession:Mn(e,"parentSession"),timestamp:Mn(e,"timestamp")}}function YH(e,t){let n=t[0],r=zH(n?.type==="title"&&typeof n.title==="string"?n.title:void 0),o=nOe(t[n?.type==="title"?1:0],r);if(o)return o;let i,s=!0;for(let a of e.split(/\r?\n/)){let c=a.trim();if(!c)continue;if(s&&Mn(c,"type")==="title"){i=zH(Mn(c,"title")),s=!1;continue}return rOe(c,i)}return}var AM=4096,oOe=16384,XH=1048576;async function QH(e,t){let n=Bun.file(e),r=await n.stat(),o=Math.min(t,r.size);return{text:o>0?await n.slice(0,o).text():"",size:r.size,mtime:new Date(r.mtimeMs),mtimeMs:r.mtimeMs}}var iOe={session_exit:!0};function sOe(e){let t,n,r,o=!1;try{let a=JSON.parse(e);if(w(a))o=!0,t=a.type,n=a.customType,r=a.timestamp}catch{}if(!o)r=Mn(e,"timestamp"),t=Mn(e,"type"),n=Mn(e,"customType");let i;if(typeof r==="number"&&Number.isFinite(r))i=new Date(r);else if(typeof r==="string"){let a=new Date(r);if(!Number.isNaN(a.getTime()))i=a}if(!i)return;let s=t==="custom"&&typeof n==="string"&&iOe[n]===!0;return{at:i,lifecycle:s}}async function ZH(e,t,n){if(t<=0)return;let r=oOe;for(;;){let o=Math.max(0,t-r),i;if(t<=AM)i=n;else if(o===0)try{i=await Bun.file(e).text()}catch{return}else try{i=await Bun.file(e).slice(o-1).text()}catch{return}let s=i.split(`
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{d,n,o,i,u,a,e,s,I,p,pn,B,f,ae,rt,me,Mt,at,rn,S,U,Er,Si,ur,X,Es,Ql,Rl}from"./index-eggbcdwx.js";import{Ge,ie,Ot,N,ye}from"./index-q3k8r0ms.js";import{al}from"./index-mx5y9vt9.js";import"./index-2f6afhze.js";import{kt,ju,Hu,Wu,js,Ui,kp}from"./index-wwyjzhgs.js";import{vu,dp,pp,ku,mr,$s,xu,wu,Cu,Eu,Bu,$i,Iu,Vl,_u}from"./index-8z9aqgf3.js";import{HA,zs,Du,oi,Yl,Ou}from"./index-c253x7vt.js";import{Ya,Ja,ui}from"./index-trq7bdvk.js";var We={name:"git-commit-vertical",size:24,node:[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]},ce=s(We);var $e={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]},te=s($e);var _e={name:"minimize",size:24,node:[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]},oe=s(_e);var Ue={name:"save-all",size:24,node:[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]},ne=s(Ue);function ue(t){if(t.byteViewer)return[];return[{id:"save",pinned:!0,actions:[{label:"Save file",icon:ne,onSelect:t.onSave,disabled:t.saveDisabled}],children:t.saveButton},{id:"save-as",actions:[{label:"Save as…",icon:ne,onSelect:t.onSaveAs}],children:e("button",{type:"button",onClick:t.onSaveAs,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:"Save the buffer to a new file","aria-label":"Save as",children:e(ne,{size:14})})}]}function pe(t){if(!t.hasReview)return[];let r=t.isReviewing?"Exit review mode":"Review this document";return[{id:"review",actions:[{label:r,icon:rn,onSelect:t.onToggleReview,active:t.isReviewing}],children:e($s,{label:r,pressed:t.isReviewing,title:t.isReviewing?"Review mode is on — click a block to judge it":"Review: click blocks to mark them good or needing work",onClick:t.onToggleReview,children:e(rn,{size:14})})}]}function fe(t){if(!t.hasPreview)return[];return[{id:"preview",actions:[{label:t.previewLabel,icon:t.isPreview?Mt:at,onSelect:t.onTogglePreview,active:t.isPreview}],children:e($s,{label:t.previewLabel,pressed:t.isPreview,onClick:t.onTogglePreview,children:t.isPreview?e(Mt,{size:14}):e(at,{size:14})})}]}function be(t){let r=[];if(r.push(...ue(t),...pe(t),...fe(t)),!t.byteViewer)r.push({id:"find",actions:[{label:t.findLabel,icon:U,onSelect:t.onToggleFind,active:t.findOpen}],children:e($s,{label:t.findLabel,pressed:t.findOpen,title:`${t.findLabel} (Ctrl+F)`,onClick:t.onToggleFind,children:e(U,{size:14})})}),r.push({id:"wrap",actions:[{label:t.wordWrapLabel,icon:pn,onSelect:t.onToggleWordWrap,active:t.wordWrap}],children:e($s,{label:t.wordWrapLabel,pressed:t.wordWrap,onClick:t.onToggleWordWrap,children:e(pn,{size:14})})}),r.push({id:"blame",actions:[{label:t.blameInline?"Hide line blame":"Show line blame",icon:ce,onSelect:t.onToggleBlameInline,active:t.blameInline}],children:e($s,{label:t.blameInline?"Hide line blame":"Show line blame",pressed:t.blameInline,title:"Who last changed each block, from git (hover a line for the commit)",onClick:t.onToggleBlameInline,children:e(ce,{size:14})})}),r.push({id:"zoom",actions:[{label:"Decrease font size",icon:Ja,onSelect:t.onZoomOut},{label:"Increase font size",icon:Ya,onSelect:t.onZoomIn}],children:e(d,{children:[e("button",{type:"button",onClick:t.onZoomOut,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:"Decrease font size","aria-label":"Decrease font size",children:e(Ja,{size:14})}),e("button",{type:"button",onClick:t.onZoomIn,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:"Increase font size","aria-label":"Increase font size",children:e(Ya,{size:14})})]})}),r.push({id:"reload",actions:[{label:"Reload from disk",icon:S,onSelect:t.onReload,disabled:!t.canReload}],children:e("button",{type:"button",onClick:t.onReload,disabled:!t.canReload||t.refreshing,"aria-busy":t.refreshing,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:!t.canReload?"Nothing to reload — this tab has no file on disk":t.reloadDiscardsEdits?"Discard my changes and reload from disk":"Reload from disk","aria-label":"Reload from disk",children:e(S,{size:14,className:t.refreshing?"animate-spin":void 0})})});return r.push({id:"copy",actions:[{label:t.copyLabel,icon:ae,onSelect:t.onCopy},{label:"Download file",icon:me,onSelect:t.onDownload}],children:e(d,{children:[e("button",{type:"button",onClick:t.onCopy,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:t.copyLabel,"aria-label":t.copyLabel,children:t.copied?e(ae,{size:14,className:"text-success-text"}):e(ae,{size:14})}),e("button",{type:"button",onClick:t.onDownload,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:"Download file","aria-label":"Download file",children:e(me,{size:14})})]})}),r.push({id:"view-modes",pinned:!0,actions:t.viewModeActions,children:t.viewModeButtons}),r.push({id:"maximize",pinned:!0,actions:[{label:t.maximizeLabel,icon:t.isMaximized?oe:te,onSelect:t.onToggleMaximize,active:t.isMaximized}],children:t.maximizeButton}),r}function he({path:t,saveStatus:r,wordWrap:l,hasPreview:m,isPreview:c,hasReview:b,isReviewing:w,copied:k,byteViewer:y=!1,saveDisabled:h=!1,unsupported:x=!1,handleMissing:T=!1,readOnly:M=!1,isMaximized:g=!1,findOpen:v=!1,onToggleFind:C,onSave:D,onTogglePreview:P,onToggleReview:R,onToggleWordWrap:V,onZoomIn:_,onZoomOut:E,onCopy:O,onDownload:H,onReload:F,canReload:A,refreshing:z=!1,reloadDiscardsEdits:Z,onSaveAs:W,onToggleMaximize:K}){let Q=h?M?"Read-only — this file was opened from the phone, not from a workspace":T?"Cannot save — reopen the file from the system to restore write access":x?"Nothing to save — this file cannot be opened as a document":"Nothing to save — this file could not be read":r==="needs-permission"?"Click Save to allow writing this file":r==="saving"?"Saving…":r==="error"?"Save failed — the file on disk was not changed":"Save file (Ctrl+S)",se=e("button",{type:"button",onClick:D,disabled:h||r==="saving",className:`${mr} hover:bg-ink/5`,title:Q,"aria-label":Q,children:r==="saving"?e(kt,{size:14,className:"text-warning-text animate-pulse"}):r==="saved"?e(f,{size:14,className:"text-success-text"}):r==="error"?e(I,{size:14,className:"text-error-text"}):r==="needs-permission"?e(kt,{size:14,className:"text-warning-text"}):e(kt,{size:14,className:"hover:text-ink"})}),q=g?"Exit full screen":"Full screen",j=e("button",{type:"button",onClick:K,className:`${mr} hover:bg-ink/5 hover:text-ink ${g?"text-ink":""}`,title:q,"aria-label":q,"aria-pressed":g,children:g?e(oe,{size:14}):e(te,{size:14})}),ee=kp(),G=dp(),Y=be({byteViewer:y,hasPreview:m,isPreview:c,wordWrap:l,hasReview:b,isReviewing:w,blameInline:ee.inline,findOpen:v,copied:k,isMaximized:g,saveDisabled:h,canReload:A,refreshing:z,reloadDiscardsEdits:Z,saveButton:se,maximizeButton:j,viewModeButtons:e(pp,{size:14}),viewModeActions:G,previewLabel:c?"Show source":"Show preview",findLabel:"Find and replace",wordWrapLabel:l?"Word wrap on":"Word wrap off",copyLabel:k?"Copied":y?"Copy image":"Copy content",maximizeLabel:q,onTogglePreview:P,onToggleReview:R,onToggleFind:C,onToggleWordWrap:V,onToggleBlameInline:()=>{let de={...Ui(),inline:!ee.inline};Er({editorBlameInline:de.inline}),window.dispatchEvent(new CustomEvent(js,{detail:de}))},onZoomIn:_,onZoomOut:E,onCopy:O,onDownload:H,onReload:F,onSaveAs:W,onToggleMaximize:K,onSave:D});return e("div",{className:`@container ${Si.desktop} flex items-center justify-between gap-2 px-3 border-b border-ink/10 bg-paper flex-shrink-0`,children:[e("div",{className:"hidden @[420px]:flex items-center space-x-2 text-xs font-mono text-ink/40 min-w-0",children:e("span",{className:"truncate max-w-[300px]",title:t,children:t})}),e(ui,{clusters:Y,className:"text-ink/40 ml-auto"})]})}function ge({content:t,file:r,zoomLevel:l,reviewActive:m,onExitReview:c,scrollRef:b,onScroll:w}){return e("div",{ref:b,onScroll:w,"data-testid":"editor-scroller",className:"flex-1 overflow-auto bg-paper flex",children:e("div",{className:"p-6 max-w-4xl mx-auto font-sans flex-1",style:{fontSize:`${l}px`},children:e(xu,{content:t,file:r,active:m,onExit:c})})})}function Ke(t,r){return r?`Spaces: ${t}`:"Tabs"}function ve({caret:t,eol:r,onSetEol:l,indentWidth:m,insertSpaces:c,language:b,byteViewer:w,viewerKind:k,lineCount:y,conflicts:h=0}){return e("footer",{className:"flex bg-canvas border-t border-ink/10 px-3 items-center justify-between text-[10px] text-ink/50 flex-shrink-0 font-mono h-6","data-editor-status-bar":"",children:[e("div",{className:"flex items-center gap-3 min-w-0",children:w?e("span",{className:"uppercase",children:oi[k]}):e(d,{children:[e("span",{className:"tabular-nums",children:t?`Ln ${t.line}, Col ${t.column}`:"Ln —, Col —"}),e("span",{children:Ke(m,c)}),e("button",{type:"button",onClick:()=>l(r==="lf"?"crlf":"lf"),className:"uppercase hover:text-ink transition-colors cursor-pointer",title:`Line endings: ${r.toUpperCase()} — click to switch`,"aria-label":`Line endings ${r.toUpperCase()}, switch`,children:r}),e("span",{children:[y," lines"]})]})}),e("div",{className:"flex items-center gap-3 min-w-0",children:[h>0&&e("span",{className:"text-error-text font-semibold tabular-nums",title:`${h} unresolved conflict${h===1?"":"s"} — markers are highlighted in the file`,children:["⚠ ",h," conflict",h===1?"":"s"]}),e("span",{className:"uppercase text-ink/40",children:b})]})]})}function Ze(t){if(t===0)return 0;return Math.max(-1,Math.min(1,-Math.sign(t)))}function qe(t,r,l=Ql,m=Rl){return Math.max(l,Math.min(m,t+r))}function je(t,r){let l=t instanceof HTMLElement?t:null;while(l&&l!==r){let m=getComputedStyle(l);if(/(auto|scroll)/.test(m.overflowY)&&l.scrollHeight>l.clientHeight)return!0;l=l.parentElement}return!1}function xe(t,r){o(()=>{if(!t)return;let l=t.closest("[data-code-surface]"),m=l instanceof HTMLElement?l:t,c=(b)=>{if(!b.ctrlKey&&!b.metaKey)return;if(b.preventDefault(),je(b.target,m))return;let w=Ze(b.deltaY);if(w===0)return;r((k)=>qe(k,w))};return t.addEventListener("wheel",c,{passive:!1}),()=>t.removeEventListener("wheel",c)},[t,r])}function we(t,r){let l=t.trim();if(!/^\d+$/.test(l))return null;let m=Number(l);if(m<1)return null;return Math.min(m,Math.max(r,1))}function ke({lineCount:t,onGo:r,onClose:l}){let[m,c]=n(""),b=i(null);o(()=>{b.current?.focus(),b.current?.select()},[]);let w=()=>{let h=we(m,t);if(h===null)return;r(h)},k=(h)=>{if(h.key==="Enter"){h.preventDefault(),w();return}if(h.key==="Escape")h.preventDefault(),l()},y=we(m,t);return e(X,{onClose:l,maxWidthClass:"max-w-xs",header:e("span",{className:"text-sm font-semibold text-ink",children:"Go to line"}),children:e("div",{className:"px-4 py-3 space-y-2",children:[e("div",{className:"flex items-center gap-2",children:[e("input",{ref:b,value:m,onInput:(h)=>c(h.target.value),onKeyDown:k,inputMode:"numeric",placeholder:"1","aria-label":"Line number",className:"flex-1 bg-paper border border-ink/20 rounded px-2 py-1 text-xs font-mono text-ink outline-none focus:border-ink/40"}),e("span",{className:"text-[10px] font-mono text-ink/40",children:["/ ",t]}),e("button",{type:"button",onClick:w,disabled:y===null,className:"flex items-center gap-1 px-2 py-1 rounded bg-ink text-paper text-xs disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[e(rt,{size:12}),"Go"]})]}),m&&y!==null&&String(y)!==m.trim()?e("div",{className:"text-[10px] text-ink/50 font-mono",children:["line ",y," (the last line)"]}):null,m&&y===null?e("div",{className:"text-[10px] text-error-text font-mono",children:"Enter a line number"}):null]})})}var Ee={status:"idle",payload:null,message:null};function Se(t){if(!t?.path)return"";return`${t.root??""}\x00${t.repo??""}\x00${t.path}`}function Te(t,r={}){let l=r.enabled!==!1&&Boolean(t?.path)&&t?.deviceFile!==!0,m=r.dirty===!0,c=Se(t),[b,w]=n({key:"",value:Ee}),k=i(t);k.current=t;let y=i(c);y.current=c;let h=i(l);h.current=l;let x=i(m);x.current=m;let T=i(b);T.current=b;let M=i(0),g=i(""),v=i(new Map),C=i(new Set),D=a(async()=>{let E=k.current;if(!E?.path)return;let O=Se(E),H=++M.current;g.current=O,w((A)=>({key:O,value:{status:"loading",payload:A.key===O?A.value.payload:null,message:null}}));let F=new URLSearchParams({blame:"1",file:E.path,repo:E.repo||"."});if(E.root)F.set("root",E.root);try{let A=await fetch(`/api/fs/git?${F.toString()}`),z=await A.json().catch(()=>null);if(H!==M.current)return;if(!A.ok||!z){w({key:O,value:{status:"error",payload:null,message:z?.error??`Blame request failed (HTTP ${A.status})`}});return}w({key:O,value:z.available?{status:"ready",payload:z,message:null}:{status:"unavailable",payload:z,message:z.message??null}})}catch(A){if(H!==M.current)return;w({key:O,value:{status:"error",payload:null,message:A instanceof Error?A.message:"Blame failed"}})}finally{if(g.current===O)g.current=""}},[]),P=a(async(E)=>{let O=v.current.get(E);if(O)return O;let H=k.current;if(!H?.path)return{entries:[],truncated:!1};let F=new URLSearchParams({blameHistory:"1",file:H.path,line:String(E),repo:H.repo||"."});if(H.root)F.set("root",H.root);try{let z=await(await fetch(`/api/fs/git?${F.toString()}`)).json().catch(()=>null),Z={entries:Array.isArray(z?.entries)?z.entries:[],truncated:z?.truncated===!0};return v.current.set(E,Z),Z}catch{return{entries:[],truncated:!1}}},[]),R=i(null);if(!R.current)R.current={ensure:()=>{if(!h.current||x.current)return;let E=T.current;if(E.key===y.current&&E.value.status!=="idle")return;if(g.current===y.current)return;D()},reload:()=>{v.current.clear(),D()},history:P,snapshot:()=>{let E=T.current;return E.key===y.current?E.value:Ee},stale:()=>x.current,subscribe:(E)=>(C.current.add(E),()=>{C.current.delete(E)})};o(()=>{if(!l||m||!c)return;v.current.clear(),D()},[l,m,c,D]);let V=i(m);return o(()=>{if(V.current===m)return;V.current=m;for(let E of C.current)E()},[m]),o(()=>{for(let E of C.current)E()},[b]),R.current}var Ye="0".repeat(40);function re(t){return t===Ye}function J(t,r=Date.now()){let l=Math.max(0,Math.floor(r/1000)-t);if(l<60)return"just now";let m=Math.floor(l/60);if(m<60)return`${m}m ago`;let c=Math.floor(m/60);if(c<24)return`${c}h ago`;let b=Math.floor(c/24);if(b<30)return`${b}d ago`;let w=Math.floor(b/30);if(w<12)return`${w}mo ago`;return`${Math.floor(b/365)}y ago`}function Ce(t,r){switch(t){case"not-repo":return"This folder is not a git repository.";case"no-commit":return"This repository has no commits yet.";case"untracked":return"This file has never been committed, so it has no history.";case"too-large":return r??"This file is too large to blame.";case"empty":return"This file is empty.";default:return r??"git could not read this file."}}var Le="fixed z-50 w-[min(340px,92vw)] rounded-xl border border-ink/20 bg-paper p-3 shadow-xl font-sans text-xs text-ink",Be="flex items-baseline justify-between gap-2",Re="truncate text-xs font-semibold text-ink",Xe="shrink-0 font-mono text-[10px] text-ink/40",Je="mt-1 line-clamp-2 text-[11px] leading-snug text-ink/80",Qe="mt-2 border-t border-ink/10 pt-2",et="flex items-center gap-2 font-mono text-[10px] text-ink/40",Me="mt-1 text-[10px] leading-snug text-ink/50",tt="mt-2 flex w-full items-center gap-1.5 text-left text-[10px] text-ink/50 hover:text-ink cursor-pointer",ot="mt-1.5 space-y-1 border-t border-ink/10 pt-1.5",le="flex items-center gap-1.5 font-mono text-[10px]";function L(t,r,l){let m=document.createElement(t);if(m.className=r,l!==void 0)m.textContent=l;return m}function nt(t){return new Date(t*1000).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function it(t){let r=t.payload;if(t.status==="error")return{title:"Blame failed",body:t.message??"git could not read this file."};if(t.status==="unavailable")return{title:r?.reason==="untracked"?"Not tracked":"No history",body:Ce(r?.reason??"error",t.message??void 0)};if(!r)return null;if(t.stale)return{title:"Not committed yet",body:"This line changed in the editor. Save the file to see its blame."};if(t.line>r.lines)return{title:"Not committed yet",body:`Line ${t.line} is past the end of the file at HEAD (${r.lines} lines).`};let l=r.runs.length>0?Ne(r,t.line):null;if(!l)return{title:"Not committed yet",body:`git has no attribution for line ${t.line}.`};if(re(l.sha))return{title:"Not committed yet",body:"This line differs from the last commit."};return null}function Ne(t,r){for(let l of t.runs)if(r>=l.from&&r<=l.to)return t.commits[l.sha]??null;return null}function lt(t,r){t.replaceChildren(),t.className=Le;let l=it(r);if(l){let h=L("div",Be);if(h.append(L("span",Re,l.title)),r.status==="error"&&r.message){let x=L("button","shrink-0 cursor-pointer text-[10px] text-ink/50 hover:text-ink","Try again");x.type="button",x.setAttribute("aria-label","Read the blame again"),h.append(x)}t.append(h,L("p",Me,l.body));return}let m=r.payload;if(!m){t.append(L("p",Me,"Reading blame…"));return}let c=Ne(m,r.line),b=L("div",Be);if(b.append(L("span",Re,c.author.trim()||"Unknown"),L("span",Xe,J(c.time))),t.append(b),c.summary)t.append(L("p",Je,c.summary));let w=L("div",`${et} ${Qe}`);if(w.append(L("code","truncate",c.sha.slice(0,7)),L("span","",nt(c.time))),c.mail){let h=L("span","truncate",c.mail);h.title=c.mail,w.append(h)}t.append(w);let k=L("button",tt);if(k.type="button",k.setAttribute("aria-expanded",r.historyOpen?"true":"false"),k.textContent=`${r.historyOpen?"▾":"▸"} Line history`,t.append(k),!r.historyOpen)return;let y=L("ol",ot);if(r.historyLoading)y.append(L("li",`${le} text-ink/40`,"Reading history…"));else if(!r.history||r.history.entries.length===0)y.append(L("li",`${le} text-ink/40`,"No commits touched this line."));else{let h=r.history.entries;if(h.forEach((x,T)=>{let M=L("li",le),g=T===h.length-1?"new":"edit";M.append(L("span","text-ink/40",T===0?"●":"○"),L("code","text-ink/60",x.sha.slice(0,7)),L("span","truncate text-ink/80",x.author.trim()||"Unknown"),L("span","ml-auto shrink-0 text-ink/40",J(x.time)),L("span","shrink-0 rounded bg-ink/5 px-1 text-[8.5px] uppercase tracking-wider text-ink/45",g)),y.append(M)}),r.history.truncated)y.append(L("li",`${le} text-ink/40`,"Older commits are not shown."))}t.append(y)}function Pe(t,r,l){let m=L("div",Le);m.setAttribute("role","dialog"),m.setAttribute("aria-label","Line blame"),m.addEventListener("mousedown",(x)=>x.stopPropagation());let c=null,b=!1,w=!1,k=()=>{let x=r.snapshot();return{line:t,status:x.status,payload:x.payload,message:x.message,stale:r.stale(),history:c,historyOpen:b,historyLoading:w}},y=()=>{lt(m,k());let x=m.querySelector('[aria-label="Read the blame again"]');if(x)x.addEventListener("click",(T)=>{T.stopPropagation(),l()});m.querySelector("button[aria-expanded]")?.addEventListener("click",(T)=>{if(T.stopPropagation(),b=!b,y(),!b||c||w)return;w=!0,y(),r.history(t).then((M)=>{c=M,w=!1,y()})})};y();let h=r.subscribe(y);return{element:m,place(x){let T=m.ownerDocument.defaultView,M=T?.innerWidth??1024,g=T?.innerHeight??768,v=m.offsetWidth||340,C=m.offsetHeight||120,D=8,P=Math.max(8,Math.min(x.left,M-v-8)),R=x.bottom+6,V=x.top-C-6,_=R+C>g-8&&V>8?V:R;m.style.left=`${P}px`,m.style.top=`${Math.max(8,_)}px`},destroy(){h(),m.remove()}}}function De(t){return ye.define((r)=>{let l=null,m=0,c,b=()=>{clearTimeout(c),c=void 0,l?.destroy(),l=null,m=0},w=(g,v)=>{let C=g.getBoundingClientRect();if(C.width>0)return{left:C.left,top:C.top,bottom:C.bottom};let D=r.state.doc.line(Math.min(v,r.state.doc.lines)),P=null;try{P=r.coordsAtPos(D.from)}catch{P=null}if(P)return P;let R=r.scrollDOM.getBoundingClientRect();return{left:R.left,top:R.top+24,bottom:R.top+24}},k=(g,v)=>{if(m===g&&l)return;b(),m=g,l=Pe(g,t,()=>{t.reload(),b()}),document.body.append(l.element),l.place(v)},y=(g)=>{let v=g.target,C=v?.closest?.(".cm-blame-label");if(C){let R=Number(C.dataset.blameLine);return Number.isInteger(R)&&R>0?{line:R,anchor:C}:null}let D=v?.closest?.(".cm-lineNumbers .cm-gutterElement");if(!D)return null;let P=Number((D.textContent??"").trim());return Number.isInteger(P)&&P>0?{line:P,anchor:D}:null},h=(g)=>{let v=y(g);if(!v)return;k(v.line,w(v.anchor,v.line))},x=(g)=>{let v=y(g);if(v){g.preventDefault(),k(v.line,w(v.anchor,v.line));return}if(l&&!l.element.contains(g.target))b()},T=(g)=>{if(g.key==="Escape"&&l)b(),g.stopPropagation()},M=(g)=>{if(!l)return;let v=g.relatedTarget;if(v&&(l.element.contains(v)||r.scrollDOM.contains(v)))return;c=setTimeout(b,200)};return r.scrollDOM.addEventListener("mouseover",h),r.scrollDOM.addEventListener("mouseleave",M),r.scrollDOM.addEventListener("mousedown",x),document.addEventListener("mousedown",x),document.addEventListener("keydown",T,!0),{update(g){if(g.docChanged&&l)b()},destroy(){b(),r.scrollDOM.removeEventListener("mouseover",h),r.scrollDOM.removeEventListener("mouseleave",M),r.scrollDOM.removeEventListener("mousedown",x),document.removeEventListener("mousedown",x),document.removeEventListener("keydown",T,!0)}}})}var Oe=40,Ie=ie.define();function st(t){return Ge.define({create:()=>({payload:t.snapshot().payload,stale:!1}),update(r,l){let m=r;for(let c of l.effects){if(!c.is(Ie))continue;m=c.value.payload!==r.payload?{payload:c.value.payload,stale:!1}:{payload:r.payload,stale:r.stale}}if(l.docChanged&&!m.stale)m={payload:m.payload,stale:!0};return m}})}function mt(t,r,l){let m=t.commits[r];if(!m||re(r))return null;let c=m.author.trim()||"Unknown";return l?c:`${c} · ${J(m.time)}`}class ze extends Ot{constructor(t,r,l){super();this.line=t;this.text=r;this.title=l}eq(t){return t.line===this.line&&t.text===this.text&&t.title===this.title}toDOM(){let t=document.createElement("span");return t.className="cm-blame-label",t.dataset.blameLine=String(this.line),t.title=this.title,t.textContent=this.text,t}}function Ae(t,r,l){let{payload:m,stale:c}=t;if(!m?.available||c)return N.none;let b=Math.min(m.lines,r.state.doc.lines);if(b<1)return N.none;let w=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.from,r.state.doc.length))).number,k=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.to,r.state.doc.length))).number,y=Math.max(1,w-Oe),h=Math.min(b,k+Oe),x=[];for(let T of m.runs){let M=Math.max(T.from,y);if(M>T.to||M>h)continue;let g=mt(m,T.sha,l);if(!g)continue;let v=m.commits[T.sha],C=r.state.doc.line(M);x.push({from:C.to,deco:N.widget({widget:new ze(C.number,g,v.summary||v.sha),side:1})})}return N.set(x.map((T)=>T.deco.range(T.from)),!0)}function ct(t,r){return ye.fromClass(class{constructor(l){this.view=l;this.decorations=Ae(l.state.field(t),l,r)}update(l){if(l.startState.field(t)===l.state.field(t)&&!l.docChanged&&!l.viewportChanged)return;this.decorations=Ae(l.state.field(t),l.view,r)}},{decorations:(l)=>l.decorations})}function dt(t){return ye.define((r)=>{let l=!0,m=()=>{if(!l)return;let b=t.snapshot();r.dispatch({effects:Ie.of({payload:b.payload,stale:!1})})},c=t.subscribe(m);return{destroy(){l=!1,c()}}})}function He({controller:t,inline:r=!0,compact:l=!1}){let m=st(t);return[m,dt(t),r?ct(m,l):[],De(t)]}function Ve({activeFile:t,editor:r,find:l,surfaceRef:m,goToLineRequest:c,rootPath:b=null,repoPath:w=null,onRunCommand:k,wordWrap:y,zoomLevel:h,setZoomLevel:x,editorFontFamily:T,editorTheme:M,viewerKind:g,isPreview:v,reviewActive:C,onToggleReview:D,revealActive:P}){let R=g==="markdown",V=Hu(),_=Wu(),E=kp(),O=Te({name:t.name,path:t.path,root:t.root??b??void 0,repo:t.repo??w??"."},{enabled:E.enabled,dirty:r.isDirty}),H=u(()=>E.enabled?He({controller:O,inline:E.inline}):null,[E.enabled,E.inline,O]),[F,A]=n(null),z=u(()=>wu(r.content),[r.content]),[Z,W]=n(!1);o(()=>{if(c>0)W(!0)},[c]);let[K,Q]=n(null),[se,q]=n(null);xe(K,x);let j=al({tabKey:String(t.id),surface:R&&v?"rendered":"code",ready:r.loaded,element:R&&v?void 0:K}),ee=a((G)=>{j.ref(G),q(G)},[j.ref]);return Bu({path:t.path,scroller:se,preview:R&&v}),e("div",{className:"relative flex-1 min-h-0 flex flex-col",children:[l.open?e(Eu,{find:l}):null,Z?e(ke,{lineCount:r.content?r.content.split(`
|
|
1
|
+
import{d,n,o,i,u,a,e,s,I,p,pn,B,f,ae,rt,me,Mt,at,rn,S,U,Er,Si,ur,X,Es,Ql,Rl}from"./index-1mkn5fbf.js";import{Ge,ie,Ot,N,ye}from"./index-q3k8r0ms.js";import{al}from"./index-kt77dwsg.js";import"./index-3kedv94b.js";import{kt,ju,Hu,Wu,js,Ui,kp}from"./index-dbsy29gn.js";import{vu,dp,pp,ku,mr,$s,xu,wu,Cu,Eu,Bu,$i,Iu,Vl,_u}from"./index-jaf968hx.js";import{HA,zs,Du,oi,Yl,Ou}from"./index-hrez92pw.js";import{Ya,Ja,ui}from"./index-y5pkqrga.js";var We={name:"git-commit-vertical",size:24,node:[["path",{d:"M12 3v6",key:"1holv5"}],["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["path",{d:"M12 15v6",key:"a9ows0"}]]},ce=s(We);var $e={name:"maximize",size:24,node:[["path",{d:"M8 3H5a2 2 0 0 0-2 2v3",key:"1dcmit"}],["path",{d:"M21 8V5a2 2 0 0 0-2-2h-3",key:"1e4gt3"}],["path",{d:"M3 16v3a2 2 0 0 0 2 2h3",key:"wsl5sc"}],["path",{d:"M16 21h3a2 2 0 0 0 2-2v-3",key:"18trek"}]]},te=s($e);var _e={name:"minimize",size:24,node:[["path",{d:"M8 3v3a2 2 0 0 1-2 2H3",key:"hohbtr"}],["path",{d:"M21 8h-3a2 2 0 0 1-2-2V3",key:"5jw1f3"}],["path",{d:"M3 16h3a2 2 0 0 1 2 2v3",key:"198tvr"}],["path",{d:"M16 21v-3a2 2 0 0 1 2-2h3",key:"ph8mxp"}]]},oe=s(_e);var Ue={name:"save-all",size:24,node:[["path",{d:"M10 2v3a1 1 0 0 0 1 1h5",key:"1xspal"}],["path",{d:"M18 18v-6a1 1 0 0 0-1-1h-6a1 1 0 0 0-1 1v6",key:"1ra60u"}],["path",{d:"M18 22H4a2 2 0 0 1-2-2V6",key:"pblm9e"}],["path",{d:"M8 18a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9.172a2 2 0 0 1 1.414.586l2.828 2.828A2 2 0 0 1 22 6.828V16a2 2 0 0 1-2.01 2z",key:"1yve0x"}]]},ne=s(Ue);function ue(t){if(t.byteViewer)return[];return[{id:"save",pinned:!0,actions:[{label:"Save file",icon:ne,onSelect:t.onSave,disabled:t.saveDisabled}],children:t.saveButton},{id:"save-as",actions:[{label:"Save as…",icon:ne,onSelect:t.onSaveAs}],children:e("button",{type:"button",onClick:t.onSaveAs,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:"Save the buffer to a new file","aria-label":"Save as",children:e(ne,{size:14})})}]}function pe(t){if(!t.hasReview)return[];let r=t.isReviewing?"Exit review mode":"Review this document";return[{id:"review",actions:[{label:r,icon:rn,onSelect:t.onToggleReview,active:t.isReviewing}],children:e($s,{label:r,pressed:t.isReviewing,title:t.isReviewing?"Review mode is on — click a block to judge it":"Review: click blocks to mark them good or needing work",onClick:t.onToggleReview,children:e(rn,{size:14})})}]}function fe(t){if(!t.hasPreview)return[];return[{id:"preview",actions:[{label:t.previewLabel,icon:t.isPreview?Mt:at,onSelect:t.onTogglePreview,active:t.isPreview}],children:e($s,{label:t.previewLabel,pressed:t.isPreview,onClick:t.onTogglePreview,children:t.isPreview?e(Mt,{size:14}):e(at,{size:14})})}]}function be(t){let r=[];if(r.push(...ue(t),...pe(t),...fe(t)),!t.byteViewer)r.push({id:"find",actions:[{label:t.findLabel,icon:U,onSelect:t.onToggleFind,active:t.findOpen}],children:e($s,{label:t.findLabel,pressed:t.findOpen,title:`${t.findLabel} (Ctrl+F)`,onClick:t.onToggleFind,children:e(U,{size:14})})}),r.push({id:"wrap",actions:[{label:t.wordWrapLabel,icon:pn,onSelect:t.onToggleWordWrap,active:t.wordWrap}],children:e($s,{label:t.wordWrapLabel,pressed:t.wordWrap,onClick:t.onToggleWordWrap,children:e(pn,{size:14})})}),r.push({id:"blame",actions:[{label:t.blameInline?"Hide line blame":"Show line blame",icon:ce,onSelect:t.onToggleBlameInline,active:t.blameInline}],children:e($s,{label:t.blameInline?"Hide line blame":"Show line blame",pressed:t.blameInline,title:"Who last changed each block, from git (hover a line for the commit)",onClick:t.onToggleBlameInline,children:e(ce,{size:14})})}),r.push({id:"zoom",actions:[{label:"Decrease font size",icon:Ja,onSelect:t.onZoomOut},{label:"Increase font size",icon:Ya,onSelect:t.onZoomIn}],children:e(d,{children:[e("button",{type:"button",onClick:t.onZoomOut,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:"Decrease font size","aria-label":"Decrease font size",children:e(Ja,{size:14})}),e("button",{type:"button",onClick:t.onZoomIn,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:"Increase font size","aria-label":"Increase font size",children:e(Ya,{size:14})})]})}),r.push({id:"reload",actions:[{label:"Reload from disk",icon:S,onSelect:t.onReload,disabled:!t.canReload}],children:e("button",{type:"button",onClick:t.onReload,disabled:!t.canReload||t.refreshing,"aria-busy":t.refreshing,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:!t.canReload?"Nothing to reload — this tab has no file on disk":t.reloadDiscardsEdits?"Discard my changes and reload from disk":"Reload from disk","aria-label":"Reload from disk",children:e(S,{size:14,className:t.refreshing?"animate-spin":void 0})})});return r.push({id:"copy",actions:[{label:t.copyLabel,icon:ae,onSelect:t.onCopy},{label:"Download file",icon:me,onSelect:t.onDownload}],children:e(d,{children:[e("button",{type:"button",onClick:t.onCopy,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:t.copyLabel,"aria-label":t.copyLabel,children:t.copied?e(ae,{size:14,className:"text-success-text"}):e(ae,{size:14})}),e("button",{type:"button",onClick:t.onDownload,className:`${mr} hover:bg-ink/5 hover:text-ink`,title:"Download file","aria-label":"Download file",children:e(me,{size:14})})]})}),r.push({id:"view-modes",pinned:!0,actions:t.viewModeActions,children:t.viewModeButtons}),r.push({id:"maximize",pinned:!0,actions:[{label:t.maximizeLabel,icon:t.isMaximized?oe:te,onSelect:t.onToggleMaximize,active:t.isMaximized}],children:t.maximizeButton}),r}function he({path:t,saveStatus:r,wordWrap:l,hasPreview:m,isPreview:c,hasReview:b,isReviewing:w,copied:k,byteViewer:y=!1,saveDisabled:h=!1,unsupported:x=!1,handleMissing:T=!1,readOnly:M=!1,isMaximized:g=!1,findOpen:v=!1,onToggleFind:C,onSave:D,onTogglePreview:P,onToggleReview:R,onToggleWordWrap:V,onZoomIn:_,onZoomOut:E,onCopy:O,onDownload:H,onReload:F,canReload:A,refreshing:z=!1,reloadDiscardsEdits:Z,onSaveAs:W,onToggleMaximize:K}){let Q=h?M?"Read-only — this file was opened from the phone, not from a workspace":T?"Cannot save — reopen the file from the system to restore write access":x?"Nothing to save — this file cannot be opened as a document":"Nothing to save — this file could not be read":r==="needs-permission"?"Click Save to allow writing this file":r==="saving"?"Saving…":r==="error"?"Save failed — the file on disk was not changed":"Save file (Ctrl+S)",se=e("button",{type:"button",onClick:D,disabled:h||r==="saving",className:`${mr} hover:bg-ink/5`,title:Q,"aria-label":Q,children:r==="saving"?e(kt,{size:14,className:"text-warning-text animate-pulse"}):r==="saved"?e(f,{size:14,className:"text-success-text"}):r==="error"?e(I,{size:14,className:"text-error-text"}):r==="needs-permission"?e(kt,{size:14,className:"text-warning-text"}):e(kt,{size:14,className:"hover:text-ink"})}),q=g?"Exit full screen":"Full screen",j=e("button",{type:"button",onClick:K,className:`${mr} hover:bg-ink/5 hover:text-ink ${g?"text-ink":""}`,title:q,"aria-label":q,"aria-pressed":g,children:g?e(oe,{size:14}):e(te,{size:14})}),ee=kp(),G=dp(),Y=be({byteViewer:y,hasPreview:m,isPreview:c,wordWrap:l,hasReview:b,isReviewing:w,blameInline:ee.inline,findOpen:v,copied:k,isMaximized:g,saveDisabled:h,canReload:A,refreshing:z,reloadDiscardsEdits:Z,saveButton:se,maximizeButton:j,viewModeButtons:e(pp,{size:14}),viewModeActions:G,previewLabel:c?"Show source":"Show preview",findLabel:"Find and replace",wordWrapLabel:l?"Word wrap on":"Word wrap off",copyLabel:k?"Copied":y?"Copy image":"Copy content",maximizeLabel:q,onTogglePreview:P,onToggleReview:R,onToggleFind:C,onToggleWordWrap:V,onToggleBlameInline:()=>{let de={...Ui(),inline:!ee.inline};Er({editorBlameInline:de.inline}),window.dispatchEvent(new CustomEvent(js,{detail:de}))},onZoomIn:_,onZoomOut:E,onCopy:O,onDownload:H,onReload:F,onSaveAs:W,onToggleMaximize:K,onSave:D});return e("div",{className:`@container ${Si.desktop} flex items-center justify-between gap-2 px-3 border-b border-ink/10 bg-paper flex-shrink-0`,children:[e("div",{className:"hidden @[420px]:flex items-center space-x-2 text-xs font-mono text-ink/40 min-w-0",children:e("span",{className:"truncate max-w-[300px]",title:t,children:t})}),e(ui,{clusters:Y,className:"text-ink/40 ml-auto"})]})}function ge({content:t,file:r,zoomLevel:l,reviewActive:m,onExitReview:c,scrollRef:b,onScroll:w}){return e("div",{ref:b,onScroll:w,"data-testid":"editor-scroller",className:"flex-1 overflow-auto bg-paper flex",children:e("div",{className:"p-6 max-w-4xl mx-auto font-sans flex-1",style:{fontSize:`${l}px`},children:e(xu,{content:t,file:r,active:m,onExit:c})})})}function Ke(t,r){return r?`Spaces: ${t}`:"Tabs"}function ve({caret:t,eol:r,onSetEol:l,indentWidth:m,insertSpaces:c,language:b,byteViewer:w,viewerKind:k,lineCount:y,conflicts:h=0}){return e("footer",{className:"flex bg-canvas border-t border-ink/10 px-3 items-center justify-between text-[10px] text-ink/50 flex-shrink-0 font-mono h-6","data-editor-status-bar":"",children:[e("div",{className:"flex items-center gap-3 min-w-0",children:w?e("span",{className:"uppercase",children:oi[k]}):e(d,{children:[e("span",{className:"tabular-nums",children:t?`Ln ${t.line}, Col ${t.column}`:"Ln —, Col —"}),e("span",{children:Ke(m,c)}),e("button",{type:"button",onClick:()=>l(r==="lf"?"crlf":"lf"),className:"uppercase hover:text-ink transition-colors cursor-pointer",title:`Line endings: ${r.toUpperCase()} — click to switch`,"aria-label":`Line endings ${r.toUpperCase()}, switch`,children:r}),e("span",{children:[y," lines"]})]})}),e("div",{className:"flex items-center gap-3 min-w-0",children:[h>0&&e("span",{className:"text-error-text font-semibold tabular-nums",title:`${h} unresolved conflict${h===1?"":"s"} — markers are highlighted in the file`,children:["⚠ ",h," conflict",h===1?"":"s"]}),e("span",{className:"uppercase text-ink/40",children:b})]})]})}function Ze(t){if(t===0)return 0;return Math.max(-1,Math.min(1,-Math.sign(t)))}function qe(t,r,l=Ql,m=Rl){return Math.max(l,Math.min(m,t+r))}function je(t,r){let l=t instanceof HTMLElement?t:null;while(l&&l!==r){let m=getComputedStyle(l);if(/(auto|scroll)/.test(m.overflowY)&&l.scrollHeight>l.clientHeight)return!0;l=l.parentElement}return!1}function xe(t,r){o(()=>{if(!t)return;let l=t.closest("[data-code-surface]"),m=l instanceof HTMLElement?l:t,c=(b)=>{if(!b.ctrlKey&&!b.metaKey)return;if(b.preventDefault(),je(b.target,m))return;let w=Ze(b.deltaY);if(w===0)return;r((k)=>qe(k,w))};return t.addEventListener("wheel",c,{passive:!1}),()=>t.removeEventListener("wheel",c)},[t,r])}function we(t,r){let l=t.trim();if(!/^\d+$/.test(l))return null;let m=Number(l);if(m<1)return null;return Math.min(m,Math.max(r,1))}function ke({lineCount:t,onGo:r,onClose:l}){let[m,c]=n(""),b=i(null);o(()=>{b.current?.focus(),b.current?.select()},[]);let w=()=>{let h=we(m,t);if(h===null)return;r(h)},k=(h)=>{if(h.key==="Enter"){h.preventDefault(),w();return}if(h.key==="Escape")h.preventDefault(),l()},y=we(m,t);return e(X,{onClose:l,maxWidthClass:"max-w-xs",header:e("span",{className:"text-sm font-semibold text-ink",children:"Go to line"}),children:e("div",{className:"px-4 py-3 space-y-2",children:[e("div",{className:"flex items-center gap-2",children:[e("input",{ref:b,value:m,onInput:(h)=>c(h.target.value),onKeyDown:k,inputMode:"numeric",placeholder:"1","aria-label":"Line number",className:"flex-1 bg-paper border border-ink/20 rounded px-2 py-1 text-xs font-mono text-ink outline-none focus:border-ink/40"}),e("span",{className:"text-[10px] font-mono text-ink/40",children:["/ ",t]}),e("button",{type:"button",onClick:w,disabled:y===null,className:"flex items-center gap-1 px-2 py-1 rounded bg-ink text-paper text-xs disabled:opacity-40 disabled:cursor-default cursor-pointer",children:[e(rt,{size:12}),"Go"]})]}),m&&y!==null&&String(y)!==m.trim()?e("div",{className:"text-[10px] text-ink/50 font-mono",children:["line ",y," (the last line)"]}):null,m&&y===null?e("div",{className:"text-[10px] text-error-text font-mono",children:"Enter a line number"}):null]})})}var Ee={status:"idle",payload:null,message:null};function Se(t){if(!t?.path)return"";return`${t.root??""}\x00${t.repo??""}\x00${t.path}`}function Te(t,r={}){let l=r.enabled!==!1&&Boolean(t?.path)&&t?.deviceFile!==!0,m=r.dirty===!0,c=Se(t),[b,w]=n({key:"",value:Ee}),k=i(t);k.current=t;let y=i(c);y.current=c;let h=i(l);h.current=l;let x=i(m);x.current=m;let T=i(b);T.current=b;let M=i(0),g=i(""),v=i(new Map),C=i(new Set),D=a(async()=>{let E=k.current;if(!E?.path)return;let O=Se(E),H=++M.current;g.current=O,w((A)=>({key:O,value:{status:"loading",payload:A.key===O?A.value.payload:null,message:null}}));let F=new URLSearchParams({blame:"1",file:E.path,repo:E.repo||"."});if(E.root)F.set("root",E.root);try{let A=await fetch(`/api/fs/git?${F.toString()}`),z=await A.json().catch(()=>null);if(H!==M.current)return;if(!A.ok||!z){w({key:O,value:{status:"error",payload:null,message:z?.error??`Blame request failed (HTTP ${A.status})`}});return}w({key:O,value:z.available?{status:"ready",payload:z,message:null}:{status:"unavailable",payload:z,message:z.message??null}})}catch(A){if(H!==M.current)return;w({key:O,value:{status:"error",payload:null,message:A instanceof Error?A.message:"Blame failed"}})}finally{if(g.current===O)g.current=""}},[]),P=a(async(E)=>{let O=v.current.get(E);if(O)return O;let H=k.current;if(!H?.path)return{entries:[],truncated:!1};let F=new URLSearchParams({blameHistory:"1",file:H.path,line:String(E),repo:H.repo||"."});if(H.root)F.set("root",H.root);try{let z=await(await fetch(`/api/fs/git?${F.toString()}`)).json().catch(()=>null),Z={entries:Array.isArray(z?.entries)?z.entries:[],truncated:z?.truncated===!0};return v.current.set(E,Z),Z}catch{return{entries:[],truncated:!1}}},[]),R=i(null);if(!R.current)R.current={ensure:()=>{if(!h.current||x.current)return;let E=T.current;if(E.key===y.current&&E.value.status!=="idle")return;if(g.current===y.current)return;D()},reload:()=>{v.current.clear(),D()},history:P,snapshot:()=>{let E=T.current;return E.key===y.current?E.value:Ee},stale:()=>x.current,subscribe:(E)=>(C.current.add(E),()=>{C.current.delete(E)})};o(()=>{if(!l||m||!c)return;v.current.clear(),D()},[l,m,c,D]);let V=i(m);return o(()=>{if(V.current===m)return;V.current=m;for(let E of C.current)E()},[m]),o(()=>{for(let E of C.current)E()},[b]),R.current}var Ye="0".repeat(40);function re(t){return t===Ye}function J(t,r=Date.now()){let l=Math.max(0,Math.floor(r/1000)-t);if(l<60)return"just now";let m=Math.floor(l/60);if(m<60)return`${m}m ago`;let c=Math.floor(m/60);if(c<24)return`${c}h ago`;let b=Math.floor(c/24);if(b<30)return`${b}d ago`;let w=Math.floor(b/30);if(w<12)return`${w}mo ago`;return`${Math.floor(b/365)}y ago`}function Ce(t,r){switch(t){case"not-repo":return"This folder is not a git repository.";case"no-commit":return"This repository has no commits yet.";case"untracked":return"This file has never been committed, so it has no history.";case"too-large":return r??"This file is too large to blame.";case"empty":return"This file is empty.";default:return r??"git could not read this file."}}var Le="fixed z-50 w-[min(340px,92vw)] rounded-xl border border-ink/20 bg-paper p-3 shadow-xl font-sans text-xs text-ink",Be="flex items-baseline justify-between gap-2",Re="truncate text-xs font-semibold text-ink",Xe="shrink-0 font-mono text-[10px] text-ink/40",Je="mt-1 line-clamp-2 text-[11px] leading-snug text-ink/80",Qe="mt-2 border-t border-ink/10 pt-2",et="flex items-center gap-2 font-mono text-[10px] text-ink/40",Me="mt-1 text-[10px] leading-snug text-ink/50",tt="mt-2 flex w-full items-center gap-1.5 text-left text-[10px] text-ink/50 hover:text-ink cursor-pointer",ot="mt-1.5 space-y-1 border-t border-ink/10 pt-1.5",le="flex items-center gap-1.5 font-mono text-[10px]";function L(t,r,l){let m=document.createElement(t);if(m.className=r,l!==void 0)m.textContent=l;return m}function nt(t){return new Date(t*1000).toLocaleDateString(void 0,{day:"numeric",month:"short",year:"numeric"})}function it(t){let r=t.payload;if(t.status==="error")return{title:"Blame failed",body:t.message??"git could not read this file."};if(t.status==="unavailable")return{title:r?.reason==="untracked"?"Not tracked":"No history",body:Ce(r?.reason??"error",t.message??void 0)};if(!r)return null;if(t.stale)return{title:"Not committed yet",body:"This line changed in the editor. Save the file to see its blame."};if(t.line>r.lines)return{title:"Not committed yet",body:`Line ${t.line} is past the end of the file at HEAD (${r.lines} lines).`};let l=r.runs.length>0?Ne(r,t.line):null;if(!l)return{title:"Not committed yet",body:`git has no attribution for line ${t.line}.`};if(re(l.sha))return{title:"Not committed yet",body:"This line differs from the last commit."};return null}function Ne(t,r){for(let l of t.runs)if(r>=l.from&&r<=l.to)return t.commits[l.sha]??null;return null}function lt(t,r){t.replaceChildren(),t.className=Le;let l=it(r);if(l){let h=L("div",Be);if(h.append(L("span",Re,l.title)),r.status==="error"&&r.message){let x=L("button","shrink-0 cursor-pointer text-[10px] text-ink/50 hover:text-ink","Try again");x.type="button",x.setAttribute("aria-label","Read the blame again"),h.append(x)}t.append(h,L("p",Me,l.body));return}let m=r.payload;if(!m){t.append(L("p",Me,"Reading blame…"));return}let c=Ne(m,r.line),b=L("div",Be);if(b.append(L("span",Re,c.author.trim()||"Unknown"),L("span",Xe,J(c.time))),t.append(b),c.summary)t.append(L("p",Je,c.summary));let w=L("div",`${et} ${Qe}`);if(w.append(L("code","truncate",c.sha.slice(0,7)),L("span","",nt(c.time))),c.mail){let h=L("span","truncate",c.mail);h.title=c.mail,w.append(h)}t.append(w);let k=L("button",tt);if(k.type="button",k.setAttribute("aria-expanded",r.historyOpen?"true":"false"),k.textContent=`${r.historyOpen?"▾":"▸"} Line history`,t.append(k),!r.historyOpen)return;let y=L("ol",ot);if(r.historyLoading)y.append(L("li",`${le} text-ink/40`,"Reading history…"));else if(!r.history||r.history.entries.length===0)y.append(L("li",`${le} text-ink/40`,"No commits touched this line."));else{let h=r.history.entries;if(h.forEach((x,T)=>{let M=L("li",le),g=T===h.length-1?"new":"edit";M.append(L("span","text-ink/40",T===0?"●":"○"),L("code","text-ink/60",x.sha.slice(0,7)),L("span","truncate text-ink/80",x.author.trim()||"Unknown"),L("span","ml-auto shrink-0 text-ink/40",J(x.time)),L("span","shrink-0 rounded bg-ink/5 px-1 text-[8.5px] uppercase tracking-wider text-ink/45",g)),y.append(M)}),r.history.truncated)y.append(L("li",`${le} text-ink/40`,"Older commits are not shown."))}t.append(y)}function Pe(t,r,l){let m=L("div",Le);m.setAttribute("role","dialog"),m.setAttribute("aria-label","Line blame"),m.addEventListener("mousedown",(x)=>x.stopPropagation());let c=null,b=!1,w=!1,k=()=>{let x=r.snapshot();return{line:t,status:x.status,payload:x.payload,message:x.message,stale:r.stale(),history:c,historyOpen:b,historyLoading:w}},y=()=>{lt(m,k());let x=m.querySelector('[aria-label="Read the blame again"]');if(x)x.addEventListener("click",(T)=>{T.stopPropagation(),l()});m.querySelector("button[aria-expanded]")?.addEventListener("click",(T)=>{if(T.stopPropagation(),b=!b,y(),!b||c||w)return;w=!0,y(),r.history(t).then((M)=>{c=M,w=!1,y()})})};y();let h=r.subscribe(y);return{element:m,place(x){let T=m.ownerDocument.defaultView,M=T?.innerWidth??1024,g=T?.innerHeight??768,v=m.offsetWidth||340,C=m.offsetHeight||120,D=8,P=Math.max(8,Math.min(x.left,M-v-8)),R=x.bottom+6,V=x.top-C-6,_=R+C>g-8&&V>8?V:R;m.style.left=`${P}px`,m.style.top=`${Math.max(8,_)}px`},destroy(){h(),m.remove()}}}function De(t){return ye.define((r)=>{let l=null,m=0,c,b=()=>{clearTimeout(c),c=void 0,l?.destroy(),l=null,m=0},w=(g,v)=>{let C=g.getBoundingClientRect();if(C.width>0)return{left:C.left,top:C.top,bottom:C.bottom};let D=r.state.doc.line(Math.min(v,r.state.doc.lines)),P=null;try{P=r.coordsAtPos(D.from)}catch{P=null}if(P)return P;let R=r.scrollDOM.getBoundingClientRect();return{left:R.left,top:R.top+24,bottom:R.top+24}},k=(g,v)=>{if(m===g&&l)return;b(),m=g,l=Pe(g,t,()=>{t.reload(),b()}),document.body.append(l.element),l.place(v)},y=(g)=>{let v=g.target,C=v?.closest?.(".cm-blame-label");if(C){let R=Number(C.dataset.blameLine);return Number.isInteger(R)&&R>0?{line:R,anchor:C}:null}let D=v?.closest?.(".cm-lineNumbers .cm-gutterElement");if(!D)return null;let P=Number((D.textContent??"").trim());return Number.isInteger(P)&&P>0?{line:P,anchor:D}:null},h=(g)=>{let v=y(g);if(!v)return;k(v.line,w(v.anchor,v.line))},x=(g)=>{let v=y(g);if(v){g.preventDefault(),k(v.line,w(v.anchor,v.line));return}if(l&&!l.element.contains(g.target))b()},T=(g)=>{if(g.key==="Escape"&&l)b(),g.stopPropagation()},M=(g)=>{if(!l)return;let v=g.relatedTarget;if(v&&(l.element.contains(v)||r.scrollDOM.contains(v)))return;c=setTimeout(b,200)};return r.scrollDOM.addEventListener("mouseover",h),r.scrollDOM.addEventListener("mouseleave",M),r.scrollDOM.addEventListener("mousedown",x),document.addEventListener("mousedown",x),document.addEventListener("keydown",T,!0),{update(g){if(g.docChanged&&l)b()},destroy(){b(),r.scrollDOM.removeEventListener("mouseover",h),r.scrollDOM.removeEventListener("mouseleave",M),r.scrollDOM.removeEventListener("mousedown",x),document.removeEventListener("mousedown",x),document.removeEventListener("keydown",T,!0)}}})}var Oe=40,Ie=ie.define();function st(t){return Ge.define({create:()=>({payload:t.snapshot().payload,stale:!1}),update(r,l){let m=r;for(let c of l.effects){if(!c.is(Ie))continue;m=c.value.payload!==r.payload?{payload:c.value.payload,stale:!1}:{payload:r.payload,stale:r.stale}}if(l.docChanged&&!m.stale)m={payload:m.payload,stale:!0};return m}})}function mt(t,r,l){let m=t.commits[r];if(!m||re(r))return null;let c=m.author.trim()||"Unknown";return l?c:`${c} · ${J(m.time)}`}class ze extends Ot{constructor(t,r,l){super();this.line=t;this.text=r;this.title=l}eq(t){return t.line===this.line&&t.text===this.text&&t.title===this.title}toDOM(){let t=document.createElement("span");return t.className="cm-blame-label",t.dataset.blameLine=String(this.line),t.title=this.title,t.textContent=this.text,t}}function Ae(t,r,l){let{payload:m,stale:c}=t;if(!m?.available||c)return N.none;let b=Math.min(m.lines,r.state.doc.lines);if(b<1)return N.none;let w=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.from,r.state.doc.length))).number,k=r.state.doc.lineAt(Math.max(0,Math.min(r.viewport.to,r.state.doc.length))).number,y=Math.max(1,w-Oe),h=Math.min(b,k+Oe),x=[];for(let T of m.runs){let M=Math.max(T.from,y);if(M>T.to||M>h)continue;let g=mt(m,T.sha,l);if(!g)continue;let v=m.commits[T.sha],C=r.state.doc.line(M);x.push({from:C.to,deco:N.widget({widget:new ze(C.number,g,v.summary||v.sha),side:1})})}return N.set(x.map((T)=>T.deco.range(T.from)),!0)}function ct(t,r){return ye.fromClass(class{constructor(l){this.view=l;this.decorations=Ae(l.state.field(t),l,r)}update(l){if(l.startState.field(t)===l.state.field(t)&&!l.docChanged&&!l.viewportChanged)return;this.decorations=Ae(l.state.field(t),l.view,r)}},{decorations:(l)=>l.decorations})}function dt(t){return ye.define((r)=>{let l=!0,m=()=>{if(!l)return;let b=t.snapshot();r.dispatch({effects:Ie.of({payload:b.payload,stale:!1})})},c=t.subscribe(m);return{destroy(){l=!1,c()}}})}function He({controller:t,inline:r=!0,compact:l=!1}){let m=st(t);return[m,dt(t),r?ct(m,l):[],De(t)]}function Ve({activeFile:t,editor:r,find:l,surfaceRef:m,goToLineRequest:c,rootPath:b=null,repoPath:w=null,onRunCommand:k,wordWrap:y,zoomLevel:h,setZoomLevel:x,editorFontFamily:T,editorTheme:M,viewerKind:g,isPreview:v,reviewActive:C,onToggleReview:D,revealActive:P}){let R=g==="markdown",V=Hu(),_=Wu(),E=kp(),O=Te({name:t.name,path:t.path,root:t.root??b??void 0,repo:t.repo??w??"."},{enabled:E.enabled,dirty:r.isDirty}),H=u(()=>E.enabled?He({controller:O,inline:E.inline}):null,[E.enabled,E.inline,O]),[F,A]=n(null),z=u(()=>wu(r.content),[r.content]),[Z,W]=n(!1);o(()=>{if(c>0)W(!0)},[c]);let[K,Q]=n(null),[se,q]=n(null);xe(K,x);let j=al({tabKey:String(t.id),surface:R&&v?"rendered":"code",ready:r.loaded,element:R&&v?void 0:K}),ee=a((G)=>{j.ref(G),q(G)},[j.ref]);return Bu({path:t.path,scroller:se,preview:R&&v}),e("div",{className:"relative flex-1 min-h-0 flex flex-col",children:[l.open?e(Eu,{find:l}):null,Z?e(ke,{lineCount:r.content?r.content.split(`
|
|
2
2
|
`).length:1,onGo:(G)=>{W(!1);let Y=ur(r.content,G-1);m.current?.select(Y,Y,!0),m.current?.revealOffset(Y)},onClose:()=>W(!1)}):null,R&&v?e(ge,{content:r.content,file:{name:t.name,path:t.path,root:t.root,repo:t.repo},zoomLevel:h,reviewActive:C,onExitReview:D,scrollRef:ee,onScroll:j.onScroll}):e(Cu,{ref:m,value:r.content,onValueChange:r.onChange,language:r.language,wordWrap:y,documentKey:String(t.id),marks:l.open||P?l.matches:void 0,currentMark:l.currentIndex,onCommand:k,onScroller:Q,onCaret:A,scrollTestId:"editor-scroller",className:"flex-1 min-h-0 text-ink select-text",blame:H,themeVars:M.vars,themes:M.themes,indentUnitText:ju(V),typing:_,padding:16,placeholder:"This file is empty",style:{fontFamily:T,fontSize:`${h}px`,lineHeight:Es}}),!R||!v?e(ve,{caret:F,eol:r.eol,onSetEol:r.setEol,indentWidth:V.width,insertSpaces:V.insertSpaces,language:r.language,byteViewer:r.isBinaryViewer,viewerKind:g,lineCount:r.content?r.content.split(`
|
|
3
3
|
`).length:0,conflicts:z}):null]})}function Fe({activeFile:t,editor:r,find:l,surfaceRef:m,pluginFileView:c,wordWrap:b,setWordWrap:w,viewerKind:k,isPreview:y,isReviewing:h,onToggleReview:x,isMaximized:T,setIsMaximized:M,zoomLevel:g,setZoomLevel:v,goToLineRequest:C,onSaveAs:D,rootPath:P=null,repoPath:R=null,runCommand:V,editorFontFamily:_,editorTheme:E,togglePreview:O,revealActive:H,missing:F}){let A=zs[k]===!0,z=Du[k]===!0,Z=a(async(W)=>{let K=await _u(t,W,{interactive:!0,baseMtimeMs:r.baseMtimeMs});if(K.status==="written")return{ok:!0};if(K.status==="conflict")return{ok:!1,error:"This file changed on disk since it was opened."};if(K.status==="needs-permission")return{ok:!1,error:"Click Save again to grant write access."};return{ok:!1,error:K.error}},[t,r.baseMtimeMs]);return e(d,{children:[e(he,{path:t.path,saveStatus:r.saveStatus,wordWrap:b,hasPreview:z,isPreview:y,hasReview:k==="markdown"&&y,isReviewing:h,copied:r.copied,byteViewer:A,saveDisabled:Boolean(r.loadError)||r.handleMissing||r.deviceBacked,unsupported:Boolean(r.unsupported),handleMissing:r.handleMissing,readOnly:r.deviceBacked,isMaximized:T,findOpen:l.open,onToggleFind:()=>l.open?l.close():l.openFind(),onSave:r.saveNow,onTogglePreview:O,onToggleReview:x,onToggleWordWrap:()=>w(!b),onZoomIn:()=>v((W)=>Math.min(Rl,W+1)),onZoomOut:()=>v((W)=>Math.max(Ql,W-1)),onCopy:r.copy,onDownload:r.download,onReload:r.reloadFromDisk,onSaveAs:D,canReload:Yl(t)&&!r.loadError&&!r.unsupported,refreshing:r.isReading,reloadDiscardsEdits:r.isDirty,onToggleMaximize:()=>M(!T)}),F&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-error/30 bg-error/10 text-error-text",children:[e(B,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was deleted from disk."}),e("div",{className:"text-[11px] font-sans text-error-text",children:"The buffer is still here. Saving recreates the file — autosave is off until then."})]})]}),r.conflict&&e(Ou,{diskMtimeMs:r.conflict.diskMtimeMs,fileName:t.name,onReload:r.resolveConflictByReload,onKeepMine:r.resolveConflictByKeepingMine}),r.handleMissing&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-warning/30 bg-warning/10 text-warning-text",children:[e(B,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:"This file was opened by the system, not from a workspace."}),e("div",{className:"text-[11px] font-sans text-warning-text",children:"Its write permission ended with the last page load. Reopen the file from the OS to edit it again."})]})]}),r.deviceBacked&&e("div",{className:"flex items-start gap-2 px-3 py-2 border-b border-ink/20 bg-ink/5 text-ink/70",children:[e(B,{size:14,className:"shrink-0 mt-0.5"}),e("div",{className:"min-w-0",children:[e("div",{className:"text-[11.5px] font-sans",children:r.deviceMissing?"The bytes for this file did not survive the reload.":"Opened from this device, so it is read-only here."}),e("div",{className:"text-[11px] font-sans text-ink/50",children:r.deviceMissing?"A phone's file lives only on the phone, so it cannot be re-read. Open it again from the app that shared it.":"The console cannot reach a file on your phone. Copy it into a workspace to edit it."})]})]}),r.isImage&&r.imageUrl?e($i,{src:r.imageUrl,name:t.name,className:"flex-1 min-h-0"}):r.isImage?e(Vl,{kind:"image",path:t.path,name:t.name,source:r.byteSource,content:r.content,revision:r.revision}):r.isLoading?e("div",{className:"flex-1 flex items-center justify-center gap-2 text-ink/40 text-xs font-mono",children:[e(p,{size:14,className:"animate-spin"}),e("span",{children:"Loading file content…"})]}):r.unsupported?e("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 px-6 text-center",children:[e(vu,{size:20,className:"text-ink/40"}),e("span",{className:"text-xs text-ink/70 font-sans",children:[t.name," cannot be opened here"]}),e("span",{className:"text-[11px] text-ink/50 font-sans max-w-[42ch]",children:r.unsupported})]}):r.loadError?e("div",{className:"flex-1 flex flex-col items-center justify-center gap-2 px-6 text-center",children:[e(B,{size:20,className:"text-error-text"}),e("span",{className:"text-xs text-error-text font-sans",children:["Could not read ",t.name]}),e("span",{className:"text-[11px] text-ink/50 font-mono break-all",children:r.loadError})]}):c&&!r.isImage?e(HA,{view:c}):Iu(k)&&(A||y)?e(Vl,{kind:k,path:t.path,name:t.name,source:r.byteSource,content:r.content,root:t.root??P,repo:t.repo??R,revision:r.revision,onContentChange:r.onChange,onSaveBytes:r.deviceBacked?void 0:Z,onDirtyChange:r.setBinaryDirty}):e(Ve,{activeFile:t,editor:r,find:l,surfaceRef:m,goToLineRequest:C,rootPath:P,repoPath:R,onRunCommand:V,wordWrap:b,zoomLevel:g,setZoomLevel:v,editorFontFamily:_,editorTheme:E,isPreview:y,reviewActive:h,onToggleReview:x,viewerKind:k,revealActive:H})]})}function Qo({activeFile:t,editor:r,find:l,surfaceRef:m,pluginFileView:c,wordWrap:b,setWordWrap:w,viewerKind:k,isPreview:y,isReviewing:h,onToggleReview:x,isMaximized:T,setIsMaximized:M,zoomLevel:g,setZoomLevel:v,goToLineRequest:C,onSaveAs:D,rootPath:P=null,repoPath:R=null,runCommand:V,editorFontFamily:_,editorTheme:E,togglePreview:O,revealActive:H,missing:F,onConvertDiffToEditor:A,onFileSaved:z}){if(!t)return e("div",{className:"flex-1 flex items-center justify-center text-ink/40",children:e("p",{className:"font-mono text-sm",children:"Select a tab to view content"})});if(t.isDiff)return e(ku,{filePath:t.path,status:t.diffStatus||"M",isStaged:Boolean(t.diffStaged),root:t.root,repo:t.repo||".",journalDiff:t.journalDiff,readOnly:t.diffSource==="journal",onOpenInEditor:()=>A(t.id),onFileSaved:z,className:"flex-1",tabKey:String(t.id)});return e(Fe,{activeFile:t,editor:r,find:l,surfaceRef:m,pluginFileView:c,wordWrap:b,setWordWrap:w,viewerKind:k,isPreview:y,isReviewing:h,onToggleReview:x,isMaximized:T,setIsMaximized:M,zoomLevel:g,setZoomLevel:v,goToLineRequest:C,onSaveAs:D,rootPath:P,repoPath:R,runCommand:V,editorFontFamily:_,editorTheme:E,togglePreview:O,revealActive:H,missing:F})}export{Qo as EditorBody};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{u,e}from"./index-
|
|
1
|
+
import{u,e}from"./index-1mkn5fbf.js";import{Su,UA,Bg,Tu}from"./index-hgzf4ask.js";function w({content:d,path:l,onChange:s}){let r=u(()=>UA(d,l),[d,l]),o=s!==void 0&&!r.truncated,a=d.endsWith(`
|
|
2
2
|
`),c=o?(i,n,t)=>{s(Bg(r.header,Tu(r.rows,i,n,t),r.delimiter,a))}:void 0,h=o?(i,n)=>{let t=r.header.slice();while(t.length<=i)t.push("");t[i]=n,s(Bg(t,r.rows,r.delimiter,a))}:void 0;return e(Su,{header:r.header,rows:r.rows,truncated:r.truncated,readOnlyNote:r.truncated?"This file is too large to edit in the grid — use Show source.":o?"Paste is not supported — double-click a cell to edit it.":"This grid is read-only — use Show source to edit the cells.",onEditCell:c,onEditHeader:h})}export{w as CsvGrid};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{u,e,p,Ym,jr,sp}from"./index-
|
|
1
|
+
import{u,e,p,Ym,jr,sp}from"./index-1mkn5fbf.js";import{xn,$n,OA}from"./index-nwbr15b3.js";var wr=$n(function(gr,Zt){(function(et){if(typeof gr==="object"&&typeof Zt<"u")Zt.exports=et();else if(typeof define==="function"&&define.amd)define([],et);else{var ft;if(typeof window<"u")ft=window;else if(typeof global<"u")ft=global;else if(typeof self<"u")ft=self;else ft=this;ft.mammoth=et()}})(function(){var et,ft,Yt;return function X(ce,L,z){function I(c,o){if(!L[c]){if(!ce[c]){var i=OA;if(!o&&i)return i(c,!0);if(d)return d(c,!0);var t=Error("Cannot find module '"+c+"'");throw t.code="MODULE_NOT_FOUND",t}var l=L[c]={exports:{}};ce[c][0].call(l.exports,function(g){var _=ce[c][1][g];return I(_?_:g)},l,l.exports,X,ce,L,z)}return L[c].exports}var d=OA;for(var k=0;k<z.length;k++)I(z[k]);return I}({1:[function(X,ce,L){var z=X("../../lib/promises");L.Files=I;function I(){function d(k){return z.reject(Error("could not open external image: '"+k+`'
|
|
2
2
|
cannot open linked files from a web browser`))}return{read:d}}},{"../../lib/promises":23}],2:[function(X,ce,L){var z=X("../lib/promises"),I=X("../lib/zipfile");L.openZip=d;function d(k){if(k.arrayBuffer)return z.resolve(I.openArrayBuffer(k.arrayBuffer));else return z.reject(Error("Could not find file in options"))}},{"../lib/promises":23,"../lib/zipfile":40}],3:[function(X,ce,L){var z=X("underscore"),I=X("./promises"),d=X("./documents"),k=X("./styles/html-paths"),c=X("./results"),o=X("./images"),i=X("./html"),t=X("./writers");L.DocumentConverter=l;function l(n){return{convertToHtml:function(v){var a=z.indexBy(v.type===d.types.document?v.comments:[],"commentId"),E=new g(n,a);return E.convertToHtml(v)}}}function g(n,v){var a=1,E=[],F=[];n=z.extend({ignoreEmptyParagraphs:!0},n);var A=n.idPrefix===void 0?"":n.idPrefix,W=n.ignoreEmptyParagraphs,S=k.topLevelElement("p"),P=n.styleMap||[];function O(m){var q=[],Y=ee(m,q,Object.create(null)),j=[];T(Y,function(r){if(r.type==="deferred")j.push(r)});var f=Object.create(null);return I.forEachSeries(j,function(r){return r.value().then(function(s){f[r.id]=s})}).then(function(){function r(N){return h(N,function(M){if(M.type==="deferred")return f[M.id];else if(M.children)return[z.extend({},M,{children:r(M.children)})];else return[M]})}var s=t.writer({prettyPrint:n.prettyPrint,outputFormat:n.outputFormat});return i.write(s,i.simplify(r(Y))),new c.Result(s.asString(),q)})}function H(m,q,Y){return h(m,function(j){return ee(j,q,Y)})}function ee(m,q,Y){if(!Y)throw Error("context not set");var j=Ae[m.type];if(j)return j(m,q,Y);else return[]}function U(m,q,Y){return J(m,q).wrap(function(){var j=H(m.children,q,Y);if(W)return j;else return[i.forceWrite].concat(j)})}function J(m,q){var Y=se(m);if(Y)return Y.to;else{if(m.styleId)q.push(y("paragraph",m));return S}}function D(m,q,Y){var j=function(){return H(m.children,q,Y)},f=[];if(m.highlight!==null){var r=ye({type:"highlight",color:m.highlight});if(r)f.push(r)}if(m.isSmallCaps)f.push(te("smallCaps"));if(m.isAllCaps)f.push(te("allCaps"));if(m.isStrikethrough)f.push(te("strikethrough","s"));if(m.isUnderline)f.push(te("underline"));if(m.verticalAlignment===d.verticalAlignment.subscript)f.push(k.element("sub",{},{fresh:!1}));if(m.verticalAlignment===d.verticalAlignment.superscript)f.push(k.element("sup",{},{fresh:!1}));if(m.isItalic)f.push(te("italic","em"));if(m.isBold)f.push(te("bold","strong"));var s=k.empty,N=se(m);if(N)s=N.to;else if(m.styleId)q.push(y("run",m));return f.push(s),f.forEach(function(M){j=M.wrap.bind(M,j)}),j()}function te(m,q){var Y=ye({type:m});if(Y)return Y;else if(q)return k.element(q,{},{fresh:!1});else return k.empty}function ye(m,q){var Y=se(m);return Y?Y.to:q}function se(m){for(var q=0;q<P.length;q++)if(P[q].from.matches(m))return P[q]}function ve(m){return function(q,Y){return I.try(function(){return m(q,Y)}).catch(function(j){return Y.push(c.error(j)),[]})}}function le(m){return Q(m.noteType,m.noteId)}function be(m){return ne(m.noteType,m.noteId)}function Q(m,q){return Te(m+"-"+q)}function ne(m,q){return Te(m+"-ref-"+q)}function Te(m){return A+m}var pe=k.elements([k.element("table",{},{fresh:!0})]);function de(m,q,Y){return ye(m,pe).wrap(function(){return Pe(m,q,Y)})}function Pe(m,q,Y){var j=z.findIndex(m.children,function(N){return!N.type===d.types.tableRow||!N.isHeader});if(j===-1)j=m.children.length;var f;if(j===0)f=H(m.children,q,z.extend({},Y,{isTableHeader:!1}));else{var r=H(m.children.slice(0,j),q,z.extend({},Y,{isTableHeader:!0})),s=H(m.children.slice(j),q,z.extend({},Y,{isTableHeader:!1}));f=[i.freshElement("thead",{},r),i.freshElement("tbody",{},s)]}return[i.forceWrite].concat(f)}function Be(m,q,Y){var j=H(m.children,q,Y);return[i.freshElement("tr",{},[i.forceWrite].concat(j))]}function Ie(m,q,Y){var j=Y.isTableHeader?"th":"td",f=H(m.children,q,Y),r={};if(m.colSpan!==1)r.colspan=m.colSpan.toString();if(m.rowSpan!==1)r.rowspan=m.rowSpan.toString();return[i.freshElement(j,r,[i.forceWrite].concat(f))]}function ke(m,q,Y){return ye(m,k.ignore).wrap(function(){var j=v[m.commentId],f=F.length+1,r="["+x(j)+f+"]";return F.push({label:r,comment:j}),[i.freshElement("a",{href:"#"+Q("comment",m.commentId),id:ne("comment",m.commentId)},[i.text(r)])]})}function Ne(m,q,Y){var{label:j,comment:f}=m,r=H(f.body,q,Y).concat([i.nonFreshElement("p",{},[i.text(" "),i.freshElement("a",{href:"#"+ne("comment",f.commentId)},[i.text("↑")])])]);return[i.freshElement("dt",{id:Q("comment",f.commentId)},[i.text("Comment "+j)]),i.freshElement("dd",{},r)]}function Re(m,q,Y){return We(m).wrap(function(){return[]})}function We(m){var q=se(m);if(q)return q.to;else if(m.breakType==="line")return k.topLevelElement("br");else return k.empty}var Ae={document:function(m,q,Y){var j=H(m.children,q,Y),f=E.map(function(s){return m.notes.resolve(s)}),r=H(f,q,Y);return j.concat([i.freshElement("ol",{},r),i.freshElement("dl",{},h(F,function(s){return Ne(s,q,Y)}))])},paragraph:U,run:D,text:function(m,q,Y){return[i.text(m.value)]},tab:function(m,q,Y){return[i.text("\t")]},hyperlink:function(m,q,Y){var j=m.anchor?"#"+Te(m.anchor):m.href,f={href:j};if(m.targetFrame!=null)f.target=m.targetFrame;var r=H(m.children,q,Y);return[i.nonFreshElement("a",f,r)]},checkbox:function(m){var q={type:"checkbox"};if(m.checked)q.checked="checked";return[i.freshElement("input",q)]},bookmarkStart:function(m,q,Y){var j=i.freshElement("a",{id:Te(m.name)},[i.forceWrite]);return[j]},noteReference:function(m,q,Y){E.push(m);var j=i.freshElement("a",{href:"#"+le(m),id:be(m)},[i.text("["+a+++"]")]);return[i.freshElement("sup",{},[j])]},note:function(m,q,Y){var j=H(m.body,q,Y),f=i.elementWithTag(k.element("p",{},{fresh:!1}),[i.text(" "),i.freshElement("a",{href:"#"+be(m)},[i.text("↑")])]),r=j.concat([f]);return i.freshElement("li",{id:le(m)},r)},commentReference:ke,comment:Ne,image:w(ve(n.convertImage||o.dataUri)),table:de,tableRow:Be,tableCell:Ie,break:Re};return{convertToHtml:O}}var _=1;function w(n){return function(v,a,E){return[{type:"deferred",id:_++,value:function(){return n(v,a,E)}}]}}function y(n,v){return c.warning("Unrecognised "+n+" style: '"+v.styleName+"' (Style ID: "+v.styleId+")")}function h(n,v){return z.flatten(n.map(v),!0)}function T(n,v){n.forEach(function(a){if(v(a),a.children)T(a.children,v)})}var x=L.commentAuthorLabel=function(v){return v.authorInitials||""}},{"./documents":4,"./html":18,"./images":20,"./promises":23,"./results":25,"./styles/html-paths":28,"./writers":33,underscore:67}],4:[function(X,ce,L){(function(z){var I=X("underscore"),d=L.types={document:"document",paragraph:"paragraph",run:"run",text:"text",tab:"tab",checkbox:"checkbox",hyperlink:"hyperlink",noteReference:"noteReference",image:"image",note:"note",commentReference:"commentReference",comment:"comment",table:"table",tableRow:"tableRow",tableCell:"tableCell",break:"break",bookmarkStart:"bookmarkStart"};function k(S,P){return P=P||{},{type:d.document,children:S,notes:P.notes||new y({}),comments:P.comments||[]}}function c(S,P){P=P||{};var O=P.indent||{};return{type:d.paragraph,children:S,styleId:P.styleId||null,styleName:P.styleName||null,numbering:P.numbering||null,alignment:P.alignment||null,indent:{start:O.start||null,end:O.end||null,firstLine:O.firstLine||null,hanging:O.hanging||null}}}function o(S,P){return P=P||{},{type:d.run,children:S,styleId:P.styleId||null,styleName:P.styleName||null,isBold:!!P.isBold,isUnderline:!!P.isUnderline,isItalic:!!P.isItalic,isStrikethrough:!!P.isStrikethrough,isAllCaps:!!P.isAllCaps,isSmallCaps:!!P.isSmallCaps,verticalAlignment:P.verticalAlignment||i.baseline,font:P.font||null,fontSize:P.fontSize||null,highlight:P.highlight||null}}var i={baseline:"baseline",superscript:"superscript",subscript:"subscript"};function t(S){return{type:d.text,value:S}}function l(){return{type:d.tab}}function g(S){return{type:d.checkbox,checked:S.checked}}function _(S,P){return{type:d.hyperlink,children:S,href:P.href,anchor:P.anchor,targetFrame:P.targetFrame}}function w(S){return{type:d.noteReference,noteType:S.noteType,noteId:S.noteId}}function y(S){this._notes=I.indexBy(S,function(P){return n(P.noteType,P.noteId)})}y.prototype.resolve=function(S){return this.findNoteByKey(n(S.noteType,S.noteId))},y.prototype.findNoteByKey=function(S){return this._notes[S]||null};function h(S){return{type:d.note,noteType:S.noteType,noteId:S.noteId,body:S.body}}function T(S){return{type:d.commentReference,commentId:S.commentId}}function x(S){return{type:d.comment,commentId:S.commentId,body:S.body,authorName:S.authorName,authorInitials:S.authorInitials}}function n(S,P){return S+"-"+P}function v(S){return{type:d.image,read:function(P){if(P)return S.readImage(P);else return S.readImage().then(function(O){return z.from(O)})},readAsArrayBuffer:function(){return S.readImage()},readAsBase64String:function(){return S.readImage("base64")},readAsBuffer:function(){return S.readImage().then(function(P){return z.from(P)})},altText:S.altText,contentType:S.contentType}}function a(S,P){return P=P||{},{type:d.table,children:S,styleId:P.styleId||null,styleName:P.styleName||null}}function E(S,P){return P=P||{},{type:d.tableRow,children:S,isHeader:P.isHeader||!1}}function F(S,P){return P=P||{},{type:d.tableCell,children:S,colSpan:P.colSpan==null?1:P.colSpan,rowSpan:P.rowSpan==null?1:P.rowSpan}}function A(S){return{type:d.break,breakType:S}}function W(S){return{type:d.bookmarkStart,name:S.name}}L.document=L.Document=k,L.paragraph=L.Paragraph=c,L.run=L.Run=o,L.text=L.Text=t,L.tab=L.Tab=l,L.checkbox=L.Checkbox=g,L.Hyperlink=_,L.noteReference=L.NoteReference=w,L.Notes=y,L.Note=h,L.commentReference=T,L.comment=x,L.Image=v,L.Table=a,L.TableRow=E,L.TableCell=F,L.lineBreak=A("line"),L.pageBreak=A("page"),L.columnBreak=A("column"),L.BookmarkStart=W,L.verticalAlignment=i}).call(this,X("buffer").Buffer)},{buffer:48,underscore:67}],5:[function(X,ce,L){L.createBodyReader=l,L._readNumberingProperties=_;var z=X("dingbat-to-unicode"),I=X("underscore"),d=X("../documents"),k=X("../results").Result,c=X("../results").warning,o=X("../xml"),i=X("../transforms"),t=X("./uris");function l(A){return{readXmlElement:function(W){return new g(A).readXmlElement(W)},readXmlElements:function(W){return new g(A).readXmlElements(W)}}}function g(A){var W=[],S=[],P=[],{relationships:O,contentTypes:H,docxFile:ee,files:U,numbering:J,styles:D}=A;function te(oe){var me=oe.map(ye);return a(me)}function ye(oe){if(oe.type==="element"){var me=j[oe.name];if(me)return me(oe);else if(!Object.prototype.hasOwnProperty.call(y,oe.name)){var xe=c("An unrecognised element was ignored: "+oe.name);return h([xe])}}return T()}function se(oe){return pe(oe).map(function(me){return{type:"paragraphProperties",styleId:me.styleId,styleName:me.name,alignment:oe.firstOrEmpty("w:jc").attributes["w:val"],numbering:_(me.styleId,oe.firstOrEmpty("w:numPr"),J),indent:ve(oe.firstOrEmpty("w:ind"))}})}function ve(oe){return{start:oe.attributes["w:start"]||oe.attributes["w:left"],end:oe.attributes["w:end"]||oe.attributes["w:right"],firstLine:oe.attributes["w:firstLine"],hanging:oe.attributes["w:hanging"]}}function le(oe){return de(oe).map(function(me){var xe=oe.firstOrEmpty("w:sz").attributes["w:val"],De=/^[0-9]+$/.test(xe)?parseInt(xe,10)/2:null;return{type:"runProperties",styleId:me.styleId,styleName:me.name,verticalAlignment:oe.firstOrEmpty("w:vertAlign").attributes["w:val"],font:oe.firstOrEmpty("w:rFonts").attributes["w:ascii"],fontSize:De,isBold:Q(oe.first("w:b")),isUnderline:be(oe.first("w:u")),isItalic:Q(oe.first("w:i")),isStrikethrough:Q(oe.first("w:strike")),isAllCaps:Q(oe.first("w:caps")),isSmallCaps:Q(oe.first("w:smallCaps")),highlight:Te(oe.firstOrEmpty("w:highlight").attributes["w:val"])}})}function be(oe){if(oe){var me=oe.attributes["w:val"];return me!==void 0&&me!=="false"&&me!=="0"&&me!=="none"}else return!1}function Q(oe){if(oe){var me=oe.attributes["w:val"];return me!=="false"&&me!=="0"}else return!1}function ne(oe){return oe!=="false"&&oe!=="0"}function Te(oe){if(!oe||oe==="none")return null;else return oe}function pe(oe){return Be(oe,"w:pStyle","Paragraph",D.findParagraphStyleById)}function de(oe){return Be(oe,"w:rStyle","Run",D.findCharacterStyleById)}function Pe(oe){return Be(oe,"w:tblStyle","Table",D.findTableStyleById)}function Be(oe,me,xe,De){var Me=[],Xe=oe.first(me),ze=null,Ve=null;if(Xe){if(ze=Xe.attributes["w:val"],ze){var Ge=De(ze);if(Ge)Ve=Ge.name;else Me.push(Qe(xe,ze))}}return n({styleId:ze,name:Ve},Me)}function Ie(oe){var me=oe.attributes["w:fldCharType"];if(me==="begin")W.push({type:"begin",fldChar:oe}),S=[];else if(me==="end"){if(W.length===0)return h([c("Ignoring complex field end character without corresponding start character")]);var xe=W.pop();if(xe.type==="begin")xe=Ne(xe);if(xe.type==="checkbox")return x(d.checkbox({checked:xe.checked}))}else if(me==="separate"){if(W.length===0)return h([c("Ignoring complex field separator character without corresponding start character")]);var De=W.pop(),Me=Ne(De);W.push(Me)}return T()}function ke(){var oe=I.last(W.filter(function(me){return me.type==="hyperlink"}));return oe?oe.options:null}function Ne(oe){return Re(S.join(""),oe.type==="begin"?oe.fldChar:o.emptyElement)}function Re(oe,me){var xe=/^\s*HYPERLINK\s+(\\l\s+)?(?:"(.*)"|([^\\]\S*))/.exec(oe);if(xe){var De=xe[2]===void 0?xe[3]:xe[2],Me=xe[1]===void 0?{href:De}:{anchor:De};return{type:"hyperlink",options:Me}}var Xe=/\s*FORMCHECKBOX\s*/.exec(oe);if(Xe){var ze=me.firstOrEmpty("w:ffData").firstOrEmpty("w:checkBox"),Ve=ze.first("w:checked"),Ge=Ve==null?Q(ze.first("w:default")):Q(Ve);return{type:"checkbox",checked:Ge}}return{type:"unknown"}}function We(oe){return S.push(oe.text()),T()}function Ae(oe){var me=oe.attributes["w:font"],xe=oe.attributes["w:char"],De=z.hex(me,xe);if(De==null&&/^F0..$/.test(xe))De=z.hex(me,xe.substring(2));if(De==null)return h([c("A w:sym element with an unsupported character was ignored: char "+xe+" in font "+me)]);else return x(new d.Text(De.string))}function m(oe){return function(me){var xe=me.attributes["w:id"];return x(new d.NoteReference({noteType:oe,noteId:xe}))}}function q(oe){return x(d.commentReference({commentId:oe.attributes["w:id"]}))}function Y(oe){return te(oe.children)}var j={"w:p":function(oe){var me=oe.firstOrEmpty("w:pPr"),xe=!!me.firstOrEmpty("w:rPr").first("w:del");if(xe)return oe.children.forEach(function(Me){P.push(Me)}),T();else{var De=oe.children;if(P.length>0)De=P.concat(De),P=[];return v.map(se(me),te(De),function(Me,Xe){return new d.Paragraph(Xe,Me)}).insertExtra()}},"w:r":function(oe){return v.map(le(oe.firstOrEmpty("w:rPr")),te(oe.children),function(me,xe){var De=ke();if(De!==null)xe=[new d.Hyperlink(xe,De)];return new d.Run(xe,me)})},"w:fldChar":Ie,"w:instrText":We,"w:t":function(oe){return x(new d.Text(oe.text()))},"w:tab":function(oe){return x(new d.Tab)},"w:noBreakHyphen":function(){return x(new d.Text("‑"))},"w:softHyphen":function(oe){return x(new d.Text(""))},"w:sym":Ae,"w:hyperlink":function(oe){var me=oe.attributes["r:id"],xe=oe.attributes["w:anchor"];return te(oe.children).map(function(De){function Me(ze){var Ve=oe.attributes["w:tgtFrame"]||null;return new d.Hyperlink(De,I.extend({targetFrame:Ve},ze))}if(me){var Xe=O.findTargetByRelationshipId(me);if(xe)Xe=t.replaceFragment(Xe,xe);return Me({href:Xe})}else if(xe)return Me({anchor:xe});else return De})},"w:tbl":f,"w:tr":s,"w:tc":N,"w:footnoteReference":m("footnote"),"w:endnoteReference":m("endnote"),"w:commentReference":q,"w:br":function(oe){var me=oe.attributes["w:type"];if(me==null||me==="textWrapping")return x(d.lineBreak);else if(me==="page")return x(d.pageBreak);else if(me==="column")return x(d.columnBreak);else return h([c("Unsupported break type: "+me)])},"w:bookmarkStart":function(oe){var me=oe.attributes["w:name"];if(me==="_GoBack")return T();else return x(new d.BookmarkStart({name:me}))},"mc:AlternateContent":function(oe){return Y(oe.firstOrEmpty("mc:Fallback"))},"w:sdt":function(oe){var me=te(oe.firstOrEmpty("w:sdtContent").children);return me.map(function(xe){var De=oe.firstOrEmpty("w:sdtPr").first("wordml:checkbox");if(De){var Me=De.first("wordml:checked"),Xe=!!Me&&ne(Me.attributes["wordml:val"]),ze=d.checkbox({checked:Xe}),Ve=!1,Ge=xe.map(i._elementsOfType(d.types.text,function($e){if($e.value.length>0&&!Ve)return Ve=!0,ze;else return $e}));if(Ve)return Ge;else return ze}else return xe})},"w:customXml":Y,"w:ins":Y,"w:moveFromRangeEnd":Y,"w:moveFromRangeStart":Y,"w:moveTo":Y,"w:moveToRangeEnd":Y,"w:moveToRangeStart":Y,"w:object":Y,"w:smartTag":Y,"w:drawing":Y,"w:pict":function(oe){return Y(oe).toExtra()},"v:roundrect":Y,"v:shape":Y,"v:textbox":Y,"w:txbxContent":Y,"wp:inline":ue,"wp:anchor":ue,"v:imagedata":Fe,"v:group":Y,"v:rect":Y};return{readXmlElement:ye,readXmlElements:te};function f(oe){var me=r(oe.firstOrEmpty("w:tblPr"));return te(oe.children).flatMap(K).flatMap(function(xe){return me.map(function(De){return d.Table(xe,De)})})}function r(oe){return Pe(oe).map(function(me){return{styleId:me.styleId,styleName:me.name}})}function s(oe){var me=oe.firstOrEmpty("w:trPr"),xe=!!me.first("w:del");if(xe)return T();var De=!!me.first("w:tblHeader");return te(oe.children).map(function(Me){return d.TableRow(Me,{isHeader:De})})}function N(oe){return te(oe.children).map(function(me){var xe=oe.firstOrEmpty("w:tcPr"),De=xe.firstOrEmpty("w:gridSpan").attributes["w:val"],Me=De?parseInt(De,10):1,Xe=d.TableCell(me,{colSpan:Me});return Xe._vMerge=M(xe),Xe})}function M(oe){var me=oe.first("w:vMerge");if(me){var xe=me.attributes["w:val"];return xe==="continue"||!xe}else return null}function K(oe){var me=I.any(oe,function(Me){return Me.type!==d.types.tableRow});if(me)return ie(oe),n(oe,[c("unexpected non-row element in table, cell merging may be incorrect")]);var xe=I.any(oe,function(Me){return I.any(Me.children,function(Xe){return Xe.type!==d.types.tableCell})});if(xe)return ie(oe),n(oe,[c("unexpected non-cell element in table row, cell merging may be incorrect")]);var De={};return oe.forEach(function(Me){var Xe=0;Me.children.forEach(function(ze){if(ze._vMerge&&De[Xe])De[Xe].rowSpan++;else De[Xe]=ze,ze._vMerge=!1;Xe+=ze.colSpan})}),oe.forEach(function(Me){Me.children=Me.children.filter(function(Xe){return!Xe._vMerge}),Me.children.forEach(function(Xe){delete Xe._vMerge})}),x(oe)}function ie(oe){oe.forEach(function(me){var xe=i.getDescendantsOfType(me,d.types.tableCell);xe.forEach(function(De){delete De._vMerge})})}function ue(oe){var me=oe.getElementsByTagName("a:graphic").getElementsByTagName("a:graphicData").getElementsByTagName("pic:pic").getElementsByTagName("pic:blipFill").getElementsByTagName("a:blip");return a(me.map(we.bind(null,oe)))}function we(oe,me){var xe=oe.firstOrEmpty("wp:docPr"),De=xe.attributes,Me=Se(De.descr)?De.title:De.descr,Xe=_e(me);if(Xe===null)return h([c("Could not find image file for a:blip element")]);return He(Xe,Me).map(function(ze){var Ve=xe.firstOrEmpty("a:hlinkClick"),Ge=Ve.attributes["r:id"];if(Ge){var $e=O.findTargetByRelationshipId(Ge);return new d.Hyperlink([ze],{href:$e})}else return ze})}function Se(oe){return oe==null||/^\s*$/.test(oe)}function _e(oe){var me=oe.attributes["r:embed"],xe=oe.attributes["r:link"];if(me)return Ze(me);else if(xe){var De=O.findTargetByRelationshipId(xe);return{path:De,read:U.read.bind(U,De)}}else return null}function Fe(oe){var me=oe.attributes["r:id"];if(me)return He(Ze(me),oe.attributes["o:title"]);else return h([c("A v:imagedata element without a relationship ID was ignored")])}function Ze(oe){var me=t.uriToZipEntryName("word",O.findTargetByRelationshipId(oe));return{path:me,read:ee.read.bind(ee,me)}}function He(oe,me){var xe=H.findContentType(oe.path),De=d.Image({readImage:oe.read,altText:me,contentType:xe}),Me=w[xe]?[]:c("Image of type "+xe+" is unlikely to display in web browsers");return n(De,Me)}function Qe(oe,me){return c(oe+" style with ID "+me+" was referenced but not defined in the document")}}function _(A,W,S){var P=W.firstOrEmpty("w:ilvl").attributes["w:val"],O=W.firstOrEmpty("w:numId").attributes["w:val"];if(P!==void 0&&O!==void 0)return S.findLevel(O,P);if(A!=null){var H=S.findLevelByParagraphStyleId(A);if(H!=null)return H}if(O!==void 0)return S.findLevel(O,"0");return null}var w={"image/png":!0,"image/gif":!0,"image/jpeg":!0,"image/svg+xml":!0,"image/tiff":!0},y={"office-word:wrap":!0,"v:shadow":!0,"v:shapetype":!0,"w:annotationRef":!0,"w:bookmarkEnd":!0,"w:sectPr":!0,"w:proofErr":!0,"w:lastRenderedPageBreak":!0,"w:commentRangeStart":!0,"w:commentRangeEnd":!0,"w:del":!0,"w:footnoteRef":!0,"w:endnoteRef":!0,"w:moveFrom":!0,"w:pPr":!0,"w:rPr":!0,"w:tblPr":!0,"w:tblGrid":!0,"w:trPr":!0,"w:tcPr":!0};function h(A){return new v(null,null,A)}function T(){return new v(null)}function x(A){return new v(A)}function n(A,W){return new v(A,null,W)}function v(A,W,S){this.value=A||[],this.extra=W||[],this._result=new k({element:this.value,extra:W},S),this.messages=this._result.messages}v.prototype.toExtra=function(){return new v(null,E(this.extra,this.value),this.messages)},v.prototype.insertExtra=function(){var A=this.extra;if(A&&A.length)return new v(E(this.value,A),null,this.messages);else return this},v.prototype.map=function(A){var W=this._result.map(function(S){return A(S.element)});return new v(W.value,this.extra,W.messages)},v.prototype.flatMap=function(A){var W=this._result.flatMap(function(S){return A(S.element)._result});return new v(W.value.element,E(this.extra,W.value.extra),W.messages)},v.map=function(A,W,S){return new v(S(A.value,W.value),E(A.extra,W.extra),A.messages.concat(W.messages))};function a(A){var W=k.combine(I.pluck(A,"_result"));return new v(I.flatten(I.pluck(W.value,"element")),I.filter(I.flatten(I.pluck(W.value,"extra")),F),W.messages)}function E(A,W){return I.flatten([A,W])}function F(A){return A}},{"../documents":4,"../results":25,"../transforms":30,"../xml":35,"./uris":16,"dingbat-to-unicode":50,underscore:67}],6:[function(X,ce,L){var z=X("../documents"),I=X("../results").Result;function d(k){function c(i){return I.combine(i.getElementsByTagName("w:comment").map(o))}function o(i){var t=i.attributes["w:id"];function l(g){return(i.attributes[g]||"").trim()||null}return k.readXmlElements(i.children).map(function(g){return z.comment({commentId:t,body:g,authorName:l("w:author"),authorInitials:l("w:initials")})})}return c}L.createCommentsReader=d},{"../documents":4,"../results":25}],7:[function(X,ce,L){L.readContentTypesFromXml=I;var z={png:"png",gif:"gif",jpeg:"jpeg",jpg:"jpeg",tif:"tiff",tiff:"tiff",bmp:"bmp"};L.defaultContentTypes=d({},{});function I(k){var c=Object.create(null),o=Object.create(null);return k.children.forEach(function(i){if(i.name==="content-types:Default")c[i.attributes.Extension]=i.attributes.ContentType;if(i.name==="content-types:Override"){var t=i.attributes.PartName;if(t.charAt(0)==="/")t=t.substring(1);o[t]=i.attributes.ContentType}}),d(o,c)}function d(k,c){return{findContentType:function(o){var i=k[o];if(i)return i;else{var t=o.split("."),l=t[t.length-1];if(Object.prototype.hasOwnProperty.call(c,l))return c[l];else{var g=z[l.toLowerCase()];if(g)return"image/"+g;else return null}}}}}},{}],8:[function(X,ce,L){L.DocumentXmlReader=d;var z=X("../documents"),I=X("../results").Result;function d(k){var c=k.bodyReader;function o(i){var t=i.first("w:body");if(t==null)throw Error("Could not find the body element: are you sure this is a docx file?");var l=c.readXmlElements(t.children).map(function(g){return new z.Document(g,{notes:k.notes,comments:k.comments})});return new I(l.value,l.messages)}return{convertXmlToDocument:o}}},{"../documents":4,"../results":25}],9:[function(X,ce,L){L.read=T,L._findPartPaths=x;var z=X("../promises"),I=X("../documents"),d=X("../results").Result,k=X("../zipfile"),c=X("./office-xml-reader").readXmlFromZipFile,o=X("./body-reader").createBodyReader,i=X("./document-xml-reader").DocumentXmlReader,t=X("./relationships-reader"),l=X("./content-types-reader"),g=X("./numbering-xml"),_=X("./styles-reader"),w=X("./notes-reader"),y=X("./comments-reader"),h=X("./files").Files;function T(O,H,ee){H=H||{},ee=ee||{};var U=new h({externalFileAccess:ee.externalFileAccess,relativeToFile:H.path});return z.props({contentTypes:A(O),partPaths:x(O),docxFile:O,files:U}).also(function(J){return{styles:S(O,J.partPaths.styles)}}).also(function(J){return{numbering:W(O,J.partPaths.numbering,J.styles)}}).also(function(J){return{footnotes:E(J.partPaths.footnotes,J,function(D,te){if(te)return w.createFootnotesReader(D)(te);else return new d([])}),endnotes:E(J.partPaths.endnotes,J,function(D,te){if(te)return w.createEndnotesReader(D)(te);else return new d([])}),comments:E(J.partPaths.comments,J,function(D,te){if(te)return y.createCommentsReader(D)(te);else return new d([])})}}).also(function(J){return{notes:J.footnotes.flatMap(function(D){return J.endnotes.map(function(te){return new I.Notes(D.concat(te))})})}}).then(function(J){return E(J.partPaths.mainDocument,J,function(D,te){return J.notes.flatMap(function(ye){return J.comments.flatMap(function(se){var ve=new i({bodyReader:D,notes:ye,comments:se});return ve.convertXmlToDocument(te)})})})})}function x(O){return P(O).then(function(H){var ee=n({docxFile:O,relationships:H,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",basePath:"",fallbackPath:"word/document.xml"});if(!O.exists(ee))throw Error("Could not find main document part. Are you sure this is a valid .docx file?");return a({filename:F(ee),readElement:t.readRelationships,defaultValue:t.defaultValue})(O).then(function(U){function J(D){return n({docxFile:O,relationships:U,relationshipType:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/"+D,basePath:k.splitPath(ee).dirname,fallbackPath:"word/"+D+".xml"})}return{mainDocument:ee,comments:J("comments"),endnotes:J("endnotes"),footnotes:J("footnotes"),numbering:J("numbering"),styles:J("styles")}})})}function n(O){var{docxFile:H,relationships:ee,relationshipType:U,basePath:J,fallbackPath:D}=O,te=ee.findTargetsByType(U),ye=te.map(function(ve){return v(k.joinPath(J,ve),"/")}),se=ye.filter(function(ve){return H.exists(ve)});if(se.length===0)return D;else return se[0]}function v(O,H){if(O.substring(0,H.length)===H)return O.substring(H.length);else return O}function a(O){return function(H){return c(H,O.filename).then(function(ee){return ee?O.readElement(ee):O.defaultValue})}}function E(O,H,ee){var U=a({filename:F(O),readElement:t.readRelationships,defaultValue:t.defaultValue});return U(H.docxFile).then(function(J){var D=new o({relationships:J,contentTypes:H.contentTypes,docxFile:H.docxFile,numbering:H.numbering,styles:H.styles,files:H.files});return c(H.docxFile,O).then(function(te){return ee(D,te)})})}function F(O){var H=k.splitPath(O);return k.joinPath(H.dirname,"_rels",H.basename+".rels")}var A=a({filename:"[Content_Types].xml",readElement:l.readContentTypesFromXml,defaultValue:l.defaultContentTypes});function W(O,H,ee){return a({filename:H,readElement:function(U){return g.readNumberingXml(U,{styles:ee})},defaultValue:g.defaultNumbering})(O)}function S(O,H){return a({filename:H,readElement:_.readStylesXml,defaultValue:_.defaultStyles})(O)}var P=a({filename:"_rels/.rels",readElement:t.readRelationships,defaultValue:t.defaultValue})},{"../documents":4,"../promises":23,"../results":25,"../zipfile":40,"./body-reader":5,"./comments-reader":6,"./content-types-reader":7,"./document-xml-reader":8,"./files":1,"./notes-reader":10,"./numbering-xml":11,"./office-xml-reader":12,"./relationships-reader":13,"./styles-reader":15}],10:[function(X,ce,L){var z=X("../documents"),I=X("../results").Result;L.createFootnotesReader=d.bind(this,"footnote"),L.createEndnotesReader=d.bind(this,"endnote");function d(k,c){function o(l){return I.combine(l.getElementsByTagName("w:"+k).filter(i).map(t))}function i(l){var g=l.attributes["w:type"];return g!=="continuationSeparator"&&g!=="separator"}function t(l){var g=l.attributes["w:id"];return c.readXmlElements(l.children).map(function(_){return z.Note({noteType:k,noteId:g,body:_})})}return o}},{"../documents":4,"../results":25}],11:[function(X,ce,L){var z=X("underscore");L.readNumberingXml=d,L.Numbering=I,L.defaultNumbering=new I({},{});function I(i,t,l){var g=z.flatten(z.values(t).map(function(T){return z.values(T.levels)})),_=z.indexBy(g.filter(function(T){return T.paragraphStyleId!=null}),"paragraphStyleId");function w(T,x){return y(T,x,Object.create(null))}function y(T,x,n){if(n[T])return null;n[T]=!0;var v=i[T];if(!v)return null;var a=t[v.abstractNumId];if(!a)return null;else if(a.numStyleLink==null)return t[v.abstractNumId].levels[x];else{var E=l.findNumberingStyleById(a.numStyleLink);return y(E.numId,x,n)}}function h(T){return _[T]||null}return{findLevel:w,findLevelByParagraphStyleId:h}}function d(i,t){if(!t||!t.styles)throw Error("styles is missing");var l=k(i),g=o(i,l);return new I(g,l,t.styles)}function k(i){var t=Object.create(null);return i.getElementsByTagName("w:abstractNum").forEach(function(l){var g=l.attributes["w:abstractNumId"];t[g]=c(l)}),t}function c(i){var t=Object.create(null),l=null;if(i.getElementsByTagName("w:lvl").forEach(function(_){var w=_.attributes["w:ilvl"],y=_.firstOrEmpty("w:numFmt").attributes["w:val"],h=y!=="bullet",T=_.firstOrEmpty("w:pStyle").attributes["w:val"];if(w===void 0)l={isOrdered:h,level:"0",paragraphStyleId:T};else t[w]={isOrdered:h,level:w,paragraphStyleId:T}}),l!==null&&t[l.level]===void 0)t[l.level]=l;var g=i.firstOrEmpty("w:numStyleLink").attributes["w:val"];return{levels:t,numStyleLink:g}}function o(i){var t=Object.create(null);return i.getElementsByTagName("w:num").forEach(function(l){var g=l.attributes["w:numId"],_=l.first("w:abstractNumId").attributes["w:val"];t[g]={abstractNumId:_}}),t}},{underscore:67}],12:[function(X,ce,L){var z=X("underscore"),I=X("../promises"),d=X("../xml");L.read=c,L.readXmlFromZipFile=o;var k={"http://schemas.openxmlformats.org/wordprocessingml/2006/main":"w","http://schemas.openxmlformats.org/officeDocument/2006/relationships":"r","http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing":"wp","http://schemas.openxmlformats.org/drawingml/2006/main":"a","http://schemas.openxmlformats.org/drawingml/2006/picture":"pic","http://purl.oclc.org/ooxml/wordprocessingml/main":"w","http://purl.oclc.org/ooxml/officeDocument/relationships":"r","http://purl.oclc.org/ooxml/drawingml/wordprocessingDrawing":"wp","http://purl.oclc.org/ooxml/drawingml/main":"a","http://purl.oclc.org/ooxml/drawingml/picture":"pic","http://schemas.openxmlformats.org/package/2006/content-types":"content-types","http://schemas.openxmlformats.org/package/2006/relationships":"relationships","http://schemas.openxmlformats.org/markup-compatibility/2006":"mc","urn:schemas-microsoft-com:vml":"v","urn:schemas-microsoft-com:office:word":"office-word","http://schemas.microsoft.com/office/word/2010/wordml":"wordml"};function c(l){return d.readString(l,k).then(function(g){return t(g)[0]})}function o(l,g){if(l.exists(g))return l.read(g,"utf-8").then(i).then(c);else return I.resolve(null)}function i(l){return l.replace(/^\uFEFF/g,"")}function t(l){if(l.type==="element")if(l.name==="mc:AlternateContent")return l.firstOrEmpty("mc:Fallback").children;else return l.children=z.flatten(l.children.map(t,!0)),[l];else return[l]}},{"../promises":23,"../xml":35,underscore:67}],13:[function(X,ce,L){L.readRelationships=z,L.defaultValue=new I([]),L.Relationships=I;function z(d){var k=[];return d.children.forEach(function(c){if(c.name==="relationships:Relationship"){var o={relationshipId:c.attributes.Id,target:c.attributes.Target,type:c.attributes.Type};k.push(o)}}),new I(k)}function I(d){var k=Object.create(null);d.forEach(function(o){k[o.relationshipId]=o.target});var c=Object.create(null);return d.forEach(function(o){if(!c[o.type])c[o.type]=[];c[o.type].push(o.target)}),{findTargetByRelationshipId:function(o){return k[o]},findTargetsByType:function(o){return c[o]||[]}}}},{}],14:[function(X,ce,L){var z=X("underscore"),I=X("../promises"),d=X("../xml");L.writeStyleMap=i,L.readStyleMap=_;var k="http://schemas.zwobble.org/mammoth/style-map",c="mammoth/style-map",o="/"+c;function i(w,y){return w.write(c,y),t(w).then(function(){return l(w)})}function t(w){var y="word/_rels/document.xml.rels",h="http://schemas.openxmlformats.org/package/2006/relationships",T="{"+h+"}Relationship";return w.read(y,"utf8").then(d.readString).then(function(x){var n=x.children;g(n,T,"Id",{Id:"rMammothStyleMap",Type:k,Target:o});var v={"":h};return w.write(y,d.writeString(x,v))})}function l(w){var y="[Content_Types].xml",h="http://schemas.openxmlformats.org/package/2006/content-types",T="{"+h+"}Override";return w.read(y,"utf8").then(d.readString).then(function(x){var n=x.children;g(n,T,"PartName",{PartName:o,ContentType:"text/prs.mammoth.style-map"});var v={"":h};return w.write(y,d.writeString(x,v))})}function g(w,y,h,T){var x=z.find(w,function(n){return n.name===y&&n.attributes[h]===T[h]});if(x)x.attributes=T;else w.push(d.element(y,T))}function _(w){if(w.exists(c))return w.read(c,"utf8");else return I.resolve(null)}},{"../promises":23,"../xml":35,underscore:67}],15:[function(X,ce,L){L.readStylesXml=I,L.Styles=z,L.defaultStyles=new z({},{});function z(i,t,l,g){return{findParagraphStyleById:function(_){return i[_]},findCharacterStyleById:function(_){return t[_]},findTableStyleById:function(_){return l[_]},findNumberingStyleById:function(_){return g[_]}}}z.EMPTY=new z({},{},{},{});function I(i){var t=Object.create(null),l=Object.create(null),g=Object.create(null),_=Object.create(null);return i.getElementsByTagName("w:style").forEach(function(w){var y=d(w),h;switch(y.type){case"paragraph":h=t;break;case"character":h=l;break;case"table":h=g;break;case"numbering":h=_;break}if(h&&h[y.styleId]===void 0)h[y.styleId]=y}),new z(t,l,g,_)}function d(i){var t=i.attributes["w:type"];if(t==="numbering")return c(t,i);else{var l=o(i),g=k(i);return{type:t,styleId:l,name:g}}}function k(i){var t=i.first("w:name");return t?t.attributes["w:val"]:null}function c(i,t){var l=o(t),g=t.firstOrEmpty("w:pPr").firstOrEmpty("w:numPr").firstOrEmpty("w:numId").attributes["w:val"];return{type:i,numId:g,styleId:l}}function o(i){return i.attributes["w:styleId"]}},{}],16:[function(X,ce,L){L.uriToZipEntryName=z,L.replaceFragment=I;function z(d,k){if(k.charAt(0)==="/")return k.substr(1);else return d+"/"+k}function I(d,k){var c=d.indexOf("#");if(c!==-1)d=d.substring(0,c);return d+"#"+k}},{}],17:[function(X,ce,L){var z=X("../styles/html-paths");function I(l,g,_){return k(z.element(l,g,{fresh:!1}),_)}function d(l,g,_){var w=z.element(l,g,{fresh:!0});return k(w,_)}function k(l,g){return{type:"element",tag:l,children:g||[]}}function c(l){return{type:"text",value:l}}var o={type:"forceWrite"};L.freshElement=d,L.nonFreshElement=I,L.elementWithTag=k,L.text=c,L.forceWrite=o;var i={br:!0,hr:!0,img:!0,input:!0};function t(l){return l.children.length===0&&i[l.tag.tagName]}L.isVoidElement=t},{"../styles/html-paths":28}],18:[function(X,ce,L){var z=X("./ast");L.freshElement=z.freshElement,L.nonFreshElement=z.nonFreshElement,L.elementWithTag=z.elementWithTag,L.text=z.text,L.forceWrite=z.forceWrite,L.simplify=X("./simplify");function I(i,t){t.forEach(function(l){d(i,l)})}function d(i,t){k[t.type](i,t)}var k={element:c,text:o,forceWrite:function(){}};function c(i,t){if(z.isVoidElement(t))i.selfClosing(t.tag.tagName,t.tag.attributes);else i.open(t.tag.tagName,t.tag.attributes),I(i,t.children),i.close(t.tag.tagName)}function o(i,t){i.text(t.value)}L.write=I},{"./ast":17,"./simplify":19}],19:[function(X,ce,L){var z=X("underscore"),I=X("./ast");function d(x){return k(g(x))}function k(x){var n=[];return x.map(c).forEach(function(v){l(n,v)}),n}function c(x){return o[x.type](x)}var o={element:i,text:t,forceWrite:t};function i(x){return I.elementWithTag(x.tag,k(x.children))}function t(x){return x}function l(x,n){var v=x[x.length-1];if(n.type==="element"&&!n.tag.fresh&&v&&v.type==="element"&&n.tag.matchesElement(v.tag)){if(n.tag.separator)l(v.children,I.text(n.tag.separator));n.children.forEach(function(a){l(v.children,a)})}else x.push(n)}function g(x){return _(x,function(n){return w[n.type](n)})}function _(x,n){return z.flatten(z.map(x,n),!0)}var w={element:h,text:T,forceWrite:y};function y(x){return[x]}function h(x){var n=g(x.children);if(n.length===0&&!I.isVoidElement(x))return[];else return[I.elementWithTag(x.tag,n)]}function T(x){if(x.value.length===0)return[];else return[x]}ce.exports=d},{"./ast":17,underscore:67}],20:[function(X,ce,L){var z=X("underscore"),I=X("./promises"),d=X("./html");L.imgElement=k;function k(o){return function(i,t){return I.resolve(o(i)).then(function(l){var g={};if(i.altText)g.alt=i.altText;return z.extend(g,l),[d.freshElement("img",g)]})}}L.inline=L.imgElement,L.dataUri=k(function(o){return o.readAsBase64String().then(function(i){return{src:"data:"+o.contentType+";base64,"+i}})});function c(o){return o.contentType.split(/\/|\\/)[1]}L.imageFilenameExtension=c},{"./html":18,"./promises":23,underscore:67}],21:[function(X,ce,L){(function(z){var I=X("underscore"),d=X("./docx/docx-reader"),k=X("./docx/style-map"),c=X("./document-to-html").DocumentConverter,o=X("./raw-text").convertElementToRawText,i=X("./style-reader").readStyle,t=X("./options-reader").readOptions,l=X("./promises"),g=X("./unzip"),_=X("./results").Result;L.convertToHtml=w,L.convertToMarkdown=y,L.convert=h,L.extractRawText=v,L.images=X("./images"),L.transforms=X("./transforms"),L.underline=X("./underline"),L.embedStyleMap=a,L.readEmbeddedStyleMap=T;function w(E,F){return h(E,F)}function y(E,F){var A=Object.create(F||{});return A.outputFormat="markdown",h(E,A)}function h(E,F){F=t(F);var A=g.openZip(E).then(function(W){return k.readStyleMap(W).then(function(S){return F.embeddedStyleMap=S,W})}).then(function(W){return d.read(W,E,F).then(function(S){return S.map(F.transformDocument)}).then(function(S){return x(S,F)})});return l.toExternalPromise(A)}function T(E){var F=g.openZip(E).then(k.readStyleMap);return l.toExternalPromise(F)}function x(E,F){var A=n(F.readStyleMap()),W=I.extend({},F,{styleMap:A.value}),S=new c(W);return E.flatMapThen(function(P){return A.flatMapThen(function(O){return S.convertToHtml(P)})})}function n(E){return _.combine((E||[]).map(i)).map(function(F){return F.filter(function(A){return!!A})})}function v(E){var F=g.openZip(E).then(d.read).then(function(A){return A.map(o)});return l.toExternalPromise(F)}function a(E,F){var A=g.openZip(E).then(function(W){return k.writeStyleMap(W,F).then(function(){return W})}).then(function(W){return W.toArrayBuffer()}).then(function(W){return{toArrayBuffer:function(){return W},toBuffer:function(){return z.from(W)}}});return l.toExternalPromise(A)}L.styleMapping=function(){throw Error(`Use a raw string instead of mammoth.styleMapping e.g. "p[style-name='Title'] => h1" instead of mammoth.styleMapping("p[style-name='Title'] => h1")`)}}).call(this,X("buffer").Buffer)},{"./document-to-html":3,"./docx/docx-reader":9,"./docx/style-map":14,"./images":20,"./options-reader":22,"./promises":23,"./raw-text":24,"./results":25,"./style-reader":26,"./transforms":30,"./underline":31,"./unzip":2,buffer:48,underscore:67}],22:[function(X,ce,L){L.readOptions=k;var z=X("underscore"),I=L._defaultStyleMap=["p.Heading1 => h1:fresh","p.Heading2 => h2:fresh","p.Heading3 => h3:fresh","p.Heading4 => h4:fresh","p.Heading5 => h5:fresh","p.Heading6 => h6:fresh","p[style-name='Heading 1'] => h1:fresh","p[style-name='Heading 2'] => h2:fresh","p[style-name='Heading 3'] => h3:fresh","p[style-name='Heading 4'] => h4:fresh","p[style-name='Heading 5'] => h5:fresh","p[style-name='Heading 6'] => h6:fresh","p[style-name='heading 1'] => h1:fresh","p[style-name='heading 2'] => h2:fresh","p[style-name='heading 3'] => h3:fresh","p[style-name='heading 4'] => h4:fresh","p[style-name='heading 5'] => h5:fresh","p[style-name='heading 6'] => h6:fresh","p.Heading => h1:fresh","p[style-name='Heading'] => h1:fresh","r[style-name='Strong'] => strong","p[style-name='footnote text'] => p:fresh","r[style-name='footnote reference'] =>","p[style-name='endnote text'] => p:fresh","r[style-name='endnote reference'] =>","p[style-name='annotation text'] => p:fresh","r[style-name='annotation reference'] =>","p[style-name='Footnote'] => p:fresh","r[style-name='Footnote anchor'] =>","p[style-name='Endnote'] => p:fresh","r[style-name='Endnote anchor'] =>","p:unordered-list(1) => ul > li:fresh","p:unordered-list(2) => ul|ol > li > ul > li:fresh","p:unordered-list(3) => ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:unordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ul > li:fresh","p:ordered-list(1) => ol > li:fresh","p:ordered-list(2) => ul|ol > li > ol > li:fresh","p:ordered-list(3) => ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(4) => ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","p:ordered-list(5) => ul|ol > li > ul|ol > li > ul|ol > li > ul|ol > li > ol > li:fresh","r[style-name='Hyperlink'] =>","p[style-name='Normal'] => p:fresh","p.Body => p:fresh","p[style-name='Body'] => p:fresh"],d=L._standardOptions={externalFileAccess:!1,transformDocument:o,includeDefaultStyleMap:!0,includeEmbeddedStyleMap:!0};function k(i){return i=i||{},z.extend({},d,i,{customStyleMap:c(i.styleMap),readStyleMap:function(){var t=this.customStyleMap;if(this.includeEmbeddedStyleMap)t=t.concat(c(this.embeddedStyleMap));if(this.includeDefaultStyleMap)t=t.concat(I);return t}})}function c(i){if(!i)return[];else if(z.isString(i))return i.split(`
|
|
3
3
|
`).map(function(t){return t.trim()}).filter(function(t){return t!==""&&t.charAt(0)!=="#"});else return i}function o(i){return i}},{underscore:67}],23:[function(X,ce,L){(function(z){var I=X("underscore");L.defer=o,L.Promise=Promise,L.resolve=Promise.resolve.bind(Promise),L.reject=Promise.reject.bind(Promise),L.forEachSeries=function(g,_){var w=0,y=o(),h=function(){if(w<g.length){var T=g[w];w++,_(T).then(h,y.reject)}else y.resolve()};return h(),y.promise};var d=L.props=function(g){var _=Object.keys(g),w=Object.values(g),y=Promise.all(w).then(function(h){var T={};for(var x=0;x<_.length;x++)T[_[x]]=h[x];return T});return c(y)},k=function(g){var _=this.then(function(w){var y=I.extend({},w,g(w));return d(y)});return c(_)};function c(g){return g.also=k,g}L.try=function(g){try{return Promise.resolve(g())}catch(_){return Promise.reject(_)}};function o(){var g,_,w=new Promise(function(y,h){g=y,_=h});return{resolve:g,reject:_,promise:w}}function i(g){var _=new Promise(g);return _.__proto__=i.prototype,_}i.__proto__=Promise,i.prototype.__proto__=Promise.prototype,i.prototype.done=function(g,_){return this.then(g,_).catch(function(w){if(l()){var y=w instanceof Error?w.stack:w;z.stderr.write("Fatal "+y+`
|
|
4
4
|
`),z.exit(2)}else setTimeout(function(){throw w},0)})};function t(g){return i.resolve(g)}L.toExternalPromise=t;function l(){if(typeof z>"u")return!1;return{}.toString.call(z).toLowerCase()==="[object process]"}}).call(this,X("_process"))},{_process:66,underscore:67}],24:[function(X,ce,L){var z=X("./documents");function I(d){if(d.type==="text")return d.value;else if(d.type===z.types.tab)return"\t";else{var k=d.type==="paragraph"?`
|