@senyao-design-system/editor 0.0.7 → 0.0.10
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/extensions/highlight-specified.d.ts +0 -0
- package/dist/extensions/jsonHighlight.d.ts +24 -0
- package/dist/extensions/utils.d.ts +10 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -17
- package/dist/index.mjs +1348 -1188
- package/dist/types.d.ts +23 -0
- package/package.json +47 -45
|
File without changes
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { EditorState, StateField } from '../../@codemirror/state';
|
|
2
|
+
import { JSONHighlightMatch } from '../../../types';
|
|
3
|
+
import { DecorationSet } from '../../@codemirror/view';
|
|
4
|
+
import { CSSProperties } from '../../react';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 查找匹配的 JSON 节点范围
|
|
8
|
+
*/
|
|
9
|
+
export declare function findMatchingRanges(state: EditorState, matches: JSONHighlightMatch[]): Array<{
|
|
10
|
+
from: number;
|
|
11
|
+
to: number;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* 创建 JSON 高亮主题
|
|
15
|
+
*/
|
|
16
|
+
export declare function createJSONHighlightTheme(className?: string, style?: CSSProperties): import('../../@codemirror/state').Extension;
|
|
17
|
+
/**
|
|
18
|
+
* 创建 JSON 高亮装饰
|
|
19
|
+
*/
|
|
20
|
+
export declare function createJSONHighlightPlugin(matches: JSONHighlightMatch[], className?: string): StateField<DecorationSet>;
|
|
21
|
+
/**
|
|
22
|
+
* 创建完整的 JSON 高亮扩展(主题 + 插件)
|
|
23
|
+
*/
|
|
24
|
+
export declare function createJSONHighlightExtension(matches: JSONHighlightMatch[], className?: string, style?: CSSProperties): (import('../../@codemirror/state').Extension | StateField<DecorationSet>)[];
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import { EditorState } from '../../@codemirror/state';
|
|
2
|
+
import { JSONHighlightMatch } from '../types';
|
|
3
|
+
|
|
1
4
|
/**
|
|
2
5
|
* 区块内容项接口
|
|
3
6
|
*/
|
|
@@ -34,3 +37,10 @@ export interface EditorData {
|
|
|
34
37
|
* @returns 编辑器数据对象,包含完整文本和只读区域
|
|
35
38
|
*/
|
|
36
39
|
export declare const blocksToEditorData: (blocks: ContentBlock[]) => EditorData;
|
|
40
|
+
/**
|
|
41
|
+
*
|
|
42
|
+
*/
|
|
43
|
+
export declare function findMatchingRanges(state1: EditorState, matches: JSONHighlightMatch[]): Array<{
|
|
44
|
+
from: number;
|
|
45
|
+
to: number;
|
|
46
|
+
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export { default as Editor } from '../components/Editor';
|
|
|
2
2
|
export { default as SQLEditor } from '../components/SQLEditor';
|
|
3
3
|
export { default as JSONEditor } from '../components/JSONEditor';
|
|
4
4
|
export { default as GenericEditor } from '../components/GenericEditor';
|
|
5
|
-
export { blocksToEditorData } from '../extensions/utils';
|
|
5
|
+
export { blocksToEditorData, findMatchingRanges } from '../extensions/utils';
|
|
6
6
|
export type { ContentBlock, EditorData } from '../extensions/utils';
|
|
7
7
|
export type { EditorChangeEvent, ReadOnlyRange, EditorProps, EditorRef, SQLEditorProps, JSONEditorProps, } from '../types';
|
|
8
8
|
export * from '../extensions';
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const k=require("react"),Lr=require("@codemirror/lang-sql"),qt=require("@codemirror/lang-json"),y=require("@codemirror/view"),me=require("@codemirror/commands"),Yt=require("@codemirror/autocomplete"),yr=require("@codemirror/lint"),ne=require("@codemirror/language"),Y=require("@lezer/highlight"),C=require("@codemirror/state");function Wn(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const ve=Wn(k);var Ot={exports:{}},Ye={};/**
|
|
2
2
|
* @license React
|
|
3
3
|
* react-jsx-runtime.production.min.js
|
|
4
4
|
*
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* This source code is licensed under the MIT license found in the
|
|
8
8
|
* LICENSE file in the root directory of this source tree.
|
|
9
|
-
*/var
|
|
9
|
+
*/var vr;function jn(){if(vr)return Ye;vr=1;var e=k,t=Symbol.for("react.element"),r=Symbol.for("react.fragment"),n=Object.prototype.hasOwnProperty,o=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};function s(c,l,d){var f,p={},O=null,b=null;d!==void 0&&(O=""+d),l.key!==void 0&&(O=""+l.key),l.ref!==void 0&&(b=l.ref);for(f in l)n.call(l,f)&&!i.hasOwnProperty(f)&&(p[f]=l[f]);if(c&&c.defaultProps)for(f in l=c.defaultProps,l)p[f]===void 0&&(p[f]=l[f]);return{$$typeof:t,type:c,key:O,ref:b,props:p,_owner:o.current}}return Ye.Fragment=r,Ye.jsx=s,Ye.jsxs=s,Ye}var ze={};/**
|
|
10
10
|
* @license React
|
|
11
11
|
* react-jsx-runtime.development.js
|
|
12
12
|
*
|
|
@@ -14,38 +14,38 @@
|
|
|
14
14
|
*
|
|
15
15
|
* This source code is licensed under the MIT license found in the
|
|
16
16
|
* LICENSE file in the root directory of this source tree.
|
|
17
|
-
*/var
|
|
18
|
-
`+We+a}}var je=!1,
|
|
19
|
-
`),
|
|
20
|
-
`),B=
|
|
21
|
-
`+
|
|
17
|
+
*/var br;function Vn(){return br||(br=1,process.env.NODE_ENV!=="production"&&function(){var e=k,t=Symbol.for("react.element"),r=Symbol.for("react.portal"),n=Symbol.for("react.fragment"),o=Symbol.for("react.strict_mode"),i=Symbol.for("react.profiler"),s=Symbol.for("react.provider"),c=Symbol.for("react.context"),l=Symbol.for("react.forward_ref"),d=Symbol.for("react.suspense"),f=Symbol.for("react.suspense_list"),p=Symbol.for("react.memo"),O=Symbol.for("react.lazy"),b=Symbol.for("react.offscreen"),R=Symbol.iterator,v="@@iterator";function m(a){if(a===null||typeof a!="object")return null;var u=R&&a[R]||a[v];return typeof u=="function"?u:null}var w=e.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;function E(a){{for(var u=arguments.length,g=new Array(u>1?u-1:0),P=1;P<u;P++)g[P-1]=arguments[P];T("error",a,g)}}function T(a,u,g){{var P=w.ReactDebugCurrentFrame,j=P.getStackAddendum();j!==""&&(u+="%s",g=g.concat([j]));var z=g.map(function(D){return String(D)});z.unshift("Warning: "+u),Function.prototype.apply.call(console[a],console,z)}}var L=!1,h=!1,_=!1,M=!1,ue=!1,G;G=Symbol.for("react.module.reference");function Re(a){return!!(typeof a=="string"||typeof a=="function"||a===n||a===i||ue||a===o||a===d||a===f||M||a===b||L||h||_||typeof a=="object"&&a!==null&&(a.$$typeof===O||a.$$typeof===p||a.$$typeof===s||a.$$typeof===c||a.$$typeof===l||a.$$typeof===G||a.getModuleId!==void 0))}function we(a,u,g){var P=a.displayName;if(P)return P;var j=u.displayName||u.name||"";return j!==""?g+"("+j+")":g}function xe(a){return a.displayName||"Context"}function te(a){if(a==null)return null;if(typeof a.tag=="number"&&E("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."),typeof a=="function")return a.displayName||a.name||null;if(typeof a=="string")return a;switch(a){case n:return"Fragment";case r:return"Portal";case i:return"Profiler";case o:return"StrictMode";case d:return"Suspense";case f:return"SuspenseList"}if(typeof a=="object")switch(a.$$typeof){case c:var u=a;return xe(u)+".Consumer";case s:var g=a;return xe(g._context)+".Provider";case l:return we(a,a.render,"ForwardRef");case p:var P=a.displayName||null;return P!==null?P:te(a.type)||"Memo";case O:{var j=a,z=j._payload,D=j._init;try{return te(D(z))}catch{return null}}}return null}var le=Object.assign,ge=0,x,A,F,$,H,U,se;function pe(){}pe.__reactDisabledLog=!0;function bt(){{if(ge===0){x=console.log,A=console.info,F=console.warn,$=console.error,H=console.group,U=console.groupCollapsed,se=console.groupEnd;var a={configurable:!0,enumerable:!0,value:pe,writable:!0};Object.defineProperties(console,{info:a,log:a,warn:a,error:a,group:a,groupCollapsed:a,groupEnd:a})}ge++}}function xt(){{if(ge--,ge===0){var a={configurable:!0,enumerable:!0,writable:!0};Object.defineProperties(console,{log:le({},a,{value:x}),info:le({},a,{value:A}),warn:le({},a,{value:F}),error:le({},a,{value:$}),group:le({},a,{value:H}),groupCollapsed:le({},a,{value:U}),groupEnd:le({},a,{value:se})})}ge<0&&E("disabledDepth fell below zero. This is a bug in React. Please file an issue.")}}var Ie=w.ReactCurrentDispatcher,We;function ke(a,u,g){{if(We===void 0)try{throw Error()}catch(j){var P=j.stack.trim().match(/\n( *(at )?)/);We=P&&P[1]||""}return`
|
|
18
|
+
`+We+a}}var je=!1,Te;{var Et=typeof WeakMap=="function"?WeakMap:Map;Te=new Et}function S(a,u){if(!a||je)return"";{var g=Te.get(a);if(g!==void 0)return g}var P;je=!0;var j=Error.prepareStackTrace;Error.prepareStackTrace=void 0;var z;z=Ie.current,Ie.current=null,bt();try{if(u){var D=function(){throw Error()};if(Object.defineProperty(D.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(D,[])}catch(re){P=re}Reflect.construct(a,[],D)}else{try{D.call()}catch(re){P=re}a.call(D.prototype)}}else{try{throw Error()}catch(re){P=re}a()}}catch(re){if(re&&P&&typeof re.stack=="string"){for(var N=re.stack.split(`
|
|
19
|
+
`),ee=P.stack.split(`
|
|
20
|
+
`),B=N.length-1,J=ee.length-1;B>=1&&J>=0&&N[B]!==ee[J];)J--;for(;B>=1&&J>=0;B--,J--)if(N[B]!==ee[J]){if(B!==1||J!==1)do if(B--,J--,J<0||N[B]!==ee[J]){var ce=`
|
|
21
|
+
`+N[B].replace(" at new "," at ");return a.displayName&&ce.includes("<anonymous>")&&(ce=ce.replace("<anonymous>",a.displayName)),typeof a=="function"&&Te.set(a,ce),ce}while(B>=1&&J>=0);break}}}finally{je=!1,Ie.current=z,xt(),Error.prepareStackTrace=j}var Oe=a?a.displayName||a.name:"",Se=Oe?ke(Oe):"";return typeof a=="function"&&Te.set(a,Se),Se}function Ve(a,u,g){return S(a,!1)}function _e(a){var u=a.prototype;return!!(u&&u.isReactComponent)}function Ee(a,u,g){if(a==null)return"";if(typeof a=="function")return S(a,_e(a));if(typeof a=="string")return ke(a);switch(a){case d:return ke("Suspense");case f:return ke("SuspenseList")}if(typeof a=="object")switch(a.$$typeof){case l:return Ve(a.render);case p:return Ee(a.type,u,g);case O:{var P=a,j=P._payload,z=P._init;try{return Ee(z(j),u,g)}catch{}}}return""}var qe=Object.prototype.hasOwnProperty,nr={},or=w.ReactDebugCurrentFrame;function Ze(a){if(a){var u=a._owner,g=Ee(a.type,a._source,u?u.type:null);or.setExtraStackFrame(g)}else or.setExtraStackFrame(null)}function yn(a,u,g,P,j){{var z=Function.call.bind(qe);for(var D in a)if(z(a,D)){var N=void 0;try{if(typeof a[D]!="function"){var ee=Error((P||"React class")+": "+g+" type `"+D+"` is invalid; it must be a function, usually from the `prop-types` package, but received `"+typeof a[D]+"`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");throw ee.name="Invariant Violation",ee}N=a[D](u,D,P,g,null,"SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED")}catch(B){N=B}N&&!(N instanceof Error)&&(Ze(j),E("%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).",P||"React class",g,D,typeof N),Ze(null)),N instanceof Error&&!(N.message in nr)&&(nr[N.message]=!0,Ze(j),E("Failed %s type: %s",g,N.message),Ze(null))}}}var vn=Array.isArray;function St(a){return vn(a)}function bn(a){{var u=typeof Symbol=="function"&&Symbol.toStringTag,g=u&&a[Symbol.toStringTag]||a.constructor.name||"Object";return g}}function xn(a){try{return ir(a),!1}catch{return!0}}function ir(a){return""+a}function ar(a){if(xn(a))return E("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.",bn(a)),ir(a)}var sr=w.ReactCurrentOwner,En={key:!0,ref:!0,__self:!0,__source:!0},cr,lr;function Sn(a){if(qe.call(a,"ref")){var u=Object.getOwnPropertyDescriptor(a,"ref").get;if(u&&u.isReactWarning)return!1}return a.ref!==void 0}function Cn(a){if(qe.call(a,"key")){var u=Object.getOwnPropertyDescriptor(a,"key").get;if(u&&u.isReactWarning)return!1}return a.key!==void 0}function Rn(a,u){typeof a.ref=="string"&&sr.current}function wn(a,u){{var g=function(){cr||(cr=!0,E("%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)",u))};g.isReactWarning=!0,Object.defineProperty(a,"key",{get:g,configurable:!0})}}function kn(a,u){{var g=function(){lr||(lr=!0,E("%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)",u))};g.isReactWarning=!0,Object.defineProperty(a,"ref",{get:g,configurable:!0})}}var Tn=function(a,u,g,P,j,z,D){var N={$$typeof:t,type:a,key:u,ref:g,props:D,_owner:z};return N._store={},Object.defineProperty(N._store,"validated",{configurable:!1,enumerable:!1,writable:!0,value:!1}),Object.defineProperty(N,"_self",{configurable:!1,enumerable:!1,writable:!1,value:P}),Object.defineProperty(N,"_source",{configurable:!1,enumerable:!1,writable:!1,value:j}),Object.freeze&&(Object.freeze(N.props),Object.freeze(N)),N};function _n(a,u,g,P,j){{var z,D={},N=null,ee=null;g!==void 0&&(ar(g),N=""+g),Cn(u)&&(ar(u.key),N=""+u.key),Sn(u)&&(ee=u.ref,Rn(u,j));for(z in u)qe.call(u,z)&&!En.hasOwnProperty(z)&&(D[z]=u[z]);if(a&&a.defaultProps){var B=a.defaultProps;for(z in B)D[z]===void 0&&(D[z]=B[z])}if(N||ee){var J=typeof a=="function"?a.displayName||a.name||"Unknown":a;N&&wn(D,J),ee&&kn(D,J)}return Tn(a,N,ee,j,P,sr.current,D)}}var Ct=w.ReactCurrentOwner,ur=w.ReactDebugCurrentFrame;function Pe(a){if(a){var u=a._owner,g=Ee(a.type,a._source,u?u.type:null);ur.setExtraStackFrame(g)}else ur.setExtraStackFrame(null)}var Rt;Rt=!1;function wt(a){return typeof a=="object"&&a!==null&&a.$$typeof===t}function fr(){{if(Ct.current){var a=te(Ct.current.type);if(a)return`
|
|
22
22
|
|
|
23
|
-
Check the render method of \``+a+"`."}return""}}function
|
|
23
|
+
Check the render method of \``+a+"`."}return""}}function Pn(a){return""}var hr={};function On(a){{var u=fr();if(!u){var g=typeof a=="string"?a:a.displayName||a.name;g&&(u=`
|
|
24
24
|
|
|
25
|
-
Check the top-level render call using <`+
|
|
25
|
+
Check the top-level render call using <`+g+">.")}return u}}function dr(a,u){{if(!a._store||a._store.validated||a.key!=null)return;a._store.validated=!0;var g=On(u);if(hr[g])return;hr[g]=!0;var P="";a&&a._owner&&a._owner!==Ct.current&&(P=" It was passed a child from "+te(a._owner.type)+"."),Pe(a),E('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.',g,P),Pe(null)}}function gr(a,u){{if(typeof a!="object")return;if(St(a))for(var g=0;g<a.length;g++){var P=a[g];wt(P)&&dr(P,u)}else if(wt(a))a._store&&(a._store.validated=!0);else if(a){var j=m(a);if(typeof j=="function"&&j!==a.entries)for(var z=j.call(a),D;!(D=z.next()).done;)wt(D.value)&&dr(D.value,u)}}}function Mn(a){{var u=a.type;if(u==null||typeof u=="string")return;var g;if(typeof u=="function")g=u.propTypes;else if(typeof u=="object"&&(u.$$typeof===l||u.$$typeof===p))g=u.propTypes;else return;if(g){var P=te(u);yn(g,a.props,"prop",P,a)}else if(u.PropTypes!==void 0&&!Rt){Rt=!0;var j=te(u);E("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",j||"Unknown")}typeof u.getDefaultProps=="function"&&!u.getDefaultProps.isReactClassApproved&&E("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.")}}function An(a){{for(var u=Object.keys(a.props),g=0;g<u.length;g++){var P=u[g];if(P!=="children"&&P!=="key"){Pe(a),E("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.",P),Pe(null);break}}a.ref!==null&&(Pe(a),E("Invalid attribute `ref` supplied to `React.Fragment`."),Pe(null))}}var pr={};function mr(a,u,g,P,j,z){{var D=Re(a);if(!D){var N="";(a===void 0||typeof a=="object"&&a!==null&&Object.keys(a).length===0)&&(N+=" You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");var ee=Pn();ee?N+=ee:N+=fr();var B;a===null?B="null":St(a)?B="array":a!==void 0&&a.$$typeof===t?(B="<"+(te(a.type)||"Unknown")+" />",N=" Did you accidentally export a JSX literal instead of a component?"):B=typeof a,E("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",B,N)}var J=_n(a,u,g,j,z);if(J==null)return J;if(D){var ce=u.children;if(ce!==void 0)if(P)if(St(ce)){for(var Oe=0;Oe<ce.length;Oe++)gr(ce[Oe],a);Object.freeze&&Object.freeze(ce)}else E("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 gr(ce,a)}if(qe.call(u,"key")){var Se=te(a),re=Object.keys(u).filter(function(In){return In!=="key"}),kt=re.length>0?"{key: someKey, "+re.join(": ..., ")+": ...}":"{key: someKey}";if(!pr[Se+kt]){var $n=re.length>0?"{"+re.join(": ..., ")+": ...}":"{}";E(`A props object containing a "key" prop is being spread into JSX:
|
|
26
26
|
let props = %s;
|
|
27
27
|
<%s {...props} />
|
|
28
28
|
React keys must be passed directly to JSX without using spread:
|
|
29
29
|
let props = %s;
|
|
30
|
-
<%s key={someKey} {...props} />`,kt,Ee,Ln,Ee),gr[Ee+kt]=!0}}return a===n?Pn(H):_n(H),H}}function Mn(a,u,p){return pr(a,u,p,!0)}function On(a,u,p){return pr(a,u,p,!1)}var An=On,Fn=Mn;ze.Fragment=n,ze.jsx=An,ze.jsxs=Fn}()),ze}process.env.NODE_ENV==="production"?Mt.exports=In():Mt.exports=$n();var br=Mt.exports;function Wn(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function jn(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var qn=function(){function e(r){var n=this;this._insertTag=function(o){var i;n.tags.length===0?n.insertionPoint?i=n.insertionPoint.nextSibling:n.prepend?i=n.container.firstChild:i=n.before:i=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(o,i),n.tags.push(o)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(n){n.forEach(this._insertTag)},t.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(jn(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var i=Wn(o);try{i.insertRule(n,i.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(n));this.ctr++},t.flush=function(){this.tags.forEach(function(n){var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}),this.tags=[],this.ctr=0},e}(),X="-ms-",at="-moz-",I="-webkit-",Dr="comm",Yt="rule",zt="decl",Vn="@import",Nr="@keyframes",Yn="@layer",zn=Math.abs,dt=String.fromCharCode,Un=Object.assign;function Bn(e,t){return Q(e,0)^45?(((t<<2^Q(e,0))<<2^Q(e,1))<<2^Q(e,2))<<2^Q(e,3):0}function Ir(e){return e.trim()}function Hn(e,t){return(e=t.exec(e))?e[0]:e}function $(e,t,r){return e.replace(t,r)}function Ot(e,t){return e.indexOf(t)}function Q(e,t){return e.charCodeAt(t)|0}function He(e,t,r){return e.slice(t,r)}function le(e){return e.length}function Ut(e){return e.length}function et(e,t){return t.push(e),e}function Kn(e,t){return e.map(t).join("")}var gt=1,Le=1,$r=0,re=0,K=0,Ne="";function pt(e,t,r,n,o,i,s){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:gt,column:Le,length:s,return:""}}function Ue(e,t){return Un(pt("",null,null,"",null,null,0),e,{length:-e.length},t)}function Gn(){return K}function Jn(){return K=re>0?Q(Ne,--re):0,Le--,K===10&&(Le=1,gt--),K}function oe(){return K=re<$r?Q(Ne,re++):0,Le++,K===10&&(Le=1,gt++),K}function fe(){return Q(Ne,re)}function nt(){return re}function Qe(e,t){return He(Ne,e,t)}function Ke(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Wr(e){return gt=Le=1,$r=le(Ne=e),re=0,[]}function jr(e){return Ne="",e}function ot(e){return Ir(Qe(re-1,At(e===91?e+2:e===40?e+1:e)))}function Qn(e){for(;(K=fe())&&K<33;)oe();return Ke(e)>2||Ke(K)>3?"":" "}function Xn(e,t){for(;--t&&oe()&&!(K<48||K>102||K>57&&K<65||K>70&&K<97););return Qe(e,nt()+(t<6&&fe()==32&&oe()==32))}function At(e){for(;oe();)switch(K){case e:return re;case 34:case 39:e!==34&&e!==39&&At(K);break;case 40:e===41&&At(e);break;case 92:oe();break}return re}function Zn(e,t){for(;oe()&&e+K!==57;)if(e+K===84&&fe()===47)break;return"/*"+Qe(t,re-1)+"*"+dt(e===47?e:oe())}function eo(e){for(;!Ke(fe());)oe();return Qe(e,re)}function to(e){return jr(it("",null,null,null,[""],e=Wr(e),0,[0],e))}function it(e,t,r,n,o,i,s,c,l){for(var d=0,f=0,m=s,P=0,E=0,w=0,v=1,y=1,k=1,g=0,C="",M=o,h=i,z=n,N=C;y;)switch(w=g,g=oe()){case 40:if(w!=108&&Q(N,m-1)==58){Ot(N+=$(ot(g),"&","&\f"),"&\f")!=-1&&(k=-1);break}case 34:case 39:case 91:N+=ot(g);break;case 9:case 10:case 13:case 32:N+=Qn(w);break;case 92:N+=Xn(nt()-1,7);continue;case 47:switch(fe()){case 42:case 47:et(ro(Zn(oe(),nt()),t,r),l);break;default:N+="/"}break;case 123*v:c[d++]=le(N)*k;case 125*v:case 59:case 0:switch(g){case 0:case 125:y=0;case 59+f:k==-1&&(N=$(N,/\f/g,"")),E>0&&le(N)-m&&et(E>32?Er(N+";",n,r,m-1):Er($(N," ","")+";",n,r,m-2),l);break;case 59:N+=";";default:if(et(z=xr(N,t,r,d,f,o,c,C,M=[],h=[],m),i),g===123)if(f===0)it(N,t,z,z,M,i,m,c,h);else switch(P===99&&Q(N,3)===110?100:P){case 100:case 108:case 109:case 115:it(e,z,z,n&&et(xr(e,z,z,0,0,o,c,C,o,M=[],m),h),o,h,m,c,n?M:h);break;default:it(N,z,z,z,[""],h,0,c,h)}}d=f=E=0,v=k=1,C=N="",m=s;break;case 58:m=1+le(N),E=w;default:if(v<1){if(g==123)--v;else if(g==125&&v++==0&&Jn()==125)continue}switch(N+=dt(g),g*v){case 38:k=f>0?1:(N+="\f",-1);break;case 44:c[d++]=(le(N)-1)*k,k=1;break;case 64:fe()===45&&(N+=ot(oe())),P=fe(),f=m=le(C=N+=eo(nt())),g++;break;case 45:w===45&&le(N)==2&&(v=0)}}return i}function xr(e,t,r,n,o,i,s,c,l,d,f){for(var m=o-1,P=o===0?i:[""],E=Ut(P),w=0,v=0,y=0;w<n;++w)for(var k=0,g=He(e,m+1,m=zn(v=s[w])),C=e;k<E;++k)(C=Ir(v>0?P[k]+" "+g:$(g,/&\f/g,P[k])))&&(l[y++]=C);return pt(e,t,r,o===0?Yt:c,l,d,f)}function ro(e,t,r){return pt(e,t,r,Dr,dt(Gn()),He(e,2,-2),0)}function Er(e,t,r,n){return pt(e,t,r,zt,He(e,0,n),He(e,n+1,-1),n)}function Ae(e,t){for(var r="",n=Ut(e),o=0;o<n;o++)r+=t(e[o],o,e,t)||"";return r}function no(e,t,r,n){switch(e.type){case Yn:if(e.children.length)break;case Vn:case zt:return e.return=e.return||e.value;case Dr:return"";case Nr:return e.return=e.value+"{"+Ae(e.children,n)+"}";case Yt:e.value=e.props.join(",")}return le(r=Ae(e.children,n))?e.return=e.value+"{"+r+"}":""}function oo(e){var t=Ut(e);return function(r,n,o,i){for(var s="",c=0;c<t;c++)s+=e[c](r,n,o,i)||"";return s}}function io(e){return function(t){t.root||(t=t.return)&&e(t)}}function ao(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var so=function(t,r,n){for(var o=0,i=0;o=i,i=fe(),o===38&&i===12&&(r[n]=1),!Ke(i);)oe();return Qe(t,re)},co=function(t,r){var n=-1,o=44;do switch(Ke(o)){case 0:o===38&&fe()===12&&(r[n]=1),t[n]+=so(re-1,r,n);break;case 2:t[n]+=ot(o);break;case 4:if(o===44){t[++n]=fe()===58?"&\f":"",r[n]=t[n].length;break}default:t[n]+=dt(o)}while(o=oe());return t},lo=function(t,r){return jr(co(Wr(t),r))},Sr=new WeakMap,uo=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var r=t.value,n=t.parent,o=t.column===n.column&&t.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(t.props.length===1&&r.charCodeAt(0)!==58&&!Sr.get(n))&&!o){Sr.set(t,!0);for(var i=[],s=lo(r,i),c=n.props,l=0,d=0;l<s.length;l++)for(var f=0;f<c.length;f++,d++)t.props[d]=i[l]?s[l].replace(/&\f/g,c[f]):c[f]+" "+s[l]}}},fo=function(t){if(t.type==="decl"){var r=t.value;r.charCodeAt(0)===108&&r.charCodeAt(2)===98&&(t.return="",t.value="")}};function qr(e,t){switch(Bn(e,t)){case 5103:return I+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return I+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return I+e+at+e+X+e+e;case 6828:case 4268:return I+e+X+e+e;case 6165:return I+e+X+"flex-"+e+e;case 5187:return I+e+$(e,/(\w+).+(:[^]+)/,I+"box-$1$2"+X+"flex-$1$2")+e;case 5443:return I+e+X+"flex-item-"+$(e,/flex-|-self/,"")+e;case 4675:return I+e+X+"flex-line-pack"+$(e,/align-content|flex-|-self/,"")+e;case 5548:return I+e+X+$(e,"shrink","negative")+e;case 5292:return I+e+X+$(e,"basis","preferred-size")+e;case 6060:return I+"box-"+$(e,"-grow","")+I+e+X+$(e,"grow","positive")+e;case 4554:return I+$(e,/([^-])(transform)/g,"$1"+I+"$2")+e;case 6187:return $($($(e,/(zoom-|grab)/,I+"$1"),/(image-set)/,I+"$1"),e,"")+e;case 5495:case 3959:return $(e,/(image-set\([^]*)/,I+"$1$`$1");case 4968:return $($(e,/(.+:)(flex-)?(.*)/,I+"box-pack:$3"+X+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+I+e+e;case 4095:case 3583:case 4068:case 2532:return $(e,/(.+)-inline(.+)/,I+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(le(e)-1-t>6)switch(Q(e,t+1)){case 109:if(Q(e,t+4)!==45)break;case 102:return $(e,/(.+:)(.+)-([^]+)/,"$1"+I+"$2-$3$1"+at+(Q(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Ot(e,"stretch")?qr($(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(Q(e,t+1)!==115)break;case 6444:switch(Q(e,le(e)-3-(~Ot(e,"!important")&&10))){case 107:return $(e,":",":"+I)+e;case 101:return $(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+I+(Q(e,14)===45?"inline-":"")+"box$3$1"+I+"$2$3$1"+X+"$2box$3")+e}break;case 5936:switch(Q(e,t+11)){case 114:return I+e+X+$(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return I+e+X+$(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return I+e+X+$(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return I+e+X+e+e}return e}var ho=function(t,r,n,o){if(t.length>-1&&!t.return)switch(t.type){case zt:t.return=qr(t.value,t.length);break;case Nr:return Ae([Ue(t,{value:$(t.value,"@","@"+I)})],o);case Yt:if(t.length)return Kn(t.props,function(i){switch(Hn(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Ae([Ue(t,{props:[$(i,/:(read-\w+)/,":"+at+"$1")]})],o);case"::placeholder":return Ae([Ue(t,{props:[$(i,/:(plac\w+)/,":"+I+"input-$1")]}),Ue(t,{props:[$(i,/:(plac\w+)/,":"+at+"$1")]}),Ue(t,{props:[$(i,/:(plac\w+)/,X+"input-$1")]})],o)}return""})}},go=[ho],po=function(t){var r=t.key;if(r==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(v){var y=v.getAttribute("data-emotion");y.indexOf(" ")!==-1&&(document.head.appendChild(v),v.setAttribute("data-s",""))})}var o=t.stylisPlugins||go,i={},s,c=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(v){for(var y=v.getAttribute("data-emotion").split(" "),k=1;k<y.length;k++)i[y[k]]=!0;c.push(v)});var l,d=[uo,fo];{var f,m=[no,io(function(v){f.insert(v)})],P=oo(d.concat(o,m)),E=function(y){return Ae(to(y),P)};l=function(y,k,g,C){f=g,E(y?y+"{"+k.styles+"}":k.styles),C&&(w.inserted[k.name]=!0)}}var w={key:r,sheet:new qn({key:r,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:i,registered:{},insert:l};return w.sheet.hydrate(c),w},Ft={exports:{}},j={};/** @license React v16.13.1
|
|
30
|
+
<%s key={someKey} {...props} />`,kt,Se,$n,Se),pr[Se+kt]=!0}}return a===n?An(J):Mn(J),J}}function Fn(a,u,g){return mr(a,u,g,!0)}function Nn(a,u,g){return mr(a,u,g,!1)}var Dn=Nn,Ln=Fn;ze.Fragment=n,ze.jsx=Dn,ze.jsxs=Ln}()),ze}process.env.NODE_ENV==="production"?Ot.exports=jn():Ot.exports=Vn();var xr=Ot.exports;function qn(e){if(e.sheet)return e.sheet;for(var t=0;t<document.styleSheets.length;t++)if(document.styleSheets[t].ownerNode===e)return document.styleSheets[t]}function Yn(e){var t=document.createElement("style");return t.setAttribute("data-emotion",e.key),e.nonce!==void 0&&t.setAttribute("nonce",e.nonce),t.appendChild(document.createTextNode("")),t.setAttribute("data-s",""),t}var zn=function(){function e(r){var n=this;this._insertTag=function(o){var i;n.tags.length===0?n.insertionPoint?i=n.insertionPoint.nextSibling:n.prepend?i=n.container.firstChild:i=n.before:i=n.tags[n.tags.length-1].nextSibling,n.container.insertBefore(o,i),n.tags.push(o)},this.isSpeedy=r.speedy===void 0?!0:r.speedy,this.tags=[],this.ctr=0,this.nonce=r.nonce,this.key=r.key,this.container=r.container,this.prepend=r.prepend,this.insertionPoint=r.insertionPoint,this.before=null}var t=e.prototype;return t.hydrate=function(n){n.forEach(this._insertTag)},t.insert=function(n){this.ctr%(this.isSpeedy?65e3:1)===0&&this._insertTag(Yn(this));var o=this.tags[this.tags.length-1];if(this.isSpeedy){var i=qn(o);try{i.insertRule(n,i.cssRules.length)}catch{}}else o.appendChild(document.createTextNode(n));this.ctr++},t.flush=function(){this.tags.forEach(function(n){var o;return(o=n.parentNode)==null?void 0:o.removeChild(n)}),this.tags=[],this.ctr=0},e}(),Z="-ms-",at="-moz-",I="-webkit-",$r="comm",zt="rule",Ht="decl",Hn="@import",Ir="@keyframes",Bn="@layer",Jn=Math.abs,dt=String.fromCharCode,Kn=Object.assign;function Un(e,t){return X(e,0)^45?(((t<<2^X(e,0))<<2^X(e,1))<<2^X(e,2))<<2^X(e,3):0}function Wr(e){return e.trim()}function Gn(e,t){return(e=t.exec(e))?e[0]:e}function W(e,t,r){return e.replace(t,r)}function Mt(e,t){return e.indexOf(t)}function X(e,t){return e.charCodeAt(t)|0}function Je(e,t,r){return e.slice(t,r)}function fe(e){return e.length}function Bt(e){return e.length}function et(e,t){return t.push(e),e}function Qn(e,t){return e.map(t).join("")}var gt=1,De=1,jr=0,oe=0,K=0,$e="";function pt(e,t,r,n,o,i,s){return{value:e,root:t,parent:r,type:n,props:o,children:i,line:gt,column:De,length:s,return:""}}function He(e,t){return Kn(pt("",null,null,"",null,null,0),e,{length:-e.length},t)}function Xn(){return K}function Zn(){return K=oe>0?X($e,--oe):0,De--,K===10&&(De=1,gt--),K}function ae(){return K=oe<jr?X($e,oe++):0,De++,K===10&&(De=1,gt++),K}function de(){return X($e,oe)}function nt(){return oe}function Qe(e,t){return Je($e,e,t)}function Ke(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function Vr(e){return gt=De=1,jr=fe($e=e),oe=0,[]}function qr(e){return $e="",e}function ot(e){return Wr(Qe(oe-1,At(e===91?e+2:e===40?e+1:e)))}function eo(e){for(;(K=de())&&K<33;)ae();return Ke(e)>2||Ke(K)>3?"":" "}function to(e,t){for(;--t&&ae()&&!(K<48||K>102||K>57&&K<65||K>70&&K<97););return Qe(e,nt()+(t<6&&de()==32&&ae()==32))}function At(e){for(;ae();)switch(K){case e:return oe;case 34:case 39:e!==34&&e!==39&&At(K);break;case 40:e===41&&At(e);break;case 92:ae();break}return oe}function ro(e,t){for(;ae()&&e+K!==57;)if(e+K===84&&de()===47)break;return"/*"+Qe(t,oe-1)+"*"+dt(e===47?e:ae())}function no(e){for(;!Ke(de());)ae();return Qe(e,oe)}function oo(e){return qr(it("",null,null,null,[""],e=Vr(e),0,[0],e))}function it(e,t,r,n,o,i,s,c,l){for(var d=0,f=0,p=s,O=0,b=0,R=0,v=1,m=1,w=1,E=0,T="",L=o,h=i,_=n,M=T;m;)switch(R=E,E=ae()){case 40:if(R!=108&&X(M,p-1)==58){Mt(M+=W(ot(E),"&","&\f"),"&\f")!=-1&&(w=-1);break}case 34:case 39:case 91:M+=ot(E);break;case 9:case 10:case 13:case 32:M+=eo(R);break;case 92:M+=to(nt()-1,7);continue;case 47:switch(de()){case 42:case 47:et(io(ro(ae(),nt()),t,r),l);break;default:M+="/"}break;case 123*v:c[d++]=fe(M)*w;case 125*v:case 59:case 0:switch(E){case 0:case 125:m=0;case 59+f:w==-1&&(M=W(M,/\f/g,"")),b>0&&fe(M)-p&&et(b>32?Sr(M+";",n,r,p-1):Sr(W(M," ","")+";",n,r,p-2),l);break;case 59:M+=";";default:if(et(_=Er(M,t,r,d,f,o,c,T,L=[],h=[],p),i),E===123)if(f===0)it(M,t,_,_,L,i,p,c,h);else switch(O===99&&X(M,3)===110?100:O){case 100:case 108:case 109:case 115:it(e,_,_,n&&et(Er(e,_,_,0,0,o,c,T,o,L=[],p),h),o,h,p,c,n?L:h);break;default:it(M,_,_,_,[""],h,0,c,h)}}d=f=b=0,v=w=1,T=M="",p=s;break;case 58:p=1+fe(M),b=R;default:if(v<1){if(E==123)--v;else if(E==125&&v++==0&&Zn()==125)continue}switch(M+=dt(E),E*v){case 38:w=f>0?1:(M+="\f",-1);break;case 44:c[d++]=(fe(M)-1)*w,w=1;break;case 64:de()===45&&(M+=ot(ae())),O=de(),f=p=fe(T=M+=no(nt())),E++;break;case 45:R===45&&fe(M)==2&&(v=0)}}return i}function Er(e,t,r,n,o,i,s,c,l,d,f){for(var p=o-1,O=o===0?i:[""],b=Bt(O),R=0,v=0,m=0;R<n;++R)for(var w=0,E=Je(e,p+1,p=Jn(v=s[R])),T=e;w<b;++w)(T=Wr(v>0?O[w]+" "+E:W(E,/&\f/g,O[w])))&&(l[m++]=T);return pt(e,t,r,o===0?zt:c,l,d,f)}function io(e,t,r){return pt(e,t,r,$r,dt(Xn()),Je(e,2,-2),0)}function Sr(e,t,r,n){return pt(e,t,r,Ht,Je(e,0,n),Je(e,n+1,-1),n)}function Fe(e,t){for(var r="",n=Bt(e),o=0;o<n;o++)r+=t(e[o],o,e,t)||"";return r}function ao(e,t,r,n){switch(e.type){case Bn:if(e.children.length)break;case Hn:case Ht:return e.return=e.return||e.value;case $r:return"";case Ir:return e.return=e.value+"{"+Fe(e.children,n)+"}";case zt:e.value=e.props.join(",")}return fe(r=Fe(e.children,n))?e.return=e.value+"{"+r+"}":""}function so(e){var t=Bt(e);return function(r,n,o,i){for(var s="",c=0;c<t;c++)s+=e[c](r,n,o,i)||"";return s}}function co(e){return function(t){t.root||(t=t.return)&&e(t)}}function lo(e){var t=Object.create(null);return function(r){return t[r]===void 0&&(t[r]=e(r)),t[r]}}var uo=function(t,r,n){for(var o=0,i=0;o=i,i=de(),o===38&&i===12&&(r[n]=1),!Ke(i);)ae();return Qe(t,oe)},fo=function(t,r){var n=-1,o=44;do switch(Ke(o)){case 0:o===38&&de()===12&&(r[n]=1),t[n]+=uo(oe-1,r,n);break;case 2:t[n]+=ot(o);break;case 4:if(o===44){t[++n]=de()===58?"&\f":"",r[n]=t[n].length;break}default:t[n]+=dt(o)}while(o=ae());return t},ho=function(t,r){return qr(fo(Vr(t),r))},Cr=new WeakMap,go=function(t){if(!(t.type!=="rule"||!t.parent||t.length<1)){for(var r=t.value,n=t.parent,o=t.column===n.column&&t.line===n.line;n.type!=="rule";)if(n=n.parent,!n)return;if(!(t.props.length===1&&r.charCodeAt(0)!==58&&!Cr.get(n))&&!o){Cr.set(t,!0);for(var i=[],s=ho(r,i),c=n.props,l=0,d=0;l<s.length;l++)for(var f=0;f<c.length;f++,d++)t.props[d]=i[l]?s[l].replace(/&\f/g,c[f]):c[f]+" "+s[l]}}},po=function(t){if(t.type==="decl"){var r=t.value;r.charCodeAt(0)===108&&r.charCodeAt(2)===98&&(t.return="",t.value="")}};function Yr(e,t){switch(Un(e,t)){case 5103:return I+"print-"+e+e;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 6391:case 5879:case 5623:case 6135:case 4599:case 4855:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:return I+e+e;case 5349:case 4246:case 4810:case 6968:case 2756:return I+e+at+e+Z+e+e;case 6828:case 4268:return I+e+Z+e+e;case 6165:return I+e+Z+"flex-"+e+e;case 5187:return I+e+W(e,/(\w+).+(:[^]+)/,I+"box-$1$2"+Z+"flex-$1$2")+e;case 5443:return I+e+Z+"flex-item-"+W(e,/flex-|-self/,"")+e;case 4675:return I+e+Z+"flex-line-pack"+W(e,/align-content|flex-|-self/,"")+e;case 5548:return I+e+Z+W(e,"shrink","negative")+e;case 5292:return I+e+Z+W(e,"basis","preferred-size")+e;case 6060:return I+"box-"+W(e,"-grow","")+I+e+Z+W(e,"grow","positive")+e;case 4554:return I+W(e,/([^-])(transform)/g,"$1"+I+"$2")+e;case 6187:return W(W(W(e,/(zoom-|grab)/,I+"$1"),/(image-set)/,I+"$1"),e,"")+e;case 5495:case 3959:return W(e,/(image-set\([^]*)/,I+"$1$`$1");case 4968:return W(W(e,/(.+:)(flex-)?(.*)/,I+"box-pack:$3"+Z+"flex-pack:$3"),/s.+-b[^;]+/,"justify")+I+e+e;case 4095:case 3583:case 4068:case 2532:return W(e,/(.+)-inline(.+)/,I+"$1$2")+e;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(fe(e)-1-t>6)switch(X(e,t+1)){case 109:if(X(e,t+4)!==45)break;case 102:return W(e,/(.+:)(.+)-([^]+)/,"$1"+I+"$2-$3$1"+at+(X(e,t+3)==108?"$3":"$2-$3"))+e;case 115:return~Mt(e,"stretch")?Yr(W(e,"stretch","fill-available"),t)+e:e}break;case 4949:if(X(e,t+1)!==115)break;case 6444:switch(X(e,fe(e)-3-(~Mt(e,"!important")&&10))){case 107:return W(e,":",":"+I)+e;case 101:return W(e,/(.+:)([^;!]+)(;|!.+)?/,"$1"+I+(X(e,14)===45?"inline-":"")+"box$3$1"+I+"$2$3$1"+Z+"$2box$3")+e}break;case 5936:switch(X(e,t+11)){case 114:return I+e+Z+W(e,/[svh]\w+-[tblr]{2}/,"tb")+e;case 108:return I+e+Z+W(e,/[svh]\w+-[tblr]{2}/,"tb-rl")+e;case 45:return I+e+Z+W(e,/[svh]\w+-[tblr]{2}/,"lr")+e}return I+e+Z+e+e}return e}var mo=function(t,r,n,o){if(t.length>-1&&!t.return)switch(t.type){case Ht:t.return=Yr(t.value,t.length);break;case Ir:return Fe([He(t,{value:W(t.value,"@","@"+I)})],o);case zt:if(t.length)return Qn(t.props,function(i){switch(Gn(i,/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":return Fe([He(t,{props:[W(i,/:(read-\w+)/,":"+at+"$1")]})],o);case"::placeholder":return Fe([He(t,{props:[W(i,/:(plac\w+)/,":"+I+"input-$1")]}),He(t,{props:[W(i,/:(plac\w+)/,":"+at+"$1")]}),He(t,{props:[W(i,/:(plac\w+)/,Z+"input-$1")]})],o)}return""})}},yo=[mo],vo=function(t){var r=t.key;if(r==="css"){var n=document.querySelectorAll("style[data-emotion]:not([data-s])");Array.prototype.forEach.call(n,function(v){var m=v.getAttribute("data-emotion");m.indexOf(" ")!==-1&&(document.head.appendChild(v),v.setAttribute("data-s",""))})}var o=t.stylisPlugins||yo,i={},s,c=[];s=t.container||document.head,Array.prototype.forEach.call(document.querySelectorAll('style[data-emotion^="'+r+' "]'),function(v){for(var m=v.getAttribute("data-emotion").split(" "),w=1;w<m.length;w++)i[m[w]]=!0;c.push(v)});var l,d=[go,po];{var f,p=[ao,co(function(v){f.insert(v)})],O=so(d.concat(o,p)),b=function(m){return Fe(oo(m),O)};l=function(m,w,E,T){f=E,b(m?m+"{"+w.styles+"}":w.styles),T&&(R.inserted[w.name]=!0)}}var R={key:r,sheet:new zn({key:r,container:s,nonce:t.nonce,speedy:t.speedy,prepend:t.prepend,insertionPoint:t.insertionPoint}),nonce:t.nonce,inserted:i,registered:{},insert:l};return R.sheet.hydrate(c),R},Ft={exports:{}},V={};/** @license React v16.13.1
|
|
31
31
|
* react-is.production.min.js
|
|
32
32
|
*
|
|
33
33
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
34
34
|
*
|
|
35
35
|
* This source code is licensed under the MIT license found in the
|
|
36
36
|
* LICENSE file in the root directory of this source tree.
|
|
37
|
-
*/var
|
|
37
|
+
*/var Rr;function bo(){if(Rr)return V;Rr=1;var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,O=e?Symbol.for("react.suspense_list"):60120,b=e?Symbol.for("react.memo"):60115,R=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function T(h){if(typeof h=="object"&&h!==null){var _=h.$$typeof;switch(_){case t:switch(h=h.type,h){case l:case d:case n:case i:case o:case p:return h;default:switch(h=h&&h.$$typeof,h){case c:case f:case R:case b:case s:return h;default:return _}}case r:return _}}}function L(h){return T(h)===d}return V.AsyncMode=l,V.ConcurrentMode=d,V.ContextConsumer=c,V.ContextProvider=s,V.Element=t,V.ForwardRef=f,V.Fragment=n,V.Lazy=R,V.Memo=b,V.Portal=r,V.Profiler=i,V.StrictMode=o,V.Suspense=p,V.isAsyncMode=function(h){return L(h)||T(h)===l},V.isConcurrentMode=L,V.isContextConsumer=function(h){return T(h)===c},V.isContextProvider=function(h){return T(h)===s},V.isElement=function(h){return typeof h=="object"&&h!==null&&h.$$typeof===t},V.isForwardRef=function(h){return T(h)===f},V.isFragment=function(h){return T(h)===n},V.isLazy=function(h){return T(h)===R},V.isMemo=function(h){return T(h)===b},V.isPortal=function(h){return T(h)===r},V.isProfiler=function(h){return T(h)===i},V.isStrictMode=function(h){return T(h)===o},V.isSuspense=function(h){return T(h)===p},V.isValidElementType=function(h){return typeof h=="string"||typeof h=="function"||h===n||h===d||h===i||h===o||h===p||h===O||typeof h=="object"&&h!==null&&(h.$$typeof===R||h.$$typeof===b||h.$$typeof===s||h.$$typeof===c||h.$$typeof===f||h.$$typeof===m||h.$$typeof===w||h.$$typeof===E||h.$$typeof===v)},V.typeOf=T,V}var q={};/** @license React v16.13.1
|
|
38
38
|
* react-is.development.js
|
|
39
39
|
*
|
|
40
40
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
41
41
|
*
|
|
42
42
|
* This source code is licensed under the MIT license found in the
|
|
43
43
|
* LICENSE file in the root directory of this source tree.
|
|
44
|
-
*/var Rr;function yo(){return Rr||(Rr=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,m=e?Symbol.for("react.suspense"):60113,P=e?Symbol.for("react.suspense_list"):60120,E=e?Symbol.for("react.memo"):60115,w=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,y=e?Symbol.for("react.fundamental"):60117,k=e?Symbol.for("react.responder"):60118,g=e?Symbol.for("react.scope"):60119;function C(S){return typeof S=="string"||typeof S=="function"||S===n||S===d||S===i||S===o||S===m||S===P||typeof S=="object"&&S!==null&&(S.$$typeof===w||S.$$typeof===E||S.$$typeof===s||S.$$typeof===c||S.$$typeof===f||S.$$typeof===y||S.$$typeof===k||S.$$typeof===g||S.$$typeof===v)}function M(S){if(typeof S=="object"&&S!==null){var qe=S.$$typeof;switch(qe){case t:var Te=S.type;switch(Te){case l:case d:case n:case i:case o:case m:return Te;default:var xe=Te&&Te.$$typeof;switch(xe){case c:case f:case w:case E:case s:return xe;default:return qe}}case r:return qe}}}var h=l,z=d,N=c,Ie=s,ve=t,Ce=f,Re=n,be=w,ee=E,ce=r,he=i,b=o,O=m,A=!1;function D(S){return A||(A=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),U(S)||M(S)===l}function U(S){return M(S)===d}function G(S){return M(S)===c}function ie(S){return M(S)===s}function de(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function bt(S){return M(S)===f}function xt(S){return M(S)===n}function $e(S){return M(S)===w}function We(S){return M(S)===E}function we(S){return M(S)===r}function je(S){return M(S)===i}function ke(S){return M(S)===o}function Et(S){return M(S)===m}q.AsyncMode=h,q.ConcurrentMode=z,q.ContextConsumer=N,q.ContextProvider=Ie,q.Element=ve,q.ForwardRef=Ce,q.Fragment=Re,q.Lazy=be,q.Memo=ee,q.Portal=ce,q.Profiler=he,q.StrictMode=b,q.Suspense=O,q.isAsyncMode=D,q.isConcurrentMode=U,q.isContextConsumer=G,q.isContextProvider=ie,q.isElement=de,q.isForwardRef=bt,q.isFragment=xt,q.isLazy=$e,q.isMemo=We,q.isPortal=we,q.isProfiler=je,q.isStrictMode=ke,q.isSuspense=Et,q.isValidElementType=C,q.typeOf=M}()),q}process.env.NODE_ENV==="production"?Ft.exports=mo():Ft.exports=yo();var vo=Ft.exports,Vr=vo,bo={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},xo={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Yr={};Yr[Vr.ForwardRef]=bo;Yr[Vr.Memo]=xo;var Eo=!0;function So(e,t,r){var n="";return r.split(" ").forEach(function(o){e[o]!==void 0?t.push(e[o]+";"):o&&(n+=o+" ")}),n}var zr=function(t,r,n){var o=t.key+"-"+r.name;(n===!1||Eo===!1)&&t.registered[o]===void 0&&(t.registered[o]=r.styles)},Co=function(t,r,n){zr(t,r,n);var o=t.key+"-"+r.name;if(t.inserted[r.name]===void 0){var i=r;do t.insert(r===i?"."+o:"",i,t.sheet,!0),i=i.next;while(i!==void 0)}};function Ro(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var wo={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},ko=/[A-Z]|^ms/g,To=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Ur=function(t){return t.charCodeAt(1)===45},wr=function(t){return t!=null&&typeof t!="boolean"},Tt=ao(function(e){return Ur(e)?e:e.replace(ko,"-$&").toLowerCase()}),kr=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(To,function(n,o,i){return ue={name:o,styles:i,next:ue},o})}return wo[t]!==1&&!Ur(t)&&typeof r=="number"&&r!==0?r+"px":r};function Ge(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var o=r;if(o.anim===1)return ue={name:o.name,styles:o.styles,next:ue},o.name;var i=r;if(i.styles!==void 0){var s=i.next;if(s!==void 0)for(;s!==void 0;)ue={name:s.name,styles:s.styles,next:ue},s=s.next;var c=i.styles+";";return c}return _o(e,t,r)}case"function":{if(e!==void 0){var l=ue,d=r(e);return ue=l,Ge(e,t,d)}break}}var f=r;return f}function _o(e,t,r){var n="";if(Array.isArray(r))for(var o=0;o<r.length;o++)n+=Ge(e,t,r[o])+";";else for(var i in r){var s=r[i];if(typeof s!="object"){var c=s;wr(c)&&(n+=Tt(i)+":"+kr(i,c)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&t==null)for(var l=0;l<s.length;l++)wr(s[l])&&(n+=Tt(i)+":"+kr(i,s[l])+";");else{var d=Ge(e,t,s);switch(i){case"animation":case"animationName":{n+=Tt(i)+":"+d+";";break}default:n+=i+"{"+d+"}"}}}return n}var Tr=/label:\s*([^\s;{]+)\s*(;|$)/g,ue;function Po(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,o="";ue=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=Ge(r,t,i);else{var s=i;o+=s[0]}for(var c=1;c<e.length;c++)if(o+=Ge(r,t,e[c]),n){var l=i;o+=l[c]}Tr.lastIndex=0;for(var d="",f;(f=Tr.exec(o))!==null;)d+="-"+f[1];var m=Ro(o)+d;return{name:m,styles:o,next:ue}}var Mo=function(t){return t()},Oo=me.useInsertionEffect?me.useInsertionEffect:!1,Ao=Oo||Mo,Br=me.createContext(typeof HTMLElement<"u"?po({key:"css"}):null);Br.Provider;var Fo=function(t){return T.forwardRef(function(r,n){var o=T.useContext(Br);return t(r,o,n)})},Lo=me.createContext({}),Bt={}.hasOwnProperty,Lt="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Do=function(t,r){var n={};for(var o in r)Bt.call(r,o)&&(n[o]=r[o]);return n[Lt]=t,n},No=function(t){var r=t.cache,n=t.serialized,o=t.isStringTag;return zr(r,n,o),Ao(function(){return Co(r,n,o)}),null},Io=Fo(function(e,t,r){var n=e.css;typeof n=="string"&&t.registered[n]!==void 0&&(n=t.registered[n]);var o=e[Lt],i=[n],s="";typeof e.className=="string"?s=So(t.registered,i,e.className):e.className!=null&&(s=e.className+" ");var c=Po(i,void 0,me.useContext(Lo));s+=t.key+"-"+c.name;var l={};for(var d in e)Bt.call(e,d)&&d!=="css"&&d!==Lt&&(l[d]=e[d]);return l.className=s,r&&(l.ref=r),me.createElement(me.Fragment,null,me.createElement(No,{cache:t,serialized:c,isStringTag:typeof o=="string"}),me.createElement(o,l))}),$o=Io,mt=function(t,r,n){return Bt.call(r,"css")?br.jsx($o,Do(t,r),n):br.jsx(t,r,n)};function Hr(e){switch(e.toLowerCase()){case"sql":return Fr.sql();case"json":return Lr.json();default:return[]}}function Kr(e){return["sql","json"].includes(e.toLowerCase())}function Gr(e={}){return Vt.autocompletion(e)}function Wo(e){return[mr.lintGutter(),mr.linter(e)]}function Jr(){return x.keymap.of([ge.indentWithTab])}const jo=[Jr(),Gr()],qo=se.HighlightStyle.define([{tag:V.tags.keyword,color:"#1a1aa6",fontWeight:"bold"},{tag:V.tags.comment,color:"#008000",fontStyle:"italic"},{tag:V.tags.string,color:"#a31515"},{tag:V.tags.number,color:"#098658"},{tag:V.tags.operator,color:"#777777"},{tag:V.tags.propertyName,color:"#0451a5"},{tag:V.tags.variableName,color:"#001080"},{tag:V.tags.definition(V.tags.variableName),color:"#1a1aa6"},{tag:V.tags.typeName,color:"#267f99"},{tag:V.tags.className,color:"#267f99"},{tag:V.tags.meta,color:"#5c5c5c"},{tag:V.tags.regexp,color:"#811f3f"},{tag:V.tags.link,color:"#0563c1",textDecoration:"underline"}]),Dt=[x.EditorView.theme({"&":{backgroundColor:"#ffffff",color:"#333333",fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:'"Menlo", "Monaco", "Courier New", monospace',overflow:"auto"},".cm-content":{padding:"8px 0",caretColor:"#333",textAlign:"left"},".cm-gutters":{backgroundColor:"#f8f9fa",color:"#6e7781",borderRight:"1px solid #ddd"},".cm-lineNumbers":{minWidth:"40px"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",textAlign:"right",fontSize:"12px"},".cm-activeLine":{backgroundColor:"rgba(0, 0, 0, 0.04)"},".cm-activeLineGutter":{backgroundColor:"rgba(0, 0, 0, 0.04)"},".cm-selectionMatch":{backgroundColor:"rgba(181, 213, 255, 0.3)"},"&.cm-focused .cm-cursor":{borderLeftColor:"#333333"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(181, 213, 255, 0.5)"}}),se.syntaxHighlighting(qo)],Vo=se.HighlightStyle.define([{tag:V.tags.keyword,color:"#569cd6",fontWeight:"bold"},{tag:V.tags.comment,color:"#6A9955",fontStyle:"italic"},{tag:V.tags.string,color:"#ce9178"},{tag:V.tags.number,color:"#b5cea8"},{tag:V.tags.operator,color:"#d4d4d4"},{tag:V.tags.propertyName,color:"#9cdcfe"},{tag:V.tags.variableName,color:"#9cdcfe"},{tag:V.tags.definition(V.tags.variableName),color:"#4fc1ff"},{tag:V.tags.typeName,color:"#4ec9b0"},{tag:V.tags.className,color:"#4ec9b0"},{tag:V.tags.meta,color:"#d4d4d4"},{tag:V.tags.regexp,color:"#d16969"},{tag:V.tags.link,color:"#4e94ce",textDecoration:"underline"}]),Qr=[x.EditorView.theme({"&":{backgroundColor:"#1e1e1e",color:"#d4d4d4",fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:'"Menlo", "Monaco", "Courier New", monospace',overflow:"auto"},".cm-content":{padding:"8px 0",caretColor:"#d4d4d4",textAlign:"left"},".cm-gutters":{backgroundColor:"#252526",color:"#858585",borderRight:"1px solid #404040"},".cm-lineNumbers":{minWidth:"40px"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",textAlign:"right",fontSize:"12px"},".cm-activeLine":{backgroundColor:"rgba(255, 255, 255, 0.07)"},".cm-activeLineGutter":{backgroundColor:"rgba(255, 255, 255, 0.07)"},".cm-selectionMatch":{backgroundColor:"rgba(255, 255, 255, 0.1)"},"&.cm-focused .cm-cursor":{borderLeftColor:"#d4d4d4"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}),se.syntaxHighlighting(Vo)];function Xr(e){switch(e){case"light":return Dt;case"dark":return Qr;default:return Dt}}const Nt=e=>{const t={value:"",readOnlyRanges:[]};let r=0;return e.forEach(n=>{const{content:o,editable:i}=n,s=o.replace(/\r\n/g,`
|
|
45
|
-
`),c=r,l=c+s.length;t.value+=o,i||t.readOnlyRanges.push({start:c,end:l}),r=l}),t},st=
|
|
46
|
-
`},selection:{anchor:o+1}}),!0)}}]),
|
|
47
|
-
`&&o===i)){for(const f of t)if(o===i){if(o>f.start&&o<f.end){n=!0;break}}else if(o<f.end&&i>f.start||o===f.start&&i>o||i===f.end&&o<i){n=!0;break}}}),n?[]:r}),x.EditorView.updateListener.of(r=>{if(r.docChanged){const n=zo(t,r);!Yo(t,n)?(t=n,Ht.set(r.view,n),r.view.dispatch({effects:st.of(n)})):r.view.dispatch({effects:st.of(n)})}}),x.EditorView.updateListener.of(r=>{r.docChanged&&setTimeout(()=>{r.view.state.field(_r,!1)&&r.view.dispatch({})},10)})]}function Yo(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].start!==t[r].start||e[r].end!==t[r].end)return!1;return!0}function zo(e,t){var o;if(!t.docChanged)return e;let r=!1;const n=e.map(i=>{const s={...i};return t.changes.iterChanges((c,l,d,f)=>{const m=f-d,P=l-c,E=m-P;if(c===0&&(r=!0),c===0&&m>0&&i.start===0){s.start=m,s.end+=E;return}if(l<=i.start)s.start+=E,s.end+=E;else if(c>=i.start&&c<i.end&&l>=i.end)s.end=c;else if(!(c>=i.start&&l<=i.end)){if(c<i.end&&l>i.end){const w=i.end-c;s.end=c+Math.min(w,m)}}}),s});if(r&&n.length>0){const i=((o=t.changes.newDoc)==null?void 0:o.toString())||"";let s=0;for(let c=0;c<i.length&&/\s/.test(i[c]);c++)s++;n[0].start===0&&s>0&&(n[0].start=s)}return n.filter(i=>i.start<i.end)}function tn(e){return Ht.get(e)||[]}function pe(e,t){const r=t.map(n=>({...n}));Ht.set(e,r),e.dispatch({effects:st.of(r)}),setTimeout(()=>{e.dom&&document.contains(e.dom)&&e.dispatch({})},10)}function J(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var o=r[n];typeof o=="string"?e.setAttribute(n,o):o!=null&&(e[n]=o)}t++}for(;t<arguments.length;t++)rn(e,arguments[t]);return e}function rn(e,t){if(typeof t=="string")e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var r=0;r<t.length;r++)rn(e,t[r]);else throw new RangeError("Unsupported child node: "+t)}const Pr=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class De{constructor(t,r,n=0,o=t.length,i,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,o),this.bufferStart=n,this.normalize=i?c=>i(Pr(c)):Pr,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return R.codePointAt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=R.fromCodePoint(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=R.codePointSize(t);let o=this.normalize(r);if(o.length)for(let i=0,s=n;;i++){let c=o.charCodeAt(i),l=this.match(c,s,this.bufferPos+this.bufferStart);if(i==o.length-1){if(l)return this.value=l,this;break}s==n&&i<r.length&&r.charCodeAt(i)==c&&s++}}}match(t,r,n){let o=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],c=!1;this.query.charCodeAt(s)==t&&(s==this.query.length-1?o={from:this.matches[i+1],to:n}:(this.matches[i]++,c=!0)),c||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:r,to:n}:this.matches.push(1,r)),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(De.prototype[Symbol.iterator]=function(){return this});const nn={from:-1,to:-1,match:/.*/.exec("")},Kt="gm"+(/x/.unicode==null?"":"u");class on{constructor(t,r,n,o=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=nn,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new an(t,r,n,o,i);this.re=new RegExp(r,Kt+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=t.iter();let s=t.lineAt(o);this.curLineStart=s.from,this.matchPos=ct(t,o),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,o=n+r[0].length;if(this.matchPos=ct(this.text,o+(n==o?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<o||n>this.value.to)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const _t=new WeakMap;class Fe{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let o=_t.get(t);if(!o||o.from>=n||o.to<=r){let c=new Fe(r,t.sliceString(r,n));return _t.set(t,c),c}if(o.from==r&&o.to==n)return o;let{text:i,from:s}=o;return s>r&&(i=t.sliceString(r,s)+i,s=r),o.to<n&&(i+=t.sliceString(o.to,n)),_t.set(t,new Fe(s,i)),new Fe(r,i.slice(r-s,n-s))}}class an{constructor(t,r,n,o,i){this.text=t,this.to=i,this.done=!1,this.value=nn,this.matchPos=ct(t,o),this.re=new RegExp(r,Kt+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=Fe.get(t,o,this.chunkEnd(o+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,o=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this.matchPos=ct(this.text,o+(n==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Fe.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(on.prototype[Symbol.iterator]=an.prototype[Symbol.iterator]=function(){return this});function Uo(e){try{return new RegExp(e,Kt),!0}catch{return!1}}function ct(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}function It(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),r=J("input",{class:"cm-textfield",name:"line",value:t}),n=J("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),e.dispatch({effects:Be.of(!1)}),e.focus()):i.keyCode==13&&(i.preventDefault(),o())},onsubmit:i=>{i.preventDefault(),o()}},J("label",e.state.phrase("Go to line"),": ",r)," ",J("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),J("button",{name:"close",onclick:()=>{e.dispatch({effects:Be.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function o(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!i)return;let{state:s}=e,c=s.doc.lineAt(s.selection.main.head),[,l,d,f,m]=i,P=f?+f.slice(1):0,E=d?+d:c.number;if(d&&m){let y=E/100;l&&(y=y*(l=="-"?-1:1)+c.number/s.doc.lines),E=Math.round(s.doc.lines*y)}else d&&l&&(E=E*(l=="-"?-1:1)+c.number);let w=s.doc.line(Math.max(1,Math.min(s.doc.lines,E))),v=R.EditorSelection.cursor(w.from+Math.max(0,Math.min(P,w.length)));e.dispatch({effects:[Be.of(!1),x.EditorView.scrollIntoView(v.from,{y:"center"})],selection:v}),e.focus()}return{dom:n}}const Be=R.StateEffect.define(),Mr=R.StateField.define({create(){return!0},update(e,t){for(let r of t.effects)r.is(Be)&&(e=r.value);return e},provide:e=>x.showPanel.from(e,t=>t?It:null)}),Bo=e=>{let t=x.getPanel(e,It);if(!t){let r=[Be.of(!0)];e.state.field(Mr,!1)==null&&r.push(R.StateEffect.appendConfig.of([Mr,Ho])),e.dispatch({effects:r}),t=x.getPanel(e,It)}return t&&t.dom.querySelector("input").select(),!0},Ho=x.EditorView.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Ko={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},sn=R.Facet.define({combine(e){return R.combineConfig(e,Ko,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function yt(e){let t=[Zo,Xo];return e&&t.push(sn.of(e)),t}const Go=x.Decoration.mark({class:"cm-selectionMatch"}),Jo=x.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Or(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=R.CharCategory.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=R.CharCategory.Word)}function Qo(e,t,r,n){return e(t.sliceDoc(r,r+1))==R.CharCategory.Word&&e(t.sliceDoc(n-1,n))==R.CharCategory.Word}const Xo=x.ViewPlugin.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(sn),{state:r}=e,n=r.selection;if(n.ranges.length>1)return x.Decoration.none;let o=n.main,i,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return x.Decoration.none;let l=r.wordAt(o.head);if(!l)return x.Decoration.none;s=r.charCategorizer(o.head),i=r.sliceDoc(l.from,l.to)}else{let l=o.to-o.from;if(l<t.minSelectionLength||l>200)return x.Decoration.none;if(t.wholeWords){if(i=r.sliceDoc(o.from,o.to),s=r.charCategorizer(o.head),!(Or(s,r,o.from,o.to)&&Qo(s,r,o.from,o.to)))return x.Decoration.none}else if(i=r.sliceDoc(o.from,o.to),!i)return x.Decoration.none}let c=[];for(let l of e.visibleRanges){let d=new De(r.doc,i,l.from,l.to);for(;!d.next().done;){let{from:f,to:m}=d.value;if((!s||Or(s,r,f,m))&&(o.empty&&f<=o.from&&m>=o.to?c.push(Jo.range(f,m)):(f>=o.to||m<=o.from)&&c.push(Go.range(f,m)),c.length>t.maxMatches))return x.Decoration.none}}return x.Decoration.set(c)}},{decorations:e=>e.decorations}),Zo=x.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ei=({state:e,dispatch:t})=>{let{selection:r}=e,n=R.EditorSelection.create(r.ranges.map(o=>e.wordAt(o.head)||R.EditorSelection.cursor(o.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function ti(e,t){let{main:r,ranges:n}=e.selection,o=e.wordAt(r.head),i=o&&o.from==r.from&&o.to==r.to;for(let s=!1,c=new De(e.doc,t,n[n.length-1].to);;)if(c.next(),c.done){if(s)return null;c=new De(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==c.value.from))continue;if(i){let l=e.wordAt(c.value.from);if(!l||l.from!=c.value.from||l.to!=c.value.to)continue}return c.value}}const ri=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(i=>i.from===i.to))return ei({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=n))return!1;let o=ti(e,n);return o?(t(e.update({selection:e.selection.addRange(R.EditorSelection.range(o.from,o.to),!1),effects:x.EditorView.scrollIntoView(o.to)})),!0):!1},Se=R.Facet.define({combine(e){return R.combineConfig(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new di(t),scrollToMatch:t=>x.EditorView.scrollIntoView(t)})}});function Gt(e){return e?[Se.of(e),Wt]:Wt}class cn{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||Uo(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
48
|
-
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new ai(this):new oi(this)}getCursor(t,r=0,n){let o=t.doc?t:R.EditorState.create({doc:t});return n==null&&(n=o.doc.length),this.regexp?Oe(this,o,r,n):Me(this,o,r,n)}}class ln{constructor(t){this.spec=t}}function Me(e,t,r,n){return new De(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:o=>o.toLowerCase(),e.wholeWord?ni(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function ni(e,t){return(r,n,o,i)=>((i>r||i+o.length<n)&&(i=Math.max(0,r-2),o=e.sliceString(i,Math.min(e.length,n+2))),(t(lt(o,r-i))!=R.CharCategory.Word||t(ut(o,r-i))!=R.CharCategory.Word)&&(t(ut(o,n-i))!=R.CharCategory.Word||t(lt(o,n-i))!=R.CharCategory.Word))}class oi extends ln{constructor(t){super(t)}nextMatch(t,r,n){let o=Me(this.spec,t,n,t.doc.length).nextOverlapping();if(o.done){let i=Math.min(t.doc.length,r+this.spec.unquoted.length);o=Me(this.spec,t,0,i).nextOverlapping()}return o.done||o.value.from==r&&o.value.to==n?null:o.value}prevMatchInRange(t,r,n){for(let o=n;;){let i=Math.max(r,o-1e4-this.spec.unquoted.length),s=Me(this.spec,t,i,o),c=null;for(;!s.nextOverlapping().done;)c=s.value;if(c)return c;if(i==r)return null;o-=1e4}}prevMatch(t,r,n){let o=this.prevMatchInRange(t,0,r);return o||(o=this.prevMatchInRange(t,Math.max(0,n-this.spec.unquoted.length),t.doc.length)),o&&(o.from!=r||o.to!=n)?o:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,r){let n=Me(this.spec,t,0,t.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(t,r,n,o){let i=Me(this.spec,t,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}function Oe(e,t,r,n){return new on(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?ii(t.charCategorizer(t.selection.main.head)):void 0},r,n)}function lt(e,t){return e.slice(R.findClusterBreak(e,t,!1),t)}function ut(e,t){return e.slice(t,R.findClusterBreak(e,t))}function ii(e){return(t,r,n)=>!n[0].length||(e(lt(n.input,n.index))!=R.CharCategory.Word||e(ut(n.input,n.index))!=R.CharCategory.Word)&&(e(ut(n.input,n.index+n[0].length))!=R.CharCategory.Word||e(lt(n.input,n.index+n[0].length))!=R.CharCategory.Word)}class ai extends ln{nextMatch(t,r,n){let o=Oe(this.spec,t,n,t.doc.length).next();return o.done&&(o=Oe(this.spec,t,0,r).next()),o.done?null:o.value}prevMatchInRange(t,r,n){for(let o=1;;o++){let i=Math.max(r,n-o*1e4),s=Oe(this.spec,t,i,n),c=null;for(;!s.next().done;)c=s.value;if(c&&(i==r||c.from>i+10))return c;if(i==r)return null}}prevMatch(t,r,n){return this.prevMatchInRange(t,0,r)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return t.match[0];if(n=="$")return"$";for(let o=n.length;o>0;o--){let i=+n.slice(0,o);if(i>0&&i<t.match.length)return t.match[i]+n.slice(o)}return r})}matchAll(t,r){let n=Oe(this.spec,t,0,t.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(t,r,n,o){let i=Oe(this.spec,t,Math.max(0,r-250),Math.min(n+250,t.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}const Je=R.StateEffect.define(),Jt=R.StateEffect.define(),ye=R.StateField.define({create(e){return new Pt($t(e).create(),null)},update(e,t){for(let r of t.effects)r.is(Je)?e=new Pt(r.value.create(),e.panel):r.is(Jt)&&(e=new Pt(e.query,r.value?Qt:null));return e},provide:e=>x.showPanel.from(e,t=>t.panel)});class Pt{constructor(t,r){this.query=t,this.panel=r}}const si=x.Decoration.mark({class:"cm-searchMatch"}),ci=x.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),li=x.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(ye))}update(e){let t=e.state.field(ye);(t!=e.startState.field(ye)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return x.Decoration.none;let{view:r}=this,n=new R.RangeSetBuilder;for(let o=0,i=r.visibleRanges,s=i.length;o<s;o++){let{from:c,to:l}=i[o];for(;o<s-1&&l>i[o+1].from-2*250;)l=i[++o].to;e.highlight(r.state,c,l,(d,f)=>{let m=r.state.selection.ranges.some(P=>P.from==d&&P.to==f);n.add(d,f,m?ci:si)})}return n.finish()}},{decorations:e=>e.decorations});function Xe(e){return t=>{let r=t.state.field(ye,!1);return r&&r.query.spec.valid?e(t,r):Xt(t)}}const ft=Xe((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let o=R.EditorSelection.single(n.from,n.to),i=e.state.facet(Se);return e.dispatch({selection:o,effects:[tr(e,n),i.scrollToMatch(o.main,e)],userEvent:"select.search"}),fn(e),!0}),ht=Xe((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,o=t.prevMatch(r,n,n);if(!o)return!1;let i=R.EditorSelection.single(o.from,o.to),s=e.state.facet(Se);return e.dispatch({selection:i,effects:[tr(e,o),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),fn(e),!0}),ui=Xe((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:R.EditorSelection.create(r.map(n=>R.EditorSelection.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),fi=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:o}=r.main,i=[],s=0;for(let c=new De(e.doc,e.sliceDoc(n,o));!c.next().done;){if(i.length>1e3)return!1;c.value.from==n&&(s=i.length),i.push(R.EditorSelection.range(c.value.from,c.value.to))}return t(e.update({selection:R.EditorSelection.create(i,s),userEvent:"select.search.matches"})),!0},Ar=Xe((e,{query:t})=>{let{state:r}=e,{from:n,to:o}=r.selection.main;if(r.readOnly)return!1;let i=t.nextMatch(r,n,n);if(!i)return!1;let s=i,c=[],l,d,f=[];s.from==n&&s.to==o&&(d=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:d}),s=t.nextMatch(r,s.from,s.to),f.push(x.EditorView.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let m=e.state.changes(c);return s&&(l=R.EditorSelection.single(s.from,s.to).map(m),f.push(tr(e,s)),f.push(r.facet(Se).scrollToMatch(l.main,e))),e.dispatch({changes:m,selection:l,effects:f,userEvent:"input.replace"}),!0}),hi=Xe((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(o=>{let{from:i,to:s}=o;return{from:i,to:s,insert:t.getReplacement(o)}});if(!r.length)return!1;let n=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:x.EditorView.announce.of(n),userEvent:"input.replace.all"}),!0});function Qt(e){return e.state.facet(Se).createPanel(e)}function $t(e,t){var r,n,o,i,s;let c=e.selection.main,l=c.empty||c.to>c.from+100?"":e.sliceDoc(c.from,c.to);if(t&&!l)return t;let d=e.facet(Se);return new cn({search:((r=t==null?void 0:t.literal)!==null&&r!==void 0?r:d.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=t==null?void 0:t.caseSensitive)!==null&&n!==void 0?n:d.caseSensitive,literal:(o=t==null?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(i=t==null?void 0:t.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(s=t==null?void 0:t.wholeWord)!==null&&s!==void 0?s:d.wholeWord})}function un(e){let t=x.getPanel(e,Qt);return t&&t.dom.querySelector("[main-field]")}function fn(e){let t=un(e);t&&t==e.root.activeElement&&t.select()}const Xt=e=>{let t=e.state.field(ye,!1);if(t&&t.panel){let r=un(e);if(r&&r!=e.root.activeElement){let n=$t(e.state,t.query.spec);n.valid&&e.dispatch({effects:Je.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[Jt.of(!0),t?Je.of($t(e.state,t.query.spec)):R.StateEffect.appendConfig.of(Wt)]});return!0},Zt=e=>{let t=e.state.field(ye,!1);if(!t||!t.panel)return!1;let r=x.getPanel(e,Qt);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Jt.of(!1)}),!0},er=[{key:"Mod-f",run:Xt,scope:"editor search-panel"},{key:"F3",run:ft,shift:ht,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ft,shift:ht,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:Zt,scope:"editor search-panel"},{key:"Mod-Shift-l",run:fi},{key:"Mod-Alt-g",run:Bo},{key:"Mod-d",run:ri,preventDefault:!0}];class di{constructor(t){this.view=t;let r=this.query=t.state.field(ye).query.spec;this.commit=this.commit.bind(this),this.searchField=J("input",{value:r.search,placeholder:ne(t,"Find"),"aria-label":ne(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=J("input",{value:r.replace,placeholder:ne(t,"Replace"),"aria-label":ne(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=J("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=J("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=J("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(o,i,s){return J("button",{class:"cm-button",name:o,onclick:i,type:"button"},s)}this.dom=J("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,n("next",()=>ft(t),[ne(t,"next")]),n("prev",()=>ht(t),[ne(t,"previous")]),n("select",()=>ui(t),[ne(t,"all")]),J("label",null,[this.caseField,ne(t,"match case")]),J("label",null,[this.reField,ne(t,"regexp")]),J("label",null,[this.wordField,ne(t,"by word")]),...t.state.readOnly?[]:[J("br"),this.replaceField,n("replace",()=>Ar(t),[ne(t,"replace")]),n("replaceAll",()=>hi(t),[ne(t,"replace all")])],J("button",{name:"close",onclick:()=>Zt(t),"aria-label":ne(t,"close"),type:"button"},["×"])])}commit(){let t=new cn({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Je.of(t)}))}keydown(t){x.runScopeHandlers(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ht:ft)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Ar(this.view))}update(t){for(let r of t.transactions)for(let n of r.effects)n.is(Je)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Se).top}}function ne(e,t){return e.state.phrase(t)}const tt=30,rt=/[\s\.,:;?!]/;function tr(e,{from:t,to:r}){let n=e.state.doc.lineAt(t),o=e.state.doc.lineAt(r).to,i=Math.max(n.from,t-tt),s=Math.min(o,r+tt),c=e.state.sliceDoc(i,s);if(i!=n.from){for(let l=0;l<tt;l++)if(!rt.test(c[l+1])&&rt.test(c[l])){c=c.slice(l);break}}if(s!=o){for(let l=c.length-1;l>c.length-tt;l--)if(!rt.test(c[l-1])&&rt.test(c[l])){c=c.slice(0,l);break}}return x.EditorView.announce.of(`${e.state.phrase("current match")}. ${c} ${e.state.phrase("on line")} ${n.number}.`)}const gi=x.EditorView.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Wt=[ye,R.Prec.low(li),gi],pi={Search:"搜索",Replace:"替换",Find:"查找","Replace all":"全部替换",Next:"下一个",Previous:"上一个",All:"全部",Close:"关闭",done:"完成","Match case":"区分大小写","Match whole word":"全字匹配","Use regular expression":"使用正则表达式","by word":"按单词",replace:"替换","Search for":"搜索内容","Replace with":"替换为","No matches":"无匹配结果","replaced $ matches":"已替换 $ 个匹配项","replaced match on line $":"已替换第 $ 行的匹配项","on line":"在第",line:"行","$ of $ matches":"第 $ 个,共 $ 个匹配","Invalid regular expression":"无效的正则表达式","Query too long":"查询内容过长","Search string too long":"搜索字符串过长"};function hn(){return x.EditorView.theme({".cm-panel.cm-search":{fontSize:"14px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},".cm-search label":{fontSize:"13px"},".cm-search input":{fontSize:"13px",fontFamily:"inherit"},".cm-search button":{fontSize:"12px",fontFamily:"inherit"}})}function dn(e){setTimeout(()=>{const t=e.dom.querySelector(".cm-panel.cm-search");if(!t)return;t.querySelectorAll("label").forEach(i=>{var c;switch((c=i.textContent)==null?void 0:c.trim()){case"Match case":i.textContent="区分大小写";break;case"Match whole word":i.textContent="全字匹配";break;case"Use regular expression":i.textContent="使用正则表达式";break}}),t.querySelectorAll("button").forEach(i=>{var c;switch((c=i.textContent)==null?void 0:c.trim()){case"Next":i.textContent="下一个";break;case"Previous":i.textContent="上一个";break;case"All":i.textContent="全部";break;case"Replace all":i.textContent="全部替换";break;case"Close":i.textContent="关闭";break;case"done":i.textContent="完成";break}}),t.querySelectorAll('input[type="text"]').forEach((i,s)=>{const c=i;s===0?c.placeholder="搜索内容":s===1&&(c.placeholder="替换为")})},100)}function jt(){return[hn(),Gt({top:!0}),yt(),x.keymap.of(er),x.EditorView.updateListener.of(e=>{e.view.dom.querySelector(".cm-panel.cm-search")&&dn(e.view)})]}function mi(){return[yt()]}function qt(){return[Gt({top:!0}),yt(),x.keymap.of(er)]}const yi=[{key:"Ctrl-f",mac:"Cmd-f",run:()=>!0},{key:"F3",run:()=>!0},{key:"Shift-F3",run:()=>!0}],vi=({value:e,onChange:t,extensions:r=[],height:n="300px",disabled:o=!1,readOnly:i=!1,className:s="",style:c={},placeholder:l="",showLineNumbers:d=!0,onEditorViewCreated:f,locale:m="zh-CN"},P)=>{const E=T.useRef(null),w=T.useRef();return T.useEffect(()=>{if(!E.current)return;const v=[ge.history(),x.keymap.of([...ge.historyKeymap,ge.indentWithTab,{key:"Enter",run:ge.insertNewlineAndIndent}]),x.EditorView.lineWrapping,se.syntaxHighlighting(se.defaultHighlightStyle),R.EditorState.allowMultipleSelections.of(!0),m==="zh-CN"?jt():qt(),l?x.placeholder(l):[],d?x.lineNumbers():[],x.EditorView.updateListener.of(g=>{if(g.docChanged&&t){const C={value:g.state.doc.toString(),readOnlyRanges:[]};t(C)}})];(o||i)&&v.push(R.EditorState.readOnly.of(!0));const y=R.EditorState.create({doc:e,extensions:[...v,...r]}),k=new x.EditorView({state:y,parent:E.current});return w.current=k,f&&f(k),()=>{var g;(g=w.current)==null||g.destroy()}},[]),T.useEffect(()=>{w.current&&e!==w.current.state.doc.toString()&&w.current.dispatch({changes:{from:0,to:w.current.state.doc.length,insert:e}})},[e]),T.useEffect(()=>{if(!w.current||!E.current)return;const v=w.current.state.doc.toString();w.current.destroy();const y=[ge.history(),x.keymap.of([...ge.historyKeymap,ge.indentWithTab,{key:"Enter",run:ge.insertNewlineAndIndent}]),x.EditorView.lineWrapping,se.syntaxHighlighting(se.defaultHighlightStyle),R.EditorState.allowMultipleSelections.of(!0),m==="zh-CN"?jt():qt(),l?x.placeholder(l):[],d?x.lineNumbers():[],x.EditorView.updateListener.of(C=>{if(C.docChanged&&t){const M={value:C.state.doc.toString(),readOnlyRanges:[]};t(M)}})];(o||i)&&y.push(R.EditorState.readOnly.of(!0));const k=R.EditorState.create({doc:v,extensions:[...y,...r]}),g=new x.EditorView({state:k,parent:E.current});w.current=g,f&&f(g)},[o,i,d]),T.useImperativeHandle(P,()=>({insertTextAtCursor:v=>{const y=w.current;y&&(y.dispatch(y.state.replaceSelection(v)),y.focus())},goToPosition:v=>{const y=w.current;if(y){const k=y.state.doc.length,g=Math.max(0,Math.min(v,k));y.dispatch({selection:{anchor:g,head:g},scrollIntoView:!0}),y.focus()}},goToLine:(v,y=0)=>{const k=w.current;if(k){const g=k.state.doc,C=Math.max(1,Math.min(v,g.lines)),M=g.line(C),h=Math.max(0,Math.min(y,M.length))+M.from;k.dispatch({selection:{anchor:h,head:h},scrollIntoView:!0}),k.focus()}},getEditorView:()=>w.current})),mt("div",{ref:E,className:`senyao-editor ${o?"disabled":""} ${i?"readonly":""} ${s}`,style:{height:n,...c}})},vt=T.forwardRef(vi),bi=({value:e,onChange:t,language:r="json",extensions:n=[],theme:o="light",showLineNumbers:i=!0,...s},c)=>{const l=T.useMemo(()=>{const d=Kr(r)?Hr(r):[],f=Xr(o);return[d,f,...n]},[r,n,o]);return mt(vt,{ref:c,value:e,onChange:t,extensions:l,showLineNumbers:i,...s})},xi=T.forwardRef(bi),Ei=({value:e,onChange:t,extensions:r=[],readOnlyRanges:n,manageReadOnlyRanges:o=!0,showLineNumbers:i=!0,...s},c)=>{const l=T.useRef(null),f=(b=>b!=null&&typeof b=="object"&&"value"in b)(e),m=f?e.value:e,P=(f&&"readOnlyRanges"in e?e.readOnlyRanges:n)??[],[E,w]=T.useState(m??""),v=T.useRef(null),[y,k]=T.useState(P),g=T.useRef(E),[C,M]=T.useState(null),h=T.useRef(!1),z=T.useRef(new Map),N=T.useRef(!1);T.useEffect(()=>{if(o&&P.length>0&&!C){const b=[];let O=0;for(let A=0;A<P.length;A++){const D=P[A];D.start>O&&b.push({content:E.substring(O,D.start),editable:!0}),b.push({content:E.substring(D.start,D.end),editable:!1}),O=D.end}O<E.length&&b.push({content:E.substring(O),editable:!0}),M(b)}},[o,P,E,C]),T.useEffect(()=>{if(E){const b=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],O=new Map;b.forEach(A=>{const D=E.indexOf(A);D>=0&&O.set(A,D)}),z.current=O}},[]);const Ie=T.useMemo(()=>{const b=[Fr.sql(),Vt.autocompletion()];return y.length>0&&b.push(en(y)),[...b,...r]},[r,y]),ve=T.useCallback((b,O,A=0)=>{const D=b.indexOf(O,A);return D>=0?D:null},[]),Ce=T.useCallback((b,O)=>{if(!o||!b||b.length===0)return b;const A=[...b];let D=0;for(let G=0;G<b.length;G++){const ie=b[G];if(!ie.editable){const de=ve(O,ie.content,D);de!==null&&(G>0&&b[G-1].editable&&de>D&&(A[G-1]={...A[G-1],content:O.substring(D,de)}),D=de+ie.content.length)}}const U=b[b.length-1];return U.editable&&D<O.length&&(A[b.length-1]={...U,content:O.substring(D)}),A},[o,ve]),Re=T.useCallback(b=>{let O=!1;return z.current.forEach((A,D)=>{const U=b.indexOf(D);U>=0&&Math.abs(U-A)>0&&(z.current.set(D,U),U>A&&(A===0||A<15)&&(O=!0))}),O},[]),be=T.useCallback(()=>{if(!v.current)return;const b=v.current,O=b.state.doc.toString(),A=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],D=b.state.selection;let U=!1;for(const G of A){const ie=O.indexOf(G);if(ie>=0){b.dispatch({selection:{anchor:ie,head:ie+G.length},scrollIntoView:!1}),U=!0;break}}U&&setTimeout(()=>{b.dom&&document.contains(b.dom)&&b.dispatch({selection:D,scrollIntoView:!1})},10)},[]),ee=T.useCallback(()=>{if(!v.current)return;const b=v.current;y.length>0&&(pe(b,[]),setTimeout(()=>{b.dom&&document.contains(b.dom)&&(pe(b,y),setTimeout(()=>{b.dom&&document.contains(b.dom)&&b.dispatch({})},10))},10))},[y]),ce=T.useCallback(b=>{const O=b.value,A=g.current;w(O),A!==O&&(!A||O.length>(A==null?void 0:A.length)&&!A.startsWith(O.substring(0,5))&&O.includes(A.substring(0,10)))&&(h.current=!0,Re(O)&&setTimeout(()=>{be()},10)),g.current=O;const D=v.current?tn(v.current):y;if(o&&C){const U=Ce(C,O);M(U);const{readOnlyRanges:G}=Nt(U);k(G),v.current&&pe(v.current,G),t&&t({value:O,readOnlyRanges:G})}else t&&t({value:O,readOnlyRanges:D})},[t,o,C,y,Ce,Re,be]);T.useEffect(()=>{!o&&JSON.stringify(P)!==JSON.stringify(y)&&(k(P),v.current&&pe(v.current,P))},[P,y,o]),T.useEffect(()=>{if(o&&C){const{readOnlyRanges:b}=Nt(C);JSON.stringify(b)!==JSON.stringify(y)&&(k(b),v.current&&pe(v.current,b))}},[C,y,o]),T.useEffect(()=>{v.current&&h.current&&(h.current=!1,v.current.dispatch({}))},[E]),T.useEffect(()=>{v.current&&y.length>0&&!N.current&&(N.current=!0,setTimeout(()=>{ee()},50),setTimeout(()=>{ee()},200))},[ee,y]);const he=T.useCallback(b=>{if(v.current=b,y.length>0&&(pe(b,y),setTimeout(()=>{pe(b,[]),setTimeout(()=>{pe(b,y)},10)},50)),E){const O=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],A=new Map;O.forEach(D=>{const U=E.indexOf(D);U>=0&&A.set(D,U)}),z.current=A}},[y,E]);return mt(vt,{ref:l,value:E,onChange:ce,extensions:Ie,showLineNumbers:i,onEditorViewCreated:he,...s})},Si=T.forwardRef(Ei),Ci=(e,t)=>{const{value:r,onChange:n,extensions:o=[],showLineNumbers:i=!0,enableFormatting:s=!1,enableCodeFolding:c=!0,...l}=e,d=T.useRef(!0),f=T.useRef(null),m=T.useCallback(g=>{try{return g===""||JSON.parse(g),!0}catch{return!1}},[]),P=T.useCallback(g=>{try{if(!g.trim())return"";const C=JSON.parse(g);return JSON.stringify(C,null,2)}catch{return g}},[]),E=T.useCallback(()=>{if(!f.current)return!1;const g=f.current,C=g.state.doc.toString(),M=P(C);if(M===C)return!1;const h=g.state.update({changes:{from:0,to:g.state.doc.length,insert:M}});return g.dispatch(h),!0},[P]),w=T.useMemo(()=>x.keymap.of([{key:"Alt-f",mac:"Mod-Alt-f",run:()=>E()}]),[E]),v=T.useCallback(g=>{if(n){const C=m(g.value);d.current=C,n(g)}},[n,m]),y=T.useMemo(()=>{const g=[Lr.json(),se.bracketMatching(),Vt.closeBrackets(),R.Prec.highest(w),...o];return c&&g.push(se.codeFolding(),se.foldGutter({markerDOM:C=>{const M=document.createElement("span");return M.style.cssText=`
|
|
44
|
+
*/var wr;function xo(){return wr||(wr=1,process.env.NODE_ENV!=="production"&&function(){var e=typeof Symbol=="function"&&Symbol.for,t=e?Symbol.for("react.element"):60103,r=e?Symbol.for("react.portal"):60106,n=e?Symbol.for("react.fragment"):60107,o=e?Symbol.for("react.strict_mode"):60108,i=e?Symbol.for("react.profiler"):60114,s=e?Symbol.for("react.provider"):60109,c=e?Symbol.for("react.context"):60110,l=e?Symbol.for("react.async_mode"):60111,d=e?Symbol.for("react.concurrent_mode"):60111,f=e?Symbol.for("react.forward_ref"):60112,p=e?Symbol.for("react.suspense"):60113,O=e?Symbol.for("react.suspense_list"):60120,b=e?Symbol.for("react.memo"):60115,R=e?Symbol.for("react.lazy"):60116,v=e?Symbol.for("react.block"):60121,m=e?Symbol.for("react.fundamental"):60117,w=e?Symbol.for("react.responder"):60118,E=e?Symbol.for("react.scope"):60119;function T(S){return typeof S=="string"||typeof S=="function"||S===n||S===d||S===i||S===o||S===p||S===O||typeof S=="object"&&S!==null&&(S.$$typeof===R||S.$$typeof===b||S.$$typeof===s||S.$$typeof===c||S.$$typeof===f||S.$$typeof===m||S.$$typeof===w||S.$$typeof===E||S.$$typeof===v)}function L(S){if(typeof S=="object"&&S!==null){var Ve=S.$$typeof;switch(Ve){case t:var _e=S.type;switch(_e){case l:case d:case n:case i:case o:case p:return _e;default:var Ee=_e&&_e.$$typeof;switch(Ee){case c:case f:case R:case b:case s:return Ee;default:return Ve}}case r:return Ve}}}var h=l,_=d,M=c,ue=s,G=t,Re=f,we=n,xe=R,te=b,le=r,ge=i,x=o,A=p,F=!1;function $(S){return F||(F=!0,console.warn("The ReactIs.isAsyncMode() alias has been deprecated, and will be removed in React 17+. Update your code to use ReactIs.isConcurrentMode() instead. It has the exact same API.")),H(S)||L(S)===l}function H(S){return L(S)===d}function U(S){return L(S)===c}function se(S){return L(S)===s}function pe(S){return typeof S=="object"&&S!==null&&S.$$typeof===t}function bt(S){return L(S)===f}function xt(S){return L(S)===n}function Ie(S){return L(S)===R}function We(S){return L(S)===b}function ke(S){return L(S)===r}function je(S){return L(S)===i}function Te(S){return L(S)===o}function Et(S){return L(S)===p}q.AsyncMode=h,q.ConcurrentMode=_,q.ContextConsumer=M,q.ContextProvider=ue,q.Element=G,q.ForwardRef=Re,q.Fragment=we,q.Lazy=xe,q.Memo=te,q.Portal=le,q.Profiler=ge,q.StrictMode=x,q.Suspense=A,q.isAsyncMode=$,q.isConcurrentMode=H,q.isContextConsumer=U,q.isContextProvider=se,q.isElement=pe,q.isForwardRef=bt,q.isFragment=xt,q.isLazy=Ie,q.isMemo=We,q.isPortal=ke,q.isProfiler=je,q.isStrictMode=Te,q.isSuspense=Et,q.isValidElementType=T,q.typeOf=L}()),q}process.env.NODE_ENV==="production"?Ft.exports=bo():Ft.exports=xo();var Eo=Ft.exports,zr=Eo,So={$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},Co={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},Hr={};Hr[zr.ForwardRef]=So;Hr[zr.Memo]=Co;var Ro=!0;function wo(e,t,r){var n="";return r.split(" ").forEach(function(o){e[o]!==void 0?t.push(e[o]+";"):o&&(n+=o+" ")}),n}var Br=function(t,r,n){var o=t.key+"-"+r.name;(n===!1||Ro===!1)&&t.registered[o]===void 0&&(t.registered[o]=r.styles)},ko=function(t,r,n){Br(t,r,n);var o=t.key+"-"+r.name;if(t.inserted[r.name]===void 0){var i=r;do t.insert(r===i?"."+o:"",i,t.sheet,!0),i=i.next;while(i!==void 0)}};function To(e){for(var t=0,r,n=0,o=e.length;o>=4;++n,o-=4)r=e.charCodeAt(n)&255|(e.charCodeAt(++n)&255)<<8|(e.charCodeAt(++n)&255)<<16|(e.charCodeAt(++n)&255)<<24,r=(r&65535)*1540483477+((r>>>16)*59797<<16),r^=r>>>24,t=(r&65535)*1540483477+((r>>>16)*59797<<16)^(t&65535)*1540483477+((t>>>16)*59797<<16);switch(o){case 3:t^=(e.charCodeAt(n+2)&255)<<16;case 2:t^=(e.charCodeAt(n+1)&255)<<8;case 1:t^=e.charCodeAt(n)&255,t=(t&65535)*1540483477+((t>>>16)*59797<<16)}return t^=t>>>13,t=(t&65535)*1540483477+((t>>>16)*59797<<16),((t^t>>>15)>>>0).toString(36)}var _o={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,boxFlex:1,boxFlexGroup:1,boxOrdinalGroup:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexPositive:1,flexShrink:1,flexNegative:1,flexOrder:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,msGridRow:1,msGridRowSpan:1,msGridColumn:1,msGridColumnSpan:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1},Po=/[A-Z]|^ms/g,Oo=/_EMO_([^_]+?)_([^]*?)_EMO_/g,Jr=function(t){return t.charCodeAt(1)===45},kr=function(t){return t!=null&&typeof t!="boolean"},Tt=lo(function(e){return Jr(e)?e:e.replace(Po,"-$&").toLowerCase()}),Tr=function(t,r){switch(t){case"animation":case"animationName":if(typeof r=="string")return r.replace(Oo,function(n,o,i){return he={name:o,styles:i,next:he},o})}return _o[t]!==1&&!Jr(t)&&typeof r=="number"&&r!==0?r+"px":r};function Ue(e,t,r){if(r==null)return"";var n=r;if(n.__emotion_styles!==void 0)return n;switch(typeof r){case"boolean":return"";case"object":{var o=r;if(o.anim===1)return he={name:o.name,styles:o.styles,next:he},o.name;var i=r;if(i.styles!==void 0){var s=i.next;if(s!==void 0)for(;s!==void 0;)he={name:s.name,styles:s.styles,next:he},s=s.next;var c=i.styles+";";return c}return Mo(e,t,r)}case"function":{if(e!==void 0){var l=he,d=r(e);return he=l,Ue(e,t,d)}break}}var f=r;return f}function Mo(e,t,r){var n="";if(Array.isArray(r))for(var o=0;o<r.length;o++)n+=Ue(e,t,r[o])+";";else for(var i in r){var s=r[i];if(typeof s!="object"){var c=s;kr(c)&&(n+=Tt(i)+":"+Tr(i,c)+";")}else if(Array.isArray(s)&&typeof s[0]=="string"&&t==null)for(var l=0;l<s.length;l++)kr(s[l])&&(n+=Tt(i)+":"+Tr(i,s[l])+";");else{var d=Ue(e,t,s);switch(i){case"animation":case"animationName":{n+=Tt(i)+":"+d+";";break}default:n+=i+"{"+d+"}"}}}return n}var _r=/label:\s*([^\s;{]+)\s*(;|$)/g,he;function Ao(e,t,r){if(e.length===1&&typeof e[0]=="object"&&e[0]!==null&&e[0].styles!==void 0)return e[0];var n=!0,o="";he=void 0;var i=e[0];if(i==null||i.raw===void 0)n=!1,o+=Ue(r,t,i);else{var s=i;o+=s[0]}for(var c=1;c<e.length;c++)if(o+=Ue(r,t,e[c]),n){var l=i;o+=l[c]}_r.lastIndex=0;for(var d="",f;(f=_r.exec(o))!==null;)d+="-"+f[1];var p=To(o)+d;return{name:p,styles:o,next:he}}var Fo=function(t){return t()},No=ve.useInsertionEffect?ve.useInsertionEffect:!1,Do=No||Fo,Kr=ve.createContext(typeof HTMLElement<"u"?vo({key:"css"}):null);Kr.Provider;var Lo=function(t){return k.forwardRef(function(r,n){var o=k.useContext(Kr);return t(r,o,n)})},$o=ve.createContext({}),Jt={}.hasOwnProperty,Nt="__EMOTION_TYPE_PLEASE_DO_NOT_USE__",Io=function(t,r){var n={};for(var o in r)Jt.call(r,o)&&(n[o]=r[o]);return n[Nt]=t,n},Wo=function(t){var r=t.cache,n=t.serialized,o=t.isStringTag;return Br(r,n,o),Do(function(){return ko(r,n,o)}),null},jo=Lo(function(e,t,r){var n=e.css;typeof n=="string"&&t.registered[n]!==void 0&&(n=t.registered[n]);var o=e[Nt],i=[n],s="";typeof e.className=="string"?s=wo(t.registered,i,e.className):e.className!=null&&(s=e.className+" ");var c=Ao(i,void 0,ve.useContext($o));s+=t.key+"-"+c.name;var l={};for(var d in e)Jt.call(e,d)&&d!=="css"&&d!==Nt&&(l[d]=e[d]);return l.className=s,r&&(l.ref=r),ve.createElement(ve.Fragment,null,ve.createElement(Wo,{cache:t,serialized:c,isStringTag:typeof o=="string"}),ve.createElement(o,l))}),Vo=jo,mt=function(t,r,n){return Jt.call(r,"css")?xr.jsx(Vo,Io(t,r),n):xr.jsx(t,r,n)};function Ur(e){switch(e.toLowerCase()){case"sql":return Lr.sql();case"json":return qt.json();default:return[]}}function Gr(e){return["sql","json"].includes(e.toLowerCase())}function Qr(e={}){return Yt.autocompletion(e)}function qo(e){return[yr.lintGutter(),yr.linter(e)]}function Xr(){return y.keymap.of([me.indentWithTab])}const Yo=[Xr(),Qr()],zo=ne.HighlightStyle.define([{tag:Y.tags.keyword,color:"#1a1aa6",fontWeight:"bold"},{tag:Y.tags.comment,color:"#008000",fontStyle:"italic"},{tag:Y.tags.string,color:"#a31515"},{tag:Y.tags.number,color:"#098658"},{tag:Y.tags.operator,color:"#777777"},{tag:Y.tags.propertyName,color:"#0451a5"},{tag:Y.tags.variableName,color:"#001080"},{tag:Y.tags.definition(Y.tags.variableName),color:"#1a1aa6"},{tag:Y.tags.typeName,color:"#267f99"},{tag:Y.tags.className,color:"#267f99"},{tag:Y.tags.meta,color:"#5c5c5c"},{tag:Y.tags.regexp,color:"#811f3f"},{tag:Y.tags.link,color:"#0563c1",textDecoration:"underline"}]),Dt=[y.EditorView.theme({"&":{backgroundColor:"#ffffff",color:"#333333",fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:'"Menlo", "Monaco", "Courier New", monospace',overflow:"auto"},".cm-content":{padding:"8px 0",caretColor:"#333",textAlign:"left"},".cm-gutters":{backgroundColor:"#f8f9fa",color:"#6e7781",borderRight:"1px solid #ddd"},".cm-lineNumbers":{minWidth:"40px"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",textAlign:"right",fontSize:"12px"},".cm-activeLine":{backgroundColor:"rgba(0, 0, 0, 0.04)"},".cm-activeLineGutter":{backgroundColor:"rgba(0, 0, 0, 0.04)"},".cm-selectionMatch":{backgroundColor:"rgba(181, 213, 255, 0.3)"},"&.cm-focused .cm-cursor":{borderLeftColor:"#333333"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(181, 213, 255, 0.5)"}}),ne.syntaxHighlighting(zo)],Ho=ne.HighlightStyle.define([{tag:Y.tags.keyword,color:"#569cd6",fontWeight:"bold"},{tag:Y.tags.comment,color:"#6A9955",fontStyle:"italic"},{tag:Y.tags.string,color:"#ce9178"},{tag:Y.tags.number,color:"#b5cea8"},{tag:Y.tags.operator,color:"#d4d4d4"},{tag:Y.tags.propertyName,color:"#9cdcfe"},{tag:Y.tags.variableName,color:"#9cdcfe"},{tag:Y.tags.definition(Y.tags.variableName),color:"#4fc1ff"},{tag:Y.tags.typeName,color:"#4ec9b0"},{tag:Y.tags.className,color:"#4ec9b0"},{tag:Y.tags.meta,color:"#d4d4d4"},{tag:Y.tags.regexp,color:"#d16969"},{tag:Y.tags.link,color:"#4e94ce",textDecoration:"underline"}]),Zr=[y.EditorView.theme({"&":{backgroundColor:"#1e1e1e",color:"#d4d4d4",fontSize:"14px",height:"100%"},".cm-scroller":{fontFamily:'"Menlo", "Monaco", "Courier New", monospace',overflow:"auto"},".cm-content":{padding:"8px 0",caretColor:"#d4d4d4",textAlign:"left"},".cm-gutters":{backgroundColor:"#252526",color:"#858585",borderRight:"1px solid #404040"},".cm-lineNumbers":{minWidth:"40px"},".cm-lineNumbers .cm-gutterElement":{padding:"0 8px 0 4px",textAlign:"right",fontSize:"12px"},".cm-activeLine":{backgroundColor:"rgba(255, 255, 255, 0.07)"},".cm-activeLineGutter":{backgroundColor:"rgba(255, 255, 255, 0.07)"},".cm-selectionMatch":{backgroundColor:"rgba(255, 255, 255, 0.1)"},"&.cm-focused .cm-cursor":{borderLeftColor:"#d4d4d4"},"&.cm-focused .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:"rgba(255, 255, 255, 0.1)"}}),ne.syntaxHighlighting(Ho)];function en(e){switch(e){case"light":return Dt;case"dark":return Zr;default:return Dt}}const Lt=e=>{const t={value:"",readOnlyRanges:[]};let r=0;return e.forEach(n=>{const{content:o,editable:i}=n,s=o.replace(/\r\n/g,`
|
|
45
|
+
`),c=r,l=c+s.length;t.value+=o,i||t.readOnlyRanges.push({start:c,end:l}),r=l}),t},Bo='{"name":"Alice","age":25,"profile":{"city":"NY"}}';function Jo(e,t){const r=[],n=C.EditorState.create({doc:Bo,extensions:[qt.json()]});return ne.syntaxTree(n).iterate({enter:i=>{const s=n.doc.sliceString(i.from,i.to);console.log(`999,${i.type.name} [${i.from}-${i.to}]: ${s} }`),i.type.name==="Property"&&console.log(n.doc.sliceString(i.node.firstChild.from,i.node.firstChild.to),n.doc.sliceString(i.node.lastChild.from,i.node.lastChild.to),3333)}}),r}const st=C.StateEffect.define(),Pr=C.StateField.define({create(){return y.Decoration.none},update(e,t){e=e.map(t.changes);for(const r of t.effects)if(r.is(st))return tn(r.value);return t.docChanged,e},provide(e){return y.EditorView.decorations.from(e)}});function tn(e){const t=[];return console.log(e,9999299),e.forEach(r=>{r.start<r.end&&t.push(y.Decoration.mark({inclusive:!0,attributes:{class:"cm-readOnly",style:"background-color: rgba(0, 0, 0, 0.05);"},priority:-100}).range(r.start,r.end))}),y.Decoration.set(t)}const Kt=new WeakMap;function rn(e){let t=e.map(r=>({...r}));return[Pr.init(()=>tn(t)),y.keymap.of([{key:"Enter",run:r=>{const n=r.state.selection.main,{from:o,to:i}=n;if(o!==i){for(const c of t)if(o<c.end&&i>c.start)return!1}let s=!1;for(const c of t)if(o>c.start&&o<c.end){s=!0;break}return s?!1:(r.dispatch({changes:{from:o,to:i,insert:`
|
|
46
|
+
`},selection:{anchor:o+1}}),!0)}}]),C.EditorState.transactionFilter.of(r=>{if(!r.docChanged||r.isUserEvent("input.type.Enter")||r.isUserEvent("input.enter"))return r;let n=!1;return r.changes.iterChanges((o,i,s,c)=>{if(!(r.newDoc.sliceString(s,c)===`
|
|
47
|
+
`&&o===i)){for(const f of t)if(o===i){if(o>f.start&&o<f.end){n=!0;break}}else if(o<f.end&&i>f.start||o===f.start&&i>o||i===f.end&&o<i){n=!0;break}}}),n?[]:r}),y.EditorView.updateListener.of(r=>{if(r.docChanged){const n=Uo(t,r);!Ko(t,n)?(t=n,Kt.set(r.view,n),r.view.dispatch({effects:st.of(n)})):r.view.dispatch({effects:st.of(n)})}}),y.EditorView.updateListener.of(r=>{r.docChanged&&setTimeout(()=>{r.view.state.field(Pr,!1)&&r.view.dispatch({})},10)})]}function Ko(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r].start!==t[r].start||e[r].end!==t[r].end)return!1;return!0}function Uo(e,t){var o;if(!t.docChanged)return e;let r=!1;const n=e.map(i=>{const s={...i};return t.changes.iterChanges((c,l,d,f)=>{const p=f-d,O=l-c,b=p-O;if(c===0&&(r=!0),c===0&&p>0&&i.start===0){s.start=p,s.end+=b;return}if(l<=i.start)s.start+=b,s.end+=b;else if(c>=i.start&&c<i.end&&l>=i.end)s.end=c;else if(!(c>=i.start&&l<=i.end)){if(c<i.end&&l>i.end){const R=i.end-c;s.end=c+Math.min(R,p)}}}),s});if(r&&n.length>0){const i=((o=t.changes.newDoc)==null?void 0:o.toString())||"";let s=0;for(let c=0;c<i.length&&/\s/.test(i[c]);c++)s++;n[0].start===0&&s>0&&(n[0].start=s)}return n.filter(i=>i.start<i.end)}function nn(e){return Kt.get(e)||[]}function ye(e,t){const r=t.map(n=>({...n}));Kt.set(e,r),e.dispatch({effects:st.of(r)}),setTimeout(()=>{e.dom&&document.contains(e.dom)&&e.dispatch({})},10)}function Q(){var e=arguments[0];typeof e=="string"&&(e=document.createElement(e));var t=1,r=arguments[1];if(r&&typeof r=="object"&&r.nodeType==null&&!Array.isArray(r)){for(var n in r)if(Object.prototype.hasOwnProperty.call(r,n)){var o=r[n];typeof o=="string"?e.setAttribute(n,o):o!=null&&(e[n]=o)}t++}for(;t<arguments.length;t++)on(e,arguments[t]);return e}function on(e,t){if(typeof t=="string")e.appendChild(document.createTextNode(t));else if(t!=null)if(t.nodeType!=null)e.appendChild(t);else if(Array.isArray(t))for(var r=0;r<t.length;r++)on(e,t[r]);else throw new RangeError("Unsupported child node: "+t)}const Or=typeof String.prototype.normalize=="function"?e=>e.normalize("NFKD"):e=>e;class Le{constructor(t,r,n=0,o=t.length,i,s){this.test=s,this.value={from:0,to:0},this.done=!1,this.matches=[],this.buffer="",this.bufferPos=0,this.iter=t.iterRange(n,o),this.bufferStart=n,this.normalize=i?c=>i(Or(c)):Or,this.query=this.normalize(r)}peek(){if(this.bufferPos==this.buffer.length){if(this.bufferStart+=this.buffer.length,this.iter.next(),this.iter.done)return-1;this.bufferPos=0,this.buffer=this.iter.value}return C.codePointAt(this.buffer,this.bufferPos)}next(){for(;this.matches.length;)this.matches.pop();return this.nextOverlapping()}nextOverlapping(){for(;;){let t=this.peek();if(t<0)return this.done=!0,this;let r=C.fromCodePoint(t),n=this.bufferStart+this.bufferPos;this.bufferPos+=C.codePointSize(t);let o=this.normalize(r);if(o.length)for(let i=0,s=n;;i++){let c=o.charCodeAt(i),l=this.match(c,s,this.bufferPos+this.bufferStart);if(i==o.length-1){if(l)return this.value=l,this;break}s==n&&i<r.length&&r.charCodeAt(i)==c&&s++}}}match(t,r,n){let o=null;for(let i=0;i<this.matches.length;i+=2){let s=this.matches[i],c=!1;this.query.charCodeAt(s)==t&&(s==this.query.length-1?o={from:this.matches[i+1],to:n}:(this.matches[i]++,c=!0)),c||(this.matches.splice(i,2),i-=2)}return this.query.charCodeAt(0)==t&&(this.query.length==1?o={from:r,to:n}:this.matches.push(1,r)),o&&this.test&&!this.test(o.from,o.to,this.buffer,this.bufferStart)&&(o=null),o}}typeof Symbol<"u"&&(Le.prototype[Symbol.iterator]=function(){return this});const an={from:-1,to:-1,match:/.*/.exec("")},Ut="gm"+(/x/.unicode==null?"":"u");class sn{constructor(t,r,n,o=0,i=t.length){if(this.text=t,this.to=i,this.curLine="",this.done=!1,this.value=an,/\\[sWDnr]|\n|\r|\[\^/.test(r))return new cn(t,r,n,o,i);this.re=new RegExp(r,Ut+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.iter=t.iter();let s=t.lineAt(o);this.curLineStart=s.from,this.matchPos=ct(t,o),this.getLine(this.curLineStart)}getLine(t){this.iter.next(t),this.iter.lineBreak?this.curLine="":(this.curLine=this.iter.value,this.curLineStart+this.curLine.length>this.to&&(this.curLine=this.curLine.slice(0,this.to-this.curLineStart)),this.iter.next())}nextLine(){this.curLineStart=this.curLineStart+this.curLine.length+1,this.curLineStart>this.to?this.curLine="":this.getLine(0)}next(){for(let t=this.matchPos-this.curLineStart;;){this.re.lastIndex=t;let r=this.matchPos<=this.to&&this.re.exec(this.curLine);if(r){let n=this.curLineStart+r.index,o=n+r[0].length;if(this.matchPos=ct(this.text,o+(n==o?1:0)),n==this.curLineStart+this.curLine.length&&this.nextLine(),(n<o||n>this.value.to)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this;t=this.matchPos-this.curLineStart}else if(this.curLineStart+this.curLine.length<this.to)this.nextLine(),t=0;else return this.done=!0,this}}}const _t=new WeakMap;class Ne{constructor(t,r){this.from=t,this.text=r}get to(){return this.from+this.text.length}static get(t,r,n){let o=_t.get(t);if(!o||o.from>=n||o.to<=r){let c=new Ne(r,t.sliceString(r,n));return _t.set(t,c),c}if(o.from==r&&o.to==n)return o;let{text:i,from:s}=o;return s>r&&(i=t.sliceString(r,s)+i,s=r),o.to<n&&(i+=t.sliceString(o.to,n)),_t.set(t,new Ne(s,i)),new Ne(r,i.slice(r-s,n-s))}}class cn{constructor(t,r,n,o,i){this.text=t,this.to=i,this.done=!1,this.value=an,this.matchPos=ct(t,o),this.re=new RegExp(r,Ut+(n!=null&&n.ignoreCase?"i":"")),this.test=n==null?void 0:n.test,this.flat=Ne.get(t,o,this.chunkEnd(o+5e3))}chunkEnd(t){return t>=this.to?this.to:this.text.lineAt(t).to}next(){for(;;){let t=this.re.lastIndex=this.matchPos-this.flat.from,r=this.re.exec(this.flat.text);if(r&&!r[0]&&r.index==t&&(this.re.lastIndex=t+1,r=this.re.exec(this.flat.text)),r){let n=this.flat.from+r.index,o=n+r[0].length;if((this.flat.to>=this.to||r.index+r[0].length<=this.flat.text.length-10)&&(!this.test||this.test(n,o,r)))return this.value={from:n,to:o,match:r},this.matchPos=ct(this.text,o+(n==o?1:0)),this}if(this.flat.to==this.to)return this.done=!0,this;this.flat=Ne.get(this.text,this.flat.from,this.chunkEnd(this.flat.from+this.flat.text.length*2))}}}typeof Symbol<"u"&&(sn.prototype[Symbol.iterator]=cn.prototype[Symbol.iterator]=function(){return this});function Go(e){try{return new RegExp(e,Ut),!0}catch{return!1}}function ct(e,t){if(t>=e.length)return t;let r=e.lineAt(t),n;for(;t<r.to&&(n=r.text.charCodeAt(t-r.from))>=56320&&n<57344;)t++;return t}function $t(e){let t=String(e.state.doc.lineAt(e.state.selection.main.head).number),r=Q("input",{class:"cm-textfield",name:"line",value:t}),n=Q("form",{class:"cm-gotoLine",onkeydown:i=>{i.keyCode==27?(i.preventDefault(),e.dispatch({effects:Be.of(!1)}),e.focus()):i.keyCode==13&&(i.preventDefault(),o())},onsubmit:i=>{i.preventDefault(),o()}},Q("label",e.state.phrase("Go to line"),": ",r)," ",Q("button",{class:"cm-button",type:"submit"},e.state.phrase("go")),Q("button",{name:"close",onclick:()=>{e.dispatch({effects:Be.of(!1)}),e.focus()},"aria-label":e.state.phrase("close"),type:"button"},["×"]));function o(){let i=/^([+-])?(\d+)?(:\d+)?(%)?$/.exec(r.value);if(!i)return;let{state:s}=e,c=s.doc.lineAt(s.selection.main.head),[,l,d,f,p]=i,O=f?+f.slice(1):0,b=d?+d:c.number;if(d&&p){let m=b/100;l&&(m=m*(l=="-"?-1:1)+c.number/s.doc.lines),b=Math.round(s.doc.lines*m)}else d&&l&&(b=b*(l=="-"?-1:1)+c.number);let R=s.doc.line(Math.max(1,Math.min(s.doc.lines,b))),v=C.EditorSelection.cursor(R.from+Math.max(0,Math.min(O,R.length)));e.dispatch({effects:[Be.of(!1),y.EditorView.scrollIntoView(v.from,{y:"center"})],selection:v}),e.focus()}return{dom:n}}const Be=C.StateEffect.define(),Mr=C.StateField.define({create(){return!0},update(e,t){for(let r of t.effects)r.is(Be)&&(e=r.value);return e},provide:e=>y.showPanel.from(e,t=>t?$t:null)}),Qo=e=>{let t=y.getPanel(e,$t);if(!t){let r=[Be.of(!0)];e.state.field(Mr,!1)==null&&r.push(C.StateEffect.appendConfig.of([Mr,Xo])),e.dispatch({effects:r}),t=y.getPanel(e,$t)}return t&&t.dom.querySelector("input").select(),!0},Xo=y.EditorView.baseTheme({".cm-panel.cm-gotoLine":{padding:"2px 6px 4px",position:"relative","& label":{fontSize:"80%"},"& [name=close]":{position:"absolute",top:"0",bottom:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:"0"}}}),Zo={highlightWordAroundCursor:!1,minSelectionLength:1,maxMatches:100,wholeWords:!1},ln=C.Facet.define({combine(e){return C.combineConfig(e,Zo,{highlightWordAroundCursor:(t,r)=>t||r,minSelectionLength:Math.min,maxMatches:Math.min})}});function yt(e){let t=[oi,ni];return e&&t.push(ln.of(e)),t}const ei=y.Decoration.mark({class:"cm-selectionMatch"}),ti=y.Decoration.mark({class:"cm-selectionMatch cm-selectionMatch-main"});function Ar(e,t,r,n){return(r==0||e(t.sliceDoc(r-1,r))!=C.CharCategory.Word)&&(n==t.doc.length||e(t.sliceDoc(n,n+1))!=C.CharCategory.Word)}function ri(e,t,r,n){return e(t.sliceDoc(r,r+1))==C.CharCategory.Word&&e(t.sliceDoc(n-1,n))==C.CharCategory.Word}const ni=y.ViewPlugin.fromClass(class{constructor(e){this.decorations=this.getDeco(e)}update(e){(e.selectionSet||e.docChanged||e.viewportChanged)&&(this.decorations=this.getDeco(e.view))}getDeco(e){let t=e.state.facet(ln),{state:r}=e,n=r.selection;if(n.ranges.length>1)return y.Decoration.none;let o=n.main,i,s=null;if(o.empty){if(!t.highlightWordAroundCursor)return y.Decoration.none;let l=r.wordAt(o.head);if(!l)return y.Decoration.none;s=r.charCategorizer(o.head),i=r.sliceDoc(l.from,l.to)}else{let l=o.to-o.from;if(l<t.minSelectionLength||l>200)return y.Decoration.none;if(t.wholeWords){if(i=r.sliceDoc(o.from,o.to),s=r.charCategorizer(o.head),!(Ar(s,r,o.from,o.to)&&ri(s,r,o.from,o.to)))return y.Decoration.none}else if(i=r.sliceDoc(o.from,o.to),!i)return y.Decoration.none}let c=[];for(let l of e.visibleRanges){let d=new Le(r.doc,i,l.from,l.to);for(;!d.next().done;){let{from:f,to:p}=d.value;if((!s||Ar(s,r,f,p))&&(o.empty&&f<=o.from&&p>=o.to?c.push(ti.range(f,p)):(f>=o.to||p<=o.from)&&c.push(ei.range(f,p)),c.length>t.maxMatches))return y.Decoration.none}}return y.Decoration.set(c)}},{decorations:e=>e.decorations}),oi=y.EditorView.baseTheme({".cm-selectionMatch":{backgroundColor:"#99ff7780"},".cm-searchMatch .cm-selectionMatch":{backgroundColor:"transparent"}}),ii=({state:e,dispatch:t})=>{let{selection:r}=e,n=C.EditorSelection.create(r.ranges.map(o=>e.wordAt(o.head)||C.EditorSelection.cursor(o.head)),r.mainIndex);return n.eq(r)?!1:(t(e.update({selection:n})),!0)};function ai(e,t){let{main:r,ranges:n}=e.selection,o=e.wordAt(r.head),i=o&&o.from==r.from&&o.to==r.to;for(let s=!1,c=new Le(e.doc,t,n[n.length-1].to);;)if(c.next(),c.done){if(s)return null;c=new Le(e.doc,t,0,Math.max(0,n[n.length-1].from-1)),s=!0}else{if(s&&n.some(l=>l.from==c.value.from))continue;if(i){let l=e.wordAt(c.value.from);if(!l||l.from!=c.value.from||l.to!=c.value.to)continue}return c.value}}const si=({state:e,dispatch:t})=>{let{ranges:r}=e.selection;if(r.some(i=>i.from===i.to))return ii({state:e,dispatch:t});let n=e.sliceDoc(r[0].from,r[0].to);if(e.selection.ranges.some(i=>e.sliceDoc(i.from,i.to)!=n))return!1;let o=ai(e,n);return o?(t(e.update({selection:e.selection.addRange(C.EditorSelection.range(o.from,o.to),!1),effects:y.EditorView.scrollIntoView(o.to)})),!0):!1},Ce=C.Facet.define({combine(e){return C.combineConfig(e,{top:!1,caseSensitive:!1,literal:!1,regexp:!1,wholeWord:!1,createPanel:t=>new vi(t),scrollToMatch:t=>y.EditorView.scrollIntoView(t)})}});function Gt(e){return e?[Ce.of(e),Wt]:Wt}class un{constructor(t){this.search=t.search,this.caseSensitive=!!t.caseSensitive,this.literal=!!t.literal,this.regexp=!!t.regexp,this.replace=t.replace||"",this.valid=!!this.search&&(!this.regexp||Go(this.search)),this.unquoted=this.unquote(this.search),this.wholeWord=!!t.wholeWord}unquote(t){return this.literal?t:t.replace(/\\([nrt\\])/g,(r,n)=>n=="n"?`
|
|
48
|
+
`:n=="r"?"\r":n=="t"?" ":"\\")}eq(t){return this.search==t.search&&this.replace==t.replace&&this.caseSensitive==t.caseSensitive&&this.regexp==t.regexp&&this.wholeWord==t.wholeWord}create(){return this.regexp?new fi(this):new li(this)}getCursor(t,r=0,n){let o=t.doc?t:C.EditorState.create({doc:t});return n==null&&(n=o.doc.length),this.regexp?Ae(this,o,r,n):Me(this,o,r,n)}}class fn{constructor(t){this.spec=t}}function Me(e,t,r,n){return new Le(t.doc,e.unquoted,r,n,e.caseSensitive?void 0:o=>o.toLowerCase(),e.wholeWord?ci(t.doc,t.charCategorizer(t.selection.main.head)):void 0)}function ci(e,t){return(r,n,o,i)=>((i>r||i+o.length<n)&&(i=Math.max(0,r-2),o=e.sliceString(i,Math.min(e.length,n+2))),(t(lt(o,r-i))!=C.CharCategory.Word||t(ut(o,r-i))!=C.CharCategory.Word)&&(t(ut(o,n-i))!=C.CharCategory.Word||t(lt(o,n-i))!=C.CharCategory.Word))}class li extends fn{constructor(t){super(t)}nextMatch(t,r,n){let o=Me(this.spec,t,n,t.doc.length).nextOverlapping();if(o.done){let i=Math.min(t.doc.length,r+this.spec.unquoted.length);o=Me(this.spec,t,0,i).nextOverlapping()}return o.done||o.value.from==r&&o.value.to==n?null:o.value}prevMatchInRange(t,r,n){for(let o=n;;){let i=Math.max(r,o-1e4-this.spec.unquoted.length),s=Me(this.spec,t,i,o),c=null;for(;!s.nextOverlapping().done;)c=s.value;if(c)return c;if(i==r)return null;o-=1e4}}prevMatch(t,r,n){let o=this.prevMatchInRange(t,0,r);return o||(o=this.prevMatchInRange(t,Math.max(0,n-this.spec.unquoted.length),t.doc.length)),o&&(o.from!=r||o.to!=n)?o:null}getReplacement(t){return this.spec.unquote(this.spec.replace)}matchAll(t,r){let n=Me(this.spec,t,0,t.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(t,r,n,o){let i=Me(this.spec,t,Math.max(0,r-this.spec.unquoted.length),Math.min(n+this.spec.unquoted.length,t.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}function Ae(e,t,r,n){return new sn(t.doc,e.search,{ignoreCase:!e.caseSensitive,test:e.wholeWord?ui(t.charCategorizer(t.selection.main.head)):void 0},r,n)}function lt(e,t){return e.slice(C.findClusterBreak(e,t,!1),t)}function ut(e,t){return e.slice(t,C.findClusterBreak(e,t))}function ui(e){return(t,r,n)=>!n[0].length||(e(lt(n.input,n.index))!=C.CharCategory.Word||e(ut(n.input,n.index))!=C.CharCategory.Word)&&(e(ut(n.input,n.index+n[0].length))!=C.CharCategory.Word||e(lt(n.input,n.index+n[0].length))!=C.CharCategory.Word)}class fi extends fn{nextMatch(t,r,n){let o=Ae(this.spec,t,n,t.doc.length).next();return o.done&&(o=Ae(this.spec,t,0,r).next()),o.done?null:o.value}prevMatchInRange(t,r,n){for(let o=1;;o++){let i=Math.max(r,n-o*1e4),s=Ae(this.spec,t,i,n),c=null;for(;!s.next().done;)c=s.value;if(c&&(i==r||c.from>i+10))return c;if(i==r)return null}}prevMatch(t,r,n){return this.prevMatchInRange(t,0,r)||this.prevMatchInRange(t,n,t.doc.length)}getReplacement(t){return this.spec.unquote(this.spec.replace).replace(/\$([$&]|\d+)/g,(r,n)=>{if(n=="&")return t.match[0];if(n=="$")return"$";for(let o=n.length;o>0;o--){let i=+n.slice(0,o);if(i>0&&i<t.match.length)return t.match[i]+n.slice(o)}return r})}matchAll(t,r){let n=Ae(this.spec,t,0,t.doc.length),o=[];for(;!n.next().done;){if(o.length>=r)return null;o.push(n.value)}return o}highlight(t,r,n,o){let i=Ae(this.spec,t,Math.max(0,r-250),Math.min(n+250,t.doc.length));for(;!i.next().done;)o(i.value.from,i.value.to)}}const Ge=C.StateEffect.define(),Qt=C.StateEffect.define(),be=C.StateField.define({create(e){return new Pt(It(e).create(),null)},update(e,t){for(let r of t.effects)r.is(Ge)?e=new Pt(r.value.create(),e.panel):r.is(Qt)&&(e=new Pt(e.query,r.value?Xt:null));return e},provide:e=>y.showPanel.from(e,t=>t.panel)});class Pt{constructor(t,r){this.query=t,this.panel=r}}const hi=y.Decoration.mark({class:"cm-searchMatch"}),di=y.Decoration.mark({class:"cm-searchMatch cm-searchMatch-selected"}),gi=y.ViewPlugin.fromClass(class{constructor(e){this.view=e,this.decorations=this.highlight(e.state.field(be))}update(e){let t=e.state.field(be);(t!=e.startState.field(be)||e.docChanged||e.selectionSet||e.viewportChanged)&&(this.decorations=this.highlight(t))}highlight({query:e,panel:t}){if(!t||!e.spec.valid)return y.Decoration.none;let{view:r}=this,n=new C.RangeSetBuilder;for(let o=0,i=r.visibleRanges,s=i.length;o<s;o++){let{from:c,to:l}=i[o];for(;o<s-1&&l>i[o+1].from-2*250;)l=i[++o].to;e.highlight(r.state,c,l,(d,f)=>{let p=r.state.selection.ranges.some(O=>O.from==d&&O.to==f);n.add(d,f,p?di:hi)})}return n.finish()}},{decorations:e=>e.decorations});function Xe(e){return t=>{let r=t.state.field(be,!1);return r&&r.query.spec.valid?e(t,r):Zt(t)}}const ft=Xe((e,{query:t})=>{let{to:r}=e.state.selection.main,n=t.nextMatch(e.state,r,r);if(!n)return!1;let o=C.EditorSelection.single(n.from,n.to),i=e.state.facet(Ce);return e.dispatch({selection:o,effects:[rr(e,n),i.scrollToMatch(o.main,e)],userEvent:"select.search"}),dn(e),!0}),ht=Xe((e,{query:t})=>{let{state:r}=e,{from:n}=r.selection.main,o=t.prevMatch(r,n,n);if(!o)return!1;let i=C.EditorSelection.single(o.from,o.to),s=e.state.facet(Ce);return e.dispatch({selection:i,effects:[rr(e,o),s.scrollToMatch(i.main,e)],userEvent:"select.search"}),dn(e),!0}),pi=Xe((e,{query:t})=>{let r=t.matchAll(e.state,1e3);return!r||!r.length?!1:(e.dispatch({selection:C.EditorSelection.create(r.map(n=>C.EditorSelection.range(n.from,n.to))),userEvent:"select.search.matches"}),!0)}),mi=({state:e,dispatch:t})=>{let r=e.selection;if(r.ranges.length>1||r.main.empty)return!1;let{from:n,to:o}=r.main,i=[],s=0;for(let c=new Le(e.doc,e.sliceDoc(n,o));!c.next().done;){if(i.length>1e3)return!1;c.value.from==n&&(s=i.length),i.push(C.EditorSelection.range(c.value.from,c.value.to))}return t(e.update({selection:C.EditorSelection.create(i,s),userEvent:"select.search.matches"})),!0},Fr=Xe((e,{query:t})=>{let{state:r}=e,{from:n,to:o}=r.selection.main;if(r.readOnly)return!1;let i=t.nextMatch(r,n,n);if(!i)return!1;let s=i,c=[],l,d,f=[];s.from==n&&s.to==o&&(d=r.toText(t.getReplacement(s)),c.push({from:s.from,to:s.to,insert:d}),s=t.nextMatch(r,s.from,s.to),f.push(y.EditorView.announce.of(r.phrase("replaced match on line $",r.doc.lineAt(n).number)+".")));let p=e.state.changes(c);return s&&(l=C.EditorSelection.single(s.from,s.to).map(p),f.push(rr(e,s)),f.push(r.facet(Ce).scrollToMatch(l.main,e))),e.dispatch({changes:p,selection:l,effects:f,userEvent:"input.replace"}),!0}),yi=Xe((e,{query:t})=>{if(e.state.readOnly)return!1;let r=t.matchAll(e.state,1e9).map(o=>{let{from:i,to:s}=o;return{from:i,to:s,insert:t.getReplacement(o)}});if(!r.length)return!1;let n=e.state.phrase("replaced $ matches",r.length)+".";return e.dispatch({changes:r,effects:y.EditorView.announce.of(n),userEvent:"input.replace.all"}),!0});function Xt(e){return e.state.facet(Ce).createPanel(e)}function It(e,t){var r,n,o,i,s;let c=e.selection.main,l=c.empty||c.to>c.from+100?"":e.sliceDoc(c.from,c.to);if(t&&!l)return t;let d=e.facet(Ce);return new un({search:((r=t==null?void 0:t.literal)!==null&&r!==void 0?r:d.literal)?l:l.replace(/\n/g,"\\n"),caseSensitive:(n=t==null?void 0:t.caseSensitive)!==null&&n!==void 0?n:d.caseSensitive,literal:(o=t==null?void 0:t.literal)!==null&&o!==void 0?o:d.literal,regexp:(i=t==null?void 0:t.regexp)!==null&&i!==void 0?i:d.regexp,wholeWord:(s=t==null?void 0:t.wholeWord)!==null&&s!==void 0?s:d.wholeWord})}function hn(e){let t=y.getPanel(e,Xt);return t&&t.dom.querySelector("[main-field]")}function dn(e){let t=hn(e);t&&t==e.root.activeElement&&t.select()}const Zt=e=>{let t=e.state.field(be,!1);if(t&&t.panel){let r=hn(e);if(r&&r!=e.root.activeElement){let n=It(e.state,t.query.spec);n.valid&&e.dispatch({effects:Ge.of(n)}),r.focus(),r.select()}}else e.dispatch({effects:[Qt.of(!0),t?Ge.of(It(e.state,t.query.spec)):C.StateEffect.appendConfig.of(Wt)]});return!0},er=e=>{let t=e.state.field(be,!1);if(!t||!t.panel)return!1;let r=y.getPanel(e,Xt);return r&&r.dom.contains(e.root.activeElement)&&e.focus(),e.dispatch({effects:Qt.of(!1)}),!0},tr=[{key:"Mod-f",run:Zt,scope:"editor search-panel"},{key:"F3",run:ft,shift:ht,scope:"editor search-panel",preventDefault:!0},{key:"Mod-g",run:ft,shift:ht,scope:"editor search-panel",preventDefault:!0},{key:"Escape",run:er,scope:"editor search-panel"},{key:"Mod-Shift-l",run:mi},{key:"Mod-Alt-g",run:Qo},{key:"Mod-d",run:si,preventDefault:!0}];class vi{constructor(t){this.view=t;let r=this.query=t.state.field(be).query.spec;this.commit=this.commit.bind(this),this.searchField=Q("input",{value:r.search,placeholder:ie(t,"Find"),"aria-label":ie(t,"Find"),class:"cm-textfield",name:"search",form:"","main-field":"true",onchange:this.commit,onkeyup:this.commit}),this.replaceField=Q("input",{value:r.replace,placeholder:ie(t,"Replace"),"aria-label":ie(t,"Replace"),class:"cm-textfield",name:"replace",form:"",onchange:this.commit,onkeyup:this.commit}),this.caseField=Q("input",{type:"checkbox",name:"case",form:"",checked:r.caseSensitive,onchange:this.commit}),this.reField=Q("input",{type:"checkbox",name:"re",form:"",checked:r.regexp,onchange:this.commit}),this.wordField=Q("input",{type:"checkbox",name:"word",form:"",checked:r.wholeWord,onchange:this.commit});function n(o,i,s){return Q("button",{class:"cm-button",name:o,onclick:i,type:"button"},s)}this.dom=Q("div",{onkeydown:o=>this.keydown(o),class:"cm-search"},[this.searchField,n("next",()=>ft(t),[ie(t,"next")]),n("prev",()=>ht(t),[ie(t,"previous")]),n("select",()=>pi(t),[ie(t,"all")]),Q("label",null,[this.caseField,ie(t,"match case")]),Q("label",null,[this.reField,ie(t,"regexp")]),Q("label",null,[this.wordField,ie(t,"by word")]),...t.state.readOnly?[]:[Q("br"),this.replaceField,n("replace",()=>Fr(t),[ie(t,"replace")]),n("replaceAll",()=>yi(t),[ie(t,"replace all")])],Q("button",{name:"close",onclick:()=>er(t),"aria-label":ie(t,"close"),type:"button"},["×"])])}commit(){let t=new un({search:this.searchField.value,caseSensitive:this.caseField.checked,regexp:this.reField.checked,wholeWord:this.wordField.checked,replace:this.replaceField.value});t.eq(this.query)||(this.query=t,this.view.dispatch({effects:Ge.of(t)}))}keydown(t){y.runScopeHandlers(this.view,t,"search-panel")?t.preventDefault():t.keyCode==13&&t.target==this.searchField?(t.preventDefault(),(t.shiftKey?ht:ft)(this.view)):t.keyCode==13&&t.target==this.replaceField&&(t.preventDefault(),Fr(this.view))}update(t){for(let r of t.transactions)for(let n of r.effects)n.is(Ge)&&!n.value.eq(this.query)&&this.setQuery(n.value)}setQuery(t){this.query=t,this.searchField.value=t.search,this.replaceField.value=t.replace,this.caseField.checked=t.caseSensitive,this.reField.checked=t.regexp,this.wordField.checked=t.wholeWord}mount(){this.searchField.select()}get pos(){return 80}get top(){return this.view.state.facet(Ce).top}}function ie(e,t){return e.state.phrase(t)}const tt=30,rt=/[\s\.,:;?!]/;function rr(e,{from:t,to:r}){let n=e.state.doc.lineAt(t),o=e.state.doc.lineAt(r).to,i=Math.max(n.from,t-tt),s=Math.min(o,r+tt),c=e.state.sliceDoc(i,s);if(i!=n.from){for(let l=0;l<tt;l++)if(!rt.test(c[l+1])&&rt.test(c[l])){c=c.slice(l);break}}if(s!=o){for(let l=c.length-1;l>c.length-tt;l--)if(!rt.test(c[l-1])&&rt.test(c[l])){c=c.slice(0,l);break}}return y.EditorView.announce.of(`${e.state.phrase("current match")}. ${c} ${e.state.phrase("on line")} ${n.number}.`)}const bi=y.EditorView.baseTheme({".cm-panel.cm-search":{padding:"2px 6px 4px",position:"relative","& [name=close]":{position:"absolute",top:"0",right:"4px",backgroundColor:"inherit",border:"none",font:"inherit",padding:0,margin:0},"& input, & button, & label":{margin:".2em .6em .2em 0"},"& input[type=checkbox]":{marginRight:".2em"},"& label":{fontSize:"80%",whiteSpace:"pre"}},"&light .cm-searchMatch":{backgroundColor:"#ffff0054"},"&dark .cm-searchMatch":{backgroundColor:"#00ffff8a"},"&light .cm-searchMatch-selected":{backgroundColor:"#ff6a0054"},"&dark .cm-searchMatch-selected":{backgroundColor:"#ff00ff8a"}}),Wt=[be,C.Prec.low(gi),bi],xi={Search:"搜索",Replace:"替换",Find:"查找","Replace all":"全部替换",Next:"下一个",Previous:"上一个",All:"全部",Close:"关闭",done:"完成","Match case":"区分大小写","Match whole word":"全字匹配","Use regular expression":"使用正则表达式","by word":"按单词",replace:"替换","Search for":"搜索内容","Replace with":"替换为","No matches":"无匹配结果","replaced $ matches":"已替换 $ 个匹配项","replaced match on line $":"已替换第 $ 行的匹配项","on line":"在第",line:"行","$ of $ matches":"第 $ 个,共 $ 个匹配","Invalid regular expression":"无效的正则表达式","Query too long":"查询内容过长","Search string too long":"搜索字符串过长"};function gn(){return y.EditorView.theme({".cm-panel.cm-search":{fontSize:"14px",fontFamily:'-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif'},".cm-search label":{fontSize:"13px"},".cm-search input":{fontSize:"13px",fontFamily:"inherit"},".cm-search button":{fontSize:"12px",fontFamily:"inherit"}})}function pn(e){setTimeout(()=>{const t=e.dom.querySelector(".cm-panel.cm-search");if(!t)return;t.querySelectorAll("label").forEach(i=>{var c;switch((c=i.textContent)==null?void 0:c.trim()){case"Match case":i.textContent="区分大小写";break;case"Match whole word":i.textContent="全字匹配";break;case"Use regular expression":i.textContent="使用正则表达式";break}}),t.querySelectorAll("button").forEach(i=>{var c;switch((c=i.textContent)==null?void 0:c.trim()){case"Next":i.textContent="下一个";break;case"Previous":i.textContent="上一个";break;case"All":i.textContent="全部";break;case"Replace all":i.textContent="全部替换";break;case"Close":i.textContent="关闭";break;case"done":i.textContent="完成";break}}),t.querySelectorAll('input[type="text"]').forEach((i,s)=>{const c=i;s===0?c.placeholder="搜索内容":s===1&&(c.placeholder="替换为")})},100)}function jt(){return[gn(),Gt({top:!0}),yt(),y.keymap.of(tr),y.EditorView.updateListener.of(e=>{e.view.dom.querySelector(".cm-panel.cm-search")&&pn(e.view)})]}function Ei(){return[yt()]}function Vt(){return[Gt({top:!0}),yt(),y.keymap.of(tr)]}const Si=[{key:"Ctrl-f",mac:"Cmd-f",run:()=>!0},{key:"F3",run:()=>!0},{key:"Shift-F3",run:()=>!0}],Ci=({value:e,onChange:t,extensions:r=[],height:n="300px",disabled:o=!1,readOnly:i=!1,className:s="",style:c={},placeholder:l="",showLineNumbers:d=!0,onEditorViewCreated:f,locale:p="zh-CN"},O)=>{const b=k.useRef(null),R=k.useRef();return k.useEffect(()=>{if(!b.current)return;const v=[me.history(),y.keymap.of([...me.historyKeymap,me.indentWithTab,{key:"Enter",run:me.insertNewlineAndIndent}]),y.EditorView.lineWrapping,ne.syntaxHighlighting(ne.defaultHighlightStyle),C.EditorState.allowMultipleSelections.of(!0),p==="zh-CN"?jt():Vt(),l?y.placeholder(l):[],d?y.lineNumbers():[],y.EditorView.updateListener.of(E=>{if(E.docChanged&&t){const T={value:E.state.doc.toString(),readOnlyRanges:[]};t(T)}})];(o||i)&&v.push(C.EditorState.readOnly.of(!0));const m=C.EditorState.create({doc:e,extensions:[...v,...r]}),w=new y.EditorView({state:m,parent:b.current});return R.current=w,f&&f(w),()=>{var E;(E=R.current)==null||E.destroy()}},[]),k.useEffect(()=>{R.current&&e!==R.current.state.doc.toString()&&R.current.dispatch({changes:{from:0,to:R.current.state.doc.length,insert:e}})},[e]),k.useEffect(()=>{if(!R.current||!b.current)return;const v=R.current.state.doc.toString();R.current.destroy();const m=[me.history(),y.keymap.of([...me.historyKeymap,me.indentWithTab,{key:"Enter",run:me.insertNewlineAndIndent}]),y.EditorView.lineWrapping,ne.syntaxHighlighting(ne.defaultHighlightStyle),C.EditorState.allowMultipleSelections.of(!0),p==="zh-CN"?jt():Vt(),l?y.placeholder(l):[],d?y.lineNumbers():[],y.EditorView.updateListener.of(T=>{if(T.docChanged&&t){const L={value:T.state.doc.toString(),readOnlyRanges:[]};t(L)}})];(o||i)&&m.push(C.EditorState.readOnly.of(!0));const w=C.EditorState.create({doc:v,extensions:[...m,...r]}),E=new y.EditorView({state:w,parent:b.current});R.current=E,f&&f(E)},[o,i,d]),k.useImperativeHandle(O,()=>({insertTextAtCursor:v=>{const m=R.current;m&&(m.dispatch(m.state.replaceSelection(v)),m.focus())},goToPosition:v=>{const m=R.current;if(m){const w=m.state.doc.length,E=Math.max(0,Math.min(v,w));m.dispatch({selection:{anchor:E,head:E},scrollIntoView:!0}),m.focus()}},goToLine:(v,m=0)=>{const w=R.current;if(w){const E=w.state.doc,T=Math.max(1,Math.min(v,E.lines)),L=E.line(T),h=Math.max(0,Math.min(m,L.length))+L.from;w.dispatch({selection:{anchor:h,head:h},scrollIntoView:!0}),w.focus()}},getEditorView:()=>R.current})),mt("div",{ref:b,className:`senyao-editor ${o?"disabled":""} ${i?"readonly":""} ${s}`,style:{height:n,...c}})},vt=k.forwardRef(Ci),Ri=({value:e,onChange:t,language:r="json",extensions:n=[],theme:o="light",showLineNumbers:i=!0,...s},c)=>{const l=k.useMemo(()=>{const d=Gr(r)?Ur(r):[],f=en(o);return[d,f,...n]},[r,n,o]);return mt(vt,{ref:c,value:e,onChange:t,extensions:l,showLineNumbers:i,...s})},wi=k.forwardRef(Ri),ki=({value:e,onChange:t,extensions:r=[],readOnlyRanges:n,manageReadOnlyRanges:o=!0,showLineNumbers:i=!0,...s},c)=>{const l=k.useRef(null),f=(x=>x!=null&&typeof x=="object"&&"value"in x)(e),p=f?e.value:e,O=(f&&"readOnlyRanges"in e?e.readOnlyRanges:n)??[],[b,R]=k.useState(p??""),v=k.useRef(null),[m,w]=k.useState(O),E=k.useRef(b),[T,L]=k.useState(null),h=k.useRef(!1),_=k.useRef(new Map),M=k.useRef(!1);k.useEffect(()=>{if(o&&O.length>0&&!T){const x=[];let A=0;for(let F=0;F<O.length;F++){const $=O[F];$.start>A&&x.push({content:b.substring(A,$.start),editable:!0}),x.push({content:b.substring($.start,$.end),editable:!1}),A=$.end}A<b.length&&x.push({content:b.substring(A),editable:!0}),L(x)}},[o,O,b,T]),k.useEffect(()=>{if(b){const x=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],A=new Map;x.forEach(F=>{const $=b.indexOf(F);$>=0&&A.set(F,$)}),_.current=A}},[]);const ue=k.useMemo(()=>{const x=[Lr.sql(),Yt.autocompletion()];return m.length>0&&x.push(rn(m)),[...x,...r]},[r,m]),G=k.useCallback((x,A,F=0)=>{const $=x.indexOf(A,F);return $>=0?$:null},[]),Re=k.useCallback((x,A)=>{if(!o||!x||x.length===0)return x;const F=[...x];let $=0;for(let U=0;U<x.length;U++){const se=x[U];if(!se.editable){const pe=G(A,se.content,$);pe!==null&&(U>0&&x[U-1].editable&&pe>$&&(F[U-1]={...F[U-1],content:A.substring($,pe)}),$=pe+se.content.length)}}const H=x[x.length-1];return H.editable&&$<A.length&&(F[x.length-1]={...H,content:A.substring($)}),F},[o,G]),we=k.useCallback(x=>{let A=!1;return _.current.forEach((F,$)=>{const H=x.indexOf($);H>=0&&Math.abs(H-F)>0&&(_.current.set($,H),H>F&&(F===0||F<15)&&(A=!0))}),A},[]),xe=k.useCallback(()=>{if(!v.current)return;const x=v.current,A=x.state.doc.toString(),F=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],$=x.state.selection;let H=!1;for(const U of F){const se=A.indexOf(U);if(se>=0){x.dispatch({selection:{anchor:se,head:se+U.length},scrollIntoView:!1}),H=!0;break}}H&&setTimeout(()=>{x.dom&&document.contains(x.dom)&&x.dispatch({selection:$,scrollIntoView:!1})},10)},[]),te=k.useCallback(()=>{if(!v.current)return;const x=v.current;m.length>0&&(ye(x,[]),setTimeout(()=>{x.dom&&document.contains(x.dom)&&(ye(x,m),setTimeout(()=>{x.dom&&document.contains(x.dom)&&x.dispatch({})},10))},10))},[m]),le=k.useCallback(x=>{const A=x.value,F=E.current;R(A),F!==A&&(!F||A.length>(F==null?void 0:F.length)&&!F.startsWith(A.substring(0,5))&&A.includes(F.substring(0,10)))&&(h.current=!0,we(A)&&setTimeout(()=>{xe()},10)),E.current=A;const $=v.current?nn(v.current):m;if(o&&T){const H=Re(T,A);L(H);const{readOnlyRanges:U}=Lt(H);w(U),v.current&&ye(v.current,U),t&&t({value:A,readOnlyRanges:U})}else t&&t({value:A,readOnlyRanges:$})},[t,o,T,m,Re,we,xe]);k.useEffect(()=>{!o&&JSON.stringify(O)!==JSON.stringify(m)&&(w(O),v.current&&ye(v.current,O))},[O,m,o]),k.useEffect(()=>{if(o&&T){const{readOnlyRanges:x}=Lt(T);JSON.stringify(x)!==JSON.stringify(m)&&(w(x),v.current&&ye(v.current,x))}},[T,m,o]),k.useEffect(()=>{v.current&&h.current&&(h.current=!1,v.current.dispatch({}))},[b]),k.useEffect(()=>{v.current&&m.length>0&&!M.current&&(M.current=!0,setTimeout(()=>{te()},50),setTimeout(()=>{te()},200))},[te,m]);const ge=k.useCallback(x=>{if(v.current=x,m.length>0&&(ye(x,m),setTimeout(()=>{ye(x,[]),setTimeout(()=>{ye(x,m)},10)},50)),b){const A=["SELECT","FROM","WHERE","GROUP","ORDER","HAVING","JOIN"],F=new Map;A.forEach($=>{const H=b.indexOf($);H>=0&&F.set($,H)}),_.current=F}},[m,b]);return mt(vt,{ref:l,value:b,onChange:le,extensions:ue,showLineNumbers:i,onEditorViewCreated:ge,...s})},Ti=k.forwardRef(ki);function mn(e){return e.startsWith('"')&&e.endsWith('"')?e.slice(1,-1):e}function _i(e,t){switch(t){case"String":return mn(e);case"Number":return Number(e);case"True":return!0;case"False":return!1;case"Null":return null;default:try{return JSON.parse(e)}catch{return e}}}function Pi(e,t){if(typeof e!="object"||e===null)return e===t;try{return JSON.stringify(e)===JSON.stringify(t)}catch{return!1}}function Oi(e,t){const r=e.firstChild;if(!r)return"";const n=t.doc.sliceString(r.from,r.to);return mn(n)}function Mi(e,t){const r=e.lastChild;if(!r)return"";const n=t.doc.sliceString(r.from,r.to);return _i(n,r.type.name)}function Ai(e){let t=e.parent;for(;t;){if(t.type.name==="Object"||t.type.name==="Array")return t;t=t.parent}return null}function Fi(e){const t=new Map;for(const r of e){const n=t.get(r.key)||[];n.push(r),t.set(r.key,n)}return t}function Ni(e,t,r){const n=r.get(e);return n?n.some(o=>Pi(t,o.value)):!1}function Di(e,t){if(!t||t.length===0)return[];const r=ne.syntaxTree(e),n=[],o=new Set,i=Fi(t);return r.iterate({enter(s){const c=s.node;if(s.type.name!=="Property")return;const l=Oi(c,e),d=Mi(c,e);if(Ni(l,d,i)){const f=Ai(c);if(f){const p=`${f.from}-${f.to}`;o.has(p)||(o.add(p),n.push({from:f.from,to:f.to}))}}}}),n}function Li(e,t){if(e)return[];const r={backgroundColor:"rgba(255, 237, 0, 0.3)",borderRadius:"3px",outline:"1px solid rgba(255, 193, 7, 0.5)"};let n={...r};return t&&(n={...r,...t}),y.EditorView.baseTheme({".cm-json-highlight":n})}function $i(e,t="cm-json-highlight"){return C.StateField.define({create(n){return Nr(n,e,t)},update(n,o){return o.docChanged?Nr(o.state,e,t):n.map(o.changes)},provide:n=>y.EditorView.decorations.from(n)})}function Nr(e,t,r){if(!t||t.length===0)return y.Decoration.none;const n=new C.RangeSetBuilder,o=Di(e,t);for(const i of o)n.add(i.from,i.to,y.Decoration.mark({class:r}));return n.finish()}function Dr(e,t,r){return[$i(e,t||"cm-json-highlight"),Li(t,r)]}const Ii=(e,t)=>{const{value:r,onChange:n,extensions:o=[],showLineNumbers:i=!0,enableFormatting:s=!1,enableCodeFolding:c=!0,highlightMatches:l,highlightClassName:d,highlightStyle:f,...p}=e,O=k.useRef(!0),b=k.useRef(null),R=k.useRef(new C.Compartment).current,v=k.useCallback(_=>{try{return _===""||JSON.parse(_),!0}catch{return!1}},[]),m=k.useCallback(_=>{try{if(!_.trim())return"";const M=JSON.parse(_);return JSON.stringify(M,null,2)}catch{return _}},[]),w=k.useCallback(()=>{if(!b.current)return!1;const _=b.current,M=_.state.doc.toString(),ue=m(M);if(ue===M)return!1;const G=_.state.update({changes:{from:0,to:_.state.doc.length,insert:ue}});return _.dispatch(G),!0},[m]),E=k.useMemo(()=>y.keymap.of([{key:"Alt-f",mac:"Mod-Alt-f",run:()=>w()}]),[w]),T=k.useCallback(_=>{if(n){const M=v(_.value);O.current=M,n(_)}},[n,v]),L=k.useMemo(()=>{const _=[qt.json(),ne.bracketMatching(),Yt.closeBrackets(),C.Prec.highest(E),...o],M=l&&l.length>0?Dr(l,d,f):[];return _.push(R.of(M)),c&&_.push(ne.codeFolding(),ne.foldGutter({markerDOM:ue=>{const G=document.createElement("span");return G.style.cssText=`
|
|
49
49
|
display: inline-flex;
|
|
50
50
|
align-items: center;
|
|
51
51
|
justify-content: center;
|
|
@@ -57,4 +57,4 @@ React keys must be passed directly to JSX without using spread:
|
|
|
57
57
|
transition: all 0.2s ease;
|
|
58
58
|
user-select: none;
|
|
59
59
|
border-radius: 2px;
|
|
60
|
-
`,
|
|
60
|
+
`,G.textContent=ue?"▾":"▸",G.onmouseenter=()=>{G.style.backgroundColor="rgba(24, 144, 255, 0.08)"},G.onmouseleave=()=>{G.style.backgroundColor="transparent"},G}}),y.keymap.of(ne.foldKeymap)),_},[E,o,c,R]);k.useEffect(()=>{if(!b.current)return;const _=l&&l.length>0?Dr(l,d,f):[];b.current.dispatch({effects:R.reconfigure(_)})},[l,d,f,R]);const h=k.useCallback(_=>{b.current=_,s&&r&&setTimeout(()=>{w()},0)},[s,r,w]);return mt(vt,{ref:t,value:r,showLineNumbers:i,onChange:T,extensions:L,onEditorViewCreated:h,...p})},Wi=k.forwardRef(Ii);exports.Editor=wi;exports.GenericEditor=vt;exports.JSONEditor=Wi;exports.SQLEditor=Ti;exports.applyChinese=pn;exports.blocksToEditorData=Lt;exports.chineseLanguageExtension=gn;exports.closeSearchPanel=er;exports.commonExtensions=Yo;exports.createAutocompletionExtension=Qr;exports.createEnglishSearchExtension=Vt;exports.createHighlightOnlyExtension=Ei;exports.createKeymapExtension=Xr;exports.createLintExtension=qo;exports.createSearchExtension=jt;exports.customSearchKeymap=Si;exports.darkTheme=Zr;exports.findMatchingRanges=Jo;exports.getCurrentReadOnlyRanges=nn;exports.getLanguageExtension=Ur;exports.getThemeExtension=en;exports.highlightSelectionMatches=yt;exports.isSupportedLanguage=Gr;exports.lightTheme=Dt;exports.openSearchPanel=Zt;exports.readOnlyRanges=rn;exports.search=Gt;exports.searchKeymap=tr;exports.searchTranslationsZhCN=xi;exports.updateReadOnlyRanges=ye;
|