@kabmo-labs/kabmo 0.46.0 → 0.46.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/{CsvGrid-br4j001k.js → CsvGrid-qdkmv8bj.js} +1 -1
- package/dist/client/static/js/{DocxView-kmtkbmmw.js → DocxView-k84ns803.js} +1 -1
- package/dist/client/static/js/{DrawioView-3df0g3jr.js → DrawioView-r1n717f7.js} +1 -1
- package/dist/client/static/js/{ImageView-2r8p5z3y.js → ImageView-jkrdrq8v.js} +1 -1
- package/dist/client/static/js/{LayoutWrapper-rq3d2a4e.js → LayoutWrapper-sh634350.js} +2 -2
- package/dist/client/static/js/{Modal-tmxhxd6q.js → Modal-xe6h99jn.js} +1 -1
- package/dist/client/static/js/{PdfView-p5z7c7eg.js → PdfView-ffg4mccg.js} +1 -1
- package/dist/client/static/js/{SessionsView-t06h6zfx.js → SessionsView-cdcbsee9.js} +1 -1
- package/dist/client/static/js/{SheetView-agw459v2.js → SheetView-89sscpz6.js} +1 -1
- package/dist/client/static/js/{SvgPreview-b9rfy1h6.js → SvgPreview-68c0ccbv.js} +1 -1
- package/dist/client/static/js/{abnfDiagram-O67JEVCF-wbnhzcnj.js → abnfDiagram-O67JEVCF-h3a5s259.js} +1 -1
- package/dist/client/static/js/{architectureDiagram-NJMV4G6O-t2sgevea.js → architectureDiagram-NJMV4G6O-983p0jgn.js} +1 -1
- package/dist/client/static/js/{blockDiagram-BEXU5L5S-v2nzp54a.js → blockDiagram-BEXU5L5S-16pse5mh.js} +1 -1
- package/dist/client/static/js/{c4Diagram-YGBWAQC7-7h03146b.js → c4Diagram-YGBWAQC7-mvnb00zt.js} +1 -1
- package/dist/client/static/js/{classDiagram-v2-NBCMYWYE-m57e9kp1.js → classDiagram-v2-NBCMYWYE-kmpd91xb.js} +1 -1
- package/dist/client/static/js/{cose-bilkent-JH36ORCC-c4tnh4mg.js → cose-bilkent-JH36ORCC-3ek5r5se.js} +1 -1
- package/dist/client/static/js/{cynefinDiagram-VND7K2PF-mjf6njey.js → cynefinDiagram-VND7K2PF-jkbh84zn.js} +1 -1
- package/dist/client/static/js/{dagre-6A5THRUB-6yma9ch3.js → dagre-6A5THRUB-4fdc0sgn.js} +1 -1
- package/dist/client/static/js/{diagram-22UHCM2B-1q4ce2gb.js → diagram-22UHCM2B-hbk61nq9.js} +1 -1
- package/dist/client/static/js/{diagram-3UASUU5V-0ttps29p.js → diagram-3UASUU5V-hfpbr9qh.js} +1 -1
- package/dist/client/static/js/{diagram-ATOU4E4O-1mzexgv1.js → diagram-ATOU4E4O-fn0nt71a.js} +1 -1
- package/dist/client/static/js/{diagram-CDSNMT55-4ae89t23.js → diagram-CDSNMT55-ssswxjeb.js} +1 -1
- package/dist/client/static/js/{diagram-MLGK6HIB-057jaqvh.js → diagram-MLGK6HIB-whnzxv6f.js} +1 -1
- package/dist/client/static/js/{diagram-MPIPVDR6-p6yyq5sx.js → diagram-MPIPVDR6-hk1chzxk.js} +1 -1
- package/dist/client/static/js/{dockerfile-00hqsk9c.js → dockerfile-zmsj8r4g.js} +1 -1
- package/dist/client/static/js/{ebnfDiagram-ZINNZB2B-bsk7dvm4.js → ebnfDiagram-ZINNZB2B-q1vkg5mr.js} +1 -1
- package/dist/client/static/js/{elk-276RUBZZ-dsq91er5.js → elk-276RUBZZ-kt98vg8j.js} +1 -1
- package/dist/client/static/js/{erDiagram-OPXOYQCR-p7p13mbh.js → erDiagram-OPXOYQCR-ey3avsn9.js} +1 -1
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7gvtpn3d.js +1 -0
- package/dist/client/static/js/{ganttDiagram-FUAMR5RP-bwgnttyk.js → ganttDiagram-FUAMR5RP-a9k1at43.js} +1 -1
- package/dist/client/static/js/{gitGraphDiagram-X574FWY7-ca0gj5am.js → gitGraphDiagram-X574FWY7-gnekjfym.js} +1 -1
- package/dist/client/static/js/{index-jkay7aw7.js → index-1ax52p0q.js} +1 -1
- package/dist/client/static/js/{index-064vdkrs.js → index-2a6qp9y6.js} +1 -1
- package/dist/client/static/js/{index-j718pxb3.js → index-3x7h2eqj.js} +1 -1
- package/dist/client/static/js/{index-amys498v.js → index-4cag7w6k.js} +131 -131
- package/dist/client/static/js/{index-ta6gpcpw.js → index-5ka2tyf9.js} +2 -2
- package/dist/client/static/js/{index-x1fqhhpp.js → index-60v30k5h.js} +2 -2
- package/dist/client/static/js/{index-5gf52a6d.js → index-65afr75v.js} +1 -1
- package/dist/client/static/js/{index-4bqssvt6.js → index-83rkg916.js} +1 -1
- package/dist/client/static/js/{index-aagt3382.js → index-84fyq5a6.js} +1 -1
- package/dist/client/static/js/{index-dr5hca5b.js → index-8g7q8mz4.js} +1 -1
- package/dist/client/static/js/{index-bjv5ga2e.js → index-9vv7wr1n.js} +1 -1
- package/dist/client/static/js/{index-pwe6chtp.js → index-amsa0tfs.js} +1 -1
- package/dist/client/static/js/{index-red856x6.js → index-atq9q1s7.js} +1 -1
- package/dist/client/static/js/{index-f7te27n5.js → index-b2e5pwx7.js} +1 -1
- package/dist/client/static/js/{index-ex5dtdx2.js → index-b5dfvget.js} +1 -1
- package/dist/client/static/js/{index-zedt16w7.js → index-bsr7wmj2.js} +1 -1
- package/dist/client/static/js/{index-k5zfzgez.js → index-c9e417cs.js} +1 -1
- package/dist/client/static/js/{index-3bf7r7z4.js → index-dt6q3rws.js} +4 -4
- package/dist/client/static/js/{index-29npynva.js → index-e9cxje00.js} +1 -1
- package/dist/client/static/js/{index-zq0qxb17.js → index-fzngzhww.js} +1 -1
- package/dist/client/static/js/{index-16sd19f0.js → index-hgzntg2j.js} +1 -1
- package/dist/client/static/js/{index-bafe7hmd.js → index-kb14dhrx.js} +1 -1
- package/dist/client/static/js/{index-qn200x1b.js → index-kbhrvep8.js} +6 -6
- package/dist/client/static/js/{index-eqhjs1yv.js → index-m4k054wz.js} +3 -3
- package/dist/client/static/js/{index-8pksqzwq.js → index-pavvxrsz.js} +1 -1
- package/dist/client/static/js/{index-95kese1h.js → index-q9ytjey8.js} +1 -1
- package/dist/client/static/js/{index-3qnjdjg2.js → index-vkqb4dnt.js} +1 -1
- package/dist/client/static/js/{index-7055hdx1.js → index-wrcdc9vz.js} +1 -1
- package/dist/client/static/js/{index-ncpwteyt.js → index-x9r7zfp4.js} +1 -1
- package/dist/client/static/js/{index-y2z8nsvw.js → index-xq5f3nxa.js} +1 -1
- package/dist/client/static/js/{index-gq5w5w8x.js → index-xwjbq003.js} +1 -1
- package/dist/client/static/js/{index-twsbv1yn.js → index-yf93db65.js} +1 -1
- package/dist/client/static/js/{index-9d3n04vb.js → index-ykm7a3cp.js} +2 -2
- package/dist/client/static/js/{index-5h8y54t6.js → index-z25ss7xj.js} +1 -1
- package/dist/client/static/js/{infoDiagram-VRGFBTTK-7q58qdf1.js → infoDiagram-VRGFBTTK-r1p25738.js} +1 -1
- package/dist/client/static/js/{ishikawaDiagram-OU5B5YK6-9jmeszag.js → ishikawaDiagram-OU5B5YK6-afgrqdrt.js} +1 -1
- package/dist/client/static/js/{journeyDiagram-ZHPQQLJL-0d7xe845.js → journeyDiagram-ZHPQQLJL-hepa4wk7.js} +1 -1
- package/dist/client/static/js/{kanban-definition-PNTS6WVX-7p83rwdn.js → kanban-definition-PNTS6WVX-jysft8ya.js} +1 -1
- package/dist/client/static/js/{mermaid.core-hwhzw0wv.js → mermaid.core-0m90b0s8.js} +2 -2
- package/dist/client/static/js/{mindmap-definition-NLK3R4M7-hy0rtr7t.js → mindmap-definition-NLK3R4M7-x2rrzpvr.js} +1 -1
- package/dist/client/static/js/one-dark-pro-09d8p5vy.js +1 -0
- package/dist/client/static/js/one-light-g3ednt6p.js +1 -0
- package/dist/client/static/js/{pegDiagram-GJSIUBJH-kd8t53tx.js → pegDiagram-GJSIUBJH-z7vb7f1z.js} +1 -1
- package/dist/client/static/js/{pieDiagram-5QR66LMP-h3x03f80.js → pieDiagram-5QR66LMP-jqv6v4e6.js} +1 -1
- package/dist/client/static/js/{quadrantDiagram-O4NWA36T-y2b1ncbg.js → quadrantDiagram-O4NWA36T-w2h8yxrv.js} +1 -1
- package/dist/client/static/js/{railroadDiagram-XR7U4H2S-x188rcxf.js → railroadDiagram-XR7U4H2S-nd09yac3.js} +1 -1
- package/dist/client/static/js/{requirementDiagram-PLB6GJNP-g5e9fk17.js → requirementDiagram-PLB6GJNP-t61zxh5v.js} +1 -1
- package/dist/client/static/js/{rust-1v8xbxn9.js → rust-avnkhh0p.js} +1 -1
- package/dist/client/static/js/{sankeyDiagram-IPEJSGJF-y9ht91gf.js → sankeyDiagram-IPEJSGJF-2f7h2cmw.js} +1 -1
- package/dist/client/static/js/{sequenceDiagram-PO4LG4MO-pp8s63rt.js → sequenceDiagram-PO4LG4MO-kfb5d7zd.js} +1 -1
- package/dist/client/static/js/{sizeCapture-INFHLROL-k6dhfxex.js → sizeCapture-INFHLROL-amfg19se.js} +1 -1
- package/dist/client/static/js/{stateDiagram-v2-GCMORJYK-y3akpsm4.js → stateDiagram-v2-GCMORJYK-k5hx7btx.js} +1 -1
- package/dist/client/static/js/{swimlanes-2SLR337P-89081dr3.js → swimlanes-2SLR337P-wv3rp8kk.js} +1 -1
- package/dist/client/static/js/{swimlanesDiagram-TC7HE7FX-3q2a15wc.js → swimlanesDiagram-TC7HE7FX-6y8zdbm4.js} +1 -1
- package/dist/client/static/js/{timeline-definition-EJHVYXUP-tz6r8g3q.js → timeline-definition-EJHVYXUP-0re95wtn.js} +1 -1
- package/dist/client/static/js/{usecaseDiagram-POWQR4AR-yq2y1b09.js → usecaseDiagram-POWQR4AR-yrje14qp.js} +1 -1
- package/dist/client/static/js/{vennDiagram-UO4OBE2U-qdmjf6x3.js → vennDiagram-UO4OBE2U-jxkmrfy5.js} +1 -1
- package/dist/client/static/js/{wardleyDiagram-VNRHLVJA-3n2sm7rj.js → wardleyDiagram-VNRHLVJA-d3v2m9b1.js} +1 -1
- package/dist/client/static/js/{xychartDiagram-PMCCYNJV-d7n2av2t.js → xychartDiagram-PMCCYNJV-9a1s1rjt.js} +1 -1
- package/package.json +1 -1
- package/src/client/components/layout/desktop-layout/LeftColumn.tsx +2 -1
- package/src/client/components/layout/desktop-layout/RightColumn.test.tsx +204 -0
- package/src/client/components/layout/desktop-layout/RightColumn.tsx +37 -16
- package/src/client/components/mobile/RightSidebar.tsx +10 -8
- package/src/client/components/mobile/mobile-session-sidebar/use-drawer-tabs.ts +2 -1
- package/src/client/components/workspace/chat-timeline/MessageList.test.ts +11 -0
- package/src/client/components/workspace/chat-timeline/MessageList.tsx +29 -21
- package/src/client/hooks/chat/timeline/row-measure.ts +75 -0
- package/src/client/hooks/chat/timeline/row-window.test.ts +41 -21
- package/src/client/hooks/chat/timeline/row-window.ts +6 -24
- package/src/client/hooks/workspace/panel-tabs-reveal.test.tsx +20 -17
- package/src/client/hooks/workspace/panel-tabs-reveal.ts +29 -17
- package/src/client/hooks/workspace/panel-tabs.ts +3 -2
- package/src/client/hooks/workspace/session-state/index.test.tsx +145 -0
- package/src/client/hooks/workspace/session-state/index.ts +28 -16
- package/dist/client/static/js/flowDiagram-KWPJA3E3-7b4w6phx.js +0 -1
- package/dist/client/static/js/one-dark-pro-4b8er03c.js +0 -1
- package/dist/client/static/js/one-light-e6r3vsz4.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-dpy3ewrn.css"><script type="module" crossorigin src="./static/js/index-
|
|
68
|
+
<link rel="stylesheet" crossorigin href="./static/js/index-dpy3ewrn.css"><script type="module" crossorigin src="./static/js/index-4cag7w6k.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(!RS(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),IS){if(!d)continue;for(let[p,m]of Object.entries(d))if(!(!m||!(p in KU))){if(m instanceof Promise){a&&(c[u]||(c[u]={}),l.push(m.then((h)=>{h instanceof Response&&(c[u][p]=h),Zh(h)&&(c[u][p]=h)})));continue}!(m instanceof Response)&&!Zh(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=WU(px(px(r(e.router.response),HU(e)),e.config.serve?.routes)),i=typeof t=="object"?{development:!Aa,reusePort:!0,idleTimeout:30,...e.config.serve||{},...t||{},routes:o,websocket:{...e.config.websocket||{},...XP||{},...t.websocket||{}},fetch:e.fetch}:{development:!Aa,reusePort:!0,idleTimeout:30,...e.config.serve||{},routes:o,websocket:{...e.config.websocket||{},...XP||{}},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=WU(px(px(await r(e.router.response,{withAsync:!0}),HU(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=zt(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=zt(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 S=n.upgrade(u);S instanceof Promise&&await S}else n.upgrade&&Object.assign(p.headers,n.upgrade);if(p.cookie&&$e(p.cookie)){let S=Kh(p.cookie);S&&(p.headers["set-cookie"]=S)}p.headers["set-cookie"]&&Array.isArray(p.headers["set-cookie"])&&(p.headers=BP(new Headers(p.headers),p.headers["set-cookie"]));let w=jU(l),I=UU(r),A;if(typeof n.beforeHandle=="function"){let S=n.beforeHandle(u);S instanceof Promise&&await S}let T=[...n.error?Array.isArray(n.error)?n.error:[n.error]:[],...(e.event.error??[]).map((S)=>typeof S=="function"?S:S.fn)].filter((S)=>S),P=T.length>0,x=P?async(S,R)=>{for(let C of T){let k=C(Object.assign(u,{error:R}));if(k instanceof Promise&&(k=await k),await w(S,k),k)break}}:()=>{};if(!d?.upgrade(u.request,{headers:$e(p.headers)?p.headers:void 0,data:{...u,get id(){return A||(A=va())},validator:l,ping(S,R){n.ping?.(S,R)},pong(S,R){n.pong?.(S,R)},open:async(S)=>{try{await w(S,n.open?.(new xm(S,u)))}catch(R){x(S,R)}},message:async(S,R)=>{let C=await I(S,R);if(c&&c(C)){let k=new me("message",a,C);return P?x(S,k):void S.send(k.message)}try{await w(S,n.message?.(new xm(S,u,C),C))}catch(k){x(S,k)}},drain:async(S)=>{try{await w(S,n.drain?.(new xm(S,u)))}catch(R){x(S,R)}},close:async(S,R,C)=>{try{await w(S,n.close?.(new xm(S,u),R,C))}catch(k){x(S,k)}}}}))return Ss(400,"Expected a websocket connection")},{...s,websocket:n})}};var mx=Ao?Bun.env:typeof process<"u"&&process?.env?process.env:{};var JU=/^(.+)\[(\d+)\]$/,qU=new Set(["__proto__","constructor","prototype"]),VU=(e)=>{if(qU.has(e))return!0;let t=e.match(JU);return t?qU.has(t[1]):!1},zU=(e)=>{let t=e.match(JU);return t?{name:t[1],index:parseInt(t[2],10)}:null},RAe=(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}},_P=(e,t,n)=>{let r=t.split("."),o=r.pop();if(VU(o)||r.some(VU))return;let i=e;for(let a of r){let c=zU(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]=RAe(l)??{}),i=i[c.name][c.index]}else(!i[a]||typeof i[a]!="object")&&(i[a]={}),i=i[a]}let s=zU(o);s?(Array.isArray(i[s.name])||(i[s.name]=[]),i[s.name][s.index]=n):i[o]=n},QP=(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)},ZP=(e,t)=>{let n=e.schema;if(!n)return;n.$defs?.[n.$ref]&&(n=n.$defs[n.$ref]);let r=As(n);if(r)for(let[o,i]of Object.entries(r))t[o]??=i.default};async function Ju(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 eI=(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:Ss,status:Ss,redirect:Cu}),d;try{if(e.event.request)for(let R=0;R<e.event.request.length;R++){let C=e.event.request[R].fn,k=C(u);if(k instanceof Promise&&(k=await k),k=n(k,l),k)return u.response=k}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?{}:Cc(i.substring(a+1)),new sm;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 w;if(o.method!=="GET"&&o.method!=="HEAD")if(y)switch(y){case"application/json":w=await o.json();break;case"text/plain":w=await o.text();break;case"application/x-www-form-urlencoded":w=Cc(await o.text());break;case"application/octet-stream":w=await o.arrayBuffer();break;case"multipart/form-data":{w={};let R=await o.formData(),C=new Map;R.forEach((k,N)=>{let O=C.get(N);O?O.push(k):C.set(N,[k])});for(let[k,N]of C){if(w[k])continue;let O=QP(N);k.includes(".")||k.includes("[")?_P(w,k,O):w[k]=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 k=0;k<d.parse.length;k++){let N=d.parse[k].fn;if(typeof N=="string")switch(N){case"json":case"application/json":w=await o.json();break;case"text":case"text/plain":w=await o.text();break;case"urlencoded":case"application/x-www-form-urlencoded":w=Cc(await o.text());break;case"arrayBuffer":case"application/octet-stream":w=await o.arrayBuffer();break;case"formdata":case"multipart/form-data":{w={};let O=await o.formData(),H=new Map;O.forEach((J,te)=>{let Y=H.get(te);Y?Y.push(J):H.set(te,[J])});for(let[J,te]of H){if(w[J])continue;let Y=QP(te);J.includes(".")||J.includes("[")?_P(w,J,Y):w[J]=Y}break}default:{let O=e["~parser"][N];if(O){let H=O(u,R);if(H instanceof Promise&&(H=await H),H){w=H;break}}break}}else{let O=N(u,R);if(O instanceof Promise&&(O=await O),O){w=O;break}}}if(delete u.contentType,w===void 0)switch(R){case"application/json":w=await o.json();break;case"text/plain":w=await o.text();break;case"application/x-www-form-urlencoded":w=Cc(await o.text());break;case"application/octet-stream":w=await o.arrayBuffer();break;case"multipart/form-data":{w={};let k=await o.formData(),N=new Map;k.forEach((O,H)=>{let J=N.get(H);J?J.push(O):N.set(H,[O])});for(let[O,H]of N){if(w[O])continue;let J=QP(H);O.includes(".")||O.includes("[")?_P(w,O,J):w[O]=J}break}}}}u.route=b,u.body=w,u.params=m?.params||void 0,u.query=a===-1?{}:Cc(i.substring(a+1)),u.headers={};for(let[R,C]of o.headers.entries())u.headers[R]=C;let I={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},A=o.headers.get("cookie");u.cookie=await ZS(u.set,A,I);let T=g?.createHeaders?.();T&&ZP(T,u.headers);let P=g?.createParams?.();P&&ZP(P,u.params);let x=g?.createQuery?.();if(x&&ZP(x,u.query),d.transform)for(let R=0;R<d.transform.length;R++){let C=d.transform[R],k=C.fn(u);if(k instanceof Promise&&(k=await k),k instanceof qt){let N=n(k,u.set);if(N)return u.response=N}C.subType==="derive"&&Object.assign(u,k)}if(g){if(T){let C=structuredClone(u.headers);for(let[k,N]of o.headers)C[k]=N;if(T.provider==="standard")u.headers=await Ju("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(P?.provider==="standard")u.params=await Ju("params",P,u.params);else{if(P?.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 k=As(C);if(k)for(let N of Object.keys(k)){let O=k[N];(O.type==="array"||O.items?.type==="string")&&typeof u.query[N]=="string"&&u.query[N]&&(u.query[N]=u.query[N].split(","))}}if(x?.provider==="standard")u.query=await Ju("query",x,u.query);else{if(x?.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[k,N]of Object.entries(u.cookie))C[k]=N.value;if(g.cookie.provider==="standard"){C=await Ju("cookie",g.cookie,C);for(let k of Object.keys(C))u.cookie[k].value=C[k]}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 Ju("body",R,w);else{if(R?.Check(w)===!1)throw new me("body",g.body,w);if(g.body?.Decode){let C=g.body.Decode(w);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],k=C.fn(u);if(k instanceof Promise&&(k=await k),k instanceof qt){let N=n(k,u.set);if(N)return u.response=N}if(C.subType==="resolve"){Object.assign(u,k);continue}if(k!==void 0){if(u.response=k,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&&(k=H)}let N=n(k,u.set);if(N)return u.response=N}}let S=typeof h=="function"?h(u):h;if(S instanceof Promise&&(S=await S),d.afterHandle?.length){u.response=S;for(let R=0;R<d.afterHandle.length;R++){let C=d.afterHandle[R].fn(u);C instanceof Promise&&(C=await C);let k=C instanceof qt,N=k?C.code:l.status?typeof l.status=="string"?ws[l.status]:l.status:200;k&&(l.status=N,C=C.response);let O=g?.createResponse?.()?.[N];if(O?.provider==="standard")C=await Ju("response",O,C);else if(O?.Check(C)===!1)if(O?.Clean)try{let J=O.Clean(C);if(O?.Check(J)===!1)throw new me("response",O,C);C=J}catch(J){throw J instanceof me?J: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=S instanceof qt,C=R?S.code:l.status?typeof l.status=="string"?ws[l.status]:l.status:200;R&&(l.status=C,S=S.response);let k=g?.createResponse?.()?.[C];if(k?.provider==="standard")S=await Ju("response",k,S);else if(k?.Check(S)===!1)if(k?.Clean)try{let N=k.Clean(S);if(k?.Check(N)===!1)throw new me("response",k,S);S=N}catch(N){throw N instanceof me?N:new me("response",k,S)}else throw new me("response",k,S);if(k?.Encode&&(S=k.Encode(S)),k?.Clean)try{S=k.Clean(S)}catch{}}if(u.set.cookie&&I?.sign){let R=I.secrets?typeof I.secrets=="string"?I.secrets:I.secrets[0]:void 0;if(I.sign===!0){if(R)for(let[C,k]of Object.entries(u.set.cookie))u.set.cookie[C].value=await om(k.value,R)}else{let C=As(g?.cookie?.schema);if(R)for(let k of I.sign)!C||!(k in C)||u.set.cookie[k]?.value&&(u.set.cookie[k].value=await om(u.set.cookie[k].value,R))}}return t(u.response=S,u.set)}catch(p){let m=p instanceof Ru&&p.error?p.error:p;return e.handleError(u,m)}finally{let p=d?d.afterResponse:e.event.afterResponse;p&&(TS?setImmediate(async()=>{for(let m of p)await m.fn(u)}):Promise.resolve().then(async()=>{for(let m of p)await m.fn(u)}))}}},YU=(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 Ru))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 XU;XU=Symbol.dispose;var PAe=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}:rm(rm(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 lu({lazy:!0,onParam:tI.default})),this["~http"]},"~dynamic":void 0,get dynamic(){return this["~dynamic"]||(this["~dynamic"]=new lu({onParam:tI.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?YP(this):YU(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[XU]=()=>{this.server&&this.stop()},t.tags&&(t.detail?t.detail.tags=t.tags:t.detail={tags:t.tags}),this.config={aot:mx.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"?GU:Vh),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 iP(console.error,()=>{})),this._promisedModules}env(t,n=mx){if(zt(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:Sa(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]=zt(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 k=this.definitions.type,N=!this.config.aot,O=this.config.normalize,H=this.definitions.typebox,J=()=>this.config.sanitize,te=()=>{if(u.cookie||c.find((Y)=>Y.cookie))return NU({modules:H,validator:u.cookie,defaultConfig:this.config.cookie,normalize:O,config:u.cookie?.config??{},dynamic:N,models:k,validators:c.map((Y)=>Y.cookie),sanitize:J})};return d?{body:zt(u.body,{modules:H,dynamic:N,models:k,normalize:O,additionalCoerce:(()=>{let Y=VP(u.body,k,H);return Y&&F in Y&&(Bn("File",Y)||Bn("Files",Y))?GP():Yh()})(),validators:c.map((Y)=>Y.body),sanitize:J}),headers:zt(u.headers,{modules:H,dynamic:N,models:k,additionalProperties:!0,coerce:!0,additionalCoerce:Vu(),validators:c.map((Y)=>Y.headers),sanitize:J}),params:zt(u.params,{modules:H,dynamic:N,models:k,coerce:!0,additionalCoerce:Vu(),validators:c.map((Y)=>Y.params),sanitize:J}),query:zt(u.query,{modules:H,dynamic:N,models:k,normalize:O,coerce:!0,additionalCoerce:KP(),validators:c.map((Y)=>Y.query),sanitize:J}),cookie:te(),response:ax(u.response,{modules:H,dynamic:N,models:k,normalize:O,validators:c.map((Y)=>Y.response),sanitize:J})}:{createBody(){return this.body?this.body:this.body=zt(u.body,{modules:H,dynamic:N,models:k,normalize:O,additionalCoerce:(()=>{let Y=VP(u.body,k,H);return Y&&F in Y&&(Bn("File",Y)||Bn("Files",Y))?GP():Yh()})(),validators:c.map((Y)=>Y.body),sanitize:J})},createHeaders(){return this.headers?this.headers:this.headers=zt(u.headers,{modules:H,dynamic:N,models:k,normalize:O,additionalProperties:!O,coerce:!0,additionalCoerce:Vu(),validators:c.map((Y)=>Y.headers),sanitize:J})},createParams(){return this.params?this.params:this.params=zt(u.params,{modules:H,dynamic:N,models:k,normalize:O,coerce:!0,additionalCoerce:Vu(),validators:c.map((Y)=>Y.params),sanitize:J})},createQuery(){return this.query?this.query:this.query=zt(u.query,{modules:H,dynamic:N,models:k,normalize:O,coerce:!0,additionalCoerce:KP(),validators:c.map((Y)=>Y.query),sanitize:J})},createCookie(){return this.cookie?this.cookie:this.cookie=te()},createResponse(){return this.response?this.response:this.response=ax(u.response,{modules:H,dynamic:N,models:k,normalize:O,validators:c.map((Y)=>Y.response),sanitize:J})}}};(l.body||l.cookie||l.headers||l.params||l.query||l.response)&&(o=bs(o,l)),o.tags&&(o.detail?o.detail.tags=o.tags:o.detail={tags:o.tags}),$e(this.config.detail)&&(o.detail=gn(Object.assign({},this.config.detail),o.detail));let m=$e(this.event)?bs(this.event,sP(o)):{...M8(sP(o))};if(c.length&&Object.assign(m,{standaloneValidator:c}),this.config.aot===!1){let k=p();this.router.dynamic.add(t,n,{validator:k,hooks:m,content:o?.type,handle:r,route:n});let N=Ou(n,{dynamic:!0});if(n!==N&&this.router.dynamic.add(t,N,{validator:k,hooks:m,content:o?.type,handle:r,route:n}),!this.config.strictPath){let O=Mu(n);this.router.dynamic.add(t,O,{validator:k,hooks:m,content:o?.type,handle:r,route:n});let H=Ou(O);O!==H&&this.router.dynamic.add(t,O,{validator:k,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 k=h.createNativeStaticHandler?.(r,m,{headers:Object.assign({},this.setHeaders)});return k instanceof Promise?k.then((N)=>{if(N)return N}):k?.()}:void 0,y=this.config.nativeStaticResponse===!0,b=(k)=>{!y||!g||(IS?this.router.response[k]?this.router.response[k][t]=g():this.router.response[k]={[t]:g()}:this.router.response[k]=g())};b(n);let w,I=()=>{if(w)return w;let k=DU({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]&&(w=this.router.history[T].composed=k),k},A;if(`${t}_${n}`in this.routeTree)for(let k=0;k<this.router.history.length;k++){let N=this.router.history[k];if(N.path===n&&N.method===t){A=k;break}}else this.routeTree[`${t}_${n}`]=this.router.history.length;let T=A??this.router.history.length,P=this.router.history,x=d?I():(k)=>w?w(k):(P[T].composed=I())(k);A!==void 0?this.router.history[A]=Object.assign({method:t,path:n,composed:x,compile:I,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:x,compile:I,handler:r,hooks:m},o.webSocket?{websocket:o.websocket}:void 0));let S={handler:d?P[T].composed:void 0,compile(){return this.handler=I()}},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,S),this.config.strictPath||this.router.http.add("WS",Mu(n),S);let k=Ou(n,{dynamic:!0});n!==k&&this.router.http.add("WS",k,S);return}if(C)n in R?R[n][t]=T:R[n]={[t]:T},this.config.strictPath||b(Mu(n));else{if(this.router.http.add(t,n,S),!this.config.strictPath){let N=Mu(n);b(N),this.router.http.add(t,N,S)}let k=Ou(n,{dynamic:!0});n!==k&&(this.router.http.add(t,k,S),b(k))}}headers(t){return t?(this.setHeaders||(this.setHeaders={}),this.setHeaders=gn(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",EU(r));return this}error(t,n){switch(typeof t){case"string":return n.prototype[Nu]=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[Nu]=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=fn(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=$u({[o]:i.map((s)=>s.fn)},this.inference,this.config.sucrose));for(let s of i){let a=O8(s,"global",{skipIfHasType:!0});switch((this.config.name||this.config.seed)&&(a.checksum=Sa(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(fn(a,"derive"));break;case"beforeHandle":this.event.beforeHandle??=[],this.event.beforeHandle.push(a);break;case"resolve":this.event.beforeHandle??=[],this.event.beforeHandle.push(fn(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 ka(this.event.parse,t),ka(this.event.transform,t),ka(this.event.beforeHandle,t),ka(this.event.afterHandle,t),ka(this.event.mapResponse,t),ka(this.event.afterResponse,t),ka(this.event.trace,t),ka(this.event.error,t),t==="scoped"?(this.validator.scoped=rm(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=rm(this.validator.global,rm(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=PS(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=gn(this.singleton,o.singleton),this.definitions=gn(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,w=u;this.applyMacro(b);let I=d||p||m||h||g||y;this.add(a,c,l,bs(b,{...w||{},error:w.error?Array.isArray(w.error)?[...w.error??[],...s.event.error??[]]:[w.error,...s.event.error??[]]:s.event.error,standaloneValidator:b.standaloneValidator||w.standaloneValidator||I?[...b.standaloneValidator??[],...w.standaloneValidator??[],...I?[{body:d,headers:p,query:m,params:h,cookie:g,response:y}]:[]]:void 0}),void 0)}else this.add(a,c,l,bs(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=gn(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=PS(this.inference),r.extender={...this.extender},r.getServer=()=>this.getServer();let o=n(r);if(this.singleton=gn(this.singleton,r.singleton),this.definitions=gn(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,bs(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:w,handler:I,hooks:A}=r.router.history[y];this.add(b,w,I,bs(m,{...A||{},error:A.error?Array.isArray(A.error)?[...A.error??[],...o.event.error??[]]:[A.error,...o.event.error??[]]:o.event.error,standaloneValidator:h?[...A.standaloneValidator??[],{body:a,headers:c,query:l,params:u,cookie:d,response:p}]:A.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),$e(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?Sa(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 $e(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){lP(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=XS(this.inference,t.inference),$e(t.singleton.decorator)&&this.decorate(t.singleton.decorator),$e(t.singleton.store)&&this.state(t.singleton.store),$e(t.definitions.type)&&this.model(t.definitions.type),$e(t.definitions.error)&&this.error(t.definitions.error),$e(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?Sa(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}),$e(t.event)&&(this.event=nP(this.event,rP(t.event),o))}else $e(t.event)&&(this.event=nP(this.event,rP(t.event)));return t.validator.global&&(this.validator.global=bs(this.validator.global,{...t.validator.global})),t.validator.scoped&&(this.validator.local=bs(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=Sa(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 D8){N8(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=gn(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(AS(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(AS(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||!$e(r)?this:n?((n in this.singleton.store)?this.singleton.store[n]=gn(this.singleton.store[n],r,{override:o==="override"}):this.singleton.store[n]=r,this):r===null?this:(this.singleton.store=gn(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]=gn(this.singleton.decorator[n],r,{override:o==="override"}):this.singleton.decorator[n]=r,this):r===null?this:(this.singleton.decorator=gn(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?ux(this):eI(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=ux(this),this)}get fetch(){let t=this.config.aot?ux(this):eI(this);return Object.defineProperty(this,"fetch",{value:t,configurable:!0,writable:!0}),t}get modules(){return this.promisedModules}},ti=PAe;var vm={name:"@kabmo-labs/kabmo",version:"0.46.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","@kabmo-labs/kabmo-sdk":"workspace:*","@kabmo-labs/kabmo-ui":"workspace:*","@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",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"},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/*"]};function fx(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 CAe,constants as MAe}from"zlib";function Ro(e){if(e.buffer instanceof ArrayBuffer)return e;return new Uint8Array(e)}var nI=1024,_U=/^(text\/|application\/(json|javascript|xml|wasm|svg))/,OAe=["zstd","br","gzip"];function QU(e){return _U.test(e)}function rI(e){if(!e)return null;for(let t of OAe)if(e.includes(t))return t;return null}function oI(e,t){if(t==="zstd")return Ro(Bun.zstdCompressSync(e,{level:3}));if(t==="br")return Ro(CAe(e,{params:{[MAe.BROTLI_PARAM_QUALITY]:4}}));return Ro(Bun.gzipSync(e,{level:6}))}async function Ts(e,t){if(!t)return e;let n=e.headers.get("content-type")??"";if(n.includes("text/event-stream"))return e;if(!_U.test(n))return e;if(e.status===204||e.status===304)return e;let r=rI(t);if(!r)return e;let o=Ro(new Uint8Array(await e.arrayBuffer()));if(o.byteLength<nI)return NAe(e,o);let i=oI(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 NAe(e,t){return new Response(t,{status:e.status,headers:e.headers})}var Ma=Bun.env.NODE_ENV!=="production",e7="/_bun/",t7=["/_bun/client/","/_bun/asset/"],iI="/_dev-assets/",ZU="no-cache";function n7(e){let t=e;for(let n of t7)t=t.replaceAll(n,iI+n.slice(e7.length));return t}function sI(e){if(!e.startsWith(iI))return null;let t=e7+e.slice(iI.length);return t7.some((n)=>t.startsWith(n))?t:null}async function r7(e,t,n,r={}){let o=sI(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:Sa(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]=zt(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 k=this.definitions.type,N=!this.config.aot,O=this.config.normalize,H=this.definitions.typebox,J=()=>this.config.sanitize,te=()=>{if(u.cookie||c.find((Y)=>Y.cookie))return NU({modules:H,validator:u.cookie,defaultConfig:this.config.cookie,normalize:O,config:u.cookie?.config??{},dynamic:N,models:k,validators:c.map((Y)=>Y.cookie),sanitize:J})};return d?{body:zt(u.body,{modules:H,dynamic:N,models:k,normalize:O,additionalCoerce:(()=>{let Y=VP(u.body,k,H);return Y&&F in Y&&(Bn("File",Y)||Bn("Files",Y))?GP():Yh()})(),validators:c.map((Y)=>Y.body),sanitize:J}),headers:zt(u.headers,{modules:H,dynamic:N,models:k,additionalProperties:!0,coerce:!0,additionalCoerce:Vu(),validators:c.map((Y)=>Y.headers),sanitize:J}),params:zt(u.params,{modules:H,dynamic:N,models:k,coerce:!0,additionalCoerce:Vu(),validators:c.map((Y)=>Y.params),sanitize:J}),query:zt(u.query,{modules:H,dynamic:N,models:k,normalize:O,coerce:!0,additionalCoerce:KP(),validators:c.map((Y)=>Y.query),sanitize:J}),cookie:te(),response:ax(u.response,{modules:H,dynamic:N,models:k,normalize:O,validators:c.map((Y)=>Y.response),sanitize:J})}:{createBody(){return this.body?this.body:this.body=zt(u.body,{modules:H,dynamic:N,models:k,normalize:O,additionalCoerce:(()=>{let Y=VP(u.body,k,H);return Y&&F in Y&&(Bn("File",Y)||Bn("Files",Y))?GP():Yh()})(),validators:c.map((Y)=>Y.body),sanitize:J})},createHeaders(){return this.headers?this.headers:this.headers=zt(u.headers,{modules:H,dynamic:N,models:k,normalize:O,additionalProperties:!O,coerce:!0,additionalCoerce:Vu(),validators:c.map((Y)=>Y.headers),sanitize:J})},createParams(){return this.params?this.params:this.params=zt(u.params,{modules:H,dynamic:N,models:k,normalize:O,coerce:!0,additionalCoerce:Vu(),validators:c.map((Y)=>Y.params),sanitize:J})},createQuery(){return this.query?this.query:this.query=zt(u.query,{modules:H,dynamic:N,models:k,normalize:O,coerce:!0,additionalCoerce:KP(),validators:c.map((Y)=>Y.query),sanitize:J})},createCookie(){return this.cookie?this.cookie:this.cookie=te()},createResponse(){return this.response?this.response:this.response=ax(u.response,{modules:H,dynamic:N,models:k,normalize:O,validators:c.map((Y)=>Y.response),sanitize:J})}}};(l.body||l.cookie||l.headers||l.params||l.query||l.response)&&(o=bs(o,l)),o.tags&&(o.detail?o.detail.tags=o.tags:o.detail={tags:o.tags}),$e(this.config.detail)&&(o.detail=gn(Object.assign({},this.config.detail),o.detail));let m=$e(this.event)?bs(this.event,sP(o)):{...M8(sP(o))};if(c.length&&Object.assign(m,{standaloneValidator:c}),this.config.aot===!1){let k=p();this.router.dynamic.add(t,n,{validator:k,hooks:m,content:o?.type,handle:r,route:n});let N=Ou(n,{dynamic:!0});if(n!==N&&this.router.dynamic.add(t,N,{validator:k,hooks:m,content:o?.type,handle:r,route:n}),!this.config.strictPath){let O=Mu(n);this.router.dynamic.add(t,O,{validator:k,hooks:m,content:o?.type,handle:r,route:n});let H=Ou(O);O!==H&&this.router.dynamic.add(t,O,{validator:k,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 k=h.createNativeStaticHandler?.(r,m,{headers:Object.assign({},this.setHeaders)});return k instanceof Promise?k.then((N)=>{if(N)return N}):k?.()}:void 0,y=this.config.nativeStaticResponse===!0,b=(k)=>{!y||!g||(IS?this.router.response[k]?this.router.response[k][t]=g():this.router.response[k]={[t]:g()}:this.router.response[k]=g())};b(n);let w,I=()=>{if(w)return w;let k=DU({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]&&(w=this.router.history[T].composed=k),k},A;if(`${t}_${n}`in this.routeTree)for(let k=0;k<this.router.history.length;k++){let N=this.router.history[k];if(N.path===n&&N.method===t){A=k;break}}else this.routeTree[`${t}_${n}`]=this.router.history.length;let T=A??this.router.history.length,P=this.router.history,x=d?I():(k)=>w?w(k):(P[T].composed=I())(k);A!==void 0?this.router.history[A]=Object.assign({method:t,path:n,composed:x,compile:I,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:x,compile:I,handler:r,hooks:m},o.webSocket?{websocket:o.websocket}:void 0));let S={handler:d?P[T].composed:void 0,compile(){return this.handler=I()}},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,S),this.config.strictPath||this.router.http.add("WS",Mu(n),S);let k=Ou(n,{dynamic:!0});n!==k&&this.router.http.add("WS",k,S);return}if(C)n in R?R[n][t]=T:R[n]={[t]:T},this.config.strictPath||b(Mu(n));else{if(this.router.http.add(t,n,S),!this.config.strictPath){let N=Mu(n);b(N),this.router.http.add(t,N,S)}let k=Ou(n,{dynamic:!0});n!==k&&(this.router.http.add(t,k,S),b(k))}}headers(t){return t?(this.setHeaders||(this.setHeaders={}),this.setHeaders=gn(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",EU(r));return this}error(t,n){switch(typeof t){case"string":return n.prototype[Nu]=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[Nu]=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=fn(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=$u({[o]:i.map((s)=>s.fn)},this.inference,this.config.sucrose));for(let s of i){let a=O8(s,"global",{skipIfHasType:!0});switch((this.config.name||this.config.seed)&&(a.checksum=Sa(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(fn(a,"derive"));break;case"beforeHandle":this.event.beforeHandle??=[],this.event.beforeHandle.push(a);break;case"resolve":this.event.beforeHandle??=[],this.event.beforeHandle.push(fn(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 ka(this.event.parse,t),ka(this.event.transform,t),ka(this.event.beforeHandle,t),ka(this.event.afterHandle,t),ka(this.event.mapResponse,t),ka(this.event.afterResponse,t),ka(this.event.trace,t),ka(this.event.error,t),t==="scoped"?(this.validator.scoped=rm(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=rm(this.validator.global,rm(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=PS(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=gn(this.singleton,o.singleton),this.definitions=gn(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,w=u;this.applyMacro(b);let I=d||p||m||h||g||y;this.add(a,c,l,bs(b,{...w||{},error:w.error?Array.isArray(w.error)?[...w.error??[],...s.event.error??[]]:[w.error,...s.event.error??[]]:s.event.error,standaloneValidator:b.standaloneValidator||w.standaloneValidator||I?[...b.standaloneValidator??[],...w.standaloneValidator??[],...I?[{body:d,headers:p,query:m,params:h,cookie:g,response:y}]:[]]:void 0}),void 0)}else this.add(a,c,l,bs(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=gn(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=PS(this.inference),r.extender={...this.extender},r.getServer=()=>this.getServer();let o=n(r);if(this.singleton=gn(this.singleton,r.singleton),this.definitions=gn(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,bs(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:w,handler:I,hooks:A}=r.router.history[y];this.add(b,w,I,bs(m,{...A||{},error:A.error?Array.isArray(A.error)?[...A.error??[],...o.event.error??[]]:[A.error,...o.event.error??[]]:o.event.error,standaloneValidator:h?[...A.standaloneValidator??[],{body:a,headers:c,query:l,params:u,cookie:d,response:p}]:A.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),$e(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?Sa(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 $e(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){lP(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=XS(this.inference,t.inference),$e(t.singleton.decorator)&&this.decorate(t.singleton.decorator),$e(t.singleton.store)&&this.state(t.singleton.store),$e(t.definitions.type)&&this.model(t.definitions.type),$e(t.definitions.error)&&this.error(t.definitions.error),$e(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?Sa(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}),$e(t.event)&&(this.event=nP(this.event,rP(t.event),o))}else $e(t.event)&&(this.event=nP(this.event,rP(t.event)));return t.validator.global&&(this.validator.global=bs(this.validator.global,{...t.validator.global})),t.validator.scoped&&(this.validator.local=bs(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=Sa(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 D8){N8(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=gn(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(AS(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(AS(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||!$e(r)?this:n?((n in this.singleton.store)?this.singleton.store[n]=gn(this.singleton.store[n],r,{override:o==="override"}):this.singleton.store[n]=r,this):r===null?this:(this.singleton.store=gn(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]=gn(this.singleton.decorator[n],r,{override:o==="override"}):this.singleton.decorator[n]=r,this):r===null?this:(this.singleton.decorator=gn(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?ux(this):eI(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=ux(this),this)}get fetch(){let t=this.config.aot?ux(this):eI(this);return Object.defineProperty(this,"fetch",{value:t,configurable:!0,writable:!0}),t}get modules(){return this.promisedModules}},ti=PAe;var vm={name:"@kabmo-labs/kabmo",version:"0.46.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","@kabmo-labs/kabmo-sdk":"workspace:*","@kabmo-labs/kabmo-ui":"workspace:*","@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",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"},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/*"]};function fx(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 CAe,constants as MAe}from"zlib";function Ro(e){if(e.buffer instanceof ArrayBuffer)return e;return new Uint8Array(e)}var nI=1024,_U=/^(text\/|application\/(json|javascript|xml|wasm|svg))/,OAe=["zstd","br","gzip"];function QU(e){return _U.test(e)}function rI(e){if(!e)return null;for(let t of OAe)if(e.includes(t))return t;return null}function oI(e,t){if(t==="zstd")return Ro(Bun.zstdCompressSync(e,{level:3}));if(t==="br")return Ro(CAe(e,{params:{[MAe.BROTLI_PARAM_QUALITY]:4}}));return Ro(Bun.gzipSync(e,{level:6}))}async function Ts(e,t){if(!t)return e;let n=e.headers.get("content-type")??"";if(n.includes("text/event-stream"))return e;if(!_U.test(n))return e;if(e.status===204||e.status===304)return e;let r=rI(t);if(!r)return e;let o=Ro(new Uint8Array(await e.arrayBuffer()));if(o.byteLength<nI)return NAe(e,o);let i=oI(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 NAe(e,t){return new Response(t,{status:e.status,headers:e.headers})}var Ma=Bun.env.NODE_ENV!=="production",e7="/_bun/",t7=["/_bun/client/","/_bun/asset/"],iI="/_dev-assets/",ZU="no-cache";function n7(e){let t=e;for(let n of t7)t=t.replaceAll(n,iI+n.slice(e7.length));return t}function sI(e){if(!e.startsWith(iI))return null;let t=e7+e.slice(iI.length);return t7.some((n)=>t.startsWith(n))?t:null}async function r7(e,t,n,r={}){let o=sI(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(fx(e,c,null))return new Response(null,{status:304,headers:{etag:c,"cache-control":ZU}});return Ts(new Response(a,{headers:{"content-type":s||"application/octet-stream","cache-control":ZU,etag:c}}),e.headers.get("accept-encoding"))}var aI=Ma?(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 z(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:V});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 V=()=>Es();function Es(){return new Response(JSON.stringify({error:"Method not allowed"}),{status:405,headers:{"content-type":"application/json; charset=utf-8"}})}async function jt(e){try{return{ok:!0,body:await e.json()}}catch(t){return{ok:!1,error:t instanceof Error?t.message:String(t)}}}function En(e,t){let n=e[t];return n?n:null}function Po(e,t=500){return f({error:e instanceof Error?e.message:String(e)},{status:t})}async function LAe(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 DAe(e){return async({request:t,params:n})=>{try{let r=await LAe(await e({request:t,params:n}));return await Ts(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 o7(e,t){let n=e;for(let{method:r,path:o,handler:i}of t){let s=DAe(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 pt(e,t,n){return[{method:"GET",path:t,handler:n??V},...["POST","PUT","PATCH","DELETE"].map((r)=>({method:r,path:t,handler:e}))]}import{existsSync as cI,realpathSync as FAe}from"fs";import{homedir as i7,tmpdir as Qwt}from"os";import*as ln from"path";var s7="omp",BAe=".omp";function a7(){return Bun.env.PI_CONFIG_DIR||BAe}function Io(){return ln.join(i7(),a7())}function pe(){let e=Bun.env.PI_CODING_AGENT_DIR;if(e)return ln.resolve(e);return ln.join(Io(),"agent")}function c7(){let e=Bun.env.PI_CODING_AGENT_DIR;if(e)return ln.resolve(e)===ln.join(Io(),"agent");return!0}function UAe(){if(process.platform!=="linux"&&process.platform!=="darwin")return;if(!c7())return;let e=Bun.env.XDG_DATA_HOME;if(!e)return;try{let t=ln.join(e,s7);return cI(t)?t:void 0}catch{return}}function jAe(e){let t=UAe();return ln.join(t??pe(),e)}function ni(){return jAe("sessions")}function l7(){return ln.join(pe(),"projects.json")}function u7(){if(process.platform!=="linux"&&process.platform!=="darwin")return Io();if(!c7())return Io();let e=Bun.env.XDG_DATA_HOME;if(!e)return Io();try{let t=ln.join(e,s7);return cI(t)?t:Io()}catch{return Io()}}function d7(){return ln.join(u7(),"plugins")}function lI(){return ln.join(u7(),"marketplaces.json")}function p7(e){let t=i7(),n=a7(),r=ln.resolve(e);for(let o of[n,".git"]){let i=r;while(i!==t){if(cI(ln.join(i,o)))return ln.join(i,n,"plugins");let s=ln.dirname(i);if(s===i)break;i=s}}return ln.join(r,n,"plugins")}function Yu(e){try{return FAe.native(e)}catch{return e}}async function Z(e){try{return await Bun.file(e).stat(),!0}catch{return!1}}function Co(e){let t=Yu(e);return t.replace(/\/+$/,"")||t}import dI from"fs";import*as gx from"path";function E(e){return typeof e==="object"&&e!==null&&!Array.isArray(e)}function yn(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 m7(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 Rn(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 m7(e.slice(s,c))}return m7(e.slice(s))}function g7(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(Rn(e,"type",r)==="message")t++;n=o+1}return t}function f7(e){if(e===void 0)return;return e.trim()?e:null}function HAe(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 WAe(e,t){if(Rn(e,"type")!=="session")return;let n=Rn(e,"id");if(!n)return;return{id:n,cwd:Rn(e,"cwd"),title:t===null?void 0:t??Rn(e,"title"),parentSession:Rn(e,"parentSession"),timestamp:Rn(e,"timestamp")}}function h7(e,t){let n=t[0],r=f7(n?.type==="title"&&typeof n.title==="string"?n.title:void 0),o=HAe(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&&Rn(c,"type")==="title"){i=f7(Rn(c,"title")),s=!1;continue}return WAe(c,i)}return}var uI=4096,$Ae=16384,y7=1048576;async function b7(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 KAe={session_exit:!0};function GAe(e){let t,n,r,o=!1;try{let a=JSON.parse(e);if(E(a))o=!0,t=a.type,n=a.customType,r=a.timestamp}catch{}if(!o)r=Rn(e,"timestamp"),t=Rn(e,"type"),n=Rn(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"&&KAe[n]===!0;return{at:i,lifecycle:s}}async function w7(e,t,n){if(t<=0)return;let r=$Ae;for(;;){let o=Math.max(0,t-r),i;if(t<=uI)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,2 +1,2 @@
|
|
|
1
|
-
import{u,e}from"./index-
|
|
1
|
+
import{u,e}from"./index-4cag7w6k.js";import{Kc,jg,Rf,Vc}from"./index-b2e5pwx7.js";function w({content:d,path:l,onChange:s}){let r=u(()=>jg(d,l),[d,l]),o=s!==void 0&&!r.truncated,a=d.endsWith(`
|
|
2
2
|
`),c=o?(i,n,t)=>{s(Rf(r.header,Vc(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(Rf(t,r.rows,r.delimiter,a))}:void 0;return e(Kc,{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,m,Xp,Rr,Cd}from"./index-
|
|
1
|
+
import{u,e,m,Xp,Rr,Cd}from"./index-4cag7w6k.js";import{hn,Nn,zg}from"./index-2ks0m8ss.js";var wr=Nn(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=zg;if(!o&&i)return i(c,!0);if(p)return p(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 p=zg;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 p(k){return z.reject(Error("could not open external image: '"+k+`'
|
|
2
2
|
cannot open linked files from a web browser`))}return{read:p}}},{"../../lib/promises":23}],2:[function(X,ce,L){var z=X("../lib/promises"),I=X("../lib/zipfile");L.openZip=p;function p(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"),p=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===p.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(d){var q=[],Y=ee(d,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(d,q,Y){return h(d,function(j){return ee(j,q,Y)})}function ee(d,q,Y){if(!Y)throw Error("context not set");var j=Ae[d.type];if(j)return j(d,q,Y);else return[]}function U(d,q,Y){return J(d,q).wrap(function(){var j=H(d.children,q,Y);if(W)return j;else return[i.forceWrite].concat(j)})}function J(d,q){var Y=se(d);if(Y)return Y.to;else{if(d.styleId)q.push(y("paragraph",d));return S}}function D(d,q,Y){var j=function(){return H(d.children,q,Y)},f=[];if(d.highlight!==null){var r=ye({type:"highlight",color:d.highlight});if(r)f.push(r)}if(d.isSmallCaps)f.push(te("smallCaps"));if(d.isAllCaps)f.push(te("allCaps"));if(d.isStrikethrough)f.push(te("strikethrough","s"));if(d.isUnderline)f.push(te("underline"));if(d.verticalAlignment===p.verticalAlignment.subscript)f.push(k.element("sub",{},{fresh:!1}));if(d.verticalAlignment===p.verticalAlignment.superscript)f.push(k.element("sup",{},{fresh:!1}));if(d.isItalic)f.push(te("italic","em"));if(d.isBold)f.push(te("bold","strong"));var s=k.empty,N=se(d);if(N)s=N.to;else if(d.styleId)q.push(y("run",d));return f.push(s),f.forEach(function(M){j=M.wrap.bind(M,j)}),j()}function te(d,q){var Y=ye({type:d});if(Y)return Y;else if(q)return k.element(q,{},{fresh:!1});else return k.empty}function ye(d,q){var Y=se(d);return Y?Y.to:q}function se(d){for(var q=0;q<P.length;q++)if(P[q].from.matches(d))return P[q]}function ve(d){return function(q,Y){return I.try(function(){return d(q,Y)}).catch(function(j){return Y.push(c.error(j)),[]})}}function le(d){return Q(d.noteType,d.noteId)}function be(d){return ne(d.noteType,d.noteId)}function Q(d,q){return Te(d+"-"+q)}function ne(d,q){return Te(d+"-ref-"+q)}function Te(d){return A+d}var pe=k.elements([k.element("table",{},{fresh:!0})]);function de(d,q,Y){return ye(d,pe).wrap(function(){return Pe(d,q,Y)})}function Pe(d,q,Y){var j=z.findIndex(d.children,function(N){return!N.type===p.types.tableRow||!N.isHeader});if(j===-1)j=d.children.length;var f;if(j===0)f=H(d.children,q,z.extend({},Y,{isTableHeader:!1}));else{var r=H(d.children.slice(0,j),q,z.extend({},Y,{isTableHeader:!0})),s=H(d.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(d,q,Y){var j=H(d.children,q,Y);return[i.freshElement("tr",{},[i.forceWrite].concat(j))]}function Ie(d,q,Y){var j=Y.isTableHeader?"th":"td",f=H(d.children,q,Y),r={};if(d.colSpan!==1)r.colspan=d.colSpan.toString();if(d.rowSpan!==1)r.rowspan=d.rowSpan.toString();return[i.freshElement(j,r,[i.forceWrite].concat(f))]}function ke(d,q,Y){return ye(d,k.ignore).wrap(function(){var j=v[d.commentId],f=F.length+1,r="["+x(j)+f+"]";return F.push({label:r,comment:j}),[i.freshElement("a",{href:"#"+Q("comment",d.commentId),id:ne("comment",d.commentId)},[i.text(r)])]})}function Ne(d,q,Y){var{label:j,comment:f}=d,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(d,q,Y){return We(d).wrap(function(){return[]})}function We(d){var q=se(d);if(q)return q.to;else if(d.breakType==="line")return k.topLevelElement("br");else return k.empty}var Ae={document:function(d,q,Y){var j=H(d.children,q,Y),f=E.map(function(s){return d.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(d,q,Y){return[i.text(d.value)]},tab:function(d,q,Y){return[i.text("\t")]},hyperlink:function(d,q,Y){var j=d.anchor?"#"+Te(d.anchor):d.href,f={href:j};if(d.targetFrame!=null)f.target=d.targetFrame;var r=H(d.children,q,Y);return[i.nonFreshElement("a",f,r)]},checkbox:function(d){var q={type:"checkbox"};if(d.checked)q.checked="checked";return[i.freshElement("input",q)]},bookmarkStart:function(d,q,Y){var j=i.freshElement("a",{id:Te(d.name)},[i.forceWrite]);return[j]},noteReference:function(d,q,Y){E.push(d);var j=i.freshElement("a",{href:"#"+le(d),id:be(d)},[i.text("["+a+++"]")]);return[i.freshElement("sup",{},[j])]},note:function(d,q,Y){var j=H(d.body,q,Y),f=i.elementWithTag(k.element("p",{},{fresh:!1}),[i.text(" "),i.freshElement("a",{href:"#"+be(d)},[i.text("↑")])]),r=j.concat([f]);return i.freshElement("li",{id:le(d)},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"),p=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:p.document,children:S,notes:P.notes||new y({}),comments:P.comments||[]}}function c(S,P){P=P||{};var O=P.indent||{};return{type:p.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:p.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:p.text,value:S}}function l(){return{type:p.tab}}function g(S){return{type:p.checkbox,checked:S.checked}}function _(S,P){return{type:p.hyperlink,children:S,href:P.href,anchor:P.anchor,targetFrame:P.targetFrame}}function w(S){return{type:p.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:p.note,noteType:S.noteType,noteId:S.noteId,body:S.body}}function T(S){return{type:p.commentReference,commentId:S.commentId}}function x(S){return{type:p.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:p.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:p.table,children:S,styleId:P.styleId||null,styleName:P.styleName||null}}function E(S,P){return P=P||{},{type:p.tableRow,children:S,isHeader:P.isHeader||!1}}function F(S,P){return P=P||{},{type:p.tableCell,children:S,colSpan:P.colSpan==null?1:P.colSpan,rowSpan:P.rowSpan==null?1:P.rowSpan}}function A(S){return{type:p.break,breakType:S}}function W(S){return{type:p.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"),p=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(p.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 p.Text(De.string))}function d(oe){return function(me){var xe=me.attributes["w:id"];return x(new p.NoteReference({noteType:oe,noteId:xe}))}}function q(oe){return x(p.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 p.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 p.Hyperlink(xe,De)];return new p.Run(xe,me)})},"w:fldChar":Ie,"w:instrText":We,"w:t":function(oe){return x(new p.Text(oe.text()))},"w:tab":function(oe){return x(new p.Tab)},"w:noBreakHyphen":function(){return x(new p.Text("‑"))},"w:softHyphen":function(oe){return x(new p.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 p.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":d("footnote"),"w:endnoteReference":d("endnote"),"w:commentReference":q,"w:br":function(oe){var me=oe.attributes["w:type"];if(me==null||me==="textWrapping")return x(p.lineBreak);else if(me==="page")return x(p.pageBreak);else if(me==="column")return x(p.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 p.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=p.checkbox({checked:Xe}),Ve=!1,Ge=xe.map(i._elementsOfType(p.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 p.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 p.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=p.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!==p.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!==p.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,p.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 p.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=p.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 p(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=p},{"../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=p({},{});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}}),p(o,c)}function p(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=p;var z=X("../documents"),I=X("../results").Result;function p(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"),p=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 p([])}),endnotes:E(J.partPaths.endnotes,J,function(D,te){if(te)return w.createEndnotesReader(D)(te);else return new p([])}),comments:E(J.partPaths.comments,J,function(D,te){if(te)return y.createCommentsReader(D)(te);else return new p([])})}}).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=p.bind(this,"footnote"),L.createEndnotesReader=p.bind(this,"endnote");function p(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=p,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 p(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"),p=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 p.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(p){var k=[];return p.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(p){var k=Object.create(null);p.forEach(function(o){k[o.relationshipId]=o.target});var c=Object.create(null);return p.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"),p=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(p.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,p.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(p.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,p.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(p.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=p(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 p(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(p,k){if(k.charAt(0)==="/")return k.substr(1);else return p+"/"+k}function I(p,k){var c=p.indexOf("#");if(c!==-1)p=p.substring(0,c);return p+"#"+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 p(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=p,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){p(i,l)})}function p(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 p(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=p},{"./ast":17,underscore:67}],20:[function(X,ce,L){var z=X("underscore"),I=X("./promises"),p=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),[p.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"),p=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 p.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(p.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"],p=L._standardOptions={externalFileAccess:!1,transformDocument:o,includeDefaultStyleMap:!0,includeEmbeddedStyleMap:!0};function k(i){return i=i||{},z.extend({},p,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 p=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 p(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(p){if(p.type==="text")return p.value;else if(p.type===z.types.tab)return"\t";else{var k=p.type==="paragraph"?`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{i,u,e,Rr,Ed}from"./index-amys498v.js";import{Dd}from"./index-3bf7r7z4.js";var mt=/^[a-zA-Z][a-zA-Z0-9:_-]*$/;function S(n,r={},a=[]){if(!mt.test(n))throw Error(`Invalid SVG tag name: ${n}`);return{tag:n,attrs:r,children:a.filter((l)=>!!l)}}function Fe(n){return{text:n}}function kt(n){return n.replace(/[&<>]/g,(r)=>r==="&"?"&":r==="<"?"<":">")}function St(n){return n.replace(/[&<>"']/g,(r)=>{switch(r){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return"'"}})}function Y(n){if(!Number.isFinite(n))return"0";let r=Math.round(n*100)/100;return Object.is(r,-0)?"0":String(r)}function At(n){let r="";for(let[a,l]of Object.entries(n)){if(l===null||l===void 0||l===!1)continue;if(!mt.test(a))throw Error(`Invalid SVG attribute name: ${a}`);if(l===!0)r+=` ${a}=""`;else if(typeof l==="number")r+=` ${a}="${Y(l)}"`;else r+=` ${a}="${St(l)}"`}return r}function gt(n){if("text"in n)return kt(n.text);let r=At(n.attrs);if(n.children.length===0)return`<${n.tag}${r}/>`;return`<${n.tag}${r}>${n.children.map(gt).join("")}</${n.tag}>`}var L=class{constructor(){this.parts=[]}moveTo(n,r){return this.parts.push(`M${Y(n)},${Y(r)}`),this}lineTo(n,r){return this.parts.push(`L${Y(n)},${Y(r)}`),this}curveTo(n,r,a,l,o,t){return this.parts.push(`C${Y(n)},${Y(r)} ${Y(a)},${Y(l)} ${Y(o)},${Y(t)}`),this}quadTo(n,r,a,l){return this.parts.push(`Q${Y(n)},${Y(r)} ${Y(a)},${Y(l)}`),this}arcTo(n,r,a,l,o,t,s){return this.parts.push(`A${Y(n)},${Y(r)} ${Y(a)} ${l?1:0},${o?1:0} ${Y(t)},${Y(s)}`),this}close(){return this.parts.push("Z"),this}toString(){return this.parts.join(" ")}},xt=1.25,Et=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584],Ct=1.06,It=new Set("гзтэсеё".split("")),Nt=new Set("жмшщюыЖМШЩЮЫФф".split(""));function Ft(n){let r=n.codePointAt(0)??0;if(r>=32&&r<=126)return Et[r-32]??556;if(r>=1024&&r<=1279){if(Nt.has(n))return 800;if(It.has(n))return 470;return n===n.toUpperCase()?690:545}if(r>=11904&&r<=40959||r>=44032&&r<=55215||r>=63744&&r<=64255||r>=65280&&r<=65519||r>=127744&&r<=129791)return 1000;if(r===8212||r===8230)return 1000;if(r===8211)return 556;if(r===160)return 278;return 600}var Ot=(n,r)=>{let a=0;for(let o of n)a+=Ft(o);let l=a/1000*r.size*Ct;if(r.weight==="bold")l*=1.07;return{width:l,height:r.size*xt}},de;function Lt(){if(de!==void 0)return de;de=null;try{let n=globalThis;if(n.navigator?.userAgent?.includes("jsdom"))return de;if(typeof n.OffscreenCanvas==="function")de=new n.OffscreenCanvas(1,1).getContext("2d");else if(n.document&&typeof n.document.createElement==="function")de=n.document.createElement("canvas").getContext("2d");if(de&&de.measureText("M").width<=0)de=null}catch{de=null}return de}function pt(n){return`${n.style==="italic"?"italic ":""}${n.weight==="bold"?"bold ":""}${n.size}px ${n.family}`}function Pt(n){let r=new Map;return(a,l)=>{let o=`${pt(l)}\x00${a}`,t=r.get(o);if(!t){if(t=n(a,l),r.size>5000)r.clear();r.set(o,t)}return t}}function Dt(){let n=Lt();if(!n)return Ot;return Pt((r,a)=>(n.font=pt(a),{width:n.measureText(r).width,height:a.size*xt}))}var _t=/^[a-zA-Z]{3,24}$/,Rt=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,ze=String.raw`\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:%|deg)?\s*`,zt=new RegExp(`^(?:rgba?|hsla?)\\((?:${ze},){2,3}${ze}\\)$|^(?:rgba?|hsla?)\\((?:${ze}){3}(?:/${ze})?\\)$`,"i");function Be(n){if(n===void 0)return;let r=n.trim();if(Rt.test(r)||zt.test(r))return r;if(_t.test(r)&&!/^(?:inherit|initial|unset|revert|var|url|expression|none|default)$/i.test(r))return r}var Wt={"--drawio-font-family":"Helvetica, Arial, sans-serif","--drawio-background":"transparent","--drawio-fill":"#ffffff","--drawio-stroke":"#000000","--drawio-text":"#000000","--drawio-label-background":"#ffffff","--drawio-placeholder":"#9ca3af"};function Te(n){return`var(${n}, ${Wt[n]})`}function ge(n,r,a){let l=n[r];if(l===void 0||l===""||l==="default")return a;if(l==="none")return"none";return Be(l)??a}function M(n,r,a,l=-1e6,o=1e6){let t=n[r],s=t===void 0?NaN:Number(t);return Number.isFinite(s)?Math.min(o,Math.max(l,s)):a}function Ve(n,r,a=!1){let l=n[r];return l===void 0?a:l==="1"||l==="true"}function nt(n,r){if(!Ve(n,"dashed"))return;let a=n.dashPattern;if(a&&/^[\d.\s]+$/.test(a))return a.trim().split(/\s+/).map((l)=>Number(l)*r).join(" ");return`${3*r} ${3*r}`}function Xt(n){let r=`#${n}`;return[`${r}{font-family:${Te("--drawio-font-family")};background:${Te("--drawio-background")}}`,`${r} text{white-space:pre}`,`${r} a{cursor:pointer}`].join("")}var $e=(n)=>({x:n.x+n.width/2,y:n.y+n.height/2});function ot(n,r,a){let l=$e(n),o=a.x-l.x,t=a.y-l.y;if(o===0&&t===0)return l;let s=n.width/2,c=n.height/2;if(r==="ellipse"||r==="doubleEllipse"||r==="orShape"||r==="xorShape"){let m=1/Math.sqrt(o*o/(s*s||1)+t*t/(c*c||1));return{x:l.x+o*m,y:l.y+t*m}}if(r==="rhombus"){let m=1/(Math.abs(o)/(s||1)+Math.abs(t)/(c||1));return{x:l.x+o*m,y:l.y+t*m}}let d=Math.min(o===0?1/0:s/Math.abs(o),t===0?1/0:c/Math.abs(t));return{x:l.x+o*d,y:l.y+t*d}}function Ee(n){if(!n.port)return;return{x:n.bounds.x+n.port.x*n.bounds.width,y:n.bounds.y+n.port.y*n.bounds.height}}function Oe(n,r){return[["left",Math.abs(r.x-n.x)],["right",Math.abs(r.x-n.x-n.width)],["top",Math.abs(r.y-n.y)],["bottom",Math.abs(r.y-n.y-n.height)]].sort((a,l)=>a[1]-l[1])[0][0]}function rt(n,r){let a=Ee(n);if(a)return a;let l=n.bounds,o=$e(l);if(r.x>=l.x&&r.x<=l.x+l.width&&(r.y<l.y||r.y>l.y+l.height))return{x:r.x,y:r.y<l.y?l.y:l.y+l.height};if(r.y>=l.y&&r.y<=l.y+l.height&&(r.x<l.x||r.x>l.x+l.width))return{x:r.x<l.x?l.x:l.x+l.width,y:r.y};let t=r.x-o.x,s=r.y-o.y;if(Math.abs(t)*l.height>=Math.abs(s)*l.width)return{x:t>0?l.x+l.width:l.x,y:o.y};return{x:o.x,y:s>0?l.y+l.height:l.y}}function Bt(n,r){let a=[n[0]],l=r;for(let o=1;o<n.length;o++){let t=a[a.length-1],s=n[o];if(Math.abs(t.x-s.x)>0.01&&Math.abs(t.y-s.y)>0.01)a.push(l?{x:s.x,y:t.y}:{x:t.x,y:s.y});a.push(s);let c=a[a.length-2];l=Math.abs(c.y-s.y)>0.01}return Me(a)}function Me(n){let r=[];for(let a of n){let l=r[r.length-1];if(l&&Math.abs(l.x-a.x)<0.01&&Math.abs(l.y-a.y)<0.01)continue;r.push(a)}return r}function qt(n,r,a,l){let o=l.edgeStyle??"",t=(f)=>("bounds"in f),s=(f)=>t(f)?$e(f.bounds):f;if(o==="entityRelationEdgeStyle"&&t(n)&&t(r)){let f=M(l,"segment",30,0,200),x=n.bounds,p=r.bounds;if(Math.min(x.x+x.width,p.x+p.width)-Math.max(x.x,p.x)>0&&!Ee(n)&&!Ee(r)){let J=Math.max(x.x+x.width,p.x+p.width)+f,_={x:x.x+x.width,y:$e(x).y},b={x:p.x+p.width,y:$e(p).y};return Me([_,{x:J,y:_.y},{x:J,y:b.y},b])}let T=$e(x).x<=$e(p).x,k=Ee(n)??{x:T?x.x+x.width:x.x,y:$e(x).y},C=Ee(r)??{x:T?p.x:p.x+p.width,y:$e(p).y},O=k.x+(T?f:-f),R=C.x+(T?-f:f);return Me([k,{x:O,y:k.y},{x:R,y:C.y},C])}if(o==="orthogonalEdgeStyle"||o==="elbowEdgeStyle"||o==="segmentEdgeStyle"){let f=a[0]??s(r),x=a[a.length-1]??s(n),p=t(n)?rt(n,f):n,T=t(r)?rt(r,x):r;if(a.length===0){let C=o==="elbowEdgeStyle"?l.elbow==="vertical":t(n)&&(Oe(n.bounds,p)==="top"||Oe(n.bounds,p)==="bottom");if(p.x===T.x||p.y===T.y)return Me([p,T]);if(C!==(t(r)&&(Oe(r.bounds,T)==="top"||Oe(r.bounds,T)==="bottom")))return Me([p,C?{x:p.x,y:T.y}:{x:T.x,y:p.y},T]);if(C){let R=(p.y+T.y)/2;return Me([p,{x:p.x,y:R},{x:T.x,y:R},T])}let O=(p.x+T.x)/2;return Me([p,{x:O,y:p.y},{x:O,y:T.y},T])}let k=t(n)?!(Oe(n.bounds,p)==="top"||Oe(n.bounds,p)==="bottom"):Math.abs(f.x-p.x)>=Math.abs(f.y-p.y);return Bt([p,...a,T],k)}let c=a[0]??s(r),d=a[a.length-1]??s(n),m=t(n)?Ee(n)??ot(n.bounds,n.shape,c):n,y=t(r)?Ee(r)??ot(r.bounds,r.shape,d):r;return Me([m,...a,y])}function Yt(n,r){let a=new L;if(n.length===0)return"";if(a.moveTo(n[0].x,n[0].y),r.curved==="1"&&n.length>2){for(let o=1;o<n.length-1;o++){let t=n[o],s=n[o+1],c=o===n.length-2?s:{x:(t.x+s.x)/2,y:(t.y+s.y)/2};a.quadTo(t.x,t.y,c.x,c.y)}return a.toString()}let l=r.rounded==="1"?M(r,"arcSize",20,0,200)/2:0;for(let o=1;o<n.length;o++){let t=n[o],s=n[o+1];if(l>0&&s){let c=n[o-1],d=Math.hypot(t.x-c.x,t.y-c.y),m=Math.hypot(s.x-t.x,s.y-t.y),y=Math.min(l,d/2,m/2);if(y>0.5){let f={x:t.x-(t.x-c.x)/d*y,y:t.y-(t.y-c.y)/d*y},x={x:t.x+(s.x-t.x)/m*y,y:t.y+(s.y-t.y)/m*y};a.lineTo(f.x,f.y).quadTo(t.x,t.y,x.x,x.y);continue}}a.lineTo(t.x,t.y)}return a.toString()}function it(n,r){switch(n){case"classic":case"classicThin":return r*1.2;case"block":case"blockThin":return r*1.6;case"diamond":case"diamondThin":return r*2.2;case"oval":case"circle":return r;default:return 0}}function st(n,r,a,l,o,t,s){if(!n||n==="none")return[];let c={x:-a.y,y:a.x},d=(x,p)=>[r.x-a.x*x+c.x*p,r.y-a.y*x+c.y*p],m=(x,p,T)=>{let k=new L;if(x.forEach(([C,O],R)=>R===0?k.moveTo(C,O):k.lineTo(C,O)),p)k.close();return S("path",{d:k.toString(),fill:p?T?t:"var(--drawio-label-background, #ffffff)":"none",stroke:t,"stroke-width":s,"stroke-linejoin":"round","stroke-linecap":"round"})},y=l*1.6,f=l*(n.endsWith("Thin")?0.45:0.7);switch(n){case"classic":case"classicThin":return[m([d(0,0),d(y,f),d(y*0.75,0),d(y,-f)],!0,o)];case"block":case"blockThin":return[m([d(0,0),d(y,f),d(y,-f)],!0,o)];case"open":case"openThin":return[m([d(y,f),d(0,0),d(y,-f)],!1,!1)];case"async":return[m([d(0,0),d(y,f),d(y,0)],!0,o)];case"diamond":case"diamondThin":return[m([d(0,0),d(y*0.7,f),d(y*1.4,0),d(y*0.7,-f)],!0,o)];case"oval":case"circle":{let[x,p]=d(l/2,0);return[S("circle",{cx:x,cy:p,r:l/2,fill:o?t:"var(--drawio-label-background, #ffffff)",stroke:t,"stroke-width":s})]}case"dash":return[m([d(l,l),d(l,-l)],!1,!1)];case"cross":return[m([d(y,f),d(0,-f)],!1,!1),m([d(y,-f),d(0,f)],!1,!1)];case"ERone":return[m([d(l*1.6,l),d(l*1.6,-l)],!1,!1)];case"ERmandOne":return[m([d(l*1.2,l),d(l*1.2,-l)],!1,!1),m([d(l*2,l),d(l*2,-l)],!1,!1)];case"ERmany":return[m([d(0,l),d(l*1.6,0),d(0,-l)],!1,!1)];case"ERoneToMany":return[m([d(0,l),d(l*1.6,0),d(0,-l)],!1,!1),m([d(l*2,l),d(l*2,-l)],!1,!1)];case"ERzeroToMany":{let[x,p]=d(l*2.6,0);return[m([d(0,l),d(l*1.6,0),d(0,-l)],!1,!1),S("circle",{cx:x,cy:p,r:l*0.6,fill:"var(--drawio-label-background, #ffffff)",stroke:t,"stroke-width":s})]}case"ERzeroToOne":{let[x,p]=d(l*2.6,0);return[m([d(l*1.2,l),d(l*1.2,-l)],!1,!1),S("circle",{cx:x,cy:p,r:l*0.6,fill:"var(--drawio-label-background, #ffffff)",stroke:t,"stroke-width":s})]}default:return[m([d(y,f),d(0,0),d(y,-f)],!1,!1)]}}function at(n,r){let a=0;for(let c=1;c<n.length;c++)a+=Math.hypot(n[c].x-n[c-1].x,n[c].y-n[c-1].y);let l=a*Math.min(1,Math.max(0,r));for(let c=1;c<n.length;c++){let d=n[c-1],m=n[c],y=Math.hypot(m.x-d.x,m.y-d.y);if(l<=y&&y>0)return{point:{x:d.x+(m.x-d.x)*l/y,y:d.y+(m.y-d.y)*l/y},dir:{x:(m.x-d.x)/y,y:(m.y-d.y)/y}};l-=y}let o=n[n.length-2]??n[0],t=n[n.length-1],s=Math.hypot(t.x-o.x,t.y-o.y)||1;return{point:t,dir:{x:(t.x-o.x)/s,y:(t.y-o.y)/s}}}var Q=class extends Error{constructor(n,r=0,a=0,l){super(r>0?`${n} (line ${r}${a>0?`, column ${a}`:""})`:n);this.line=r,this.column=a,this.hint=l,this.name="DrawioError"}},Ut={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ndash:"–",mdash:"—",hellip:"…",laquo:"«",raquo:"»",copy:"©",reg:"®",trade:"™",bull:"•",middot:"·",deg:"°",times:"×",rarr:"→",larr:"←",euro:"€"};function je(n){return n.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(r,a)=>{if(a[0]==="#"){let l=a[1]==="x"||a[1]==="X"?parseInt(a.slice(2),16):parseInt(a.slice(1),10);return l>0&&l<=1114111&&!(l>=55296&&l<=57343)?String.fromCodePoint(l):r}return Ut[a.toLowerCase()]??r})}function Ht(n){return n.split(/\r\n|\r|\n/).map((r)=>r?[{text:r}]:[])}var lt=new Set(["div","p","li","h1","h2","h3","h4","h5","h6","tr","ul","ol","table","blockquote","pre"]),jt=[10,13,16,18,24,32,48];function Gt(n){let r={};for(let a of n.split(";")){let l=a.indexOf(":");if(l<0)continue;let o=a.slice(0,l).trim().toLowerCase(),t=a.slice(l+1).trim();if(o==="color")r.color=Be(t);else if(o==="font-weight")r.bold=t==="bold"||Number(t)>=600;else if(o==="font-style")r.italic=t==="italic"||t==="oblique";else if(o==="text-decoration"||o==="text-decoration-line")r.underline=t.includes("underline");else if(o==="font-size"){let s=/^([\d.]+)px$/.exec(t);if(s)r.size=Math.min(200,Number(s[1]))}}return r}function Zt(n){let r=[[]],a=[],l=()=>Object.assign({},...a.map((m)=>m.style)),o=()=>{r.push([])},t=()=>{if(r[r.length-1].length>0)o()},s=(m)=>{if(!m)return;let y=l(),f={text:m};if(y.bold)f.bold=!0;if(y.italic)f.italic=!0;if(y.underline)f.underline=!0;if(y.color)f.color=y.color;if(y.size)f.size=y.size;r[r.length-1].push(f)},c=/<!--[\s\S]*?-->|<\/?([a-zA-Z][a-zA-Z0-9]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*)\s*\/?>|([^<]+)|</g,d;while(d=c.exec(n)){if(d[3]!==void 0||d[0]==="<"){s(je((d[3]??"<").replace(/[ \t\r\n]+/g," ")));continue}let m=(d[1]??"").toLowerCase();if(!m)continue;let y=d[0][1]==="/";if(m==="br"){o();continue}if(y){let k=a.map((C)=>C.tag).lastIndexOf(m);if(k>=0)a.splice(k);if(lt.has(m))t();continue}if(["script","style","title","head"].includes(m)){let k=n.toLowerCase().indexOf(`</${m}`,c.lastIndex);c.lastIndex=k<0?n.length:k;continue}if(lt.has(m))t();let f=d[2]??"",x=(k)=>new RegExp(`\\s${k}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(f),p={};if(m==="b"||m==="strong"||/^h[1-6]$/.test(m))p.bold=!0;if(m==="i"||m==="em")p.italic=!0;if(m==="u")p.underline=!0;let T=x("style");if(T)Object.assign(p,Gt(je(T[1]??T[2]??T[3]??"")));if(m==="font"){let k=x("color"),C=k&&Be(je(k[1]??k[2]??k[3]??""));if(C)p.color=C;let O=x("size"),R=O?Number(O[1]??O[2]??O[3]):NaN;if(R>=1&&R<=7)p.size=jt[R-1]}if(m==="li")s("• ");if(!(/\/>$/.test(d[0])||["img","hr","input","wbr","meta","link"].includes(m)))a.push({tag:m,style:p})}while(r.length>1&&r[r.length-1].every((m)=>!m.text.trim()))r.pop();while(r.length>1&&r[0].every((m)=>!m.text.trim()))r.shift();return r.map((m)=>Vt(m))}function Vt(n){let r=n.map((a)=>({...a}));while(r.length>0&&r[0].text.trim()==="")r.shift();while(r.length>0&&r[r.length-1].text.trim()==="")r.pop();if(r[0])r[0].text=r[0].text.replace(/^ +/,"");if(r.length>0)r[r.length-1].text=r[r.length-1].text.replace(/ +$/,"");return r}function yt(n,r){return{...r,size:n.size??r.size,weight:n.bold?"bold":r.weight,style:n.italic?"italic":r.style}}function Ke(n,r,a){return n.reduce((l,o)=>l+a(o.text,yt(o,r)).width,0)}function Kt(n,r){return Math.max(r.size,...n.map((a)=>a.size??r.size))*1.2}function Qt(n,r,a,l){let o=[];for(let t of n){if(Ke(t,a,l)<=r){o.push(t);continue}let s=[[]];for(let m of t)for(let y of m.text.split(/( +)/))if(/^ +$/.test(y))s.push([]);else if(y)s[s.length-1].push({...m,text:y});let c=[],d=0;for(let m of s){if(m.length===0)continue;let y=Ke(m,a,l),f=l(" ",yt(m[0],a)).width;if(c.length>0&&d+f+y>r)o.push(c),c=[],d=0;if(c.length>0)c.push({...m[0],text:" "}),d+=f;c.push(...m),d+=y}o.push(c)}return o}var Jt=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],en=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],tn=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],nn=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],on=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function Re(n,r){let a=new Uint16Array(16);for(let t=0;t<r;t++)a[n[t]]++;a[0]=0;let l=new Uint16Array(16);for(let t=1;t<16;t++)l[t]=l[t-1]+a[t-1];let o=new Uint16Array(r);for(let t=0;t<r;t++)if(n[t])o[l[n[t]]++]=t;return{counts:a,symbols:o}}var We;function rn(){if(We)return We;let n=new Uint8Array(288);for(let a=0;a<144;a++)n[a]=8;for(let a=144;a<256;a++)n[a]=9;for(let a=256;a<280;a++)n[a]=7;for(let a=280;a<288;a++)n[a]=8;let r=new Uint8Array(30).fill(5);return We={lit:Re(n,288),dist:Re(r,30)},We}function sn(n,r=50000000){let a=0,l=0,o=0,t=new Uint8Array(Math.min(r,Math.max(1024,n.length*4))),s=0,c=()=>{throw new Q("A compressed page is corrupt")},d=(f)=>{while(o<f){if(a>=n.length)c();l|=n[a++]<<o,o+=8}let x=l&(1<<f)-1;return l>>>=f,o-=f,x},m=(f)=>{if(s+f<=t.length)return;if(s+f>r)throw new Q(`A compressed page expands beyond ${r} bytes`);let x=t.length*2;while(x<s+f)x*=2;let p=new Uint8Array(Math.min(x,r));p.set(t.subarray(0,s)),t=p},y=(f)=>{let x=0,p=0,T=0;for(let k=1;k<16;k++){x|=d(1);let C=f.counts[k];if(x-C<p)return f.symbols[T+(x-p)];T+=C,p+=C,p<<=1,x<<=1}return c()};for(;;){let f=d(1),x=d(2);if(x===0){if(l=0,o=0,a+4>n.length)c();let p=n[a]|n[a+1]<<8,T=n[a+2]|n[a+3]<<8;if((p^65535)!==T)c();if(a+=4,a+p>n.length)c();m(p),t.set(n.subarray(a,a+p),s),s+=p,a+=p}else if(x===1||x===2){let p,T;if(x===1)({lit:p,dist:T}=rn());else{let k=d(5)+257,C=d(5)+1,O=d(4)+4,R=new Uint8Array(19);for(let b=0;b<O;b++)R[on[b]]=d(3);let J=Re(R,19),_=new Uint8Array(k+C);for(let b=0;b<k+C;){let E=y(J);if(E<16)_[b++]=E;else{let N,P=0;if(E===16){if(b===0)c();P=_[b-1],N=3+d(2)}else if(E===17)N=3+d(3);else N=11+d(7);if(b+N>k+C)c();_.fill(P,b,b+N),b+=N}}p=Re(_.subarray(0,k),k),T=Re(_.subarray(k),C)}for(;;){let k=y(p);if(k<256)m(1),t[s++]=k;else if(k===256)break;else{let C=k-257;if(C>=29)c();let O=Jt[C]+d(en[C]),R=y(T);if(R>=30)c();let J=tn[R]+d(nn[R]);if(J>s)c();m(O);for(let _=0;_<O;_++,s++)t[s]=t[s-J]}}}else c();if(f)break}return t.subarray(0,s)}var an="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qe=new Int16Array(128).fill(-1);for(let n=0;n<64;n++)qe[an.charCodeAt(n)]=n;qe[45]=62;qe[95]=63;function ln(n){let r=n.replace(/[\s=]/g,""),a=new Uint8Array(Math.floor(r.length*3/4)),l=0,o=0,t=0;for(let s=0;s<r.length;s++){let c=r.charCodeAt(s),d=c<128?qe[c]:-1;if(d<0)throw new Q("A compressed page is not valid base64");if(l=l<<6|d,o+=6,o>=8)o-=8,a[t++]=l>>o&255}return a.subarray(0,t)}function cn(n){return new TextDecoder("utf-8").decode(n)}function un(n,r){let a=cn(sn(ln(n.trim()),r));try{return decodeURIComponent(a)}catch{return a}}var ct="http://www.w3.org/XML/1998/namespace",ut="http://www.w3.org/2000/xmlns/",wt=String.raw`A-Za-z_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD`,fn=String.raw`${wt}\-.0-9\u00B7\u0300-\u036F\u203F-\u2040:`,ft=new RegExp(`[${wt}:][${fn}]*`,"y"),hn={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};function Ge(n){return n===9||n===10||n===13||n>=32&&n<=55295||n>=57344&&n<=65533||n>=65536&&n<=1114111}function Qe(n,r={}){let a=r.maxLength??20000000,l=r.maxElements??200000,o=r.maxDepth??256;if(typeof n!=="string")throw new Q("The diagram must be a string of XML");if(n.length>a)throw new Q(`The file has ${n.length} characters; the limit is ${a}`);let t=n.charCodeAt(0)===65279?n.slice(1):n,s=0,c=0,d=[0];for(let b=t.indexOf(`
|
|
1
|
+
import{i,u,e,Rr,Ed}from"./index-4cag7w6k.js";import{Dd}from"./index-dt6q3rws.js";var mt=/^[a-zA-Z][a-zA-Z0-9:_-]*$/;function S(n,r={},a=[]){if(!mt.test(n))throw Error(`Invalid SVG tag name: ${n}`);return{tag:n,attrs:r,children:a.filter((l)=>!!l)}}function Fe(n){return{text:n}}function kt(n){return n.replace(/[&<>]/g,(r)=>r==="&"?"&":r==="<"?"<":">")}function St(n){return n.replace(/[&<>"']/g,(r)=>{switch(r){case"&":return"&";case"<":return"<";case">":return">";case'"':return""";default:return"'"}})}function Y(n){if(!Number.isFinite(n))return"0";let r=Math.round(n*100)/100;return Object.is(r,-0)?"0":String(r)}function At(n){let r="";for(let[a,l]of Object.entries(n)){if(l===null||l===void 0||l===!1)continue;if(!mt.test(a))throw Error(`Invalid SVG attribute name: ${a}`);if(l===!0)r+=` ${a}=""`;else if(typeof l==="number")r+=` ${a}="${Y(l)}"`;else r+=` ${a}="${St(l)}"`}return r}function gt(n){if("text"in n)return kt(n.text);let r=At(n.attrs);if(n.children.length===0)return`<${n.tag}${r}/>`;return`<${n.tag}${r}>${n.children.map(gt).join("")}</${n.tag}>`}var L=class{constructor(){this.parts=[]}moveTo(n,r){return this.parts.push(`M${Y(n)},${Y(r)}`),this}lineTo(n,r){return this.parts.push(`L${Y(n)},${Y(r)}`),this}curveTo(n,r,a,l,o,t){return this.parts.push(`C${Y(n)},${Y(r)} ${Y(a)},${Y(l)} ${Y(o)},${Y(t)}`),this}quadTo(n,r,a,l){return this.parts.push(`Q${Y(n)},${Y(r)} ${Y(a)},${Y(l)}`),this}arcTo(n,r,a,l,o,t,s){return this.parts.push(`A${Y(n)},${Y(r)} ${Y(a)} ${l?1:0},${o?1:0} ${Y(t)},${Y(s)}`),this}close(){return this.parts.push("Z"),this}toString(){return this.parts.join(" ")}},xt=1.25,Et=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584],Ct=1.06,It=new Set("гзтэсеё".split("")),Nt=new Set("жмшщюыЖМШЩЮЫФф".split(""));function Ft(n){let r=n.codePointAt(0)??0;if(r>=32&&r<=126)return Et[r-32]??556;if(r>=1024&&r<=1279){if(Nt.has(n))return 800;if(It.has(n))return 470;return n===n.toUpperCase()?690:545}if(r>=11904&&r<=40959||r>=44032&&r<=55215||r>=63744&&r<=64255||r>=65280&&r<=65519||r>=127744&&r<=129791)return 1000;if(r===8212||r===8230)return 1000;if(r===8211)return 556;if(r===160)return 278;return 600}var Ot=(n,r)=>{let a=0;for(let o of n)a+=Ft(o);let l=a/1000*r.size*Ct;if(r.weight==="bold")l*=1.07;return{width:l,height:r.size*xt}},de;function Lt(){if(de!==void 0)return de;de=null;try{let n=globalThis;if(n.navigator?.userAgent?.includes("jsdom"))return de;if(typeof n.OffscreenCanvas==="function")de=new n.OffscreenCanvas(1,1).getContext("2d");else if(n.document&&typeof n.document.createElement==="function")de=n.document.createElement("canvas").getContext("2d");if(de&&de.measureText("M").width<=0)de=null}catch{de=null}return de}function pt(n){return`${n.style==="italic"?"italic ":""}${n.weight==="bold"?"bold ":""}${n.size}px ${n.family}`}function Pt(n){let r=new Map;return(a,l)=>{let o=`${pt(l)}\x00${a}`,t=r.get(o);if(!t){if(t=n(a,l),r.size>5000)r.clear();r.set(o,t)}return t}}function Dt(){let n=Lt();if(!n)return Ot;return Pt((r,a)=>(n.font=pt(a),{width:n.measureText(r).width,height:a.size*xt}))}var _t=/^[a-zA-Z]{3,24}$/,Rt=/^#(?:[0-9a-fA-F]{3,4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})$/,ze=String.raw`\s*[+-]?(?:\d+\.?\d*|\.\d+)(?:%|deg)?\s*`,zt=new RegExp(`^(?:rgba?|hsla?)\\((?:${ze},){2,3}${ze}\\)$|^(?:rgba?|hsla?)\\((?:${ze}){3}(?:/${ze})?\\)$`,"i");function Be(n){if(n===void 0)return;let r=n.trim();if(Rt.test(r)||zt.test(r))return r;if(_t.test(r)&&!/^(?:inherit|initial|unset|revert|var|url|expression|none|default)$/i.test(r))return r}var Wt={"--drawio-font-family":"Helvetica, Arial, sans-serif","--drawio-background":"transparent","--drawio-fill":"#ffffff","--drawio-stroke":"#000000","--drawio-text":"#000000","--drawio-label-background":"#ffffff","--drawio-placeholder":"#9ca3af"};function Te(n){return`var(${n}, ${Wt[n]})`}function ge(n,r,a){let l=n[r];if(l===void 0||l===""||l==="default")return a;if(l==="none")return"none";return Be(l)??a}function M(n,r,a,l=-1e6,o=1e6){let t=n[r],s=t===void 0?NaN:Number(t);return Number.isFinite(s)?Math.min(o,Math.max(l,s)):a}function Ve(n,r,a=!1){let l=n[r];return l===void 0?a:l==="1"||l==="true"}function nt(n,r){if(!Ve(n,"dashed"))return;let a=n.dashPattern;if(a&&/^[\d.\s]+$/.test(a))return a.trim().split(/\s+/).map((l)=>Number(l)*r).join(" ");return`${3*r} ${3*r}`}function Xt(n){let r=`#${n}`;return[`${r}{font-family:${Te("--drawio-font-family")};background:${Te("--drawio-background")}}`,`${r} text{white-space:pre}`,`${r} a{cursor:pointer}`].join("")}var $e=(n)=>({x:n.x+n.width/2,y:n.y+n.height/2});function ot(n,r,a){let l=$e(n),o=a.x-l.x,t=a.y-l.y;if(o===0&&t===0)return l;let s=n.width/2,c=n.height/2;if(r==="ellipse"||r==="doubleEllipse"||r==="orShape"||r==="xorShape"){let m=1/Math.sqrt(o*o/(s*s||1)+t*t/(c*c||1));return{x:l.x+o*m,y:l.y+t*m}}if(r==="rhombus"){let m=1/(Math.abs(o)/(s||1)+Math.abs(t)/(c||1));return{x:l.x+o*m,y:l.y+t*m}}let d=Math.min(o===0?1/0:s/Math.abs(o),t===0?1/0:c/Math.abs(t));return{x:l.x+o*d,y:l.y+t*d}}function Ee(n){if(!n.port)return;return{x:n.bounds.x+n.port.x*n.bounds.width,y:n.bounds.y+n.port.y*n.bounds.height}}function Oe(n,r){return[["left",Math.abs(r.x-n.x)],["right",Math.abs(r.x-n.x-n.width)],["top",Math.abs(r.y-n.y)],["bottom",Math.abs(r.y-n.y-n.height)]].sort((a,l)=>a[1]-l[1])[0][0]}function rt(n,r){let a=Ee(n);if(a)return a;let l=n.bounds,o=$e(l);if(r.x>=l.x&&r.x<=l.x+l.width&&(r.y<l.y||r.y>l.y+l.height))return{x:r.x,y:r.y<l.y?l.y:l.y+l.height};if(r.y>=l.y&&r.y<=l.y+l.height&&(r.x<l.x||r.x>l.x+l.width))return{x:r.x<l.x?l.x:l.x+l.width,y:r.y};let t=r.x-o.x,s=r.y-o.y;if(Math.abs(t)*l.height>=Math.abs(s)*l.width)return{x:t>0?l.x+l.width:l.x,y:o.y};return{x:o.x,y:s>0?l.y+l.height:l.y}}function Bt(n,r){let a=[n[0]],l=r;for(let o=1;o<n.length;o++){let t=a[a.length-1],s=n[o];if(Math.abs(t.x-s.x)>0.01&&Math.abs(t.y-s.y)>0.01)a.push(l?{x:s.x,y:t.y}:{x:t.x,y:s.y});a.push(s);let c=a[a.length-2];l=Math.abs(c.y-s.y)>0.01}return Me(a)}function Me(n){let r=[];for(let a of n){let l=r[r.length-1];if(l&&Math.abs(l.x-a.x)<0.01&&Math.abs(l.y-a.y)<0.01)continue;r.push(a)}return r}function qt(n,r,a,l){let o=l.edgeStyle??"",t=(f)=>("bounds"in f),s=(f)=>t(f)?$e(f.bounds):f;if(o==="entityRelationEdgeStyle"&&t(n)&&t(r)){let f=M(l,"segment",30,0,200),x=n.bounds,p=r.bounds;if(Math.min(x.x+x.width,p.x+p.width)-Math.max(x.x,p.x)>0&&!Ee(n)&&!Ee(r)){let J=Math.max(x.x+x.width,p.x+p.width)+f,_={x:x.x+x.width,y:$e(x).y},b={x:p.x+p.width,y:$e(p).y};return Me([_,{x:J,y:_.y},{x:J,y:b.y},b])}let T=$e(x).x<=$e(p).x,k=Ee(n)??{x:T?x.x+x.width:x.x,y:$e(x).y},C=Ee(r)??{x:T?p.x:p.x+p.width,y:$e(p).y},O=k.x+(T?f:-f),R=C.x+(T?-f:f);return Me([k,{x:O,y:k.y},{x:R,y:C.y},C])}if(o==="orthogonalEdgeStyle"||o==="elbowEdgeStyle"||o==="segmentEdgeStyle"){let f=a[0]??s(r),x=a[a.length-1]??s(n),p=t(n)?rt(n,f):n,T=t(r)?rt(r,x):r;if(a.length===0){let C=o==="elbowEdgeStyle"?l.elbow==="vertical":t(n)&&(Oe(n.bounds,p)==="top"||Oe(n.bounds,p)==="bottom");if(p.x===T.x||p.y===T.y)return Me([p,T]);if(C!==(t(r)&&(Oe(r.bounds,T)==="top"||Oe(r.bounds,T)==="bottom")))return Me([p,C?{x:p.x,y:T.y}:{x:T.x,y:p.y},T]);if(C){let R=(p.y+T.y)/2;return Me([p,{x:p.x,y:R},{x:T.x,y:R},T])}let O=(p.x+T.x)/2;return Me([p,{x:O,y:p.y},{x:O,y:T.y},T])}let k=t(n)?!(Oe(n.bounds,p)==="top"||Oe(n.bounds,p)==="bottom"):Math.abs(f.x-p.x)>=Math.abs(f.y-p.y);return Bt([p,...a,T],k)}let c=a[0]??s(r),d=a[a.length-1]??s(n),m=t(n)?Ee(n)??ot(n.bounds,n.shape,c):n,y=t(r)?Ee(r)??ot(r.bounds,r.shape,d):r;return Me([m,...a,y])}function Yt(n,r){let a=new L;if(n.length===0)return"";if(a.moveTo(n[0].x,n[0].y),r.curved==="1"&&n.length>2){for(let o=1;o<n.length-1;o++){let t=n[o],s=n[o+1],c=o===n.length-2?s:{x:(t.x+s.x)/2,y:(t.y+s.y)/2};a.quadTo(t.x,t.y,c.x,c.y)}return a.toString()}let l=r.rounded==="1"?M(r,"arcSize",20,0,200)/2:0;for(let o=1;o<n.length;o++){let t=n[o],s=n[o+1];if(l>0&&s){let c=n[o-1],d=Math.hypot(t.x-c.x,t.y-c.y),m=Math.hypot(s.x-t.x,s.y-t.y),y=Math.min(l,d/2,m/2);if(y>0.5){let f={x:t.x-(t.x-c.x)/d*y,y:t.y-(t.y-c.y)/d*y},x={x:t.x+(s.x-t.x)/m*y,y:t.y+(s.y-t.y)/m*y};a.lineTo(f.x,f.y).quadTo(t.x,t.y,x.x,x.y);continue}}a.lineTo(t.x,t.y)}return a.toString()}function it(n,r){switch(n){case"classic":case"classicThin":return r*1.2;case"block":case"blockThin":return r*1.6;case"diamond":case"diamondThin":return r*2.2;case"oval":case"circle":return r;default:return 0}}function st(n,r,a,l,o,t,s){if(!n||n==="none")return[];let c={x:-a.y,y:a.x},d=(x,p)=>[r.x-a.x*x+c.x*p,r.y-a.y*x+c.y*p],m=(x,p,T)=>{let k=new L;if(x.forEach(([C,O],R)=>R===0?k.moveTo(C,O):k.lineTo(C,O)),p)k.close();return S("path",{d:k.toString(),fill:p?T?t:"var(--drawio-label-background, #ffffff)":"none",stroke:t,"stroke-width":s,"stroke-linejoin":"round","stroke-linecap":"round"})},y=l*1.6,f=l*(n.endsWith("Thin")?0.45:0.7);switch(n){case"classic":case"classicThin":return[m([d(0,0),d(y,f),d(y*0.75,0),d(y,-f)],!0,o)];case"block":case"blockThin":return[m([d(0,0),d(y,f),d(y,-f)],!0,o)];case"open":case"openThin":return[m([d(y,f),d(0,0),d(y,-f)],!1,!1)];case"async":return[m([d(0,0),d(y,f),d(y,0)],!0,o)];case"diamond":case"diamondThin":return[m([d(0,0),d(y*0.7,f),d(y*1.4,0),d(y*0.7,-f)],!0,o)];case"oval":case"circle":{let[x,p]=d(l/2,0);return[S("circle",{cx:x,cy:p,r:l/2,fill:o?t:"var(--drawio-label-background, #ffffff)",stroke:t,"stroke-width":s})]}case"dash":return[m([d(l,l),d(l,-l)],!1,!1)];case"cross":return[m([d(y,f),d(0,-f)],!1,!1),m([d(y,-f),d(0,f)],!1,!1)];case"ERone":return[m([d(l*1.6,l),d(l*1.6,-l)],!1,!1)];case"ERmandOne":return[m([d(l*1.2,l),d(l*1.2,-l)],!1,!1),m([d(l*2,l),d(l*2,-l)],!1,!1)];case"ERmany":return[m([d(0,l),d(l*1.6,0),d(0,-l)],!1,!1)];case"ERoneToMany":return[m([d(0,l),d(l*1.6,0),d(0,-l)],!1,!1),m([d(l*2,l),d(l*2,-l)],!1,!1)];case"ERzeroToMany":{let[x,p]=d(l*2.6,0);return[m([d(0,l),d(l*1.6,0),d(0,-l)],!1,!1),S("circle",{cx:x,cy:p,r:l*0.6,fill:"var(--drawio-label-background, #ffffff)",stroke:t,"stroke-width":s})]}case"ERzeroToOne":{let[x,p]=d(l*2.6,0);return[m([d(l*1.2,l),d(l*1.2,-l)],!1,!1),S("circle",{cx:x,cy:p,r:l*0.6,fill:"var(--drawio-label-background, #ffffff)",stroke:t,"stroke-width":s})]}default:return[m([d(y,f),d(0,0),d(y,-f)],!1,!1)]}}function at(n,r){let a=0;for(let c=1;c<n.length;c++)a+=Math.hypot(n[c].x-n[c-1].x,n[c].y-n[c-1].y);let l=a*Math.min(1,Math.max(0,r));for(let c=1;c<n.length;c++){let d=n[c-1],m=n[c],y=Math.hypot(m.x-d.x,m.y-d.y);if(l<=y&&y>0)return{point:{x:d.x+(m.x-d.x)*l/y,y:d.y+(m.y-d.y)*l/y},dir:{x:(m.x-d.x)/y,y:(m.y-d.y)/y}};l-=y}let o=n[n.length-2]??n[0],t=n[n.length-1],s=Math.hypot(t.x-o.x,t.y-o.y)||1;return{point:t,dir:{x:(t.x-o.x)/s,y:(t.y-o.y)/s}}}var Q=class extends Error{constructor(n,r=0,a=0,l){super(r>0?`${n} (line ${r}${a>0?`, column ${a}`:""})`:n);this.line=r,this.column=a,this.hint=l,this.name="DrawioError"}},Ut={amp:"&",lt:"<",gt:">",quot:'"',apos:"'",nbsp:" ",ndash:"–",mdash:"—",hellip:"…",laquo:"«",raquo:"»",copy:"©",reg:"®",trade:"™",bull:"•",middot:"·",deg:"°",times:"×",rarr:"→",larr:"←",euro:"€"};function je(n){return n.replace(/&(#x[0-9a-f]+|#\d+|[a-z]+);/gi,(r,a)=>{if(a[0]==="#"){let l=a[1]==="x"||a[1]==="X"?parseInt(a.slice(2),16):parseInt(a.slice(1),10);return l>0&&l<=1114111&&!(l>=55296&&l<=57343)?String.fromCodePoint(l):r}return Ut[a.toLowerCase()]??r})}function Ht(n){return n.split(/\r\n|\r|\n/).map((r)=>r?[{text:r}]:[])}var lt=new Set(["div","p","li","h1","h2","h3","h4","h5","h6","tr","ul","ol","table","blockquote","pre"]),jt=[10,13,16,18,24,32,48];function Gt(n){let r={};for(let a of n.split(";")){let l=a.indexOf(":");if(l<0)continue;let o=a.slice(0,l).trim().toLowerCase(),t=a.slice(l+1).trim();if(o==="color")r.color=Be(t);else if(o==="font-weight")r.bold=t==="bold"||Number(t)>=600;else if(o==="font-style")r.italic=t==="italic"||t==="oblique";else if(o==="text-decoration"||o==="text-decoration-line")r.underline=t.includes("underline");else if(o==="font-size"){let s=/^([\d.]+)px$/.exec(t);if(s)r.size=Math.min(200,Number(s[1]))}}return r}function Zt(n){let r=[[]],a=[],l=()=>Object.assign({},...a.map((m)=>m.style)),o=()=>{r.push([])},t=()=>{if(r[r.length-1].length>0)o()},s=(m)=>{if(!m)return;let y=l(),f={text:m};if(y.bold)f.bold=!0;if(y.italic)f.italic=!0;if(y.underline)f.underline=!0;if(y.color)f.color=y.color;if(y.size)f.size=y.size;r[r.length-1].push(f)},c=/<!--[\s\S]*?-->|<\/?([a-zA-Z][a-zA-Z0-9]*)((?:\s+[^\s=>/]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?)*)\s*\/?>|([^<]+)|</g,d;while(d=c.exec(n)){if(d[3]!==void 0||d[0]==="<"){s(je((d[3]??"<").replace(/[ \t\r\n]+/g," ")));continue}let m=(d[1]??"").toLowerCase();if(!m)continue;let y=d[0][1]==="/";if(m==="br"){o();continue}if(y){let k=a.map((C)=>C.tag).lastIndexOf(m);if(k>=0)a.splice(k);if(lt.has(m))t();continue}if(["script","style","title","head"].includes(m)){let k=n.toLowerCase().indexOf(`</${m}`,c.lastIndex);c.lastIndex=k<0?n.length:k;continue}if(lt.has(m))t();let f=d[2]??"",x=(k)=>new RegExp(`\\s${k}\\s*=\\s*(?:"([^"]*)"|'([^']*)'|([^\\s>]+))`,"i").exec(f),p={};if(m==="b"||m==="strong"||/^h[1-6]$/.test(m))p.bold=!0;if(m==="i"||m==="em")p.italic=!0;if(m==="u")p.underline=!0;let T=x("style");if(T)Object.assign(p,Gt(je(T[1]??T[2]??T[3]??"")));if(m==="font"){let k=x("color"),C=k&&Be(je(k[1]??k[2]??k[3]??""));if(C)p.color=C;let O=x("size"),R=O?Number(O[1]??O[2]??O[3]):NaN;if(R>=1&&R<=7)p.size=jt[R-1]}if(m==="li")s("• ");if(!(/\/>$/.test(d[0])||["img","hr","input","wbr","meta","link"].includes(m)))a.push({tag:m,style:p})}while(r.length>1&&r[r.length-1].every((m)=>!m.text.trim()))r.pop();while(r.length>1&&r[0].every((m)=>!m.text.trim()))r.shift();return r.map((m)=>Vt(m))}function Vt(n){let r=n.map((a)=>({...a}));while(r.length>0&&r[0].text.trim()==="")r.shift();while(r.length>0&&r[r.length-1].text.trim()==="")r.pop();if(r[0])r[0].text=r[0].text.replace(/^ +/,"");if(r.length>0)r[r.length-1].text=r[r.length-1].text.replace(/ +$/,"");return r}function yt(n,r){return{...r,size:n.size??r.size,weight:n.bold?"bold":r.weight,style:n.italic?"italic":r.style}}function Ke(n,r,a){return n.reduce((l,o)=>l+a(o.text,yt(o,r)).width,0)}function Kt(n,r){return Math.max(r.size,...n.map((a)=>a.size??r.size))*1.2}function Qt(n,r,a,l){let o=[];for(let t of n){if(Ke(t,a,l)<=r){o.push(t);continue}let s=[[]];for(let m of t)for(let y of m.text.split(/( +)/))if(/^ +$/.test(y))s.push([]);else if(y)s[s.length-1].push({...m,text:y});let c=[],d=0;for(let m of s){if(m.length===0)continue;let y=Ke(m,a,l),f=l(" ",yt(m[0],a)).width;if(c.length>0&&d+f+y>r)o.push(c),c=[],d=0;if(c.length>0)c.push({...m[0],text:" "}),d+=f;c.push(...m),d+=y}o.push(c)}return o}var Jt=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],en=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],tn=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],nn=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],on=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function Re(n,r){let a=new Uint16Array(16);for(let t=0;t<r;t++)a[n[t]]++;a[0]=0;let l=new Uint16Array(16);for(let t=1;t<16;t++)l[t]=l[t-1]+a[t-1];let o=new Uint16Array(r);for(let t=0;t<r;t++)if(n[t])o[l[n[t]]++]=t;return{counts:a,symbols:o}}var We;function rn(){if(We)return We;let n=new Uint8Array(288);for(let a=0;a<144;a++)n[a]=8;for(let a=144;a<256;a++)n[a]=9;for(let a=256;a<280;a++)n[a]=7;for(let a=280;a<288;a++)n[a]=8;let r=new Uint8Array(30).fill(5);return We={lit:Re(n,288),dist:Re(r,30)},We}function sn(n,r=50000000){let a=0,l=0,o=0,t=new Uint8Array(Math.min(r,Math.max(1024,n.length*4))),s=0,c=()=>{throw new Q("A compressed page is corrupt")},d=(f)=>{while(o<f){if(a>=n.length)c();l|=n[a++]<<o,o+=8}let x=l&(1<<f)-1;return l>>>=f,o-=f,x},m=(f)=>{if(s+f<=t.length)return;if(s+f>r)throw new Q(`A compressed page expands beyond ${r} bytes`);let x=t.length*2;while(x<s+f)x*=2;let p=new Uint8Array(Math.min(x,r));p.set(t.subarray(0,s)),t=p},y=(f)=>{let x=0,p=0,T=0;for(let k=1;k<16;k++){x|=d(1);let C=f.counts[k];if(x-C<p)return f.symbols[T+(x-p)];T+=C,p+=C,p<<=1,x<<=1}return c()};for(;;){let f=d(1),x=d(2);if(x===0){if(l=0,o=0,a+4>n.length)c();let p=n[a]|n[a+1]<<8,T=n[a+2]|n[a+3]<<8;if((p^65535)!==T)c();if(a+=4,a+p>n.length)c();m(p),t.set(n.subarray(a,a+p),s),s+=p,a+=p}else if(x===1||x===2){let p,T;if(x===1)({lit:p,dist:T}=rn());else{let k=d(5)+257,C=d(5)+1,O=d(4)+4,R=new Uint8Array(19);for(let b=0;b<O;b++)R[on[b]]=d(3);let J=Re(R,19),_=new Uint8Array(k+C);for(let b=0;b<k+C;){let E=y(J);if(E<16)_[b++]=E;else{let N,P=0;if(E===16){if(b===0)c();P=_[b-1],N=3+d(2)}else if(E===17)N=3+d(3);else N=11+d(7);if(b+N>k+C)c();_.fill(P,b,b+N),b+=N}}p=Re(_.subarray(0,k),k),T=Re(_.subarray(k),C)}for(;;){let k=y(p);if(k<256)m(1),t[s++]=k;else if(k===256)break;else{let C=k-257;if(C>=29)c();let O=Jt[C]+d(en[C]),R=y(T);if(R>=30)c();let J=tn[R]+d(nn[R]);if(J>s)c();m(O);for(let _=0;_<O;_++,s++)t[s]=t[s-J]}}}else c();if(f)break}return t.subarray(0,s)}var an="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",qe=new Int16Array(128).fill(-1);for(let n=0;n<64;n++)qe[an.charCodeAt(n)]=n;qe[45]=62;qe[95]=63;function ln(n){let r=n.replace(/[\s=]/g,""),a=new Uint8Array(Math.floor(r.length*3/4)),l=0,o=0,t=0;for(let s=0;s<r.length;s++){let c=r.charCodeAt(s),d=c<128?qe[c]:-1;if(d<0)throw new Q("A compressed page is not valid base64");if(l=l<<6|d,o+=6,o>=8)o-=8,a[t++]=l>>o&255}return a.subarray(0,t)}function cn(n){return new TextDecoder("utf-8").decode(n)}function un(n,r){let a=cn(sn(ln(n.trim()),r));try{return decodeURIComponent(a)}catch{return a}}var ct="http://www.w3.org/XML/1998/namespace",ut="http://www.w3.org/2000/xmlns/",wt=String.raw`A-Za-z_\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD`,fn=String.raw`${wt}\-.0-9\u00B7\u0300-\u036F\u203F-\u2040:`,ft=new RegExp(`[${wt}:][${fn}]*`,"y"),hn={lt:"<",gt:">",amp:"&",quot:'"',apos:"'"};function Ge(n){return n===9||n===10||n===13||n>=32&&n<=55295||n>=57344&&n<=65533||n>=65536&&n<=1114111}function Qe(n,r={}){let a=r.maxLength??20000000,l=r.maxElements??200000,o=r.maxDepth??256;if(typeof n!=="string")throw new Q("The diagram must be a string of XML");if(n.length>a)throw new Q(`The file has ${n.length} characters; the limit is ${a}`);let t=n.charCodeAt(0)===65279?n.slice(1):n,s=0,c=0,d=[0];for(let b=t.indexOf(`
|
|
2
2
|
`);b>=0;b=t.indexOf(`
|
|
3
3
|
`,b+1))d.push(b+1);let m=(b)=>{let E=0,N=d.length-1;while(E<N){let P=E+N+1>>1;if(d[P]<=b)E=P;else N=P-1}return{line:E+1,column:b-d[E]+1}},y=(b,E=s,N)=>{let{line:P,column:V}=m(E);throw new Q(b,P,V,N)},f=()=>{ft.lastIndex=s;let b=ft.exec(t);if(!b)y("A name is expected here");return s+=b[0].length,b[0]},x=()=>{let b=s;while(s<t.length&&/[ \t\r\n]/.test(t[s]))s++;return s>b},p=(b)=>{if(!t.startsWith(b,s))y(`"${b}" is expected here`);s+=b.length},T=(b,E,N)=>{let P=(U)=>N?U.replace(/\r\n|[\r\n\t]/g," "):U.replace(/\r\n?/g,`
|
|
4
4
|
`),V="",re=0;for(let U=0;U<b.length;U++){let ie=b.charCodeAt(U);if(ie===38){let me=b.indexOf(";",U);if(me<0)y('An "&" must start a reference such as "&"',E+U);let K=b.slice(U+1,me),se;if(K.startsWith("#x")){let j=/^[0-9a-fA-F]+$/.test(K.slice(2))?parseInt(K.slice(2),16):NaN;se=Ge(j)?String.fromCodePoint(j):void 0}else if(K.startsWith("#")){let j=/^[0-9]+$/.test(K.slice(1))?parseInt(K.slice(1),10):NaN;se=Ge(j)?String.fromCodePoint(j):void 0}else se=hn[K];if(se===void 0)y(`"&${K};" is not a known reference`,E+U,"Only < > & " ' and &#…; are allowed.");V+=P(b.slice(re,U))+se,U=me,re=me+1;continue}if(N&&ie===60)y('"<" is not allowed in an attribute value',E+U);if(!Ge(ie)&&!(ie>=55296&&ie<=57343))y("The file contains a character XML does not allow",E+U)}return V+P(b.slice(re))},k=(b)=>{if(t.startsWith("<!--",s)){let E=t.indexOf("-->",s+4);if(E<0)y("A comment is never closed");let N=t.slice(s+4,E);if(N.includes("--"))y('"--" is not allowed inside a comment');return s=E+3,{kind:"comment",value:N}}if(t.startsWith("<?",s)){let E=s;s+=2;let N=f();if(N.toLowerCase()==="xml"&&E!==0)y("The XML declaration must come first",E);let P=t.indexOf("?>",s);if(P<0)y("A processing instruction is never closed",E);let V=t.slice(s,P).trim();return s=P+2,{kind:"instruction",target:N,value:V}}if(b&&t.startsWith("<![CDATA[",s)){let E=t.indexOf("]]>",s+9);if(E<0)y("A CDATA section is never closed");let N=t.slice(s+9,E).replace(/\r\n?/g,`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{e,m,Rr}from"./index-
|
|
1
|
+
import{e,m,Rr}from"./index-4cag7w6k.js";import{wi,ru}from"./index-dt6q3rws.js";function g({source:t,name:r,revision:s=0}){let{url:i,loading:n,error:o}=ru(t,s);if(o)return e(Rr,{name:r,message:o});if(n||!i)return e("div",{className:"flex flex-1 items-center justify-center gap-2 text-xs text-ink/40",children:[e(m,{size:14,className:"animate-spin"}),e("span",{children:"Loading image…"})]});return e(wi,{src:i,name:r,className:"flex-1 min-h-0"})}export{g as ImageView};
|