codemini-cli 0.6.4 → 0.6.6
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/codemini-web/dist/assets/{AboutDialog-MRopwNIL.js → AboutDialog-dFkTshay.js} +2 -2
- package/codemini-web/dist/assets/CodeWikiPanel-Dqup5Sen.js +1 -0
- package/codemini-web/dist/assets/ConfigDialog-DTehAh2r.js +1 -0
- package/codemini-web/dist/assets/{GitDiffDialog-gSysUg2J.js → GitDiffDialog-D4uMixee.js} +2 -2
- package/codemini-web/dist/assets/{MemoryDialog-DFUmo3Kl.js → MemoryDialog-DJqtWamU.js} +3 -3
- package/codemini-web/dist/assets/MessageBubble-BGnFIxcq.js +12 -0
- package/codemini-web/dist/assets/{PatchDiff-B8rwvEg5.js → PatchDiff-CpHAbmv3.js} +1 -1
- package/codemini-web/dist/assets/ProjectSelector-CgJDcTNL.js +1 -0
- package/codemini-web/dist/assets/SkillDialog-D1J46nMC.js +8 -0
- package/codemini-web/dist/assets/{SoulDialog-BLjUGqqB.js → SoulDialog-DIqK4utD.js} +1 -1
- package/codemini-web/dist/assets/chevron-right-BBG4s6Zh.js +1 -0
- package/codemini-web/dist/assets/{chunk-BO2N2NFS-6uELoidu.js → chunk-BO2N2NFS-fRXUeu1b.js} +4 -4
- package/codemini-web/dist/assets/{highlighted-body-OFNGDK62-gb1UMBZ5.js → highlighted-body-OFNGDK62-CKKvx7S1.js} +1 -1
- package/codemini-web/dist/assets/index-DF9s7Tuc.css +2 -0
- package/codemini-web/dist/assets/{index-CDXQGwPs.js → index-DyIUhlc8.js} +6 -6
- package/codemini-web/dist/assets/input-BKNu4DOt.js +1 -0
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-BM8yuNk5.js +1 -0
- package/codemini-web/dist/assets/{pencil-BhT11Ztp.js → pencil-C0uznNC_.js} +1 -1
- package/codemini-web/dist/assets/{refresh-cw-D7R5Lth6.js → refresh-cw-DUgU5bEu.js} +1 -1
- package/codemini-web/dist/assets/select-J6668k2a.js +1 -0
- package/codemini-web/dist/assets/{trash-2-BfNZcWfX.js → trash-2-H0DiWqiE.js} +1 -1
- package/codemini-web/dist/index.html +2 -2
- package/codemini-web/lib/runtime-bridge.js +7 -0
- package/codemini-web/server.js +100 -74
- package/package.json +1 -1
- package/src/commands/skill.js +188 -48
- package/src/core/agent-loop.js +73 -34
- package/src/core/chat-runtime.js +22 -17
- package/src/core/config-store.js +2 -4
- package/src/core/git-oplog-change-tracker.js +96 -15
- package/src/core/shell-profile.js +3 -2
- package/src/core/tools.js +144 -51
- package/codemini-web/dist/assets/CodeWikiPanel-UpK5xGE3.js +0 -1
- package/codemini-web/dist/assets/ConfigDialog-CNl28wsj.js +0 -1
- package/codemini-web/dist/assets/MessageBubble-CGnnViv0.js +0 -12
- package/codemini-web/dist/assets/ProjectSelector-BF59M1zb.js +0 -1
- package/codemini-web/dist/assets/SkillDialog-CQTjbSiw.js +0 -8
- package/codemini-web/dist/assets/chevron-right--85xg7qk.js +0 -1
- package/codemini-web/dist/assets/index-1xqD0R5t.css +0 -2
- package/codemini-web/dist/assets/input-Ca8O_061.js +0 -1
- package/codemini-web/dist/assets/mermaid-GHXKKRXX-ROliF8Yd.js +0 -1
- package/codemini-web/dist/assets/select-DBvcHBzs.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/angular-html-BtqWAyby.js","assets/rolldown-runtime-S-ySWqyJ.js","assets/html-CCOAFbPU.js","assets/css-D2Zgfenk.js","assets/javascript-Cn8UGaJe.js","assets/angular-ts-BUlY5dZZ.js","assets/scss-By7PHVyf.js","assets/apl-B9jkvghZ.js","assets/json-BlCKYbAr.js","assets/xml-DDsJXW9N.js","assets/java-X5SW6zDn.js","assets/astro-P-Wk2Uo3.js","assets/postcss-BVVH-mhK.js","assets/tsx-Cvi8n1qy.js","assets/typescript-DESGzanZ.js","assets/blade-CxVOILUn.js","assets/html-derivative-BN80HtRR.js","assets/sql-PkTJiLTy.js","assets/bsl-9Rfj8X2G.js","assets/sdbl-CtZR2I6R.js","assets/c-Ce4Vw5YJ.js","assets/cairo-B8t0-PSB.js","assets/python-Dt6SBvxD.js","assets/cobol-C67LYEki.js","assets/coffee-C_zREOQP.js","assets/cpp-BcL70P81.js","assets/glsl-BsJMlsXZ.js","assets/regexp-PTdmEsyL.js","assets/crystal-CoqbT5f8.js","assets/shellscript-wXQ3AlcS.js","assets/edge-DytV3yX5.js","assets/elixir-BLpitXJw.js","assets/elm-C5ZqKzP8.js","assets/erb-CxvZayEs.js","assets/ruby-DQmpjmxU.js","assets/graphql-Bzui-_oF.js","assets/jsx-mn0xQF_s.js","assets/haml-BL3Pq-bL.js","assets/lua-CG2sJZNs.js","assets/yaml-CZT5eZge.js","assets/erlang-CdOz9ruD.js","assets/markdown-BObkjWCp.js","assets/fortran-fixed-form-BmD2L0UY.js","assets/fortran-free-form-Db24aQuN.js","assets/fsharp-DgKUr7h2.js","assets/gdresource-BqgTfeIa.js","assets/gdscript-CxxY7zMa.js","assets/gdshader-W85lNgcx.js","assets/git-commit-CPnaL3nl.js","assets/diff-DGLbp6Xl.js","assets/git-rebase-BVjWygdV.js","assets/glimmer-js-bG2aM9pf.js","assets/glimmer-ts-D6GU3-HZ.js","assets/hack-Dl73UNBo.js","assets/handlebars-Dl0DZ9iU.js","assets/http-BT0m2fV8.js","assets/hurl-QdCmCx_B.js","assets/csv-Cx2EO4hN.js","assets/hxml-DlOl0PEf.js","assets/haxe-DxCG7g2C.js","assets/jinja-CzKj-PyV.js","assets/jison-CMHmT6Zn.js","assets/julia-ssnM4-62.js","assets/r-70IHnSKT.js","assets/just-BYVm1Mrm.js","assets/perl-Drip2S24.js","assets/latex--PKG7pkB.js","assets/tex-C26OlX33.js","assets/liquid-CmT9c2rW.js","assets/marko-CJF04FnX.js","assets/less-Dycz37IB.js","assets/mdc-DjUuZ2FY.js","assets/nextflow-CK5HLJvq.js","assets/nextflow-groovy-CYeLXiaP.js","assets/nginx-BC64-3-i.js","assets/nim-x_81C3Qr.js","assets/php-BbiCqfrp.js","assets/pug-D4U6GWCU.js","assets/qml-C7Gvixtn.js","assets/razor-CeMDYz78.js","assets/csharp-BJRWJrkS.js","assets/rst-4NiHKVzB.js","assets/cmake-DuxpWyxB.js","assets/sas-BXFb3Byc.js","assets/shaderlab-jhHUXThs.js","assets/hlsl-CU9ay1Rj.js","assets/shellsession-mbgkQZNs.js","assets/soy-Brdxowwc.js","assets/sparql-D050l-1j.js","assets/turtle-DsCF_r1D.js","assets/stata-rcB48Bwa.js","assets/surrealql-BEIq2Ti9.js","assets/svelte-DLivETBJ.js","assets/templ-DCO78tPK.js","assets/go-B2Qj-jpc.js","assets/ts-tags-DxtnKICy.js","assets/twig-l2jHuCJP.js","assets/vue-DTExrAHq.js","assets/vue-html-DF9b1rb0.js","assets/vue-vine-A_lRwVWt.js","assets/stylus-BPw8WnNN.js","assets/xsl-TnKTzvHo.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{i as r}from"./index-CDXQGwPs.js";import{a as i,c as a,l as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./lib-BXWizt13.js";var p=n(),m={position:`absolute`,top:0,bottom:0,textAlign:`center`},h={display:`contents`};function g(){return null}var _=`diffs-container`,v=/(?=^From [a-f0-9]+ .+$)/m,y=/(?=^diff --git)/gm,b=/(?=^---\s+\S)/gm,x=/(?=^@@ )/gm,ee=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,S=/(?<=\n)/,C=/^(---|\+\+\+)\s+([^\t\r\n]+)/,w=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,T=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,E=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,D=`header-prefix`,te=`header-metadata`,ne=`header-custom`,O={dark:`pierre-dark`,light:`pierre-light`},re=`data-theme-css`,ie=`data-unsafe-css`,ae={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},oe=Object.freeze({fromStart:0,fromEnd:0}),se={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},ce={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function le(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function ue(e,t){return typeof window>`u`&&t!=null?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,p.jsx)(p.Fragment,{children:e})}var k=e(t(),1),de=(0,k.createContext)(void 0);function fe(){return(0,k.useContext)(de)}var pe=new Map,me=new Map,he=new Map,ge=new Set;function _e(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=pe.get(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,pe.has(n)||pe.set(n,e);ge.has(n)||(ge.add(n),t.loadThemeSync(e))}}var ve=new Map,ye=new Map,be=new Map,xe=new Set;function Se(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(xe.has(n.name))continue;let e=ve.get(n.name);e??(e=n,ve.set(n.name,e)),xe.add(e.name),t.loadLanguageSync(e.data)}}function Ce(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var A=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function we(e){return Te(e)}function Te(e){return Array.isArray(e)?Ee(e):e instanceof RegExp?e:typeof e==`object`?De(e):e}function Ee(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Te(e[n]);return t}function De(e){let t={};for(let n in e)t[n]=Te(e[n]);return t}function Oe(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ke(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ke(e.substring(0,e.length-1)):e.substr(~t+1)}var Ae=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,je=class{static hasCaptures(e){return e===null?!1:(Ae.lastIndex=0,Ae.test(e))}static replaceCaptures(e,t,n){return e.replace(Ae,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Me(e,t){return e<t?-1:+(e>t)}function Ne(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Me(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Pe(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Fe(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Ie=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Le=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(He(e),t)}static createFromParsedTheme(e,t){return We(e,t)}_cachedMatchRoot=new Ie(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>ze(e.parent,t.parentScopes));return n?new Ve(n.fontStyle,n.foreground,n.background):null}},Re=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ze(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Be(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Be(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Ve=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function He(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&Pe(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Pe(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Ue(l,u,e,o,s,c)}}return n}var Ue=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},j=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(j||{});function We(e,t){e.sort((e,t)=>{let n=Me(e.scope,t.scope);return n!==0||(n=Ne(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Ge(t),o=new Ve(n,a.getId(r),a.getId(i)),s=new Je(new qe(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Le(a,o,s)}var Ge=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Ke=Object.freeze([]),qe=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Ke,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Je=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),qe.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Ne(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new qe(e,t,n,r,i))}},Ye=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Ze(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Xe(e){return e}function Ze(e){return e}function Qe(e,t){let n=[],r=et(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if($e(i)){let e=[];do e.push(i),i=r.next();while($e(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function $e(e){return!!e&&!!e.match(/[\w\.:]+/)}function et(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function tt(e){typeof e.dispose==`function`&&e.dispose()}var nt=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},rt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},it=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},at=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new nt(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new it;for(let n of e)ot(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof nt){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function ot(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof nt?ct({baseGrammar:a,selfGrammar:i},r):st(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new nt(e))}function st(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];lt([r],t,n)}}function ct(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&<(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&<(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function lt(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Oe({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&<(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ht(i);switch(a.kind){case 0:ct({...t,selfGrammar:t.baseGrammar},n);break;case 1:ct(t,n);break;case 2:st(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?st(a.ruleName,i,n):ct(i,n)}else a.kind===4?n.add(new rt(a.scopeName,a.ruleName)):n.add(new nt(a.scopeName));break}}}var ut=class{kind=0},dt=class{kind=1},ft=class{constructor(e){this.ruleName=e}kind=2},pt=class{constructor(e){this.scopeName=e}kind=3},mt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ht(e){if(e===`$base`)return new ut;if(e===`$self`)return new dt;let t=e.indexOf(`#`);return t===-1?new pt(e):t===0?new ft(e.substring(1)):new mt(e.substring(0,t),e.substring(t+1))}var gt=/\\(\d+)/,_t=/\\(\d+)/g,vt=-1,yt=-2;function bt(e){return e}function xt(e){return e}var St=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=je.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=je.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ke(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:je.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:je.replaceCaptures(this._contentName,e,t)}},Ct=class extends St{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},wt=class extends St{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new kt(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new At,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Tt=class extends St{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new At,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Et=class extends St{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new kt(i,this.id),this.beginCaptures=a,this._end=new kt(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new At;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Dt=class extends St{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new kt(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new kt(o,yt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new At;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new At,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},Ot=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Ct(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new wt(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Oe({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Tt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Dt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Et(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ht(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Tt||e instanceof Et||e instanceof Dt)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},kt=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=gt.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return _t.lastIndex=0,this.source.replace(_t,(e,t)=>Fe(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},At=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new jt(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new jt(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},jt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
2
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{i as r}from"./index-DyIUhlc8.js";import{a as i,c as a,l as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./lib-BXWizt13.js";var p=n(),m={position:`absolute`,top:0,bottom:0,textAlign:`center`},h={display:`contents`};function g(){return null}var _=`diffs-container`,v=/(?=^From [a-f0-9]+ .+$)/m,y=/(?=^diff --git)/gm,b=/(?=^---\s+\S)/gm,x=/(?=^@@ )/gm,ee=/^@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@(?: (.*))?/m,S=/(?<=\n)/,C=/^(---|\+\+\+)\s+([^\t\r\n]+)/,w=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,T=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,E=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,D=`header-prefix`,te=`header-metadata`,ne=`header-custom`,O={dark:`pierre-dark`,light:`pierre-light`},re=`data-theme-css`,ie=`data-unsafe-css`,ae={hunkLineCount:50,lineHeight:20,diffHeaderHeight:44,hunkSeparatorHeight:32,fileGap:8},oe=Object.freeze({fromStart:0,fromEnd:0}),se={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},ce={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0};function le(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function ue(e,t){return typeof window>`u`&&t!=null?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(`template`,{shadowrootmode:`open`,dangerouslySetInnerHTML:{__html:t}}),e]}):(0,p.jsx)(p.Fragment,{children:e})}var k=e(t(),1),de=(0,k.createContext)(void 0);function fe(){return(0,k.useContext)(de)}var pe=new Map,me=new Map,he=new Map,ge=new Set;function _e(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=pe.get(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,pe.has(n)||pe.set(n,e);ge.has(n)||(ge.add(n),t.loadThemeSync(e))}}var ve=new Map,ye=new Map,be=new Map,xe=new Set;function Se(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(xe.has(n.name))continue;let e=ve.get(n.name);e??(e=n,ve.set(n.name,e)),xe.add(e.name),t.loadLanguageSync(e.data)}}function Ce(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var A=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function we(e){return Te(e)}function Te(e){return Array.isArray(e)?Ee(e):e instanceof RegExp?e:typeof e==`object`?De(e):e}function Ee(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Te(e[n]);return t}function De(e){let t={};for(let n in e)t[n]=Te(e[n]);return t}function Oe(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function ke(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?ke(e.substring(0,e.length-1)):e.substr(~t+1)}var Ae=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,je=class{static hasCaptures(e){return e===null?!1:(Ae.lastIndex=0,Ae.test(e))}static replaceCaptures(e,t,n){return e.replace(Ae,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Me(e,t){return e<t?-1:+(e>t)}function Ne(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Me(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function Pe(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function Fe(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var Ie=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},Le=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(He(e),t)}static createFromParsedTheme(e,t){return We(e,t)}_cachedMatchRoot=new Ie(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>ze(e.parent,t.parentScopes));return n?new Ve(n.fontStyle,n.foreground,n.background):null}},Re=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e?!0:this.parent===null?!1:this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function ze(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!Be(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function Be(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var Ve=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function He(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8;break}}let s=null;typeof i.settings.foreground==`string`&&Pe(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&Pe(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new Ue(l,u,e,o,s,c)}}return n}var Ue=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},j=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(j||{});function We(e,t){e.sort((e,t)=>{let n=Me(e.scope,t.scope);return n!==0||(n=Ne(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new Ge(t),o=new Ve(n,a.getId(r),a.getId(i)),s=new Je(new qe(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new Le(a,o,s)}var Ge=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},Ke=Object.freeze([]),qe=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||Ke,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},Je=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),qe.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(Ne(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new qe(e,t,n,r,i))}},Ye=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return(e&1024)!=0}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=Ze(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function Xe(e){return e}function Ze(e){return e}function Qe(e,t){let n=[],r=et(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if($e(i)){let e=[];do e.push(i),i=r.next();while($e(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function $e(e){return!!e&&!!e.match(/[\w\.:]+/)}function et(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function tt(e){typeof e.dispose==`function`&&e.dispose()}var nt=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},rt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},it=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},at=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new nt(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new it;for(let n of e)ot(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof nt){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function ot(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof nt?ct({baseGrammar:a,selfGrammar:i},r):st(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new nt(e))}function st(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];lt([r],t,n)}}function ct(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&<(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&<(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function lt(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Oe({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&<(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=ht(i);switch(a.kind){case 0:ct({...t,selfGrammar:t.baseGrammar},n);break;case 1:ct(t,n);break;case 2:st(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?st(a.ruleName,i,n):ct(i,n)}else a.kind===4?n.add(new rt(a.scopeName,a.ruleName)):n.add(new nt(a.scopeName));break}}}var ut=class{kind=0},dt=class{kind=1},ft=class{constructor(e){this.ruleName=e}kind=2},pt=class{constructor(e){this.scopeName=e}kind=3},mt=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function ht(e){if(e===`$base`)return new ut;if(e===`$self`)return new dt;let t=e.indexOf(`#`);return t===-1?new pt(e):t===0?new ft(e.substring(1)):new mt(e.substring(0,t),e.substring(t+1))}var gt=/\\(\d+)/,_t=/\\(\d+)/g,vt=-1,yt=-2;function bt(e){return e}function xt(e){return e}var St=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=je.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=je.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${ke(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:je.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:je.replaceCaptures(this._contentName,e,t)}},Ct=class extends St{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},wt=class extends St{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new kt(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new At,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Tt=class extends St{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new At,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Et=class extends St{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new kt(i,this.id),this.beginCaptures=a,this._end=new kt(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new At;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},Dt=class extends St{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new kt(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new kt(o,yt),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new At;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new At,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},Ot=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new Ct(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new wt(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Oe({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new Tt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new Dt(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new Et(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=ht(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l)if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository);break}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof Tt||e instanceof Et||e instanceof Dt)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},kt=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this.hasAnchor?this._anchorCache=this._buildAnchorCache():this._anchorCache=null,this.ruleId=t,typeof this.source==`string`?this.hasBackReferences=gt.test(this.source):this.hasBackReferences=!1}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return _t.lastIndex=0,this.source.replace(_t,(e,t)=>Fe(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},At=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new jt(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new jt(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},jt=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
3
3
|
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},Mt=class{constructor(e,t){this.languageId=e,this.tokenType=t}},Nt=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new Mt(e,8),this._embeddedLanguagesMatcher=new Pt(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new Mt(0,0);_getBasicScopeAttributes=new Ie(e=>new Mt(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},Pt=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>Fe(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var Ft=!1,It=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function Lt(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=Rt(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new It(i,!0);f()}return new It(i,!1);function f(){let o=zt(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===vt){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),Gt(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof Et){let r=o;Gt(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof Dt){let r=o;Gt(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(Gt(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function Rt(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof Dt&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=Ut(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==yt){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),Gt(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function zt(e,t,n,r,i,a){let o=Bt(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=Vt(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function Bt(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=Ht(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function Vt(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=Ht(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function Ht(e,t,n,r,i){return Ft?{ruleScanner:e.compile(t,n),findOptions:Wt(r,i)}:{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function Ut(e,t,n,r,i){return Ft?{ruleScanner:e.compileWhile(t,n),findOptions:Wt(r,i)}:{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function Wt(e,t){let n=0;return e||(n|=1),t||(n|=4),n}function Gt(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));Lt(e,p,n&&d.start===0,d.start,f,i,!1,0),tt(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new Kt(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var Kt=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function qt(e,t,n,r,i,a,o,s){return new Zt(e,t,n,r,i,a,o,s)}function Jt(e,t,n,r,i){let a=Qe(t,Yt),o=Ot.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function Yt(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(Xt(t[r],e))return n=r+1,!0;return!1})}function Xt(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var Zt=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new Nt(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=Qt(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=Qe(e,Yt);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)Jt(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&Jt(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(bt(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[xt(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=Qt(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=Ot.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===en.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=Ye.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?$t.createRootAndLookUpScopeName(a,r,this):$t.createRoot(`unknown`,r),t=new en(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
4
4
|
`;let a=this.createOnigString(e),o=a.content.length,s=new nn(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=Lt(this,a,i,0,t,s,!0,r);return tt(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function Qt(e,t){return e=we(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var $t=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=Re.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new Re(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new Re(null,t),o=r.themeProvider.themeMatch(a);return new e(null,a,e.mergeAttributes(n,i,o))}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),Ye.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a);return new e(t,a,e.mergeAttributes(t.tokenAttributes,i,o))}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},en=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t===null?!1:e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?$t.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:xt(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=$t.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,bt(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,$t.fromExtension(r,n.contentNameScopesList))}},tn=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):Qe(e,Yt).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>Qe(e,Yt).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},nn=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=Ye.set(n,0,Xe(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=Ye.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},rn=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,qt(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},an=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new rn(Le.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(Le.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new tn(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new at(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},on=en.NULL,sn=/["&'<>`]/g,cn=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,ln=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,un=/[|\\{}()[\]^$+*?.]/g,dn=new WeakMap;function fn(e,t){if(e=e.replace(t.subset?pn(t.subset):sn,r),t.subset||t.escapeOnly)return e;return e.replace(cn,n).replace(ln,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function pn(e){let t=dn.get(e);return t||(t=mn(e),dn.set(e,t)),t}function mn(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(un,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var hn=/[\dA-Fa-f]/;function gn(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!hn.test(String.fromCharCode(t))?r:r+`;`}var _n=/\d/;function vn(e,t,n){let r=`&#`+String(e);return n&&t&&!_n.test(String.fromCharCode(t))?r:r+`;`}var yn=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),bn={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},xn=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],Sn={}.hasOwnProperty,Cn={},wn;for(wn in bn)Sn.call(bn,wn)&&(Cn[bn[wn]]=wn);var Tn=/[^\dA-Za-z]/;function En(e,t,n,r){let i=String.fromCharCode(e);if(Sn.call(Cn,i)){let e=Cn[i],a=`&`+e;return n&&yn.includes(e)&&!xn.includes(e)&&(!r||t&&t!==61&&Tn.test(String.fromCharCode(t)))?a:a+`;`}return``}function Dn(e,t,n){let r=gn(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=En(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=vn(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function On(e,t){return fn(e,Object.assign({format:Dn},t))}var kn=/^>|^->|<!--|-->|--!>|<!-$/g,An=[`>`],jn=[`<`,`>`];function Mn(e,t,n,r){return r.settings.bogusComments?`<?`+On(e.value,Object.assign({},r.settings.characterReferences,{subset:An}))+`>`:`<!--`+e.value.replace(kn,i)+`-->`;function i(e){return On(e,Object.assign({},r.settings.characterReferences,{subset:jn}))}}function Nn(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}var M=In(1),Pn=In(-1),Fn=[];function In(e){return t;function t(t,n,r){let i=t?t.children:Fn,a=(n||0)+e,o=i[a];if(!r)for(;o&&d(o);)a+=e,o=i[a];return o}}var Ln={}.hasOwnProperty;function Rn(e){return t;function t(t,n,r){return Ln.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var zn=Rn({body:Hn,caption:Bn,colgroup:Bn,dd:Kn,dt:Gn,head:Bn,html:Vn,li:Wn,optgroup:Jn,option:Yn,p:Un,rp:qn,rt:qn,tbody:Zn,td:er,tfoot:Qn,th:er,thead:Xn,tr:$n});function Bn(e,t,n){let r=M(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&d(r.value.charAt(0)))}function Vn(e,t,n){let r=M(n,t);return!r||r.type!==`comment`}function Hn(e,t,n){let r=M(n,t);return!r||r.type!==`comment`}function Un(e,t,n){let r=M(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||!(n.type===`element`&&(n.tagName===`a`||n.tagName===`audio`||n.tagName===`del`||n.tagName===`ins`||n.tagName===`map`||n.tagName===`noscript`||n.tagName===`video`))}function Wn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&r.tagName===`li`}function Gn(e,t,n){let r=M(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function Kn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function qn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function Jn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function Yn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function Xn(e,t,n){let r=M(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function Zn(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function Qn(e,t,n){return!M(n,t)}function $n(e,t,n){let r=M(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function er(e,t,n){let r=M(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var tr=Rn({body:ir,colgroup:ar,head:rr,html:nr,tbody:or});function nr(e){let t=M(e,-1);return!t||t.type!==`comment`}function rr(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ir(e){let t=M(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&d(t.value.charAt(0)))&&!(t.type===`element`&&(t.tagName===`meta`||t.tagName===`link`||t.tagName===`script`||t.tagName===`style`||t.tagName===`template`))}function ar(e,t,n){let r=Pn(n,t),i=M(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&zn(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function or(e,t,n){let r=Pn(n,t),i=M(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&zn(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var sr={name:[[`
|
|
5
5
|
\f\r &/=>`.split(``),`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{a as r,i,n as a,o,r as s,s as c,t as l}from"./select-J6668k2a.js";import{At as u,Dt as d,Ft as f,I as p,Nt as m,Tt as h,c as g,d as _,f as v,jt as y,k as b,kt as x,lt as S,pt as C,q as w,s as T,u as E}from"./index-DyIUhlc8.js";import{t as D}from"./input-BKNu4DOt.js";var O=e(t(),1),k=n();function A(e,t){return O.useReducer((e,n)=>t[e][n]??e,e)}var j=`ScrollArea`,[M,N]=y(j),[ee,P]=M(j),F=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,type:r=`hover`,dir:i,scrollHideDelay:a=600,...o}=e,[s,l]=O.useState(null),[u,d]=O.useState(null),[p,h]=O.useState(null),[g,_]=O.useState(null),[v,y]=O.useState(null),[b,x]=O.useState(0),[S,C]=O.useState(0),[w,T]=O.useState(!1),[E,D]=O.useState(!1),A=f(t,e=>l(e)),j=c(i);return(0,k.jsx)(ee,{scope:n,type:r,dir:j,scrollHideDelay:a,scrollArea:s,viewport:u,onViewportChange:d,content:p,onContentChange:h,scrollbarX:g,onScrollbarXChange:_,scrollbarXEnabled:w,onScrollbarXEnabledChange:T,scrollbarY:v,onScrollbarYChange:y,scrollbarYEnabled:E,onScrollbarYEnabledChange:D,onCornerWidthChange:x,onCornerHeightChange:C,children:(0,k.jsx)(m.div,{dir:j,...o,ref:A,style:{position:`relative`,"--radix-scroll-area-corner-width":b+`px`,"--radix-scroll-area-corner-height":S+`px`,...e.style}})})});F.displayName=j;var I=`ScrollAreaViewport`,L=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,children:r,nonce:i,...a}=e,o=P(I,n),s=f(t,O.useRef(null),o.onViewportChange);return(0,k.jsxs)(k.Fragment,{children:[(0,k.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-scroll-area-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-scroll-area-viewport]::-webkit-scrollbar{display:none}`},nonce:i}),(0,k.jsx)(m.div,{"data-radix-scroll-area-viewport":``,...a,ref:s,style:{overflowX:o.scrollbarXEnabled?`scroll`:`hidden`,overflowY:o.scrollbarYEnabled?`scroll`:`hidden`,...e.style},children:(0,k.jsx)(`div`,{ref:o.onContentChange,style:{minWidth:`100%`,display:`table`},children:r})})]})});L.displayName=I;var R=`ScrollAreaScrollbar`,z=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),{onScrollbarXEnabledChange:a,onScrollbarYEnabledChange:o}=i,s=e.orientation===`horizontal`;return O.useEffect(()=>(s?a(!0):o(!0),()=>{s?a(!1):o(!1)}),[s,a,o]),i.type===`hover`?(0,k.jsx)(te,{...r,ref:t,forceMount:n}):i.type===`scroll`?(0,k.jsx)(ne,{...r,ref:t,forceMount:n}):i.type===`auto`?(0,k.jsx)(B,{...r,ref:t,forceMount:n}):i.type===`always`?(0,k.jsx)(V,{...r,ref:t}):null});z.displayName=R;var te=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),[a,o]=O.useState(!1);return O.useEffect(()=>{let e=i.scrollArea,t=0;if(e){let n=()=>{window.clearTimeout(t),o(!0)},r=()=>{t=window.setTimeout(()=>o(!1),i.scrollHideDelay)};return e.addEventListener(`pointerenter`,n),e.addEventListener(`pointerleave`,r),()=>{window.clearTimeout(t),e.removeEventListener(`pointerenter`,n),e.removeEventListener(`pointerleave`,r)}}},[i.scrollArea,i.scrollHideDelay]),(0,k.jsx)(d,{present:n||a,children:(0,k.jsx)(B,{"data-state":a?`visible`:`hidden`,...r,ref:t})})}),ne=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=P(R,e.__scopeScrollArea),a=e.orientation===`horizontal`,o=Z(()=>c(`SCROLL_END`),100),[s,c]=A(`hidden`,{hidden:{SCROLL:`scrolling`},scrolling:{SCROLL_END:`idle`,POINTER_ENTER:`interacting`},interacting:{SCROLL:`interacting`,POINTER_LEAVE:`idle`},idle:{HIDE:`hidden`,SCROLL:`scrolling`,POINTER_ENTER:`interacting`}});return O.useEffect(()=>{if(s===`idle`){let e=window.setTimeout(()=>c(`HIDE`),i.scrollHideDelay);return()=>window.clearTimeout(e)}},[s,i.scrollHideDelay,c]),O.useEffect(()=>{let e=i.viewport,t=a?`scrollLeft`:`scrollTop`;if(e){let n=e[t],r=()=>{let r=e[t];n!==r&&(c(`SCROLL`),o()),n=r};return e.addEventListener(`scroll`,r),()=>e.removeEventListener(`scroll`,r)}},[i.viewport,a,c,o]),(0,k.jsx)(d,{present:n||s!==`hidden`,children:(0,k.jsx)(V,{"data-state":s===`hidden`?`hidden`:`visible`,...r,ref:t,onPointerEnter:u(e.onPointerEnter,()=>c(`POINTER_ENTER`)),onPointerLeave:u(e.onPointerLeave,()=>c(`POINTER_LEAVE`))})})}),B=O.forwardRef((e,t)=>{let n=P(R,e.__scopeScrollArea),{forceMount:r,...i}=e,[a,o]=O.useState(!1),s=e.orientation===`horizontal`,c=Z(()=>{if(n.viewport){let e=n.viewport.offsetWidth<n.viewport.scrollWidth,t=n.viewport.offsetHeight<n.viewport.scrollHeight;o(s?e:t)}},10);return Q(n.viewport,c),Q(n.content,c),(0,k.jsx)(d,{present:r||a,children:(0,k.jsx)(V,{"data-state":a?`visible`:`hidden`,...i,ref:t})})}),V=O.forwardRef((e,t)=>{let{orientation:n=`vertical`,...r}=e,i=P(R,e.__scopeScrollArea),a=O.useRef(null),o=O.useRef(0),[s,c]=O.useState({content:0,viewport:0,scrollbar:{size:0,paddingStart:0,paddingEnd:0}}),l=Y(s.viewport,s.content),u={...r,sizes:s,onSizesChange:c,hasThumb:l>0&&l<1,onThumbChange:e=>a.current=e,onThumbPointerUp:()=>o.current=0,onThumbPointerDown:e=>o.current=e};function d(e,t){return ce(e,o.current,s,t)}return n===`horizontal`?(0,k.jsx)(re,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollLeft,t=le(e,s,i.dir);a.current.style.transform=`translate3d(${t}px, 0, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollLeft=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollLeft=d(e,i.dir))}}):n===`vertical`?(0,k.jsx)(ie,{...u,ref:t,onThumbPositionChange:()=>{if(i.viewport&&a.current){let e=i.viewport.scrollTop,t=le(e,s);a.current.style.transform=`translate3d(0, ${t}px, 0)`}},onWheelScroll:e=>{i.viewport&&(i.viewport.scrollTop=e)},onDragScroll:e=>{i.viewport&&(i.viewport.scrollTop=d(e))}}):null}),re=O.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=P(R,e.__scopeScrollArea),[o,s]=O.useState(),c=O.useRef(null),l=f(t,c,a.onScrollbarXChange);return O.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,k.jsx)(U,{"data-orientation":`horizontal`,...i,ref:l,sizes:n,style:{bottom:0,left:a.dir===`rtl`?`var(--radix-scroll-area-corner-width)`:0,right:a.dir===`ltr`?`var(--radix-scroll-area-corner-width)`:0,"--radix-scroll-area-thumb-width":X(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.x),onDragScroll:t=>e.onDragScroll(t.x),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollLeft+t.deltaX;e.onWheelScroll(r),de(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollWidth,viewport:a.viewport.offsetWidth,scrollbar:{size:c.current.clientWidth,paddingStart:J(o.paddingLeft),paddingEnd:J(o.paddingRight)}})}})}),ie=O.forwardRef((e,t)=>{let{sizes:n,onSizesChange:r,...i}=e,a=P(R,e.__scopeScrollArea),[o,s]=O.useState(),c=O.useRef(null),l=f(t,c,a.onScrollbarYChange);return O.useEffect(()=>{c.current&&s(getComputedStyle(c.current))},[c]),(0,k.jsx)(U,{"data-orientation":`vertical`,...i,ref:l,sizes:n,style:{top:0,right:a.dir===`ltr`?0:void 0,left:a.dir===`rtl`?0:void 0,bottom:`var(--radix-scroll-area-corner-height)`,"--radix-scroll-area-thumb-height":X(n)+`px`,...e.style},onThumbPointerDown:t=>e.onThumbPointerDown(t.y),onDragScroll:t=>e.onDragScroll(t.y),onWheelScroll:(t,n)=>{if(a.viewport){let r=a.viewport.scrollTop+t.deltaY;e.onWheelScroll(r),de(r,n)&&t.preventDefault()}},onResize:()=>{c.current&&a.viewport&&o&&r({content:a.viewport.scrollHeight,viewport:a.viewport.offsetHeight,scrollbar:{size:c.current.clientHeight,paddingStart:J(o.paddingTop),paddingEnd:J(o.paddingBottom)}})}})}),[ae,H]=M(R),U=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,sizes:r,hasThumb:i,onThumbChange:a,onThumbPointerUp:o,onThumbPointerDown:s,onThumbPositionChange:c,onDragScroll:l,onWheelScroll:d,onResize:p,...g}=e,_=P(R,n),[v,y]=O.useState(null),b=f(t,e=>y(e)),x=O.useRef(null),S=O.useRef(``),C=_.viewport,w=r.content-r.viewport,T=h(d),E=h(c),D=Z(p,10);function A(e){x.current&&l({x:e.clientX-x.current.left,y:e.clientY-x.current.top})}return O.useEffect(()=>{let e=e=>{let t=e.target;v?.contains(t)&&T(e,w)};return document.addEventListener(`wheel`,e,{passive:!1}),()=>document.removeEventListener(`wheel`,e,{passive:!1})},[C,v,w,T]),O.useEffect(E,[r,E]),Q(v,D),Q(_.content,D),(0,k.jsx)(ae,{scope:n,scrollbar:v,hasThumb:i,onThumbChange:h(a),onThumbPointerUp:h(o),onThumbPositionChange:E,onThumbPointerDown:h(s),children:(0,k.jsx)(m.div,{...g,ref:b,style:{position:`absolute`,...g.style},onPointerDown:u(e.onPointerDown,e=>{e.button===0&&(e.target.setPointerCapture(e.pointerId),x.current=v.getBoundingClientRect(),S.current=document.body.style.webkitUserSelect,document.body.style.webkitUserSelect=`none`,_.viewport&&(_.viewport.style.scrollBehavior=`auto`),A(e))}),onPointerMove:u(e.onPointerMove,A),onPointerUp:u(e.onPointerUp,e=>{let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),document.body.style.webkitUserSelect=S.current,_.viewport&&(_.viewport.style.scrollBehavior=``),x.current=null})})})}),W=`ScrollAreaThumb`,G=O.forwardRef((e,t)=>{let{forceMount:n,...r}=e,i=H(W,e.__scopeScrollArea);return(0,k.jsx)(d,{present:n||i.hasThumb,children:(0,k.jsx)(oe,{ref:t,...r})})}),oe=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,style:r,...i}=e,a=P(W,n),o=H(W,n),{onThumbPositionChange:s}=o,c=f(t,e=>o.onThumbChange(e)),l=O.useRef(void 0),d=Z(()=>{l.current&&=(l.current(),void 0)},100);return O.useEffect(()=>{let e=a.viewport;if(e){let t=()=>{d(),l.current||(l.current=fe(e,s),s())};return s(),e.addEventListener(`scroll`,t),()=>e.removeEventListener(`scroll`,t)}},[a.viewport,d,s]),(0,k.jsx)(m.div,{"data-state":o.hasThumb?`visible`:`hidden`,...i,ref:c,style:{width:`var(--radix-scroll-area-thumb-width)`,height:`var(--radix-scroll-area-thumb-height)`,...r},onPointerDownCapture:u(e.onPointerDownCapture,e=>{let t=e.target.getBoundingClientRect(),n=e.clientX-t.left,r=e.clientY-t.top;o.onThumbPointerDown({x:n,y:r})}),onPointerUp:u(e.onPointerUp,o.onThumbPointerUp)})});G.displayName=W;var K=`ScrollAreaCorner`,q=O.forwardRef((e,t)=>{let n=P(K,e.__scopeScrollArea),r=!!(n.scrollbarX&&n.scrollbarY);return n.type!==`scroll`&&r?(0,k.jsx)(se,{...e,ref:t}):null});q.displayName=K;var se=O.forwardRef((e,t)=>{let{__scopeScrollArea:n,...r}=e,i=P(K,n),[a,o]=O.useState(0),[s,c]=O.useState(0),l=!!(a&&s);return Q(i.scrollbarX,()=>{let e=i.scrollbarX?.offsetHeight||0;i.onCornerHeightChange(e),c(e)}),Q(i.scrollbarY,()=>{let e=i.scrollbarY?.offsetWidth||0;i.onCornerWidthChange(e),o(e)}),l?(0,k.jsx)(m.div,{...r,ref:t,style:{width:a,height:s,position:`absolute`,right:i.dir===`ltr`?0:void 0,left:i.dir===`rtl`?0:void 0,bottom:0,...e.style}}):null});function J(e){return e?parseInt(e,10):0}function Y(e,t){let n=e/t;return isNaN(n)?0:n}function X(e){let t=Y(e.viewport,e.content),n=e.scrollbar.paddingStart+e.scrollbar.paddingEnd,r=(e.scrollbar.size-n)*t;return Math.max(r,18)}function ce(e,t,n,r=`ltr`){let i=X(n),a=i/2,o=t||a,s=i-o,c=n.scrollbar.paddingStart+o,l=n.scrollbar.size-n.scrollbar.paddingEnd-s,u=n.content-n.viewport,d=r===`ltr`?[0,u]:[u*-1,0];return ue([c,l],d)(e)}function le(e,t,n=`ltr`){let r=X(t),i=t.scrollbar.paddingStart+t.scrollbar.paddingEnd,a=t.scrollbar.size-i,s=t.content-t.viewport,c=a-r,l=o(e,n===`ltr`?[0,s]:[s*-1,0]);return ue([0,s],[0,c])(l)}function ue(e,t){return n=>{if(e[0]===e[1]||t[0]===t[1])return t[0];let r=(t[1]-t[0])/(e[1]-e[0]);return t[0]+r*(n-e[0])}}function de(e,t){return e>0&&e<t}var fe=(e,t=()=>{})=>{let n={left:e.scrollLeft,top:e.scrollTop},r=0;return(function i(){let a={left:e.scrollLeft,top:e.scrollTop},o=n.left!==a.left,s=n.top!==a.top;(o||s)&&t(),n=a,r=window.requestAnimationFrame(i)})(),()=>window.cancelAnimationFrame(r)};function Z(e,t){let n=h(e),r=O.useRef(0);return O.useEffect(()=>()=>window.clearTimeout(r.current),[]),O.useCallback(()=>{window.clearTimeout(r.current),r.current=window.setTimeout(n,t)},[n,t])}function Q(e,t){let n=h(t);x(()=>{let t=0;if(e){let r=new ResizeObserver(()=>{cancelAnimationFrame(t),t=window.requestAnimationFrame(n)});return r.observe(e),()=>{window.cancelAnimationFrame(t),r.unobserve(e)}}},[e,n])}var pe=F,me=L,he=q;function ge({className:e,children:t,...n}){return(0,k.jsxs)(pe,{"data-slot":`scroll-area`,className:C(`relative`,e),...n,children:[(0,k.jsx)(me,{"data-slot":`scroll-area-viewport`,className:`size-full rounded-[inherit] transition-[color,box-shadow] outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:outline-1`,children:t}),(0,k.jsx)(_e,{}),(0,k.jsx)(he,{})]})}function _e({className:e,orientation:t=`vertical`,...n}){return(0,k.jsx)(z,{"data-slot":`scroll-area-scrollbar`,orientation:t,className:C(`flex touch-none p-px transition-colors select-none`,t===`vertical`&&`h-full w-2.5 border-l border-l-transparent`,t===`horizontal`&&`h-2.5 flex-col border-t border-t-transparent`,e),...n,children:(0,k.jsx)(G,{"data-slot":`scroll-area-thumb`,className:`relative flex-1 rounded-full bg-border`})})}var ve=`__codemini_general__`,$=[{value:`general`,label:S(`generalChat`)},{value:`project`,label:S(`projectTask`)}];function ye({open:e,onOpenChange:t,onOpenProject:n}){let[o,c]=(0,O.useState)(`project`),[u,d]=(0,O.useState)(!1),[f,m]=(0,O.useState)(``),[h,y]=(0,O.useState)(null),[x,A]=(0,O.useState)(``);(0,O.useEffect)(()=>{e&&w().then(e=>{let t=e.cwd||``;e.isGeneral?(c(`general`),m(``),A(``),j(``)):(c(`project`),m(t),A(t||``),j(t||``))}).catch(()=>{})},[e]);let j=async e=>{try{let t=await p(e),n=!e&&!t.path&&t.roots?.[0]?.path;if(n){let e=await p(n);y(e),A(e.path??n),m(e.path??n);return}y(t),A(t.path??e)}catch{}},M=()=>{if(o===`general`){t(!1),n(ve);return}let e=f.trim();e&&(t(!1),n(e))},N=(x||``).replace(/\\/g,`/`),ee=/^[A-Za-z]:($|\/)/.test(N),P=N.startsWith(`/`)||ee,F=N.split(`/`).filter(Boolean),I=e=>e.length?/^[A-Za-z]:$/.test(e[0])?e.length===1?`${e[0]}/`:`${e[0]}/${e.slice(1).join(`/`)}`:`${P?`/`:``}${e.join(`/`)}`:``,L=h?.roots||[],R=e=>String(e||``).replace(/\\/g,`/`).toLowerCase(),z=L.slice().sort((e,t)=>R(t.path).length-R(e.path).length).find(e=>{let t=R(e.path),n=R(x||f);return t&&(n===t||n.startsWith(t.endsWith(`/`)?t:`${t}/`))}),te=$.find(e=>e.value===o)||$[1];return(0,k.jsx)(T,{open:e,onOpenChange:t,children:(0,k.jsxs)(g,{className:`sm:max-w-lg`,children:[(0,k.jsx)(E,{children:(0,k.jsx)(_,{children:S(`selectProject`)})}),(0,k.jsxs)(`div`,{className:`relative`,children:[(0,k.jsxs)(`button`,{type:`button`,onClick:()=>d(!u),className:`w-full flex items-center justify-between h-9 px-3 rounded-lg border border-(--border-default) bg-(--bg-input) text-[13px] text-(--text-primary) cursor-pointer hover:bg-(--bg-hover)`,children:[(0,k.jsx)(`span`,{className:`font-medium`,children:te.label}),(0,k.jsx)(b,{size:14,className:`text-(--text-muted)`})]}),u&&(0,k.jsx)(`div`,{className:`absolute top-full left-0 right-0 mt-1 rounded-lg border border-(--border-default) bg-(--bg-primary) shadow-lg z-50 p-1`,children:$.map(e=>(0,k.jsx)(`button`,{className:C(`w-full text-left px-3 py-2 my-1 text-[13px] rounded-md cursor-pointer border-0`,o===e.value?`bg-(--bg-active) text-(--text-primary) font-medium`:`bg-transparent text-(--text-secondary) hover:bg-(--bg-hover)`),onClick:()=>{c(e.value),d(!1)},children:e.label},e.value))})]}),o===`general`?(0,k.jsxs)(`div`,{className:`flex flex-col items-center gap-4 py-8 text-(--text-muted) text-[13px]`,children:[(0,k.jsx)(`span`,{children:S(`generalChatDesc`)}),(0,k.jsx)(v,{onClick:M,className:`text-[13px] h-8`,children:S(`enterGeneral`)})]}):(0,k.jsxs)(k.Fragment,{children:[(0,k.jsxs)(`div`,{className:`flex gap-2`,children:[L.length>0&&(0,k.jsxs)(l,{value:z?.path||L[0]?.path,onValueChange:e=>{m(e),j(e)},children:[(0,k.jsx)(i,{className:`w-[132px] h-8 bg-(--bg-input) text-(--text-primary)`,children:(0,k.jsx)(r,{})}),(0,k.jsx)(a,{align:`start`,children:L.map(e=>(0,k.jsxs)(s,{value:e.path,children:[(0,k.jsx)(`span`,{className:`font-medium`,children:e.name}),(0,k.jsx)(`span`,{className:`text-(--text-muted) truncate`,children:e.path})]},e.path))})]}),(0,k.jsx)(D,{value:f,onChange:e=>m(e.target.value),placeholder:S(`enterOrBrowse`),onKeyDown:e=>e.key===`Enter`&&M(),className:`flex-1 h-8 text-[13px]`}),(0,k.jsx)(v,{onClick:M,className:`text-[13px] h-8`,children:S(`select`)})]}),(0,k.jsxs)(`div`,{className:`border border-(--border-default) rounded-lg overflow-hidden`,children:[(0,k.jsx)(`div`,{className:`flex items-center gap-1 text-[12px] px-3 py-2 border-b border-(--border-default) bg-(--bg-secondary) flex-wrap text-(--text-secondary)`,children:F.map((e,t)=>{let n=I(F.slice(0,t+1));return(0,k.jsxs)(`span`,{className:`flex items-center gap-1`,children:[t>0&&(0,k.jsx)(`span`,{className:`text-(--text-muted)`,children:`/`}),(0,k.jsx)(`button`,{onClick:()=>{m(n),j(n)},className:C(`hover:underline cursor-pointer border-0 bg-transparent`,t===F.length-1?`text-(--text-primary) font-medium`:`text-(--accent-blue)`),children:e})]},t)})}),(0,k.jsx)(ge,{className:`h-[240px]`,children:h&&(0,k.jsxs)(`div`,{className:`p-2`,children:[F.length>0&&(0,k.jsx)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{let e=I(F.slice(0,-1));m(e),j(e)},children:(0,k.jsx)(`span`,{children:`..`})}),(h.dirs||[]).map(e=>(0,k.jsxs)(`button`,{className:`w-full text-left px-2 py-1.5 text-[13px] hover:bg-(--bg-hover) rounded cursor-pointer flex items-center gap-2 border-0 bg-transparent text-(--text-secondary)`,onClick:()=>{m(e.path),j(e.path)},children:[(0,k.jsx)(`span`,{className:`flex-1 truncate`,children:e.name}),e.isGit&&(0,k.jsx)(`span`,{className:`text-[11px] text-(--text-muted) bg-(--bg-tertiary) px-1.5 py-0.5 rounded`,children:`git`})]},e.path)),!(h.roots||[]).length&&!(h.dirs||[]).length&&!h.error&&(0,k.jsx)(`div`,{className:`text-center text-[12px] text-(--text-muted) py-4`,children:S(`noSubDirs`)})]})})]})]})]})})}export{ye as ProjectSelector};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{a as r,i,n as a,r as o,t as s}from"./select-J6668k2a.js";import{t as ee}from"./chevron-right-BBG4s6Zh.js";import{n as c,t as l}from"./pencil-C0uznNC_.js";import{n as u,t as d}from"./trash-2-H0DiWqiE.js";import{B as f,J as p,L as m,P as h,Y as g,b as _,c as v,d as y,et as b,f as x,g as S,k as C,l as w,lt as T,n as E,ot as te,pt as D,r as O,rt as k,s as A,st as j,u as M,w as N}from"./index-DyIUhlc8.js";import{t as P}from"./input-BKNu4DOt.js";var F=h(`download`,[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]),ne=h(`file-code-corner`,[[`path`,{d:`M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35`,key:`1wthlu`}],[`path`,{d:`M14 2v5a1 1 0 0 0 1 1h5`,key:`wfsgrz`}],[`path`,{d:`m5 16-3 3 3 3`,key:`331omg`}],[`path`,{d:`m9 22 3-3-3-3`,key:`lsp7cz`}]]),I=h(`sliders-horizontal`,[[`path`,{d:`M10 5H3`,key:`1qgfaw`}],[`path`,{d:`M12 19H3`,key:`yhmn1j`}],[`path`,{d:`M14 3v4`,key:`1sua03`}],[`path`,{d:`M16 17v4`,key:`1q0r14`}],[`path`,{d:`M21 12h-9`,key:`1o4lsq`}],[`path`,{d:`M21 19h-5`,key:`1rlt1p`}],[`path`,{d:`M21 5h-7`,key:`1oszz2`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M8 12H3`,key:`a7s4jb`}]]),L=e(t(),1),R=n(),re=[`all`,`enabled`,`builtin`,`custom`],z=[`always`,`auto_attach`,`agent_requested`,`manual`];function B({checked:e,onClick:t,title:n}){return(0,R.jsx)(`button`,{type:`button`,onClick:t,title:n,"aria-pressed":e,className:D(`relative h-5 w-9 rounded-full border shadow-inner transition-colors`,e?`border-(--text-primary) bg-(--text-primary)`:`border-(--border-strong) bg-(--bg-hover)`),children:(0,R.jsx)(`span`,{className:D(`absolute left-0.5 top-0.5 size-3.5 rounded-full transition-transform`,e?`bg-(--bg-primary)`:`bg-(--text-muted)`,e?`translate-x-4`:`translate-x-0`)})})}function V(e){return T(e===`builtin`?`builtin`:e===`global`?`globalScope`:`projectScope`)}function ie(e){return`${e?.scope||`unknown`}:${e?.projectDir||``}:${e?.name||``}`}function H(e){return e===`__codemini_general__`?T(`generalChat`):e}function ae(e=[]){return Array.isArray(e)?e.map(e=>String(e||``).trim()).filter(Boolean).join(`
|
|
2
|
+
`):``}function oe(e=[],t=[]){let n=new Map;for(let t of Array.isArray(e)?e:[]){let e=String(t?.dir||t?.path||t||``).trim();!e||n.has(e)||n.set(e,{dir:e,label:t?.label||H(e.split(/[/\\]/).filter(Boolean).pop()||e)})}for(let e of Array.isArray(t)?t:[]){let t=String(e||``).trim();!t||n.has(t)||n.set(t,{dir:t,label:H(t.split(/[/\\]/).filter(Boolean).pop()||t)})}return Array.from(n.values())}function U(e){let t=String(e||``).trim();return t?`project:${t}`:``}function W(e){let t=String(e||``);return t===`global`?{scope:`global`,projectDir:``}:t.startsWith(`project:`)?{scope:`project`,projectDir:t.slice(8)}:{scope:`project`,projectDir:``}}function G(e=[]){return e[0]?.dir?U(e[0].dir):`global`}function K(e){return e?.scope===`builtin`}function q(e){return e?.enabled!==!1}function J({skill:e,projectTargets:t=[],onSave:n,onCancel:ee}){let[c,l]=(0,L.useState)(e?.name||``),[u,d]=(0,L.useState)(e?.description||``),[f,h]=(0,L.useState)(e?.scope===`global`?`global`:U(e?.projectDir)||G(t)),[g,_]=(0,L.useState)(e?.mode||`agent_requested`),[v,y]=(0,L.useState)((e?.triggers||[]).join(`, `)),[b,S]=(0,L.useState)(e?.priority??50),[C,w]=(0,L.useState)(q(e)),[D,k]=(0,L.useState)(``),[A,M]=(0,L.useState)(!1),N=!e,F=K(e);return(0,L.useEffect)(()=>{if(l(e?.name||``),d(e?.description||``),h(e?.scope===`global`?`global`:U(e?.projectDir)||G(t)),_(e?.mode||`agent_requested`),y((e?.triggers||[]).join(`, `)),S(e?.priority??50),w(q(e)),!e){k(``);return}M(!0),p(e.name,e.projectDir).then(e=>k(e.content||``)).catch(()=>{}).finally(()=>M(!1))},[e,t]),(0,R.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col`,children:[(0,R.jsxs)(`div`,{className:`min-h-0 flex-1 overflow-y-auto pr-1`,children:[(0,R.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:`text-[13px] font-medium text-(--text-primary)`,children:T(N?`newSkill`:`editSkill`)}),(0,R.jsx)(`div`,{className:`mt-0.5 text-[11px] text-(--text-muted)`,children:T(`skillEditorHint`)})]}),(0,R.jsx)(O,{variant:`outline`,className:`rounded-md px-1.5 py-0 text-[10px]`,children:V(W(f).scope)})]}),(0,R.jsxs)(`div`,{className:`grid gap-3`,children:[(N||!K(e))&&(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillScope`)}),(0,R.jsxs)(s,{value:f,onValueChange:h,children:[(0,R.jsx)(i,{className:`h-8 w-full bg-(--bg-primary) text-[13px]`,children:(0,R.jsx)(r,{})}),(0,R.jsxs)(a,{align:`start`,children:[(0,R.jsx)(o,{value:`global`,children:T(`globalScope`)}),t.map(e=>(0,R.jsx)(o,{value:U(e.dir),children:e.label},e.dir))]})]})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`name`)}),(0,R.jsx)(P,{value:c,onChange:e=>l(e.target.value),disabled:!N,placeholder:`my-skill`,className:`h-8 text-[13px]`})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`description`)}),(0,R.jsx)(P,{value:u,onChange:e=>d(e.target.value),placeholder:T(`skillDescriptionPlaceholder`),className:`h-8 text-[13px]`})]}),(0,R.jsxs)(`div`,{className:`rounded-md border border-(--border-default) bg-(--bg-secondary) p-3`,children:[(0,R.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-[12px] font-medium text-(--text-primary)`,children:[(0,R.jsx)(I,{size:13}),T(`skillRoutingSettings`)]}),(0,R.jsxs)(`div`,{className:`grid gap-3 sm:grid-cols-2`,children:[(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillMode`)}),(0,R.jsxs)(s,{value:g,onValueChange:_,children:[(0,R.jsx)(i,{className:`h-8 w-full bg-(--bg-primary) text-[13px]`,children:(0,R.jsx)(r,{})}),(0,R.jsx)(a,{align:`start`,children:z.map(e=>(0,R.jsx)(o,{value:e,children:T(`skillMode_${e}`)},e))})]})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillPriority`)}),(0,R.jsx)(P,{type:`number`,min:`0`,max:`100`,value:b,onChange:e=>S(e.target.value),className:`h-8 text-[13px]`})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5 sm:col-span-2`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillTriggers`)}),(0,R.jsx)(P,{value:v,onChange:e=>y(e.target.value),placeholder:`after_edit, before_final`,className:`h-8 text-[13px]`})]}),(0,R.jsxs)(`div`,{className:`flex items-center justify-between rounded-md border border-(--border-default) bg-(--bg-primary) px-2 py-1.5 sm:col-span-2`,children:[(0,R.jsx)(`span`,{className:`text-[12px] text-(--text-muted)`,children:T(C?`enabled`:`disabled`)}),(0,R.jsx)(B,{checked:C,onClick:()=>w(e=>!e),title:T(C?`disable`:`enable`)})]})]})]}),(0,R.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,R.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:T(`skillContent`)}),A?(0,R.jsxs)(`div`,{className:`rounded-md border border-(--border-default) py-8 text-center text-[12px] text-(--text-muted)`,children:[T(`loading`),`...`]}):(0,R.jsx)(E,{value:D,onChange:e=>k(e.target.value),disabled:F,className:`min-h-[360px] resize-y text-[13px] font-mono leading-5`,placeholder:`---
|
|
3
|
+
name: my-skill
|
|
4
|
+
description: ...
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
Skill instructions...`})]})]})]}),(0,R.jsxs)(`div`,{className:`mt-3 flex shrink-0 justify-end gap-2 border-t border-(--border-default) bg-(--bg-primary) pt-3`,children:[(0,R.jsx)(x,{variant:`outline`,onClick:ee,size:`sm`,children:T(`cancel`)}),(0,R.jsx)(x,{onClick:async()=>{let t=W(f),r={description:u,scope:t.scope,mode:g,triggers:v.split(`,`).map(e=>e.trim()).filter(Boolean),enabled:C,priority:Number(b)||0};N?(await m({name:c,description:u,content:D,scope:t.scope,projectDir:t.projectDir}),await j(c,r,t.scope===`project`?t.projectDir:void 0)):(F||await te(e.name,D,e.projectDir),await j(e.name,{...r,targetProjectDir:t.scope===`project`?t.projectDir:void 0},e.projectDir)),n()},disabled:A||!F&&!D.trim()||N&&!c.trim(),size:`sm`,children:T(N?`create`:`save`)})]})]})}function se({skill:e,projectTargets:t=[],open:n,onSave:r,onOpenChange:i}){return(0,R.jsx)(A,{open:n,onOpenChange:i,children:(0,R.jsxs)(v,{className:`sm:max-w-[760px] h-[86vh] max-h-[86vh] flex flex-col overflow-hidden`,children:[(0,R.jsx)(M,{className:`shrink-0`,children:(0,R.jsx)(y,{children:T(e?`editSkill`:`newSkill`)})}),(0,R.jsx)(J,{skill:e,projectTargets:t,onSave:r,onCancel:()=>i(!1)})]})})}function ce({skill:e,open:t,onOpenChange:n}){let[r,i]=(0,L.useState)(``),[a,o]=(0,L.useState)(!1);return(0,L.useEffect)(()=>{!t||!e||(o(!0),p(e.name,e.projectDir).then(e=>i(e.content||``)).catch(()=>{}).finally(()=>o(!1)))},[t,e]),(0,R.jsx)(A,{open:t,onOpenChange:n,children:(0,R.jsxs)(v,{className:`sm:max-w-[720px] max-h-[82vh] flex flex-col overflow-hidden`,children:[(0,R.jsx)(M,{className:`shrink-0`,children:(0,R.jsxs)(y,{children:[e?.name,` `,T(`contentPreview`)]})}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 pr-1`,children:a?(0,R.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:[T(`loading`),`...`]}):(0,R.jsx)(`pre`,{className:`rounded-lg bg-(--bg-secondary) p-3 text-[13px] whitespace-pre-wrap break-words font-mono leading-5`,children:r})}),(0,R.jsx)(w,{className:`shrink-0`,children:(0,R.jsx)(x,{variant:`outline`,onClick:()=>n(!1),size:`sm`,children:T(`close`)})})]})})}function le({skill:e,onView:t,onToggle:n,onEdit:r,onDelete:i}){let a=q(e);return(0,R.jsx)(`div`,{className:D(`rounded-lg border p-3 transition-colors`,a?`border-(--border-default) bg-(--bg-primary) hover:bg-(--bg-hover)`:`border-(--border-default) bg-(--bg-secondary) opacity-75`),children:(0,R.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,R.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,R.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,R.jsx)(`span`,{className:`truncate text-[13px] font-medium text-(--text-primary)`,children:e.name}),(0,R.jsx)(O,{variant:K(e)?`secondary`:`outline`,className:`h-4 rounded-md px-1.5 py-0 text-[10px]`,children:V(e.scope)}),(0,R.jsx)(O,{variant:a?`outline`:`secondary`,className:`h-4 rounded-md px-1.5 py-0 text-[10px]`,children:T(a?`enabled`:`disabled`)}),e.version&&e.version!==`0.0.0`&&(0,R.jsxs)(`span`,{className:`text-[10px] text-(--text-muted)`,children:[`v`,e.version]}),e.mode&&(0,R.jsx)(O,{variant:`outline`,className:`h-4 rounded-md px-1.5 py-0 text-[10px]`,children:T(`skillMode_${e.mode}`)})]}),(0,R.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[11px] leading-4 text-(--text-muted)`,children:e.description||T(`noDescription`)}),e.triggers?.length>0&&(0,R.jsxs)(`div`,{className:`mt-1 truncate text-[10px] text-(--text-muted)`,children:[T(`skillTriggers`),`: `,e.triggers.join(`, `)]})]}),(0,R.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,R.jsx)(x,{variant:`ghost`,size:`icon-xs`,onClick:()=>t(e),title:T(`view`),children:(0,R.jsx)(c,{size:13})}),(0,R.jsx)(B,{checked:a,onClick:()=>n(e,!a),title:T(a?`disable`:`enable`)}),(0,R.jsx)(x,{variant:`ghost`,size:`icon-xs`,onClick:()=>r(e),title:K(e)?T(`skillRoutingSettings`):T(`edit`),children:K(e)?(0,R.jsx)(I,{size:13}):(0,R.jsx)(l,{size:13})}),!K(e)&&(0,R.jsx)(x,{variant:`ghost`,size:`icon-xs`,onClick:()=>{confirm(T(`confirmDeleteSkill`).replace(`{{name}}`,e.name))&&i(e)},title:T(`delete`),className:`text-(--accent-red) hover:text-(--accent-red)`,children:(0,R.jsx)(d,{size:13})})]})]})})}function Y({projectDirs:e=[],projectTargets:t=[]}){let[n,c]=(0,L.useState)([]),[l,d]=(0,L.useState)(!0),[p,m]=(0,L.useState)(null),[h,v]=(0,L.useState)(null),[y,w]=(0,L.useState)(()=>new Set),[E,te]=(0,L.useState)(``),[D,O]=(0,L.useState)(`all`),[A,j]=(0,L.useState)(``),M=(0,L.useMemo)(()=>oe(t,e),[t,e]),[I,z]=(0,L.useState)(``),[B,V]=(0,L.useState)(!1),[J,Y]=(0,L.useState)(``),X=ae(e),Z=(0,L.useMemo)(()=>X?X.split(`
|
|
8
|
+
`):[],[X]);(0,L.useEffect)(()=>{let e=new Set([`global`,...M.map(e=>U(e.dir))]);I&&!e.has(I)&&z(``)},[I,M]);let Q=(0,L.useCallback)(async()=>{d(!0);try{let e=await g(Z);c(Array.isArray(e)?e:[])}catch{}d(!1)},[Z]);(0,L.useEffect)(()=>{Q()},[Q]);let ue=async(e,t)=>{c(n=>n.map(n=>n.name===e.name&&n.projectDir===e.projectDir?{...n,enabled:t}:n));try{await k(e.name,t,e.projectDir)}catch{c(n=>n.map(n=>n.name===e.name&&n.projectDir===e.projectDir?{...n,enabled:!t}:n))}try{let e=await g(Z);c(Array.isArray(e)?e:[])}catch{}},de=async e=>{await f(e.name,e.projectDir),Q()},fe=()=>{m(null),Q()},pe=async()=>{let e=A.trim();if(e){V(!0),Y(``);try{let t=W(I||G(M)),n=await b({source:e,scope:t.scope,projectDir:t.projectDir});if(n?.error)throw Error(n.message||`Install failed`);j(``),await Q()}catch(e){Y(e.message||`Install failed`)}finally{V(!1)}}};n.filter(q).length,n.filter(e=>!K(e)).length;let $=(0,L.useMemo)(()=>{let e=E.trim().toLowerCase();return n.filter(t=>D===`enabled`&&!q(t)||D===`builtin`&&t.scope!==`builtin`||D===`custom`&&t.scope===`builtin`?!1:e?t.name.toLowerCase().includes(e)||String(H(t.projectName||``)).toLowerCase().includes(e):!0)},[n,E,D]),me=(0,L.useMemo)(()=>{let e=[],t=[],n=new Map;for(let r of $){if(r.scope!==`project`){e.push(r);continue}let i=r.projectDir||`__current_project__`;if(!n.has(i)){let e={key:i,name:H(r.projectName||T(`projectScope`)),items:[]};n.set(i,e),t.push(e)}n.get(i).items.push(r)}return{regular:e,projectGroups:t}},[$]),he=(0,L.useCallback)(e=>{w(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]);return l?(0,R.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:[T(`loading`),`...`]}):(0,R.jsxs)(`div`,{className:`space-y-3`,children:[(0,R.jsx)(`div`,{className:`rounded-lg border border-(--border-default) bg-(--bg-secondary) p-3`,children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,R.jsxs)(`div`,{className:`min-w-0`,children:[(0,R.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,R.jsx)(ne,{size:14,className:`text-(--text-muted)`}),(0,R.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:T(`skillLibrary`)})]}),(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-(--text-muted)`,children:T(`skillPanelHint`)})]}),(0,R.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,children:(0,R.jsxs)(x,{onClick:()=>m(`new`),size:`sm`,children:[(0,R.jsx)(_,{size:13}),T(`addSkill`)]})})]})}),(0,R.jsxs)(`div`,{className:`grid gap-2 sm:grid-cols-[1fr_auto_auto] sm:items-center`,children:[(0,R.jsx)(P,{value:A,onChange:e=>j(e.target.value),placeholder:T(`skillInstallPlaceholder`),className:`h-8 text-[13px]`}),(0,R.jsxs)(s,{value:I||G(M),onValueChange:z,children:[(0,R.jsx)(i,{className:`h-8 w-full bg-(--bg-primary) text-[13px] sm:w-[150px]`,children:(0,R.jsx)(r,{})}),(0,R.jsxs)(a,{align:`start`,children:[(0,R.jsx)(o,{value:`global`,children:T(`globalScope`)}),M.map(e=>(0,R.jsx)(o,{value:U(e.dir),children:e.label},e.dir))]})]}),(0,R.jsxs)(x,{onClick:pe,disabled:B||!A.trim(),size:`sm`,children:[(0,R.jsx)(F,{size:13}),T(B?`installing`:`installSkill`)]})]}),J&&(0,R.jsx)(`div`,{className:`mt-2 text-[11px] text-(--accent-red)`,children:J}),(0,R.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,R.jsxs)(`div`,{className:`relative flex-1`,children:[(0,R.jsx)(u,{size:13,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-(--text-muted)`}),(0,R.jsx)(P,{value:E,onChange:e=>te(e.target.value),placeholder:T(`searchSkills`),className:`h-8 pl-8 text-[13px]`})]}),(0,R.jsx)(`div`,{className:`flex shrink-0 rounded-md border border-(--border-default) p-0.5 gap-0.5`,children:re.map(e=>(0,R.jsx)(x,{type:`button`,variant:D===e?`secondary`:`ghost`,size:`xs`,onClick:()=>O(e),className:`px-2`,children:T(`filter_${e}`)},e))})]}),(0,R.jsx)(S,{className:`bg-(--border-default)`}),n.length===0&&!p&&(0,R.jsxs)(`div`,{className:`rounded-lg border border-dashed border-(--border-default) py-8 text-center`,children:[(0,R.jsx)(`div`,{className:`text-[13px] text-(--text-primary)`,children:T(`noSkills`)}),(0,R.jsx)(`div`,{className:`mt-1 text-[11px] text-(--text-muted)`,children:T(`noSkillsHint`)})]}),n.length>0&&$.length===0&&(0,R.jsx)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:T(`noMatches`)}),(0,R.jsxs)(`div`,{className:`grid max-h-[420px] gap-2 overflow-y-auto pr-1`,children:[me.regular.map(e=>(0,R.jsx)(le,{skill:e,onView:v,onToggle:ue,onEdit:m,onDelete:de},ie(e))),me.projectGroups.map(e=>{let t=y.has(e.key);return(0,R.jsxs)(`div`,{className:`grid gap-1`,children:[(0,R.jsxs)(`button`,{type:`button`,onClick:()=>he(e.key),className:`flex h-8 w-full items-center gap-2 rounded-md border-0 bg-transparent px-2 text-left text-[12px] font-medium text-(--text-primary) hover:bg-(--bg-hover)`,title:e.key,children:[(0,R.jsx)(N,{size:14,className:`shrink-0 text-(--text-muted)`}),(0,R.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),(0,R.jsx)(`span`,{className:`shrink-0 text-[12px] font-medium text-(--text-accent)`,children:e.items.length}),t?(0,R.jsx)(ee,{size:13,className:`shrink-0 text-(--text-muted)`}):(0,R.jsx)(C,{size:13,className:`shrink-0 text-(--text-muted)`})]}),!t&&(0,R.jsx)(`div`,{className:`grid gap-2 pl-6`,children:e.items.map(e=>(0,R.jsx)(le,{skill:e,onView:v,onToggle:ue,onEdit:m,onDelete:de},ie(e)))})]},e.key)})]}),(0,R.jsx)(ce,{skill:h,open:!!h,onOpenChange:e=>{e||v(null)}}),(0,R.jsx)(se,{skill:p===`new`?null:p,projectTargets:M,open:!!p,onSave:fe,onOpenChange:e=>{e||m(null)}})]})}function X({open:e,onOpenChange:t,projectDirs:n=[],projectTargets:r=[]}){return(0,R.jsx)(A,{open:e,onOpenChange:t,children:(0,R.jsxs)(v,{className:`sm:max-w-[800px] max-h-[86vh] overflow-hidden flex flex-col`,children:[(0,R.jsx)(M,{children:(0,R.jsx)(y,{children:T(`skills`)})}),(0,R.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 pr-1`,children:(0,R.jsx)(Y,{projectDirs:n,projectTargets:r})})]})})}export{X as SkillDialog};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{n as r,t as i}from"./pencil-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-S-ySWqyJ.js";import{a as t,r as n}from"./bundle-mjs-C44PrJ2C.js";import{n as r,t as i}from"./pencil-C0uznNC_.js";import{n as a,t as o}from"./trash-2-H0DiWqiE.js";import{E as s,F as c,R as l,V as u,X as d,Z as f,b as p,c as m,ct as h,d as g,f as _,g as v,l as y,lt as b,n as x,pt as S,r as C,s as w,u as T}from"./index-DyIUhlc8.js";import{t as E}from"./input-BKNu4DOt.js";var D=e(t(),1),O=n(),k=[`all`,`builtin`,`custom`];function A({checked:e,onClick:t,title:n}){return(0,O.jsx)(`button`,{type:`button`,onClick:t,title:n,"aria-pressed":e,className:S(`relative h-5 w-9 rounded-full border shadow-inner transition-colors`,e?`border-(--text-primary) bg-(--text-primary)`:`border-(--border-strong) bg-(--bg-hover)`),children:(0,O.jsx)(`span`,{className:S(`absolute left-0.5 top-0.5 size-3.5 rounded-full transition-transform`,e?`bg-(--bg-primary)`:`bg-(--text-muted)`,e?`translate-x-4`:`translate-x-0`)})})}function j(e){return b(e===`builtin`?`builtin`:`custom`)}function M({soul:e,onSave:t,onCancel:n}){let[r,i]=(0,D.useState)(e?.name||``),[a,o]=(0,D.useState)(``),[s,c]=(0,D.useState)(!1),u=!e;return(0,D.useEffect)(()=>{if(i(e?.name||``),!e){o(``);return}c(!0),d(e.name).then(e=>o(e.content||``)).catch(()=>{}).finally(()=>c(!1))},[e]),(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsxs)(`div`,{className:`mb-3 flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{children:[(0,O.jsx)(`div`,{className:`text-[13px] font-medium text-(--text-primary)`,children:b(u?`newSoul`:`editSoul`)}),(0,O.jsx)(`div`,{className:`mt-0.5 text-[11px] text-(--text-muted)`,children:b(`soulEditorHint`)})]}),(0,O.jsx)(C,{variant:`outline`,className:`rounded-md px-1.5 py-0 text-[10px]`,children:u?b(`custom`):j(e.scope)})]}),(0,O.jsxs)(`div`,{className:`grid gap-3`,children:[(0,O.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,O.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:b(`name`)}),(0,O.jsx)(E,{value:r,onChange:e=>i(e.target.value),disabled:!u,placeholder:`my-soul`,className:`h-8 text-[13px]`})]}),(0,O.jsxs)(`div`,{className:`grid gap-1.5`,children:[(0,O.jsx)(`label`,{className:`text-[12px] text-(--text-muted)`,children:b(`soulContent`)}),s?(0,O.jsxs)(`div`,{className:`rounded-md border border-(--border-default) py-8 text-center text-[12px] text-(--text-muted)`,children:[b(`loading`),`...`]}):(0,O.jsx)(x,{value:a,onChange:e=>o(e.target.value),className:`min-h-[220px] resize-y text-[13px] font-mono leading-5`,placeholder:b(`soulPlaceholder`)})]})]}),(0,O.jsxs)(`div`,{className:`mt-3 flex justify-end gap-2`,children:[(0,O.jsx)(_,{variant:`outline`,onClick:n,size:`sm`,children:b(`cancel`)}),(0,O.jsx)(_,{onClick:async()=>{u?await l({name:r,content:a}):await h(e.name,a),t()},disabled:s||!a.trim()||u&&!r.trim(),size:`sm`,children:b(u?`create`:`save`)})]})]})}function N({soul:e,open:t,onSave:n,onOpenChange:r}){return(0,O.jsx)(w,{open:t,onOpenChange:r,children:(0,O.jsxs)(m,{className:`sm:max-w-[720px] max-h-[86vh] flex flex-col overflow-hidden`,children:[(0,O.jsx)(T,{className:`shrink-0`,children:(0,O.jsx)(g,{children:b(e?`editSoul`:`newSoul`)})}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 pr-1`,children:(0,O.jsx)(M,{soul:e,onSave:n,onCancel:()=>r(!1)})})]})})}function P({soul:e,open:t,onOpenChange:n}){let[r,i]=(0,D.useState)(``),[a,o]=(0,D.useState)(!1);return(0,D.useEffect)(()=>{!t||!e||(o(!0),d(e.name).then(e=>i(e.content||``)).catch(()=>{}).finally(()=>o(!1)))},[t,e]),(0,O.jsx)(w,{open:t,onOpenChange:n,children:(0,O.jsxs)(m,{className:`sm:max-w-[680px] max-h-[82vh] flex flex-col overflow-hidden`,children:[(0,O.jsx)(T,{className:`shrink-0`,children:(0,O.jsxs)(g,{children:[e?.name,` `,b(`contentPreview`)]})}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 pr-1`,children:a?(0,O.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:[b(`loading`),`...`]}):(0,O.jsx)(`pre`,{className:`rounded-lg bg-(--bg-secondary) p-3 text-[13px] whitespace-pre-wrap break-words font-mono leading-5`,children:r})}),(0,O.jsx)(y,{className:`shrink-0`,children:(0,O.jsx)(_,{variant:`outline`,onClick:()=>n(!1),size:`sm`,children:b(`close`)})})]})})}function F(){let[e,t]=(0,D.useState)([]),[n,l]=(0,D.useState)(!0),[d,m]=(0,D.useState)(null),[h,g]=(0,D.useState)(null),[y,x]=(0,D.useState)(``),[w,T]=(0,D.useState)(`all`),M=(0,D.useCallback)(async()=>{l(!0);try{let e=await f();t(Array.isArray(e)?e:[])}catch{}l(!1)},[]);(0,D.useEffect)(()=>{M()},[M]);let F=e.find(e=>e.active);e.filter(e=>e.scope!==`builtin`).length;let I=(0,D.useMemo)(()=>{let t=y.trim().toLowerCase();return e.filter(e=>w!==`all`&&e.scope!==w?!1:t?e.name.toLowerCase().includes(t):!0)},[e,y,w]),L=async e=>{await c(e),M()},R=async e=>{await u(e),M()};return n?(0,O.jsxs)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:[b(`loading`),`...`]}):(0,O.jsxs)(`div`,{className:`space-y-3`,children:[(0,O.jsx)(`div`,{className:`rounded-lg border border-(--border-default) bg-(--bg-secondary) p-3`,children:(0,O.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row sm:items-center sm:justify-between`,children:[(0,O.jsxs)(`div`,{className:`min-w-0`,children:[(0,O.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,O.jsx)(s,{size:14,className:`text-(--text-muted)`}),(0,O.jsx)(`span`,{className:`text-[13px] font-medium text-(--text-primary)`,children:F?.name||b(`noActiveSoul`)}),F&&(0,O.jsx)(C,{className:`h-4 rounded-md border-0 bg-(--text-primary) px-1.5 py-0 text-[10px] text-(--bg-primary)`,children:b(`current`)})]}),(0,O.jsx)(`div`,{className:`mt-1 text-[11px] text-(--text-muted)`,children:b(`soulPanelHint`)})]}),(0,O.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,O.jsxs)(_,{onClick:()=>m(`new`),size:`sm`,children:[(0,O.jsx)(p,{size:13}),b(`addSoul`)]})})]})}),(0,O.jsxs)(`div`,{className:`flex flex-col gap-2 sm:flex-row sm:items-center`,children:[(0,O.jsxs)(`div`,{className:`relative flex-1`,children:[(0,O.jsx)(a,{size:13,className:`pointer-events-none absolute left-2.5 top-1/2 -translate-y-1/2 text-(--text-muted)`}),(0,O.jsx)(E,{value:y,onChange:e=>x(e.target.value),placeholder:b(`searchSouls`),className:`h-8 pl-8 text-[13px]`})]}),(0,O.jsx)(`div`,{className:`flex shrink-0 rounded-md border border-(--border-default) p-0.5 gap-0.5`,children:k.map(e=>(0,O.jsx)(_,{type:`button`,variant:w===e?`secondary`:`ghost`,size:`xs`,onClick:()=>T(e),className:`px-2`,children:b(`filter_${e}`)},e))})]}),(0,O.jsx)(v,{className:`bg-(--border-default)`}),e.length===0&&!d&&(0,O.jsxs)(`div`,{className:`rounded-lg border border-dashed border-(--border-default) py-8 text-center`,children:[(0,O.jsx)(`div`,{className:`text-[13px] text-(--text-primary)`,children:b(`noSouls`)}),(0,O.jsx)(`div`,{className:`mt-1 text-[11px] text-(--text-muted)`,children:b(`noSoulsHint`)})]}),e.length>0&&I.length===0&&(0,O.jsx)(`div`,{className:`py-8 text-center text-[12px] text-(--text-muted)`,children:b(`noMatches`)}),(0,O.jsx)(`div`,{className:`grid max-h-[420px] gap-2 overflow-y-auto pr-1`,children:I.map(e=>(0,O.jsx)(`div`,{className:S(`rounded-lg border p-3 transition-colors`,e.active?`border-(--border-strong) bg-(--bg-active)`:`border-(--border-default) bg-(--bg-primary) hover:bg-(--bg-hover)`),children:(0,O.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,O.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,O.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,children:[(0,O.jsx)(`span`,{className:`truncate text-[13px] font-medium text-(--text-primary)`,children:e.name}),(0,O.jsx)(C,{variant:`outline`,className:`h-4 rounded-md px-1.5 py-0 text-[10px]`,children:j(e.scope)}),e.active&&(0,O.jsx)(C,{className:`h-4 rounded-md border-0 bg-(--text-primary) px-1.5 py-0 text-[10px] text-(--bg-primary)`,children:b(`current`)})]}),(0,O.jsx)(`div`,{className:`mt-1 line-clamp-2 text-[11px] leading-4 text-(--text-muted)`,children:e.preview||b(`noPreview`)})]}),(0,O.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,O.jsx)(_,{variant:`ghost`,size:`icon-xs`,onClick:()=>g(e),title:b(`view`),children:(0,O.jsx)(r,{size:13})}),(0,O.jsx)(A,{checked:!!e.active,onClick:()=>{e.active||L(e.name)},title:e.active?b(`current`):b(`activate`)}),e.scope!==`builtin`&&(0,O.jsxs)(O.Fragment,{children:[(0,O.jsx)(_,{variant:`ghost`,size:`icon-xs`,onClick:()=>m(e),title:b(`edit`),children:(0,O.jsx)(i,{size:13})}),(0,O.jsx)(_,{variant:`ghost`,size:`icon-xs`,onClick:()=>{confirm(b(`confirmDeleteSoul`).replace(`{{name}}`,e.name))&&R(e.name)},title:b(`delete`),className:`text-(--accent-red) hover:text-(--accent-red)`,children:(0,O.jsx)(o,{size:13})})]})]})]})},`${e.scope}-${e.name}`))}),(0,O.jsx)(P,{soul:h,open:!!h,onOpenChange:e=>{e||g(null)}}),(0,O.jsx)(N,{soul:d===`new`?null:d,open:!!d,onSave:()=>{m(null),M()},onOpenChange:e=>{e||m(null)}})]})}function I({open:e,onOpenChange:t}){return(0,O.jsx)(w,{open:e,onOpenChange:t,children:(0,O.jsxs)(m,{className:`sm:max-w-[760px] max-h-[86vh] overflow-hidden flex flex-col`,children:[(0,O.jsx)(T,{children:(0,O.jsx)(g,{children:b(`souls`)})}),(0,O.jsx)(`div`,{className:`flex-1 overflow-y-auto min-h-0 pr-1`,children:(0,O.jsx)(F,{})})]})})}export{I as SoulDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{P as e}from"./index-DyIUhlc8.js";var t=e(`chevron-right`,[[`path`,{d:`m9 18 6-6-6-6`,key:`mthhwq`}]]);export{t};
|