@techie_doubts/tui.notes.2026 1.0.7 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/{arc-9PNMzvov.js → arc-CIcRRSta.js} +1 -1
- package/dist/assets/{architectureDiagram-VXUJARFQ-D7eSuxAo.js → architectureDiagram-VXUJARFQ-CETnnZCB.js} +1 -1
- package/dist/assets/{blockDiagram-VD42YOAC-CRDx2v4y.js → blockDiagram-VD42YOAC-BOvlZil1.js} +1 -1
- package/dist/assets/{c4Diagram-YG6GDRKO-BZ-rR7Xz.js → c4Diagram-YG6GDRKO-CNV6HN2x.js} +1 -1
- package/dist/assets/channel-CdG2A9XY.js +1 -0
- package/dist/assets/{chunk-4BX2VUAB-BVa9_CI8.js → chunk-4BX2VUAB-KDnSJDvW.js} +1 -1
- package/dist/assets/{chunk-55IACEB6-DEsgGcA5.js → chunk-55IACEB6-DYvjLzFs.js} +1 -1
- package/dist/assets/{chunk-B4BG7PRW-Bpu5eFEV.js → chunk-B4BG7PRW-DEpR2bOf.js} +1 -1
- package/dist/assets/{chunk-DI55MBZ5-BzPNj5EH.js → chunk-DI55MBZ5-DDlHRszV.js} +1 -1
- package/dist/assets/{chunk-FMBD7UC4-DD_AE9Va.js → chunk-FMBD7UC4-CxMxdMk1.js} +1 -1
- package/dist/assets/{chunk-QN33PNHL--se-DHpE.js → chunk-QN33PNHL-CxkhbU8S.js} +1 -1
- package/dist/assets/{chunk-QZHKN3VN-B_BW43Zd.js → chunk-QZHKN3VN-BxGbXkUT.js} +1 -1
- package/dist/assets/{chunk-TZMSLE5B-48E-4UsA.js → chunk-TZMSLE5B-LnHPQ_wV.js} +1 -1
- package/dist/assets/classDiagram-2ON5EDUG-C5Y2kxjB.js +1 -0
- package/dist/assets/classDiagram-v2-WZHVMYZB-C5Y2kxjB.js +1 -0
- package/dist/assets/{clone-DwHBVXnd.js → clone-CvGfsInX.js} +1 -1
- package/dist/assets/{cose-bilkent-S5V4N54A-Dnc12AzZ.js → cose-bilkent-S5V4N54A-CQ5uAT9m.js} +1 -1
- package/dist/assets/{dagre-6UL2VRFP-Iu3gYghr.js → dagre-6UL2VRFP-De_yKZbs.js} +1 -1
- package/dist/assets/{diagram-PSM6KHXK-DYVzB3Bb.js → diagram-PSM6KHXK-CwixpUR-.js} +1 -1
- package/dist/assets/{diagram-QEK2KX5R-DvQbqxnW.js → diagram-QEK2KX5R-pOF12iRq.js} +1 -1
- package/dist/assets/{diagram-S2PKOQOG-DW_WGV5l.js → diagram-S2PKOQOG-CJYO0UuF.js} +1 -1
- package/dist/assets/{erDiagram-Q2GNP2WA-CBe2n1OC.js → erDiagram-Q2GNP2WA-Dw7cNBSS.js} +1 -1
- package/dist/assets/{flowDiagram-NV44I4VS-uz0-mHbc.js → flowDiagram-NV44I4VS-DrCXFAM-.js} +1 -1
- package/dist/assets/{ganttDiagram-JELNMOA3-D1iOsCAQ.js → ganttDiagram-JELNMOA3-Caq_Rl65.js} +1 -1
- package/dist/assets/{gitGraphDiagram-NY62KEGX-BFfRNLnM.js → gitGraphDiagram-NY62KEGX-vowZovNx.js} +1 -1
- package/dist/assets/{index-DnUc1o0Y.js → index-C378qiys.js} +521 -523
- package/dist/assets/{index-CqYDBXjB.css → index-OJnEfe9A.css} +1 -1
- package/dist/assets/{infoDiagram-WHAUD3N6-DCZYFU_B.js → infoDiagram-WHAUD3N6-C6FgcPQV.js} +1 -1
- package/dist/assets/{journeyDiagram-XKPGCS4Q-DFK2B_WZ.js → journeyDiagram-XKPGCS4Q-94L7BTbd.js} +1 -1
- package/dist/assets/{kanban-definition-3W4ZIXB7-lE-SqPd9.js → kanban-definition-3W4ZIXB7-Dgky7Sjl.js} +1 -1
- package/dist/assets/{linear-BJBvhlsU.js → linear-BS3jNszE.js} +1 -1
- package/dist/assets/{mindmap-definition-VGOIOE7T-CezBJW1D.js → mindmap-definition-VGOIOE7T-Bflay8Qj.js} +1 -1
- package/dist/assets/{pieDiagram-ADFJNKIX-rvj_uGqQ.js → pieDiagram-ADFJNKIX-CmQb2GUF.js} +1 -1
- package/dist/assets/{quadrantDiagram-AYHSOK5B-CN1tcbqL.js → quadrantDiagram-AYHSOK5B-YGxDiiDa.js} +1 -1
- package/dist/assets/{requirementDiagram-UZGBJVZJ-bRYjaHoU.js → requirementDiagram-UZGBJVZJ-C8U25oXn.js} +1 -1
- package/dist/assets/{sankeyDiagram-TZEHDZUN-RddyTJDs.js → sankeyDiagram-TZEHDZUN-DYcOFdDa.js} +1 -1
- package/dist/assets/{sequenceDiagram-WL72ISMW-DOTXWN13.js → sequenceDiagram-WL72ISMW-CMuh_8Xz.js} +1 -1
- package/dist/assets/{stateDiagram-FKZM4ZOC-BlJdyhyd.js → stateDiagram-FKZM4ZOC-CWa-EhFI.js} +1 -1
- package/dist/assets/stateDiagram-v2-4FDKWEC3-f8SbD9Gl.js +1 -0
- package/dist/assets/{timeline-definition-IT6M3QCI-CO3bnFMn.js → timeline-definition-IT6M3QCI-BusCsDZ5.js} +1 -1
- package/dist/assets/{treemap-KMMF4GRG-CY0UWUvF.js → treemap-KMMF4GRG-DTD_-Mhn.js} +1 -1
- package/dist/assets/{xychartDiagram-PRI3JC2R-BT1LZniA.js → xychartDiagram-PRI3JC2R-BEUf-hFY.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +3 -3
- package/server/index.js +327 -0
- package/dist/assets/channel-BCWjdVOH.js +0 -1
- package/dist/assets/classDiagram-2ON5EDUG-COShAlEY.js +0 -1
- package/dist/assets/classDiagram-v2-WZHVMYZB-COShAlEY.js +0 -1
- package/dist/assets/stateDiagram-v2-4FDKWEC3-D73xSmHh.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{aU as ai,bd as el,aQ as W,aR as jn,aY as Yn,be as zp,bf as jp,aM as fi,aP as Yp,b2 as Fd,bg as qp,bh as Ud,bi as Xp,bj as Gd,bk as Jp,bl as Bd,bm as Wl,aV as Vl,a_ as Hl,b1 as Qi,bn as Qp,bo as Zp,bp as Kd,bq as Rs,br as em,bs as Wd,bt as tm,bu as zl,bv as nm,aW as rm,aX as jl,bw as xa,bx as yn,by as j,bz as nn}from"./index-DnUc1o0Y.js";import{k as St,a as Vd,s as im,g as sm,b as am,d as Yl,e as om,f as Hd,c as xe}from"./clone-DwHBVXnd.js";import{l as lm,c as cm,r as um,y as tl,m as N,a as dm,z as fm,p as hm,f as st,v as qn,u as L,x as nl,w as ln,s as pm}from"./_basePickBy-5vIZeqrx.js";import{s as mm,p as zd,k as Xn,M as rl,K as ir,I as Se,a3 as gm,a4 as ym,a5 as Tm,b as Rm,d as ql,c as jd,B as Yd,X as qd,v as pe,a6 as Xd,D as Em,E as Xl,N as Am,a7 as vm,a8 as Im,a9 as km,a as Jd,h as _,i as Mt,f as Tn,r as Pe,j as z,g as nt,P as Jl,aa as ye,m as Sm}from"./_baseUniq-BKVPFJfn.js";import{c as Le}from"./clone-Ck-f8mTd.js";var Nm=Object.prototype,xm=Nm.hasOwnProperty,Qe=lm(function(n,e){if(mm(e)||zd(e)){cm(e,Xn(e),n);return}for(var t in e)xm.call(e,t)&&um(n,t,e[t])});function Qd(n,e,t){var r=-1,i=n.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=n[r+e];return s}function hi(n){for(var e=-1,t=n==null?0:n.length,r=0,i=[];++e<t;){var s=n[e];s&&(i[r++]=s)}return i}function Cm(n,e,t,r){for(var i=-1,s=n==null?0:n.length;++i<s;){var a=n[i];e(r,a,t(a),n)}return r}function $m(n,e,t,r){return rl(n,function(i,s,a){e(r,i,t(i),a)}),r}function _m(n,e){return function(t,r){var i=Se(t)?Cm:$m,s=e?e():{};return i(t,n,ir(r),s)}}var Lm=200;function Om(n,e,t,r){var i=-1,s=ym,a=!0,o=n.length,l=[],c=e.length;if(!o)return l;e.length>=Lm&&(s=Tm,a=!1,e=new gm(e));e:for(;++i<o;){var u=n[i],d=u;if(u=u!==0?u:0,a&&d===d){for(var f=c;f--;)if(e[f]===d)continue e;l.push(u)}else s(e,d,r)||l.push(u)}return l}var Qs=Rm(function(n,e){return ql(n)?Om(n,jd(e,1,ql,!0)):[]});function Ae(n,e,t){var r=n==null?0:n.length;return r?(e=e===void 0?1:tl(e),Qd(n,e<0?0:e,r)):[]}function oi(n,e,t){var r=n==null?0:n.length;return r?(e=e===void 0?1:tl(e),e=r-e,Qd(n,0,e<0?0:e)):[]}function wm(n,e){for(var t=-1,r=n==null?0:n.length;++t<r;)if(!e(n[t],t,n))return!1;return!0}function Pm(n,e){var t=!0;return rl(n,function(r,i,s){return t=!!e(r,i,s),t}),t}function dt(n,e,t){var r=Se(n)?wm:Pm;return r(n,ir(e))}function pt(n){return n&&n.length?n[0]:void 0}function Je(n,e){return jd(N(n,e))}var bm=Object.prototype,Mm=bm.hasOwnProperty,Dm=_m(function(n,e,t){Mm.call(n,t)?n[t].push(e):dm(n,t,[e])}),Fm="[object String]";function Ke(n){return typeof n=="string"||!Se(n)&&Yd(n)&&qd(n)==Fm}var Um=Math.max;function Fe(n,e,t,r){n=zd(n)?n:pe(n),t=t?tl(t):0;var i=n.length;return t<0&&(t=Um(i+t,0)),Ke(n)?t<=i&&n.indexOf(e,t)>-1:!!i&&Xd(n,e,t)>-1}function Ql(n,e,t){var r=n==null?0:n.length;if(!r)return-1;var i=0;return Xd(n,e,i)}var Gm="[object RegExp]";function Bm(n){return Yd(n)&&qd(n)==Gm}var Zl=Xl&&Xl.isRegExp,Dt=Zl?Em(Zl):Bm,Km="Expected a function";function Wm(n){if(typeof n!="function")throw new TypeError(Km);return function(){var e=arguments;switch(e.length){case 0:return!n.call(this);case 1:return!n.call(this,e[0]);case 2:return!n.call(this,e[0],e[1]);case 3:return!n.call(this,e[0],e[1],e[2])}return!n.apply(this,e)}}function gt(n,e){if(n==null)return{};var t=Am(fm(n),function(r){return[r]});return e=ir(e),hm(n,t,function(r,i){return e(r,i[0])})}function Zs(n,e){var t=Se(n)?vm:Im;return t(n,Wm(ir(e)))}function Vm(n,e){var t;return rl(n,function(r,i,s){return t=e(r,i,s),!t}),!!t}function Zd(n,e,t){var r=Se(n)?km:Vm;return r(n,ir(e))}function il(n){return n&&n.length?Jd(n):[]}function Hm(n,e){return n&&n.length?Jd(n,ir(e)):[]}function _e(n){return typeof n=="object"&&n!==null&&typeof n.$type=="string"}function kt(n){return typeof n=="object"&&n!==null&&typeof n.$refText=="string"}function zm(n){return typeof n=="object"&&n!==null&&typeof n.name=="string"&&typeof n.type=="string"&&typeof n.path=="string"}function Zi(n){return typeof n=="object"&&n!==null&&_e(n.container)&&kt(n.reference)&&typeof n.message=="string"}class ef{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return _e(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[t];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,t);return r[t]=s,s}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function li(n){return typeof n=="object"&&n!==null&&Array.isArray(n.content)}function tf(n){return typeof n=="object"&&n!==null&&typeof n.tokenType=="object"}function nf(n){return li(n)&&typeof n.fullText=="string"}class Ie{constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let t=0,r=e.next();for(;!r.done;)t++,r=e.next();return t}toArray(){const e=[],t=this.iterator();let r;do r=t.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,t){const r=this.map(i=>[e?e(i):i,t?t(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Ie(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),t=>{let r;if(!t.firstDone){do if(r=this.nextFn(t.first),!r.done)return r;while(!r.done);t.firstDone=!0}do if(r=t.iterator.next(),!r.done)return r;while(!r.done);return qe})}join(e=","){const t=this.iterator();let r="",i,s=!1;do i=t.next(),i.done||(s&&(r+=e),r+=jm(i.value)),s=!0;while(!i.done);return r}indexOf(e,t=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=t&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(!e(r.value))return!1;r=t.next()}return!0}some(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(e(r.value))return!0;r=t.next()}return!1}forEach(e){const t=this.iterator();let r=0,i=t.next();for(;!i.done;)e(i.value,r),i=t.next(),r++}map(e){return new Ie(this.startFn,t=>{const{done:r,value:i}=this.nextFn(t);return r?qe:{done:!1,value:e(i)}})}filter(e){return new Ie(this.startFn,t=>{let r;do if(r=this.nextFn(t),!r.done&&e(r.value))return r;while(!r.done);return qe})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,t){const r=this.iterator();let i=t,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,t,r);return s===void 0?i.value:t(s,i.value)}find(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(e(r.value))return r.value;r=t.next()}}findIndex(e){const t=this.iterator();let r=0,i=t.next();for(;!i.done;){if(e(i.value))return r;i=t.next(),r++}return-1}includes(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(r.value===e)return!0;r=t.next()}return!1}flatMap(e){return new Ie(()=>({this:this.startFn()}),t=>{do{if(t.iterator){const s=t.iterator.next();if(s.done)t.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(t.this);if(!r){const s=e(i);if(Es(s))t.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(t.iterator);return qe})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const t=e>1?this.flat(e-1):this;return new Ie(()=>({this:t.startFn()}),r=>{do{if(r.iterator){const a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}const{done:i,value:s}=t.nextFn(r.this);if(!i)if(Es(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return qe})}head(){const t=this.iterator().next();if(!t.done)return t.value}tail(e=1){return new Ie(()=>{const t=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(t).done)return t;return t},this.nextFn)}limit(e){return new Ie(()=>({size:0,state:this.startFn()}),t=>(t.size++,t.size>e?qe:this.nextFn(t.state)))}distinct(e){return new Ie(()=>({set:new Set,internalState:this.startFn()}),t=>{let r;do if(r=this.nextFn(t.internalState),!r.done){const i=e?e(r.value):r.value;if(!t.set.has(i))return t.set.add(i),r}while(!r.done);return qe})}exclude(e,t){const r=new Set;for(const i of e){const s=t?t(i):i;r.add(s)}return this.filter(i=>{const s=t?t(i):i;return!r.has(s)})}}function jm(n){return typeof n=="string"?n:typeof n>"u"?"undefined":typeof n.toString=="function"?n.toString():Object.prototype.toString.call(n)}function Es(n){return!!n&&typeof n[Symbol.iterator]=="function"}const Ym=new Ie(()=>{},()=>qe),qe=Object.freeze({done:!0,value:void 0});function ke(...n){if(n.length===1){const e=n[0];if(e instanceof Ie)return e;if(Es(e))return new Ie(()=>e[Symbol.iterator](),t=>t.next());if(typeof e.length=="number")return new Ie(()=>({index:0}),t=>t.index<e.length?{done:!1,value:e[t.index++]}:qe)}return n.length>1?new Ie(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<n.length){const t=n[e.collIndex++];Es(t)?e.iterator=t[Symbol.iterator]():t&&typeof t.length=="number"&&(e.array=t)}}while(e.iterator||e.array||e.collIndex<n.length);return qe}):Ym}class sl extends Ie{constructor(e,t,r){super(()=>({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(t(a.value)[Symbol.iterator]()),a}return qe})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var lo;(function(n){function e(s){return s.reduce((a,o)=>a+o,0)}n.sum=e;function t(s){return s.reduce((a,o)=>a*o,0)}n.product=t;function r(s){return s.reduce((a,o)=>Math.min(a,o))}n.min=r;function i(s){return s.reduce((a,o)=>Math.max(a,o))}n.max=i})(lo||(lo={}));function co(n){return new sl(n,e=>li(e)?e.content:[],{includeRoot:!0})}function qm(n,e){for(;n.container;)if(n=n.container,n===e)return!0;return!1}function uo(n){return{start:{character:n.startColumn-1,line:n.startLine-1},end:{character:n.endColumn,line:n.endLine-1}}}function As(n){if(!n)return;const{offset:e,end:t,range:r}=n;return{range:r,offset:e,end:t,length:t-e}}var wt;(function(n){n[n.Before=0]="Before",n[n.After=1]="After",n[n.OverlapFront=2]="OverlapFront",n[n.OverlapBack=3]="OverlapBack",n[n.Inside=4]="Inside",n[n.Outside=5]="Outside"})(wt||(wt={}));function Xm(n,e){if(n.end.line<e.start.line||n.end.line===e.start.line&&n.end.character<=e.start.character)return wt.Before;if(n.start.line>e.end.line||n.start.line===e.end.line&&n.start.character>=e.end.character)return wt.After;const t=n.start.line>e.start.line||n.start.line===e.start.line&&n.start.character>=e.start.character,r=n.end.line<e.end.line||n.end.line===e.end.line&&n.end.character<=e.end.character;return t&&r?wt.Inside:t?wt.OverlapBack:r?wt.OverlapFront:wt.Outside}function Jm(n,e){return Xm(n,e)>wt.After}const Qm=/^[\w\p{L}]$/u;function Zm(n,e){if(n){const t=eg(n,!0);if(t&&ec(t,e))return t;if(nf(n)){const r=n.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=n.content[i];if(ec(s,e))return s}}}}function ec(n,e){return tf(n)&&e.includes(n.tokenType.name)}function eg(n,e=!0){for(;n.container;){const t=n.container;let r=t.content.indexOf(n);for(;r>0;){r--;const i=t.content[r];if(e||!i.hidden)return i}n=t}}class rf extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function pi(n){throw new Error("Error! The input value was not handled.")}const Si="AbstractRule",Ni="AbstractType",Ca="Condition",tc="TypeDefinition",$a="ValueLiteral",Rr="AbstractElement";function tg(n){return K.isInstance(n,Rr)}const xi="ArrayLiteral",Ci="ArrayType",Er="BooleanLiteral";function ng(n){return K.isInstance(n,Er)}const Ar="Conjunction";function rg(n){return K.isInstance(n,Ar)}const vr="Disjunction";function ig(n){return K.isInstance(n,vr)}const $i="Grammar",_a="GrammarImport",Ir="InferredType";function sf(n){return K.isInstance(n,Ir)}const kr="Interface";function af(n){return K.isInstance(n,kr)}const La="NamedArgument",Sr="Negation";function sg(n){return K.isInstance(n,Sr)}const _i="NumberLiteral",Li="Parameter",Nr="ParameterReference";function ag(n){return K.isInstance(n,Nr)}const xr="ParserRule";function lt(n){return K.isInstance(n,xr)}const Oi="ReferenceType",es="ReturnType";function og(n){return K.isInstance(n,es)}const Cr="SimpleType";function lg(n){return K.isInstance(n,Cr)}const wi="StringLiteral",Nn="TerminalRule";function Rn(n){return K.isInstance(n,Nn)}const $r="Type";function of(n){return K.isInstance(n,$r)}const Oa="TypeAttribute",Pi="UnionType",_r="Action";function ea(n){return K.isInstance(n,_r)}const Lr="Alternatives";function lf(n){return K.isInstance(n,Lr)}const Or="Assignment";function cn(n){return K.isInstance(n,Or)}const wr="CharacterRange";function cg(n){return K.isInstance(n,wr)}const Pr="CrossReference";function al(n){return K.isInstance(n,Pr)}const br="EndOfFile";function ug(n){return K.isInstance(n,br)}const Mr="Group";function ol(n){return K.isInstance(n,Mr)}const Dr="Keyword";function un(n){return K.isInstance(n,Dr)}const Fr="NegatedToken";function dg(n){return K.isInstance(n,Fr)}const Ur="RegexToken";function fg(n){return K.isInstance(n,Ur)}const Gr="RuleCall";function dn(n){return K.isInstance(n,Gr)}const Br="TerminalAlternatives";function hg(n){return K.isInstance(n,Br)}const Kr="TerminalGroup";function pg(n){return K.isInstance(n,Kr)}const Wr="TerminalRuleCall";function mg(n){return K.isInstance(n,Wr)}const Vr="UnorderedGroup";function cf(n){return K.isInstance(n,Vr)}const Hr="UntilToken";function gg(n){return K.isInstance(n,Hr)}const zr="Wildcard";function yg(n){return K.isInstance(n,zr)}class uf extends ef{getAllTypes(){return[Rr,Si,Ni,_r,Lr,xi,Ci,Or,Er,wr,Ca,Ar,Pr,vr,br,$i,_a,Mr,Ir,kr,Dr,La,Fr,Sr,_i,Li,Nr,xr,Oi,Ur,es,Gr,Cr,wi,Br,Kr,Nn,Wr,$r,Oa,tc,Pi,Vr,Hr,$a,zr]}computeIsSubtype(e,t){switch(e){case _r:case Lr:case Or:case wr:case Pr:case br:case Mr:case Dr:case Fr:case Ur:case Gr:case Br:case Kr:case Wr:case Vr:case Hr:case zr:return this.isSubtype(Rr,t);case xi:case _i:case wi:return this.isSubtype($a,t);case Ci:case Oi:case Cr:case Pi:return this.isSubtype(tc,t);case Er:return this.isSubtype(Ca,t)||this.isSubtype($a,t);case Ar:case vr:case Sr:case Nr:return this.isSubtype(Ca,t);case Ir:case kr:case $r:return this.isSubtype(Ni,t);case xr:return this.isSubtype(Si,t)||this.isSubtype(Ni,t);case Nn:return this.isSubtype(Si,t);default:return!1}}getReferenceType(e){const t=`${e.container.$type}:${e.property}`;switch(t){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return Ni;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Si;case"Grammar:usedGrammars":return $i;case"NamedArgument:parameter":case"ParameterReference:parameter":return Li;case"TerminalRuleCall:rule":return Nn;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Rr:return{name:Rr,properties:[{name:"cardinality"},{name:"lookahead"}]};case xi:return{name:xi,properties:[{name:"elements",defaultValue:[]}]};case Ci:return{name:Ci,properties:[{name:"elementType"}]};case Er:return{name:Er,properties:[{name:"true",defaultValue:!1}]};case Ar:return{name:Ar,properties:[{name:"left"},{name:"right"}]};case vr:return{name:vr,properties:[{name:"left"},{name:"right"}]};case $i:return{name:$i,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case _a:return{name:_a,properties:[{name:"path"}]};case Ir:return{name:Ir,properties:[{name:"name"}]};case kr:return{name:kr,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case La:return{name:La,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case Sr:return{name:Sr,properties:[{name:"value"}]};case _i:return{name:_i,properties:[{name:"value"}]};case Li:return{name:Li,properties:[{name:"name"}]};case Nr:return{name:Nr,properties:[{name:"parameter"}]};case xr:return{name:xr,properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case Oi:return{name:Oi,properties:[{name:"referenceType"}]};case es:return{name:es,properties:[{name:"name"}]};case Cr:return{name:Cr,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case wi:return{name:wi,properties:[{name:"value"}]};case Nn:return{name:Nn,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case $r:return{name:$r,properties:[{name:"name"},{name:"type"}]};case Oa:return{name:Oa,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case Pi:return{name:Pi,properties:[{name:"types",defaultValue:[]}]};case _r:return{name:_r,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case Lr:return{name:Lr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Or:return{name:Or,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case wr:return{name:wr,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Pr:return{name:Pr,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case br:return{name:br,properties:[{name:"cardinality"},{name:"lookahead"}]};case Mr:return{name:Mr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case Dr:return{name:Dr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case Fr:return{name:Fr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Ur:return{name:Ur,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case Gr:return{name:Gr,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Br:return{name:Br,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Kr:return{name:Kr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Wr:return{name:Wr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Vr:return{name:Vr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Hr:return{name:Hr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case zr:return{name:zr,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const K=new uf;function Tg(n){for(const[e,t]of Object.entries(n))e.startsWith("$")||(Array.isArray(t)?t.forEach((r,i)=>{_e(r)&&(r.$container=n,r.$containerProperty=e,r.$containerIndex=i)}):_e(t)&&(t.$container=n,t.$containerProperty=e))}function ta(n,e){let t=n;for(;t;){if(e(t))return t;t=t.$container}}function Bt(n){const t=fo(n).$document;if(!t)throw new Error("AST node has no document.");return t}function fo(n){for(;n.$container;)n=n.$container;return n}function ll(n,e){if(!n)throw new Error("Node must be an AstNode.");const t=e?.range;return new Ie(()=>({keys:Object.keys(n),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=n[i];if(_e(s)){if(r.keyIndex++,nc(s,t))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const a=r.arrayIndex++,o=s[a];if(_e(o)&&nc(o,t))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return qe})}function mi(n,e){if(!n)throw new Error("Root node must be an AstNode.");return new sl(n,t=>ll(t,e))}function Cn(n,e){if(!n)throw new Error("Root node must be an AstNode.");return new sl(n,t=>ll(t,e),{includeRoot:!0})}function nc(n,e){var t;if(!e)return!0;const r=(t=n.$cstNode)===null||t===void 0?void 0:t.range;return r?Jm(r,e):!1}function df(n){return new Ie(()=>({keys:Object.keys(n),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const t=e.keys[e.keyIndex];if(!t.startsWith("$")){const r=n[t];if(kt(r))return e.keyIndex++,{done:!1,value:{reference:r,container:n,property:t}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(kt(s))return{done:!1,value:{reference:s,container:n,property:t,index:i}}}e.arrayIndex=0}}e.keyIndex++}return qe})}function Rg(n,e){const t=n.getTypeMetaData(e.$type),r=e;for(const i of t.properties)i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=ff(i.defaultValue))}function ff(n){return Array.isArray(n)?[...n.map(ff)]:n}function b(n){return n.charCodeAt(0)}function wa(n,e){Array.isArray(n)?n.forEach(function(t){e.push(t)}):e.push(n)}function pr(n,e){if(n[e]===!0)throw"duplicate flag "+e;n[e],n[e]=!0}function kn(n){if(n===void 0)throw Error("Internal Error - Should never get here!");return!0}function Eg(){throw Error("Internal Error - Should never get here!")}function rc(n){return n.type==="Character"}const vs=[];for(let n=b("0");n<=b("9");n++)vs.push(n);const Is=[b("_")].concat(vs);for(let n=b("a");n<=b("z");n++)Is.push(n);for(let n=b("A");n<=b("Z");n++)Is.push(n);const ic=[b(" "),b("\f"),b(`
|
|
1
|
+
import{aU as ai,bd as el,aQ as W,aR as jn,aY as Yn,be as zp,bf as jp,aM as fi,aP as Yp,b2 as Fd,bg as qp,bh as Ud,bi as Xp,bj as Gd,bk as Jp,bl as Bd,bm as Wl,aV as Vl,a_ as Hl,b1 as Qi,bn as Qp,bo as Zp,bp as Kd,bq as Rs,br as em,bs as Wd,bt as tm,bu as zl,bv as nm,aW as rm,aX as jl,bw as xa,bx as yn,by as j,bz as nn}from"./index-C378qiys.js";import{k as St,a as Vd,s as im,g as sm,b as am,d as Yl,e as om,f as Hd,c as xe}from"./clone-CvGfsInX.js";import{l as lm,c as cm,r as um,y as tl,m as N,a as dm,z as fm,p as hm,f as st,v as qn,u as L,x as nl,w as ln,s as pm}from"./_basePickBy-5vIZeqrx.js";import{s as mm,p as zd,k as Xn,M as rl,K as ir,I as Se,a3 as gm,a4 as ym,a5 as Tm,b as Rm,d as ql,c as jd,B as Yd,X as qd,v as pe,a6 as Xd,D as Em,E as Xl,N as Am,a7 as vm,a8 as Im,a9 as km,a as Jd,h as _,i as Mt,f as Tn,r as Pe,j as z,g as nt,P as Jl,aa as ye,m as Sm}from"./_baseUniq-BKVPFJfn.js";import{c as Le}from"./clone-Ck-f8mTd.js";var Nm=Object.prototype,xm=Nm.hasOwnProperty,Qe=lm(function(n,e){if(mm(e)||zd(e)){cm(e,Xn(e),n);return}for(var t in e)xm.call(e,t)&&um(n,t,e[t])});function Qd(n,e,t){var r=-1,i=n.length;e<0&&(e=-e>i?0:i+e),t=t>i?i:t,t<0&&(t+=i),i=e>t?0:t-e>>>0,e>>>=0;for(var s=Array(i);++r<i;)s[r]=n[r+e];return s}function hi(n){for(var e=-1,t=n==null?0:n.length,r=0,i=[];++e<t;){var s=n[e];s&&(i[r++]=s)}return i}function Cm(n,e,t,r){for(var i=-1,s=n==null?0:n.length;++i<s;){var a=n[i];e(r,a,t(a),n)}return r}function $m(n,e,t,r){return rl(n,function(i,s,a){e(r,i,t(i),a)}),r}function _m(n,e){return function(t,r){var i=Se(t)?Cm:$m,s=e?e():{};return i(t,n,ir(r),s)}}var Lm=200;function Om(n,e,t,r){var i=-1,s=ym,a=!0,o=n.length,l=[],c=e.length;if(!o)return l;e.length>=Lm&&(s=Tm,a=!1,e=new gm(e));e:for(;++i<o;){var u=n[i],d=u;if(u=u!==0?u:0,a&&d===d){for(var f=c;f--;)if(e[f]===d)continue e;l.push(u)}else s(e,d,r)||l.push(u)}return l}var Qs=Rm(function(n,e){return ql(n)?Om(n,jd(e,1,ql,!0)):[]});function Ae(n,e,t){var r=n==null?0:n.length;return r?(e=e===void 0?1:tl(e),Qd(n,e<0?0:e,r)):[]}function oi(n,e,t){var r=n==null?0:n.length;return r?(e=e===void 0?1:tl(e),e=r-e,Qd(n,0,e<0?0:e)):[]}function wm(n,e){for(var t=-1,r=n==null?0:n.length;++t<r;)if(!e(n[t],t,n))return!1;return!0}function Pm(n,e){var t=!0;return rl(n,function(r,i,s){return t=!!e(r,i,s),t}),t}function dt(n,e,t){var r=Se(n)?wm:Pm;return r(n,ir(e))}function pt(n){return n&&n.length?n[0]:void 0}function Je(n,e){return jd(N(n,e))}var bm=Object.prototype,Mm=bm.hasOwnProperty,Dm=_m(function(n,e,t){Mm.call(n,t)?n[t].push(e):dm(n,t,[e])}),Fm="[object String]";function Ke(n){return typeof n=="string"||!Se(n)&&Yd(n)&&qd(n)==Fm}var Um=Math.max;function Fe(n,e,t,r){n=zd(n)?n:pe(n),t=t?tl(t):0;var i=n.length;return t<0&&(t=Um(i+t,0)),Ke(n)?t<=i&&n.indexOf(e,t)>-1:!!i&&Xd(n,e,t)>-1}function Ql(n,e,t){var r=n==null?0:n.length;if(!r)return-1;var i=0;return Xd(n,e,i)}var Gm="[object RegExp]";function Bm(n){return Yd(n)&&qd(n)==Gm}var Zl=Xl&&Xl.isRegExp,Dt=Zl?Em(Zl):Bm,Km="Expected a function";function Wm(n){if(typeof n!="function")throw new TypeError(Km);return function(){var e=arguments;switch(e.length){case 0:return!n.call(this);case 1:return!n.call(this,e[0]);case 2:return!n.call(this,e[0],e[1]);case 3:return!n.call(this,e[0],e[1],e[2])}return!n.apply(this,e)}}function gt(n,e){if(n==null)return{};var t=Am(fm(n),function(r){return[r]});return e=ir(e),hm(n,t,function(r,i){return e(r,i[0])})}function Zs(n,e){var t=Se(n)?vm:Im;return t(n,Wm(ir(e)))}function Vm(n,e){var t;return rl(n,function(r,i,s){return t=e(r,i,s),!t}),!!t}function Zd(n,e,t){var r=Se(n)?km:Vm;return r(n,ir(e))}function il(n){return n&&n.length?Jd(n):[]}function Hm(n,e){return n&&n.length?Jd(n,ir(e)):[]}function _e(n){return typeof n=="object"&&n!==null&&typeof n.$type=="string"}function kt(n){return typeof n=="object"&&n!==null&&typeof n.$refText=="string"}function zm(n){return typeof n=="object"&&n!==null&&typeof n.name=="string"&&typeof n.type=="string"&&typeof n.path=="string"}function Zi(n){return typeof n=="object"&&n!==null&&_e(n.container)&&kt(n.reference)&&typeof n.message=="string"}class ef{constructor(){this.subtypes={},this.allSubtypes={}}isInstance(e,t){return _e(e)&&this.isSubtype(e.$type,t)}isSubtype(e,t){if(e===t)return!0;let r=this.subtypes[e];r||(r=this.subtypes[e]={});const i=r[t];if(i!==void 0)return i;{const s=this.computeIsSubtype(e,t);return r[t]=s,s}}getAllSubTypes(e){const t=this.allSubtypes[e];if(t)return t;{const r=this.getAllTypes(),i=[];for(const s of r)this.isSubtype(s,e)&&i.push(s);return this.allSubtypes[e]=i,i}}}function li(n){return typeof n=="object"&&n!==null&&Array.isArray(n.content)}function tf(n){return typeof n=="object"&&n!==null&&typeof n.tokenType=="object"}function nf(n){return li(n)&&typeof n.fullText=="string"}class Ie{constructor(e,t){this.startFn=e,this.nextFn=t}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),[Symbol.iterator]:()=>e};return e}[Symbol.iterator](){return this.iterator()}isEmpty(){return!!this.iterator().next().done}count(){const e=this.iterator();let t=0,r=e.next();for(;!r.done;)t++,r=e.next();return t}toArray(){const e=[],t=this.iterator();let r;do r=t.next(),r.value!==void 0&&e.push(r.value);while(!r.done);return e}toSet(){return new Set(this)}toMap(e,t){const r=this.map(i=>[e?e(i):i,t?t(i):i]);return new Map(r)}toString(){return this.join()}concat(e){return new Ie(()=>({first:this.startFn(),firstDone:!1,iterator:e[Symbol.iterator]()}),t=>{let r;if(!t.firstDone){do if(r=this.nextFn(t.first),!r.done)return r;while(!r.done);t.firstDone=!0}do if(r=t.iterator.next(),!r.done)return r;while(!r.done);return qe})}join(e=","){const t=this.iterator();let r="",i,s=!1;do i=t.next(),i.done||(s&&(r+=e),r+=jm(i.value)),s=!0;while(!i.done);return r}indexOf(e,t=0){const r=this.iterator();let i=0,s=r.next();for(;!s.done;){if(i>=t&&s.value===e)return i;s=r.next(),i++}return-1}every(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(!e(r.value))return!1;r=t.next()}return!0}some(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(e(r.value))return!0;r=t.next()}return!1}forEach(e){const t=this.iterator();let r=0,i=t.next();for(;!i.done;)e(i.value,r),i=t.next(),r++}map(e){return new Ie(this.startFn,t=>{const{done:r,value:i}=this.nextFn(t);return r?qe:{done:!1,value:e(i)}})}filter(e){return new Ie(this.startFn,t=>{let r;do if(r=this.nextFn(t),!r.done&&e(r.value))return r;while(!r.done);return qe})}nonNullable(){return this.filter(e=>e!=null)}reduce(e,t){const r=this.iterator();let i=t,s=r.next();for(;!s.done;)i===void 0?i=s.value:i=e(i,s.value),s=r.next();return i}reduceRight(e,t){return this.recursiveReduce(this.iterator(),e,t)}recursiveReduce(e,t,r){const i=e.next();if(i.done)return r;const s=this.recursiveReduce(e,t,r);return s===void 0?i.value:t(s,i.value)}find(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(e(r.value))return r.value;r=t.next()}}findIndex(e){const t=this.iterator();let r=0,i=t.next();for(;!i.done;){if(e(i.value))return r;i=t.next(),r++}return-1}includes(e){const t=this.iterator();let r=t.next();for(;!r.done;){if(r.value===e)return!0;r=t.next()}return!1}flatMap(e){return new Ie(()=>({this:this.startFn()}),t=>{do{if(t.iterator){const s=t.iterator.next();if(s.done)t.iterator=void 0;else return s}const{done:r,value:i}=this.nextFn(t.this);if(!r){const s=e(i);if(Es(s))t.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}}while(t.iterator);return qe})}flat(e){if(e===void 0&&(e=1),e<=0)return this;const t=e>1?this.flat(e-1):this;return new Ie(()=>({this:t.startFn()}),r=>{do{if(r.iterator){const a=r.iterator.next();if(a.done)r.iterator=void 0;else return a}const{done:i,value:s}=t.nextFn(r.this);if(!i)if(Es(s))r.iterator=s[Symbol.iterator]();else return{done:!1,value:s}}while(r.iterator);return qe})}head(){const t=this.iterator().next();if(!t.done)return t.value}tail(e=1){return new Ie(()=>{const t=this.startFn();for(let r=0;r<e;r++)if(this.nextFn(t).done)return t;return t},this.nextFn)}limit(e){return new Ie(()=>({size:0,state:this.startFn()}),t=>(t.size++,t.size>e?qe:this.nextFn(t.state)))}distinct(e){return new Ie(()=>({set:new Set,internalState:this.startFn()}),t=>{let r;do if(r=this.nextFn(t.internalState),!r.done){const i=e?e(r.value):r.value;if(!t.set.has(i))return t.set.add(i),r}while(!r.done);return qe})}exclude(e,t){const r=new Set;for(const i of e){const s=t?t(i):i;r.add(s)}return this.filter(i=>{const s=t?t(i):i;return!r.has(s)})}}function jm(n){return typeof n=="string"?n:typeof n>"u"?"undefined":typeof n.toString=="function"?n.toString():Object.prototype.toString.call(n)}function Es(n){return!!n&&typeof n[Symbol.iterator]=="function"}const Ym=new Ie(()=>{},()=>qe),qe=Object.freeze({done:!0,value:void 0});function ke(...n){if(n.length===1){const e=n[0];if(e instanceof Ie)return e;if(Es(e))return new Ie(()=>e[Symbol.iterator](),t=>t.next());if(typeof e.length=="number")return new Ie(()=>({index:0}),t=>t.index<e.length?{done:!1,value:e[t.index++]}:qe)}return n.length>1?new Ie(()=>({collIndex:0,arrIndex:0}),e=>{do{if(e.iterator){const t=e.iterator.next();if(!t.done)return t;e.iterator=void 0}if(e.array){if(e.arrIndex<e.array.length)return{done:!1,value:e.array[e.arrIndex++]};e.array=void 0,e.arrIndex=0}if(e.collIndex<n.length){const t=n[e.collIndex++];Es(t)?e.iterator=t[Symbol.iterator]():t&&typeof t.length=="number"&&(e.array=t)}}while(e.iterator||e.array||e.collIndex<n.length);return qe}):Ym}class sl extends Ie{constructor(e,t,r){super(()=>({iterators:r?.includeRoot?[[e][Symbol.iterator]()]:[t(e)[Symbol.iterator]()],pruned:!1}),i=>{for(i.pruned&&(i.iterators.pop(),i.pruned=!1);i.iterators.length>0;){const a=i.iterators[i.iterators.length-1].next();if(a.done)i.iterators.pop();else return i.iterators.push(t(a.value)[Symbol.iterator]()),a}return qe})}iterator(){const e={state:this.startFn(),next:()=>this.nextFn(e.state),prune:()=>{e.state.pruned=!0},[Symbol.iterator]:()=>e};return e}}var lo;(function(n){function e(s){return s.reduce((a,o)=>a+o,0)}n.sum=e;function t(s){return s.reduce((a,o)=>a*o,0)}n.product=t;function r(s){return s.reduce((a,o)=>Math.min(a,o))}n.min=r;function i(s){return s.reduce((a,o)=>Math.max(a,o))}n.max=i})(lo||(lo={}));function co(n){return new sl(n,e=>li(e)?e.content:[],{includeRoot:!0})}function qm(n,e){for(;n.container;)if(n=n.container,n===e)return!0;return!1}function uo(n){return{start:{character:n.startColumn-1,line:n.startLine-1},end:{character:n.endColumn,line:n.endLine-1}}}function As(n){if(!n)return;const{offset:e,end:t,range:r}=n;return{range:r,offset:e,end:t,length:t-e}}var wt;(function(n){n[n.Before=0]="Before",n[n.After=1]="After",n[n.OverlapFront=2]="OverlapFront",n[n.OverlapBack=3]="OverlapBack",n[n.Inside=4]="Inside",n[n.Outside=5]="Outside"})(wt||(wt={}));function Xm(n,e){if(n.end.line<e.start.line||n.end.line===e.start.line&&n.end.character<=e.start.character)return wt.Before;if(n.start.line>e.end.line||n.start.line===e.end.line&&n.start.character>=e.end.character)return wt.After;const t=n.start.line>e.start.line||n.start.line===e.start.line&&n.start.character>=e.start.character,r=n.end.line<e.end.line||n.end.line===e.end.line&&n.end.character<=e.end.character;return t&&r?wt.Inside:t?wt.OverlapBack:r?wt.OverlapFront:wt.Outside}function Jm(n,e){return Xm(n,e)>wt.After}const Qm=/^[\w\p{L}]$/u;function Zm(n,e){if(n){const t=eg(n,!0);if(t&&ec(t,e))return t;if(nf(n)){const r=n.content.findIndex(i=>!i.hidden);for(let i=r-1;i>=0;i--){const s=n.content[i];if(ec(s,e))return s}}}}function ec(n,e){return tf(n)&&e.includes(n.tokenType.name)}function eg(n,e=!0){for(;n.container;){const t=n.container;let r=t.content.indexOf(n);for(;r>0;){r--;const i=t.content[r];if(e||!i.hidden)return i}n=t}}class rf extends Error{constructor(e,t){super(e?`${t} at ${e.range.start.line}:${e.range.start.character}`:t)}}function pi(n){throw new Error("Error! The input value was not handled.")}const Si="AbstractRule",Ni="AbstractType",Ca="Condition",tc="TypeDefinition",$a="ValueLiteral",Rr="AbstractElement";function tg(n){return K.isInstance(n,Rr)}const xi="ArrayLiteral",Ci="ArrayType",Er="BooleanLiteral";function ng(n){return K.isInstance(n,Er)}const Ar="Conjunction";function rg(n){return K.isInstance(n,Ar)}const vr="Disjunction";function ig(n){return K.isInstance(n,vr)}const $i="Grammar",_a="GrammarImport",Ir="InferredType";function sf(n){return K.isInstance(n,Ir)}const kr="Interface";function af(n){return K.isInstance(n,kr)}const La="NamedArgument",Sr="Negation";function sg(n){return K.isInstance(n,Sr)}const _i="NumberLiteral",Li="Parameter",Nr="ParameterReference";function ag(n){return K.isInstance(n,Nr)}const xr="ParserRule";function lt(n){return K.isInstance(n,xr)}const Oi="ReferenceType",es="ReturnType";function og(n){return K.isInstance(n,es)}const Cr="SimpleType";function lg(n){return K.isInstance(n,Cr)}const wi="StringLiteral",Nn="TerminalRule";function Rn(n){return K.isInstance(n,Nn)}const $r="Type";function of(n){return K.isInstance(n,$r)}const Oa="TypeAttribute",Pi="UnionType",_r="Action";function ea(n){return K.isInstance(n,_r)}const Lr="Alternatives";function lf(n){return K.isInstance(n,Lr)}const Or="Assignment";function cn(n){return K.isInstance(n,Or)}const wr="CharacterRange";function cg(n){return K.isInstance(n,wr)}const Pr="CrossReference";function al(n){return K.isInstance(n,Pr)}const br="EndOfFile";function ug(n){return K.isInstance(n,br)}const Mr="Group";function ol(n){return K.isInstance(n,Mr)}const Dr="Keyword";function un(n){return K.isInstance(n,Dr)}const Fr="NegatedToken";function dg(n){return K.isInstance(n,Fr)}const Ur="RegexToken";function fg(n){return K.isInstance(n,Ur)}const Gr="RuleCall";function dn(n){return K.isInstance(n,Gr)}const Br="TerminalAlternatives";function hg(n){return K.isInstance(n,Br)}const Kr="TerminalGroup";function pg(n){return K.isInstance(n,Kr)}const Wr="TerminalRuleCall";function mg(n){return K.isInstance(n,Wr)}const Vr="UnorderedGroup";function cf(n){return K.isInstance(n,Vr)}const Hr="UntilToken";function gg(n){return K.isInstance(n,Hr)}const zr="Wildcard";function yg(n){return K.isInstance(n,zr)}class uf extends ef{getAllTypes(){return[Rr,Si,Ni,_r,Lr,xi,Ci,Or,Er,wr,Ca,Ar,Pr,vr,br,$i,_a,Mr,Ir,kr,Dr,La,Fr,Sr,_i,Li,Nr,xr,Oi,Ur,es,Gr,Cr,wi,Br,Kr,Nn,Wr,$r,Oa,tc,Pi,Vr,Hr,$a,zr]}computeIsSubtype(e,t){switch(e){case _r:case Lr:case Or:case wr:case Pr:case br:case Mr:case Dr:case Fr:case Ur:case Gr:case Br:case Kr:case Wr:case Vr:case Hr:case zr:return this.isSubtype(Rr,t);case xi:case _i:case wi:return this.isSubtype($a,t);case Ci:case Oi:case Cr:case Pi:return this.isSubtype(tc,t);case Er:return this.isSubtype(Ca,t)||this.isSubtype($a,t);case Ar:case vr:case Sr:case Nr:return this.isSubtype(Ca,t);case Ir:case kr:case $r:return this.isSubtype(Ni,t);case xr:return this.isSubtype(Si,t)||this.isSubtype(Ni,t);case Nn:return this.isSubtype(Si,t);default:return!1}}getReferenceType(e){const t=`${e.container.$type}:${e.property}`;switch(t){case"Action:type":case"CrossReference:type":case"Interface:superTypes":case"ParserRule:returnType":case"SimpleType:typeRef":return Ni;case"Grammar:hiddenTokens":case"ParserRule:hiddenTokens":case"RuleCall:rule":return Si;case"Grammar:usedGrammars":return $i;case"NamedArgument:parameter":case"ParameterReference:parameter":return Li;case"TerminalRuleCall:rule":return Nn;default:throw new Error(`${t} is not a valid reference id.`)}}getTypeMetaData(e){switch(e){case Rr:return{name:Rr,properties:[{name:"cardinality"},{name:"lookahead"}]};case xi:return{name:xi,properties:[{name:"elements",defaultValue:[]}]};case Ci:return{name:Ci,properties:[{name:"elementType"}]};case Er:return{name:Er,properties:[{name:"true",defaultValue:!1}]};case Ar:return{name:Ar,properties:[{name:"left"},{name:"right"}]};case vr:return{name:vr,properties:[{name:"left"},{name:"right"}]};case $i:return{name:$i,properties:[{name:"definesHiddenTokens",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"imports",defaultValue:[]},{name:"interfaces",defaultValue:[]},{name:"isDeclared",defaultValue:!1},{name:"name"},{name:"rules",defaultValue:[]},{name:"types",defaultValue:[]},{name:"usedGrammars",defaultValue:[]}]};case _a:return{name:_a,properties:[{name:"path"}]};case Ir:return{name:Ir,properties:[{name:"name"}]};case kr:return{name:kr,properties:[{name:"attributes",defaultValue:[]},{name:"name"},{name:"superTypes",defaultValue:[]}]};case La:return{name:La,properties:[{name:"calledByName",defaultValue:!1},{name:"parameter"},{name:"value"}]};case Sr:return{name:Sr,properties:[{name:"value"}]};case _i:return{name:_i,properties:[{name:"value"}]};case Li:return{name:Li,properties:[{name:"name"}]};case Nr:return{name:Nr,properties:[{name:"parameter"}]};case xr:return{name:xr,properties:[{name:"dataType"},{name:"definesHiddenTokens",defaultValue:!1},{name:"definition"},{name:"entry",defaultValue:!1},{name:"fragment",defaultValue:!1},{name:"hiddenTokens",defaultValue:[]},{name:"inferredType"},{name:"name"},{name:"parameters",defaultValue:[]},{name:"returnType"},{name:"wildcard",defaultValue:!1}]};case Oi:return{name:Oi,properties:[{name:"referenceType"}]};case es:return{name:es,properties:[{name:"name"}]};case Cr:return{name:Cr,properties:[{name:"primitiveType"},{name:"stringType"},{name:"typeRef"}]};case wi:return{name:wi,properties:[{name:"value"}]};case Nn:return{name:Nn,properties:[{name:"definition"},{name:"fragment",defaultValue:!1},{name:"hidden",defaultValue:!1},{name:"name"},{name:"type"}]};case $r:return{name:$r,properties:[{name:"name"},{name:"type"}]};case Oa:return{name:Oa,properties:[{name:"defaultValue"},{name:"isOptional",defaultValue:!1},{name:"name"},{name:"type"}]};case Pi:return{name:Pi,properties:[{name:"types",defaultValue:[]}]};case _r:return{name:_r,properties:[{name:"cardinality"},{name:"feature"},{name:"inferredType"},{name:"lookahead"},{name:"operator"},{name:"type"}]};case Lr:return{name:Lr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Or:return{name:Or,properties:[{name:"cardinality"},{name:"feature"},{name:"lookahead"},{name:"operator"},{name:"terminal"}]};case wr:return{name:wr,properties:[{name:"cardinality"},{name:"left"},{name:"lookahead"},{name:"right"}]};case Pr:return{name:Pr,properties:[{name:"cardinality"},{name:"deprecatedSyntax",defaultValue:!1},{name:"lookahead"},{name:"terminal"},{name:"type"}]};case br:return{name:br,properties:[{name:"cardinality"},{name:"lookahead"}]};case Mr:return{name:Mr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"guardCondition"},{name:"lookahead"}]};case Dr:return{name:Dr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"value"}]};case Fr:return{name:Fr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case Ur:return{name:Ur,properties:[{name:"cardinality"},{name:"lookahead"},{name:"regex"}]};case Gr:return{name:Gr,properties:[{name:"arguments",defaultValue:[]},{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Br:return{name:Br,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Kr:return{name:Kr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Wr:return{name:Wr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"rule"}]};case Vr:return{name:Vr,properties:[{name:"cardinality"},{name:"elements",defaultValue:[]},{name:"lookahead"}]};case Hr:return{name:Hr,properties:[{name:"cardinality"},{name:"lookahead"},{name:"terminal"}]};case zr:return{name:zr,properties:[{name:"cardinality"},{name:"lookahead"}]};default:return{name:e,properties:[]}}}}const K=new uf;function Tg(n){for(const[e,t]of Object.entries(n))e.startsWith("$")||(Array.isArray(t)?t.forEach((r,i)=>{_e(r)&&(r.$container=n,r.$containerProperty=e,r.$containerIndex=i)}):_e(t)&&(t.$container=n,t.$containerProperty=e))}function ta(n,e){let t=n;for(;t;){if(e(t))return t;t=t.$container}}function Bt(n){const t=fo(n).$document;if(!t)throw new Error("AST node has no document.");return t}function fo(n){for(;n.$container;)n=n.$container;return n}function ll(n,e){if(!n)throw new Error("Node must be an AstNode.");const t=e?.range;return new Ie(()=>({keys:Object.keys(n),keyIndex:0,arrayIndex:0}),r=>{for(;r.keyIndex<r.keys.length;){const i=r.keys[r.keyIndex];if(!i.startsWith("$")){const s=n[i];if(_e(s)){if(r.keyIndex++,nc(s,t))return{done:!1,value:s}}else if(Array.isArray(s)){for(;r.arrayIndex<s.length;){const a=r.arrayIndex++,o=s[a];if(_e(o)&&nc(o,t))return{done:!1,value:o}}r.arrayIndex=0}}r.keyIndex++}return qe})}function mi(n,e){if(!n)throw new Error("Root node must be an AstNode.");return new sl(n,t=>ll(t,e))}function Cn(n,e){if(!n)throw new Error("Root node must be an AstNode.");return new sl(n,t=>ll(t,e),{includeRoot:!0})}function nc(n,e){var t;if(!e)return!0;const r=(t=n.$cstNode)===null||t===void 0?void 0:t.range;return r?Jm(r,e):!1}function df(n){return new Ie(()=>({keys:Object.keys(n),keyIndex:0,arrayIndex:0}),e=>{for(;e.keyIndex<e.keys.length;){const t=e.keys[e.keyIndex];if(!t.startsWith("$")){const r=n[t];if(kt(r))return e.keyIndex++,{done:!1,value:{reference:r,container:n,property:t}};if(Array.isArray(r)){for(;e.arrayIndex<r.length;){const i=e.arrayIndex++,s=r[i];if(kt(s))return{done:!1,value:{reference:s,container:n,property:t,index:i}}}e.arrayIndex=0}}e.keyIndex++}return qe})}function Rg(n,e){const t=n.getTypeMetaData(e.$type),r=e;for(const i of t.properties)i.defaultValue!==void 0&&r[i.name]===void 0&&(r[i.name]=ff(i.defaultValue))}function ff(n){return Array.isArray(n)?[...n.map(ff)]:n}function b(n){return n.charCodeAt(0)}function wa(n,e){Array.isArray(n)?n.forEach(function(t){e.push(t)}):e.push(n)}function pr(n,e){if(n[e]===!0)throw"duplicate flag "+e;n[e],n[e]=!0}function kn(n){if(n===void 0)throw Error("Internal Error - Should never get here!");return!0}function Eg(){throw Error("Internal Error - Should never get here!")}function rc(n){return n.type==="Character"}const vs=[];for(let n=b("0");n<=b("9");n++)vs.push(n);const Is=[b("_")].concat(vs);for(let n=b("a");n<=b("z");n++)Is.push(n);for(let n=b("A");n<=b("Z");n++)Is.push(n);const ic=[b(" "),b("\f"),b(`
|
|
2
2
|
`),b("\r"),b(" "),b("\v"),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b(" "),b("\u2028"),b("\u2029"),b(" "),b(" "),b(" "),b("\uFEFF")],Ag=/[0-9a-fA-F]/,bi=/[0-9]/,vg=/[1-9]/;let hf=class{constructor(){this.idx=0,this.input="",this.groupIdx=0}saveState(){return{idx:this.idx,input:this.input,groupIdx:this.groupIdx}}restoreState(e){this.idx=e.idx,this.input=e.input,this.groupIdx=e.groupIdx}pattern(e){this.idx=0,this.input=e,this.groupIdx=0,this.consumeChar("/");const t=this.disjunction();this.consumeChar("/");const r={type:"Flags",loc:{begin:this.idx,end:e.length},global:!1,ignoreCase:!1,multiLine:!1,unicode:!1,sticky:!1};for(;this.isRegExpFlag();)switch(this.popChar()){case"g":pr(r,"global");break;case"i":pr(r,"ignoreCase");break;case"m":pr(r,"multiLine");break;case"u":pr(r,"unicode");break;case"y":pr(r,"sticky");break}if(this.idx!==this.input.length)throw Error("Redundant input: "+this.input.substring(this.idx));return{type:"Pattern",flags:r,value:t,loc:this.loc(0)}}disjunction(){const e=[],t=this.idx;for(e.push(this.alternative());this.peekChar()==="|";)this.consumeChar("|"),e.push(this.alternative());return{type:"Disjunction",value:e,loc:this.loc(t)}}alternative(){const e=[],t=this.idx;for(;this.isTerm();)e.push(this.term());return{type:"Alternative",value:e,loc:this.loc(t)}}term(){return this.isAssertion()?this.assertion():this.atom()}assertion(){const e=this.idx;switch(this.popChar()){case"^":return{type:"StartAnchor",loc:this.loc(e)};case"$":return{type:"EndAnchor",loc:this.loc(e)};case"\\":switch(this.popChar()){case"b":return{type:"WordBoundary",loc:this.loc(e)};case"B":return{type:"NonWordBoundary",loc:this.loc(e)}}throw Error("Invalid Assertion Escape");case"(":this.consumeChar("?");let t;switch(this.popChar()){case"=":t="Lookahead";break;case"!":t="NegativeLookahead";break}kn(t);const r=this.disjunction();return this.consumeChar(")"),{type:t,value:r,loc:this.loc(e)}}return Eg()}quantifier(e=!1){let t;const r=this.idx;switch(this.popChar()){case"*":t={atLeast:0,atMost:1/0};break;case"+":t={atLeast:1,atMost:1/0};break;case"?":t={atLeast:0,atMost:1};break;case"{":const i=this.integerIncludingZero();switch(this.popChar()){case"}":t={atLeast:i,atMost:i};break;case",":let s;this.isDigit()?(s=this.integerIncludingZero(),t={atLeast:i,atMost:s}):t={atLeast:i,atMost:1/0},this.consumeChar("}");break}if(e===!0&&t===void 0)return;kn(t);break}if(!(e===!0&&t===void 0)&&kn(t))return this.peekChar(0)==="?"?(this.consumeChar("?"),t.greedy=!1):t.greedy=!0,t.type="Quantifier",t.loc=this.loc(r),t}atom(){let e;const t=this.idx;switch(this.peekChar()){case".":e=this.dotAll();break;case"\\":e=this.atomEscape();break;case"[":e=this.characterClass();break;case"(":e=this.group();break}if(e===void 0&&this.isPatternCharacter()&&(e=this.patternCharacter()),kn(e))return e.loc=this.loc(t),this.isQuantifier()&&(e.quantifier=this.quantifier()),e}dotAll(){return this.consumeChar("."),{type:"Set",complement:!0,value:[b(`
|
|
3
3
|
`),b("\r"),b("\u2028"),b("\u2029")]}}atomEscape(){switch(this.consumeChar("\\"),this.peekChar()){case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":return this.decimalEscapeAtom();case"d":case"D":case"s":case"S":case"w":case"W":return this.characterClassEscape();case"f":case"n":case"r":case"t":case"v":return this.controlEscapeAtom();case"c":return this.controlLetterEscapeAtom();case"0":return this.nulCharacterAtom();case"x":return this.hexEscapeSequenceAtom();case"u":return this.regExpUnicodeEscapeSequenceAtom();default:return this.identityEscapeAtom()}}decimalEscapeAtom(){return{type:"GroupBackReference",value:this.positiveInteger()}}characterClassEscape(){let e,t=!1;switch(this.popChar()){case"d":e=vs;break;case"D":e=vs,t=!0;break;case"s":e=ic;break;case"S":e=ic,t=!0;break;case"w":e=Is;break;case"W":e=Is,t=!0;break}if(kn(e))return{type:"Set",value:e,complement:t}}controlEscapeAtom(){let e;switch(this.popChar()){case"f":e=b("\f");break;case"n":e=b(`
|
|
4
4
|
`);break;case"r":e=b("\r");break;case"t":e=b(" ");break;case"v":e=b("\v");break}if(kn(e))return{type:"Character",value:e}}controlLetterEscapeAtom(){this.consumeChar("c");const e=this.popChar();if(/[a-zA-Z]/.test(e)===!1)throw Error("Invalid ");return{type:"Character",value:e.toUpperCase().charCodeAt(0)-64}}nulCharacterAtom(){return this.consumeChar("0"),{type:"Character",value:b("\0")}}hexEscapeSequenceAtom(){return this.consumeChar("x"),this.parseHexDigits(2)}regExpUnicodeEscapeSequenceAtom(){return this.consumeChar("u"),this.parseHexDigits(4)}identityEscapeAtom(){const e=this.popChar();return{type:"Character",value:b(e)}}classPatternCharacterAtom(){switch(this.peekChar()){case`
|
package/dist/assets/{xychartDiagram-PRI3JC2R-BT1LZniA.js → xychartDiagram-PRI3JC2R-BEUf-hFY.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{s as gi,g as xi,q as Xt,p as di,a as fi,b as pi,_ as a,l as Nt,H as mi,e as yi,y as bi,F as St,i as Ai,D as Yt,E as wi,K as Ci,aA as Si,R as Wt}from"./index-
|
|
1
|
+
import{s as gi,g as xi,q as Xt,p as di,a as fi,b as pi,_ as a,l as Nt,H as mi,e as yi,y as bi,F as St,i as Ai,D as Yt,E as wi,K as Ci,aA as Si,R as Wt}from"./index-C378qiys.js";import{i as _i}from"./init-Gi6I4Gst.js";import{o as ki}from"./ordinal-Cboi1Yqb.js";import{l as zt}from"./linear-BS3jNszE.js";import"./defaultLocale-DX6XiGOO.js";function Ri(e,t,i){e=+e,t=+t,i=(n=arguments.length)<2?(t=e,e=0,1):n<3?1:+i;for(var s=-1,n=Math.max(0,Math.ceil((t-e)/i))|0,o=new Array(n);++s<n;)o[s]=e+s*i;return o}function yt(){var e=ki().unknown(void 0),t=e.domain,i=e.range,s=0,n=1,o,g,m=!1,p=0,k=0,v=.5;delete e.unknown;function C(){var b=t().length,E=n<s,D=E?n:s,P=E?s:n;o=(P-D)/Math.max(1,b-p+k*2),m&&(o=Math.floor(o)),D+=(P-D-o*(b-p))*v,g=o*(1-p),m&&(D=Math.round(D),g=Math.round(g));var I=Ri(b).map(function(y){return D+o*y});return i(E?I.reverse():I)}return e.domain=function(b){return arguments.length?(t(b),C()):t()},e.range=function(b){return arguments.length?([s,n]=b,s=+s,n=+n,C()):[s,n]},e.rangeRound=function(b){return[s,n]=b,s=+s,n=+n,m=!0,C()},e.bandwidth=function(){return g},e.step=function(){return o},e.round=function(b){return arguments.length?(m=!!b,C()):m},e.padding=function(b){return arguments.length?(p=Math.min(1,k=+b),C()):p},e.paddingInner=function(b){return arguments.length?(p=Math.min(1,b),C()):p},e.paddingOuter=function(b){return arguments.length?(k=+b,C()):k},e.align=function(b){return arguments.length?(v=Math.max(0,Math.min(1,b)),C()):v},e.copy=function(){return yt(t(),[s,n]).round(m).paddingInner(p).paddingOuter(k).align(v)},_i.apply(C(),arguments)}var bt=(function(){var e=a(function(F,h,u,x){for(u=u||{},x=F.length;x--;u[F[x]]=h);return u},"o"),t=[1,10,12,14,16,18,19,21,23],i=[2,6],s=[1,3],n=[1,5],o=[1,6],g=[1,7],m=[1,5,10,12,14,16,18,19,21,23,34,35,36],p=[1,25],k=[1,26],v=[1,28],C=[1,29],b=[1,30],E=[1,31],D=[1,32],P=[1,33],I=[1,34],y=[1,35],_=[1,36],c=[1,37],W=[1,43],z=[1,42],U=[1,47],X=[1,50],l=[1,10,12,14,16,18,19,21,23,34,35,36],L=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36],S=[1,10,12,14,16,18,19,21,23,24,26,27,28,34,35,36,41,42,43,44,45,46,47,48,49,50],R=[1,64],$={trace:a(function(){},"trace"),yy:{},symbols_:{error:2,start:3,eol:4,XYCHART:5,chartConfig:6,document:7,CHART_ORIENTATION:8,statement:9,title:10,text:11,X_AXIS:12,parseXAxis:13,Y_AXIS:14,parseYAxis:15,LINE:16,plotData:17,BAR:18,acc_title:19,acc_title_value:20,acc_descr:21,acc_descr_value:22,acc_descr_multiline_value:23,SQUARE_BRACES_START:24,commaSeparatedNumbers:25,SQUARE_BRACES_END:26,NUMBER_WITH_DECIMAL:27,COMMA:28,xAxisData:29,bandData:30,ARROW_DELIMITER:31,commaSeparatedTexts:32,yAxisData:33,NEWLINE:34,SEMI:35,EOF:36,alphaNum:37,STR:38,MD_STR:39,alphaNumToken:40,AMP:41,NUM:42,ALPHA:43,PLUS:44,EQUALS:45,MULT:46,DOT:47,BRKT:48,MINUS:49,UNDERSCORE:50,$accept:0,$end:1},terminals_:{2:"error",5:"XYCHART",8:"CHART_ORIENTATION",10:"title",12:"X_AXIS",14:"Y_AXIS",16:"LINE",18:"BAR",19:"acc_title",20:"acc_title_value",21:"acc_descr",22:"acc_descr_value",23:"acc_descr_multiline_value",24:"SQUARE_BRACES_START",26:"SQUARE_BRACES_END",27:"NUMBER_WITH_DECIMAL",28:"COMMA",31:"ARROW_DELIMITER",34:"NEWLINE",35:"SEMI",36:"EOF",38:"STR",39:"MD_STR",41:"AMP",42:"NUM",43:"ALPHA",44:"PLUS",45:"EQUALS",46:"MULT",47:"DOT",48:"BRKT",49:"MINUS",50:"UNDERSCORE"},productions_:[0,[3,2],[3,3],[3,2],[3,1],[6,1],[7,0],[7,2],[9,2],[9,2],[9,2],[9,2],[9,2],[9,3],[9,2],[9,3],[9,2],[9,2],[9,1],[17,3],[25,3],[25,1],[13,1],[13,2],[13,1],[29,1],[29,3],[30,3],[32,3],[32,1],[15,1],[15,2],[15,1],[33,3],[4,1],[4,1],[4,1],[11,1],[11,1],[11,1],[37,1],[37,2],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1],[40,1]],performAction:a(function(h,u,x,d,w,r,at){var f=r.length-1;switch(w){case 5:d.setOrientation(r[f]);break;case 9:d.setDiagramTitle(r[f].text.trim());break;case 12:d.setLineData({text:"",type:"text"},r[f]);break;case 13:d.setLineData(r[f-1],r[f]);break;case 14:d.setBarData({text:"",type:"text"},r[f]);break;case 15:d.setBarData(r[f-1],r[f]);break;case 16:this.$=r[f].trim(),d.setAccTitle(this.$);break;case 17:case 18:this.$=r[f].trim(),d.setAccDescription(this.$);break;case 19:this.$=r[f-1];break;case 20:this.$=[Number(r[f-2]),...r[f]];break;case 21:this.$=[Number(r[f])];break;case 22:d.setXAxisTitle(r[f]);break;case 23:d.setXAxisTitle(r[f-1]);break;case 24:d.setXAxisTitle({type:"text",text:""});break;case 25:d.setXAxisBand(r[f]);break;case 26:d.setXAxisRangeData(Number(r[f-2]),Number(r[f]));break;case 27:this.$=r[f-1];break;case 28:this.$=[r[f-2],...r[f]];break;case 29:this.$=[r[f]];break;case 30:d.setYAxisTitle(r[f]);break;case 31:d.setYAxisTitle(r[f-1]);break;case 32:d.setYAxisTitle({type:"text",text:""});break;case 33:d.setYAxisRangeData(Number(r[f-2]),Number(r[f]));break;case 37:this.$={text:r[f],type:"text"};break;case 38:this.$={text:r[f],type:"text"};break;case 39:this.$={text:r[f],type:"markdown"};break;case 40:this.$=r[f];break;case 41:this.$=r[f-1]+""+r[f];break}},"anonymous"),table:[e(t,i,{3:1,4:2,7:4,5:s,34:n,35:o,36:g}),{1:[3]},e(t,i,{4:2,7:4,3:8,5:s,34:n,35:o,36:g}),e(t,i,{4:2,7:4,6:9,3:10,5:s,8:[1,11],34:n,35:o,36:g}),{1:[2,4],9:12,10:[1,13],12:[1,14],14:[1,15],16:[1,16],18:[1,17],19:[1,18],21:[1,19],23:[1,20]},e(m,[2,34]),e(m,[2,35]),e(m,[2,36]),{1:[2,1]},e(t,i,{4:2,7:4,3:21,5:s,34:n,35:o,36:g}),{1:[2,3]},e(m,[2,5]),e(t,[2,7],{4:22,34:n,35:o,36:g}),{11:23,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{11:39,13:38,24:W,27:z,29:40,30:41,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{11:45,15:44,27:U,33:46,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{11:49,17:48,24:X,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{11:52,17:51,24:X,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},{20:[1,53]},{22:[1,54]},e(l,[2,18]),{1:[2,2]},e(l,[2,8]),e(l,[2,9]),e(L,[2,37],{40:55,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c}),e(L,[2,38]),e(L,[2,39]),e(S,[2,40]),e(S,[2,42]),e(S,[2,43]),e(S,[2,44]),e(S,[2,45]),e(S,[2,46]),e(S,[2,47]),e(S,[2,48]),e(S,[2,49]),e(S,[2,50]),e(S,[2,51]),e(l,[2,10]),e(l,[2,22],{30:41,29:56,24:W,27:z}),e(l,[2,24]),e(l,[2,25]),{31:[1,57]},{11:59,32:58,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},e(l,[2,11]),e(l,[2,30],{33:60,27:U}),e(l,[2,32]),{31:[1,61]},e(l,[2,12]),{17:62,24:X},{25:63,27:R},e(l,[2,14]),{17:65,24:X},e(l,[2,16]),e(l,[2,17]),e(S,[2,41]),e(l,[2,23]),{27:[1,66]},{26:[1,67]},{26:[2,29],28:[1,68]},e(l,[2,31]),{27:[1,69]},e(l,[2,13]),{26:[1,70]},{26:[2,21],28:[1,71]},e(l,[2,15]),e(l,[2,26]),e(l,[2,27]),{11:59,32:72,37:24,38:p,39:k,40:27,41:v,42:C,43:b,44:E,45:D,46:P,47:I,48:y,49:_,50:c},e(l,[2,33]),e(l,[2,19]),{25:73,27:R},{26:[2,28]},{26:[2,20]}],defaultActions:{8:[2,1],10:[2,3],21:[2,2],72:[2,28],73:[2,20]},parseError:a(function(h,u){if(u.recoverable)this.trace(h);else{var x=new Error(h);throw x.hash=u,x}},"parseError"),parse:a(function(h){var u=this,x=[0],d=[],w=[null],r=[],at=this.table,f="",lt=0,It=0,hi=2,Mt=1,li=r.slice.call(arguments,1),T=Object.create(this.lexer),Y={yy:{}};for(var dt in this.yy)Object.prototype.hasOwnProperty.call(this.yy,dt)&&(Y.yy[dt]=this.yy[dt]);T.setInput(h,Y.yy),Y.yy.lexer=T,Y.yy.parser=this,typeof T.yylloc>"u"&&(T.yylloc={});var ft=T.yylloc;r.push(ft);var ci=T.options&&T.options.ranges;typeof Y.yy.parseError=="function"?this.parseError=Y.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;function ui(V){x.length=x.length-2*V,w.length=w.length-V,r.length=r.length-V}a(ui,"popStack");function Vt(){var V;return V=d.pop()||T.lex()||Mt,typeof V!="number"&&(V instanceof Array&&(d=V,V=d.pop()),V=u.symbols_[V]||V),V}a(Vt,"lex");for(var M,H,B,pt,q={},ct,O,Bt,ut;;){if(H=x[x.length-1],this.defaultActions[H]?B=this.defaultActions[H]:((M===null||typeof M>"u")&&(M=Vt()),B=at[H]&&at[H][M]),typeof B>"u"||!B.length||!B[0]){var mt="";ut=[];for(ct in at[H])this.terminals_[ct]&&ct>hi&&ut.push("'"+this.terminals_[ct]+"'");T.showPosition?mt="Parse error on line "+(lt+1)+`:
|
|
2
2
|
`+T.showPosition()+`
|
|
3
3
|
Expecting `+ut.join(", ")+", got '"+(this.terminals_[M]||M)+"'":mt="Parse error on line "+(lt+1)+": Unexpected "+(M==Mt?"end of input":"'"+(this.terminals_[M]||M)+"'"),this.parseError(mt,{text:T.match,token:this.terminals_[M]||M,line:T.yylineno,loc:ft,expected:ut})}if(B[0]instanceof Array&&B.length>1)throw new Error("Parse Error: multiple actions possible at state: "+H+", token: "+M);switch(B[0]){case 1:x.push(M),w.push(T.yytext),r.push(T.yylloc),x.push(B[1]),M=null,It=T.yyleng,f=T.yytext,lt=T.yylineno,ft=T.yylloc;break;case 2:if(O=this.productions_[B[1]][1],q.$=w[w.length-O],q._$={first_line:r[r.length-(O||1)].first_line,last_line:r[r.length-1].last_line,first_column:r[r.length-(O||1)].first_column,last_column:r[r.length-1].last_column},ci&&(q._$.range=[r[r.length-(O||1)].range[0],r[r.length-1].range[1]]),pt=this.performAction.apply(q,[f,It,lt,Y.yy,B[1],w,r].concat(li)),typeof pt<"u")return pt;O&&(x=x.slice(0,-1*O*2),w=w.slice(0,-1*O),r=r.slice(0,-1*O)),x.push(this.productions_[B[1]][0]),w.push(q.$),r.push(q._$),Bt=at[x[x.length-2]][x[x.length-1]],x.push(Bt);break;case 3:return!0}}return!0},"parse")},Et=(function(){var F={EOF:1,parseError:a(function(u,x){if(this.yy.parser)this.yy.parser.parseError(u,x);else throw new Error(u)},"parseError"),setInput:a(function(h,u){return this.yy=u||this.yy||{},this._input=h,this._more=this._backtrack=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this.options.ranges&&(this.yylloc.range=[0,0]),this.offset=0,this},"setInput"),input:a(function(){var h=this._input[0];this.yytext+=h,this.yyleng++,this.offset++,this.match+=h,this.matched+=h;var u=h.match(/(?:\r\n?|\n).*/g);return u?(this.yylineno++,this.yylloc.last_line++):this.yylloc.last_column++,this.options.ranges&&this.yylloc.range[1]++,this._input=this._input.slice(1),h},"input"),unput:a(function(h){var u=h.length,x=h.split(/(?:\r\n?|\n)/g);this._input=h+this._input,this.yytext=this.yytext.substr(0,this.yytext.length-u),this.offset-=u;var d=this.match.split(/(?:\r\n?|\n)/g);this.match=this.match.substr(0,this.match.length-1),this.matched=this.matched.substr(0,this.matched.length-1),x.length-1&&(this.yylineno-=x.length-1);var w=this.yylloc.range;return this.yylloc={first_line:this.yylloc.first_line,last_line:this.yylineno+1,first_column:this.yylloc.first_column,last_column:x?(x.length===d.length?this.yylloc.first_column:0)+d[d.length-x.length].length-x[0].length:this.yylloc.first_column-u},this.options.ranges&&(this.yylloc.range=[w[0],w[0]+this.yyleng-u]),this.yyleng=this.yytext.length,this},"unput"),more:a(function(){return this._more=!0,this},"more"),reject:a(function(){if(this.options.backtrack_lexer)this._backtrack=!0;else return this.parseError("Lexical error on line "+(this.yylineno+1)+`. You can only invoke reject() in the lexer when the lexer is of the backtracking persuasion (options.backtrack_lexer = true).
|
|
4
4
|
`+this.showPosition(),{text:"",token:null,line:this.yylineno});return this},"reject"),less:a(function(h){this.unput(this.match.slice(h))},"less"),pastInput:a(function(){var h=this.matched.substr(0,this.matched.length-this.match.length);return(h.length>20?"...":"")+h.substr(-20).replace(/\n/g,"")},"pastInput"),upcomingInput:a(function(){var h=this.match;return h.length<20&&(h+=this._input.substr(0,20-h.length)),(h.substr(0,20)+(h.length>20?"...":"")).replace(/\n/g,"")},"upcomingInput"),showPosition:a(function(){var h=this.pastInput(),u=new Array(h.length+1).join("-");return h+this.upcomingInput()+`
|
package/dist/index.html
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
<link rel="mask-icon" href="/safari-pinned-tab.svg?v=2" color="#ff9b47" />
|
|
12
12
|
<meta name="theme-color" content="#ff9b47" />
|
|
13
13
|
<title>TUI Notes 2026 - Step 0</title>
|
|
14
|
-
<script type="module" crossorigin src="/assets/index-
|
|
15
|
-
<link rel="stylesheet" crossorigin href="/assets/index-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-C378qiys.js"></script>
|
|
15
|
+
<link rel="stylesheet" crossorigin href="/assets/index-OJnEfe9A.css">
|
|
16
16
|
</head>
|
|
17
17
|
<body>
|
|
18
18
|
<div id="app"></div>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@techie_doubts/tui.notes.2026",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.9",
|
|
4
4
|
"description": "Apple Notes-style local markdown notes app powered by @techie_doubts/tui.editor.2026",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "0BSD",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
},
|
|
43
43
|
"dependencies": {
|
|
44
44
|
"@techie_doubts/editor-plugin-abc": "3.0.1",
|
|
45
|
-
"@techie_doubts/editor-plugin-chart": "3.1.
|
|
45
|
+
"@techie_doubts/editor-plugin-chart": "3.1.1",
|
|
46
46
|
"@techie_doubts/editor-plugin-code-syntax-highlight": "3.1.0",
|
|
47
47
|
"@techie_doubts/editor-plugin-color-syntax": "3.1.0",
|
|
48
48
|
"@techie_doubts/editor-plugin-export": "3.0.1",
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
"@techie_doubts/editor-plugin-uml": "3.1.0",
|
|
56
56
|
"@techie_doubts/tui.chart.2026": "4.6.2",
|
|
57
57
|
"@techie_doubts/tui.color-picker.2026": "2.2.8",
|
|
58
|
-
"@techie_doubts/tui.editor.2026": "3.3.
|
|
58
|
+
"@techie_doubts/tui.editor.2026": "3.3.4",
|
|
59
59
|
"express": "^4.21.2",
|
|
60
60
|
"katex": "^0.16.28",
|
|
61
61
|
"mermaid": "^11.12.0",
|
package/server/index.js
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import express from "express";
|
|
2
|
+
import crypto from "node:crypto";
|
|
2
3
|
import fs from "node:fs";
|
|
4
|
+
import os from "node:os";
|
|
3
5
|
import path from "node:path";
|
|
4
6
|
import { fileURLToPath } from "node:url";
|
|
5
7
|
import {
|
|
@@ -17,6 +19,234 @@ const HOST = process.env.TUI_NOTES_API_HOST || "127.0.0.1";
|
|
|
17
19
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
18
20
|
const DIST_DIR = path.resolve(__dirname, "..", "dist");
|
|
19
21
|
const DIST_INDEX_FILE = path.join(DIST_DIR, "index.html");
|
|
22
|
+
const parsedUploadLimit = Number(process.env.TUI_NOTES_MEDIA_UPLOAD_LIMIT_BYTES);
|
|
23
|
+
const MAX_MEDIA_UPLOAD_BYTES =
|
|
24
|
+
Number.isFinite(parsedUploadLimit) && parsedUploadLimit > 0
|
|
25
|
+
? parsedUploadLimit
|
|
26
|
+
: 500 * 1024 * 1024;
|
|
27
|
+
const AUDIO_EXTENSIONS = new Set(["m4a", "mp3", "wav", "ogg", "opus", "webm", "aac", "flac", "oga", "mp4"]);
|
|
28
|
+
const VIDEO_EXTENSIONS = new Set(["mp4", "webm", "mov", "m4v", "ogv", "avi", "mkv"]);
|
|
29
|
+
const IMAGE_EXTENSIONS = new Set(["png", "jpg", "jpeg", "gif", "webp", "avif", "svg", "bmp", "ico"]);
|
|
30
|
+
|
|
31
|
+
function sanitizePathSegment(value) {
|
|
32
|
+
const segment = String(value || "").trim();
|
|
33
|
+
if (!segment || segment === "." || segment === "..") {
|
|
34
|
+
return "";
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const cleaned = segment.replace(/[<>:"|?*\u0000-\u001f]/g, "");
|
|
38
|
+
return cleaned.trim();
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function normalizeNoteFileName(note) {
|
|
42
|
+
const raw = String(note?.fileName || `${note?.id || "note"}.md`).replaceAll("\\", "/").trim();
|
|
43
|
+
const normalized = path.posix.normalize(raw).replace(/^\/+/, "");
|
|
44
|
+
if (
|
|
45
|
+
!normalized ||
|
|
46
|
+
normalized === "." ||
|
|
47
|
+
normalized === ".." ||
|
|
48
|
+
normalized.startsWith("../")
|
|
49
|
+
) {
|
|
50
|
+
return `${note?.id || "note"}.md`;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const parts = normalized.split("/").filter(Boolean);
|
|
54
|
+
const safeParts = parts.map(sanitizePathSegment).filter(Boolean);
|
|
55
|
+
if (!safeParts.length) {
|
|
56
|
+
return `${note?.id || "note"}.md`;
|
|
57
|
+
}
|
|
58
|
+
return safeParts.join("/");
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
function normalizeMediaRelativePath(value) {
|
|
62
|
+
const raw = String(value || "").trim().replaceAll("\\", "/");
|
|
63
|
+
if (!raw) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const withoutDotPrefix = raw.replace(/^(\.\/)+/, "");
|
|
68
|
+
const normalized = path.posix.normalize(withoutDotPrefix).replace(/^\/+/, "");
|
|
69
|
+
if (
|
|
70
|
+
!normalized ||
|
|
71
|
+
normalized === "." ||
|
|
72
|
+
normalized === ".." ||
|
|
73
|
+
normalized.startsWith("../")
|
|
74
|
+
) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const parts = normalized.split("/").filter(Boolean);
|
|
79
|
+
if (!parts.length) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
for (const part of parts) {
|
|
83
|
+
if (part !== sanitizePathSegment(part)) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
return normalized;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
function getLowerFileExtension(filePath) {
|
|
92
|
+
const ext = path.extname(String(filePath || "")).replace(/^\./, "").toLowerCase();
|
|
93
|
+
return ext;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function isAllowedMediaExtension(filePath, requestedKind) {
|
|
97
|
+
const ext = getLowerFileExtension(filePath);
|
|
98
|
+
if (!ext) {
|
|
99
|
+
return false;
|
|
100
|
+
}
|
|
101
|
+
if (requestedKind === "audio") {
|
|
102
|
+
return AUDIO_EXTENSIONS.has(ext);
|
|
103
|
+
}
|
|
104
|
+
if (requestedKind === "video") {
|
|
105
|
+
return VIDEO_EXTENSIONS.has(ext);
|
|
106
|
+
}
|
|
107
|
+
if (requestedKind === "image") {
|
|
108
|
+
return IMAGE_EXTENSIONS.has(ext);
|
|
109
|
+
}
|
|
110
|
+
return AUDIO_EXTENSIONS.has(ext) || VIDEO_EXTENSIONS.has(ext) || IMAGE_EXTENSIONS.has(ext);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function resolveNoteById(noteId) {
|
|
114
|
+
const state = getHydratedState();
|
|
115
|
+
return state.notes.find((note) => String(note.id) === String(noteId)) || null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function getNoteMediaDirectoryAbsolutePath(note) {
|
|
119
|
+
const noteFileName = normalizeNoteFileName(note);
|
|
120
|
+
const noteDirRelative = path.posix.dirname(noteFileName) === "." ? "" : path.posix.dirname(noteFileName);
|
|
121
|
+
const noteDirAbsolute = path.resolve(getNotesDir(), ...noteDirRelative.split("/").filter(Boolean));
|
|
122
|
+
const notesRoot = path.resolve(getNotesDir());
|
|
123
|
+
const normalizedNoteDir = path.normalize(noteDirAbsolute);
|
|
124
|
+
const rootWithSep = `${notesRoot}${path.sep}`;
|
|
125
|
+
|
|
126
|
+
if (normalizedNoteDir !== notesRoot && !normalizedNoteDir.startsWith(rootWithSep)) {
|
|
127
|
+
throw new Error("Unsafe note directory path.");
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
return noteDirAbsolute;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
function inferExtensionFromMime(mimeType, kind) {
|
|
134
|
+
const mime = String(mimeType || "").toLowerCase();
|
|
135
|
+
|
|
136
|
+
if (mime.includes("audio/mp4")) return "m4a";
|
|
137
|
+
if (mime.includes("audio/mpeg")) return "mp3";
|
|
138
|
+
if (mime.includes("audio/wav")) return "wav";
|
|
139
|
+
if (mime.includes("audio/ogg")) return "ogg";
|
|
140
|
+
if (mime.includes("audio/webm")) return "webm";
|
|
141
|
+
if (mime.includes("video/mp4")) return "mp4";
|
|
142
|
+
if (mime.includes("video/webm")) return "webm";
|
|
143
|
+
if (mime.includes("video/ogg")) return "ogv";
|
|
144
|
+
|
|
145
|
+
return kind === "audio" ? "m4a" : "mp4";
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
function normalizeUploadFileName(input) {
|
|
149
|
+
const value = String(input || "").trim().replaceAll("\\", "/");
|
|
150
|
+
if (!value) {
|
|
151
|
+
return { base: "", extension: "" };
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
const fileName = value.split("/").pop() || "";
|
|
155
|
+
const safeFileName = sanitizePathSegment(fileName);
|
|
156
|
+
if (!safeFileName) {
|
|
157
|
+
return { base: "", extension: "" };
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const ext = path.posix.extname(safeFileName).replace(/^\./, "").toLowerCase();
|
|
161
|
+
const base = sanitizePathSegment(path.posix.basename(safeFileName, path.posix.extname(safeFileName)));
|
|
162
|
+
|
|
163
|
+
return { base, extension: ext };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
function randomSuffix() {
|
|
167
|
+
return crypto.randomBytes(3).toString("hex");
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function saveUploadedMediaFile(note, { kind, originalFileName, mimeType, dataBuffer }) {
|
|
171
|
+
if (!Buffer.isBuffer(dataBuffer) || dataBuffer.length <= 0) {
|
|
172
|
+
throw new Error("Uploaded file is empty.");
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const mediaDir = getNoteMediaDirectoryAbsolutePath(note);
|
|
176
|
+
fs.mkdirSync(mediaDir, { recursive: true });
|
|
177
|
+
|
|
178
|
+
const { base: rawBase, extension: extFromName } = normalizeUploadFileName(originalFileName);
|
|
179
|
+
const allowedExtensions = kind === "audio" ? AUDIO_EXTENSIONS : VIDEO_EXTENSIONS;
|
|
180
|
+
const extension = allowedExtensions.has(extFromName)
|
|
181
|
+
? extFromName
|
|
182
|
+
: inferExtensionFromMime(mimeType, kind);
|
|
183
|
+
const baseName = rawBase || `${kind}-${Date.now()}`;
|
|
184
|
+
|
|
185
|
+
let fileName = `${baseName}.${extension}`;
|
|
186
|
+
let absolutePath = path.join(mediaDir, fileName);
|
|
187
|
+
let guard = 0;
|
|
188
|
+
|
|
189
|
+
while (fs.existsSync(absolutePath) && guard < 1000) {
|
|
190
|
+
fileName = `${baseName}-${randomSuffix()}.${extension}`;
|
|
191
|
+
absolutePath = path.join(mediaDir, fileName);
|
|
192
|
+
guard += 1;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
fs.writeFileSync(absolutePath, dataBuffer);
|
|
196
|
+
|
|
197
|
+
return {
|
|
198
|
+
fileName,
|
|
199
|
+
relativePath: `./${fileName}`,
|
|
200
|
+
absolutePath,
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
function resolveRequestedMediaFilePath(note, requestedPath, requestedKind = "") {
|
|
205
|
+
const raw = String(requestedPath || "").trim().replaceAll("\\", "/");
|
|
206
|
+
if (!raw) {
|
|
207
|
+
return null;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
let absoluteCandidate = null;
|
|
211
|
+
if (raw.startsWith("~/")) {
|
|
212
|
+
absoluteCandidate = path.resolve(os.homedir(), raw.slice(2));
|
|
213
|
+
} else if (raw.startsWith("./~/")) {
|
|
214
|
+
absoluteCandidate = path.resolve(os.homedir(), raw.slice(4));
|
|
215
|
+
} else if (raw.startsWith("file://")) {
|
|
216
|
+
try {
|
|
217
|
+
absoluteCandidate = decodeURIComponent(raw.replace(/^file:\/\//i, ""));
|
|
218
|
+
} catch (_error) {
|
|
219
|
+
absoluteCandidate = raw.replace(/^file:\/\//i, "");
|
|
220
|
+
}
|
|
221
|
+
} else if (path.isAbsolute(raw)) {
|
|
222
|
+
absoluteCandidate = raw;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
if (absoluteCandidate) {
|
|
226
|
+
const absolutePath = path.resolve(absoluteCandidate);
|
|
227
|
+
if (!isAllowedMediaExtension(absolutePath, requestedKind)) {
|
|
228
|
+
return null;
|
|
229
|
+
}
|
|
230
|
+
return absolutePath;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
const normalizedRelativePath = normalizeMediaRelativePath(requestedPath);
|
|
234
|
+
if (!normalizedRelativePath) {
|
|
235
|
+
return null;
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
const noteDir = getNoteMediaDirectoryAbsolutePath(note);
|
|
239
|
+
const absolutePath = path.resolve(noteDir, ...normalizedRelativePath.split("/"));
|
|
240
|
+
const normalizedNoteDir = path.normalize(noteDir);
|
|
241
|
+
const rootPrefix = `${normalizedNoteDir}${path.sep}`;
|
|
242
|
+
const normalizedAbsolute = path.normalize(absolutePath);
|
|
243
|
+
|
|
244
|
+
if (normalizedAbsolute !== normalizedNoteDir && !normalizedAbsolute.startsWith(rootPrefix)) {
|
|
245
|
+
return null;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
return absolutePath;
|
|
249
|
+
}
|
|
20
250
|
|
|
21
251
|
function resolveServeDistMode() {
|
|
22
252
|
if (process.env.TUI_NOTES_SERVE_DIST === "0") {
|
|
@@ -56,6 +286,103 @@ app.get("/api/state", (_req, res) => {
|
|
|
56
286
|
res.json(state);
|
|
57
287
|
});
|
|
58
288
|
|
|
289
|
+
app.get("/api/media/file", (req, res) => {
|
|
290
|
+
const noteId = String(req.query?.noteId || "").trim();
|
|
291
|
+
const mediaPath = String(req.query?.path || "").trim();
|
|
292
|
+
const requestedKind = String(req.query?.kind || "").trim().toLowerCase();
|
|
293
|
+
if (!noteId || !mediaPath) {
|
|
294
|
+
res.status(400).json({ message: "noteId and path are required." });
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
const note = resolveNoteById(noteId);
|
|
299
|
+
if (!note || note.deletedAt) {
|
|
300
|
+
res.status(404).json({ message: "Note not found." });
|
|
301
|
+
return;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
const absolutePath = resolveRequestedMediaFilePath(note, mediaPath, requestedKind);
|
|
305
|
+
if (!absolutePath || !fs.existsSync(absolutePath)) {
|
|
306
|
+
res.status(404).json({ message: "Media file not found." });
|
|
307
|
+
return;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
const lowerPath = absolutePath.toLowerCase();
|
|
311
|
+
if (requestedKind === "audio") {
|
|
312
|
+
if (lowerPath.endsWith(".webm")) {
|
|
313
|
+
res.type("audio/webm");
|
|
314
|
+
} else if (lowerPath.endsWith(".m4a") || lowerPath.endsWith(".mp4")) {
|
|
315
|
+
res.type("audio/mp4");
|
|
316
|
+
}
|
|
317
|
+
} else if (requestedKind === "video" && lowerPath.endsWith(".webm")) {
|
|
318
|
+
res.type("video/webm");
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
res.sendFile(absolutePath);
|
|
322
|
+
});
|
|
323
|
+
|
|
324
|
+
app.post(
|
|
325
|
+
"/api/media/upload",
|
|
326
|
+
express.raw({
|
|
327
|
+
type: () => true,
|
|
328
|
+
limit: MAX_MEDIA_UPLOAD_BYTES,
|
|
329
|
+
}),
|
|
330
|
+
(req, res) => {
|
|
331
|
+
const noteId = String(req.query?.noteId || "").trim();
|
|
332
|
+
const kindRaw = String(req.query?.kind || "").trim().toLowerCase();
|
|
333
|
+
const originalFileName = String(req.query?.fileName || "").trim();
|
|
334
|
+
const mimeType = String(req.query?.mimeType || "").trim();
|
|
335
|
+
|
|
336
|
+
if (!noteId) {
|
|
337
|
+
res.status(400).json({ message: "noteId is required." });
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const kind = kindRaw === "audio" || kindRaw === "video" ? kindRaw : null;
|
|
342
|
+
if (!kind) {
|
|
343
|
+
res.status(400).json({ message: "kind must be audio or video." });
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const note = resolveNoteById(noteId);
|
|
348
|
+
if (!note || note.deletedAt) {
|
|
349
|
+
res.status(404).json({ message: "Note not found." });
|
|
350
|
+
return;
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
const rawBody = Buffer.isBuffer(req.body)
|
|
354
|
+
? req.body
|
|
355
|
+
: req.body instanceof Uint8Array
|
|
356
|
+
? Buffer.from(req.body)
|
|
357
|
+
: null;
|
|
358
|
+
|
|
359
|
+
if (!rawBody || rawBody.length <= 0) {
|
|
360
|
+
res.status(400).json({ message: "Request body must contain binary file data." });
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
try {
|
|
365
|
+
const saved = saveUploadedMediaFile(note, {
|
|
366
|
+
kind,
|
|
367
|
+
originalFileName,
|
|
368
|
+
mimeType,
|
|
369
|
+
dataBuffer: rawBody,
|
|
370
|
+
});
|
|
371
|
+
|
|
372
|
+
res.json({
|
|
373
|
+
ok: true,
|
|
374
|
+
kind,
|
|
375
|
+
fileName: saved.fileName,
|
|
376
|
+
relativePath: saved.relativePath,
|
|
377
|
+
});
|
|
378
|
+
} catch (error) {
|
|
379
|
+
res.status(500).json({
|
|
380
|
+
message: error?.message || "Failed to save uploaded media.",
|
|
381
|
+
});
|
|
382
|
+
}
|
|
383
|
+
},
|
|
384
|
+
);
|
|
385
|
+
|
|
59
386
|
function handleStateWrite(req, res) {
|
|
60
387
|
if (!req.body || typeof req.body !== "object") {
|
|
61
388
|
res.status(400).json({ message: "Request body must be a state object." });
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{ap as o,aq as n}from"./index-DnUc1o0Y.js";const t=(a,r)=>o.lang.round(n.parse(a)[r]);export{t as c};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-B4BG7PRW-Bpu5eFEV.js";import{_ as i}from"./index-DnUc1o0Y.js";import"./chunk-FMBD7UC4-DD_AE9Va.js";import"./chunk-55IACEB6-DEsgGcA5.js";import"./chunk-QN33PNHL--se-DHpE.js";var p={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{p as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as a,c as s,a as e,C as t}from"./chunk-B4BG7PRW-Bpu5eFEV.js";import{_ as i}from"./index-DnUc1o0Y.js";import"./chunk-FMBD7UC4-DD_AE9Va.js";import"./chunk-55IACEB6-DEsgGcA5.js";import"./chunk-QN33PNHL--se-DHpE.js";var p={parser:e,get db(){return new t},renderer:s,styles:a,init:i(r=>{r.class||(r.class={}),r.class.arrowMarkerAbsolute=r.arrowMarkerAbsolute},"init")};export{p as diagram};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{s as t,b as r,a,S as s}from"./chunk-DI55MBZ5-BzPNj5EH.js";import{_ as i}from"./index-DnUc1o0Y.js";import"./chunk-55IACEB6-DEsgGcA5.js";import"./chunk-QN33PNHL--se-DHpE.js";var l={parser:a,get db(){return new s(2)},renderer:r,styles:t,init:i(e=>{e.state||(e.state={}),e.state.arrowMarkerAbsolute=e.arrowMarkerAbsolute},"init")};export{l as diagram};
|