2 lines
7.2 KiB
JavaScript
2 lines
7.2 KiB
JavaScript
import{G as o}from"./iconBase-B7bT1FlI.js";import{R as k,r as n,j as b}from"./react-vendor-jWT2yUdV.js";import{E as l,R as w,o as L}from"./codemirror-core-782AVq39.js";import{j}from"./codemirror-lang-DFaD5e7G.js";import{a as T,c as R}from"./index-DiaaLdUu.js";function N(t){return o({attr:{viewBox:"0 0 24 24",fill:"currentColor"},child:[{tag:"path",attr:{d:"M12 2c-.218 0 -.432 .002 -.642 .005l-.616 .017l-.299 .013l-.579 .034l-.553 .046c-4.785 .464 -6.732 2.411 -7.196 7.196l-.046 .553l-.034 .579c-.005 .098 -.01 .198 -.013 .299l-.017 .616l-.004 .318l-.001 .324c0 .218 .002 .432 .005 .642l.017 .616l.013 .299l.034 .579l.046 .553c.464 4.785 2.411 6.732 7.196 7.196l.553 .046l.579 .034c.098 .005 .198 .01 .299 .013l.616 .017l.642 .005l.642 -.005l.616 -.017l.299 -.013l.579 -.034l.553 -.046c4.785 -.464 6.732 -2.411 7.196 -7.196l.046 -.553l.034 -.579c.005 -.098 .01 -.198 .013 -.299l.017 -.616l.005 -.642l-.005 -.642l-.017 -.616l-.013 -.299l-.034 -.579l-.046 -.553c-.464 -4.785 -2.411 -6.732 -7.196 -7.196l-.553 -.046l-.579 -.034a28.058 28.058 0 0 0 -.299 -.013l-.616 -.017l-.318 -.004l-.324 -.001zm-1.707 6.293a1 1 0 0 1 1.32 -.083l.094 .083l3 3a1 1 0 0 1 .083 1.32l-.083 .094l-3 3a1 1 0 0 1 -1.497 -1.32l.083 -.094l2.292 -2.293l-2.292 -2.293a1 1 0 0 1 -.083 -1.32l.083 -.094z",fill:"currentColor",strokeWidth:"0"},child:[]}]})(t)}function D(t){return o({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M7 8l-4 4l4 4"},child:[]},{tag:"path",attr:{d:"M17 8l4 4l-4 4"},child:[]},{tag:"path",attr:{d:"M14 4l-4 16"},child:[]}]})(t)}function F(t){return o({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M18 6v6a3 3 0 0 1 -3 3h-10l4 -4m0 8l-4 -4"},child:[]}]})(t)}function G(t){return o({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M5 19l2.757 -7.351a1 1 0 0 1 .936 -.649h12.307a1 1 0 0 1 .986 1.164l-.996 5.211a2 2 0 0 1 -1.964 1.625h-14.026a2 2 0 0 1 -2 -2v-11a2 2 0 0 1 2 -2h4l3 3h7a2 2 0 0 1 2 2v2"},child:[]}]})(t)}function O(t){return o({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M8 9h8"},child:[]},{tag:"path",attr:{d:"M8 13h6"},child:[]},{tag:"path",attr:{d:"M11.012 19.193l-3.012 1.807v-3h-2a3 3 0 0 1 -3 -3v-8a3 3 0 0 1 3 -3h12a3 3 0 0 1 3 3v6"},child:[]},{tag:"path",attr:{d:"M20 21l2 -2l-2 -2"},child:[]},{tag:"path",attr:{d:"M17 17l-2 2l2 2"},child:[]}]})(t)}function H(t){return o({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M3 17a3 3 0 1 0 6 0a3 3 0 0 0 -6 0"},child:[]},{tag:"path",attr:{d:"M9 17v-13h10v8"},child:[]},{tag:"path",attr:{d:"M9 8h10"},child:[]},{tag:"path",attr:{d:"M16 19h6"},child:[]},{tag:"path",attr:{d:"M19 16v6"},child:[]}]})(t)}function I(t){return o({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M10 10m-7 0a7 7 0 1 0 14 0a7 7 0 1 0 -14 0"},child:[]},{tag:"path",attr:{d:"M21 21l-6 -6"},child:[]}]})(t)}function P(t){return o({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M4 7l16 0"},child:[]},{tag:"path",attr:{d:"M10 11l0 6"},child:[]},{tag:"path",attr:{d:"M14 11l0 6"},child:[]},{tag:"path",attr:{d:"M5 7l1 12a2 2 0 0 0 2 2h8a2 2 0 0 0 2 -2l1 -12"},child:[]},{tag:"path",attr:{d:"M9 7v-3a1 1 0 0 1 1 -1h4a1 1 0 0 1 1 1v3"},child:[]}]})(t)}function _(t){return o({attr:{viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"},child:[{tag:"path",attr:{d:"M15 10l4.553 -2.276a1 1 0 0 1 1.447 .894v6.764a1 1 0 0 1 -1.447 .894l-4.553 -2.276v-4z"},child:[]},{tag:"path",attr:{d:"M3 6m0 2a2 2 0 0 1 2 -2h8a2 2 0 0 1 2 2v8a2 2 0 0 1 -2 2h-8a2 2 0 0 1 -2 -2z"},child:[]},{tag:"path",attr:{d:"M7 12l4 0"},child:[]},{tag:"path",attr:{d:"M9 10l0 4"},child:[]}]})(t)}const W=t=>{switch(t){case"json":return j();default:return[]}},q=k.forwardRef((t,M)=>{var h,s,u,g,f,m,v,p;const{isDark:r}=T(),i=!!((h=t.options)!=null&&h.chromeless),[C,d]=n.useState(t.value||t.defaultValue||""),c=k.useRef(null);n.useEffect(()=>{t.value!==void 0&&d(t.value)},[t.value]),n.useImperativeHandle(M,()=>({getValue:()=>{var e,a;return((a=(e=c.current)==null?void 0:e.view)==null?void 0:a.state.doc.toString())||C}}));const x=[l.theme({"&":{fontSize:"14px",height:"100% !important",backgroundColor:"transparent !important"},"&.cm-editor":{backgroundColor:"transparent !important"},".cm-scroller":{fontFamily:"var(--font-family-mono, ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, 'Liberation Mono', 'Courier New', monospace)",lineHeight:"1.6",overflow:"auto !important",height:"100% !important",backgroundColor:"transparent !important"},".cm-gutters":{backgroundColor:"transparent !important",borderRight:"none",color:r?"hsl(var(--heroui-foreground-500) / 0.75)":"hsl(var(--heroui-foreground-500) / 0.65)"},".cm-gutterElement":{paddingLeft:"12px",paddingRight:"12px"},".cm-activeLineGutter":{backgroundColor:"transparent !important",color:r?"hsl(var(--heroui-foreground) / 0.9) !important":"hsl(var(--heroui-foreground) / 0.8) !important"},".cm-content":{color:"hsl(var(--heroui-foreground) / 0.9)",caretColor:"hsl(var(--heroui-foreground) / 0.9)",paddingTop:"12px",paddingBottom:"12px",backgroundColor:"transparent !important"},".cm-activeLine":{backgroundColor:r?"hsl(var(--heroui-foreground) / 0.08)":"hsl(var(--heroui-foreground) / 0.06)"},".cm-selectionMatch":{backgroundColor:r?"hsl(var(--heroui-foreground) / 0.16)":"hsl(var(--heroui-foreground) / 0.12)"},".ͼo":{color:r?"hsl(var(--heroui-primary) / 0.85)":"hsl(var(--heroui-primary) / 0.75)"},".ͼd":{color:r?"#98c379cc":"#50a14fcc"},".ͼc":{color:r?"#d19a66cc":"#c18401cc"}}),W(t.language||t.defaultLanguage),((s=t.options)==null?void 0:s.wordWrap)==="on"?l.lineWrapping:[],(u=t.options)!=null&&u.readOnly?l.editable.of(!1):[]].flat();return b.jsx("div",{style:{fontSize:((g=t.options)==null?void 0:g.fontSize)||14,height:t.height||"100%",display:"flex",flexDirection:"column"},className:R(i?"overflow-hidden transition-colors bg-transparent":"rounded-xl border overflow-hidden transition-colors backdrop-blur-sm",!i&&(r?"border-white/10 bg-white/5 text-default-100":"border-white/40 dark:border-white/10 bg-white/60 dark:bg-black/20 text-default-700")),children:b.jsx(w,{ref:c,value:t.value??t.defaultValue,height:"100%",className:"h-full w-full [&_.cm-editor]:!bg-transparent [&_.cm-scroller]:!bg-transparent",style:{backgroundColor:"transparent"},theme:r?L:"light",extensions:x,onChange:e=>{var a;d(e),(a=t.onChange)==null||a.call(t,e)},readOnly:(f=t.options)==null?void 0:f.readOnly,basicSetup:{lineNumbers:((m=t.options)==null?void 0:m.lineNumbers)!=="off",foldGutter:((v=t.options)==null?void 0:v.folding)!==!1,highlightActiveLine:((p=t.options)==null?void 0:p.renderLineHighlight)!=="none"}})})});export{q as C,N as T,O as a,D as b,I as c,F as d,H as e,_ as f,G as g,P as h};
|