Update repo to use go:embed (#10996)

Replace bindata packages with stdlib go:embed.
Modernize some uiserver code with newer interfaces introduced in go 1.16 (mainly working with fs.File instead of http.File.
Remove steps that are no longer used from our build files.
Add Github Action to detect differences in agent/uiserver/dist and verify that the files are correct (by compiling UI assets and comparing contents).
This commit is contained in:
Chris S. Kim 2022-05-31 15:33:56 -04:00 committed by GitHub
parent f2c9574c1d
commit ea1e4aa52d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
53 changed files with 16062 additions and 1231 deletions

3
.changelog/10996.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:improvement
ui: removed external dependencies for serving UI assets in favor of Go's native embed capabilities
```

View File

@ -672,22 +672,6 @@ jobs:
- packages/consul-ui/dist - packages/consul-ui/dist
- run: *notify-slack-failure - run: *notify-slack-failure
# build static-assets file
build-static-assets:
docker:
- image: *GOLANG_IMAGE
steps:
- checkout
- attach_workspace:
at: ./pkg
- run: mv pkg/packages/consul-ui/dist pkg/web_ui # 'make static-assets' looks for the 'pkg/web_ui' path
- run: make static-assets
- persist_to_workspace:
root: .
paths:
- ./agent/uiserver/bindata_assetfs.go
- run: *notify-slack-failure
# commits static assets to git # commits static assets to git
publish-static-assets: publish-static-assets:
docker: docker:
@ -700,7 +684,12 @@ jobs:
- attach_workspace: - attach_workspace:
at: . at: .
- run: - run:
name: commit agent/uiserver/bindata_assetfs.go if there are UI changes name: move compiled ui files to agent/uiserver
command: |
rm -rf agent/uiserver/dist
mv ui/packages/consul-ui/dist agent/uiserver
- run:
name: commit agent/uiserver/dist/ if there are UI changes
command: | command: |
# check if there are any changes in ui/ # check if there are any changes in ui/
# if there are, we commit the ui static asset file # if there are, we commit the ui static asset file
@ -714,8 +703,8 @@ jobs:
git checkout -B ci/main-assetfs-build main git checkout -B ci/main-assetfs-build main
short_sha=$(git rev-parse --short HEAD) short_sha=$(git rev-parse --short HEAD)
git add agent/uiserver/bindata_assetfs.go git add agent/uiserver/dist/
git commit -m "auto-updated agent/uiserver/bindata_assetfs.go from commit ${short_sha}" git commit -m "auto-updated agent/uiserver/dist/ from commit ${short_sha}"
git push --force origin ci/main-assetfs-build git push --force origin ci/main-assetfs-build
else else
echo "no UI changes so no static assets to publish" echo "no UI changes so no static assets to publish"
@ -1102,20 +1091,12 @@ workflows:
- ember-build-prod: - ember-build-prod:
requires: requires:
- frontend-cache - frontend-cache
- build-static-assets: - publish-static-assets:
requires: requires:
- ember-build-prod - ember-build-prod
- publish-static-assets:
filters:
branches:
only:
- main
- /release\/\d+\.\d+\.x$/
requires:
- build-static-assets
- dev-build: - dev-build:
requires: requires:
- build-static-assets - ember-build-prod
- dev-upload-s3: - dev-upload-s3:
requires: requires:
- dev-build - dev-build

View File

@ -101,12 +101,8 @@ jobs:
echo "consul binary type is ${CONSUL_BINARY_TYPE}" echo "consul binary type is ${CONSUL_BINARY_TYPE}"
echo "consul copyright year is ${CONSUL_COPYRIGHT_YEAR}" echo "consul copyright year is ${CONSUL_COPYRIGHT_YEAR}"
cd ui && make && cd .. cd ui && make && cd ..
mkdir pkg rm -rf agent/uiserver/dist
mv ui/packages/consul-ui/dist pkg/web_ui mv ui/packages/consul-ui/dist agent/uiserver/
- name: Build static-assets
run: make static-assets
- name: Build - name: Build
env: env:
GOOS: ${{ matrix.goos }} GOOS: ${{ matrix.goos }}
@ -196,11 +192,8 @@ jobs:
echo "consul binary type is ${CONSUL_BINARY_TYPE}" echo "consul binary type is ${CONSUL_BINARY_TYPE}"
echo "consul copyright year is ${CONSUL_COPYRIGHT_YEAR}" echo "consul copyright year is ${CONSUL_COPYRIGHT_YEAR}"
cd ui && make && cd .. cd ui && make && cd ..
mkdir pkg rm -rf agent/uiserver/dist
mv ui/packages/consul-ui/dist pkg/web_ui mv ui/packages/consul-ui/dist agent/uiserver/
- name: Build static-assets
run: make static-assets
- name: Build - name: Build
env: env:

View File

@ -0,0 +1,37 @@
# This workflow detects if there is a diff in the `agent/uiserver/dist` directory
# which is used by Consul to serve its embedded UI.
# `agent/uiserver/dist` should not be manually updated.
name: Embedded Asset Checker
on:
pull_request:
types: [opened, synchronize, labeled, unlabeled, reopened]
# Runs on PRs to main and all release branches
branches:
- main
- release/*
jobs:
dist-check:
if: "! ( contains(github.event.pull_request.labels.*.name, 'pr/update-ui-assets') || github.event.pull_request.user.login == 'hc-github-team-consul-core' )"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 0 # by default the checkout action doesn't checkout all branches
- name: Check for agent/uiserver/dist dir change in diff
run: |
dist_files=$(git --no-pager diff --name-only HEAD "$(git merge-base HEAD "origin/${{ github.event.pull_request.base.ref }}")" -- agent/uiserver/dist)
if [[ -z "${dist_files}" ]]; then
exit 0
fi
echo "Found diffs in dir agent/uiserver/dist"
github_message="This PR has diffs in \`agent/uiserver/dist\`. If the changes are intentional, add the label \`pr/update-ui-assets\`. Otherwise, revert changes to \`agent/uiserver/dist\`."
curl -s -H "Authorization: token ${{ secrets.PR_COMMENT_TOKEN }}" \
-X POST \
-d "{ \"body\": \"${github_message}\"}" \
"https://api.github.com/repos/${GITHUB_REPOSITORY}/issues/${{ github.event.pull_request.number }}/comments"
exit 1

View File

@ -20,7 +20,6 @@ MAIN_GOPATH=$(shell go env GOPATH | cut -d: -f1)
export PATH := $(PWD)/bin:$(GOPATH)/bin:$(PATH) export PATH := $(PWD)/bin:$(GOPATH)/bin:$(PATH)
ASSETFS_PATH?=agent/uiserver/bindata_assetfs.go
# Get the git commit # Get the git commit
GIT_COMMIT?=$(shell git rev-parse --short HEAD) GIT_COMMIT?=$(shell git rev-parse --short HEAD)
GIT_COMMIT_YEAR?=$(shell git show -s --format=%cd --date=format:%Y HEAD) GIT_COMMIT_YEAR?=$(shell git show -s --format=%cd --date=format:%Y HEAD)
@ -275,15 +274,15 @@ lint: lint-tools
@echo "--> Running enumcover" @echo "--> Running enumcover"
@enumcover ./... @enumcover ./...
# If you've run "make ui" manually then this will get called for you. This is # Build the static web ui inside a Docker container. For local testing only; do not commit these assets.
# also run as part of the release build script when it verifies that there are no ui: ui-docker
# changes to the UI assets that aren't checked in.
static-assets: bindata-tools
@go-bindata-assetfs -pkg uiserver -prefix pkg -o $(ASSETFS_PATH) ./pkg/web_ui/...
@go fmt $(ASSETFS_PATH)
# Build the static web ui and build static assets inside a Docker container # Build the static web ui with yarn. This is the version to commit.
ui: ui-docker static-assets-docker .PHONY: ui-regen
ui-regen:
cd $(CURDIR)/ui && make && cd ..
rm -rf $(CURDIR)/agent/uiserver/dist
mv $(CURDIR)/ui/packages/consul-ui/dist $(CURDIR)/agent/uiserver/
tools: tools:
@$(SHELL) $(CURDIR)/build-support/scripts/devtools.sh @$(SHELL) $(CURDIR)/build-support/scripts/devtools.sh
@ -292,10 +291,6 @@ tools:
lint-tools: lint-tools:
@$(SHELL) $(CURDIR)/build-support/scripts/devtools.sh -lint @$(SHELL) $(CURDIR)/build-support/scripts/devtools.sh -lint
.PHONY: bindata-tools
bindata-tools:
@$(SHELL) $(CURDIR)/build-support/scripts/devtools.sh -bindata
.PHONY: proto-tools .PHONY: proto-tools
proto-tools: proto-tools:
@$(SHELL) $(CURDIR)/build-support/scripts/devtools.sh -protobuf @$(SHELL) $(CURDIR)/build-support/scripts/devtools.sh -protobuf
@ -321,9 +316,6 @@ ui-build-image:
@echo "Building UI build container" @echo "Building UI build container"
@docker build $(NOCACHE) $(QUIET) -t $(UI_BUILD_TAG) - < build-support/docker/Build-UI.dockerfile @docker build $(NOCACHE) $(QUIET) -t $(UI_BUILD_TAG) - < build-support/docker/Build-UI.dockerfile
static-assets-docker: go-build-image
@$(SHELL) $(CURDIR)/build-support/scripts/build-docker.sh static-assets
consul-docker: go-build-image consul-docker: go-build-image
@$(SHELL) $(CURDIR)/build-support/scripts/build-docker.sh consul @$(SHELL) $(CURDIR)/build-support/scripts/build-docker.sh consul
@ -401,6 +393,6 @@ envoy-regen:
@find "command/connect/envoy/testdata" -name '*.golden' -delete @find "command/connect/envoy/testdata" -name '*.golden' -delete
@go test -tags '$(GOTAGS)' ./command/connect/envoy -update @go test -tags '$(GOTAGS)' ./command/connect/envoy -update
.PHONY: all bin dev dist cov test test-internal cover lint ui static-assets tools .PHONY: all bin dev dist cov test test-internal cover lint ui tools
.PHONY: docker-images go-build-image ui-build-image static-assets-docker consul-docker ui-docker .PHONY: docker-images go-build-image ui-build-image consul-docker ui-docker
.PHONY: version test-envoy-integ .PHONY: version test-envoy-integ

7
agent/uiserver/README.md Normal file
View File

@ -0,0 +1,7 @@
# uiserver
The contents of `dist/` are generated by `make ui` in the root of this repo
which compiles `ui` assets and copies them here.
A CI job (`publish-static-assets`) will detect any diffs in `ui` files and
commit the compiled files. Avoid committing files manually to `dist/`.

File diff suppressed because one or more lines are too long

View File

@ -1,21 +1,19 @@
package uiserver package uiserver
import ( import (
"net/http" "io/fs"
"os"
) )
// bufIndexFS is an implementation of http.FS that intercepts requests for // bufIndexFS is an implementation of fs.FS that intercepts requests for
// the index.html file and returns a pre-rendered file from memory. // the index.html file and returns a pre-rendered file from memory.
type bufIndexFS struct { type bufIndexFS struct {
fs http.FileSystem fs fs.FS
indexRendered []byte bufIndex fs.File
indexInfo os.FileInfo
} }
func (fs *bufIndexFS) Open(name string) (http.File, error) { func (fs *bufIndexFS) Open(name string) (fs.File, error) {
if name == "/index.html" { if name == "index.html" {
return newBufferedFile(fs.indexRendered, fs.indexInfo), nil return fs.bufIndex, nil
} }
return fs.fs.Open(name) return fs.fs.Open(name)
} }

View File

@ -1,67 +1,33 @@
package uiserver package uiserver
import ( import (
"bytes" "io"
"errors" "io/fs"
"os"
"time"
) )
// bufferedFile implements http.File and allows us to modify a file from disk by // bufferedFile implements fs.File and allows us to modify a file from disk by
// writing out the new version into a buffer and then serving file reads from // writing out the new version into a buffer and then serving file reads from
// that. // that.
type bufferedFile struct { type bufferedFile struct {
buf *bytes.Reader buf io.Reader
info os.FileInfo info fs.FileInfo
} }
func newBufferedFile(buf []byte, info os.FileInfo) *bufferedFile { func (b *bufferedFile) Stat() (fs.FileInfo, error) {
return b.info, nil
}
func (b *bufferedFile) Read(bytes []byte) (int, error) {
return b.buf.Read(bytes)
}
func (b *bufferedFile) Close() error {
return nil
}
func newBufferedFile(buf io.Reader, info fs.FileInfo) *bufferedFile {
return &bufferedFile{ return &bufferedFile{
buf: bytes.NewReader(buf), buf: buf,
info: info, info: info,
} }
} }
func (t *bufferedFile) Read(p []byte) (n int, err error) {
return t.buf.Read(p)
}
func (t *bufferedFile) Seek(offset int64, whence int) (int64, error) {
return t.buf.Seek(offset, whence)
}
func (t *bufferedFile) Close() error {
return nil
}
func (t *bufferedFile) Readdir(count int) ([]os.FileInfo, error) {
return nil, errors.New("not a directory")
}
func (t *bufferedFile) Stat() (os.FileInfo, error) {
return t, nil
}
func (t *bufferedFile) Name() string {
return t.info.Name()
}
func (t *bufferedFile) Size() int64 {
return int64(t.buf.Len())
}
func (t *bufferedFile) Mode() os.FileMode {
return t.info.Mode()
}
func (t *bufferedFile) ModTime() time.Time {
return t.info.ModTime()
}
func (t *bufferedFile) IsDir() bool {
return false
}
func (t *bufferedFile) Sys() interface{} {
return nil
}

Binary file not shown.

View File

@ -0,0 +1,138 @@
var jsonlint=function(){var e={trace:function(){},yy:{},symbols_:{error:2,JSONString:3,STRING:4,JSONNumber:5,NUMBER:6,JSONNullLiteral:7,NULL:8,JSONBooleanLiteral:9,TRUE:10,FALSE:11,JSONText:12,JSONValue:13,EOF:14,JSONObject:15,JSONArray:16,"{":17,"}":18,JSONMemberList:19,JSONMember:20,":":21,",":22,"[":23,"]":24,JSONElementList:25,$accept:0,$end:1},terminals_:{2:"error",4:"STRING",6:"NUMBER",8:"NULL",10:"TRUE",11:"FALSE",14:"EOF",17:"{",18:"}",21:":",22:",",23:"[",24:"]"},productions_:[0,[3,1],[5,1],[7,1],[9,1],[9,1],[12,2],[13,1],[13,1],[13,1],[13,1],[13,1],[13,1],[15,2],[15,3],[20,3],[19,1],[19,3],[16,2],[16,3],[25,1],[25,3]],performAction:function(e,t,r,n,i,a){var s=a.length-1
switch(i){case 1:this.$=e.replace(/\\(\\|")/g,"$1").replace(/\\n/g,"\n").replace(/\\r/g,"\r").replace(/\\t/g,"\t").replace(/\\v/g,"\v").replace(/\\f/g,"\f").replace(/\\b/g,"\b")
break
case 2:this.$=Number(e)
break
case 3:this.$=null
break
case 4:this.$=!0
break
case 5:this.$=!1
break
case 6:return this.$=a[s-1]
case 13:this.$={}
break
case 14:this.$=a[s-1]
break
case 15:this.$=[a[s-2],a[s]]
break
case 16:this.$={},this.$[a[s][0]]=a[s][1]
break
case 17:this.$=a[s-2],a[s-2][a[s][0]]=a[s][1]
break
case 18:this.$=[]
break
case 19:this.$=a[s-1]
break
case 20:this.$=[a[s]]
break
case 21:this.$=a[s-2],a[s-2].push(a[s])}},table:[{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],12:1,13:2,15:7,16:8,17:[1,14],23:[1,15]},{1:[3]},{14:[1,16]},{14:[2,7],18:[2,7],22:[2,7],24:[2,7]},{14:[2,8],18:[2,8],22:[2,8],24:[2,8]},{14:[2,9],18:[2,9],22:[2,9],24:[2,9]},{14:[2,10],18:[2,10],22:[2,10],24:[2,10]},{14:[2,11],18:[2,11],22:[2,11],24:[2,11]},{14:[2,12],18:[2,12],22:[2,12],24:[2,12]},{14:[2,3],18:[2,3],22:[2,3],24:[2,3]},{14:[2,4],18:[2,4],22:[2,4],24:[2,4]},{14:[2,5],18:[2,5],22:[2,5],24:[2,5]},{14:[2,1],18:[2,1],21:[2,1],22:[2,1],24:[2,1]},{14:[2,2],18:[2,2],22:[2,2],24:[2,2]},{3:20,4:[1,12],18:[1,17],19:18,20:19},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:23,15:7,16:8,17:[1,14],23:[1,15],24:[1,21],25:22},{1:[2,6]},{14:[2,13],18:[2,13],22:[2,13],24:[2,13]},{18:[1,24],22:[1,25]},{18:[2,16],22:[2,16]},{21:[1,26]},{14:[2,18],18:[2,18],22:[2,18],24:[2,18]},{22:[1,28],24:[1,27]},{22:[2,20],24:[2,20]},{14:[2,14],18:[2,14],22:[2,14],24:[2,14]},{3:20,4:[1,12],20:29},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:30,15:7,16:8,17:[1,14],23:[1,15]},{14:[2,19],18:[2,19],22:[2,19],24:[2,19]},{3:5,4:[1,12],5:6,6:[1,13],7:3,8:[1,9],9:4,10:[1,10],11:[1,11],13:31,15:7,16:8,17:[1,14],23:[1,15]},{18:[2,17],22:[2,17]},{18:[2,15],22:[2,15]},{22:[2,21],24:[2,21]}],defaultActions:{16:[2,6]},parseError:function(e){throw new Error(e)},parse:function(e){var t=this,r=[0],n=[null],i=[],a=this.table,s="",o=0,l=0,c=0
this.lexer.setInput(e),this.lexer.yy=this.yy,this.yy.lexer=this.lexer,void 0===this.lexer.yylloc&&(this.lexer.yylloc={})
var u=this.lexer.yylloc
function f(){var e
return"number"!=typeof(e=t.lexer.lex()||1)&&(e=t.symbols_[e]||e),e}i.push(u),"function"==typeof this.yy.parseError&&(this.parseError=this.yy.parseError)
for(var h,p,d,y,m,v,g,b,x,k,w={};;){if(d=r[r.length-1],this.defaultActions[d]?y=this.defaultActions[d]:(null==h&&(h=f()),y=a[d]&&a[d][h]),void 0===y||!y.length||!y[0]){if(!c){for(v in x=[],a[d])this.terminals_[v]&&v>2&&x.push("'"+this.terminals_[v]+"'")
var _=""
_=this.lexer.showPosition?"Parse error on line "+(o+1)+":\n"+this.lexer.showPosition()+"\nExpecting "+x.join(", ")+", got '"+this.terminals_[h]+"'":"Parse error on line "+(o+1)+": Unexpected "+(1==h?"end of input":"'"+(this.terminals_[h]||h)+"'"),this.parseError(_,{text:this.lexer.match,token:this.terminals_[h]||h,line:this.lexer.yylineno,loc:u,expected:x})}if(3==c){if(1==h)throw new Error(_||"Parsing halted.")
l=this.lexer.yyleng,s=this.lexer.yytext,o=this.lexer.yylineno,u=this.lexer.yylloc,h=f()}for(;!(2..toString()in a[d]);){if(0==d)throw new Error(_||"Parsing halted.")
k=1,r.length=r.length-2*k,n.length=n.length-k,i.length=i.length-k,d=r[r.length-1]}p=h,h=2,y=a[d=r[r.length-1]]&&a[d][2],c=3}if(y[0]instanceof Array&&y.length>1)throw new Error("Parse Error: multiple actions possible at state: "+d+", token: "+h)
switch(y[0]){case 1:r.push(h),n.push(this.lexer.yytext),i.push(this.lexer.yylloc),r.push(y[1]),h=null,p?(h=p,p=null):(l=this.lexer.yyleng,s=this.lexer.yytext,o=this.lexer.yylineno,u=this.lexer.yylloc,c>0&&c--)
break
case 2:if(g=this.productions_[y[1]][1],w.$=n[n.length-g],w._$={first_line:i[i.length-(g||1)].first_line,last_line:i[i.length-1].last_line,first_column:i[i.length-(g||1)].first_column,last_column:i[i.length-1].last_column},void 0!==(m=this.performAction.call(w,s,l,o,this.yy,y[1],n,i)))return m
g&&(r=r.slice(0,-1*g*2),n=n.slice(0,-1*g),i=i.slice(0,-1*g)),r.push(this.productions_[y[1]][0]),n.push(w.$),i.push(w._$),b=a[r[r.length-2]][r[r.length-1]],r.push(b)
break
case 3:return!0}}return!0}},t=function(){var e={EOF:1,parseError:function(e,t){if(!this.yy.parseError)throw new Error(e)
this.yy.parseError(e,t)},setInput:function(e){return this._input=e,this._more=this._less=this.done=!1,this.yylineno=this.yyleng=0,this.yytext=this.matched=this.match="",this.conditionStack=["INITIAL"],this.yylloc={first_line:1,first_column:0,last_line:1,last_column:0},this},input:function(){var e=this._input[0]
return this.yytext+=e,this.yyleng++,this.match+=e,this.matched+=e,e.match(/\n/)&&this.yylineno++,this._input=this._input.slice(1),e},unput:function(e){return this._input=e+this._input,this},more:function(){return this._more=!0,this},less:function(e){this._input=this.match.slice(e)+this._input},pastInput:function(){var e=this.matched.substr(0,this.matched.length-this.match.length)
return(e.length>20?"...":"")+e.substr(-20).replace(/\n/g,"")},upcomingInput:function(){var e=this.match
return e.length<20&&(e+=this._input.substr(0,20-e.length)),(e.substr(0,20)+(e.length>20?"...":"")).replace(/\n/g,"")},showPosition:function(){var e=this.pastInput(),t=new Array(e.length+1).join("-")
return e+this.upcomingInput()+"\n"+t+"^"},next:function(){if(this.done)return this.EOF
var e,t,r,n,i
this._input||(this.done=!0),this._more||(this.yytext="",this.match="")
for(var a=this._currentRules(),s=0;s<a.length&&(!(r=this._input.match(this.rules[a[s]]))||t&&!(r[0].length>t[0].length)||(t=r,n=s,this.options.flex));s++);return t?((i=t[0].match(/\n.*/g))&&(this.yylineno+=i.length),this.yylloc={first_line:this.yylloc.last_line,last_line:this.yylineno+1,first_column:this.yylloc.last_column,last_column:i?i[i.length-1].length-1:this.yylloc.last_column+t[0].length},this.yytext+=t[0],this.match+=t[0],this.yyleng=this.yytext.length,this._more=!1,this._input=this._input.slice(t[0].length),this.matched+=t[0],e=this.performAction.call(this,this.yy,this,a[n],this.conditionStack[this.conditionStack.length-1]),this.done&&this._input&&(this.done=!1),e||void 0):""===this._input?this.EOF:void this.parseError("Lexical error on line "+(this.yylineno+1)+". Unrecognized text.\n"+this.showPosition(),{text:"",token:null,line:this.yylineno})},lex:function(){var e=this.next()
return void 0!==e?e:this.lex()},begin:function(e){this.conditionStack.push(e)},popState:function(){return this.conditionStack.pop()},_currentRules:function(){return this.conditions[this.conditionStack[this.conditionStack.length-1]].rules},topState:function(){return this.conditionStack[this.conditionStack.length-2]},pushState:function(e){this.begin(e)},options:{},performAction:function(e,t,r){switch(r){case 0:break
case 1:return 6
case 2:return t.yytext=t.yytext.substr(1,t.yyleng-2),4
case 3:return 17
case 4:return 18
case 5:return 23
case 6:return 24
case 7:return 22
case 8:return 21
case 9:return 10
case 10:return 11
case 11:return 8
case 12:return 14
case 13:return"INVALID"}},rules:[/^(?:\s+)/,/^(?:(-?([0-9]|[1-9][0-9]+))(\.[0-9]+)?([eE][-+]?[0-9]+)?\b)/,/^(?:"(?:\\[\\"bfnrt/]|\\u[a-fA-F0-9]{4}|[^\\\0-\x09\x0a-\x1f"])*")/,/^(?:\{)/,/^(?:\})/,/^(?:\[)/,/^(?:\])/,/^(?:,)/,/^(?::)/,/^(?:true\b)/,/^(?:false\b)/,/^(?:null\b)/,/^(?:$)/,/^(?:.)/],conditions:{INITIAL:{rules:[0,1,2,3,4,5,6,7,8,9,10,11,12,13],inclusive:!0}}}
return e}()
return e.lexer=t,e}()
"undefined"!=typeof require&&"undefined"!=typeof exports&&(exports.parser=jsonlint,exports.parse=function(){return jsonlint.parse.apply(jsonlint,arguments)},exports.main=function(e){if(!e[1])throw new Error("Usage: "+e[0]+" FILE")
if("undefined"!=typeof process)var t=require("fs").readFileSync(require("path").join(process.cwd(),e[1]),"utf8")
else t=require("file").path(require("file").cwd()).join(e[1]).read({charset:"utf-8"})
return exports.parser.parse(t)},"undefined"!=typeof module&&require.main===module&&exports.main("undefined"!=typeof process?process.argv.slice(1):require("system").args)),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}((function(e){"use strict"
function t(e,t,r){return/^(?:operator|sof|keyword c|case|new|[\[{}\(,;:]|=>)$/.test(t.lastType)||"quasi"==t.lastType&&/\{\s*$/.test(e.string.slice(0,e.pos-(r||0)))}e.defineMode("javascript",(function(r,n){var i,a,s=r.indentUnit,o=n.statementIndent,l=n.jsonld,c=n.json||l,u=n.typescript,f=n.wordCharacters||/[\w$\xa1-\uffff]/,h=function(){function e(e){return{type:e,style:"keyword"}}var t=e("keyword a"),r=e("keyword b"),n=e("keyword c"),i=e("operator"),a={type:"atom",style:"atom"},s={if:e("if"),while:t,with:t,else:r,do:r,try:r,finally:r,return:n,break:n,continue:n,new:e("new"),delete:n,throw:n,debugger:n,var:e("var"),const:e("var"),let:e("var"),function:e("function"),catch:e("catch"),for:e("for"),switch:e("switch"),case:e("case"),default:e("default"),in:i,typeof:i,instanceof:i,true:a,false:a,null:a,undefined:a,NaN:a,Infinity:a,this:e("this"),class:e("class"),super:e("atom"),yield:n,export:e("export"),import:e("import"),extends:n,await:n,async:e("async")}
if(u){var o={type:"variable",style:"variable-3"},l={interface:e("class"),implements:n,namespace:n,module:e("module"),enum:e("module"),public:e("modifier"),private:e("modifier"),protected:e("modifier"),abstract:e("modifier"),as:i,string:o,number:o,boolean:o,any:o}
for(var c in l)s[c]=l[c]}return s}(),p=/[+\-*&%=<>!?|~^]/,d=/^@(context|id|value|language|type|container|list|set|reverse|index|base|vocab|graph)"/
function y(e,t,r){return i=e,a=r,t}function m(e,r){var n,i=e.next()
if('"'==i||"'"==i)return r.tokenize=(n=i,function(e,t){var r,i=!1
if(l&&"@"==e.peek()&&e.match(d))return t.tokenize=m,y("jsonld-keyword","meta")
for(;null!=(r=e.next())&&(r!=n||i);)i=!i&&"\\"==r
return i||(t.tokenize=m),y("string","string")}),r.tokenize(e,r)
if("."==i&&e.match(/^\d+(?:[eE][+\-]?\d+)?/))return y("number","number")
if("."==i&&e.match(".."))return y("spread","meta")
if(/[\[\]{}\(\),;\:\.]/.test(i))return y(i)
if("="==i&&e.eat(">"))return y("=>","operator")
if("0"==i&&e.eat(/x/i))return e.eatWhile(/[\da-f]/i),y("number","number")
if("0"==i&&e.eat(/o/i))return e.eatWhile(/[0-7]/i),y("number","number")
if("0"==i&&e.eat(/b/i))return e.eatWhile(/[01]/i),y("number","number")
if(/\d/.test(i))return e.match(/^\d*(?:\.\d*)?(?:[eE][+\-]?\d+)?/),y("number","number")
if("/"==i)return e.eat("*")?(r.tokenize=v,v(e,r)):e.eat("/")?(e.skipToEnd(),y("comment","comment")):t(e,r,1)?(function(e){for(var t,r=!1,n=!1;null!=(t=e.next());){if(!r){if("/"==t&&!n)return
"["==t?n=!0:n&&"]"==t&&(n=!1)}r=!r&&"\\"==t}}(e),e.match(/^\b(([gimyu])(?![gimyu]*\2))+\b/),y("regexp","string-2")):(e.eatWhile(p),y("operator","operator",e.current()))
if("`"==i)return r.tokenize=g,g(e,r)
if("#"==i)return e.skipToEnd(),y("error","error")
if(p.test(i))return e.eatWhile(p),y("operator","operator",e.current())
if(f.test(i)){e.eatWhile(f)
var a=e.current(),s=h.propertyIsEnumerable(a)&&h[a]
return s&&"."!=r.lastType?y(s.type,s.style,a):y("variable","variable",a)}}function v(e,t){for(var r,n=!1;r=e.next();){if("/"==r&&n){t.tokenize=m
break}n="*"==r}return y("comment","comment")}function g(e,t){for(var r,n=!1;null!=(r=e.next());){if(!n&&("`"==r||"$"==r&&e.eat("{"))){t.tokenize=m
break}n=!n&&"\\"==r}return y("quasi","string-2",e.current())}function b(e,t){t.fatArrowAt&&(t.fatArrowAt=null)
var r=e.string.indexOf("=>",e.start)
if(!(r<0)){for(var n=0,i=!1,a=r-1;a>=0;--a){var s=e.string.charAt(a),o="([{}])".indexOf(s)
if(o>=0&&o<3){if(!n){++a
break}if(0==--n)break}else if(o>=3&&o<6)++n
else if(f.test(s))i=!0
else{if(/["'\/]/.test(s))return
if(i&&!n){++a
break}}}i&&!n&&(t.fatArrowAt=a)}}var x={atom:!0,number:!0,variable:!0,string:!0,regexp:!0,this:!0,"jsonld-keyword":!0}
function k(e,t,r,n,i,a){this.indented=e,this.column=t,this.type=r,this.prev=i,this.info=a,null!=n&&(this.align=n)}function w(e,t){for(var r=e.localVars;r;r=r.next)if(r.name==t)return!0
for(var n=e.context;n;n=n.prev)for(r=n.vars;r;r=r.next)if(r.name==t)return!0}var _={state:null,column:null,marked:null,cc:null}
function E(){for(var e=arguments.length-1;e>=0;e--)_.cc.push(arguments[e])}function j(){return E.apply(null,arguments),!0}function S(e){function t(t){for(var r=t;r;r=r.next)if(r.name==e)return!0
return!1}var r=_.state
if(_.marked="def",r.context){if(t(r.localVars))return
r.localVars={name:e,next:r.localVars}}else{if(t(r.globalVars))return
n.globalVars&&(r.globalVars={name:e,next:r.globalVars})}}var I={name:"this",next:{name:"arguments"}}
function $(){_.state.context={prev:_.state.context,vars:_.state.localVars},_.state.localVars=I}function A(){_.state.localVars=_.state.context.vars,_.state.context=_.state.context.prev}function M(e,t){var r=function(){var r=_.state,n=r.indented
if("stat"==r.lexical.type)n=r.lexical.indented
else for(var i=r.lexical;i&&")"==i.type&&i.align;i=i.prev)n=i.indented
r.lexical=new k(n,_.stream.column(),e,null,r.lexical,t)}
return r.lex=!0,r}function N(){var e=_.state
e.lexical.prev&&(")"==e.lexical.type&&(e.indented=e.lexical.indented),e.lexical=e.lexical.prev)}function O(e){return function t(r){return r==e?j():";"==e?E():j(t)}}function V(e,t){return"var"==e?j(M("vardef",t.length),ae,O(";"),N):"keyword a"==e?j(M("form"),T,V,N):"keyword b"==e?j(M("form"),V,N):"{"==e?j(M("}"),ee,N):";"==e?j():"if"==e?("else"==_.state.lexical.info&&_.state.cc[_.state.cc.length-1]==N&&_.state.cc.pop()(),j(M("form"),T,V,N,ue)):"function"==e?j(me):"for"==e?j(M("form"),fe,V,N):"variable"==e?j(M("stat"),D):"switch"==e?j(M("form"),T,M("}","switch"),O("{"),ee,N,N):"case"==e?j(T,O(":")):"default"==e?j(O(":")):"catch"==e?j(M("form"),$,O("("),ve,O(")"),V,N,A):"class"==e?j(M("form"),ge,N):"export"==e?j(M("stat"),we,N):"import"==e?j(M("stat"),_e,N):"module"==e?j(M("form"),se,M("}"),O("{"),ee,N,N):"async"==e?j(V):E(M("stat"),T,O(";"),N)}function T(e){return L(e,!1)}function z(e){return L(e,!0)}function L(e,t){if(_.state.fatArrowAt==_.stream.start){var r=t?W:C
if("("==e)return j($,M(")"),Y(se,")"),N,O("=>"),r,A)
if("variable"==e)return E($,se,O("=>"),r,A)}var n=t?F:J
return x.hasOwnProperty(e)?j(n):"function"==e?j(me,n):"keyword c"==e?j(t?P:q):"("==e?j(M(")"),q,Ae,O(")"),N,n):"operator"==e||"spread"==e?j(t?z:T):"["==e?j(M("]"),Ie,N,n):"{"==e?Z(K,"}",null,n):"quasi"==e?E(U,n):"new"==e?j(function(e){return function(t){return"."==t?j(e?G:B):E(e?z:T)}}(t)):j()}function q(e){return e.match(/[;\}\)\],]/)?E():E(T)}function P(e){return e.match(/[;\}\)\],]/)?E():E(z)}function J(e,t){return","==e?j(T):F(e,t,!1)}function F(e,t,r){var n=0==r?J:F,i=0==r?T:z
return"=>"==e?j($,r?W:C,A):"operator"==e?/\+\+|--/.test(t)?j(n):"?"==t?j(T,O(":"),i):j(i):"quasi"==e?E(U,n):";"!=e?"("==e?Z(z,")","call",n):"."==e?j(H,n):"["==e?j(M("]"),q,O("]"),N,n):void 0:void 0}function U(e,t){return"quasi"!=e?E():"${"!=t.slice(t.length-2)?j(U):j(T,R)}function R(e){if("}"==e)return _.marked="string-2",_.state.tokenize=g,j(U)}function C(e){return b(_.stream,_.state),E("{"==e?V:T)}function W(e){return b(_.stream,_.state),E("{"==e?V:z)}function B(e,t){if("target"==t)return _.marked="keyword",j(J)}function G(e,t){if("target"==t)return _.marked="keyword",j(F)}function D(e){return":"==e?j(N,V):E(J,O(";"),N)}function H(e){if("variable"==e)return _.marked="property",j()}function K(e,t){return"variable"==e||"keyword"==_.style?(_.marked="property",j("get"==t||"set"==t?Q:X)):"number"==e||"string"==e?(_.marked=l?"property":_.style+" property",j(X)):"jsonld-keyword"==e?j(X):"modifier"==e?j(K):"["==e?j(T,O("]"),X):"spread"==e?j(T):void 0}function Q(e){return"variable"!=e?E(X):(_.marked="property",j(me))}function X(e){return":"==e?j(z):"("==e?E(me):void 0}function Y(e,t){function r(n,i){if(","==n){var a=_.state.lexical
return"call"==a.info&&(a.pos=(a.pos||0)+1),j(e,r)}return n==t||i==t?j():j(O(t))}return function(n,i){return n==t||i==t?j():E(e,r)}}function Z(e,t,r){for(var n=3;n<arguments.length;n++)_.cc.push(arguments[n])
return j(M(t,r),Y(e,t),N)}function ee(e){return"}"==e?j():E(V,ee)}function te(e){if(u&&":"==e)return j(ne)}function re(e,t){if("="==t)return j(z)}function ne(e){if("variable"==e)return _.marked="variable-3",j(ie)}function ie(e,t){return"<"==t?j(Y(ne,">"),ie):"["==e?j(O("]"),ie):void 0}function ae(){return E(se,te,le,ce)}function se(e,t){return"modifier"==e?j(se):"variable"==e?(S(t),j()):"spread"==e?j(se):"["==e?Z(se,"]"):"{"==e?Z(oe,"}"):void 0}function oe(e,t){return"variable"!=e||_.stream.match(/^\s*:/,!1)?("variable"==e&&(_.marked="property"),"spread"==e?j(se):"}"==e?E():j(O(":"),se,le)):(S(t),j(le))}function le(e,t){if("="==t)return j(z)}function ce(e){if(","==e)return j(ae)}function ue(e,t){if("keyword b"==e&&"else"==t)return j(M("form","else"),V,N)}function fe(e){if("("==e)return j(M(")"),he,O(")"),N)}function he(e){return"var"==e?j(ae,O(";"),de):";"==e?j(de):"variable"==e?j(pe):E(T,O(";"),de)}function pe(e,t){return"in"==t||"of"==t?(_.marked="keyword",j(T)):j(J,de)}function de(e,t){return";"==e?j(ye):"in"==t||"of"==t?(_.marked="keyword",j(T)):E(T,O(";"),ye)}function ye(e){")"!=e&&j(T)}function me(e,t){return"*"==t?(_.marked="keyword",j(me)):"variable"==e?(S(t),j(me)):"("==e?j($,M(")"),Y(ve,")"),N,te,V,A):void 0}function ve(e){return"spread"==e?j(ve):E(se,te,re)}function ge(e,t){if("variable"==e)return S(t),j(be)}function be(e,t){return"extends"==t?j(T,be):"{"==e?j(M("}"),xe,N):void 0}function xe(e,t){return"variable"==e||"keyword"==_.style?"static"==t?(_.marked="keyword",j(xe)):(_.marked="property","get"==t||"set"==t?j(ke,me,xe):j(me,xe)):"*"==t?(_.marked="keyword",j(xe)):";"==e?j(xe):"}"==e?j():void 0}function ke(e){return"variable"!=e?E():(_.marked="property",j())}function we(e,t){return"*"==t?(_.marked="keyword",j(Se,O(";"))):"default"==t?(_.marked="keyword",j(T,O(";"))):E(V)}function _e(e){return"string"==e?j():E(Ee,Se)}function Ee(e,t){return"{"==e?Z(Ee,"}"):("variable"==e&&S(t),"*"==t&&(_.marked="keyword"),j(je))}function je(e,t){if("as"==t)return _.marked="keyword",j(Ee)}function Se(e,t){if("from"==t)return _.marked="keyword",j(T)}function Ie(e){return"]"==e?j():E(z,$e)}function $e(e){return"for"==e?E(Ae,O("]")):","==e?j(Y(P,"]")):E(Y(z,"]"))}function Ae(e){return"for"==e?j(fe,Ae):"if"==e?j(T,Ae):void 0}return N.lex=!0,{startState:function(e){var t={tokenize:m,lastType:"sof",cc:[],lexical:new k((e||0)-s,0,"block",!1),localVars:n.localVars,context:n.localVars&&{vars:n.localVars},indented:e||0}
return n.globalVars&&"object"==typeof n.globalVars&&(t.globalVars=n.globalVars),t},token:function(e,t){if(e.sol()&&(t.lexical.hasOwnProperty("align")||(t.lexical.align=!1),t.indented=e.indentation(),b(e,t)),t.tokenize!=v&&e.eatSpace())return null
var r=t.tokenize(e,t)
return"comment"==i?r:(t.lastType="operator"!=i||"++"!=a&&"--"!=a?i:"incdec",function(e,t,r,n,i){var a=e.cc
for(_.state=e,_.stream=i,_.marked=null,_.cc=a,_.style=t,e.lexical.hasOwnProperty("align")||(e.lexical.align=!0);;){if((a.length?a.pop():c?T:V)(r,n)){for(;a.length&&a[a.length-1].lex;)a.pop()()
return _.marked?_.marked:"variable"==r&&w(e,n)?"variable-2":t}}}(t,r,i,a,e))},indent:function(t,r){if(t.tokenize==v)return e.Pass
if(t.tokenize!=m)return 0
var i=r&&r.charAt(0),a=t.lexical
if(!/^\s*else\b/.test(r))for(var l=t.cc.length-1;l>=0;--l){var c=t.cc[l]
if(c==N)a=a.prev
else if(c!=ue)break}"stat"==a.type&&"}"==i&&(a=a.prev),o&&")"==a.type&&"stat"==a.prev.type&&(a=a.prev)
var u=a.type,f=i==u
return"vardef"==u?a.indented+("operator"==t.lastType||","==t.lastType?a.info+1:0):"form"==u&&"{"==i?a.indented:"form"==u?a.indented+s:"stat"==u?a.indented+(function(e,t){return"operator"==e.lastType||","==e.lastType||p.test(t.charAt(0))||/[,.]/.test(t.charAt(0))}(t,r)?o||s:0):"switch"!=a.info||f||0==n.doubleIndentSwitch?a.align?a.column+(f?0:1):a.indented+(f?0:s):a.indented+(/^(?:case|default)\b/.test(r)?s:2*s)},electricInput:/^\s*(?:case .*?:|default:|\{|\})$/,blockCommentStart:c?null:"/*",blockCommentEnd:c?null:"*/",lineComment:c?null:"//",fold:"brace",closeBrackets:"()[]{}''\"\"``",helperType:c?"json":"javascript",jsonldMode:l,jsonMode:c,expressionAllowed:t,skipExpression:function(e){var t=e.cc[e.cc.length-1]
t!=T&&t!=z||e.cc.pop()}}})),e.registerHelper("wordChars","javascript",/[\w$]/),e.defineMIME("text/javascript","javascript"),e.defineMIME("text/ecmascript","javascript"),e.defineMIME("application/javascript","javascript"),e.defineMIME("application/x-javascript","javascript"),e.defineMIME("application/ecmascript","javascript"),e.defineMIME("application/json",{name:"javascript",json:!0}),e.defineMIME("application/x-json",{name:"javascript",json:!0}),e.defineMIME("application/ld+json",{name:"javascript",jsonld:!0}),e.defineMIME("text/typescript",{name:"javascript",typescript:!0}),e.defineMIME("application/typescript",{name:"javascript",typescript:!0})}))

