LightRAG/lightrag/api/webui/assets/index-BKeDSElW.js

4 lines
9.0 KiB
JavaScript
Raw Normal View History

2025-07-14 17:19:28 +08:00
import{f as W,p as A,c as k,n as C,d as $,s as q,e as z,v as U,k as S,S as X}from"./markdown-vendor-7kCcHxQn.js";import"./ui-vendor-DaJTMqwy.js";import"./react-vendor-CgPb4pW_.js";import"./feature-graph-D68hhnYC.js";import"./graph-vendor-BC3frDkq.js";import"./utils-vendor-elCzPYZl.js";const T=/[#.]/g;function Y(e,t){const n=e||"",r={};let o=0,i,s;for(;o<n.length;){T.lastIndex=o;const a=T.exec(n),c=n.slice(o,a?a.index:n.length);c&&(i?i==="#"?r.id=c:Array.isArray(r.className)?r.className.push(c):r.className=[c]:s=c,o+=c.length),a&&(i=a[0],o++)}return{type:"element",tagName:s||t||"div",properties:r,children:[]}}function B(e,t,n){const r=n?v(n):void 0;function o(i,s,...a){let c;if(i==null){c={type:"root",children:[]};const f=s;a.unshift(f)}else{c=Y(i,t);const f=c.tagName.toLowerCase(),l=r?r.get(f):void 0;if(c.tagName=l||f,J(s))a.unshift(s);else for(const[u,d]of Object.entries(s))Q(e,c.properties,u,d)}for(const f of a)w(c.children,f);return c.type==="element"&&c.tagName==="template"&&(c.content={type:"root",children:c.children},c.children=[]),c}return o}function J(e){if(e===null||typeof e!="object"||Array.isArray(e))return!0;if(typeof e.type!="string")return!1;const t=e,n=Object.keys(e);for(const r of n){const o=t[r];if(o&&typeof o=="object"){if(!Array.isArray(o))return!0;const i=o;for(const s of i)if(typeof s!="number"&&typeof s!="string")return!0}}return!!("children"in e&&Array.isArray(e.children))}function Q(e,t,n,r){const o=W(e,n);let i;if(r!=null){if(typeof r=="number"){if(Number.isNaN(r))return;i=r}else typeof r=="boolean"?i=r:typeof r=="string"?o.spaceSeparated?i=A(r):o.commaSeparated?i=k(r):o.commaOrSpaceSeparated?i=A(k(r).join(" ")):i=j(o,o.property,r):Array.isArray(r)?i=[...r]:i=o.property==="style"?Z(r):String(r);if(Array.isArray(i)){const s=[];for(const a of i)s.push(j(o,o.property,a));i=s}o.property==="className"&&Array.isArray(t.className)&&(i=t.className.concat(i)),t[o.property]=i}}function w(e,t){if(t!=null)if(typeof t=="number"||typeof t=="string")e.push({type:"text",value:String(t)});else if(Array.isArray(t))for(const n of t)w(e,n);else if(typeof t=="object"&&"type"in t)t.type==="root"?w(e,t.children):e.push(t);else throw new Error("Expected node, nodes, or string, got `"+t+"`")}function j(e,t,n){if(typeof n=="string"){if(e.number&&n&&!Number.isNaN(Number(n)))return Number(n);if((e.boolean||e.overloadedBoolean)&&(n===""||C(n)===C(t)))return!0}return n}function Z(e){const t=[];for(const[n,r]of Object.entries(e))t.push([n,r].join(": "));return t.join("; ")}function v(e){const t=new Map;for(const n of e)t.set(n.toLowerCase(),n);return t}const ee=["altGlyph","altGlyphDef","altGlyphItem","animateColor","animateMotion","animateTransform","clipPath","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","foreignObject","glyphRef","linearGradient","radialGradient","solidColor","textArea","textPath"],te=B($,"div"),ne=B(q,"g",ee),y={html:"http://www.w3.org/1999/xhtml",svg:"http://www.w3.org/2000/svg"};function re(e,t){return P(e,{})||{type:"root",children:[]}}function P(e,t){const n=oe(e,t);return n&&t.afterTransform&&t.afterTransform(e,n),n}function oe(e,t){switch(e.nodeType){case 1:return ae(e,t);case 3:return se(e);case 8:return ce(e);case 9:return E(e,t);case 10:return ie();case 11:return E(e,t);default:return}}function E(e,t){return{type:"root",children:D(e,t)}}function ie(){return{type:"doctype"}}function se(e){return{type:"text",value:e.nodeValue||""}}function ce(e){return{type:"comment",value:e.nodeValue||""}}function ae(e,t){const n=e.namespaceURI,r=n===y.svg?ne:te,o=n===y.html?e.tagName.toLowerCase():e.tagName,i=n===y.html&&o==="template"?e.content:e,s=e.getAttributeNames(),a={};let c=-1;for(;++c<s.length;)a[s[c]]=e.getAttribute(s[c])||"";return r(o,a,D(i,t))}function D(e,t){const n=e.childNodes,r=[];let o=-1;for(
`.repeat(f)||" "),f=-1,c.push(l))}return c.join("")}function R(e,t,n){return e.type==="element"?we(e,t,n):e.type==="text"?n.whitespace==="normal"?_(e,n):Ne(e):[]}function we(e,t,n){const r=H(e,n),o=e.children||[];let i=-1,s=[];if(ge(e))return s;let a,c;for(N(e)||L(e)&&I(t,e,L)?c=`
`:me(e)?(a=2,c=2):G(e)&&(a=1,c=1);++i<o.length;)s=s.concat(R(o[i],e,{whitespace:r,breakBefore:i?void 0:a,breakAfter:i<o.length-1?N(o[i+1]):c}));return F(e)&&I(t,e,F)&&s.push(" "),a&&s.unshift(a),c&&s.push(c),s}function _(e,t){const n=String(e.value),r=[],o=[];let i=0;for(;i<=n.length;){O.lastIndex=i;const c=O.exec(n),f=c&&"index"in c?c.index:n.length;r.push(be(n.slice(i,f).replace(/[\u061C\u200E\u200F\u202A-\u202E\u2066-\u2069]/g,""),i===0?t.breakBefore:!0,f===n.length?t.breakAfter:!0)),i=f+1}let s=-1,a;for(;++s<r.length;)r[s].charCodeAt(r[s].length-1)===8203||s<r.length-1&&r[s+1].charCodeAt(0)===8203?(o.push(r[s]),a=void 0):r[s]?(typeof a=="number"&&o.push(a),o.push(r[s]),a=0):(s===0||s===r.length-1)&&o.push(0);return o}function Ne(e){return[String(e.value)]}function be(e,t,n){const r=[];let o=0,i;for(;o<e.length;){M.lastIndex=o;const s=M.exec(e);i=s?s.index:e.length,!o&&!i&&s&&!t&&r.push(""),o!==i&&r.push(e.slice(o,i)),o=s?i+s[0].length:i}return o!==i&&!n&&r.push(""),r.join(" ")}function H(e,t){if(e.type==="element"){const n=e.properties||{};switch(e.tagName){case"listing":case"plaintext":case"xmp":return"pre";case"nobr":return"nowrap";case"pre":return n.wrap?"pre-wrap":"pre";case"td":case"th":return n.noWrap?"nowrap":t.whitespace;case"textarea":return"pre-wrap"}}return t.whitespace}function xe(e){return!!(e.properties||{}).hidden}function Ae(e){return e.tagName==="td"||e.tagName==="th"}function ke(e){return e.tagName==="dialog"&&!(e.properties||{}).open}const Ce={},Se=[];function Fe(e){const t=e||Ce;return function(n,r){U(n,"element",function(o,i){const s=Array.isArray(o.properties.className)?o.properties.className:Se,a=s.includes("language-math"),c=s.includes("math-display"),f=s.includes("math-inline");let l=c;if(!a&&!c&&!f)return;let u=i[i.length-1],d=o;if(o.tagName==="code"&&a&&u&&u.type==="element"&&u.tagName==="pre"&&(d=u,u=i[i.length-2],l=!0),!u)return;const m=ye(d,{whitespace:"pre"});let p;try{p=S.renderToString(m,{...t,displayMode:l,throwOnError:!0})}catch(g){const x=g,V=x.name.toLowerCase();r.message("Could not render math with KaTeX",{ancestors:[...i,o],cause:x,place:o.position,ruleId:V,source:"rehype-katex"});try{p=S.renderToString(m,{...t,displayMode:l,strict:"ignore",throwOnError:!1})}catch{p=[{type:"element",tagName:"span",properties:{className:["katex-error"],style:"color:"+(t.errorColor||"#cc0000"),title:String(g)},children:[{type:"text",value:m}]}]}}typeof p=="string"&&(p=fe(p).children);const K=u.children.indexOf(d);return u.children.splice(K,1,...p),X})}}export{Fe as default};