@hep-code-runner/react 3.1.0 → 3.1.2
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.js +1 -1
- package/dist/index.mjs +85 -83
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -319,7 +319,7 @@ h1 {
|
|
|
319
319
|
}`,sql:"SELECT 'Hello, World!' AS message;",markdown:`# Hello, World!
|
|
320
320
|
|
|
321
321
|
This is a sample markdown document.`};function je(p){const h=p.toLowerCase();return Nt[h]||`// ${p}
|
|
322
|
-
// Write your code here`}const Ue=({pistonUrl:p="/api/piston",language:h="javascript",theme:n="light",themeColor:u="",showLanguageSelector:b=!0,showEditor:T=!0,editable:_=!0,defaultCode:s="",executorLabel:m="运行",onExecuteStart:S,onExecuteEnd:A,onLanguageChange:I,onChange:P})=>{const[H,Z]=E.useState([]),[F,y]=E.useState(h),[x,t]=E.useState(n),[r,i]=E.useState(s),[o,l]=E.useState(""),[g,k]=E.useState(""),[f,C]=E.useState(!1),[$,G]=E.useState(null),[B,Y]=E.useState("stdout"),[re,ne]=E.useState(null),[ce,j]=E.useState(!0),[W,te]=E.useState(60),[J,z]=E.useState(!1),[se,q]=E.useState(!1),Q=E.useMemo(()=>new It({pistonUrl:p}),[p]),ae=E.useMemo(()=>H.map(O=>({value:`${O.language}:${O.version}`,label:`${O.language.charAt(0).toUpperCase()+O.language.slice(1)} ${O.version}`})),[H]),ie=E.useMemo(()=>{if(!u)return{};const O=n==="dark",D=(Re,be)=>{const he=parseInt(Re.replace("#",""),16),fe=Math.round(2.55*be),xe=Math.min(255,Math.max(0,(he>>16)+fe)),Oe=Math.min(255,Math.max(0,(he>>8&255)+fe)),Ie=Math.min(255,Math.max(0,(he&255)+fe));return"#"+(16777216+xe*65536+Oe*256+Ie).toString(16).slice(1)},Te=(Re=>{const be=parseInt(Re.replace("#",""),16),he=be>>16&255,fe=be>>8&255,xe=be&255;return(.299*he+.587*fe+.114*xe)/255>.5})(u)?"#000":"#fff";return{"--hep-cr-theme-color":u,"--hep-cr-theme-color-hover":O?D(u,20):D(u,-20),"--hep-cr-tab-active-color":Te}},[u,n]),V=E.useMemo(()=>F.includes(":")?F.split(":")[0]:F,[F]);E.useEffect(()=>{async function O(){j(!0),ne(null);try{const D=await Q.getRuntimes();Z(D)}catch(D){ne(D instanceof Error?D.message:"Failed to load runtimes")}finally{j(!1)}}O()},[Q]),E.useEffect(()=>{!r&&H.length>0&&i(s||je(V))},[H,r,s,V]);const ue=E.useCallback(O=>{const D=O.target.value,pe=D.includes(":")?D.split(":")[0]:D;y(D);const me=je(pe);i(me),I==null||I(pe,me)},[I]),oe=E.useCallback(async()=>{if(!f){C(!0),l(""),k(""),G(null),ne(null),Y("stdout"),S==null||S();try{const O=await Q.execute(V,r);l(O.output),k(O.stderr),G(O.executionTime||null),Y(O.stderr?"stderr":"stdout"),A==null||A(O)}catch(O){const D=O instanceof Error?O.message:"Execution failed";ne(D),A==null||A({success:!1,output:"",stderr:D,code:-1})}finally{C(!1)}}},[f,F,r,Q,S,A]);E.useCallback(()=>{l(""),k(""),G(null),ne(null)},[]);const de=E.useCallback(async()=>{await navigator.clipboard.writeText(r),z(!0),setTimeout(()=>{z(!1)},2e3)},[r]),Ee=E.useCallback(async()=>{const O=B==="stdout"?o:g;await navigator.clipboard.writeText(O),q(!0),setTimeout(()=>{q(!1)},2e3)},[B,o,g]),ge=E.useCallback(()=>{i(je(V))},[F]),we=E.useRef(!1),ye=E.useCallback(O=>{we.current=!0,document.addEventListener("mousemove",le),document.addEventListener("mouseup",Ae),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]),le=E.useCallback(O=>{if(!we.current)return;const D=document.querySelector(".hep-cr-main");if(!D)return;const pe=D.getBoundingClientRect(),me=(O.clientX-pe.left)/pe.width*100;te(Math.max(20,Math.min(80,me)))},[]),Ae=E.useCallback(()=>{we.current=!1,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",Ae),document.body.style.cursor="",document.body.style.userSelect=""},[le]);return c.jsxs("div",{className:`hep-cr-runner hep-cr-runner-${x}`,style:ie,children:[c.jsxs("div",{className:"hep-cr-header",children:[c.jsx("div",{className:"hep-cr-controls",children:b&&c.jsxs("select",{value:F,onChange:ue,className:"hep-cr-language-select",disabled:f,children:[ce&&c.jsx("option",{value:"",children:"加载中..."}),ae.map(O=>c.jsx("option",{value:O.value,children:O.label},O.value))]})}),c.jsxs("div",{className:"hep-cr-actions",children:[c.jsxs("button",{className:"hep-cr-btn hep-cr-btn-run",disabled:f||ce,onClick:oe,children:[f?c.jsx("span",{className:"hep-cr-spinner"}):c.jsx("span",{className:"hep-cr-run-icon",children:"▶"}),f?"运行中...":m]}),T&&_&&c.jsx("button",{className:"hep-cr-btn hep-cr-btn-reset",onClick:ge,children:"重置"}),c.jsx("button",{className:"hep-cr-btn hep-cr-btn-theme",onClick:()=>t(x==="light"?"dark":"light"),title:x==="light"?"Switch to dark mode":"Switch to light mode",children:x==="light"?c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:c.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("circle",{cx:"12",cy:"12",r:"5"}),c.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),c.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),c.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),c.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),c.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),c.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),c.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),c.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})})]})]}),re&&c.jsx("div",{className:"hep-cr-error-message",children:re}),c.jsxs("div",{className:"hep-cr-main",children:[T&&c.jsxs("div",{className:"hep-cr-editor-panel",style:{width:`${W}%`},children:[c.jsxs("div",{className:"hep-cr-panel-header",children:[c.jsx("span",{className:"hep-cr-panel-title",children:"编辑器"}),c.jsxs("div",{className:"hep-cr-output-actions",children:[c.jsx("span",{className:"hep-cr-language-badge",children:V}),c.jsx("button",{className:`hep-cr-btn-icon ${J?"hep-cr-btn-copied":""}`,disabled:J,onClick:de,title:J?"已复制":"复制",children:J?c.jsx("span",{className:"hep-cr-copied-text",children:"已复制"}):c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]}),c.jsx(Rt,{value:r,language:V,theme:x,disabled:!_||f,onChange:i,onCodeChange:P})]}),T&&c.jsx("div",{className:"hep-cr-resize-handle",onMouseDown:ye,children:c.jsx("div",{className:"hep-cr-resize-line"})}),c.jsxs("div",{className:"hep-cr-output-panel",style:{width:T?`${100-W}%`:"100%"},children:[c.jsxs("div",{className:"hep-cr-panel-header",children:[c.jsxs("div",{className:"hep-cr-output-tabs",children:[c.jsx("button",{className:`hep-cr-tab ${B==="stdout"?"active":""}`,onClick:()=>Y("stdout"),children:"输出"}),g&&c.jsx("button",{className:`hep-cr-tab hep-cr-tab-error ${B==="stderr"?"active":""}`,onClick:()=>Y("stderr"),children:"错误"})]}),c.jsxs("div",{className:"hep-cr-output-actions",children:[$!==null&&c.jsxs("span",{className:"hep-cr-execution-time",children:[$,"ms"]}),c.jsx("button",{className:`hep-cr-btn-icon ${se?"hep-cr-btn-copied":""}`,disabled:se,onClick:Ee,title:se?"已复制":"复制",children:se?c.jsx("span",{className:"hep-cr-copied-text",children:"已复制"}):c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]}),c.jsx("div",{className:"hep-cr-output-content",children:c.jsx("pre",{children:B==="stdout"?f?"代码执行中...":o||'点击"运行"执行代码':g})})]})]}),c.jsx("style",{children:`
|
|
322
|
+
// Write your code here`}const Ue=({pistonUrl:p="/api/piston",language:h="javascript",theme:n="light",themeColor:u="",showLanguageSelector:b=!0,showEditor:T=!0,editable:_=!0,defaultCode:s="",executorLabel:m="运行",onExecuteStart:S,onExecuteEnd:A,onLanguageChange:I,onChange:P})=>{const[H,Z]=E.useState([]),[F,y]=E.useState(h),[x,t]=E.useState(n),[r,i]=E.useState(s),[o,l]=E.useState(""),[g,k]=E.useState(""),[f,C]=E.useState(!1),[$,G]=E.useState(null),[B,Y]=E.useState("stdout"),[re,ne]=E.useState(null),[ce,j]=E.useState(!0),[W,te]=E.useState(60),[J,z]=E.useState(!1),[se,q]=E.useState(!1),Q=E.useMemo(()=>new It({pistonUrl:p}),[p]),ae=E.useMemo(()=>H.map(O=>({value:`${O.language}:${O.version}`,label:`${O.language.charAt(0).toUpperCase()+O.language.slice(1)} ${O.version}`})),[H]),ie=E.useMemo(()=>{if(!u)return{};const O=n==="dark",D=(Re,be)=>{const he=parseInt(Re.replace("#",""),16),fe=Math.round(2.55*be),xe=Math.min(255,Math.max(0,(he>>16)+fe)),Oe=Math.min(255,Math.max(0,(he>>8&255)+fe)),Ie=Math.min(255,Math.max(0,(he&255)+fe));return"#"+(16777216+xe*65536+Oe*256+Ie).toString(16).slice(1)},Te=(Re=>{const be=parseInt(Re.replace("#",""),16),he=be>>16&255,fe=be>>8&255,xe=be&255;return(.299*he+.587*fe+.114*xe)/255>.5})(u)?"#000":"#fff";return{"--hep-cr-theme-color":u,"--hep-cr-theme-color-hover":O?D(u,20):D(u,-20),"--hep-cr-tab-active-color":Te}},[u,n]),V=E.useMemo(()=>F.includes(":")?F.split(":")[0]:F,[F]);E.useEffect(()=>{async function O(){j(!0),ne(null);try{const D=await Q.getRuntimes();Z(D)}catch(D){ne(D instanceof Error?D.message:"Failed to load runtimes")}finally{j(!1)}}O()},[Q]),E.useEffect(()=>{!r&&H.length>0&&i(s||je(V))},[H,r,s,V]),E.useEffect(()=>{P==null||P(r)},[]);const ue=E.useCallback(O=>{const D=O.target.value,pe=D.includes(":")?D.split(":")[0]:D;y(D);const me=je(pe);i(me),I==null||I(pe,me)},[I]),oe=E.useCallback(async()=>{if(!f){C(!0),l(""),k(""),G(null),ne(null),Y("stdout"),S==null||S();try{const O=await Q.execute(V,r);l(O.output),k(O.stderr),G(O.executionTime||null),Y(O.stderr?"stderr":"stdout"),A==null||A(O)}catch(O){const D=O instanceof Error?O.message:"Execution failed";ne(D),A==null||A({success:!1,output:"",stderr:D,code:-1})}finally{C(!1)}}},[f,F,r,Q,S,A]);E.useCallback(()=>{l(""),k(""),G(null),ne(null)},[]);const de=E.useCallback(async()=>{await navigator.clipboard.writeText(r),z(!0),setTimeout(()=>{z(!1)},2e3)},[r]),Ee=E.useCallback(async()=>{const O=B==="stdout"?o:g;await navigator.clipboard.writeText(O),q(!0),setTimeout(()=>{q(!1)},2e3)},[B,o,g]),ge=E.useCallback(()=>{i(je(V))},[F]),we=E.useRef(!1),ye=E.useCallback(O=>{we.current=!0,document.addEventListener("mousemove",le),document.addEventListener("mouseup",Ae),document.body.style.cursor="col-resize",document.body.style.userSelect="none"},[]),le=E.useCallback(O=>{if(!we.current)return;const D=document.querySelector(".hep-cr-main");if(!D)return;const pe=D.getBoundingClientRect(),me=(O.clientX-pe.left)/pe.width*100;te(Math.max(20,Math.min(80,me)))},[]),Ae=E.useCallback(()=>{we.current=!1,document.removeEventListener("mousemove",le),document.removeEventListener("mouseup",Ae),document.body.style.cursor="",document.body.style.userSelect=""},[le]);return c.jsxs("div",{className:`hep-cr-runner hep-cr-runner-${x}`,style:ie,children:[c.jsxs("div",{className:"hep-cr-header",children:[c.jsx("div",{className:"hep-cr-controls",children:b&&c.jsxs("select",{value:F,onChange:ue,className:"hep-cr-language-select",disabled:f,children:[ce&&c.jsx("option",{value:"",children:"加载中..."}),ae.map(O=>c.jsx("option",{value:O.value,children:O.label},O.value))]})}),c.jsxs("div",{className:"hep-cr-actions",children:[c.jsxs("button",{className:"hep-cr-btn hep-cr-btn-run",disabled:f||ce,onClick:oe,children:[f?c.jsx("span",{className:"hep-cr-spinner"}):c.jsx("span",{className:"hep-cr-run-icon",children:"▶"}),f?"运行中...":m]}),T&&_&&c.jsx("button",{className:"hep-cr-btn hep-cr-btn-reset",onClick:ge,children:"重置"}),c.jsx("button",{className:"hep-cr-btn hep-cr-btn-theme",onClick:()=>t(x==="light"?"dark":"light"),title:x==="light"?"Switch to dark mode":"Switch to light mode",children:x==="light"?c.jsx("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:c.jsx("path",{d:"M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z"})}):c.jsxs("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("circle",{cx:"12",cy:"12",r:"5"}),c.jsx("line",{x1:"12",y1:"1",x2:"12",y2:"3"}),c.jsx("line",{x1:"12",y1:"21",x2:"12",y2:"23"}),c.jsx("line",{x1:"4.22",y1:"4.22",x2:"5.64",y2:"5.64"}),c.jsx("line",{x1:"18.36",y1:"18.36",x2:"19.78",y2:"19.78"}),c.jsx("line",{x1:"1",y1:"12",x2:"3",y2:"12"}),c.jsx("line",{x1:"21",y1:"12",x2:"23",y2:"12"}),c.jsx("line",{x1:"4.22",y1:"19.78",x2:"5.64",y2:"18.36"}),c.jsx("line",{x1:"18.36",y1:"5.64",x2:"19.78",y2:"4.22"})]})})]})]}),re&&c.jsx("div",{className:"hep-cr-error-message",children:re}),c.jsxs("div",{className:"hep-cr-main",children:[T&&c.jsxs("div",{className:"hep-cr-editor-panel",style:{width:`${W}%`},children:[c.jsxs("div",{className:"hep-cr-panel-header",children:[c.jsx("span",{className:"hep-cr-panel-title",children:"编辑器"}),c.jsxs("div",{className:"hep-cr-output-actions",children:[c.jsx("span",{className:"hep-cr-language-badge",children:V}),c.jsx("button",{className:`hep-cr-btn-icon ${J?"hep-cr-btn-copied":""}`,disabled:J,onClick:de,title:J?"已复制":"复制",children:J?c.jsx("span",{className:"hep-cr-copied-text",children:"已复制"}):c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]}),c.jsx(Rt,{value:r,language:V,theme:x,disabled:!_||f,onChange:i,onCodeChange:P})]}),T&&c.jsx("div",{className:"hep-cr-resize-handle",onMouseDown:ye,children:c.jsx("div",{className:"hep-cr-resize-line"})}),c.jsxs("div",{className:"hep-cr-output-panel",style:{width:T?`${100-W}%`:"100%"},children:[c.jsxs("div",{className:"hep-cr-panel-header",children:[c.jsxs("div",{className:"hep-cr-output-tabs",children:[c.jsx("button",{className:`hep-cr-tab ${B==="stdout"?"active":""}`,onClick:()=>Y("stdout"),children:"输出"}),g&&c.jsx("button",{className:`hep-cr-tab hep-cr-tab-error ${B==="stderr"?"active":""}`,onClick:()=>Y("stderr"),children:"错误"})]}),c.jsxs("div",{className:"hep-cr-output-actions",children:[$!==null&&c.jsxs("span",{className:"hep-cr-execution-time",children:[$,"ms"]}),c.jsx("button",{className:`hep-cr-btn-icon ${se?"hep-cr-btn-copied":""}`,disabled:se,onClick:Ee,title:se?"已复制":"复制",children:se?c.jsx("span",{className:"hep-cr-copied-text",children:"已复制"}):c.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[c.jsx("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2"}),c.jsx("path",{d:"M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"})]})})]})]}),c.jsx("div",{className:"hep-cr-output-content",children:c.jsx("pre",{children:B==="stdout"?f?"代码执行中...":o||'点击"运行"执行代码':g})})]})]}),c.jsx("style",{children:`
|
|
323
323
|
.hep-cr-runner {
|
|
324
324
|
display: flex;
|
|
325
325
|
flex-direction: column;
|
package/dist/index.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import tr, { useRef as Pe, useMemo as Ae, useCallback as te, useEffect as
|
|
1
|
+
import tr, { useRef as Pe, useMemo as Ae, useCallback as te, useEffect as Te, useState as X, forwardRef as xr, useImperativeHandle as kr } from "react";
|
|
2
2
|
var Je = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
3
3
|
function wr(p) {
|
|
4
4
|
return p && p.__esModule && Object.prototype.hasOwnProperty.call(p, "default") ? p.default : p;
|
|
5
5
|
}
|
|
6
|
-
var Be = { exports: {} },
|
|
6
|
+
var Be = { exports: {} }, Oe = {};
|
|
7
7
|
/**
|
|
8
8
|
* @license React
|
|
9
9
|
* react-jsx-runtime.production.min.js
|
|
@@ -15,19 +15,19 @@ var Be = { exports: {} }, Ie = {};
|
|
|
15
15
|
*/
|
|
16
16
|
var Qe;
|
|
17
17
|
function Sr() {
|
|
18
|
-
if (Qe) return
|
|
18
|
+
if (Qe) return Oe;
|
|
19
19
|
Qe = 1;
|
|
20
20
|
var p = tr, h = Symbol.for("react.element"), n = Symbol.for("react.fragment"), u = Object.prototype.hasOwnProperty, b = p.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, A = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
21
21
|
function R(s, m, k) {
|
|
22
|
-
var S, I = {},
|
|
23
|
-
k !== void 0 && (
|
|
22
|
+
var S, I = {}, C = null, U = null;
|
|
23
|
+
k !== void 0 && (C = "" + k), m.key !== void 0 && (C = "" + m.key), m.ref !== void 0 && (U = m.ref);
|
|
24
24
|
for (S in m) u.call(m, S) && !A.hasOwnProperty(S) && (I[S] = m[S]);
|
|
25
25
|
if (s && s.defaultProps) for (S in m = s.defaultProps, m) I[S] === void 0 && (I[S] = m[S]);
|
|
26
|
-
return { $$typeof: h, type: s, key:
|
|
26
|
+
return { $$typeof: h, type: s, key: C, ref: U, props: I, _owner: b.current };
|
|
27
27
|
}
|
|
28
|
-
return
|
|
28
|
+
return Oe.Fragment = n, Oe.jsx = R, Oe.jsxs = R, Oe;
|
|
29
29
|
}
|
|
30
|
-
var
|
|
30
|
+
var Ne = {};
|
|
31
31
|
/**
|
|
32
32
|
* @license React
|
|
33
33
|
* react-jsx-runtime.development.js
|
|
@@ -40,7 +40,7 @@ var Oe = {};
|
|
|
40
40
|
var er;
|
|
41
41
|
function Ar() {
|
|
42
42
|
return er || (er = 1, process.env.NODE_ENV !== "production" && function() {
|
|
43
|
-
var p = tr, h = Symbol.for("react.element"), n = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), R = Symbol.for("react.provider"), s = Symbol.for("react.context"), m = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), S = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"),
|
|
43
|
+
var p = tr, h = Symbol.for("react.element"), n = Symbol.for("react.portal"), u = Symbol.for("react.fragment"), b = Symbol.for("react.strict_mode"), A = Symbol.for("react.profiler"), R = Symbol.for("react.provider"), s = Symbol.for("react.context"), m = Symbol.for("react.forward_ref"), k = Symbol.for("react.suspense"), S = Symbol.for("react.suspense_list"), I = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), U = Symbol.for("react.offscreen"), Z = Symbol.iterator, _ = "@@iterator";
|
|
44
44
|
function E(e) {
|
|
45
45
|
if (e === null || typeof e != "object")
|
|
46
46
|
return null;
|
|
@@ -59,16 +59,16 @@ function Ar() {
|
|
|
59
59
|
{
|
|
60
60
|
var v = y.ReactDebugCurrentFrame, O = v.getStackAddendum();
|
|
61
61
|
O !== "" && (a += "%s", d = d.concat([O]));
|
|
62
|
-
var
|
|
62
|
+
var L = d.map(function(T) {
|
|
63
63
|
return String(T);
|
|
64
64
|
});
|
|
65
|
-
|
|
65
|
+
L.unshift("Warning: " + a), Function.prototype.apply.call(console[e], console, L);
|
|
66
66
|
}
|
|
67
67
|
}
|
|
68
68
|
var i = !1, o = !1, l = !1, g = !1, x = !1, f;
|
|
69
69
|
f = Symbol.for("react.module.reference");
|
|
70
70
|
function N(e) {
|
|
71
|
-
return !!(typeof e == "string" || typeof e == "function" || e === u || e === A || x || e === b || e === k || e === S || g || e === U || i || o || l || typeof e == "object" && e !== null && (e.$$typeof ===
|
|
71
|
+
return !!(typeof e == "string" || typeof e == "function" || e === u || e === A || x || e === b || e === k || e === S || g || e === U || i || o || l || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === I || e.$$typeof === R || e.$$typeof === s || e.$$typeof === m || // This needs to include all possible module reference object
|
|
72
72
|
// types supported by any Flight configuration anywhere since
|
|
73
73
|
// we don't know which Flight build this will end up being used
|
|
74
74
|
// with.
|
|
@@ -118,10 +118,10 @@ function Ar() {
|
|
|
118
118
|
case I:
|
|
119
119
|
var v = e.displayName || null;
|
|
120
120
|
return v !== null ? v : H(e.type) || "Memo";
|
|
121
|
-
case
|
|
122
|
-
var O = e,
|
|
121
|
+
case C: {
|
|
122
|
+
var O = e, L = O._payload, T = O._init;
|
|
123
123
|
try {
|
|
124
|
-
return H(T(
|
|
124
|
+
return H(T(L));
|
|
125
125
|
} catch {
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
@@ -222,8 +222,8 @@ function Ar() {
|
|
|
222
222
|
de = !0;
|
|
223
223
|
var O = Error.prepareStackTrace;
|
|
224
224
|
Error.prepareStackTrace = void 0;
|
|
225
|
-
var
|
|
226
|
-
|
|
225
|
+
var L;
|
|
226
|
+
L = ie.current, ie.current = null, q();
|
|
227
227
|
try {
|
|
228
228
|
if (a) {
|
|
229
229
|
var T = function() {
|
|
@@ -276,7 +276,7 @@ function Ar() {
|
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
} finally {
|
|
279
|
-
de = !1, ie.current =
|
|
279
|
+
de = !1, ie.current = L, Q(), Error.prepareStackTrace = O;
|
|
280
280
|
}
|
|
281
281
|
var Se = e ? e.displayName || e.name : "", Ee = Se ? Y(Se) : "";
|
|
282
282
|
return typeof e == "function" && se.set(e, Ee), Ee;
|
|
@@ -284,7 +284,7 @@ function Ar() {
|
|
|
284
284
|
function me(e, a, d) {
|
|
285
285
|
return ye(e, !1);
|
|
286
286
|
}
|
|
287
|
-
function
|
|
287
|
+
function Re(e) {
|
|
288
288
|
var a = e.prototype;
|
|
289
289
|
return !!(a && a.isReactComponent);
|
|
290
290
|
}
|
|
@@ -292,7 +292,7 @@ function Ar() {
|
|
|
292
292
|
if (e == null)
|
|
293
293
|
return "";
|
|
294
294
|
if (typeof e == "function")
|
|
295
|
-
return ye(e,
|
|
295
|
+
return ye(e, Re(e));
|
|
296
296
|
if (typeof e == "string")
|
|
297
297
|
return Y(e);
|
|
298
298
|
switch (e) {
|
|
@@ -307,17 +307,17 @@ function Ar() {
|
|
|
307
307
|
return me(e.render);
|
|
308
308
|
case I:
|
|
309
309
|
return xe(e.type, a, d);
|
|
310
|
-
case
|
|
311
|
-
var v = e, O = v._payload,
|
|
310
|
+
case C: {
|
|
311
|
+
var v = e, O = v._payload, L = v._init;
|
|
312
312
|
try {
|
|
313
|
-
return xe(
|
|
313
|
+
return xe(L(O), a, d);
|
|
314
314
|
} catch {
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
}
|
|
318
318
|
return "";
|
|
319
319
|
}
|
|
320
|
-
var ce = Object.prototype.hasOwnProperty,
|
|
320
|
+
var ce = Object.prototype.hasOwnProperty, _e = {}, F = y.ReactDebugCurrentFrame;
|
|
321
321
|
function P(e) {
|
|
322
322
|
if (e) {
|
|
323
323
|
var a = e._owner, d = xe(e.type, e._source, a ? a.type : null);
|
|
@@ -327,9 +327,9 @@ function Ar() {
|
|
|
327
327
|
}
|
|
328
328
|
function he(e, a, d, v, O) {
|
|
329
329
|
{
|
|
330
|
-
var
|
|
330
|
+
var L = Function.call.bind(ce);
|
|
331
331
|
for (var T in e)
|
|
332
|
-
if (
|
|
332
|
+
if (L(e, T)) {
|
|
333
333
|
var w = void 0;
|
|
334
334
|
try {
|
|
335
335
|
if (typeof e[T] != "function") {
|
|
@@ -340,15 +340,15 @@ function Ar() {
|
|
|
340
340
|
} catch ($) {
|
|
341
341
|
w = $;
|
|
342
342
|
}
|
|
343
|
-
w && !(w instanceof Error) && (P(O), r("%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).", v || "React class", d, T, typeof w), P(null)), w instanceof Error && !(w.message in
|
|
343
|
+
w && !(w instanceof Error) && (P(O), r("%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).", v || "React class", d, T, typeof w), P(null)), w instanceof Error && !(w.message in _e) && (_e[w.message] = !0, P(O), r("Failed %s type: %s", d, w.message), P(null));
|
|
344
344
|
}
|
|
345
345
|
}
|
|
346
346
|
}
|
|
347
347
|
var be = Array.isArray;
|
|
348
|
-
function
|
|
348
|
+
function Fe(e) {
|
|
349
349
|
return be(e);
|
|
350
350
|
}
|
|
351
|
-
function
|
|
351
|
+
function Ie(e) {
|
|
352
352
|
{
|
|
353
353
|
var a = typeof Symbol == "function" && Symbol.toStringTag, d = a && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
354
354
|
return d;
|
|
@@ -366,14 +366,14 @@ function Ar() {
|
|
|
366
366
|
}
|
|
367
367
|
function ge(e) {
|
|
368
368
|
if (ve(e))
|
|
369
|
-
return r("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",
|
|
369
|
+
return r("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", Ie(e)), fe(e);
|
|
370
370
|
}
|
|
371
|
-
var ke = y.ReactCurrentOwner,
|
|
371
|
+
var ke = y.ReactCurrentOwner, Le = {
|
|
372
372
|
key: !0,
|
|
373
373
|
ref: !0,
|
|
374
374
|
__self: !0,
|
|
375
375
|
__source: !0
|
|
376
|
-
},
|
|
376
|
+
}, Ce, We;
|
|
377
377
|
function ar(e) {
|
|
378
378
|
if (ce.call(e, "ref")) {
|
|
379
379
|
var a = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
@@ -396,7 +396,7 @@ function Ar() {
|
|
|
396
396
|
function sr(e, a) {
|
|
397
397
|
{
|
|
398
398
|
var d = function() {
|
|
399
|
-
|
|
399
|
+
Ce || (Ce = !0, r("%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)", a));
|
|
400
400
|
};
|
|
401
401
|
d.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
402
402
|
get: d,
|
|
@@ -415,7 +415,7 @@ function Ar() {
|
|
|
415
415
|
});
|
|
416
416
|
}
|
|
417
417
|
}
|
|
418
|
-
var cr = function(e, a, d, v, O,
|
|
418
|
+
var cr = function(e, a, d, v, O, L, T) {
|
|
419
419
|
var w = {
|
|
420
420
|
// This tag allows us to uniquely identify this as a React Element
|
|
421
421
|
$$typeof: h,
|
|
@@ -425,7 +425,7 @@ function Ar() {
|
|
|
425
425
|
ref: d,
|
|
426
426
|
props: T,
|
|
427
427
|
// Record the component responsible for creating this element.
|
|
428
|
-
_owner:
|
|
428
|
+
_owner: L
|
|
429
429
|
};
|
|
430
430
|
return w._store = {}, Object.defineProperty(w._store, "validated", {
|
|
431
431
|
configurable: !1,
|
|
@@ -446,14 +446,14 @@ function Ar() {
|
|
|
446
446
|
};
|
|
447
447
|
function ur(e, a, d, v, O) {
|
|
448
448
|
{
|
|
449
|
-
var
|
|
449
|
+
var L, T = {}, w = null, V = null;
|
|
450
450
|
d !== void 0 && (ge(d), w = "" + d), ir(a) && (ge(a.key), w = "" + a.key), ar(a) && (V = a.ref, or(a, O));
|
|
451
|
-
for (
|
|
452
|
-
ce.call(a,
|
|
451
|
+
for (L in a)
|
|
452
|
+
ce.call(a, L) && !Le.hasOwnProperty(L) && (T[L] = a[L]);
|
|
453
453
|
if (e && e.defaultProps) {
|
|
454
454
|
var $ = e.defaultProps;
|
|
455
|
-
for (
|
|
456
|
-
T[
|
|
455
|
+
for (L in $)
|
|
456
|
+
T[L] === void 0 && (T[L] = $[L]);
|
|
457
457
|
}
|
|
458
458
|
if (w || V) {
|
|
459
459
|
var M = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
@@ -520,7 +520,7 @@ Check the top-level render call using <` + d + ">.");
|
|
|
520
520
|
{
|
|
521
521
|
if (typeof e != "object")
|
|
522
522
|
return;
|
|
523
|
-
if (
|
|
523
|
+
if (Fe(e))
|
|
524
524
|
for (var d = 0; d < e.length; d++) {
|
|
525
525
|
var v = e[d];
|
|
526
526
|
$e(v) && Xe(v, a);
|
|
@@ -530,7 +530,7 @@ Check the top-level render call using <` + d + ">.");
|
|
|
530
530
|
else if (e) {
|
|
531
531
|
var O = E(e);
|
|
532
532
|
if (typeof O == "function" && O !== e.entries)
|
|
533
|
-
for (var
|
|
533
|
+
for (var L = O.call(e), T; !(T = L.next()).done; )
|
|
534
534
|
$e(T.value) && Xe(T.value, a);
|
|
535
535
|
}
|
|
536
536
|
}
|
|
@@ -573,7 +573,7 @@ Check the top-level render call using <` + d + ">.");
|
|
|
573
573
|
}
|
|
574
574
|
}
|
|
575
575
|
var Ze = {};
|
|
576
|
-
function qe(e, a, d, v, O,
|
|
576
|
+
function qe(e, a, d, v, O, L) {
|
|
577
577
|
{
|
|
578
578
|
var T = N(e);
|
|
579
579
|
if (!T) {
|
|
@@ -582,16 +582,16 @@ Check the top-level render call using <` + d + ">.");
|
|
|
582
582
|
var V = dr();
|
|
583
583
|
V ? w += V : w += Ye();
|
|
584
584
|
var $;
|
|
585
|
-
e === null ? $ = "null" :
|
|
585
|
+
e === null ? $ = "null" : Fe(e) ? $ = "array" : e !== void 0 && e.$$typeof === h ? ($ = "<" + (H(e.type) || "Unknown") + " />", w = " Did you accidentally export a JSX literal instead of a component?") : $ = typeof e, r("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", $, w);
|
|
586
586
|
}
|
|
587
|
-
var M = ur(e, a, d, O,
|
|
587
|
+
var M = ur(e, a, d, O, L);
|
|
588
588
|
if (M == null)
|
|
589
589
|
return M;
|
|
590
590
|
if (T) {
|
|
591
591
|
var ee = a.children;
|
|
592
592
|
if (ee !== void 0)
|
|
593
593
|
if (v)
|
|
594
|
-
if (
|
|
594
|
+
if (Fe(ee)) {
|
|
595
595
|
for (var Se = 0; Se < ee.length; Se++)
|
|
596
596
|
Ke(ee[Se], e);
|
|
597
597
|
Object.freeze && Object.freeze(ee);
|
|
@@ -624,8 +624,8 @@ React keys must be passed directly to JSX without using spread:
|
|
|
624
624
|
return qe(e, a, d, !1);
|
|
625
625
|
}
|
|
626
626
|
var br = mr, vr = gr;
|
|
627
|
-
|
|
628
|
-
}()),
|
|
627
|
+
Ne.Fragment = u, Ne.jsx = br, Ne.jsxs = vr;
|
|
628
|
+
}()), Ne;
|
|
629
629
|
}
|
|
630
630
|
process.env.NODE_ENV === "production" ? Be.exports = Sr() : Be.exports = Ar();
|
|
631
631
|
var c = Be.exports, nr = { exports: {} };
|
|
@@ -1165,7 +1165,7 @@ var c = Be.exports, nr = { exports: {} };
|
|
|
1165
1165
|
delete t.rest;
|
|
1166
1166
|
}
|
|
1167
1167
|
var l = new I();
|
|
1168
|
-
return
|
|
1168
|
+
return C(l, l.head, r), S(r, l, t, l.head, 0), Z(l);
|
|
1169
1169
|
},
|
|
1170
1170
|
/**
|
|
1171
1171
|
* @namespace
|
|
@@ -1279,9 +1279,9 @@ var c = Be.exports, nr = { exports: {} };
|
|
|
1279
1279
|
var ie = B.index, oe = B[0], Y = re.slice(0, ie), de = re.slice(ie + oe.length), se = z + re.length;
|
|
1280
1280
|
g && se > g.reach && (g.reach = se);
|
|
1281
1281
|
var pe = D.prev;
|
|
1282
|
-
Y && (pe =
|
|
1282
|
+
Y && (pe = C(t, pe, Y), z += Y.length), U(t, pe, J);
|
|
1283
1283
|
var ye = new m(x, W ? s.tokenize(oe, W) : oe, ne, oe);
|
|
1284
|
-
if (D =
|
|
1284
|
+
if (D = C(t, pe, ye), de && C(t, D, de), J > 1) {
|
|
1285
1285
|
var me = {
|
|
1286
1286
|
cause: x + "," + N,
|
|
1287
1287
|
reach: se
|
|
@@ -1297,7 +1297,7 @@ var c = Be.exports, nr = { exports: {} };
|
|
|
1297
1297
|
var r = { value: null, prev: null, next: null }, t = { value: null, prev: r, next: null };
|
|
1298
1298
|
r.next = t, this.head = r, this.tail = t, this.length = 0;
|
|
1299
1299
|
}
|
|
1300
|
-
function
|
|
1300
|
+
function C(r, t, i) {
|
|
1301
1301
|
var o = t.next, l = { value: i, prev: t, next: o };
|
|
1302
1302
|
return t.next = l, o.prev = l, r.length++, l;
|
|
1303
1303
|
}
|
|
@@ -1718,7 +1718,7 @@ var c = Be.exports, nr = { exports: {} };
|
|
|
1718
1718
|
h: "c",
|
|
1719
1719
|
tex: "latex"
|
|
1720
1720
|
}, s = "data-src-status", m = "loading", k = "loaded", S = "failed", I = "pre[data-src]:not([" + s + '="' + k + '"]):not([' + s + '="' + m + '"])';
|
|
1721
|
-
function
|
|
1721
|
+
function C(_, E, y) {
|
|
1722
1722
|
var r = new XMLHttpRequest();
|
|
1723
1723
|
r.open("GET", _, !0), r.onreadystatechange = function() {
|
|
1724
1724
|
r.readyState == 4 && (r.status < 400 && r.responseText ? E(r.responseText) : r.status >= 400 ? y(b(r.status, r.statusText)) : y(A));
|
|
@@ -1749,7 +1749,7 @@ var c = Be.exports, nr = { exports: {} };
|
|
|
1749
1749
|
}
|
|
1750
1750
|
n.util.setLanguage(y, t), n.util.setLanguage(E, t);
|
|
1751
1751
|
var o = n.plugins.autoloader;
|
|
1752
|
-
o && o.loadLanguages(t),
|
|
1752
|
+
o && o.loadLanguages(t), C(
|
|
1753
1753
|
r,
|
|
1754
1754
|
function(l) {
|
|
1755
1755
|
E.setAttribute(s, k);
|
|
@@ -2849,27 +2849,27 @@ const Nr = ({
|
|
|
2849
2849
|
} catch {
|
|
2850
2850
|
}
|
|
2851
2851
|
return Or(p || "");
|
|
2852
|
-
}, [p, k]),
|
|
2852
|
+
}, [p, k]), C = te((E) => {
|
|
2853
2853
|
m.current && clearTimeout(m.current), m.current = setTimeout(() => {
|
|
2854
2854
|
A == null || A(E);
|
|
2855
2855
|
}, 500);
|
|
2856
2856
|
}, [A]), U = (E) => {
|
|
2857
2857
|
const y = E.target.value;
|
|
2858
|
-
b == null || b(y),
|
|
2858
|
+
b == null || b(y), C(y);
|
|
2859
2859
|
}, Z = () => {
|
|
2860
2860
|
R.current && s.current && (s.current.scrollTop = R.current.scrollTop, s.current.scrollLeft = R.current.scrollLeft);
|
|
2861
2861
|
}, _ = (E) => {
|
|
2862
2862
|
if (E.key === "Tab") {
|
|
2863
2863
|
E.preventDefault();
|
|
2864
2864
|
const y = E.target, r = y.selectionStart, t = y.selectionEnd, i = p.substring(0, r) + " " + p.substring(t);
|
|
2865
|
-
b == null || b(i),
|
|
2865
|
+
b == null || b(i), C(i), requestAnimationFrame(() => {
|
|
2866
2866
|
y.selectionStart = y.selectionEnd = r + 2;
|
|
2867
2867
|
});
|
|
2868
2868
|
}
|
|
2869
2869
|
};
|
|
2870
|
-
return
|
|
2870
|
+
return Te(() => () => {
|
|
2871
2871
|
m.current && clearTimeout(m.current);
|
|
2872
|
-
}, []),
|
|
2872
|
+
}, []), Te(() => {
|
|
2873
2873
|
Fr(n);
|
|
2874
2874
|
}, [n]), /* @__PURE__ */ c.jsxs("div", { className: `hep-cr-editor theme-${n}`, style: { background: S }, children: [
|
|
2875
2875
|
/* @__PURE__ */ c.jsx(
|
|
@@ -2896,7 +2896,7 @@ const Nr = ({
|
|
|
2896
2896
|
}
|
|
2897
2897
|
)
|
|
2898
2898
|
] });
|
|
2899
|
-
},
|
|
2899
|
+
}, Lr = `
|
|
2900
2900
|
.hep-cr-editor {
|
|
2901
2901
|
position: relative;
|
|
2902
2902
|
flex: 1;
|
|
@@ -2958,10 +2958,10 @@ if (typeof document < "u") {
|
|
|
2958
2958
|
const p = "hep-cr-editor-styles";
|
|
2959
2959
|
if (!document.getElementById(p)) {
|
|
2960
2960
|
const h = document.createElement("style");
|
|
2961
|
-
h.id = p, h.textContent =
|
|
2961
|
+
h.id = p, h.textContent = Lr, document.head.appendChild(h);
|
|
2962
2962
|
}
|
|
2963
2963
|
}
|
|
2964
|
-
var
|
|
2964
|
+
var Cr = Object.defineProperty, Pr = (p, h, n) => h in p ? Cr(p, h, { enumerable: !0, configurable: !0, writable: !0, value: n }) : p[h] = n, rr = (p, h, n) => Pr(p, typeof h != "symbol" ? h + "" : h, n);
|
|
2965
2965
|
let Ue = null;
|
|
2966
2966
|
class Dr {
|
|
2967
2967
|
constructor(h = {}) {
|
|
@@ -3018,11 +3018,11 @@ class Dr {
|
|
|
3018
3018
|
});
|
|
3019
3019
|
if (!m.ok)
|
|
3020
3020
|
throw new Error(`Execute failed: ${m.statusText}`);
|
|
3021
|
-
const k = await m.json(), S = Date.now() - s, I = k.run.stdout || "",
|
|
3021
|
+
const k = await m.json(), S = Date.now() - s, I = k.run.stdout || "", C = k.run.stderr || "";
|
|
3022
3022
|
return {
|
|
3023
3023
|
success: k.run.code === 0,
|
|
3024
3024
|
output: I,
|
|
3025
|
-
stderr:
|
|
3025
|
+
stderr: C,
|
|
3026
3026
|
code: k.run.code,
|
|
3027
3027
|
executionTime: S,
|
|
3028
3028
|
compile: k.compile ? {
|
|
@@ -3187,27 +3187,27 @@ const $r = ({
|
|
|
3187
3187
|
onExecuteStart: k,
|
|
3188
3188
|
onExecuteEnd: S,
|
|
3189
3189
|
onLanguageChange: I,
|
|
3190
|
-
onChange:
|
|
3190
|
+
onChange: C
|
|
3191
3191
|
}) => {
|
|
3192
3192
|
const [U, Z] = X([]), [_, E] = X(h), [y, r] = X(n), [t, i] = X(s), [o, l] = X(""), [g, x] = X(""), [f, N] = X(!1), [j, W] = X(null), [H, G] = X("stdout"), [ne, ae] = X(null), [ue, D] = X(!0), [z, re] = X(60), [J, B] = X(!1), [le, q] = X(!1), Q = Ae(() => new Dr({ pistonUrl: p }), [p]), ie = Ae(() => U.map((F) => ({
|
|
3193
3193
|
value: `${F.language}:${F.version}`,
|
|
3194
3194
|
label: `${F.language.charAt(0).toUpperCase() + F.language.slice(1)} ${F.version}`
|
|
3195
3195
|
})), [U]), oe = Ae(() => {
|
|
3196
3196
|
if (!u) return {};
|
|
3197
|
-
const F = n === "dark", P = (
|
|
3198
|
-
const fe = parseInt(
|
|
3199
|
-
return "#" + (16777216 + ke * 65536 +
|
|
3200
|
-
},
|
|
3201
|
-
const ve = parseInt(
|
|
3197
|
+
const F = n === "dark", P = (Ie, ve) => {
|
|
3198
|
+
const fe = parseInt(Ie.replace("#", ""), 16), ge = Math.round(2.55 * ve), ke = Math.min(255, Math.max(0, (fe >> 16) + ge)), Le = Math.min(255, Math.max(0, (fe >> 8 & 255) + ge)), Ce = Math.min(255, Math.max(0, (fe & 255) + ge));
|
|
3199
|
+
return "#" + (16777216 + ke * 65536 + Le * 256 + Ce).toString(16).slice(1);
|
|
3200
|
+
}, Fe = ((Ie) => {
|
|
3201
|
+
const ve = parseInt(Ie.replace("#", ""), 16), fe = ve >> 16 & 255, ge = ve >> 8 & 255, ke = ve & 255;
|
|
3202
3202
|
return (0.299 * fe + 0.587 * ge + 0.114 * ke) / 255 > 0.5;
|
|
3203
3203
|
})(u) ? "#000" : "#fff";
|
|
3204
3204
|
return {
|
|
3205
3205
|
"--hep-cr-theme-color": u,
|
|
3206
3206
|
"--hep-cr-theme-color-hover": F ? P(u, 20) : P(u, -20),
|
|
3207
|
-
"--hep-cr-tab-active-color":
|
|
3207
|
+
"--hep-cr-tab-active-color": Fe
|
|
3208
3208
|
};
|
|
3209
3209
|
}, [u, n]), Y = Ae(() => _.includes(":") ? _.split(":")[0] : _, [_]);
|
|
3210
|
-
|
|
3210
|
+
Te(() => {
|
|
3211
3211
|
async function F() {
|
|
3212
3212
|
D(!0), ae(null);
|
|
3213
3213
|
try {
|
|
@@ -3220,9 +3220,11 @@ const $r = ({
|
|
|
3220
3220
|
}
|
|
3221
3221
|
}
|
|
3222
3222
|
F();
|
|
3223
|
-
}, [Q]),
|
|
3223
|
+
}, [Q]), Te(() => {
|
|
3224
3224
|
!t && U.length > 0 && i(s || He(Y));
|
|
3225
|
-
}, [U, t, s, Y])
|
|
3225
|
+
}, [U, t, s, Y]), Te(() => {
|
|
3226
|
+
C == null || C(t);
|
|
3227
|
+
}, []);
|
|
3226
3228
|
const de = te(
|
|
3227
3229
|
(F) => {
|
|
3228
3230
|
const P = F.target.value, he = P.includes(":") ? P.split(":")[0] : P;
|
|
@@ -3264,16 +3266,16 @@ const $r = ({
|
|
|
3264
3266
|
}, 2e3);
|
|
3265
3267
|
}, [H, o, g]), me = te(() => {
|
|
3266
3268
|
i(He(Y));
|
|
3267
|
-
}, [_]),
|
|
3268
|
-
|
|
3269
|
+
}, [_]), Re = Pe(!1), xe = te((F) => {
|
|
3270
|
+
Re.current = !0, document.addEventListener("mousemove", ce), document.addEventListener("mouseup", _e), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
|
|
3269
3271
|
}, []), ce = te((F) => {
|
|
3270
|
-
if (!
|
|
3272
|
+
if (!Re.current) return;
|
|
3271
3273
|
const P = document.querySelector(".hep-cr-main");
|
|
3272
3274
|
if (!P) return;
|
|
3273
3275
|
const he = P.getBoundingClientRect(), be = (F.clientX - he.left) / he.width * 100;
|
|
3274
3276
|
re(Math.max(20, Math.min(80, be)));
|
|
3275
|
-
}, []),
|
|
3276
|
-
|
|
3277
|
+
}, []), _e = te(() => {
|
|
3278
|
+
Re.current = !1, document.removeEventListener("mousemove", ce), document.removeEventListener("mouseup", _e), document.body.style.cursor = "", document.body.style.userSelect = "";
|
|
3277
3279
|
}, [ce]);
|
|
3278
3280
|
return /* @__PURE__ */ c.jsxs("div", { className: `hep-cr-runner hep-cr-runner-${y}`, style: oe, children: [
|
|
3279
3281
|
/* @__PURE__ */ c.jsxs("div", { className: "hep-cr-header", children: [
|
|
@@ -3366,7 +3368,7 @@ const $r = ({
|
|
|
3366
3368
|
theme: y,
|
|
3367
3369
|
disabled: !R || f,
|
|
3368
3370
|
onChange: i,
|
|
3369
|
-
onCodeChange:
|
|
3371
|
+
onCodeChange: C
|
|
3370
3372
|
}
|
|
3371
3373
|
)
|
|
3372
3374
|
] }),
|
|
@@ -3673,8 +3675,8 @@ const $r = ({
|
|
|
3673
3675
|
theme: R = "light",
|
|
3674
3676
|
...s
|
|
3675
3677
|
}, m) => {
|
|
3676
|
-
const [k, S] = X(h), I = p !== void 0,
|
|
3677
|
-
|
|
3678
|
+
const [k, S] = X(h), I = p !== void 0, C = I ? p : k;
|
|
3679
|
+
Te(() => {
|
|
3678
3680
|
I && p !== k && S(p);
|
|
3679
3681
|
}, [p, I]);
|
|
3680
3682
|
const U = te(() => {
|
|
@@ -3686,7 +3688,7 @@ const $r = ({
|
|
|
3686
3688
|
close: U
|
|
3687
3689
|
}));
|
|
3688
3690
|
const _ = typeof u == "number" ? `${u}px` : u;
|
|
3689
|
-
return
|
|
3691
|
+
return C ? /* @__PURE__ */ c.jsxs("div", { className: "hep-cr-dialog-overlay", onClick: Z, children: [
|
|
3690
3692
|
/* @__PURE__ */ c.jsxs("div", { className: "hep-cr-dialog-container", style: { width: _ }, children: [
|
|
3691
3693
|
/* @__PURE__ */ c.jsxs("div", { className: "hep-cr-dialog-header", children: [
|
|
3692
3694
|
/* @__PURE__ */ c.jsx("h3", { className: "hep-cr-dialog-title", children: n }),
|