View File

@ -0,0 +1,38 @@
(function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)})((function(e){"use strict"
e.defineMode("ruby",(function(e){function t(e){for(var t={},n=0,r=e.length;n<r;++n)t[e[n]]=!0
return t}var n,r=t(["alias","and","BEGIN","begin","break","case","class","def","defined?","do","else","elsif","END","end","ensure","false","for","if","in","module","next","not","or","redo","rescue","retry","return","self","super","then","true","undef","unless","until","when","while","yield","nil","raise","throw","catch","fail","loop","callcc","caller","lambda","proc","public","protected","private","require","load","require_relative","extend","autoload","__END__","__FILE__","__LINE__","__dir__"]),i=t(["def","class","case","for","while","until","module","then","catch","loop","proc","begin"]),o=t(["end","until"]),a={"[":"]","{":"}","(":")"}
function u(e,t,n){return n.tokenize.push(e),e(t,n)}function f(e,t){if(e.sol()&&e.match("=begin")&&e.eol())return t.tokenize.push(s),"comment"
if(e.eatSpace())return null
var r,i,o=e.next()
if("`"==o||"'"==o||'"'==o)return u(c(o,"string",'"'==o||"`"==o),e,t)
if("/"==o){var f=e.current().length
if(e.skipTo("/")){var l=e.current().length
e.backUp(e.current().length-f)
for(var d=0;e.current().length<l;){var p=e.next()
if("("==p?d+=1:")"==p&&(d-=1),d<0)break}if(e.backUp(e.current().length-f),0==d)return u(c(o,"string-2",!0),e,t)}return"operator"}if("%"==o){var k="string",h=!0
e.eat("s")?k="atom":e.eat(/[WQ]/)?k="string":e.eat(/[r]/)?k="string-2":e.eat(/[wxq]/)&&(k="string",h=!1)
var m=e.eat(/[^\w\s=]/)
return m?(a.propertyIsEnumerable(m)&&(m=a[m]),u(c(m,k,h,!0),e,t)):"operator"}if("#"==o)return e.skipToEnd(),"comment"
if("<"==o&&(r=e.match(/^<-?[\`\"\']?([a-zA-Z_?]\w*)[\`\"\']?(?:;|$)/)))return u((i=r[1],function(e,t){return e.match(i)?t.tokenize.pop():e.skipToEnd(),"string"}),e,t)
if("0"==o)return e.eat("x")?e.eatWhile(/[\da-fA-F]/):e.eat("b")?e.eatWhile(/[01]/):e.eatWhile(/[0-7]/),"number"
if(/\d/.test(o))return e.match(/^[\d_]*(?:\.[\d_]+)?(?:[eE][+\-]?[\d_]+)?/),"number"
if("?"==o){for(;e.match(/^\\[CM]-/););return e.eat("\\")?e.eatWhile(/\w/):e.next(),"string"}if(":"==o)return e.eat("'")?u(c("'","atom",!1),e,t):e.eat('"')?u(c('"',"atom",!0),e,t):e.eat(/[\<\>]/)?(e.eat(/[\<\>]/),"atom"):e.eat(/[\+\-\*\/\&\|\:\!]/)?"atom":e.eat(/[a-zA-Z$@_\xa1-\uffff]/)?(e.eatWhile(/[\w$\xa1-\uffff]/),e.eat(/[\?\!\=]/),"atom"):"operator"
if("@"==o&&e.match(/^@?[a-zA-Z_\xa1-\uffff]/))return e.eat("@"),e.eatWhile(/[\w\xa1-\uffff]/),"variable-2"
if("$"==o)return e.eat(/[a-zA-Z_]/)?e.eatWhile(/[\w]/):e.eat(/\d/)?e.eat(/\d/):e.next(),"variable-3"
if(/[a-zA-Z_\xa1-\uffff]/.test(o))return e.eatWhile(/[\w\xa1-\uffff]/),e.eat(/[\?\!]/),e.eat(":")?"atom":"ident"
if("|"!=o||!t.varList&&"{"!=t.lastTok&&"do"!=t.lastTok){if(/[\(\)\[\]{}\\;]/.test(o))return n=o,null
if("-"==o&&e.eat(">"))return"arrow"
if(/[=+\-\/*:\.^%<>~|]/.test(o)){var x=e.eatWhile(/[=+\-\/*:\.^%<>~|]/)
return"."!=o||x||(n="."),"operator"}return null}return n="|",null}function l(e){return e||(e=1),function(t,n){if("}"==t.peek()){if(1==e)return n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)
n.tokenize[n.tokenize.length-1]=l(e-1)}else"{"==t.peek()&&(n.tokenize[n.tokenize.length-1]=l(e+1))
return f(t,n)}}function d(){var e=!1
return function(t,n){return e?(n.tokenize.pop(),n.tokenize[n.tokenize.length-1](t,n)):(e=!0,f(t,n))}}function c(e,t,n,r){return function(i,o){var a,u=!1
for("read-quoted-paused"===o.context.type&&(o.context=o.context.prev,i.eat("}"));null!=(a=i.next());){if(a==e&&(r||!u)){o.tokenize.pop()
break}if(n&&"#"==a&&!u){if(i.eat("{")){"}"==e&&(o.context={prev:o.context,type:"read-quoted-paused"}),o.tokenize.push(l())
break}if(/[@\$]/.test(i.peek())){o.tokenize.push(d())
break}}u=!u&&"\\"==a}return t}}function s(e,t){return e.sol()&&e.match("=end")&&e.eol()&&t.tokenize.pop(),e.skipToEnd(),"comment"}return{startState:function(){return{tokenize:[f],indented:0,context:{type:"top",indented:-e.indentUnit},continuedLine:!1,lastTok:null,varList:!1}},token:function(e,t){n=null,e.sol()&&(t.indented=e.indentation())
var a,u=t.tokenize[t.tokenize.length-1](e,t),f=n
if("ident"==u){var l=e.current()
"keyword"==(u="."==t.lastTok?"property":r.propertyIsEnumerable(e.current())?"keyword":/^[A-Z]/.test(l)?"tag":"def"==t.lastTok||"class"==t.lastTok||t.varList?"def":"variable")&&(f=l,i.propertyIsEnumerable(l)?a="indent":o.propertyIsEnumerable(l)?a="dedent":"if"!=l&&"unless"!=l||e.column()!=e.indentation()?"do"==l&&t.context.indented<t.indented&&(a="indent"):a="indent")}return(n||u&&"comment"!=u)&&(t.lastTok=f),"|"==n&&(t.varList=!t.varList),"indent"==a||/[\(\[\{]/.test(n)?t.context={prev:t.context,type:n||u,indented:t.indented}:("dedent"==a||/[\)\]\}]/.test(n))&&t.context.prev&&(t.context=t.context.prev),e.eol()&&(t.continuedLine="\\"==n||"operator"==u),u},indent:function(t,n){if(t.tokenize[t.tokenize.length-1]!=f)return 0
var r=n&&n.charAt(0),i=t.context,o=i.type==a[r]||"keyword"==i.type&&/^(?:end|until|else|elsif|when|rescue)\b/.test(n)
return i.indented+(o?0:e.indentUnit)+(t.continuedLine?e.indentUnit:0)},electricInput:/^\s*(?:end|rescue|\})$/,lineComment:"#"}})),e.defineMIME("text/x-ruby","ruby")}))

View File

@ -0,0 +1,37 @@
(function(t){"object"==typeof exports&&"object"==typeof module?t(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],t):t(CodeMirror)})((function(t){"use strict"
var e={autoSelfClosers:{area:!0,base:!0,br:!0,col:!0,command:!0,embed:!0,frame:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0,menuitem:!0},implicitlyClosed:{dd:!0,li:!0,optgroup:!0,option:!0,p:!0,rp:!0,rt:!0,tbody:!0,td:!0,tfoot:!0,th:!0,tr:!0},contextGrabbers:{dd:{dd:!0,dt:!0},dt:{dd:!0,dt:!0},li:{li:!0},option:{option:!0,optgroup:!0},optgroup:{optgroup:!0},p:{address:!0,article:!0,aside:!0,blockquote:!0,dir:!0,div:!0,dl:!0,fieldset:!0,footer:!0,form:!0,h1:!0,h2:!0,h3:!0,h4:!0,h5:!0,h6:!0,header:!0,hgroup:!0,hr:!0,menu:!0,nav:!0,ol:!0,p:!0,pre:!0,section:!0,table:!0,ul:!0},rp:{rp:!0,rt:!0},rt:{rp:!0,rt:!0},tbody:{tbody:!0,tfoot:!0},td:{td:!0,th:!0},tfoot:{tbody:!0},th:{td:!0,th:!0},thead:{tbody:!0,tfoot:!0},tr:{tr:!0}},doNotIndent:{pre:!0},allowUnquoted:!0,allowMissing:!0,caseFold:!0},n={autoSelfClosers:{},implicitlyClosed:{},contextGrabbers:{},doNotIndent:{},allowUnquoted:!1,allowMissing:!1,caseFold:!1}
t.defineMode("xml",(function(r,o){var a,i,l=r.indentUnit,u={},d=o.htmlMode?e:n
for(var c in d)u[c]=d[c]
for(var c in o)u[c]=o[c]
function s(t,e){function n(n){return e.tokenize=n,n(t,e)}var r=t.next()
return"<"==r?t.eat("!")?t.eat("[")?t.match("CDATA[")?n(m("atom","]]>")):null:t.match("--")?n(m("comment","--\x3e")):t.match("DOCTYPE",!0,!0)?(t.eatWhile(/[\w\._\-]/),n(function t(e){return function(n,r){for(var o;null!=(o=n.next());){if("<"==o)return r.tokenize=t(e+1),r.tokenize(n,r)
if(">"==o){if(1==e){r.tokenize=s
break}return r.tokenize=t(e-1),r.tokenize(n,r)}}return"meta"}}(1))):null:t.eat("?")?(t.eatWhile(/[\w\._\-]/),e.tokenize=m("meta","?>"),"meta"):(a=t.eat("/")?"closeTag":"openTag",e.tokenize=f,"tag bracket"):"&"==r?(t.eat("#")?t.eat("x")?t.eatWhile(/[a-fA-F\d]/)&&t.eat(";"):t.eatWhile(/[\d]/)&&t.eat(";"):t.eatWhile(/[\w\.\-:]/)&&t.eat(";"))?"atom":"error":(t.eatWhile(/[^&<]/),null)}function f(t,e){var n,r,o=t.next()
if(">"==o||"/"==o&&t.eat(">"))return e.tokenize=s,a=">"==o?"endTag":"selfcloseTag","tag bracket"
if("="==o)return a="equals",null
if("<"==o){e.tokenize=s,e.state=x,e.tagName=e.tagStart=null
var i=e.tokenize(t,e)
return i?i+" tag error":"tag error"}return/[\'\"]/.test(o)?(e.tokenize=(n=o,(r=function(t,e){for(;!t.eol();)if(t.next()==n){e.tokenize=f
break}return"string"}).isInAttribute=!0,r),e.stringStartCol=t.column(),e.tokenize(t,e)):(t.match(/^[^\s\u00a0=<>\"\']*[^\s\u00a0=<>\"\'\/]/),"word")}function m(t,e){return function(n,r){for(;!n.eol();){if(n.match(e)){r.tokenize=s
break}n.next()}return t}}function g(t,e,n){this.prev=t.context,this.tagName=e,this.indent=t.indented,this.startOfLine=n,(u.doNotIndent.hasOwnProperty(e)||t.context&&t.context.noIndent)&&(this.noIndent=!0)}function p(t){t.context&&(t.context=t.context.prev)}function h(t,e){for(var n;;){if(!t.context)return
if(n=t.context.tagName,!u.contextGrabbers.hasOwnProperty(n)||!u.contextGrabbers[n].hasOwnProperty(e))return
p(t)}}function x(t,e,n){return"openTag"==t?(n.tagStart=e.column(),b):"closeTag"==t?k:x}function b(t,e,n){return"word"==t?(n.tagName=e.current(),i="tag",y):(i="error",b)}function k(t,e,n){if("word"==t){var r=e.current()
return n.context&&n.context.tagName!=r&&u.implicitlyClosed.hasOwnProperty(n.context.tagName)&&p(n),n.context&&n.context.tagName==r||!1===u.matchClosing?(i="tag",w):(i="tag error",v)}return i="error",v}function w(t,e,n){return"endTag"!=t?(i="error",w):(p(n),x)}function v(t,e,n){return i="error",w(t,0,n)}function y(t,e,n){if("word"==t)return i="attribute",z
if("endTag"==t||"selfcloseTag"==t){var r=n.tagName,o=n.tagStart
return n.tagName=n.tagStart=null,"selfcloseTag"==t||u.autoSelfClosers.hasOwnProperty(r)?h(n,r):(h(n,r),n.context=new g(n,r,o==n.indented)),x}return i="error",y}function z(t,e,n){return"equals"==t?N:(u.allowMissing||(i="error"),y(t,0,n))}function N(t,e,n){return"string"==t?T:"word"==t&&u.allowUnquoted?(i="string",y):(i="error",y(t,0,n))}function T(t,e,n){return"string"==t?T:y(t,0,n)}return s.isInText=!0,{startState:function(t){var e={tokenize:s,state:x,indented:t||0,tagName:null,tagStart:null,context:null}
return null!=t&&(e.baseIndent=t),e},token:function(t,e){if(!e.tagName&&t.sol()&&(e.indented=t.indentation()),t.eatSpace())return null
a=null
var n=e.tokenize(t,e)
return(n||a)&&"comment"!=n&&(i=null,e.state=e.state(a||n,t,e),i&&(n="error"==i?n+" error":i)),n},indent:function(e,n,r){var o=e.context
if(e.tokenize.isInAttribute)return e.tagStart==e.indented?e.stringStartCol+1:e.indented+l
if(o&&o.noIndent)return t.Pass
if(e.tokenize!=f&&e.tokenize!=s)return r?r.match(/^(\s*)/)[0].length:0
if(e.tagName)return!1!==u.multilineTagIndentPastTag?e.tagStart+e.tagName.length+2:e.tagStart+l*(u.multilineTagIndentFactor||1)
if(u.alignCDATA&&/<!\[CDATA\[/.test(n))return 0
var a=n&&/^<(\/)?([\w_:\.-]*)/.exec(n)
if(a&&a[1])for(;o;){if(o.tagName==a[2]){o=o.prev
break}if(!u.implicitlyClosed.hasOwnProperty(o.tagName))break
o=o.prev}else if(a)for(;o;){var i=u.contextGrabbers[o.tagName]
if(!i||!i.hasOwnProperty(a[2]))break
o=o.prev}for(;o&&o.prev&&!o.startOfLine;)o=o.prev
return o?o.indent+l:e.baseIndent||0},electricInput:/<\/[\s\w:]+>$/,blockCommentStart:"\x3c!--",blockCommentEnd:"--\x3e",configuration:u.htmlMode?"html":"xml",helperType:u.htmlMode?"html":"xml",skipAttribute:function(t){t.state==N&&(t.state=y)}}})),t.defineMIME("text/xml","xml"),t.defineMIME("application/xml","xml"),t.mimeModes.hasOwnProperty("text/html")||t.defineMIME("text/html",{name:"xml",htmlMode:!0})}))

View File

@ -0,0 +1,276 @@
/*! js-yaml 4.0.0 https://github.com/nodeca/js-yaml @license MIT */
(function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports):"function"==typeof define&&define.amd?define(["exports"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).jsyaml={})})(this,(function(e){"use strict"
function t(e){return null==e}var n={isNothing:t,isObject:function(e){return"object"==typeof e&&null!==e},toArray:function(e){return Array.isArray(e)?e:t(e)?[]:[e]},repeat:function(e,t){var n,i=""
for(n=0;n<t;n+=1)i+=e
return i},isNegativeZero:function(e){return 0===e&&Number.NEGATIVE_INFINITY===1/e},extend:function(e,t){var n,i,r,o
if(t)for(n=0,i=(o=Object.keys(t)).length;n<i;n+=1)e[r=o[n]]=t[r]
return e}}
function i(e,t){var n="",i=e.reason||"(unknown reason)"
return e.mark?(e.mark.name&&(n+='in "'+e.mark.name+'" '),n+="("+(e.mark.line+1)+":"+(e.mark.column+1)+")",!t&&e.mark.snippet&&(n+="\n\n"+e.mark.snippet),i+" "+n):i}function r(e,t){Error.call(this),this.name="YAMLException",this.reason=e,this.mark=t,this.message=i(this,!1),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=(new Error).stack||""}r.prototype=Object.create(Error.prototype),r.prototype.constructor=r,r.prototype.toString=function(e){return this.name+": "+i(this,e)}
var o=r
function a(e,t,n,i,r){var o="",a="",l=Math.floor(r/2)-1
return i-t>l&&(t=i-l+(o=" ... ").length),n-i>l&&(n=i+l-(a=" ...").length),{str:o+e.slice(t,n).replace(/\t/g,"→")+a,pos:i-t+o.length}}function l(e,t){return n.repeat(" ",t-e.length)+e}var c=function(e,t){if(t=Object.create(t||null),!e.buffer)return null
t.maxLength||(t.maxLength=79),"number"!=typeof t.indent&&(t.indent=1),"number"!=typeof t.linesBefore&&(t.linesBefore=3),"number"!=typeof t.linesAfter&&(t.linesAfter=2)
for(var i,r=/\r?\n|\r|\0/g,o=[0],c=[],s=-1;i=r.exec(e.buffer);)c.push(i.index),o.push(i.index+i[0].length),e.position<=i.index&&s<0&&(s=o.length-2)
s<0&&(s=o.length-1)
var u,p,f="",d=Math.min(e.line+t.linesAfter,c.length).toString().length,h=t.maxLength-(t.indent+d+3)
for(u=1;u<=t.linesBefore&&!(s-u<0);u++)p=a(e.buffer,o[s-u],c[s-u],e.position-(o[s]-o[s-u]),h),f=n.repeat(" ",t.indent)+l((e.line-u+1).toString(),d)+" | "+p.str+"\n"+f
for(p=a(e.buffer,o[s],c[s],e.position,h),f+=n.repeat(" ",t.indent)+l((e.line+1).toString(),d)+" | "+p.str+"\n",f+=n.repeat("-",t.indent+d+3+p.pos)+"^\n",u=1;u<=t.linesAfter&&!(s+u>=c.length);u++)p=a(e.buffer,o[s+u],c[s+u],e.position-(o[s]-o[s+u]),h),f+=n.repeat(" ",t.indent)+l((e.line+u+1).toString(),d)+" | "+p.str+"\n"
return f.replace(/\n$/,"")},s=["kind","multi","resolve","construct","instanceOf","predicate","represent","representName","defaultStyle","styleAliases"],u=["scalar","sequence","mapping"]
var p=function(e,t){if(t=t||{},Object.keys(t).forEach((function(t){if(-1===s.indexOf(t))throw new o('Unknown option "'+t+'" is met in definition of "'+e+'" YAML type.')})),this.tag=e,this.kind=t.kind||null,this.resolve=t.resolve||function(){return!0},this.construct=t.construct||function(e){return e},this.instanceOf=t.instanceOf||null,this.predicate=t.predicate||null,this.represent=t.represent||null,this.representName=t.representName||null,this.defaultStyle=t.defaultStyle||null,this.multi=t.multi||!1,this.styleAliases=function(e){var t={}
return null!==e&&Object.keys(e).forEach((function(n){e[n].forEach((function(e){t[String(e)]=n}))})),t}(t.styleAliases||null),-1===u.indexOf(this.kind))throw new o('Unknown kind "'+this.kind+'" is specified for "'+e+'" YAML type.')}
function f(e,t,n){var i=[]
return e[t].forEach((function(e){n.forEach((function(t,n){t.tag===e.tag&&t.kind===e.kind&&t.multi===e.multi&&i.push(n)})),n.push(e)})),n.filter((function(e,t){return-1===i.indexOf(t)}))}function d(e){return this.extend(e)}d.prototype.extend=function(e){var t=[],n=[]
if(e instanceof p)n.push(e)
else if(Array.isArray(e))n=n.concat(e)
else{if(!e||!Array.isArray(e.implicit)&&!Array.isArray(e.explicit))throw new o("Schema.extend argument should be a Type, [ Type ], or a schema definition ({ implicit: [...], explicit: [...] })")
e.implicit&&(t=t.concat(e.implicit)),e.explicit&&(n=n.concat(e.explicit))}t.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.")
if(e.loadKind&&"scalar"!==e.loadKind)throw new o("There is a non-scalar type in the implicit list of a schema. Implicit resolving of such types is not supported.")
if(e.multi)throw new o("There is a multi type in the implicit list of a schema. Multi tags can only be listed as explicit.")})),n.forEach((function(e){if(!(e instanceof p))throw new o("Specified list of YAML types (or a single Type object) contains a non-Type object.")}))
var i=Object.create(d.prototype)
return i.implicit=(this.implicit||[]).concat(t),i.explicit=(this.explicit||[]).concat(n),i.compiledImplicit=f(i,"implicit",[]),i.compiledExplicit=f(i,"explicit",[]),i.compiledTypeMap=function(){var e,t,n={scalar:{},sequence:{},mapping:{},fallback:{},multi:{scalar:[],sequence:[],mapping:[],fallback:[]}}
function i(e){e.multi?(n.multi[e.kind].push(e),n.multi.fallback.push(e)):n[e.kind][e.tag]=n.fallback[e.tag]=e}for(e=0,t=arguments.length;e<t;e+=1)arguments[e].forEach(i)
return n}(i.compiledImplicit,i.compiledExplicit),i}
var h=d,m=new h({explicit:[new p("tag:yaml.org,2002:str",{kind:"scalar",construct:function(e){return null!==e?e:""}}),new p("tag:yaml.org,2002:seq",{kind:"sequence",construct:function(e){return null!==e?e:[]}}),new p("tag:yaml.org,2002:map",{kind:"mapping",construct:function(e){return null!==e?e:{}}})]})
var g=new p("tag:yaml.org,2002:null",{kind:"scalar",resolve:function(e){if(null===e)return!0
var t=e.length
return 1===t&&"~"===e||4===t&&("null"===e||"Null"===e||"NULL"===e)},construct:function(){return null},predicate:function(e){return null===e},represent:{canonical:function(){return"~"},lowercase:function(){return"null"},uppercase:function(){return"NULL"},camelcase:function(){return"Null"},empty:function(){return""}},defaultStyle:"lowercase"})
var y=new p("tag:yaml.org,2002:bool",{kind:"scalar",resolve:function(e){if(null===e)return!1
var t=e.length
return 4===t&&("true"===e||"True"===e||"TRUE"===e)||5===t&&("false"===e||"False"===e||"FALSE"===e)},construct:function(e){return"true"===e||"True"===e||"TRUE"===e},predicate:function(e){return"[object Boolean]"===Object.prototype.toString.call(e)},represent:{lowercase:function(e){return e?"true":"false"},uppercase:function(e){return e?"TRUE":"FALSE"},camelcase:function(e){return e?"True":"False"}},defaultStyle:"lowercase"})
function b(e){return 48<=e&&e<=55}function A(e){return 48<=e&&e<=57}var v=new p("tag:yaml.org,2002:int",{kind:"scalar",resolve:function(e){if(null===e)return!1
var t,n,i=e.length,r=0,o=!1
if(!i)return!1
if("-"!==(t=e[r])&&"+"!==t||(t=e[++r]),"0"===t){if(r+1===i)return!0
if("b"===(t=e[++r])){for(r++;r<i;r++)if("_"!==(t=e[r])){if("0"!==t&&"1"!==t)return!1
o=!0}return o&&"_"!==t}if("x"===t){for(r++;r<i;r++)if("_"!==(t=e[r])){if(!(48<=(n=e.charCodeAt(r))&&n<=57||65<=n&&n<=70||97<=n&&n<=102))return!1
o=!0}return o&&"_"!==t}if("o"===t){for(r++;r<i;r++)if("_"!==(t=e[r])){if(!b(e.charCodeAt(r)))return!1
o=!0}return o&&"_"!==t}}if("_"===t)return!1
for(;r<i;r++)if("_"!==(t=e[r])){if(!A(e.charCodeAt(r)))return!1
o=!0}return!(!o||"_"===t)},construct:function(e){var t,n=e,i=1
if(-1!==n.indexOf("_")&&(n=n.replace(/_/g,"")),"-"!==(t=n[0])&&"+"!==t||("-"===t&&(i=-1),t=(n=n.slice(1))[0]),"0"===n)return 0
if("0"===t){if("b"===n[1])return i*parseInt(n.slice(2),2)
if("x"===n[1])return i*parseInt(n.slice(2),16)
if("o"===n[1])return i*parseInt(n.slice(2),8)}return i*parseInt(n,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&e%1==0&&!n.isNegativeZero(e)},represent:{binary:function(e){return e>=0?"0b"+e.toString(2):"-0b"+e.toString(2).slice(1)},octal:function(e){return e>=0?"0o"+e.toString(8):"-0o"+e.toString(8).slice(1)},decimal:function(e){return e.toString(10)},hexadecimal:function(e){return e>=0?"0x"+e.toString(16).toUpperCase():"-0x"+e.toString(16).toUpperCase().slice(1)}},defaultStyle:"decimal",styleAliases:{binary:[2,"bin"],octal:[8,"oct"],decimal:[10,"dec"],hexadecimal:[16,"hex"]}}),k=new RegExp("^(?:[-+]?(?:[0-9][0-9_]*)(?:\\.[0-9_]*)?(?:[eE][-+]?[0-9]+)?|\\.[0-9_]+(?:[eE][-+]?[0-9]+)?|[-+]?\\.(?:inf|Inf|INF)|\\.(?:nan|NaN|NAN))$")
var w=/^[-+]?[0-9]+e/
var C=new p("tag:yaml.org,2002:float",{kind:"scalar",resolve:function(e){return null!==e&&!(!k.test(e)||"_"===e[e.length-1])},construct:function(e){var t,n
return n="-"===(t=e.replace(/_/g,"").toLowerCase())[0]?-1:1,"+-".indexOf(t[0])>=0&&(t=t.slice(1)),".inf"===t?1===n?Number.POSITIVE_INFINITY:Number.NEGATIVE_INFINITY:".nan"===t?NaN:n*parseFloat(t,10)},predicate:function(e){return"[object Number]"===Object.prototype.toString.call(e)&&(e%1!=0||n.isNegativeZero(e))},represent:function(e,t){var i
if(isNaN(e))switch(t){case"lowercase":return".nan"
case"uppercase":return".NAN"
case"camelcase":return".NaN"}else if(Number.POSITIVE_INFINITY===e)switch(t){case"lowercase":return".inf"
case"uppercase":return".INF"
case"camelcase":return".Inf"}else if(Number.NEGATIVE_INFINITY===e)switch(t){case"lowercase":return"-.inf"
case"uppercase":return"-.INF"
case"camelcase":return"-.Inf"}else if(n.isNegativeZero(e))return"-0.0"
return i=e.toString(10),w.test(i)?i.replace("e",".e"):i},defaultStyle:"lowercase"}),x=m.extend({implicit:[g,y,v,C]}),I=x,S=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9])-([0-9][0-9])$"),O=new RegExp("^([0-9][0-9][0-9][0-9])-([0-9][0-9]?)-([0-9][0-9]?)(?:[Tt]|[ \\t]+)([0-9][0-9]?):([0-9][0-9]):([0-9][0-9])(?:\\.([0-9]*))?(?:[ \\t]*(Z|([-+])([0-9][0-9]?)(?::([0-9][0-9]))?))?$")
var j=new p("tag:yaml.org,2002:timestamp",{kind:"scalar",resolve:function(e){return null!==e&&(null!==S.exec(e)||null!==O.exec(e))},construct:function(e){var t,n,i,r,o,a,l,c,s=0,u=null
if(null===(t=S.exec(e))&&(t=O.exec(e)),null===t)throw new Error("Date resolve error")
if(n=+t[1],i=+t[2]-1,r=+t[3],!t[4])return new Date(Date.UTC(n,i,r))
if(o=+t[4],a=+t[5],l=+t[6],t[7]){for(s=t[7].slice(0,3);s.length<3;)s+="0"
s=+s}return t[9]&&(u=6e4*(60*+t[10]+ +(t[11]||0)),"-"===t[9]&&(u=-u)),c=new Date(Date.UTC(n,i,r,o,a,l,s)),u&&c.setTime(c.getTime()-u),c},instanceOf:Date,represent:function(e){return e.toISOString()}})
var T=new p("tag:yaml.org,2002:merge",{kind:"scalar",resolve:function(e){return"<<"===e||null===e}}),E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=\n\r"
var M=new p("tag:yaml.org,2002:binary",{kind:"scalar",resolve:function(e){if(null===e)return!1
var t,n,i=0,r=e.length,o=E
for(n=0;n<r;n++)if(!((t=o.indexOf(e.charAt(n)))>64)){if(t<0)return!1
i+=6}return i%8==0},construct:function(e){var t,n,i=e.replace(/[\r\n=]/g,""),r=i.length,o=E,a=0,l=[]
for(t=0;t<r;t++)t%4==0&&t&&(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)),a=a<<6|o.indexOf(i.charAt(t))
return 0===(n=r%4*6)?(l.push(a>>16&255),l.push(a>>8&255),l.push(255&a)):18===n?(l.push(a>>10&255),l.push(a>>2&255)):12===n&&l.push(a>>4&255),new Uint8Array(l)},predicate:function(e){return"[object Uint8Array]"===Object.prototype.toString.call(e)},represent:function(e){var t,n,i="",r=0,o=e.length,a=E
for(t=0;t<o;t++)t%3==0&&t&&(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]),r=(r<<8)+e[t]
return 0===(n=o%3)?(i+=a[r>>18&63],i+=a[r>>12&63],i+=a[r>>6&63],i+=a[63&r]):2===n?(i+=a[r>>10&63],i+=a[r>>4&63],i+=a[r<<2&63],i+=a[64]):1===n&&(i+=a[r>>2&63],i+=a[r<<4&63],i+=a[64],i+=a[64]),i}}),L=Object.prototype.hasOwnProperty,N=Object.prototype.toString
var F=new p("tag:yaml.org,2002:omap",{kind:"sequence",resolve:function(e){if(null===e)return!0
var t,n,i,r,o,a=[],l=e
for(t=0,n=l.length;t<n;t+=1){if(i=l[t],o=!1,"[object Object]"!==N.call(i))return!1
for(r in i)if(L.call(i,r)){if(o)return!1
o=!0}if(!o)return!1
if(-1!==a.indexOf(r))return!1
a.push(r)}return!0},construct:function(e){return null!==e?e:[]}}),_=Object.prototype.toString
var D=new p("tag:yaml.org,2002:pairs",{kind:"sequence",resolve:function(e){if(null===e)return!0
var t,n,i,r,o,a=e
for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1){if(i=a[t],"[object Object]"!==_.call(i))return!1
if(1!==(r=Object.keys(i)).length)return!1
o[t]=[r[0],i[r[0]]]}return!0},construct:function(e){if(null===e)return[]
var t,n,i,r,o,a=e
for(o=new Array(a.length),t=0,n=a.length;t<n;t+=1)i=a[t],r=Object.keys(i),o[t]=[r[0],i[r[0]]]
return o}}),U=Object.prototype.hasOwnProperty
var q=new p("tag:yaml.org,2002:set",{kind:"mapping",resolve:function(e){if(null===e)return!0
var t,n=e
for(t in n)if(U.call(n,t)&&null!==n[t])return!1
return!0},construct:function(e){return null!==e?e:{}}}),Y=I.extend({implicit:[j,T],explicit:[M,F,D,q]}),P=Object.prototype.hasOwnProperty,R=/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F-\x84\x86-\x9F\uFFFE\uFFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF]/,$=/[\x85\u2028\u2029]/,B=/[,\[\]\{\}]/,K=/^(?:!|!!|![a-z\-]+!)$/i,W=/^(?:!|[^,\[\]\{\}])(?:%[0-9a-f]{2}|[0-9a-z\-#;\/\?:@&=\+\$,_\.!~\*'\(\)\[\]])*$/i
function H(e){return Object.prototype.toString.call(e)}function G(e){return 10===e||13===e}function V(e){return 9===e||32===e}function Z(e){return 9===e||32===e||10===e||13===e}function z(e){return 44===e||91===e||93===e||123===e||125===e}function J(e){var t
return 48<=e&&e<=57?e-48:97<=(t=32|e)&&t<=102?t-97+10:-1}function Q(e){return 48===e?"\0":97===e?"":98===e?"\b":116===e||9===e?"\t":110===e?"\n":118===e?"\v":102===e?"\f":114===e?"\r":101===e?"":32===e?" ":34===e?'"':47===e?"/":92===e?"\\":78===e?"…":95===e?" ":76===e?"\u2028":80===e?"\u2029":""}function X(e){return e<=65535?String.fromCharCode(e):String.fromCharCode(55296+(e-65536>>10),56320+(e-65536&1023))}for(var ee=new Array(256),te=new Array(256),ne=0;ne<256;ne++)ee[ne]=Q(ne)?1:0,te[ne]=Q(ne)
function ie(e,t){this.input=e,this.filename=t.filename||null,this.schema=t.schema||Y,this.onWarning=t.onWarning||null,this.legacy=t.legacy||!1,this.json=t.json||!1,this.listener=t.listener||null,this.implicitTypes=this.schema.compiledImplicit,this.typeMap=this.schema.compiledTypeMap,this.length=e.length,this.position=0,this.line=0,this.lineStart=0,this.lineIndent=0,this.firstTabInLine=-1,this.documents=[]}function re(e,t){var n={name:e.filename,buffer:e.input.slice(0,-1),position:e.position,line:e.line,column:e.position-e.lineStart}
return n.snippet=c(n),new o(t,n)}function oe(e,t){throw re(e,t)}function ae(e,t){e.onWarning&&e.onWarning.call(null,re(e,t))}var le={YAML:function(e,t,n){var i,r,o
null!==e.version&&oe(e,"duplication of %YAML directive"),1!==n.length&&oe(e,"YAML directive accepts exactly one argument"),null===(i=/^([0-9]+)\.([0-9]+)$/.exec(n[0]))&&oe(e,"ill-formed argument of the YAML directive"),r=parseInt(i[1],10),o=parseInt(i[2],10),1!==r&&oe(e,"unacceptable YAML version of the document"),e.version=n[0],e.checkLineBreaks=o<2,1!==o&&2!==o&&ae(e,"unsupported YAML version of the document")},TAG:function(e,t,n){var i,r
2!==n.length&&oe(e,"TAG directive accepts exactly two arguments"),i=n[0],r=n[1],K.test(i)||oe(e,"ill-formed tag handle (first argument) of the TAG directive"),P.call(e.tagMap,i)&&oe(e,'there is a previously declared suffix for "'+i+'" tag handle'),W.test(r)||oe(e,"ill-formed tag prefix (second argument) of the TAG directive")
try{r=decodeURIComponent(r)}catch(o){oe(e,"tag prefix is malformed: "+r)}e.tagMap[i]=r}}
function ce(e,t,n,i){var r,o,a,l
if(t<n){if(l=e.input.slice(t,n),i)for(r=0,o=l.length;r<o;r+=1)9===(a=l.charCodeAt(r))||32<=a&&a<=1114111||oe(e,"expected valid JSON character")
else R.test(l)&&oe(e,"the stream contains non-printable characters")
e.result+=l}}function se(e,t,i,r){var o,a,l,c
for(n.isObject(i)||oe(e,"cannot merge mappings; the provided source object is unacceptable"),l=0,c=(o=Object.keys(i)).length;l<c;l+=1)a=o[l],P.call(t,a)||(t[a]=i[a],r[a]=!0)}function ue(e,t,n,i,r,o,a,l,c){var s,u
if(Array.isArray(r))for(s=0,u=(r=Array.prototype.slice.call(r)).length;s<u;s+=1)Array.isArray(r[s])&&oe(e,"nested arrays are not supported inside keys"),"object"==typeof r&&"[object Object]"===H(r[s])&&(r[s]="[object Object]")
if("object"==typeof r&&"[object Object]"===H(r)&&(r="[object Object]"),r=String(r),null===t&&(t={}),"tag:yaml.org,2002:merge"===i)if(Array.isArray(o))for(s=0,u=o.length;s<u;s+=1)se(e,t,o[s],n)
else se(e,t,o,n)
else e.json||P.call(n,r)||!P.call(t,r)||(e.line=a||e.line,e.lineStart=l||e.lineStart,e.position=c||e.position,oe(e,"duplicated mapping key")),"__proto__"===r?Object.defineProperty(t,r,{configurable:!0,enumerable:!0,writable:!0,value:o}):t[r]=o,delete n[r]
return t}function pe(e){var t
10===(t=e.input.charCodeAt(e.position))?e.position++:13===t?(e.position++,10===e.input.charCodeAt(e.position)&&e.position++):oe(e,"a line break is expected"),e.line+=1,e.lineStart=e.position,e.firstTabInLine=-1}function fe(e,t,n){for(var i=0,r=e.input.charCodeAt(e.position);0!==r;){for(;V(r);)9===r&&-1===e.firstTabInLine&&(e.firstTabInLine=e.position),r=e.input.charCodeAt(++e.position)
if(t&&35===r)do{r=e.input.charCodeAt(++e.position)}while(10!==r&&13!==r&&0!==r)
if(!G(r))break
for(pe(e),r=e.input.charCodeAt(e.position),i++,e.lineIndent=0;32===r;)e.lineIndent++,r=e.input.charCodeAt(++e.position)}return-1!==n&&0!==i&&e.lineIndent<n&&ae(e,"deficient indentation"),i}function de(e){var t,n=e.position
return!(45!==(t=e.input.charCodeAt(n))&&46!==t||t!==e.input.charCodeAt(n+1)||t!==e.input.charCodeAt(n+2)||(n+=3,0!==(t=e.input.charCodeAt(n))&&!Z(t)))}function he(e,t){1===t?e.result+=" ":t>1&&(e.result+=n.repeat("\n",t-1))}function me(e,t){var n,i,r=e.tag,o=e.anchor,a=[],l=!1
if(-1!==e.firstTabInLine)return!1
for(null!==e.anchor&&(e.anchorMap[e.anchor]=a),i=e.input.charCodeAt(e.position);0!==i&&(-1!==e.firstTabInLine&&(e.position=e.firstTabInLine,oe(e,"tab characters must not be used in indentation")),45===i)&&Z(e.input.charCodeAt(e.position+1));)if(l=!0,e.position++,fe(e,!0,-1)&&e.lineIndent<=t)a.push(null),i=e.input.charCodeAt(e.position)
else if(n=e.line,be(e,t,3,!1,!0),a.push(e.result),fe(e,!0,-1),i=e.input.charCodeAt(e.position),(e.line===n||e.lineIndent>t)&&0!==i)oe(e,"bad indentation of a sequence entry")
else if(e.lineIndent<t)break
return!!l&&(e.tag=r,e.anchor=o,e.kind="sequence",e.result=a,!0)}function ge(e){var t,n,i,r,o=!1,a=!1
if(33!==(r=e.input.charCodeAt(e.position)))return!1
if(null!==e.tag&&oe(e,"duplication of a tag property"),60===(r=e.input.charCodeAt(++e.position))?(o=!0,r=e.input.charCodeAt(++e.position)):33===r?(a=!0,n="!!",r=e.input.charCodeAt(++e.position)):n="!",t=e.position,o){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&62!==r)
e.position<e.length?(i=e.input.slice(t,e.position),r=e.input.charCodeAt(++e.position)):oe(e,"unexpected end of the stream within a verbatim tag")}else{for(;0!==r&&!Z(r);)33===r&&(a?oe(e,"tag suffix cannot contain exclamation marks"):(n=e.input.slice(t-1,e.position+1),K.test(n)||oe(e,"named tag handle cannot contain such characters"),a=!0,t=e.position+1)),r=e.input.charCodeAt(++e.position)
i=e.input.slice(t,e.position),B.test(i)&&oe(e,"tag suffix cannot contain flow indicator characters")}i&&!W.test(i)&&oe(e,"tag name cannot contain such characters: "+i)
try{i=decodeURIComponent(i)}catch(l){oe(e,"tag name is malformed: "+i)}return o?e.tag=i:P.call(e.tagMap,n)?e.tag=e.tagMap[n]+i:"!"===n?e.tag="!"+i:"!!"===n?e.tag="tag:yaml.org,2002:"+i:oe(e,'undeclared tag handle "'+n+'"'),!0}function ye(e){var t,n
if(38!==(n=e.input.charCodeAt(e.position)))return!1
for(null!==e.anchor&&oe(e,"duplication of an anchor property"),n=e.input.charCodeAt(++e.position),t=e.position;0!==n&&!Z(n)&&!z(n);)n=e.input.charCodeAt(++e.position)
return e.position===t&&oe(e,"name of an anchor node must contain at least one character"),e.anchor=e.input.slice(t,e.position),!0}function be(e,t,i,r,o){var a,l,c,s,u,p,f,d,h,m=1,g=!1,y=!1
if(null!==e.listener&&e.listener("open",e),e.tag=null,e.anchor=null,e.kind=null,e.result=null,a=l=c=4===i||3===i,r&&fe(e,!0,-1)&&(g=!0,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)),1===m)for(;ge(e)||ye(e);)fe(e,!0,-1)?(g=!0,c=a,e.lineIndent>t?m=1:e.lineIndent===t?m=0:e.lineIndent<t&&(m=-1)):c=!1
if(c&&(c=g||o),1!==m&&4!==i||(d=1===i||2===i?t:t+1,h=e.position-e.lineStart,1===m?c&&(me(e,h)||function(e,t,n){var i,r,o,a,l,c,s,u=e.tag,p=e.anchor,f={},d=Object.create(null),h=null,m=null,g=null,y=!1,b=!1
if(-1!==e.firstTabInLine)return!1
for(null!==e.anchor&&(e.anchorMap[e.anchor]=f),s=e.input.charCodeAt(e.position);0!==s;){if(y||-1===e.firstTabInLine||(e.position=e.firstTabInLine,oe(e,"tab characters must not be used in indentation")),i=e.input.charCodeAt(e.position+1),o=e.line,63!==s&&58!==s||!Z(i)){if(a=e.line,l=e.lineStart,c=e.position,!be(e,n,2,!1,!0))break
if(e.line===o){for(s=e.input.charCodeAt(e.position);V(s);)s=e.input.charCodeAt(++e.position)
if(58===s)Z(s=e.input.charCodeAt(++e.position))||oe(e,"a whitespace character is expected after the key-value separator within a block mapping"),y&&(ue(e,f,d,h,m,null,a,l,c),h=m=g=null),b=!0,y=!1,r=!1,h=e.tag,m=e.result
else{if(!b)return e.tag=u,e.anchor=p,!0
oe(e,"can not read an implicit mapping pair; a colon is missed")}}else{if(!b)return e.tag=u,e.anchor=p,!0
oe(e,"can not read a block mapping entry; a multiline key may not be an implicit key")}}else 63===s?(y&&(ue(e,f,d,h,m,null,a,l,c),h=m=g=null),b=!0,y=!0,r=!0):y?(y=!1,r=!0):oe(e,"incomplete explicit mapping pair; a key node is missed; or followed by a non-tabulated empty line"),e.position+=1,s=i
if((e.line===o||e.lineIndent>t)&&(y&&(a=e.line,l=e.lineStart,c=e.position),be(e,t,4,!0,r)&&(y?m=e.result:g=e.result),y||(ue(e,f,d,h,m,g,a,l,c),h=m=g=null),fe(e,!0,-1),s=e.input.charCodeAt(e.position)),(e.line===o||e.lineIndent>t)&&0!==s)oe(e,"bad indentation of a mapping entry")
else if(e.lineIndent<t)break}return y&&ue(e,f,d,h,m,null,a,l,c),b&&(e.tag=u,e.anchor=p,e.kind="mapping",e.result=f),b}(e,h,d))||function(e,t){var n,i,r,o,a,l,c,s,u,p,f,d,h=!0,m=e.tag,g=e.anchor,y=Object.create(null)
if(91===(d=e.input.charCodeAt(e.position)))a=93,s=!1,o=[]
else{if(123!==d)return!1
a=125,s=!0,o={}}for(null!==e.anchor&&(e.anchorMap[e.anchor]=o),d=e.input.charCodeAt(++e.position);0!==d;){if(fe(e,!0,t),(d=e.input.charCodeAt(e.position))===a)return e.position++,e.tag=m,e.anchor=g,e.kind=s?"mapping":"sequence",e.result=o,!0
h?44===d&&oe(e,"expected the node content, but found ','"):oe(e,"missed comma between flow collection entries"),f=null,l=c=!1,63===d&&Z(e.input.charCodeAt(e.position+1))&&(l=c=!0,e.position++,fe(e,!0,t)),n=e.line,i=e.lineStart,r=e.position,be(e,t,1,!1,!0),p=e.tag,u=e.result,fe(e,!0,t),d=e.input.charCodeAt(e.position),!c&&e.line!==n||58!==d||(l=!0,d=e.input.charCodeAt(++e.position),fe(e,!0,t),be(e,t,1,!1,!0),f=e.result),s?ue(e,o,y,p,u,f,n,i,r):l?o.push(ue(e,null,y,p,u,f,n,i,r)):o.push(u),fe(e,!0,t),44===(d=e.input.charCodeAt(e.position))?(h=!0,d=e.input.charCodeAt(++e.position)):h=!1}oe(e,"unexpected end of the stream within a flow collection")}(e,d)?y=!0:(l&&function(e,t){var i,r,o,a,l,c=1,s=!1,u=!1,p=t,f=0,d=!1
if(124===(a=e.input.charCodeAt(e.position)))r=!1
else{if(62!==a)return!1
r=!0}for(e.kind="scalar",e.result="";0!==a;)if(43===(a=e.input.charCodeAt(++e.position))||45===a)1===c?c=43===a?3:2:oe(e,"repeat of a chomping mode identifier")
else{if(!((o=48<=(l=a)&&l<=57?l-48:-1)>=0))break
0===o?oe(e,"bad explicit indentation width of a block scalar; it cannot be less than one"):u?oe(e,"repeat of an indentation width identifier"):(p=t+o-1,u=!0)}if(V(a)){do{a=e.input.charCodeAt(++e.position)}while(V(a))
if(35===a)do{a=e.input.charCodeAt(++e.position)}while(!G(a)&&0!==a)}for(;0!==a;){for(pe(e),e.lineIndent=0,a=e.input.charCodeAt(e.position);(!u||e.lineIndent<p)&&32===a;)e.lineIndent++,a=e.input.charCodeAt(++e.position)
if(!u&&e.lineIndent>p&&(p=e.lineIndent),G(a))f++
else{if(e.lineIndent<p){3===c?e.result+=n.repeat("\n",s?1+f:f):1===c&&s&&(e.result+="\n")
break}for(r?V(a)?(d=!0,e.result+=n.repeat("\n",s?1+f:f)):d?(d=!1,e.result+=n.repeat("\n",f+1)):0===f?s&&(e.result+=" "):e.result+=n.repeat("\n",f):e.result+=n.repeat("\n",s?1+f:f),s=!0,u=!0,f=0,i=e.position;!G(a)&&0!==a;)a=e.input.charCodeAt(++e.position)
ce(e,i,e.position,!1)}}return!0}(e,d)||function(e,t){var n,i,r
if(39!==(n=e.input.charCodeAt(e.position)))return!1
for(e.kind="scalar",e.result="",e.position++,i=r=e.position;0!==(n=e.input.charCodeAt(e.position));)if(39===n){if(ce(e,i,e.position,!0),39!==(n=e.input.charCodeAt(++e.position)))return!0
i=e.position,e.position++,r=e.position}else G(n)?(ce(e,i,r,!0),he(e,fe(e,!1,t)),i=r=e.position):e.position===e.lineStart&&de(e)?oe(e,"unexpected end of the document within a single quoted scalar"):(e.position++,r=e.position)
oe(e,"unexpected end of the stream within a single quoted scalar")}(e,d)||function(e,t){var n,i,r,o,a,l,c
if(34!==(l=e.input.charCodeAt(e.position)))return!1
for(e.kind="scalar",e.result="",e.position++,n=i=e.position;0!==(l=e.input.charCodeAt(e.position));){if(34===l)return ce(e,n,e.position,!0),e.position++,!0
if(92===l){if(ce(e,n,e.position,!0),G(l=e.input.charCodeAt(++e.position)))fe(e,!1,t)
else if(l<256&&ee[l])e.result+=te[l],e.position++
else if((a=120===(c=l)?2:117===c?4:85===c?8:0)>0){for(r=a,o=0;r>0;r--)(a=J(l=e.input.charCodeAt(++e.position)))>=0?o=(o<<4)+a:oe(e,"expected hexadecimal character")
e.result+=X(o),e.position++}else oe(e,"unknown escape sequence")
n=i=e.position}else G(l)?(ce(e,n,i,!0),he(e,fe(e,!1,t)),n=i=e.position):e.position===e.lineStart&&de(e)?oe(e,"unexpected end of the document within a double quoted scalar"):(e.position++,i=e.position)}oe(e,"unexpected end of the stream within a double quoted scalar")}(e,d)?y=!0:!function(e){var t,n,i
if(42!==(i=e.input.charCodeAt(e.position)))return!1
for(i=e.input.charCodeAt(++e.position),t=e.position;0!==i&&!Z(i)&&!z(i);)i=e.input.charCodeAt(++e.position)
return e.position===t&&oe(e,"name of an alias node must contain at least one character"),n=e.input.slice(t,e.position),P.call(e.anchorMap,n)||oe(e,'unidentified alias "'+n+'"'),e.result=e.anchorMap[n],fe(e,!0,-1),!0}(e)?function(e,t,n){var i,r,o,a,l,c,s,u,p=e.kind,f=e.result
if(Z(u=e.input.charCodeAt(e.position))||z(u)||35===u||38===u||42===u||33===u||124===u||62===u||39===u||34===u||37===u||64===u||96===u)return!1
if((63===u||45===u)&&(Z(i=e.input.charCodeAt(e.position+1))||n&&z(i)))return!1
for(e.kind="scalar",e.result="",r=o=e.position,a=!1;0!==u;){if(58===u){if(Z(i=e.input.charCodeAt(e.position+1))||n&&z(i))break}else if(35===u){if(Z(e.input.charCodeAt(e.position-1)))break}else{if(e.position===e.lineStart&&de(e)||n&&z(u))break
if(G(u)){if(l=e.line,c=e.lineStart,s=e.lineIndent,fe(e,!1,-1),e.lineIndent>=t){a=!0,u=e.input.charCodeAt(e.position)
continue}e.position=o,e.line=l,e.lineStart=c,e.lineIndent=s
break}}a&&(ce(e,r,o,!1),he(e,e.line-l),r=o=e.position,a=!1),V(u)||(o=e.position+1),u=e.input.charCodeAt(++e.position)}return ce(e,r,o,!1),!!e.result||(e.kind=p,e.result=f,!1)}(e,d,1===i)&&(y=!0,null===e.tag&&(e.tag="?")):(y=!0,null===e.tag&&null===e.anchor||oe(e,"alias node should not have any properties")),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):0===m&&(y=c&&me(e,h))),null===e.tag)null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)
else if("?"===e.tag){for(null!==e.result&&"scalar"!==e.kind&&oe(e,'unacceptable node kind for !<?> tag; it should be "scalar", not "'+e.kind+'"'),s=0,u=e.implicitTypes.length;s<u;s+=1)if((f=e.implicitTypes[s]).resolve(e.result)){e.result=f.construct(e.result),e.tag=f.tag,null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)
break}}else if("!"!==e.tag){if(P.call(e.typeMap[e.kind||"fallback"],e.tag))f=e.typeMap[e.kind||"fallback"][e.tag]
else for(f=null,s=0,u=(p=e.typeMap.multi[e.kind||"fallback"]).length;s<u;s+=1)if(e.tag.slice(0,p[s].tag.length)===p[s].tag){f=p[s]
break}f||oe(e,"unknown tag !<"+e.tag+">"),null!==e.result&&f.kind!==e.kind&&oe(e,"unacceptable node kind for !<"+e.tag+'> tag; it should be "'+f.kind+'", not "'+e.kind+'"'),f.resolve(e.result,e.tag)?(e.result=f.construct(e.result,e.tag),null!==e.anchor&&(e.anchorMap[e.anchor]=e.result)):oe(e,"cannot resolve a node with !<"+e.tag+"> explicit tag")}return null!==e.listener&&e.listener("close",e),null!==e.tag||null!==e.anchor||y}function Ae(e){var t,n,i,r,o=e.position,a=!1
for(e.version=null,e.checkLineBreaks=e.legacy,e.tagMap=Object.create(null),e.anchorMap=Object.create(null);0!==(r=e.input.charCodeAt(e.position))&&(fe(e,!0,-1),r=e.input.charCodeAt(e.position),!(e.lineIndent>0||37!==r));){for(a=!0,r=e.input.charCodeAt(++e.position),t=e.position;0!==r&&!Z(r);)r=e.input.charCodeAt(++e.position)
for(i=[],(n=e.input.slice(t,e.position)).length<1&&oe(e,"directive name must not be less than one character in length");0!==r;){for(;V(r);)r=e.input.charCodeAt(++e.position)
if(35===r){do{r=e.input.charCodeAt(++e.position)}while(0!==r&&!G(r))
break}if(G(r))break
for(t=e.position;0!==r&&!Z(r);)r=e.input.charCodeAt(++e.position)
i.push(e.input.slice(t,e.position))}0!==r&&pe(e),P.call(le,n)?le[n](e,n,i):ae(e,'unknown document directive "'+n+'"')}fe(e,!0,-1),0===e.lineIndent&&45===e.input.charCodeAt(e.position)&&45===e.input.charCodeAt(e.position+1)&&45===e.input.charCodeAt(e.position+2)?(e.position+=3,fe(e,!0,-1)):a&&oe(e,"directives end mark is expected"),be(e,e.lineIndent-1,4,!1,!0),fe(e,!0,-1),e.checkLineBreaks&&$.test(e.input.slice(o,e.position))&&ae(e,"non-ASCII line breaks are interpreted as content"),e.documents.push(e.result),e.position===e.lineStart&&de(e)?46===e.input.charCodeAt(e.position)&&(e.position+=3,fe(e,!0,-1)):e.position<e.length-1&&oe(e,"end of the stream or a document separator is expected")}function ve(e,t){t=t||{},0!==(e=String(e)).length&&(10!==e.charCodeAt(e.length-1)&&13!==e.charCodeAt(e.length-1)&&(e+="\n"),65279===e.charCodeAt(0)&&(e=e.slice(1)))
var n=new ie(e,t),i=e.indexOf("\0")
for(-1!==i&&(n.position=i,oe(n,"null byte is not allowed in input")),n.input+="\0";32===n.input.charCodeAt(n.position);)n.lineIndent+=1,n.position+=1
for(;n.position<n.length-1;)Ae(n)
return n.documents}var ke={loadAll:function(e,t,n){null!==t&&"object"==typeof t&&void 0===n&&(n=t,t=null)
var i=ve(e,n)
if("function"!=typeof t)return i
for(var r=0,o=i.length;r<o;r+=1)t(i[r])},load:function(e,t){var n=ve(e,t)
if(0!==n.length){if(1===n.length)return n[0]
throw new o("expected a single document in the stream, but found more")}}},we=Object.prototype.toString,Ce=Object.prototype.hasOwnProperty,xe={0:"\\0",7:"\\a",8:"\\b",9:"\\t",10:"\\n",11:"\\v",12:"\\f",13:"\\r",27:"\\e",34:'\\"',92:"\\\\",133:"\\N",160:"\\_",8232:"\\L",8233:"\\P"},Ie=["y","Y","yes","Yes","YES","on","On","ON","n","N","no","No","NO","off","Off","OFF"],Se=/^[-+]?[0-9_]+(?::[0-9_]+)+(?:\.[0-9_]*)?$/
function Oe(e){var t,i,r
if(t=e.toString(16).toUpperCase(),e<=255)i="x",r=2
else if(e<=65535)i="u",r=4
else{if(!(e<=4294967295))throw new o("code point within a string may not be greater than 0xFFFFFFFF")
i="U",r=8}return"\\"+i+n.repeat("0",r-t.length)+t}function je(e){this.schema=e.schema||Y,this.indent=Math.max(1,e.indent||2),this.noArrayIndent=e.noArrayIndent||!1,this.skipInvalid=e.skipInvalid||!1,this.flowLevel=n.isNothing(e.flowLevel)?-1:e.flowLevel,this.styleMap=function(e,t){var n,i,r,o,a,l,c
if(null===t)return{}
for(n={},r=0,o=(i=Object.keys(t)).length;r<o;r+=1)a=i[r],l=String(t[a]),"!!"===a.slice(0,2)&&(a="tag:yaml.org,2002:"+a.slice(2)),(c=e.compiledTypeMap.fallback[a])&&Ce.call(c.styleAliases,l)&&(l=c.styleAliases[l]),n[a]=l
return n}(this.schema,e.styles||null),this.sortKeys=e.sortKeys||!1,this.lineWidth=e.lineWidth||80,this.noRefs=e.noRefs||!1,this.noCompatMode=e.noCompatMode||!1,this.condenseFlow=e.condenseFlow||!1,this.quotingType='"'===e.quotingType?2:1,this.forceQuotes=e.forceQuotes||!1,this.replacer="function"==typeof e.replacer?e.replacer:null,this.implicitTypes=this.schema.compiledImplicit,this.explicitTypes=this.schema.compiledExplicit,this.tag=null,this.result="",this.duplicates=[],this.usedDuplicates=null}function Te(e,t){for(var i,r=n.repeat(" ",t),o=0,a=-1,l="",c=e.length;o<c;)-1===(a=e.indexOf("\n",o))?(i=e.slice(o),o=c):(i=e.slice(o,a+1),o=a+1),i.length&&"\n"!==i&&(l+=r),l+=i
return l}function Ee(e,t){return"\n"+n.repeat(" ",e.indent*t)}function Me(e){return 32===e||9===e}function Le(e){return 32<=e&&e<=126||161<=e&&e<=55295&&8232!==e&&8233!==e||57344<=e&&e<=65533&&65279!==e||65536<=e&&e<=1114111}function Ne(e){return Le(e)&&65279!==e&&13!==e&&10!==e}function Fe(e,t,n){var i=Ne(e),r=i&&!Me(e)
return(n?i:i&&44!==e&&91!==e&&93!==e&&123!==e&&125!==e)&&35!==e&&!(58===t&&!r)||Ne(t)&&!Me(t)&&35===e||58===t&&r}function _e(e,t){var n,i=e.charCodeAt(t)
return i>=55296&&i<=56319&&t+1<e.length&&(n=e.charCodeAt(t+1))>=56320&&n<=57343?1024*(i-55296)+n-56320+65536:i}function De(e){return/^\n* /.test(e)}function Ue(e,t,n,i,r,o,a,l){var c,s,u=0,p=null,f=!1,d=!1,h=-1!==i,m=-1,g=Le(s=_e(e,0))&&65279!==s&&!Me(s)&&45!==s&&63!==s&&58!==s&&44!==s&&91!==s&&93!==s&&123!==s&&125!==s&&35!==s&&38!==s&&42!==s&&33!==s&&124!==s&&61!==s&&62!==s&&39!==s&&34!==s&&37!==s&&64!==s&&96!==s&&function(e){return!Me(e)&&58!==e}(_e(e,e.length-1))
if(t||a)for(c=0;c<e.length;u>=65536?c+=2:c++){if(!Le(u=_e(e,c)))return 5
g=g&&Fe(u,p,l),p=u}else{for(c=0;c<e.length;u>=65536?c+=2:c++){if(10===(u=_e(e,c)))f=!0,h&&(d=d||c-m-1>i&&" "!==e[m+1],m=c)
else if(!Le(u))return 5
g=g&&Fe(u,p,l),p=u}d=d||h&&c-m-1>i&&" "!==e[m+1]}return f||d?n>9&&De(e)?5:a?2===o?5:2:d?4:3:!g||a||r(e)?2===o?5:2:1}function qe(e,t,n,i,r){e.dump=function(){if(0===t.length)return 2===e.quotingType?'""':"''"
if(!e.noCompatMode&&(-1!==Ie.indexOf(t)||Se.test(t)))return 2===e.quotingType?'"'+t+'"':"'"+t+"'"
var a=e.indent*Math.max(1,n),l=-1===e.lineWidth?-1:Math.max(Math.min(e.lineWidth,40),e.lineWidth-a),c=i||e.flowLevel>-1&&n>=e.flowLevel
switch(Ue(t,c,e.indent,l,(function(t){return function(e,t){var n,i
for(n=0,i=e.implicitTypes.length;n<i;n+=1)if(e.implicitTypes[n].resolve(t))return!0
return!1}(e,t)}),e.quotingType,e.forceQuotes&&!i,r)){case 1:return t
case 2:return"'"+t.replace(/'/g,"''")+"'"
case 3:return"|"+Ye(t,e.indent)+Pe(Te(t,a))
case 4:return">"+Ye(t,e.indent)+Pe(Te(function(e,t){var n,i,r=/(\n+)([^\n]*)/g,o=(l=e.indexOf("\n"),l=-1!==l?l:e.length,r.lastIndex=l,Re(e.slice(0,l),t)),a="\n"===e[0]||" "===e[0]
var l
for(;i=r.exec(e);){var c=i[1],s=i[2]
n=" "===s[0],o+=c+(a||n||""===s?"":"\n")+Re(s,t),a=n}return o}(t,l),a))
case 5:return'"'+function(e){for(var t,n="",i=0,r=0;r<e.length;i>=65536?r+=2:r++)i=_e(e,r),!(t=xe[i])&&Le(i)?(n+=e[r],i>=65536&&(n+=e[r+1])):n+=t||Oe(i)
return n}(t)+'"'
default:throw new o("impossible error: invalid scalar style")}}()}function Ye(e,t){var n=De(e)?String(t):"",i="\n"===e[e.length-1]
return n+(i&&("\n"===e[e.length-2]||"\n"===e)?"+":i?"":"-")+"\n"}function Pe(e){return"\n"===e[e.length-1]?e.slice(0,-1):e}function Re(e,t){if(""===e||" "===e[0])return e
for(var n,i,r=/ [^ ]/g,o=0,a=0,l=0,c="";n=r.exec(e);)(l=n.index)-o>t&&(i=a>o?a:l,c+="\n"+e.slice(o,i),o=i+1),a=l
return c+="\n",e.length-o>t&&a>o?c+=e.slice(o,a)+"\n"+e.slice(a+1):c+=e.slice(o),c.slice(1)}function $e(e,t,n,i){var r,o,a,l="",c=e.tag
for(r=0,o=n.length;r<o;r+=1)a=n[r],e.replacer&&(a=e.replacer.call(n,String(r),a)),(Ke(e,t+1,a,!0,!0,!1,!0)||void 0===a&&Ke(e,t+1,null,!0,!0,!1,!0))&&(i&&""===l||(l+=Ee(e,t)),e.dump&&10===e.dump.charCodeAt(0)?l+="-":l+="- ",l+=e.dump)
e.tag=c,e.dump=l||"[]"}function Be(e,t,n){var i,r,a,l,c,s
for(a=0,l=(r=n?e.explicitTypes:e.implicitTypes).length;a<l;a+=1)if(((c=r[a]).instanceOf||c.predicate)&&(!c.instanceOf||"object"==typeof t&&t instanceof c.instanceOf)&&(!c.predicate||c.predicate(t))){if(n?c.multi&&c.representName?e.tag=c.representName(t):e.tag=c.tag:e.tag="?",c.represent){if(s=e.styleMap[c.tag]||c.defaultStyle,"[object Function]"===we.call(c.represent))i=c.represent(t,s)
else{if(!Ce.call(c.represent,s))throw new o("!<"+c.tag+'> tag resolver accepts not "'+s+'" style')
i=c.represent[s](t,s)}e.dump=i}return!0}return!1}function Ke(e,t,n,i,r,a,l){e.tag=null,e.dump=n,Be(e,n,!1)||Be(e,n,!0)
var c,s=we.call(e.dump),u=i
i&&(i=e.flowLevel<0||e.flowLevel>t)
var p,f,d="[object Object]"===s||"[object Array]"===s
if(d&&(f=-1!==(p=e.duplicates.indexOf(n))),(null!==e.tag&&"?"!==e.tag||f||2!==e.indent&&t>0)&&(r=!1),f&&e.usedDuplicates[p])e.dump="*ref_"+p
else{if(d&&f&&!e.usedDuplicates[p]&&(e.usedDuplicates[p]=!0),"[object Object]"===s)i&&0!==Object.keys(e.dump).length?(function(e,t,n,i){var r,a,l,c,s,u,p="",f=e.tag,d=Object.keys(n)
if(!0===e.sortKeys)d.sort()
else if("function"==typeof e.sortKeys)d.sort(e.sortKeys)
else if(e.sortKeys)throw new o("sortKeys must be a boolean or a function")
for(r=0,a=d.length;r<a;r+=1)u="",i&&""===p||(u+=Ee(e,t)),c=n[l=d[r]],e.replacer&&(c=e.replacer.call(n,l,c)),Ke(e,t+1,l,!0,!0,!0)&&((s=null!==e.tag&&"?"!==e.tag||e.dump&&e.dump.length>1024)&&(e.dump&&10===e.dump.charCodeAt(0)?u+="?":u+="? "),u+=e.dump,s&&(u+=Ee(e,t)),Ke(e,t+1,c,!0,s)&&(e.dump&&10===e.dump.charCodeAt(0)?u+=":":u+=": ",p+=u+=e.dump))
e.tag=f,e.dump=p||"{}"}(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(function(e,t,n){var i,r,o,a,l,c="",s=e.tag,u=Object.keys(n)
for(i=0,r=u.length;i<r;i+=1)l="",""!==c&&(l+=", "),e.condenseFlow&&(l+='"'),a=n[o=u[i]],e.replacer&&(a=e.replacer.call(n,o,a)),Ke(e,t,o,!1,!1)&&(e.dump.length>1024&&(l+="? "),l+=e.dump+(e.condenseFlow?'"':"")+":"+(e.condenseFlow?"":" "),Ke(e,t,a,!1,!1)&&(c+=l+=e.dump))
e.tag=s,e.dump="{"+c+"}"}(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump))
else if("[object Array]"===s)i&&0!==e.dump.length?(e.noArrayIndent&&!l&&t>0?$e(e,t-1,e.dump,r):$e(e,t,e.dump,r),f&&(e.dump="&ref_"+p+e.dump)):(function(e,t,n){var i,r,o,a="",l=e.tag
for(i=0,r=n.length;i<r;i+=1)o=n[i],e.replacer&&(o=e.replacer.call(n,String(i),o)),(Ke(e,t,o,!1,!1)||void 0===o&&Ke(e,t,null,!1,!1))&&(""!==a&&(a+=","+(e.condenseFlow?"":" ")),a+=e.dump)
e.tag=l,e.dump="["+a+"]"}(e,t,e.dump),f&&(e.dump="&ref_"+p+" "+e.dump))
else{if("[object String]"!==s){if("[object Undefined]"===s)return!1
if(e.skipInvalid)return!1
throw new o("unacceptable kind of an object to dump "+s)}"?"!==e.tag&&qe(e,e.dump,t,a,u)}null!==e.tag&&"?"!==e.tag&&(c=encodeURI("!"===e.tag[0]?e.tag.slice(1):e.tag).replace(/!/g,"%21"),c="!"===e.tag[0]?"!"+c:"tag:yaml.org,2002:"===c.slice(0,18)?"!!"+c.slice(18):"!<"+c+">",e.dump=c+" "+e.dump)}return!0}function We(e,t){var n,i,r=[],o=[]
for(function e(t,n,i){var r,o,a
if(null!==t&&"object"==typeof t)if(-1!==(o=n.indexOf(t)))-1===i.indexOf(o)&&i.push(o)
else if(n.push(t),Array.isArray(t))for(o=0,a=t.length;o<a;o+=1)e(t[o],n,i)
else for(r=Object.keys(t),o=0,a=r.length;o<a;o+=1)e(t[r[o]],n,i)}(e,r,o),n=0,i=o.length;n<i;n+=1)t.duplicates.push(r[o[n]])
t.usedDuplicates=new Array(i)}function He(e,t){return function(){throw new Error("Function yaml."+e+" is removed in js-yaml 4. Use yaml."+t+" instead, which is now safe by default.")}}var Ge=p,Ve=h,Ze=m,ze=x,Je=I,Qe=Y,Xe=ke.load,et=ke.loadAll,tt={dump:function(e,t){var n=new je(t=t||{})
n.noRefs||We(e,n)
var i=e
return n.replacer&&(i=n.replacer.call({"":i},"",i)),Ke(n,0,i,!0,!0)?n.dump+"\n":""}}.dump,nt=o,it=He("safeLoad","load"),rt=He("safeLoadAll","loadAll"),ot=He("safeDump","dump"),at={Type:Ge,Schema:Ve,FAILSAFE_SCHEMA:Ze,JSON_SCHEMA:ze,CORE_SCHEMA:Je,DEFAULT_SCHEMA:Qe,load:Xe,loadAll:et,dump:tt,YAMLException:nt,safeLoad:it,safeLoadAll:rt,safeDump:ot}
e.CORE_SCHEMA=Je,e.DEFAULT_SCHEMA=Qe,e.FAILSAFE_SCHEMA=Ze,e.JSON_SCHEMA=ze,e.Schema=Ve,e.Type=Ge,e.YAMLException=nt,e.default=at,e.dump=tt,e.load=Xe,e.loadAll=et,e.safeDump=ot,e.safeLoad=it,e.safeLoadAll=rt,Object.defineProperty(e,"__esModule",{value:!0})})),function(e){"object"==typeof exports&&"object"==typeof module?e(require("../../lib/codemirror")):"function"==typeof define&&define.amd?define(["../../lib/codemirror"],e):e(CodeMirror)}((function(e){"use strict"
e.defineMode("yaml",(function(){var e=new RegExp("\\b(("+["true","false","on","off","yes","no"].join(")|(")+"))$","i")
return{token:function(t,n){var i=t.peek(),r=n.escaped
if(n.escaped=!1,"#"==i&&(0==t.pos||/\s/.test(t.string.charAt(t.pos-1))))return t.skipToEnd(),"comment"
if(t.match(/^('([^']|\\.)*'?|"([^"]|\\.)*"?)/))return"string"
if(n.literal&&t.indentation()>n.keyCol)return t.skipToEnd(),"string"
if(n.literal&&(n.literal=!1),t.sol()){if(n.keyCol=0,n.pair=!1,n.pairStart=!1,t.match(/---/))return"def"
if(t.match(/\.\.\./))return"def"
if(t.match(/\s*-\s+/))return"meta"}if(t.match(/^(\{|\}|\[|\])/))return"{"==i?n.inlinePairs++:"}"==i?n.inlinePairs--:"["==i?n.inlineList++:n.inlineList--,"meta"
if(n.inlineList>0&&!r&&","==i)return t.next(),"meta"
if(n.inlinePairs>0&&!r&&","==i)return n.keyCol=0,n.pair=!1,n.pairStart=!1,t.next(),"meta"
if(n.pairStart){if(t.match(/^\s*(\||\>)\s*/))return n.literal=!0,"meta"
if(t.match(/^\s*(\&|\*)[a-z0-9\._-]+\b/i))return"variable-2"
if(0==n.inlinePairs&&t.match(/^\s*-?[0-9\.\,]+\s?$/))return"number"
if(n.inlinePairs>0&&t.match(/^\s*-?[0-9\.\,]+\s?(?=(,|}))/))return"number"
if(t.match(e))return"keyword"}return!n.pair&&t.match(/^\s*(?:[,\[\]{}&*!|>'"%@`][^\s'":]|[^,\[\]{}#&*!|>'"%@`])[^#]*?(?=\s*:($|\s))/)?(n.pair=!0,n.keyCol=t.indentation(),"atom"):n.pair&&t.match(/^:\s*/)?(n.pairStart=!0,"meta"):(n.pairStart=!1,n.escaped="\\"==i,t.next(),null)},startState:function(){return{pair:!1,pairStart:!1,keyCol:0,inlinePairs:0,inlineList:0,literal:!1,escaped:!1}}}})),e.defineMIME("text/x-yaml","yaml")}))

View File

@ -0,0 +1 @@
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.routes=JSON.stringify(e)})({dc:{acls:{tokens:{_options:{abilities:["read tokens"]}}}}})

View File

@ -0,0 +1 @@
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.services=JSON.stringify(e)})({})

View File

@ -0,0 +1 @@
((s,e=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{e.routes=JSON.stringify(s)})({dc:{nodes:{show:{sessions:{_options:{path:"/lock-sessions"}}}}}})

View File

@ -0,0 +1 @@
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.services=JSON.stringify(e)})({})

View File

@ -0,0 +1 @@
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.routes=JSON.stringify(e)})({dc:{nspaces:{_options:{path:"/namespaces",abilities:["read nspaces"]},index:{_options:{path:"/",queryParams:{sortBy:"sort",searchproperty:{as:"searchproperty",empty:[["Name","Description","Role","Policy"]]},search:{as:"filter",replace:!0}}}},edit:{_options:{path:"/:name"}},create:{_options:{template:"../edit",path:"/create",abilities:["create nspaces"]}}}}})

View File

@ -0,0 +1 @@
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.services=JSON.stringify(e)})({})

View File

@ -0,0 +1 @@
((t,e=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{e.routes=JSON.stringify(t)})({dc:{partitions:{_options:{path:"/partitions",abilities:["read partitions"]},index:{_options:{path:"/",queryParams:{sortBy:"sort",searchproperty:{as:"searchproperty",empty:[["Name","Description"]]},search:{as:"filter",replace:!0}}}},edit:{_options:{path:"/:name"}},create:{_options:{template:"../edit",path:"/create",abilities:["create partitions"]}}}}})

View File

@ -0,0 +1 @@
((e,t=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{t.services=JSON.stringify(e)})({"component:consul/partition/selector":{class:"consul-ui/components/consul/partition/selector"}})

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
((e,r=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{r.routes=JSON.stringify(e)})({"oauth-provider-debug":{_options:{path:"/oauth-provider-debug",queryParams:{redirect_uri:"redirect_uri",response_type:"response_type",scope:"scope"}}}})

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1 @@
((e,s=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{s.services=JSON.stringify(e)})({"route:basic":{class:"consul-ui/routing/route"},"service:intl":{class:"consul-ui/services/i18n"},"service:state":{class:"consul-ui/services/state-with-charts"},"auth-provider:oidc-with-url":{class:"consul-ui/services/auth-providers/oauth2-code-with-url-provider"},"component:consul/partition/selector":{class:"@glimmer/component"}})

View File

@ -0,0 +1 @@
((e,i=("undefined"!=typeof document?document.currentScript.dataset:module.exports))=>{i.services=JSON.stringify(e)})({"route:application":{class:"consul-ui/routing/application-debug"},"service:intl":{class:"consul-ui/services/i18n-debug"}})

View File

@ -0,0 +1,6 @@
/*! https://mths.be/cssescape v1.5.1 by @mathias | MIT license */
(function(e,t){"object"==typeof exports?module.exports=t(e):"function"==typeof define&&define.amd?define([],t.bind(e,e)):t(e)})("undefined"!=typeof global?global:this,(function(e){if(e.CSS&&e.CSS.escape)return e.CSS.escape
var t=function(e){if(0==arguments.length)throw new TypeError("`CSS.escape` requires an argument.")
for(var t,n=String(e),r=n.length,o=-1,S="",a=n.charCodeAt(0);++o<r;)0!=(t=n.charCodeAt(o))?S+=t>=1&&t<=31||127==t||0==o&&t>=48&&t<=57||1==o&&t>=48&&t<=57&&45==a?"\\"+t.toString(16)+" ":(0!=o||1!=r||45!=t)&&(t>=128||45==t||95==t||t>=48&&t<=57||t>=65&&t<=90||t>=97&&t<=122)?n.charAt(o):"\\"+n.charAt(o):S+="<22>"
return S}
return e.CSS||(e.CSS={}),e.CSS.escape=t,t}))

View File

@ -0,0 +1,204 @@
(function(n){"use strict"
function e(n,e,r){return e<=n&&n<=r}"undefined"!=typeof module&&module.exports&&!n["encoding-indexes"]&&(n["encoding-indexes"]=require("./encoding-indexes-75eea16b259716db4fd162ee283d2ae5.js")["encoding-indexes"])
var r=Math.floor
function i(n){if(void 0===n)return{}
if(n===Object(n))return n
throw TypeError("Could not convert argument to dictionary")}function t(n){return 0<=n&&n<=127}var o=t
function s(n){this.tokens=[].slice.call(n),this.tokens.reverse()}s.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.pop():-1},prepend:function(n){if(Array.isArray(n))for(var e=n;e.length;)this.tokens.push(e.pop())
else this.tokens.push(n)},push:function(n){if(Array.isArray(n))for(var e=n;e.length;)this.tokens.unshift(e.shift())
else this.tokens.unshift(n)}}
function a(n,e){if(n)throw TypeError("Decoder error")
return e||65533}function u(n){throw TypeError("The code point "+n+" could not be encoded.")}function l(n){return n=String(n).trim().toLowerCase(),Object.prototype.hasOwnProperty.call(c,n)?c[n]:null}var f=[{encodings:[{labels:["unicode-1-1-utf-8","utf-8","utf8"],name:"UTF-8"}],heading:"The Encoding"},{encodings:[{labels:["866","cp866","csibm866","ibm866"],name:"IBM866"},{labels:["csisolatin2","iso-8859-2","iso-ir-101","iso8859-2","iso88592","iso_8859-2","iso_8859-2:1987","l2","latin2"],name:"ISO-8859-2"},{labels:["csisolatin3","iso-8859-3","iso-ir-109","iso8859-3","iso88593","iso_8859-3","iso_8859-3:1988","l3","latin3"],name:"ISO-8859-3"},{labels:["csisolatin4","iso-8859-4","iso-ir-110","iso8859-4","iso88594","iso_8859-4","iso_8859-4:1988","l4","latin4"],name:"ISO-8859-4"},{labels:["csisolatincyrillic","cyrillic","iso-8859-5","iso-ir-144","iso8859-5","iso88595","iso_8859-5","iso_8859-5:1988"],name:"ISO-8859-5"},{labels:["arabic","asmo-708","csiso88596e","csiso88596i","csisolatinarabic","ecma-114","iso-8859-6","iso-8859-6-e","iso-8859-6-i","iso-ir-127","iso8859-6","iso88596","iso_8859-6","iso_8859-6:1987"],name:"ISO-8859-6"},{labels:["csisolatingreek","ecma-118","elot_928","greek","greek8","iso-8859-7","iso-ir-126","iso8859-7","iso88597","iso_8859-7","iso_8859-7:1987","sun_eu_greek"],name:"ISO-8859-7"},{labels:["csiso88598e","csisolatinhebrew","hebrew","iso-8859-8","iso-8859-8-e","iso-ir-138","iso8859-8","iso88598","iso_8859-8","iso_8859-8:1988","visual"],name:"ISO-8859-8"},{labels:["csiso88598i","iso-8859-8-i","logical"],name:"ISO-8859-8-I"},{labels:["csisolatin6","iso-8859-10","iso-ir-157","iso8859-10","iso885910","l6","latin6"],name:"ISO-8859-10"},{labels:["iso-8859-13","iso8859-13","iso885913"],name:"ISO-8859-13"},{labels:["iso-8859-14","iso8859-14","iso885914"],name:"ISO-8859-14"},{labels:["csisolatin9","iso-8859-15","iso8859-15","iso885915","iso_8859-15","l9"],name:"ISO-8859-15"},{labels:["iso-8859-16"],name:"ISO-8859-16"},{labels:["cskoi8r","koi","koi8","koi8-r","koi8_r"],name:"KOI8-R"},{labels:["koi8-ru","koi8-u"],name:"KOI8-U"},{labels:["csmacintosh","mac","macintosh","x-mac-roman"],name:"macintosh"},{labels:["dos-874","iso-8859-11","iso8859-11","iso885911","tis-620","windows-874"],name:"windows-874"},{labels:["cp1250","windows-1250","x-cp1250"],name:"windows-1250"},{labels:["cp1251","windows-1251","x-cp1251"],name:"windows-1251"},{labels:["ansi_x3.4-1968","ascii","cp1252","cp819","csisolatin1","ibm819","iso-8859-1","iso-ir-100","iso8859-1","iso88591","iso_8859-1","iso_8859-1:1987","l1","latin1","us-ascii","windows-1252","x-cp1252"],name:"windows-1252"},{labels:["cp1253","windows-1253","x-cp1253"],name:"windows-1253"},{labels:["cp1254","csisolatin5","iso-8859-9","iso-ir-148","iso8859-9","iso88599","iso_8859-9","iso_8859-9:1989","l5","latin5","windows-1254","x-cp1254"],name:"windows-1254"},{labels:["cp1255","windows-1255","x-cp1255"],name:"windows-1255"},{labels:["cp1256","windows-1256","x-cp1256"],name:"windows-1256"},{labels:["cp1257","windows-1257","x-cp1257"],name:"windows-1257"},{labels:["cp1258","windows-1258","x-cp1258"],name:"windows-1258"},{labels:["x-mac-cyrillic","x-mac-ukrainian"],name:"x-mac-cyrillic"}],heading:"Legacy single-byte encodings"},{encodings:[{labels:["chinese","csgb2312","csiso58gb231280","gb2312","gb_2312","gb_2312-80","gbk","iso-ir-58","x-gbk"],name:"GBK"},{labels:["gb18030"],name:"gb18030"}],heading:"Legacy multi-byte Chinese (simplified) encodings"},{encodings:[{labels:["big5","big5-hkscs","cn-big5","csbig5","x-x-big5"],name:"Big5"}],heading:"Legacy multi-byte Chinese (traditional) encodings"},{encodings:[{labels:["cseucpkdfmtjapanese","euc-jp","x-euc-jp"],name:"EUC-JP"},{labels:["csiso2022jp","iso-2022-jp"],name:"ISO-2022-JP"},{labels:["csshiftjis","ms932","ms_kanji","shift-jis","shift_jis","sjis","windows-31j","x-sjis"],name:"Shift_JIS"}],heading:"Legacy multi-byte Japanese encodings"},{encodings:[{labels:["cseuckr","csksc56011987","euc-kr","iso-ir-149","korean","ks_c_5601-1987","ks_c_5601-1989","ksc5601","ksc_5601","windows-949"],name:"EUC-KR"}],heading:"Legacy multi-byte Korean encodings"},{encodings:[{labels:["csiso2022kr","hz-gb-2312","iso-2022-cn","iso-2022-cn-ext","iso-2022-kr"],name:"replacement"},{labels:["utf-16be"],name:"UTF-16BE"},{labels:["utf-16","utf-16le"],name:"UTF-16LE"},{labels:["x-user-defined"],name:"x-user-defined"}],heading:"Legacy miscellaneous encodings"}],c={}
f.forEach((function(n){n.encodings.forEach((function(n){n.labels.forEach((function(e){c[e]=n}))}))}))
var d,h,g={},p={}
function _(n,e){return e&&e[n]||null}function b(n,e){var r=e.indexOf(n)
return-1===r?null:r}function w(e){if(!("encoding-indexes"in n))throw Error("Indexes missing. Did you forget to include encoding-indexes-75eea16b259716db4fd162ee283d2ae5.js first?")
return n["encoding-indexes"][e]}function m(n,e){if(!(this instanceof m))throw TypeError("Called as a function. Did you forget 'new'?")
n=void 0!==n?String(n):"utf-8",e=i(e),this._encoding=null,this._decoder=null,this._ignoreBOM=!1,this._BOMseen=!1,this._error_mode="replacement",this._do_not_flush=!1
var r=l(n)
if(null===r||"replacement"===r.name)throw RangeError("Unknown encoding: "+n)
if(!p[r.name])throw Error("Decoder not present. Did you forget to include encoding-indexes-75eea16b259716db4fd162ee283d2ae5.js first?")
return this._encoding=r,Boolean(e.fatal)&&(this._error_mode="fatal"),Boolean(e.ignoreBOM)&&(this._ignoreBOM=!0),Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase(),this.fatal="fatal"===this._error_mode,this.ignoreBOM=this._ignoreBOM),this}function v(e,r){if(!(this instanceof v))throw TypeError("Called as a function. Did you forget 'new'?")
r=i(r),this._encoding=null,this._encoder=null,this._do_not_flush=!1,this._fatal=Boolean(r.fatal)?"fatal":"replacement"
if(Boolean(r.NONSTANDARD_allowLegacyEncoding)){var t=l(e=void 0!==e?String(e):"utf-8")
if(null===t||"replacement"===t.name)throw RangeError("Unknown encoding: "+e)
if(!g[t.name])throw Error("Encoder not present. Did you forget to include encoding-indexes-75eea16b259716db4fd162ee283d2ae5.js first?")
this._encoding=t}else this._encoding=l("utf-8"),void 0!==e&&"console"in n&&console.warn("TextEncoder constructor called with encoding label, which is ignored.")
return Object.defineProperty||(this.encoding=this._encoding.name.toLowerCase()),this}function y(n){var r=n.fatal,i=0,t=0,o=0,s=128,u=191
this.handler=function(n,l){if(-1===l&&0!==o)return o=0,a(r)
if(-1===l)return-1
if(0===o){if(e(l,0,127))return l
if(e(l,194,223))o=1,i=31&l
else if(e(l,224,239))224===l&&(s=160),237===l&&(u=159),o=2,i=15&l
else{if(!e(l,240,244))return a(r)
240===l&&(s=144),244===l&&(u=143),o=3,i=7&l}return null}if(!e(l,s,u))return i=o=t=0,s=128,u=191,n.prepend(l),a(r)
if(s=128,u=191,i=i<<6|63&l,(t+=1)!==o)return null
var f=i
return i=o=t=0,f}}function x(n){n.fatal
this.handler=function(n,r){if(-1===r)return-1
if(o(r))return r
var i,t
e(r,128,2047)?(i=1,t=192):e(r,2048,65535)?(i=2,t=224):e(r,65536,1114111)&&(i=3,t=240)
for(var s=[(r>>6*i)+t];i>0;){var a=r>>6*(i-1)
s.push(128|63&a),i-=1}return s}}function O(n,e){var r=e.fatal
this.handler=function(e,i){if(-1===i)return-1
if(t(i))return i
var o=n[i-128]
return null===o?a(r):o}}function k(n,e){e.fatal
this.handler=function(e,r){if(-1===r)return-1
if(o(r))return r
var i=b(r,n)
return null===i&&u(r),i+128}}function E(n){var r=n.fatal,i=0,o=0,s=0
this.handler=function(n,u){if(-1===u&&0===i&&0===o&&0===s)return-1
var l
if(-1!==u||0===i&&0===o&&0===s||(i=0,o=0,s=0,a(r)),0!==s){l=null,e(u,48,57)&&(l=function(n){if(n>39419&&n<189e3||n>1237575)return null
if(7457===n)return 59335
var e,r=0,i=0,t=w("gb18030-ranges")
for(e=0;e<t.length;++e){var o=t[e]
if(!(o[0]<=n))break
r=o[0],i=o[1]}return i+n-r}(10*(126*(10*(i-129)+o-48)+s-129)+u-48))
var f=[o,s,u]
return i=0,o=0,s=0,null===l?(n.prepend(f),a(r)):l}if(0!==o)return e(u,129,254)?(s=u,null):(n.prepend([o,u]),i=0,o=0,a(r))
if(0!==i){if(e(u,48,57))return o=u,null
var c=i,d=null
i=0
var h=u<127?64:65
return(e(u,64,126)||e(u,128,254))&&(d=190*(c-129)+(u-h)),null===(l=null===d?null:_(d,w("gb18030")))&&t(u)&&n.prepend(u),null===l?a(r):l}return t(u)?u:128===u?8364:e(u,129,254)?(i=u,null):a(r)}}function j(n,e){n.fatal
this.handler=function(n,i){if(-1===i)return-1
if(o(i))return i
if(58853===i)return u(i)
if(e&&8364===i)return 128
var t=b(i,w("gb18030"))
if(null!==t){var s=t%190
return[r(t/190)+129,s+(s<63?64:65)]}if(e)return u(i)
t=function(n){if(59335===n)return 7457
var e,r=0,i=0,t=w("gb18030-ranges")
for(e=0;e<t.length;++e){var o=t[e]
if(!(o[1]<=n))break
r=o[1],i=o[0]}return i+n-r}(i)
var a=r(t/10/126/10),l=r((t-=10*a*126*10)/10/126),f=r((t-=10*l*126)/10)
return[a+129,l+48,f+129,t-10*f+48]}}function B(n){var r=n.fatal,i=0
this.handler=function(n,o){if(-1===o&&0!==i)return i=0,a(r)
if(-1===o&&0===i)return-1
if(0!==i){var s=i,u=null
i=0
var l=o<127?64:98
switch((e(o,64,126)||e(o,161,254))&&(u=157*(s-129)+(o-l)),u){case 1133:return[202,772]
case 1135:return[202,780]
case 1164:return[234,772]
case 1166:return[234,780]}var f=null===u?null:_(u,w("big5"))
return null===f&&t(o)&&n.prepend(o),null===f?a(r):f}return t(o)?o:e(o,129,254)?(i=o,null):a(r)}}function S(n){n.fatal
this.handler=function(n,e){if(-1===e)return-1
if(o(e))return e
var i=function(n){var e=h=h||w("big5").map((function(n,e){return e<5024?null:n}))
return 9552===n||9566===n||9569===n||9578===n||21313===n||21317===n?e.lastIndexOf(n):b(n,e)}(e)
if(null===i)return u(e)
var t=r(i/157)+129
if(t<161)return u(e)
var s=i%157
return[t,s+(s<63?64:98)]}}function T(n){var r=n.fatal,i=!1,o=0
this.handler=function(n,s){if(-1===s&&0!==o)return o=0,a(r)
if(-1===s&&0===o)return-1
if(142===o&&e(s,161,223))return o=0,65216+s
if(143===o&&e(s,161,254))return i=!0,o=s,null
if(0!==o){var u=o
o=0
var l=null
return e(u,161,254)&&e(s,161,254)&&(l=_(94*(u-161)+(s-161),w(i?"jis0212":"jis0208"))),i=!1,e(s,161,254)||n.prepend(s),null===l?a(r):l}return t(s)?s:142===s||143===s||e(s,161,254)?(o=s,null):a(r)}}function I(n){n.fatal
this.handler=function(n,i){if(-1===i)return-1
if(o(i))return i
if(165===i)return 92
if(8254===i)return 126
if(e(i,65377,65439))return[142,i-65377+161]
8722===i&&(i=65293)
var t=b(i,w("jis0208"))
return null===t?u(i):[r(t/94)+161,t%94+161]}}function U(n){var r=n.fatal,i=0,t=1,o=2,s=3,u=4,l=5,f=6,c=i,d=i,h=0,g=!1
this.handler=function(n,p){switch(c){default:case i:return 27===p?(c=l,null):e(p,0,127)&&14!==p&&15!==p&&27!==p?(g=!1,p):-1===p?-1:(g=!1,a(r))
case t:return 27===p?(c=l,null):92===p?(g=!1,165):126===p?(g=!1,8254):e(p,0,127)&&14!==p&&15!==p&&27!==p&&92!==p&&126!==p?(g=!1,p):-1===p?-1:(g=!1,a(r))
case o:return 27===p?(c=l,null):e(p,33,95)?(g=!1,65344+p):-1===p?-1:(g=!1,a(r))
case s:return 27===p?(c=l,null):e(p,33,126)?(g=!1,h=p,c=u,null):-1===p?-1:(g=!1,a(r))
case u:if(27===p)return c=l,a(r)
if(e(p,33,126)){c=s
var b=_(94*(h-33)+p-33,w("jis0208"))
return null===b?a(r):b}return-1===p?(c=s,n.prepend(p),a(r)):(c=s,a(r))
case l:return 36===p||40===p?(h=p,c=f,null):(n.prepend(p),g=!1,c=d,a(r))
case f:var m=h
h=0
var v=null
if(40===m&&66===p&&(v=i),40===m&&74===p&&(v=t),40===m&&73===p&&(v=o),36!==m||64!==p&&66!==p||(v=s),null!==v){c=c=v
var y=g
return g=!0,y?a(r):null}return n.prepend([m,p]),g=!1,c=d,a(r)}}}function C(n){n.fatal
var e=0,i=1,t=2,s=e
this.handler=function(n,a){if(-1===a&&s!==e)return n.prepend(a),s=e,[27,40,66]
if(-1===a&&s===e)return-1
if(!(s!==e&&s!==i||14!==a&&15!==a&&27!==a))return u(65533)
if(s===e&&o(a))return a
if(s===i&&(o(a)&&92!==a&&126!==a||165==a||8254==a)){if(o(a))return a
if(165===a)return 92
if(8254===a)return 126}if(o(a)&&s!==e)return n.prepend(a),s=e,[27,40,66]
if((165===a||8254===a)&&s!==i)return n.prepend(a),s=i,[27,40,74]
8722===a&&(a=65293)
var l=b(a,w("jis0208"))
return null===l?u(a):s!==t?(n.prepend(a),s=t,[27,36,66]):[r(l/94)+33,l%94+33]}}function A(n){var r=n.fatal,i=0
this.handler=function(n,o){if(-1===o&&0!==i)return i=0,a(r)
if(-1===o&&0===i)return-1
if(0!==i){var s=i,u=null
i=0
var l=o<127?64:65,f=s<160?129:193
if((e(o,64,126)||e(o,128,252))&&(u=188*(s-f)+o-l),e(u,8836,10715))return 48508+u
var c=null===u?null:_(u,w("jis0208"))
return null===c&&t(o)&&n.prepend(o),null===c?a(r):c}return t(o)||128===o?o:e(o,161,223)?65216+o:e(o,129,159)||e(o,224,252)?(i=o,null):a(r)}}function L(n){n.fatal
this.handler=function(n,i){if(-1===i)return-1
if(o(i)||128===i)return i
if(165===i)return 92
if(8254===i)return 126
if(e(i,65377,65439))return i-65377+161
8722===i&&(i=65293)
var t=function(n){return(d=d||w("jis0208").map((function(n,r){return e(r,8272,8835)?null:n}))).indexOf(n)}(i)
if(null===t)return u(i)
var s=r(t/188),a=t%188
return[s+(s<31?129:193),a+(a<63?64:65)]}}function M(n){var r=n.fatal,i=0
this.handler=function(n,o){if(-1===o&&0!==i)return i=0,a(r)
if(-1===o&&0===i)return-1
if(0!==i){var s=i,u=null
i=0,e(o,65,254)&&(u=190*(s-129)+(o-65))
var l=null===u?null:_(u,w("euc-kr"))
return null===u&&t(o)&&n.prepend(o),null===l?a(r):l}return t(o)?o:e(o,129,254)?(i=o,null):a(r)}}function P(n){n.fatal
this.handler=function(n,e){if(-1===e)return-1
if(o(e))return e
var i=b(e,w("euc-kr"))
return null===i?u(e):[r(i/190)+129,i%190+65]}}function D(n,e){var r=n>>8,i=255&n
return e?[r,i]:[i,r]}function F(n,r){var i=r.fatal,t=null,o=null
this.handler=function(r,s){if(-1===s&&(null!==t||null!==o))return a(i)
if(-1===s&&null===t&&null===o)return-1
if(null===t)return t=s,null
var u
if(u=n?(t<<8)+s:(s<<8)+t,t=null,null!==o){var l=o
return o=null,e(u,56320,57343)?65536+1024*(l-55296)+(u-56320):(r.prepend(D(u,n)),a(i))}return e(u,55296,56319)?(o=u,null):e(u,56320,57343)?a(i):u}}function J(n,r){r.fatal
this.handler=function(r,i){if(-1===i)return-1
if(e(i,0,65535))return D(i,n)
var t=D(55296+(i-65536>>10),n),o=D(56320+(i-65536&1023),n)
return t.concat(o)}}function K(n){n.fatal
this.handler=function(n,e){return-1===e?-1:t(e)?e:63360+e-128}}function R(n){n.fatal
this.handler=function(n,r){return-1===r?-1:o(r)?r:e(r,63360,63487)?r-63360+128:u(r)}}Object.defineProperty&&(Object.defineProperty(m.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),Object.defineProperty(m.prototype,"fatal",{get:function(){return"fatal"===this._error_mode}}),Object.defineProperty(m.prototype,"ignoreBOM",{get:function(){return this._ignoreBOM}})),m.prototype.decode=function(n,e){var r
r="object"==typeof n&&n instanceof ArrayBuffer?new Uint8Array(n):"object"==typeof n&&"buffer"in n&&n.buffer instanceof ArrayBuffer?new Uint8Array(n.buffer,n.byteOffset,n.byteLength):new Uint8Array(0),e=i(e),this._do_not_flush||(this._decoder=p[this._encoding.name]({fatal:"fatal"===this._error_mode}),this._BOMseen=!1),this._do_not_flush=Boolean(e.stream)
for(var t,o=new s(r),a=[];;){var u=o.read()
if(-1===u)break
if(-1===(t=this._decoder.handler(o,u)))break
null!==t&&(Array.isArray(t)?a.push.apply(a,t):a.push(t))}if(!this._do_not_flush){do{if(-1===(t=this._decoder.handler(o,o.read())))break
null!==t&&(Array.isArray(t)?a.push.apply(a,t):a.push(t))}while(!o.endOfStream())
this._decoder=null}return function(n){var e,r
return e=["UTF-8","UTF-16LE","UTF-16BE"],r=this._encoding.name,-1===e.indexOf(r)||this._ignoreBOM||this._BOMseen||(n.length>0&&65279===n[0]?(this._BOMseen=!0,n.shift()):n.length>0&&(this._BOMseen=!0)),function(n){for(var e="",r=0;r<n.length;++r){var i=n[r]
i<=65535?e+=String.fromCharCode(i):(i-=65536,e+=String.fromCharCode(55296+(i>>10),56320+(1023&i)))}return e}(n)}.call(this,a)},Object.defineProperty&&Object.defineProperty(v.prototype,"encoding",{get:function(){return this._encoding.name.toLowerCase()}}),v.prototype.encode=function(n,e){n=void 0===n?"":String(n),e=i(e),this._do_not_flush||(this._encoder=g[this._encoding.name]({fatal:"fatal"===this._fatal})),this._do_not_flush=Boolean(e.stream)
for(var r,t=new s(function(n){for(var e=String(n),r=e.length,i=0,t=[];i<r;){var o=e.charCodeAt(i)
if(o<55296||o>57343)t.push(o)
else if(56320<=o&&o<=57343)t.push(65533)
else if(55296<=o&&o<=56319)if(i===r-1)t.push(65533)
else{var s=e.charCodeAt(i+1)
if(56320<=s&&s<=57343){var a=1023&o,u=1023&s
t.push(65536+(a<<10)+u),i+=1}else t.push(65533)}i+=1}return t}(n)),o=[];;){var a=t.read()
if(-1===a)break
if(-1===(r=this._encoder.handler(t,a)))break
Array.isArray(r)?o.push.apply(o,r):o.push(r)}if(!this._do_not_flush){for(;-1!==(r=this._encoder.handler(t,t.read()));)Array.isArray(r)?o.push.apply(o,r):o.push(r)
this._encoder=null}return new Uint8Array(o)},g["UTF-8"]=function(n){return new x(n)},p["UTF-8"]=function(n){return new y(n)},"encoding-indexes"in n&&f.forEach((function(n){"Legacy single-byte encodings"===n.heading&&n.encodings.forEach((function(n){var e=n.name,r=w(e.toLowerCase())
p[e]=function(n){return new O(r,n)},g[e]=function(n){return new k(r,n)}}))})),p.GBK=function(n){return new E(n)},g.GBK=function(n){return new j(n,!0)},g.gb18030=function(n){return new j(n)},p.gb18030=function(n){return new E(n)},g.Big5=function(n){return new S(n)},p.Big5=function(n){return new B(n)},g["EUC-JP"]=function(n){return new I(n)},p["EUC-JP"]=function(n){return new T(n)},g["ISO-2022-JP"]=function(n){return new C(n)},p["ISO-2022-JP"]=function(n){return new U(n)},g.Shift_JIS=function(n){return new L(n)},p.Shift_JIS=function(n){return new A(n)},g["EUC-KR"]=function(n){return new P(n)},p["EUC-KR"]=function(n){return new M(n)},g["UTF-16BE"]=function(n){return new J(!0,n)},p["UTF-16BE"]=function(n){return new F(!0,n)},g["UTF-16LE"]=function(n){return new J(!1,n)},p["UTF-16LE"]=function(n){return new F(!1,n)},g["x-user-defined"]=function(n){return new R(n)},p["x-user-defined"]=function(n){return new K(n)},n.TextEncoder||(n.TextEncoder=v),n.TextDecoder||(n.TextDecoder=m),"undefined"!=typeof module&&module.exports&&(module.exports={TextEncoder:n.TextEncoder,TextDecoder:n.TextDecoder,EncodingIndexes:n["encoding-indexes"]})})(this||{})

File diff suppressed because one or more lines are too long

BIN
agent/uiserver/dist/assets/favicon.ico (Stored with Git LFS) vendored Normal file

Binary file not shown.

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.2 KiB

View File

@ -0,0 +1,5 @@
(function(e){const t=new Map(Object.entries(JSON.parse(e.querySelector("[data-consul-ui-fs]").textContent))),n=function(t){var n=e.createElement("script")
n.src=t,e.body.appendChild(n)}
"TextDecoder"in window||(n(t.get(["text-encoding","encoding-indexes"].join("/")+".js")),n(t.get(["text-encoding","encoding"].join("/")+".js"))),window.CSS&&window.CSS.escape||n(t.get(["css.escape","css.escape"].join("/")+".js"))
try{const t=e.querySelector('[name="consul-ui/config/environment"]'),n=JSON.parse(e.querySelector("[data-consul-ui-config]").textContent),o=JSON.parse(decodeURIComponent(t.getAttribute("content"))),c="string"!=typeof n.ContentPath?"":n.ContentPath
c.length>0&&(o.rootURL=c),t.setAttribute("content",encodeURIComponent(JSON.stringify(o)))}catch(o){throw new Error("Unable to parse consul-ui settings: "+o.message)}})(document)

View File

@ -0,0 +1,11 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 14 32 18" width="32" height="4" fill="#d68ab2" preserveAspectRatio="none">
<path opacity="0.8" transform="translate(0 0)" d="M2 14 V18 H6 V14z">
<animateTransform attributeName="transform" type="translate" values="0 0; 24 0; 0 0" dur="2s" begin="0" repeatCount="indefinite" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" />
</path>
<path opacity="0.5" transform="translate(0 0)" d="M0 14 V18 H8 V14z">
<animateTransform attributeName="transform" type="translate" values="0 0; 24 0; 0 0" dur="2s" begin="0.1s" repeatCount="indefinite" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" />
</path>
<path opacity="0.25" transform="translate(0 0)" d="M0 14 V18 H8 V14z">
<animateTransform attributeName="transform" type="translate" values="0 0; 24 0; 0 0" dur="2s" begin="0.2s" repeatCount="indefinite" keySplines="0.2 0.2 0.4 0.8;0.2 0.2 0.4 0.8" calcMode="spline" />
</path>
</svg>

After

Width:  |  Height:  |  Size: 983 B

View File

@ -0,0 +1,4 @@
(function(r){const e=["init","serviceRecentSummarySeries","serviceRecentSummaryStats","upstreamRecentSummaryStats","downstreamRecentSummaryStats"]
r.consul=new class{constructor(){this.registry={},this.providers={}}registerMetricsProvider(r,t){for(var i of e)if("function"!=typeof t[i])throw new Error(`Can't register metrics provider '${r}': missing ${i} method.`)
this.registry[r]=t}getMetricsProvider(r,e){if(!(r in this.registry))throw new Error(`Metrics Provider '${r}' is not registered.`)
return r in this.providers||(this.providers[r]=Object.create(this.registry[r]),this.providers[r].init(e)),this.providers[r]}}})(window)

View File

@ -0,0 +1,43 @@
(function(){var e={unitSuffix:"",labels:{},data:[]},t={options:{},init:function(e){if(this.options=e,!this.options.metrics_proxy_enabled)throw new Error("prometheus metrics provider currently requires the ui_config.metrics_proxy to be configured in the Consul agent.")},httpGet:function(e,t,r){if(t){var s=-1!==e.indexOf("?")?"&":"?"
e=e+s+Object.keys(t).map((function(e){return encodeURIComponent(e)+"="+encodeURIComponent(t[e])})).join("&")}return this.options.fetch(e,{headers:r||{}}).then((function(e){if(e.ok)return e.json()
var t=new Error("HTTP Error: "+e.statusText)
throw t.statusCode=e.status,t}))},serviceRecentSummarySeries:function(e,t,r,s,n){var a=(new Date).getTime()/1e3
return n.start=a-900,n.end=a,this.hasL7Metrics(s)?this.fetchRequestRateSeries(e,t,r,n):this.fetchDataRateSeries(e,t,r,n)},serviceRecentSummaryStats:function(e,t,r,s,n){var a=[]
return this.hasL7Metrics(s)?(a.push(this.fetchRPS(e,t,r,"service",n)),a.push(this.fetchER(e,t,r,"service",n)),a.push(this.fetchPercentile(50,e,t,r,"service",n)),a.push(this.fetchPercentile(99,e,t,r,"service",n))):(a.push(this.fetchConnRate(e,t,r,"service",n)),a.push(this.fetchServiceRx(e,t,r,"service",n)),a.push(this.fetchServiceTx(e,t,r,"service",n)),a.push(this.fetchServiceNoRoute(e,t,r,"service",n))),this.fetchStats(a)},upstreamRecentSummaryStats:function(e,t,r,s){return this.fetchRecentSummaryStats(e,t,r,"upstream",s)},downstreamRecentSummaryStats:function(e,t,r,s){return this.fetchRecentSummaryStats(e,t,r,"downstream",s)},fetchRecentSummaryStats:function(e,t,r,s,n){var a=[]
return a.push(this.fetchRPS(e,t,r,s,n)),a.push(this.fetchER(e,t,r,s,n)),a.push(this.fetchPercentile(50,e,t,r,s,n)),a.push(this.fetchPercentile(99,e,t,r,s,n)),a.push(this.fetchConnRate(e,t,r,s,n)),a.push(this.fetchServiceRx(e,t,r,s,n)),a.push(this.fetchServiceTx(e,t,r,s,n)),a.push(this.fetchServiceNoRoute(e,t,r,s,n)),this.fetchStatsGrouped(a)},hasL7Metrics:function(e){return"http"===e||"http2"===e||"grpc"===e},fetchStats:function(e){return Promise.all(e).then((function(t){for(var r={stats:[]},s=0;s<e.length;s++)t[s].value&&r.stats.push(t[s])
return r}))},fetchStatsGrouped:function(e){return Promise.all(e).then((function(t){for(var r={stats:{}},s=0;s<e.length;s++)if(t[s])for(var n in t[s])t[s].hasOwnProperty(n)&&(r.stats[n]||(r.stats[n]=[]),r.stats[n].push(t[s][n]))
return r}))},reformatSeries:function(t,r){return function(s){if(!s.data||!s.data.result||0==s.data.result.length||!s.data.result[0].values||0==s.data.result[0].values.length)return e
let n=s.data.result[0].values.map((function(e){return{time:Math.round(1e3*e[0])}}))
return s.data.result.map((function(e){e.values.map((function(t,r){n[r][e.metric.label]=parseFloat(t[1])}))})),{unitSuffix:t,labels:r,data:n}}},fetchRequestRateSeries:function(e,t,r,s){var n=`sum by (label) (label_replace(label_replace(irate(envoy_listener_http_downstream_rq_xx{consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}",envoy_http_conn_manager_prefix="public_listener"}[10m]), "label", "Successes", "envoy_response_code_class", "[^5]"), "label", "Errors", "envoy_response_code_class", "5"))`
return this.fetchSeries(n,s).then(this.reformatSeries(" rps",{Total:"Total inbound requests per second",Successes:"Successful responses (with an HTTP response code not in the 5xx range) per second.",Errors:"Error responses (with an HTTP response code in the 5xx range) per second."}))},fetchDataRateSeries:function(e,t,r,s){var n=`8 * sum by (label) (label_replace(irate(envoy_tcp_downstream_cx_tx_bytes_total{consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}",envoy_tcp_prefix="public_listener"}[10m]), "label", "Outbound", "__name__", ".*") or label_replace(irate(envoy_tcp_downstream_cx_rx_bytes_total{consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}",envoy_tcp_prefix="public_listener"}[10m]), "label", "Inbound", "__name__", ".*"))`
return this.fetchSeries(n,s).then(this.reformatSeries("bps",{Total:"Total bandwidth",Inbound:"Inbound data rate (data recieved) from the network in bits per second.",Outbound:"Outbound data rate (data transmitted) from the network in bits per second."}))},makeSubject:function(e,t,r,s){var n=`${r}/${e} (${t})`
return"upstream"==s?n+" &rarr; {{GROUP}}":"downstream"==s?"{{GROUP}} &rarr; "+n:n},makeHTTPSelector:function(e,t,r,s){if("downstream"==s)return`consul_destination_service="${e}",consul_destination_datacenter="${t}",consul_destination_namespace="${r}"`
var n=`consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}"`
return n+="upstream"==s?',envoy_http_conn_manager_prefix="upstream"':',envoy_http_conn_manager_prefix="public_listener"'},makeTCPSelector:function(e,t,r,s){if("downstream"==s)return`consul_destination_service="${e}",consul_destination_datacenter="${t}",consul_destination_namespace="${r}"`
var n=`consul_source_service="${e}",consul_source_datacenter="${t}",consul_source_namespace="${r}"`
return n+="upstream"==s?',envoy_tcp_prefix=~"upstream.*"':',envoy_tcp_prefix="public_listener"'},groupQuery:function(e,t){return"upstream"==e?t+=" by (consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace)":"downstream"==e&&(t+=" by (consul_source_service,consul_source_datacenter,consul_source_namespace)"),t},groupByInfix:function(e){return"upstream"==e?"upstream":"downstream"==e&&"source"},metricPrefixHTTP:function(e){return"downstream"==e?"envoy_cluster_upstream_rq":"envoy_http_downstream_rq"},metricPrefixTCP:function(e){return"downstream"==e?"envoy_cluster_upstream_cx":"envoy_tcp_downstream_cx"},fetchRPS:function(e,t,s,n){var a=this.makeHTTPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=`sum(rate(${this.metricPrefixHTTP(n)}_completed{${a}}[15m]))`
return this.fetchStat(this.groupQuery(n,i),"RPS",`<b>${c}</b> request rate averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchER:function(e,t,s,n){var a=this.makeHTTPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=""
"upstream"==n?i+=" by (consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace)":"downstream"==n&&(i+=" by (consul_source_service,consul_source_datacenter,consul_source_namespace)")
var u=this.metricPrefixHTTP(n),o=`sum(rate(${u}_xx{${a},envoy_response_code_class="5"}[15m]))${i}/sum(rate(${u}_xx{${a}}[15m]))${i}`
return this.fetchStat(o,"ER",`Percentage of <b>${c}</b> requests which were 5xx status over the last 15 minutes`,(function(e){return r(e)+"%"}),this.groupByInfix(n))},fetchPercentile:function(e,t,r,n,a){var c=this.makeHTTPSelector(t,r,n,a),i=this.makeSubject(t,r,n,a),u="le"
"upstream"==a?u+=",consul_upstream_service,consul_upstream_datacenter,consul_upstream_namespace":"downstream"==a&&(u+=",consul_source_service,consul_source_datacenter,consul_source_namespace")
var o=`histogram_quantile(${e/100}, sum by(${u}) (rate(${this.metricPrefixHTTP(a)}_time_bucket{${c}}[15m])))`
return this.fetchStat(o,"P"+e,`<b>${i}</b> ${e}th percentile request service time over the last 15 minutes`,s,this.groupByInfix(a))},fetchConnRate:function(e,t,s,n){var a=this.makeTCPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=`sum(rate(${this.metricPrefixTCP(n)}_total{${a}}[15m]))`
return this.fetchStat(this.groupQuery(n,i),"CR",`<b>${c}</b> inbound TCP connections per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceRx:function(e,t,s,n){var a=this.makeTCPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=`8 * sum(rate(${this.metricPrefixTCP(n)}_rx_bytes_total{${a}}[15m]))`
return this.fetchStat(this.groupQuery(n,i),"RX",`<b>${c}</b> received bits per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceTx:function(e,t,s,n){var a=this.makeTCPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i=`8 * sum(rate(${this.metricPrefixTCP(n)}_tx_bytes_total{${a}}[15m]))`
return this.fetchStat(this.groupQuery(n,i),"TX",`<b>${c}</b> transmitted bits per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchServiceNoRoute:function(e,t,s,n){var a=this.makeTCPSelector(e,t,s,n),c=this.makeSubject(e,t,s,n),i="_no_route"
"downstream"==n&&(i="_connect_fail")
var u=`sum(rate(${this.metricPrefixTCP(n)}${i}{${a}}[15m]))`
return this.fetchStat(this.groupQuery(n,u),"NR",`<b>${c}</b> unroutable (failed) connections per second averaged over the last 15 minutes`,r,this.groupByInfix(n))},fetchStat:function(e,t,r,s,n){n||(e+=" OR on() vector(0)")
var a={query:e,time:(new Date).getTime()/1e3}
return this.httpGet("/api/v1/query",a).then((function(e){if(!n){var a=parseFloat(e.data.result[0].value[1])
return{label:t,desc:r,value:isNaN(a)?"-":s(a)}}for(var c={},i=0;i<e.data.result.length;i++){var u=e.data.result[i],o=(a=parseFloat(u.value[1]),`${u.metric["consul_"+n+"_service"]}.${u.metric["consul_"+n+"_namespace"]}.${u.metric["consul_"+n+"_datacenter"]}`)
c[o]={label:t,desc:r.replace("{{GROUP}}",o),value:isNaN(a)?"-":s(a)}}return c}))},fetchSeries:function(e,t){var r={query:e,start:t.start,end:t.end,step:"10s",timeout:"8s"}
return this.httpGet("/api/v1/query_range",r)}}
function r(e){return e<1e3?Number.isInteger(e)?""+e:Number(e>=100?e.toPrecision(3):e<1?e.toFixed(2):e.toPrecision(2)):e>=1e3&&e<1e6?+(e/1e3).toPrecision(3)+"k":e>=1e6&&e<1e9?+(e/1e6).toPrecision(3)+"m":e>=1e9&&e<1e12?+(e/1e9).toPrecision(3)+"g":e>=1e12?+(e/1e12).toFixed(0)+"t":void 0}function s(e){if(e<1e3)return Math.round(e)+"ms"
var t=e/1e3
if(t<60)return t.toFixed(1)+"s"
var r=t/60
if(r<60)return r.toFixed(1)+"m"
var s=r/60
return s<24?s.toFixed(1)+"h":(s/24).toFixed(1)+"d"}window.consul.registerMetricsProvider("prometheus",t)})()

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

85
agent/uiserver/dist/index.html vendored Normal file

File diff suppressed because one or more lines are too long

19
agent/uiserver/dist/oidc/callback vendored Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Consul</title>
<script>
var CURRENT_REQUEST_KEY = '__torii_request';
var pendingRequestKey = window.localStorage.getItem(CURRENT_REQUEST_KEY);
if (pendingRequestKey) {
window.localStorage.removeItem(CURRENT_REQUEST_KEY);
var url = window.location.toString();
window.localStorage.setItem(pendingRequestKey, url);
}
window.close();
</script>
</head>
</html>

3
agent/uiserver/dist/robots.txt vendored Normal file
View File

@ -0,0 +1,3 @@
# http://www.robotstxt.org
User-agent: *
Disallow: /

19
agent/uiserver/dist/torii/redirect.html vendored Normal file
View File

@ -0,0 +1,19 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Torii OAuth Redirect</title>
<script>
var CURRENT_REQUEST_KEY = '__torii_request';
var pendingRequestKey = window.localStorage.getItem(CURRENT_REQUEST_KEY);
if (pendingRequestKey) {
window.localStorage.removeItem(CURRENT_REQUEST_KEY);
var url = window.location.toString();
window.localStorage.setItem(pendingRequestKey, url);
}
window.close();
</script>
</head>
</html>

View File

@ -1,21 +1,23 @@
package uiserver package uiserver
import "net/http" import (
"io/fs"
)
// redirectFS is an http.FS that serves the index.html file for any path that is // redirectFS is an fs.FS that serves the index.html file for any path that is
// not found on the underlying FS. // not found on the underlying FS.
// //
// TODO: it seems better to actually 404 bad paths or at least redirect them // TODO: it seems better to actually 404 bad paths or at least redirect them
// rather than pretend index.html is everywhere but this is behavior changing // rather than pretend index.html is everywhere but this is behavior changing
// so I don't want to take it on as part of this refactor. // so I don't want to take it on as part of this refactor.
type redirectFS struct { type redirectFS struct {
fs http.FileSystem fs fs.FS
} }
func (fs *redirectFS) Open(name string) (http.File, error) { func (fs *redirectFS) Open(name string) (fs.File, error) {
file, err := fs.fs.Open(name) file, err := fs.fs.Open(name)
if err != nil { if err != nil {
file, err = fs.fs.Open("/index.html") file, err = fs.fs.Open("index.html")
} }
return file, err return file, err
} }

View File

@ -2,9 +2,11 @@ package uiserver
import ( import (
"bytes" "bytes"
"embed"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io/ioutil" "io"
"io/fs"
"net/http" "net/http"
"os" "os"
"path" "path"
@ -22,8 +24,11 @@ const (
compiledProviderJSPath = "assets/compiled-metrics-providers.js" compiledProviderJSPath = "assets/compiled-metrics-providers.js"
) )
//go:embed dist
var dist embed.FS
// Handler is the http.Handler that serves the Consul UI. It may serve from the // Handler is the http.Handler that serves the Consul UI. It may serve from the
// compiled-in AssetFS or from and external dir. It provides a few important // embedded fs.FS or from an external directory. It provides a few important
// transformations on the index.html file and includes a proxy for metrics // transformations on the index.html file and includes a proxy for metrics
// backends. // backends.
type Handler struct { type Handler struct {
@ -87,15 +92,20 @@ func (h *Handler) ReloadConfig(newCfg *config.RuntimeConfig) error {
func (h *Handler) handleIndex() (http.Handler, error) { func (h *Handler) handleIndex() (http.Handler, error) {
cfg := h.getRuntimeConfig() cfg := h.getRuntimeConfig()
var fs http.FileSystem var fsys fs.FS
if cfg.UIConfig.Dir == "" { if cfg.UIConfig.Dir == "" {
fs = assetFS() // strip the dist/ prefix
sub, err := fs.Sub(dist, "dist")
if err != nil {
return nil, err
}
fsys = sub
} else { } else {
fs = http.Dir(cfg.UIConfig.Dir) fsys = os.DirFS(cfg.UIConfig.Dir)
} }
// Render a new index.html with the new config values ready to serve. // Render a new index.html with the new config values ready to serve.
buf, info, err := h.renderIndex(cfg, fs) buf, err := h.renderIndexFile(cfg, fsys)
if _, ok := err.(*os.PathError); ok && cfg.UIConfig.Dir != "" { if _, ok := err.(*os.PathError); ok && cfg.UIConfig.Dir != "" {
// A Path error indicates that there is no index.html. This could happen if // A Path error indicates that there is no index.html. This could happen if
// the user configured their own UI dir and is serving something that is not // the user configured their own UI dir and is serving something that is not
@ -105,24 +115,23 @@ func (h *Handler) handleIndex() (http.Handler, error) {
// breaking change although quite an edge case. Instead, continue but just // breaking change although quite an edge case. Instead, continue but just
// return a 404 response for the index.html and log a warning. // return a 404 response for the index.html and log a warning.
h.logger.Warn("ui_config.dir does not contain an index.html. Index templating and redirects to index.html are disabled.") h.logger.Warn("ui_config.dir does not contain an index.html. Index templating and redirects to index.html are disabled.")
return http.FileServer(fs), nil return http.FileServer(http.FS(fsys)), nil
} }
if err != nil { if err != nil {
return nil, err return nil, err
} }
// Create a new fs that serves the rendered index file or falls back to the // Create a new fsys that serves the rendered index file or falls back to the
// underlying FS. // underlying FS.
fs = &bufIndexFS{ fsys = &bufIndexFS{
fs: fs, fs: fsys,
indexRendered: buf, bufIndex: buf,
indexInfo: info,
} }
// Wrap the buffering FS our redirect FS. This needs to happen later so that // Wrap the buffering FS our redirect FS. This needs to happen later so that
// redirected requests for /index.html get served the rendered version not the // redirected requests for /index.html get served the rendered version not the
// original. // original.
return http.FileServer(&redirectFS{fs: fs}), nil return http.FileServer(http.FS(&redirectFS{fs: fsys})), nil
} }
// getRuntimeConfig is a helper to atomically access the runtime config. // getRuntimeConfig is a helper to atomically access the runtime config.
@ -186,33 +195,34 @@ func concatFile(buf *bytes.Buffer, file string) error {
return nil return nil
} }
func (h *Handler) renderIndex(cfg *config.RuntimeConfig, fs http.FileSystem) ([]byte, os.FileInfo, error) { func (h *Handler) renderIndexFile(cfg *config.RuntimeConfig, fsys fs.FS) (fs.File, error) {
// Open the original index.html // Open the original index.html
f, err := fs.Open("/index.html") f, err := fsys.Open("index.html")
if err != nil { if err != nil {
return nil, nil, err return nil, err
} }
defer f.Close() defer f.Close()
content, err := ioutil.ReadAll(f) content, err := io.ReadAll(f)
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("failed reading index.html: %w", err) return nil, fmt.Errorf("failed reading index.html: %w", err)
} }
info, err := f.Stat() info, err := f.Stat()
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("failed reading metadata for index.html: %w", err) return nil, fmt.Errorf("failed reading metadata for index.html: %w", err)
} }
// Create template data from the current config. // Create template data from the current config.
tplData, err := uiTemplateDataFromConfig(cfg) tplData, err := uiTemplateDataFromConfig(cfg)
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("failed loading UI config for template: %w", err) return nil, fmt.Errorf("failed loading UI config for template: %w", err)
} }
// Allow caller to apply additional data transformations if needed. // Allow caller to apply additional data transformations if needed.
if h.transform != nil { if h.transform != nil {
if err := h.transform(tplData); err != nil { if err := h.transform(tplData); err != nil {
return nil, nil, fmt.Errorf("failed running transform: %w", err) return nil, fmt.Errorf("failed running transform: %w", err)
} }
} }
@ -226,15 +236,16 @@ func (h *Handler) renderIndex(cfg *config.RuntimeConfig, fs http.FileSystem) ([]
}, },
}).Parse(string(content)) }).Parse(string(content))
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("failed parsing index.html template: %w", err) return nil, fmt.Errorf("failed parsing index.html template: %w", err)
} }
var buf bytes.Buffer var buf bytes.Buffer
err = tpl.Execute(&buf, tplData) err = tpl.Execute(&buf, tplData)
if err != nil { if err != nil {
return nil, nil, fmt.Errorf("failed to render index.html: %w", err) return nil, fmt.Errorf("failed to render index.html: %w", err)
} }
return buf.Bytes(), info, nil file := newBufferedFile(&buf, info)
return file, nil
} }

