@onerjs/code-input 0.1.7 → 0.1.8
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/code-input.cjs +12 -12
- package/dist/code-input.es.js +114 -111
- package/dist/style.css +1 -1
- package/package.json +1 -1
package/dist/code-input.cjs
CHANGED
|
@@ -5,24 +5,24 @@
|
|
|
5
5
|
round(x: number): number
|
|
6
6
|
max(...values: number[]): number
|
|
7
7
|
random(): number
|
|
8
|
-
}`,documentation:"内置数学对象",members:[{label:"PI",kind:"property",detail:"number"},{label:"E",kind:"property",detail:"number"},{label:"abs",kind:"function",detail:"(x: number) => number"},{label:"ceil",kind:"function",detail:"(x: number) => number"},{label:"floor",kind:"function",detail:"(x: number) => number"},{label:"round",kind:"function",detail:"(x: number) => number"},{label:"max",kind:"function",detail:"(...values: number[]) => number"},{label:"min",kind:"function",detail:"(...values: number[]) => number"},{label:"pow",kind:"function",detail:"(base: number, exp: number) => number"},{label:"random",kind:"function",detail:"() => number"},{label:"sqrt",kind:"function",detail:"(x: number) => number"},{label:"trunc",kind:"function",detail:"(x: number) => number"}]},{label:"JSON",kind:"class",detail:"JSON",members:[{label:"parse",kind:"function",detail:"(text: string) => any"},{label:"stringify",kind:"function",detail:"(value: any, space?: number) => string"}]},{label:"console",kind:"variable",detail:"Console",members:[{label:"log",kind:"function",detail:"(...data: any[]) => void"},{label:"info",kind:"function",detail:"(...data: any[]) => void"},{label:"warn",kind:"function",detail:"(...data: any[]) => void"},{label:"error",kind:"function",detail:"(...data: any[]) => void"},{label:"debug",kind:"function",detail:"(...data: any[]) => void"},{label:"table",kind:"function",detail:"(data: any) => void"},{label:"time",kind:"function",detail:"(label: string) => void"},{label:"timeEnd",kind:"function",detail:"(label: string) => void"}]},{label:"Object",kind:"class",detail:"Object",members:[{label:"keys",kind:"function",detail:"(o: object) => string[]"},{label:"values",kind:"function",detail:"(o: object) => any[]"},{label:"entries",kind:"function",detail:"(o: object) => [string, any][]"},{label:"assign",kind:"function",detail:"(target: object, ...sources: object[]) => object"},{label:"freeze",kind:"function",detail:"(o: object) => object"}]},{label:"Array",kind:"class",detail:"Array",members:[{label:"isArray",kind:"function",detail:"(value: any) => boolean"},{label:"from",kind:"function",detail:"(iterable: any) => any[]"},{label:"of",kind:"function",detail:"(...items: any[]) => any[]"}]},{label:"Promise",kind:"class",detail:"Promise",members:[{label:"resolve",kind:"function",detail:"(value?: any) => Promise<any>"},{label:"reject",kind:"function",detail:"(reason?: any) => Promise<never>"},{label:"all",kind:"function",detail:"(values: any[]) => Promise<any[]>"},{label:"race",kind:"function",detail:"(values: any[]) => Promise<any>"}]},{label:"Date",kind:"class",detail:"Date",members:[{label:"now",kind:"function",detail:"() => number"},{label:"parse",kind:"function",detail:"(dateString: string) => number"}]},{label:"String",kind:"class",detail:"String",members:[{label:"fromCharCode",kind:"function",detail:"(...codes: number[]) => string"},{label:"from",kind:"function",detail:"(value: any) => string"}]},{label:"Number",kind:"class",detail:"Number",members:[{label:"isNaN",kind:"function",detail:"(value: any) => boolean"},{label:"isInteger",kind:"function",detail:"(value: any) => boolean"},{label:"parseFloat",kind:"function",detail:"(value: string) => number"},{label:"parseInt",kind:"function",detail:"(value: string, radix?: number) => number"}]},{label:"setTimeout",kind:"function",detail:"(callback: Function, ms?: number) => number"},{label:"clearTimeout",kind:"function",detail:"(id: number) => void"},{label:"setInterval",kind:"function",detail:"(callback: Function, ms?: number) => number"},{label:"clearInterval",kind:"function",detail:"(id: number) => void"}],Nt=/[\w$]/;function Je(n,r){const a=[];let e=null;for(let $=0;$<r;$++){const v=n[$];if(e){v===e&&n[$-1]!=="\\"&&(e=null);continue}if(v==="'"||v==='"'||v==="`"){e=v;continue}if(v==="("){a.push({index:$,commas:0});continue}if(v===")"){a.pop();continue}v===","&&a.length&&a[a.length-1].commas++}const i=a[a.length-1];if(!i)return null;let c=i.index-1;for(;c>=0&&/\s/.test(n[c]);)c--;const p=c;for(;c>=0&&Nt.test(n[c]);)c--;const d=n.slice(c+1,p+1);if(!d)return null;let s=r;for(;s>0&&/[\w$'"]/.test(n[s-1]);)s--;const f=n.slice(s,r);let E=f,V=null;return f&&(f[0]==="'"||f[0]==='"')&&(V=f[0],E=f.slice(1)),{functionName:d,paramIndex:i.commas,prefix:E,replaceStart:s,quote:V}}const We=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","from","function","if","import","in","instanceof","let","new","of","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","async","await","true","false","null","undefined","NaN","Infinity"],At=["abstract","any","as","asserts","bigint","boolean","declare","enum","implements","infer","interface","is","keyof","namespace","never","number","object","override","private","protected","public","readonly","satisfies","static","string","symbol","type","unknown"];function Te(n){return n==="typescript"?[...We,...At]:We}function xe(n){return new Set(Te(n))}const Vt=/((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/,je=/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g,Ot=/^[A-Za-z_$]/;function
|
|
8
|
+
}`,documentation:"内置数学对象",members:[{label:"PI",kind:"property",detail:"number"},{label:"E",kind:"property",detail:"number"},{label:"abs",kind:"function",detail:"(x: number) => number"},{label:"ceil",kind:"function",detail:"(x: number) => number"},{label:"floor",kind:"function",detail:"(x: number) => number"},{label:"round",kind:"function",detail:"(x: number) => number"},{label:"max",kind:"function",detail:"(...values: number[]) => number"},{label:"min",kind:"function",detail:"(...values: number[]) => number"},{label:"pow",kind:"function",detail:"(base: number, exp: number) => number"},{label:"random",kind:"function",detail:"() => number"},{label:"sqrt",kind:"function",detail:"(x: number) => number"},{label:"trunc",kind:"function",detail:"(x: number) => number"}]},{label:"JSON",kind:"class",detail:"JSON",members:[{label:"parse",kind:"function",detail:"(text: string) => any"},{label:"stringify",kind:"function",detail:"(value: any, space?: number) => string"}]},{label:"console",kind:"variable",detail:"Console",members:[{label:"log",kind:"function",detail:"(...data: any[]) => void"},{label:"info",kind:"function",detail:"(...data: any[]) => void"},{label:"warn",kind:"function",detail:"(...data: any[]) => void"},{label:"error",kind:"function",detail:"(...data: any[]) => void"},{label:"debug",kind:"function",detail:"(...data: any[]) => void"},{label:"table",kind:"function",detail:"(data: any) => void"},{label:"time",kind:"function",detail:"(label: string) => void"},{label:"timeEnd",kind:"function",detail:"(label: string) => void"}]},{label:"Object",kind:"class",detail:"Object",members:[{label:"keys",kind:"function",detail:"(o: object) => string[]"},{label:"values",kind:"function",detail:"(o: object) => any[]"},{label:"entries",kind:"function",detail:"(o: object) => [string, any][]"},{label:"assign",kind:"function",detail:"(target: object, ...sources: object[]) => object"},{label:"freeze",kind:"function",detail:"(o: object) => object"}]},{label:"Array",kind:"class",detail:"Array",members:[{label:"isArray",kind:"function",detail:"(value: any) => boolean"},{label:"from",kind:"function",detail:"(iterable: any) => any[]"},{label:"of",kind:"function",detail:"(...items: any[]) => any[]"}]},{label:"Promise",kind:"class",detail:"Promise",members:[{label:"resolve",kind:"function",detail:"(value?: any) => Promise<any>"},{label:"reject",kind:"function",detail:"(reason?: any) => Promise<never>"},{label:"all",kind:"function",detail:"(values: any[]) => Promise<any[]>"},{label:"race",kind:"function",detail:"(values: any[]) => Promise<any>"}]},{label:"Date",kind:"class",detail:"Date",members:[{label:"now",kind:"function",detail:"() => number"},{label:"parse",kind:"function",detail:"(dateString: string) => number"}]},{label:"String",kind:"class",detail:"String",members:[{label:"fromCharCode",kind:"function",detail:"(...codes: number[]) => string"},{label:"from",kind:"function",detail:"(value: any) => string"}]},{label:"Number",kind:"class",detail:"Number",members:[{label:"isNaN",kind:"function",detail:"(value: any) => boolean"},{label:"isInteger",kind:"function",detail:"(value: any) => boolean"},{label:"parseFloat",kind:"function",detail:"(value: string) => number"},{label:"parseInt",kind:"function",detail:"(value: string, radix?: number) => number"}]},{label:"setTimeout",kind:"function",detail:"(callback: Function, ms?: number) => number"},{label:"clearTimeout",kind:"function",detail:"(id: number) => void"},{label:"setInterval",kind:"function",detail:"(callback: Function, ms?: number) => number"},{label:"clearInterval",kind:"function",detail:"(id: number) => void"}],Nt=/[\w$]/;function Je(n,r){const a=[];let e=null;for(let $=0;$<r;$++){const v=n[$];if(e){v===e&&n[$-1]!=="\\"&&(e=null);continue}if(v==="'"||v==='"'||v==="`"){e=v;continue}if(v==="("){a.push({index:$,commas:0});continue}if(v===")"){a.pop();continue}v===","&&a.length&&a[a.length-1].commas++}const i=a[a.length-1];if(!i)return null;let c=i.index-1;for(;c>=0&&/\s/.test(n[c]);)c--;const p=c;for(;c>=0&&Nt.test(n[c]);)c--;const d=n.slice(c+1,p+1);if(!d)return null;let s=r;for(;s>0&&/[\w$'"]/.test(n[s-1]);)s--;const f=n.slice(s,r);let E=f,V=null;return f&&(f[0]==="'"||f[0]==='"')&&(V=f[0],E=f.slice(1)),{functionName:d,paramIndex:i.commas,prefix:E,replaceStart:s,quote:V}}const We=["break","case","catch","class","const","continue","debugger","default","delete","do","else","export","extends","finally","for","from","function","if","import","in","instanceof","let","new","of","return","super","switch","this","throw","try","typeof","var","void","while","with","yield","async","await","true","false","null","undefined","NaN","Infinity"],At=["abstract","any","as","asserts","bigint","boolean","declare","enum","implements","infer","interface","is","keyof","namespace","never","number","object","override","private","protected","public","readonly","satisfies","static","string","symbol","type","unknown"];function Te(n){return n==="typescript"?[...We,...At]:We}function xe(n){return new Set(Te(n))}const Vt=/((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/,je=/\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g,Ot=/^[A-Za-z_$]/;function Qe(n,r){const a=n.slice(0,r),e=Vt.exec(a);if(!e)return{prefix:"",chain:[]};const i=e[1]??"",c=e[2]??"",p=i.split(".").filter(Boolean).map(d=>d.replace(/\?$/,""));return{prefix:c,chain:p}}function we(n,r){const a=[],e=new Set;let i;for(je.lastIndex=0;(i=je.exec(n))&&!(i.index>=r);){const c=i[1];if(e.has(c))continue;e.add(c);const p=i[0].slice(0,i[0].indexOf(c)).trim();a.push({label:c,kind:p==="function"?"function":p==="class"?"class":"variable",detail:"当前文件"})}return a}function Ge(n,r){let a=r;for(const e of n){if(!a)return null;const i=a.find(c=>c.label===e);if(!i)return null;a=i.members??[]}return a}function zt(n,r){const a=n.toLowerCase(),e=r.toLowerCase(),i=a.indexOf(e);if(i===0)return 1e3-a.length;if(i>0)return 800-i;let c=0,p=0,d=-1;for(let s=0;s<a.length&&c<e.length;s++)a[s]===e[c]&&(d>=0&&(p+=s-d-1),d=s,c++);return c!==e.length?null:400-p-a.length}function et(n,r){if(!r)return n;const a=[];for(const e of n){const i=zt(e.label,r);i!==null&&a.push({item:e,score:i})}return a.sort((e,i)=>i.score-e.score||e.item.label.localeCompare(i.item.label)),a.map(e=>e.item)}function Dt(n){const r=new Set,a=[];for(const e of n)r.has(e.label)||(r.add(e.label),a.push(e));return a}function tt(n,r,a){const{prefix:e,chain:i}=Qe(n,r);if(a.auto&&(!e&&i.length===0||e&&!Ot.test(e)))return null;const c=a.declared??[],p=[...c,...a.completions];let d;if(i.length>0){const f=Ge(i,p);if(!f||f.length===0)return null;d=f}else d=[...a.completions,...c,...Te(a.language).map(f=>({label:f,kind:"keyword"}))];const s=et(Dt(d),e);return s.length===0?null:{items:s,start:r-e.length,end:r}}const Wt=/([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;function nt(n,r,a,e){const i=n.slice(r,a);if(!i)return null;const c=[...e.declared??[],...e.completions],p=Wt.exec(n.slice(0,r));if(p){const d=p[1].split(".").filter(Boolean).map(E=>E.replace(/\?$/,"")),s=Ge(d,c),f=s==null?void 0:s.find(E=>E.label===i);if(f)return f}return c.find(d=>d.label===i)??null}const W="[A-Za-z_$][\\w$]*",Fe="(?:readonly\\s+|public\\s+|private\\s+|protected\\s+|static\\s+|abstract\\s+)*";function Pe(n,r){let a=0,e=!1,i=r;for(let c=r;c<n.length;c++){const p=n[c];for(let d=0;d<p.length;d++){const s=p[d];s==="{"?(a++,e=!0):s==="}"&&a--}if(e&&a<=0){i=c;break}}return{end:i,body:n.slice(r+1,i)}}function Ke(n){return n.trim().replace(/[,;]$/,"").trim()}function jt(n){return/^(?:export\s+)?(?:declare\s+)?(?:abstract\s+)?(?:interface|class|type|function|const|let|var|namespace|enum)\b/.test(n)}function J(n,r){const a=n[r];let e=a.lastIndexOf("}");const i=a.lastIndexOf(";");if(i>e&&(e=i),e===-1)return;const c=a.slice(e+1).replace(/^[\s;]+/,"").trim();!c||!jt(c)||(n[r]=a.slice(0,e+1),n.splice(r+1,0,c))}function P(n){return n.length?n.join(`
|
|
9
9
|
`).replace(/^\s*\/\*\*?/,"").replace(/\*\/\s*$/,"").split(`
|
|
10
10
|
`).map(r=>r.replace(/^\s*\*+\s?/,"").replace(/^\s*\/\/\s?/,"")).join(`
|
|
11
11
|
`).replace(/\n{3,}/g,`
|
|
12
12
|
|
|
13
|
-
`).trim():""}function
|
|
13
|
+
`).trim():""}function qe(n){return n.split(`
|
|
14
14
|
`).filter(r=>!/^\s*(\/\/|\/\*|\*)/.test(r)).join(`
|
|
15
15
|
`).replace(/\n{2,}/g,`
|
|
16
|
-
`).trim()}function Ze(n){const r=[],a=new Set,e=new RegExp(`^${Fe}(${W})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`),i=new RegExp(`^${Fe}(${W})(\\?)?\\s*:\\s*(.+?);?$`);let c=[],p=!1;for(const d of n){const s=d.trim();if(p){c.push(s),s.includes("*/")&&(p=!1);continue}if(s.startsWith("/*")){c.push(s),s.includes("*/")||(p=!0);continue}if(s.startsWith("//")){c.push(s);continue}if(!s||s.startsWith("}")||s.startsWith("[")){c=[];continue}const f=e.exec(s);if(f){const V=P(c);c=[];const $=f[1];if(a.has($))continue;a.add($),r.push({label:$,kind:"function",detail:`(${f[3].trim()}) => ${
|
|
17
|
-
`),a=new Map,e=new Map,i=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${W})`),c=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${W})`),p=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${W})\\s*=`);let d=[],s=!1;for(let v=0;v<r.length;v++){const y=r[v].trim();if(s){d.push(y),y.includes("*/")&&(s=!1);continue}if(y.startsWith("/*")){d.push(y),y.includes("*/")||(s=!0);continue}if(y.startsWith("//")){d.push(y);continue}if(!y){d=[];continue}const N=i.exec(y);if(N&&y.includes("{")){const w=P(d);d=[];const{end:C,body:
|
|
18
|
-
`).replace(/^\s*export\s+/,"")),members:Ze(
|
|
19
|
-
`).replace(/^\s*export\s+/,"")),members:Ze(
|
|
20
|
-
`))&&
|
|
21
|
-
`).replace(/^\s*export\s+/,"").replace(/;\s*$/,"").trim();a.set(B[1],{label:B[1],type:b,members:[],kind:"type",documentation:w||void 0,literals:lt(b)}),J(r,
|
|
16
|
+
`).trim()}function Ze(n){const r=[],a=new Set,e=new RegExp(`^${Fe}(${W})(\\?)?\\s*\\((.*)\\)\\s*:\\s*(.+?);?$`),i=new RegExp(`^${Fe}(${W})(\\?)?\\s*:\\s*(.+?);?$`);let c=[],p=!1;for(const d of n){const s=d.trim();if(p){c.push(s),s.includes("*/")&&(p=!1);continue}if(s.startsWith("/*")){c.push(s),s.includes("*/")||(p=!0);continue}if(s.startsWith("//")){c.push(s);continue}if(!s||s.startsWith("}")||s.startsWith("[")){c=[];continue}const f=e.exec(s);if(f){const V=P(c);c=[];const $=f[1];if(a.has($))continue;a.add($),r.push({label:$,kind:"function",detail:`(${f[3].trim()}) => ${Ke(f[4])}`,documentation:V||void 0});continue}const E=i.exec(s);if(E){const V=P(c);c=[];const $=E[1];if(a.has($))continue;a.add($);const v=Ke(E[3]),y=/^\(|=>/.test(v)?"function":"property";r.push({label:$,kind:y,detail:v,documentation:V||void 0})}}return r}function lt(n){const r=[],a=/(['"])((?:\\.|(?!\1).)*)\1/g;let e;for(;e=a.exec(n);)r.push(e[2]);return r}function Ft(n,r){const a=[];let e=0,i="",c=null;for(let p=0;p<n.length;p++){const d=n[p];if(c){i+=d,d===c&&n[p-1]!=="\\"&&(c=null);continue}if(d==="'"||d==='"'||d==="`"){c=d,i+=d;continue}if(d==="("||d==="<"||d==="["||d==="{"?e++:(d===")"||d===">"||d==="]"||d==="}")&&e--,d===r&&e===0){a.push(i),i="";continue}i+=d}return a.push(i),a}function Pt(n,r){const a=n.trim(),e=lt(a);if(e.length)return e;const i=r.get(a.replace(/\[\]$/,""));return(i==null?void 0:i.literals)??[]}function Kt(n,r){const a=n.trim();return a?Ft(a,",").map(e=>{const i=new RegExp(`^\\s*(${W})\\s*(\\?)?\\s*:\\s*(.+)$`).exec(e);if(!i)return{name:e.trim(),type:"",optional:!1,literals:[]};const c=i[3].replace(/\s*=\s*[^=]*$/,"").trim();return{name:i[1],optional:!!i[2],type:c,literals:Pt(c,r)}}):[]}function ot(n){const r=n.replace(/\[\]/g,"").replace(/<[^>]*>/g,"").replace(/\s*\|\s*null\s*/g,"").trim(),a=new RegExp(`^(${W})$`).exec(r);return a?a[1]:null}function qt(n){const r=n.trim();if(!r||r.endsWith(";"))return!1;const a=(r.match(/[(<[{]/g)??[]).length,e=(r.match(/[)>\]}]/g)??[]).length;return/[|&,(<]\s*$/.test(r)||a>e}function it(n,r,a,e=0){return e>6?n:n.map(i=>{if(i.kind!=="property"||!i.detail)return i;const c=ot(i.detail),p=c?r.get(c):void 0;if(!p||a.has(p.label))return i;const d=new Set(a);return d.add(p.label),{...i,type:p.type,members:it(p.members,r,d,e+1)}})}const Zt=50,Q=new Map,Ut={items:[],signatures:new Map};function at(n){if(!n||!n.trim())return Ut;const r=Q.get(n);if(r)return r;const a=Yt(n);if(Q.size>=Zt){const e=Q.keys().next().value;e!==void 0&&Q.delete(e)}return Q.set(n,a),a}function st(n){return at(n).items}function rt(n){return at(n).signatures}function Yt(n){const r=n.split(`
|
|
17
|
+
`),a=new Map,e=new Map,i=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?interface\\s+(${W})`),c=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:abstract\\s+)?class\\s+(${W})`),p=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?type\\s+(${W})\\s*=`);let d=[],s=!1;for(let v=0;v<r.length;v++){const y=r[v].trim();if(s){d.push(y),y.includes("*/")&&(s=!1);continue}if(y.startsWith("/*")){d.push(y),y.includes("*/")||(s=!0);continue}if(y.startsWith("//")){d.push(y);continue}if(!y){d=[];continue}const N=i.exec(y);if(N&&y.includes("{")){const w=P(d);d=[];const{end:C,body:R}=Pe(r,v),b=N[1];a.set(b,{label:b,type:qe(r.slice(v,C+1).join(`
|
|
18
|
+
`).replace(/^\s*export\s+/,"")),members:Ze(R),kind:"interface",documentation:w||void 0}),J(r,C),v=C;continue}const L=c.exec(y);if(L&&y.includes("{")){const w=P(d);d=[];const{end:C,body:R}=Pe(r,v),b=L[1];a.set(b,{label:b,type:qe(r.slice(v,C+1).join(`
|
|
19
|
+
`).replace(/^\s*export\s+/,"")),members:Ze(R),kind:"class",documentation:w||void 0}),J(r,C),v=C;continue}const B=p.exec(y);if(B){const w=P(d);d=[];const C=[r[v]];let R=v;for(;qt(C.join(`
|
|
20
|
+
`))&&R+1<r.length;)R++,C.push(r[R]);const b=C.join(`
|
|
21
|
+
`).replace(/^\s*export\s+/,"").replace(/;\s*$/,"").trim();a.set(B[1],{label:B[1],type:b,members:[],kind:"type",documentation:w||void 0,literals:lt(b)}),J(r,R),v=R;continue}d=[]}const f=[],E=new Set,V=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?function\\s+(${W})\\s*\\(([^)]*)\\)\\s*:\\s*([^;{]+)`),$=new RegExp(`^(?:export\\s+)?(?:declare\\s+)?(?:const|let|var)\\s+(${W})\\s*:\\s*([^=;]+)`);d=[],s=!1;for(let v=0;v<r.length;v++){const y=r[v].trim();if(s){d.push(y),y.includes("*/")&&(s=!1);continue}if(y.startsWith("/*")){d.push(y),y.includes("*/")||(s=!0);continue}if(y.startsWith("//")){d.push(y);continue}if(!y){d=[];continue}const N=V.exec(y);if(N){J(r,v);const B=P(d);d=[];const w=N[1];E.has(w)||(E.add(w),f.push({label:w,kind:"function",detail:`(${N[2].trim()}) => ${N[3].trim()}`,documentation:B||void 0})),e.set(w,{name:w,params:Kt(N[2],a)});continue}const L=$.exec(y);if(L){J(r,v);const B=P(d);d=[];const w=L[1];if(E.has(w))continue;E.add(w);const C=L[2].trim(),R=ot(C),b=R?a.get(R):void 0,te=(b==null?void 0:b.kind)==="class"?"class":/^\(|=>/.test(C)?"function":"variable";f.push({label:w,kind:te,detail:C,type:b==null?void 0:b.type,documentation:B||(b==null?void 0:b.documentation)||void 0,members:b?it(b.members,a,new Set([b.label])):void 0});continue}d=[]}return{items:f,signatures:e}}function ce(n,r,a,e){if(!a||!e)return null;const i=Math.max(0,r-1),c=n.lastIndexOf(a,i);if(c===-1||n.lastIndexOf(e,i)>c)return null;const d=n.indexOf(e,c+a.length);return{start:c+a.length,end:d===-1?n.length:d}}function Xt(n,r,a,e){return ce(n,r,a,e)!==null}const Ue=/[A-Za-z_$]/,Jt=/[\w$]/,Ye=/\s/;function G(n,r){const a=[],e=n.length;let i=0;for(;i<e;){const c=n[i],p=n[i+1];if(Ye.test(c)){i++;continue}if(c==="/"&&p==="/"){let s=n.indexOf(`
|
|
22
22
|
`,i);s===-1&&(s=e),a.push({start:i,end:s,type:"comment"}),i=s;continue}if(c==="/"&&p==="*"){const s=n.indexOf("*/",i+2),f=s===-1?e:s+2;a.push({start:i,end:f,type:"comment"}),i=f;continue}if(c==='"'||c==="'"){let s=i+1;for(;s<e;){if(n[s]==="\\"){s+=2;continue}if(n[s]===`
|
|
23
|
-
`)break;if(n[s]===c){s++;break}s++}a.push({start:i,end:s,type:"string"}),i=s;continue}if(c==="`"){let s=i+1;for(;s<e;){if(n[s]==="\\"){s+=2;continue}if(n[s]==="`"){s++;break}s++}a.push({start:i,end:s,type:"template"}),i=s;continue}if(/[0-9]/.test(c)||c==="."&&/[0-9]/.test(p??"")){let s=i+1;for(;s<e&&/[\w.]/.test(n[s]);)s++;a.push({start:i,end:s,type:"number"}),i=s;continue}if(Ue.test(c)){let s=i+1;for(;s<e&&Jt.test(n[s]);)s++;const f=n.slice(i,s),E=r.keywords.has(f)?"keyword":r.builtins.has(f)?"builtin":"identifier";a.push({start:i,end:s,type:E}),i=s;continue}let d=i+1;for(;d<e;){const s=n[d];if(Ye.test(s)||Ue.test(s)||/[0-9]/.test(s)||s==='"'||s==="'"||s==="`"||s==="/")break;d++}a.push({start:i,end:d,type:"punctuation"}),i=d}return a}const
|
|
24
|
-
`:`${ee(s.value,
|
|
23
|
+
`)break;if(n[s]===c){s++;break}s++}a.push({start:i,end:s,type:"string"}),i=s;continue}if(c==="`"){let s=i+1;for(;s<e;){if(n[s]==="\\"){s+=2;continue}if(n[s]==="`"){s++;break}s++}a.push({start:i,end:s,type:"template"}),i=s;continue}if(/[0-9]/.test(c)||c==="."&&/[0-9]/.test(p??"")){let s=i+1;for(;s<e&&/[\w.]/.test(n[s]);)s++;a.push({start:i,end:s,type:"number"}),i=s;continue}if(Ue.test(c)){let s=i+1;for(;s<e&&Jt.test(n[s]);)s++;const f=n.slice(i,s),E=r.keywords.has(f)?"keyword":r.builtins.has(f)?"builtin":"identifier";a.push({start:i,end:s,type:E}),i=s;continue}let d=i+1;for(;d<e;){const s=n[d];if(Ye.test(s)||Ue.test(s)||/[0-9]/.test(s)||s==='"'||s==="'"||s==="`"||s==="/")break;d++}a.push({start:i,end:d,type:"punctuation"}),i=d}return a}const Qt={"&":"&","<":"<",">":">"};function K(n){return n.replace(/[&<>]/g,r=>Qt[r]??r)}function ee(n,r,a=0){let e="",i=0;for(const c of r){c.start>i&&(e+=K(n.slice(i,c.start)));const p=K(n.slice(c.start,c.end));e+=`<span class="tok-${c.type}" data-start="${c.start+a}" data-end="${c.end+a}">${p}</span>`,i=c.end}return i<n.length&&(e+=K(n.slice(i))),e}function ct(n,r,a,e){if(!a||!e)return ee(n,G(n,r));let i="",c=0;for(;c<n.length;){const p=n.indexOf(a,c);if(p===-1){i+=K(n.slice(c));break}i+=K(n.slice(c,p));const d=n.indexOf(e,p+a.length),s=d===-1?n.length:d,f=n.slice(p+a.length,s);i+=`<span class="tok-brace">${K(a)}</span>`,i+=ee(f,G(f,r),p+a.length),d===-1?c=s:(i+=`<span class="tok-brace">${K(e)}</span>`,c=d+e.length)}return i}const Gt={key:0,class:"gutter","aria-hidden":"true"},en=["innerHTML"],tn=["value","readonly","placeholder"],nn=["onMouseenter","onClick"],ln={class:"popup-label"},on={key:0,class:"popup-detail"},an={class:"hover-head"},sn={class:"hover-name"},rn={key:0,class:"hover-colon"},cn={key:0,class:"hover-type"},un={key:0,class:"hover-doc"},dn={key:1,class:"hover-def"},fn=["innerHTML"],pn=["title","aria-label"],mn={key:0,viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},hn={key:1,viewBox:"0 0 16 16",width:"14",height:"14","aria-hidden":"true"},gn=o.defineComponent({__name:"CodeEditor",props:{modelValue:{},mode:{default:"code"},language:{default:"javascript"},completions:{default:()=>[]},tsTypes:{default:""},completionFilter:{},templateCompletions:{default:()=>[]},templateOpen:{default:"{{"},templateClose:{default:"}}"},placeholder:{default:""},readonly:{type:Boolean,default:!1},lineNumbers:{type:Boolean,default:!0},hover:{type:Boolean,default:!0},theme:{default:"light"},collapsible:{type:Boolean,default:!1},defaultExpanded:{type:Boolean,default:!1},collapsedHeight:{default:"34px"},collapseOnBlur:{type:Boolean,default:!1},borderRadius:{default:"4px"},background:{default:""},borderColor:{default:""},minHeight:{default:"260px"}},emits:["update:modelValue","change","expand","collapse"],setup(n,{expose:r,emit:a}){const e=n,i=a,c={variable:"变量",function:"函数",property:"属性",class:"对象",keyword:"关键字",value:"值"},p={"(":")","[":"]","{":"}",'"':'"',"'":"'"},d=new Set(["ArrowLeft","ArrowRight","ArrowUp","ArrowDown","Home","End","PageUp","PageDown"]),s=o.ref(e.modelValue),f=o.ref(),E=o.ref(),V=o.ref(),$=o.ref(),v=o.ref(),y=o.ref(),N=o.ref(),L=o.ref([]),B=o.ref(0),w=o.ref(!1),C=o.ref({start:0,end:0}),R=o.ref({}),b=o.ref(null),te=o.ref({}),dt=o.computed(()=>e.tsTypes?st(e.tsTypes):[]),ft=o.computed(()=>e.tsTypes?rt(e.tsTypes):new Map),Ee=o.computed(()=>[...Xe,...dt.value,...e.completions]),ue=o.computed(()=>e.mode==="template"?[...e.templateCompletions,...Ee.value]:Ee.value),pt=o.computed(()=>{const t={keywords:xe(e.language),builtins:new Set(ue.value.map(l=>l.label))};return e.mode==="template"?`${ct(s.value,t,e.templateOpen,e.templateClose)}
|
|
24
|
+
`:`${ee(s.value,G(s.value,t))}
|
|
25
25
|
`}),mt=o.computed(()=>s.value.split(`
|
|
26
|
-
`).length),D=o.ref(e.defaultExpanded),de=o.ref(!1),ne=o.computed(()=>e.collapsible&&!D.value),ht=o.computed(()=>{const t={};return e.collapsible&&(t.height=e.collapsedHeight),t}),gt=o.computed(()=>{const t={"--ce-radius":e.borderRadius,"--ce-collapsed-height":e.collapsedHeight};return e.background&&(t["--ce-bg"]=e.background),e.borderColor&&(t["--ce-border"]=e.borderColor),e.collapsible?{...t,height:D.value?e.minHeight:e.collapsedHeight}:{...t,height:e.minHeight}});let Ce=0;function Se(t){if(D.value===t)return;const l=f.value;t&&l&&(Ce=l.scrollTop),D.value=t,e.collapsible&&(de.value=!0),i(t?"expand":"collapse"),
|
|
26
|
+
`).length),D=o.ref(e.defaultExpanded),de=o.ref(!1),ne=o.computed(()=>e.collapsible&&!D.value),ht=o.computed(()=>{const t={};return e.collapsible&&(t.height=e.collapsedHeight),t}),gt=o.computed(()=>{const t={"--ce-radius":e.borderRadius,"--ce-collapsed-height":e.collapsedHeight};return e.background&&(t["--ce-bg"]=e.background),e.borderColor&&(t["--ce-border"]=e.borderColor),e.collapsible?{...t,height:D.value?e.minHeight:e.collapsedHeight}:{...t,height:e.minHeight}});let Ce=0;function Se(t){if(D.value===t)return;const l=f.value;t&&l&&(Ce=l.scrollTop),D.value=t,e.collapsible&&(de.value=!0),i(t?"expand":"collapse"),I(),z(),o.nextTick(()=>{if(fe(),!D.value&&l){const u=Math.max(0,l.scrollHeight-l.clientHeight);l.scrollTop=Math.max(0,Math.min(Ce,u)),O(!0),document.activeElement===l&&F();return}O(!0),t&&e.collapseOnBlur&&l&&document.activeElement!==l&&l.focus()})}function bt(){de.value=!1}function vt(){Se(!D.value)}o.watch(()=>e.modelValue,t=>{t!==s.value&&(s.value=t,I())}),o.watch(s,()=>{o.nextTick(()=>O(!0))});function $e(t){return c[t]}function yt(t){return t?ee(t,G(t,{keywords:xe("typescript"),builtins:new Set})):""}let q={top:14,bottom:14,left:16,right:16,lineHeight:22};function fe(){const t=f.value;if(!t)return;const l=window.getComputedStyle(t);q={top:parseFloat(l.paddingTop)||0,bottom:parseFloat(l.paddingBottom)||0,left:parseFloat(l.paddingLeft)||0,right:parseFloat(l.paddingRight)||0,lineHeight:parseFloat(l.lineHeight)||22}}function O(t=!1){const l=f.value;if(!l)return;const u=$.value;if(u&&(u.style.transform=`translate(${-l.scrollLeft}px, ${-l.scrollTop}px)`),v.value&&(v.value.style.transform=`translateY(${-l.scrollTop}px)`),t){const m=`${s.value}|${e.mode}|${l.clientWidth}|${l.clientHeight}`;m!==Me&&(Me=m,kt())}}function F(){const t=f.value;if(!t)return;const l=Re();if(!l)return;const u=t.getBoundingClientRect(),m=t.offsetWidth?u.width/t.offsetWidth:1,g=t.offsetHeight?u.height/t.offsetHeight:1,h=t.clientHeight*g,T=q.top*g,x=q.bottom*g,k=l.lineHeight*g,S=t.scrollTop*g,H=Math.max(0,t.scrollHeight*g-h),A=(ne.value?8:14)*g;let M=t.scrollTop;if(ne.value){const re=h-T-x,X=l.top+S-T-Math.max(0,(re-k)/2);M=Math.max(0,Math.min(X,H))/g}else{const re=T,ye=h-x,X=l.top,De=X+k;let ke=S;X<re+A?ke=S+(X-re-A):De>ye-A&&(ke=S+(De-ye+A)),M=Math.max(0,Math.min(ke,H))/g}const _=t.clientWidth*m,U=q.left*m,j=q.right*m,ve=t.scrollLeft*m,ie=l.left+ve,_t=ve+U,Lt=ve+_-j,ae=8*m;let se=t.scrollLeft;ie<_t+ae?se=Math.max(0,(ie-U-ae)/m):ie>Lt-ae&&(se=Math.max(0,(ie-U-_+j+ae)/m));const Oe=Math.abs(M-t.scrollTop)>.5,ze=Math.abs(se-t.scrollLeft)>.5;!Oe&&!ze||(Oe&&(t.scrollTop=M),ze&&(t.scrollLeft=se),O())}let Be=[],Me="",le=0,pe=-1,me=-1,he={x:0,y:0};function kt(){const t=f.value,l=V.value;if(!t||!l)return;const u=t.getBoundingClientRect(),m=[];l.querySelectorAll("[data-start]").forEach(g=>{const h=g.getBoundingClientRect();m.push({start:Number(g.dataset.start),end:Number(g.dataset.end),left:h.left-u.left+t.scrollLeft,right:h.right-u.left+t.scrollLeft,top:h.top-u.top+t.scrollTop,bottom:h.bottom-u.top+t.scrollTop})}),Be=m}function xt(t,l){for(const u of Be)if(t>=u.left-1&&t<=u.right+1&&l>=u.top&&l<=u.bottom)return u;return null}function z(){b.value=null,le=0,pe=-1,me=-1}function wt(t){const l=N.value,u=f.value;if(!l||!u)return;const m=u.getBoundingClientRect(),g=m.left+t.left-u.scrollLeft,h=m.left+t.right-u.scrollLeft,T=m.top+t.top-u.scrollTop,x=m.top+t.bottom-u.scrollTop,k=12,S=8,H=l.offsetWidth,A=l.offsetHeight;let M=g,_=x+S;M+H>window.innerWidth-k&&(M=h-H),_+A>window.innerHeight-k&&(_=T-A-S),M=Math.max(k,Math.min(M,window.innerWidth-k-H)),_=Math.max(k,_),te.value={left:`${M}px`,top:`${_}px`}}function Tt(t,l){const u=f.value;if(!u||e.readonly||!e.hover||w.value){z();return}if(u.selectionStart!==u.selectionEnd){z();return}const m=N.value;if(b.value&&m){const x=m.getBoundingClientRect();if(t>=x.left&&t<=x.right&&l>=x.top&&l<=x.bottom)return}const g=u.getBoundingClientRect(),h=xt(t-g.left+u.scrollLeft,l-g.top+u.scrollTop);if(!h){z();return}if(b.value&&pe===h.start&&me===h.end)return;const T=nt(u.value,h.start,h.end,{completions:ue.value,declared:we(u.value,h.start)});if(!T){z();return}b.value=T,pe=h.start,me=h.end,o.nextTick(()=>wt(h))}function Et(t){he={x:t.clientX,y:t.clientY},!le&&(le=requestAnimationFrame(()=>{le=0,Tt(he.x,he.y)}))}function Re(){const t=f.value;if(!t)return null;const l=window.getComputedStyle(t),u=document.createElement("div"),m=parseFloat(l.paddingLeft)||0,g=parseFloat(l.paddingRight)||0,h=t.getBoundingClientRect();Object.assign(u.style,{position:"fixed",left:`${h.left}px`,top:`${h.top}px`,visibility:"hidden",pointerEvents:"none",zIndex:"-1",whiteSpace:l.whiteSpace,overflowWrap:l.overflowWrap,wordBreak:l.wordBreak,boxSizing:"content-box",width:`${t.clientWidth-m-g}px`,paddingTop:l.paddingTop,paddingRight:l.paddingRight,paddingBottom:l.paddingBottom,paddingLeft:l.paddingLeft,border:"0",fontFamily:l.fontFamily,fontSize:l.fontSize,fontWeight:l.fontWeight,fontStyle:l.fontStyle,fontVariant:l.fontVariant,letterSpacing:l.letterSpacing,lineHeight:l.lineHeight,textTransform:l.textTransform,tabSize:l.tabSize}),u.textContent=t.value.slice(0,t.selectionStart);const T=document.createElement("span");T.textContent="",u.appendChild(T),document.body.appendChild(u);const x=T.getBoundingClientRect();document.body.removeChild(u);const k=parseFloat(l.lineHeight)||22,S=x.height,H=S>0&&S<k?(k-S)/2:0;return{left:x.left-h.left-t.scrollLeft,top:x.top-h.top-t.scrollTop-H,lineHeight:k}}async function Ie(){await o.nextTick();const t=E.value,l=y.value,u=Re();if(!t||!l||!u)return;const m=4,g=8,h=window.innerWidth,T=window.innerHeight,x=t.getBoundingClientRect(),k=l.scrollHeight,S=T-(x.top+u.top+u.lineHeight)-m-g,H=x.top+u.top-m-g,A=S>=Math.min(k,180)||S>=H,M=Math.min(248,Math.max(A?S:H,96)),_=Math.min(k,M),U=l.offsetWidth||280;let j=u.left;x.left+j+U>h-g&&(j=h-g-U-x.left),j=Math.max(j,g-x.left),R.value={left:`${j}px`,top:`${A?u.top+u.lineHeight+m:u.top-m-_}px`,maxHeight:`${M}px`}}function I(){w.value=!1,L.value=[],B.value=0,z()}function Y(t=!1){var x;const l=f.value;if(!l||e.readonly)return;if(l.selectionStart!==l.selectionEnd){I();return}const u=l.selectionStart;let m=!t;const g=Je(l.value,u);if(g){const k=(x=ft.value.get(g.functionName))==null?void 0:x.params[g.paramIndex],S=(k==null?void 0:k.literals)??[];if(S.length){const H=g.quote,A=S.map(_=>({label:`'${_}'`,kind:"value",detail:k==null?void 0:k.type,insertText:H?_:`'${_}'`})),M=et(A,g.prefix);if(M.length){L.value=M,C.value={start:H?g.replaceStart+1:g.replaceStart,end:u},B.value=0,w.value=!0,Ie();return}}}if(e.mode==="template"){const k=ce(l.value,u,e.templateOpen,e.templateClose);if(!k){I();return}t&&l.value.slice(k.start,u).trim()===""&&(m=!0)}const h=tt(l.value,u,{language:e.language,completions:ue.value,declared:we(l.value,u),auto:!m});if(!h){I();return}let T=h.items;if(e.completionFilter){const k=Qe(l.value,u);if(T=e.completionFilter(T,{prefix:k.prefix,chain:k.chain,text:l.value,position:u,mode:e.mode,language:e.language}),T.length===0){I();return}}L.value=T,C.value={start:h.start,end:h.end},B.value=0,w.value=!0,Ie()}function Ct(t){s.value=t,i("update:modelValue",t),i("change",t)}function oe(t,l,u,m=t+u.length){const g=f.value;if(!g)return;const h=g.value.slice(0,t)+u+g.value.slice(l);Ct(h),I(),o.nextTick(()=>{g.value=h,g.setSelectionRange(m,m),g.focus(),O(!0),F()})}function He(t=L.value[B.value]){if(!t)return;const l=t.insertText??t.label;oe(C.value.start,C.value.end,l),I()}function _e(t){const l=L.value.length;l&&(B.value=(B.value+t+l)%l,o.nextTick(()=>{var u,m;(m=(u=y.value)==null?void 0:u.querySelector(".is-active"))==null||m.scrollIntoView({block:"nearest"})}))}function St(t){const l=t.target;s.value=l.value,i("update:modelValue",l.value),i("change",l.value),z(),O(),F(),o.nextTick(F),Y(!0)}function $t(t){if(I(),z(),!e.collapsible||!e.collapseOnBlur||!D.value)return;const l=t.relatedTarget;l&&l.closest(".expand-toggle")||Se(!1)}function Bt(){Le(),F()}function Le(){const t=f.value;if(!t||e.readonly)return;if(t.selectionStart!==t.selectionEnd){I();return}const l=t.selectionStart;if(l>0&&t.value[l-1]==="."){Y(!0);return}if(e.mode==="template"){const u=ce(t.value,l,e.templateOpen,e.templateClose);if(u&&t.value.slice(u.start,l).trim()===""){Y(!0);return}}I()}let ge=0;function Ne(){window.clearTimeout(ge),ge=window.setTimeout(()=>{ge=0,Le(),F()},0)}function Ae(t){t.target!==f.value&&w.value&&I()}function Mt(){z(),O(),ne.value&&Rt()}let be=0;function Rt(){window.clearTimeout(be),be=window.setTimeout(()=>{be=0,It()},120)}function It(){const t=f.value;if(!t)return;const l=q.lineHeight,u=t.scrollTop,m=Math.round(u/l)*l;Math.abs(m-u)<.5||(t.scrollTop=m,O())}function Ht(t){var g;const l=f.value;if(!l)return;const u=t.metaKey||t.ctrlKey,m=d.has(t.key);if(t.key===" "&&u){t.preventDefault(),Y(!1);return}if(w.value){if(t.key==="ArrowDown"){t.preventDefault(),_e(1);return}if(t.key==="ArrowUp"){t.preventDefault(),_e(-1);return}if(t.key==="Enter"||t.key==="Tab"){t.preventDefault(),He();return}if(t.key==="Escape"){t.preventDefault(),I();return}if(m||u){I(),m&&!u&&Ne();return}}if(m&&!u){Ne();return}if(t.key==="Enter"&&!u&&!t.shiftKey){const h=l.selectionStart;if(h!==l.selectionEnd)return;const T=l.value.lastIndexOf(`
|
|
27
27
|
`,h-1)+1,x=l.value.slice(T,h),k=((g=x.match(/^[ \t]*/))==null?void 0:g[0])??"",S=/[{[(]$/.test(x.trimEnd())?" ":"";t.preventDefault(),oe(h,h,`
|
|
28
|
-
${k}${S}`);return}if(t.key==="Tab"){t.preventDefault(),oe(l.selectionStart,l.selectionEnd," ");return}if(t.key.length===1&&!u&&!t.altKey&&p[t.key]){if(l.selectionStart!==l.selectionEnd)return;const h=l.selectionStart,T=l.value[h-1],x=l.value[h];if((t.key==='"'||t.key==="'")&&T&&/[\w$]/.test(T)||x!==void 0&&!/[\s)\]},;:]/.test(x))return;t.preventDefault(),oe(h,h,t.key+p[t.key],h+1),e.mode==="template"&&o.nextTick(()=>Y(!0))}}function Ve(){w.value&&
|
|
28
|
+
${k}${S}`);return}if(t.key==="Tab"){t.preventDefault(),oe(l.selectionStart,l.selectionEnd," ");return}if(t.key.length===1&&!u&&!t.altKey&&p[t.key]){if(l.selectionStart!==l.selectionEnd)return;const h=l.selectionStart,T=l.value[h-1],x=l.value[h];if((t.key==='"'||t.key==="'")&&T&&/[\w$]/.test(T)||x!==void 0&&!/[\s)\]},;:]/.test(x))return;t.preventDefault(),oe(h,h,t.key+p[t.key],h+1),e.mode==="template"&&o.nextTick(()=>Y(!0))}}function Ve(){w.value&&I(),z(),o.nextTick(()=>{fe(),O(!0)})}let Z=null;return o.onMounted(()=>{window.addEventListener("resize",Ve),window.addEventListener("scroll",Ae,!0),o.nextTick(()=>{fe(),O(!0)}),typeof ResizeObserver<"u"&&f.value&&(Z=new ResizeObserver(()=>{O(!0),F()}),Z.observe(f.value))}),o.onBeforeUnmount(()=>{window.removeEventListener("resize",Ve),window.removeEventListener("scroll",Ae,!0),Z==null||Z.disconnect(),Z=null}),r({focus:()=>{var t;return(t=f.value)==null?void 0:t.focus()}}),(t,l)=>(o.openBlock(),o.createElementBlock("div",{class:o.normalizeClass(["code-input",{"is-collapsible":n.collapsible}]),style:o.normalizeStyle(ht.value)},[o.createElementVNode("div",{class:o.normalizeClass(["code-editor",{"is-readonly":n.readonly,"is-dark":n.theme==="dark","is-collapsed":ne.value,"is-expanding":de.value}]),style:o.normalizeStyle(gt.value),onAnimationend:o.withModifiers(bt,["self"])},[n.lineNumbers?(o.openBlock(),o.createElementBlock("div",Gt,[o.createElementVNode("div",{ref_key:"gutterInner",ref:v,class:"gutter-inner code-font"},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(mt.value,u=>(o.openBlock(),o.createElementBlock("div",{key:u,class:"gutter-line"},o.toDisplayString(u),1))),128))],512)])):o.createCommentVNode("",!0),o.createElementVNode("div",{ref_key:"stage",ref:E,class:"stage"},[o.createElementVNode("div",{ref_key:"highlightLayer",ref:V,class:"highlight code-font"},[o.createElementVNode("pre",{ref_key:"highlightInner",ref:$,class:"code-font"},[o.createElementVNode("code",{innerHTML:pt.value},null,8,en)],512)],512),o.createElementVNode("textarea",{ref_key:"textarea",ref:f,class:"code-font input",value:s.value,readonly:n.readonly,placeholder:n.placeholder,spellcheck:"false",autocomplete:"off",autocapitalize:"off",autocorrect:"off",wrap:"off",onInput:St,onKeydown:Ht,onScroll:Mt,onClick:Bt,onMousemove:Et,onMouseleave:z,onBlur:$t},null,40,tn),w.value?(o.openBlock(),o.createElementBlock("ul",{key:0,ref_key:"popup",ref:y,class:"popup",style:o.normalizeStyle(R.value),onMousedown:l[0]||(l[0]=o.withModifiers(()=>{},["prevent"]))},[(o.openBlock(!0),o.createElementBlock(o.Fragment,null,o.renderList(L.value,(u,m)=>(o.openBlock(),o.createElementBlock("li",{key:`${u.label}-${m}`,class:o.normalizeClass(["popup-item",{"is-active":m===B.value}]),onMouseenter:g=>B.value=m,onClick:g=>He(u)},[o.createElementVNode("span",{class:o.normalizeClass(["badge",`badge-${u.kind}`])},o.toDisplayString($e(u.kind)),3),o.createElementVNode("span",ln,o.toDisplayString(u.label),1),u.detail?(o.openBlock(),o.createElementBlock("span",on,o.toDisplayString(u.detail),1)):o.createCommentVNode("",!0)],42,nn))),128))],36)):o.createCommentVNode("",!0),b.value?(o.openBlock(),o.createElementBlock("div",{key:1,ref_key:"hoverCard",ref:N,class:"hover-card",style:o.normalizeStyle(te.value)},[o.createElementVNode("div",an,[o.createElementVNode("span",{class:o.normalizeClass(["badge",`badge-${b.value.kind}`])},o.toDisplayString($e(b.value.kind)),3),o.createElementVNode("span",sn,[o.createTextVNode(o.toDisplayString(b.value.label),1),b.value.detail?(o.openBlock(),o.createElementBlock("span",rn,":")):o.createCommentVNode("",!0)]),b.value.detail?(o.openBlock(),o.createElementBlock("span",cn,o.toDisplayString(b.value.detail),1)):o.createCommentVNode("",!0)]),b.value.documentation?(o.openBlock(),o.createElementBlock("p",un,o.toDisplayString(b.value.documentation),1)):o.createCommentVNode("",!0),b.value.type?(o.openBlock(),o.createElementBlock("pre",dn,[o.createElementVNode("code",{innerHTML:yt(b.value.type)},null,8,fn)])):o.createCommentVNode("",!0)],4)):o.createCommentVNode("",!0)],512),n.collapsible?(o.openBlock(),o.createElementBlock("button",{key:1,type:"button",class:"expand-toggle",title:D.value?"收起":"展开","aria-label":D.value?"收起编辑器":"展开编辑器",onClick:vt},[D.value?(o.openBlock(),o.createElementBlock("svg",hn,[...l[2]||(l[2]=[o.createElementVNode("path",{d:"M11 2 5 8 11 14",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])])):(o.openBlock(),o.createElementBlock("svg",mn,[...l[1]||(l[1]=[o.createElementVNode("path",{d:"M6 2 12 8 6 14",fill:"none",stroke:"currentColor","stroke-width":"1.6","stroke-linecap":"round","stroke-linejoin":"round"},null,-1)])]))],8,pn)):o.createCommentVNode("",!0)],38)],6))}}),bn=(n,r)=>{const a=n.__vccOpts||n;for(const[e,i]of r)a[e]=i;return a},ut=bn(gn,[["__scopeId","data-v-3779a6df"]]),vn={install(n){n.component("CodeInput",ut)}};exports.CodeEditor=ut;exports.collectCompletions=tt;exports.default=vn;exports.defaultCompletions=Xe;exports.findArgumentContext=Je;exports.findTemplateRange=ce;exports.getKeywordSet=xe;exports.getKeywords=Te;exports.highlight=ee;exports.highlightTemplate=ct;exports.isInsideTemplate=Xt;exports.parseTsCompletions=st;exports.parseTsSignatures=rt;exports.resolveHoverItem=nt;exports.scanDeclarations=we;exports.tokenize=G;
|
package/dist/code-input.es.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { defineComponent as Dt, ref as E, computed as q, watch as Ze, nextTick as V, onMounted as jt, onBeforeUnmount as Ft, openBlock as
|
|
1
|
+
import { defineComponent as Dt, ref as E, computed as q, watch as Ze, nextTick as V, onMounted as jt, onBeforeUnmount as Ft, openBlock as I, createElementBlock as H, normalizeStyle as he, normalizeClass as ie, createElementVNode as A, withModifiers as Ue, Fragment as Ye, renderList as Xe, toDisplayString as Y, createCommentVNode as K, createTextVNode as Pt } from "vue";
|
|
2
2
|
const Vt = [
|
|
3
3
|
{
|
|
4
4
|
label: "Math",
|
|
@@ -256,10 +256,10 @@ const Je = [
|
|
|
256
256
|
function rt(n) {
|
|
257
257
|
return n === "typescript" ? [...Je, ...Zt] : Je;
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function Qe(n) {
|
|
260
260
|
return new Set(rt(n));
|
|
261
261
|
}
|
|
262
|
-
const Ut = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/,
|
|
262
|
+
const Ut = /((?:[A-Za-z_$][\w$]*\??\.)*)([A-Za-z_$][\w$]*)?$/, Ge = /\b(?:const|let|var|function|class)\s+([A-Za-z_$][\w$]*)/g, Yt = /^[A-Za-z_$]/;
|
|
263
263
|
function ct(n, s) {
|
|
264
264
|
const o = n.slice(0, s), e = Ut.exec(o);
|
|
265
265
|
if (!e) return { prefix: "", chain: [] };
|
|
@@ -269,7 +269,7 @@ function ct(n, s) {
|
|
|
269
269
|
function et(n, s) {
|
|
270
270
|
const o = [], e = /* @__PURE__ */ new Set();
|
|
271
271
|
let i;
|
|
272
|
-
for (
|
|
272
|
+
for (Ge.lastIndex = 0; (i = Ge.exec(n)) && !(i.index >= s); ) {
|
|
273
273
|
const r = i[1];
|
|
274
274
|
if (e.has(r)) continue;
|
|
275
275
|
e.add(r);
|
|
@@ -316,7 +316,7 @@ function Jt(n) {
|
|
|
316
316
|
s.has(e.label) || (s.add(e.label), o.push(e));
|
|
317
317
|
return o;
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function Qt(n, s, o) {
|
|
320
320
|
const { prefix: e, chain: i } = ct(n, s);
|
|
321
321
|
if (o.auto && (!e && i.length === 0 || e && !Yt.test(e)))
|
|
322
322
|
return null;
|
|
@@ -342,11 +342,11 @@ function Gt(n, s, o) {
|
|
|
342
342
|
end: s
|
|
343
343
|
};
|
|
344
344
|
}
|
|
345
|
-
const
|
|
345
|
+
const Gt = /([A-Za-z_$][\w$]*(?:\??\.[A-Za-z_$][\w$]*)*)\??\.\s*$/;
|
|
346
346
|
function en(n, s, o, e) {
|
|
347
347
|
const i = n.slice(s, o);
|
|
348
348
|
if (!i) return null;
|
|
349
|
-
const r = [...e.declared ?? [], ...e.completions], f =
|
|
349
|
+
const r = [...e.declared ?? [], ...e.completions], f = Gt.exec(n.slice(0, s));
|
|
350
350
|
if (f) {
|
|
351
351
|
const u = f[1].split(".").filter(Boolean).map((T) => T.replace(/\?$/, "")), a = ut(u, r), d = a == null ? void 0 : a.find((T) => T.label === i);
|
|
352
352
|
if (d) return d;
|
|
@@ -568,31 +568,31 @@ function dn(n) {
|
|
|
568
568
|
if (W && v.includes("{")) {
|
|
569
569
|
const w = J(u);
|
|
570
570
|
u = [];
|
|
571
|
-
const { end: $, body:
|
|
571
|
+
const { end: $, body: L } = nt(s, b), g = W[1];
|
|
572
572
|
o.set(g, {
|
|
573
573
|
label: g,
|
|
574
574
|
type: it(
|
|
575
575
|
s.slice(b, $ + 1).join(`
|
|
576
576
|
`).replace(/^\s*export\s+/, "")
|
|
577
577
|
),
|
|
578
|
-
members: ot(
|
|
578
|
+
members: ot(L),
|
|
579
579
|
kind: "interface",
|
|
580
580
|
documentation: w || void 0
|
|
581
581
|
}), oe(s, $), b = $;
|
|
582
582
|
continue;
|
|
583
583
|
}
|
|
584
|
-
const
|
|
585
|
-
if (
|
|
584
|
+
const N = r.exec(v);
|
|
585
|
+
if (N && v.includes("{")) {
|
|
586
586
|
const w = J(u);
|
|
587
587
|
u = [];
|
|
588
|
-
const { end: $, body:
|
|
588
|
+
const { end: $, body: L } = nt(s, b), g = N[1];
|
|
589
589
|
o.set(g, {
|
|
590
590
|
label: g,
|
|
591
591
|
type: it(
|
|
592
592
|
s.slice(b, $ + 1).join(`
|
|
593
593
|
`).replace(/^\s*export\s+/, "")
|
|
594
594
|
),
|
|
595
|
-
members: ot(
|
|
595
|
+
members: ot(L),
|
|
596
596
|
kind: "class",
|
|
597
597
|
documentation: w || void 0
|
|
598
598
|
}), oe(s, $), b = $;
|
|
@@ -603,10 +603,10 @@ function dn(n) {
|
|
|
603
603
|
const w = J(u);
|
|
604
604
|
u = [];
|
|
605
605
|
const $ = [s[b]];
|
|
606
|
-
let
|
|
606
|
+
let L = b;
|
|
607
607
|
for (; an($.join(`
|
|
608
|
-
`)) &&
|
|
609
|
-
|
|
608
|
+
`)) && L + 1 < s.length; )
|
|
609
|
+
L++, $.push(s[L]);
|
|
610
610
|
const g = $.join(`
|
|
611
611
|
`).replace(/^\s*export\s+/, "").replace(/;\s*$/, "").trim();
|
|
612
612
|
o.set(R[1], {
|
|
@@ -616,7 +616,7 @@ function dn(n) {
|
|
|
616
616
|
kind: "type",
|
|
617
617
|
documentation: w || void 0,
|
|
618
618
|
literals: ft(g)
|
|
619
|
-
}), oe(s,
|
|
619
|
+
}), oe(s, L), b = L;
|
|
620
620
|
continue;
|
|
621
621
|
}
|
|
622
622
|
u = [];
|
|
@@ -659,15 +659,15 @@ function dn(n) {
|
|
|
659
659
|
})), e.set(w, { name: w, params: on(W[2], o) });
|
|
660
660
|
continue;
|
|
661
661
|
}
|
|
662
|
-
const
|
|
663
|
-
if (
|
|
662
|
+
const N = S.exec(v);
|
|
663
|
+
if (N) {
|
|
664
664
|
oe(s, b);
|
|
665
665
|
const R = J(u);
|
|
666
666
|
u = [];
|
|
667
|
-
const w =
|
|
667
|
+
const w = N[1];
|
|
668
668
|
if (T.has(w)) continue;
|
|
669
669
|
T.add(w);
|
|
670
|
-
const $ =
|
|
670
|
+
const $ = N[2].trim(), L = pt($), g = L ? o.get(L) : void 0, se = (g == null ? void 0 : g.kind) === "class" ? "class" : /^\(|=>/.test($) ? "function" : "variable";
|
|
671
671
|
d.push({
|
|
672
672
|
label: w,
|
|
673
673
|
kind: se,
|
|
@@ -778,17 +778,17 @@ const pn = {
|
|
|
778
778
|
"<": "<",
|
|
779
779
|
">": ">"
|
|
780
780
|
};
|
|
781
|
-
function
|
|
781
|
+
function Q(n) {
|
|
782
782
|
return n.replace(/[&<>]/g, (s) => pn[s] ?? s);
|
|
783
783
|
}
|
|
784
784
|
function be(n, s, o = 0) {
|
|
785
785
|
let e = "", i = 0;
|
|
786
786
|
for (const r of s) {
|
|
787
|
-
r.start > i && (e +=
|
|
788
|
-
const f =
|
|
787
|
+
r.start > i && (e += Q(n.slice(i, r.start)));
|
|
788
|
+
const f = Q(n.slice(r.start, r.end));
|
|
789
789
|
e += `<span class="tok-${r.type}" data-start="${r.start + o}" data-end="${r.end + o}">${f}</span>`, i = r.end;
|
|
790
790
|
}
|
|
791
|
-
return i < n.length && (e +=
|
|
791
|
+
return i < n.length && (e += Q(n.slice(i))), e;
|
|
792
792
|
}
|
|
793
793
|
function mn(n, s, o, e) {
|
|
794
794
|
if (!o || !e) return be(n, ge(n, s));
|
|
@@ -796,12 +796,12 @@ function mn(n, s, o, e) {
|
|
|
796
796
|
for (; r < n.length; ) {
|
|
797
797
|
const f = n.indexOf(o, r);
|
|
798
798
|
if (f === -1) {
|
|
799
|
-
i +=
|
|
799
|
+
i += Q(n.slice(r));
|
|
800
800
|
break;
|
|
801
801
|
}
|
|
802
|
-
i +=
|
|
802
|
+
i += Q(n.slice(r, f));
|
|
803
803
|
const u = n.indexOf(e, f + o.length), a = u === -1 ? n.length : u, d = n.slice(f + o.length, a);
|
|
804
|
-
i += `<span class="tok-brace">${
|
|
804
|
+
i += `<span class="tok-brace">${Q(o)}</span>`, i += be(d, ge(d, s), f + o.length), u === -1 ? r = a : (i += `<span class="tok-brace">${Q(e)}</span>`, r = u + e.length);
|
|
805
805
|
}
|
|
806
806
|
return i;
|
|
807
807
|
}
|
|
@@ -886,7 +886,7 @@ const hn = {
|
|
|
886
886
|
"End",
|
|
887
887
|
"PageUp",
|
|
888
888
|
"PageDown"
|
|
889
|
-
]), a = E(e.modelValue), d = E(), T = E(), D = E(), S = E(), b = E(), v = E(), W = E(),
|
|
889
|
+
]), a = E(e.modelValue), d = E(), T = E(), D = E(), S = E(), b = E(), v = E(), W = E(), N = E([]), R = E(0), w = E(!1), $ = E({ start: 0, end: 0 }), L = E({}), g = E(null), se = E({}), gt = q(
|
|
890
890
|
() => e.tsTypes ? cn(e.tsTypes) : []
|
|
891
891
|
), bt = q(
|
|
892
892
|
() => e.tsTypes ? un(e.tsTypes) : /* @__PURE__ */ new Map()
|
|
@@ -898,7 +898,7 @@ const hn = {
|
|
|
898
898
|
() => e.mode === "template" ? [...e.templateCompletions, ...Ie.value] : Ie.value
|
|
899
899
|
), vt = q(() => {
|
|
900
900
|
const t = {
|
|
901
|
-
keywords:
|
|
901
|
+
keywords: Qe(e.language),
|
|
902
902
|
builtins: new Set(ve.value.map((l) => l.label))
|
|
903
903
|
};
|
|
904
904
|
return e.mode === "template" ? `${mn(a.value, t, e.templateOpen, e.templateClose)}
|
|
@@ -919,7 +919,7 @@ const hn = {
|
|
|
919
919
|
function Le(t) {
|
|
920
920
|
if (P.value === t) return;
|
|
921
921
|
const l = d.value;
|
|
922
|
-
t && l && (He = l.scrollTop), P.value = t, e.collapsible && (ye.value = !0), i(t ? "expand" : "collapse"),
|
|
922
|
+
t && l && (He = l.scrollTop), P.value = t, e.collapsible && (ye.value = !0), i(t ? "expand" : "collapse"), _(), F(), V(() => {
|
|
923
923
|
if (ke(), !P.value && l) {
|
|
924
924
|
const c = Math.max(0, l.scrollHeight - l.clientHeight);
|
|
925
925
|
l.scrollTop = Math.max(0, Math.min(He, c)), j(!0), document.activeElement === l && X();
|
|
@@ -937,7 +937,7 @@ const hn = {
|
|
|
937
937
|
Ze(
|
|
938
938
|
() => e.modelValue,
|
|
939
939
|
(t) => {
|
|
940
|
-
t !== a.value && (a.value = t,
|
|
940
|
+
t !== a.value && (a.value = t, _());
|
|
941
941
|
}
|
|
942
942
|
), Ze(a, () => {
|
|
943
943
|
V(() => j(!0));
|
|
@@ -948,15 +948,15 @@ const hn = {
|
|
|
948
948
|
function $t(t) {
|
|
949
949
|
return t ? be(
|
|
950
950
|
t,
|
|
951
|
-
ge(t, { keywords:
|
|
951
|
+
ge(t, { keywords: Qe("typescript"), builtins: /* @__PURE__ */ new Set() })
|
|
952
952
|
) : "";
|
|
953
953
|
}
|
|
954
|
-
let
|
|
954
|
+
let G = { top: 14, bottom: 14, left: 16, right: 16, lineHeight: 22 };
|
|
955
955
|
function ke() {
|
|
956
956
|
const t = d.value;
|
|
957
957
|
if (!t) return;
|
|
958
958
|
const l = window.getComputedStyle(t);
|
|
959
|
-
|
|
959
|
+
G = {
|
|
960
960
|
top: parseFloat(l.paddingTop) || 0,
|
|
961
961
|
bottom: parseFloat(l.paddingBottom) || 0,
|
|
962
962
|
left: parseFloat(l.paddingLeft) || 0,
|
|
@@ -978,21 +978,21 @@ const hn = {
|
|
|
978
978
|
if (!t) return;
|
|
979
979
|
const l = Oe();
|
|
980
980
|
if (!l) return;
|
|
981
|
-
const c = t.getBoundingClientRect(), p = t.offsetWidth ? c.width / t.offsetWidth : 1, h = t.offsetHeight ? c.height / t.offsetHeight : 1, m = t.clientHeight * h, x =
|
|
982
|
-
let
|
|
981
|
+
const c = t.getBoundingClientRect(), p = t.offsetWidth ? c.width / t.offsetWidth : 1, h = t.offsetHeight ? c.height / t.offsetHeight : 1, m = t.clientHeight * h, x = G.top * h, k = G.bottom * h, y = l.lineHeight * h, C = t.scrollTop * h, B = Math.max(0, t.scrollHeight * h - m), z = (re.value ? 8 : 14) * h;
|
|
982
|
+
let M = t.scrollTop;
|
|
983
983
|
if (re.value) {
|
|
984
984
|
const me = m - x - k, le = l.top + C - x - Math.max(0, (me - y) / 2);
|
|
985
|
-
|
|
985
|
+
M = Math.max(0, Math.min(le, B)) / h;
|
|
986
986
|
} else {
|
|
987
987
|
const me = x, Ee = m - k, le = l.top, Ke = le + y;
|
|
988
988
|
let Re = C;
|
|
989
|
-
le < me + z ? Re = C + (le - me - z) : Ke > Ee - z && (Re = C + (Ke - Ee + z)),
|
|
989
|
+
le < me + z ? Re = C + (le - me - z) : Ke > Ee - z && (Re = C + (Ke - Ee + z)), M = Math.max(0, Math.min(Re, B)) / h;
|
|
990
990
|
}
|
|
991
|
-
const
|
|
991
|
+
const O = t.clientWidth * p, te = G.left * p, U = G.right * p, Se = t.scrollLeft * p, de = l.left + Se, Wt = Se + te, zt = Se + O - U, fe = 8 * p;
|
|
992
992
|
let pe = t.scrollLeft;
|
|
993
|
-
de < Wt + fe ? pe = Math.max(0, (de - te - fe) / p) : de > zt - fe && (pe = Math.max(0, (de - te -
|
|
994
|
-
const Ve = Math.abs(
|
|
995
|
-
!Ve && !qe || (Ve && (t.scrollTop =
|
|
993
|
+
de < Wt + fe ? pe = Math.max(0, (de - te - fe) / p) : de > zt - fe && (pe = Math.max(0, (de - te - O + U + fe) / p));
|
|
994
|
+
const Ve = Math.abs(M - t.scrollTop) > 0.5, qe = Math.abs(pe - t.scrollLeft) > 0.5;
|
|
995
|
+
!Ve && !qe || (Ve && (t.scrollTop = M), qe && (t.scrollLeft = pe), j());
|
|
996
996
|
}
|
|
997
997
|
let Ae = [], Be = "", ce = 0, we = -1, xe = -1, Te = { x: 0, y: 0 };
|
|
998
998
|
function Ct() {
|
|
@@ -1023,9 +1023,9 @@ const hn = {
|
|
|
1023
1023
|
function Et(t) {
|
|
1024
1024
|
const l = W.value, c = d.value;
|
|
1025
1025
|
if (!l || !c) return;
|
|
1026
|
-
const p = c.getBoundingClientRect(), h = p.left + t.left - c.scrollLeft, m = p.left + t.right - c.scrollLeft, x = p.top + t.top - c.scrollTop, k = p.top + t.bottom - c.scrollTop, y = 12, C = 8,
|
|
1027
|
-
let
|
|
1028
|
-
|
|
1026
|
+
const p = c.getBoundingClientRect(), h = p.left + t.left - c.scrollLeft, m = p.left + t.right - c.scrollLeft, x = p.top + t.top - c.scrollTop, k = p.top + t.bottom - c.scrollTop, y = 12, C = 8, B = l.offsetWidth, z = l.offsetHeight;
|
|
1027
|
+
let M = h, O = k + C;
|
|
1028
|
+
M + B > window.innerWidth - y && (M = m - B), O + z > window.innerHeight - y && (O = x - z - C), M = Math.max(y, Math.min(M, window.innerWidth - y - B)), O = Math.max(y, O), se.value = { left: `${M}px`, top: `${O}px` };
|
|
1029
1029
|
}
|
|
1030
1030
|
function Rt(t, l) {
|
|
1031
1031
|
const c = d.value;
|
|
@@ -1100,10 +1100,10 @@ const hn = {
|
|
|
1100
1100
|
x.textContent = "", c.appendChild(x), document.body.appendChild(c);
|
|
1101
1101
|
const k = x.getBoundingClientRect();
|
|
1102
1102
|
document.body.removeChild(c);
|
|
1103
|
-
const y = parseFloat(l.lineHeight) || 22, C = k.height,
|
|
1103
|
+
const y = parseFloat(l.lineHeight) || 22, C = k.height, B = C > 0 && C < y ? (y - C) / 2 : 0;
|
|
1104
1104
|
return {
|
|
1105
1105
|
left: k.left - m.left - t.scrollLeft,
|
|
1106
|
-
top: k.top - m.top - t.scrollTop -
|
|
1106
|
+
top: k.top - m.top - t.scrollTop - B,
|
|
1107
1107
|
lineHeight: y
|
|
1108
1108
|
};
|
|
1109
1109
|
}
|
|
@@ -1111,23 +1111,23 @@ const hn = {
|
|
|
1111
1111
|
await V();
|
|
1112
1112
|
const t = T.value, l = v.value, c = Oe();
|
|
1113
1113
|
if (!t || !l || !c) return;
|
|
1114
|
-
const p = 4, h = 8, m = window.innerWidth, x = window.innerHeight, k = t.getBoundingClientRect(), y = l.scrollHeight, C = x - (k.top + c.top + c.lineHeight) - p - h,
|
|
1114
|
+
const p = 4, h = 8, m = window.innerWidth, x = window.innerHeight, k = t.getBoundingClientRect(), y = l.scrollHeight, C = x - (k.top + c.top + c.lineHeight) - p - h, B = k.top + c.top - p - h, z = C >= Math.min(y, 180) || C >= B, M = Math.min(248, Math.max(z ? C : B, 96)), O = Math.min(y, M), te = l.offsetWidth || 280;
|
|
1115
1115
|
let U = c.left;
|
|
1116
|
-
k.left + U + te > m - h && (U = m - h - te - k.left), U = Math.max(U, h - k.left),
|
|
1116
|
+
k.left + U + te > m - h && (U = m - h - te - k.left), U = Math.max(U, h - k.left), L.value = {
|
|
1117
1117
|
left: `${U}px`,
|
|
1118
|
-
top: `${z ? c.top + c.lineHeight + p : c.top - p -
|
|
1119
|
-
maxHeight: `${
|
|
1118
|
+
top: `${z ? c.top + c.lineHeight + p : c.top - p - O}px`,
|
|
1119
|
+
maxHeight: `${M}px`
|
|
1120
1120
|
};
|
|
1121
1121
|
}
|
|
1122
|
-
function
|
|
1123
|
-
w.value = !1,
|
|
1122
|
+
function _() {
|
|
1123
|
+
w.value = !1, N.value = [], R.value = 0, F();
|
|
1124
1124
|
}
|
|
1125
1125
|
function ne(t = !1) {
|
|
1126
1126
|
var k;
|
|
1127
1127
|
const l = d.value;
|
|
1128
1128
|
if (!l || e.readonly) return;
|
|
1129
1129
|
if (l.selectionStart !== l.selectionEnd) {
|
|
1130
|
-
|
|
1130
|
+
_();
|
|
1131
1131
|
return;
|
|
1132
1132
|
}
|
|
1133
1133
|
const c = l.selectionStart;
|
|
@@ -1136,14 +1136,17 @@ const hn = {
|
|
|
1136
1136
|
if (h) {
|
|
1137
1137
|
const y = (k = bt.value.get(h.functionName)) == null ? void 0 : k.params[h.paramIndex], C = (y == null ? void 0 : y.literals) ?? [];
|
|
1138
1138
|
if (C.length) {
|
|
1139
|
-
const
|
|
1140
|
-
label:
|
|
1139
|
+
const B = h.quote, z = C.map((O) => ({
|
|
1140
|
+
label: `'${O}'`,
|
|
1141
1141
|
kind: "value",
|
|
1142
1142
|
detail: y == null ? void 0 : y.type,
|
|
1143
|
-
insertText:
|
|
1144
|
-
})),
|
|
1145
|
-
if (
|
|
1146
|
-
|
|
1143
|
+
insertText: B ? O : `'${O}'`
|
|
1144
|
+
})), M = dt(z, h.prefix);
|
|
1145
|
+
if (M.length) {
|
|
1146
|
+
N.value = M, $.value = {
|
|
1147
|
+
start: B ? h.replaceStart + 1 : h.replaceStart,
|
|
1148
|
+
end: c
|
|
1149
|
+
}, R.value = 0, w.value = !0, Ne();
|
|
1147
1150
|
return;
|
|
1148
1151
|
}
|
|
1149
1152
|
}
|
|
@@ -1156,19 +1159,19 @@ const hn = {
|
|
|
1156
1159
|
e.templateClose
|
|
1157
1160
|
);
|
|
1158
1161
|
if (!y) {
|
|
1159
|
-
|
|
1162
|
+
_();
|
|
1160
1163
|
return;
|
|
1161
1164
|
}
|
|
1162
1165
|
t && l.value.slice(y.start, c).trim() === "" && (p = !0);
|
|
1163
1166
|
}
|
|
1164
|
-
const m =
|
|
1167
|
+
const m = Qt(l.value, c, {
|
|
1165
1168
|
language: e.language,
|
|
1166
1169
|
completions: ve.value,
|
|
1167
1170
|
declared: et(l.value, c),
|
|
1168
1171
|
auto: !p
|
|
1169
1172
|
});
|
|
1170
1173
|
if (!m) {
|
|
1171
|
-
|
|
1174
|
+
_();
|
|
1172
1175
|
return;
|
|
1173
1176
|
}
|
|
1174
1177
|
let x = m.items;
|
|
@@ -1182,11 +1185,11 @@ const hn = {
|
|
|
1182
1185
|
mode: e.mode,
|
|
1183
1186
|
language: e.language
|
|
1184
1187
|
}), x.length === 0) {
|
|
1185
|
-
|
|
1188
|
+
_();
|
|
1186
1189
|
return;
|
|
1187
1190
|
}
|
|
1188
1191
|
}
|
|
1189
|
-
|
|
1192
|
+
N.value = x, $.value = { start: m.start, end: m.end }, R.value = 0, w.value = !0, Ne();
|
|
1190
1193
|
}
|
|
1191
1194
|
function It(t) {
|
|
1192
1195
|
a.value = t, i("update:modelValue", t), i("change", t);
|
|
@@ -1195,17 +1198,17 @@ const hn = {
|
|
|
1195
1198
|
const h = d.value;
|
|
1196
1199
|
if (!h) return;
|
|
1197
1200
|
const m = h.value.slice(0, t) + c + h.value.slice(l);
|
|
1198
|
-
It(m),
|
|
1201
|
+
It(m), _(), V(() => {
|
|
1199
1202
|
h.value = m, h.setSelectionRange(p, p), h.focus(), j(!0), X();
|
|
1200
1203
|
});
|
|
1201
1204
|
}
|
|
1202
|
-
function We(t =
|
|
1205
|
+
function We(t = N.value[R.value]) {
|
|
1203
1206
|
if (!t) return;
|
|
1204
1207
|
const l = t.insertText ?? t.label;
|
|
1205
|
-
ue($.value.start, $.value.end, l),
|
|
1208
|
+
ue($.value.start, $.value.end, l), _();
|
|
1206
1209
|
}
|
|
1207
1210
|
function ze(t) {
|
|
1208
|
-
const l =
|
|
1211
|
+
const l = N.value.length;
|
|
1209
1212
|
l && (R.value = (R.value + t + l) % l, V(() => {
|
|
1210
1213
|
var c, p;
|
|
1211
1214
|
(p = (c = v.value) == null ? void 0 : c.querySelector(".is-active")) == null || p.scrollIntoView({ block: "nearest" });
|
|
@@ -1216,7 +1219,7 @@ const hn = {
|
|
|
1216
1219
|
a.value = l.value, i("update:modelValue", l.value), i("change", l.value), F(), j(), X(), V(X), ne(!0);
|
|
1217
1220
|
}
|
|
1218
1221
|
function Lt(t) {
|
|
1219
|
-
if (
|
|
1222
|
+
if (_(), F(), !e.collapsible || !e.collapseOnBlur || !P.value) return;
|
|
1220
1223
|
const l = t.relatedTarget;
|
|
1221
1224
|
l && l.closest(".expand-toggle") || Le(!1);
|
|
1222
1225
|
}
|
|
@@ -1227,7 +1230,7 @@ const hn = {
|
|
|
1227
1230
|
const t = d.value;
|
|
1228
1231
|
if (!t || e.readonly) return;
|
|
1229
1232
|
if (t.selectionStart !== t.selectionEnd) {
|
|
1230
|
-
|
|
1233
|
+
_();
|
|
1231
1234
|
return;
|
|
1232
1235
|
}
|
|
1233
1236
|
const l = t.selectionStart;
|
|
@@ -1247,7 +1250,7 @@ const hn = {
|
|
|
1247
1250
|
return;
|
|
1248
1251
|
}
|
|
1249
1252
|
}
|
|
1250
|
-
|
|
1253
|
+
_();
|
|
1251
1254
|
}
|
|
1252
1255
|
let $e = 0;
|
|
1253
1256
|
function je() {
|
|
@@ -1256,7 +1259,7 @@ const hn = {
|
|
|
1256
1259
|
}, 0);
|
|
1257
1260
|
}
|
|
1258
1261
|
function Fe(t) {
|
|
1259
|
-
t.target !== d.value && w.value &&
|
|
1262
|
+
t.target !== d.value && w.value && _();
|
|
1260
1263
|
}
|
|
1261
1264
|
function At() {
|
|
1262
1265
|
F(), j(), re.value && Bt();
|
|
@@ -1270,7 +1273,7 @@ const hn = {
|
|
|
1270
1273
|
function Ot() {
|
|
1271
1274
|
const t = d.value;
|
|
1272
1275
|
if (!t) return;
|
|
1273
|
-
const l =
|
|
1276
|
+
const l = G.lineHeight, c = t.scrollTop, p = Math.round(c / l) * l;
|
|
1274
1277
|
Math.abs(p - c) < 0.5 || (t.scrollTop = p, j());
|
|
1275
1278
|
}
|
|
1276
1279
|
function Nt(t) {
|
|
@@ -1296,11 +1299,11 @@ const hn = {
|
|
|
1296
1299
|
return;
|
|
1297
1300
|
}
|
|
1298
1301
|
if (t.key === "Escape") {
|
|
1299
|
-
t.preventDefault(),
|
|
1302
|
+
t.preventDefault(), _();
|
|
1300
1303
|
return;
|
|
1301
1304
|
}
|
|
1302
1305
|
if (p || c) {
|
|
1303
|
-
|
|
1306
|
+
_(), p && !c && je();
|
|
1304
1307
|
return;
|
|
1305
1308
|
}
|
|
1306
1309
|
}
|
|
@@ -1329,7 +1332,7 @@ ${y}${C}`);
|
|
|
1329
1332
|
}
|
|
1330
1333
|
}
|
|
1331
1334
|
function Pe() {
|
|
1332
|
-
w.value &&
|
|
1335
|
+
w.value && _(), F(), V(() => {
|
|
1333
1336
|
ke(), j(!0);
|
|
1334
1337
|
});
|
|
1335
1338
|
}
|
|
@@ -1345,11 +1348,11 @@ ${y}${C}`);
|
|
|
1345
1348
|
}), s({ focus: () => {
|
|
1346
1349
|
var t;
|
|
1347
1350
|
return (t = d.value) == null ? void 0 : t.focus();
|
|
1348
|
-
} }), (t, l) => (
|
|
1351
|
+
} }), (t, l) => (I(), H("div", {
|
|
1349
1352
|
class: ie(["code-input", { "is-collapsible": n.collapsible }]),
|
|
1350
1353
|
style: he(kt.value)
|
|
1351
1354
|
}, [
|
|
1352
|
-
|
|
1355
|
+
A("div", {
|
|
1353
1356
|
class: ie(["code-editor", {
|
|
1354
1357
|
"is-readonly": n.readonly,
|
|
1355
1358
|
"is-dark": n.theme === "dark",
|
|
@@ -1359,37 +1362,37 @@ ${y}${C}`);
|
|
|
1359
1362
|
style: he(wt.value),
|
|
1360
1363
|
onAnimationend: Ue(xt, ["self"])
|
|
1361
1364
|
}, [
|
|
1362
|
-
n.lineNumbers ? (
|
|
1363
|
-
|
|
1365
|
+
n.lineNumbers ? (I(), H("div", hn, [
|
|
1366
|
+
A("div", {
|
|
1364
1367
|
ref_key: "gutterInner",
|
|
1365
1368
|
ref: b,
|
|
1366
1369
|
class: "gutter-inner code-font"
|
|
1367
1370
|
}, [
|
|
1368
|
-
(
|
|
1371
|
+
(I(!0), H(Ye, null, Xe(yt.value, (c) => (I(), H("div", {
|
|
1369
1372
|
key: c,
|
|
1370
1373
|
class: "gutter-line"
|
|
1371
1374
|
}, Y(c), 1))), 128))
|
|
1372
1375
|
], 512)
|
|
1373
1376
|
])) : K("", !0),
|
|
1374
|
-
|
|
1377
|
+
A("div", {
|
|
1375
1378
|
ref_key: "stage",
|
|
1376
1379
|
ref: T,
|
|
1377
1380
|
class: "stage"
|
|
1378
1381
|
}, [
|
|
1379
|
-
|
|
1382
|
+
A("div", {
|
|
1380
1383
|
ref_key: "highlightLayer",
|
|
1381
1384
|
ref: D,
|
|
1382
1385
|
class: "highlight code-font"
|
|
1383
1386
|
}, [
|
|
1384
|
-
|
|
1387
|
+
A("pre", {
|
|
1385
1388
|
ref_key: "highlightInner",
|
|
1386
1389
|
ref: S,
|
|
1387
1390
|
class: "code-font"
|
|
1388
1391
|
}, [
|
|
1389
|
-
|
|
1392
|
+
A("code", { innerHTML: vt.value }, null, 8, gn)
|
|
1390
1393
|
], 512)
|
|
1391
1394
|
], 512),
|
|
1392
|
-
|
|
1395
|
+
A("textarea", {
|
|
1393
1396
|
ref_key: "textarea",
|
|
1394
1397
|
ref: d,
|
|
1395
1398
|
class: "code-font input",
|
|
@@ -1409,54 +1412,54 @@ ${y}${C}`);
|
|
|
1409
1412
|
onMouseleave: F,
|
|
1410
1413
|
onBlur: Lt
|
|
1411
1414
|
}, null, 40, bn),
|
|
1412
|
-
w.value ? (
|
|
1415
|
+
w.value ? (I(), H("ul", {
|
|
1413
1416
|
key: 0,
|
|
1414
1417
|
ref_key: "popup",
|
|
1415
1418
|
ref: v,
|
|
1416
1419
|
class: "popup",
|
|
1417
|
-
style: he(
|
|
1420
|
+
style: he(L.value),
|
|
1418
1421
|
onMousedown: l[0] || (l[0] = Ue(() => {
|
|
1419
1422
|
}, ["prevent"]))
|
|
1420
1423
|
}, [
|
|
1421
|
-
(
|
|
1424
|
+
(I(!0), H(Ye, null, Xe(N.value, (c, p) => (I(), H("li", {
|
|
1422
1425
|
key: `${c.label}-${p}`,
|
|
1423
1426
|
class: ie(["popup-item", { "is-active": p === R.value }]),
|
|
1424
1427
|
onMouseenter: (h) => R.value = p,
|
|
1425
1428
|
onClick: (h) => We(c)
|
|
1426
1429
|
}, [
|
|
1427
|
-
|
|
1430
|
+
A("span", {
|
|
1428
1431
|
class: ie(["badge", `badge-${c.kind}`])
|
|
1429
1432
|
}, Y(_e(c.kind)), 3),
|
|
1430
|
-
|
|
1431
|
-
c.detail ? (
|
|
1433
|
+
A("span", yn, Y(c.label), 1),
|
|
1434
|
+
c.detail ? (I(), H("span", kn, Y(c.detail), 1)) : K("", !0)
|
|
1432
1435
|
], 42, vn))), 128))
|
|
1433
1436
|
], 36)) : K("", !0),
|
|
1434
|
-
g.value ? (
|
|
1437
|
+
g.value ? (I(), H("div", {
|
|
1435
1438
|
key: 1,
|
|
1436
1439
|
ref_key: "hoverCard",
|
|
1437
1440
|
ref: W,
|
|
1438
1441
|
class: "hover-card",
|
|
1439
1442
|
style: he(se.value)
|
|
1440
1443
|
}, [
|
|
1441
|
-
|
|
1442
|
-
|
|
1444
|
+
A("div", wn, [
|
|
1445
|
+
A("span", {
|
|
1443
1446
|
class: ie(["badge", `badge-${g.value.kind}`])
|
|
1444
1447
|
}, Y(_e(g.value.kind)), 3),
|
|
1445
|
-
|
|
1448
|
+
A("span", xn, [
|
|
1446
1449
|
Pt(Y(g.value.label), 1),
|
|
1447
|
-
g.value.detail ? (
|
|
1450
|
+
g.value.detail ? (I(), H("span", Tn, ":")) : K("", !0)
|
|
1448
1451
|
]),
|
|
1449
|
-
g.value.detail ? (
|
|
1452
|
+
g.value.detail ? (I(), H("span", $n, Y(g.value.detail), 1)) : K("", !0)
|
|
1450
1453
|
]),
|
|
1451
|
-
g.value.documentation ? (
|
|
1452
|
-
g.value.type ? (
|
|
1453
|
-
|
|
1454
|
+
g.value.documentation ? (I(), H("p", Cn, Y(g.value.documentation), 1)) : K("", !0),
|
|
1455
|
+
g.value.type ? (I(), H("pre", Sn, [
|
|
1456
|
+
A("code", {
|
|
1454
1457
|
innerHTML: $t(g.value.type)
|
|
1455
1458
|
}, null, 8, En)
|
|
1456
1459
|
])) : K("", !0)
|
|
1457
1460
|
], 4)) : K("", !0)
|
|
1458
1461
|
], 512),
|
|
1459
|
-
n.collapsible ? (
|
|
1462
|
+
n.collapsible ? (I(), H("button", {
|
|
1460
1463
|
key: 1,
|
|
1461
1464
|
type: "button",
|
|
1462
1465
|
class: "expand-toggle",
|
|
@@ -1464,8 +1467,8 @@ ${y}${C}`);
|
|
|
1464
1467
|
"aria-label": P.value ? "收起编辑器" : "展开编辑器",
|
|
1465
1468
|
onClick: Tt
|
|
1466
1469
|
}, [
|
|
1467
|
-
P.value ? (
|
|
1468
|
-
|
|
1470
|
+
P.value ? (I(), H("svg", In, [...l[2] || (l[2] = [
|
|
1471
|
+
A("path", {
|
|
1469
1472
|
d: "M11 2 5 8 11 14",
|
|
1470
1473
|
fill: "none",
|
|
1471
1474
|
stroke: "currentColor",
|
|
@@ -1473,8 +1476,8 @@ ${y}${C}`);
|
|
|
1473
1476
|
"stroke-linecap": "round",
|
|
1474
1477
|
"stroke-linejoin": "round"
|
|
1475
1478
|
}, null, -1)
|
|
1476
|
-
])])) : (
|
|
1477
|
-
|
|
1479
|
+
])])) : (I(), H("svg", Mn, [...l[1] || (l[1] = [
|
|
1480
|
+
A("path", {
|
|
1478
1481
|
d: "M6 2 12 8 6 14",
|
|
1479
1482
|
fill: "none",
|
|
1480
1483
|
stroke: "currentColor",
|
|
@@ -1492,19 +1495,19 @@ ${y}${C}`);
|
|
|
1492
1495
|
for (const [e, i] of s)
|
|
1493
1496
|
o[e] = i;
|
|
1494
1497
|
return o;
|
|
1495
|
-
}, _n = /* @__PURE__ */ Ln(Hn, [["__scopeId", "data-v-
|
|
1498
|
+
}, _n = /* @__PURE__ */ Ln(Hn, [["__scopeId", "data-v-3779a6df"]]), On = {
|
|
1496
1499
|
install(n) {
|
|
1497
1500
|
n.component("CodeInput", _n);
|
|
1498
1501
|
}
|
|
1499
1502
|
};
|
|
1500
1503
|
export {
|
|
1501
1504
|
_n as CodeEditor,
|
|
1502
|
-
|
|
1505
|
+
Qt as collectCompletions,
|
|
1503
1506
|
On as default,
|
|
1504
1507
|
Vt as defaultCompletions,
|
|
1505
1508
|
Kt as findArgumentContext,
|
|
1506
1509
|
Me as findTemplateRange,
|
|
1507
|
-
|
|
1510
|
+
Qe as getKeywordSet,
|
|
1508
1511
|
rt as getKeywords,
|
|
1509
1512
|
be as highlight,
|
|
1510
1513
|
mn as highlightTemplate,
|
package/dist/style.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.code-input[data-v-e1c19d60],.code-input[data-v-e1c19d60] *,.code-input[data-v-e1c19d60] *:before,.code-input[data-v-e1c19d60] *:after{box-sizing:border-box}.code-input[data-v-e1c19d60]{position:relative}.code-input.is-collapsible>.code-editor[data-v-e1c19d60]{position:absolute;top:0;left:0;width:100%;transition:height .24s ease,box-shadow .24s ease}.code-input.is-collapsible>.code-editor[data-v-e1c19d60]:not(.is-collapsed){z-index:40;box-shadow:0 16px 40px #172a542e}.code-editor.is-expanding[data-v-e1c19d60]{animation:ce-pop-e1c19d60 .24s ease}@keyframes ce-pop-e1c19d60{0%{transform:scale(.97);opacity:.55}to{transform:scale(1);opacity:1}}.code-editor[data-v-e1c19d60]{position:relative;display:flex;align-items:stretch;border:1px solid var(--ce-border);border-radius:var(--ce-radius, 4px);background:var(--ce-bg);color:var(--ce-text);transition:border-color .18s ease,box-shadow .18s ease,background .18s ease;--ce-bg: #fbfcff;--ce-border: #dbe2ef;--ce-border-focus: #6b93ff;--ce-ring: rgba(88, 132, 255, .16);--ce-text: #1f2937;--ce-caret: #2f6bff;--ce-placeholder: #b3bdcc;--ce-selection: rgba(47, 107, 255, .18);--ce-gutter-bg: #f3f6fc;--ce-gutter-border: #e7ecf5;--ce-gutter-text: #a6b1c2;--ce-panel-bg: #ffffff;--ce-panel-border: #e4eaf5;--ce-panel-shadow: 0 16px 36px rgba(23, 42, 84, .16);--ce-item-active: #edf3ff;--ce-item-text: #0f172a;--ce-item-detail: #94a3b8;--ce-hover-text: #0f172a;--ce-hover-doc: #5b6b82;--ce-hover-type: #4b5b72;--ce-hover-colon: #94a3b8;--ce-def-border: #93b0ff;--ce-def-bg: linear-gradient(180deg, #f6f8fd 0%, #f1f5fc 100%);--ce-def-text: #334155;--ce-toggle-bg: rgba(255, 255, 255, .92);--ce-toggle-border: #dbe2ef;--ce-toggle-fg: #64748b;--ce-toggle-hover-bg: #eef3ff;--ce-toggle-hover-fg: #2f6bff;--ce-tok-keyword: #c026d3;--ce-tok-builtin: #0b7a75;--ce-tok-string: #b45309;--ce-tok-number: #2563eb;--ce-tok-comment: #9aa7b8;--ce-tok-punct: #64748b;--ce-tok-brace: #a855f7;--ce-badge-var-fg: #1d4ed8;--ce-badge-var-bg: #e3ecff;--ce-badge-fn-fg: #7c3aed;--ce-badge-fn-bg: #f0e7ff;--ce-badge-prop-fg: #0f766e;--ce-badge-prop-bg: #d9f5ef;--ce-badge-class-fg: #b45309;--ce-badge-class-bg: #fdf0d8;--ce-badge-kw-fg: #475569;--ce-badge-kw-bg: #eef1f6;--ce-badge-value-fg: #0e7490;--ce-badge-value-bg: #d8f3fa;--ce-scrollbar-thumb: rgba(100, 116, 139, .35);--ce-scrollbar-thumb-hover: rgba(100, 116, 139, .6);--ce-pad-y: 14px;--ce-pad-x: 16px;--ce-line-height: 22px}.code-editor.is-dark[data-v-e1c19d60]{--ce-bg: #1b1f27;--ce-border: #2e3644;--ce-border-focus: #6ea8ff;--ce-ring: rgba(110, 168, 255, .25);--ce-text: #d6dbe6;--ce-caret: #7cb0ff;--ce-placeholder: #565f72;--ce-selection: rgba(110, 168, 255, .28);--ce-gutter-bg: #171b22;--ce-gutter-border: #262d39;--ce-gutter-text: #566076;--ce-panel-bg: #232833;--ce-panel-border: #333c4c;--ce-panel-shadow: 0 16px 36px rgba(0, 0, 0, .45);--ce-item-active: #2d3648;--ce-item-text: #e6ebf5;--ce-item-detail: #7d879b;--ce-hover-text: #e6ebf5;--ce-hover-doc: #9aa5b8;--ce-hover-type: #b6c0d2;--ce-hover-colon: #7d879b;--ce-def-border: #4a72c0;--ce-def-bg: linear-gradient(180deg, #20252f 0%, #1c212a 100%);--ce-def-text: #c6cedd;--ce-toggle-bg: rgba(38, 45, 58, .92);--ce-toggle-border: #333c4c;--ce-toggle-fg: #8b95a8;--ce-toggle-hover-bg: #2d3648;--ce-toggle-hover-fg: #7cb0ff;--ce-tok-keyword: #c586c0;--ce-tok-builtin: #4ec9b0;--ce-tok-string: #ce9178;--ce-tok-number: #b5cea8;--ce-tok-comment: #6a9955;--ce-tok-punct: #8b95a8;--ce-tok-brace: #d18fd0;--ce-badge-var-fg: #9bb8ff;--ce-badge-var-bg: rgba(90, 130, 255, .18);--ce-badge-fn-fg: #c4a6ff;--ce-badge-fn-bg: rgba(150, 110, 255, .2);--ce-badge-prop-fg: #6fe0d0;--ce-badge-prop-bg: rgba(20, 190, 170, .16);--ce-badge-class-fg: #f2c078;--ce-badge-class-bg: rgba(230, 160, 40, .16);--ce-badge-kw-fg: #aab4c6;--ce-badge-kw-bg: rgba(150, 165, 190, .14);--ce-badge-value-fg: #7dd3fc;--ce-badge-value-bg: rgba(56, 189, 248, .16);--ce-scrollbar-thumb: rgba(148, 163, 184, .35);--ce-scrollbar-thumb-hover: rgba(148, 163, 184, .6)}.code-editor[data-v-e1c19d60]:focus-within{border-color:var(--ce-border-focus);box-shadow:0 0 0 3px var(--ce-ring)}.code-font[data-v-e1c19d60]{margin:0;font-family:JetBrains Mono,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace;font-size:13.5px;line-height:var(--ce-line-height);letter-spacing:0;-moz-tab-size:2;tab-size:2;white-space:pre;overflow-wrap:normal;word-break:normal}.is-collapsed .input[data-v-e1c19d60],.is-collapsed .highlight pre[data-v-e1c19d60]{padding-top:0;padding-bottom:0;line-height:var(--ce-collapsed-height, 34px);white-space:pre}.code-input.is-collapsible .stage[data-v-e1c19d60]{transition:margin .24s ease}.code-input.is-collapsible .code-editor.is-collapsed .stage[data-v-e1c19d60]{margin-right:46px}.code-input.is-collapsible .code-editor:not(.is-collapsed) .stage[data-v-e1c19d60]{margin-bottom:46px}.is-collapsed .input[data-v-e1c19d60]{scrollbar-width:none}.is-collapsed .input[data-v-e1c19d60]::-webkit-scrollbar{display:none}.gutter[data-v-e1c19d60]{flex:none;width:44px;padding:14px 10px;border-right:1px solid var(--ce-gutter-border);border-radius:var(--ce-radius, 4px) 0 0 var(--ce-radius, 4px);background:var(--ce-gutter-bg);color:var(--ce-gutter-text);text-align:right;-webkit-user-select:none;user-select:none;overflow:hidden;transition:width .24s ease,padding .24s ease,opacity .24s ease,border-right-width .24s ease,background .18s ease,color .18s ease}.is-collapsed .gutter[data-v-e1c19d60]{width:0;padding:0;border-right-width:0;opacity:0}.gutter-line[data-v-e1c19d60]{padding-right:2px}.stage[data-v-e1c19d60]{position:relative;flex:1;min-width:0}.highlight[data-v-e1c19d60]{position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden;pointer-events:none}.highlight pre[data-v-e1c19d60]{margin:0;padding:var(--ce-pad-y) var(--ce-pad-x);font:inherit;white-space:inherit;overflow-wrap:inherit;word-break:inherit;-moz-tab-size:inherit;tab-size:inherit;color:var(--ce-text);will-change:transform;transition:padding .24s ease,line-height .24s ease}.input[data-v-e1c19d60]{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;margin:0;padding:var(--ce-pad-y) var(--ce-pad-x);border:0;outline:none;resize:none;background:transparent;color:transparent;caret-color:var(--ce-caret);-webkit-text-fill-color:transparent;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ce-scrollbar-thumb) transparent;transition:padding .24s ease,line-height .24s ease}.input[data-v-e1c19d60]::-webkit-scrollbar{width:8px;height:8px}.input[data-v-e1c19d60]::-webkit-scrollbar-track{background:transparent}.input[data-v-e1c19d60]::-webkit-scrollbar-thumb{background:var(--ce-scrollbar-thumb);background-clip:padding-box;border:2px solid transparent;border-radius:8px}.input[data-v-e1c19d60]::-webkit-scrollbar-thumb:hover{background:var(--ce-scrollbar-thumb-hover);background-clip:padding-box;border:2px solid transparent}.input[data-v-e1c19d60]::-webkit-scrollbar-corner{background:transparent}.input[data-v-e1c19d60]::placeholder{color:var(--ce-placeholder);-webkit-text-fill-color:var(--ce-placeholder)}.input[data-v-e1c19d60]::selection{background:var(--ce-selection)}.is-readonly .input[data-v-e1c19d60]{cursor:default}.expand-toggle[data-v-e1c19d60]{position:absolute;right:10px;top:calc(100% - 36px);z-index:30;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:1px solid var(--ce-toggle-border);border-radius:7px;background:var(--ce-toggle-bg);color:var(--ce-toggle-fg);cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease,top .24s ease}.expand-toggle[data-v-e1c19d60]:hover{background:var(--ce-toggle-hover-bg);color:var(--ce-toggle-hover-fg);border-color:var(--ce-toggle-hover-fg)}.is-collapsed .expand-toggle[data-v-e1c19d60]{top:calc(50% - 13px)}.popup[data-v-e1c19d60]{position:absolute;z-index:60;min-width:220px;max-width:360px;max-height:248px;margin:0;padding:6px;overflow:auto;list-style:none;background:var(--ce-panel-bg);border:1px solid var(--ce-panel-border);border-radius:10px;box-shadow:var(--ce-panel-shadow)}.popup-item[data-v-e1c19d60]{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:6px;font-size:13px;line-height:20px;white-space:nowrap;cursor:pointer}.popup-item.is-active[data-v-e1c19d60]{background:var(--ce-item-active)}.badge[data-v-e1c19d60]{flex:none;min-width:42px;padding:2px 6px;border-radius:4px;font-size:10px;font-weight:600;text-align:center;white-space:nowrap}.badge-variable[data-v-e1c19d60]{color:var(--ce-badge-var-fg);background:var(--ce-badge-var-bg)}.badge-function[data-v-e1c19d60]{color:var(--ce-badge-fn-fg);background:var(--ce-badge-fn-bg)}.badge-property[data-v-e1c19d60]{color:var(--ce-badge-prop-fg);background:var(--ce-badge-prop-bg)}.badge-class[data-v-e1c19d60]{color:var(--ce-badge-class-fg);background:var(--ce-badge-class-bg)}.badge-keyword[data-v-e1c19d60]{color:var(--ce-badge-kw-fg);background:var(--ce-badge-kw-bg)}.badge-value[data-v-e1c19d60]{color:var(--ce-badge-value-fg);background:var(--ce-badge-value-bg)}.popup-label[data-v-e1c19d60]{color:var(--ce-item-text)}.popup-detail[data-v-e1c19d60]{margin-left:auto;overflow:hidden;color:var(--ce-item-detail);font-size:11px;text-overflow:ellipsis}.highlight[data-v-e1c19d60] .tok-keyword{color:var(--ce-tok-keyword);font-weight:600}.highlight[data-v-e1c19d60] .tok-builtin{color:var(--ce-tok-builtin)}.highlight[data-v-e1c19d60] .tok-string,.highlight[data-v-e1c19d60] .tok-template{color:var(--ce-tok-string)}.highlight[data-v-e1c19d60] .tok-number{color:var(--ce-tok-number)}.highlight[data-v-e1c19d60] .tok-comment{color:var(--ce-tok-comment);font-style:italic}.highlight[data-v-e1c19d60] .tok-punctuation{color:var(--ce-tok-punct)}.highlight[data-v-e1c19d60] .tok-brace{color:var(--ce-tok-brace);font-weight:600}.hover-card[data-v-e1c19d60]{position:fixed;z-index:70;min-width:180px;max-width:380px;padding:10px 12px;border:1px solid var(--ce-panel-border);border-radius:10px;background:var(--ce-panel-bg);box-shadow:var(--ce-panel-shadow);pointer-events:none}.hover-head[data-v-e1c19d60]{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px}.hover-name[data-v-e1c19d60]{color:var(--ce-hover-text);font-family:JetBrains Mono,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;font-weight:600}.hover-doc[data-v-e1c19d60]{margin:8px 0 0;color:var(--ce-hover-doc);font-size:12px;line-height:1.6}.hover-colon[data-v-e1c19d60]{color:var(--ce-hover-colon);font-weight:400}.hover-type[data-v-e1c19d60]{color:var(--ce-hover-type);font-family:JetBrains Mono,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}.hover-def[data-v-e1c19d60]{margin:8px 0 0;padding:9px 11px;border-radius:8px;border-left:3px solid var(--ce-def-border);background:var(--ce-def-bg)}.hover-def code[data-v-e1c19d60]{display:block;color:var(--ce-def-text);font-family:JetBrains Mono,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.65;white-space:pre-wrap;word-break:break-word}.hover-def[data-v-e1c19d60] .tok-keyword{color:var(--ce-tok-keyword);font-weight:600}.hover-def[data-v-e1c19d60] .tok-identifier{color:var(--ce-hover-text)}.hover-def[data-v-e1c19d60] .tok-number{color:var(--ce-tok-number)}.hover-def[data-v-e1c19d60] .tok-string,.hover-def[data-v-e1c19d60] .tok-template{color:var(--ce-tok-string)}.hover-def[data-v-e1c19d60] .tok-comment{color:var(--ce-tok-comment);font-style:italic}.hover-def[data-v-e1c19d60] .tok-punctuation{color:var(--ce-tok-punct)}
|
|
1
|
+
.code-input[data-v-3779a6df],.code-input[data-v-3779a6df] *,.code-input[data-v-3779a6df] *:before,.code-input[data-v-3779a6df] *:after{box-sizing:border-box}.code-input[data-v-3779a6df]{position:relative}.code-input.is-collapsible>.code-editor[data-v-3779a6df]{position:absolute;top:0;left:0;width:100%;transition:height .24s ease,box-shadow .24s ease}.code-input.is-collapsible>.code-editor[data-v-3779a6df]:not(.is-collapsed){z-index:40;box-shadow:0 16px 40px #172a542e}.code-editor.is-expanding[data-v-3779a6df]{animation:ce-pop-3779a6df .24s ease}@keyframes ce-pop-3779a6df{0%{transform:scale(.97);opacity:.55}to{transform:scale(1);opacity:1}}.code-editor[data-v-3779a6df]{position:relative;display:flex;align-items:stretch;border:1px solid var(--ce-border);border-radius:var(--ce-radius, 4px);background:var(--ce-bg);color:var(--ce-text);transition:border-color .18s ease,box-shadow .18s ease,background .18s ease;--ce-bg: #fbfcff;--ce-border: #dbe2ef;--ce-border-focus: #6b93ff;--ce-ring: rgba(88, 132, 255, .16);--ce-text: #1f2937;--ce-caret: #2f6bff;--ce-placeholder: #b3bdcc;--ce-selection: rgba(47, 107, 255, .18);--ce-gutter-bg: #f3f6fc;--ce-gutter-border: #e7ecf5;--ce-gutter-text: #a6b1c2;--ce-panel-bg: #ffffff;--ce-panel-border: #e4eaf5;--ce-panel-shadow: 0 16px 36px rgba(23, 42, 84, .16);--ce-item-active: #edf3ff;--ce-item-text: #0f172a;--ce-item-detail: #94a3b8;--ce-hover-text: #0f172a;--ce-hover-doc: #5b6b82;--ce-hover-type: #4b5b72;--ce-hover-colon: #94a3b8;--ce-def-border: #93b0ff;--ce-def-bg: linear-gradient(180deg, #f6f8fd 0%, #f1f5fc 100%);--ce-def-text: #334155;--ce-toggle-bg: rgba(255, 255, 255, .92);--ce-toggle-border: #dbe2ef;--ce-toggle-fg: #64748b;--ce-toggle-hover-bg: #eef3ff;--ce-toggle-hover-fg: #2f6bff;--ce-tok-keyword: #c026d3;--ce-tok-builtin: #0b7a75;--ce-tok-string: #b45309;--ce-tok-number: #2563eb;--ce-tok-comment: #9aa7b8;--ce-tok-punct: #64748b;--ce-tok-brace: #a855f7;--ce-badge-var-fg: #1d4ed8;--ce-badge-var-bg: #e3ecff;--ce-badge-fn-fg: #7c3aed;--ce-badge-fn-bg: #f0e7ff;--ce-badge-prop-fg: #0f766e;--ce-badge-prop-bg: #d9f5ef;--ce-badge-class-fg: #b45309;--ce-badge-class-bg: #fdf0d8;--ce-badge-kw-fg: #475569;--ce-badge-kw-bg: #eef1f6;--ce-badge-value-fg: #0e7490;--ce-badge-value-bg: #d8f3fa;--ce-scrollbar-thumb: rgba(100, 116, 139, .35);--ce-scrollbar-thumb-hover: rgba(100, 116, 139, .6);--ce-pad-y: 14px;--ce-pad-x: 16px;--ce-line-height: 22px}.code-editor.is-dark[data-v-3779a6df]{--ce-bg: #1b1f27;--ce-border: #2e3644;--ce-border-focus: #6ea8ff;--ce-ring: rgba(110, 168, 255, .25);--ce-text: #d6dbe6;--ce-caret: #7cb0ff;--ce-placeholder: #565f72;--ce-selection: rgba(110, 168, 255, .28);--ce-gutter-bg: #171b22;--ce-gutter-border: #262d39;--ce-gutter-text: #566076;--ce-panel-bg: #232833;--ce-panel-border: #333c4c;--ce-panel-shadow: 0 16px 36px rgba(0, 0, 0, .45);--ce-item-active: #2d3648;--ce-item-text: #e6ebf5;--ce-item-detail: #7d879b;--ce-hover-text: #e6ebf5;--ce-hover-doc: #9aa5b8;--ce-hover-type: #b6c0d2;--ce-hover-colon: #7d879b;--ce-def-border: #4a72c0;--ce-def-bg: linear-gradient(180deg, #20252f 0%, #1c212a 100%);--ce-def-text: #c6cedd;--ce-toggle-bg: rgba(38, 45, 58, .92);--ce-toggle-border: #333c4c;--ce-toggle-fg: #8b95a8;--ce-toggle-hover-bg: #2d3648;--ce-toggle-hover-fg: #7cb0ff;--ce-tok-keyword: #c586c0;--ce-tok-builtin: #4ec9b0;--ce-tok-string: #ce9178;--ce-tok-number: #b5cea8;--ce-tok-comment: #6a9955;--ce-tok-punct: #8b95a8;--ce-tok-brace: #d18fd0;--ce-badge-var-fg: #9bb8ff;--ce-badge-var-bg: rgba(90, 130, 255, .18);--ce-badge-fn-fg: #c4a6ff;--ce-badge-fn-bg: rgba(150, 110, 255, .2);--ce-badge-prop-fg: #6fe0d0;--ce-badge-prop-bg: rgba(20, 190, 170, .16);--ce-badge-class-fg: #f2c078;--ce-badge-class-bg: rgba(230, 160, 40, .16);--ce-badge-kw-fg: #aab4c6;--ce-badge-kw-bg: rgba(150, 165, 190, .14);--ce-badge-value-fg: #7dd3fc;--ce-badge-value-bg: rgba(56, 189, 248, .16);--ce-scrollbar-thumb: rgba(148, 163, 184, .35);--ce-scrollbar-thumb-hover: rgba(148, 163, 184, .6)}.code-editor[data-v-3779a6df]:focus-within{border-color:var(--ce-border-focus);box-shadow:0 0 0 3px var(--ce-ring)}.code-font[data-v-3779a6df]{margin:0;font-family:JetBrains Mono,SFMono-Regular,Menlo,Consolas,Liberation Mono,monospace;font-size:13.5px;line-height:var(--ce-line-height);letter-spacing:0;-moz-tab-size:2;tab-size:2;white-space:pre;overflow-wrap:normal;word-break:normal}.is-collapsed .input[data-v-3779a6df],.is-collapsed .highlight pre[data-v-3779a6df]{padding-top:0;padding-bottom:0;line-height:var(--ce-collapsed-height, 34px);white-space:pre}.code-input.is-collapsible .stage[data-v-3779a6df]{transition:margin .24s ease}.code-input.is-collapsible .code-editor.is-collapsed .stage[data-v-3779a6df]{margin-right:46px}.code-input.is-collapsible .code-editor:not(.is-collapsed) .stage[data-v-3779a6df]{margin-bottom:46px}.is-collapsed .input[data-v-3779a6df]{scrollbar-width:none}.is-collapsed .input[data-v-3779a6df]::-webkit-scrollbar{display:none}.gutter[data-v-3779a6df]{flex:none;width:44px;padding:14px 10px;border-right:1px solid var(--ce-gutter-border);border-radius:var(--ce-radius, 4px) 0 0 var(--ce-radius, 4px);background:var(--ce-gutter-bg);color:var(--ce-gutter-text);text-align:right;-webkit-user-select:none;user-select:none;overflow:hidden;transition:width .24s ease,padding .24s ease,opacity .24s ease,border-right-width .24s ease,background .18s ease,color .18s ease}.is-collapsed .gutter[data-v-3779a6df]{width:0;padding:0;border-right-width:0;opacity:0}.gutter-line[data-v-3779a6df]{padding-right:2px}.stage[data-v-3779a6df]{position:relative;flex:1;min-width:0}.highlight[data-v-3779a6df]{position:absolute;top:0;right:0;bottom:0;left:0;overflow:hidden;pointer-events:none}.highlight pre[data-v-3779a6df]{margin:0;padding:var(--ce-pad-y) var(--ce-pad-x);font:inherit;white-space:inherit;overflow-wrap:inherit;word-break:inherit;-moz-tab-size:inherit;tab-size:inherit;color:var(--ce-text);will-change:transform;transition:padding .24s ease,line-height .24s ease}.input[data-v-3779a6df]{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;margin:0;padding:var(--ce-pad-y) var(--ce-pad-x);border:0;outline:none;resize:none;background:transparent;color:transparent;caret-color:var(--ce-caret);-webkit-text-fill-color:transparent;overflow:auto;scrollbar-width:thin;scrollbar-color:var(--ce-scrollbar-thumb) transparent;transition:padding .24s ease,line-height .24s ease}.input[data-v-3779a6df]::-webkit-scrollbar{width:8px;height:8px}.input[data-v-3779a6df]::-webkit-scrollbar-track{background:transparent}.input[data-v-3779a6df]::-webkit-scrollbar-thumb{background:var(--ce-scrollbar-thumb);background-clip:padding-box;border:2px solid transparent;border-radius:8px}.input[data-v-3779a6df]::-webkit-scrollbar-thumb:hover{background:var(--ce-scrollbar-thumb-hover);background-clip:padding-box;border:2px solid transparent}.input[data-v-3779a6df]::-webkit-scrollbar-corner{background:transparent}.input[data-v-3779a6df]::placeholder{color:var(--ce-placeholder);-webkit-text-fill-color:var(--ce-placeholder)}.input[data-v-3779a6df]::selection{background:var(--ce-selection)}.is-readonly .input[data-v-3779a6df]{cursor:default}.expand-toggle[data-v-3779a6df]{position:absolute;right:10px;top:calc(100% - 36px);z-index:30;display:inline-flex;align-items:center;justify-content:center;width:26px;height:26px;padding:0;border:1px solid var(--ce-toggle-border);border-radius:7px;background:var(--ce-toggle-bg);color:var(--ce-toggle-fg);cursor:pointer;transition:background .15s ease,color .15s ease,border-color .15s ease,top .24s ease}.expand-toggle[data-v-3779a6df]:hover{background:var(--ce-toggle-hover-bg);color:var(--ce-toggle-hover-fg);border-color:var(--ce-toggle-hover-fg)}.is-collapsed .expand-toggle[data-v-3779a6df]{top:calc(50% - 13px)}.popup[data-v-3779a6df]{position:absolute;z-index:60;min-width:220px;max-width:360px;max-height:248px;margin:0;padding:6px;overflow:auto;list-style:none;background:var(--ce-panel-bg);border:1px solid var(--ce-panel-border);border-radius:10px;box-shadow:var(--ce-panel-shadow)}.popup-item[data-v-3779a6df]{display:flex;align-items:center;gap:8px;padding:6px 8px;border-radius:6px;font-size:13px;line-height:20px;white-space:nowrap;cursor:pointer}.popup-item.is-active[data-v-3779a6df]{background:var(--ce-item-active)}.badge[data-v-3779a6df]{flex:none;min-width:42px;padding:2px 6px;border-radius:4px;font-size:10px;font-weight:600;text-align:center;white-space:nowrap}.badge-variable[data-v-3779a6df]{color:var(--ce-badge-var-fg);background:var(--ce-badge-var-bg)}.badge-function[data-v-3779a6df]{color:var(--ce-badge-fn-fg);background:var(--ce-badge-fn-bg)}.badge-property[data-v-3779a6df]{color:var(--ce-badge-prop-fg);background:var(--ce-badge-prop-bg)}.badge-class[data-v-3779a6df]{color:var(--ce-badge-class-fg);background:var(--ce-badge-class-bg)}.badge-keyword[data-v-3779a6df]{color:var(--ce-badge-kw-fg);background:var(--ce-badge-kw-bg)}.badge-value[data-v-3779a6df]{color:var(--ce-badge-value-fg);background:var(--ce-badge-value-bg)}.popup-label[data-v-3779a6df]{color:var(--ce-item-text)}.popup-detail[data-v-3779a6df]{margin-left:auto;overflow:hidden;color:var(--ce-item-detail);font-size:11px;text-overflow:ellipsis}.highlight[data-v-3779a6df] .tok-keyword{color:var(--ce-tok-keyword);font-weight:600}.highlight[data-v-3779a6df] .tok-builtin{color:var(--ce-tok-builtin)}.highlight[data-v-3779a6df] .tok-string,.highlight[data-v-3779a6df] .tok-template{color:var(--ce-tok-string)}.highlight[data-v-3779a6df] .tok-number{color:var(--ce-tok-number)}.highlight[data-v-3779a6df] .tok-comment{color:var(--ce-tok-comment);font-style:italic}.highlight[data-v-3779a6df] .tok-punctuation{color:var(--ce-tok-punct)}.highlight[data-v-3779a6df] .tok-brace{color:var(--ce-tok-brace);font-weight:600}.hover-card[data-v-3779a6df]{position:fixed;z-index:70;min-width:180px;max-width:380px;padding:10px 12px;border:1px solid var(--ce-panel-border);border-radius:10px;background:var(--ce-panel-bg);box-shadow:var(--ce-panel-shadow);pointer-events:none}.hover-head[data-v-3779a6df]{display:flex;flex-wrap:wrap;align-items:baseline;gap:8px}.hover-name[data-v-3779a6df]{color:var(--ce-hover-text);font-family:JetBrains Mono,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px;font-weight:600}.hover-doc[data-v-3779a6df]{margin:8px 0 0;color:var(--ce-hover-doc);font-size:12px;line-height:1.6}.hover-colon[data-v-3779a6df]{color:var(--ce-hover-colon);font-weight:400}.hover-type[data-v-3779a6df]{color:var(--ce-hover-type);font-family:JetBrains Mono,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px}.hover-def[data-v-3779a6df]{margin:8px 0 0;padding:9px 11px;border-radius:8px;border-left:3px solid var(--ce-def-border);background:var(--ce-def-bg)}.hover-def code[data-v-3779a6df]{display:block;color:var(--ce-def-text);font-family:JetBrains Mono,SFMono-Regular,Menlo,Consolas,monospace;font-size:12px;line-height:1.65;white-space:pre-wrap;word-break:break-word}.hover-def[data-v-3779a6df] .tok-keyword{color:var(--ce-tok-keyword);font-weight:600}.hover-def[data-v-3779a6df] .tok-identifier{color:var(--ce-hover-text)}.hover-def[data-v-3779a6df] .tok-number{color:var(--ce-tok-number)}.hover-def[data-v-3779a6df] .tok-string,.hover-def[data-v-3779a6df] .tok-template{color:var(--ce-tok-string)}.hover-def[data-v-3779a6df] .tok-comment{color:var(--ce-tok-comment);font-style:italic}.hover-def[data-v-3779a6df] .tok-punctuation{color:var(--ce-tok-punct)}
|