import "./cljs_env.js";
shadow$provide.module$node_modules$$lezer$highlight$dist$index_cjs=function(global,require,module,exports){function sameArray(a,b){return a.length==b.length&&a.every((x,i)=>x==b[i])}function permute(array){let result=[array];for(let i=0;i<array.length;i++)for(let a of permute(array.slice(0,i).concat(array.slice(i+1))))result.push(a);return result}function tagHighlighter(tags$jscomp$0,options){let map=Object.create(null);for(let style of tags$jscomp$0)if(Array.isArray(style.tag))for(let tag of style.tag)map[tag.id]=
style.class;else map[style.tag.id]=style.class;let {scope,all=null}=options||{};return{style:tags=>{let cls=all;for(let tag of tags)for(let sub of tag.set)if(tags=map[sub.id]){cls=cls?cls+" "+tags:tags;break}return cls},scope}}function highlightTags(highlighters,tags){let result=null;for(let highlighter of highlighters)(highlighters=highlighter.style(tags))&&(result=result?result+" "+highlighters:highlighters);return result}function getStyleTags(node){let rule=node.type.prop(ruleNodeProp);for(;rule&&
rule.context&&!node.matchContext(rule.context);)rule=rule.next;return rule||null}Object.defineProperty(exports,"__esModule",{value:!0});var common=require("module$node_modules$$lezer$common$dist$index_cjs");let nextTagID=0;class Tag{constructor(set,base,modified){this.set=set;this.base=base;this.modified=modified;this.id=nextTagID++}static define(parent){if(null===parent||void 0===parent?0:parent.base)throw Error("Can not derive from a modified tag");let tag=new Tag([],null,[]);tag.set.push(tag);
if(parent)for(let t of parent.set)tag.set.push(t);return tag}static defineModifier(){let mod=new Modifier;return tag=>-1<tag.modified.indexOf(mod)?tag:Modifier.get(tag.base||tag,tag.modified.concat(mod).sort((a,b)=>a.id-b.id))}}let nextModifierID=0;class Modifier{constructor(){this.instances=[];this.id=nextModifierID++}static get(base,mods){if(!mods.length)return base;var exists=mods[0].instances.find(t=>t.base==base&&sameArray(mods,t.modified));if(exists)return exists;exists=[];let tag=new Tag(exists,
base,mods);for(var m of mods)m.instances.push(tag);m=permute(mods);for(let parent of base.set)for(let config of m)exists.push(Modifier.get(parent,config));return tag}}const ruleNodeProp=new common.NodeProp;class Rule{constructor(tags,mode,context,next){this.tags=tags;this.mode=mode;this.context=context;this.next=next}get opaque(){return 0==this.mode}get inherit(){return 1==this.mode}sort(other){if(!other||other.depth<this.depth)return this.next=other,this;other.next=this.sort(other.next);return other}get depth(){return this.context?
this.context.length:0}}Rule.empty=new Rule([],2,null);class HighlightBuilder{constructor(at,highlighters,span){this.at=at;this.highlighters=highlighters;this.span=span;this.class=""}startSpan(at,cls){cls!=this.class&&(this.flush(at),at>this.at&&(this.at=at),this.class=cls)}flush(to){to>this.at&&this.class&&this.span(this.at,to,this.class)}highlightRange(cursor,from,to,inheritedClass,highlighters){let {type,from:start,to:end}=cursor;if(!(start>=to||end<=from)){type.isTop&&(highlighters=this.highlighters.filter(h=>
!h.scope||h.scope(type)));var cls=inheritedClass,rule=getStyleTags(cursor)||Rule.empty,tagCls=highlightTags(highlighters,rule.tags);tagCls&&(cls&&(cls+=" "),cls+=tagCls,1==rule.mode&&(inheritedClass+=(inheritedClass?" ":"")+tagCls));this.startSpan(cursor.from,cls);if(!rule.opaque){var mounted=cursor.tree&&cursor.tree.prop(common.NodeProp.mounted);if(mounted&&mounted.overlay){rule=cursor.node.enter(mounted.overlay[0].from+start,1);tagCls=this.highlighters.filter(h=>!h.scope||h.scope(mounted.tree.type));
let hasChild=cursor.firstChild();for(let i=0,pos=start;;i++){let next=i<mounted.overlay.length?mounted.overlay[i]:null,nextPos=next?next.from+start:end,rangeFrom=Math.max(from,pos),rangeTo=Math.min(to,nextPos);if(rangeFrom<rangeTo&&hasChild)for(;cursor.from<rangeTo&&(this.highlightRange(cursor,rangeFrom,rangeTo,inheritedClass,highlighters),this.startSpan(Math.min(to,cursor.to),cls),!(cursor.to>=nextPos)&&cursor.nextSibling()););if(!next||nextPos>to)break;pos=next.to+start;pos>from&&(this.highlightRange(rule.cursor(),
Math.max(from,next.from+start),Math.min(to,pos),inheritedClass,tagCls),this.startSpan(pos,cls))}hasChild&&cursor.parent()}else if(cursor.firstChild()){do if(!(cursor.to<=from)){if(cursor.from>=to)break;this.highlightRange(cursor,from,to,inheritedClass,highlighters);this.startSpan(Math.min(to,cursor.to),cls)}while(cursor.nextSibling());cursor.parent()}}}}}global=Tag.define;require=global();module=global();const typeName=global(module),propertyName=global(module),literal=global(),string=global(literal),
number=global(literal),content=global(),heading=global(content),keyword=global(),operator=global(),punctuation=global(),bracket=global(punctuation),meta=global();global={comment:require,lineComment:global(require),blockComment:global(require),docComment:global(require),name:module,variableName:global(module),typeName,tagName:global(typeName),propertyName,attributeName:global(propertyName),className:global(module),labelName:global(module),namespace:global(module),macroName:global(module),literal,string,
docString:global(string),character:global(string),attributeValue:global(string),number,integer:global(number),float:global(number),bool:global(literal),regexp:global(literal),escape:global(literal),color:global(literal),url:global(literal),keyword,self:global(keyword),null:global(keyword),atom:global(keyword),unit:global(keyword),modifier:global(keyword),operatorKeyword:global(keyword),controlKeyword:global(keyword),definitionKeyword:global(keyword),moduleKeyword:global(keyword),operator,derefOperator:global(operator),
arithmeticOperator:global(operator),logicOperator:global(operator),bitwiseOperator:global(operator),compareOperator:global(operator),updateOperator:global(operator),definitionOperator:global(operator),typeOperator:global(operator),controlOperator:global(operator),punctuation,separator:global(punctuation),bracket,angleBracket:global(bracket),squareBracket:global(bracket),paren:global(bracket),brace:global(bracket),content,heading,heading1:global(heading),heading2:global(heading),heading3:global(heading),
heading4:global(heading),heading5:global(heading),heading6:global(heading),contentSeparator:global(content),list:global(content),quote:global(content),emphasis:global(content),strong:global(content),link:global(content),monospace:global(content),strikethrough:global(content),inserted:global(),deleted:global(),changed:global(),invalid:global(),meta,documentMeta:global(meta),annotation:global(meta),processingInstruction:global(meta),definition:Tag.defineModifier(),constant:Tag.defineModifier(),function:Tag.defineModifier(),
standard:Tag.defineModifier(),local:Tag.defineModifier(),special:Tag.defineModifier()};require=tagHighlighter([{tag:global.link,class:"tok-link"},{tag:global.heading,class:"tok-heading"},{tag:global.emphasis,class:"tok-emphasis"},{tag:global.strong,class:"tok-strong"},{tag:global.keyword,class:"tok-keyword"},{tag:global.atom,class:"tok-atom"},{tag:global.bool,class:"tok-bool"},{tag:global.url,class:"tok-url"},{tag:global.labelName,class:"tok-labelName"},{tag:global.inserted,class:"tok-inserted"},
{tag:global.deleted,class:"tok-deleted"},{tag:global.literal,class:"tok-literal"},{tag:global.string,class:"tok-string"},{tag:global.number,class:"tok-number"},{tag:[global.regexp,global.escape,global.special(global.string)],class:"tok-string2"},{tag:global.variableName,class:"tok-variableName"},{tag:global.local(global.variableName),class:"tok-variableName tok-local"},{tag:global.definition(global.variableName),class:"tok-variableName tok-definition"},{tag:global.special(global.variableName),class:"tok-variableName2"},
{tag:global.definition(global.propertyName),class:"tok-propertyName tok-definition"},{tag:global.typeName,class:"tok-typeName"},{tag:global.namespace,class:"tok-namespace"},{tag:global.className,class:"tok-className"},{tag:global.macroName,class:"tok-macroName"},{tag:global.propertyName,class:"tok-propertyName"},{tag:global.operator,class:"tok-operator"},{tag:global.comment,class:"tok-comment"},{tag:global.meta,class:"tok-meta"},{tag:global.invalid,class:"tok-invalid"},{tag:global.punctuation,class:"tok-punctuation"}]);
exports.Tag=Tag;exports.classHighlighter=require;exports.getStyleTags=getStyleTags;exports.highlightTree=function(tree,highlighter,putStyle,from=0,to=tree.length){highlighter=new HighlightBuilder(from,Array.isArray(highlighter)?highlighter:[highlighter],putStyle);highlighter.highlightRange(tree.cursor(),from,to,"",highlighter.highlighters);highlighter.flush(to)};exports.styleTags=function(spec){let byName=Object.create(null);for(let prop in spec){let tags=spec[prop];Array.isArray(tags)||(tags=[tags]);
for(let part of prop.split(" "))if(part){var pieces=[];let mode=2;var rest=part;for(var pos=0;;){if("..."==rest&&0<pos&&pos+3==part.length){mode=1;break}rest=/^"(?:[^"\\]|\\.)*?"|[^\/!]+/.exec(rest);if(!rest)throw new RangeError("Invalid path: "+part);pieces.push("*"==rest[0]?"":'"'==rest[0][0]?JSON.parse(rest[0]):rest[0]);pos+=rest[0].length;if(pos==part.length)break;rest=part[pos++];if(pos==part.length&&"!"==rest){mode=0;break}if("/"!=rest)throw new RangeError("Invalid path: "+part);rest=part.slice(pos)}rest=
pieces.length-1;pos=pieces[rest];if(!pos)throw new RangeError("Invalid path: "+part);pieces=new Rule(tags,mode,0<rest?pieces.slice(0,rest):null);byName[pos]=pieces.sort(byName[pos])}}return ruleNodeProp.add(byName)};exports.tagHighlighter=tagHighlighter;exports.tags=global}
//# sourceMappingURL=module$node_modules$$lezer$highlight$dist$index_cjs.js.map
