mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-11 20:05:19 +00:00
3 lines
80 KiB
JavaScript
3 lines
80 KiB
JavaScript
|
|
import{P as O,N as t,a as e,D as s,b as r,T as i,I as o,c as a,t as n,s as l,L as h,d as x,e as p,f as Q,g as S,h as c,j as T}from"./codemirror_language-_XiX6II0.js";import{i as u,c as P,s as f}from"./index-CTWZX_TW.js";import"./codemirror_state-BKbyfKsm.js";import"./codemirror_view-C0PMO2z_.js";class d{constructor(O,t,e,s,r,i,o,a,n,l=0,h){this.p=O,this.stack=t,this.state=e,this.reducePos=s,this.pos=r,this.score=i,this.buffer=o,this.bufferBase=a,this.curContext=n,this.lookAhead=l,this.parent=h}toString(){return`[${this.stack.filter(((O,t)=>t%3==0)).concat(this.state)}]@${this.pos}${this.score?"!"+this.score:""}`}static start(O,t,e=0){let s=O.parser.context;return new d(O,[],t,e,e,0,[],0,s?new $(s,s.start):null,0,null)}get context(){return this.curContext?this.curContext.context:null}pushState(O,t){this.stack.push(this.state,t,this.bufferBase+this.buffer.length),this.state=O}reduce(O){var t;let e=O>>19,s=65535&O,{parser:r}=this.p,i=r.dynamicPrecedence(s);if(i&&(this.score+=i),0==e)return this.pushState(r.getGoto(this.state,s,!0),this.reducePos),s<r.minRepeatTerm&&this.storeNode(s,this.reducePos,this.reducePos,4,!0),void this.reduceContext(s,this.reducePos);let o=this.stack.length-3*(e-1)-(262144&O?6:0),a=o?this.stack[o-2]:this.p.ranges[0].from,n=this.reducePos-a;n>=2e3&&!(null===(t=this.p.parser.nodeSet.types[s])||void 0===t?void 0:t.isAnonymous)&&(a==this.p.lastBigReductionStart?(this.p.bigReductionCount++,this.p.lastBigReductionSize=n):this.p.lastBigReductionSize<n&&(this.p.bigReductionCount=1,this.p.lastBigReductionStart=a,this.p.lastBigReductionSize=n));let l=o?this.stack[o-1]:0,h=this.bufferBase+this.buffer.length-l;if(s<r.minRepeatTerm||131072&O){let O=r.stateFlag(this.state,1)?this.pos:this.reducePos;this.storeNode(s,a,O,h+4,!0)}if(262144&O)this.state=this.stack[o];else{let O=this.stack[o-3];this.state=r.getGoto(O,s,!0)}for(;this.stack.length>o;)this.stack.pop();this.reduceContext(s,a)}storeNode(O,t,e,s=4,r=!1){if(0==O&&(!this.stack.length||this.stack[this.stack.length-1]<this.buffer.length+this.bufferBase)){let O=this,s=this.buffer.length;if(0==s&&O.parent&&(s=O.bufferBase-O.parent.bufferBase,O=O.parent),s>0&&0==O.buffer[s-4]&&O.buffer[s-1]>-1){if(t==e)return;if(O.buffer[s-2]>=t)return void(O.buffer[s-2]=e)}}if(r&&this.pos!=e){let r=this.buffer.length;if(r>0&&0!=this.buffer[r-4])for(;r>0&&this.buffer[r-2]>e;)this.buffer[r]=this.buffer[r-4],this.buffer[r+1]=this.buffer[r-3],this.buffer[r+2]=this.buffer[r-2],this.buffer[r+3]=this.buffer[r-1],r-=4,s>4&&(s-=4);this.buffer[r]=O,this.buffer[r+1]=t,this.buffer[r+2]=e,this.buffer[r+3]=s}else this.buffer.push(O,t,e,s)}shift(O,t,e,s){if(131072&O)this.pushState(65535&O,this.pos);else if(0==(262144&O)){let r=O,{parser:i}=this.p;(s>this.pos||t<=i.maxNode)&&(this.pos=s,i.stateFlag(r,1)||(this.reducePos=s)),this.pushState(r,e),this.shiftContext(t,e),t<=i.maxNode&&this.buffer.push(t,e,s,4)}else this.pos=s,this.shiftContext(t,e),t<=this.p.parser.maxNode&&this.buffer.push(t,e,s,4)}apply(O,t,e,s){65536&O?this.reduce(O):this.shift(O,t,e,s)}useNode(O,t){let e=this.p.reused.length-1;(e<0||this.p.reused[e]!=O)&&(this.p.reused.push(O),e++);let s=this.pos;this.reducePos=this.pos=s+O.length,this.pushState(t,s),this.buffer.push(e,s,this.reducePos,-1),this.curContext&&this.updateContext(this.curContext.tracker.reuse(this.curContext.context,O,this,this.p.stream.reset(this.pos-O.length)))}split(){let O=this,t=O.buffer.length;for(;t>0&&O.buffer[t-2]>O.reducePos;)t-=4;let e=O.buffer.slice(t),s=O.bufferBase+t;for(;O&&s==O.bufferBase;)O=O.parent;return new d(this.p,this.stack.slice(),this.state,this.reducePos,this.pos,this.score,e,s,this.curContext,this.lookAhead,O)}recoverByDelete(O,t){let e=O<=this.p.parser.maxNode;e&&this.storeNode(O,this.pos,t,4),this.storeNode(0,this.pos,t,e?8:4),this.pos=this.reducePos=t,this.score-=190}canShift(O){for(let t=new w(this);;){let e=this.p.parser.stateSlot(t.state,4)||this.p.parser.hasAction(t.state,O);if(0==e)return!1;if(0==(65536&e))return!0;t.reduce(e)}}recoverByInsert(O){if(this.stack.length>=300)return[];let t=this.p.parser.nextStates(this.state);if(t.leng
|
||
|
|
//# sourceMappingURL=codemirror_lang-python-Cxoc-ydj.js.map
|