View File

@ -1,7 +1,4 @@
ARG GOLANG_VERSION=1.18.1 ARG GOLANG_VERSION=1.18.1
FROM golang:${GOLANG_VERSION} FROM golang:${GOLANG_VERSION}
RUN go install github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs@master
RUN go install github.com/hashicorp/go-bindata/go-bindata@master
WORKDIR /consul WORKDIR /consul

View File

@ -139,59 +139,14 @@ function build_ui {
# Copy UI over ready to be packaged into the binary # Copy UI over ready to be packaged into the binary
if test ${ret} -eq 0 if test ${ret} -eq 0
then then
rm -rf ${1}/pkg/web_ui rm -rf ${1}/agent/uiserver/dist
mkdir -p ${1}/pkg cp -r ${1}/ui/dist ${1}/agent/uiserver/
cp -r ${1}/ui/dist ${1}/pkg/web_ui
fi fi
popd > /dev/null popd > /dev/null
return $ret return $ret
} }
function build_assetfs {
# Arguments:
# $1 - Path to the top level Consul source
# $2 - The docker image to run the build within (optional)
#
# Returns:
# 0 - success
# * - error
#
# Note:
# The GIT_COMMIT and GIT_DIRTY environment variables will be used if present
if ! test -d "$1"
then
err "ERROR: '$1' is not a directory. build_assetfs must be called with the path to the top level source as the first argument'"
return 1
fi
local sdir="$1"
local image_name=${GO_BUILD_CONTAINER_DEFAULT}
if test -n "$2"
then
image_name="$2"
fi
pushd ${sdir} > /dev/null
status "Creating the Go Build Container with image: ${image_name}"
local container_id=$(docker create -it -e GIT_COMMIT=${GIT_COMMIT} -e GIT_DIRTY=${GIT_DIRTY} ${image_name} make static-assets ASSETFS_PATH=bindata_assetfs.go)
local ret=$?
if test $ret -eq 0
then
status "Copying the sources from '${sdir}/(pkg/web_ui|GNUmakefile)' to /consul/pkg"
(
tar -c pkg/web_ui GNUmakefile | docker cp - ${container_id}:/consul &&
status "Running build in container" && docker start -i ${container_id} &&
status "Copying back artifacts" && docker cp ${container_id}:/consul/bindata_assetfs.go ${sdir}/agent/uiserver/bindata_assetfs.go
)
ret=$?
docker rm ${container_id} > /dev/null
fi
popd >/dev/null
return $ret
}
function build_consul_post { function build_consul_post {
# Arguments # Arguments
# $1 - Path to the top level Consul source # $1 - Path to the top level Consul source

View File

@ -465,25 +465,17 @@ function build_release {
err "ERROR: Failed to build the ui" err "ERROR: Failed to build the ui"
return 1 return 1
fi fi
status "UI Built with Version: $(ui_version "${sdir}/pkg/web_ui/index.html")"
status_stage "==> Building Static Assets for version ${vers}"
build_assetfs "${sdir}" "${GO_BUILD_TAG}"
if test $? -ne 0
then
err "ERROR: Failed to build the static assets"
return 1
fi
if is_set "${do_tag}" if is_set "${do_tag}"
then then
git add "${sdir}/agent/uiserver/bindata_assetfs.go" git add "${sdir}/agent/uiserver/dist"
if test $? -ne 0 if test $? -ne 0
then then
err "ERROR: Failed to git add the assetfs file" err "ERROR: Failed to git add /agent/uiserver/dist directory"
return 1 return 1
fi fi
fi fi
status "UI Built with Version: $(ui_version "${sdir}/agent/uiserver/dist/index.html")"
fi fi
if is_set "${do_tag}" if is_set "${do_tag}"

View File

@ -9,7 +9,7 @@ source "${SCRIPT_DIR}/functions.sh"
function usage { function usage {
cat <<-EOF cat <<-EOF
Usage: ${SCRIPT_NAME} (consul|ui|static-assets) [<options ...>] Usage: ${SCRIPT_NAME} (consul|ui) [<options ...>]
Description: Description:
This script will build the various Consul components within docker containers This script will build the various Consul components within docker containers
@ -76,7 +76,7 @@ function main {
refresh=1 refresh=1
shift shift
;; ;;
consul | ui | static-assets ) consul | ui )
command="$1" command="$1"
shift shift
;; ;;
@ -104,16 +104,6 @@ function main {
status_stage "==> Building Consul" status_stage "==> Building Consul"
build_consul "${sdir}" "" "${image}" || return 1 build_consul "${sdir}" "" "${image}" || return 1
;; ;;
static-assets )
if is_set "${refresh}"
then
status_stage "==> Refreshing Consul build container image"
export GO_BUILD_TAG="${image:-${GO_BUILD_CONTAINER_DEFAULT}}"
refresh_docker_images "${sdir}" go-build-image || return 1
fi
status_stage "==> Building Static Assets"
build_assetfs "${sdir}" "${image}" || return 1
;;
ui ) ui )
if is_set "${refresh}" if is_set "${refresh}"
then then
@ -123,7 +113,7 @@ function main {
fi fi
status_stage "==> Building UI" status_stage "==> Building UI"
build_ui "${sdir}" "${image}" || return 1 build_ui "${sdir}" "${image}" || return 1
status "==> UI Built with Version: $(ui_version ${sdir}/pkg/web_ui/index.html), Logo: $(ui_logo_type ${sdir}/pkg/web_ui/index.html)" status "==> UI Built with Version: $(ui_version ${sdir}/agent/uiserver/dist/index.html), Logo: $(ui_logo_type ${sdir}/agent/uiserver/dist/index.html)"
;; ;;
* ) * )
err_usage "ERROR: Unknown command: '${command}'" err_usage "ERROR: Unknown command: '${command}'"

View File

@ -21,7 +21,6 @@ Description:
Options: Options:
-protobuf Just install tools for protobuf. -protobuf Just install tools for protobuf.
-lint Just install tools for linting. -lint Just install tools for linting.
-bindata Just install tools for static assets.
-h | --help Print this help text. -h | --help Print this help text.
EOF EOF
} }
@ -40,10 +39,6 @@ function main {
proto_tools_install proto_tools_install
return 0 return 0
;; ;;
-bindata )
bindata_install
return 0
;;
-lint ) -lint )
lint_install lint_install
return 0 return 0
@ -132,16 +127,6 @@ function lint_install {
'github.com/golangci/golangci-lint/cmd/golangci-lint' 'github.com/golangci/golangci-lint/cmd/golangci-lint'
} }
function bindata_install {
install_unversioned_tool \
'go-bindata' \
'github.com/hashicorp/go-bindata/go-bindata@bf7910a'
install_unversioned_tool \
'go-bindata-assetfs' \
'github.com/elazarl/go-bindata-assetfs/go-bindata-assetfs@38087fe'
}
function tools_install { function tools_install {
local mockery_version local mockery_version
@ -154,7 +139,6 @@ function tools_install {
'github.com/vektra/mockery/v2' 'github.com/vektra/mockery/v2'
lint_install lint_install
bindata_install
proto_tools_install proto_tools_install
return 0 return 0

View File

@ -20,7 +20,7 @@ Description:
* Update version/version*.go files * Update version/version*.go files
* Update CHANGELOG.md to put things into release mode * Update CHANGELOG.md to put things into release mode
* Create a release commit. It changes in the commit include the CHANGELOG.md * Create a release commit. It changes in the commit include the CHANGELOG.md
version files and the assetfs. version files.
* Tag the release * Tag the release
* Generate the SHA256SUMS file for the binaries * Generate the SHA256SUMS file for the binaries
* Sign the SHA256SUMS file with a GPG key * Sign the SHA256SUMS file with a GPG key
@ -35,7 +35,7 @@ Options:
release mode release mode
Defaults to 1. Defaults to 1.
-b | --build BOOL Whether to perform the build of the ui's, assetfs and -b | --build BOOL Whether to perform the build of the ui's and
binaries. Defaults to 1. binaries. Defaults to 1.
-S | --sign BOOL Whether to sign the generated SHA256SUMS file. -S | --sign BOOL Whether to sign the generated SHA256SUMS file.

1
go.mod
View File

@ -17,7 +17,6 @@ require (
github.com/coredns/coredns v1.1.2 github.com/coredns/coredns v1.1.2
github.com/coreos/go-oidc v2.1.0+incompatible github.com/coreos/go-oidc v2.1.0+incompatible
github.com/docker/go-connections v0.3.0 github.com/docker/go-connections v0.3.0
github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0
github.com/envoyproxy/go-control-plane v0.10.1 github.com/envoyproxy/go-control-plane v0.10.1
github.com/fsnotify/fsnotify v1.5.1 github.com/fsnotify/fsnotify v1.5.1
github.com/golang/protobuf v1.5.0 github.com/golang/protobuf v1.5.0

2
go.sum
View File

@ -159,8 +159,6 @@ github.com/docker/go-connections v0.3.0 h1:3lOnM9cSzgGwx8VfK/NGOW5fLQ0GjIlCkaktF
github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-connections v0.3.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec=
github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM=
github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk=
github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0 h1:ZoRgc53qJCfSLimXqJDrmBhnt5GChDsExMCK7t48o0Y=
github.com/elazarl/go-bindata-assetfs v0.0.0-20160803192304-e1a2a7ec64b0/go.mod h1:v+YaWX3bdea5J/mo8dSETolEo7R71Vk1u8bnjau5yw4=
github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc= github.com/elazarl/goproxy v0.0.0-20180725130230-947c36da3153/go.mod h1:/Zj4wYkgs4iZTTu3o/KG3Itv/qCCa8VVMlb3i9OVuzc=
github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs= github.com/emicklei/go-restful v0.0.0-20170410110728-ff4f55a20633/go.mod h1:otzb+WCGbkyDHkqmQmT5YD2WR4BBwUdeQoFo8l/7tVs=
github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4=