arize-phoenix 12.6.1__py3-none-any.whl → 12.7.0__py3-none-any.whl
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.
Potentially problematic release.
This version of arize-phoenix might be problematic. Click here for more details.
- {arize_phoenix-12.6.1.dist-info → arize_phoenix-12.7.0.dist-info}/METADATA +17 -11
- {arize_phoenix-12.6.1.dist-info → arize_phoenix-12.7.0.dist-info}/RECORD +30 -29
- phoenix/server/api/context.py +2 -0
- phoenix/server/api/dataloaders/__init__.py +2 -0
- phoenix/server/api/dataloaders/experiment_dataset_splits.py +43 -0
- phoenix/server/api/input_types/ChatCompletionInput.py +1 -0
- phoenix/server/api/input_types/DatasetFilter.py +5 -2
- phoenix/server/api/mutations/chat_mutations.py +17 -3
- phoenix/server/api/queries.py +53 -28
- phoenix/server/api/routers/v1/datasets.py +150 -1
- phoenix/server/api/routers/v1/experiments.py +19 -0
- phoenix/server/api/subscriptions.py +22 -19
- phoenix/server/api/types/Dataset.py +1 -1
- phoenix/server/api/types/Experiment.py +14 -0
- phoenix/server/app.py +2 -0
- phoenix/server/cost_tracking/model_cost_manifest.json +142 -0
- phoenix/server/static/.vite/manifest.json +43 -43
- phoenix/server/static/assets/{components-XKc983B9.js → components-X_GtZhnz.js} +777 -696
- phoenix/server/static/assets/{index-DG8e74sg.js → index-BCtFqQdo.js} +2 -2
- phoenix/server/static/assets/{pages-CSZW-lt0.js → pages-Dl8TWyNq.js} +588 -595
- phoenix/server/static/assets/vendor-3BvTzoBp.js +920 -0
- phoenix/server/static/assets/{vendor-arizeai-Cb1ncvYH.js → vendor-arizeai-C6_oC0y8.js} +1 -1
- phoenix/server/static/assets/vendor-codemirror-DPnZGAZA.js +25 -0
- phoenix/server/static/assets/{vendor-recharts-BC1ysIKu.js → vendor-recharts-CjgSbsB0.js} +7 -7
- phoenix/server/static/assets/{vendor-shiki-B45T-YxN.js → vendor-shiki-CJyhDG0E.js} +1 -1
- phoenix/version.py +1 -1
- phoenix/server/static/assets/vendor-CQ4tN9P7.js +0 -918
- phoenix/server/static/assets/vendor-codemirror-CckmKopH.js +0 -25
- {arize_phoenix-12.6.1.dist-info → arize_phoenix-12.7.0.dist-info}/WHEEL +0 -0
- {arize_phoenix-12.6.1.dist-info → arize_phoenix-12.7.0.dist-info}/entry_points.txt +0 -0
- {arize_phoenix-12.6.1.dist-info → arize_phoenix-12.7.0.dist-info}/licenses/IP_NOTICE +0 -0
- {arize_phoenix-12.6.1.dist-info → arize_phoenix-12.7.0.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var jt=Object.defineProperty;var kt=(n,e,t)=>e in n?jt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var f=(n,e,t)=>kt(n,typeof e!="symbol"?e+"":e,t);import{
|
|
1
|
+
var jt=Object.defineProperty;var kt=(n,e,t)=>e in n?jt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t;var f=(n,e,t)=>kt(n,typeof e!="symbol"?e+"":e,t);import{ee as wt}from"./vendor-3BvTzoBp.js";function vt(n,e,t){const{parseMetaString:a,trimEndingNewline:s=!0,defaultLanguage:r="text",fallbackLanguage:i}=t,c=e.getLoadedLanguages();n.options.highlight=(o,l="text",u)=>{l===""&&(l=r),i&&!c.includes(l)&&(l=i);const d=(a==null?void 0:a(u,o,l))||{},m={...t,lang:l,meta:{...t.meta,...d,__raw:u}},p=[];return p.push({name:"@shikijs/markdown-it:block-class",code(g){g.properties.class=`language-${l}`}}),s&&o.endsWith(`
|
|
2
2
|
`)&&(o=o.slice(0,-1)),e.codeToHtml(o,{...m,transformers:[...p,...m.transformers||[]]})}}function ba(n,e){return function(t){vt(t,n,e)}}let O=class extends Error{constructor(e){super(e),this.name="ShikiError"}},Ae=class extends Error{constructor(e){super(e),this.name="ShikiError"}};function Ct(){return 2147483648}function xt(){return typeof performance<"u"?performance.now():Date.now()}const St=(n,e)=>n+(e-n%e)%e;async function Bt(n){let e,t;const a={};function s(p){t=p,a.HEAPU8=new Uint8Array(p),a.HEAPU32=new Uint32Array(p)}function r(p,g,$){a.HEAPU8.copyWithin(p,g,g+$)}function i(p){try{return e.grow(p-t.byteLength+65535>>>16),s(e.buffer),1}catch{}}function c(p){const g=a.HEAPU8.length;p=p>>>0;const $=Ct();if(p>$)return!1;for(let b=1;b<=4;b*=2){let h=g*(1+.2/b);h=Math.min(h,p+100663296);const _=Math.min($,St(Math.max(p,h),65536));if(i(_))return!0}return!1}const o=typeof TextDecoder<"u"?new TextDecoder("utf8"):void 0;function l(p,g,$=1024){const b=g+$;let h=g;for(;p[h]&&!(h>=b);)++h;if(h-g>16&&p.buffer&&o)return o.decode(p.subarray(g,h));let _="";for(;g<h;){let y=p[g++];if(!(y&128)){_+=String.fromCharCode(y);continue}const j=p[g++]&63;if((y&224)===192){_+=String.fromCharCode((y&31)<<6|j);continue}const k=p[g++]&63;if((y&240)===224?y=(y&15)<<12|j<<6|k:y=(y&7)<<18|j<<12|k<<6|p[g++]&63,y<65536)_+=String.fromCharCode(y);else{const B=y-65536;_+=String.fromCharCode(55296|B>>10,56320|B&1023)}}return _}function u(p,g){return p?l(a.HEAPU8,p,g):""}const d={emscripten_get_now:xt,emscripten_memcpy_big:r,emscripten_resize_heap:c,fd_write:()=>0};async function m(){const g=await n({env:d,wasi_snapshot_preview1:d});e=g.memory,s(e.buffer),Object.assign(a,g),a.UTF8ToString=u}return await m(),a}var Rt=Object.defineProperty,At=(n,e,t)=>e in n?Rt(n,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):n[e]=t,v=(n,e,t)=>(At(n,typeof e!="symbol"?e+"":e,t),t);let C=null;function It(n){throw new Ae(n.UTF8ToString(n.getLastOnigError()))}class fe{constructor(e){v(this,"utf16Length"),v(this,"utf8Length"),v(this,"utf16Value"),v(this,"utf8Value"),v(this,"utf16OffsetToUtf8"),v(this,"utf8OffsetToUtf16");const t=e.length,a=fe._utf8ByteLength(e),s=a!==t,r=s?new Uint32Array(t+1):null;s&&(r[t]=a);const i=s?new Uint32Array(a+1):null;s&&(i[a]=t);const c=new Uint8Array(a);let o=0;for(let l=0;l<t;l++){const u=e.charCodeAt(l);let d=u,m=!1;if(u>=55296&&u<=56319&&l+1<t){const p=e.charCodeAt(l+1);p>=56320&&p<=57343&&(d=(u-55296<<10)+65536|p-56320,m=!0)}s&&(r[l]=o,m&&(r[l+1]=o),d<=127?i[o+0]=l:d<=2047?(i[o+0]=l,i[o+1]=l):d<=65535?(i[o+0]=l,i[o+1]=l,i[o+2]=l):(i[o+0]=l,i[o+1]=l,i[o+2]=l,i[o+3]=l)),d<=127?c[o++]=d:d<=2047?(c[o++]=192|(d&1984)>>>6,c[o++]=128|(d&63)>>>0):d<=65535?(c[o++]=224|(d&61440)>>>12,c[o++]=128|(d&4032)>>>6,c[o++]=128|(d&63)>>>0):(c[o++]=240|(d&1835008)>>>18,c[o++]=128|(d&258048)>>>12,c[o++]=128|(d&4032)>>>6,c[o++]=128|(d&63)>>>0),m&&l++}this.utf16Length=t,this.utf8Length=a,this.utf16Value=e,this.utf8Value=c,this.utf16OffsetToUtf8=r,this.utf8OffsetToUtf16=i}static _utf8ByteLength(e){let t=0;for(let a=0,s=e.length;a<s;a++){const r=e.charCodeAt(a);let i=r,c=!1;if(r>=55296&&r<=56319&&a+1<s){const o=e.charCodeAt(a+1);o>=56320&&o<=57343&&(i=(r-55296<<10)+65536|o-56320,c=!0)}i<=127?t+=1:i<=2047?t+=2:i<=65535?t+=3:t+=4,c&&a++}return t}createString(e){const t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}}const I=class{constructor(n){if(v(this,"id",++I.LAST_ID),v(this,"_onigBinding"),v(this,"content"),v(this,"utf16Length"),v(this,"utf8Length"),v(this,"utf16OffsetToUtf8"),v(this,"utf8OffsetToUtf16"),v(this,"ptr"),!C)throw new Ae("Must invoke loadWasm first.");this._onigBinding=C,this.content=n;const e=new fe(n);this.utf16Length=e.utf16Length,this.utf8Length=e.utf8Length,this.utf16OffsetToUtf8=e.utf16OffsetToUtf8,this.utf8OffsetToUtf16=e.utf8OffsetToUtf16,this.utf8Length<1e4&&!I._sharedPtrInUse?(I._sharedPtr||(I._sharedPtr=C.omalloc(1e4)),I._sharedPtrInUse=!0,C.HEAPU8.set(e.utf8Value,I._sharedPtr),this.ptr=I._sharedPtr):this.ptr=e.createString(C)}convertUtf8OffsetToUtf16(n){return this.utf8OffsetToUtf16?n<0?0:n>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[n]:n}convertUtf16OffsetToUtf8(n){return this.utf16OffsetToUtf8?n<0?0:n>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[n]:n}dispose(){this.ptr===I._sharedPtr?I._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};let J=I;v(J,"LAST_ID",0);v(J,"_sharedPtr",0);v(J,"_sharedPtrInUse",!1);class Tt{constructor(e){if(v(this,"_onigBinding"),v(this,"_ptr"),!C)throw new Ae("Must invoke loadWasm first.");const t=[],a=[];for(let c=0,o=e.length;c<o;c++){const l=new fe(e[c]);t[c]=l.createString(C),a[c]=l.utf8Length}const s=C.omalloc(4*e.length);C.HEAPU32.set(t,s/4);const r=C.omalloc(4*e.length);C.HEAPU32.set(a,r/4);const i=C.createOnigScanner(s,r,e.length);for(let c=0,o=e.length;c<o;c++)C.ofree(t[c]);C.ofree(r),C.ofree(s),i===0&&It(C),this._onigBinding=C,this._ptr=i}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,a){let s=0;if(typeof a=="number"&&(s=a),typeof e=="string"){e=new J(e);const r=this._findNextMatchSync(e,t,!1,s);return e.dispose(),r}return this._findNextMatchSync(e,t,!1,s)}_findNextMatchSync(e,t,a,s){const r=this._onigBinding,i=r.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),s);if(i===0)return null;const c=r.HEAPU32;let o=i/4;const l=c[o++],u=c[o++],d=[];for(let m=0;m<u;m++){const p=e.convertUtf8OffsetToUtf16(c[o++]),g=e.convertUtf8OffsetToUtf16(c[o++]);d[m]={start:p,end:g,length:g-p}}return{index:l,captureIndices:d}}}function Et(n){return typeof n.instantiator=="function"}function Nt(n){return typeof n.default=="function"}function Pt(n){return typeof n.data<"u"}function Lt(n){return typeof Response<"u"&&n instanceof Response}function Gt(n){var e;return typeof ArrayBuffer<"u"&&(n instanceof ArrayBuffer||ArrayBuffer.isView(n))||typeof Buffer<"u"&&((e=Buffer.isBuffer)==null?void 0:e.call(Buffer,n))||typeof SharedArrayBuffer<"u"&&n instanceof SharedArrayBuffer||typeof Uint32Array<"u"&&n instanceof Uint32Array}let ee;function Ft(n){if(ee)return ee;async function e(){C=await Bt(async t=>{let a=n;return a=await a,typeof a=="function"&&(a=await a(t)),typeof a=="function"&&(a=await a(t)),Et(a)?a=await a.instantiator(t):Nt(a)?a=await a.default(t):(Pt(a)&&(a=a.data),Lt(a)?typeof WebAssembly.instantiateStreaming=="function"?a=await Ot(a)(t):a=await Mt(a)(t):Gt(a)?a=await ye(a)(t):a instanceof WebAssembly.Module?a=await ye(a)(t):"default"in a&&a.default instanceof WebAssembly.Module&&(a=await ye(a.default)(t))),"instance"in a&&(a=a.instance),"exports"in a&&(a=a.exports),a})}return ee=e(),ee}function ye(n){return e=>WebAssembly.instantiate(n,e)}function Ot(n){return e=>WebAssembly.instantiateStreaming(n,e)}function Mt(n){return async e=>{const t=await n.arrayBuffer();return WebAssembly.instantiate(t,e)}}let Wt;function Ht(){return Wt}async function zt(n){return n&&await Ft(n),{createScanner(e){return new Tt(e.map(t=>typeof t=="string"?t:t.source))},createString(e){return new J(e)}}}function Ut(n){return Ie(n)}function Ie(n){return Array.isArray(n)?Dt(n):n instanceof RegExp?n:typeof n=="object"?qt(n):n}function Dt(n){let e=[];for(let t=0,a=n.length;t<a;t++)e[t]=Ie(n[t]);return e}function qt(n){let e={};for(let t in n)e[t]=Ie(n[t]);return e}function Qe(n,...e){return e.forEach(t=>{for(let a in t)n[a]=t[a]}),n}function Ye(n){const e=~n.lastIndexOf("/")||~n.lastIndexOf("\\");return e===0?n:~e===n.length-1?Ye(n.substring(0,n.length-1)):n.substr(~e+1)}var $e=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,te=class{static hasCaptures(n){return n===null?!1:($e.lastIndex=0,$e.test(n))}static replaceCaptures(n,e,t){return n.replace($e,(a,s,r,i)=>{let c=t[parseInt(s||r,10)];if(c){let o=e.substring(c.start,c.end);for(;o[0]===".";)o=o.substring(1);switch(i){case"downcase":return o.toLowerCase();case"upcase":return o.toUpperCase();default:return o}}else return a})}};function et(n,e){return n<e?-1:n>e?1:0}function tt(n,e){if(n===null&&e===null)return 0;if(!n)return-1;if(!e)return 1;let t=n.length,a=e.length;if(t===a){for(let s=0;s<t;s++){let r=et(n[s],e[s]);if(r!==0)return r}return 0}return t-a}function Fe(n){return!!(/^#[0-9a-f]{6}$/i.test(n)||/^#[0-9a-f]{8}$/i.test(n)||/^#[0-9a-f]{3}$/i.test(n)||/^#[0-9a-f]{4}$/i.test(n))}function nt(n){return n.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,"\\$&")}var at=class{constructor(n){f(this,"cache",new Map);this.fn=n}get(n){if(this.cache.has(n))return this.cache.get(n);const e=this.fn(n);return this.cache.set(n,e),e}},se=class{constructor(n,e,t){f(this,"_cachedMatchRoot",new at(n=>this._root.match(n)));this._colorMap=n,this._defaults=e,this._root=t}static createFromRawTheme(n,e){return this.createFromParsedTheme(Zt(n),e)}static createFromParsedTheme(n,e){return Jt(n,e)}getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(n){if(n===null)return this._defaults;const e=n.scopeName,a=this._cachedMatchRoot.get(e).find(s=>Vt(n.parent,s.parentScopes));return a?new st(a.fontStyle,a.foreground,a.background):null}},je=class ne{constructor(e,t){this.parent=e,this.scopeName=t}static push(e,t){for(const a of t)e=new ne(e,a);return e}static from(...e){let t=null;for(let a=0;a<e.length;a++)t=new ne(t,e[a]);return t}push(e){return new ne(this,e)}getSegments(){let e=this;const 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){const t=[];let a=this;for(;a&&a!==e;)t.push(a.scopeName),a=a.parent;return a===e?t.reverse():void 0}};function Vt(n,e){if(e.length===0)return!0;for(let t=0;t<e.length;t++){let a=e[t],s=!1;if(a===">"){if(t===e.length-1)return!1;a=e[++t],s=!0}for(;n&&!Xt(n.scopeName,a);){if(s)return!1;n=n.parent}if(!n)return!1;n=n.parent}return!0}function Xt(n,e){return e===n||n.startsWith(e)&&n[e.length]==="."}var st=class{constructor(n,e,t){this.fontStyle=n,this.foregroundId=e,this.backgroundId=t}};function Zt(n){if(!n)return[];if(!n.settings||!Array.isArray(n.settings))return[];let e=n.settings,t=[],a=0;for(let s=0,r=e.length;s<r;s++){let i=e[s];if(!i.settings)continue;let c;if(typeof i.scope=="string"){let d=i.scope;d=d.replace(/^[,]+/,""),d=d.replace(/[,]+$/,""),c=d.split(",")}else Array.isArray(i.scope)?c=i.scope:c=[""];let o=-1;if(typeof i.settings.fontStyle=="string"){o=0;let d=i.settings.fontStyle.split(" ");for(let m=0,p=d.length;m<p;m++)switch(d[m]){case"italic":o=o|1;break;case"bold":o=o|2;break;case"underline":o=o|4;break;case"strikethrough":o=o|8;break}}let l=null;typeof i.settings.foreground=="string"&&Fe(i.settings.foreground)&&(l=i.settings.foreground);let u=null;typeof i.settings.background=="string"&&Fe(i.settings.background)&&(u=i.settings.background);for(let d=0,m=c.length;d<m;d++){let g=c[d].trim().split(" "),$=g[g.length-1],b=null;g.length>1&&(b=g.slice(0,g.length-1),b.reverse()),t[a++]=new Kt($,b,s,o,l,u)}}return t}var Kt=class{constructor(n,e,t,a,s,r){this.scope=n,this.parentScopes=e,this.index=t,this.fontStyle=a,this.foreground=s,this.background=r}},L=(n=>(n[n.NotSet=-1]="NotSet",n[n.None=0]="None",n[n.Italic=1]="Italic",n[n.Bold=2]="Bold",n[n.Underline=4]="Underline",n[n.Strikethrough=8]="Strikethrough",n))(L||{});function Jt(n,e){n.sort((o,l)=>{let u=et(o.scope,l.scope);return u!==0||(u=tt(o.parentScopes,l.parentScopes),u!==0)?u:o.index-l.index});let t=0,a="#000000",s="#ffffff";for(;n.length>=1&&n[0].scope==="";){let o=n.shift();o.fontStyle!==-1&&(t=o.fontStyle),o.foreground!==null&&(a=o.foreground),o.background!==null&&(s=o.background)}let r=new Qt(e),i=new st(t,r.getId(a),r.getId(s)),c=new en(new ve(0,null,-1,0,0),[]);for(let o=0,l=n.length;o<l;o++){let u=n[o];c.insert(0,u.scope,u.parentScopes,u.fontStyle,r.getId(u.foreground),r.getId(u.background))}return new se(r,i,c)}var Qt=class{constructor(n){f(this,"_isFrozen");f(this,"_lastColorId");f(this,"_id2color");f(this,"_color2id");if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(n)){this._isFrozen=!0;for(let e=0,t=n.length;e<t;e++)this._color2id[n[e]]=e,this._id2color[e]=n[e]}else this._isFrozen=!1}getId(n){if(n===null)return 0;n=n.toUpperCase();let e=this._color2id[n];if(e)return e;if(this._isFrozen)throw new Error(`Missing color in color map - ${n}`);return e=++this._lastColorId,this._color2id[n]=e,this._id2color[e]=n,e}getColorMap(){return this._id2color.slice(0)}},Yt=Object.freeze([]),ve=class rt{constructor(e,t,a,s,r){f(this,"scopeDepth");f(this,"parentScopes");f(this,"fontStyle");f(this,"foreground");f(this,"background");this.scopeDepth=e,this.parentScopes=t||Yt,this.fontStyle=a,this.foreground=s,this.background=r}clone(){return new rt(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let a=0,s=e.length;a<s;a++)t[a]=e[a].clone();return t}acceptOverwrite(e,t,a,s){this.scopeDepth>e?console.log("how did this happen?"):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),a!==0&&(this.foreground=a),s!==0&&(this.background=s)}},en=class Ce{constructor(e,t=[],a={}){f(this,"_rulesWithParentScopes");this._mainRule=e,this._children=a,this._rulesWithParentScopes=t}static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let a=0,s=0;for(;e.parentScopes[a]===">"&&a++,t.parentScopes[s]===">"&&s++,!(a>=e.parentScopes.length||s>=t.parentScopes.length);){const r=t.parentScopes[s].length-e.parentScopes[a].length;if(r!==0)return r;a++,s++}return t.parentScopes.length-e.parentScopes.length}match(e){if(e!==""){let a=e.indexOf("."),s,r;if(a===-1?(s=e,r=""):(s=e.substring(0,a),r=e.substring(a+1)),this._children.hasOwnProperty(s))return this._children[s].match(r)}const t=this._rulesWithParentScopes.concat(this._mainRule);return t.sort(Ce._cmpBySpecificity),t}insert(e,t,a,s,r,i){if(t===""){this._doInsertHere(e,a,s,r,i);return}let c=t.indexOf("."),o,l;c===-1?(o=t,l=""):(o=t.substring(0,c),l=t.substring(c+1));let u;this._children.hasOwnProperty(o)?u=this._children[o]:(u=new Ce(this._mainRule.clone(),ve.cloneArr(this._rulesWithParentScopes)),this._children[o]=u),u.insert(e+1,l,a,s,r,i)}_doInsertHere(e,t,a,s,r){if(t===null){this._mainRule.acceptOverwrite(e,a,s,r);return}for(let i=0,c=this._rulesWithParentScopes.length;i<c;i++){let o=this._rulesWithParentScopes[i];if(tt(o.parentScopes,t)===0){o.acceptOverwrite(e,a,s,r);return}}a===-1&&(a=this._mainRule.fontStyle),s===0&&(s=this._mainRule.foreground),r===0&&(r=this._mainRule.background),this._rulesWithParentScopes.push(new ve(e,t,a,s,r))}},W=class R{static toBinaryStr(e){return e.toString(2).padStart(32,"0")}static print(e){const t=R.getLanguageId(e),a=R.getTokenType(e),s=R.getFontStyle(e),r=R.getForeground(e),i=R.getBackground(e);console.log({languageId:t,tokenType:a,fontStyle:s,foreground:r,background:i})}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(e,t,a,s,r,i,c){let o=R.getLanguageId(e),l=R.getTokenType(e),u=R.containsBalancedBrackets(e)?1:0,d=R.getFontStyle(e),m=R.getForeground(e),p=R.getBackground(e);return t!==0&&(o=t),a!==8&&(l=a),s!==null&&(u=s?1:0),r!==-1&&(d=r),i!==0&&(m=i),c!==0&&(p=c),(o<<0|l<<8|u<<10|d<<11|m<<15|p<<24)>>>0}};function re(n,e){const t=[],a=tn(n);let s=a.next();for(;s!==null;){let o=0;if(s.length===2&&s.charAt(1)===":"){switch(s.charAt(0)){case"R":o=1;break;case"L":o=-1;break;default:console.log(`Unknown priority ${s} in scope selector`)}s=a.next()}let l=i();if(t.push({matcher:l,priority:o}),s!==",")break;s=a.next()}return t;function r(){if(s==="-"){s=a.next();const o=r();return l=>!!o&&!o(l)}if(s==="("){s=a.next();const o=c();return s===")"&&(s=a.next()),o}if(Oe(s)){const o=[];do o.push(s),s=a.next();while(Oe(s));return l=>e(o,l)}return null}function i(){const o=[];let l=r();for(;l;)o.push(l),l=r();return u=>o.every(d=>d(u))}function c(){const o=[];let l=i();for(;l&&(o.push(l),s==="|"||s===",");){do s=a.next();while(s==="|"||s===",");l=i()}return u=>o.some(d=>d(u))}}function Oe(n){return!!n&&!!n.match(/[\w\.:]+/)}function tn(n){let e=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,t=e.exec(n);return{next:()=>{if(!t)return null;const a=t[0];return t=e.exec(n),a}}}function it(n){typeof n.dispose=="function"&&n.dispose()}var V=class{constructor(n){this.scopeName=n}toKey(){return this.scopeName}},nn=class{constructor(n,e){this.scopeName=n,this.ruleName=e}toKey(){return`${this.scopeName}#${this.ruleName}`}},an=class{constructor(){f(this,"_references",[]);f(this,"_seenReferenceKeys",new Set);f(this,"visitedRule",new Set)}get references(){return this._references}add(n){const e=n.toKey();this._seenReferenceKeys.has(e)||(this._seenReferenceKeys.add(e),this._references.push(n))}},sn=class{constructor(n,e){f(this,"seenFullScopeRequests",new Set);f(this,"seenPartialScopeRequests",new Set);f(this,"Q");this.repo=n,this.initialScopeName=e,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new V(this.initialScopeName)]}processQueue(){const n=this.Q;this.Q=[];const e=new an;for(const t of n)rn(t,this.initialScopeName,this.repo,e);for(const t of e.references)if(t instanceof V){if(this.seenFullScopeRequests.has(t.scopeName))continue;this.seenFullScopeRequests.add(t.scopeName),this.Q.push(t)}else{if(this.seenFullScopeRequests.has(t.scopeName)||this.seenPartialScopeRequests.has(t.toKey()))continue;this.seenPartialScopeRequests.add(t.toKey()),this.Q.push(t)}}};function rn(n,e,t,a){const s=t.lookup(n.scopeName);if(!s){if(n.scopeName===e)throw new Error(`No grammar provided for <${e}>`);return}const r=t.lookup(e);n instanceof V?ae({baseGrammar:r,selfGrammar:s},a):xe(n.ruleName,{baseGrammar:r,selfGrammar:s,repository:s.repository},a);const i=t.injections(n.scopeName);if(i)for(const c of i)a.add(new V(c))}function xe(n,e,t){if(e.repository&&e.repository[n]){const a=e.repository[n];ie([a],e,t)}}function ae(n,e){n.selfGrammar.patterns&&Array.isArray(n.selfGrammar.patterns)&&ie(n.selfGrammar.patterns,{...n,repository:n.selfGrammar.repository},e),n.selfGrammar.injections&&ie(Object.values(n.selfGrammar.injections),{...n,repository:n.selfGrammar.repository},e)}function ie(n,e,t){for(const a of n){if(t.visitedRule.has(a))continue;t.visitedRule.add(a);const s=a.repository?Qe({},e.repository,a.repository):e.repository;Array.isArray(a.patterns)&&ie(a.patterns,{...e,repository:s},t);const r=a.include;if(!r)continue;const i=ot(r);switch(i.kind){case 0:ae({...e,selfGrammar:e.baseGrammar},t);break;case 1:ae(e,t);break;case 2:xe(i.ruleName,{...e,repository:s},t);break;case 3:case 4:const c=i.scopeName===e.selfGrammar.scopeName?e.selfGrammar:i.scopeName===e.baseGrammar.scopeName?e.baseGrammar:void 0;if(c){const o={baseGrammar:e.baseGrammar,selfGrammar:c,repository:s};i.kind===4?xe(i.ruleName,o,t):ae(o,t)}else i.kind===4?t.add(new nn(i.scopeName,i.ruleName)):t.add(new V(i.scopeName));break}}}var on=class{constructor(){f(this,"kind",0)}},cn=class{constructor(){f(this,"kind",1)}},ln=class{constructor(n){f(this,"kind",2);this.ruleName=n}},un=class{constructor(n){f(this,"kind",3);this.scopeName=n}},dn=class{constructor(n,e){f(this,"kind",4);this.scopeName=n,this.ruleName=e}};function ot(n){if(n==="$base")return new on;if(n==="$self")return new cn;const e=n.indexOf("#");if(e===-1)return new un(n);if(e===0)return new ln(n.substring(1));{const t=n.substring(0,e),a=n.substring(e+1);return new dn(t,a)}}var pn=/\\(\d+)/,Me=/\\(\d+)/g,mn=-1,ct=-2;var Q=class{constructor(n,e,t,a){f(this,"$location");f(this,"id");f(this,"_nameIsCapturing");f(this,"_name");f(this,"_contentNameIsCapturing");f(this,"_contentName");this.$location=n,this.id=e,this._name=t||null,this._nameIsCapturing=te.hasCaptures(this._name),this._contentName=a||null,this._contentNameIsCapturing=te.hasCaptures(this._contentName)}get debugName(){const n=this.$location?`${Ye(this.$location.filename)}:${this.$location.line}`:"unknown";return`${this.constructor.name}#${this.id} @ ${n}`}getName(n,e){return!this._nameIsCapturing||this._name===null||n===null||e===null?this._name:te.replaceCaptures(this._name,n,e)}getContentName(n,e){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:te.replaceCaptures(this._contentName,n,e)}},fn=class extends Q{constructor(e,t,a,s,r){super(e,t,a,s);f(this,"retokenizeCapturedWithRuleId");this.retokenizeCapturedWithRuleId=r}dispose(){}collectPatterns(e,t){throw new Error("Not supported!")}compile(e,t){throw new Error("Not supported!")}compileAG(e,t,a,s){throw new Error("Not supported!")}},gn=class extends Q{constructor(e,t,a,s,r){super(e,t,a,null);f(this,"_match");f(this,"captures");f(this,"_cachedCompiledPatterns");this._match=new X(s,this.id),this.captures=r,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=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,a,s){return this._getCachedCompiledPatterns(e).compileAG(e,a,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Z,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},We=class extends Q{constructor(e,t,a,s,r){super(e,t,a,s);f(this,"hasMissingPatterns");f(this,"patterns");f(this,"_cachedCompiledPatterns");this.patterns=r.patterns,this.hasMissingPatterns=r.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null)}collectPatterns(e,t){for(const a of this.patterns)e.getRule(a).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,a,s){return this._getCachedCompiledPatterns(e).compileAG(e,a,s)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new Z,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},Se=class extends Q{constructor(e,t,a,s,r,i,c,o,l,u){super(e,t,a,s);f(this,"_begin");f(this,"beginCaptures");f(this,"_end");f(this,"endHasBackReferences");f(this,"endCaptures");f(this,"applyEndPatternLast");f(this,"hasMissingPatterns");f(this,"patterns");f(this,"_cachedCompiledPatterns");this._begin=new X(r,this.id),this.beginCaptures=i,this._end=new X(c||"",-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=o,this.applyEndPatternLast=l||!1,this.patterns=u.patterns,this.hasMissingPatterns=u.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=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,a,s){return this._getCachedCompiledPatterns(e,t).compileAG(e,a,s)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Z;for(const a of this.patterns)e.getRule(a).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}},oe=class extends Q{constructor(e,t,a,s,r,i,c,o,l){super(e,t,a,s);f(this,"_begin");f(this,"beginCaptures");f(this,"whileCaptures");f(this,"_while");f(this,"whileHasBackReferences");f(this,"hasMissingPatterns");f(this,"patterns");f(this,"_cachedCompiledPatterns");f(this,"_cachedCompiledWhilePatterns");this._begin=new X(r,this.id),this.beginCaptures=i,this.whileCaptures=o,this._while=new X(c,ct),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&(this._cachedCompiledPatterns.dispose(),this._cachedCompiledPatterns=null),this._cachedCompiledWhilePatterns&&(this._cachedCompiledWhilePatterns.dispose(),this._cachedCompiledWhilePatterns=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,a,s){return this._getCachedCompiledPatterns(e).compileAG(e,a,s)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new Z;for(const 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,a,s){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,a,s)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new Z,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||""),this._cachedCompiledWhilePatterns}},lt=class x{static createCaptureRule(e,t,a,s,r){return e.registerRule(i=>new fn(t,i,a,s,r))}static getCompiledRuleId(e,t,a){return e.id||t.registerRule(s=>{if(e.id=s,e.match)return new gn(e.$vscodeTextmateLocation,e.id,e.name,e.match,x._compileCaptures(e.captures,t,a));if(typeof e.begin>"u"){e.repository&&(a=Qe({},a,e.repository));let r=e.patterns;return typeof r>"u"&&e.include&&(r=[{include:e.include}]),new We(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,x._compilePatterns(r,t,a))}return e.while?new oe(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,x._compileCaptures(e.beginCaptures||e.captures,t,a),e.while,x._compileCaptures(e.whileCaptures||e.captures,t,a),x._compilePatterns(e.patterns,t,a)):new Se(e.$vscodeTextmateLocation,e.id,e.name,e.contentName,e.begin,x._compileCaptures(e.beginCaptures||e.captures,t,a),e.end,x._compileCaptures(e.endCaptures||e.captures,t,a),e.applyEndPatternLast,x._compilePatterns(e.patterns,t,a))}),e.id}static _compileCaptures(e,t,a){let s=[];if(e){let r=0;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const c=parseInt(i,10);c>r&&(r=c)}for(let i=0;i<=r;i++)s[i]=null;for(const i in e){if(i==="$vscodeTextmateLocation")continue;const c=parseInt(i,10);let o=0;e[i].patterns&&(o=x.getCompiledRuleId(e[i],t,a)),s[c]=x.createCaptureRule(t,e[i].$vscodeTextmateLocation,e[i].name,e[i].contentName,o)}}return s}static _compilePatterns(e,t,a){let s=[];if(e)for(let r=0,i=e.length;r<i;r++){const c=e[r];let o=-1;if(c.include){const l=ot(c.include);switch(l.kind){case 0:case 1:o=x.getCompiledRuleId(a[c.include],t,a);break;case 2:let u=a[l.ruleName];u&&(o=x.getCompiledRuleId(u,t,a));break;case 3:case 4:const d=l.scopeName,m=l.kind===4?l.ruleName:null,p=t.getExternalGrammar(d,a);if(p)if(m){let g=p.repository[m];g&&(o=x.getCompiledRuleId(g,t,p.repository))}else o=x.getCompiledRuleId(p.repository.$self,t,p.repository);break}}else o=x.getCompiledRuleId(c,t,a);if(o!==-1){const l=t.getRule(o);let u=!1;if((l instanceof We||l instanceof Se||l instanceof oe)&&l.hasMissingPatterns&&l.patterns.length===0&&(u=!0),u)continue;s.push(o)}}return{patterns:s,hasMissingPatterns:(e?e.length:0)!==s.length}}},X=class ut{constructor(e,t){f(this,"source");f(this,"ruleId");f(this,"hasAnchor");f(this,"hasBackReferences");f(this,"_anchorCache");if(e&&typeof e=="string"){const a=e.length;let s=0,r=[],i=!1;for(let c=0;c<a;c++)if(e.charAt(c)==="\\"&&c+1<a){const l=e.charAt(c+1);l==="z"?(r.push(e.substring(s,c)),r.push("$(?!\\n)(?<!\\n)"),s=c+2):(l==="A"||l==="G")&&(i=!0),c++}this.hasAnchor=i,s===0?this.source=e:(r.push(e.substring(s,a)),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=pn.test(this.source):this.hasBackReferences=!1}clone(){return new ut(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 new Error("This method should only be called if the source is a string");let a=t.map(s=>e.substring(s.start,s.end));return Me.lastIndex=0,this.source.replace(Me,(s,r)=>nt(a[parseInt(r,10)]||""))}_buildAnchorCache(){if(typeof this.source!="string")throw new Error("This method should only be called if the source is a string");let e=[],t=[],a=[],s=[],r,i,c,o;for(r=0,i=this.source.length;r<i;r++)c=this.source.charAt(r),e[r]=c,t[r]=c,a[r]=c,s[r]=c,c==="\\"&&r+1<i&&(o=this.source.charAt(r+1),o==="A"?(e[r+1]="",t[r+1]="",a[r+1]="A",s[r+1]="A"):o==="G"?(e[r+1]="",t[r+1]="G",a[r+1]="",s[r+1]="G"):(e[r+1]=o,t[r+1]=o,a[r+1]=o,s[r+1]=o),r++);return{A0_G0:e.join(""),A0_G1:t.join(""),A1_G0:a.join(""),A1_G1:s.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}},Z=class{constructor(){f(this,"_items");f(this,"_hasAnchors");f(this,"_cached");f(this,"_anchorCache");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(),this._cached=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(n){this._items.push(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}unshift(n){this._items.unshift(n),this._hasAnchors=this._hasAnchors||n.hasAnchor}length(){return this._items.length}setSource(n,e){this._items[n].source!==e&&(this._disposeCaches(),this._items[n].setSource(e))}compile(n){if(!this._cached){let e=this._items.map(t=>t.source);this._cached=new He(n,e,this._items.map(t=>t.ruleId))}return this._cached}compileAG(n,e,t){return this._hasAnchors?e?t?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A1_G0):t?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(n,e,t)),this._anchorCache.A0_G0):this.compile(n)}_resolveAnchors(n,e,t){let a=this._items.map(s=>s.resolveAnchors(e,t));return new He(n,a,this._items.map(s=>s.ruleId))}},He=class{constructor(n,e,t){f(this,"scanner");this.regExps=e,this.rules=t,this.scanner=n.createOnigScanner(e)}dispose(){typeof this.scanner.dispose=="function"&&this.scanner.dispose()}toString(){const n=[];for(let e=0,t=this.rules.length;e<t;e++)n.push(" - "+this.rules[e]+": "+this.regExps[e]);return n.join(`
|
|
3
3
|
`)}findNextMatchSync(n,e,t){const a=this.scanner.findNextMatchSync(n,e,t);return a?{ruleId:this.rules[a.index],captureIndices:a.captureIndices}:null}},ke=class{constructor(n,e){this.languageId=n,this.tokenType=e}},P,hn=(P=class{constructor(e,t){f(this,"_defaultAttributes");f(this,"_embeddedLanguagesMatcher");f(this,"_getBasicScopeAttributes",new at(e=>{const t=this._scopeToLanguage(e),a=this._toStandardTokenType(e);return new ke(t,a)}));this._defaultAttributes=new ke(e,8),this._embeddedLanguagesMatcher=new bn(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(e){return e===null?P._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(e)}_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(e){const t=e.match(P.STANDARD_TOKEN_TYPE_REGEXP);if(!t)return 8;switch(t[1]){case"comment":return 1;case"string":return 2;case"regex":return 3;case"meta.embedded":return 0}throw new Error("Unexpected match for standard token type!")}},f(P,"_NULL_SCOPE_METADATA",new ke(0,0)),f(P,"STANDARD_TOKEN_TYPE_REGEXP",/\b(comment|string|regex|meta\.embedded)\b/),P),bn=class{constructor(n){f(this,"values");f(this,"scopesRegExp");if(n.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(n);const e=n.map(([t,a])=>nt(t));e.sort(),e.reverse(),this.scopesRegExp=new RegExp(`^((${e.join(")|(")}))($|\\.)`,"")}}match(n){if(!this.scopesRegExp)return;const e=n.match(this.scopesRegExp);if(e)return this.values.get(e[1])}},ze=class{constructor(n,e){this.stack=n,this.stoppedEarly=e}};function dt(n,e,t,a,s,r,i,c){const o=e.content.length;let l=!1,u=-1;if(i){const p=_n(n,e,t,a,s,r);s=p.stack,a=p.linePos,t=p.isFirstLine,u=p.anchorPosition}const d=Date.now();for(;!l;){if(c!==0&&Date.now()-d>c)return new ze(s,!0);m()}return new ze(s,!1);function m(){const p=yn(n,e,t,a,s,u);if(!p){r.produce(s,o),l=!0;return}const g=p.captureIndices,$=p.matchedRuleId,b=g&&g.length>0?g[0].end>a:!1;if($===mn){const h=s.getRule(n);r.produce(s,g[0].start),s=s.withContentNameScopesList(s.nameScopesList),D(n,e,t,s,r,h.endCaptures,g),r.produce(s,g[0].end);const _=s;if(s=s.parent,u=_.getAnchorPos(),!b&&_.getEnterPos()===a){s=_,r.produce(s,o),l=!0;return}}else{const h=n.getRule($);r.produce(s,g[0].start);const _=s,y=h.getName(e.content,g),j=s.contentNameScopesList.pushAttributed(y,n);if(s=s.push($,a,u,g[0].end===o,null,j,j),h instanceof Se){const k=h;D(n,e,t,s,r,k.beginCaptures,g),r.produce(s,g[0].end),u=g[0].end;const B=k.getContentName(e.content,g),w=j.pushAttributed(B,n);if(s=s.withContentNameScopesList(w),k.endHasBackReferences&&(s=s.withEndRule(k.getEndWithResolvedBackReferences(e.content,g))),!b&&_.hasSameRuleAs(s)){s=s.pop(),r.produce(s,o),l=!0;return}}else if(h instanceof oe){const k=h;D(n,e,t,s,r,k.beginCaptures,g),r.produce(s,g[0].end),u=g[0].end;const B=k.getContentName(e.content,g),w=j.pushAttributed(B,n);if(s=s.withContentNameScopesList(w),k.whileHasBackReferences&&(s=s.withEndRule(k.getWhileWithResolvedBackReferences(e.content,g))),!b&&_.hasSameRuleAs(s)){s=s.pop(),r.produce(s,o),l=!0;return}}else if(D(n,e,t,s,r,h.captures,g),r.produce(s,g[0].end),s=s.pop(),!b){s=s.safePop(),r.produce(s,o),l=!0;return}}g[0].end>a&&(a=g[0].end,t=!1)}}function _n(n,e,t,a,s,r){let i=s.beginRuleCapturedEOL?0:-1;const c=[];for(let o=s;o;o=o.pop()){const l=o.getRule(n);l instanceof oe&&c.push({rule:l,stack:o})}for(let o=c.pop();o;o=c.pop()){const{ruleScanner:l,findOptions:u}=kn(o.rule,n,o.stack.endRule,t,a===i),d=l.findNextMatchSync(e,a,u);if(d){if(d.ruleId!==ct){s=o.stack.pop();break}d.captureIndices&&d.captureIndices.length&&(r.produce(o.stack,d.captureIndices[0].start),D(n,e,t,o.stack,r,o.rule.whileCaptures,d.captureIndices),r.produce(o.stack,d.captureIndices[0].end),i=d.captureIndices[0].end,d.captureIndices[0].end>a&&(a=d.captureIndices[0].end,t=!1))}else{s=o.stack.pop();break}}return{stack:s,linePos:a,anchorPosition:i,isFirstLine:t}}function yn(n,e,t,a,s,r){const i=$n(n,e,t,a,s,r),c=n.getInjections();if(c.length===0)return i;const o=jn(c,n,e,t,a,s,r);if(!o)return i;if(!i)return o;const l=i.captureIndices[0].start,u=o.captureIndices[0].start;return u<l||o.priorityMatch&&u===l?o:i}function $n(n,e,t,a,s,r){const i=s.getRule(n),{ruleScanner:c,findOptions:o}=pt(i,n,s.endRule,t,a===r),l=c.findNextMatchSync(e,a,o);return l?{captureIndices:l.captureIndices,matchedRuleId:l.ruleId}:null}function jn(n,e,t,a,s,r,i){let c=Number.MAX_VALUE,o=null,l,u=0;const d=r.contentNameScopesList.getScopeNames();for(let m=0,p=n.length;m<p;m++){const g=n[m];if(!g.matcher(d))continue;const $=e.getRule(g.ruleId),{ruleScanner:b,findOptions:h}=pt($,e,null,a,s===i),_=b.findNextMatchSync(t,s,h);if(!_)continue;const y=_.captureIndices[0].start;if(!(y>=c)&&(c=y,o=_.captureIndices,l=_.ruleId,u=g.priority,c===s))break}return o?{priorityMatch:u===-1,captureIndices:o,matchedRuleId:l}:null}function pt(n,e,t,a,s){return{ruleScanner:n.compileAG(e,t,a,s),findOptions:0}}function kn(n,e,t,a,s){return{ruleScanner:n.compileWhileAG(e,t,a,s),findOptions:0}}function D(n,e,t,a,s,r,i){if(r.length===0)return;const c=e.content,o=Math.min(r.length,i.length),l=[],u=i[0].end;for(let d=0;d<o;d++){const m=r[d];if(m===null)continue;const p=i[d];if(p.length===0)continue;if(p.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=p.start;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?s.produceFromScopes(l[l.length-1].scopes,p.start):s.produce(a,p.start),m.retokenizeCapturedWithRuleId){const $=m.getName(c,i),b=a.contentNameScopesList.pushAttributed($,n),h=m.getContentName(c,i),_=b.pushAttributed(h,n),y=a.push(m.retokenizeCapturedWithRuleId,p.start,-1,!1,null,b,_),j=n.createOnigString(c.substring(0,p.end));dt(n,j,t&&p.start===0,p.start,y,s,!1,0),it(j);continue}const g=m.getName(c,i);if(g!==null){const b=(l.length>0?l[l.length-1].scopes:a.contentNameScopesList).pushAttributed(g,n);l.push(new wn(b,p.end))}}for(;l.length>0;)s.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var wn=class{constructor(n,e){f(this,"scopes");f(this,"endPos");this.scopes=n,this.endPos=e}};function vn(n,e,t,a,s,r,i,c){return new xn(n,e,t,a,s,r,i,c)}function Ue(n,e,t,a,s){const r=re(e,ce),i=lt.getCompiledRuleId(t,a,s.repository);for(const c of r)n.push({debugSelector:e,matcher:c.matcher,ruleId:i,grammar:s,priority:c.priority})}function ce(n,e){if(e.length<n.length)return!1;let t=0;return n.every(a=>{for(let s=t;s<e.length;s++)if(Cn(e[s],a))return t=s+1,!0;return!1})}function Cn(n,e){if(!n)return!1;if(n===e)return!0;const t=e.length;return n.length>t&&n.substr(0,t)===e&&n[t]==="."}var xn=class{constructor(n,e,t,a,s,r,i,c){f(this,"_rootId");f(this,"_lastRuleId");f(this,"_ruleId2desc");f(this,"_includedGrammars");f(this,"_grammarRepository");f(this,"_grammar");f(this,"_injections");f(this,"_basicScopeAttributesProvider");f(this,"_tokenTypeMatchers");if(this._rootScopeName=n,this.balancedBracketSelectors=r,this._onigLib=c,this._basicScopeAttributesProvider=new hn(t,a),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=i,this._grammar=De(e,null),this._injections=null,this._tokenTypeMatchers=[],s)for(const o of Object.keys(s)){const l=re(o,ce);for(const u of l)this._tokenTypeMatchers.push({matcher:u.matcher,type:s[o]})}}get themeProvider(){return this._grammarRepository}dispose(){for(const n of this._ruleId2desc)n&&n.dispose()}createOnigScanner(n){return this._onigLib.createOnigScanner(n)}createOnigString(n){return this._onigLib.createOnigString(n)}getMetadataForScope(n){return this._basicScopeAttributesProvider.getBasicScopeAttributes(n)}_collectInjections(){const n={lookup:s=>s===this._rootScopeName?this._grammar:this.getExternalGrammar(s),injections:s=>this._grammarRepository.injections(s)},e=[],t=this._rootScopeName,a=n.lookup(t);if(a){const s=a.injections;if(s)for(let i in s)Ue(e,i,s[i],this,a);const r=this._grammarRepository.injections(t);r&&r.forEach(i=>{const c=this.getExternalGrammar(i);if(c){const o=c.injectionSelector;o&&Ue(e,o,c,this,c)}})}return e.sort((s,r)=>s.priority-r.priority),e}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(n){const e=++this._lastRuleId,t=n(e);return this._ruleId2desc[e]=t,t}getRule(n){return this._ruleId2desc[n]}getExternalGrammar(n,e){if(this._includedGrammars[n])return this._includedGrammars[n];if(this._grammarRepository){const t=this._grammarRepository.lookup(n);if(t)return this._includedGrammars[n]=De(t,e&&e.$base),this._includedGrammars[n]}}tokenizeLine(n,e,t=0){const a=this._tokenize(n,e,!1,t);return{tokens:a.lineTokens.getResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}tokenizeLine2(n,e,t=0){const a=this._tokenize(n,e,!0,t);return{tokens:a.lineTokens.getBinaryResult(a.ruleStack,a.lineLength),ruleStack:a.ruleStack,stoppedEarly:a.stoppedEarly}}_tokenize(n,e,t,a){this._rootId===-1&&(this._rootId=lt.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let s;if(!e||e===Be.NULL){s=!0;const l=this._basicScopeAttributesProvider.getDefaultAttributes(),u=this.themeProvider.getDefaults(),d=W.set(0,l.languageId,l.tokenType,null,u.fontStyle,u.foregroundId,u.backgroundId),m=this.getRule(this._rootId).getName(null,null);let p;m?p=q.createRootAndLookUpScopeName(m,d,this):p=q.createRoot("unknown",d),e=new Be(null,this._rootId,-1,-1,!1,null,p,p)}else s=!1,e.reset();n=n+`
|
|
4
4
|
`;const r=this.createOnigString(n),i=r.content.length,c=new Bn(t,n,this._tokenTypeMatchers,this.balancedBracketSelectors),o=dt(this,r,s,0,e,c,!0,a);return it(r),{lineLength:i,lineTokens:c,ruleStack:o.stack,stoppedEarly:o.stoppedEarly}}};function De(n,e){return n=Ut(n),n.repository=n.repository||{},n.repository.$self={$vscodeTextmateLocation:n.$vscodeTextmateLocation,patterns:n.patterns,name:n.scopeName},n.repository.$base=e||n.repository.$self,n}var q=class T{constructor(e,t,a){this.parent=e,this.scopePath=t,this.tokenAttributes=a}static fromExtension(e,t){let a=e,s=(e==null?void 0:e.scopePath)??null;for(const r of t)s=je.push(s,r.scopeNames),a=new T(a,s,r.encodedTokenAttributes);return a}static createRoot(e,t){return new T(null,new je(null,e),t)}static createRootAndLookUpScopeName(e,t,a){const s=a.getMetadataForScope(e),r=new je(null,e),i=a.themeProvider.themeMatch(r),c=T.mergeAttributes(t,s,i);return new T(null,r,c)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(" ")}equals(e){return T.equals(this,e)}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,a){let s=-1,r=0,i=0;return a!==null&&(s=a.fontStyle,r=a.foregroundId,i=a.backgroundId),W.set(e,t.languageId,t.tokenType,null,s,r,i)}pushAttributed(e,t){if(e===null)return this;if(e.indexOf(" ")===-1)return T._pushAttributed(this,e,t);const a=e.split(/ /g);let s=this;for(const r of a)s=T._pushAttributed(s,r,t);return s}static _pushAttributed(e,t,a){const s=a.getMetadataForScope(t),r=e.scopePath.push(t),i=a.themeProvider.themeMatch(r),c=T.mergeAttributes(e.tokenAttributes,s,i);return new T(e,r,c)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){var s;const t=[];let a=this;for(;a&&a!==e;)t.push({encodedTokenAttributes:a.tokenAttributes,scopeNames:a.scopePath.getExtensionIfDefined(((s=a.parent)==null?void 0:s.scopePath)??null)}),a=a.parent;return a===e?t.reverse():void 0}},A,Be=(A=class{constructor(e,t,a,s,r,i,c,o){f(this,"_stackElementBrand");f(this,"_enterPos");f(this,"_anchorPos");f(this,"depth");this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=r,this.endRule=i,this.nameScopesList=c,this.contentNameScopesList=o,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=a,this._anchorPos=s}equals(e){return e===null?!1:A._equals(this,e)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?q.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(){A._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(e,t,a,s,r,i,c){return new A(this,e,t,a,s,r,i,c)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){const e=[];return this._writeString(e,0),"["+e.join(",")+"]"}_writeString(e,t){var a,s;return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${(a=this.nameScopesList)==null?void 0:a.toString()}, ${(s=this.contentNameScopesList)==null?void 0:s.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(e){return this.endRule===e?this:new A(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,e,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(){var e,t,a;return{ruleId:this.ruleId,beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:((t=this.nameScopesList)==null?void 0:t.getExtensionIfDefined(((e=this.parent)==null?void 0:e.nameScopesList)??null))??[],contentNameScopesList:((a=this.contentNameScopesList)==null?void 0:a.getExtensionIfDefined(this.nameScopesList))??[]}}static pushFrame(e,t){const a=q.fromExtension((e==null?void 0:e.nameScopesList)??null,t.nameScopesList);return new A(e,t.ruleId,t.enterPos??-1,t.anchorPos??-1,t.beginRuleCapturedEOL,t.endRule,a,q.fromExtension(a,t.contentNameScopesList))}},f(A,"NULL",new A(null,0,0,0,!1,null,null,null)),A),Sn=class{constructor(n,e){f(this,"balancedBracketScopes");f(this,"unbalancedBracketScopes");f(this,"allowAny",!1);this.balancedBracketScopes=n.flatMap(t=>t==="*"?(this.allowAny=!0,[]):re(t,ce).map(a=>a.matcher)),this.unbalancedBracketScopes=e.flatMap(t=>re(t,ce).map(a=>a.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(n){for(const e of this.unbalancedBracketScopes)if(e(n))return!1;for(const e of this.balancedBracketScopes)if(e(n))return!0;return this.allowAny}},Bn=class{constructor(n,e,t,a){f(this,"_emitBinaryTokens");f(this,"_lineText");f(this,"_tokens");f(this,"_binaryTokens");f(this,"_lastTokenEndIndex");f(this,"_tokenTypeOverrides");this.balancedBracketSelectors=a,this._emitBinaryTokens=n,this._tokenTypeOverrides=t,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}produce(n,e){this.produceFromScopes(n.contentNameScopesList,e)}produceFromScopes(n,e){var a;if(this._lastTokenEndIndex>=e)return;if(this._emitBinaryTokens){let s=(n==null?void 0:n.tokenAttributes)??0,r=!1;if((a=this.balancedBracketSelectors)!=null&&a.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){const i=(n==null?void 0:n.getScopeNames())??[];for(const c of this._tokenTypeOverrides)c.matcher(i)&&(s=W.set(s,0,c.type,null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(i))}if(r&&(s=W.set(s,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===s){this._lastTokenEndIndex=e;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(s),this._lastTokenEndIndex=e;return}const t=(n==null?void 0:n.getScopeNames())??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:e,scopes:t}),this._lastTokenEndIndex=e}getResult(n,e){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===e-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(n,e){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===e-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(n,e),this._binaryTokens[this._binaryTokens.length-2]=0);const t=new Uint32Array(this._binaryTokens.length);for(let a=0,s=this._binaryTokens.length;a<s;a++)t[a]=this._binaryTokens[a];return t}},Rn=class{constructor(n,e){f(this,"_grammars",new Map);f(this,"_rawGrammars",new Map);f(this,"_injectionGrammars",new Map);f(this,"_theme");this._onigLib=e,this._theme=n}dispose(){for(const n of this._grammars.values())n.dispose()}setTheme(n){this._theme=n}getColorMap(){return this._theme.getColorMap()}addGrammar(n,e){this._rawGrammars.set(n.scopeName,n),e&&this._injectionGrammars.set(n.scopeName,e)}lookup(n){return this._rawGrammars.get(n)}injections(n){return this._injectionGrammars.get(n)}getDefaults(){return this._theme.getDefaults()}themeMatch(n){return this._theme.match(n)}grammarForScopeName(n,e,t,a,s){if(!this._grammars.has(n)){let r=this._rawGrammars.get(n);if(!r)return null;this._grammars.set(n,vn(n,r,e,t,a,s,this,this._onigLib))}return this._grammars.get(n)}},An=class{constructor(e){f(this,"_options");f(this,"_syncRegistry");f(this,"_ensureGrammarCache");this._options=e,this._syncRegistry=new Rn(se.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(se.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,a){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:a})}loadGrammarWithConfiguration(e,t,a){return this._loadGrammar(e,t,a.embeddedLanguages,a.tokenTypes,new Sn(a.balancedBracketSelectors||[],a.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,a,s,r){const i=new sn(this._syncRegistry,e);for(;i.Q.length>0;)i.Q.map(c=>this._loadSingleGrammar(c.scopeName)),i.processQueue();return this._grammarForScopeName(e,t,a,s,r)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){const t=this._options.loadGrammar(e);if(t){const a=typeof this._options.getInjections=="function"?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,a)}}addGrammar(e,t=[],a=0,s=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,a,s)}_grammarForScopeName(e,t=0,a=null,s=null,r=null){return this._syncRegistry.grammarForScopeName(e,t,a,s,r)}},Re=Be.NULL;function In(n){return Array.isArray(n)?n:[n]}function ge(n,e=!1){var r;const t=n.split(/(\r?\n)/g);let a=0;const s=[];for(let i=0;i<t.length;i+=2){const c=e?t[i]+(t[i+1]||""):t[i];s.push([c,a]),a+=t[i].length,a+=((r=t[i+1])==null?void 0:r.length)||0}return s}function Te(n){return!n||["plaintext","txt","text","plain"].includes(n)}function Tn(n){return n==="ansi"||Te(n)}function Ee(n){return n==="none"}function En(n){return Ee(n)}function mt(n,e){var a;if(!e)return n;n.properties||(n.properties={}),(a=n.properties).class||(a.class=[]),typeof n.properties.class=="string"&&(n.properties.class=n.properties.class.split(/\s+/g)),Array.isArray(n.properties.class)||(n.properties.class=[]);const t=Array.isArray(e)?e:e.split(/\s+/g);for(const s of t)s&&!n.properties.class.includes(s)&&n.properties.class.push(s);return n}function Nn(n,e){let t=0;const a=[];for(const s of e)s>t&&a.push({...n,content:n.content.slice(t,s),offset:n.offset+t}),t=s;return t<n.content.length&&a.push({...n,content:n.content.slice(t),offset:n.offset+t}),a}function Pn(n,e){const t=Array.from(e instanceof Set?e:new Set(e)).sort((a,s)=>a-s);return t.length?n.map(a=>a.flatMap(s=>{const r=t.filter(i=>s.offset<i&&i<s.offset+s.content.length).map(i=>i-s.offset).sort((i,c)=>i-c);return r.length?Nn(s,r):s})):n}async function ft(n){return Promise.resolve(typeof n=="function"?n():n).then(e=>e.default||e)}function le(n,e){const t=typeof n=="string"?{}:{...n.colorReplacements},a=typeof n=="string"?n:n.name;for(const[s,r]of Object.entries((e==null?void 0:e.colorReplacements)||{}))typeof r=="string"?t[s]=r:s===a&&Object.assign(t,r);return t}function G(n,e){return n&&((e==null?void 0:e[n==null?void 0:n.toLowerCase()])||n)}function gt(n){const e={};return n.color&&(e.color=n.color),n.bgColor&&(e["background-color"]=n.bgColor),n.fontStyle&&(n.fontStyle&L.Italic&&(e["font-style"]="italic"),n.fontStyle&L.Bold&&(e["font-weight"]="bold"),n.fontStyle&L.Underline&&(e["text-decoration"]="underline")),e}function Ln(n){return typeof n=="string"?n:Object.entries(n).map(([e,t])=>`${e}:${t}`).join(";")}function Gn(n){const e=ge(n,!0).map(([s])=>s);function t(s){if(s===n.length)return{line:e.length-1,character:e[e.length-1].length};let r=s,i=0;for(const c of e){if(r<c.length)break;r-=c.length,i++}return{line:i,character:r}}function a(s,r){let i=0;for(let c=0;c<s;c++)i+=e[c].length;return i+=r,i}return{lines:e,indexToPos:t,posToIndex:a}}class S extends Error{constructor(e){super(e),this.name="ShikiError"}}const ht=new WeakMap;function he(n,e){ht.set(n,e)}function K(n){return ht.get(n)}class H{constructor(...e){f(this,"_stacks",{});f(this,"lang");if(e.length===2){const[t,a]=e;this.lang=a,this._stacks=t}else{const[t,a,s]=e;this.lang=a,this._stacks={[s]:t}}}get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(e,t){return new H(Object.fromEntries(In(t).map(a=>[a,Re])),e)}getInternalStack(e=this.theme){return this._stacks[e]}get scopes(){return qe(this._stacks[this.theme])}getScopes(e=this.theme){return qe(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.scopes}}}function qe(n){const e=[],t=new Set;function a(s){var i;if(t.has(s))return;t.add(s);const r=(i=s==null?void 0:s.nameScopesList)==null?void 0:i.scopeName;r&&e.push(r),s.parent&&a(s.parent)}return a(n),e}function Fn(n,e){if(!(n instanceof H))throw new S("Invalid grammar state");return n.getInternalStack(e)}function On(){const n=new WeakMap;function e(t){if(!n.has(t.meta)){let a=function(i){if(typeof i=="number"){if(i<0||i>t.source.length)throw new S(`Invalid decoration offset: ${i}. Code length: ${t.source.length}`);return{...s.indexToPos(i),offset:i}}else{const c=s.lines[i.line];if(c===void 0)throw new S(`Invalid decoration position ${JSON.stringify(i)}. Lines length: ${s.lines.length}`);if(i.character<0||i.character>c.length)throw new S(`Invalid decoration position ${JSON.stringify(i)}. Line ${i.line} length: ${c.length}`);return{...i,offset:s.posToIndex(i.line,i.character)}}};const s=Gn(t.source),r=(t.options.decorations||[]).map(i=>({...i,start:a(i.start),end:a(i.end)}));Mn(r),n.set(t.meta,{decorations:r,converter:s,source:t.source})}return n.get(t.meta)}return{name:"shiki:decorations",tokens(t){var i;if(!((i=this.options.decorations)!=null&&i.length))return;const s=e(this).decorations.flatMap(c=>[c.start.offset,c.end.offset]);return Pn(t,s)},code(t){var u;if(!((u=this.options.decorations)!=null&&u.length))return;const a=e(this),s=Array.from(t.children).filter(d=>d.type==="element"&&d.tagName==="span");if(s.length!==a.converter.lines.length)throw new S(`Number of lines in code element (${s.length}) does not match the number of lines in the source (${a.converter.lines.length}). Failed to apply decorations.`);function r(d,m,p,g){const $=s[d];let b="",h=-1,_=-1;if(m===0&&(h=0),p===0&&(_=0),p===Number.POSITIVE_INFINITY&&(_=$.children.length),h===-1||_===-1)for(let j=0;j<$.children.length;j++)b+=bt($.children[j]),h===-1&&b.length===m&&(h=j+1),_===-1&&b.length===p&&(_=j+1);if(h===-1)throw new S(`Failed to find start index for decoration ${JSON.stringify(g.start)}`);if(_===-1)throw new S(`Failed to find end index for decoration ${JSON.stringify(g.end)}`);const y=$.children.slice(h,_);if(!g.alwaysWrap&&y.length===$.children.length)c($,g,"line");else if(!g.alwaysWrap&&y.length===1&&y[0].type==="element")c(y[0],g,"token");else{const j={type:"element",tagName:"span",properties:{},children:y};c(j,g,"wrapper"),$.children.splice(h,y.length,j)}}function i(d,m){s[d]=c(s[d],m,"line")}function c(d,m,p){var b;const g=m.properties||{},$=m.transform||(h=>h);return d.tagName=m.tagName||"span",d.properties={...d.properties,...g,class:d.properties.class},(b=m.properties)!=null&&b.class&&mt(d,m.properties.class),d=$(d,p)||d,d}const o=[],l=a.decorations.sort((d,m)=>m.start.offset-d.start.offset);for(const d of l){const{start:m,end:p}=d;if(m.line===p.line)r(m.line,m.character,p.character,d);else if(m.line<p.line){r(m.line,m.character,Number.POSITIVE_INFINITY,d);for(let g=m.line+1;g<p.line;g++)o.unshift(()=>i(g,d));r(p.line,0,p.character,d)}}o.forEach(d=>d())}}}function Mn(n){for(let e=0;e<n.length;e++){const t=n[e];if(t.start.offset>t.end.offset)throw new S(`Invalid decoration range: ${JSON.stringify(t.start)} - ${JSON.stringify(t.end)}`);for(let a=e+1;a<n.length;a++){const s=n[a],r=t.start.offset<s.start.offset&&s.start.offset<t.end.offset,i=t.start.offset<s.end.offset&&s.end.offset<t.end.offset,c=s.start.offset<t.start.offset&&t.start.offset<s.end.offset,o=s.start.offset<t.end.offset&&t.end.offset<s.end.offset;if(r||i||c||o){if(i&&i||c&&o)continue;throw new S(`Decorations ${JSON.stringify(t.start)} and ${JSON.stringify(s.start)} intersect.`)}}}}function bt(n){return n.type==="text"?n.value:n.type==="element"?n.children.map(bt).join(""):""}const Wn=[On()];function ue(n){return[...n.transformers||[],...Wn]}var F=["black","red","green","yellow","blue","magenta","cyan","white","brightBlack","brightRed","brightGreen","brightYellow","brightBlue","brightMagenta","brightCyan","brightWhite"],we={1:"bold",2:"dim",3:"italic",4:"underline",7:"reverse",9:"strikethrough"};function Hn(n,e){const t=n.indexOf("\x1B[",e);if(t!==-1){const a=n.indexOf("m",t);return{sequence:n.substring(t+2,a).split(";"),startPosition:t,position:a+1}}return{position:n.length}}function Ve(n,e){let t=1;const a=n[e+t++];let s;if(a==="2"){const r=[n[e+t++],n[e+t++],n[e+t]].map(i=>Number.parseInt(i));r.length===3&&!r.some(i=>Number.isNaN(i))&&(s={type:"rgb",rgb:r})}else if(a==="5"){const r=Number.parseInt(n[e+t]);Number.isNaN(r)||(s={type:"table",index:Number(r)})}return[t,s]}function zn(n){const e=[];for(let t=0;t<n.length;t++){const a=n[t],s=Number.parseInt(a);if(!Number.isNaN(s))if(s===0)e.push({type:"resetAll"});else if(s<=9)we[s]&&e.push({type:"setDecoration",value:we[s]});else if(s<=29){const r=we[s-20];r&&e.push({type:"resetDecoration",value:r})}else if(s<=37)e.push({type:"setForegroundColor",value:{type:"named",name:F[s-30]}});else if(s===38){const[r,i]=Ve(n,t);i&&e.push({type:"setForegroundColor",value:i}),t+=r}else if(s===39)e.push({type:"resetForegroundColor"});else if(s<=47)e.push({type:"setBackgroundColor",value:{type:"named",name:F[s-40]}});else if(s===48){const[r,i]=Ve(n,t);i&&e.push({type:"setBackgroundColor",value:i}),t+=r}else s===49?e.push({type:"resetBackgroundColor"}):s>=90&&s<=97?e.push({type:"setForegroundColor",value:{type:"named",name:F[s-90+8]}}):s>=100&&s<=107&&e.push({type:"setBackgroundColor",value:{type:"named",name:F[s-100+8]}})}return e}function Un(){let n=null,e=null,t=new Set;return{parse(a){const s=[];let r=0;do{const i=Hn(a,r),c=i.sequence?a.substring(r,i.startPosition):a.substring(r);if(c.length>0&&s.push({value:c,foreground:n,background:e,decorations:new Set(t)}),i.sequence){const o=zn(i.sequence);for(const l of o)l.type==="resetAll"?(n=null,e=null,t.clear()):l.type==="resetForegroundColor"?n=null:l.type==="resetBackgroundColor"?e=null:l.type==="resetDecoration"&&t.delete(l.value);for(const l of o)l.type==="setForegroundColor"?n=l.value:l.type==="setBackgroundColor"?e=l.value:l.type==="setDecoration"&&t.add(l.value)}r=i.position}while(r<a.length);return s}}}var Dn={black:"#000000",red:"#bb0000",green:"#00bb00",yellow:"#bbbb00",blue:"#0000bb",magenta:"#ff00ff",cyan:"#00bbbb",white:"#eeeeee",brightBlack:"#555555",brightRed:"#ff5555",brightGreen:"#00ff00",brightYellow:"#ffff55",brightBlue:"#5555ff",brightMagenta:"#ff55ff",brightCyan:"#55ffff",brightWhite:"#ffffff"};function qn(n=Dn){function e(c){return n[c]}function t(c){return`#${c.map(o=>Math.max(0,Math.min(o,255)).toString(16).padStart(2,"0")).join("")}`}let a;function s(){if(a)return a;a=[];for(let l=0;l<F.length;l++)a.push(e(F[l]));let c=[0,95,135,175,215,255];for(let l=0;l<6;l++)for(let u=0;u<6;u++)for(let d=0;d<6;d++)a.push(t([c[l],c[u],c[d]]));let o=8;for(let l=0;l<24;l++,o+=10)a.push(t([o,o,o]));return a}function r(c){return s()[c]}function i(c){switch(c.type){case"named":return e(c.name);case"rgb":return t(c.rgb);case"table":return r(c.index)}}return{value:i}}function Vn(n,e,t){const a=le(n,t),s=ge(e),r=qn(Object.fromEntries(F.map(c=>{var o;return[c,(o=n.colors)==null?void 0:o[`terminal.ansi${c[0].toUpperCase()}${c.substring(1)}`]]}))),i=Un();return s.map(c=>i.parse(c[0]).map(o=>{let l,u;o.decorations.has("reverse")?(l=o.background?r.value(o.background):n.bg,u=o.foreground?r.value(o.foreground):n.fg):(l=o.foreground?r.value(o.foreground):n.fg,u=o.background?r.value(o.background):void 0),l=G(l,a),u=G(u,a),o.decorations.has("dim")&&(l=Xn(l));let d=L.None;return o.decorations.has("bold")&&(d|=L.Bold),o.decorations.has("italic")&&(d|=L.Italic),o.decorations.has("underline")&&(d|=L.Underline),{content:o.value,offset:c[1],color:l,bgColor:u,fontStyle:d}}))}function Xn(n){const e=n.match(/#([0-9a-f]{3})([0-9a-f]{3})?([0-9a-f]{2})?/);if(e)if(e[3]){const a=Math.round(Number.parseInt(e[3],16)/2).toString(16).padStart(2,"0");return`#${e[1]}${e[2]}${a}`}else return e[2]?`#${e[1]}${e[2]}80`:`#${Array.from(e[1]).map(a=>`${a}${a}`).join("")}80`;const t=n.match(/var\((--[\w-]+-ansi-[\w-]+)\)/);return t?`var(${t[1]}-dim)`:n}function Ne(n,e,t={}){const{lang:a="text",theme:s=n.getLoadedThemes()[0]}=t;if(Te(a)||Ee(s))return ge(e).map(o=>[{content:o[0],offset:o[1]}]);const{theme:r,colorMap:i}=n.setTheme(s);if(a==="ansi")return Vn(r,e,t);const c=n.getLanguage(a);if(t.grammarState){if(t.grammarState.lang!==c.name)throw new O(`Grammar state language "${t.grammarState.lang}" does not match highlight language "${c.name}"`);if(!t.grammarState.themes.includes(r.name))throw new O(`Grammar state themes "${t.grammarState.themes}" do not contain highlight theme "${r.name}"`)}return Kn(e,c,r,i,t)}function Zn(...n){if(n.length===2)return K(n[1]);const[e,t,a={}]=n,{lang:s="text",theme:r=e.getLoadedThemes()[0]}=a;if(Te(s)||Ee(r))throw new O("Plain language does not have grammar state");if(s==="ansi")throw new O("ANSI language does not have grammar state");const{theme:i,colorMap:c}=e.setTheme(r),o=e.getLanguage(s);return new H(de(t,o,i,c,a).stateStack,o.name,i.name)}function Kn(n,e,t,a,s){const r=de(n,e,t,a,s),i=new H(de(n,e,t,a,s).stateStack,e.name,t.name);return he(r.tokens,i),r.tokens}function de(n,e,t,a,s){const r=le(t,s),{tokenizeMaxLineLength:i=0,tokenizeTimeLimit:c=500}=s,o=ge(n);let l=s.grammarState?Fn(s.grammarState,t.name)??Re:s.grammarContextCode!=null?de(s.grammarContextCode,e,t,a,{...s,grammarState:void 0,grammarContextCode:void 0}).stateStack:Re,u=[];const d=[];for(let m=0,p=o.length;m<p;m++){const[g,$]=o[m];if(g===""){u=[],d.push([]);continue}if(i>0&&g.length>=i){u=[],d.push([{content:g,offset:$,color:"",fontStyle:0}]);continue}let b,h,_;s.includeExplanation&&(b=e.tokenizeLine(g,l),h=b.tokens,_=0);const y=e.tokenizeLine2(g,l,c),j=y.tokens.length/2;for(let k=0;k<j;k++){const B=y.tokens[2*k],w=k+1<j?y.tokens[2*k+2]:g.length;if(B===w)continue;const E=y.tokens[2*k+1],Y=G(a[W.getForeground(E)],r),z=W.getFontStyle(E),be={content:g.substring(B,w),offset:$+B,color:Y,fontStyle:z};if(s.includeExplanation){const Le=[];if(s.includeExplanation!=="scopeName")for(const N of t.settings){let M;switch(typeof N.scope){case"string":M=N.scope.split(/,/).map(_e=>_e.trim());break;case"object":M=N.scope;break;default:continue}Le.push({settings:N,selectors:M.map(_e=>_e.split(/ /))})}be.explanation=[];let Ge=0;for(;B+Ge<w;){const N=h[_],M=g.substring(N.startIndex,N.endIndex);Ge+=M.length,be.explanation.push({content:M,scopes:s.includeExplanation==="scopeName"?Jn(N.scopes):Qn(Le,N.scopes)}),_+=1}}u.push(be)}d.push(u),u=[],l=y.ruleStack}return{tokens:d,stateStack:l}}function Jn(n){return n.map(e=>({scopeName:e}))}function Qn(n,e){const t=[];for(let a=0,s=e.length;a<s;a++){const r=e[a];t[a]={scopeName:r,themeMatches:ea(n,r,e.slice(0,a))}}return t}function Xe(n,e){return n===e||e.substring(0,n.length)===n&&e[n.length]==="."}function Yn(n,e,t){if(!Xe(n[n.length-1],e))return!1;let a=n.length-2,s=t.length-1;for(;a>=0&&s>=0;)Xe(n[a],t[s])&&(a-=1),s-=1;return a===-1}function ea(n,e,t){const a=[];for(const{selectors:s,settings:r}of n)for(const i of s)if(Yn(i,e,t)){a.push(r);break}return a}function _t(n,e,t){const a=Object.entries(t.themes).filter(o=>o[1]).map(o=>({color:o[0],theme:o[1]})),s=a.map(o=>{const l=Ne(n,e,{...t,theme:o.theme}),u=K(l),d=typeof o.theme=="string"?o.theme:o.theme.name;return{tokens:l,state:u,theme:d}}),r=ta(...s.map(o=>o.tokens)),i=r[0].map((o,l)=>o.map((u,d)=>{const m={content:u.content,variants:{},offset:u.offset};return"includeExplanation"in t&&t.includeExplanation&&(m.explanation=u.explanation),r.forEach((p,g)=>{const{content:$,explanation:b,offset:h,..._}=p[l][d];m.variants[a[g].color]=_}),m})),c=s[0].state?new H(Object.fromEntries(s.map(o=>{var l;return[o.theme,(l=o.state)==null?void 0:l.getInternalStack(o.theme)]})),s[0].state.lang):void 0;return c&&he(i,c),i}function ta(...n){const e=n.map(()=>[]),t=n.length;for(let a=0;a<n[0].length;a++){const s=n.map(o=>o[a]),r=e.map(()=>[]);e.forEach((o,l)=>o.push(r[l]));const i=s.map(()=>0),c=s.map(o=>o[0]);for(;c.every(o=>o);){const o=Math.min(...c.map(l=>l.content.length));for(let l=0;l<t;l++){const u=c[l];u.content.length===o?(r[l].push(u),i[l]+=1,c[l]=s[l][i[l]]):(r[l].push({...u,content:u.content.slice(0,o)}),c[l]={...u,content:u.content.slice(o),offset:u.offset+o})}}}return e}function pe(n,e,t){let a,s,r,i,c,o;if("themes"in t){const{defaultColor:l="light",cssVariablePrefix:u="--shiki-"}=t,d=Object.entries(t.themes).filter(b=>b[1]).map(b=>({color:b[0],theme:b[1]})).sort((b,h)=>b.color===l?-1:h.color===l?1:0);if(d.length===0)throw new O("`themes` option must not be empty");const m=_t(n,e,t);if(o=K(m),l&&!d.find(b=>b.color===l))throw new O(`\`themes\` option must contain the defaultColor key \`${l}\``);const p=d.map(b=>n.getTheme(b.theme)),g=d.map(b=>b.color);r=m.map(b=>b.map(h=>na(h,g,u,l))),o&&he(r,o);const $=d.map(b=>le(b.theme,t));s=d.map((b,h)=>(h===0&&l?"":`${u+b.color}:`)+(G(p[h].fg,$[h])||"inherit")).join(";"),a=d.map((b,h)=>(h===0&&l?"":`${u+b.color}-bg:`)+(G(p[h].bg,$[h])||"inherit")).join(";"),i=`shiki-themes ${p.map(b=>b.name).join(" ")}`,c=l?void 0:[s,a].join(";")}else if("theme"in t){const l=le(t.theme,t);r=Ne(n,e,t);const u=n.getTheme(t.theme);a=G(u.bg,l),s=G(u.fg,l),i=u.name,o=K(r)}else throw new O("Invalid options, either `theme` or `themes` must be provided");return{tokens:r,fg:s,bg:a,themeName:i,rootStyle:c,grammarState:o}}function na(n,e,t,a){const s={content:n.content,explanation:n.explanation,offset:n.offset},r=e.map(o=>gt(n.variants[o])),i=new Set(r.flatMap(o=>Object.keys(o))),c={};return r.forEach((o,l)=>{for(const u of i){const d=o[u]||"inherit";if(l===0&&a)c[u]=d;else{const m=u==="color"?"":u==="background-color"?"-bg":`-${u}`,p=t+e[l]+(u==="color"?"":m);c[p]=d}}}),s.htmlStyle=c,s}function me(n,e,t,a={meta:{},options:t,codeToHast:(s,r)=>me(n,s,r),codeToTokens:(s,r)=>pe(n,s,r)}){var p,g;let s=e;for(const $ of ue(t))s=((p=$.preprocess)==null?void 0:p.call(a,s,t))||s;let{tokens:r,fg:i,bg:c,themeName:o,rootStyle:l,grammarState:u}=pe(n,s,t);const{mergeWhitespaces:d=!0}=t;d===!0?r=sa(r):d==="never"&&(r=ra(r));const m={...a,get source(){return s}};for(const $ of ue(t))r=((g=$.tokens)==null?void 0:g.call(m,r))||r;return aa(r,{...t,fg:i,bg:c,themeName:o,rootStyle:l},m,u)}function aa(n,e,t,a=K(n)){var g,$,b;const s=ue(e),r=[],i={type:"root",children:[]},{structure:c="classic",tabindex:o="0"}=e;let l={type:"element",tagName:"pre",properties:{class:`shiki ${e.themeName||""}`,style:e.rootStyle||`background-color:${e.bg};color:${e.fg}`,...o!==!1&&o!=null?{tabindex:o.toString()}:{},...Object.fromEntries(Array.from(Object.entries(e.meta||{})).filter(([h])=>!h.startsWith("_")))},children:[]},u={type:"element",tagName:"code",properties:{},children:r};const d=[],m={...t,structure:c,addClassToHast:mt,get source(){return t.source},get tokens(){return n},get options(){return e},get root(){return i},get pre(){return l},get code(){return u},get lines(){return d}};if(n.forEach((h,_)=>{var k,B;_&&(c==="inline"?i.children.push({type:"element",tagName:"br",properties:{},children:[]}):c==="classic"&&r.push({type:"text",value:`
|
phoenix/version.py
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
__version__ = "12.
|
|
1
|
+
__version__ = "12.7.0"
|