markstream-react 0.0.14 → 0.0.16
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/index.css +1 -1
- package/dist/index.d.ts +585 -0
- package/dist/index.js +23 -23
- package/dist/index.tailwind.css +1 -1
- package/dist/tailwind.ts +1 -1
- package/package.json +8 -4
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import e,{useMemo as t,useState as n,useContext as r,createContext as o,useRef as i,useEffect as s,useCallback as a,useSyncExternalStore as l,useLayoutEffect as c}from"react";import{getMarkdown as d,parseMarkdownToStructure as u}from"stream-markdown-parser";import{autoUpdate as m,computePosition as h,offset as p,flip as f,shift as g}from"@floating-ui/dom";import{createPortal as x}from"react-dom";var w,v,y,k={exports:{}},b={},j={};var C=(y||(y=1,"production"===process.env.NODE_ENV?k.exports=function(){if(w)return b;w=1;var t=e,n=/* @__PURE__ */Symbol.for("react.element"),r=/* @__PURE__ */Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(e,t,r){var a,l={},c=null,d=null;for(a in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(d=t.ref),t)o.call(t,a)&&!s.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:n,type:e,key:c,ref:d,props:l,_owner:i.current}}return b.Fragment=r,b.jsx=a,b.jsxs=a,b}():k.exports=(v||(v=1,"production"!==process.env.NODE_ENV&&function(){var t,n=e,r=/* @__PURE__ */Symbol.for("react.element"),o=/* @__PURE__ */Symbol.for("react.portal"),i=/* @__PURE__ */Symbol.for("react.fragment"),s=/* @__PURE__ */Symbol.for("react.strict_mode"),a=/* @__PURE__ */Symbol.for("react.profiler"),l=/* @__PURE__ */Symbol.for("react.provider"),c=/* @__PURE__ */Symbol.for("react.context"),d=/* @__PURE__ */Symbol.for("react.forward_ref"),u=/* @__PURE__ */Symbol.for("react.suspense"),m=/* @__PURE__ */Symbol.for("react.suspense_list"),h=/* @__PURE__ */Symbol.for("react.memo"),p=/* @__PURE__ */Symbol.for("react.lazy"),f=/* @__PURE__ */Symbol.for("react.offscreen"),g=Symbol.iterator,x=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];!function(e,t,n){var r=x.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(t+="%s",n=n.concat([r]));var o=n.map(function(e){return String(e)});o.unshift("Warning: "+t),Function.prototype.apply.call(console.error,console,o)}(0,e,n)}function v(e){return e.displayName||"Context"}function y(e){if(null==e)return null;if("number"==typeof e.tag&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case i:return"Fragment";case o:return"Portal";case a:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case m:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return v(e)+".Consumer";case l:return v(e._context)+".Provider";case d:return function(e,t,n){var r=e.displayName;if(r)return r;var o=t.displayName||t.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case h:var t=e.displayName||null;return null!==t?t:y(e.type)||"Memo";case p:var n=e,r=n._payload,f=n._init;try{return y(f(r))}catch(g){return null}}return null}t=/* @__PURE__ */Symbol.for("react.module.reference");var k,b,C,M,N,S,L,B=Object.assign,E=0;function T(){}T.__reactDisabledLog=!0;var _,$=x.ReactCurrentDispatcher;function D(e,t,n){if(void 0===_)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);_=r&&r[1]||""}return"\n"+_+e}var O,P=!1,R="function"==typeof WeakMap?WeakMap:Map;function W(e,t){if(!e||P)return"";var n,r=O.get(e);if(void 0!==r)return r;P=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=$.current,$.current=null,function(){if(0===E){k=console.log,b=console.info,C=console.warn,M=console.error,N=console.group,S=console.groupCollapsed,L=console.groupEnd;var e={configurable:!0,enumerable:!0,value:T,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}E++}();try{if(t){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(p){n=p}Reflect.construct(e,[],s)}else{try{s.call()}catch(p){n=p}e.call(s.prototype)}}else{try{throw Error()}catch(p){n=p}e()}}catch(f){if(f&&n&&"string"==typeof f.stack){for(var a=f.stack.split("\n"),l=n.stack.split("\n"),c=a.length-1,d=l.length-1;c>=1&&d>=0&&a[c]!==l[d];)d--;for(;c>=1&&d>=0;c--,d--)if(a[c]!==l[d]){if(1!==c||1!==d)do{if(c--,--d<0||a[c]!==l[d]){var u="\n"+a[c].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),"function"==typeof e&&O.set(e,u),u}}while(c>=1&&d>=0);break}}}finally{P=!1,$.current=o,function(){if(0===--E){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},e,{value:k}),info:B({},e,{value:b}),warn:B({},e,{value:C}),error:B({},e,{value:M}),group:B({},e,{value:N}),groupCollapsed:B({},e,{value:S}),groupEnd:B({},e,{value:L})})}E<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var m=e?e.displayName||e.name:"",h=m?D(m):"";return"function"==typeof e&&O.set(e,h),h}function A(e,t,n){if(null==e)return"";if("function"==typeof e)return W(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return D(e);switch(e){case u:return D("Suspense");case m:return D("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case d:return W(e.render,!1);case h:return A(e.type,t,n);case p:var o=e,i=o._payload,s=o._init;try{return A(s(i),t,n)}catch(a){}}return""}O=new R;var I=Object.prototype.hasOwnProperty,F={},z=x.ReactDebugCurrentFrame;function H(e){if(e){var t=e._owner,n=A(e.type,e._source,t?t.type:null);z.setExtraStackFrame(n)}else z.setExtraStackFrame(null)}var V=Array.isArray;function K(e){return V(e)}function X(e){return""+e}function U(e){if(function(e){try{return X(e),!1}catch(t){return!0}}(e))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),X(e)}var q,Y,Z,J=x.ReactCurrentOwner,G={key:!0,ref:!0,__self:!0,__source:!0},Q=x.ReactCurrentOwner,ee=x.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,n=A(e.type,e._source,t?t.type:null);ee.setExtraStackFrame(n)}else ee.setExtraStackFrame(null)}function ne(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function re(){if(Q.current){var e=y(Q.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Z=!1;var oe={};function ie(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=re();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!oe[n]){oe[n]=!0;var r="";e&&e._owner&&e._owner!==Q.current&&(r=" It was passed a child from "+y(e._owner.type)+"."),te(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),te(null)}}}function se(e,t){if("object"==typeof e)if(K(e))for(var n=0;n<e.length;n++){var r=e[n];ne(r)&&ie(r,t)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=g&&e[g]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,s=o.call(e);!(i=s.next()).done;)ne(i.value)&&ie(i.value,t)}}var ae={};function le(e,n,o,g,x,v){var k=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===a||e===s||e===u||e===m||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===h||e.$$typeof===l||e.$$typeof===c||e.$$typeof===d||e.$$typeof===t||void 0!==e.getModuleId)}(e);if(!k){var b,j="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(j+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),j+=re(),null===e?b="null":K(e)?b="array":void 0!==e&&e.$$typeof===r?(b="<"+(y(e.type)||"Unknown")+" />",j=" Did you accidentally export a JSX literal instead of a component?"):b=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",b,j)}var C=function(e,t,n,o,i){var s,a={},l=null,c=null;for(s in void 0!==n&&(U(n),l=""+n),function(e){if(I.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(U(t.key),l=""+t.key),function(e){if(I.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e){"string"==typeof e.ref&&J.current}(t)),t)I.call(t,s)&&!G.hasOwnProperty(s)&&(a[s]=t[s]);if(e&&e.defaultProps){var d=e.defaultProps;for(s in d)void 0===a[s]&&(a[s]=d[s])}if(l||c){var u="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var n=function(){q||(q=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(a,u),c&&function(e,t){var n=function(){Y||(Y=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(a,u)}return function(e,t,n,o,i,s,a){var l={$$typeof:r,type:e,key:t,ref:n,props:a,_owner:s,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,i,o,J.current,a)}(e,n,o,x,v);if(null==C)return C;if(k){var M=n.children;if(void 0!==M)if(g)if(K(M)){for(var N=0;N<M.length;N++)se(M[N],e);Object.freeze&&Object.freeze(M)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else se(M,e)}if(I.call(n,"key")){var S=y(e),L=Object.keys(n).filter(function(e){return"key"!==e}),B=L.length>0?"{key: someKey, "+L.join(": ..., ")+": ...}":"{key: someKey}";ae[S+B]||(w('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',B,S,L.length>0?"{"+L.join(": ..., ")+": ...}":"{}",S),ae[S+B]=!0)}return e===i?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){te(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),te(null);break}}null!==e.ref&&(te(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(C):function(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==d&&n.$$typeof!==h)return;t=n.propTypes}if(t){var r=y(n);!function(e,t,n,r,o){var i=Function.call.bind(I);for(var s in e)if(i(e,s)){var a=void 0;try{if("function"!=typeof e[s]){var l=Error((r||"React class")+": "+n+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}a=e[s](t,s,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(c){a=c}!a||a instanceof Error||(H(o),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,s,typeof a),H(null)),a instanceof Error&&!(a.message in F)&&(F[a.message]=!0,H(o),w("Failed %s type: %s",n,a.message),H(null))}}(t,e.props,"prop",r,e)}else void 0===n.PropTypes||Z||(Z=!0,w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}(C),C}j.Fragment=i,j.jsx=function(e,t,n){return le(e,t,n,!1)},j.jsxs=function(e,t,n){return le(e,t,n,!0)}}()),j)),k.exports);const M=/* @__PURE__ */new Set(["image","table","code_block","html_block","html_inline","blockquote","list","list_item","definition_list","footnote","footnote_reference","footnote_anchor","admonition","thematic_break","math_block","thinking","vmr_container"]);function N(e){if(Array.isArray(e)&&0!==e.length)return e.reduce((e,[t,n])=>t?(e["for"===t?"htmlFor":"class"===t?"className":t]=null==n||n,e):e,{})}function S(e,t,n,r){if(!Array.isArray(e)||0===e.length)return null;const o=[];for(let i=0;i<e.length;i++){const s=e[i];if(s){if("label_open"===s.type){const a=[];for(i++;i<e.length;){const t=e[i];if("label_close"===(null==t?void 0:t.type))break;t&&a.push(t),i++}const l=`${n}-label-${i}`;o.push(
|
|
1
|
+
import e,{useMemo as t,useState as n,useContext as r,createContext as o,useRef as i,useEffect as s,useCallback as a,useSyncExternalStore as l,useLayoutEffect as c}from"react";import{getMarkdown as d,parseMarkdownToStructure as u}from"stream-markdown-parser";import{autoUpdate as m,computePosition as h,offset as p,flip as f,shift as g}from"@floating-ui/dom";import{createPortal as x}from"react-dom";var w,v,y,k={exports:{}},b={},j={};var C=(y||(y=1,"production"===process.env.NODE_ENV?k.exports=function(){if(w)return b;w=1;var t=e,n=/* @__PURE__ */Symbol.for("react.element"),r=/* @__PURE__ */Symbol.for("react.fragment"),o=Object.prototype.hasOwnProperty,i=t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,s={key:!0,ref:!0,__self:!0,__source:!0};function a(e,t,r){var a,l={},c=null,d=null;for(a in void 0!==r&&(c=""+r),void 0!==t.key&&(c=""+t.key),void 0!==t.ref&&(d=t.ref),t)o.call(t,a)&&!s.hasOwnProperty(a)&&(l[a]=t[a]);if(e&&e.defaultProps)for(a in t=e.defaultProps)void 0===l[a]&&(l[a]=t[a]);return{$$typeof:n,type:e,key:c,ref:d,props:l,_owner:i.current}}return b.Fragment=r,b.jsx=a,b.jsxs=a,b}():k.exports=(v||(v=1,"production"!==process.env.NODE_ENV&&function(){var t,n=e,r=/* @__PURE__ */Symbol.for("react.element"),o=/* @__PURE__ */Symbol.for("react.portal"),i=/* @__PURE__ */Symbol.for("react.fragment"),s=/* @__PURE__ */Symbol.for("react.strict_mode"),a=/* @__PURE__ */Symbol.for("react.profiler"),l=/* @__PURE__ */Symbol.for("react.provider"),c=/* @__PURE__ */Symbol.for("react.context"),d=/* @__PURE__ */Symbol.for("react.forward_ref"),u=/* @__PURE__ */Symbol.for("react.suspense"),m=/* @__PURE__ */Symbol.for("react.suspense_list"),h=/* @__PURE__ */Symbol.for("react.memo"),p=/* @__PURE__ */Symbol.for("react.lazy"),f=/* @__PURE__ */Symbol.for("react.offscreen"),g=Symbol.iterator,x=n.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function w(e){for(var t=arguments.length,n=new Array(t>1?t-1:0),r=1;r<t;r++)n[r-1]=arguments[r];!function(e,t,n){var r=x.ReactDebugCurrentFrame.getStackAddendum();""!==r&&(t+="%s",n=n.concat([r]));var o=n.map(function(e){return String(e)});o.unshift("Warning: "+t),Function.prototype.apply.call(console.error,console,o)}(0,e,n)}function v(e){return e.displayName||"Context"}function y(e){if(null==e)return null;if("number"==typeof e.tag&&w("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),"function"==typeof e)return e.displayName||e.name||null;if("string"==typeof e)return e;switch(e){case i:return"Fragment";case o:return"Portal";case a:return"Profiler";case s:return"StrictMode";case u:return"Suspense";case m:return"SuspenseList"}if("object"==typeof e)switch(e.$$typeof){case c:return v(e)+".Consumer";case l:return v(e._context)+".Provider";case d:return function(e,t,n){var r=e.displayName;if(r)return r;var o=t.displayName||t.name||"";return""!==o?n+"("+o+")":n}(e,e.render,"ForwardRef");case h:var t=e.displayName||null;return null!==t?t:y(e.type)||"Memo";case p:var n=e,r=n._payload,f=n._init;try{return y(f(r))}catch(g){return null}}return null}t=/* @__PURE__ */Symbol.for("react.module.reference");var k,b,C,M,N,S,L,B=Object.assign,E=0;function T(){}T.__reactDisabledLog=!0;var _,$=x.ReactCurrentDispatcher;function D(e,t,n){if(void 0===_)try{throw Error()}catch(o){var r=o.stack.trim().match(/\n( *(at )?)/);_=r&&r[1]||""}return"\n"+_+e}var O,P=!1,W="function"==typeof WeakMap?WeakMap:Map;function R(e,t){if(!e||P)return"";var n,r=O.get(e);if(void 0!==r)return r;P=!0;var o,i=Error.prepareStackTrace;Error.prepareStackTrace=void 0,o=$.current,$.current=null,function(){if(0===E){k=console.log,b=console.info,C=console.warn,M=console.error,N=console.group,S=console.groupCollapsed,L=console.groupEnd;var e={configurable:!0,enumerable:!0,value:T,writable:!0};Object.defineProperties(console,{info:e,log:e,warn:e,error:e,group:e,groupCollapsed:e,groupEnd:e})}E++}();try{if(t){var s=function(){throw Error()};if(Object.defineProperty(s.prototype,"props",{set:function(){throw Error()}}),"object"==typeof Reflect&&Reflect.construct){try{Reflect.construct(s,[])}catch(p){n=p}Reflect.construct(e,[],s)}else{try{s.call()}catch(p){n=p}e.call(s.prototype)}}else{try{throw Error()}catch(p){n=p}e()}}catch(f){if(f&&n&&"string"==typeof f.stack){for(var a=f.stack.split("\n"),l=n.stack.split("\n"),c=a.length-1,d=l.length-1;c>=1&&d>=0&&a[c]!==l[d];)d--;for(;c>=1&&d>=0;c--,d--)if(a[c]!==l[d]){if(1!==c||1!==d)do{if(c--,--d<0||a[c]!==l[d]){var u="\n"+a[c].replace(" at new "," at ");return e.displayName&&u.includes("<anonymous>")&&(u=u.replace("<anonymous>",e.displayName)),"function"==typeof e&&O.set(e,u),u}}while(c>=1&&d>=0);break}}}finally{P=!1,$.current=o,function(){if(0===--E){var e={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:B({},e,{value:k}),info:B({},e,{value:b}),warn:B({},e,{value:C}),error:B({},e,{value:M}),group:B({},e,{value:N}),groupCollapsed:B({},e,{value:S}),groupEnd:B({},e,{value:L})})}E<0&&w("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}(),Error.prepareStackTrace=i}var m=e?e.displayName||e.name:"",h=m?D(m):"";return"function"==typeof e&&O.set(e,h),h}function A(e,t,n){if(null==e)return"";if("function"==typeof e)return R(e,!(!(r=e.prototype)||!r.isReactComponent));var r;if("string"==typeof e)return D(e);switch(e){case u:return D("Suspense");case m:return D("SuspenseList")}if("object"==typeof e)switch(e.$$typeof){case d:return R(e.render,!1);case h:return A(e.type,t,n);case p:var o=e,i=o._payload,s=o._init;try{return A(s(i),t,n)}catch(a){}}return""}O=new W;var I=Object.prototype.hasOwnProperty,F={},z=x.ReactDebugCurrentFrame;function H(e){if(e){var t=e._owner,n=A(e.type,e._source,t?t.type:null);z.setExtraStackFrame(n)}else z.setExtraStackFrame(null)}var V=Array.isArray;function K(e){return V(e)}function X(e){return""+e}function U(e){if(function(e){try{return X(e),!1}catch(t){return!0}}(e))return w("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",function(e){return"function"==typeof Symbol&&Symbol.toStringTag&&e[Symbol.toStringTag]||e.constructor.name||"Object"}(e)),X(e)}var q,Y,Z,J=x.ReactCurrentOwner,G={key:!0,ref:!0,__self:!0,__source:!0},Q=x.ReactCurrentOwner,ee=x.ReactDebugCurrentFrame;function te(e){if(e){var t=e._owner,n=A(e.type,e._source,t?t.type:null);ee.setExtraStackFrame(n)}else ee.setExtraStackFrame(null)}function ne(e){return"object"==typeof e&&null!==e&&e.$$typeof===r}function re(){if(Q.current){var e=y(Q.current.type);if(e)return"\n\nCheck the render method of `"+e+"`."}return""}Z=!1;var oe={};function ie(e,t){if(e._store&&!e._store.validated&&null==e.key){e._store.validated=!0;var n=function(e){var t=re();if(!t){var n="string"==typeof e?e:e.displayName||e.name;n&&(t="\n\nCheck the top-level render call using <"+n+">.")}return t}(t);if(!oe[n]){oe[n]=!0;var r="";e&&e._owner&&e._owner!==Q.current&&(r=" It was passed a child from "+y(e._owner.type)+"."),te(e),w('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',n,r),te(null)}}}function se(e,t){if("object"==typeof e)if(K(e))for(var n=0;n<e.length;n++){var r=e[n];ne(r)&&ie(r,t)}else if(ne(e))e._store&&(e._store.validated=!0);else if(e){var o=function(e){if(null===e||"object"!=typeof e)return null;var t=g&&e[g]||e["@@iterator"];return"function"==typeof t?t:null}(e);if("function"==typeof o&&o!==e.entries)for(var i,s=o.call(e);!(i=s.next()).done;)ne(i.value)&&ie(i.value,t)}}var ae={};function le(e,n,o,g,x,v){var k=function(e){return"string"==typeof e||"function"==typeof e||e===i||e===a||e===s||e===u||e===m||e===f||"object"==typeof e&&null!==e&&(e.$$typeof===p||e.$$typeof===h||e.$$typeof===l||e.$$typeof===c||e.$$typeof===d||e.$$typeof===t||void 0!==e.getModuleId)}(e);if(!k){var b,j="";(void 0===e||"object"==typeof e&&null!==e&&0===Object.keys(e).length)&&(j+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."),j+=re(),null===e?b="null":K(e)?b="array":void 0!==e&&e.$$typeof===r?(b="<"+(y(e.type)||"Unknown")+" />",j=" Did you accidentally export a JSX literal instead of a component?"):b=typeof e,w("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",b,j)}var C=function(e,t,n,o,i){var s,a={},l=null,c=null;for(s in void 0!==n&&(U(n),l=""+n),function(e){if(I.call(e,"key")){var t=Object.getOwnPropertyDescriptor(e,"key").get;if(t&&t.isReactWarning)return!1}return void 0!==e.key}(t)&&(U(t.key),l=""+t.key),function(e){if(I.call(e,"ref")){var t=Object.getOwnPropertyDescriptor(e,"ref").get;if(t&&t.isReactWarning)return!1}return void 0!==e.ref}(t)&&(c=t.ref,function(e){"string"==typeof e.ref&&J.current}(t)),t)I.call(t,s)&&!G.hasOwnProperty(s)&&(a[s]=t[s]);if(e&&e.defaultProps){var d=e.defaultProps;for(s in d)void 0===a[s]&&(a[s]=d[s])}if(l||c){var u="function"==typeof e?e.displayName||e.name||"Unknown":e;l&&function(e,t){var n=function(){q||(q=!0,w("%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"key",{get:n,configurable:!0})}(a,u),c&&function(e,t){var n=function(){Y||(Y=!0,w("%s: `ref` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://reactjs.org/link/special-props)",t))};n.isReactWarning=!0,Object.defineProperty(e,"ref",{get:n,configurable:!0})}(a,u)}return function(e,t,n,o,i,s,a){var l={$$typeof:r,type:e,key:t,ref:n,props:a,_owner:s,_store:{}};return Object.defineProperty(l._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(l,"_self",{configurable:!1,enumerable:!1,writable:!1,value:o}),Object.defineProperty(l,"_source",{configurable:!1,enumerable:!1,writable:!1,value:i}),Object.freeze&&(Object.freeze(l.props),Object.freeze(l)),l}(e,l,c,i,o,J.current,a)}(e,n,o,x,v);if(null==C)return C;if(k){var M=n.children;if(void 0!==M)if(g)if(K(M)){for(var N=0;N<M.length;N++)se(M[N],e);Object.freeze&&Object.freeze(M)}else w("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");else se(M,e)}if(I.call(n,"key")){var S=y(e),L=Object.keys(n).filter(function(e){return"key"!==e}),B=L.length>0?"{key: someKey, "+L.join(": ..., ")+": ...}":"{key: someKey}";ae[S+B]||(w('A props object containing a "key" prop is being spread into JSX:\n let props = %s;\n <%s {...props} />\nReact keys must be passed directly to JSX without using spread:\n let props = %s;\n <%s key={someKey} {...props} />',B,S,L.length>0?"{"+L.join(": ..., ")+": ...}":"{}",S),ae[S+B]=!0)}return e===i?function(e){for(var t=Object.keys(e.props),n=0;n<t.length;n++){var r=t[n];if("children"!==r&&"key"!==r){te(e),w("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",r),te(null);break}}null!==e.ref&&(te(e),w("Invalid attribute `ref` supplied to `React.Fragment`."),te(null))}(C):function(e){var t,n=e.type;if(null!=n&&"string"!=typeof n){if("function"==typeof n)t=n.propTypes;else{if("object"!=typeof n||n.$$typeof!==d&&n.$$typeof!==h)return;t=n.propTypes}if(t){var r=y(n);!function(e,t,n,r,o){var i=Function.call.bind(I);for(var s in e)if(i(e,s)){var a=void 0;try{if("function"!=typeof e[s]){var l=Error((r||"React class")+": "+n+" type `"+s+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof e[s]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw l.name="Invariant Violation",l}a=e[s](t,s,r,n,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(c){a=c}!a||a instanceof Error||(H(o),w("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).",r||"React class",n,s,typeof a),H(null)),a instanceof Error&&!(a.message in F)&&(F[a.message]=!0,H(o),w("Failed %s type: %s",n,a.message),H(null))}}(t,e.props,"prop",r,e)}else void 0===n.PropTypes||Z||(Z=!0,w("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",y(n)||"Unknown"));"function"!=typeof n.getDefaultProps||n.getDefaultProps.isReactClassApproved||w("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}(C),C}j.Fragment=i,j.jsx=function(e,t,n){return le(e,t,n,!1)},j.jsxs=function(e,t,n){return le(e,t,n,!0)}}()),j)),k.exports);const M=/* @__PURE__ */new Set(["image","table","code_block","html_block","html_inline","blockquote","list","list_item","definition_list","footnote","footnote_reference","footnote_anchor","admonition","thematic_break","math_block","thinking","vmr_container"]);function N(e){if(Array.isArray(e)&&0!==e.length)return e.reduce((e,[t,n])=>t?(e["for"===t?"htmlFor":"class"===t?"className":t]=null==n||n,e):e,{})}function S(e,t,n,r){if(!Array.isArray(e)||0===e.length)return null;const o=[];for(let i=0;i<e.length;i++){const s=e[i];if(s){if("label_open"===s.type){const a=[];for(i++;i<e.length;){const t=e[i];if("label_close"===(null==t?void 0:t.type))break;t&&a.push(t),i++}const l=`${n}-label-${i}`;o.push(
|
|
2
2
|
/* @__PURE__ */C.jsx("label",{...N(s.attrs),children:S(a,t,`${l}-child`,r)},l));continue}"label_close"!==s.type&&o.push(r(s,`${n}-${i}`,t))}}return o}function L(e,t,n,r){/* @__PURE__ */
|
|
3
3
|
return C.jsx(C.Fragment,{children:S(e,t,`${n}-inline`,r)})}const B={note:"ℹ️",info:"ℹ️",tip:"💡",warning:"⚠️",danger:"❗",error:"⛔",caution:"⚠️"};function E(e){const{node:r,ctx:o,renderNode:i,indexKey:s,isDark:a}=e,l=String(r.kind||"note"),c=t(()=>r.title&&String(r.title).trim().length?String(r.title):l.charAt(0).toUpperCase()+l.slice(1),[l,r.title]),[d,u]=n(()=>{var e;return!!r.collapsible&&!(null==(e=r.open)||e)}),m=t(()=>`admonition-${Math.random().toString(36).slice(2,9)}`,[]);/* @__PURE__ */
|
|
4
4
|
return C.jsxs("div",{className:`admonition admonition-${l}${a?" is-dark":""}`,"data-index-key":s,children:[
|
|
5
5
|
/* @__PURE__ */C.jsxs("div",{id:m,className:"admonition-header",children:[B[l]&&/* @__PURE__ */C.jsx("span",{className:"admonition-icon",children:B[l]}),
|
|
6
6
|
/* @__PURE__ */C.jsx("span",{className:"admonition-title",children:c}),r.collapsible&&/* @__PURE__ */C.jsx("button",{type:"button",className:"admonition-toggle","aria-expanded":!d,"aria-controls":`${m}-content`,title:d?"Expand":"Collapse",onClick:()=>u(e=>!e),children:/* @__PURE__ */C.jsx("span",{children:d?"▶":"▼"})})]}),!d&&/* @__PURE__ */C.jsx("div",{id:`${m}-content`,className:"admonition-content","aria-labelledby":m,children:o&&i?S(r.children,o,String(null!=s?s:m),i):null})]})}const T=o(null);function _(e,t){const n="undefined"!=typeof window&&"undefined"!=typeof document,r=/* @__PURE__ */new Map;return(o,i)=>{var s,a;const l={current:!1};let c,d=!1;const u=new Promise(e=>{c=()=>{d||(d=!0,e())}}),m=()=>{for(const e of r.values())if(e.targets.has(o)){e.targets.delete(o);try{e.observer.unobserve(o)}catch{}}};if(!n||!t())return l.current=!0,c(),{isVisible:()=>!0,whenVisible:u,destroy:m};const h=((t,o)=>{var i,s;if(!n)return null;if("undefined"==typeof IntersectionObserver)return null;const a=null!=(i=e())?i:null,l=`${t}::${o}`,c=r.get(l);if(c&&c.root===a)return c;if(c){try{c.observer.disconnect()}catch{}r.delete(l)}const d=null!=(s=null==c?void 0:c.targets)?s:/* @__PURE__ */new Map,u=new IntersectionObserver(e=>{for(const t of e){const e=d.get(t.target);if(e&&(t.isIntersecting||t.intersectionRatio>0)){e.state.current=!0;try{e.resolve()}catch{}try{u.unobserve(t.target)}catch{}d.delete(t.target)}}},{root:a,rootMargin:t,threshold:o}),m={observer:u,root:a,rootMargin:t,threshold:o,targets:d};r.set(l,m);for(const e of d.keys())u.observe(e);return m})(null!=(s=null==i?void 0:i.rootMargin)?s:"300px",null!=(a=null==i?void 0:i.threshold)?a:0);return h?(h.targets.set(o,{resolve:c,state:l}),h.observer.observe(o),{isVisible:()=>l.current,whenVisible:u,destroy:m}):(l.current=!0,c(),{isVisible:()=>!0,whenVisible:u,destroy:m})}}const $=_(()=>null,()=>!0);function D({getRoot:e,enabled:n=!0,children:r}){const o=i(n);o.current=n;const s=i(e);s.current=e;const a=t(()=>_(()=>{var e,t;return null!=(t=null==(e=s.current)?void 0:e.call(s))?t:null},()=>o.current),[]);/* @__PURE__ */
|
|
7
|
-
return C.jsx(T.Provider,{value:a,children:r})}function O(){var e;return null!=(e=r(T))?e:$}const P="__global__",
|
|
7
|
+
return C.jsx(T.Provider,{value:a,children:r})}function O(){var e;return null!=(e=r(T))?e:$}const P="__global__",W="__MARKSTREAM_REACT_CUSTOM_COMPONENTS_STORE__",R=(()=>{const e=globalThis;if(e[W])return e[W];const t={scopedComponents:{},revision:0,listeners:/* @__PURE__ */new Set};return e[W]=t,t})();function A(){R.revision++;for(const e of Array.from(R.listeners))try{e()}catch{}}function I(e){return R.listeners.add(e),()=>{R.listeners.delete(e)}}function F(){return R.revision}function z(e,t){"string"==typeof e?R.scopedComponents[e]={...t||{}}:R.scopedComponents[P]={...e},A()}function H(e){const t=R.scopedComponents[P]||{};if(!e)return t;const n=R.scopedComponents[e]||{};return t&&0!==Object.keys(t).length?n&&0!==Object.keys(n).length?{...t,...n}:t:n}function V(e){if(e===P)throw new Error("removeCustomComponents: cannot delete global mapping; call clearGlobalCustomComponents instead.");delete R.scopedComponents[e],A()}function K(){delete R.scopedComponents[P],A()}function X(e){const{node:t}=e;/* @__PURE__ */
|
|
8
8
|
return C.jsx("span",{className:"checkbox-node",children:/* @__PURE__ */C.jsx("input",{type:"checkbox",checked:Boolean(t.checked),disabled:!0,className:"checkbox-input",readOnly:!0})})}const U={"common.copy":"Copy","common.copySuccess":"Copied","common.decrease":"Decrease","common.reset":"Reset","common.increase":"Increase","common.expand":"Expand","common.collapse":"Collapse","common.preview":"Preview","common.source":"Source","common.export":"Export","common.open":"Open","common.zoomIn":"Zoom in","common.zoomOut":"Zoom out","common.resetZoom":"Reset zoom","image.loadError":"Image failed to load","image.loading":"Loading image..."};function q(e){Object.assign(U,e)}function Y(){return{t:e=>{var t;return null!=(t=U[e])?t:function(e){return(e.split(".").pop()||e).replace(/[_-]/g," ").replace(/([A-Z])/g," $1").replace(/\s+/g," ").replace(/\b\w/g,e=>e.toUpperCase()).trim()}(e)}}}let Z=null,J=null,G=null,Q=null,ee=null,te=null;function ne(){Q&&(clearTimeout(Q),Q=null),ee&&(clearTimeout(ee),ee=null)}async function re(e){if(!Z||!J)return;const{x:t,y:n}=await h(J,Z,{placement:e,middleware:[p(8),f(),g({padding:8})],strategy:"fixed"});Z.style.transform=`translate3d(${Math.round(t)}px, ${Math.round(n)}px, 0)`}function oe(e,t,n="top",r=!1,o,i){if(!e||"undefined"==typeof document)return;if(Z||"undefined"==typeof document||(Z=document.createElement("div"),Z.className="ms-tooltip",Z.setAttribute("role","tooltip"),Z.dataset.visible="false",Z.style.position="fixed",Z.style.left="0px",Z.style.top="0px",Z.style.transform="translate3d(0,0,0)",document.body.appendChild(Z)),!Z)return;ne();const s=async()=>{if(Z){J=e,Z.textContent=t,Z.dataset.placement=n,Z.dataset.dark=function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(i)?"true":"false",Z.dataset.visible="false",te=`tooltip-${Date.now()}-${Math.random().toString(36).slice(2)}`,Z.id=te;try{e.setAttribute("aria-describedby",te)}catch{}await re(n),Z.dataset.visible="true",null==G||G(),G=m(e,Z,()=>{re(n)})}};r?s():Q=setTimeout(s,80)}function ie(e=!1){if(!Z)return;ne();const t=()=>{if(Z){if(Z.dataset.visible="false",J&&te)try{J.removeAttribute("aria-describedby")}catch{}J=null,te=null,G&&(G(),G=null)}};e?t():ee=setTimeout(t,120)}let se=null;function ae(e){se=null!=e?e:null}const le={"":"",javascript:"javascript",js:"javascript",mjs:"javascript",cjs:"javascript",typescript:"typescript",ts:"typescript",jsx:"jsx",tsx:"tsx",py:"python",rb:"ruby",sh:"shell",bash:"shell",zsh:"shell",shellscript:"shell",plaintext:"plain",text:"plain","c++":"cpp",md:"markdown"};function ce(e){var t;const n=function(e){if(!e)return"";const t=e.trim();if(!t)return"";const[n]=t.split(/\s+/),[r]=n.split(":");return r.toLowerCase()}(e);return null!=(t=le[n])?t:n}function de(e){const t=ce(e);if(!t)return"plaintext";switch(t){case"plain":return"plaintext";case"jsx":return"javascript";case"tsx":return"typescript";default:return t}}function ue(e){if(se){const t=se(e);if(null!=t&&""!==t)return t}switch(ce(e)){case"javascript":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4.5 11c0 .828427.6715729 1.5 1.5 1.5.8284271 0 1.5-.671573 1.5-1.5V7.5M12.5 8.75C12.5 8.05964406 11.9627417 7.5 11.3 7.5L10.7 7.5C10.0372583 7.5 9.5 8.05964406 9.5 8.75 9.5 9.44035594 10.0372583 10 10.7 10L11.3 10C11.9627417 10 12.5 10.5596441 12.5 11.25 12.5 11.9403559 11.9627417 12.5 11.3 12.5L10.7 12.5C10.0372583 12.5 9.5 11.9403559 9.5 11.25" />\n <path d="m 4,1.5 h 8 c 1.385,0 2.5,1.115 2.5,2.5 v 8 c 0,1.385 -1.115,2.5 -2.5,2.5 H 4 C 2.615,14.5 1.5,13.385 1.5,12 V 4 C 1.5,2.615 2.615,1.5 4,1.5 Z" />\n </g>\n</svg>\n\n';case"typescript":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M4 1.5h8A2.5 2.5 0 0114.5 4v8a2.5 2.5 0 01-2.5 2.5H4A2.5 2.5 0 011.5 12V4A2.5 2.5 0 014 1.5" />\n <path d="M12.5 8.75c0-.69-.54-1.25-1.2-1.25h-.6c-.66 0-1.2.56-1.2 1.25S10.04 10 10.7 10h.6c.66 0 1.2.56 1.2 1.25s-.54 1.25-1.2 1.25h-.6c-.66 0-1.2-.56-1.2-1.25m-3-3.75v5M5 7.5h3" />\n </g>\n</svg>\n\n';case"jsx":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#99d1db" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 10.8c4.14 0 7.5-1.25 7.5-2.8S12.14 5.2 8 5.2.5 6.45.5 8s3.36 2.8 7.5 2.8" />\n <path d="M5.52 9.4c2.07 3.5 4.86 5.72 6.23 4.95 1.37-.78.8-4.24-1.27-7.75C8.41 3.1 5.62.88 4.25 1.65c-1.37.78-.8 4.24 1.27 7.75" />\n <path d="M5.52 6.6c-2.07 3.5-2.64 6.97-1.27 7.75 1.37.77 4.16-1.45 6.23-4.95s2.64-6.97 1.27-7.75C10.38.88 7.59 3.1 5.52 6.6" />\n <path d="M8.5 8a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n\n';case"tsx":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M8 11.3c4.14 0 7.5-1.28 7.5-2.86S12.14 5.58 8 5.58.5 6.86.5 8.44s3.36 2.87 7.5 2.87Z" />\n <path d="M5.52 9.87c2.07 3.6 4.86 5.86 6.23 5.07 1.37-.8.8-4.34-1.27-7.93S5.62 1.16 4.25 1.95s-.8 4.34 1.27 7.92" />\n <path d="M5.52 7.01c-2.07 3.59-2.64 7.14-1.27 7.93s4.16-1.48 6.23-5.07c2.07-3.58 2.64-7.13 1.27-7.92-1.37-.8-4.16 1.47-6.23 5.06" />\n <path d="M8.5 8.44a.5.5 0 01-.5.5.5.5 0 01-.5-.5.5.5 0 01.5-.5.5.5 0 01.5.5" />\n </g>\n</svg>\n\n';case"html":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#ef9f76" d="M1.5 1.5h13L13 13l-5 2-5-2z" />\n <path stroke="#c6d0f5" d="M11 4.5H5l.25 3h5.5l-.25 3-2.5 1-2.5-1-.08-1" />\n </g>\n</svg>\n\n';case"css":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round">\n <path d="m4 1.5h8c1.38 0 2.5 1.12 2.5 2.5v8c0 1.38-1.12 2.5-2.5 2.5h-8c-1.38 0-2.5-1.12-2.5-2.5v-8c0-1.38 1.12-2.5 2.5-2.5z" />\n <path stroke-width=".814" d="m 10.240861,11.529149 c 0,0.58011 0.437448,1.039154 0.96002,1.035371 l 0.451635,-0.0032 c 0.522572,-0.0036 0.949379,-0.451477 0.949379,-1.032848 0,-0.581372 -0.426807,-1.065638 -0.949379,-1.065638 l -0.451635,3.4e-5 c -0.522572,3.9e-5 -0.949379,-0.4855273 -0.949379,-1.0656374 0,-0.5801104 0.426807,-1.0378931 0.949379,-1.0378931 l 0.451635,2.825e-4 c 0.522572,3.267e-4 0.951743,0.4577827 0.951743,1.0378931 M 6.8003972,11.529149 c 0,0.58011 0.4374474,1.039154 0.9600196,1.035371 l 0.46464,-0.0032 c 0.5225722,-0.0035 0.9363738,-0.451477 0.9363738,-1.031587 0,-0.580111 -0.4090724,-1.065638 -0.9316446,-1.065638 l -0.4693692,3.4e-5 c -0.5225722,3.8e-5 -0.949379,-0.4855272 -0.949379,-1.0656373 0,-0.5801104 0.4268068,-1.0378931 0.949379,-1.0378931 h 0.4516348 c 0.5225722,0 0.9635665,0.4577827 0.9635665,1.0378931 M 3.4072246,11.529149 c 0,0.58011 0.4374474,1.051765 0.9600196,1.051765 H 4.818879 c 0.5225722,0 0.949379,-0.456521 0.949379,-1.037893 m 0.01129,-2.1312747 c 0,-0.5801103 -0.4374474,-1.037893 -0.9600196,-1.037893 L 4.3678939,8.3741358 C 3.8453217,8.3744624 3.4078743,8.8420074 3.4078743,9.4233788 v 2.1186642" />\n </g>\n</svg>\n\n';case"json":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#e5c890" stroke-linecap="round" stroke-linejoin="round" d="M4.5 2.5H4c-.75 0-1.5.75-1.5 1.5v2c0 1.1-1 2-1.83 2 .83 0 1.83.9 1.83 2v2c0 .75.75 1.5 1.5 1.5h.5m7-11h.5c.75 0 1.5.75 1.5 1.5v2c0 1.1 1 2 1.83 2-.83 0-1.83.9-1.83 2v2c0 .74-.75 1.5-1.5 1.5h-.5m-6.5-3a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1m3 0a.5.5 0 100-1 .5.5 0 000 1" />\n</svg>\n\n';case"python":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke-linecap="round" stroke-linejoin="round">\n <path stroke="#8caaee" d="M8.5 5.5h-3m6 0V3c0-.8-.7-1.5-1.5-1.5H7c-.8 0-1.5.7-1.5 1.5v2.5H3c-.8 0-1.5.7-1.5 1.5v2c0 .8.7 1.5 1.48 1.5" />\n <path stroke="#e5c890" d="M10.5 10.5h-3m-3 0V13c0 .8.7 1.5 1.5 1.5h3c.8 0 1.5-.7 1.5-1.5v-2.5H13c.8 0 1.5-.7 1.5-1.5V7c0-.8-.7-1.5-1.48-1.5H11.5c0 1.5 0 2-1 2h-2" />\n <path stroke="#8caaee" d="M2.98 10.5H4.5c0-1.5 0-2 1-2h2M7.5 3.5v0" />\n <path stroke="#e5c890" d="m 8.5,12.5 v 0" />\n </g>\n</svg>\n\n';case"shell":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round">\n <path d="M2 15.5c-.7 0-1.5-.8-1.5-1.5V5c0-.7.8-1.5 1.5-1.5h9c.7 0 1.5.8 1.5 1.5v9c0 .7-.8 1.5-1.5 1.5z" />\n <path d="m1.2 3.8 3.04-2.5S5.17.5 5.7.5h8.4c.66 0 1.4.73 1.4 1.4v7.73a2.7 2.7 0 01-.7 1.75l-2.68 3.51M3 8.5l3 2-3 2m4 0h2" />\n </g>\n</svg>\n\n';case"markdown":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#85c1dc" stroke-linecap="round" stroke-linejoin="round" d="m9.25 8.25 2.25 2.25 2.25-2.25M3.5 11V5.5l2.04 3 1.96-3V11m4-.5V5M1.65 2.5h12.7c.59 0 1.15.49 1.15 1v9c0 .51-.56 1-1.15 1H1.65c-.59 0-1.15-.49-1.15-1V3.58c0-.5.56-1.08 1.15-1.08" />\n</svg>\n\n';case"mermaid":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ca9ee6" stroke-linecap="round" stroke-linejoin="round" d="M1.5 2.5c0 6 2.25 5.75 4 7 .83.67 1.17 2 1 4h3c-.17-2 .17-3.33 1-4 1.75-1.25 4-1 4-7C12 2.5 10 3 8 7 6 3 4 2.5 1.5 2.5" />\n</svg>\n\n';case"svg":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#ef9f76" stroke-linecap="round" stroke-linejoin="round" d="m4.54 10 6.92-4m-6.92 4a1.5 1.5 0 10-2.6 1.5 1.5 1.5 0 002.6-1.5M8 4v8m0-8a1.5 1.5 0 100-3 1.5 1.5 0 000 3M4.54 6l6.92 4M4.54 6a1.5 1.5 0 10-2.6-1.5A1.5 1.5 0 004.54 6M8 12a1.5 1.5 0 100 3 1.5 1.5 0 000-3m3.46-2a1.5 1.5 0 102.6 1.5 1.5 1.5 0 00-2.6-1.5m0-4a1.5 1.5 0 102.6-1.5 1.5 1.5 0 00-2.6 1.5" />\n</svg>\n\n';case"vue":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#a6d189" stroke-linecap="round" stroke-linejoin="round">\n <path d="M1 1.5h5.44L8 4.56 9.56 1.5H15l-6.99 13z" />\n <path d="M12.05 1.73 8 9.28 3.95 1.73" />\n </g>\n</svg>\n\n';case"cpp":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="m 2.5559121,12.951629 c 2.7459832,2.734744 7.1981158,2.734744 9.9441189,0 l -1.789955,-1.782586 c -1.7574201,1.750224 -4.606788,1.750224 -6.3642295,0 -1.7574416,-1.7502236 -1.7574416,-4.587893 0,-6.338097 1.7574415,-1.750224 4.6068094,-1.750224 6.3642295,0 l 0.894977,-0.8912929 0.894978,-0.891293 c -2.7460031,-2.73472867 -7.198136,-2.73472867 -9.9441191,0 -2.74598585,2.7347089 -2.74598585,7.1685599 2e-7,9.9032689 z" clip-rule="evenodd" />\n <path fill="none" stroke="#8caaee" stroke-linecap="round" stroke-linejoin="round" d="M7.5 6v4M5.513524 7.9999996H9.51304M13.486476 5.9999996v4M11.5 7.9999992h3.999516" />\n</svg>\n\n';case"plain":return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16">\n <g fill="none" stroke="#c6d0f5" stroke-linecap="round" stroke-linejoin="round">\n <path d="M13.5 6.5v6a2 2 0 01-2 2h-7a2 2 0 01-2-2v-9c0-1.1.9-2 2-2h4.01" />\n <path d="m8.5 1.5 5 5h-4a1 1 0 01-1-1zm-3 10h5m-5-3h5m-5-3h1" />\n </g>\n</svg>\n\n';default:return'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="16" height="16">\x3c!-- Icon from Lucide by Lucide Contributors - https://github.com/lucide-icons/lucide/blob/main/LICENSE --\x3e<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m10 9l-3 3l3 3m4 0l3-3l-3-3"/><rect width="18" height="18" x="3" y="3" rx="2"/></g></svg>\n\n'}}const me={javascript:"JavaScript",typescript:"TypeScript",jsx:"JSX",tsx:"TSX",shell:"Shell",plain:"Text",text:"Text",markdown:"Markdown",json:"JSON",python:"Python",cpp:"C++",vue:"Vue",html:"HTML",css:"CSS",svg:"SVG",mermaid:"Mermaid"};function he(e){const n=t(()=>{const t=e.code||"",n=t.trim().toLowerCase();return n.startsWith("<!doctype")||n.startsWith("<html")||n.startsWith("<body")?t:`<!doctype html>\n<html lang="en">\n <head>\n <meta charset="utf-8" />\n <meta name="viewport" content="width=device-width, initial-scale=1" />\n <style>\n html, body {\n margin: 0;\n padding: 0;\n height: 100%;\n background-color: ${e.isDark?"#020617":"#ffffff"};\n color: ${e.isDark?"#e5e7eb":"#020617"};\n }\n body {\n font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', ui-sans-serif, sans-serif;\n }\n </style>\n </head>\n <body>\n ${t}\n </body>\n</html>`},[e.code,e.isDark]);return s(()=>{const t=t=>{var n;"Escape"!==t.key&&"Esc"!==t.key||null==(n=e.onClose)||n.call(e)};return"undefined"!=typeof window&&window.addEventListener("keydown",t),()=>{"undefined"!=typeof window&&window.removeEventListener("keydown",t)}},[e]),"undefined"==typeof document?null:x(
|
|
9
9
|
/* @__PURE__ */C.jsx("div",{className:"html-preview-frame__backdrop"+(e.isDark?" html-preview-frame__backdrop--dark":""),onClick:()=>{var t;return null==(t=e.onClose)?void 0:t.call(e)},children:/* @__PURE__ */C.jsxs("div",{className:"html-preview-frame"+(e.isDark?" html-preview-frame--dark":""),onClick:e=>e.stopPropagation(),children:[
|
|
10
10
|
/* @__PURE__ */C.jsxs("div",{className:"html-preview-frame__header",children:[
|
|
@@ -12,8 +12,8 @@ return C.jsx("span",{className:"checkbox-node",children:/* @__PURE__ */C.jsx("in
|
|
|
12
12
|
/* @__PURE__ */C.jsx("span",{className:"html-preview-frame__dot"}),
|
|
13
13
|
/* @__PURE__ */C.jsx("span",{className:"html-preview-frame__label",children:e.title||"Preview"})]}),
|
|
14
14
|
/* @__PURE__ */C.jsx("button",{type:"button",className:"html-preview-frame__close"+(e.isDark?" html-preview-frame__close--dark":""),onClick:()=>{var t;return null==(t=e.onClose)?void 0:t.call(e)},children:"×"})]}),
|
|
15
|
-
/* @__PURE__ */C.jsx("iframe",{className:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcDoc:n,title:e.title||"Preview"})]})}),document.body)}let pe=!1,fe=null,ge=!1;async function xe(){if(fe)return fe;if(ge)return null;try{return fe=await import("stream-monaco"),await async function(e){
|
|
16
|
-
return C.jsx("pre",{className:o,"aria-busy":!0===(null==e?void 0:e.loading),"aria-label":i,"data-language":r,tabIndex:0,children:/* @__PURE__ */C.jsx("code",{translate:"no",children:String(null!=(n=null==e?void 0:e.code)?n:"")})})}const Pe={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0};function
|
|
15
|
+
/* @__PURE__ */C.jsx("iframe",{className:"html-preview-frame__iframe",sandbox:"allow-scripts allow-same-origin",srcDoc:n,title:e.title||"Preview"})]})}),document.body)}let pe=!1,fe=null,ge=!1;async function xe(){if(fe)return fe;if(ge)return null;try{return fe=await import("stream-monaco"),await async function(e){if(pe)return;pe=!0;const t=null==globalThis?void 0:globalThis.MonacoEnvironment;(!t||"function"!=typeof t.getWorker&&"function"!=typeof t.getWorkerUrl)&&(null==e?void 0:e.preloadMonacoWorkers)&&await e.preloadMonacoWorkers()}(fe),fe}catch{return ge=!0,null}}let we=null,ve=!1,ye=null,ke=null,be=null,je=null,Ce=null;const Me=/* @__PURE__ */new WeakMap;let Ne=0;function Se(e,t){const n=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=Me.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return Me.set(e,t),t}catch{}const n="__theme_"+ ++Ne;return Me.set(e,n),n}return String(e)}(e);return n?(we!==t&&(we=t),ve||Ce!==n?!ye||je!==n&&ke!==n?(be=e,je=n,ye||(ve=!0,ye=(async()=>{for(;null!=be&&null!=je;){const e=be,t=je;if(be=null,je=null,Ce===t)continue;const n=we;if(!n)break;try{ke=t,await Promise.resolve(n(e)),Ce=t}catch{}}})().finally(()=>{ve=!1,ye=null,ke=null}),ye)):ye:Promise.resolve()):Promise.resolve()}let Le=null,Be=null,Ee=null;const Te=/* @__PURE__ */new Set,_e=/* @__PURE__ */new WeakMap;let $e=0;function De(){for(const e of Array.from(Te))try{e()}catch{}}function Oe({node:e}){var n;const r=t(()=>function(e){var t;return String(null!=(t=String(null!=e?e:"").split(/\s+/g)[0])?t:"").toLowerCase().replace(/[^\w-]/g,"")||"plaintext"}(null==e?void 0:e.language),[e]),o=`language-${r}`,i=r?`Code block: ${r}`:"Code block";/* @__PURE__ */
|
|
16
|
+
return C.jsx("pre",{className:o,"aria-busy":!0===(null==e?void 0:e.loading),"aria-label":i,"data-language":r,tabIndex:0,children:/* @__PURE__ */C.jsx("code",{translate:"no",children:String(null!=(n=null==e?void 0:e.code)?n:"")})})}const Pe={isShowPreview:!0,loading:!0,stream:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0};function We(e){var r;const o={...Pe,...e},{node:l,isDark:c,loading:d,stream:u,isShowPreview:m,enableFontSizeControl:h,darkTheme:p,lightTheme:f,monacoOptions:g,themes:x,minWidth:w,maxWidth:v,showHeader:y,showCopyButton:k,showExpandButton:b,showPreviewButton:j,showFontSizeButtons:M}=o,N=i(null),S=i(null),L=i(null),B=i(null),E=i(null),T=i(null),_=i(null),$=i(0),D=i(null),P=i(null),W=O(),R=i(g),A=i(x),I=i(g),[F,z]=n(!1),[H,V]=n(()=>"undefined"==typeof window),[K,X]=n(!1),[U,q]=n(!1),[Z,J]=n(!1),[G,Q]=n(()=>l.language||"plaintext"),[ee,te]=n(()=>ce(l.language)),[ne,re]=n(!1),[se,ae]=n(!1),[le,pe]=n(!1),[fe,ge]=n(!1),{t:we}=Y(),[ve,ye]=n(()=>{const e=Number(null==g?void 0:g.fontSize);return Number.isFinite(e)&&e>0?e:14}),[ke,be]=n(ve),je=a(()=>{var e,t;const n=null!=(t=null==(e=R.current)?void 0:e.MAX_HEIGHT)?t:500;if("number"==typeof n&&Number.isFinite(n))return Math.max(80,n);const r=String(n).match(/^(\d+(?:\.\d+)?)/),o=r?Number.parseFloat(r[1]):500;return Number.isFinite(o)?Math.max(80,o):500},[]),Ce=a(e=>{var t,n,r,o;if(F)return;const i=N.current,s=L.current;if(!i||!s)return;const a="diff"===T.current?null==(t=s.getDiffEditorView)?void 0:t.call(s):null==(n=s.getEditorView)?void 0:n.call(s);if(!a)return;const l=je();try{null==(r=a.updateOptions)||r.call(a,{automaticLayout:e})}catch{}e?(i.style.maxHeight="none",i.style.overflow="visible"):(i.style.maxHeight=`${Math.ceil(l)}px`,i.style.overflow="auto");try{const t=Number((()=>{if("function"==typeof a.getContentHeight)return a.getContentHeight();if("diff"===T.current&&"function"==typeof a.getModifiedEditor){const e=a.getModifiedEditor();if(e&&"function"==typeof e.getContentHeight)return e.getContentHeight()}})());if(Number.isFinite(t)&&t>0){const n=e?t:Math.min(t,l);i.style.height=`${Math.ceil(Math.max(120,n))}px`}null==(o=a.layout)||o.call(a)}catch{}},[je,F]);s(()=>{R.current=g},[g]),s(()=>{te(ce(l.language))},[l.language]);const Me=i(l);Me.current=l;const Ne=a(()=>{var e;$.current+=1;try{null==(e=B.current)||e.call(B)}catch{}E.current=null,T.current=null,_.current=null,J(!1),q(!1)},[]),_e=a(()=>{var e,t,n,r,o,i;const s=N.current,a=S.current;if(!s||!a)return;const l=null!=(e=s.querySelector(".monaco-editor"))?e:s;try{const e="undefined"!=typeof window&&window.getComputedStyle?window.getComputedStyle(l):null,s=String(null!=(t=null==e?void 0:e.getPropertyValue("--vscode-editor-foreground"))?t:"").trim()||String(null!=(n=null==e?void 0:e.color)?n:"").trim(),c=String(null!=(r=null==e?void 0:e.getPropertyValue("--vscode-editor-background"))?r:"").trim()||String(null!=(o=null==e?void 0:e.backgroundColor)?o:"").trim(),d=String(null!=(i=null==e?void 0:e.getPropertyValue("--vscode-editor-selectionBackground"))?i:"").trim();s&&a.style.setProperty("--vscode-editor-foreground",s),c&&a.style.setProperty("--vscode-editor-background",c),d&&a.style.setProperty("--vscode-editor-selectionBackground",d)}catch{}},[]);s(()=>()=>{var e,t,n;$.current+=1,null==(e=B.current)||e.call(B),B.current=null,E.current=null,T.current=null,_.current=null,D.current=null,null==(n=null==(t=P.current)?void 0:t.destroy)||n.call(t),P.current=null},[]),s(()=>{var e,t;if("undefined"==typeof window)return;if(H)return;const n=S.current;if(!n)return;null==(t=null==(e=P.current)?void 0:e.destroy)||t.call(e);const r=W(n,{rootMargin:"400px"});return P.current=r,r.isVisible()&&V(!0),r.whenVisible.then(()=>V(!0)),()=>{r.destroy(),P.current===r&&(P.current=null)}},[W,H]),s(()=>{let e=!0;return"undefined"==typeof window||(async()=>{var t,n;try{const r=await xe();if(!e)return;if(!r)return void z(!0);const o=r.useMonaco,i=r.detectLanguage;if("function"==typeof i&&(D.current=i),"function"!=typeof o)return void z(!0);const s=null!=(t=c?p:f)?t:Le,a={...I.current||{}},l=o({wordWrap:"on",wrappingIndent:"same",themes:A.current,theme:s,...a,onThemeChange(){_e()}});L.current=l,"function"==typeof(n=l.setTheme)&&(Ee=n,null!=Le&&null!=Be&&Se(Le,Ee).then(()=>De()).catch(()=>{})),B.current="function"==typeof l.safeClean?()=>l.safeClean():"function"==typeof l.cleanupEditor?()=>l.cleanupEditor():null,X(!0)}catch{e&&z(!0)}})(),()=>{e=!1}},[]),s(()=>{var e;if(!l.language&&!ee&&D.current)try{const t=D.current(String(null!=(e=l.code)?e:""));t&&Q(t)}catch{}},[ee,l.code,l.language]);const $e=t(()=>String(l.language||ee||G||"plaintext"),[ee,G,l.language]),We=t(()=>ce($e),[$e]),Re=t(()=>de(We),[We]),Ae=t(()=>ue(We),[We]),Ie=t(()=>!!m&&("html"===We||"svg"===We),[We,m]),Fe=t(()=>{const e=We;return e?me[e]||e.charAt(0).toUpperCase()+e.slice(1):me[""]||"Plain Text"},[We]),ze=t(()=>{var e,t,n;return l.diff?null!=(t=null!=(e=l.updatedCode)?e:l.code)?t:"":null!=(n=l.code)?n:""},[l.code,l.diff,l.updatedCode]),He=t(()=>{const e=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},t={},n=e(w),r=e(v);return n&&(t.minWidth=n),r&&(t.maxWidth=r),t},[w,v]),Ve=!1===u&&d,Ke=t(()=>c?p:f,[p,c,f]);s(()=>{if(F)return;if(!U||!H)return;const e=L.current;(null==e?void 0:e.setTheme)&&Ke&&Se(Ke,e.setTheme).then(_e).catch(()=>{})},[U,Ke,_e,F,H]),s(()=>{var e;if("undefined"!=typeof window)return e=()=>{_e()},Te.add(e),()=>{Te.delete(e)}},[_e]);const Xe=a(async()=>{var e,t;if(F)return null;if(!H)return null;if(le)return null;if(Ve)return null;const n=L.current,r=N.current;if(!n||!r||!n.createEditor)return null;const o=Me.current,i=o.diff?"diff":"single",s=_.current,a="diff"===i?Boolean(null==(e=n.getDiffEditorView)?void 0:e.call(n)):Boolean(null==(t=n.getEditorView)?void 0:t.call(n));if(T.current===i&&s===r&&a)return null;if(E.current)return E.current;$.current+=1;const l=$.current;q(!0);const c=(async()=>{var e,t,i,s,a,c,d,u,m,h;try{null==(e=B.current)||e.call(B),T.current=null,_.current=null,J(!1);const p=Re;if(o.diff?"function"==typeof n.createDiffEditor?(T.current="diff",await n.createDiffEditor(r,String(null!=(t=o.originalCode)?t:""),String(null!=(i=o.updatedCode)?i:""),p)):(T.current="single",await n.createEditor(r,String(null!=(a=null!=(s=o.updatedCode)?s:o.code)?a:""),p)):(T.current="single",await n.createEditor(r,String(null!=(c=o.code)?c:""),p)),_.current=r,$.current!==l)return;const f=Number(null==(d=R.current)?void 0:d.fontSize);if(Number.isFinite(f)&&f>0){ye(f),be(f);try{const e="diff"===T.current?null==(u=n.getDiffEditorView)?void 0:u.call(n):null==(m=n.getEditorView)?void 0:m.call(n);null==(h=null==e?void 0:e.updateOptions)||h.call(e,{fontSize:f,automaticLayout:!1})}catch{}}_e(),se||le||Ce(!1),J(!0)}catch{$.current===l&&z(!0)}})().finally(()=>{E.current===c&&(E.current=null)});return E.current=c,c},[Ce,le,se,Re,Ve,_e,F,H]);s(()=>{F||K&&H&&(le||Ve?Ne():Xe())},[le,Xe,K,Ne,Ve,F,H]),s(()=>{var e;if(F)return;if(!K)return;if(!H)return;if(le)return;if(Ve)return;const t=L.current;if(!t)return;const n=String(null!=(e=l.code)?e:"");(async()=>{var e,r;let o=ee;if(!o&&D.current)try{o=ce(D.current(n)),o&&te(o)}catch{}const i=de(o||We);if(t.createEditor&&N.current){try{await Promise.resolve(Xe())}catch{}const e=E.current;if(e)try{await e}catch{}}try{l.diff&&t.updateDiff?await Promise.resolve(t.updateDiff(String(null!=(e=l.originalCode)?e:""),String(null!=(r=l.updatedCode)?r:""),i)):t.updateCode&&await Promise.resolve(t.updateCode(n,i))}catch{}se&&Ce(!0)})()},[Ce,We,ee,le,U,Xe,se,K,l.code,l.diff,l.originalCode,l.updatedCode,Ve,F,H]),s(()=>{if(F)return;if(!K)return;if(!H)return;if(le)return;if(Ve)return;if(!se&&d)return;const e="undefined"!=typeof window&&"function"==typeof window.requestAnimationFrame?window.requestAnimationFrame(()=>Ce(se)):null;return null==e&&Ce(se),()=>{null!=e&&"undefined"!=typeof window&&"function"==typeof window.cancelAnimationFrame&&window.cancelAnimationFrame(e)}},[Ce,le,se,d,K,Ve,F,H]),s(()=>{var e,t,n;if(!h)return;if(F)return;const r=L.current;if(r){try{const o="diff"===T.current?null==(e=r.getDiffEditorView)?void 0:e.call(r):null==(t=r.getEditorView)?void 0:t.call(r);null==(n=null==o?void 0:o.updateOptions)||n.call(o,{fontSize:ke})}catch{}Ce(se)}},[Ce,h,se,ke,l.diff,F]);const Ue=a((e,t)=>{oe(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),c)},[c]),qe=a(()=>{ie()},[]),Ye=a(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(String(ze)),re(!0),null==(e=o.onCopy)||e.call(o,String(ze)),setTimeout(()=>re(!1),1e3)}catch{}},[o,ze]),Ze=a(()=>{if(!Ie)return;const e="html"===We?"text/html":"image/svg+xml",t="html"===We?we("artifacts.htmlPreviewTitle")||"HTML Preview":we("artifacts.svgPreviewTitle")||"SVG Preview";"function"!=typeof o.onPreviewCode?"html"===We&&ge(e=>!e):o.onPreviewCode({node:l,artifactType:e,artifactTitle:t,id:`temp-${We}-${Date.now()}`})},[We,Ie,l,o,we]);return F?/* @__PURE__ */C.jsx(Oe,{node:l}):/* @__PURE__ */C.jsxs("div",{ref:S,className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",c?"border-gray-700/30 bg-gray-900":"border-gray-200 bg-white",d?"is-rendering":"",c?"is-dark":""].join(" "),style:He,children:[y&&/* @__PURE__ */C.jsxs("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:`var(--vscode-editor-foreground, ${c?"#e5e7eb":"#111827"})`,backgroundColor:`var(--vscode-editor-background, ${c?"#111827":"#ffffff"})`},children:[
|
|
17
17
|
/* @__PURE__ */C.jsxs("div",{className:"flex items-center space-x-2 flex-1 overflow-hidden",children:[
|
|
18
18
|
/* @__PURE__ */C.jsx("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:Ae}}),
|
|
19
19
|
/* @__PURE__ */C.jsx("span",{className:"text-sm font-medium font-mono truncate",children:Fe})]}),
|
|
@@ -32,8 +32,8 @@ return C.jsx("pre",{className:o,"aria-busy":!0===(null==e?void 0:e.loading),"ari
|
|
|
32
32
|
/* @__PURE__ */C.jsx("div",{ref:N,className:"code-editor-container"+(u?"":" code-height-placeholder"),style:{visibility:Z?"visible":"hidden"},"aria-hidden":!Z}),!Z&&/* @__PURE__ */C.jsx("div",{style:{position:"absolute",inset:0,overflow:"auto",padding:"1rem"},children:/* @__PURE__ */C.jsx("pre",{className:"code-fallback-plain m-0","aria-busy":d,"aria-label":`Code block: ${Fe}`,tabIndex:0,children:/* @__PURE__ */C.jsx("code",{translate:"no",children:String(ze)})})})]})),!u&&d&&/* @__PURE__ */C.jsx("div",{className:"code-loading-placeholder",children:/* @__PURE__ */C.jsxs("div",{className:"loading-skeleton",children:[
|
|
33
33
|
/* @__PURE__ */C.jsx("div",{className:"skeleton-line"}),
|
|
34
34
|
/* @__PURE__ */C.jsx("div",{className:"skeleton-line"}),
|
|
35
|
-
/* @__PURE__ */C.jsx("div",{className:"skeleton-line short"})]})})]}),fe&&!o.onPreviewCode&&Ie&&"html"===
|
|
36
|
-
/* @__PURE__ */C.jsx("span",{className:"sr-only","aria-live":"polite",role:"status",children:ne?we("common.copied")||"Copied":""})]})}function
|
|
35
|
+
/* @__PURE__ */C.jsx("div",{className:"skeleton-line short"})]})})]}),fe&&!o.onPreviewCode&&Ie&&"html"===We&&/* @__PURE__ */C.jsx(he,{code:String(null!=(r=l.code)?r:""),isDark:c,onClose:()=>ge(!1)}),
|
|
36
|
+
/* @__PURE__ */C.jsx("span",{className:"sr-only","aria-live":"polite",role:"status",children:ne?we("common.copied")||"Copied":""})]})}function Re(e){const{node:t,ctx:n,renderNode:r,indexKey:o}=e,i=Array.isArray(t.items)?t.items:[];/* @__PURE__ */
|
|
37
37
|
return C.jsx("dl",{className:"definition-list","data-index-key":o,children:i.map((e,t)=>/* @__PURE__ */C.jsxs("div",{className:"mb-4",children:[
|
|
38
38
|
/* @__PURE__ */C.jsx("dt",{className:"definition-term font-semibold",children:n&&r?L(e.term,n,`${String(null!=o?o:"definition")}-term-${t}`,r):null}),
|
|
39
39
|
/* @__PURE__ */C.jsx("dd",{className:"definition-desc ml-4",children:n&&r?L(e.definition,n,`${String(null!=o?o:"definition")}-desc-${t}`,r):null})]},`${String(null!=o?o:"definition")}-${t}`))})}function Ae(e){var t;const{node:n}=e;/* @__PURE__ */
|
|
@@ -42,8 +42,8 @@ return C.jsx("em",{className:"emphasis-node",children:e.children})}function Fe(e
|
|
|
42
42
|
return C.jsx("a",{className:"footnote-anchor text-sm text-[#0366d6] hover:underline cursor-pointer",href:`#fnref-${t.id}`,title:`Back to reference ${t.id}`,onClick:n,children:"↩︎"})}function ze(e){const{node:t,ctx:n,renderNode:r,indexKey:o}=e;/* @__PURE__ */
|
|
43
43
|
return C.jsx("div",{id:`footnote-${t.id}`,className:"footnote-node flex mt-2 mb-2 text-sm leading-relaxed border-t border-[#eaecef] pt-2",children:/* @__PURE__ */C.jsx("div",{className:"flex-1",children:n&&r?S(t.children,n,String(null!=o?o:`footnote-${t.id}`),r):null})})}function He(e){const{node:n}=e,r=t(()=>`#footnote-${n.id}`,[n.id]),o=a(e=>{if(e.preventDefault(),"undefined"==typeof document)return;const t=document.querySelector(r);t&&t.scrollIntoView({behavior:"smooth"})},[r]);/* @__PURE__ */
|
|
44
44
|
return C.jsx("sup",{id:`fnref-${n.id}`,className:"footnote-reference",onClick:o,children:/* @__PURE__ */C.jsxs("a",{href:r,title:`View footnote ${n.id}`,className:"footnote-link cursor-pointer",children:["[",n.id,"]"]})})}function Ve(e){/* @__PURE__ */
|
|
45
|
-
return C.jsx("br",{className:"hard-break"})}function Ke(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Ke(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Xe(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ke(e))&&(r&&(r+=" "),r+=t);return r}function Ue(e){const{node:t,ctx:n,renderNode:r,indexKey:o,children:i}=e,s=Math.min(6,Math.max(1,Number(t.level)||1)),a=`h${s}
|
|
46
|
-
return C.jsx(a,{dir:"auto",className:Xe("heading-node font-semibold",`heading-${s}
|
|
45
|
+
return C.jsx("br",{className:"hard-break"})}function Ke(e){var t,n,r="";if("string"==typeof e||"number"==typeof e)r+=e;else if("object"==typeof e)if(Array.isArray(e)){var o=e.length;for(t=0;t<o;t++)e[t]&&(n=Ke(e[t]))&&(r&&(r+=" "),r+=n)}else for(n in e)e[n]&&(r&&(r+=" "),r+=n);return r}function Xe(){for(var e,t,n=0,r="",o=arguments.length;n<o;n++)(e=arguments[n])&&(t=Ke(e))&&(r&&(r+=" "),r+=t);return r}function Ue(e){const{node:t,ctx:n,renderNode:r,indexKey:o,children:i}=e,s=Math.min(6,Math.max(1,Number(t.level)||1)),a=`h${s}`,l=null==t?void 0:t.attrs,{class:c,className:d,style:u,...m}=null!=l?l:{};/* @__PURE__ */
|
|
46
|
+
return C.jsx(a,{dir:"auto",className:Xe("heading-node font-semibold",`heading-${s}`,c,d),..."object"==typeof u&&null!=u?{style:u}:{},...m,children:null!=i?i:n&&r?S(t.children,n,String(null!=o?o:`heading-${s}`),r):null})}function qe(e){/* @__PURE__ */
|
|
47
47
|
return C.jsx("mark",{className:"highlight-node",children:e.children})}const Ye=/* @__PURE__ */new Set(["onclick","onerror","onload","onmouseover","onmouseout","onmousedown","onmouseup","onkeydown","onkeyup","onfocus","onblur","onsubmit","onreset","onchange","onselect","ondblclick"]),Ze=/* @__PURE__ */new Set(["script"]),Je=/* @__PURE__ */new Set(["href","src","srcset","xlink:href","formaction"]);function Ge(e){const t=function(e){let t="";for(const n of e){const e=n.charCodeAt(0);e<=31||127===e||/\s/u.test(n)||(t+=n)}return t}(e).toLowerCase();return!(!t.startsWith("javascript:")&&!t.startsWith("vbscript:"))||!!t.startsWith("data:")&&!(t.startsWith("data:image/")||t.startsWith("data:video/")||t.startsWith("data:audio/"))}const Qe=/* @__PURE__ */new Set(["a","abbr","address","area","article","aside","audio","b","base","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","head","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","link","main","map","mark","menu","meta","meter","nav","noscript","object","ol","optgroup","option","output","p","param","picture","pre","progress","q","rp","rt","ruby","s","samp","script","section","select","small","source","span","strong","style","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","title","tr","track","u","ul","var","video","wbr"]),et=/* @__PURE__ */new Set(["area","base","br","col","embed","hr","img","input","link","meta","param","source","track","wbr"]);function tt(e){return e.startsWith("--")?e:e.replace(/-([a-z])/g,(e,t)=>t.toUpperCase())}function nt(e){const t={...e};if(Object.prototype.hasOwnProperty.call(t,"class")&&(t.className=t.class,delete t.class),Object.prototype.hasOwnProperty.call(t,"for")&&(t.htmlFor=t.for,delete t.for),"string"==typeof t.style){const e=function(e){const t=e.trim();if(!t)return;const n={};for(const r of t.split(";")){const e=r.trim();if(!e)continue;const t=e.indexOf(":");if(-1===t)continue;const o=tt(e.slice(0,t).trim()),i=e.slice(t+1).trim();o&&(n[o]=i)}return Object.keys(n).length?n:void 0}(t.style);e?t.style=e:delete t.style}return t}function rt(e){const t={};for(const[n,r]of Object.entries(e)){const e=n.toLowerCase();Ye.has(e)||Je.has(e)&&r&&Ge(r)||(t[n]=r)}return t}function ot(e,t){const n=e.toLowerCase();return!Qe.has(n)&&(Object.prototype.hasOwnProperty.call(t,n)||Object.prototype.hasOwnProperty.call(t,e))}function it(r){const{node:o,placeholder:a,customId:c}=r,d=O(),[u,m]=n(null),h=i(null),[p,f]=n(()=>"undefined"==typeof window),[g,x]=n(o.content),w=Boolean(o.loading),v=l(I,F,F),y=t(()=>{var e;return null!=(e=r.customComponents)?e:H(c)},[c,r.customComponents,v]);s(()=>{var e;if("undefined"==typeof window)return void f(!0);if(null==(e=h.current)||e.destroy(),h.current=null,!w)return f(!0),void x(o.content);if(!u)return void f(!1);const t=d(u,{rootMargin:"400px"});return h.current=t,t.isVisible()&&f(!0),t.whenVisible.then(()=>f(!0)).catch(()=>{}),()=>{t.destroy(),h.current=null}},[u,w,o.content,d]),s(()=>()=>{var e;null==(e=h.current)||e.destroy(),h.current=null},[]),s(()=>{w&&!p||x(o.content)},[w,o.content,p]);const k=t(()=>{var e;return N(null!=(e=o.attrs)?e:void 0)},[o.attrs]),b=t(()=>{var e;return function(e,t){const n=/<([a-z][a-z0-9-]*)\b[^>]*>/gi;let r;for(;null!==(r=n.exec(e));)if(ot(r[1],t))return!0;return!1}(null!=(e=o.content)?e:"",y)},[y,o.content]),j=t(()=>b&&o.content?function(t,n){if(!t)return[];try{const r=function(e){var t,n,r;const o=[];let i=0;for(;i<e.length;){if(e.startsWith("\x3c!--",i)){const t=e.indexOf("--\x3e",i);if(-1!==t){i=t+3;continue}break}const s=e.indexOf("<",i);if(-1===s){i<e.length&&e.slice(i).trim()&&o.push({type:"text",content:e.slice(i)});break}if(s>i){const t=e.slice(i,s);t.trim()&&o.push({type:"text",content:t})}const a=e.indexOf(">",s);if(-1===a)break;const l=e.slice(s+1,a).trim(),c=l.startsWith("/"),d=l.endsWith("/");if(c)o.push({type:"tag_close",tagName:l.slice(1).trim()});else{const e=l.indexOf(" ");let i,s="";-1===e?i=d?l.slice(0,-1).trim():l.trim():(i=l.slice(0,e).trim(),s=l.slice(e+1));const a={};if(s){const e=/([^\s=]+)(?:=(?:"([^"]*)"|'([^']*)'|(\S*)))?/g;let o;for(;null!==(o=e.exec(s));){const e=o[1],i=null!=(r=null!=(n=null!=(t=o[2])?t:o[3])?n:o[4])?r:"";e&&!e.endsWith("/")&&(a[e]=i)}}o.push({type:d||et.has(i.toLowerCase())?"self_closing":"tag_open",tagName:i,attrs:a})}i=a+1}return o}(t);let o=0;const i=[],s=[];for(const t of r)if("text"===t.type){if(i.length>0&&i[i.length-1].blocked)continue;(i.length>0?i[i.length-1].children:s).push(t.content)}else if("self_closing"===t.type){if(Ze.has(t.tagName.toLowerCase()))continue;const r=rt(t.attrs||{}),a=r.key,l=null!=a&&""!==a?a:"ms-html-"+o++,c=ot(t.tagName,n)?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0;c?(i.length>0?i[i.length-1].children:s).push(e.createElement(c,{...r,key:l})):(i.length>0?i[i.length-1].children:s).push(e.createElement(t.tagName,{...nt(r),key:l,suppressHydrationWarning:!0}))}else if("tag_open"===t.type)i.push({tagName:t.tagName,children:[],attrs:t.attrs,blocked:Ze.has(t.tagName.toLowerCase())});else if("tag_close"===t.type){const t=i.pop();if(t){if(t.blocked)continue;const r=rt(t.attrs||{}),a=r.key,l=null!=a&&""!==a?a:"ms-html-"+o++,c=ot(t.tagName,n)?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0,d=c?e.createElement(c,{...r,key:l},...t.children):e.createElement(t.tagName,{...nt(r),key:l,suppressHydrationWarning:!0},...t.children);i.length>0?i[i.length-1].children.push(d):s.push(d)}}for(;i.length>0;){const t=i.pop();if(t.blocked)continue;const r=rt(t.attrs||{}),a=r.key,l=null!=a&&""!==a?a:"ms-html-"+o++,c=ot(t.tagName,n)?n[t.tagName]||n[t.tagName.toLowerCase()]:void 0,d=c?e.createElement(c,{...r,key:l},...t.children):e.createElement(t.tagName,{...nt(r),key:l,suppressHydrationWarning:!0},...t.children);s.push(d)}return s}catch{return null}}(o.content,y):null,[y,o.content,b]);/* @__PURE__ */
|
|
48
48
|
return C.jsx("div",{ref:m,className:"html-block-node",...k,children:p?b&&j?/* @__PURE__ */C.jsx(C.Fragment,{children:j}):/* @__PURE__ */C.jsx("div",{dangerouslySetInnerHTML:{__html:null!=g?g:""}}):/* @__PURE__ */C.jsx("div",{className:"html-block-node__placeholder",children:null!=a?a:/* @__PURE__ */C.jsxs(C.Fragment,{children:[
|
|
49
49
|
/* @__PURE__ */C.jsx("span",{className:"html-block-node__placeholder-bar"}),
|
|
@@ -59,7 +59,7 @@ return C.jsxs("figure",{ref:p,className:"image-node",children:[
|
|
|
59
59
|
/* @__PURE__ */C.jsx("path",{d:"M21.2155 128.398C12.6555 128.616 6.16484 128.339 3.16751 131.56C-0.0538222 134.56 0.218178 141.054 -0.000488281 149.608C0.218178 158.168 -0.0538222 164.659 3.16751 167.656C6.16484 170.878 12.6555 170.606 21.2155 170.824C25.0262 170.726 28.4288 170.726 31.2955 170.475C32.7968 170.342 34.1488 170.136 35.3382 169.814C35.3542 169.811 35.3648 169.806 35.3782 169.803C35.4768 169.774 35.5755 169.747 35.6688 169.718C37.1568 169.272 38.3648 168.622 39.2635 167.656C40.1915 166.795 40.8262 165.646 41.2715 164.243C41.2875 164.174 41.3115 164.102 41.3328 164.035C41.3328 164.035 41.3355 164.032 41.3355 164.027C41.3968 163.827 41.4529 163.622 41.5062 163.406C41.5062 163.398 41.5115 163.392 41.5142 163.382C41.7542 162.392 41.9222 161.294 42.0422 160.096C42.0555 159.944 42.0715 159.792 42.0848 159.635C42.3328 156.779 42.3328 153.398 42.4262 149.608C42.2075 141.054 42.4848 134.56 39.2635 131.56C36.2635 128.339 29.7728 128.616 21.2155 128.398Z",fill:"#FFCCCC"}),
|
|
60
60
|
/* @__PURE__ */C.jsx("path",{d:"M81.0595 184.171C70.8568 184.433 63.1208 184.102 59.5475 187.942C55.7075 191.518 56.0328 199.254 55.7742 209.454C56.0328 219.657 55.7075 227.393 59.5475 230.963C63.1208 234.803 70.8568 234.478 81.0595 234.739C85.6008 234.622 89.6595 234.622 93.0728 234.323C94.8648 234.163 96.4755 233.921 97.8942 233.534C97.9102 233.529 97.9235 233.526 97.9422 233.521C98.0568 233.486 98.1742 233.457 98.2888 233.422C100.06 232.889 101.5 232.113 102.569 230.963C103.676 229.937 104.433 228.566 104.964 226.894C104.985 226.811 105.012 226.726 105.036 226.646C105.041 226.643 105.041 226.643 105.041 226.638C105.116 226.401 105.18 226.153 105.244 225.897C105.244 225.889 105.249 225.881 105.254 225.867C105.54 224.689 105.74 223.379 105.881 221.953C105.9 221.771 105.916 221.59 105.934 221.403C106.228 218.001 106.228 213.969 106.342 209.454C106.081 199.254 106.412 191.518 102.572 187.942C98.9955 184.102 91.2568 184.433 81.0595 184.171Z",fill:"#FF939F"}),
|
|
61
61
|
/* @__PURE__ */C.jsx("path",{d:"M260.591 151.87C215.652 151.87 203.02 164.523 203.02 209.462H198.476C198.476 164.523 185.836 151.881 140.895 151.881V147.337C185.836 147.337 198.487 134.705 198.487 89.7659H203.02C203.02 134.705 215.652 147.337 260.591 147.337V151.87ZM286.052 124.158C281.82 119.614 272.66 120.001 260.591 119.689C248.521 119.385 239.361 119.771 235.129 115.227C230.585 110.995 230.983 101.846 230.671 89.7659C230.513 83.7312 230.535 78.4272 230.023 74.1019C229.513 69.7659 228.481 66.4219 226.209 64.3046C221.967 59.7606 212.817 60.1472 200.748 59.8459C188.681 60.1472 179.519 59.7606 175.287 64.3046C170.753 68.5366 171.129 77.6966 170.828 89.7659C170.516 101.835 170.9 110.995 166.356 115.227C162.124 119.771 152.985 119.374 140.905 119.689C138.873 119.739 136.924 119.771 135.071 119.811C119.313 118.697 106.337 112.318 106.337 89.7659C106.212 84.6699 106.233 80.1792 105.807 76.5206C105.367 72.8726 104.492 70.0379 102.575 68.2566C99.0013 64.4112 91.2573 64.7446 81.0653 64.4832C70.86 64.7446 63.1186 64.4112 59.5533 68.2566C55.708 71.8299 56.0306 79.5632 55.7693 89.7659C56.0306 99.9686 55.708 107.702 59.5533 111.278C63.1186 115.113 70.86 114.79 81.0653 115.049C103.617 115.049 109.996 128.035 111.1 143.803C111.068 145.659 111.028 147.587 110.975 149.619C111.121 154.987 111.121 159.79 111.476 163.835C111.663 165.95 111.945 167.857 112.404 169.534C112.412 169.555 112.412 169.566 112.423 169.598C112.465 169.734 112.497 169.867 112.537 170.003C113.164 172.099 114.092 173.809 115.447 175.07C116.665 176.371 118.281 177.278 120.271 177.905C120.364 177.934 120.46 177.955 120.564 177.987C120.855 178.081 121.145 178.153 121.439 178.238C121.46 178.238 121.471 178.238 121.479 178.249C122.876 178.582 124.42 178.822 126.108 178.987C126.327 179.009 126.545 179.03 126.764 179.051C130.788 179.395 135.559 179.395 140.905 179.529C152.975 179.843 162.124 179.457 166.356 184.001C170.9 188.233 170.516 197.371 170.828 209.451C171.129 221.529 170.743 230.681 175.287 234.91C179.519 239.454 188.681 239.07 200.748 239.371C206.127 239.235 210.921 239.235 214.975 238.881C217.079 238.694 218.985 238.403 220.676 237.955C220.695 237.945 220.705 237.934 220.727 237.934C220.873 237.891 220.999 237.859 221.135 237.819C223.228 237.193 224.937 236.265 226.209 234.91C227.511 233.691 228.409 232.065 229.044 230.097C229.065 230.003 229.095 229.899 229.127 229.803V229.793C229.22 229.513 229.295 229.222 229.367 228.918C229.367 228.897 229.377 228.897 229.377 228.878C229.721 227.481 229.951 225.937 230.127 224.249C230.137 224.03 230.169 223.811 230.191 223.593C230.535 219.571 230.535 214.798 230.671 209.451C230.972 197.371 230.585 188.233 235.129 184.001C239.361 179.457 248.511 179.843 260.591 179.529C272.66 179.227 281.82 179.614 286.052 175.07C290.596 170.838 290.209 161.689 290.511 149.619C290.209 137.539 290.596 128.379 286.052 124.158Z",fill:"#FF356A"}),
|
|
62
|
-
/* @__PURE__ */C.jsx("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),Nt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function St(e){const t={...Nt,...e},{t:r}=Y(),[o,l]=n(!1),[c,d]=n(!1),[u,m]=n(!1),[h,p]=n("360px"),[f,g]=n(!1),[w,v]=n(1),[y,k]=n({x:0,y:0}),[b,j]=n(!1),M=i(null),N=i(null),S=i(null),L=i({x:0,y:0}),B=i(null),E=t.node.code,T=a(async()=>{var e,n;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(E)),l(!0),null==(n=t.onCopy)||n.call(t,E),setTimeout(()=>l(!1),1e3)}catch{}},[E,t]),_=a(async()=>{var e,t;if(!M.current)return;const n=M.current;try{const r=await async function(){return Ct||jt||(jt=import("@antv/infographic").then(e=>{const t=e&&e.default?e.default:e;let n=t;return"function"==typeof t&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),Ct=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),jt)}();if(!r)return void console.warn("Infographic library failed to load.");B.current&&(null==(t=(e=B.current).destroy)||t.call(e),B.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});B.current=o,o.render(E),setTimeout(()=>{if(n){const e=n.scrollHeight;e>0&&p(`${Math.min(e,800)}px`)}},0)}catch(r){console.error("Failed to render infographic:",r),n.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${r instanceof Error?r.message:"Unknown error"}</div>`}},[E]);s(()=>{u||c||_()},[E,u,c,_]),s(()=>()=>{var e,t;B.current&&(null==(t=(e=B.current).destroy)||t.call(e),B.current=null)},[]);const $=a(()=>{g(!1),N.current&&(N.current.innerHTML=""),S.current=null,document.body.style.overflow=""},[]),D=a(()=>{g(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!f)return;const e=e=>{"Escape"===e.key&&$()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f,$]),s(()=>{f&&setTimeout(()=>{if(M.current&&N.current){N.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=M.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),N.current.appendChild(e),S.current=e,e.style.transform=`translate(${y.x}px, ${y.y}px) scale(${w})`}},0)},[f]),s(()=>{f&&S.current&&(S.current.style.transform=`translate(${y.x}px, ${y.y}px) scale(${w})`)},[f,y,w]);const O=a(()=>{var e;const t=null==(e=M.current)?void 0:e.querySelector("svg");if(!t)return;const n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},[]),P=e=>{j(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;L.current={x:t-y.x,y:n-y.y}},
|
|
62
|
+
/* @__PURE__ */C.jsx("path",{d:"M112.405 49.848C112.411 49.8694 112.416 49.8827 112.421 49.904C112.461 50.0427 112.499 50.1814 112.539 50.3147C113.171 52.4134 114.088 54.1147 115.448 55.384C116.661 56.6907 118.283 57.5894 120.264 58.2134C120.36 58.24 120.464 58.2694 120.555 58.3014C120.56 58.3067 120.56 58.3067 120.565 58.3067C120.848 58.3947 121.141 58.4694 121.443 58.5467C121.453 58.5467 121.464 58.552 121.48 58.5574C122.875 58.896 124.424 59.1334 126.112 59.3014C126.325 59.3227 126.541 59.3414 126.763 59.3627C130.789 59.712 135.56 59.712 140.904 59.8454C152.973 59.5387 162.128 59.928 166.36 55.384C170.907 51.152 170.515 41.9947 170.824 29.9254C170.517 17.8507 170.907 8.69602 166.363 4.46935C162.131 -0.0746511 152.973 0.309349 140.904 1.52588e-05C128.829 0.309349 119.675 -0.0746511 115.448 4.46935C110.904 8.69602 111.288 17.8507 110.979 29.9254C111.117 35.3014 111.117 40.1014 111.472 44.144C111.661 46.2614 111.949 48.1707 112.405 49.848Z",fill:"#FF6376"})]})}),Nt={maxHeight:"500px",loading:!0,showHeader:!0,showCopyButton:!0,showCollapseButton:!0,showModeToggle:!0,showExportButton:!0,showFullscreenButton:!0,showZoomControls:!0};function St(e){const t={...Nt,...e},{t:r}=Y(),[o,l]=n(!1),[c,d]=n(!1),[u,m]=n(!1),[h,p]=n("360px"),[f,g]=n(!1),[w,v]=n(1),[y,k]=n({x:0,y:0}),[b,j]=n(!1),M=i(null),N=i(null),S=i(null),L=i({x:0,y:0}),B=i(null),E=t.node.code,T=a(async()=>{var e,n;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(E)),l(!0),null==(n=t.onCopy)||n.call(t,E),setTimeout(()=>l(!1),1e3)}catch{}},[E,t]),_=a(async()=>{var e,t;if(!M.current)return;const n=M.current;try{const r=await async function(){return Ct||jt||(jt=import("@antv/infographic").then(e=>{const t=e&&e.default?e.default:e;let n=t;return"function"==typeof t&&t.prototype&&t.prototype.render?n=t:e.Infographic?n=e.Infographic:t&&t.Infographic&&(n=t.Infographic),Ct=n,n}).catch(e=>(console.warn("Failed to load @antv/infographic",e),null)),jt)}();if(!r)return void console.warn("Infographic library failed to load.");B.current&&(null==(t=(e=B.current).destroy)||t.call(e),B.current=null),n.innerHTML="";const o=new r({container:n,width:"100%",height:"100%"});B.current=o,o.render(E),setTimeout(()=>{if(n){const e=n.scrollHeight;e>0&&p(`${Math.min(e,800)}px`)}},0)}catch(r){console.error("Failed to render infographic:",r),n.innerHTML=`<div class="text-red-500 p-4">Failed to render infographic: ${r instanceof Error?r.message:"Unknown error"}</div>`}},[E]);s(()=>{u||c||_()},[E,u,c,_]),s(()=>()=>{var e,t;B.current&&(null==(t=(e=B.current).destroy)||t.call(e),B.current=null)},[]);const $=a(()=>{g(!1),N.current&&(N.current.innerHTML=""),S.current=null,document.body.style.overflow=""},[]),D=a(()=>{g(!0),document.body.style.overflow="hidden"},[]);s(()=>{if(!f)return;const e=e=>{"Escape"===e.key&&$()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[f,$]),s(()=>{f&&setTimeout(()=>{if(M.current&&N.current){N.current.innerHTML="";const e=document.createElement("div");Object.assign(e.style,{transition:"transform 0.1s ease",transformOrigin:"center center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"});const t=M.current.cloneNode(!0);t.classList.add("fullscreen"),t.style.height="auto",e.appendChild(t),N.current.appendChild(e),S.current=e,e.style.transform=`translate(${y.x}px, ${y.y}px) scale(${w})`}},0)},[f]),s(()=>{f&&S.current&&(S.current.style.transform=`translate(${y.x}px, ${y.y}px) scale(${w})`)},[f,y,w]);const O=a(()=>{var e;const t=null==(e=M.current)?void 0:e.querySelector("svg");if(!t)return;const n=(new XMLSerializer).serializeToString(t),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`infographic-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)},[]),P=e=>{j(!0);const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;L.current={x:t-y.x,y:n-y.y}},W=e=>{if(!b)return;const t="touches"in e?e.touches[0].clientX:e.clientX,n="touches"in e?e.touches[0].clientY:e.clientY;k({x:t-L.current.x,y:n-L.current.y})},R=()=>j(!1),A=t.isDark?"p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",I=u||c;/* @__PURE__ */
|
|
63
63
|
return C.jsxs(C.Fragment,{children:[
|
|
64
64
|
/* @__PURE__ */C.jsxs("div",{className:Xe("my-4 rounded-lg border overflow-hidden shadow-sm",t.isDark?"border-gray-700/30":"border-gray-200",{"is-rendering":t.loading}),children:[t.showHeader&&/* @__PURE__ */C.jsxs("div",{className:Xe("flex justify-between items-center px-4 py-2.5 border-b",t.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
|
|
65
65
|
/* @__PURE__ */C.jsxs("div",{className:"flex items-center gap-x-2 overflow-hidden",children:[Mt,
|
|
@@ -80,29 +80,29 @@ return C.jsxs(C.Fragment,{children:[
|
|
|
80
80
|
/* @__PURE__ */C.jsx("button",{className:Xe("p-2 text-xs rounded transition-colors",t.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>v(Math.min(w+.1,3)),children:"+"}),
|
|
81
81
|
/* @__PURE__ */C.jsx("button",{className:Xe("p-2 text-xs rounded transition-colors",t.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>v(Math.max(w-.1,.5)),children:"-"}),
|
|
82
82
|
/* @__PURE__ */C.jsxs("button",{className:Xe("p-2 text-xs rounded transition-colors",t.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{v(1),k({x:0,y:0})},children:[Math.round(100*w),"%"]})]})}),
|
|
83
|
-
/* @__PURE__ */C.jsx("div",{className:Xe("min-h-[360px] relative transition-all duration-100 overflow-hidden block",t.isDark?"bg-gray-900":"bg-gray-50"),style:{height:h},onMouseDown:P,onMouseMove:
|
|
83
|
+
/* @__PURE__ */C.jsx("div",{className:Xe("min-h-[360px] relative transition-all duration-100 overflow-hidden block",t.isDark?"bg-gray-900":"bg-gray-50"),style:{height:h},onMouseDown:P,onMouseMove:W,onMouseUp:R,onMouseLeave:R,onTouchStart:P,onTouchMove:W,onTouchEnd:R,children:/* @__PURE__ */C.jsx("div",{className:Xe("absolute inset-0 cursor-grab",b&&"cursor-grabbing"),style:{transform:`translate(${y.x}px, ${y.y}px) scale(${w})`},children:/* @__PURE__ */C.jsx("div",{ref:M,className:"w-full text-center flex items-center justify-center min-h-full"})})})]})})]}),f&&"undefined"!=typeof document&&x(
|
|
84
84
|
/* @__PURE__ */C.jsx("div",{className:"fixed inset-0 z-50 flex items-center justify-center bg-black/70 p-4",onClick:$,role:"dialog","aria-modal":"true",children:/* @__PURE__ */C.jsxs("div",{className:Xe("dialog-panel relative w-full h-full max-w-full max-h-full rounded shadow-lg overflow-hidden",t.isDark?"bg-gray-900":"bg-white"),onClick:e=>e.stopPropagation(),children:[
|
|
85
85
|
/* @__PURE__ */C.jsxs("div",{className:"absolute top-6 right-6 z-50 flex items-center gap-2",children:[
|
|
86
86
|
/* @__PURE__ */C.jsx("button",{className:Xe("p-2 text-xs rounded transition-colors",t.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>v(Math.min(w+.1,3)),children:"+"}),
|
|
87
87
|
/* @__PURE__ */C.jsx("button",{className:Xe("p-2 text-xs rounded transition-colors",t.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>v(Math.max(w-.1,.5)),children:"-"}),
|
|
88
88
|
/* @__PURE__ */C.jsxs("button",{className:Xe("p-2 text-xs rounded transition-colors",t.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:()=>{v(1),k({x:0,y:0})},children:[Math.round(100*w),"%"]}),
|
|
89
89
|
/* @__PURE__ */C.jsx("button",{className:Xe("inline-flex items-center justify-center p-2 rounded transition-colors",t.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onClick:$,children:"X"})]}),
|
|
90
|
-
/* @__PURE__ */C.jsx("div",{ref:N,className:Xe("w-full h-full flex items-center justify-center p-4 overflow-hidden",!b&&"cursor-grab",b&&"cursor-grabbing"),onMouseDown:P,onMouseMove:
|
|
90
|
+
/* @__PURE__ */C.jsx("div",{ref:N,className:Xe("w-full h-full flex items-center justify-center p-4 overflow-hidden",!b&&"cursor-grab",b&&"cursor-grabbing"),onMouseDown:P,onMouseMove:W,onMouseUp:R,onMouseLeave:R,onTouchStart:P,onTouchMove:W,onTouchEnd:R})]})}),document.body)]})}function Lt(e){const{node:t}=e;/* @__PURE__ */
|
|
91
91
|
return C.jsx("code",{className:"inline-code inline text-[85%] px-1 py-0.5 rounded font-mono bg-[hsl(var(--secondary))] whitespace-normal break-words max-w-full",children:t.code})}function Bt(e){/* @__PURE__ */
|
|
92
92
|
return C.jsx("ins",{className:"insert-node",children:e.children})}function Et(e){var n,r,o,i,s;const{node:l,ctx:c,renderNode:d,indexKey:u}=e,m=!1!==e.showTooltip,h=null!=(n=e.isDark)?n:null==c?void 0:c.isDark,p=t(()=>{var t,n,r,o,i,s;const a=void 0!==e.underlineBottom?"number"==typeof e.underlineBottom?`${e.underlineBottom}px`:String(e.underlineBottom):"-3px";return{"--link-color":null!=(t=e.color)?t:"#0366d6","--underline-height":`${null!=(n=e.underlineHeight)?n:2}px`,"--underline-bottom":a,"--underline-opacity":String(null!=(r=e.animationOpacity)?r:.9),"--underline-duration":`${null!=(o=e.animationDuration)?o:.8}s`,"--underline-timing":null!=(i=e.animationTiming)?i:"linear","--underline-iteration":"number"==typeof e.animationIteration?String(e.animationIteration):null!=(s=e.animationIteration)?s:"infinite"}},[e.animationDuration,e.animationIteration,e.animationOpacity,e.animationTiming,e.color,e.underlineBottom,e.underlineHeight]),f=String(null!=(o=null!=(r=l.title)?r:l.href)?o:""),g=a(e=>{m&&oe(e.currentTarget,String(l.title||l.href||l.text||""),"top",!1,(e.clientX,e.clientY),h)},[h,l.href,l.text,l.title,m]),x=a(()=>{m&&ie()},[m]);return l.loading?/* @__PURE__ */C.jsx("span",{className:"link-loading inline-flex items-baseline gap-1.5","aria-hidden":"false",style:p,children:/* @__PURE__ */C.jsxs("span",{className:"link-text-wrapper relative inline-flex",children:[
|
|
93
93
|
/* @__PURE__ */C.jsx("span",{className:"leading-[normal] link-text",children:/* @__PURE__ */C.jsx("span",{className:"leading-[normal] link-text",children:null!=(i=l.text)?i:""})}),
|
|
94
94
|
/* @__PURE__ */C.jsx("span",{className:"underline-anim","aria-hidden":"true"})]})}):/* @__PURE__ */C.jsx("a",{className:"link-node",href:l.href,title:m?"":f,"aria-label":`Link: ${f}`,target:"_blank",rel:"noopener noreferrer",style:p,onMouseEnter:g,onMouseLeave:x,children:c&&d?S(l.children,c,String(null!=u?u:"link"),d):null!=(s=l.text)?s:null})}function Tt(e){const{node:t,ctx:n,renderNode:r,value:o,indexKey:i,children:s}=e,a=null==o?void 0:o;/* @__PURE__ */
|
|
95
95
|
return C.jsx("li",{className:"list-item pl-1.5 my-2",dir:"auto",value:a,children:null!=s?s:n&&r?S(t.children,n,String(null!=i?i:"list-item"),r):null})}function _t(e){var t;const{node:n,ctx:r,renderNode:o,indexKey:i}=e,s=n.ordered?"ol":"ul",a=n.ordered&&n.start?n.start:void 0,l=r&&H(r.customId).list_item||Tt;/* @__PURE__ */
|
|
96
96
|
return C.jsx(s,{className:Xe("list-node my-5 pl-[calc(13/8*1em)]",n.ordered?"list-decimal":"list-disc max-lg:my-[calc(4/3*1em)] max-lg:pl-[calc(14/9*1em)]"),start:a,children:null==(t=n.items)?void 0:t.map((e,t)=>{var s;/* @__PURE__ */
|
|
97
|
-
return C.jsx(l,{node:e,value:n.ordered?(null!=(s=n.start)?s:1)+t:void 0,ctx:r,renderNode:o,indexKey:`${String(null!=i?i:"list")}-${t}`,customId:null==r?void 0:r.customId,isDark:null==r?void 0:r.isDark,typewriter:null==r?void 0:r.typewriter},`${String(null!=i?i:"list")}-${t}`)})})}let $t=null,Dt=null,Ot=!1;const Pt=/* @__PURE__ */new Map,
|
|
97
|
+
return C.jsx(l,{node:e,value:n.ordered?(null!=(s=n.start)?s:1)+t:void 0,ctx:r,renderNode:o,indexKey:`${String(null!=i?i:"list")}-${t}`,customId:null==r?void 0:r.customId,isDark:null==r?void 0:r.isDark,typewriter:null==r?void 0:r.typewriter},`${String(null!=i?i:"list")}-${t}`)})})}let $t=null,Dt=null,Ot=!1;const Pt=/* @__PURE__ */new Map,Wt=/* @__PURE__ */new Map;let Rt=5;const At=/* @__PURE__ */new Set;function It(){if(Pt.size<Rt&&At.size){const e=Array.from(At);At.clear();for(const t of e)try{t()}catch{}}}function Ft(e){$t=e,Dt=null,$t.onmessage=e=>{const{id:t,html:n,error:r}=e.data,o=Pt.get(t);if(o)if(Pt.delete(t),clearTimeout(o.timeoutId),It(),r)o.reject(new Error(r));else{const{content:t,displayMode:r}=e.data;if(t){const e=`${r?"d":"i"}:${t}`;if(Wt.set(e,n),Wt.size>200){const e=Wt.keys().next().value;Wt.delete(e)}}o.resolve(n)}},$t.onerror=e=>{console.error("[katexWorkerClient] Worker error:",e);for(const[t,n]of Pt.entries())clearTimeout(n.timeoutId),n.reject(new Error(`Worker error: ${e.message}`));Pt.clear(),It()}}function zt(){var e;$t&&(null==(e=$t.terminate)||e.call($t)),$t=null,Dt=null}function Ht(e){Ot=!!e,$t&&$t.postMessage({type:"init",debug:Ot})}const Vt="WORKER_BUSY";async function Kt(e,t=!0,n=2e3,r){if(performance.now(),Dt)return Promise.reject(Dt);const o=`${t?"d":"i"}:${e}`,i=Wt.get(o);if(i)return Promise.resolve(i);const s=$t||(Dt=new Error("[katexWorkerClient] No worker instance set. Please inject a Worker via setKaTeXWorker()."),Dt.name="WORKER_INIT_ERROR",Dt.code="WORKER_INIT_ERROR",null);if(!s)return Promise.reject(Dt);if(Pt.size>=Rt){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=Vt,e.busy=!0,e.inFlight=Pt.size,e.max=Rt,Promise.reject(e)}return new Promise((o,i)=>{if(null==r?void 0:r.aborted){const e=new Error("Aborted");return e.name="AbortError",void i(e)}const a=Math.random().toString(36).slice(2),l=setTimeout(()=>{Pt.delete(a);const e=new Error("Worker render timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT",i(e),It()},n),c=()=>{},d=()=>{Pt.delete(a),clearTimeout(l),At.delete(c);const e=new Error("Aborted");e.name="AbortError",i(e),It()};r&&r.addEventListener("abort",d,{once:!0}),Pt.set(a,{resolve:e=>{r&&r.removeEventListener("abort",d),o(e)},reject:e=>{r&&r.removeEventListener("abort",d),i(e)},timeoutId:l});try{s.postMessage({id:a,content:e,displayMode:t,debug:Ot})}catch(u){Pt.delete(a),clearTimeout(l),r&&r.removeEventListener("abort",d),i(u),It()}})}function Xt(e,t,n){const r=`${t?"d":"i"}:${e}`;if(Wt.set(r,n),Wt.size>200){const e=Wt.keys().next().value;Wt.delete(e)}}function Ut(){Wt.clear()}function qt(e){Rt=Math.max(1,Math.floor(e)),It()}function Yt(e=1500,t){return Pt.size<Rt?Promise.resolve():new Promise((n,r)=>{if(null==t?void 0:t.aborted){const e=new Error("Aborted");return e.name="AbortError",void r(e)}let o=null;function i(){At.delete(s),null!=o&&clearTimeout(o),t&&t.removeEventListener("abort",a)}function s(){i(),n()}function a(){i();const e=new Error("Aborted");e.name="AbortError",r(e)}o=e>0?setTimeout(()=>{i(),r(new Error("Timeout waiting for worker slot"))},e):null,t&&t.addEventListener("abort",a,{once:!0}),At.add(s)})}const Zt={timeout:2e3,waitTimeout:1500,backoffMs:30,maxRetries:1};function Jt(e){null!=e.timeout&&(Zt.timeout=Math.max(0,Math.floor(e.timeout))),null!=e.waitTimeout&&(Zt.waitTimeout=Math.max(0,Math.floor(e.waitTimeout))),null!=e.backoffMs&&(Zt.backoffMs=Math.max(0,Math.floor(e.backoffMs))),null!=e.maxRetries&&(Zt.maxRetries=Math.max(0,Math.floor(e.maxRetries)))}function Gt(){return{...Zt}}async function Qt(e,t=!0,n={}){var r,o,i,s;const a=null!=(r=n.timeout)?r:Zt.timeout,l=null!=(o=n.waitTimeout)?o:Zt.waitTimeout,c=null!=(i=n.backoffMs)?i:Zt.backoffMs,d=null!=(s=n.maxRetries)?s:Zt.maxRetries,u=n.signal;let m=0;for(;;){if(null==u?void 0:u.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}try{return await Kt(e,t,a,u)}catch(h){if((null==h?void 0:h.code)!==Vt||m>=d)throw h;if(m++,await Yt(l,u).catch(()=>{}),null==u?void 0:u.aborted){const e=new Error("Aborted");throw e.name="AbortError",e}c>0&&await new Promise(e=>setTimeout(e,c*m))}}}let en=null,tn=!1;async function nn(){if(en)return en;if(tn)return null;try{return en=await import("katex"),await import("katex/contrib/mhchem"),en}catch{return tn=!0,null}}function rn({node:e}){const t=i(null),[r,o]=n(!0),a=i(0);return s(()=>{var n;let r=!1;const i=new AbortController,s=++a.current,l=null!=(n=e.content)?n:"";return l?(Qt(l,!0,{timeout:3e3,waitTimeout:2e3,maxRetries:1,signal:i.signal}).then(e=>{r||s!==a.current||(t.current&&(t.current.innerHTML=e),o(!1))}).catch(async n=>{if(r||s!==a.current)return;if(!t.current)return;const i=(null==n?void 0:n.code)||(null==n?void 0:n.name);if("WORKER_INIT_ERROR"===i||(null==n?void 0:n.fallbackToRenderer)||i===Vt||"WORKER_TIMEOUT"===i){const n=await nn();if(n)try{const i=n.renderToString(l,{throwOnError:e.loading,displayMode:!0});return void(!r&&s===a.current&&t.current&&(t.current.innerHTML=i,o(!1),Xt(l,!0,i)))}catch{}}e.loading||(t.current.textContent=e.raw,o(!1))}),()=>{r=!0,i.abort()}):(o(!1),()=>i.abort())},[e.content,e.loading,e.raw]),/* @__PURE__ */C.jsx("div",{className:"math-block text-center overflow-x-auto relative min-h-[40px]",children:/* @__PURE__ */C.jsx("div",{ref:t,className:r?"math-rendering":void 0})})}function on({node:e}){const t=i(null),r=i(null),[o,a]=n(!0),l=i(0);return s(()=>{var t;let n=!1;const o=new AbortController,i=++l.current,s=null!=(t=e.content)?t:"";if(!s)return a(!1),()=>o.abort();const c="$$"===e.markup;return Qt(s,c,{timeout:1500,waitTimeout:0,maxRetries:0,signal:o.signal}).then(e=>{n||i!==l.current||r.current&&(r.current.innerHTML=e,a(!1))}).catch(async t=>{if(n||i!==l.current)return;if(!r.current)return;const o=(null==t?void 0:t.code)||(null==t?void 0:t.name);if("WORKER_INIT_ERROR"===o||(null==t?void 0:t.fallbackToRenderer)||o===Vt||"WORKER_TIMEOUT"===o){const t=await nn();if(t)try{const o=t.renderToString(s,{throwOnError:e.loading,displayMode:c});return void(!n&&i===l.current&&r.current&&(r.current.innerHTML=o,a(!1),Xt(s,c,o)))}catch{}}e.loading||(r.current.textContent=e.raw,a(!1))}),()=>{n=!0,o.abort()}},[e.content,e.loading,e.raw,e.markup]),/* @__PURE__ */C.jsxs("span",{ref:t,className:"math-inline-wrapper",children:[
|
|
98
98
|
/* @__PURE__ */C.jsx("span",{ref:r,className:"math-inline"+(o?" math-inline--hidden":"")}),o&&/* @__PURE__ */C.jsxs("span",{className:"math-inline__loading",role:"status","aria-live":"polite",children:[
|
|
99
99
|
/* @__PURE__ */C.jsx("span",{className:"math-inline__spinner","aria-hidden":"true"}),
|
|
100
|
-
/* @__PURE__ */C.jsx("span",{className:"sr-only",children:"Loading"})]})]})}let sn=null,an=null;const ln=/* @__PURE__ */new Map;let cn=5,dn=!1;function un(e){dn=!!e}function mn(e){Number.isFinite(e)&&e>0&&(cn=Math.floor(e))}function hn(){return{inFlight:ln.size,max:cn}}const pn="WORKER_BUSY";function fn(e){sn=e,an=null;const t=e;sn.onmessage=e=>{if(sn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,s=ln.get(n);s&&(!1===r||i?s.reject(new Error(i||"Unknown error")):s.resolve(o))},sn.onerror=e=>{var n,r;if(sn===t)if(0!==ln.size){try{dn?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of ln.entries())n.reject(new Error(`Worker error: ${e.message}`));ln.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},sn.onmessageerror=e=>{var n,r;if(sn===t)if(0!==ln.size){try{dn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of ln.entries())t.reject(new Error("Worker messageerror"));ln.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function gn(){var e;if(sn)try{for(const[e,t]of ln.entries())t.reject(new Error("Worker cleared"));ln.clear(),null==(e=sn.terminate)||e.call(sn)}catch{}sn=null,an=null}function xn(e,t,n=1400){if(an)return Promise.reject(an);const r=sn||(an=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),an.name="WORKER_INIT_ERROR",an.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(an);if(ln.size>=cn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=pn,e.inFlight=ln.size,e.max=cn,Promise.reject(e)}return new Promise((o,i)=>{const s=Math.random().toString(36).slice(2);let a=!1,l=null;const c=()=>{a||(a=!0,null!=l&&clearTimeout(l),ln.delete(s))},d={resolve:e=>{c(),o(e)},reject:e=>{c(),i(e)}};ln.set(s,d);try{r.postMessage({id:s,action:e,payload:t})}catch(u){return ln.delete(s),void i(u)}l=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=ln.get(s);null==t||t.reject(e)},n)})}async function wn(e,t,n=1400){return xn("canParse",{code:e,theme:t},n)}async function vn(e,t,n=2400){return xn("findPrefix",{code:e,theme:t},n)}function yn(){var e;null==(e=null==sn?void 0:sn.terminate)||e.call(sn),sn=null,an=null,ln.clear()}let kn=null,bn=!1,jn=null,Cn=null;function Mn(e,t){var n;if(!e||!t)return;const r=function(e){var t,n;return`${String(null!=(t=null==e?void 0:e.securityLevel)?t:"loose")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(jn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),jn=r}catch{}}const Nn="undefined"!=typeof window?c:s,Sn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Ln=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Bn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function En(e){if(!e)return"";const t=e.trim();return Bn.test(t)?t:""}function Tn(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function _n(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Tn(e);const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return null;if(!e)return null;const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return null;const r=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){if(t.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Ln.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=En(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r}(t);return n?(e.appendChild(n),e.innerHTML):""}(e,t);if(Tn(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const $n={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!1};function Dn(e){var r,o,l,c,d,u,m,h,p;const f={...$n,...e},{t:g}=Y(),w=t(()=>ue("mermaid"),[]),v=null!=(o=null==(r=f.node)?void 0:r.code)?o:"",y=t(()=>v.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[v]),k=null!=(l=f.workerTimeoutMs)?l:$n.workerTimeoutMs,b=null!=(c=f.parseTimeoutMs)?c:$n.parseTimeoutMs,j=null!=(d=f.renderTimeoutMs)?d:$n.renderTimeoutMs,M=null!=(u=f.fullRenderTimeoutMs)?u:$n.fullRenderTimeoutMs,[N,S]=n(!1),[L,B]=n(!1),[E,T]=n(!1),[_,$]=n(!1),[D,P]=n(1),[R,W]=n({x:0,y:0}),[A,I]=n(!1),[F,z]=n(!1),[H,V]=n(!1),[K,X]=n(null),[U,q]=n(!1),[Z,J]=n(()=>null==f.maxHeight?"360px":f.maxHeight),[G,Q]=n("undefined"==typeof window),ee=i(null),te=i(null),ne=i(null),re=i(null),se=i(null),ae=i(null),le=i(null),ce=i({x:0,y:0}),de=i(0),me=i({}),he=i(""),pe=i(!1),fe=i(null),ge=i(!1),xe=i({zoom:1,translateX:0,translateY:0,containerHeight:Z||"360px"}),we=O(),ve=Boolean(null!=(h=null==(m=f.node)?void 0:m.loading)?h:f.loading),ye=f.isDark?"dark":"light",ke=Boolean(f.isStrict),be=t(()=>ke?{startOnLoad:!1,securityLevel:"strict",dompurifyConfig:Sn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose"},[ke]);s(()=>{ge.current=H},[H]),s(()=>{me.current={}},[ye,y,ke]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(kn)return Mn(kn,e),kn;if(Cn){const t=await Cn;return t&&Mn(t,e),t}if(bn)return null;try{bn=!0,Cn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(kn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!kn)throw new Error("Mermaid module did not export expected API");return Mn(kn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),kn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Cn=null}})();const t=await Cn;return t&&Mn(t,e),t}catch{return null}}(be);e||(ee.current=t,S(Boolean(t)),pe.current||B(!t))})(),()=>{e=!0}},[be]),s(()=>{const e=te.current;if(!e)return;const t=we(e,{rootMargin:"400px"});return fe.current=t,t.isVisible()&&Q(!0),t.whenVisible.then(()=>Q(!0)),()=>{t.destroy(),fe.current=null}},[we]),s(()=>{if("undefined"==typeof document)return;if(!U)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[U]);const je=a(e=>{const t=te.current,n=re.current;if(!t||!n)return;const r=n.querySelector("svg");if(!r)return;let o=0,i=0;const s=r.getAttribute("viewBox");if(s){const e=s.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:t.clientWidth)*(i/o),l=Number.isFinite(a)&&a>0?a:i;J(`${Math.min(l,i)}px`)},[]);s(()=>{if(!te.current||"undefined"==typeof ResizeObserver)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;!function(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}globalThis.setTimeout(e,0)}(()=>je(t))});return e.observe(te.current),()=>e.disconnect()},[je]),s(()=>()=>{yn()},[]);const Ce=a(async(e,t,n)=>{var r;if(!ee.current||!re.current)return!1;z(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Pn(e,t),s=await Wn(()=>ee.current.render(o,i),{timeoutMs:M,signal:n});if(!(null==s?void 0:s.svg))return!1;const a=_n(re.current,s.svg,ke);return null==(r=s.bindFunctions)||r.call(s,re.current),je(),me.current[t]=a,V(!0),X(null),!0}catch(o){return ve||X(o instanceof Error?o.message:String(o)),!1}finally{z(!1)}},[M,ve,ke,je]),Me=a(async(e,t,n)=>{var r;if(ee.current&&re.current){z(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Pn(Rn(e)||e,t),s=await Wn(()=>ee.current.render(o,i),{timeoutMs:j,signal:n});(null==s?void 0:s.svg)&&(_n(re.current,s.svg,ke),null==(r=s.bindFunctions)||r.call(s,re.current),je())}catch{}finally{z(!1)}}},[j,ve,ke,je]),Ne=a(async(e,t)=>{if(!e.trim())return Tn(re.current),V(!1),void(he.current="");const n=e.replace(/\s+/g,"");if(n===he.current&&ge.current)return;const r=++de.current;try{if(await async function(e,t,n){try{if(await wn(e,t,n.workerTimeout))return!0}catch(s){if("AbortError"===(null==s?void 0:s.name))throw s}if(!n.mermaid)throw new Error("Mermaid not available");const r=Pn(e,t),o=n.mermaid;if("function"==typeof o.parse)return await Wn(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await Wn(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,ye,{workerTimeout:k,parseTimeout:b,mermaid:ee.current,signal:t}),(null==t?void 0:t.aborted)||de.current!==r)return;return void(await Ce(e,ye,t)&&(he.current=n))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const n=await async function(e,t,n){try{const r=await vn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return Rn(e)}(e,ye,{workerTimeout:k,signal:t});if(!n||(null==t?void 0:t.aborted)||de.current!==r)return;await Me(n,ye,t)}catch{}},[b,Ce,Me,ye,k]);s(()=>{if(!G||L||E)return;const e=new AbortController;return Ne(y,e.signal),()=>e.abort()},[y,E,Ne,L,G]);const Se=a((e,t)=>{e.clientX,e.clientY,oe(e.currentTarget,t,"top",!1,0,f.isDark)},[f.isDark]),Le=a(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(y)),$(!0),null==(t=f.onCopy)||t.call(f,y),setTimeout(()=>$(!1),1e3)}catch{}},[y,f]),Be=a(()=>{var e,t,n;const r=null!=(t=null==(e=re.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=An(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=f.onExport)||n.call(f,i),i.defaultPrevented||function(e,t){const n=null!=t?t:An(e),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[f]),Ee=a(()=>{le.current=null,Tn(ae.current)},[]),Te=a(()=>{q(!1),Ee()},[Ee]),_e=a(()=>{var e,t,n;const r=null!=(t=null==(e=re.current)?void 0:e.querySelector("svg"))?t:null,o=r?An(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=f.onOpenModal)||n.call(f,i),i.defaultPrevented||q(!0)},[f]);s(()=>{if(!U)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Te()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Te,U]),Nn(()=>{if(!U)return;const e=ae.current,t=te.current;if(!e||!t)return;const n=`translate(${R.x}px, ${R.y}px) scale(${D})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(le.current=o,o.style.transform=n),Tn(e),e.appendChild(r)},[U]),s(()=>{U&&le.current&&(le.current.style.transform=`translate(${R.x}px, ${R.y}px) scale(${D})`)},[U,R.x,R.y,D]);const $e=L||F||E,De=t(()=>f.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[f.isDark]),Oe=a(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=f.onToggleMode)||t.call(f,e,n),!n.defaultPrevented)if(pe.current=!0,"preview"===e){B(!1);const e=xe.current;P(e.zoom),W({x:e.translateX,y:e.translateY}),J(e.containerHeight),ge.current&&me.current[ye]&&re.current?(re.current.innerHTML=me.current[ye],je()):Ne(y)}else xe.current={zoom:D,translateX:R.x,translateY:R.y,containerHeight:Z},B(!0)},[y,Z,Ne,f,ye,R.x,R.y,je,D]),Pe=a(e=>{if(!1===f.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=te.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-R.x,o=e.clientY-n.top-R.y,i=.01*-e.deltaY,s=On(D+i,.5,3);if(s===D)return;const a=s/D;W({x:R.x-r*(a-1),y:R.y-o*(a-1)}),P(s)},[R,D]),Re=a((e,t)=>{I(!0),ce.current={x:e-R.x,y:t-R.y}},[R.x,R.y]),We=a((e,t)=>{A&&W({x:e-ce.current.x,y:t-ce.current.y})},[A]),Ae=a(()=>{I(!1)},[]),Ie=/* @__PURE__ */C.jsxs("div",{className:"relative",children:[f.showZoomControls&&/* @__PURE__ */C.jsx("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */C.jsxs("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
|
|
100
|
+
/* @__PURE__ */C.jsx("span",{className:"sr-only",children:"Loading"})]})]})}let sn=null,an=null;const ln=/* @__PURE__ */new Map;let cn=5,dn=!1;function un(e){dn=!!e}function mn(e){Number.isFinite(e)&&e>0&&(cn=Math.floor(e))}function hn(){return{inFlight:ln.size,max:cn}}const pn="WORKER_BUSY";function fn(e){sn=e,an=null;const t=e;sn.onmessage=e=>{if(sn!==t)return;const{id:n,ok:r,result:o,error:i}=e.data,s=ln.get(n);s&&(!1===r||i?s.reject(new Error(i||"Unknown error")):s.resolve(o))},sn.onerror=e=>{var n,r;if(sn===t)if(0!==ln.size){try{dn?console.error("[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker error:",(null==e?void 0:e.message)||e)}catch{}for(const[t,n]of ln.entries())n.reject(new Error(`Worker error: ${e.message}`));ln.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker error (no pending):",(null==e?void 0:e.message)||e)},sn.onmessageerror=e=>{var n,r;if(sn===t)if(0!==ln.size){try{dn?console.error("[mermaidWorkerClient] Worker messageerror:",e):null==(r=console.debug)||r.call(console,"[mermaidWorkerClient] Worker messageerror:",e)}catch{}for(const[e,t]of ln.entries())t.reject(new Error("Worker messageerror"));ln.clear()}else null==(n=console.debug)||n.call(console,"[mermaidWorkerClient] Worker messageerror (no pending):",e)}}function gn(){var e;if(sn)try{for(const[e,t]of ln.entries())t.reject(new Error("Worker cleared"));ln.clear(),null==(e=sn.terminate)||e.call(sn)}catch{}sn=null,an=null}function xn(e,t,n=1400){if(an)return Promise.reject(an);const r=sn||(an=new Error("[mermaidWorkerClient] No worker instance set. Please inject a Worker via setMermaidWorker()."),an.name="WORKER_INIT_ERROR",an.code="WORKER_INIT_ERROR",null);if(!r)return Promise.reject(an);if(ln.size>=cn){const e=new Error("Worker busy");return e.name="WorkerBusy",e.code=pn,e.inFlight=ln.size,e.max=cn,Promise.reject(e)}return new Promise((o,i)=>{const s=Math.random().toString(36).slice(2);let a=!1,l=null;const c=()=>{a||(a=!0,null!=l&&clearTimeout(l),ln.delete(s))},d={resolve:e=>{c(),o(e)},reject:e=>{c(),i(e)}};ln.set(s,d);try{r.postMessage({id:s,action:e,payload:t})}catch(u){return ln.delete(s),void i(u)}l=setTimeout(()=>{const e=new Error("Worker call timed out");e.name="WorkerTimeout",e.code="WORKER_TIMEOUT";const t=ln.get(s);null==t||t.reject(e)},n)})}async function wn(e,t,n=1400){return xn("canParse",{code:e,theme:t},n)}async function vn(e,t,n=2400){return xn("findPrefix",{code:e,theme:t},n)}function yn(){var e;null==(e=null==sn?void 0:sn.terminate)||e.call(sn),sn=null,an=null,ln.clear()}let kn=null,bn=!1,jn=null,Cn=null;function Mn(e,t){var n;if(!e||!t)return;const r=function(e){var t,n;return`${String(null!=(t=null==e?void 0:e.securityLevel)?t:"loose")}|htmlLabels:${!1===(null==(n=null==e?void 0:e.flowchart)?void 0:n.htmlLabels)?"0":"1"}`}(t);if(jn!==r)try{"function"==typeof e.initialize?e.initialize(t):(null==(n=e.mermaidAPI)?void 0:n.initialize)&&e.mermaidAPI.initialize(t),jn=r}catch{}}const Nn="undefined"!=typeof window?c:s,Sn={USE_PROFILES:{svg:!0},FORBID_TAGS:["script"],FORBID_ATTR:[/^on/i],ADD_TAGS:["style"],ADD_ATTR:["style"],SAFE_FOR_TEMPLATES:!0},Ln=[/javascript:/i,/expression\s*\(/i,/url\s*\(\s*javascript:/i,/@import/i],Bn=/^(?:https?:|mailto:|tel:|#|\/|data:image\/(?:png|gif|jpe?g|webp);)/i;function En(e){if(!e)return"";const t=e.trim();return Bn.test(t)?t:""}function Tn(e){if(e)try{e.replaceChildren()}catch{e.innerHTML=""}}function _n(e,t,n){if(!e)return"";if(n)return function(e,t){if(!e)return"";Tn(e);const n=function(e){if("undefined"==typeof window||"undefined"==typeof DOMParser)return null;if(!e)return null;const t=e.replace(/["']\s*javascript:/gi,"#").replace(/\bjavascript:/gi,"#").replace(/["']\s*vbscript:/gi,"#").replace(/\bvbscript:/gi,"#").replace(/\bdata:text\/html/gi,"#"),n=(new DOMParser).parseFromString(t,"image/svg+xml").documentElement;if(!n||"svg"!==n.nodeName.toLowerCase())return null;const r=n;return function(e){const t=/* @__PURE__ */new Set(["script"]),n=[e,...Array.from(e.querySelectorAll("*"))];for(const r of n){if(t.has(r.tagName.toLowerCase())){r.remove();continue}const e=Array.from(r.attributes);for(const t of e){const e=t.name;if(/^on/i.test(e))r.removeAttribute(e);else{if("style"===e&&t.value){const n=t.value;if(Ln.some(e=>e.test(n))){r.removeAttribute(e);continue}}if(("href"===e||"xlink:href"===e)&&t.value){const n=En(t.value);if(!n){r.removeAttribute(e);continue}n!==t.value&&r.setAttribute(e,n)}}}}}(r),r}(t);return n?(e.appendChild(n),e.innerHTML):""}(e,t);if(Tn(e),t)try{e.insertAdjacentHTML("afterbegin",t)}catch{e.innerHTML=t}return e.innerHTML}const $n={maxHeight:"500px",loading:!0,workerTimeoutMs:1400,parseTimeoutMs:1800,renderTimeoutMs:2500,fullRenderTimeoutMs:4e3,showHeader:!0,showModeToggle:!0,showCopyButton:!0,showExportButton:!0,showFullscreenButton:!0,showCollapseButton:!0,showZoomControls:!0,enableWheelZoom:!1,isStrict:!1};function Dn(e){var r,o,l,c,d,u,m,h,p;const f={...$n,...e},{t:g}=Y(),w=t(()=>ue("mermaid"),[]),v=null!=(o=null==(r=f.node)?void 0:r.code)?o:"",y=t(()=>v.replace(/\]::([^:])/g,"]:::$1").replace(/:::subgraphNode$/gm,"::subgraphNode"),[v]),k=null!=(l=f.workerTimeoutMs)?l:$n.workerTimeoutMs,b=null!=(c=f.parseTimeoutMs)?c:$n.parseTimeoutMs,j=null!=(d=f.renderTimeoutMs)?d:$n.renderTimeoutMs,M=null!=(u=f.fullRenderTimeoutMs)?u:$n.fullRenderTimeoutMs,[N,S]=n(!1),[L,B]=n(!1),[E,T]=n(!1),[_,$]=n(!1),[D,P]=n(1),[W,R]=n({x:0,y:0}),[A,I]=n(!1),[F,z]=n(!1),[H,V]=n(!1),[K,X]=n(null),[U,q]=n(!1),[Z,J]=n(()=>null==f.maxHeight?"360px":f.maxHeight),[G,Q]=n("undefined"==typeof window),ee=i(null),te=i(null),ne=i(null),re=i(null),se=i(null),ae=i(null),le=i(null),ce=i({x:0,y:0}),de=i(0),me=i({}),he=i(""),pe=i(!1),fe=i(null),ge=i(!1),xe=i({zoom:1,translateX:0,translateY:0,containerHeight:Z||"360px"}),we=O(),ve=Boolean(null!=(h=null==(m=f.node)?void 0:m.loading)?h:f.loading),ye=f.isDark?"dark":"light",ke=Boolean(f.isStrict),be=t(()=>ke?{startOnLoad:!1,securityLevel:"strict",dompurifyConfig:Sn,flowchart:{htmlLabels:!1}}:{startOnLoad:!1,securityLevel:"loose"},[ke]);s(()=>{ge.current=H},[H]),s(()=>{me.current={}},[ye,y,ke]),s(()=>{let e=!1;return(async()=>{const t=await async function(e){if(kn)return Mn(kn,e),kn;if(Cn){const t=await Cn;return t&&Mn(t,e),t}if(bn)return null;try{bn=!0,Cn=(async()=>{try{const t=await import("mermaid"),n=(null==t?void 0:t.default)||t;if(kn=(null==n?void 0:n.default)?n.default:(null==n?void 0:n.mermaidAPI)?n:(null==n?void 0:n.mermaid)?n.mermaid:n,!kn)throw new Error("Mermaid module did not export expected API");return Mn(kn,null!=e?e:{startOnLoad:!1,securityLevel:"loose"}),kn}catch(t){return console.warn("[markstream-react] Failed to load mermaid:",t),null}finally{Cn=null}})();const t=await Cn;return t&&Mn(t,e),t}catch{return null}}(be);e||(ee.current=t,S(Boolean(t)),pe.current||B(!t))})(),()=>{e=!0}},[be]),s(()=>{const e=te.current;if(!e)return;const t=we(e,{rootMargin:"400px"});return fe.current=t,t.isVisible()&&Q(!0),t.whenVisible.then(()=>Q(!0)),()=>{t.destroy(),fe.current=null}},[we]),s(()=>{if("undefined"==typeof document)return;if(!U)return;const e=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{document.body.style.overflow=e}},[U]);const je=a(e=>{const t=te.current,n=re.current;if(!t||!n)return;const r=n.querySelector("svg");if(!r)return;let o=0,i=0;const s=r.getAttribute("viewBox");if(s){const e=s.split(" ");4===e.length&&(o=Number.parseFloat(e[2]),i=Number.parseFloat(e[3]))}if(o&&i||!r.hasAttribute("width")||!r.hasAttribute("height")||(o=Number.parseFloat(r.getAttribute("width")||"0"),i=Number.parseFloat(r.getAttribute("height")||"0")),!o||!i||Number.isNaN(o)||Number.isNaN(i))try{const e=r.getBBox();o=e.width,i=e.height}catch{return}if(!(o>0&&i>0))return;const a=(null!=e?e:t.clientWidth)*(i/o),l=Number.isFinite(a)&&a>0?a:i;J(`${Math.min(l,i)}px`)},[]);s(()=>{if(!te.current||"undefined"==typeof ResizeObserver)return;const e=new ResizeObserver(e=>{if(!e.length)return;const t=e[0].contentRect.width;!function(e){try{if("undefined"!=typeof globalThis&&"function"==typeof globalThis.requestAnimationFrame)return globalThis.requestAnimationFrame(e)}catch{}globalThis.setTimeout(e,0)}(()=>je(t))});return e.observe(te.current),()=>e.disconnect()},[je]),s(()=>()=>{yn()},[]);const Ce=a(async(e,t,n)=>{var r;if(!ee.current||!re.current)return!1;z(!0);try{const o=`mermaid-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Pn(e,t),s=await Rn(()=>ee.current.render(o,i),{timeoutMs:M,signal:n});if(!(null==s?void 0:s.svg))return!1;const a=_n(re.current,s.svg,ke);return null==(r=s.bindFunctions)||r.call(s,re.current),je(),me.current[t]=a,V(!0),X(null),!0}catch(o){return ve||X(o instanceof Error?o.message:String(o)),!1}finally{z(!1)}},[M,ve,ke,je]),Me=a(async(e,t,n)=>{var r;if(ee.current&&re.current){z(!0);try{const o=`mermaid-preview-${Date.now()}-${Math.random().toString(36).slice(2,9)}`,i=Pn(Wn(e)||e,t),s=await Rn(()=>ee.current.render(o,i),{timeoutMs:j,signal:n});(null==s?void 0:s.svg)&&(_n(re.current,s.svg,ke),null==(r=s.bindFunctions)||r.call(s,re.current),je())}catch{}finally{z(!1)}}},[j,ve,ke,je]),Ne=a(async(e,t)=>{if(!e.trim())return Tn(re.current),V(!1),void(he.current="");const n=e.replace(/\s+/g,"");if(n===he.current&&ge.current)return;const r=++de.current;try{if(await async function(e,t,n){try{if(await wn(e,t,n.workerTimeout))return!0}catch(s){if("AbortError"===(null==s?void 0:s.name))throw s}if(!n.mermaid)throw new Error("Mermaid not available");const r=Pn(e,t),o=n.mermaid;if("function"==typeof o.parse)return await Rn(()=>o.parse(r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0;const i=`mermaid-parse-${Math.random().toString(36).slice(2,9)}`;return await Rn(()=>o.render(i,r),{timeoutMs:n.parseTimeout,signal:n.signal}),!0}(e,ye,{workerTimeout:k,parseTimeout:b,mermaid:ee.current,signal:t}),(null==t?void 0:t.aborted)||de.current!==r)return;return void(await Ce(e,ye,t)&&(he.current=n))}catch(o){if("AbortError"===(null==o?void 0:o.name))return}try{const n=await async function(e,t,n){try{const r=await vn(e,t,n.workerTimeout);if(r)return r}catch(o){if("AbortError"===(null==o?void 0:o.name))throw o}return Wn(e)}(e,ye,{workerTimeout:k,signal:t});if(!n||(null==t?void 0:t.aborted)||de.current!==r)return;await Me(n,ye,t)}catch{}},[b,Ce,Me,ye,k]);s(()=>{if(!G||L||E)return;const e=new AbortController;return Ne(y,e.signal),()=>e.abort()},[y,E,Ne,L,G]);const Se=a((e,t)=>{e.clientX,e.clientY,oe(e.currentTarget,t,"top",!1,0,f.isDark)},[f.isDark]),Le=a(async()=>{var e,t;try{await(null==(e=navigator.clipboard)?void 0:e.writeText(y)),$(!0),null==(t=f.onCopy)||t.call(f,y),setTimeout(()=>$(!1),1e3)}catch{}},[y,f]),Be=a(()=>{var e,t,n;const r=null!=(t=null==(e=re.current)?void 0:e.querySelector("svg"))?t:null;if(!r)return;const o=An(r),i={payload:{type:"export"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=f.onExport)||n.call(f,i),i.defaultPrevented||function(e,t){const n=null!=t?t:An(e),r=new Blob([n],{type:"image/svg+xml;charset=utf-8"}),o=URL.createObjectURL(r),i=document.createElement("a");i.href=o,i.download=`mermaid-${Date.now()}.svg`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(o)}(r,o)},[f]),Ee=a(()=>{le.current=null,Tn(ae.current)},[]),Te=a(()=>{q(!1),Ee()},[Ee]),_e=a(()=>{var e,t,n;const r=null!=(t=null==(e=re.current)?void 0:e.querySelector("svg"))?t:null,o=r?An(r):null,i={payload:{type:"open-modal"},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0},svgElement:r,svgString:o};null==(n=f.onOpenModal)||n.call(f,i),i.defaultPrevented||q(!0)},[f]);s(()=>{if(!U)return;if("undefined"==typeof window)return;const e=e=>{"Escape"===e.key&&Te()};try{window.addEventListener("keydown",e)}catch{}return()=>{try{window.removeEventListener("keydown",e)}catch{}}},[Te,U]),Nn(()=>{if(!U)return;const e=ae.current,t=te.current;if(!e||!t)return;const n=`translate(${W.x}px, ${W.y}px) scale(${D})`,r=t.cloneNode(!0);r.classList.add("fullscreen");const o=r.querySelector("[data-mermaid-wrapper]");o&&(le.current=o,o.style.transform=n),Tn(e),e.appendChild(r)},[U]),s(()=>{U&&le.current&&(le.current.style.transform=`translate(${W.x}px, ${W.y}px) scale(${D})`)},[U,W.x,W.y,D]);const $e=L||F||E,De=t(()=>f.isDark?"mermaid-action-btn p-2 text-xs rounded text-gray-400 hover:bg-gray-700 hover:text-gray-200":"mermaid-action-btn p-2 text-xs rounded text-gray-600 hover:bg-gray-200 hover:text-gray-700",[f.isDark]),Oe=a(e=>{var t;const n={payload:{type:"toggle-mode",target:e},defaultPrevented:!1,preventDefault(){this.defaultPrevented=!0}};if(null==(t=f.onToggleMode)||t.call(f,e,n),!n.defaultPrevented)if(pe.current=!0,"preview"===e){B(!1);const e=xe.current;P(e.zoom),R({x:e.translateX,y:e.translateY}),J(e.containerHeight),ge.current&&me.current[ye]&&re.current?(re.current.innerHTML=me.current[ye],je()):Ne(y)}else xe.current={zoom:D,translateX:W.x,translateY:W.y,containerHeight:Z},B(!0)},[y,Z,Ne,f,ye,W.x,W.y,je,D]),Pe=a(e=>{if(!1===f.enableWheelZoom)return;if(!e.ctrlKey&&!e.metaKey)return;e.preventDefault();const t=te.current;if(!t)return;const n=t.getBoundingClientRect(),r=e.clientX-n.left-W.x,o=e.clientY-n.top-W.y,i=.01*-e.deltaY,s=On(D+i,.5,3);if(s===D)return;const a=s/D;R({x:W.x-r*(a-1),y:W.y-o*(a-1)}),P(s)},[W,D]),We=a((e,t)=>{I(!0),ce.current={x:e-W.x,y:t-W.y}},[W.x,W.y]),Re=a((e,t)=>{A&&R({x:e-ce.current.x,y:t-ce.current.y})},[A]),Ae=a(()=>{I(!1)},[]),Ie=/* @__PURE__ */C.jsxs("div",{className:"relative",children:[f.showZoomControls&&/* @__PURE__ */C.jsx("div",{className:"absolute top-2 right-2 z-10 rounded-lg",children:/* @__PURE__ */C.jsxs("div",{className:"flex items-center gap-2 backdrop-blur rounded-lg",children:[
|
|
101
101
|
/* @__PURE__ */C.jsx("button",{type:"button",className:Xe("p-2 text-xs rounded transition-colors",f.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,g("common.zoomIn")),onMouseLeave:()=>ie(),onClick:()=>P(On(D+.1,.5,3)),children:"+"}),
|
|
102
102
|
/* @__PURE__ */C.jsx("button",{type:"button",className:Xe("p-2 text-xs rounded transition-colors",f.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,g("common.zoomOut")),onMouseLeave:()=>ie(),onClick:()=>P(On(D-.1,.5,3)),children:"−"}),
|
|
103
|
-
/* @__PURE__ */C.jsxs("button",{type:"button",className:Xe("p-2 text-xs rounded transition-colors",f.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,g("common.resetZoom")),onMouseLeave:()=>ie(),onClick:()=>{P(1),
|
|
104
|
-
/* @__PURE__ */C.jsxs("div",{ref:te,className:Xe("min-h-[360px] relative transition-all duration-100 overflow-hidden block",f.isDark?"bg-gray-900":"bg-gray-50"),style:{height:Z,maxHeight:null!=(p=f.maxHeight)?p:void 0},onWheel:Pe,onMouseDown:e=>{0===e.button&&(e.preventDefault(),
|
|
105
|
-
/* @__PURE__ */C.jsx("div",{ref:ne,"data-mermaid-wrapper":!0,className:Xe("absolute inset-0 cursor-grab",{"cursor-grabbing":A}),style:{transform:`translate(${
|
|
103
|
+
/* @__PURE__ */C.jsxs("button",{type:"button",className:Xe("p-2 text-xs rounded transition-colors",f.isDark?"text-gray-400 hover:bg-gray-700":"text-gray-600 hover:bg-gray-200"),onMouseEnter:e=>Se(e,g("common.resetZoom")),onMouseLeave:()=>ie(),onClick:()=>{P(1),R({x:0,y:0})},children:[Math.round(100*D),"%"]})]})}),
|
|
104
|
+
/* @__PURE__ */C.jsxs("div",{ref:te,className:Xe("min-h-[360px] relative transition-all duration-100 overflow-hidden block",f.isDark?"bg-gray-900":"bg-gray-50"),style:{height:Z,maxHeight:null!=(p=f.maxHeight)?p:void 0},onWheel:Pe,onMouseDown:e=>{0===e.button&&(e.preventDefault(),We(e.clientX,e.clientY))},onMouseMove:e=>Re(e.clientX,e.clientY),onMouseUp:Ae,onMouseLeave:Ae,onTouchStart:e=>{const t=e.touches[0];t&&We(t.clientX,t.clientY)},onTouchMove:e=>{const t=e.touches[0];t&&Re(t.clientX,t.clientY)},onTouchEnd:Ae,children:[
|
|
105
|
+
/* @__PURE__ */C.jsx("div",{ref:ne,"data-mermaid-wrapper":!0,className:Xe("absolute inset-0 cursor-grab",{"cursor-grabbing":A}),style:{transform:`translate(${W.x}px, ${W.y}px) scale(${D})`},children:/* @__PURE__ */C.jsx("div",{ref:re,className:"_mermaid w-full text-center flex items-center justify-center min-h-full"})}),(F||ve)&&/* @__PURE__ */C.jsxs("div",{className:"mermaid-loading",children:[
|
|
106
106
|
/* @__PURE__ */C.jsx("span",{className:"mermaid-spinner"}),
|
|
107
107
|
/* @__PURE__ */C.jsx("span",{children:"Rendering diagram…"})]})]})]}),Fe=f.showHeader&&/* @__PURE__ */C.jsxs("div",{className:Xe("mermaid-block-header flex justify-between items-center px-4 py-2.5 border-b",f.isDark?"bg-gray-800 border-gray-700/30":"bg-gray-50 border-gray-200"),children:[
|
|
108
108
|
/* @__PURE__ */C.jsxs("div",{className:"flex items-center space-x-2 overflow-hidden",children:[
|
|
@@ -127,7 +127,7 @@ return C.jsxs(C.Fragment,{children:[
|
|
|
127
127
|
/* @__PURE__ */C.jsxs("div",{className:"mermaid-modal-header",children:[
|
|
128
128
|
/* @__PURE__ */C.jsx("span",{className:"mermaid-modal-title",children:"Mermaid Preview"}),
|
|
129
129
|
/* @__PURE__ */C.jsx("button",{type:"button",className:"mermaid-modal-close",onClick:Te,children:"Close"})]}),
|
|
130
|
-
/* @__PURE__ */C.jsx("div",{className:"mermaid-modal-body",children:/* @__PURE__ */C.jsx("div",{ref:ae,className:"mermaid-modal-content"})})]})}),document.body)]})}function On(e,t,n){return Math.min(Math.max(e,t),n)}function Pn(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function
|
|
130
|
+
/* @__PURE__ */C.jsx("div",{className:"mermaid-modal-body",children:/* @__PURE__ */C.jsx("div",{ref:ae,className:"mermaid-modal-content"})})]})}),document.body)]})}function On(e,t,n){return Math.min(Math.max(e,t),n)}function Pn(e,t){return e.trimStart().startsWith("%%{")?e:`%%{init: {"theme": "${"dark"===t?"dark":"default"}"}}%%\n${e}`}function Wn(e){const t=e.split("\n");for(;t.length>0;){const e=t[t.length-1].trimEnd();if(""!==e){if(!(/^[-=~>|<\s]+$/.test(e.trim())||/(?:--|==|~~|->|<-|-\||-\)|-x|o-|\|-|\.-)\s*$/.test(e)||/[-|><]$/.test(e)||/(?:graph|flowchart|sequenceDiagram|classDiagram|stateDiagram|erDiagram|gantt)\s*$/i.test(e)))break;t.pop()}else t.pop()}return t.join("\n")}async function Rn(e,t={}){const{timeoutMs:n,signal:r}=t;return(null==r?void 0:r.aborted)?Promise.reject(new DOMException("Aborted","AbortError")):new Promise((t,o)=>{let i=!1,s=null;function a(){i||(i=!0,l(),o(new DOMException("Aborted","AbortError")))}function l(){null!=s&&clearTimeout(s),r&&r.removeEventListener("abort",a)}r&&r.addEventListener("abort",a,{once:!0}),n&&n>0&&(s=setTimeout(()=>{i||(i=!0,l(),o(new Error("Operation timed out")))},n)),e().then(e=>{i||(i=!0,l(),t(e))}).catch(e=>{i||(i=!0,l(),o(e))})})}function An(e){return(new XMLSerializer).serializeToString(e)}function In(e){const{node:t}=e;/* @__PURE__ */
|
|
131
131
|
return C.jsxs("div",{className:"unknown-node text-sm text-gray-500 italic",children:["Unsupported node type:"," ",String(null==t?void 0:t.type)]})}function Fn(t){var n;const{node:r,ctx:o,renderNode:i,indexKey:s,children:a}=t;if(!o||!i)/* @__PURE__ */
|
|
132
132
|
return C.jsx("p",{dir:"auto",className:"paragraph-node",children:a});const l=null!=(n=r.children)?n:[],c=[],d=[],u=()=>{if(!d.length)return;const e=c.length;c.push(
|
|
133
133
|
/* @__PURE__ */C.jsx("p",{dir:"auto",className:"paragraph-node",children:S(d.slice(),o,`${String(null!=s?s:"paragraph")}-${e}`,i)},`${String(null!=s?s:"paragraph")}-inline-${e}`)),d.length=0};return l.forEach((t,n)=>{M.has(t.type)?(u(),c.push(
|
|
@@ -155,7 +155,7 @@ return C.jsx(ir,{node:t,ctx:r,renderNode:Gn,indexKey:n,typewriter:r.typewriter},
|
|
|
155
155
|
return C.jsx(_t,{node:t,ctx:r,renderNode:Gn,indexKey:n,typewriter:r.typewriter},n);case"list_item":/* @__PURE__ */
|
|
156
156
|
return C.jsx(Tt,{node:t,ctx:r,renderNode:Gn,indexKey:n,typewriter:r.typewriter},n);case"table":/* @__PURE__ */
|
|
157
157
|
return C.jsx(Un,{node:t,ctx:r,renderNode:Gn,indexKey:n,typewriter:r.typewriter},n);case"definition_list":/* @__PURE__ */
|
|
158
|
-
return C.jsx(
|
|
158
|
+
return C.jsx(Re,{node:t,ctx:r,renderNode:Gn,indexKey:n,typewriter:r.typewriter},n);case"footnote":/* @__PURE__ */
|
|
159
159
|
return C.jsx(ze,{node:t,ctx:r,renderNode:Gn,indexKey:n,typewriter:r.typewriter},n);case"footnote_reference":/* @__PURE__ */
|
|
160
160
|
return C.jsx(He,{node:t},n);case"footnote_anchor":/* @__PURE__ */
|
|
161
161
|
return C.jsx(Fe,{node:t},n);case"admonition":/* @__PURE__ */
|
|
@@ -164,7 +164,7 @@ return C.jsx(Ve,{node:t,typewriter:r.typewriter},n);case"link":/* @__PURE__ */
|
|
|
164
164
|
return C.jsx(Et,{node:t,ctx:r,renderNode:Gn,indexKey:n,isDark:r.isDark,typewriter:r.typewriter},n);case"image":/* @__PURE__ */
|
|
165
165
|
return C.jsx(bt,{node:t},n);case"inline_code":/* @__PURE__ */
|
|
166
166
|
return C.jsx(Lt,{node:t,typewriter:r.typewriter},n);case"code_block":return function(t,n,r){var o,i,s,a;const l=ce(String(t.language||""));if("mermaid"===l){const o=H(r.customId).mermaid;if(o)return e.createElement(o,{key:n,node:t,isDark:r.isDark});if(!r.renderCodeBlocksAsPre)/* @__PURE__ */
|
|
167
|
-
return C.jsx(Dn,{node:t,isDark:r.isDark,loading:Boolean(t.loading)},n)}if("infographic"===l){const o=H(r.customId).infographic;return o?e.createElement(o,{key:n,node:t,isDark:r.isDark}):/* @__PURE__ */C.jsx(St,{node:t,isDark:r.isDark,loading:Boolean(t.loading)},n)}return r.renderCodeBlocksAsPre||"mermaid"===l?/* @__PURE__ */C.jsx(Oe,{node:t},n):/* @__PURE__ */C.jsx(
|
|
167
|
+
return C.jsx(Dn,{node:t,isDark:r.isDark,loading:Boolean(t.loading)},n)}if("infographic"===l){const o=H(r.customId).infographic;return o?e.createElement(o,{key:n,node:t,isDark:r.isDark}):/* @__PURE__ */C.jsx(St,{node:t,isDark:r.isDark,loading:Boolean(t.loading)},n)}return r.renderCodeBlocksAsPre||"mermaid"===l?/* @__PURE__ */C.jsx(Oe,{node:t},n):/* @__PURE__ */C.jsx(We,{node:t,loading:Boolean(t.loading),stream:r.codeBlockStream,monacoOptions:null==(o=r.codeBlockThemes)?void 0:o.monacoOptions,themes:null==(i=r.codeBlockThemes)?void 0:i.themes,minWidth:null==(s=r.codeBlockThemes)?void 0:s.minWidth,maxWidth:null==(a=r.codeBlockThemes)?void 0:a.maxWidth,isDark:r.isDark,onCopy:r.events.onCopy,...r.codeBlockProps||{}},n)}(t,n,r);case"strong":/* @__PURE__ */
|
|
168
168
|
return C.jsx(Vn,{node:t,children:S(t.children,r,`${String(n)}-strong`,Gn)},n);case"emphasis":/* @__PURE__ */
|
|
169
169
|
return C.jsx(Ie,{node:t,children:S(t.children,r,`${String(n)}-em`,Gn)},n);case"strikethrough":/* @__PURE__ */
|
|
170
170
|
return C.jsx(Hn,{node:t,children:S(t.children,r,`${String(n)}-strike`,Gn)},n);case"highlight":/* @__PURE__ */
|
|
@@ -179,10 +179,10 @@ return C.jsx(on,{node:t},n);case"math_block":/* @__PURE__ */
|
|
|
179
179
|
return C.jsx(rn,{node:t},n);case"reference":/* @__PURE__ */
|
|
180
180
|
return C.jsx(zn,{node:t,ctx:r,typewriter:r.typewriter},n);case"html_block":case"html_inline":return"html_block"===t.type?/* @__PURE__ */C.jsx(it,{node:t,typewriter:r.typewriter,customId:r.customId},n):/* @__PURE__ */C.jsx(yt,{node:t,typewriter:r.typewriter,customId:r.customId},n);case"vmr_container":/* @__PURE__ */
|
|
181
181
|
return C.jsx(Zn,{node:t,ctx:r,renderNode:Gn,indexKey:n,typewriter:r.typewriter},n);case"label_open":case"label_close":return null;default:/* @__PURE__ */
|
|
182
|
-
return C.jsx(In,{node:t},n)}}const Qn={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},er=d();function tr(e){const t=String(null!=e?e:"").trim();if(!t)return"";const n=t.match(/^[<\s/]*([A-Z][\w-]*)/i);return n?n[1].toLowerCase():""}function nr(e){return/^[a-z][a-z0-9-]*$/.test(e)}const rr=e.memo(({props:e,parsedNodes:r,renderCtx:o,indexPrefix:l,containerRef:c})=>{var d,u,m,h,p,f,g;const x=O(),w="undefined"!=typeof window,v="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,y=Math.max(0,Math.trunc(null!=(d=e.renderBatchSize)?d:80)),k=Math.max(0,Math.trunc(null!=(u=e.initialRenderBatchSize)?u:y||r.length)),b=!1!==e.batchRendering&&y>0&&w,j=Math.max(0,null!=(m=e.liveNodeBuffer)?m:60),M=Math.max(1,null!=(h=e.maxLiveNodes)?h:320),N=(null!=(p=e.maxLiveNodes)?p:0)>0&&r.length>M,S=!1!==e.viewportPriority,L=b&&(null!=(f=e.maxLiveNodes)?f:0)<=0,B=t(()=>{var t;return!1!==e.deferNodesUntilVisible&&!((null!=(t=e.maxLiveNodes)?t:0)<=0)&&!N&&!(r.length>900)&&S},[r.length,e.deferNodesUntilVisible,e.maxLiveNodes,S,N]),[E,T]=n(()=>L?Math.min(r.length,k):r.length),_=i(E);s(()=>{_.current=E},[E]);const $=L?E:r.length,[D,P]=n(0),[R
|
|
183
|
-
return C.jsxs("div",{ref:c,className:`markstream-react markdown-renderer${e.isDark?" dark":""}${N?" virtualized":""}`,onClick:e.onClick,onMouseOver:we(e.onMouseOver),onMouseOut:we(e.onMouseOut),children:[ve,oe.map(({node:t,index:n})=>{var r;const i=xe(n),s=null!=(r=A.current.get(n))?r:re,a=!1!==e.typewriter&&"code_block"!==t.type&&!K.current.has(n)&&i;return a&&K.current.add(n),/* @__PURE__ */C.jsx("div",{ref:e=>fe(n,e),className:"node-slot","data-node-index":n,"data-node-type":t.type,children:i?/* @__PURE__ */C.jsx("div",{ref:e=>ge(n,e),className:"node-content"+(a?" typewriter-node":""),children:Gn(t,`${l}-${n}`,o)}):/* @__PURE__ */C.jsx("div",{className:"node-placeholder",style:{height:`${s}px`}})},`${l}-${n}`)}),ye]})},function(e,t){if(e.parsedNodes!==t.parsedNodes)return!1;if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;const n=e.props,r=t.props;return n.isDark===r.isDark&&n.typewriter===r.typewriter&&n.batchRendering===r.batchRendering&&n.initialRenderBatchSize===r.initialRenderBatchSize&&n.renderBatchSize===r.renderBatchSize&&n.renderBatchDelay===r.renderBatchDelay&&n.renderBatchBudgetMs===r.renderBatchBudgetMs&&n.renderBatchIdleTimeoutMs===r.renderBatchIdleTimeoutMs&&n.deferNodesUntilVisible===r.deferNodesUntilVisible&&n.maxLiveNodes===r.maxLiveNodes&&n.liveNodeBuffer===r.liveNodeBuffer&&n.viewportPriority===r.viewportPriority&&n.indexKey===r.indexKey&&n.onClick===r.onClick&&n.onMouseOver===r.onMouseOver&&n.onMouseOut===r.onMouseOut}),or=e=>{const n={...Qn,...e},r=i(null),o=i(null),a=l(I,F,F),c=t(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),m=t(()=>{const e=H(n.customId);return Object.keys(e).map(String).map(e=>e.trim().toLowerCase()).filter(nr)},[n.customId,a]),h=t(()=>{var e,t,r;const o=null!=(t=(null!=(e=n.parseOptions)?e:{}).customHtmlTags)?t:[],i=[...null!=(r=n.customHtmlTags)?r:[],...Array.isArray(o)?o:[],...m].map(tr).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,m,a]),p=t(()=>{const e=h;return e&&0!==e.length?d(c,{customHtmlTags:e}):d(c)},[c,h]),f=t(()=>{const e=p;return n.customMarkdownIt?n.customMarkdownIt(e):e},[p,n.customMarkdownIt]),g=t(()=>{var e,t;const r=null!=(e=n.parseOptions)?e:{},o=null!=(t=n.final)?t:r.final,i=h;return i
|
|
182
|
+
return C.jsx(In,{node:t},n)}}const Qn={codeBlockStream:!0,typewriter:!0,batchRendering:!0,initialRenderBatchSize:40,renderBatchSize:80,renderBatchDelay:16,renderBatchBudgetMs:6,renderBatchIdleTimeoutMs:120,deferNodesUntilVisible:!0,maxLiveNodes:320,liveNodeBuffer:60},er=d();function tr(e){const t=String(null!=e?e:"").trim();if(!t)return"";const n=t.match(/^[<\s/]*([A-Z][\w-]*)/i);return n?n[1].toLowerCase():""}function nr(e){return/^[a-z][a-z0-9-]*$/.test(e)}const rr=e.memo(({props:e,parsedNodes:r,renderCtx:o,indexPrefix:l,containerRef:c})=>{var d,u,m,h,p,f,g;const x=O(),w="undefined"!=typeof window,v="undefined"!=typeof window&&"function"==typeof window.requestIdleCallback,y=Math.max(0,Math.trunc(null!=(d=e.renderBatchSize)?d:80)),k=Math.max(0,Math.trunc(null!=(u=e.initialRenderBatchSize)?u:y||r.length)),b=!1!==e.batchRendering&&y>0&&w,j=Math.max(0,null!=(m=e.liveNodeBuffer)?m:60),M=Math.max(1,null!=(h=e.maxLiveNodes)?h:320),N=(null!=(p=e.maxLiveNodes)?p:0)>0&&r.length>M,S=!1!==e.viewportPriority,L=b&&(null!=(f=e.maxLiveNodes)?f:0)<=0,B=t(()=>{var t;return!1!==e.deferNodesUntilVisible&&!((null!=(t=e.maxLiveNodes)?t:0)<=0)&&!N&&!(r.length>900)&&S},[r.length,e.deferNodesUntilVisible,e.maxLiveNodes,S,N]),[E,T]=n(()=>L?Math.min(r.length,k):r.length),_=i(E);s(()=>{_.current=E},[E]);const $=L?E:r.length,[D,P]=n(0),[W,R]=n({start:0,end:r.length}),A=i(/* @__PURE__ */new Map),[I,F]=n(0),z=i({}),H=i(/* @__PURE__ */new Map),V=i(/* @__PURE__ */new Map),K=i(/* @__PURE__ */new Set),X=i(E),U=i(null),q=i(null),Y=i(null),Z=i(!1),J=i(null),G=i(Math.max(1,y||1)),Q=i(r.length),ee=i({key:e.indexKey,total:r.length}),te=i({batchSize:y,initial:k,delay:null!=(g=e.renderBatchDelay)?g:16,enabled:L}),ne=B||N,re=t(()=>{const e=A.current;if(!e.size)return 32;let t=0;for(const n of e.values())t+=n;return Math.max(16,t/e.size)},[I]),oe=t(()=>{if(!N)return r.map((e,t)=>({node:e,index:t}));const e=r.length,t=Math.max(0,Math.min(W.start,e)),n=Math.max(t,Math.min(W.end,e));return r.slice(t,n).map((e,n)=>({node:e,index:t+n}))},[r,W,N]),ie=t(()=>{if(!N)return r.length;const e=Math.max(W.end+j,k),t=Math.min(r.length,e);return Math.max(E,t)},[r.length,N,W.end,j,k,E]);Q.current=ie;const se=a((e,t)=>{var n;if(e>=t)return 0;const r=A.current;let o=0;for(let i=e;i<t;i++)o+=null!=(n=r.get(i))?n:re;return o},[re]),ae=N?se(0,Math.min(W.start,r.length)):0,le=N?se(Math.min(W.end,r.length),r.length):0,ce=a(()=>{null!=U.current&&"function"==typeof cancelAnimationFrame&&(cancelAnimationFrame(U.current),U.current=null),null!=q.current&&(window.clearTimeout(q.current),q.current=null),null!=Y.current&&"function"==typeof window.cancelIdleCallback&&(window.cancelIdleCallback(Y.current),Y.current=null),Z.current=!1,J.current=null},[]),de=a(t=>{var n;if(!L)return;const r=Math.max(2,null!=(n=e.renderBatchBudgetMs)?n:6),o=Math.max(1,y||1),i=Math.max(1,Math.floor(o/4));t>1.2*r?G.current=Math.max(i,Math.floor(.7*G.current)):t<.5*r&&G.current<o&&(G.current=Math.min(o,Math.ceil(1.2*G.current)))},[L,e.renderBatchBudgetMs,y]),ue=a((t,n={})=>{var r,o;if(!L)return;const i=Q.current;if(_.current>=i)return;const s=Math.max(1,t),a=e=>{const t="undefined"!=typeof performance?performance.now():Date.now();T(t=>{const n=Math.min(Q.current,t+Math.max(1,e));return _.current=n,n});const n="undefined"!=typeof performance?performance.now():Date.now();de(n-t)},l=()=>{const e=Math.max(1,Math.round(G.current));ue(e)},c=t=>{var n;U.current=null,q.current=null,Y.current=null,Z.current=!1;const r=J.current;if(J.current=null,a(null!=r?r:s),_.current>=Q.current)return;if(!t)return void l();const o=Math.max(2,null!=(n=e.renderBatchBudgetMs)?n:6);for(;_.current<Q.current&&!(("function"==typeof t.timeRemaining?t.timeRemaining():0)<=.5*o);)a(Math.max(1,Math.round(G.current)));_.current<Q.current&&l()};if(!w||n.immediate)return void c();const d=Math.max(0,null!=(r=e.renderBatchDelay)?r:16);if(J.current=null!=J.current?Math.max(J.current,s):s,!Z.current){if(Z.current=!0,v){const t=Math.max(0,null!=(o=e.renderBatchIdleTimeoutMs)?o:120);return void(Y.current=window.requestIdleCallback(e=>c(e),{timeout:t}))}"function"==typeof requestAnimationFrame?U.current=requestAnimationFrame(()=>{0!==d?q.current=window.setTimeout(()=>c(),d):c()}):q.current=window.setTimeout(()=>c(),d)}},[de,v,L,w,e.renderBatchDelay,e.renderBatchBudgetMs,e.renderBatchIdleTimeoutMs]);s(()=>{var t;const n=e.indexKey,o=r.length,i=ee.current,s=void 0!==n?n!==i.key:o!==i.total;ee.current={key:n,total:o};const a=te.current,l=null!=(t=e.renderBatchDelay)?t:16,c=a.batchSize!==y||a.initial!==k||a.delay!==l||a.enabled!==L;if(te.current={batchSize:y,initial:k,delay:l,enabled:L},(s||c||!L)&&ce(),(s||c)&&(G.current=Math.max(1,y||1),K.current.clear()),!o)return _.current=0,void T(0);const d=Q.current;if(!L)return _.current=d,void T(d);if(s||c){const e=Math.min(d,k);return _.current=e,T(e),void(e<d&&ue(Math.max(1,k),{immediate:!w}))}const u=Math.min(_.current,d);u!==_.current&&(_.current=u,T(u)),_.current<d&&ue(Math.max(1,y||1))},[ce,L,w,r.length,e.indexKey,e.renderBatchDelay,y,k,ue]),s(()=>{if(!N)return void R({start:0,end:r.length});const e=r.length;if(!e)return void R({start:0,end:0});const t=Math.max(0,Math.min(D,e-1));let n=Math.max(0,t-j),o=Math.min(e,t+j+1);const i=o-n;if(i>M){const e=i-M;n+=Math.ceil(e/2),o-=Math.floor(e/2)}else if(i<M){const t=M-i;n=Math.max(0,n-Math.ceil(t/2)),o=Math.min(e,o+Math.floor(t/2))}R({start:n,end:o})},[D,j,M,r.length,N]),s(()=>()=>{ce();for(const e of H.current.values())e.destroy();H.current.clear()},[ce]);const me=a(e=>{for(const[t,n]of H.current.entries())t>=e&&(n.destroy(),H.current.delete(t),delete z.current[t],V.current.delete(t))},[]);s(()=>{me($)},[me,$]),s(()=>{const e=r.length;let t=!1;for(const n of Array.from(A.current.keys()))n>=e&&(A.current.delete(n),t=!0);t&&F(e=>e+1);for(const n of Object.keys(z.current))Number(n)>=e&&delete z.current[n];for(const n of Array.from(K.current))n>=e&&K.current.delete(n)},[r.length]);const he=a((e,t)=>{B&&t&&(z.current[e]=!0),t&&N&&P(t=>e>t?e:t)},[B,N]),pe=a(e=>{const t=H.current.get(e);t&&(t.destroy(),H.current.delete(e))},[]),fe=a((e,t)=>{const n=V.current;if(t?n.set(e,t):n.delete(e),!ne||!t)return pe(e),B&&!t&&delete z.current[e],void(t&&he(e,!0));if(e<k&&!N)return pe(e),void he(e,!0);pe(e);const r=x(t,{rootMargin:"400px"});H.current.set(e,r),r.isVisible()&&he(e,!0),r.whenVisible.then(()=>he(e,!0)).catch(()=>{})},[B,pe,he,x,k,ne,N]),ge=a((e,t)=>{if(!t)return void(A.current.has(e)&&(A.current.delete(e),F(e=>e+1)));const n=()=>{const n=t.offsetHeight;n&&A.current.get(e)!==n&&(A.current.set(e,n),F(e=>e+1))};"function"==typeof queueMicrotask?queueMicrotask(n):Promise.resolve().then(n)},[]),xe=a(e=>!(L&&e>=_.current)&&(!B||e<k||!0===z.current[e]),[B,L,k]),we=a(e=>t=>{if(!e)return;const n=t.target;(null==n?void 0:n.closest("[data-node-index]"))&&e(t)},[]);s(()=>{for(const[e,t]of V.current.entries())t&&fe(e,t)},[fe]),s(()=>{N&&E>X.current&&P(E-1),X.current=E},[E,N]);const ve=N?/* @__PURE__ */C.jsx("div",{className:"node-spacer",style:{height:`${ae}px`},"aria-hidden":"true"}):null,ye=N?/* @__PURE__ */C.jsx("div",{className:"node-spacer",style:{height:`${le}px`},"aria-hidden":"true"}):null;/* @__PURE__ */
|
|
183
|
+
return C.jsxs("div",{ref:c,className:`markstream-react markdown-renderer${e.isDark?" dark":""}${N?" virtualized":""}`,onClick:e.onClick,onMouseOver:we(e.onMouseOver),onMouseOut:we(e.onMouseOut),children:[ve,oe.map(({node:t,index:n})=>{var r;const i=xe(n),s=null!=(r=A.current.get(n))?r:re,a=!1!==e.typewriter&&"code_block"!==t.type&&!K.current.has(n)&&i;return a&&K.current.add(n),/* @__PURE__ */C.jsx("div",{ref:e=>fe(n,e),className:"node-slot","data-node-index":n,"data-node-type":t.type,children:i?/* @__PURE__ */C.jsx("div",{ref:e=>ge(n,e),className:"node-content"+(a?" typewriter-node":""),children:Gn(t,`${l}-${n}`,o)}):/* @__PURE__ */C.jsx("div",{className:"node-placeholder",style:{height:`${s}px`}})},`${l}-${n}`)}),ye]})},function(e,t){if(e.parsedNodes!==t.parsedNodes)return!1;if(e.renderCtx!==t.renderCtx)return!1;if(e.indexPrefix!==t.indexPrefix)return!1;if(e.containerRef!==t.containerRef)return!1;const n=e.props,r=t.props;return n.isDark===r.isDark&&n.typewriter===r.typewriter&&n.batchRendering===r.batchRendering&&n.initialRenderBatchSize===r.initialRenderBatchSize&&n.renderBatchSize===r.renderBatchSize&&n.renderBatchDelay===r.renderBatchDelay&&n.renderBatchBudgetMs===r.renderBatchBudgetMs&&n.renderBatchIdleTimeoutMs===r.renderBatchIdleTimeoutMs&&n.deferNodesUntilVisible===r.deferNodesUntilVisible&&n.maxLiveNodes===r.maxLiveNodes&&n.liveNodeBuffer===r.liveNodeBuffer&&n.viewportPriority===r.viewportPriority&&n.indexKey===r.indexKey&&n.onClick===r.onClick&&n.onMouseOver===r.onMouseOver&&n.onMouseOut===r.onMouseOut}),or=e=>{const n={...Qn,...e},r=i(null),o=i(null),a=l(I,F,F),c=t(()=>n.customId?`renderer-${n.customId}`:`renderer-${Date.now()}-${Math.random().toString(36).slice(2)}`,[n.customId]),m=t(()=>{const e=H(n.customId);return Object.keys(e).map(String).map(e=>e.trim().toLowerCase()).filter(nr)},[n.customId,a]),h=t(()=>{var e,t,r;const o=null!=(t=(null!=(e=n.parseOptions)?e:{}).customHtmlTags)?t:[],i=[...null!=(r=n.customHtmlTags)?r:[],...Array.isArray(o)?o:[],...m].map(tr).filter(Boolean);return Array.from(new Set(i))},[n.customId,n.customHtmlTags,n.parseOptions,m,a]),p=t(()=>{const e=h;return e&&0!==e.length?d(c,{customHtmlTags:e}):d(c)},[c,h]),f=t(()=>{const e=p;return n.customMarkdownIt?n.customMarkdownIt(e):e},[p,n.customMarkdownIt]),g=t(()=>{var e,t;const r=null!=(e=n.parseOptions)?e:{},o=null!=(t=n.final)?t:r.final,i=null!=o,s=h.length>0;return i||s?{...r,...i?{final:o}:{},...s?{customHtmlTags:h}:{}}:r},[h,n.final,n.parseOptions]),x=t(()=>{var e,t;const r=Boolean(n.debugPerformance)&&"undefined"!=typeof console&&"undefined"!=typeof performance,o=r?performance.now():0;let i=[];return Array.isArray(n.nodes)&&n.nodes.length?i=n.nodes.map(e=>({...e})):n.content&&(i=u(n.content,null!=f?f:er,g)),r&&console.info("[markstream-react][perf] parse(sync)",{ms:Math.round(performance.now()-o),nodes:i.length,contentLength:null!=(t=null==(e=n.content)?void 0:e.length)?t:0}),i},[n.content,n.debugPerformance,n.nodes,g,f,n.customId,a,h]);if(s(()=>{var e,t;if("undefined"==typeof window)return;if(n.renderCodeBlocksAsPre)return;if(!x.some(e=>{var t;return"code_block"===(null==e?void 0:e.type)&&"mermaid"!==ce(String(null!=(t=null==e?void 0:e.language)?t:""))}))return;const r=null!=(e=window.requestIdleCallback)?e:(e,t)=>{var n;return window.setTimeout(()=>e({didTimeout:!0,timeRemaining:()=>0}),null!=(n=null==t?void 0:t.timeout)?n:600)},o=null!=(t=window.cancelIdleCallback)?t:e=>window.clearTimeout(e),i=r(()=>{xe()},{timeout:900});return()=>o(i)},[x,n.renderCodeBlocksAsPre]),"undefined"!=typeof window&&!n.renderCodeBlocksAsPre){const e=n.isDark?n.codeBlockDarkTheme:n.codeBlockLightTheme,t="string"==typeof e?e:"object"==typeof e&&e&&"name"in e?String(e.name):null;t&&o.current!==t&&(o.current=t,function(e){if(null==e)return;const t=function(e){if(null==e)return null;if("string"==typeof e)return e;if("object"==typeof e&&e&&"name"in e)return String(e.name);if("object"==typeof e){const t=_e.get(e);if(t)return t;try{const t=JSON.stringify(e);if(t)return _e.set(e,t),t}catch{}const n="__theme_"+ ++$e;return _e.set(e,n),n}return String(e)}(e);t&&Be!==t&&(Le=e,Be=t,Ee&&Se(Le,Ee).then(()=>De()).catch(()=>{}))}(e))}const w=t(()=>null!=n.indexKey?String(n.indexKey):"markdown-renderer",[n.indexKey]),v=t(()=>({customId:n.customId,isDark:n.isDark,indexKey:w,typewriter:n.typewriter,renderCodeBlocksAsPre:n.renderCodeBlocksAsPre,codeBlockStream:n.codeBlockStream,codeBlockProps:n.codeBlockProps,codeBlockThemes:{themes:n.themes,monacoOptions:n.codeBlockMonacoOptions,minWidth:n.codeBlockMinWidth,maxWidth:n.codeBlockMaxWidth},events:{onCopy:n.onCopy,onHandleArtifactClick:n.onHandleArtifactClick}}),[n.customId,n.isDark,w,n.typewriter,n.renderCodeBlocksAsPre,n.codeBlockStream,n.codeBlockProps,n.themes,n.codeBlockMonacoOptions,n.codeBlockMinWidth,n.codeBlockMaxWidth,n.onCopy,n.onHandleArtifactClick]);/* @__PURE__ */
|
|
184
184
|
return C.jsx(D,{getRoot:()=>r.current,enabled:!1!==n.viewportPriority,children:/* @__PURE__ */C.jsx(rr,{props:n,parsedNodes:x,renderCtx:v,indexPrefix:w,containerRef:r})})};function ir(e){var t,n,r,o,i,s;const{node:a,ctx:l,renderNode:c,indexKey:d,children:u}=e;/* @__PURE__ */
|
|
185
|
-
return C.jsx("blockquote",{className:"blockquote-node",dir:"auto",cite:a.cite,children:null!=u?u:l&&c?/* @__PURE__ */C.jsx(or,{nodes:a.children||[],indexKey:`blockquote-${String(null!=d?d:"blockquote")}`,customId:l.customId,isDark:l.isDark,typewriter:l.typewriter,viewportPriority:!0,codeBlockStream:l.codeBlockStream,renderCodeBlocksAsPre:l.renderCodeBlocksAsPre,codeBlockProps:l.codeBlockProps,themes:null==(t=l.codeBlockThemes)?void 0:t.themes,codeBlockDarkTheme:null==(n=l.codeBlockThemes)?void 0:n.darkTheme,codeBlockLightTheme:null==(r=l.codeBlockThemes)?void 0:r.lightTheme,codeBlockMonacoOptions:null==(o=l.codeBlockThemes)?void 0:o.monacoOptions,codeBlockMinWidth:null==(i=l.codeBlockThemes)?void 0:i.minWidth,codeBlockMaxWidth:null==(s=l.codeBlockThemes)?void 0:s.maxWidth,onCopy:l.events.onCopy,onHandleArtifactClick:l.events.onHandleArtifactClick}):null})}function sr(e){const r={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0,...e},o=t(()=>{var e;return String(null!=(e=r.node.language)?e:"")},[r.node.language]),l=t(()=>function(e){var t;const[n]=String(null!=e?e:"").split(":");return(null!=(t=null==n?void 0:n.trim().toLowerCase())?t:"")||"plaintext"}(o),[o]),c=t(()=>ce(o),[o]),d=t(()=>{const e=me[c]||c;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[c]),u=t(()=>ue(c),[c]),{t:m}=Y(),h=t(()=>!!r.isShowPreview&&("html"===c||"svg"===c),[c,r.isShowPreview]),p=t(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n=t(r.minWidth),o=t(r.maxWidth);return n&&(e.minWidth=n),o&&(e.maxWidth=o),e},[r.maxWidth,r.minWidth]),[f,g]=n(!1),[x,w]=n(!1),[v,y]=n(!1),[k,b]=n(""),[j,M]=n(!1),[N,S]=n(14),[L,B]=n(N),E=i(null),T=i(null),_=i(null),$=i(null),D=i(!1),O=a(()=>r.isDark?r.darkTheme:r.lightTheme,[r.darkTheme,r.isDark,r.lightTheme]),P=a(e=>{if(!e)return b(""),void M(!1);var t;b(`<pre class="shiki shiki-fallback"><code>${t=e,t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`),M(!1)},[]),
|
|
185
|
+
return C.jsx("blockquote",{className:"blockquote-node",dir:"auto",cite:a.cite,children:null!=u?u:l&&c?/* @__PURE__ */C.jsx(or,{nodes:a.children||[],indexKey:`blockquote-${String(null!=d?d:"blockquote")}`,customId:l.customId,isDark:l.isDark,typewriter:l.typewriter,viewportPriority:!0,codeBlockStream:l.codeBlockStream,renderCodeBlocksAsPre:l.renderCodeBlocksAsPre,codeBlockProps:l.codeBlockProps,themes:null==(t=l.codeBlockThemes)?void 0:t.themes,codeBlockDarkTheme:null==(n=l.codeBlockThemes)?void 0:n.darkTheme,codeBlockLightTheme:null==(r=l.codeBlockThemes)?void 0:r.lightTheme,codeBlockMonacoOptions:null==(o=l.codeBlockThemes)?void 0:o.monacoOptions,codeBlockMinWidth:null==(i=l.codeBlockThemes)?void 0:i.minWidth,codeBlockMaxWidth:null==(s=l.codeBlockThemes)?void 0:s.maxWidth,onCopy:l.events.onCopy,onHandleArtifactClick:l.events.onHandleArtifactClick}):null})}function sr(e){const r={loading:!0,stream:!0,darkTheme:"vitesse-dark",lightTheme:"vitesse-light",isDark:!1,isShowPreview:!0,enableFontSizeControl:!0,showHeader:!0,showCopyButton:!0,showExpandButton:!0,showPreviewButton:!0,showFontSizeButtons:!0,...e},o=t(()=>{var e;return String(null!=(e=r.node.language)?e:"")},[r.node.language]),l=t(()=>function(e){var t;const[n]=String(null!=e?e:"").split(":");return(null!=(t=null==n?void 0:n.trim().toLowerCase())?t:"")||"plaintext"}(o),[o]),c=t(()=>ce(o),[o]),d=t(()=>{const e=me[c]||c;return e?e.charAt(0).toUpperCase()+e.slice(1):"Text"},[c]),u=t(()=>ue(c),[c]),{t:m}=Y(),h=t(()=>!!r.isShowPreview&&("html"===c||"svg"===c),[c,r.isShowPreview]),p=t(()=>{const e={},t=e=>{if(null!=e)return"number"==typeof e?`${e}px`:String(e)},n=t(r.minWidth),o=t(r.maxWidth);return n&&(e.minWidth=n),o&&(e.maxWidth=o),e},[r.maxWidth,r.minWidth]),[f,g]=n(!1),[x,w]=n(!1),[v,y]=n(!1),[k,b]=n(""),[j,M]=n(!1),[N,S]=n(14),[L,B]=n(N),E=i(null),T=i(null),_=i(null),$=i(null),D=i(!1),O=a(()=>r.isDark?r.darkTheme:r.lightTheme,[r.darkTheme,r.isDark,r.lightTheme]),P=a(e=>{if(!e)return b(""),void M(!1);var t;b(`<pre class="shiki shiki-fallback"><code>${t=e,t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}</code></pre>`),M(!1)},[]),W=a(()=>{b(""),M(!0)},[]),R=a(async()=>{if(!$.current&&!D.current){D.current=!0;try{const e=await import("stream-markdown");$.current=e.createShikiStreamRenderer}catch{}}},[]),A=a(async()=>{if(await R(),E.current&&T.current)if(!_.current&&$.current&&(_.current=$.current(T.current,{theme:O(),themes:r.themes}),M(!0)),_.current)if(!1===r.stream&&r.loading)P(r.node.code);else{P(r.node.code);try{await _.current.updateCode(r.node.code,l),W()}catch{}}else P(r.node.code);else P(r.node.code)},[W,R,O,l,r.loading,r.node.code,r.stream,r.themes,P]);s(()=>(A(),()=>{var e;null==(e=_.current)||e.dispose(),_.current=null}),[A]),s(()=>{_.current&&_.current.setTheme(O())},[O]),s(()=>{_.current&&(!1===r.stream&&r.loading||(P(r.node.code),Promise.resolve(_.current.updateCode(r.node.code,l)).then(()=>W()).catch(()=>{})))},[W,l,r.loading,r.node.code,r.stream,P]);const I=a((e,t)=>{oe(e.currentTarget,t,"top",!1,(e.clientX,e.clientY),r.isDark)},[r.isDark]),F=a(()=>ie(),[]),z=a(async()=>{var e;try{"undefined"!=typeof navigator&&navigator.clipboard&&"function"==typeof navigator.clipboard.writeText&&await navigator.clipboard.writeText(r.node.code),g(!0),null==(e=r.onCopy)||e.call(r,r.node.code),setTimeout(()=>g(!1),1e3)}catch{}},[r]),H=a(()=>{var e;if(!h)return;const t="html"===l?"text/html":"image/svg+xml",n="html"===l?"HTML Preview":"SVG Preview";null==(e=r.onPreviewCode)||e.call(r,{type:t,content:r.node.code,title:n})},[h,l,r]),V=t(()=>({fontSize:`${L}px`}),[L]);return s(()=>{S(14),B(14)},[]),/* @__PURE__ */C.jsxs("div",{className:["code-block-container my-4 rounded-lg border overflow-hidden shadow-sm",r.isDark?"border-gray-700/30 bg-gray-900 is-dark":"border-gray-200 bg-white"].join(" "),style:p,children:[r.showHeader&&/* @__PURE__ */C.jsxs("div",{className:"code-block-header flex justify-between items-center px-4 py-2.5 border-b border-gray-400/5",style:{color:"var(--vscode-editor-foreground)",backgroundColor:"var(--vscode-editor-background)"},children:[
|
|
186
186
|
/* @__PURE__ */C.jsxs("div",{className:"flex items-center space-x-2",children:[
|
|
187
187
|
/* @__PURE__ */C.jsx("span",{className:"icon-slot h-4 w-4 flex-shrink-0",dangerouslySetInnerHTML:{__html:u}}),
|
|
188
188
|
/* @__PURE__ */C.jsx("span",{className:"text-sm font-medium font-mono",children:d})]}),
|
|
@@ -202,4 +202,4 @@ return C.jsx("blockquote",{className:"blockquote-node",dir:"auto",cite:a.cite,ch
|
|
|
202
202
|
/* @__PURE__ */C.jsx("div",{className:"skeleton-line"}),
|
|
203
203
|
/* @__PURE__ */C.jsx("div",{className:"skeleton-line short"})]})}),
|
|
204
204
|
/* @__PURE__ */C.jsx("span",{className:"sr-only","aria-live":"polite",role:"status",children:f?m("common.copied")||"Copied":""})]})}function ar(e){var r;const o=i(null),[a,l]=n(!1),[c,d]=n({transform:"translate3d(0px, 0px, 0px)",left:"0px",top:"0px"}),u=t(()=>function(e){if("boolean"==typeof e)return e;if("undefined"!=typeof document)try{if(document.documentElement.classList.contains("dark"))return!0}catch{}if("undefined"!=typeof window&&"function"==typeof window.matchMedia)try{return window.matchMedia("(prefers-color-scheme: dark)").matches}catch{}return!1}(e.isDark),[e.isDark]);return s(()=>{if(!e.visible)return void l(!1);if(!e.anchorEl||!o.current)return void l(!0);let t=null,n=!1;const r=async()=>{var t,r;if(!e.anchorEl||!o.current)return;const{x:i,y:s}=await h(e.anchorEl,o.current,{placement:null!=(t=e.placement)?t:"top",middleware:[p(null!=(r=e.offset)?r:8),f(),g({padding:8})],strategy:"fixed"});n||d({position:"fixed",left:"0px",top:"0px",transform:`translate3d(${Math.round(i)}px, ${Math.round(s)}px, 0)`})};return r().then(()=>{n||l(!0)}),t=m(e.anchorEl,o.current,r),()=>{n=!0,null==t||t()}},[e.anchorEl,e.offset,e.placement,e.visible]),"undefined"==typeof document?null:e.visible&&a?x(
|
|
205
|
-
/* @__PURE__ */C.jsx("div",{id:null!=(r=e.id)?r:void 0,ref:o,style:c,className:["ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",u?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:e.content}),document.body):null}export{E as AdmonitionNode,ir as BlockquoteNode,X as CheckboxNode,
|
|
205
|
+
/* @__PURE__ */C.jsx("div",{id:null!=(r=e.id)?r:void 0,ref:o,style:c,className:["ms-tooltip z-[9999] inline-block text-base py-2 px-3 rounded-md shadow-md whitespace-nowrap pointer-events-none border tooltip-element",u?"bg-gray-900 text-white border-gray-700 is-dark":"bg-white text-gray-900 border-gray-200"].join(" "),role:"tooltip",children:e.content}),document.body):null}export{E as AdmonitionNode,ir as BlockquoteNode,X as CheckboxNode,We as CodeBlockNode,Re as DefinitionListNode,Ae as EmojiNode,Ie as EmphasisNode,In as FallbackComponent,Fe as FootnoteAnchorNode,ze as FootnoteNode,He as FootnoteReferenceNode,Ve as HardBreakNode,Ue as HeadingNode,qe as HighlightNode,it as HtmlBlockNode,yt as HtmlInlineNode,he as HtmlPreviewFrame,bt as ImageNode,St as InfographicBlockNode,Lt as InlineCodeNode,Bt as InsertNode,Et as LinkNode,Tt as ListItemNode,_t as ListNode,pn as MERMAID_WORKER_BUSY_CODE,sr as MarkdownCodeBlockNode,rn as MathBlockNode,on as MathInlineNode,Dn as MermaidBlockNode,or as NodeRenderer,Fn as ParagraphNode,Oe as PreCodeNode,We as ReactCodeBlockNode,zn as ReferenceNode,Hn as StrikethroughNode,Vn as StrongNode,Kn as SubscriptNode,Xn as SuperscriptNode,Un as TableNode,qn as TextNode,Yn as ThematicBreakNode,ar as Tooltip,Zn as VmrContainerNode,Vt as WORKER_BUSY_CODE,wn as canParseOffthread,K as clearGlobalCustomComponents,Ut as clearKaTeXCache,zt as clearKaTeXWorker,gn as clearMermaidWorker,vn as findPrefixOffthread,H as getCustomNodeComponents,Gt as getKaTeXBackpressureDefaults,ue as getLanguageIcon,hn as getMermaidWorkerLoad,me as languageMap,ce as normalizeLanguageIdentifier,V as removeCustomComponents,Kt as renderKaTeXInWorker,Qt as renderKaTeXWithBackpressure,Gn as renderNode,de as resolveMonacoLanguageId,z as setCustomComponents,q as setDefaultI18nMap,Jt as setKaTeXBackpressureDefaults,Xt as setKaTeXCache,qt as setKaTeXConcurrencyLimit,Ft as setKaTeXWorker,Ht as setKaTeXWorkerDebug,ae as setLanguageIconResolver,fn as setMermaidWorker,un as setMermaidWorkerClientDebug,mn as setMermaidWorkerMaxConcurrency,yn as terminateWorker,Y as useSafeI18n,Yt as waitForKaTeXWorkerSlot};
|