satis 2.0.7 → 2.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/gem-push.yml +11 -0
- data/.gitignore +15 -0
- data/.nvmrc +1 -0
- data/.rubocop.yml +18 -0
- data/Gemfile +27 -0
- data/Procfile +2 -0
- data/TODO.md +26 -0
- data/app/assets/images/satis/.keep +0 -0
- data/app/components/satis/tabs/component_controller.js +6 -0
- data/bin/importmap +4 -0
- data/bin/rails +14 -0
- data/lib/satis/version.rb +1 -1
- data/package.json +9 -0
- data/satis.gemspec +39 -0
- data/vendor/javascript/@codemirror--autocomplete.js +2 -0
- data/vendor/javascript/@codemirror--commands.js +2 -0
- data/vendor/javascript/@codemirror--lang-css.js +2 -0
- data/vendor/javascript/@codemirror--lang-html.js +2 -0
- data/vendor/javascript/@codemirror--lang-javascript.js +2 -0
- data/vendor/javascript/@codemirror--lang-json.js +2 -0
- data/vendor/javascript/@codemirror--lang-liquid.js +2 -0
- data/vendor/javascript/@codemirror--lang-markdown.js +2 -0
- data/vendor/javascript/@codemirror--lang-yaml.js +2 -0
- data/vendor/javascript/@codemirror--language.js +2 -0
- data/vendor/javascript/@codemirror--lint.js +2 -0
- data/vendor/javascript/@codemirror--search.js +2 -0
- data/vendor/javascript/@codemirror--state.js +2 -0
- data/vendor/javascript/@codemirror--view.js +2 -0
- data/vendor/javascript/@lezer--common.js +2 -0
- data/vendor/javascript/@lezer--css.js +2 -0
- data/vendor/javascript/@lezer--highlight.js +2 -0
- data/vendor/javascript/@lezer--html.js +2 -0
- data/vendor/javascript/@lezer--javascript.js +2 -0
- data/vendor/javascript/@lezer--json.js +2 -0
- data/vendor/javascript/@lezer--lr.js +2 -0
- data/vendor/javascript/@lezer--markdown.js +2 -0
- data/vendor/javascript/@lezer--yaml.js +2 -0
- data/vendor/javascript/@rails--actiontext.js +2 -0
- data/vendor/javascript/codemirror.js +2 -0
- data/vendor/javascript/crelt.js +2 -0
- data/vendor/javascript/data.min.js +7 -0
- data/vendor/javascript/intl-tel-input-utils.js +520 -0
- data/vendor/javascript/intl-tel-input.js +1782 -0
- data/vendor/javascript/leaflet.js +6 -0
- data/vendor/javascript/popper.js.js +1805 -0
- data/vendor/javascript/sortablejs.js +134 -0
- data/vendor/javascript/style-mod.js +2 -0
- data/vendor/javascript/tippy.js.js +2 -0
- data/vendor/javascript/trix.js +2 -0
- data/vendor/javascript/w3c-keyname.js +2 -0
- data/yarn.lock +821 -0
- metadata +51 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cf74c30badf9e24f0ecd2b80e47568dc846ad750ed5d05dad327ce0cccee0d06
|
4
|
+
data.tar.gz: 81cc8495a00bcbe9d793d9dc90d7e383ce9b21f2eb9c17abc5741804d3f4841b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 87ce373698005201b4c26ff7f37eec141e7f5f519391bbce776d10b0025d465273e810f4823887f299bcb494c1f47b8ad15fcfc982a0b25fb0ca7e272a0139f3
|
7
|
+
data.tar.gz: a741e2c352826b72e0f33b53fb8210fb06462f3394fae0f5361f311a81c34e3cad0098296c7d93cb4dfe7c5a9bbc269e1bafe983b871215efda0d13c0bd7b273
|
data/.gitignore
ADDED
data/.nvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
v21.6.2
|
data/.rubocop.yml
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
require:
|
2
|
+
- standard
|
3
|
+
- rubocop-rails
|
4
|
+
|
5
|
+
inherit_gem:
|
6
|
+
standard: config/base.yml
|
7
|
+
|
8
|
+
AllCops:
|
9
|
+
NewCops: enable
|
10
|
+
Exclude:
|
11
|
+
- node_modules/**/*
|
12
|
+
- public/**/*
|
13
|
+
- vendor/**/*
|
14
|
+
|
15
|
+
Rails:
|
16
|
+
Enabled: true # enable rubocop-rails cops
|
17
|
+
Bundler/DuplicatedGem:
|
18
|
+
Enabled: false # ignore duplicated gem errors because we will have duplicated gems when dual booting
|
data/Gemfile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
source "https://rubygems.org"
|
2
|
+
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
3
|
+
git_source(:entdec) { |repo_name| "git@github.com:entdec/#{repo_name}.git" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in satis.gemspec.
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :development do
|
9
|
+
gem "pg", ">= 0.18", "< 2.0"
|
10
|
+
end
|
11
|
+
|
12
|
+
# To use a debugger
|
13
|
+
# gem 'byebug', group: [:development, :test]
|
14
|
+
|
15
|
+
gem "sidekiq"
|
16
|
+
gem "puma"
|
17
|
+
gem "sprockets-rails"
|
18
|
+
gem "pry"
|
19
|
+
gem "capybara", "~> 3.40"
|
20
|
+
gem "selenium-webdriver", "~> 4.17"
|
21
|
+
gem "slim", "~> 5.2"
|
22
|
+
|
23
|
+
group :development, :test do
|
24
|
+
gem "standard", require: false
|
25
|
+
gem "rubocop-rails", require: false
|
26
|
+
gem "strong_migrations"
|
27
|
+
end
|
data/Procfile
ADDED
data/TODO.md
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# TODO
|
2
|
+
|
3
|
+
## Tailwind CSS
|
4
|
+
|
5
|
+
- move tailwindcss into satis, possibly including config
|
6
|
+
|
7
|
+
"peerDependencies": {
|
8
|
+
"@tailwindcss/forms": "^0.3.3",
|
9
|
+
"@tailwindcss/typography": "^0.4.1",
|
10
|
+
"codemirror": "^5.48.4",
|
11
|
+
"codemirror-liquid": "git+ssh://git@code.entropydecelerator.com/components/codemirror-liquid",
|
12
|
+
"@hotwired/stimulus": ">2.0",
|
13
|
+
"@hotwired/stimulus-webpack-helpers": "^1.0.1",
|
14
|
+
"tailwindcss": "^2.2.2"
|
15
|
+
}
|
16
|
+
|
17
|
+
## Fontawesome
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
REGEXP = /(fas|far|fal|fad|fab|fat|fa-solid|fa-regular|fa-light|fa-thin|fa-duotone|fa-brands)(?:\s|\.)fa-([a-z\-]*)/
|
21
|
+
Dir.glob('app/views/**/*.html.slim').each do |file|
|
22
|
+
contents = File.read(file)
|
23
|
+
results = contents.scan(REGEXP)
|
24
|
+
pp results if results.size > 0
|
25
|
+
end
|
26
|
+
```
|
File without changes
|
@@ -53,6 +53,12 @@ export default class TabsComponentController extends ApplicationController {
|
|
53
53
|
return el.attributes["id"] === clickedTab.attributes["id"]
|
54
54
|
})
|
55
55
|
}
|
56
|
+
|
57
|
+
//return if tab is already selected
|
58
|
+
if (this.tabTargets[index].classList.contains("selected")) {
|
59
|
+
return
|
60
|
+
}
|
61
|
+
|
56
62
|
this.open(index, true)
|
57
63
|
|
58
64
|
if (this.keyValue) {
|
data/bin/importmap
ADDED
data/bin/rails
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
3
|
+
# installed from the root of your application.
|
4
|
+
|
5
|
+
ENGINE_ROOT = File.expand_path('..', __dir__)
|
6
|
+
ENGINE_PATH = File.expand_path('../lib/satis/engine', __dir__)
|
7
|
+
APP_PATH = File.expand_path('../test/dummy/config/application', __dir__)
|
8
|
+
|
9
|
+
# Set up gems listed in the Gemfile.
|
10
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__)
|
11
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
12
|
+
|
13
|
+
require 'rails/all'
|
14
|
+
require 'rails/engine/commands'
|
data/lib/satis/version.rb
CHANGED
data/package.json
ADDED
data/satis.gemspec
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require_relative "lib/satis/version"
|
2
|
+
|
3
|
+
Gem::Specification.new do |spec|
|
4
|
+
spec.name = "satis"
|
5
|
+
spec.version = Satis::VERSION
|
6
|
+
spec.authors = ["Tom de Grunt"]
|
7
|
+
spec.email = ["tom@degrunt.nl"]
|
8
|
+
spec.homepage = "https://github.com/entdec/satis"
|
9
|
+
spec.summary = "Satis allow you to focus on features, let us do the UI/UX. It'll give you satisfaction."
|
10
|
+
spec.description = "Pretty cool"
|
11
|
+
spec.license = "MIT"
|
12
|
+
|
13
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
14
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
15
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
16
|
+
|
17
|
+
# spec.metadata['homepage_uri'] = spec.homepage
|
18
|
+
# spec.metadata['source_code_uri'] = "Put your gem's public repo URL here."
|
19
|
+
# spec.metadata['changelog_uri'] = "Put your gem's CHANGELOG.md URL here."
|
20
|
+
|
21
|
+
spec.files = Dir.chdir(File.expand_path("..", __FILE__)) do
|
22
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.add_dependency "browser"
|
26
|
+
spec.add_dependency "diffy"
|
27
|
+
spec.add_dependency "rails", ">= 6"
|
28
|
+
spec.add_dependency "view_component"
|
29
|
+
spec.add_dependency "jsonb_accessor", "~> 1.4"
|
30
|
+
|
31
|
+
spec.add_development_dependency "auxilium", "~> 3"
|
32
|
+
spec.add_development_dependency "slim-rails", "~> 3"
|
33
|
+
spec.add_development_dependency "faker"
|
34
|
+
|
35
|
+
spec.add_dependency "tailwindcss-rails"
|
36
|
+
spec.add_dependency "importmap-rails"
|
37
|
+
spec.add_dependency "turbo-rails"
|
38
|
+
spec.add_dependency "stimulus-rails"
|
39
|
+
end
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{Annotation as e,EditorSelection as t,StateEffect as o,codePointAt as n,codePointSize as i,fromCodePoint as s,combineConfig as l,Facet as r,StateField as a,Prec as c,MapMode as p,Text as f,Transaction as u,RangeValue as h,RangeSet as d,CharCategory as m}from"@codemirror/state";import{Direction as g,logException as v,showTooltip as b,EditorView as w,getTooltip as y,ViewPlugin as x,WidgetType as C,Decoration as S,keymap as A}from"@codemirror/view";import{syntaxTree as I,indentUnit as k}from"@codemirror/language";class CompletionContext{constructor(e,t,o){this.state=e;this.pos=t;this.explicit=o;this.abortListeners=[]}tokenBefore(e){let t=I(this.state).resolveInner(this.pos,-1);while(t&&e.indexOf(t.name)<0)t=t.parent;return t?{from:t.from,to:this.pos,text:this.state.sliceDoc(t.from,this.pos),type:t.type}:null}matchBefore(e){let t=this.state.doc.lineAt(this.pos);let o=Math.max(t.from,this.pos-250);let n=t.text.slice(o-t.from,this.pos-t.from);let i=n.search(ensureAnchor(e,false));return i<0?null:{from:o+i,to:this.pos,text:n.slice(i)}}get aborted(){return this.abortListeners==null}addEventListener(e,t){e=="abort"&&this.abortListeners&&this.abortListeners.push(t)}}function toSet(e){let t=Object.keys(e).join("");let o=/\w/.test(t);o&&(t=t.replace(/\w/g,""));return`[${o?"\\w":""}${t.replace(/[^\w\s]/g,"\\$&")}]`}function prefixMatch(e){let t=Object.create(null),o=Object.create(null);for(let{label:n}of e){t[n[0]]=true;for(let e=1;e<n.length;e++)o[n[e]]=true}let n=toSet(t)+toSet(o)+"*$";return[new RegExp("^"+n),new RegExp(n)]}function completeFromList(e){let t=e.map((e=>typeof e=="string"?{label:e}:e));let[o,n]=t.every((e=>/^\w+$/.test(e.label)))?[/\w*$/,/\w+$/]:prefixMatch(t);return e=>{let i=e.matchBefore(n);return i||e.explicit?{from:i?i.from:e.pos,options:t,validFor:o}:null}}function ifIn(e,t){return o=>{for(let n=I(o.state).resolveInner(o.pos,-1);n;n=n.parent){if(e.indexOf(n.name)>-1)return t(o);if(n.type.isTop)break}return null}}function ifNotIn(e,t){return o=>{for(let t=I(o.state).resolveInner(o.pos,-1);t;t=t.parent){if(e.indexOf(t.name)>-1)return null;if(t.type.isTop)break}return t(o)}}class Option{constructor(e,t,o,n){this.completion=e;this.source=t;this.match=o;this.score=n}}function cur(e){return e.selection.main.from}function ensureAnchor(e,t){var o;let{source:n}=e;let i=t&&n[0]!="^",s=n[n.length-1]!="$";return i||s?new RegExp(`${i?"^":""}(?:${n})${s?"$":""}`,(o=e.flags)!==null&&o!==void 0?o:e.ignoreCase?"i":""):e}const O=e.define();function insertCompletionText(e,o,n,i){let{main:s}=e.selection,l=n-s.from,r=i-s.from;return Object.assign(Object.assign({},e.changeByRange((a=>a!=s&&n!=i&&e.sliceDoc(a.from+l,a.from+r)!=e.sliceDoc(n,i)?{range:a}:{changes:{from:a.from+l,to:i==s.from?a.to:a.from+r,insert:o},range:t.cursor(a.from+l+o.length)}))),{scrollIntoView:true,userEvent:"input.complete"})}const R=new WeakMap;function asSource(e){if(!Array.isArray(e))return e;let t=R.get(e);t||R.set(e,t=completeFromList(e));return t}const T=o.define();const D=o.define();class FuzzyMatcher{constructor(e){this.pattern=e;this.chars=[];this.folded=[];this.any=[];this.precise=[];this.byWord=[];this.score=0;this.matched=[];for(let t=0;t<e.length;){let o=n(e,t),s=i(o);this.chars.push(o);let l=e.slice(t,t+s),r=l.toUpperCase();this.folded.push(n(r==l?l.toLowerCase():r,0));t+=s}this.astral=e.length!=this.chars.length}ret(e,t){this.score=e;this.matched=t;return true}match(e){if(this.pattern.length==0)return this.ret(-100,[]);if(e.length<this.pattern.length)return false;let{chars:t,folded:o,any:l,precise:r,byWord:a}=this;if(t.length==1){let s=n(e,0),l=i(s);let r=l==e.length?0:-100;if(s==t[0]);else{if(s!=o[0])return false;r+=-200}return this.ret(r,[0,l])}let c=e.indexOf(this.pattern);if(c==0)return this.ret(e.length==this.pattern.length?0:-100,[0,this.pattern.length]);let p=t.length,f=0;if(c<0){for(let s=0,r=Math.min(e.length,200);s<r&&f<p;){let r=n(e,s);r!=t[f]&&r!=o[f]||(l[f++]=s);s+=i(r)}if(f<p)return false}let u=0;let h=0,d=false;let m=0,g=-1,v=-1;let b=/[a-z]/.test(e),w=true;for(let l=0,f=Math.min(e.length,200),y=0;l<f&&h<p;){let f=n(e,l);if(c<0){u<p&&f==t[u]&&(r[u++]=l);if(m<p)if(f==t[m]||f==o[m]){m==0&&(g=l);v=l+1;m++}else m=0}let x,C=f<255?f>=48&&f<=57||f>=97&&f<=122?2:f>=65&&f<=90?1:0:(x=s(f))!=x.toLowerCase()?1:x!=x.toUpperCase()?2:0;(!l||C==1&&b||y==0&&C!=0)&&(t[h]==f||o[h]==f&&(d=true)?a[h++]=l:a.length&&(w=false));y=C;l+=i(f)}return h==p&&a[0]==0&&w?this.result((d?-200:0)-100,a,e):m==p&&g==0?this.ret(-200-e.length+(v==e.length?0:-100),[0,v]):c>-1?this.ret(-700-e.length,[c,c+this.pattern.length]):m==p?this.ret(-900-e.length,[g,v]):h==p?this.result((d?-200:0)-100-700+(w?0:-1100),a,e):t.length!=2&&this.result((l[0]?-700:0)-200-1100,l,e)}result(e,t,o){let s=[],l=0;for(let e of t){let t=e+(this.astral?i(n(o,e)):1);if(l&&s[l-1]==e)s[l-1]=t;else{s[l++]=e;s[l++]=t}}return this.ret(e-o.length,s)}}const E=r.define({combine(e){return l(e,{activateOnTyping:true,activateOnTypingDelay:100,selectOnOpen:true,override:null,closeOnBlur:true,maxRenderedOptions:100,defaultKeymap:true,tooltipClass:()=>"",optionClass:()=>"",aboveCursor:false,icons:true,addToOptions:[],positionInfo:defaultPositionInfo,compareCompletions:(e,t)=>e.label.localeCompare(t.label),interactionDelay:75,updateSyncTime:100},{defaultKeymap:(e,t)=>e&&t,closeOnBlur:(e,t)=>e&&t,icons:(e,t)=>e&&t,tooltipClass:(e,t)=>o=>joinClass(e(o),t(o)),optionClass:(e,t)=>o=>joinClass(e(o),t(o)),addToOptions:(e,t)=>e.concat(t)})}});function joinClass(e,t){return e?t?e+" "+t:e:t}function defaultPositionInfo(e,t,o,n,i,s){let l=e.textDirection==g.RTL,r=l,a=false;let c,p,f="top";let u=t.left-i.left,h=i.right-t.right;let d=n.right-n.left,m=n.bottom-n.top;r&&u<Math.min(d,h)?r=false:!r&&h<Math.min(d,u)&&(r=true);if(d<=(r?u:h)){c=Math.max(i.top,Math.min(o.top,i.bottom-m))-t.top;p=Math.min(400,r?u:h)}else{a=true;p=Math.min(400,(l?t.right:i.right-t.left)-30);let e=i.bottom-t.bottom;if(e>=m||e>t.top)c=o.bottom-t.top;else{f="bottom";c=t.bottom-o.top}}let v=(t.bottom-t.top)/s.offsetHeight;let b=(t.right-t.left)/s.offsetWidth;return{style:`${f}: ${c/v}px; max-width: ${p/b}px`,class:"cm-completionInfo-"+(a?l?"left-narrow":"right-narrow":r?"left":"right")}}function optionContent(e){let t=e.addToOptions.slice();e.icons&&t.push({render(e){let t=document.createElement("div");t.classList.add("cm-completionIcon");e.type&&t.classList.add(...e.type.split(/\s+/g).map((e=>"cm-completionIcon-"+e)));t.setAttribute("aria-hidden","true");return t},position:20});t.push({render(e,t,o,n){let i=document.createElement("span");i.className="cm-completionLabel";let s=e.displayLabel||e.label,l=0;for(let e=0;e<n.length;){let t=n[e++],o=n[e++];t>l&&i.appendChild(document.createTextNode(s.slice(l,t)));let r=i.appendChild(document.createElement("span"));r.appendChild(document.createTextNode(s.slice(t,o)));r.className="cm-completionMatchedText";l=o}l<s.length&&i.appendChild(document.createTextNode(s.slice(l)));return i},position:50},{render(e){if(!e.detail)return null;let t=document.createElement("span");t.className="cm-completionDetail";t.textContent=e.detail;return t},position:80});return t.sort(((e,t)=>e.position-t.position)).map((e=>e.render))}function rangeAroundSelected(e,t,o){if(e<=o)return{from:0,to:e};t<0&&(t=0);if(t<=e>>1){let e=Math.floor(t/o);return{from:e*o,to:(e+1)*o}}let n=Math.floor((e-t)/o);return{from:e-(n+1)*o,to:e-n*o}}class CompletionTooltip{constructor(e,t,o){this.view=e;this.stateField=t;this.applyCompletion=o;this.info=null;this.infoDestroy=null;this.placeInfoReq={read:()=>this.measureInfo(),write:e=>this.placeInfo(e),key:this};this.space=null;this.currentClass="";let n=e.state.field(t);let{options:i,selected:s}=n.open;let l=e.state.facet(E);this.optionContent=optionContent(l);this.optionClass=l.optionClass;this.tooltipClass=l.tooltipClass;this.range=rangeAroundSelected(i.length,s,l.maxRenderedOptions);this.dom=document.createElement("div");this.dom.className="cm-tooltip-autocomplete";this.updateTooltipClass(e.state);this.dom.addEventListener("mousedown",(o=>{let{options:n}=e.state.field(t).open;for(let t,i=o.target;i&&i!=this.dom;i=i.parentNode)if(i.nodeName=="LI"&&(t=/-(\d+)$/.exec(i.id))&&+t[1]<n.length){this.applyCompletion(e,n[+t[1]]);o.preventDefault();return}}));this.dom.addEventListener("focusout",(t=>{let o=e.state.field(this.stateField,false);o&&o.tooltip&&e.state.facet(E).closeOnBlur&&t.relatedTarget!=e.contentDOM&&e.dispatch({effects:D.of(null)})}));this.showOptions(i,n.id)}mount(){this.updateSel()}showOptions(e,t){this.list&&this.list.remove();this.list=this.dom.appendChild(this.createListBox(e,t,this.range));this.list.addEventListener("scroll",(()=>{this.info&&this.view.requestMeasure(this.placeInfoReq)}))}update(e){var t;let o=e.state.field(this.stateField);let n=e.startState.field(this.stateField);this.updateTooltipClass(e.state);if(o!=n){let{options:i,selected:s,disabled:l}=o.open;if(!n.open||n.open.options!=i){this.range=rangeAroundSelected(i.length,s,e.state.facet(E).maxRenderedOptions);this.showOptions(i,o.id)}this.updateSel();l!=((t=n.open)===null||t===void 0?void 0:t.disabled)&&this.dom.classList.toggle("cm-tooltip-autocomplete-disabled",!!l)}}updateTooltipClass(e){let t=this.tooltipClass(e);if(t!=this.currentClass){for(let e of this.currentClass.split(" "))e&&this.dom.classList.remove(e);for(let e of t.split(" "))e&&this.dom.classList.add(e);this.currentClass=t}}positioned(e){this.space=e;this.info&&this.view.requestMeasure(this.placeInfoReq)}updateSel(){let e=this.view.state.field(this.stateField),t=e.open;if(t.selected>-1&&t.selected<this.range.from||t.selected>=this.range.to){this.range=rangeAroundSelected(t.options.length,t.selected,this.view.state.facet(E).maxRenderedOptions);this.showOptions(t.options,e.id)}if(this.updateSelectedOption(t.selected)){this.destroyInfo();let{completion:o}=t.options[t.selected];let{info:n}=o;if(!n)return;let i=typeof n==="string"?document.createTextNode(n):n(o);if(!i)return;"then"in i?i.then((t=>{t&&this.view.state.field(this.stateField,false)==e&&this.addInfoPane(t,o)})).catch((e=>v(this.view.state,e,"completion info"))):this.addInfoPane(i,o)}}addInfoPane(e,t){this.destroyInfo();let o=this.info=document.createElement("div");o.className="cm-tooltip cm-completionInfo";if(e.nodeType!=null){o.appendChild(e);this.infoDestroy=null}else{let{dom:t,destroy:n}=e;o.appendChild(t);this.infoDestroy=n||null}this.dom.appendChild(o);this.view.requestMeasure(this.placeInfoReq)}updateSelectedOption(e){let t=null;for(let o=this.list.firstChild,n=this.range.from;o;o=o.nextSibling,n++)if(o.nodeName=="LI"&&o.id)if(n==e){if(!o.hasAttribute("aria-selected")){o.setAttribute("aria-selected","true");t=o}}else o.hasAttribute("aria-selected")&&o.removeAttribute("aria-selected");else n--;t&&scrollIntoView(this.list,t);return t}measureInfo(){let e=this.dom.querySelector("[aria-selected]");if(!e||!this.info)return null;let t=this.dom.getBoundingClientRect();let o=this.info.getBoundingClientRect();let n=e.getBoundingClientRect();let i=this.space;if(!i){let e=this.dom.ownerDocument.defaultView||window;i={left:0,top:0,right:e.innerWidth,bottom:e.innerHeight}}return n.top>Math.min(i.bottom,t.bottom)-10||n.bottom<Math.max(i.top,t.top)+10?null:this.view.state.facet(E).positionInfo(this.view,t,n,o,i,this.dom)}placeInfo(e){if(this.info)if(e){e.style&&(this.info.style.cssText=e.style);this.info.className="cm-tooltip cm-completionInfo "+(e.class||"")}else this.info.style.cssText="top: -1e6px"}createListBox(e,t,o){const n=document.createElement("ul");n.id=t;n.setAttribute("role","listbox");n.setAttribute("aria-expanded","true");n.setAttribute("aria-label",this.view.state.phrase("Completions"));let i=null;for(let s=o.from;s<o.to;s++){let{completion:l,match:r}=e[s],{section:a}=l;if(a){let e=typeof a=="string"?a:a.name;if(e!=i&&(s>o.from||o.from==0)){i=e;if(typeof a!="string"&&a.header)n.appendChild(a.header(a));else{let t=n.appendChild(document.createElement("completion-section"));t.textContent=e}}}const c=n.appendChild(document.createElement("li"));c.id=t+"-"+s;c.setAttribute("role","option");let p=this.optionClass(l);p&&(c.className=p);for(let e of this.optionContent){let t=e(l,this.view.state,this.view,r);t&&c.appendChild(t)}}o.from&&n.classList.add("cm-completionListIncompleteTop");o.to<e.length&&n.classList.add("cm-completionListIncompleteBottom");return n}destroyInfo(){if(this.info){this.infoDestroy&&this.infoDestroy();this.info.remove();this.info=null}}destroy(){this.destroyInfo()}}function completionTooltip(e,t){return o=>new CompletionTooltip(o,e,t)}function scrollIntoView(e,t){let o=e.getBoundingClientRect();let n=t.getBoundingClientRect();let i=o.height/e.offsetHeight;n.top<o.top?e.scrollTop-=(o.top-n.top)/i:n.bottom>o.bottom&&(e.scrollTop+=(n.bottom-o.bottom)/i)}function score(e){return(e.boost||0)*100+(e.apply?10:0)+(e.info?5:0)+(e.type?1:0)}function sortOptions(e,t){let o=[];let n=null;let addOption=e=>{o.push(e);let{section:t}=e.completion;if(t){n||(n=[]);let e=typeof t=="string"?t:t.name;n.some((t=>t.name==e))||n.push(typeof t=="string"?{name:e}:t)}};for(let n of e)if(n.hasResult()){let e=n.result.getMatch;if(n.result.filter===false)for(let t of n.result.options)addOption(new Option(t,n.source,e?e(t):[],1e9-o.length));else{let o=new FuzzyMatcher(t.sliceDoc(n.from,n.to));for(let t of n.result.options)if(o.match(t.label)){let i=t.displayLabel?e?e(t,o.matched):[]:o.matched;addOption(new Option(t,n.source,i,o.score+(t.boost||0)))}}}if(n){let e=Object.create(null),t=0;let cmp=(e,t)=>{var o,n;return((o=e.rank)!==null&&o!==void 0?o:1e9)-((n=t.rank)!==null&&n!==void 0?n:1e9)||(e.name<t.name?-1:1)};for(let o of n.sort(cmp)){t-=1e5;e[o.name]=t}for(let t of o){let{section:o}=t.completion;o&&(t.score+=e[typeof o=="string"?o:o.name])}}let i=[],s=null;let l=t.facet(E).compareCompletions;for(let e of o.sort(((e,t)=>t.score-e.score||l(e.completion,t.completion)))){let t=e.completion;!s||s.label!=t.label||s.detail!=t.detail||s.type!=null&&t.type!=null&&s.type!=t.type||s.apply!=t.apply||s.boost!=t.boost?i.push(e):score(e.completion)>score(s)&&(i[i.length-1]=e);s=e.completion}return i}class CompletionDialog{constructor(e,t,o,n,i,s){this.options=e;this.attrs=t;this.tooltip=o;this.timestamp=n;this.selected=i;this.disabled=s}setSelected(e,t){return e==this.selected||e>=this.options.length?this:new CompletionDialog(this.options,makeAttrs(t,e),this.tooltip,this.timestamp,e,this.disabled)}static build(e,t,o,n,i){let s=sortOptions(e,t);if(!s.length)return n&&e.some((e=>e.state==1))?new CompletionDialog(n.options,n.attrs,n.tooltip,n.timestamp,n.selected,true):null;let l=t.facet(E).selectOnOpen?0:-1;if(n&&n.selected!=l&&n.selected!=-1){let e=n.options[n.selected].completion;for(let t=0;t<s.length;t++)if(s[t].completion==e){l=t;break}}return new CompletionDialog(s,makeAttrs(o,l),{pos:e.reduce(((e,t)=>t.hasResult()?Math.min(e,t.from):e),1e8),create:j,above:i.aboveCursor},n?n.timestamp:Date.now(),l,false)}map(e){return new CompletionDialog(this.options,this.attrs,Object.assign(Object.assign({},this.tooltip),{pos:e.mapPos(this.tooltip.pos)}),this.timestamp,this.selected,this.disabled)}}class CompletionState{constructor(e,t,o){this.active=e;this.id=t;this.open=o}static start(){return new CompletionState(L,"cm-ac-"+Math.floor(Math.random()*2e6).toString(36),null)}update(e){let{state:t}=e,o=t.facet(E);let n=o.override||t.languageDataAt("autocomplete",cur(t)).map(asSource);let i=n.map((t=>{let n=this.active.find((e=>e.source==t))||new ActiveSource(t,this.active.some((e=>e.state!=0))?1:0);return n.update(e,o)}));i.length==this.active.length&&i.every(((e,t)=>e==this.active[t]))&&(i=this.active);let s=this.open;s&&e.docChanged&&(s=s.map(e.changes));e.selection||i.some((t=>t.hasResult()&&e.changes.touchesRange(t.from,t.to)))||!sameResults(i,this.active)?s=CompletionDialog.build(i,t,this.id,s,o):s&&s.disabled&&!i.some((e=>e.state==1))&&(s=null);!s&&i.every((e=>e.state!=1))&&i.some((e=>e.hasResult()))&&(i=i.map((e=>e.hasResult()?new ActiveSource(e.source,0):e)));for(let t of e.effects)t.is(F)&&(s=s&&s.setSelected(t.value,this.id));return i==this.active&&s==this.open?this:new CompletionState(i,this.id,s)}get tooltip(){return this.open?this.open.tooltip:null}get attrs(){return this.open?this.open.attrs:P}}function sameResults(e,t){if(e==t)return true;for(let o=0,n=0;;){while(o<e.length&&!e[o].hasResult)o++;while(n<t.length&&!t[n].hasResult)n++;let i=o==e.length,s=n==t.length;if(i||s)return i==s;if(e[o++].result!=t[n++].result)return false}}const P={"aria-autocomplete":"list"};function makeAttrs(e,t){let o={"aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":e};t>-1&&(o["aria-activedescendant"]=e+"-"+t);return o}const L=[];function getUserEvent(e){return e.isUserEvent("input.type")?"input":e.isUserEvent("delete.backward")?"delete":null}class ActiveSource{constructor(e,t,o=-1){this.source=e;this.state=t;this.explicitPos=o}hasResult(){return false}update(e,t){let o=getUserEvent(e),n=this;o?n=n.handleUserEvent(e,o,t):e.docChanged?n=n.handleChange(e):e.selection&&n.state!=0&&(n=new ActiveSource(n.source,0));for(let t of e.effects)if(t.is(T))n=new ActiveSource(n.source,1,t.value?cur(e.state):-1);else if(t.is(D))n=new ActiveSource(n.source,0);else if(t.is(M))for(let e of t.value)e.source==n.source&&(n=e);return n}handleUserEvent(e,t,o){return t!="delete"&&o.activateOnTyping?new ActiveSource(this.source,1):this.map(e.changes)}handleChange(e){return e.changes.touchesRange(cur(e.startState))?new ActiveSource(this.source,0):this.map(e.changes)}map(e){return e.empty||this.explicitPos<0?this:new ActiveSource(this.source,this.state,e.mapPos(this.explicitPos))}}class ActiveResult extends ActiveSource{constructor(e,t,o,n,i){super(e,2,t);this.result=o;this.from=n;this.to=i}hasResult(){return true}handleUserEvent(e,t,o){var n;let i=e.changes.mapPos(this.from),s=e.changes.mapPos(this.to,1);let l=cur(e.state);if((this.explicitPos<0?l<=i:l<this.from)||l>s||t=="delete"&&cur(e.startState)==this.from)return new ActiveSource(this.source,t=="input"&&o.activateOnTyping?1:0);let r,a=this.explicitPos<0?-1:e.changes.mapPos(this.explicitPos);return checkValid(this.result.validFor,e.state,i,s)?new ActiveResult(this.source,a,this.result,i,s):this.result.update&&(r=this.result.update(this.result,i,s,new CompletionContext(e.state,l,a>=0)))?new ActiveResult(this.source,a,r,r.from,(n=r.to)!==null&&n!==void 0?n:cur(e.state)):new ActiveSource(this.source,1,a)}handleChange(e){return e.changes.touchesRange(this.from,this.to)?new ActiveSource(this.source,0):this.map(e.changes)}map(e){return e.empty?this:new ActiveResult(this.source,this.explicitPos<0?-1:e.mapPos(this.explicitPos),this.result,e.mapPos(this.from),e.mapPos(this.to,1))}}function checkValid(e,t,o,n){if(!e)return false;let i=t.sliceDoc(o,n);return typeof e=="function"?e(i,o,n,t):ensureAnchor(e,true).test(i)}const M=o.define({map(e,t){return e.map((e=>e.map(t)))}});const F=o.define();const B=a.define({create(){return CompletionState.start()},update(e,t){return e.update(t)},provide:e=>[b.from(e,(e=>e.tooltip)),w.contentAttributes.from(e,(e=>e.attrs))]});function applyCompletion(e,t){const o=t.completion.apply||t.completion.label;let n=e.state.field(B).active.find((e=>e.source==t.source));if(!(n instanceof ActiveResult))return false;typeof o=="string"?e.dispatch(Object.assign(Object.assign({},insertCompletionText(e.state,o,n.from,n.to)),{annotations:O.of(t.completion)})):o(e,t.completion,n.from,n.to);return true}const j=completionTooltip(B,applyCompletion);function moveCompletionSelection(e,t="option"){return o=>{let n=o.state.field(B,false);if(!n||!n.open||n.open.disabled||Date.now()-n.open.timestamp<o.state.facet(E).interactionDelay)return false;let i,s=1;t=="page"&&(i=y(o,n.open.tooltip))&&(s=Math.max(2,Math.floor(i.dom.offsetHeight/i.dom.querySelector("li").offsetHeight)-1));let{length:l}=n.open.options;let r=n.open.selected>-1?n.open.selected+s*(e?1:-1):e?0:l-1;r<0?r=t=="page"?0:l-1:r>=l&&(r=t=="page"?l-1:0);o.dispatch({effects:F.of(r)});return true}}const acceptCompletion=e=>{let t=e.state.field(B,false);return!(e.state.readOnly||!t||!t.open||t.open.selected<0||t.open.disabled||Date.now()-t.open.timestamp<e.state.facet(E).interactionDelay)&&applyCompletion(e,t.open.options[t.open.selected])};const startCompletion=e=>{let t=e.state.field(B,false);if(!t)return false;e.dispatch({effects:T.of(true)});return true};const closeCompletion=e=>{let t=e.state.field(B,false);if(!t||!t.active.some((e=>e.state!=0)))return false;e.dispatch({effects:D.of(null)});return true};class RunningQuery{constructor(e,t){this.active=e;this.context=t;this.time=Date.now();this.updates=[];this.done=void 0}}const N=50,W=1e3;const $=x.fromClass(class{constructor(e){this.view=e;this.debounceUpdate=-1;this.running=[];this.debounceAccept=-1;this.pendingStart=false;this.composing=0;for(let t of e.state.field(B).active)t.state==1&&this.startQuery(t)}update(e){let t=e.state.field(B);if(!e.selectionSet&&!e.docChanged&&e.startState.field(B)==t)return;let o=e.transactions.some((e=>(e.selection||e.docChanged)&&!getUserEvent(e)));for(let t=0;t<this.running.length;t++){let n=this.running[t];if(o||n.updates.length+e.transactions.length>N&&Date.now()-n.time>W){for(let e of n.context.abortListeners)try{e()}catch(e){v(this.view.state,e)}n.context.abortListeners=null;this.running.splice(t--,1)}else n.updates.push(...e.transactions)}this.debounceUpdate>-1&&clearTimeout(this.debounceUpdate);e.transactions.some((e=>e.effects.some((e=>e.is(T)))))&&(this.pendingStart=true);let n=this.pendingStart?50:e.state.facet(E).activateOnTypingDelay;this.debounceUpdate=t.active.some((e=>e.state==1&&!this.running.some((t=>t.active.source==e.source))))?setTimeout((()=>this.startUpdate()),n):-1;if(this.composing!=0)for(let t of e.transactions)getUserEvent(t)=="input"?this.composing=2:this.composing==2&&t.selection&&(this.composing=3)}startUpdate(){this.debounceUpdate=-1;this.pendingStart=false;let{state:e}=this.view,t=e.field(B);for(let e of t.active)e.state!=1||this.running.some((t=>t.active.source==e.source))||this.startQuery(e)}startQuery(e){let{state:t}=this.view,o=cur(t);let n=new CompletionContext(t,o,e.explicitPos==o);let i=new RunningQuery(e,n);this.running.push(i);Promise.resolve(e.source(n)).then((e=>{if(!i.context.aborted){i.done=e||null;this.scheduleAccept()}}),(e=>{this.view.dispatch({effects:D.of(null)});v(this.view.state,e)}))}scheduleAccept(){this.running.every((e=>e.done!==void 0))?this.accept():this.debounceAccept<0&&(this.debounceAccept=setTimeout((()=>this.accept()),this.view.state.facet(E).updateSyncTime))}accept(){var e;this.debounceAccept>-1&&clearTimeout(this.debounceAccept);this.debounceAccept=-1;let t=[];let o=this.view.state.facet(E);for(let n=0;n<this.running.length;n++){let i=this.running[n];if(i.done===void 0)continue;this.running.splice(n--,1);if(i.done){let n=new ActiveResult(i.active.source,i.active.explicitPos,i.done,i.done.from,(e=i.done.to)!==null&&e!==void 0?e:cur(i.updates.length?i.updates[0].startState:this.view.state));for(let e of i.updates)n=n.update(e,o);if(n.hasResult()){t.push(n);continue}}let s=this.view.state.field(B).active.find((e=>e.source==i.active.source));if(s&&s.state==1)if(i.done==null){let e=new ActiveSource(i.active.source,0);for(let t of i.updates)e=e.update(t,o);e.state!=1&&t.push(e)}else this.startQuery(s)}t.length&&this.view.dispatch({effects:M.of(t)})}},{eventHandlers:{blur(e){let t=this.view.state.field(B,false);if(t&&t.tooltip&&this.view.state.facet(E).closeOnBlur){let o=t.open&&y(this.view,t.open.tooltip);o&&o.dom.contains(e.relatedTarget)||setTimeout((()=>this.view.dispatch({effects:D.of(null)})),10)}},compositionstart(){this.composing=1},compositionend(){this.composing==3&&setTimeout((()=>this.view.dispatch({effects:T.of(false)})),20);this.composing=0}}});const U=typeof navigator=="object"&&/Win/.test(navigator.platform);const q=c.highest(w.domEventHandlers({keydown(e,t){let o=t.state.field(B,false);if(!o||!o.open||o.open.disabled||o.open.selected<0||e.key.length>1||e.ctrlKey&&!(U&&e.altKey)||e.metaKey)return false;let n=o.open.options[o.open.selected];let i=o.active.find((e=>e.source==n.source));let s=n.completion.commitCharacters||i.result.commitCharacters;s&&s.indexOf(e.key)>-1&&applyCompletion(t,n);return false}}));const V=w.baseTheme({".cm-tooltip.cm-tooltip-autocomplete":{"& > ul":{fontFamily:"monospace",whiteSpace:"nowrap",overflow:"hidden auto",maxWidth_fallback:"700px",maxWidth:"min(700px, 95vw)",minWidth:"250px",maxHeight:"10em",height:"100%",listStyle:"none",margin:0,padding:0,"& > li, & > completion-section":{padding:"1px 3px",lineHeight:1.2},"& > li":{overflowX:"hidden",textOverflow:"ellipsis",cursor:"pointer"},"& > completion-section":{display:"list-item",borderBottom:"1px solid silver",paddingLeft:"0.5em",opacity:.7}}},"&light .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#17c",color:"white"},"&light .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#777"},"&dark .cm-tooltip-autocomplete ul li[aria-selected]":{background:"#347",color:"white"},"&dark .cm-tooltip-autocomplete-disabled ul li[aria-selected]":{background:"#444"},".cm-completionListIncompleteTop:before, .cm-completionListIncompleteBottom:after":{content:'"···"',opacity:.5,display:"block",textAlign:"center"},".cm-tooltip.cm-completionInfo":{position:"absolute",padding:"3px 9px",width:"max-content",maxWidth:"400px",boxSizing:"border-box"},".cm-completionInfo.cm-completionInfo-left":{right:"100%"},".cm-completionInfo.cm-completionInfo-right":{left:"100%"},".cm-completionInfo.cm-completionInfo-left-narrow":{right:"30px"},".cm-completionInfo.cm-completionInfo-right-narrow":{left:"30px"},"&light .cm-snippetField":{backgroundColor:"#00000022"},"&dark .cm-snippetField":{backgroundColor:"#ffffff22"},".cm-snippetFieldPosition":{verticalAlign:"text-top",width:0,height:"1.15em",display:"inline-block",margin:"0 -0.7px -.7em",borderLeft:"1.4px dotted #888"},".cm-completionMatchedText":{textDecoration:"underline"},".cm-completionDetail":{marginLeft:"0.5em",fontStyle:"italic"},".cm-completionIcon":{fontSize:"90%",width:".8em",display:"inline-block",textAlign:"center",paddingRight:".6em",opacity:"0.6",boxSizing:"content-box"},".cm-completionIcon-function, .cm-completionIcon-method":{"&:after":{content:"'ƒ'"}},".cm-completionIcon-class":{"&:after":{content:"'○'"}},".cm-completionIcon-interface":{"&:after":{content:"'◌'"}},".cm-completionIcon-variable":{"&:after":{content:"'𝑥'"}},".cm-completionIcon-constant":{"&:after":{content:"'𝐶'"}},".cm-completionIcon-type":{"&:after":{content:"'𝑡'"}},".cm-completionIcon-enum":{"&:after":{content:"'∪'"}},".cm-completionIcon-property":{"&:after":{content:"'□'"}},".cm-completionIcon-keyword":{"&:after":{content:"'🔑︎'"}},".cm-completionIcon-namespace":{"&:after":{content:"'▢'"}},".cm-completionIcon-text":{"&:after":{content:"'abc'",fontSize:"50%",verticalAlign:"middle"}}});class FieldPos{constructor(e,t,o,n){this.field=e;this.line=t;this.from=o;this.to=n}}class FieldRange{constructor(e,t,o){this.field=e;this.from=t;this.to=o}map(e){let t=e.mapPos(this.from,-1,p.TrackDel);let o=e.mapPos(this.to,1,p.TrackDel);return t==null||o==null?null:new FieldRange(this.field,t,o)}}class Snippet{constructor(e,t){this.lines=e;this.fieldPositions=t}instantiate(e,t){let o=[],n=[t];let i=e.doc.lineAt(t),s=/^\s*/.exec(i.text)[0];for(let i of this.lines){if(o.length){let o=s,l=/^\t*/.exec(i)[0].length;for(let t=0;t<l;t++)o+=e.facet(k);n.push(t+o.length-l);i=o+i.slice(l)}o.push(i);t+=i.length+1}let l=this.fieldPositions.map((e=>new FieldRange(e.field,n[e.line]+e.from,n[e.line]+e.to)));return{text:o,ranges:l}}static parse(e){let t=[];let o,n=[],i=[];for(let s of e.split(/\r\n?|\n/)){while(o=/[#$]\{(?:(\d+)(?::([^}]*))?|([^}]*))\}/.exec(s)){let e=o[1]?+o[1]:null,l=o[2]||o[3]||"",r=-1;for(let o=0;o<t.length;o++)(e!=null?t[o].seq!=e:!l||t[o].name!=l)||(r=o);if(r<0){let o=0;while(o<t.length&&(e==null||t[o].seq!=null&&t[o].seq<e))o++;t.splice(o,0,{seq:e,name:l});r=o;for(let e of i)e.field>=r&&e.field++}i.push(new FieldPos(r,n.length,o.index,o.index+l.length));s=s.slice(0,o.index)+l+s.slice(o.index+o[0].length)}for(let e;e=/\\([{}])/.exec(s);){s=s.slice(0,e.index)+e[1]+s.slice(e.index+e[0].length);for(let t of i)if(t.line==n.length&&t.from>e.index){t.from--;t.to--}}n.push(s)}return new Snippet(n,i)}}let z=S.widget({widget:new class extends C{toDOM(){let e=document.createElement("span");e.className="cm-snippetFieldPosition";return e}ignoreEvent(){return false}}});let H=S.mark({class:"cm-snippetField"});class ActiveSnippet{constructor(e,t){this.ranges=e;this.active=t;this.deco=S.set(e.map((e=>(e.from==e.to?z:H).range(e.from,e.to))))}map(e){let t=[];for(let o of this.ranges){let n=o.map(e);if(!n)return null;t.push(n)}return new ActiveSnippet(t,this.active)}selectionInsideField(e){return e.ranges.every((e=>this.ranges.some((t=>t.field==this.active&&t.from<=e.from&&t.to>=e.to))))}}const K=o.define({map(e,t){return e&&e.map(t)}});const Q=o.define();const X=a.define({create(){return null},update(e,t){for(let o of t.effects){if(o.is(K))return o.value;if(o.is(Q)&&e)return new ActiveSnippet(e.ranges,o.value)}e&&t.docChanged&&(e=e.map(t.changes));e&&t.selection&&!e.selectionInsideField(t.selection)&&(e=null);return e},provide:e=>w.decorations.from(e,(e=>e?e.deco:S.none))});function fieldSelection(e,o){return t.create(e.filter((e=>e.field==o)).map((e=>t.range(e.from,e.to))))}function snippet(e){let t=Snippet.parse(e);return(e,n,i,s)=>{let{text:l,ranges:r}=t.instantiate(e.state,i);let a={changes:{from:i,to:s,insert:f.of(l)},scrollIntoView:true,annotations:n?[O.of(n),u.userEvent.of("input.complete")]:void 0};r.length&&(a.selection=fieldSelection(r,0));if(r.some((e=>e.field>0))){let t=new ActiveSnippet(r,0);let n=a.effects=[K.of(t)];e.state.field(X,false)===void 0&&n.push(o.appendConfig.of([X,Z,ee,V]))}e.dispatch(e.state.update(a))}}function moveField(e){return({state:t,dispatch:o})=>{let n=t.field(X,false);if(!n||e<0&&n.active==0)return false;let i=n.active+e,s=e>0&&!n.ranges.some((t=>t.field==i+e));o(t.update({selection:fieldSelection(n.ranges,i),effects:K.of(s?null:new ActiveSnippet(n.ranges,i)),scrollIntoView:true}));return true}}const clearSnippet=({state:e,dispatch:t})=>{let o=e.field(X,false);if(!o)return false;t(e.update({effects:K.of(null)}));return true};const _=moveField(1);const Y=moveField(-1);function hasNextSnippetField(e){let t=e.field(X,false);return!!(t&&t.ranges.some((e=>e.field==t.active+1)))}function hasPrevSnippetField(e){let t=e.field(X,false);return!!(t&&t.active>0)}const G=[{key:"Tab",run:_,shift:Y},{key:"Escape",run:clearSnippet}];const J=r.define({combine(e){return e.length?e[0]:G}});const Z=c.highest(A.compute([J],(e=>e.facet(J))));function snippetCompletion(e,t){return Object.assign(Object.assign({},t),{apply:snippet(e)})}const ee=w.domEventHandlers({mousedown(e,t){let o,n=t.state.field(X,false);if(!n||(o=t.posAtCoords({x:e.clientX,y:e.clientY}))==null)return false;let i=n.ranges.find((e=>e.from<=o&&e.to>=o));if(!i||i.field==n.active)return false;t.dispatch({selection:fieldSelection(n.ranges,i.field),effects:K.of(n.ranges.some((e=>e.field>i.field))?new ActiveSnippet(n.ranges,i.field):null),scrollIntoView:true});return true}});function wordRE(e){let t=e.replace(/[\]\-\\]/g,"\\$&");try{return new RegExp(`[\\p{Alphabetic}\\p{Number}_${t}]+`,"ug")}catch(e){return new RegExp(`[w${t}]`,"g")}}function mapRE(e,t){return new RegExp(t(e.source),e.unicode?"u":"")}const te=Object.create(null);function wordCache(e){return te[e]||(te[e]=new WeakMap)}function storeWords(e,t,o,n,i){for(let s=e.iterLines(),l=0;!s.next().done;){let e,{value:r}=s;t.lastIndex=0;while(e=t.exec(r))if(!n[e[0]]&&l+e.index!=i){o.push({type:"text",label:e[0]});n[e[0]]=true;if(o.length>=2e3)return}l+=r.length+1}}function collectWords(e,t,o,n,i){let s=e.length>=1e3;let l=s&&t.get(e);if(l)return l;let r=[],a=Object.create(null);if(e.children){let s=0;for(let l of e.children){if(l.length>=1e3){for(let e of collectWords(l,t,o,n-s,i-s))if(!a[e.label]){a[e.label]=true;r.push(e)}}else storeWords(l,o,r,a,i-s);s+=l.length+1}}else storeWords(e,o,r,a,i);s&&r.length<2e3&&t.set(e,r);return r}const completeAnyWord=e=>{let t=e.state.languageDataAt("wordChars",e.pos).join("");let o=wordRE(t);let n=e.matchBefore(mapRE(o,(e=>e+"$")));if(!n&&!e.explicit)return null;let i=n?n.from:e.pos;let s=collectWords(e.state.doc,wordCache(t),o,5e4,i);return{from:i,options:s,validFor:mapRE(o,(e=>"^"+e))}};const oe={brackets:["(","[","{","'",'"'],before:")]}:;>",stringPrefixes:[]};const ne=o.define({map(e,t){let o=t.mapPos(e,-1,p.TrackAfter);return o==null?void 0:o}});const ie=new class extends h{};ie.startSide=1;ie.endSide=-1;const se=a.define({create(){return d.empty},update(e,t){e=e.map(t.changes);if(t.selection){let o=t.state.doc.lineAt(t.selection.main.head);e=e.update({filter:e=>e>=o.from&&e<=o.to})}for(let o of t.effects)o.is(ne)&&(e=e.update({add:[ie.range(o.value,o.value+1)]}));return e}});function closeBrackets(){return[ae,se]}const le="()[]{}<>";function closing(e){for(let t=0;t<le.length;t+=2)if(le.charCodeAt(t)==e)return le.charAt(t+1);return s(e<128?e:e+1)}function config(e,t){return e.languageDataAt("closeBrackets",t)[0]||oe}const re=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);const ae=w.inputHandler.of(((e,t,o,s)=>{if((re?e.composing:e.compositionStarted)||e.state.readOnly)return false;let l=e.state.selection.main;if(s.length>2||s.length==2&&i(n(s,0))==1||t!=l.from||o!=l.to)return false;let r=insertBracket(e.state,s);if(!r)return false;e.dispatch(r);return true}));const deleteBracketPair=({state:e,dispatch:o})=>{if(e.readOnly)return false;let i=config(e,e.selection.main.head);let s=i.brackets||oe.brackets;let l=null,r=e.changeByRange((o=>{if(o.empty){let i=prevChar(e.doc,o.head);for(let l of s)if(l==i&&nextChar(e.doc,o.head)==closing(n(l,0)))return{changes:{from:o.head-l.length,to:o.head+l.length},range:t.cursor(o.head-l.length)}}return{range:l=o}}));l||o(e.update(r,{scrollIntoView:true,userEvent:"delete.backward"}));return!l};const ce=[{key:"Backspace",run:deleteBracketPair}];function insertBracket(e,t){let o=config(e,e.selection.main.head);let i=o.brackets||oe.brackets;for(let s of i){let l=closing(n(s,0));if(t==s)return l==s?handleSame(e,s,i.indexOf(s+s+s)>-1,o):handleOpen(e,s,l,o.before||oe.before);if(t==l&&closedBracketAt(e,e.selection.main.from))return handleClose(e,s,l)}return null}function closedBracketAt(e,t){let o=false;e.field(se).between(0,e.doc.length,(e=>{e==t&&(o=true)}));return o}function nextChar(e,t){let o=e.sliceString(t,t+2);return o.slice(0,i(n(o,0)))}function prevChar(e,t){let o=e.sliceString(t-2,t);return i(n(o,0))==o.length?o:o.slice(1)}function handleOpen(e,o,n,i){let s=null,l=e.changeByRange((l=>{if(!l.empty)return{changes:[{insert:o,from:l.from},{insert:n,from:l.to}],effects:ne.of(l.to+o.length),range:t.range(l.anchor+o.length,l.head+o.length)};let r=nextChar(e.doc,l.head);return!r||/\s/.test(r)||i.indexOf(r)>-1?{changes:{insert:o+n,from:l.head},effects:ne.of(l.head+o.length),range:t.cursor(l.head+o.length)}:{range:s=l}}));return s?null:e.update(l,{scrollIntoView:true,userEvent:"input.type"})}function handleClose(e,o,n){let i=null,s=e.changeByRange((o=>o.empty&&nextChar(e.doc,o.head)==n?{changes:{from:o.head,to:o.head+n.length,insert:n},range:t.cursor(o.head+n.length)}:i={range:o}));return i?null:e.update(s,{scrollIntoView:true,userEvent:"input.type"})}function handleSame(e,o,n,i){let s=i.stringPrefixes||oe.stringPrefixes;let l=null,r=e.changeByRange((i=>{if(!i.empty)return{changes:[{insert:o,from:i.from},{insert:o,from:i.to}],effects:ne.of(i.to+o.length),range:t.range(i.anchor+o.length,i.head+o.length)};let r,a=i.head,c=nextChar(e.doc,a);if(c==o){if(nodeStart(e,a))return{changes:{insert:o+o,from:a},effects:ne.of(a+o.length),range:t.cursor(a+o.length)};if(closedBracketAt(e,a)){let i=n&&e.sliceDoc(a,a+o.length*3)==o+o+o;let s=i?o+o+o:o;return{changes:{from:a,to:a+s.length,insert:s},range:t.cursor(a+s.length)}}}else{if(n&&e.sliceDoc(a-2*o.length,a)==o+o&&(r=canStartStringAt(e,a-2*o.length,s))>-1&&nodeStart(e,r))return{changes:{insert:o+o+o+o,from:a},effects:ne.of(a+o.length),range:t.cursor(a+o.length)};if(e.charCategorizer(a)(c)!=m.Word&&canStartStringAt(e,a,s)>-1&&!probablyInString(e,a,o,s))return{changes:{insert:o+o,from:a},effects:ne.of(a+o.length),range:t.cursor(a+o.length)}}return{range:l=i}}));return l?null:e.update(r,{scrollIntoView:true,userEvent:"input.type"})}function nodeStart(e,t){let o=I(e).resolveInner(t+1);return o.parent&&o.from==t}function probablyInString(e,t,o,n){let i=I(e).resolveInner(t,-1);let s=n.reduce(((e,t)=>Math.max(e,t.length)),0);for(let l=0;l<5;l++){let l=e.sliceDoc(i.from,Math.min(i.to,i.from+o.length+s));let r=l.indexOf(o);if(!r||r>-1&&n.indexOf(l.slice(0,r))>-1){let t=i.firstChild;while(t&&t.from==i.from&&t.to-t.from>o.length+r){if(e.sliceDoc(t.to-o.length,t.to)==o)return false;t=t.firstChild}return true}let a=i.to==t&&i.parent;if(!a)break;i=a}return false}function canStartStringAt(e,t,o){let n=e.charCategorizer(t);if(n(e.sliceDoc(t-1,t))!=m.Word)return t;for(let i of o){let o=t-i.length;if(e.sliceDoc(o,t)==i&&n(e.sliceDoc(o-1,o))!=m.Word)return o}return-1}function autocompletion(e={}){return[q,B,E.of(e),$,fe,V]}const pe=[{key:"Ctrl-Space",run:startCompletion},{key:"Escape",run:closeCompletion},{key:"ArrowDown",run:moveCompletionSelection(true)},{key:"ArrowUp",run:moveCompletionSelection(false)},{key:"PageDown",run:moveCompletionSelection(true,"page")},{key:"PageUp",run:moveCompletionSelection(false,"page")},{key:"Enter",run:acceptCompletion}];const fe=c.highest(A.computeN([E],(e=>e.facet(E).defaultKeymap?[pe]:[])));function completionStatus(e){let t=e.field(B,false);return t&&t.active.some((e=>e.state==1))?"pending":t&&t.active.some((e=>e.state!=0))?"active":null}const ue=new WeakMap;function currentCompletions(e){var t;let o=(t=e.field(B,false))===null||t===void 0?void 0:t.open;if(!o||o.disabled)return[];let n=ue.get(o.options);n||ue.set(o.options,n=o.options.map((e=>e.completion)));return n}function selectedCompletion(e){var t;let o=(t=e.field(B,false))===null||t===void 0?void 0:t.open;return o&&!o.disabled&&o.selected>=0?o.options[o.selected].completion:null}function selectedCompletionIndex(e){var t;let o=(t=e.field(B,false))===null||t===void 0?void 0:t.open;return o&&!o.disabled&&o.selected>=0?o.selected:null}function setSelectedCompletion(e){return F.of(e)}export{CompletionContext,acceptCompletion,autocompletion,clearSnippet,closeBrackets,ce as closeBracketsKeymap,closeCompletion,completeAnyWord,completeFromList,pe as completionKeymap,completionStatus,currentCompletions,deleteBracketPair,hasNextSnippetField,hasPrevSnippetField,ifIn,ifNotIn,insertBracket,insertCompletionText,moveCompletionSelection,_ as nextSnippetField,O as pickedCompletion,Y as prevSnippetField,selectedCompletion,selectedCompletionIndex,setSelectedCompletion,snippet,snippetCompletion,J as snippetKeymap,startCompletion};
|
2
|
+
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{Annotation as e,Facet as t,combineConfig as n,Transaction as r,StateField as o,ChangeSet as l,ChangeDesc as s,EditorSelection as a,StateEffect as c,CharCategory as i,countColumn as u,findClusterBreak as f,Text as h}from"@codemirror/state";import{EditorView as d,Direction as m}from"@codemirror/view";import{syntaxTree as p,matchBrackets as g,getIndentUnit as y,IndentContext as v,getIndentation as B,indentString as S,indentUnit as A}from"@codemirror/language";import{NodeProp as k}from"@lezer/common";const toggleComment=e=>{let{state:t}=e,n=t.doc.lineAt(t.selection.main.from),r=getConfig(e.state,n.from);return r.line?w(e):!!r.block&&L(e)};function command(e,t){return({state:n,dispatch:r})=>{if(n.readOnly)return false;let o=e(t,n);if(!o)return false;r(n.update(o));return true}}const w=command(changeLineComment,0);const C=command(changeLineComment,1);const x=command(changeLineComment,2);const D=command(changeBlockComment,0);const M=command(changeBlockComment,1);const E=command(changeBlockComment,2);const L=command(((e,t)=>changeBlockComment(e,t,selectedLineRanges(t))),0);function getConfig(e,t){let n=e.languageDataAt("commentTokens",t);return n.length?n[0]:{}}const b=50;function findBlockComment(e,{open:t,close:n},r,o){let l=e.sliceDoc(r-b,r);let s=e.sliceDoc(o,o+b);let a=/\s*$/.exec(l)[0].length,c=/^\s*/.exec(s)[0].length;let i=l.length-a;if(l.slice(i-t.length,i)==t&&s.slice(c,c+n.length)==n)return{open:{pos:r-a,margin:a&&1},close:{pos:o+c,margin:c&&1}};let u,f;if(o-r<=2*b)u=f=e.sliceDoc(r,o);else{u=e.sliceDoc(r,r+b);f=e.sliceDoc(o-b,o)}let h=/^\s*/.exec(u)[0].length,d=/\s*$/.exec(f)[0].length;let m=f.length-d-n.length;return u.slice(h,h+t.length)==t&&f.slice(m,m+n.length)==n?{open:{pos:r+h+t.length,margin:/\s/.test(u.charAt(h+t.length))?1:0},close:{pos:o-d-n.length,margin:/\s/.test(f.charAt(m-1))?1:0}}:null}function selectedLineRanges(e){let t=[];for(let n of e.selection.ranges){let r=e.doc.lineAt(n.from);let o=n.to<=r.to?r:e.doc.lineAt(n.to);let l=t.length-1;l>=0&&t[l].to>r.from?t[l].to=o.to:t.push({from:r.from+/^\s*/.exec(r.text)[0].length,to:o.to})}return t}function changeBlockComment(e,t,n=t.selection.ranges){let r=n.map((e=>getConfig(t,e.from).block));if(!r.every((e=>e)))return null;let o=n.map(((e,n)=>findBlockComment(t,r[n],e.from,e.to)));if(e!=2&&!o.every((e=>e)))return{changes:t.changes(n.map(((e,t)=>o[t]?[]:[{from:e.from,insert:r[t].open+" "},{from:e.to,insert:" "+r[t].close}])))};if(e!=1&&o.some((e=>e))){let e=[];for(let t,n=0;n<o.length;n++)if(t=o[n]){let o=r[n],{open:l,close:s}=t;e.push({from:l.pos-o.open.length,to:l.pos+l.margin},{from:s.pos-s.margin,to:s.pos+o.close.length})}return{changes:e}}return null}function changeLineComment(e,t,n=t.selection.ranges){let r=[];let o=-1;for(let{from:e,to:l}of n){let n=r.length,s=1e9;let a=getConfig(t,e).line;if(a){for(let n=e;n<=l;){let c=t.doc.lineAt(n);if(c.from>o&&(e==l||l>c.from)){o=c.from;let e=/^\s*/.exec(c.text)[0].length;let t=e==c.length;let n=c.text.slice(e,e+a.length)==a?e:-1;e<c.text.length&&e<s&&(s=e);r.push({line:c,comment:n,token:a,indent:e,empty:t,single:false})}n=c.to+1}if(s<1e9)for(let e=n;e<r.length;e++)r[e].indent<r[e].line.text.length&&(r[e].indent=s);r.length==n+1&&(r[n].single=true)}}if(e!=2&&r.some((e=>e.comment<0&&(!e.empty||e.single)))){let e=[];for(let{line:t,token:n,indent:o,empty:l,single:s}of r)!s&&l||e.push({from:t.from+o,insert:n+" "});let n=t.changes(e);return{changes:n,selection:t.selection.map(n,1)}}if(e!=1&&r.some((e=>e.comment>=0))){let e=[];for(let{line:t,comment:n,token:o}of r)if(n>=0){let r=t.from+n,l=r+o.length;t.text[l-t.from]==" "&&l++;e.push({from:r,to:l})}return{changes:e}}return null}const O=e.define();const H=e.define();const I=t.define();const T=t.define({combine(e){return n(e,{minDepth:100,newGroupDelay:500,joinToEvent:(e,t)=>t},{minDepth:Math.max,newGroupDelay:Math.min,joinToEvent:(e,t)=>(n,r)=>e(n,r)||t(n,r)})}});const R=o.define({create(){return HistoryState.empty},update(e,t){let n=t.state.facet(T);let o=t.annotation(O);if(o){let r=HistEvent.fromTransaction(t,o.selection),l=o.side;let s=l==0?e.undone:e.done;s=r?updateBranch(s,s.length,n.minDepth,r):addSelection(s,t.startState.selection);return new HistoryState(l==0?o.rest:s,l==0?s:o.rest)}let l=t.annotation(H);l!="full"&&l!="before"||(e=e.isolate());if(t.annotation(r.addToHistory)===false)return t.changes.empty?e:e.addMapping(t.changes.desc);let s=HistEvent.fromTransaction(t);let a=t.annotation(r.time),c=t.annotation(r.userEvent);s?e=e.addChanges(s,a,c,n,t):t.selection&&(e=e.addSelection(t.startState.selection,a,c,n.newGroupDelay));l!="full"&&l!="after"||(e=e.isolate());return e},toJSON(e){return{done:e.done.map((e=>e.toJSON())),undone:e.undone.map((e=>e.toJSON()))}},fromJSON(e){return new HistoryState(e.done.map(HistEvent.fromJSON),e.undone.map(HistEvent.fromJSON))}});function history(e={}){return[R,T.of(e),d.domEventHandlers({beforeinput(e,t){let n=e.inputType=="historyUndo"?N:e.inputType=="historyRedo"?G:null;if(!n)return false;e.preventDefault();return n(t)}})]}const V=R;function cmd(e,t){return function({state:n,dispatch:r}){if(!t&&n.readOnly)return false;let o=n.field(R,false);if(!o)return false;let l=o.pop(e,n,t);if(!l)return false;r(l);return true}}const N=cmd(0,false);const G=cmd(1,false);const J=cmd(0,true);const P=cmd(1,true);function depth(e){return function(t){let n=t.field(R,false);if(!n)return 0;let r=e==0?n.done:n.undone;return r.length-(r.length&&!r[0].changes?1:0)}}const U=depth(0);const z=depth(1);class HistEvent{constructor(e,t,n,r,o){this.changes=e;this.effects=t;this.mapped=n;this.startSelection=r;this.selectionsAfter=o}setSelAfter(e){return new HistEvent(this.changes,this.effects,this.mapped,this.startSelection,e)}toJSON(){var e,t,n;return{changes:(e=this.changes)===null||e===void 0?void 0:e.toJSON(),mapped:(t=this.mapped)===null||t===void 0?void 0:t.toJSON(),startSelection:(n=this.startSelection)===null||n===void 0?void 0:n.toJSON(),selectionsAfter:this.selectionsAfter.map((e=>e.toJSON()))}}static fromJSON(e){return new HistEvent(e.changes&&l.fromJSON(e.changes),[],e.mapped&&s.fromJSON(e.mapped),e.startSelection&&a.fromJSON(e.startSelection),e.selectionsAfter.map(a.fromJSON))}static fromTransaction(e,t){let n=j;for(let t of e.startState.facet(I)){let r=t(e);r.length&&(n=n.concat(r))}return!n.length&&e.changes.empty?null:new HistEvent(e.changes.invert(e.startState.doc),n,void 0,t||e.startState.selection,j)}static selection(e){return new HistEvent(void 0,j,void 0,void 0,e)}}function updateBranch(e,t,n,r){let o=t+1>n+20?t-n-1:0;let l=e.slice(o,t);l.push(r);return l}function isAdjacent(e,t){let n=[],r=false;e.iterChangedRanges(((e,t)=>n.push(e,t)));t.iterChangedRanges(((e,t,o,l)=>{for(let e=0;e<n.length;){let t=n[e++],s=n[e++];l>=t&&o<=s&&(r=true)}}));return r}function eqSelectionShape(e,t){return e.ranges.length==t.ranges.length&&e.ranges.filter(((e,n)=>e.empty!=t.ranges[n].empty)).length===0}function conc(e,t){return e.length?t.length?e.concat(t):e:t}const j=[];const q=200;function addSelection(e,t){if(e.length){let n=e[e.length-1];let r=n.selectionsAfter.slice(Math.max(0,n.selectionsAfter.length-q));if(r.length&&r[r.length-1].eq(t))return e;r.push(t);return updateBranch(e,e.length-1,1e9,n.setSelAfter(r))}return[HistEvent.selection([t])]}function popSelection(e){let t=e[e.length-1];let n=e.slice();n[e.length-1]=t.setSelAfter(t.selectionsAfter.slice(0,t.selectionsAfter.length-1));return n}function addMappingToBranch(e,t){if(!e.length)return e;let n=e.length,r=j;while(n){let o=mapEvent(e[n-1],t,r);if(o.changes&&!o.changes.empty||o.effects.length){let t=e.slice(0,n);t[n-1]=o;return t}t=o.mapped;n--;r=o.selectionsAfter}return r.length?[HistEvent.selection(r)]:j}function mapEvent(e,t,n){let r=conc(e.selectionsAfter.length?e.selectionsAfter.map((e=>e.map(t))):j,n);if(!e.changes)return HistEvent.selection(r);let o=e.changes.map(t),l=t.mapDesc(e.changes,true);let s=e.mapped?e.mapped.composeDesc(l):l;return new HistEvent(o,c.mapEffects(e.effects,t),s,e.startSelection.map(l),r)}const W=/^(input\.type|delete)($|\.)/;class HistoryState{constructor(e,t,n=0,r=void 0){this.done=e;this.undone=t;this.prevTime=n;this.prevUserEvent=r}isolate(){return this.prevTime?new HistoryState(this.done,this.undone):this}addChanges(e,t,n,r,o){let l=this.done,s=l[l.length-1];l=s&&s.changes&&!s.changes.empty&&e.changes&&(!n||W.test(n))&&(!s.selectionsAfter.length&&t-this.prevTime<r.newGroupDelay&&r.joinToEvent(o,isAdjacent(s.changes,e.changes))||n=="input.type.compose")?updateBranch(l,l.length-1,r.minDepth,new HistEvent(e.changes.compose(s.changes),conc(e.effects,s.effects),s.mapped,s.startSelection,j)):updateBranch(l,l.length,r.minDepth,e);return new HistoryState(l,j,t,n)}addSelection(e,t,n,r){let o=this.done.length?this.done[this.done.length-1].selectionsAfter:j;return o.length>0&&t-this.prevTime<r&&n==this.prevUserEvent&&n&&/^select($|\.)/.test(n)&&eqSelectionShape(o[o.length-1],e)?this:new HistoryState(addSelection(this.done,e),this.undone,t,n)}addMapping(e){return new HistoryState(addMappingToBranch(this.done,e),addMappingToBranch(this.undone,e),this.prevTime,this.prevUserEvent)}pop(e,t,n){let r=e==0?this.done:this.undone;if(r.length==0)return null;let o=r[r.length-1],l=o.selectionsAfter[0]||t.selection;if(n&&o.selectionsAfter.length)return t.update({selection:o.selectionsAfter[o.selectionsAfter.length-1],annotations:O.of({side:e,rest:popSelection(r),selection:l}),userEvent:e==0?"select.undo":"select.redo",scrollIntoView:true});if(o.changes){let n=r.length==1?j:r.slice(0,r.length-1);o.mapped&&(n=addMappingToBranch(n,o.mapped));return t.update({changes:o.changes,selection:o.startSelection,effects:o.effects,annotations:O.of({side:e,rest:n,selection:l}),filter:false,userEvent:e==0?"undo":"redo",scrollIntoView:true})}return null}}HistoryState.empty=new HistoryState(j,j);const $=[{key:"Mod-z",run:N,preventDefault:true},{key:"Mod-y",mac:"Mod-Shift-z",run:G,preventDefault:true},{linux:"Ctrl-Shift-z",run:G,preventDefault:true},{key:"Mod-u",run:J,preventDefault:true},{key:"Alt-u",mac:"Mod-Shift-u",run:P,preventDefault:true}];function updateSel(e,t){return a.create(e.ranges.map(t),e.mainIndex)}function setSel(e,t){return e.update({selection:t,scrollIntoView:true,userEvent:"select"})}function moveSel({state:e,dispatch:t},n){let r=updateSel(e.selection,n);if(r.eq(e.selection,true))return false;t(setSel(e,r));return true}function rangeEnd(e,t){return a.cursor(t?e.to:e.from)}function cursorByChar(e,t){return moveSel(e,(n=>n.empty?e.moveByChar(n,t):rangeEnd(n,t)))}function ltrAtCursor(e){return e.textDirectionAt(e.state.selection.main.head)==m.LTR}const cursorCharLeft=e=>cursorByChar(e,!ltrAtCursor(e));const cursorCharRight=e=>cursorByChar(e,ltrAtCursor(e));const cursorCharForward=e=>cursorByChar(e,true);const cursorCharBackward=e=>cursorByChar(e,false);function cursorByGroup(e,t){return moveSel(e,(n=>n.empty?e.moveByGroup(n,t):rangeEnd(n,t)))}const cursorGroupLeft=e=>cursorByGroup(e,!ltrAtCursor(e));const cursorGroupRight=e=>cursorByGroup(e,ltrAtCursor(e));const cursorGroupForward=e=>cursorByGroup(e,true);const cursorGroupBackward=e=>cursorByGroup(e,false);const _=typeof Intl!="undefined"&&Intl.Segmenter?new Intl.Segmenter(void 0,{granularity:"word"}):null;function moveBySubword(e,t,n){let r=e.state.charCategorizer(t.from);let o=i.Space,l=t.from,s=0;let c=false,u=false,f=false;let step=t=>{if(c)return false;l+=n?t.length:-t.length;let a,h=r(t);h==i.Word&&t.charCodeAt(0)<128&&/[\W_]/.test(t)&&(h=-1);o==i.Space&&(o=h);if(o!=h)return false;if(o==i.Word)if(t.toLowerCase()==t){if(!n&&u)return false;f=true}else if(f){if(n)return false;c=true}else{if(u&&n&&r(a=e.state.sliceDoc(l,l+1))==i.Word&&a.toLowerCase()==a)return false;u=true}s++;return true};let h=e.moveByChar(t,n,(e=>{step(e);return step}));if(_&&o==i.Word&&h.from==t.from+s*(n?1:-1)){let r=Math.min(t.head,h.head),o=Math.max(t.head,h.head);let l=e.state.sliceDoc(r,o);if(l.length>1&&/[\u4E00-\uffff]/.test(l)){let e=Array.from(_.segment(l));if(e.length>1)return n?a.cursor(t.head+e[1].index,-1):a.cursor(h.head+e[e.length-1].index,1)}}return h}function cursorBySubword(e,t){return moveSel(e,(n=>n.empty?moveBySubword(e,n,t):rangeEnd(n,t)))}const cursorSubwordForward=e=>cursorBySubword(e,true);const cursorSubwordBackward=e=>cursorBySubword(e,false);function interestingNode(e,t,n){if(t.type.prop(n))return true;let r=t.to-t.from;return r&&(r>2||/[^\s,.;:]/.test(e.sliceDoc(t.from,t.to)))||t.firstChild}function moveBySyntax(e,t,n){let r=p(e).resolveInner(t.head);let o=n?k.closedBy:k.openedBy;for(let l=t.head;;){let t=n?r.childAfter(l):r.childBefore(l);if(!t)break;interestingNode(e,t,o)?r=t:l=n?t.to:t.from}let l,s,c=r.type.prop(o);s=c&&(l=n?g(e,r.from,1):g(e,r.to,-1))&&l.matched?n?l.end.to:l.end.from:n?r.to:r.from;return a.cursor(s,n?-1:1)}const cursorSyntaxLeft=e=>moveSel(e,(t=>moveBySyntax(e.state,t,!ltrAtCursor(e))));const cursorSyntaxRight=e=>moveSel(e,(t=>moveBySyntax(e.state,t,ltrAtCursor(e))));function cursorByLine(e,t){return moveSel(e,(n=>{if(!n.empty)return rangeEnd(n,t);let r=e.moveVertically(n,t);return r.head!=n.head?r:e.moveToLineBoundary(n,t)}))}const cursorLineUp=e=>cursorByLine(e,false);const cursorLineDown=e=>cursorByLine(e,true);function pageInfo(e){let t=e.scrollDOM.clientHeight<e.scrollDOM.scrollHeight-2;let n,r=0,o=0;if(t){for(let t of e.state.facet(d.scrollMargins)){let n=t(e);(n===null||n===void 0?void 0:n.top)&&(r=Math.max(n===null||n===void 0?void 0:n.top,r));(n===null||n===void 0?void 0:n.bottom)&&(o=Math.max(n===null||n===void 0?void 0:n.bottom,o))}n=e.scrollDOM.clientHeight-r-o}else n=(e.dom.ownerDocument.defaultView||window).innerHeight;return{marginTop:r,marginBottom:o,selfScroll:t,height:Math.max(e.defaultLineHeight,n-5)}}function cursorByPage(e,t){let n=pageInfo(e);let{state:r}=e,o=updateSel(r.selection,(r=>r.empty?e.moveVertically(r,t,n.height):rangeEnd(r,t)));if(o.eq(r.selection))return false;let l;if(n.selfScroll){let t=e.coordsAtPos(r.selection.main.head);let s=e.scrollDOM.getBoundingClientRect();let a=s.top+n.marginTop,c=s.bottom-n.marginBottom;t&&t.top>a&&t.bottom<c&&(l=d.scrollIntoView(o.main.head,{y:"start",yMargin:t.top-a}))}e.dispatch(setSel(r,o),{effects:l});return true}const cursorPageUp=e=>cursorByPage(e,false);const cursorPageDown=e=>cursorByPage(e,true);function moveByLineBoundary(e,t,n){let r=e.lineBlockAt(t.head),o=e.moveToLineBoundary(t,n);o.head==t.head&&o.head!=(n?r.to:r.from)&&(o=e.moveToLineBoundary(t,n,false));if(!n&&o.head==r.from&&r.length){let n=/^\s*/.exec(e.state.sliceDoc(r.from,Math.min(r.from+100,r.to)))[0].length;n&&t.head!=r.from+n&&(o=a.cursor(r.from+n))}return o}const cursorLineBoundaryForward=e=>moveSel(e,(t=>moveByLineBoundary(e,t,true)));const cursorLineBoundaryBackward=e=>moveSel(e,(t=>moveByLineBoundary(e,t,false)));const cursorLineBoundaryLeft=e=>moveSel(e,(t=>moveByLineBoundary(e,t,!ltrAtCursor(e))));const cursorLineBoundaryRight=e=>moveSel(e,(t=>moveByLineBoundary(e,t,ltrAtCursor(e))));const cursorLineStart=e=>moveSel(e,(t=>a.cursor(e.lineBlockAt(t.head).from,1)));const cursorLineEnd=e=>moveSel(e,(t=>a.cursor(e.lineBlockAt(t.head).to,-1)));function toMatchingBracket(e,t,n){let r=false,o=updateSel(e.selection,(t=>{let o=g(e,t.head,-1)||g(e,t.head,1)||t.head>0&&g(e,t.head-1,1)||t.head<e.doc.length&&g(e,t.head+1,-1);if(!o||!o.end)return t;r=true;let l=o.start.from==t.head?o.end.to:o.end.from;return n?a.range(t.anchor,l):a.cursor(l)}));if(!r)return false;t(setSel(e,o));return true}const cursorMatchingBracket=({state:e,dispatch:t})=>toMatchingBracket(e,t,false);const selectMatchingBracket=({state:e,dispatch:t})=>toMatchingBracket(e,t,true);function extendSel(e,t){let n=updateSel(e.state.selection,(e=>{let n=t(e);return a.range(e.anchor,n.head,n.goalColumn,n.bidiLevel||void 0)}));if(n.eq(e.state.selection))return false;e.dispatch(setSel(e.state,n));return true}function selectByChar(e,t){return extendSel(e,(n=>e.moveByChar(n,t)))}const selectCharLeft=e=>selectByChar(e,!ltrAtCursor(e));const selectCharRight=e=>selectByChar(e,ltrAtCursor(e));const selectCharForward=e=>selectByChar(e,true);const selectCharBackward=e=>selectByChar(e,false);function selectByGroup(e,t){return extendSel(e,(n=>e.moveByGroup(n,t)))}const selectGroupLeft=e=>selectByGroup(e,!ltrAtCursor(e));const selectGroupRight=e=>selectByGroup(e,ltrAtCursor(e));const selectGroupForward=e=>selectByGroup(e,true);const selectGroupBackward=e=>selectByGroup(e,false);function selectBySubword(e,t){return extendSel(e,(n=>moveBySubword(e,n,t)))}const selectSubwordForward=e=>selectBySubword(e,true);const selectSubwordBackward=e=>selectBySubword(e,false);const selectSyntaxLeft=e=>extendSel(e,(t=>moveBySyntax(e.state,t,!ltrAtCursor(e))));const selectSyntaxRight=e=>extendSel(e,(t=>moveBySyntax(e.state,t,ltrAtCursor(e))));function selectByLine(e,t){return extendSel(e,(n=>e.moveVertically(n,t)))}const selectLineUp=e=>selectByLine(e,false);const selectLineDown=e=>selectByLine(e,true);function selectByPage(e,t){return extendSel(e,(n=>e.moveVertically(n,t,pageInfo(e).height)))}const selectPageUp=e=>selectByPage(e,false);const selectPageDown=e=>selectByPage(e,true);const selectLineBoundaryForward=e=>extendSel(e,(t=>moveByLineBoundary(e,t,true)));const selectLineBoundaryBackward=e=>extendSel(e,(t=>moveByLineBoundary(e,t,false)));const selectLineBoundaryLeft=e=>extendSel(e,(t=>moveByLineBoundary(e,t,!ltrAtCursor(e))));const selectLineBoundaryRight=e=>extendSel(e,(t=>moveByLineBoundary(e,t,ltrAtCursor(e))));const selectLineStart=e=>extendSel(e,(t=>a.cursor(e.lineBlockAt(t.head).from)));const selectLineEnd=e=>extendSel(e,(t=>a.cursor(e.lineBlockAt(t.head).to)));const cursorDocStart=({state:e,dispatch:t})=>{t(setSel(e,{anchor:0}));return true};const cursorDocEnd=({state:e,dispatch:t})=>{t(setSel(e,{anchor:e.doc.length}));return true};const selectDocStart=({state:e,dispatch:t})=>{t(setSel(e,{anchor:e.selection.main.anchor,head:0}));return true};const selectDocEnd=({state:e,dispatch:t})=>{t(setSel(e,{anchor:e.selection.main.anchor,head:e.doc.length}));return true};const selectAll=({state:e,dispatch:t})=>{t(e.update({selection:{anchor:0,head:e.doc.length},userEvent:"select"}));return true};const selectLine=({state:e,dispatch:t})=>{let n=selectedLineBlocks(e).map((({from:t,to:n})=>a.range(t,Math.min(n+1,e.doc.length))));t(e.update({selection:a.create(n),userEvent:"select"}));return true};const selectParentSyntax=({state:e,dispatch:t})=>{let n=updateSel(e.selection,(t=>{var n;let r=p(e).resolveStack(t.from,1);for(let e=r;e;e=e.next){let{node:r}=e;if((r.from<t.from&&r.to>=t.to||r.to>t.to&&r.from<=t.from)&&((n=r.parent)===null||n===void 0?void 0:n.parent))return a.range(r.to,r.from)}return t}));t(setSel(e,n));return true};const simplifySelection=({state:e,dispatch:t})=>{let n=e.selection,r=null;n.ranges.length>1?r=a.create([n.main]):n.main.empty||(r=a.create([a.cursor(n.main.head)]));if(!r)return false;t(setSel(e,r));return true};function deleteBy(e,t){if(e.state.readOnly)return false;let n="delete.selection",{state:r}=e;let o=r.changeByRange((r=>{let{from:o,to:l}=r;if(o==l){let s=t(r);if(s<o){n="delete.backward";s=skipAtomic(e,s,false)}else if(s>o){n="delete.forward";s=skipAtomic(e,s,true)}o=Math.min(o,s);l=Math.max(l,s)}else{o=skipAtomic(e,o,false);l=skipAtomic(e,l,true)}return o==l?{range:r}:{changes:{from:o,to:l},range:a.cursor(o,o<r.head?-1:1)}}));if(o.changes.empty)return false;e.dispatch(r.update(o,{scrollIntoView:true,userEvent:n,effects:n=="delete.selection"?d.announce.of(r.phrase("Selection deleted")):void 0}));return true}function skipAtomic(e,t,n){if(e instanceof d)for(let r of e.state.facet(d.atomicRanges).map((t=>t(e))))r.between(t,t,((e,r)=>{e<t&&r>t&&(t=n?r:e)}));return t}const deleteByChar=(e,t)=>deleteBy(e,(n=>{let r,o,l=n.from,{state:s}=e,a=s.doc.lineAt(l);if(!t&&l>a.from&&l<a.from+200&&!/[^ \t]/.test(r=a.text.slice(0,l-a.from))){if(r[r.length-1]=="\t")return l-1;let e=u(r,s.tabSize),t=e%y(s)||y(s);for(let e=0;e<t&&r[r.length-1-e]==" ";e++)l--;o=l}else{o=f(a.text,l-a.from,t,t)+a.from;o==l&&a.number!=(t?s.doc.lines:1)?o+=t?1:-1:!t&&/[\ufe00-\ufe0f]/.test(a.text.slice(o-a.from,l-a.from))&&(o=f(a.text,o-a.from,false,false)+a.from)}return o}));const deleteCharBackward=e=>deleteByChar(e,false);const deleteCharForward=e=>deleteByChar(e,true);const deleteByGroup=(e,t)=>deleteBy(e,(n=>{let r=n.head,{state:o}=e,l=o.doc.lineAt(r);let s=o.charCategorizer(r);for(let e=null;;){if(r==(t?l.to:l.from)){r==n.head&&l.number!=(t?o.doc.lines:1)&&(r+=t?1:-1);break}let a=f(l.text,r-l.from,t)+l.from;let c=l.text.slice(Math.min(r,a)-l.from,Math.max(r,a)-l.from);let i=s(c);if(e!=null&&i!=e)break;c==" "&&r==n.head||(e=i);r=a}return r}));const deleteGroupBackward=e=>deleteByGroup(e,false);const deleteGroupForward=e=>deleteByGroup(e,true);const deleteToLineEnd=e=>deleteBy(e,(t=>{let n=e.lineBlockAt(t.head).to;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}));const deleteToLineStart=e=>deleteBy(e,(t=>{let n=e.lineBlockAt(t.head).from;return t.head>n?n:Math.max(0,t.head-1)}));const deleteLineBoundaryBackward=e=>deleteBy(e,(t=>{let n=e.moveToLineBoundary(t,false).head;return t.head>n?n:Math.max(0,t.head-1)}));const deleteLineBoundaryForward=e=>deleteBy(e,(t=>{let n=e.moveToLineBoundary(t,true).head;return t.head<n?n:Math.min(e.state.doc.length,t.head+1)}));const deleteTrailingWhitespace=({state:e,dispatch:t})=>{if(e.readOnly)return false;let n=[];for(let t=0,r="",o=e.doc.iter();;){o.next();if(o.lineBreak||o.done){let e=r.search(/\s+$/);e>-1&&n.push({from:t-(r.length-e),to:t});if(o.done)break;r=""}else r=o.value;t+=o.value.length}if(!n.length)return false;t(e.update({changes:n,userEvent:"delete"}));return true};const splitLine=({state:e,dispatch:t})=>{if(e.readOnly)return false;let n=e.changeByRange((e=>({changes:{from:e.from,to:e.to,insert:h.of(["",""])},range:a.cursor(e.from)})));t(e.update(n,{scrollIntoView:true,userEvent:"input"}));return true};const transposeChars=({state:e,dispatch:t})=>{if(e.readOnly)return false;let n=e.changeByRange((t=>{if(!t.empty||t.from==0||t.from==e.doc.length)return{range:t};let n=t.from,r=e.doc.lineAt(n);let o=n==r.from?n-1:f(r.text,n-r.from,false)+r.from;let l=n==r.to?n+1:f(r.text,n-r.from,true)+r.from;return{changes:{from:o,to:l,insert:e.doc.slice(n,l).append(e.doc.slice(o,n))},range:a.cursor(l)}}));if(n.changes.empty)return false;t(e.update(n,{scrollIntoView:true,userEvent:"move.character"}));return true};function selectedLineBlocks(e){let t=[],n=-1;for(let r of e.selection.ranges){let o=e.doc.lineAt(r.from),l=e.doc.lineAt(r.to);r.empty||r.to!=l.from||(l=e.doc.lineAt(r.to-1));if(n>=o.number){let e=t[t.length-1];e.to=l.to;e.ranges.push(r)}else t.push({from:o.from,to:l.to,ranges:[r]});n=l.number+1}return t}function moveLine(e,t,n){if(e.readOnly)return false;let r=[],o=[];for(let t of selectedLineBlocks(e)){if(n?t.to==e.doc.length:t.from==0)continue;let l=e.doc.lineAt(n?t.to+1:t.from-1);let s=l.length+1;if(n){r.push({from:t.to,to:l.to},{from:t.from,insert:l.text+e.lineBreak});for(let n of t.ranges)o.push(a.range(Math.min(e.doc.length,n.anchor+s),Math.min(e.doc.length,n.head+s)))}else{r.push({from:l.from,to:t.from},{from:t.to,insert:e.lineBreak+l.text});for(let e of t.ranges)o.push(a.range(e.anchor-s,e.head-s))}}if(!r.length)return false;t(e.update({changes:r,scrollIntoView:true,selection:a.create(o,e.selection.mainIndex),userEvent:"move.line"}));return true}const moveLineUp=({state:e,dispatch:t})=>moveLine(e,t,false);const moveLineDown=({state:e,dispatch:t})=>moveLine(e,t,true);function copyLine(e,t,n){if(e.readOnly)return false;let r=[];for(let t of selectedLineBlocks(e))n?r.push({from:t.from,insert:e.doc.slice(t.from,t.to)+e.lineBreak}):r.push({from:t.to,insert:e.lineBreak+e.doc.slice(t.from,t.to)});t(e.update({changes:r,scrollIntoView:true,userEvent:"input.copyline"}));return true}const copyLineUp=({state:e,dispatch:t})=>copyLine(e,t,false);const copyLineDown=({state:e,dispatch:t})=>copyLine(e,t,true);const deleteLine=e=>{if(e.state.readOnly)return false;let{state:t}=e,n=t.changes(selectedLineBlocks(t).map((({from:e,to:n})=>{e>0?e--:n<t.doc.length&&n++;return{from:e,to:n}})));let r=updateSel(t.selection,(t=>e.moveVertically(t,true))).map(n);e.dispatch({changes:n,selection:r,scrollIntoView:true,userEvent:"delete.line"});return true};const insertNewline=({state:e,dispatch:t})=>{t(e.update(e.replaceSelection(e.lineBreak),{scrollIntoView:true,userEvent:"input"}));return true};function isBetweenBrackets(e,t){if(/\(\)|\[\]|\{\}/.test(e.sliceDoc(t-1,t+1)))return{from:t,to:t};let n=p(e).resolveInner(t);let r,o=n.childBefore(t),l=n.childAfter(t);return o&&l&&o.to<=t&&l.from>=t&&(r=o.type.prop(k.closedBy))&&r.indexOf(l.name)>-1&&e.doc.lineAt(o.to).from==e.doc.lineAt(l.from).from&&!/\S/.test(e.sliceDoc(o.to,l.from))?{from:o.to,to:l.from}:null}const F=newlineAndIndent(false);const K=newlineAndIndent(true);function newlineAndIndent(e){return({state:t,dispatch:n})=>{if(t.readOnly)return false;let r=t.changeByRange((n=>{let{from:r,to:o}=n,l=t.doc.lineAt(r);let s=!e&&r==o&&isBetweenBrackets(t,r);e&&(r=o=(o<=l.to?l:t.doc.lineAt(o)).to);let c=new v(t,{simulateBreak:r,simulateDoubleBreak:!!s});let i=B(c,r);i==null&&(i=u(/^\s*/.exec(t.doc.lineAt(r).text)[0],t.tabSize));while(o<l.to&&/\s/.test(l.text[o-l.from]))o++;s?({from:r,to:o}=s):r>l.from&&r<l.from+100&&!/\S/.test(l.text.slice(0,r))&&(r=l.from);let f=["",S(t,i)];s&&f.push(S(t,c.lineIndent(l.from,-1)));return{changes:{from:r,to:o,insert:h.of(f)},range:a.cursor(r+1+f[1].length)}}));n(t.update(r,{scrollIntoView:true,userEvent:"input"}));return true}}function changeBySelectedLine(e,t){let n=-1;return e.changeByRange((r=>{let o=[];for(let l=r.from;l<=r.to;){let s=e.doc.lineAt(l);if(s.number>n&&(r.empty||r.to>s.from)){t(s,o,r);n=s.number}l=s.to+1}let l=e.changes(o);return{changes:o,range:a.range(l.mapPos(r.anchor,1),l.mapPos(r.head,1))}}))}const indentSelection=({state:e,dispatch:t})=>{if(e.readOnly)return false;let n=Object.create(null);let r=new v(e,{overrideIndentation:e=>{let t=n[e];return t==null?-1:t}});let o=changeBySelectedLine(e,((t,o,l)=>{let s=B(r,t.from);if(s==null)return;/\S/.test(t.text)||(s=0);let a=/^\s*/.exec(t.text)[0];let c=S(e,s);if(a!=c||l.from<t.from+a.length){n[t.from]=s;o.push({from:t.from,to:t.from+a.length,insert:c})}}));o.changes.empty||t(e.update(o,{userEvent:"indent"}));return true};const indentMore=({state:e,dispatch:t})=>{if(e.readOnly)return false;t(e.update(changeBySelectedLine(e,((t,n)=>{n.push({from:t.from,insert:e.facet(A)})})),{userEvent:"input.indent"}));return true};const indentLess=({state:e,dispatch:t})=>{if(e.readOnly)return false;t(e.update(changeBySelectedLine(e,((t,n)=>{let r=/^\s*/.exec(t.text)[0];if(!r)return;let o=u(r,e.tabSize),l=0;let s=S(e,Math.max(0,o-y(e)));while(l<r.length&&l<s.length&&r.charCodeAt(l)==s.charCodeAt(l))l++;n.push({from:t.from+l,to:t.from+r.length,insert:s.slice(l)})})),{userEvent:"delete.dedent"}));return true};const insertTab=({state:e,dispatch:t})=>{if(e.selection.ranges.some((e=>!e.empty)))return indentMore({state:e,dispatch:t});t(e.update(e.replaceSelection("\t"),{scrollIntoView:true,userEvent:"input"}));return true};const Q=[{key:"Ctrl-b",run:cursorCharLeft,shift:selectCharLeft,preventDefault:true},{key:"Ctrl-f",run:cursorCharRight,shift:selectCharRight},{key:"Ctrl-p",run:cursorLineUp,shift:selectLineUp},{key:"Ctrl-n",run:cursorLineDown,shift:selectLineDown},{key:"Ctrl-a",run:cursorLineStart,shift:selectLineStart},{key:"Ctrl-e",run:cursorLineEnd,shift:selectLineEnd},{key:"Ctrl-d",run:deleteCharForward},{key:"Ctrl-h",run:deleteCharBackward},{key:"Ctrl-k",run:deleteToLineEnd},{key:"Ctrl-Alt-h",run:deleteGroupBackward},{key:"Ctrl-o",run:splitLine},{key:"Ctrl-t",run:transposeChars},{key:"Ctrl-v",run:cursorPageDown}];const X=[{key:"ArrowLeft",run:cursorCharLeft,shift:selectCharLeft,preventDefault:true},{key:"Mod-ArrowLeft",mac:"Alt-ArrowLeft",run:cursorGroupLeft,shift:selectGroupLeft,preventDefault:true},{mac:"Cmd-ArrowLeft",run:cursorLineBoundaryLeft,shift:selectLineBoundaryLeft,preventDefault:true},{key:"ArrowRight",run:cursorCharRight,shift:selectCharRight,preventDefault:true},{key:"Mod-ArrowRight",mac:"Alt-ArrowRight",run:cursorGroupRight,shift:selectGroupRight,preventDefault:true},{mac:"Cmd-ArrowRight",run:cursorLineBoundaryRight,shift:selectLineBoundaryRight,preventDefault:true},{key:"ArrowUp",run:cursorLineUp,shift:selectLineUp,preventDefault:true},{mac:"Cmd-ArrowUp",run:cursorDocStart,shift:selectDocStart},{mac:"Ctrl-ArrowUp",run:cursorPageUp,shift:selectPageUp},{key:"ArrowDown",run:cursorLineDown,shift:selectLineDown,preventDefault:true},{mac:"Cmd-ArrowDown",run:cursorDocEnd,shift:selectDocEnd},{mac:"Ctrl-ArrowDown",run:cursorPageDown,shift:selectPageDown},{key:"PageUp",run:cursorPageUp,shift:selectPageUp},{key:"PageDown",run:cursorPageDown,shift:selectPageDown},{key:"Home",run:cursorLineBoundaryBackward,shift:selectLineBoundaryBackward,preventDefault:true},{key:"Mod-Home",run:cursorDocStart,shift:selectDocStart},{key:"End",run:cursorLineBoundaryForward,shift:selectLineBoundaryForward,preventDefault:true},{key:"Mod-End",run:cursorDocEnd,shift:selectDocEnd},{key:"Enter",run:F},{key:"Mod-a",run:selectAll},{key:"Backspace",run:deleteCharBackward,shift:deleteCharBackward},{key:"Delete",run:deleteCharForward},{key:"Mod-Backspace",mac:"Alt-Backspace",run:deleteGroupBackward},{key:"Mod-Delete",mac:"Alt-Delete",run:deleteGroupForward},{mac:"Mod-Backspace",run:deleteLineBoundaryBackward},{mac:"Mod-Delete",run:deleteLineBoundaryForward}].concat(Q.map((e=>({mac:e.key,run:e.run,shift:e.shift}))));const Y=[{key:"Alt-ArrowLeft",mac:"Ctrl-ArrowLeft",run:cursorSyntaxLeft,shift:selectSyntaxLeft},{key:"Alt-ArrowRight",mac:"Ctrl-ArrowRight",run:cursorSyntaxRight,shift:selectSyntaxRight},{key:"Alt-ArrowUp",run:moveLineUp},{key:"Shift-Alt-ArrowUp",run:copyLineUp},{key:"Alt-ArrowDown",run:moveLineDown},{key:"Shift-Alt-ArrowDown",run:copyLineDown},{key:"Escape",run:simplifySelection},{key:"Mod-Enter",run:K},{key:"Alt-l",mac:"Ctrl-l",run:selectLine},{key:"Mod-i",run:selectParentSyntax,preventDefault:true},{key:"Mod-[",run:indentLess},{key:"Mod-]",run:indentMore},{key:"Mod-Alt-\\",run:indentSelection},{key:"Shift-Mod-k",run:deleteLine},{key:"Shift-Mod-\\",run:cursorMatchingBracket},{key:"Mod-/",run:toggleComment},{key:"Alt-A",run:D}].concat(X);const Z={key:"Tab",run:indentMore,shift:indentLess};export{M as blockComment,E as blockUncomment,copyLineDown,copyLineUp,cursorCharBackward,cursorCharForward,cursorCharLeft,cursorCharRight,cursorDocEnd,cursorDocStart,cursorGroupBackward,cursorGroupForward,cursorGroupLeft,cursorGroupRight,cursorLineBoundaryBackward,cursorLineBoundaryForward,cursorLineBoundaryLeft,cursorLineBoundaryRight,cursorLineDown,cursorLineEnd,cursorLineStart,cursorLineUp,cursorMatchingBracket,cursorPageDown,cursorPageUp,cursorSubwordBackward,cursorSubwordForward,cursorSyntaxLeft,cursorSyntaxRight,Y as defaultKeymap,deleteCharBackward,deleteCharForward,deleteGroupBackward,deleteGroupForward,deleteLine,deleteLineBoundaryBackward,deleteLineBoundaryForward,deleteToLineEnd,deleteToLineStart,deleteTrailingWhitespace,Q as emacsStyleKeymap,history,V as historyField,$ as historyKeymap,indentLess,indentMore,indentSelection,Z as indentWithTab,K as insertBlankLine,insertNewline,F as insertNewlineAndIndent,insertTab,I as invertedEffects,H as isolateHistory,C as lineComment,x as lineUncomment,moveLineDown,moveLineUp,G as redo,z as redoDepth,P as redoSelection,selectAll,selectCharBackward,selectCharForward,selectCharLeft,selectCharRight,selectDocEnd,selectDocStart,selectGroupBackward,selectGroupForward,selectGroupLeft,selectGroupRight,selectLine,selectLineBoundaryBackward,selectLineBoundaryForward,selectLineBoundaryLeft,selectLineBoundaryRight,selectLineDown,selectLineEnd,selectLineStart,selectLineUp,selectMatchingBracket,selectPageDown,selectPageUp,selectParentSyntax,selectSubwordBackward,selectSubwordForward,selectSyntaxLeft,selectSyntaxRight,simplifySelection,splitLine,X as standardKeymap,D as toggleBlockComment,L as toggleBlockCommentByLine,toggleComment,w as toggleLineComment,transposeChars,N as undo,U as undoDepth,J as undoSelection};
|
2
|
+
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{parser as e}from"@lezer/css";import{syntaxTree as t,LRLanguage as r,indentNodeProp as a,continuedIndent as o,foldNodeProp as i,foldInside as l,LanguageSupport as n}from"@codemirror/language";import{NodeWeakMap as s,IterMode as d}from"@lezer/common";let c=null;function properties(){if(!c&&"object"==typeof document&&document.body){let{style:e}=document.body,t=[],r=new Set;for(let a in e)if("cssText"!=a&&"cssFloat"!=a&&"string"==typeof e[a]){/[A-Z]/.test(a)&&(a=a.replace(/[A-Z]/g,(e=>"-"+e.toLowerCase())));if(!r.has(a)){t.push(a);r.add(a)}}c=t.sort().map((e=>({type:"property",label:e})))}return c||[]}const u=["active","after","any-link","autofill","backdrop","before","checked","cue","default","defined","disabled","empty","enabled","file-selector-button","first","first-child","first-letter","first-line","first-of-type","focus","focus-visible","focus-within","fullscreen","has","host","host-context","hover","in-range","indeterminate","invalid","is","lang","last-child","last-of-type","left","link","marker","modal","not","nth-child","nth-last-child","nth-last-of-type","nth-of-type","only-child","only-of-type","optional","out-of-range","part","placeholder","placeholder-shown","read-only","read-write","required","right","root","scope","selection","slotted","target","target-text","valid","visited","where"].map((e=>({type:"class",label:e})));const p=["above","absolute","activeborder","additive","activecaption","after-white-space","ahead","alias","all","all-scroll","alphabetic","alternate","always","antialiased","appworkspace","asterisks","attr","auto","auto-flow","avoid","avoid-column","avoid-page","avoid-region","axis-pan","background","backwards","baseline","below","bidi-override","blink","block","block-axis","bold","bolder","border","border-box","both","bottom","break","break-all","break-word","bullets","button","button-bevel","buttonface","buttonhighlight","buttonshadow","buttontext","calc","capitalize","caps-lock-indicator","caption","captiontext","caret","cell","center","checkbox","circle","cjk-decimal","clear","clip","close-quote","col-resize","collapse","color","color-burn","color-dodge","column","column-reverse","compact","condensed","contain","content","contents","content-box","context-menu","continuous","copy","counter","counters","cover","crop","cross","crosshair","currentcolor","cursive","cyclic","darken","dashed","decimal","decimal-leading-zero","default","default-button","dense","destination-atop","destination-in","destination-out","destination-over","difference","disc","discard","disclosure-closed","disclosure-open","document","dot-dash","dot-dot-dash","dotted","double","down","e-resize","ease","ease-in","ease-in-out","ease-out","element","ellipse","ellipsis","embed","end","ethiopic-abegede-gez","ethiopic-halehame-aa-er","ethiopic-halehame-gez","ew-resize","exclusion","expanded","extends","extra-condensed","extra-expanded","fantasy","fast","fill","fill-box","fixed","flat","flex","flex-end","flex-start","footnotes","forwards","from","geometricPrecision","graytext","grid","groove","hand","hard-light","help","hidden","hide","higher","highlight","highlighttext","horizontal","hsl","hsla","hue","icon","ignore","inactiveborder","inactivecaption","inactivecaptiontext","infinite","infobackground","infotext","inherit","initial","inline","inline-axis","inline-block","inline-flex","inline-grid","inline-table","inset","inside","intrinsic","invert","italic","justify","keep-all","landscape","large","larger","left","level","lighter","lighten","line-through","linear","linear-gradient","lines","list-item","listbox","listitem","local","logical","loud","lower","lower-hexadecimal","lower-latin","lower-norwegian","lowercase","ltr","luminosity","manipulation","match","matrix","matrix3d","medium","menu","menutext","message-box","middle","min-intrinsic","mix","monospace","move","multiple","multiple_mask_images","multiply","n-resize","narrower","ne-resize","nesw-resize","no-close-quote","no-drop","no-open-quote","no-repeat","none","normal","not-allowed","nowrap","ns-resize","numbers","numeric","nw-resize","nwse-resize","oblique","opacity","open-quote","optimizeLegibility","optimizeSpeed","outset","outside","outside-shape","overlay","overline","padding","padding-box","painted","page","paused","perspective","pinch-zoom","plus-darker","plus-lighter","pointer","polygon","portrait","pre","pre-line","pre-wrap","preserve-3d","progress","push-button","radial-gradient","radio","read-only","read-write","read-write-plaintext-only","rectangle","region","relative","repeat","repeating-linear-gradient","repeating-radial-gradient","repeat-x","repeat-y","reset","reverse","rgb","rgba","ridge","right","rotate","rotate3d","rotateX","rotateY","rotateZ","round","row","row-resize","row-reverse","rtl","run-in","running","s-resize","sans-serif","saturation","scale","scale3d","scaleX","scaleY","scaleZ","screen","scroll","scrollbar","scroll-position","se-resize","self-start","self-end","semi-condensed","semi-expanded","separate","serif","show","single","skew","skewX","skewY","skip-white-space","slide","slider-horizontal","slider-vertical","sliderthumb-horizontal","sliderthumb-vertical","slow","small","small-caps","small-caption","smaller","soft-light","solid","source-atop","source-in","source-out","source-over","space","space-around","space-between","space-evenly","spell-out","square","start","static","status-bar","stretch","stroke","stroke-box","sub","subpixel-antialiased","svg_masks","super","sw-resize","symbolic","symbols","system-ui","table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row","table-row-group","text","text-bottom","text-top","textarea","textfield","thick","thin","threeddarkshadow","threedface","threedhighlight","threedlightshadow","threedshadow","to","top","transform","translate","translate3d","translateX","translateY","translateZ","transparent","ultra-condensed","ultra-expanded","underline","unidirectional-pan","unset","up","upper-latin","uppercase","url","var","vertical","vertical-text","view-box","visible","visibleFill","visiblePainted","visibleStroke","visual","w-resize","wait","wave","wider","window","windowframe","windowtext","words","wrap","wrap-reverse","x-large","x-small","xor","xx-large","xx-small"].map((e=>({type:"keyword",label:e}))).concat(["aliceblue","antiquewhite","aqua","aquamarine","azure","beige","bisque","black","blanchedalmond","blue","blueviolet","brown","burlywood","cadetblue","chartreuse","chocolate","coral","cornflowerblue","cornsilk","crimson","cyan","darkblue","darkcyan","darkgoldenrod","darkgray","darkgreen","darkkhaki","darkmagenta","darkolivegreen","darkorange","darkorchid","darkred","darksalmon","darkseagreen","darkslateblue","darkslategray","darkturquoise","darkviolet","deeppink","deepskyblue","dimgray","dodgerblue","firebrick","floralwhite","forestgreen","fuchsia","gainsboro","ghostwhite","gold","goldenrod","gray","grey","green","greenyellow","honeydew","hotpink","indianred","indigo","ivory","khaki","lavender","lavenderblush","lawngreen","lemonchiffon","lightblue","lightcoral","lightcyan","lightgoldenrodyellow","lightgray","lightgreen","lightpink","lightsalmon","lightseagreen","lightskyblue","lightslategray","lightsteelblue","lightyellow","lime","limegreen","linen","magenta","maroon","mediumaquamarine","mediumblue","mediumorchid","mediumpurple","mediumseagreen","mediumslateblue","mediumspringgreen","mediumturquoise","mediumvioletred","midnightblue","mintcream","mistyrose","moccasin","navajowhite","navy","oldlace","olive","olivedrab","orange","orangered","orchid","palegoldenrod","palegreen","paleturquoise","palevioletred","papayawhip","peachpuff","peru","pink","plum","powderblue","purple","rebeccapurple","red","rosybrown","royalblue","saddlebrown","salmon","sandybrown","seagreen","seashell","sienna","silver","skyblue","slateblue","slategray","snow","springgreen","steelblue","tan","teal","thistle","tomato","turquoise","violet","wheat","white","whitesmoke","yellow","yellowgreen"].map((e=>({type:"constant",label:e}))));const m=["a","abbr","address","article","aside","b","bdi","bdo","blockquote","body","br","button","canvas","caption","cite","code","col","colgroup","dd","del","details","dfn","dialog","div","dl","dt","em","figcaption","figure","footer","form","header","hgroup","h1","h2","h3","h4","h5","h6","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","meter","nav","ol","output","p","pre","ruby","section","select","small","source","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","tr","u","ul"].map((e=>({type:"type",label:e})));const h=/^(\w[\w-]*|-\w[\w-]*|)$/,g=/^-(-[\w-]*)?$/;function isVarArg(e,t){var r;("("==e.name||e.type.isError)&&(e=e.parent||e);if("ArgList"!=e.name)return false;let a=null===(r=e.parent)||void 0===r?void 0:r.firstChild;return"Callee"==(null===a||void 0===a?void 0:a.name)&&"var"==t.sliceString(a.from,a.to)}const b=new s;const f=["Declaration"];function astTop(e){for(let t=e;;){if(t.type.isTop)return t;if(!(t=t.parent))return e}}function variableNames(e,t,r){if(t.to-t.from>4096){let a=b.get(t);if(a)return a;let o=[],i=new Set,l=t.cursor(d.IncludeAnonymous);if(l.firstChild())do{for(let t of variableNames(e,l.node,r))if(!i.has(t.label)){i.add(t.label);o.push(t)}}while(l.nextSibling());b.set(t,o);return o}{let a=[],o=new Set;t.cursor().iterate((t=>{var i;if(r(t)&&t.matchContext(f)&&":"==(null===(i=t.node.nextSibling)||void 0===i?void 0:i.name)){let r=e.sliceString(t.from,t.to);if(!o.has(r)){o.add(r);a.push({label:r,type:"variable"})}}}));return a}}const defineCSSCompletionSource=e=>r=>{let{state:a,pos:o}=r,i=t(a).resolveInner(o,-1);let l=i.type.isError&&i.from==i.to-1&&"-"==a.doc.sliceString(i.from,i.to);if("PropertyName"==i.name||(l||"TagName"==i.name)&&/^(Block|Styles)$/.test(i.resolve(i.to).name))return{from:i.from,options:properties(),validFor:h};if("ValueName"==i.name)return{from:i.from,options:p,validFor:h};if("PseudoClassName"==i.name)return{from:i.from,options:u,validFor:h};if(e(i)||(r.explicit||l)&&isVarArg(i,a.doc))return{from:e(i)||l?i.from:o,options:variableNames(a.doc,astTop(i),e),validFor:g};if("TagName"==i.name){for(let{parent:e}=i;e;e=e.parent)if("Block"==e.name)return{from:i.from,options:properties(),validFor:h};return{from:i.from,options:m,validFor:h}}if(!r.explicit)return null;let n=i.resolve(o),s=n.childBefore(o);return s&&":"==s.name&&"PseudoClassSelector"==n.name?{from:o,options:u,validFor:h}:s&&":"==s.name&&"Declaration"==n.name||"ArgList"==n.name?{from:o,options:p,validFor:h}:"Block"==n.name||"Styles"==n.name?{from:o,options:properties(),validFor:h}:null};const w=defineCSSCompletionSource((e=>"VariableName"==e.name));const v=r.define({name:"css",parser:e.configure({props:[a.add({Declaration:o()}),i.add({"Block KeyframeList":l})]}),languageData:{commentTokens:{block:{open:"/*",close:"*/"}},indentOnInput:/^\s*\}$/,wordChars:"-"}});function css(){return new n(v,v.data.of({autocomplete:w}))}export{css,w as cssCompletionSource,v as cssLanguage,defineCSSCompletionSource};
|
2
|
+
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{parser as e,configureNesting as t}from"@lezer/html";import{cssLanguage as l,css as a}from"@codemirror/lang-css";import{javascriptLanguage as n,typescriptLanguage as r,jsxLanguage as o,tsxLanguage as s,javascript as i}from"@codemirror/lang-javascript";import{EditorView as u}from"@codemirror/view";import{EditorSelection as c}from"@codemirror/state";import{syntaxTree as m,indentNodeProp as d,foldNodeProp as p,bracketMatchingHandle as f,LRLanguage as g,LanguageSupport as h}from"@codemirror/language";const b=["_blank","_self","_top","_parent"];const y=["ascii","utf-8","utf-16","latin1","latin1"];const v=["get","post","put","delete"];const x=["application/x-www-form-urlencoded","multipart/form-data","text/plain"];const w=["true","false"];const C={};const T={a:{attrs:{href:null,ping:null,type:null,media:null,target:b,hreflang:null}},abbr:C,address:C,area:{attrs:{alt:null,coords:null,href:null,target:null,ping:null,media:null,hreflang:null,type:null,shape:["default","rect","circle","poly"]}},article:C,aside:C,audio:{attrs:{src:null,mediagroup:null,crossorigin:["anonymous","use-credentials"],preload:["none","metadata","auto"],autoplay:["autoplay"],loop:["loop"],controls:["controls"]}},b:C,base:{attrs:{href:null,target:b}},bdi:C,bdo:C,blockquote:{attrs:{cite:null}},body:C,br:C,button:{attrs:{form:null,formaction:null,name:null,value:null,autofocus:["autofocus"],disabled:["autofocus"],formenctype:x,formmethod:v,formnovalidate:["novalidate"],formtarget:b,type:["submit","reset","button"]}},canvas:{attrs:{width:null,height:null}},caption:C,center:C,cite:C,code:C,col:{attrs:{span:null}},colgroup:{attrs:{span:null}},command:{attrs:{type:["command","checkbox","radio"],label:null,icon:null,radiogroup:null,command:null,title:null,disabled:["disabled"],checked:["checked"]}},data:{attrs:{value:null}},datagrid:{attrs:{disabled:["disabled"],multiple:["multiple"]}},datalist:{attrs:{data:null}},dd:C,del:{attrs:{cite:null,datetime:null}},details:{attrs:{open:["open"]}},dfn:C,div:C,dl:C,dt:C,em:C,embed:{attrs:{src:null,type:null,width:null,height:null}},eventsource:{attrs:{src:null}},fieldset:{attrs:{disabled:["disabled"],form:null,name:null}},figcaption:C,figure:C,footer:C,form:{attrs:{action:null,name:null,"accept-charset":y,autocomplete:["on","off"],enctype:x,method:v,novalidate:["novalidate"],target:b}},h1:C,h2:C,h3:C,h4:C,h5:C,h6:C,head:{children:["title","base","link","style","meta","script","noscript","command"]},header:C,hgroup:C,hr:C,html:{attrs:{manifest:null}},i:C,iframe:{attrs:{src:null,srcdoc:null,name:null,width:null,height:null,sandbox:["allow-top-navigation","allow-same-origin","allow-forms","allow-scripts"],seamless:["seamless"]}},img:{attrs:{alt:null,src:null,ismap:null,usemap:null,width:null,height:null,crossorigin:["anonymous","use-credentials"]}},input:{attrs:{alt:null,dirname:null,form:null,formaction:null,height:null,list:null,max:null,maxlength:null,min:null,name:null,pattern:null,placeholder:null,size:null,src:null,step:null,value:null,width:null,accept:["audio/*","video/*","image/*"],autocomplete:["on","off"],autofocus:["autofocus"],checked:["checked"],disabled:["disabled"],formenctype:x,formmethod:v,formnovalidate:["novalidate"],formtarget:b,multiple:["multiple"],readonly:["readonly"],required:["required"],type:["hidden","text","search","tel","url","email","password","datetime","date","month","week","time","datetime-local","number","range","color","checkbox","radio","file","submit","image","reset","button"]}},ins:{attrs:{cite:null,datetime:null}},kbd:C,keygen:{attrs:{challenge:null,form:null,name:null,autofocus:["autofocus"],disabled:["disabled"],keytype:["RSA"]}},label:{attrs:{for:null,form:null}},legend:C,li:{attrs:{value:null}},link:{attrs:{href:null,type:null,hreflang:null,media:null,sizes:["all","16x16","16x16 32x32","16x16 32x32 64x64"]}},map:{attrs:{name:null}},mark:C,menu:{attrs:{label:null,type:["list","context","toolbar"]}},meta:{attrs:{content:null,charset:y,name:["viewport","application-name","author","description","generator","keywords"],"http-equiv":["content-language","content-type","default-style","refresh"]}},meter:{attrs:{value:null,min:null,low:null,high:null,max:null,optimum:null}},nav:C,noscript:C,object:{attrs:{data:null,type:null,name:null,usemap:null,form:null,width:null,height:null,typemustmatch:["typemustmatch"]}},ol:{attrs:{reversed:["reversed"],start:null,type:["1","a","A","i","I"]},children:["li","script","template","ul","ol"]},optgroup:{attrs:{disabled:["disabled"],label:null}},option:{attrs:{disabled:["disabled"],label:null,selected:["selected"],value:null}},output:{attrs:{for:null,form:null,name:null}},p:C,param:{attrs:{name:null,value:null}},pre:C,progress:{attrs:{value:null,max:null}},q:{attrs:{cite:null}},rp:C,rt:C,ruby:C,samp:C,script:{attrs:{type:["text/javascript"],src:null,async:["async"],defer:["defer"],charset:y}},section:C,select:{attrs:{form:null,name:null,size:null,autofocus:["autofocus"],disabled:["disabled"],multiple:["multiple"]}},slot:{attrs:{name:null}},small:C,source:{attrs:{src:null,type:null,media:null}},span:C,strong:C,style:{attrs:{type:["text/css"],media:null,scoped:null}},sub:C,summary:C,sup:C,table:C,tbody:C,td:{attrs:{colspan:null,rowspan:null,headers:null}},template:C,textarea:{attrs:{dirname:null,form:null,maxlength:null,name:null,placeholder:null,rows:null,cols:null,autofocus:["autofocus"],disabled:["disabled"],readonly:["readonly"],required:["required"],wrap:["soft","hard"]}},tfoot:C,th:{attrs:{colspan:null,rowspan:null,headers:null,scope:["row","col","rowgroup","colgroup"]}},thead:C,time:{attrs:{datetime:null}},title:C,tr:C,track:{attrs:{src:null,label:null,default:null,kind:["subtitles","captions","descriptions","chapters","metadata"],srclang:null}},ul:{children:["li","script","template","ul","ol"]},var:C,video:{attrs:{src:null,poster:null,width:null,height:null,crossorigin:["anonymous","use-credentials"],preload:["auto","metadata","none"],autoplay:["autoplay"],mediagroup:["movie"],muted:["muted"],controls:["controls"]}},wbr:C};const k={accesskey:null,class:null,contenteditable:w,contextmenu:null,dir:["ltr","rtl","auto"],draggable:["true","false","auto"],dropzone:["copy","move","link","string:","file:"],hidden:["hidden"],id:null,inert:["inert"],itemid:null,itemprop:null,itemref:null,itemscope:["itemscope"],itemtype:null,lang:["ar","bn","de","en-GB","en-US","es","fr","hi","id","ja","pa","pt","ru","tr","zh"],spellcheck:w,autocorrect:w,autocapitalize:w,style:null,tabindex:null,title:null,translate:["yes","no"],rel:["stylesheet","alternate","author","bookmark","help","license","next","nofollow","noreferrer","prefetch","prev","search","tag"],role:"alert application article banner button cell checkbox complementary contentinfo dialog document feed figure form grid gridcell heading img list listbox listitem main navigation region row rowgroup search switch tab table tabpanel textbox timer".split(" "),"aria-activedescendant":null,"aria-atomic":w,"aria-autocomplete":["inline","list","both","none"],"aria-busy":w,"aria-checked":["true","false","mixed","undefined"],"aria-controls":null,"aria-describedby":null,"aria-disabled":w,"aria-dropeffect":null,"aria-expanded":["true","false","undefined"],"aria-flowto":null,"aria-grabbed":["true","false","undefined"],"aria-haspopup":w,"aria-hidden":w,"aria-invalid":["true","false","grammar","spelling"],"aria-label":null,"aria-labelledby":null,"aria-level":null,"aria-live":["off","polite","assertive"],"aria-multiline":w,"aria-multiselectable":w,"aria-owns":null,"aria-posinset":null,"aria-pressed":["true","false","mixed","undefined"],"aria-readonly":w,"aria-relevant":null,"aria-required":w,"aria-selected":["true","false","undefined"],"aria-setsize":null,"aria-sort":["ascending","descending","none","other"],"aria-valuemax":null,"aria-valuemin":null,"aria-valuenow":null,"aria-valuetext":null};const S="beforeunload copy cut dragstart dragover dragleave dragenter dragend drag paste focus blur change click load mousedown mouseenter mouseleave mouseup keydown keyup resize scroll unload".split(" ").map((e=>"on"+e));for(let e of S)k[e]=null;class Schema{constructor(e,t){this.tags=Object.assign(Object.assign({},T),e);this.globalAttrs=Object.assign(Object.assign({},k),t);this.allTags=Object.keys(this.tags);this.globalAttrNames=Object.keys(this.globalAttrs)}}Schema.default=new Schema;function elementName(e,t,l=e.length){if(!t)return"";let a=t.firstChild;let n=a&&a.getChild("TagName");return n?e.sliceString(n.from,Math.min(n.to,l)):""}function findParentElement(e,t=false){for(;e;e=e.parent)if(e.name=="Element"){if(!t)return e;t=false}return null}function allowedChildren(e,t,l){let a=l.tags[elementName(e,findParentElement(t))];return(a===null||a===void 0?void 0:a.children)||l.allTags}function openTags(e,t){let l=[];for(let a=findParentElement(t);a&&!a.type.isTop;a=findParentElement(a.parent)){let n=elementName(e,a);if(n&&a.lastChild.name=="CloseTag")break;n&&l.indexOf(n)<0&&(t.name=="EndTag"||t.from>=a.firstChild.to)&&l.push(n)}return l}const A=/^[:\-\.\w\u00b7-\uffff]*$/;function completeTag(e,t,l,a,n){let r=/\s*>/.test(e.sliceDoc(n,n+5))?"":">";let o=findParentElement(l,true);return{from:a,to:n,options:allowedChildren(e.doc,o,t).map((e=>({label:e,type:"type"}))).concat(openTags(e.doc,l).map(((e,t)=>({label:"/"+e,apply:"/"+e+r,type:"type",boost:99-t})))),validFor:/^\/?[:\-\.\w\u00b7-\uffff]*$/}}function completeCloseTag(e,t,l,a){let n=/\s*>/.test(e.sliceDoc(a,a+5))?"":">";return{from:l,to:a,options:openTags(e.doc,t).map(((e,t)=>({label:e,apply:e+n,type:"type",boost:99-t}))),validFor:A}}function completeStartTag(e,t,l,a){let n=[],r=0;for(let a of allowedChildren(e.doc,l,t))n.push({label:"<"+a,type:"type"});for(let t of openTags(e.doc,l))n.push({label:"</"+t+">",type:"type",boost:99-r++});return{from:a,to:a,options:n,validFor:/^<\/?[:\-\.\w\u00b7-\uffff]*$/}}function completeAttrName(e,t,l,a,n){let r=findParentElement(l),o=r?t.tags[elementName(e.doc,r)]:null;let s=o&&o.attrs?Object.keys(o.attrs):[];let i=o&&o.globalAttrs===false?s:s.length?s.concat(t.globalAttrNames):t.globalAttrNames;return{from:a,to:n,options:i.map((e=>({label:e,type:"property"}))),validFor:A}}function completeAttrValue(e,t,l,a,n){var r;let o=(r=l.parent)===null||r===void 0?void 0:r.getChild("AttributeName");let s,i=[];if(o){let r=e.sliceDoc(o.from,o.to);let u=t.globalAttrs[r];if(!u){let a=findParentElement(l),n=a?t.tags[elementName(e.doc,a)]:null;u=(n===null||n===void 0?void 0:n.attrs)&&n.attrs[r]}if(u){let t=e.sliceDoc(a,n).toLowerCase(),l='"',r='"';if(/^['"]/.test(t)){s=t[0]=='"'?/^[^"]*$/:/^[^']*$/;l="";r=e.sliceDoc(n,n+1)==t[0]?"":t[0];t=t.slice(1);a++}else s=/^[^\s<>='"]*$/;for(let e of u)i.push({label:e,apply:l+e+r,type:"constant"})}}return{from:a,to:n,options:i,validFor:s}}function htmlCompletionFor(e,t){let{state:l,pos:a}=t,n=m(l).resolveInner(a,-1),r=n.resolve(a);for(let e,t=a;r==n&&(e=n.childBefore(t));){let l=e.lastChild;if(!l||!l.type.isError||l.from<l.to)break;r=n=e;t=l.from}return n.name=="TagName"?n.parent&&/CloseTag$/.test(n.parent.name)?completeCloseTag(l,n,n.from,a):completeTag(l,e,n,n.from,a):n.name=="StartTag"?completeTag(l,e,n,a,a):n.name=="StartCloseTag"||n.name=="IncompleteCloseTag"?completeCloseTag(l,n,a,a):n.name=="OpenTag"||n.name=="SelfClosingTag"||n.name=="AttributeName"?completeAttrName(l,e,n,n.name=="AttributeName"?n.from:a,a):n.name=="Is"||n.name=="AttributeValue"||n.name=="UnquotedAttributeValue"?completeAttrValue(l,e,n,n.name=="Is"?a:n.from,a):!t.explicit||r.name!="Element"&&r.name!="Text"&&r.name!="Document"?null:completeStartTag(l,e,n,a)}function htmlCompletionSource(e){return htmlCompletionFor(Schema.default,e)}function htmlCompletionSourceWith(e){let{extraTags:t,extraGlobalAttributes:l}=e;let a=l||t?new Schema(t,l):Schema.default;return e=>htmlCompletionFor(a,e)}const N=n.parser.configure({top:"SingleExpression"});const E=[{tag:"script",attrs:e=>e.type=="text/typescript"||e.lang=="ts",parser:r.parser},{tag:"script",attrs:e=>e.type=="text/babel"||e.type=="text/jsx",parser:o.parser},{tag:"script",attrs:e=>e.type=="text/typescript-jsx",parser:s.parser},{tag:"script",attrs(e){return/^(importmap|speculationrules|application\/(.+\+)?json)$/i.test(e.type)},parser:N},{tag:"script",attrs(e){return!e.type||/^(?:text|application)\/(?:x-)?(?:java|ecma)script$|^module$|^$/i.test(e.type)},parser:n.parser},{tag:"style",attrs(e){return(!e.lang||e.lang=="css")&&(!e.type||/^(text\/)?(x-)?(stylesheet|css)$/i.test(e.type))},parser:l.parser}];const j=[{name:"style",parser:l.parser.configure({top:"Styles"})}].concat(S.map((e=>({name:e,parser:n.parser}))));const O=g.define({name:"html",parser:e.configure({props:[d.add({Element(e){let t=/^(\s*)(<\/)?/.exec(e.textAfter);return e.node.to<=e.pos+t[0].length?e.continue():e.lineIndent(e.node.from)+(t[2]?0:e.unit)},"OpenTag CloseTag SelfClosingTag"(e){return e.column(e.node.from)+e.unit},Document(e){if(e.pos+/\s*/.exec(e.textAfter)[0].length<e.node.to)return e.continue();let t,l=null;for(let t=e.node;;){let e=t.lastChild;if(!e||e.name!="Element"||e.to!=t.to)break;l=t=e}return!l||(t=l.lastChild)&&(t.name=="CloseTag"||t.name=="SelfClosingTag")?null:e.lineIndent(l.from)+e.unit}}),p.add({Element(e){let t=e.firstChild,l=e.lastChild;return t&&t.name=="OpenTag"?{from:t.to,to:l.name=="CloseTag"?l.from:e.to}:null}}),f.add({"OpenTag CloseTag":e=>e.getChild("TagName")})]}),languageData:{commentTokens:{block:{open:"\x3c!--",close:"--\x3e"}},indentOnInput:/^\s*<\/\w+\W$/,wordChars:"-._"}});const $=O.configure({wrap:t(E,j)});function html(e={}){let l,n="";e.matchClosingTags===false&&(n="noMatch");e.selfClosingTags===true&&(n=(n?n+" ":"")+"selfClosing");(e.nestedLanguages&&e.nestedLanguages.length||e.nestedAttributes&&e.nestedAttributes.length)&&(l=t((e.nestedLanguages||[]).concat(E),(e.nestedAttributes||[]).concat(j)));let r=l?O.configure({wrap:l,dialect:n}):n?$.configure({dialect:n}):$;return new h(r,[$.data.of({autocomplete:htmlCompletionSourceWith(e)}),e.autoCloseTags!==false?q:[],i().support,a().support])}const I=new Set("area base br col command embed frame hr img input keygen link meta param source track wbr menuitem".split(" "));const q=u.inputHandler.of(((e,t,l,a,n)=>{if(e.composing||e.state.readOnly||t!=l||a!=">"&&a!="/"||!$.isActiveAt(e.state,t,-1))return false;let r=n(),{state:o}=r;let s=o.changeByRange((e=>{var t,l,n;let r=o.doc.sliceString(e.from-1,e.to)==a;let s,{head:i}=e,u=m(o).resolveInner(i-1,-1);u.name!="TagName"&&u.name!="StartTag"||(u=u.parent);if(r&&a==">"&&u.name=="OpenTag"){if(((l=(t=u.parent)===null||t===void 0?void 0:t.lastChild)===null||l===void 0?void 0:l.name)!="CloseTag"&&(s=elementName(o.doc,u.parent,i))&&!I.has(s)){let t=i+(o.doc.sliceString(i,i+1)===">"?1:0);let l=`</${s}>`;return{range:e,changes:{from:i,to:t,insert:l}}}}else if(r&&a=="/"&&u.name=="IncompleteCloseTag"){let e=u.parent;if(u.from==i-2&&((n=e.lastChild)===null||n===void 0?void 0:n.name)!="CloseTag"&&(s=elementName(o.doc,e,i))&&!I.has(s)){let e=i+(o.doc.sliceString(i,i+1)===">"?1:0);let t=`${s}>`;return{range:c.cursor(i+t.length,-1),changes:{from:i,to:e,insert:t}}}}return{range:e}}));if(s.changes.empty)return false;e.dispatch([r,o.update(s,{userEvent:"input.complete",scrollIntoView:true})]);return true}));export{q as autoCloseTags,html,htmlCompletionSource,htmlCompletionSourceWith,$ as htmlLanguage,O as htmlPlain};
|
2
|
+
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{parser as e}from"@lezer/javascript";import{syntaxTree as t,continuedIndent as n,flatIndent as o,delimitedIndent as r,indentNodeProp as a,foldInside as i,foldNodeProp as l,LRLanguage as s,defineLanguageFacet as c,sublanguageProp as p,LanguageSupport as m}from"@codemirror/language";import{EditorSelection as f}from"@codemirror/state";import{EditorView as u}from"@codemirror/view";import{snippetCompletion as d,completeFromList as y,ifNotIn as g}from"@codemirror/autocomplete";import{NodeWeakMap as b,IterMode as h}from"@lezer/common";const S=[d("function ${name}(${params}) {\n\t${}\n}",{label:"function",detail:"definition",type:"keyword"}),d("for (let ${index} = 0; ${index} < ${bound}; ${index}++) {\n\t${}\n}",{label:"for",detail:"loop",type:"keyword"}),d("for (let ${name} of ${collection}) {\n\t${}\n}",{label:"for",detail:"of loop",type:"keyword"}),d("do {\n\t${}\n} while (${})",{label:"do",detail:"loop",type:"keyword"}),d("while (${}) {\n\t${}\n}",{label:"while",detail:"loop",type:"keyword"}),d("try {\n\t${}\n} catch (${error}) {\n\t${}\n}",{label:"try",detail:"/ catch block",type:"keyword"}),d("if (${}) {\n\t${}\n}",{label:"if",detail:"block",type:"keyword"}),d("if (${}) {\n\t${}\n} else {\n\t${}\n}",{label:"if",detail:"/ else block",type:"keyword"}),d("class ${name} {\n\tconstructor(${params}) {\n\t\t${}\n\t}\n}",{label:"class",detail:"definition",type:"keyword"}),d('import {${names}} from "${module}"\n${}',{label:"import",detail:"named",type:"keyword"}),d('import ${name} from "${module}"\n${}',{label:"import",detail:"default",type:"keyword"})];const $=S.concat([d("interface ${name} {\n\t${}\n}",{label:"interface",detail:"definition",type:"keyword"}),d("type ${name} = ${type}",{label:"type",detail:"definition",type:"keyword"}),d("enum ${name} {\n\t${}\n}",{label:"enum",detail:"definition",type:"keyword"})]);const w=new b;const v=new Set(["Script","Block","FunctionExpression","FunctionDeclaration","ArrowFunction","MethodDeclaration","ForStatement"]);function defID(e){return(t,n)=>{let o=t.node.getChild("VariableDefinition");o&&n(o,e);return true}}const x=["FunctionDeclaration"];const k={FunctionDeclaration:defID("function"),ClassDeclaration:defID("class"),ClassExpression:()=>true,EnumDeclaration:defID("constant"),TypeAliasDeclaration:defID("type"),NamespaceDeclaration:defID("namespace"),VariableDefinition(e,t){e.matchContext(x)||t(e,"variable")},TypeDefinition(e,t){t(e,"type")},__proto__:null};function getScope(e,t){let n=w.get(t);if(n)return n;let o=[],r=true;function def(t,n){let r=e.sliceString(t.from,t.to);o.push({label:r,type:n})}t.cursor(h.IncludeAnonymous).iterate((t=>{if(r)r=false;else if(t.name){let e=k[t.name];if(e&&e(t,def)||v.has(t.name))return false}else if(t.to-t.from>8192){for(let n of getScope(e,t.node))o.push(n);return false}}));w.set(t,o);return o}const C=/^[\w$\xa1-\uffff][\w$\d\xa1-\uffff]*$/;const D=["TemplateString","String","RegExp","LineComment","BlockComment","VariableDefinition","TypeDefinition","Label","PropertyDefinition","PropertyName","PrivatePropertyDefinition","PrivatePropertyName",".","?."];function localCompletionSource(e){let n=t(e.state).resolveInner(e.pos,-1);if(D.indexOf(n.name)>-1)return null;let o=n.name=="VariableName"||n.to-n.from<20&&C.test(e.state.sliceDoc(n.from,n.to));if(!o&&!e.explicit)return null;let r=[];for(let t=n;t;t=t.parent)v.has(t.name)&&(r=r.concat(getScope(e.state.doc,t)));return{options:r,from:o?n.from:e.pos,validFor:C}}function pathFor(e,t,n){var o;let r=[];for(;;){let a,i=t.firstChild;if((i===null||i===void 0?void 0:i.name)=="VariableName"){r.push(e(i));return{path:r.reverse(),name:n}}if((i===null||i===void 0?void 0:i.name)!="MemberExpression"||((o=a=i.lastChild)===null||o===void 0?void 0:o.name)!="PropertyName")return null;r.push(e(a));t=i}}function completionPath(e){let read=t=>e.state.doc.sliceString(t.from,t.to);let n=t(e.state).resolveInner(e.pos,-1);return n.name=="PropertyName"?pathFor(read,n.parent,read(n)):n.name!="."&&n.name!="?."||n.parent.name!="MemberExpression"?D.indexOf(n.name)>-1?null:n.name=="VariableName"||n.to-n.from<20&&C.test(read(n))?{path:[],name:read(n)}:n.name=="MemberExpression"?pathFor(read,n,""):e.explicit?{path:[],name:""}:null:pathFor(read,n.parent,"")}function enumeratePropertyCompletions(e,t){let n=[],o=new Set;for(let r=0;;r++){for(let a of(Object.getOwnPropertyNames||Object.keys)(e)){if(!/^[a-zA-Z_$\xaa-\uffdc][\w$\xaa-\uffdc]*$/.test(a)||o.has(a))continue;o.add(a);let i;try{i=e[a]}catch(e){continue}n.push({label:a,type:typeof i=="function"?/^[A-Z]/.test(a)?"class":t?"function":"method":t?"variable":"property",boost:-r})}let a=Object.getPrototypeOf(e);if(!a)return n;e=a}}function scopeCompletionSource(e){let t=new Map;return n=>{let o=completionPath(n);if(!o)return null;let r=e;for(let e of o.path){r=r[e];if(!r)return null}let a=t.get(r);a||t.set(r,a=enumeratePropertyCompletions(r,!o.path.length));return{from:n.pos-o.name.length,options:a,validFor:C}}}const T=s.define({name:"javascript",parser:e.configure({props:[a.add({IfStatement:n({except:/^\s*({|else\b)/}),TryStatement:n({except:/^\s*({|catch\b|finally\b)/}),LabeledStatement:o,SwitchBody:e=>{let t=e.textAfter,n=/^\s*\}/.test(t),o=/^\s*(case|default)\b/.test(t);return e.baseIndent+(n?0:o?1:2)*e.unit},Block:r({closing:"}"}),ArrowFunction:e=>e.baseIndent+e.unit,"TemplateString BlockComment":()=>null,"Statement Property":n({except:/^{/}),JSXElement(e){let t=/^\s*<\//.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},JSXEscape(e){let t=/\s*\}/.test(e.textAfter);return e.lineIndent(e.node.from)+(t?0:e.unit)},"JSXOpenTag JSXSelfClosingTag"(e){return e.column(e.node.from)+e.unit}}),l.add({"Block ClassBody SwitchBody EnumBody ObjectExpression ArrayExpression ObjectType":i,BlockComment(e){return{from:e.from+2,to:e.to-2}}})]}),languageData:{closeBrackets:{brackets:["(","[","{","'",'"',"`"]},commentTokens:{line:"//",block:{open:"/*",close:"*/"}},indentOnInput:/^\s*(?:case |default:|\{|\}|<\/)$/,wordChars:"$"}});const I={test:e=>/^JSX/.test(e.name),facet:c({commentTokens:{block:{open:"{/*",close:"*/}"}}})};const J=T.configure({dialect:"ts"},"typescript");const P=T.configure({dialect:"jsx",props:[p.add((e=>e.isTop?[I]:void 0))]});const X=T.configure({dialect:"jsx ts",props:[p.add((e=>e.isTop?[I]:void 0))]},"typescript");let kwCompletion=e=>({label:e,type:"keyword"});const O="break case const continue default delete export extends false finally in instanceof let new return static super switch this throw true typeof var yield".split(" ").map(kwCompletion);const A=O.concat(["declare","implements","private","protected","public"].map(kwCompletion));function javascript(e={}){let t=e.jsx?e.typescript?X:P:e.typescript?J:T;let n=e.typescript?$.concat(A):S.concat(O);return new m(t,[T.data.of({autocomplete:g(D,y(n))}),T.data.of({autocomplete:localCompletionSource}),e.jsx?F:[]])}function findOpenTag(e){for(;;){if(e.name=="JSXOpenTag"||e.name=="JSXSelfClosingTag"||e.name=="JSXFragmentTag")return e;if(e.name=="JSXEscape"||!e.parent)return null;e=e.parent}}function elementName(e,t,n=e.length){for(let o=t===null||t===void 0?void 0:t.firstChild;o;o=o.nextSibling)if(o.name=="JSXIdentifier"||o.name=="JSXBuiltin"||o.name=="JSXNamespacedName"||o.name=="JSXMemberExpression")return e.sliceString(o.from,Math.min(o.to,n));return""}const E=typeof navigator=="object"&&/Android\b/.test(navigator.userAgent);const F=u.inputHandler.of(((e,n,o,r,a)=>{if((E?e.composing:e.compositionStarted)||e.state.readOnly||n!=o||r!=">"&&r!="/"||!T.isActiveAt(e.state,n,-1))return false;let i=a(),{state:l}=i;let s=l.changeByRange((e=>{var n;let o,{head:a}=e,i=t(l).resolveInner(a-1,-1);i.name=="JSXStartTag"&&(i=i.parent);if(l.doc.sliceString(a-1,a)!=r||i.name=="JSXAttributeValue"&&i.to>a);else{if(r==">"&&i.name=="JSXFragmentTag")return{range:e,changes:{from:a,insert:"</>"}};if(r=="/"&&i.name=="JSXStartCloseTag"){let e=i.parent,t=e.parent;if(t&&e.from==a-2&&((o=elementName(l.doc,t.firstChild,a))||((n=t.firstChild)===null||n===void 0?void 0:n.name)=="JSXFragmentTag")){let e=`${o}>`;return{range:f.cursor(a+e.length,-1),changes:{from:a,insert:e}}}}else if(r==">"){let t=findOpenTag(i);if(t&&t.name=="JSXOpenTag"&&!/^\/?>|^<\//.test(l.doc.sliceString(a,a+2))&&(o=elementName(l.doc,t,a)))return{range:e,changes:{from:a,insert:`</${o}>`}}}}return{range:e}}));if(s.changes.empty)return false;e.dispatch([i,l.update(s,{userEvent:"input.complete",scrollIntoView:true})]);return true}));function esLint(e,t){if(!t){t={parserOptions:{ecmaVersion:2019,sourceType:"module"},env:{browser:true,node:true,es6:true,es2015:true,es2017:true,es2020:true},rules:{}};e.getRules().forEach(((e,n)=>{e.meta.docs.recommended&&(t.rules[n]=2)}))}return n=>{let{state:o}=n,r=[];for(let{from:n,to:a}of T.findRegions(o)){let i=o.doc.lineAt(n),l={line:i.number-1,col:n-i.from,pos:n};for(let i of e.verify(o.sliceDoc(n,a),t))r.push(translateDiagnostic(i,o.doc,l))}return r}}function mapPos(e,t,n,o){return n.line(e+o.line).from+t+(e==1?o.col-1:-1)}function translateDiagnostic(e,t,n){let o=mapPos(e.line,e.column,t,n);let r={from:o,to:e.endLine!=null&&e.endColumn!=1?mapPos(e.endLine,e.endColumn,t,n):o,message:e.message,source:e.ruleId?"eslint:"+e.ruleId:"eslint",severity:e.severity==1?"warning":"error"};if(e.fix){let{range:t,text:a}=e.fix,i=t[0]+n.pos-o,l=t[1]+n.pos-o;r.actions=[{name:"fix",apply(e,t){e.dispatch({changes:{from:t+i,to:t+l,insert:a},scrollIntoView:true})}}]}return r}export{F as autoCloseTags,completionPath,esLint,javascript,T as javascriptLanguage,P as jsxLanguage,localCompletionSource,scopeCompletionSource,S as snippets,X as tsxLanguage,J as typescriptLanguage,$ as typescriptSnippets};
|
2
|
+
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{parser as e}from"@lezer/json";import{LRLanguage as t,indentNodeProp as r,continuedIndent as n,foldNodeProp as o,foldInside as s,LanguageSupport as a}from"@codemirror/language";const jsonParseLinter=()=>e=>{try{JSON.parse(e.state.doc.toString())}catch(t){if(!(t instanceof SyntaxError))throw t;const r=getErrorPosition(t,e.state.doc);return[{from:r,message:t.message,severity:"error",to:r}]}return[]};function getErrorPosition(e,t){let r;return(r=e.message.match(/at position (\d+)/))?Math.min(+r[1],t.length):(r=e.message.match(/at line (\d+) column (\d+)/))?Math.min(t.line(+r[1]).from+ +r[2]-1,t.length):0}const c=t.define({name:"json",parser:e.configure({props:[r.add({Object:n({except:/^\s*\}/}),Array:n({except:/^\s*\]/})}),o.add({"Object Array":s})]}),languageData:{closeBrackets:{brackets:["[","{",'"']},indentOnInput:/^\s*[\}\]]$/}});function json(){return new a(c)}export{json,c as jsonLanguage,jsonParseLinter};
|
2
|
+
|
@@ -0,0 +1,2 @@
|
|
1
|
+
import{syntaxTree as O,delimitedIndent as $,indentNodeProp as e,foldNodeProp as a,LRLanguage as i,LanguageSupport as r}from"@codemirror/language";import{html as t}from"@codemirror/lang-html";import{tags as n,styleTags as o}from"@lezer/highlight";import{parseMixed as Q}from"@lezer/common";import{ExternalTokenizer as l,LRParser as c}from"@lezer/lr";import{EditorSelection as p}from"@codemirror/state";import{EditorView as s}from"@codemirror/view";const m=1,P=2,q=3,d=180,f=4,W=181,g=5,u=182;function wordChar(O){return O>=65&&O<=90||O>=97&&O<=122}const v=new l((O=>{let $=O.pos;for(;;){let{next:e}=O;if(e<0)break;if(e==123){let e=O.peek(1);if(e==123){if(O.pos>$)break;O.acceptToken(m,2);return}if(e==37){if(O.pos>$)break;let e=2,a=2;for(;;){let $=O.peek(e);if($==32||$==10)++e;else if($==35){++e;for(;;){let $=O.peek(e);if($<0||$==10)break;e++}}else{if($!=45||a!=2){let i=$==101&&O.peek(e+1)==110&&O.peek(e+2)==100;O.acceptToken(i?q:P,a);return}a=++e}}}}O.advance();if(e==10)break}O.pos>$&&O.acceptToken(d)}));function rawTokenizer(O,$,e){return new l((a=>{let i=a.pos;for(;;){let{next:$}=a;if($==123&&a.peek(1)==37){let $=2;for(;;$++){let O=a.peek($);if(O!=32&&O!=10)break}let r="";for(;;$++){let O=a.peek($);if(!wordChar(O))break;r+=String.fromCharCode(O)}if(r==O){if(a.pos>i)break;a.acceptToken(e,2);break}}else if($<0)break;a.advance();if($==10)break}a.pos>i&&a.acceptToken($)}))}const y=rawTokenizer("endcomment",u,g);const b=rawTokenizer("endraw",W,f);const T={__proto__:null,contains:32,or:36,and:36,true:50,false:50,empty:52,forloop:54,tablerowloop:56,continue:58,in:128,with:194,for:196,as:198,if:234,endif:238,unless:244,endunless:248,elsif:252,else:256,case:262,endcase:266,when:270,endfor:278,tablerow:284,endtablerow:288,break:292,cycle:298,echo:302,render:306,include:312,assign:316,capture:322,endcapture:326,increment:330,decrement:334};const k={__proto__:null,if:82,endif:86,elsif:90,else:94,unless:100,endunless:104,case:110,endcase:114,when:118,for:126,endfor:136,tablerow:142,endtablerow:146,break:150,continue:154,cycle:158,comment:164,endcomment:170,raw:176,endraw:182,echo:186,render:190,include:202,assign:206,capture:212,endcapture:216,increment:220,decrement:224,liquid:228};const _=c.deserialize({version:14,states:"GYQYOPOOOOOP'#F{'#F{OeOXO'#CdOsQWO'#CfO!bQ`O'#DQO#{OPO'#DTO$ZOPO'#D^O$iOPO'#DcO$wOPO'#DkO%VOPO'#DsO%eOSO'#EOO%jOQO'#EUO%oOPO'#EhOOOP'#G`'#G`OOOP'#G]'#G]OOOP'#Fz'#FzQYOPOOOOOP-E9y-E9y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 {{ {% {% {% {% InlineComment Template Text }} Interpolation VariableName MemberExpression . PropertyName BinaryExpression contains CompareOp LogicOp AssignmentExpression AssignOp ) ( RangeExpression .. BooleanLiteral empty forloop tablerowloop continue StringLiteral NumberLiteral Filter | FilterName : Tag TagName %} IfDirective Tag if EndTag endif Tag elsif Tag else UnlessDirective Tag unless EndTag endunless CaseDirective Tag case EndTag endcase Tag when , ForDirective Tag for in Parameter ParameterName EndTag endfor TableDirective Tag tablerow EndTag endtablerow Tag break Tag continue Tag cycle Comment Tag comment CommentText EndTag endcomment RawDirective Tag raw RawText EndTag endraw Tag echo Tag render RenderParameter with for as Tag include Tag assign CaptureDirective Tag capture EndTag endcapture Tag increment Tag decrement Tag liquid IfDirective Tag if EndTag endif UnlessDirective Tag unless EndTag endunless Tag elsif Tag else CaseDirective Tag case EndTag endcase Tag when ForDirective Tag EndTag endfor TableDirective Tag tablerow EndTag endtablerow Tag break Tag Tag cycle Tag echo Tag render RenderParameter Tag include Tag assign CaptureDirective Tag capture EndTag endcapture Tag increment Tag decrement",maxTerm:189,nodeProps:[["closedBy",1,"}}",-4,2,3,4,5,"%}",22,")"],["openedBy",9,"{{",21,"(",38,"{%"],["group",-12,11,12,15,19,23,25,26,27,28,29,30,31,"Expression"]],skippedNodes:[0,6],repeatNodeCount:11,tokenData:")l~RlXY!yYZ!y]^!ypq!yqr#[rs#gst$Xuv$pwx${xy%hyz%m{|%r|}'^}!O'c!O!P'o!Q![&{![!](P!^!_(U!_!`(^!`!a(U!c!}(f#R#S(f#T#o(f#p#q)[#q#r)a%W;'S(f;'S;:j)U<%lO(f~#OS%O~XY!yYZ!y]^!ypq!y~#_P!_!`#b~#gOa~~#jUOY#gZr#grs#|s;'S#g;'S;=`$R<%lO#g~$ROn~~$UP;=`<%l#g~$^SU~OY$XZ;'S$X;'S;=`$j<%lO$X~$mP;=`<%l$X~$sP#q#r$v~${Ov~~%OUOY${Zw${wx#|x;'S${;'S;=`%b<%lO${~%eP;=`<%l${~%mOf~~%rOe~P%uQ!O!P%{!Q![&{P&OP!Q![&RP&WRoP!Q![&R!g!h&a#X#Y&aP&dR{|&m}!O&m!Q![&sP&pP!Q![&sP&xPoP!Q![&sP'QSoP!O!P%{!Q![&{!g!h&a#X#Y&a~'cO!^~~'fRuv$p!O!P%{!Q![&{~'tQ]S!O!P'z!Q![&R~(POh~~(UOs~~(ZPa~!_!`#b~(cPd~!_!`#b_(oV^WuQ%RT!Q![(f!c!}(f#R#S(f#T#o(f%W;'S(f;'S;:j)U<%lO(f_)XP;=`<%l(f~)aOq~~)dP#q#r)g~)lOX~",tokenizers:[v,b,y,0,1,2,3],topRules:{Template:[0,7]},specialized:[{term:187,get:O=>T[O]||-1},{term:37,get:O=>k[O]||-1}],tokenPrec:0});function completions(O,$){return O.split(" ").map((O=>({label:O,type:$})))}const R=completions("abs append at_least at_most capitalize ceil compact concat date default divided_by downcase escape escape_once first floor join last lstrip map minus modulo newline_to_br plus prepend remove remove_first replace replace_first reverse round rstrip size slice sort sort_natural split strip strip_html strip_newlines sum times truncate truncatewords uniq upcase url_decode url_encode where","function");const Y=completions("cycle comment endcomment raw endraw echo increment decrement liquid if elsif else endif unless endunless case endcase for endfor tablerow endtablerow break continue assign capture endcapture render include","keyword");const w=completions("empty forloop tablerowloop in with as contains","keyword");const U=completions("first index index0 last length rindex","property");const G=completions("col col0 col_first col_last first index index0 last length rindex rindex0 row","property");function findContext($){var e;let{state:a,pos:i}=$;let r=O(a).resolveInner(i,-1).enterUnfinishedNodesBefore(i);let t=((e=r.childBefore(i))===null||e===void 0?void 0:e.name)||r.name;if(r.name=="FilterName")return{type:"filter",node:r};if($.explicit&&t=="|")return{type:"filter"};if(r.name=="TagName")return{type:"tag",node:r};if($.explicit&&t=="{%")return{type:"tag"};if(r.name=="PropertyName"&&r.parent.name=="MemberExpression")return{type:"property",node:r,target:r.parent};if(r.name=="."&&r.parent.name=="MemberExpression")return{type:"property",target:r.parent};if(r.name=="MemberExpression"&&t==".")return{type:"property",target:r};if(r.name=="VariableName")return{type:"expression",from:r.from};let n=$.matchBefore(/[\w\u00c0-\uffff]+$/);return n?{type:"expression",from:n.from}:$.explicit&&r.name!="CommentText"&&r.name!="StringLiteral"&&r.name!="NumberLiteral"&&r.name!="InlineComment"?{type:"expression"}:null}function resolveProperties(O,$,e,a){let i=[];for(;;){let e=$.getChild("Expression");if(!e)return[];if(e.name=="forloop")return i.length?[]:U;if(e.name=="tablerowloop")return i.length?[]:G;if(e.name=="VariableName"){i.unshift(O.sliceDoc(e.from,e.to));break}if(e.name!="MemberExpression")return[];{let a=e.getChild("PropertyName");a&&i.unshift(O.sliceDoc(a.from,a.to));$=e}}return a?a(i,O,e):[]}function liquidCompletionSource(O={}){let $=O.filters?O.filters.concat(R):R;let e=O.tags?O.tags.concat(Y):Y;let a=O.variables?O.variables.concat(w):w;let{properties:i}=O;return O=>{var r;let t=findContext(O);if(!t)return null;let n=(r=t.from)!==null&&r!==void 0?r:t.node?t.node.from:O.pos;let o;o=t.type=="filter"?$:t.type=="tag"?e:t.type=="expression"?a:resolveProperties(O.state,t.target,O,i);return o.length?{options:o,from:n,validFor:/^[\w\u00c0-\uffff]*$/}:null}}const X=s.inputHandler.of(((O,$,e,a)=>{if(a!="%"||$!=e||O.state.doc.sliceString($-1,e+1)!="{}")return false;O.dispatch(O.state.changeByRange((O=>({changes:{from:O.from,to:O.to,insert:"%%"},range:p.cursor(O.from+1)}))),{scrollIntoView:true,userEvent:"input.type"});return true}));function directiveIndent(O){return $=>{let e=O.test($.textAfter);return $.lineIndent($.node.from)+(e?0:$.unit)}}const S=i.define({name:"liquid",parser:_.configure({props:[o({"cycle comment endcomment raw endraw echo increment decrement liquid in with as":n.keyword,"empty forloop tablerowloop":n.atom,"if elsif else endif unless endunless case endcase for endfor tablerow endtablerow break continue":n.controlKeyword,"assign capture endcapture":n.definitionKeyword,contains:n.operatorKeyword,"render include":n.moduleKeyword,VariableName:n.variableName,TagName:n.tagName,FilterName:n.function(n.variableName),PropertyName:n.propertyName,CompareOp:n.compareOperator,AssignOp:n.definitionOperator,LogicOp:n.logicOperator,NumberLiteral:n.number,StringLiteral:n.string,BooleanLiteral:n.bool,InlineComment:n.lineComment,CommentText:n.blockComment,"{% %} {{ }}":n.brace,"( )":n.paren,".":n.derefOperator,", .. : |":n.punctuation}),e.add({Tag:$({closing:"%}"}),"UnlessDirective ForDirective TablerowDirective CaptureDirective":directiveIndent(/^\s*(\{%-?\s*)?end\w/),IfDirective:directiveIndent(/^\s*(\{%-?\s*)?(endif|else|elsif)\b/),CaseDirective:directiveIndent(/^\s*(\{%-?\s*)?(endcase|when)\b/)}),a.add({"UnlessDirective ForDirective TablerowDirective CaptureDirective IfDirective CaseDirective RawDirective Comment"(O){let $=O.firstChild,e=O.lastChild;return $&&$.name=="Tag"?{from:$.to,to:e.name=="EndTag"?e.from:O.to}:null}})]}),languageData:{commentTokens:{line:"#"},indentOnInput:/^\s*{%-?\s*(?:end|elsif|else|when|)$/}});const z=t();function makeLiquid(O){return S.configure({wrap:Q(($=>$.type.isTop?{parser:O.parser,overlay:O=>O.name=="Text"||O.name=="RawText"}:null))},"liquid")}const h=makeLiquid(z.language);function liquid(O={}){let $=O.base||z;let e=$.language==z.language?h:makeLiquid($.language);return new r(e,[$.support,e.data.of({autocomplete:liquidCompletionSource(O)}),$.language.data.of({closeBrackets:{brackets:["{"]}}),X])}export{X as closePercentBrace,liquid,liquidCompletionSource,h as liquidLanguage};
|
2
|
+
|