Version Description
Download this release
Release Info
Developer | nko |
Plugin | Visual Portfolio, Photo Gallery & Post Grid |
Version | 1.11.0 |
Comparing to | |
See all releases |
Code changes from version 1.10.0 to 1.11.0
- assets/admin/css/style.min.css +2 -2
- assets/admin/js/gutenberg-block.min.js +2 -2
- assets/admin/js/mce-dropdown.min.js +2 -2
- assets/admin/js/mce-localize.min.js +1 -1
- assets/admin/js/script.min.js +3 -3
- assets/admin/js/vc-frontend.min.js +2 -2
- assets/css/noscript.min.css +5 -0
- assets/css/style.min.css +2 -2
- assets/js/lazysizes-object-fit-cover.min.js +1 -1
- assets/js/script-preview.min.js +3 -3
- assets/js/script.min.js +3 -3
- assets/vendor/codemirror/addon/comment/comment.js +1 -1
- assets/vendor/codemirror/addon/comment/continuecomment.js +1 -1
- assets/vendor/codemirror/addon/dialog/dialog.js +1 -1
- assets/vendor/codemirror/addon/edit/closebrackets.js +6 -9
- assets/vendor/codemirror/addon/edit/closetag.js +1 -1
- assets/vendor/codemirror/addon/edit/continuelist.js +11 -1
- assets/vendor/codemirror/addon/edit/matchbrackets.js +11 -6
- assets/vendor/codemirror/addon/edit/matchtags.js +1 -1
- assets/vendor/codemirror/addon/edit/trailingspace.js +1 -1
- assets/vendor/codemirror/addon/fold/brace-fold.js +2 -2
- assets/vendor/codemirror/addon/fold/comment-fold.js +1 -1
- assets/vendor/codemirror/addon/fold/foldcode.js +1 -1
- assets/vendor/codemirror/addon/fold/foldgutter.js +1 -1
- assets/vendor/codemirror/addon/fold/indent-fold.js +1 -1
- assets/vendor/codemirror/addon/fold/markdown-fold.js +1 -1
- assets/vendor/codemirror/addon/fold/xml-fold.js +1 -1
- assets/vendor/codemirror/addon/hint/anyword-hint.js +1 -1
- assets/vendor/codemirror/addon/hint/css-hint.js +1 -1
- assets/vendor/codemirror/addon/hint/html-hint.js +3 -1
- assets/vendor/codemirror/addon/hint/javascript-hint.js +1 -1
- assets/vendor/codemirror/addon/hint/show-hint.js +25 -10
- assets/vendor/codemirror/addon/hint/sql-hint.js +24 -19
- assets/vendor/codemirror/addon/hint/xml-hint.js +12 -6
- assets/vendor/codemirror/addon/lint/coffeescript-lint.js +1 -1
- assets/vendor/codemirror/addon/lint/css-lint.js +1 -1
- assets/vendor/codemirror/addon/lint/html-lint.js +1 -1
- assets/vendor/codemirror/addon/lint/javascript-lint.js +1 -1
- assets/vendor/codemirror/addon/lint/json-lint.js +1 -1
- assets/vendor/codemirror/addon/lint/lint.js +1 -1
- assets/vendor/codemirror/addon/lint/yaml-lint.js +2 -2
- assets/vendor/codemirror/addon/scroll/annotatescrollbar.js +1 -1
- assets/vendor/codemirror/addon/scroll/scrollpastend.js +1 -1
- assets/vendor/codemirror/addon/scroll/simplescrollbars.js +1 -1
- assets/vendor/codemirror/addon/search/jump-to-line.js +5 -4
- assets/vendor/codemirror/addon/search/match-highlighter.js +1 -1
- assets/vendor/codemirror/addon/search/matchesonscrollbar.js +1 -1
- assets/vendor/codemirror/addon/search/search.js +20 -14
- assets/vendor/codemirror/addon/search/searchcursor.js +1 -1
- assets/vendor/codemirror/codemirror.js +6789 -6765
assets/admin/css/style.min.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*!
|
2 |
* Name : Visual Portfolio
|
3 |
-
* Version : 1.
|
4 |
* Author : nK https://nkdev.info
|
5 |
-
*/.dashicons-visual-portfolio,.dashicons-visual-portfolio-gray,.mce-widget .mce-i-visual-portfolio{background-image:url("../images/icon.svg");background-repeat:no-repeat;background-position:center center;background-size:15px;opacity:.6}.mce-widget .mce-i-visual-portfolio{background-image:url("../images/icon-mce.svg");opacity:1}.menu-top.current .dashicons-visual-portfolio,.menu-top:hover .dashicons-visual-portfolio,.wp-has-current-submenu .dashicons-visual-portfolio{opacity:1}.dashicons-visual-portfolio-gray,.mce-i-visual-portfolio-gray{background-image:url("../images/icon-gray.svg")}.vc_element-icon[data-is-container="true"].icon-visual-portfolio,.vc_element-icon.icon-visual-portfolio{background-position:50% 50%}.vc_element-icon.icon-visual-portfolio,.vc_control-visual-portfolio{position:relative;overflow:hidden;background-image:url("../images/icon-vc.png");background-position:50% 50%;background-size:cover;border-radius:3px}.vc_add-element-container .icon-visual-portfolio{position:absolute}.vc_control-visual-portfolio{display:inline-block;width:18px;height:18px;margin:0 2px;cursor:pointer}.vc_controls-row .vc_control-visual-portfolio{float:right;margin:4px}.vc_control-visual-portfolio-overlay{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2}.vp-row{display:flex;flex:0 1 auto;flex-direction:row;flex-wrap:wrap;box-sizing:border-box;margin-right:-15px;margin-left:-15px}.vp-col-1,.vp-col-2,.vp-col-3,.vp-col-4,.vp-col-5,.vp-col-6,.vp-col-7,.vp-col-8,.vp-col-9,.vp-col-10,.vp-col-11,.vp-col-12{flex:0 0 auto;box-sizing:border-box;padding-right:15px;padding-left:15px}.vp-col-1{flex-basis:8.33333%;max-width:8.33333%}.vp-col-2{flex-basis:16.66667%;max-width:16.66667%}.vp-col-3{flex-basis:25%;max-width:25%}.vp-col-4{flex-basis:33.33333%;max-width:33.33333%}.vp-col-5{flex-basis:41.66667%;max-width:41.66667%}.vp-col-6{flex-basis:50%;max-width:50%}.vp-col-7{flex-basis:58.33333%;max-width:58.33333%}.vp-col-8{flex-basis:66.66667%;max-width:66.66667%}.vp-col-9{flex-basis:75%;max-width:75%}.vp-col-10{flex-basis:83.33333%;max-width:83.33333%}.vp-col-11{flex-basis:91.66667%;max-width:91.66667%}.vp-col-12{flex-basis:100%;max-width:100%}.vp-col-clearfix{flex-basis:100%;max-width:100%}.vp-col-clearfix .vp-control-html{margin-bottom:0}.post-type-vp_lists.post-php,.post-type-vp_lists.post-new-php{background-color:#edeff0}.post-type-vp_lists.post-php #wpcontent,.post-type-vp_lists.post-new-php #wpcontent{padding-left:0}.post-type-vp_lists.post-php .wrap,.post-type-vp_lists.post-new-php .wrap{margin:0}.post-type-vp_lists.post-php #poststuff,.post-type-vp_lists.post-new-php #poststuff{padding-top:0}.post-type-vp_lists.post-php #wpfooter,.post-type-vp_lists.post-new-php #wpfooter{display:none}.post-type-vp_lists.post-php #wpbody-content,.post-type-vp_lists.post-new-php #wpbody-content{padding-bottom:0}.post-type-vp_lists.post-php #post-body.columns-2 #postbox-container-1,.post-type-vp_lists.post-new-php #post-body.columns-2 #postbox-container-1{position:fixed;top:0;right:300px;bottom:0;width:300px;overflow:auto;-webkit-overflow-scrolling:touch}html.wp-toolbar .post-type-vp_lists.post-php #post-body.columns-2 #postbox-container-1,html.wp-toolbar .post-type-vp_lists.post-new-php #post-body.columns-2 #postbox-container-1{top:32px}@media only screen and (max-width: 850px){.post-type-vp_lists.post-php #post-body.columns-2 #postbox-container-1,.post-type-vp_lists.post-new-php #post-body.columns-2 #postbox-container-1{position:relative;top:auto;right:auto;bottom:auto;width:100%;margin-right:0}}.post-type-vp_lists.post-php #postbox-container-2,.post-type-vp_lists.post-new-php #postbox-container-2{position:absolute;top:0;right:0;bottom:0;left:0;width:calc(100% - 300px);min-height:calc(100vh - 32px);overflow:auto;-webkit-overflow-scrolling:touch}@media only screen and (max-width: 850px){.post-type-vp_lists.post-php #postbox-container-2,.post-type-vp_lists.post-new-php #postbox-container-2{right:0;bottom:auto;width:100%}}.post-type-vp_lists.post-php .columns-2 #side-sortables,.post-type-vp_lists.post-new-php .columns-2 #side-sortables{width:auto}.post-type-vp_lists.post-php .notice,.post-type-vp_lists.post-new-php .notice{margin:0;margin-right:300px;margin-bottom:1px}@media only screen and (max-width: 850px){.post-type-vp_lists.post-php .notice,.post-type-vp_lists.post-new-php .notice{margin-right:0}}.post-type-vp_lists.post-php #poststuff .postbox,.post-type-vp_lists.post-new-php #poststuff .postbox{margin-bottom:0;border-color:#e2e4e7;border-top:0;border-right:0}.post-type-vp_lists.post-php #poststuff .postbox>h2,.post-type-vp_lists.post-new-php #poststuff .postbox>h2{padding:15px;border-bottom:none}.post-type-vp_lists.post-php #poststuff .postbox>.handlediv,.post-type-vp_lists.post-new-php #poststuff .postbox>.handlediv{height:50px}.post-type-vp_lists.post-php #poststuff .postbox>.inside,.post-type-vp_lists.post-new-php #poststuff .postbox>.inside{padding:15px;padding-top:0}.vp-control{display:flex;flex-wrap:wrap;align-items:center;margin-bottom:19px}.vp-control>label{width:100%;margin-bottom:5px}.vp-control>.vp-control-description{width:100%;margin:2px 0 5px;font-size:13px;font-style:italic;color:#666}.vp-control.vp-control-checkbox,.vp-control.vp-control-toggle{flex-wrap:nowrap}.vp-control.vp-control-checkbox>label,.vp-control.vp-control-toggle>label{margin-bottom:0}.vp-control.vp-control-textarea textarea{width:100%}.vp-image-picker{display:none}.vp-image-picker,.vp-image-picker *{box-sizing:border-box}.vp-image-picker+ul.thumbnails.image_picker_selector li{margin:0 10px 10px 0}.vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail{padding:0;cursor:pointer;border:none}.vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail img{display:block;border:2px solid transparent}.vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail.selected{background-color:transparent}.vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail.selected img{border-color:#0073aa}.vp-image-picker+ul.thumbnails.image_picker_selector .group_title{padding-top:5px;padding-left:5px;font-weight:500}.vp-control-range [type="number"]{width:50px;margin-left:10px}.vp-control-range [type="range"]{flex:1;width:100%;padding:0;background:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vp-control-range [type="range"]::-webkit-slider-thumb{box-sizing:border-box;width:18px;height:18px;margin-top:-7px;cursor:pointer;background:#555d66;background-clip:padding-box;border:4px solid transparent;border-radius:50%;-webkit-appearance:none;appearance:none}.vp-control-range [type="range"]::-moz-range-thumb{box-sizing:border-box;width:18px;height:18px;cursor:pointer;background:#555d66;background-clip:padding-box;border:4px solid transparent;border-radius:50%}.vp-control-range [type="range"]::-ms-thumb{box-sizing:border-box;width:14px;height:14px;margin-top:0;cursor:pointer;background:#555d66;background-clip:padding-box;border:2px solid transparent;border-radius:50%}.vp-control-range [type="range"]:focus{outline:none}.vp-control-range [type="range"]:focus::-webkit-slider-thumb{color:#191e23;background-color:#fff;outline:2px solid transparent;outline-offset:-2px;box-shadow:inset 0 0 0 1px #6c7781, inset 0 0 0 2px #fff}.vp-control-range [type="range"]:focus::-moz-range-thumb{color:#191e23;background-color:#fff;outline:2px solid transparent;outline-offset:-2px;box-shadow:inset 0 0 0 1px #6c7781, inset 0 0 0 2px #fff}.vp-control-range [type="range"]:focus::-ms-thumb{color:#191e23;background-color:#fff;outline:2px solid transparent;outline-offset:-2px;box-shadow:inset 0 0 0 1px #6c7781, inset 0 0 0 2px #fff}.vp-control-range [type="range"]::-webkit-slider-runnable-track{height:3px;margin-top:-4px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.vp-control-range [type="range"]::-moz-range-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.vp-control-range [type="range"]::-ms-track{height:3px;margin-top:-4px;color:transparent;cursor:pointer;background:#e2e4e7;border-color:transparent;border-radius:1.5px}.vp-control-toggle,.vp-control-toggle *{box-sizing:border-box}.vp-control-toggle .vp-toggle{position:relative}.vp-control-toggle .vp-toggle .vp-toggle__track{content:"";display:inline-block;box-sizing:border-box;width:36px;height:18px;vertical-align:top;background-color:#fff;border:2px solid #6c7781;border-radius:9px;transition:background .2s ease}.vp-control-toggle .vp-toggle .vp-toggle__track::after{content:"";position:absolute;display:block;top:50%;right:5px;width:3px;height:3px;margin-top:-3px;border:1.5px solid #6c7781;border-radius:3px}.vp-control-toggle .vp-toggle:hover .vp-toggle__track{background-color:#e2e4e7}.vp-control-toggle .vp-toggle [type="checkbox"]:checked ~ .vp-toggle__track{background-color:#33b3db;border:2px solid #33b3db}.vp-control-toggle .vp-toggle [type="checkbox"]:checked ~ .vp-toggle__track::after{top:50%;right:auto;left:8px;width:0;height:5px;margin-top:-3px;border:0;border-right:2px solid #fff;border-radius:0}.vp-control-toggle .vp-toggle .vp-toggle__thumb{position:absolute;display:block;top:4px;left:4px;width:10px;height:10px;background-color:#6c7781;border:5px solid #6c7781;border-radius:50%;transition:-webkit-transform .1s ease;transition:transform .1s ease;transition:transform .1s ease, -webkit-transform .1s ease}.vp-control-toggle .vp-toggle [type="checkbox"]:focus ~ .vp-toggle__track{box-shadow:0 0 0 2px #fff, 0 0 0 3px #6c7781}.vp-control-toggle .vp-toggle [type="checkbox"]:checked ~ .vp-toggle__thumb{background-color:#fff;border-width:0;-webkit-transform:translateX(18px);transform:translateX(18px)}.vp-control-toggle .vp-toggle [type="checkbox"]{position:absolute;top:0;left:0;width:100%;height:100%;padding:0;margin:0;opacity:0;z-index:1}.vp-control-image-dropdown{position:relative;display:flex;align-items:center;width:100%;padding:5px 7px;cursor:pointer;background-color:#fff;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,0.07)}.vp-control-image-dropdown,.vp-control-image-dropdown *{box-sizing:border-box}.vp-control-image-dropdown::before{content:"";position:absolute;display:block;top:50%;right:6px;width:0;height:0;margin-top:-2px;border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px}.vp-control-image-dropdown.active::before{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.vp-control-image-dropdown .vp-control-image-dropdown__preview{display:block;flex:0 0 auto;width:32px}.vp-control-image-dropdown .vp-control-image-dropdown__preview img{display:block;width:100%;height:auto}.vp-control-image-dropdown .vp-control-image-dropdown__title{flex:1;padding-left:10px}.vp-control-image-dropdown .vp-control-image-dropdown__content{position:absolute;display:none;top:100%;left:0;width:100%;max-width:285px;margin-top:7px;margin-left:-1px;cursor:default;background-color:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,0.04);z-index:1}.vp-control-image-dropdown .vp-control-image-dropdown__content>div{width:100%;max-height:250px;padding:4px;overflow:auto}.vp-control-image-dropdown .vp-control-image-dropdown__content::before{content:"";position:absolute;display:block;top:-5px;left:10px;width:0;height:0;border-right:5px solid transparent;border-bottom:5px solid #e5e5e5;border-left:5px solid transparent}.vp-control-image-dropdown .vp-control-image-dropdown__content::after{content:"";position:absolute;display:block;top:-7px;right:0;left:0;height:7px}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector,.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector .group>ul{display:flex;flex-wrap:wrap}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li{display:block;flex:0 0 25%;float:none;max-width:25%;margin:0}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li.group,.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li.group_title{flex:0 0 100%;max-width:100%}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail{padding:3px}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li img{width:100%;height:auto}.vp-control-image-dropdown.active .vp-control-image-dropdown__content{display:block}.vp-oembed-preview{position:relative;width:100%;padding-top:56.25%;color:#a2a2a2;background-color:#f1f1f1;border:1px solid #e8e8e8}.vp-oembed-preview::after{content:"\f126";position:absolute;display:block;top:50%;left:50%;width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:dashicons;font-size:20px;font-style:normal;font-weight:400;line-height:1;text-align:center;text-decoration:inherit;vertical-align:top;z-index:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.vp-oembed-preview>iframe{position:absolute;top:0;left:0;width:100%;height:100%;z-index:2}.vp-portfolio__thumbnail{position:relative;display:block;max-width:70px;padding-top:100%;overflow:hidden;border-radius:3px}.vp-portfolio__thumbnail img{position:absolute;display:block;top:0;left:0;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.vp-portfolio__thumbnail:empty{background-color:#f1f1f1;border:1px solid #e8e8e8}.vp-portfolio__thumbnail:empty,.vp-portfolio__thumbnail:empty:hover,.vp-portfolio__thumbnail:empty:active,.vp-portfolio__thumbnail:empty:focus{color:#a2a2a2}.vp-portfolio__thumbnail:empty::after{content:"\f128";position:absolute;display:block;top:50%;left:50%;width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:dashicons;font-size:20px;font-style:normal;font-weight:400;line-height:1;text-align:center;text-decoration:inherit;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-list-table th.column-portfolio_post_thumbs{width:70px}.wp-list-table th.column-vp_lists_post_shortcode{width:250px}@media screen and (max-width: 782px){.wp-list-table th.column-portfolio_post_thumbs{display:none}.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-portfolio_post_thumbs{float:left;width:70px !important;min-width:70px}.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-portfolio_post_thumbs::before{content:none}.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-title{overflow:hidden;clear:right}}.vp-portfolio-list .vp-portfolio-list__icon span{display:block;width:120px;height:120px;margin:0 auto;margin-top:60px;background-size:105px}.vp-portfolio-list .vp-portfolio-list__text{text-align:center}.vp-portfolio-list .vp-portfolio-list__text p{margin-top:30px;margin-bottom:30px;font-size:15px;font-weight:500;color:#8e8e8e}.vp-portfolio-list .vp-portfolio-list__text .button-hero{display:inline-block}.vp_list_preview{padding:0 12px;margin-right:-12px;margin-left:-12px}.vp_list_preview iframe{width:100%;min-height:120px;transition:height .3s}.vp-content-source{display:flex;flex-wrap:wrap;padding-right:9px;padding-left:9px;margin-right:-15px;margin-left:-15px}.vp-content-source .vp-content-source__item{position:relative;width:70px;height:50px;padding:12px;margin:0 5px;color:#6c7781;text-align:center;cursor:pointer;border:1px solid transparent;border-radius:3px}.vp-content-source .vp-content-source__item.active,.vp-content-source .vp-content-source__item:hover{color:#555;background-color:#ecf0f4}.vp-content-source .vp-content-source__item.active{color:#fff;background-color:#6c7781;border-color:#6c7781}.vp-content-source .vp-content-source__item .vp-content-source__item-icon>span{width:24px;height:24px;margin-top:2px;font-size:24px}.vp-content-source .vp-content-source__item .vp-content-source__item-title{position:absolute;top:58%;right:8px;left:8px;font-weight:500}.vp-content-source .vp-content-source__item-content{flex:1;min-width:100%}.vp-content-source .vp-content-source__item-content>div{position:relative;display:none;padding:0 15px;padding-bottom:1px;margin-top:12px;margin-right:-9px;margin-bottom:-14px;margin-left:-9px;overflow:hidden;background-color:#f9f9fa;border-top:1px solid #eee}.vp-content-source .vp-content-source__item-content>div:empty{display:none !important}.vp-content-source .vp-content-source__item-content>div.active{display:block}.vp-select2{width:100%}.vp-select2+.select2{width:100%}.post-attributes-label+.vp-select2+.select2{margin-top:5px}.vp-select2+.select2 ul,.vp-select2+.select2 li{margin-bottom:0}.vp-select2+.select2 .select2-selection{border:1px solid #ddd;border-radius:0;box-shadow:inset 0 1px 2px rgba(0,0,0,0.07)}.vp-select2+.select2.select2-container--open .select2-selection{outline:none}.vp-select2+.select2 .select2-selection--multiple{min-height:27px}.vp-select2+.select2 .select2-selection--multiple .select2-selection__choice{padding:3px 8px;margin-top:3px;color:#fff;background-color:#6c7781;border-color:#6c7781}.vp-select2+.select2 .select2-selection--multiple .select2-selection__choice__remove{float:right;margin-right:0;margin-left:3px;color:inherit;opacity:.5}.select2-vp-container ul,.select2-vp-container li{margin-bottom:0}.select2-vp-container .select2-dropdown{border-color:#ddd}.select2-vp-container .select2-search--dropdown .select2-search__field{padding:3px 4px;border:1px solid #ddd;outline:none;box-shadow:none}.select2-vp-container .select2-results__option[aria-selected="true"]{background-color:#efeeee}.select2-vp-container .select2-results__option--highlighted[aria-selected]{background-color:#33b3db}.vp-select2-ajax__result{display:flex;flex:0 1 auto;flex-direction:row;flex-wrap:wrap}.vp-select2-ajax__result .vp-select2-ajax__result-img{position:relative;flex:0 0 35px;background-color:rgba(0,0,0,0.1);background-position:center center;background-size:cover;border-radius:3px}.vp-select2-ajax__result .vp-select2-ajax__result-img::after{content:"";display:block;width:100%;padding-top:100%}.vp-select2-ajax__result .vp-select2-ajax__result-data{padding-left:10px}.vp-select2-ajax__result .vp-select2-ajax__result-title{font-size:16px;font-weight:500;line-height:1}.vp-select2-ajax__result .vp-select2-ajax__result-post-type{font-size:12px;opacity:.5}.vp-control-gallery{position:relative;border-bottom:1px solid #eaeaea}.vp-control-gallery .vp-control-gallery-additional-data{position:absolute;box-sizing:border-box;top:-15px;right:-365px;bottom:0;width:350px;padding:15px 13px;overflow:auto;background-color:#fff;border-left:1px solid #eaeaea;transition:.15s right}.vp-control-gallery .vp-control-gallery-additional-data.active{right:-15px}.vp-control-gallery .vp-control-gallery-additional-data.active+.vp-control-gallery-items{margin-right:335px}@media (max-width: 910px){.vp-control-gallery .vp-control-gallery-additional-data{position:relative;display:none;right:0;width:120%;height:auto;margin-bottom:30px;border:1px solid #eaeaea}.vp-control-gallery .vp-control-gallery-additional-data.active{display:block}.vp-control-gallery .vp-control-gallery-additional-data.active+.vp-control-gallery-items{margin-right:-15px}}.vp-control-gallery .vp-control-gallery-additional-data .vp-control-gallery-additional-data-preview{display:flex;padding:15px 13px;margin:-15px -13px;margin-bottom:15px;border-bottom:1px solid #eaeaea}.vp-control-gallery .vp-control-gallery-additional-data .vp-control-gallery-additional-data-preview .vp-control-gallery-additional-data-preview-image{margin-right:15px}.vp-control-gallery .vp-control-gallery-additional-data .vp-control-gallery-additional-data-preview .vp-control-gallery-additional-data-preview-image img{display:block;width:70px;border-radius:3px;box-shadow:0 0 0 1px #fff, 0 0 0 2px #eaeaea}.vp-control-gallery .vp-control-gallery-additional-data .vp-control-gallery-additional-data-preview .vp-control-gallery-additional-data-preview-size{color:#8f9498}.vp-control-gallery .vp-control-gallery-items{display:flex;flex-wrap:wrap;align-content:flex-start;width:120%;height:325px;padding:7px;margin:-12px;margin-bottom:-25px;overflow:auto;transition:.15s margin-right}.vp-control-gallery .vp-control-gallery-items::after{content:"";display:block;width:100%}.vp-control-gallery .vp-control-gallery-items>div{position:relative;display:block;width:calc(12.5% - 10px);margin:5px;cursor:move;cursor:-webkit-grab;cursor:grab;border-radius:3px}@media (max-width: 1350px){.vp-control-gallery .vp-control-gallery-items>div{width:calc(14.22% - 10px)}}@media (max-width: 1250px){.vp-control-gallery .vp-control-gallery-items>div{width:calc(16.66% - 10px)}}@media (max-width: 1100px){.vp-control-gallery .vp-control-gallery-items>div{width:calc(25% - 10px)}}.vp-control-gallery .vp-control-gallery-items>div::after{content:"";display:block;padding-top:100%}.vp-control-gallery .vp-control-gallery-items>div.sortable-ghost{opacity:.4}.vp-control-gallery .vp-control-gallery-items>div img{position:absolute;display:block;top:0;left:0;width:100%;height:100%;-o-object-fit:cover;object-fit:cover;border-radius:3px}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-img .vp-control-gallery-items-remove{position:absolute;top:-5px;right:-5px;width:20px;height:20px;color:#fff;cursor:pointer;visibility:hidden;background-color:#dc3232;border-radius:50%;opacity:0;transition:.15s visibility, .15s opacity}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-img .vp-control-gallery-items-remove span{width:20px;height:20px;font-size:10px;line-height:20px}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-img:hover .vp-control-gallery-items-remove{visibility:visible;opacity:1}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-img.active{box-shadow:0 0 0 1px #fff, 0 0 0 4px #33b3db}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-add{display:flex;align-items:center;justify-content:center;box-sizing:border-box;color:#6c7781;text-align:center;cursor:pointer;background-color:#fff;border:1px solid #ccd3da;border-radius:3px}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-add>span{position:absolute;top:50%;left:50%;width:24px;height:24px;margin-top:-12px;margin-left:-12px;line-height:24px}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-add:hover{color:#555;background-color:#f7f7f7}.vp-input{width:100%}.post-type-vp_lists .CodeMirror{width:100%;text-align:left;border:1px solid #ddd}.post-type-vp_lists .CodeMirror .CodeMirror-matchingbracket{color:inherit;background:rgba(255,150,0,0.3)}.post-type-vp_lists [class*="CodeMirror-lint-message"],.post-type-vp_lists .CodeMirror-lint-marker-multiple,.post-type-vp_lists [class*="CodeMirror-lint-marker"]{background-image:none}.post-type-vp_lists .CodeMirror-lint-marker-error,.post-type-vp_lists .CodeMirror-lint-marker-warning{cursor:help}.post-type-vp_lists .CodeMirror-lint-marker-multiple{position:absolute;top:0}.post-type-vp_lists [class*="CodeMirror-lint-marker"]::before{position:relative;top:-2px;font:400 18px/1 dashicons}.post-type-vp_lists [class*="CodeMirror-lint-message"]::before{position:absolute;left:16px;font:400 16px/1 dashicons}.post-type-vp_lists .CodeMirror-lint-message-error,.post-type-vp_lists .CodeMirror-lint-message-warning{padding:3px 12px 3px 28px;margin:5px 0 2px;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1)}.post-type-vp_lists .CodeMirror-lint-message-warning{background-color:#fff8e5;border-left:4px solid #ffb900}.post-type-vp_lists .CodeMirror-lint-message-warning::before,.post-type-vp_lists .CodeMirror-lint-marker-warning::before{content:"\f534";color:#f6a306}.post-type-vp_lists .CodeMirror-lint-message-error{background-color:#fbeaea;border-left:4px solid #dc3232}.post-type-vp_lists .CodeMirror-lint-message-error::before,.post-type-vp_lists .CodeMirror-lint-marker-error::before{content:"\f153";color:#dc3232}.post-type-vp_lists .CodeMirror-lint-tooltip{background:0 0;border:none;border-radius:0;direction:ltr}.post-type-vp_lists .CodeMirror-resizer{display:none;display:flex;align-items:center;justify-content:center;width:100%;height:20px;margin-top:-2px;font-size:13px;cursor:row-resize;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fbfbfb}.post-type-vp_lists .CodeMirror-resizer::before{content:"\2261";position:absolute;left:50%;color:#999}.post-type-vp_lists .CodeMirror-resizer:hover{background:#f7f7f7}.post-type-vp_lists .CodeMirror-resizer:hover::before{color:#000}.post-type-vp_lists .CodeMirror ~ .CodeMirror-resizer{display:block}@media (max-width: 850px){.vp-steps__right,.vp-steps__step{float:none;width:100%}}.post-type-vp_lists #slugdiv,.post-type-vp_lists #postcustom{display:none}
|
1 |
/*!
|
2 |
* Name : Visual Portfolio
|
3 |
+
* Version : 1.11.0
|
4 |
* Author : nK https://nkdev.info
|
5 |
+
*/.dashicons-visual-portfolio,.dashicons-visual-portfolio-gray,.mce-widget .mce-i-visual-portfolio{background-image:url("../images/icon.svg");background-repeat:no-repeat;background-position:center center;background-size:15px;opacity:.6}.mce-widget .mce-i-visual-portfolio{background-image:url("../images/icon-mce.svg");opacity:1}.menu-top.current .dashicons-visual-portfolio,.menu-top:hover .dashicons-visual-portfolio,.wp-has-current-submenu .dashicons-visual-portfolio{opacity:1}.dashicons-visual-portfolio-gray,.mce-i-visual-portfolio-gray{background-image:url("../images/icon-gray.svg")}.vc_element-icon[data-is-container="true"].icon-visual-portfolio,.vc_element-icon.icon-visual-portfolio{background-position:50% 50%}.vc_element-icon.icon-visual-portfolio,.vc_control-visual-portfolio{position:relative;overflow:hidden;background-image:url("../images/icon-vc.png");background-position:50% 50%;background-size:cover;border-radius:3px}.vc_add-element-container .icon-visual-portfolio{position:absolute}.vc_control-visual-portfolio{display:inline-block;width:18px;height:18px;margin:0 2px;cursor:pointer}.vc_controls-row .vc_control-visual-portfolio{float:right;margin:4px}.vc_control-visual-portfolio-overlay{position:absolute;top:0;right:0;bottom:0;left:0;z-index:2}.vp-row{display:flex;flex:0 1 auto;flex-direction:row;flex-wrap:wrap;box-sizing:border-box;margin-right:-15px;margin-left:-15px}.vp-col-1,.vp-col-2,.vp-col-3,.vp-col-4,.vp-col-5,.vp-col-6,.vp-col-7,.vp-col-8,.vp-col-9,.vp-col-10,.vp-col-11,.vp-col-12{flex:0 0 auto;box-sizing:border-box;padding-right:15px;padding-left:15px}.vp-col-1{flex-basis:8.33333%;max-width:8.33333%}.vp-col-2{flex-basis:16.66667%;max-width:16.66667%}.vp-col-3{flex-basis:25%;max-width:25%}.vp-col-4{flex-basis:33.33333%;max-width:33.33333%}.vp-col-5{flex-basis:41.66667%;max-width:41.66667%}.vp-col-6{flex-basis:50%;max-width:50%}.vp-col-7{flex-basis:58.33333%;max-width:58.33333%}.vp-col-8{flex-basis:66.66667%;max-width:66.66667%}.vp-col-9{flex-basis:75%;max-width:75%}.vp-col-10{flex-basis:83.33333%;max-width:83.33333%}.vp-col-11{flex-basis:91.66667%;max-width:91.66667%}.vp-col-12{flex-basis:100%;max-width:100%}.vp-col-clearfix{flex-basis:100%;max-width:100%}.vp-col-clearfix .vp-control-html{margin-bottom:0}.post-type-vp_lists.post-php,.post-type-vp_lists.post-new-php{background-color:#edeff0}.post-type-vp_lists.post-php #wpcontent,.post-type-vp_lists.post-new-php #wpcontent{padding-left:0}.post-type-vp_lists.post-php .wrap,.post-type-vp_lists.post-new-php .wrap{margin:0}.post-type-vp_lists.post-php #poststuff,.post-type-vp_lists.post-new-php #poststuff{padding-top:0}.post-type-vp_lists.post-php #wpfooter,.post-type-vp_lists.post-new-php #wpfooter{display:none}.post-type-vp_lists.post-php #wpbody-content,.post-type-vp_lists.post-new-php #wpbody-content{padding-bottom:0}.post-type-vp_lists.post-php #post-body.columns-2 #postbox-container-1,.post-type-vp_lists.post-new-php #post-body.columns-2 #postbox-container-1{position:fixed;top:0;right:300px;bottom:0;width:300px;overflow:auto;-webkit-overflow-scrolling:touch}html.wp-toolbar .post-type-vp_lists.post-php #post-body.columns-2 #postbox-container-1,html.wp-toolbar .post-type-vp_lists.post-new-php #post-body.columns-2 #postbox-container-1{top:32px}@media only screen and (max-width: 850px){.post-type-vp_lists.post-php #post-body.columns-2 #postbox-container-1,.post-type-vp_lists.post-new-php #post-body.columns-2 #postbox-container-1{position:relative;top:auto;right:auto;bottom:auto;width:100%;margin-right:0}}.post-type-vp_lists.post-php #postbox-container-2,.post-type-vp_lists.post-new-php #postbox-container-2{position:absolute;top:0;right:0;bottom:0;left:0;width:calc(100% - 300px);min-height:calc(100vh - 32px);overflow:auto;-webkit-overflow-scrolling:touch}@media only screen and (max-width: 850px){.post-type-vp_lists.post-php #postbox-container-2,.post-type-vp_lists.post-new-php #postbox-container-2{right:0;bottom:auto;width:100%}}.post-type-vp_lists.post-php .columns-2 #side-sortables,.post-type-vp_lists.post-new-php .columns-2 #side-sortables{width:auto}.post-type-vp_lists.post-php .notice,.post-type-vp_lists.post-new-php .notice{margin:0;margin-right:300px;margin-bottom:1px}@media only screen and (max-width: 850px){.post-type-vp_lists.post-php .notice,.post-type-vp_lists.post-new-php .notice{margin-right:0}}.post-type-vp_lists.post-php #poststuff .postbox,.post-type-vp_lists.post-new-php #poststuff .postbox{margin-bottom:0;border-color:#e2e4e7;border-top:0;border-right:0}.post-type-vp_lists.post-php #poststuff .postbox>h2,.post-type-vp_lists.post-new-php #poststuff .postbox>h2{padding:15px;border-bottom:none}.post-type-vp_lists.post-php #poststuff .postbox>.handlediv,.post-type-vp_lists.post-new-php #poststuff .postbox>.handlediv{height:50px}.post-type-vp_lists.post-php #poststuff .postbox>.inside,.post-type-vp_lists.post-new-php #poststuff .postbox>.inside{padding:15px;padding-top:0}.post-type-vp_lists.post-php.rtl #post-body.columns-2 #postbox-container-1,.post-type-vp_lists.post-new-php.rtl #post-body.columns-2 #postbox-container-1{right:auto;left:300px}.vp-control{display:flex;flex-wrap:wrap;align-items:center;margin-bottom:19px}.vp-control>label{width:100%;margin-bottom:5px}.vp-control>.vp-control-description{width:100%;margin:2px 0 5px;font-size:13px;font-style:italic;color:#666}.vp-control.vp-control-checkbox,.vp-control.vp-control-toggle{flex-wrap:nowrap}.vp-control.vp-control-checkbox>label,.vp-control.vp-control-toggle>label{margin-bottom:0}.vp-control.vp-control-textarea textarea{width:100%}.vp-image-picker{display:none}.vp-image-picker,.vp-image-picker *{box-sizing:border-box}.vp-image-picker+ul.thumbnails.image_picker_selector li{margin:0 10px 10px 0}.vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail{padding:0;cursor:pointer;border:none}.vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail img{display:block;border:2px solid transparent}.vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail.selected{background-color:transparent}.vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail.selected img{border-color:#0073aa}.vp-image-picker+ul.thumbnails.image_picker_selector .group_title{padding-top:5px;padding-left:5px;font-weight:500}.vp-control-range [type="number"]{width:50px;margin-left:10px}.vp-control-range [type="range"]{flex:1;width:100%;padding:0;background:transparent;-webkit-appearance:none;-moz-appearance:none;appearance:none}.vp-control-range [type="range"]::-webkit-slider-thumb{box-sizing:border-box;width:18px;height:18px;margin-top:-7px;cursor:pointer;background:#555d66;background-clip:padding-box;border:4px solid transparent;border-radius:50%;-webkit-appearance:none;appearance:none}.vp-control-range [type="range"]::-moz-range-thumb{box-sizing:border-box;width:18px;height:18px;cursor:pointer;background:#555d66;background-clip:padding-box;border:4px solid transparent;border-radius:50%}.vp-control-range [type="range"]::-ms-thumb{box-sizing:border-box;width:14px;height:14px;margin-top:0;cursor:pointer;background:#555d66;background-clip:padding-box;border:2px solid transparent;border-radius:50%}.vp-control-range [type="range"]:focus{outline:none}.vp-control-range [type="range"]:focus::-webkit-slider-thumb{color:#191e23;background-color:#fff;outline:2px solid transparent;outline-offset:-2px;box-shadow:inset 0 0 0 1px #6c7781, inset 0 0 0 2px #fff}.vp-control-range [type="range"]:focus::-moz-range-thumb{color:#191e23;background-color:#fff;outline:2px solid transparent;outline-offset:-2px;box-shadow:inset 0 0 0 1px #6c7781, inset 0 0 0 2px #fff}.vp-control-range [type="range"]:focus::-ms-thumb{color:#191e23;background-color:#fff;outline:2px solid transparent;outline-offset:-2px;box-shadow:inset 0 0 0 1px #6c7781, inset 0 0 0 2px #fff}.vp-control-range [type="range"]::-webkit-slider-runnable-track{height:3px;margin-top:-4px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.vp-control-range [type="range"]::-moz-range-track{height:3px;cursor:pointer;background:#e2e4e7;border-radius:1.5px}.vp-control-range [type="range"]::-ms-track{height:3px;margin-top:-4px;color:transparent;cursor:pointer;background:#e2e4e7;border-color:transparent;border-radius:1.5px}.vp-control-toggle,.vp-control-toggle *{box-sizing:border-box}.vp-control-toggle .vp-toggle{position:relative}.vp-control-toggle .vp-toggle .vp-toggle__track{content:"";display:inline-block;box-sizing:border-box;width:36px;height:18px;vertical-align:top;background-color:#fff;border:2px solid #6c7781;border-radius:9px;transition:background .2s ease}.vp-control-toggle .vp-toggle .vp-toggle__track::after{content:"";position:absolute;display:block;top:50%;right:5px;width:3px;height:3px;margin-top:-3px;border:1.5px solid #6c7781;border-radius:3px}.vp-control-toggle .vp-toggle:hover .vp-toggle__track{background-color:#e2e4e7}.vp-control-toggle .vp-toggle [type="checkbox"]:checked ~ .vp-toggle__track{background-color:#33b3db;border:2px solid #33b3db}.vp-control-toggle .vp-toggle [type="checkbox"]:checked ~ .vp-toggle__track::after{top:50%;right:auto;left:8px;width:0;height:5px;margin-top:-3px;border:0;border-right:2px solid #fff;border-radius:0}.vp-control-toggle .vp-toggle .vp-toggle__thumb{position:absolute;display:block;top:4px;left:4px;width:10px;height:10px;background-color:#6c7781;border:5px solid #6c7781;border-radius:50%;transition:-webkit-transform .1s ease;transition:transform .1s ease;transition:transform .1s ease, -webkit-transform .1s ease}.vp-control-toggle .vp-toggle [type="checkbox"]:focus ~ .vp-toggle__track{box-shadow:0 0 0 2px #fff, 0 0 0 3px #6c7781}.vp-control-toggle .vp-toggle [type="checkbox"]:checked ~ .vp-toggle__thumb{background-color:#fff;border-width:0;-webkit-transform:translateX(18px);transform:translateX(18px)}.vp-control-toggle .vp-toggle [type="checkbox"]{position:absolute;top:0;left:0;width:100%;height:100%;padding:0;margin:0;opacity:0;z-index:1}.vp-control-image-dropdown{position:relative;display:flex;align-items:center;width:100%;padding:5px 7px;cursor:pointer;background-color:#fff;border:1px solid #ddd;box-shadow:inset 0 1px 2px rgba(0,0,0,0.07)}.vp-control-image-dropdown,.vp-control-image-dropdown *{box-sizing:border-box}.vp-control-image-dropdown::before{content:"";position:absolute;display:block;top:50%;right:6px;width:0;height:0;margin-top:-2px;border-color:#888 transparent transparent transparent;border-style:solid;border-width:5px 4px 0 4px}.vp-control-image-dropdown.active::before{border-color:transparent transparent #888 transparent;border-width:0 4px 5px 4px}.vp-control-image-dropdown .vp-control-image-dropdown__preview{display:block;flex:0 0 auto;width:32px}.vp-control-image-dropdown .vp-control-image-dropdown__preview img{display:block;width:100%;height:auto}.vp-control-image-dropdown .vp-control-image-dropdown__title{flex:1;padding-left:10px}.vp-control-image-dropdown .vp-control-image-dropdown__content{position:absolute;display:none;top:100%;left:0;width:100%;max-width:285px;margin-top:7px;margin-left:-1px;cursor:default;background-color:#fff;border:1px solid #e5e5e5;box-shadow:0 1px 1px rgba(0,0,0,0.04);z-index:1}.vp-control-image-dropdown .vp-control-image-dropdown__content>div{width:100%;max-height:250px;padding:4px;overflow:auto}.vp-control-image-dropdown .vp-control-image-dropdown__content::before{content:"";position:absolute;display:block;top:-5px;left:10px;width:0;height:0;border-right:5px solid transparent;border-bottom:5px solid #e5e5e5;border-left:5px solid transparent}.vp-control-image-dropdown .vp-control-image-dropdown__content::after{content:"";position:absolute;display:block;top:-7px;right:0;left:0;height:7px}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector,.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector .group>ul{display:flex;flex-wrap:wrap}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li{display:block;flex:0 0 25%;float:none;max-width:25%;margin:0}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li.group,.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li.group_title{flex:0 0 100%;max-width:100%}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li .thumbnail{padding:3px}.vp-control-image-dropdown .vp-control-image-dropdown__content .vp-image-picker+ul.thumbnails.image_picker_selector li img{width:100%;height:auto}.vp-control-image-dropdown.active .vp-control-image-dropdown__content{display:block}.vp-oembed-preview{position:relative;width:100%;padding-top:56.25%;color:#a2a2a2;background-color:#f1f1f1;border:1px solid #e8e8e8}.vp-oembed-preview::after{content:"\f126";position:absolute;display:block;top:50%;left:50%;width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:dashicons;font-size:20px;font-style:normal;font-weight:400;line-height:1;text-align:center;text-decoration:inherit;vertical-align:top;z-index:1;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.vp-oembed-preview>iframe{position:absolute;top:0;left:0;width:100%;height:100%;z-index:2}.vp-portfolio__thumbnail{position:relative;display:block;max-width:70px;padding-top:100%;overflow:hidden;border-radius:3px}.vp-portfolio__thumbnail img{position:absolute;display:block;top:0;left:0;width:100%;height:100%;-o-object-fit:cover;object-fit:cover}.vp-portfolio__thumbnail:empty{background-color:#f1f1f1;border:1px solid #e8e8e8}.vp-portfolio__thumbnail:empty,.vp-portfolio__thumbnail:empty:hover,.vp-portfolio__thumbnail:empty:active,.vp-portfolio__thumbnail:empty:focus{color:#a2a2a2}.vp-portfolio__thumbnail:empty::after{content:"\f128";position:absolute;display:block;top:50%;left:50%;width:20px;height:20px;margin-top:-10px;margin-left:-10px;font-family:dashicons;font-size:20px;font-style:normal;font-weight:400;line-height:1;text-align:center;text-decoration:inherit;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.wp-list-table th.column-portfolio_post_thumbs{width:70px}.wp-list-table th.column-vp_lists_post_shortcode{width:250px}@media screen and (max-width: 782px){.wp-list-table th.column-portfolio_post_thumbs{display:none}.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-portfolio_post_thumbs{float:left;width:70px !important;min-width:70px}.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-portfolio_post_thumbs::before{content:none}.wp-list-table tr:not(.inline-edit-row):not(.no-items) td.column-title{overflow:hidden;clear:right}}.vp-portfolio-list .vp-portfolio-list__icon span{display:block;width:120px;height:120px;margin:0 auto;margin-top:60px;background-size:105px}.vp-portfolio-list .vp-portfolio-list__text{text-align:center}.vp-portfolio-list .vp-portfolio-list__text p{margin-top:30px;margin-bottom:30px;font-size:15px;font-weight:500;color:#8e8e8e}.vp-portfolio-list .vp-portfolio-list__text .button-hero{display:inline-block}.vp_list_preview{padding:0 12px;margin-right:-12px;margin-left:-12px}.vp_list_preview iframe{width:100%;min-height:120px;transition:height .3s}.vp-content-source{display:flex;flex-wrap:wrap;padding-right:9px;padding-left:9px;margin-right:-15px;margin-left:-15px}.vp-content-source .vp-content-source__item{position:relative;width:70px;height:50px;padding:12px;margin:0 5px;color:#6c7781;text-align:center;cursor:pointer;border:1px solid transparent;border-radius:3px}.vp-content-source .vp-content-source__item.active,.vp-content-source .vp-content-source__item:hover{color:#555;background-color:#ecf0f4}.vp-content-source .vp-content-source__item.active{color:#fff;background-color:#6c7781;border-color:#6c7781}.vp-content-source .vp-content-source__item .vp-content-source__item-icon>span{width:24px;height:24px;margin-top:2px;font-size:24px}.vp-content-source .vp-content-source__item .vp-content-source__item-title{position:absolute;top:58%;right:8px;left:8px;font-weight:500}.vp-content-source .vp-content-source__item-content{flex:1;min-width:100%}.vp-content-source .vp-content-source__item-content>div{position:relative;display:none;padding:0 15px;padding-bottom:1px;margin-top:12px;margin-right:-9px;margin-bottom:-14px;margin-left:-9px;overflow:hidden;background-color:#f9f9fa;border-top:1px solid #eee}.vp-content-source .vp-content-source__item-content>div:empty{display:none !important}.vp-content-source .vp-content-source__item-content>div.active{display:block}.vp-select2{width:100%}.vp-select2+.select2{width:100%}.post-attributes-label+.vp-select2+.select2{margin-top:5px}.vp-select2+.select2 ul,.vp-select2+.select2 li{margin-bottom:0}.vp-select2+.select2 .select2-selection{border:1px solid #ddd;border-radius:0;box-shadow:inset 0 1px 2px rgba(0,0,0,0.07)}.vp-select2+.select2.select2-container--open .select2-selection{outline:none}.vp-select2+.select2 .select2-selection--multiple{min-height:27px}.vp-select2+.select2 .select2-selection--multiple .select2-selection__choice{padding:3px 8px;margin-top:3px;color:#fff;background-color:#6c7781;border-color:#6c7781}.vp-select2+.select2 .select2-selection--multiple .select2-selection__choice__remove{float:right;margin-right:0;margin-left:3px;color:inherit;opacity:.5}.select2-vp-container ul,.select2-vp-container li{margin-bottom:0}.select2-vp-container .select2-dropdown{border-color:#ddd}.select2-vp-container .select2-search--dropdown .select2-search__field{padding:3px 4px;border:1px solid #ddd;outline:none;box-shadow:none}.select2-vp-container .select2-results__option[aria-selected="true"]{background-color:#efeeee}.select2-vp-container .select2-results__option--highlighted[aria-selected]{background-color:#33b3db}.vp-select2-ajax__result{display:flex;flex:0 1 auto;flex-direction:row;flex-wrap:wrap}.vp-select2-ajax__result .vp-select2-ajax__result-img{position:relative;flex:0 0 35px;background-color:rgba(0,0,0,0.1);background-position:center center;background-size:cover;border-radius:3px}.vp-select2-ajax__result .vp-select2-ajax__result-img::after{content:"";display:block;width:100%;padding-top:100%}.vp-select2-ajax__result .vp-select2-ajax__result-data{padding-left:10px}.vp-select2-ajax__result .vp-select2-ajax__result-title{font-size:16px;font-weight:500;line-height:1}.vp-select2-ajax__result .vp-select2-ajax__result-post-type{font-size:12px;opacity:.5}.vp-control-gallery{position:relative;border-bottom:1px solid #eaeaea}.vp-control-gallery .vp-control-gallery-additional-data{position:absolute;box-sizing:border-box;top:-15px;right:-365px;bottom:0;width:350px;padding:15px 13px;overflow:auto;background-color:#fff;border-left:1px solid #eaeaea;transition:.15s right}.vp-control-gallery .vp-control-gallery-additional-data.active{right:-15px}.vp-control-gallery .vp-control-gallery-additional-data.active+.vp-control-gallery-items{margin-right:335px}@media (max-width: 910px){.vp-control-gallery .vp-control-gallery-additional-data{position:relative;display:none;right:0;width:120%;height:auto;margin-bottom:30px;border:1px solid #eaeaea}.vp-control-gallery .vp-control-gallery-additional-data.active{display:block}.vp-control-gallery .vp-control-gallery-additional-data.active+.vp-control-gallery-items{margin-right:-15px}}.vp-control-gallery .vp-control-gallery-additional-data .vp-control-gallery-additional-data-preview{display:flex;padding:15px 13px;margin:-15px -13px;margin-bottom:15px;border-bottom:1px solid #eaeaea}.vp-control-gallery .vp-control-gallery-additional-data .vp-control-gallery-additional-data-preview .vp-control-gallery-additional-data-preview-image{margin-right:15px}.vp-control-gallery .vp-control-gallery-additional-data .vp-control-gallery-additional-data-preview .vp-control-gallery-additional-data-preview-image img{display:block;width:70px;border-radius:3px;box-shadow:0 0 0 1px #fff, 0 0 0 2px #eaeaea}.vp-control-gallery .vp-control-gallery-additional-data .vp-control-gallery-additional-data-preview .vp-control-gallery-additional-data-preview-size{color:#8f9498}.vp-control-gallery .vp-control-gallery-items{display:flex;flex-wrap:wrap;align-content:flex-start;width:120%;height:325px;padding:7px;margin:-12px;margin-bottom:-25px;overflow:auto;transition:.15s margin-right}.vp-control-gallery .vp-control-gallery-items::after{content:"";display:block;width:100%}.vp-control-gallery .vp-control-gallery-items>div{position:relative;display:block;width:calc(12.5% - 10px);margin:5px;cursor:move;cursor:-webkit-grab;cursor:grab;border-radius:3px}@media (max-width: 1350px){.vp-control-gallery .vp-control-gallery-items>div{width:calc(14.22% - 10px)}}@media (max-width: 1250px){.vp-control-gallery .vp-control-gallery-items>div{width:calc(16.66% - 10px)}}@media (max-width: 1100px){.vp-control-gallery .vp-control-gallery-items>div{width:calc(25% - 10px)}}.vp-control-gallery .vp-control-gallery-items>div::after{content:"";display:block;padding-top:100%}.vp-control-gallery .vp-control-gallery-items>div.sortable-ghost{opacity:.4}.vp-control-gallery .vp-control-gallery-items>div img{position:absolute;display:block;top:0;left:0;width:100%;height:100%;-o-object-fit:cover;object-fit:cover;border-radius:3px}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-img .vp-control-gallery-items-remove{position:absolute;top:-5px;right:-5px;width:20px;height:20px;color:#fff;cursor:pointer;visibility:hidden;background-color:#dc3232;border-radius:50%;opacity:0;transition:.15s visibility, .15s opacity}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-img .vp-control-gallery-items-remove span{width:20px;height:20px;font-size:10px;line-height:20px}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-img:hover .vp-control-gallery-items-remove{visibility:visible;opacity:1}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-img.active{box-shadow:0 0 0 1px #fff, 0 0 0 4px #33b3db}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-add{display:flex;align-items:center;justify-content:center;box-sizing:border-box;color:#6c7781;text-align:center;cursor:pointer;background-color:#fff;border:1px solid #ccd3da;border-radius:3px}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-add>span{position:absolute;top:50%;left:50%;width:24px;height:24px;margin-top:-12px;margin-left:-12px;line-height:24px}.vp-control-gallery .vp-control-gallery-items>.vp-control-gallery-items-add:hover{color:#555;background-color:#f7f7f7}.vp-input{width:100%}.post-type-vp_lists .CodeMirror{width:100%;text-align:left;border:1px solid #ddd}.post-type-vp_lists .CodeMirror .CodeMirror-matchingbracket{color:inherit;background:rgba(255,150,0,0.3)}.post-type-vp_lists [class*="CodeMirror-lint-message"],.post-type-vp_lists .CodeMirror-lint-marker-multiple,.post-type-vp_lists [class*="CodeMirror-lint-marker"]{background-image:none}.post-type-vp_lists .CodeMirror-lint-marker-error,.post-type-vp_lists .CodeMirror-lint-marker-warning{cursor:help}.post-type-vp_lists .CodeMirror-lint-marker-multiple{position:absolute;top:0}.post-type-vp_lists [class*="CodeMirror-lint-marker"]::before{position:relative;top:-2px;font:400 18px/1 dashicons}.post-type-vp_lists [class*="CodeMirror-lint-message"]::before{position:absolute;left:16px;font:400 16px/1 dashicons}.post-type-vp_lists .CodeMirror-lint-message-error,.post-type-vp_lists .CodeMirror-lint-message-warning{padding:3px 12px 3px 28px;margin:5px 0 2px;box-shadow:0 1px 1px 0 rgba(0,0,0,0.1)}.post-type-vp_lists .CodeMirror-lint-message-warning{background-color:#fff8e5;border-left:4px solid #ffb900}.post-type-vp_lists .CodeMirror-lint-message-warning::before,.post-type-vp_lists .CodeMirror-lint-marker-warning::before{content:"\f534";color:#f6a306}.post-type-vp_lists .CodeMirror-lint-message-error{background-color:#fbeaea;border-left:4px solid #dc3232}.post-type-vp_lists .CodeMirror-lint-message-error::before,.post-type-vp_lists .CodeMirror-lint-marker-error::before{content:"\f153";color:#dc3232}.post-type-vp_lists .CodeMirror-lint-tooltip{background:0 0;border:none;border-radius:0;direction:ltr}.post-type-vp_lists .CodeMirror-resizer{display:none;display:flex;align-items:center;justify-content:center;width:100%;height:20px;margin-top:-2px;font-size:13px;cursor:row-resize;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;background-color:#fbfbfb}.post-type-vp_lists .CodeMirror-resizer::before{content:"\2261";position:absolute;left:50%;color:#999}.post-type-vp_lists .CodeMirror-resizer:hover{background:#f7f7f7}.post-type-vp_lists .CodeMirror-resizer:hover::before{color:#000}.post-type-vp_lists .CodeMirror ~ .CodeMirror-resizer{display:block}@media (max-width: 850px){.vp-steps__right,.vp-steps__step{float:none;width:100%}}.post-type-vp_lists #slugdiv,.post-type-vp_lists #postcustom{display:none}
|
assets/admin/js/gutenberg-block.min.js
CHANGED
@@ -1,4 +1,4 @@
|
|
1 |
-
!function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=173)}([function(t,n,e){var r=e(2),o=e(8),i=e(13),u=e(10),c=e(20),a=function(t,n,e){var f,s,l,p,h=t&a.F,d=t&a.G,v=t&a.S,y=t&a.P,g=t&a.B,m=d?r:v?r[n]||(r[n]={}):(r[n]||{}).prototype,b=d?o:o[n]||(o[n]={}),w=b.prototype||(b.prototype={});for(f in d&&(e=n),e)l=((s=!h&&m&&void 0!==m[f])?m:e)[f],p=g&&s?c(l,r):y&&"function"==typeof l?c(Function.call,l):l,m&&u(m,f,l,t&a.U),b[f]!=l&&i(b,f,p),y&&w[f]!=l&&(w[f]=l)};r.core=o,a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,e){var r=e(3);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,n,e){var r=e(75)("wks"),o=e(32),i=e(2).Symbol,u="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=r},function(t,n,e){var r=e(4),o=e(113),i=e(27),u=Object.defineProperty;n.f=e(7)?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return u(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){t.exports=!e(1)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){var e=t.exports={version:"2.5.7"};"number"==typeof __e&&(__e=e)},function(t,n,e){var r=e(24),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,n,e){var r=e(2),o=e(13),i=e(12),u=e(32)("src"),c=Function.toString,a=(""+c).split("toString");e(8).inspectSource=function(t){return c.call(t)},(t.exports=function(t,n,e,c){var f="function"==typeof e;f&&(i(e,"name")||o(e,"name",n)),t[n]!==e&&(f&&(i(e,u)||o(e,u,t[n]?""+t[n]:a.join(String(n)))),t===r?t[n]=e:c?t[n]?t[n]=e:o(t,n,e):(delete t[n],o(t,n,e)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||c.call(this)})},function(t,n,e){var r=e(0),o=e(1),i=e(23),u=/"/g,c=function(t,n,e,r){var o=String(i(t)),c="<"+n;return""!==e&&(c+=" "+e+'="'+String(r).replace(u,""")+'"'),c+">"+o+"</"+n+">"};t.exports=function(t,n){var e={};e[t]=n(c),r(r.P+r.F*o(function(){var n=""[t]('"');return n!==n.toLowerCase()||n.split('"').length>3}),"String",e)}},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var r=e(6),o=e(31);t.exports=e(7)?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var r=e(54),o=e(23);t.exports=function(t){return r(o(t))}},function(t,n,e){var r=e(23);t.exports=function(t){return Object(r(t))}},function(t,n,e){"use strict";var r=e(1);t.exports=function(t,n){return!!t&&r(function(){n?t.call(null,function(){},1):t.call(null)})}},function(t,n,e){var r=e(55),o=e(31),i=e(14),u=e(27),c=e(12),a=e(113),f=Object.getOwnPropertyDescriptor;n.f=e(7)?f:function(t,n){if(t=i(t),n=u(n,!0),a)try{return f(t,n)}catch(t){}if(c(t,n))return o(!r.f.call(t,n),t[n])}},function(t,n,e){var r=e(0),o=e(8),i=e(1);t.exports=function(t,n){var e=(o.Object||{})[t]||Object[t],u={};u[t]=n(e),r(r.S+r.F*i(function(){e(1)}),"Object",u)}},function(t,n,e){var r=e(20),o=e(54),i=e(15),u=e(9),c=e(268);t.exports=function(t,n){var e=1==t,a=2==t,f=3==t,s=4==t,l=6==t,p=5==t||l,h=n||c;return function(n,c,d){for(var v,y,g=i(n),m=o(g),b=r(c,d,3),w=u(m.length),S=0,x=e?h(n,w):a?h(n,0):void 0;w>S;S++)if((p||S in m)&&(y=b(v=m[S],S,g),t))if(e)x[S]=y;else if(y)switch(t){case 3:return!0;case 5:return v;case 6:return S;case 2:x.push(v)}else if(s)return!1;return l?-1:f||s?s:x}}},function(t,n,e){var r=e(21);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n,e){"use strict";if(e(7)){var r=e(33),o=e(2),i=e(1),u=e(0),c=e(70),a=e(98),f=e(20),s=e(46),l=e(31),p=e(13),h=e(47),d=e(24),v=e(9),y=e(138),g=e(35),m=e(27),b=e(12),w=e(62),S=e(3),x=e(15),_=e(91),O=e(36),E=e(38),M=e(37).f,P=e(93),T=e(32),F=e(5),I=e(19),j=e(60),A=e(67),k=e(95),N=e(43),L=e(64),R=e(45),C=e(94),z=e(130),D=e(6),W=e(17),V=D.f,B=W.f,U=o.RangeError,H=o.TypeError,G=o.Uint8Array,q=Array.prototype,Y=a.ArrayBuffer,J=a.DataView,K=I(0),X=I(2),Q=I(3),$=I(4),Z=I(5),tt=I(6),nt=j(!0),et=j(!1),rt=k.values,ot=k.keys,it=k.entries,ut=q.lastIndexOf,ct=q.reduce,at=q.reduceRight,ft=q.join,st=q.sort,lt=q.slice,pt=q.toString,ht=q.toLocaleString,dt=F("iterator"),vt=F("toStringTag"),yt=T("typed_constructor"),gt=T("def_constructor"),mt=c.CONSTR,bt=c.TYPED,wt=c.VIEW,St=I(1,function(t,n){return Mt(A(t,t[gt]),n)}),xt=i(function(){return 1===new G(new Uint16Array([1]).buffer)[0]}),_t=!!G&&!!G.prototype.set&&i(function(){new G(1).set({})}),Ot=function(t,n){var e=d(t);if(e<0||e%n)throw U("Wrong offset!");return e},Et=function(t){if(S(t)&&bt in t)return t;throw H(t+" is not a typed array!")},Mt=function(t,n){if(!(S(t)&&yt in t))throw H("It is not a typed array constructor!");return new t(n)},Pt=function(t,n){return Tt(A(t,t[gt]),n)},Tt=function(t,n){for(var e=0,r=n.length,o=Mt(t,r);r>e;)o[e]=n[e++];return o},Ft=function(t,n,e){V(t,n,{get:function(){return this._d[e]}})},It=function(t){var n,e,r,o,i,u,c=x(t),a=arguments.length,s=a>1?arguments[1]:void 0,l=void 0!==s,p=P(c);if(void 0!=p&&!_(p)){for(u=p.call(c),r=[],n=0;!(i=u.next()).done;n++)r.push(i.value);c=r}for(l&&a>2&&(s=f(s,arguments[2],2)),n=0,e=v(c.length),o=Mt(this,e);e>n;n++)o[n]=l?s(c[n],n):c[n];return o},jt=function(){for(var t=0,n=arguments.length,e=Mt(this,n);n>t;)e[t]=arguments[t++];return e},At=!!G&&i(function(){ht.call(new G(1))}),kt=function(){return ht.apply(At?lt.call(Et(this)):Et(this),arguments)},Nt={copyWithin:function(t,n){return z.call(Et(this),t,n,arguments.length>2?arguments[2]:void 0)},every:function(t){return $(Et(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return C.apply(Et(this),arguments)},filter:function(t){return Pt(this,X(Et(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return Z(Et(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(Et(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){K(Et(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return et(Et(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return nt(Et(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ft.apply(Et(this),arguments)},lastIndexOf:function(t){return ut.apply(Et(this),arguments)},map:function(t){return St(Et(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return ct.apply(Et(this),arguments)},reduceRight:function(t){return at.apply(Et(this),arguments)},reverse:function(){for(var t,n=Et(this).length,e=Math.floor(n/2),r=0;r<e;)t=this[r],this[r++]=this[--n],this[n]=t;return this},some:function(t){return Q(Et(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return st.call(Et(this),t)},subarray:function(t,n){var e=Et(this),r=e.length,o=g(t,r);return new(A(e,e[gt]))(e.buffer,e.byteOffset+o*e.BYTES_PER_ELEMENT,v((void 0===n?r:g(n,r))-o))}},Lt=function(t,n){return Pt(this,lt.call(Et(this),t,n))},Rt=function(t){Et(this);var n=Ot(arguments[1],1),e=this.length,r=x(t),o=v(r.length),i=0;if(o+n>e)throw U("Wrong length!");for(;i<o;)this[n+i]=r[i++]},Ct={entries:function(){return it.call(Et(this))},keys:function(){return ot.call(Et(this))},values:function(){return rt.call(Et(this))}},zt=function(t,n){return S(t)&&t[bt]&&"symbol"!=typeof n&&n in t&&String(+n)==String(n)},Dt=function(t,n){return zt(t,n=m(n,!0))?l(2,t[n]):B(t,n)},Wt=function(t,n,e){return!(zt(t,n=m(n,!0))&&S(e)&&b(e,"value"))||b(e,"get")||b(e,"set")||e.configurable||b(e,"writable")&&!e.writable||b(e,"enumerable")&&!e.enumerable?V(t,n,e):(t[n]=e.value,t)};mt||(W.f=Dt,D.f=Wt),u(u.S+u.F*!mt,"Object",{getOwnPropertyDescriptor:Dt,defineProperty:Wt}),i(function(){pt.call({})})&&(pt=ht=function(){return ft.call(this)});var Vt=h({},Nt);h(Vt,Ct),p(Vt,dt,Ct.values),h(Vt,{slice:Lt,set:Rt,constructor:function(){},toString:pt,toLocaleString:kt}),Ft(Vt,"buffer","b"),Ft(Vt,"byteOffset","o"),Ft(Vt,"byteLength","l"),Ft(Vt,"length","e"),V(Vt,vt,{get:function(){return this[bt]}}),t.exports=function(t,n,e,a){var f=t+((a=!!a)?"Clamped":"")+"Array",l="get"+t,h="set"+t,d=o[f],g=d||{},m=d&&E(d),b=!d||!c.ABV,x={},_=d&&d.prototype,P=function(t,e){V(t,e,{get:function(){return function(t,e){var r=t._d;return r.v[l](e*n+r.o,xt)}(this,e)},set:function(t){return function(t,e,r){var o=t._d;a&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),o.v[h](e*n+o.o,r,xt)}(this,e,t)},enumerable:!0})};b?(d=e(function(t,e,r,o){s(t,d,f,"_d");var i,u,c,a,l=0,h=0;if(S(e)){if(!(e instanceof Y||"ArrayBuffer"==(a=w(e))||"SharedArrayBuffer"==a))return bt in e?Tt(d,e):It.call(d,e);i=e,h=Ot(r,n);var g=e.byteLength;if(void 0===o){if(g%n)throw U("Wrong length!");if((u=g-h)<0)throw U("Wrong length!")}else if((u=v(o)*n)+h>g)throw U("Wrong length!");c=u/n}else c=y(e),i=new Y(u=c*n);for(p(t,"_d",{b:i,o:h,l:u,e:c,v:new J(i)});l<c;)P(t,l++)}),_=d.prototype=O(Vt),p(_,"constructor",d)):i(function(){d(1)})&&i(function(){new d(-1)})&&L(function(t){new d,new d(null),new d(1.5),new d(t)},!0)||(d=e(function(t,e,r,o){var i;return s(t,d,f),S(e)?e instanceof Y||"ArrayBuffer"==(i=w(e))||"SharedArrayBuffer"==i?void 0!==o?new g(e,Ot(r,n),o):void 0!==r?new g(e,Ot(r,n)):new g(e):bt in e?Tt(d,e):It.call(d,e):new g(y(e))}),K(m!==Function.prototype?M(g).concat(M(m)):M(g),function(t){t in d||p(d,t,g[t])}),d.prototype=_,r||(_.constructor=d));var T=_[dt],F=!!T&&("values"==T.name||void 0==T.name),I=Ct.values;p(d,yt,!0),p(_,bt,f),p(_,wt,!0),p(_,gt,d),(a?new d(1)[vt]==f:vt in _)||V(_,vt,{get:function(){return f}}),x[f]=d,u(u.G+u.W+u.F*(d!=g),x),u(u.S,f,{BYTES_PER_ELEMENT:n}),u(u.S+u.F*i(function(){g.of.call(d,1)}),f,{from:It,of:jt}),"BYTES_PER_ELEMENT"in _||p(_,"BYTES_PER_ELEMENT",n),u(u.P,f,Nt),R(f),u(u.P+u.F*_t,f,{set:Rt}),u(u.P+u.F*!F,f,Ct),r||_.toString==pt||(_.toString=pt),u(u.P+u.F*i(function(){new d(1).slice()}),f,{slice:Lt}),u(u.P+u.F*(i(function(){return[1,2].toLocaleString()!=new d([1,2]).toLocaleString()})||!i(function(){_.toLocaleString.call([1,2])})),f,{toLocaleString:kt}),N[f]=F?T:I,r||F||p(_,dt,I)}}else t.exports=function(){}},function(t,n){var e=t.exports={version:"2.5.6"};"number"==typeof __e&&(__e=e)},function(t,n,e){var r=e(3);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,e){var r=e(32)("meta"),o=e(3),i=e(12),u=e(6).f,c=0,a=Object.isExtensible||function(){return!0},f=!e(1)(function(){return a(Object.preventExtensions({}))}),s=function(t){u(t,r,{value:{i:"O"+ ++c,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!a(t))return"F";if(!n)return"E";s(t)}return t[r].i},getWeak:function(t,n){if(!i(t,r)){if(!a(t))return!0;if(!n)return!1;s(t)}return t[r].w},onFreeze:function(t){return f&&l.NEED&&a(t)&&!i(t,r)&&s(t),t}}},function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},,function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,n){t.exports=!1},function(t,n,e){var r=e(115),o=e(78);t.exports=Object.keys||function(t){return r(t,o)}},function(t,n,e){var r=e(24),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=r(t))<0?o(t+n,0):i(t,n)}},function(t,n,e){var r=e(4),o=e(116),i=e(78),u=e(77)("IE_PROTO"),c=function(){},a=function(){var t,n=e(74)("iframe"),r=i.length;for(n.style.display="none",e(80).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;r--;)delete a.prototype[i[r]];return a()};t.exports=Object.create||function(t,n){var e;return null!==t?(c.prototype=r(t),e=new c,c.prototype=null,e[u]=t):e=a(),void 0===n?e:o(e,n)}},function(t,n,e){var r=e(115),o=e(78).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,n,e){var r=e(12),o=e(15),i=e(77)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var r=e(56),o=e(145),i=e(102),u=Object.defineProperty;n.f=e(41)?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return u(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){t.exports=!e(57)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(6).f,o=e(12),i=e(5)("toStringTag");t.exports=function(t,n,e){t&&!o(t=e?t:t.prototype,i)&&r(t,i,{configurable:!0,value:n})}},function(t,n){t.exports={}},function(t,n,e){var r=e(5)("unscopables"),o=Array.prototype;void 0==o[r]&&e(13)(o,r,{}),t.exports=function(t){o[r][t]=!0}},function(t,n,e){"use strict";var r=e(2),o=e(6),i=e(7),u=e(5)("species");t.exports=function(t){var n=r[t];i&&n&&!n[u]&&o.f(n,u,{configurable:!0,get:function(){return this}})}},function(t,n){t.exports=function(t,n,e,r){if(!(t instanceof n)||void 0!==r&&r in t)throw TypeError(e+": incorrect invocation!");return t}},function(t,n,e){var r=e(10);t.exports=function(t,n,e){for(var o in n)r(t,o,n[o],e);return t}},function(t,n,e){var r=e(3);t.exports=function(t,n){if(!r(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},function(t,n,e){var r=e(29),o=e(26),i=e(144),u=e(50),c=e(39),a=function(t,n,e){var f,s,l,p=t&a.F,h=t&a.G,d=t&a.S,v=t&a.P,y=t&a.B,g=t&a.W,m=h?o:o[n]||(o[n]={}),b=m.prototype,w=h?r:d?r[n]:(r[n]||{}).prototype;for(f in h&&(e=n),e)(s=!p&&w&&void 0!==w[f])&&c(m,f)||(l=s?w[f]:e[f],m[f]=h&&"function"!=typeof w[f]?e[f]:y&&s?i(l,r):g&&w[f]==l?function(t){var n=function(n,e,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,r)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(l):v&&"function"==typeof l?i(Function.call,l):l,v&&((m.virtual||(m.virtual={}))[f]=l,t&a.R&&b&&!b[f]&&u(b,f,l)))};a.F=1,a.G=2,a.S=4,a.P=8,a.B=16,a.W=32,a.U=64,a.R=128,t.exports=a},function(t,n,e){var r=e(40),o=e(73);t.exports=e(41)?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,e){var r=e(358),o=e(99);t.exports=function(t){return r(o(t))}},function(t,n,e){var r=e(101)("wks"),o=e(72),i=e(29).Symbol,u="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=r},function(t,n,e){var r=e(22);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,e){var r=e(51);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){t.exports=React},function(t,n){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){var r=e(14),o=e(9),i=e(35);t.exports=function(t){return function(n,e,u){var c,a=r(n),f=o(a.length),s=i(u,f);if(t&&e!=e){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===e)return t||s||0;return!t&&-1}}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,e){var r=e(22),o=e(5)("toStringTag"),i="Arguments"==r(function(){return arguments}());t.exports=function(t){var n,e,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),o))?e:i?r(n):"Object"==(u=r(n))&&"function"==typeof n.callee?"Arguments":u}},function(t,n,e){var r=e(0),o=e(23),i=e(1),u=e(82),c="["+u+"]",a=RegExp("^"+c+c+"*"),f=RegExp(c+c+"*$"),s=function(t,n,e){var o={},c=i(function(){return!!u[t]()||"
"!="
"[t]()}),a=o[t]=c?n(l):u[t];e&&(o[e]=a),r(r.P+r.F*c,"String",o)},l=s.trim=function(t,n){return t=String(o(t)),1&n&&(t=t.replace(a,"")),2&n&&(t=t.replace(f,"")),t};t.exports=s},function(t,n,e){var r=e(5)("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,n){if(!n&&!o)return!1;var e=!1;try{var i=[7],u=i[r]();u.next=function(){return{done:e=!0}},i[r]=function(){return u},t(i)}catch(t){}return e}},function(t,n,e){"use strict";var r=e(13),o=e(10),i=e(1),u=e(23),c=e(5);t.exports=function(t,n,e){var a=c(t),f=e(u,a,""[t]),s=f[0],l=f[1];i(function(){var n={};return n[a]=function(){return 7},7!=""[t](n)})&&(o(String.prototype,t,s),r(RegExp.prototype,a,2==n?function(t,n){return l.call(t,this,n)}:function(t){return l.call(t,this)}))}},function(t,n,e){var r=e(20),o=e(128),i=e(91),u=e(4),c=e(9),a=e(93),f={},s={};(n=t.exports=function(t,n,e,l,p){var h,d,v,y,g=p?function(){return t}:a(t),m=r(e,l,n?2:1),b=0;if("function"!=typeof g)throw TypeError(t+" is not iterable!");if(i(g)){for(h=c(t.length);h>b;b++)if((y=n?m(u(d=t[b])[0],d[1]):m(t[b]))===f||y===s)return y}else for(v=g.call(t);!(d=v.next()).done;)if((y=o(v,m,d.value,n))===f||y===s)return y}).BREAK=f,n.RETURN=s},function(t,n,e){var r=e(4),o=e(21),i=e(5)("species");t.exports=function(t,n){var e,u=r(t).constructor;return void 0===u||void 0==(e=r(u)[i])?n:o(e)}},function(t,n,e){var r=e(2).navigator;t.exports=r&&r.userAgent||""},function(t,n,e){"use strict";var r=e(2),o=e(0),i=e(10),u=e(47),c=e(28),a=e(66),f=e(46),s=e(3),l=e(1),p=e(64),h=e(42),d=e(83);t.exports=function(t,n,e,v,y,g){var m=r[t],b=m,w=y?"set":"add",S=b&&b.prototype,x={},_=function(t){var n=S[t];i(S,t,"delete"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return g&&!s(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,e){return n.call(this,0===t?0:t,e),this})};if("function"==typeof b&&(g||S.forEach&&!l(function(){(new b).entries().next()}))){var O=new b,E=O[w](g?{}:-0,1)!=O,M=l(function(){O.has(1)}),P=p(function(t){new b(t)}),T=!g&&l(function(){for(var t=new b,n=5;n--;)t[w](n,n);return!t.has(-0)});P||((b=n(function(n,e){f(n,b,t);var r=d(new m,n,b);return void 0!=e&&a(e,y,r[w],r),r})).prototype=S,S.constructor=b),(M||T)&&(_("delete"),_("has"),y&&_("get")),(T||E)&&_(w),g&&S.clear&&delete S.clear}else b=v.getConstructor(n,t,y,w),u(b.prototype,e),c.NEED=!0;return h(b,t),x[t]=b,o(o.G+o.W+o.F*(b!=m),x),g||v.setStrong(b,t,y),b}},function(t,n,e){for(var r,o=e(2),i=e(13),u=e(32),c=u("typed_array"),a=u("view"),f=!(!o.ArrayBuffer||!o.DataView),s=f,l=0,p="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(r=o[p[l++]])?(i(r.prototype,c,!0),i(r.prototype,a,!0)):s=!1;t.exports={ABV:f,CONSTR:s,TYPED:c,VIEW:a}},function(t,n){t.exports=!0},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n,e){var r=e(3),o=e(2).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,e){var r=e(8),o=e(2),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e(33)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n,e){n.f=e(5)},function(t,n,e){var r=e(75)("keys"),o=e(32);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,e){var r=e(22);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,n,e){var r=e(2).document;t.exports=r&&r.documentElement},function(t,n,e){var r=e(3),o=e(4),i=function(t,n){if(o(t),!r(n)&&null!==n)throw TypeError(n+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=e(20)(Function.call,e(17).f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return i(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:i}},function(t,n){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(t,n,e){var r=e(3),o=e(81).set;t.exports=function(t,n,e){var i,u=n.constructor;return u!==e&&"function"==typeof u&&(i=u.prototype)!==e.prototype&&r(i)&&o&&o(t,i),t}},function(t,n,e){"use strict";var r=e(24),o=e(23);t.exports=function(t){var n=String(o(this)),e="",i=r(t);if(i<0||i==1/0)throw RangeError("Count can't be negative");for(;i>0;(i>>>=1)&&(n+=n))1&i&&(e+=n);return e}},function(t,n){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,n){var e=Math.expm1;t.exports=!e||e(10)>22025.465794806718||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:e},function(t,n,e){"use strict";var r=e(33),o=e(0),i=e(10),u=e(13),c=e(43),a=e(127),f=e(42),s=e(38),l=e(5)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,n,e,d,v,y,g){a(e,n,d);var m,b,w,S=function(t){if(!p&&t in E)return E[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},x=n+" Iterator",_="values"==v,O=!1,E=t.prototype,M=E[l]||E["@@iterator"]||v&&E[v],P=M||S(v),T=v?_?S("entries"):P:void 0,F="Array"==n&&E.entries||M;if(F&&(w=s(F.call(new t)))!==Object.prototype&&w.next&&(f(w,x,!0),r||"function"==typeof w[l]||u(w,l,h)),_&&M&&"values"!==M.name&&(O=!0,P=function(){return M.call(this)}),r&&!g||!p&&!O&&E[l]||u(E,l,P),c[n]=P,c[x]=h,v)if(m={values:_?P:S("values"),keys:y?P:S("keys"),entries:T},g)for(b in m)b in E||i(E,b,m[b]);else o(o.P+o.F*(p||O),n,m);return m}},function(t,n,e){var r=e(89),o=e(23);t.exports=function(t,n,e){if(r(n))throw TypeError("String#"+e+" doesn't accept regex!");return String(o(t))}},function(t,n,e){var r=e(3),o=e(22),i=e(5)("match");t.exports=function(t){var n;return r(t)&&(void 0!==(n=t[i])?!!n:"RegExp"==o(t))}},function(t,n,e){var r=e(5)("match");t.exports=function(t){var n=/./;try{"/./"[t](n)}catch(e){try{return n[r]=!1,!"/./"[t](n)}catch(t){}}return!0}},function(t,n,e){var r=e(43),o=e(5)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},function(t,n,e){"use strict";var r=e(6),o=e(31);t.exports=function(t,n,e){n in t?r.f(t,n,o(0,e)):t[n]=e}},function(t,n,e){var r=e(62),o=e(5)("iterator"),i=e(43);t.exports=e(8).getIteratorMethod=function(t){if(void 0!=t)return t[o]||t["@@iterator"]||i[r(t)]}},function(t,n,e){"use strict";var r=e(15),o=e(35),i=e(9);t.exports=function(t){for(var n=r(this),e=i(n.length),u=arguments.length,c=o(u>1?arguments[1]:void 0,e),a=u>2?arguments[2]:void 0,f=void 0===a?e:o(a,e);f>c;)n[c++]=t;return n}},function(t,n,e){"use strict";var r=e(44),o=e(131),i=e(43),u=e(14);t.exports=e(87)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,n,e){"use strict";var r=e(4);t.exports=function(){var t=r(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},function(t,n,e){var r,o,i,u=e(20),c=e(120),a=e(80),f=e(74),s=e(2),l=s.process,p=s.setImmediate,h=s.clearImmediate,d=s.MessageChannel,v=s.Dispatch,y=0,g={},m=function(){var t=+this;if(g.hasOwnProperty(t)){var n=g[t];delete g[t],n()}},b=function(t){m.call(t.data)};p&&h||(p=function(t){for(var n=[],e=1;arguments.length>e;)n.push(arguments[e++]);return g[++y]=function(){c("function"==typeof t?t:Function(t),n)},r(y),y},h=function(t){delete g[t]},"process"==e(22)(l)?r=function(t){l.nextTick(u(m,t,1))}:v&&v.now?r=function(t){v.now(u(m,t,1))}:d?(i=(o=new d).port2,o.port1.onmessage=b,r=u(i.postMessage,i,1)):s.addEventListener&&"function"==typeof postMessage&&!s.importScripts?(r=function(t){s.postMessage(t+"","*")},s.addEventListener("message",b,!1)):r="onreadystatechange"in f("script")?function(t){a.appendChild(f("script")).onreadystatechange=function(){a.removeChild(this),m.call(t)}}:function(t){setTimeout(u(m,t,1),0)}),t.exports={set:p,clear:h}},function(t,n,e){"use strict";var r=e(2),o=e(7),i=e(33),u=e(70),c=e(13),a=e(47),f=e(1),s=e(46),l=e(24),p=e(9),h=e(138),d=e(37).f,v=e(6).f,y=e(94),g=e(42),m="prototype",b="Wrong index!",w=r.ArrayBuffer,S=r.DataView,x=r.Math,_=r.RangeError,O=r.Infinity,E=w,M=x.abs,P=x.pow,T=x.floor,F=x.log,I=x.LN2,j=o?"_b":"buffer",A=o?"_l":"byteLength",k=o?"_o":"byteOffset";function N(t,n,e){var r,o,i,u=new Array(e),c=8*e-n-1,a=(1<<c)-1,f=a>>1,s=23===n?P(2,-24)-P(2,-77):0,l=0,p=t<0||0===t&&1/t<0?1:0;for((t=M(t))!=t||t===O?(o=t!=t?1:0,r=a):(r=T(F(t)/I),t*(i=P(2,-r))<1&&(r--,i*=2),(t+=r+f>=1?s/i:s*P(2,1-f))*i>=2&&(r++,i/=2),r+f>=a?(o=0,r=a):r+f>=1?(o=(t*i-1)*P(2,n),r+=f):(o=t*P(2,f-1)*P(2,n),r=0));n>=8;u[l++]=255&o,o/=256,n-=8);for(r=r<<n|o,c+=n;c>0;u[l++]=255&r,r/=256,c-=8);return u[--l]|=128*p,u}function L(t,n,e){var r,o=8*e-n-1,i=(1<<o)-1,u=i>>1,c=o-7,a=e-1,f=t[a--],s=127&f;for(f>>=7;c>0;s=256*s+t[a],a--,c-=8);for(r=s&(1<<-c)-1,s>>=-c,c+=n;c>0;r=256*r+t[a],a--,c-=8);if(0===s)s=1-u;else{if(s===i)return r?NaN:f?-O:O;r+=P(2,n),s-=u}return(f?-1:1)*r*P(2,s-n)}function R(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function C(t){return[255&t]}function z(t){return[255&t,t>>8&255]}function D(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function W(t){return N(t,52,8)}function V(t){return N(t,23,4)}function B(t,n,e){v(t[m],n,{get:function(){return this[e]}})}function U(t,n,e,r){var o=h(+e);if(o+n>t[A])throw _(b);var i=t[j]._b,u=o+t[k],c=i.slice(u,u+n);return r?c:c.reverse()}function H(t,n,e,r,o,i){var u=h(+e);if(u+n>t[A])throw _(b);for(var c=t[j]._b,a=u+t[k],f=r(+o),s=0;s<n;s++)c[a+s]=f[i?s:n-s-1]}if(u.ABV){if(!f(function(){w(1)})||!f(function(){new w(-1)})||f(function(){return new w,new w(1.5),new w(NaN),"ArrayBuffer"!=w.name})){for(var G,q=(w=function(t){return s(this,w),new E(h(t))})[m]=E[m],Y=d(E),J=0;Y.length>J;)(G=Y[J++])in w||c(w,G,E[G]);i||(q.constructor=w)}var K=new S(new w(2)),X=S[m].setInt8;K.setInt8(0,2147483648),K.setInt8(1,2147483649),!K.getInt8(0)&&K.getInt8(1)||a(S[m],{setInt8:function(t,n){X.call(this,t,n<<24>>24)},setUint8:function(t,n){X.call(this,t,n<<24>>24)}},!0)}else w=function(t){s(this,w,"ArrayBuffer");var n=h(t);this._b=y.call(new Array(n),0),this[A]=n},S=function(t,n,e){s(this,S,"DataView"),s(t,w,"DataView");var r=t[A],o=l(n);if(o<0||o>r)throw _("Wrong offset!");if(o+(e=void 0===e?r-o:p(e))>r)throw _("Wrong length!");this[j]=t,this[k]=o,this[A]=e},o&&(B(w,"byteLength","_l"),B(S,"buffer","_b"),B(S,"byteLength","_l"),B(S,"byteOffset","_o")),a(S[m],{getInt8:function(t){return U(this,1,t)[0]<<24>>24},getUint8:function(t){return U(this,1,t)[0]},getInt16:function(t){var n=U(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=U(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return R(U(this,4,t,arguments[1]))},getUint32:function(t){return R(U(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return L(U(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return L(U(this,8,t,arguments[1]),52,8)},setInt8:function(t,n){H(this,1,t,C,n)},setUint8:function(t,n){H(this,1,t,C,n)},setInt16:function(t,n){H(this,2,t,z,n,arguments[2])},setUint16:function(t,n){H(this,2,t,z,n,arguments[2])},setInt32:function(t,n){H(this,4,t,D,n,arguments[2])},setUint32:function(t,n){H(this,4,t,D,n,arguments[2])},setFloat32:function(t,n){H(this,4,t,V,n,arguments[2])},setFloat64:function(t,n){H(this,8,t,W,n,arguments[2])}});g(w,"ArrayBuffer"),g(S,"DataView"),c(S[m],u.VIEW,!0),n.ArrayBuffer=w,n.DataView=S},function(t,n){t.exports=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,e){var r=e(101)("keys"),o=e(72);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,n,e){var r=e(26),o=e(29),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e(71)?"pure":"global",copyright:"© 2018 Denis Pushkarev (zloirock.ru)"})},function(t,n,e){var r=e(51);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n){t.exports={}},function(t,n,e){var r=e(56),o=e(357),i=e(107),u=e(100)("IE_PROTO"),c=function(){},a=function(){var t,n=e(146)("iframe"),r=i.length;for(n.style.display="none",e(362).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),a=t.F;r--;)delete a.prototype[i[r]];return a()};t.exports=Object.create||function(t,n){var e;return null!==t?(c.prototype=r(t),e=new c,c.prototype=null,e[u]=t):e=a(),void 0===n?e:o(e,n)}},function(t,n,e){var r=e(150),o=e(107);t.exports=Object.keys||function(t){return r(t,o)}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,e){var r=e(40).f,o=e(39),i=e(53)("toStringTag");t.exports=function(t,n,e){t&&!o(t=e?t:t.prototype,i)&&r(t,i,{configurable:!0,value:n})}},function(t,n,e){n.f=e(53)},function(t,n,e){var r=e(29),o=e(26),i=e(71),u=e(109),c=e(40).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,e){"use strict";var r=e(58),o=e.n(r);function i(){return(i=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}var u=o.a.createElement("g",{fill:"#555D66"},o.a.createElement("path",{d:"M11.4 10.2H3V21h8.4V10.2zM21 15h-8.4v6H21v-6zM11.4 3H3v6h8.4V3zM21 3h-8.4v10.8H21V3z"}));n.a=function(t){return o.a.createElement("svg",i({width:24,height:24,viewBox:"0 0 24 24",fill:"none"},t),u)}},function(t,n,e){t.exports=!e(7)&&!e(1)(function(){return 7!=Object.defineProperty(e(74)("div"),"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(2),o=e(8),i=e(33),u=e(76),c=e(6).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in n||c(n,t,{value:u.f(t)})}},function(t,n,e){var r=e(12),o=e(14),i=e(60)(!1),u=e(77)("IE_PROTO");t.exports=function(t,n){var e,c=o(t),a=0,f=[];for(e in c)e!=u&&r(c,e)&&f.push(e);for(;n.length>a;)r(c,e=n[a++])&&(~i(f,e)||f.push(e));return f}},function(t,n,e){var r=e(6),o=e(4),i=e(34);t.exports=e(7)?Object.defineProperties:function(t,n){o(t);for(var e,u=i(n),c=u.length,a=0;c>a;)r.f(t,e=u[a++],n[e]);return t}},function(t,n,e){var r=e(14),o=e(37).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return u.slice()}}(t):o(r(t))}},function(t,n,e){"use strict";var r=e(34),o=e(61),i=e(55),u=e(15),c=e(54),a=Object.assign;t.exports=!a||e(1)(function(){var t={},n={},e=Symbol(),r="abcdefghijklmnopqrst";return t[e]=7,r.split("").forEach(function(t){n[t]=t}),7!=a({},t)[e]||Object.keys(a({},n)).join("")!=r})?function(t,n){for(var e=u(t),a=arguments.length,f=1,s=o.f,l=i.f;a>f;)for(var p,h=c(arguments[f++]),d=s?r(h).concat(s(h)):r(h),v=d.length,y=0;v>y;)l.call(h,p=d[y++])&&(e[p]=h[p]);return e}:a},function(t,n,e){"use strict";var r=e(21),o=e(3),i=e(120),u=[].slice,c={};t.exports=Function.bind||function(t){var n=r(this),e=u.call(arguments,1),a=function(){var r=e.concat(u.call(arguments));return this instanceof a?function(t,n,e){if(!(n in c)){for(var r=[],o=0;o<n;o++)r[o]="a["+o+"]";c[n]=Function("F,a","return new F("+r.join(",")+")")}return c[n](t,e)}(n,r.length,r):i(n,r,t)};return o(n.prototype)&&(a.prototype=n.prototype),a}},function(t,n){t.exports=function(t,n,e){var r=void 0===e;switch(n.length){case 0:return r?t():t.call(e);case 1:return r?t(n[0]):t.call(e,n[0]);case 2:return r?t(n[0],n[1]):t.call(e,n[0],n[1]);case 3:return r?t(n[0],n[1],n[2]):t.call(e,n[0],n[1],n[2]);case 4:return r?t(n[0],n[1],n[2],n[3]):t.call(e,n[0],n[1],n[2],n[3])}return t.apply(e,n)}},function(t,n,e){var r=e(2).parseInt,o=e(63).trim,i=e(82),u=/^[-+]?0[xX]/;t.exports=8!==r(i+"08")||22!==r(i+"0x16")?function(t,n){var e=o(String(t),3);return r(e,n>>>0||(u.test(e)?16:10))}:r},function(t,n,e){var r=e(2).parseFloat,o=e(63).trim;t.exports=1/r(e(82)+"-0")!=-1/0?function(t){var n=o(String(t),3),e=r(n);return 0===e&&"-"==n.charAt(0)?-0:e}:r},function(t,n,e){var r=e(22);t.exports=function(t,n){if("number"!=typeof t&&"Number"!=r(t))throw TypeError(n);return+t}},function(t,n,e){var r=e(3),o=Math.floor;t.exports=function(t){return!r(t)&&isFinite(t)&&o(t)===t}},function(t,n){t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},function(t,n,e){var r=e(24),o=e(23);t.exports=function(t){return function(n,e){var i,u,c=String(o(n)),a=r(e),f=c.length;return a<0||a>=f?t?"":void 0:(i=c.charCodeAt(a))<55296||i>56319||a+1===f||(u=c.charCodeAt(a+1))<56320||u>57343?t?c.charAt(a):i:t?c.slice(a,a+2):u-56320+(i-55296<<10)+65536}}},function(t,n,e){"use strict";var r=e(36),o=e(31),i=e(42),u={};e(13)(u,e(5)("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(u,{next:o(1,e)}),i(t,n+" Iterator")}},function(t,n,e){var r=e(4);t.exports=function(t,n,e,o){try{return o?n(r(e)[0],e[1]):n(e)}catch(n){var i=t.return;throw void 0!==i&&r(i.call(t)),n}}},function(t,n,e){var r=e(21),o=e(15),i=e(54),u=e(9);t.exports=function(t,n,e,c,a){r(n);var f=o(t),s=i(f),l=u(f.length),p=a?l-1:0,h=a?-1:1;if(e<2)for(;;){if(p in s){c=s[p],p+=h;break}if(p+=h,a?p<0:l<=p)throw TypeError("Reduce of empty array with no initial value")}for(;a?p>=0:l>p;p+=h)p in s&&(c=n(c,s[p],p,f));return c}},function(t,n,e){"use strict";var r=e(15),o=e(35),i=e(9);t.exports=[].copyWithin||function(t,n){var e=r(this),u=i(e.length),c=o(t,u),a=o(n,u),f=arguments.length>2?arguments[2]:void 0,s=Math.min((void 0===f?u:o(f,u))-a,u-c),l=1;for(a<c&&c<a+s&&(l=-1,a+=s-1,c+=s-1);s-- >0;)a in e?e[c]=e[a]:delete e[c],c+=l,a+=l;return e}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,e){e(7)&&"g"!=/./g.flags&&e(6).f(RegExp.prototype,"flags",{configurable:!0,get:e(96)})},function(t,n,e){"use strict";var r,o,i,u,c=e(33),a=e(2),f=e(20),s=e(62),l=e(0),p=e(3),h=e(21),d=e(46),v=e(66),y=e(67),g=e(97).set,m=e(289)(),b=e(134),w=e(290),S=e(68),x=e(135),_=a.TypeError,O=a.process,E=O&&O.versions,M=E&&E.v8||"",P=a.Promise,T="process"==s(O),F=function(){},I=o=b.f,j=!!function(){try{var t=P.resolve(1),n=(t.constructor={})[e(5)("species")]=function(t){t(F,F)};return(T||"function"==typeof PromiseRejectionEvent)&&t.then(F)instanceof n&&0!==M.indexOf("6.6")&&-1===S.indexOf("Chrome/66")}catch(t){}}(),A=function(t){var n;return!(!p(t)||"function"!=typeof(n=t.then))&&n},k=function(t,n){if(!t._n){t._n=!0;var e=t._c;m(function(){for(var r=t._v,o=1==t._s,i=0,u=function(n){var e,i,u,c=o?n.ok:n.fail,a=n.resolve,f=n.reject,s=n.domain;try{c?(o||(2==t._h&&R(t),t._h=1),!0===c?e=r:(s&&s.enter(),e=c(r),s&&(s.exit(),u=!0)),e===n.promise?f(_("Promise-chain cycle")):(i=A(e))?i.call(e,a,f):a(e)):f(r)}catch(t){s&&!u&&s.exit(),f(t)}};e.length>i;)u(e[i++]);t._c=[],t._n=!1,n&&!t._h&&N(t)})}},N=function(t){g.call(a,function(){var n,e,r,o=t._v,i=L(t);if(i&&(n=w(function(){T?O.emit("unhandledRejection",o,t):(e=a.onunhandledrejection)?e({promise:t,reason:o}):(r=a.console)&&r.error&&r.error("Unhandled promise rejection",o)}),t._h=T||L(t)?2:1),t._a=void 0,i&&n.e)throw n.v})},L=function(t){return 1!==t._h&&0===(t._a||t._c).length},R=function(t){g.call(a,function(){var n;T?O.emit("rejectionHandled",t):(n=a.onrejectionhandled)&&n({promise:t,reason:t._v})})},C=function(t){var n=this;n._d||(n._d=!0,(n=n._w||n)._v=t,n._s=2,n._a||(n._a=n._c.slice()),k(n,!0))},z=function(t){var n,e=this;if(!e._d){e._d=!0,e=e._w||e;try{if(e===t)throw _("Promise can't be resolved itself");(n=A(t))?m(function(){var r={_w:e,_d:!1};try{n.call(t,f(z,r,1),f(C,r,1))}catch(t){C.call(r,t)}}):(e._v=t,e._s=1,k(e,!1))}catch(t){C.call({_w:e,_d:!1},t)}}};j||(P=function(t){d(this,P,"Promise","_h"),h(t),r.call(this);try{t(f(z,this,1),f(C,this,1))}catch(t){C.call(this,t)}},(r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=e(47)(P.prototype,{then:function(t,n){var e=I(y(this,P));return e.ok="function"!=typeof t||t,e.fail="function"==typeof n&&n,e.domain=T?O.domain:void 0,this._c.push(e),this._a&&this._a.push(e),this._s&&k(this,!1),e.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new r;this.promise=t,this.resolve=f(z,t,1),this.reject=f(C,t,1)},b.f=I=function(t){return t===P||t===u?new i(t):o(t)}),l(l.G+l.W+l.F*!j,{Promise:P}),e(42)(P,"Promise"),e(45)("Promise"),u=e(8).Promise,l(l.S+l.F*!j,"Promise",{reject:function(t){var n=I(this);return(0,n.reject)(t),n.promise}}),l(l.S+l.F*(c||!j),"Promise",{resolve:function(t){return x(c&&this===u?P:this,t)}}),l(l.S+l.F*!(j&&e(64)(function(t){P.all(t).catch(F)})),"Promise",{all:function(t){var n=this,e=I(n),r=e.resolve,o=e.reject,i=w(function(){var e=[],i=0,u=1;v(t,!1,function(t){var c=i++,a=!1;e.push(void 0),u++,n.resolve(t).then(function(t){a||(a=!0,e[c]=t,--u||r(e))},o)}),--u||r(e)});return i.e&&o(i.v),e.promise},race:function(t){var n=this,e=I(n),r=e.reject,o=w(function(){v(t,!1,function(t){n.resolve(t).then(e.resolve,r)})});return o.e&&r(o.v),e.promise}})},function(t,n,e){"use strict";var r=e(21);t.exports.f=function(t){return new function(t){var n,e;this.promise=new t(function(t,r){if(void 0!==n||void 0!==e)throw TypeError("Bad Promise constructor");n=t,e=r}),this.resolve=r(n),this.reject=r(e)}(t)}},function(t,n,e){var r=e(4),o=e(3),i=e(134);t.exports=function(t,n){if(r(t),o(n)&&n.constructor===t)return n;var e=i.f(t);return(0,e.resolve)(n),e.promise}},function(t,n,e){"use strict";var r=e(6).f,o=e(36),i=e(47),u=e(20),c=e(46),a=e(66),f=e(87),s=e(131),l=e(45),p=e(7),h=e(28).fastKey,d=e(48),v=p?"_s":"size",y=function(t,n){var e,r=h(n);if("F"!==r)return t._i[r];for(e=t._f;e;e=e.n)if(e.k==n)return e};t.exports={getConstructor:function(t,n,e,f){var s=t(function(t,r){c(t,s,n,"_i"),t._t=n,t._i=o(null),t._f=void 0,t._l=void 0,t[v]=0,void 0!=r&&a(r,e,t[f],t)});return i(s.prototype,{clear:function(){for(var t=d(this,n),e=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete e[r.i];t._f=t._l=void 0,t[v]=0},delete:function(t){var e=d(this,n),r=y(e,t);if(r){var o=r.n,i=r.p;delete e._i[r.i],r.r=!0,i&&(i.n=o),o&&(o.p=i),e._f==r&&(e._f=o),e._l==r&&(e._l=i),e[v]--}return!!r},forEach:function(t){d(this,n);for(var e,r=u(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.n:this._f;)for(r(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!y(d(this,n),t)}}),p&&r(s.prototype,"size",{get:function(){return d(this,n)[v]}}),s},def:function(t,n,e){var r,o,i=y(t,n);return i?i.v=e:(t._l=i={i:o=h(n,!0),k:n,v:e,p:r=t._l,n:void 0,r:!1},t._f||(t._f=i),r&&(r.n=i),t[v]++,"F"!==o&&(t._i[o]=i)),t},getEntry:y,setStrong:function(t,n,e){f(t,n,function(t,e){this._t=d(t,n),this._k=e,this._l=void 0},function(){for(var t=this._k,n=this._l;n&&n.r;)n=n.p;return this._t&&(this._l=n=n?n.n:this._t._f)?s(0,"keys"==t?n.k:"values"==t?n.v:[n.k,n.v]):(this._t=void 0,s(1))},e?"entries":"values",!e,!0),l(n)}}},function(t,n,e){"use strict";var r=e(47),o=e(28).getWeak,i=e(4),u=e(3),c=e(46),a=e(66),f=e(19),s=e(12),l=e(48),p=f(5),h=f(6),d=0,v=function(t){return t._l||(t._l=new y)},y=function(){this.a=[]},g=function(t,n){return p(t.a,function(t){return t[0]===n})};y.prototype={get:function(t){var n=g(this,t);if(n)return n[1]},has:function(t){return!!g(this,t)},set:function(t,n){var e=g(this,t);e?e[1]=n:this.a.push([t,n])},delete:function(t){var n=h(this.a,function(n){return n[0]===t});return~n&&this.a.splice(n,1),!!~n}},t.exports={getConstructor:function(t,n,e,i){var f=t(function(t,r){c(t,f,n,"_i"),t._t=n,t._i=d++,t._l=void 0,void 0!=r&&a(r,e,t[i],t)});return r(f.prototype,{delete:function(t){if(!u(t))return!1;var e=o(t);return!0===e?v(l(this,n)).delete(t):e&&s(e,this._i)&&delete e[this._i]},has:function(t){if(!u(t))return!1;var e=o(t);return!0===e?v(l(this,n)).has(t):e&&s(e,this._i)}}),f},def:function(t,n,e){var r=o(i(n),!0);return!0===r?v(t).set(n,e):r[t._i]=e,t},ufstore:v}},function(t,n,e){var r=e(24),o=e(9);t.exports=function(t){if(void 0===t)return 0;var n=r(t),e=o(n);if(n!==e)throw RangeError("Wrong length!");return e}},function(t,n,e){var r=e(37),o=e(61),i=e(4),u=e(2).Reflect;t.exports=u&&u.ownKeys||function(t){var n=r.f(i(t)),e=o.f;return e?n.concat(e(t)):n}},function(t,n,e){var r=e(9),o=e(84),i=e(23);t.exports=function(t,n,e,u){var c=String(i(t)),a=c.length,f=void 0===e?" ":String(e),s=r(n);if(s<=a||""==f)return c;var l=s-a,p=o.call(f,Math.ceil(l/f.length));return p.length>l&&(p=p.slice(0,l)),u?p+c:c+p}},function(t,n,e){var r=e(34),o=e(14),i=e(55).f;t.exports=function(t){return function(n){for(var e,u=o(n),c=r(u),a=c.length,f=0,s=[];a>f;)i.call(u,e=c[f++])&&s.push(t?[e,u[e]]:u[e]);return s}}},function(t,n,e){var r=e(99);t.exports=function(t){return Object(r(t))}},function(t,n,e){var r=e(39),o=e(142),i=e(100)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,e){var r=e(345);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,e){t.exports=!e(41)&&!e(57)(function(){return 7!=Object.defineProperty(e(146)("div"),"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(51),o=e(29).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,e){"use strict";n.__esModule=!0;var r=u(e(352)),o=u(e(367)),i="function"==typeof o.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":typeof t};function u(t){return t&&t.__esModule?t:{default:t}}n.default="function"==typeof o.default&&"symbol"===i(r.default)?function(t){return void 0===t?"undefined":i(t)}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":void 0===t?"undefined":i(t)}},function(t,n,e){"use strict";var r=e(71),o=e(49),i=e(149),u=e(50),c=e(104),a=e(356),f=e(108),s=e(143),l=e(53)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,n,e,d,v,y,g){a(e,n,d);var m,b,w,S=function(t){if(!p&&t in E)return E[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},x=n+" Iterator",_="values"==v,O=!1,E=t.prototype,M=E[l]||E["@@iterator"]||v&&E[v],P=M||S(v),T=v?_?S("entries"):P:void 0,F="Array"==n&&E.entries||M;if(F&&(w=s(F.call(new t)))!==Object.prototype&&w.next&&(f(w,x,!0),r||"function"==typeof w[l]||u(w,l,h)),_&&M&&"values"!==M.name&&(O=!0,P=function(){return M.call(this)}),r&&!g||!p&&!O&&E[l]||u(E,l,P),c[n]=P,c[x]=h,v)if(m={values:_?P:S("values"),keys:y?P:S("keys"),entries:T},g)for(b in m)b in E||i(E,b,m[b]);else o(o.P+o.F*(p||O),n,m);return m}},function(t,n,e){t.exports=e(50)},function(t,n,e){var r=e(39),o=e(52),i=e(359)(!1),u=e(100)("IE_PROTO");t.exports=function(t,n){var e,c=o(t),a=0,f=[];for(e in c)e!=u&&r(c,e)&&f.push(e);for(;n.length>a;)r(c,e=n[a++])&&(~i(f,e)||f.push(e));return f}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,e){var r=e(150),o=e(107).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,n,e){var r=e(111),o=e(73),i=e(52),u=e(102),c=e(39),a=e(145),f=Object.getOwnPropertyDescriptor;n.f=e(41)?f:function(t,n){if(t=i(t),n=u(n,!0),a)try{return f(t,n)}catch(t){}if(c(t,n))return o(!r.f.call(t,n),t[n])}},,function(t,n,e){var r;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
@@ -9,4 +9,4 @@
|
|
9 |
Licensed under the MIT License (MIT), see
|
10 |
http://jedwatson.github.io/classnames
|
11 |
*/
|
12 |
-
!function(){"use strict";var e=function(){function t(){}function n(t,n){for(var e=n.length,r=0;r<e;++r)o(t,n[r])}t.prototype=Object.create(null);var e={}.hasOwnProperty;var r=/\s+/;function o(t,o){if(o){var i=typeof o;"string"===i?function(t,n){for(var e=n.split(r),o=e.length,i=0;i<o;++i)t[e[i]]=!0}(t,o):Array.isArray(o)?n(t,o):"object"===i?function(t,n){for(var r in n)e.call(n,r)&&(t[r]=!!n[r])}(t,o):"number"===i&&function(t,n){t[n]=!0}(t,o)}}return function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];var i=new t;n(i,r);var u=[];for(var c in i)i[c]&&u.push(c);return u.join(" ")}}();t.exports?(e.default=e,t.exports=e):void 0===(r=function(){return e}.apply(n,[]))||(t.exports=r)}()},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=p(e(341)),o=p(e(346)),i=p(e(347)),u=p(e(351)),c=p(e(377)),a=p(e(58)),f=p(e(385)),s=p(e(388)),l=e(389);function p(t){return t&&t.__esModule?t:{default:t}}var h=function(t){function n(){var t,e,i,c;(0,o.default)(this,n);for(var a=arguments.length,f=Array(a),p=0;p<a;p++)f[p]=arguments[p];return e=i=(0,u.default)(this,(t=n.__proto__||(0,r.default)(n)).call.apply(t,[this].concat(f))),i.updateIframe=function(t){if(!t.src){var n=t.content||t.children;if(n){var e=i.refs.frame;if(e){var r=e.contentDocument;r&&("string"==typeof n?(r.open(),r.write(n),r.close()):(r.open(),r.write('<div id="iframe-root"></div>'),r.close(),s.default.render(n,r.getElementById("iframe-root"))))}}}},i.injectIframeResizerUrl=function(){if(i.props.iframeResizerUrl){var t=i.refs.frame;if(t){var n=t.contentDocument;if(n){var e=null;if(["head","HEAD","body","BODY","div","DIV"].forEach(function(t){if(!e){var r=n.getElementsByTagName(t);r&&r.length&&(e=r[0])}}),e){var r=document.createElement("script");r.type="text/javascript",r.src=i.props.iframeResizerUrl,e.appendChild(r)}else console.error("Unable to inject iframe resizer script")}}}},i.onLoad=function(){i.injectIframeResizerUrl()},i.resizeIframe=function(t){var n=i.refs.frame;n&&t.iframeResizerEnable&&(0,l.iframeResizer)(t.iframeResizerOptions,n)},c=e,(0,u.default)(i,c)}return(0,c.default)(n,t),(0,i.default)(n,[{key:"componentDidMount",value:function(){this.updateIframe(this.props),this.resizeIframe(this.props)}},{key:"componentWillReceiveProps",value:function(t){this.updateIframe(t),this.resizeIframe(t)}},{key:"render",value:function(){var t=this.props,n=t.src,e=t.id,r=t.frameBorder,o=t.className,i=t.style;return a.default.createElement("iframe",{ref:"frame",src:n,id:e,frameBorder:r,className:o,style:i,onLoad:this.onLoad})}}]),n}(a.default.Component);h.propTypes={content:f.default.oneOfType([f.default.string,f.default.element]),src:f.default.string,iframeResizerEnable:f.default.bool,iframeResizerOptions:f.default.object,iframeResizerUrl:f.default.oneOfType([f.default.string,f.default.bool]),id:f.default.string,frameBorder:f.default.number,className:f.default.string,style:f.default.object},h.defaultProps={iframeResizerEnable:!0,iframeResizerOptions:{},iframeResizerUrl:"https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.8/iframeResizer.contentWindow.min.js",frameBorder:0,style:{width:"100%",minHeight:20}},n.default=h},,,,,,,,,,,,,,,,function(t,n,e){t.exports=e(174)},function(t,n,e){"use strict";e.r(n),function(t){var n=e(156),r=e.n(n),o=e(157),i=e.n(o),u=e(112);function c(t){return(c="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==c(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,n){return(l=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}t._babelPolyfill||e(175);var p=window.VPAdminGutenbergVariables,h=wp.i18n.__,d=wp.element,v=d.Component,y=d.Fragment,g=d.RawHTML,m=wp.blocks.registerBlockType,b=wp.components,w=b.Placeholder,S=b.Spinner,x=b.SelectControl,_=wp.apiFetch,O=wp.data,E=O.registerStore,M=O.withSelect,P={apiFetch:function(t){return{type:"API_FETCH",request:t}},setPortfolioLayouts:function(t,n){return{type:"SET_PORTFOLIO_LAYOUTS",query:t,layouts:n}}};E("nk/visual-portfolio",{reducer:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{layouts:{}},n=arguments.length>1?arguments[1]:void 0;switch(n.type){case"SET_PORTFOLIO_LAYOUTS":return!t.layouts[n.query]&&n.layouts&&(t.layouts[n.query]=n.layouts),t}return t},actions:P,selectors:{getPortfolioLayouts:function(t,n){return t.layouts[n]}},controls:{API_FETCH:function(t){var n=t.request;return _(n).catch(function(t){return!(!t||!t.error||"no_layouts_found"!==t.error_code)&&{response:[],error:!1,success:!0}}).then(function(t){return!!(t&&t.success&&t.response)&&t.response})}},resolvers:{getPortfolioLayouts:regeneratorRuntime.mark(function t(n){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,P.apiFetch({path:n});case 2:return e=t.sent,t.abrupt("return",P.setPortfolioLayouts(n,e));case 4:case"end":return t.stop()}},t,this)})}});var T=function(t){function n(){return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),f(this,s(n).apply(this,arguments))}return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&l(t,n)}(n,v),function(t,n,e){n&&a(t.prototype,n),e&&a(t,e)}(n,[{key:"shouldComponentUpdate",value:function(t){return this.props.attributes.id!==t.attributes.id||this.props.portfolioLayouts!==t.portfolioLayouts||this.props.className!==t.className}},{key:"render",value:function(){var t=this.props,n=t.portfolioLayouts,e=t.attributes,o=t.setAttributes,c=this.props.className,a=e.id,f=e.ghostkitClassname,s=!1,l=!1;f&&(c=r()(c,f)),n?(s=[{label:h("--- Select layout ---"),value:""}],Object.keys(n).map(function(t){var e=n[t];s.push({label:"#".concat(e.id," - ").concat(e.title),value:e.id}),a&&parseInt(a,10)===e.id&&(l=e.edit_url)})):a&&(s=[{label:"#".concat(a),value:a}]);var d=p.preview_url+(p.preview_url.split("?")[1]?"&":"?")+"vp_preview_frame=true&vp_preview_frame_id=".concat(a);return wp.element.createElement("div",{className:c},wp.element.createElement(w,{className:"visual-portfolio-gutenberg-placeholder",icon:wp.element.createElement(u.a,null),label:h("Visual Portfolio")},!Array.isArray(s)&&wp.element.createElement(S,null),Array.isArray(s)&&s.length&&wp.element.createElement(y,null,l&&wp.element.createElement("a",{href:l,target:"_blank"},h("Edit Layout")),wp.element.createElement(x,{value:a,onChange:function(t){return o({id:t})},options:s})),Array.isArray(s)&&!s.length&&h("No portfolio layouts found.")),a?wp.element.createElement("div",{className:"visual-portfolio-gutenberg-preview"},wp.element.createElement(i.a,{src:d,iframeResizerOptions:{resizedCallback:function(t){t.iframe&&jQuery(t.iframe).css("margin-bottom",-jQuery(t.iframe).height()/2)}}})):"")}}]),n}();m("nk/visual-portfolio",{title:"Visual Portfolio",icon:u.a,category:"common",keywords:["visual portfolio","vp","portfolio"],ghostkit:{supports:{spacings:!0,display:!0,scrollReveal:!0}},supports:{anchor:!0,className:!0,html:!1,align:["wide","full"]},attributes:{id:{type:"string"}},edit:M(function(t){return{portfolioLayouts:t("nk/visual-portfolio").getPortfolioLayouts("/visual-portfolio/v1/get_layouts/")}})(T),save:function(t){var n=t.attributes,e=n.id,r=n.className,o="[visual_portfolio";return e&&(o+=' id="'.concat(e,'"')),r&&(o+=' class="'.concat(r,'"')),o+="]",wp.element.createElement(g,null,o)},transforms:{from:[{type:"shortcode",tag:"visual_portfolio",attributes:{id:{type:"string",shortcode:function(t){return t.named.id}},className:{type:"string",shortcode:function(t){return t.named.class}}}}]}})}.call(this,e(59))},function(t,n,e){"use strict";(function(t){e(176),e(320),e(322),e(324),e(326),e(328),e(330),e(332),e(334),e(336),e(340),t._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),t._babelPolyfill=!0}).call(this,e(59))},function(t,n,e){e(177),e(179),e(180),e(181),e(182),e(183),e(184),e(185),e(186),e(187),e(188),e(189),e(190),e(191),e(192),e(193),e(195),e(196),e(197),e(198),e(199),e(200),e(201),e(202),e(203),e(204),e(205),e(206),e(207),e(208),e(209),e(210),e(211),e(212),e(213),e(214),e(215),e(216),e(217),e(218),e(219),e(220),e(221),e(223),e(224),e(225),e(226),e(227),e(228),e(229),e(230),e(231),e(232),e(233),e(234),e(235),e(236),e(237),e(238),e(239),e(240),e(241),e(242),e(243),e(244),e(245),e(246),e(247),e(248),e(249),e(250),e(251),e(252),e(253),e(254),e(255),e(256),e(258),e(259),e(261),e(262),e(263),e(264),e(265),e(266),e(267),e(270),e(271),e(272),e(273),e(274),e(275),e(276),e(277),e(278),e(279),e(280),e(281),e(282),e(95),e(283),e(284),e(132),e(285),e(286),e(287),e(288),e(133),e(291),e(292),e(293),e(294),e(295),e(296),e(297),e(298),e(299),e(300),e(301),e(302),e(303),e(304),e(305),e(306),e(307),e(308),e(309),e(310),e(311),e(312),e(313),e(314),e(315),e(316),e(317),e(318),e(319),t.exports=e(8)},function(t,n,e){"use strict";var r=e(2),o=e(12),i=e(7),u=e(0),c=e(10),a=e(28).KEY,f=e(1),s=e(75),l=e(42),p=e(32),h=e(5),d=e(76),v=e(114),y=e(178),g=e(79),m=e(4),b=e(3),w=e(14),S=e(27),x=e(31),_=e(36),O=e(117),E=e(17),M=e(6),P=e(34),T=E.f,F=M.f,I=O.f,j=r.Symbol,A=r.JSON,k=A&&A.stringify,N=h("_hidden"),L=h("toPrimitive"),R={}.propertyIsEnumerable,C=s("symbol-registry"),z=s("symbols"),D=s("op-symbols"),W=Object.prototype,V="function"==typeof j,B=r.QObject,U=!B||!B.prototype||!B.prototype.findChild,H=i&&f(function(){return 7!=_(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a})?function(t,n,e){var r=T(W,n);r&&delete W[n],F(t,n,e),r&&t!==W&&F(W,n,r)}:F,G=function(t){var n=z[t]=_(j.prototype);return n._k=t,n},q=V&&"symbol"==typeof j.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof j},Y=function(t,n,e){return t===W&&Y(D,n,e),m(t),n=S(n,!0),m(e),o(z,n)?(e.enumerable?(o(t,N)&&t[N][n]&&(t[N][n]=!1),e=_(e,{enumerable:x(0,!1)})):(o(t,N)||F(t,N,x(1,{})),t[N][n]=!0),H(t,n,e)):F(t,n,e)},J=function(t,n){m(t);for(var e,r=y(n=w(n)),o=0,i=r.length;i>o;)Y(t,e=r[o++],n[e]);return t},K=function(t){var n=R.call(this,t=S(t,!0));return!(this===W&&o(z,t)&&!o(D,t))&&(!(n||!o(this,t)||!o(z,t)||o(this,N)&&this[N][t])||n)},X=function(t,n){if(t=w(t),n=S(n,!0),t!==W||!o(z,n)||o(D,n)){var e=T(t,n);return!e||!o(z,n)||o(t,N)&&t[N][n]||(e.enumerable=!0),e}},Q=function(t){for(var n,e=I(w(t)),r=[],i=0;e.length>i;)o(z,n=e[i++])||n==N||n==a||r.push(n);return r},$=function(t){for(var n,e=t===W,r=I(e?D:w(t)),i=[],u=0;r.length>u;)!o(z,n=r[u++])||e&&!o(W,n)||i.push(z[n]);return i};V||(c((j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),n=function(e){this===W&&n.call(D,e),o(this,N)&&o(this[N],t)&&(this[N][t]=!1),H(this,t,x(1,e))};return i&&U&&H(W,t,{configurable:!0,set:n}),G(t)}).prototype,"toString",function(){return this._k}),E.f=X,M.f=Y,e(37).f=O.f=Q,e(55).f=K,e(61).f=$,i&&!e(33)&&c(W,"propertyIsEnumerable",K,!0),d.f=function(t){return G(h(t))}),u(u.G+u.W+u.F*!V,{Symbol:j});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Z.length>tt;)h(Z[tt++]);for(var nt=P(h.store),et=0;nt.length>et;)v(nt[et++]);u(u.S+u.F*!V,"Symbol",{for:function(t){return o(C,t+="")?C[t]:C[t]=j(t)},keyFor:function(t){if(!q(t))throw TypeError(t+" is not a symbol!");for(var n in C)if(C[n]===t)return n},useSetter:function(){U=!0},useSimple:function(){U=!1}}),u(u.S+u.F*!V,"Object",{create:function(t,n){return void 0===n?_(t):J(_(t),n)},defineProperty:Y,defineProperties:J,getOwnPropertyDescriptor:X,getOwnPropertyNames:Q,getOwnPropertySymbols:$}),A&&u(u.S+u.F*(!V||f(function(){var t=j();return"[null]"!=k([t])||"{}"!=k({a:t})||"{}"!=k(Object(t))})),"JSON",{stringify:function(t){for(var n,e,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(e=n=r[1],(b(n)||void 0!==t)&&!q(t))return g(n)||(n=function(t,n){if("function"==typeof e&&(n=e.call(this,t,n)),!q(n))return n}),r[1]=n,k.apply(A,r)}}),j.prototype[L]||e(13)(j.prototype,L,j.prototype.valueOf),l(j,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(t,n,e){var r=e(34),o=e(61),i=e(55);t.exports=function(t){var n=r(t),e=o.f;if(e)for(var u,c=e(t),a=i.f,f=0;c.length>f;)a.call(t,u=c[f++])&&n.push(u);return n}},function(t,n,e){var r=e(0);r(r.S,"Object",{create:e(36)})},function(t,n,e){var r=e(0);r(r.S+r.F*!e(7),"Object",{defineProperty:e(6).f})},function(t,n,e){var r=e(0);r(r.S+r.F*!e(7),"Object",{defineProperties:e(116)})},function(t,n,e){var r=e(14),o=e(17).f;e(18)("getOwnPropertyDescriptor",function(){return function(t,n){return o(r(t),n)}})},function(t,n,e){var r=e(15),o=e(38);e(18)("getPrototypeOf",function(){return function(t){return o(r(t))}})},function(t,n,e){var r=e(15),o=e(34);e(18)("keys",function(){return function(t){return o(r(t))}})},function(t,n,e){e(18)("getOwnPropertyNames",function(){return e(117).f})},function(t,n,e){var r=e(3),o=e(28).onFreeze;e(18)("freeze",function(t){return function(n){return t&&r(n)?t(o(n)):n}})},function(t,n,e){var r=e(3),o=e(28).onFreeze;e(18)("seal",function(t){return function(n){return t&&r(n)?t(o(n)):n}})},function(t,n,e){var r=e(3),o=e(28).onFreeze;e(18)("preventExtensions",function(t){return function(n){return t&&r(n)?t(o(n)):n}})},function(t,n,e){var r=e(3);e(18)("isFrozen",function(t){return function(n){return!r(n)||!!t&&t(n)}})},function(t,n,e){var r=e(3);e(18)("isSealed",function(t){return function(n){return!r(n)||!!t&&t(n)}})},function(t,n,e){var r=e(3);e(18)("isExtensible",function(t){return function(n){return!!r(n)&&(!t||t(n))}})},function(t,n,e){var r=e(0);r(r.S+r.F,"Object",{assign:e(118)})},function(t,n,e){var r=e(0);r(r.S,"Object",{is:e(194)})},function(t,n){t.exports=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n}},function(t,n,e){var r=e(0);r(r.S,"Object",{setPrototypeOf:e(81).set})},function(t,n,e){"use strict";var r=e(62),o={};o[e(5)("toStringTag")]="z",o+""!="[object z]"&&e(10)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,n,e){var r=e(0);r(r.P,"Function",{bind:e(119)})},function(t,n,e){var r=e(6).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||e(7)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},function(t,n,e){"use strict";var r=e(3),o=e(38),i=e(5)("hasInstance"),u=Function.prototype;i in u||e(6).f(u,i,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=o(t);)if(this.prototype===t)return!0;return!1}})},function(t,n,e){var r=e(0),o=e(121);r(r.G+r.F*(parseInt!=o),{parseInt:o})},function(t,n,e){var r=e(0),o=e(122);r(r.G+r.F*(parseFloat!=o),{parseFloat:o})},function(t,n,e){"use strict";var r=e(2),o=e(12),i=e(22),u=e(83),c=e(27),a=e(1),f=e(37).f,s=e(17).f,l=e(6).f,p=e(63).trim,h=r.Number,d=h,v=h.prototype,y="Number"==i(e(36)(v)),g="trim"in String.prototype,m=function(t){var n=c(t,!1);if("string"==typeof n&&n.length>2){var e,r,o,i=(n=g?n.trim():p(n,3)).charCodeAt(0);if(43===i||45===i){if(88===(e=n.charCodeAt(2))||120===e)return NaN}else if(48===i){switch(n.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+n}for(var u,a=n.slice(2),f=0,s=a.length;f<s;f++)if((u=a.charCodeAt(f))<48||u>o)return NaN;return parseInt(a,r)}}return+n};if(!h(" 0o1")||!h("0b1")||h("+0x1")){h=function(t){var n=arguments.length<1?0:t,e=this;return e instanceof h&&(y?a(function(){v.valueOf.call(e)}):"Number"!=i(e))?u(new d(m(n)),e,h):m(n)};for(var b,w=e(7)?f(d):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),S=0;w.length>S;S++)o(d,b=w[S])&&!o(h,b)&&l(h,b,s(d,b));h.prototype=v,v.constructor=h,e(10)(r,"Number",h)}},function(t,n,e){"use strict";var r=e(0),o=e(24),i=e(123),u=e(84),c=1..toFixed,a=Math.floor,f=[0,0,0,0,0,0],s="Number.toFixed: incorrect invocation!",l=function(t,n){for(var e=-1,r=n;++e<6;)r+=t*f[e],f[e]=r%1e7,r=a(r/1e7)},p=function(t){for(var n=6,e=0;--n>=0;)e+=f[n],f[n]=a(e/t),e=e%t*1e7},h=function(){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==f[t]){var e=String(f[t]);n=""===n?e:n+u.call("0",7-e.length)+e}return n},d=function(t,n,e){return 0===n?e:n%2==1?d(t,n-1,e*t):d(t*t,n/2,e)};r(r.P+r.F*(!!c&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!e(1)(function(){c.call({})})),"Number",{toFixed:function(t){var n,e,r,c,a=i(this,s),f=o(t),v="",y="0";if(f<0||f>20)throw RangeError(s);if(a!=a)return"NaN";if(a<=-1e21||a>=1e21)return String(a);if(a<0&&(v="-",a=-a),a>1e-21)if(e=(n=function(t){for(var n=0,e=t;e>=4096;)n+=12,e/=4096;for(;e>=2;)n+=1,e/=2;return n}(a*d(2,69,1))-69)<0?a*d(2,-n,1):a/d(2,n,1),e*=4503599627370496,(n=52-n)>0){for(l(0,e),r=f;r>=7;)l(1e7,0),r-=7;for(l(d(10,r,1),0),r=n-1;r>=23;)p(1<<23),r-=23;p(1<<r),l(1,1),p(2),y=h()}else l(0,e),l(1<<-n,0),y=h()+u.call("0",f);return y=f>0?v+((c=y.length)<=f?"0."+u.call("0",f-c)+y:y.slice(0,c-f)+"."+y.slice(c-f)):v+y}})},function(t,n,e){"use strict";var r=e(0),o=e(1),i=e(123),u=1..toPrecision;r(r.P+r.F*(o(function(){return"1"!==u.call(1,void 0)})||!o(function(){u.call({})})),"Number",{toPrecision:function(t){var n=i(this,"Number#toPrecision: incorrect invocation!");return void 0===t?u.call(n):u.call(n,t)}})},function(t,n,e){var r=e(0);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,n,e){var r=e(0),o=e(2).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&o(t)}})},function(t,n,e){var r=e(0);r(r.S,"Number",{isInteger:e(124)})},function(t,n,e){var r=e(0);r(r.S,"Number",{isNaN:function(t){return t!=t}})},function(t,n,e){var r=e(0),o=e(124),i=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return o(t)&&i(t)<=9007199254740991}})},function(t,n,e){var r=e(0);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,n,e){var r=e(0);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,n,e){var r=e(0),o=e(122);r(r.S+r.F*(Number.parseFloat!=o),"Number",{parseFloat:o})},function(t,n,e){var r=e(0),o=e(121);r(r.S+r.F*(Number.parseInt!=o),"Number",{parseInt:o})},function(t,n,e){var r=e(0),o=e(125),i=Math.sqrt,u=Math.acosh;r(r.S+r.F*!(u&&710==Math.floor(u(Number.MAX_VALUE))&&u(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:o(t-1+i(t-1)*i(t+1))}})},function(t,n,e){var r=e(0),o=Math.asinh;r(r.S+r.F*!(o&&1/o(0)>0),"Math",{asinh:function t(n){return isFinite(n=+n)&&0!=n?n<0?-t(-n):Math.log(n+Math.sqrt(n*n+1)):n}})},function(t,n,e){var r=e(0),o=Math.atanh;r(r.S+r.F*!(o&&1/o(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,n,e){var r=e(0),o=e(85);r(r.S,"Math",{cbrt:function(t){return o(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,n,e){var r=e(0);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,n,e){var r=e(0),o=Math.exp;r(r.S,"Math",{cosh:function(t){return(o(t=+t)+o(-t))/2}})},function(t,n,e){var r=e(0),o=e(86);r(r.S+r.F*(o!=Math.expm1),"Math",{expm1:o})},function(t,n,e){var r=e(0);r(r.S,"Math",{fround:e(222)})},function(t,n,e){var r=e(85),o=Math.pow,i=o(2,-52),u=o(2,-23),c=o(2,127)*(2-u),a=o(2,-126);t.exports=Math.fround||function(t){var n,e,o=Math.abs(t),f=r(t);return o<a?f*function(t){return t+1/i-1/i}(o/a/u)*a*u:(e=(n=(1+u/i)*o)-(n-o))>c||e!=e?f*(1/0):f*e}},function(t,n,e){var r=e(0),o=Math.abs;r(r.S,"Math",{hypot:function(t,n){for(var e,r,i=0,u=0,c=arguments.length,a=0;u<c;)a<(e=o(arguments[u++]))?(i=i*(r=a/e)*r+1,a=e):i+=e>0?(r=e/a)*r:e;return a===1/0?1/0:a*Math.sqrt(i)}})},function(t,n,e){var r=e(0),o=Math.imul;r(r.S+r.F*e(1)(function(){return-5!=o(4294967295,5)||2!=o.length}),"Math",{imul:function(t,n){var e=+t,r=+n,o=65535&e,i=65535&r;return 0|o*i+((65535&e>>>16)*i+o*(65535&r>>>16)<<16>>>0)}})},function(t,n,e){var r=e(0);r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},function(t,n,e){var r=e(0);r(r.S,"Math",{log1p:e(125)})},function(t,n,e){var r=e(0);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,n,e){var r=e(0);r(r.S,"Math",{sign:e(85)})},function(t,n,e){var r=e(0),o=e(86),i=Math.exp;r(r.S+r.F*e(1)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(o(t)-o(-t))/2:(i(t-1)-i(-t-1))*(Math.E/2)}})},function(t,n,e){var r=e(0),o=e(86),i=Math.exp;r(r.S,"Math",{tanh:function(t){var n=o(t=+t),e=o(-t);return n==1/0?1:e==1/0?-1:(n-e)/(i(t)+i(-t))}})},function(t,n,e){var r=e(0);r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,n,e){var r=e(0),o=e(35),i=String.fromCharCode,u=String.fromCodePoint;r(r.S+r.F*(!!u&&1!=u.length),"String",{fromCodePoint:function(t){for(var n,e=[],r=arguments.length,u=0;r>u;){if(n=+arguments[u++],o(n,1114111)!==n)throw RangeError(n+" is not a valid code point");e.push(n<65536?i(n):i(55296+((n-=65536)>>10),n%1024+56320))}return e.join("")}})},function(t,n,e){var r=e(0),o=e(14),i=e(9);r(r.S,"String",{raw:function(t){for(var n=o(t.raw),e=i(n.length),r=arguments.length,u=[],c=0;e>c;)u.push(String(n[c++])),c<r&&u.push(String(arguments[c]));return u.join("")}})},function(t,n,e){"use strict";e(63)("trim",function(t){return function(){return t(this,3)}})},function(t,n,e){"use strict";var r=e(126)(!0);e(87)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,e=this._i;return e>=n.length?{value:void 0,done:!0}:(t=r(n,e),this._i+=t.length,{value:t,done:!1})})},function(t,n,e){"use strict";var r=e(0),o=e(126)(!1);r(r.P,"String",{codePointAt:function(t){return o(this,t)}})},function(t,n,e){"use strict";var r=e(0),o=e(9),i=e(88),u="".endsWith;r(r.P+r.F*e(90)("endsWith"),"String",{endsWith:function(t){var n=i(this,t,"endsWith"),e=arguments.length>1?arguments[1]:void 0,r=o(n.length),c=void 0===e?r:Math.min(o(e),r),a=String(t);return u?u.call(n,a,c):n.slice(c-a.length,c)===a}})},function(t,n,e){"use strict";var r=e(0),o=e(88);r(r.P+r.F*e(90)("includes"),"String",{includes:function(t){return!!~o(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,n,e){var r=e(0);r(r.P,"String",{repeat:e(84)})},function(t,n,e){"use strict";var r=e(0),o=e(9),i=e(88),u="".startsWith;r(r.P+r.F*e(90)("startsWith"),"String",{startsWith:function(t){var n=i(this,t,"startsWith"),e=o(Math.min(arguments.length>1?arguments[1]:void 0,n.length)),r=String(t);return u?u.call(n,r,e):n.slice(e,e+r.length)===r}})},function(t,n,e){"use strict";e(11)("anchor",function(t){return function(n){return t(this,"a","name",n)}})},function(t,n,e){"use strict";e(11)("big",function(t){return function(){return t(this,"big","","")}})},function(t,n,e){"use strict";e(11)("blink",function(t){return function(){return t(this,"blink","","")}})},function(t,n,e){"use strict";e(11)("bold",function(t){return function(){return t(this,"b","","")}})},function(t,n,e){"use strict";e(11)("fixed",function(t){return function(){return t(this,"tt","","")}})},function(t,n,e){"use strict";e(11)("fontcolor",function(t){return function(n){return t(this,"font","color",n)}})},function(t,n,e){"use strict";e(11)("fontsize",function(t){return function(n){return t(this,"font","size",n)}})},function(t,n,e){"use strict";e(11)("italics",function(t){return function(){return t(this,"i","","")}})},function(t,n,e){"use strict";e(11)("link",function(t){return function(n){return t(this,"a","href",n)}})},function(t,n,e){"use strict";e(11)("small",function(t){return function(){return t(this,"small","","")}})},function(t,n,e){"use strict";e(11)("strike",function(t){return function(){return t(this,"strike","","")}})},function(t,n,e){"use strict";e(11)("sub",function(t){return function(){return t(this,"sub","","")}})},function(t,n,e){"use strict";e(11)("sup",function(t){return function(){return t(this,"sup","","")}})},function(t,n,e){var r=e(0);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(t,n,e){"use strict";var r=e(0),o=e(15),i=e(27);r(r.P+r.F*e(1)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var n=o(this),e=i(n);return"number"!=typeof e||isFinite(e)?n.toISOString():null}})},function(t,n,e){var r=e(0),o=e(257);r(r.P+r.F*(Date.prototype.toISOString!==o),"Date",{toISOString:o})},function(t,n,e){"use strict";var r=e(1),o=Date.prototype.getTime,i=Date.prototype.toISOString,u=function(t){return t>9?t:"0"+t};t.exports=r(function(){return"0385-07-25T07:06:39.999Z"!=i.call(new Date(-5e13-1))})||!r(function(){i.call(new Date(NaN))})?function(){if(!isFinite(o.call(this)))throw RangeError("Invalid time value");var t=this,n=t.getUTCFullYear(),e=t.getUTCMilliseconds(),r=n<0?"-":n>9999?"+":"";return r+("00000"+Math.abs(n)).slice(r?-6:-4)+"-"+u(t.getUTCMonth()+1)+"-"+u(t.getUTCDate())+"T"+u(t.getUTCHours())+":"+u(t.getUTCMinutes())+":"+u(t.getUTCSeconds())+"."+(e>99?e:"0"+u(e))+"Z"}:i},function(t,n,e){var r=Date.prototype,o=r.toString,i=r.getTime;new Date(NaN)+""!="Invalid Date"&&e(10)(r,"toString",function(){var t=i.call(this);return t==t?o.call(this):"Invalid Date"})},function(t,n,e){var r=e(5)("toPrimitive"),o=Date.prototype;r in o||e(13)(o,r,e(260))},function(t,n,e){"use strict";var r=e(4),o=e(27);t.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return o(r(this),"number"!=t)}},function(t,n,e){var r=e(0);r(r.S,"Array",{isArray:e(79)})},function(t,n,e){"use strict";var r=e(20),o=e(0),i=e(15),u=e(128),c=e(91),a=e(9),f=e(92),s=e(93);o(o.S+o.F*!e(64)(function(t){Array.from(t)}),"Array",{from:function(t){var n,e,o,l,p=i(t),h="function"==typeof this?this:Array,d=arguments.length,v=d>1?arguments[1]:void 0,y=void 0!==v,g=0,m=s(p);if(y&&(v=r(v,d>2?arguments[2]:void 0,2)),void 0==m||h==Array&&c(m))for(e=new h(n=a(p.length));n>g;g++)f(e,g,y?v(p[g],g):p[g]);else for(l=m.call(p),e=new h;!(o=l.next()).done;g++)f(e,g,y?u(l,v,[o.value,g],!0):o.value);return e.length=g,e}})},function(t,n,e){"use strict";var r=e(0),o=e(92);r(r.S+r.F*e(1)(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,n=arguments.length,e=new("function"==typeof this?this:Array)(n);n>t;)o(e,t,arguments[t++]);return e.length=n,e}})},function(t,n,e){"use strict";var r=e(0),o=e(14),i=[].join;r(r.P+r.F*(e(54)!=Object||!e(16)(i)),"Array",{join:function(t){return i.call(o(this),void 0===t?",":t)}})},function(t,n,e){"use strict";var r=e(0),o=e(80),i=e(22),u=e(35),c=e(9),a=[].slice;r(r.P+r.F*e(1)(function(){o&&a.call(o)}),"Array",{slice:function(t,n){var e=c(this.length),r=i(this);if(n=void 0===n?e:n,"Array"==r)return a.call(this,t,n);for(var o=u(t,e),f=u(n,e),s=c(f-o),l=new Array(s),p=0;p<s;p++)l[p]="String"==r?this.charAt(o+p):this[o+p];return l}})},function(t,n,e){"use strict";var r=e(0),o=e(21),i=e(15),u=e(1),c=[].sort,a=[1,2,3];r(r.P+r.F*(u(function(){a.sort(void 0)})||!u(function(){a.sort(null)})||!e(16)(c)),"Array",{sort:function(t){return void 0===t?c.call(i(this)):c.call(i(this),o(t))}})},function(t,n,e){"use strict";var r=e(0),o=e(19)(0),i=e(16)([].forEach,!0);r(r.P+r.F*!i,"Array",{forEach:function(t){return o(this,t,arguments[1])}})},function(t,n,e){var r=e(269);t.exports=function(t,n){return new(r(t))(n)}},function(t,n,e){var r=e(3),o=e(79),i=e(5)("species");t.exports=function(t){var n;return o(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!o(n.prototype)||(n=void 0),r(n)&&null===(n=n[i])&&(n=void 0)),void 0===n?Array:n}},function(t,n,e){"use strict";var r=e(0),o=e(19)(1);r(r.P+r.F*!e(16)([].map,!0),"Array",{map:function(t){return o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(19)(2);r(r.P+r.F*!e(16)([].filter,!0),"Array",{filter:function(t){return o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(19)(3);r(r.P+r.F*!e(16)([].some,!0),"Array",{some:function(t){return o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(19)(4);r(r.P+r.F*!e(16)([].every,!0),"Array",{every:function(t){return o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(129);r(r.P+r.F*!e(16)([].reduce,!0),"Array",{reduce:function(t){return o(this,t,arguments.length,arguments[1],!1)}})},function(t,n,e){"use strict";var r=e(0),o=e(129);r(r.P+r.F*!e(16)([].reduceRight,!0),"Array",{reduceRight:function(t){return o(this,t,arguments.length,arguments[1],!0)}})},function(t,n,e){"use strict";var r=e(0),o=e(60)(!1),i=[].indexOf,u=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(u||!e(16)(i)),"Array",{indexOf:function(t){return u?i.apply(this,arguments)||0:o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(14),i=e(24),u=e(9),c=[].lastIndexOf,a=!!c&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(a||!e(16)(c)),"Array",{lastIndexOf:function(t){if(a)return c.apply(this,arguments)||0;var n=o(this),e=u(n.length),r=e-1;for(arguments.length>1&&(r=Math.min(r,i(arguments[1]))),r<0&&(r=e+r);r>=0;r--)if(r in n&&n[r]===t)return r||0;return-1}})},function(t,n,e){var r=e(0);r(r.P,"Array",{copyWithin:e(130)}),e(44)("copyWithin")},function(t,n,e){var r=e(0);r(r.P,"Array",{fill:e(94)}),e(44)("fill")},function(t,n,e){"use strict";var r=e(0),o=e(19)(5),i=!0;"find"in[]&&Array(1).find(function(){i=!1}),r(r.P+r.F*i,"Array",{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),e(44)("find")},function(t,n,e){"use strict";var r=e(0),o=e(19)(6),i="findIndex",u=!0;i in[]&&Array(1)[i](function(){u=!1}),r(r.P+r.F*u,"Array",{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),e(44)(i)},function(t,n,e){e(45)("Array")},function(t,n,e){var r=e(2),o=e(83),i=e(6).f,u=e(37).f,c=e(89),a=e(96),f=r.RegExp,s=f,l=f.prototype,p=/a/g,h=/a/g,d=new f(p)!==p;if(e(7)&&(!d||e(1)(function(){return h[e(5)("match")]=!1,f(p)!=p||f(h)==h||"/a/i"!=f(p,"i")}))){f=function(t,n){var e=this instanceof f,r=c(t),i=void 0===n;return!e&&r&&t.constructor===f&&i?t:o(d?new s(r&&!i?t.source:t,n):s((r=t instanceof f)?t.source:t,r&&i?a.call(t):n),e?this:l,f)};for(var v=function(t){t in f||i(f,t,{configurable:!0,get:function(){return s[t]},set:function(n){s[t]=n}})},y=u(s),g=0;y.length>g;)v(y[g++]);l.constructor=f,f.prototype=l,e(10)(r,"RegExp",f)}e(45)("RegExp")},function(t,n,e){"use strict";e(132);var r=e(4),o=e(96),i=e(7),u=/./.toString,c=function(t){e(10)(RegExp.prototype,"toString",t,!0)};e(1)(function(){return"/a/b"!=u.call({source:"a",flags:"b"})})?c(function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!i&&t instanceof RegExp?o.call(t):void 0)}):"toString"!=u.name&&c(function(){return u.call(this)})},function(t,n,e){e(65)("match",1,function(t,n,e){return[function(e){"use strict";var r=t(this),o=void 0==e?void 0:e[n];return void 0!==o?o.call(e,r):new RegExp(e)[n](String(r))},e]})},function(t,n,e){e(65)("replace",2,function(t,n,e){return[function(r,o){"use strict";var i=t(this),u=void 0==r?void 0:r[n];return void 0!==u?u.call(r,i,o):e.call(String(i),r,o)},e]})},function(t,n,e){e(65)("search",1,function(t,n,e){return[function(e){"use strict";var r=t(this),o=void 0==e?void 0:e[n];return void 0!==o?o.call(e,r):new RegExp(e)[n](String(r))},e]})},function(t,n,e){e(65)("split",2,function(t,n,r){"use strict";var o=e(89),i=r,u=[].push;if("c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length){var c=void 0===/()??/.exec("")[1];r=function(t,n){var e=String(this);if(void 0===t&&0===n)return[];if(!o(t))return i.call(e,t,n);var r,a,f,s,l,p=[],h=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),d=0,v=void 0===n?4294967295:n>>>0,y=new RegExp(t.source,h+"g");for(c||(r=new RegExp("^"+y.source+"$(?!\\s)",h));(a=y.exec(e))&&!((f=a.index+a[0].length)>d&&(p.push(e.slice(d,a.index)),!c&&a.length>1&&a[0].replace(r,function(){for(l=1;l<arguments.length-2;l++)void 0===arguments[l]&&(a[l]=void 0)}),a.length>1&&a.index<e.length&&u.apply(p,a.slice(1)),s=a[0].length,d=f,p.length>=v));)y.lastIndex===a.index&&y.lastIndex++;return d===e.length?!s&&y.test("")||p.push(""):p.push(e.slice(d)),p.length>v?p.slice(0,v):p}}else"0".split(void 0,0).length&&(r=function(t,n){return void 0===t&&0===n?[]:i.call(this,t,n)});return[function(e,o){var i=t(this),u=void 0==e?void 0:e[n];return void 0!==u?u.call(e,i,o):r.call(String(i),e,o)},r]})},function(t,n,e){var r=e(2),o=e(97).set,i=r.MutationObserver||r.WebKitMutationObserver,u=r.process,c=r.Promise,a="process"==e(22)(u);t.exports=function(){var t,n,e,f=function(){var r,o;for(a&&(r=u.domain)&&r.exit();t;){o=t.fn,t=t.next;try{o()}catch(r){throw t?e():n=void 0,r}}n=void 0,r&&r.enter()};if(a)e=function(){u.nextTick(f)};else if(!i||r.navigator&&r.navigator.standalone)if(c&&c.resolve){var s=c.resolve(void 0);e=function(){s.then(f)}}else e=function(){o.call(r,f)};else{var l=!0,p=document.createTextNode("");new i(f).observe(p,{characterData:!0}),e=function(){p.data=l=!l}}return function(r){var o={fn:r,next:void 0};n&&(n.next=o),t||(t=o,e()),n=o}}},function(t,n){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,n,e){"use strict";var r=e(136),o=e(48);t.exports=e(69)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var n=r.getEntry(o(this,"Map"),t);return n&&n.v},set:function(t,n){return r.def(o(this,"Map"),0===t?0:t,n)}},r,!0)},function(t,n,e){"use strict";var r=e(136),o=e(48);t.exports=e(69)("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"Set"),t=0===t?0:t,t)}},r)},function(t,n,e){"use strict";var r,o=e(19)(0),i=e(10),u=e(28),c=e(118),a=e(137),f=e(3),s=e(1),l=e(48),p=u.getWeak,h=Object.isExtensible,d=a.ufstore,v={},y=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},g={get:function(t){if(f(t)){var n=p(t);return!0===n?d(l(this,"WeakMap")).get(t):n?n[this._i]:void 0}},set:function(t,n){return a.def(l(this,"WeakMap"),t,n)}},m=t.exports=e(69)("WeakMap",y,g,a,!0,!0);s(function(){return 7!=(new m).set((Object.freeze||Object)(v),7).get(v)})&&(c((r=a.getConstructor(y,"WeakMap")).prototype,g),u.NEED=!0,o(["delete","has","get","set"],function(t){var n=m.prototype,e=n[t];i(n,t,function(n,o){if(f(n)&&!h(n)){this._f||(this._f=new r);var i=this._f[t](n,o);return"set"==t?this:i}return e.call(this,n,o)})}))},function(t,n,e){"use strict";var r=e(137),o=e(48);e(69)("WeakSet",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"WeakSet"),t,!0)}},r,!1,!0)},function(t,n,e){"use strict";var r=e(0),o=e(70),i=e(98),u=e(4),c=e(35),a=e(9),f=e(3),s=e(2).ArrayBuffer,l=e(67),p=i.ArrayBuffer,h=i.DataView,d=o.ABV&&s.isView,v=p.prototype.slice,y=o.VIEW;r(r.G+r.W+r.F*(s!==p),{ArrayBuffer:p}),r(r.S+r.F*!o.CONSTR,"ArrayBuffer",{isView:function(t){return d&&d(t)||f(t)&&y in t}}),r(r.P+r.U+r.F*e(1)(function(){return!new p(2).slice(1,void 0).byteLength}),"ArrayBuffer",{slice:function(t,n){if(void 0!==v&&void 0===n)return v.call(u(this),t);for(var e=u(this).byteLength,r=c(t,e),o=c(void 0===n?e:n,e),i=new(l(this,p))(a(o-r)),f=new h(this),s=new h(i),d=0;r<o;)s.setUint8(d++,f.getUint8(r++));return i}}),e(45)("ArrayBuffer")},function(t,n,e){var r=e(0);r(r.G+r.W+r.F*!e(70).ABV,{DataView:e(98).DataView})},function(t,n,e){e(25)("Int8",1,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(25)("Uint8",1,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(25)("Uint8",1,function(t){return function(n,e,r){return t(this,n,e,r)}},!0)},function(t,n,e){e(25)("Int16",2,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(25)("Uint16",2,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(25)("Int32",4,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(25)("Uint32",4,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(25)("Float32",4,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(25)("Float64",8,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){var r=e(0),o=e(21),i=e(4),u=(e(2).Reflect||{}).apply,c=Function.apply;r(r.S+r.F*!e(1)(function(){u(function(){})}),"Reflect",{apply:function(t,n,e){var r=o(t),a=i(e);return u?u(r,n,a):c.call(r,n,a)}})},function(t,n,e){var r=e(0),o=e(36),i=e(21),u=e(4),c=e(3),a=e(1),f=e(119),s=(e(2).Reflect||{}).construct,l=a(function(){function t(){}return!(s(function(){},[],t)instanceof t)}),p=!a(function(){s(function(){})});r(r.S+r.F*(l||p),"Reflect",{construct:function(t,n){i(t),u(n);var e=arguments.length<3?t:i(arguments[2]);if(p&&!l)return s(t,n,e);if(t==e){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var r=[null];return r.push.apply(r,n),new(f.apply(t,r))}var a=e.prototype,h=o(c(a)?a:Object.prototype),d=Function.apply.call(t,h,n);return c(d)?d:h}})},function(t,n,e){var r=e(6),o=e(0),i=e(4),u=e(27);o(o.S+o.F*e(1)(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,n,e){i(t),n=u(n,!0),i(e);try{return r.f(t,n,e),!0}catch(t){return!1}}})},function(t,n,e){var r=e(0),o=e(17).f,i=e(4);r(r.S,"Reflect",{deleteProperty:function(t,n){var e=o(i(t),n);return!(e&&!e.configurable)&&delete t[n]}})},function(t,n,e){"use strict";var r=e(0),o=e(4),i=function(t){this._t=o(t),this._i=0;var n,e=this._k=[];for(n in t)e.push(n)};e(127)(i,"Object",function(){var t,n=this._k;do{if(this._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[this._i++])in this._t));return{value:t,done:!1}}),r(r.S,"Reflect",{enumerate:function(t){return new i(t)}})},function(t,n,e){var r=e(17),o=e(38),i=e(12),u=e(0),c=e(3),a=e(4);u(u.S,"Reflect",{get:function t(n,e){var u,f,s=arguments.length<3?n:arguments[2];return a(n)===s?n[e]:(u=r.f(n,e))?i(u,"value")?u.value:void 0!==u.get?u.get.call(s):void 0:c(f=o(n))?t(f,e,s):void 0}})},function(t,n,e){var r=e(17),o=e(0),i=e(4);o(o.S,"Reflect",{getOwnPropertyDescriptor:function(t,n){return r.f(i(t),n)}})},function(t,n,e){var r=e(0),o=e(38),i=e(4);r(r.S,"Reflect",{getPrototypeOf:function(t){return o(i(t))}})},function(t,n,e){var r=e(0);r(r.S,"Reflect",{has:function(t,n){return n in t}})},function(t,n,e){var r=e(0),o=e(4),i=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return o(t),!i||i(t)}})},function(t,n,e){var r=e(0);r(r.S,"Reflect",{ownKeys:e(139)})},function(t,n,e){var r=e(0),o=e(4),i=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){o(t);try{return i&&i(t),!0}catch(t){return!1}}})},function(t,n,e){var r=e(6),o=e(17),i=e(38),u=e(12),c=e(0),a=e(31),f=e(4),s=e(3);c(c.S,"Reflect",{set:function t(n,e,c){var l,p,h=arguments.length<4?n:arguments[3],d=o.f(f(n),e);if(!d){if(s(p=i(n)))return t(p,e,c,h);d=a(0)}if(u(d,"value")){if(!1===d.writable||!s(h))return!1;if(l=o.f(h,e)){if(l.get||l.set||!1===l.writable)return!1;l.value=c,r.f(h,e,l)}else r.f(h,e,a(0,c));return!0}return void 0!==d.set&&(d.set.call(h,c),!0)}})},function(t,n,e){var r=e(0),o=e(81);o&&r(r.S,"Reflect",{setPrototypeOf:function(t,n){o.check(t,n);try{return o.set(t,n),!0}catch(t){return!1}}})},function(t,n,e){e(321),t.exports=e(8).Array.includes},function(t,n,e){"use strict";var r=e(0),o=e(60)(!0);r(r.P,"Array",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),e(44)("includes")},function(t,n,e){e(323),t.exports=e(8).String.padStart},function(t,n,e){"use strict";var r=e(0),o=e(140),i=e(68);r(r.P+r.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(i),"String",{padStart:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,n,e){e(325),t.exports=e(8).String.padEnd},function(t,n,e){"use strict";var r=e(0),o=e(140),i=e(68);r(r.P+r.F*/Version\/10\.\d+(\.\d+)? Safari\//.test(i),"String",{padEnd:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},function(t,n,e){e(327),t.exports=e(76).f("asyncIterator")},function(t,n,e){e(114)("asyncIterator")},function(t,n,e){e(329),t.exports=e(8).Object.getOwnPropertyDescriptors},function(t,n,e){var r=e(0),o=e(139),i=e(14),u=e(17),c=e(92);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var n,e,r=i(t),a=u.f,f=o(r),s={},l=0;f.length>l;)void 0!==(e=a(r,n=f[l++]))&&c(s,n,e);return s}})},function(t,n,e){e(331),t.exports=e(8).Object.values},function(t,n,e){var r=e(0),o=e(141)(!1);r(r.S,"Object",{values:function(t){return o(t)}})},function(t,n,e){e(333),t.exports=e(8).Object.entries},function(t,n,e){var r=e(0),o=e(141)(!0);r(r.S,"Object",{entries:function(t){return o(t)}})},function(t,n,e){"use strict";e(133),e(335),t.exports=e(8).Promise.finally},function(t,n,e){"use strict";var r=e(0),o=e(8),i=e(2),u=e(67),c=e(135);r(r.P+r.R,"Promise",{finally:function(t){var n=u(this,o.Promise||i.Promise),e="function"==typeof t;return this.then(e?function(e){return c(n,t()).then(function(){return e})}:t,e?function(e){return c(n,t()).then(function(){throw e})}:t)}})},function(t,n,e){e(337),e(338),e(339),t.exports=e(8)},function(t,n,e){var r=e(2),o=e(0),i=e(68),u=[].slice,c=/MSIE .\./.test(i),a=function(t){return function(n,e){var r=arguments.length>2,o=!!r&&u.call(arguments,2);return t(r?function(){("function"==typeof n?n:Function(n)).apply(this,o)}:n,e)}};o(o.G+o.B+o.F*c,{setTimeout:a(r.setTimeout),setInterval:a(r.setInterval)})},function(t,n,e){var r=e(0),o=e(97);r(r.G+r.B,{setImmediate:o.set,clearImmediate:o.clear})},function(t,n,e){for(var r=e(95),o=e(34),i=e(10),u=e(2),c=e(13),a=e(43),f=e(5),s=f("iterator"),l=f("toStringTag"),p=a.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=o(h),v=0;v<d.length;v++){var y,g=d[v],m=h[g],b=u[g],w=b&&b.prototype;if(w&&(w[s]||c(w,s,p),w[l]||c(w,l,g),a[g]=p,m))for(y in r)w[y]||i(w,y,r[y],!0)}},function(t,n){!function(n){"use strict";var e,r=Object.prototype,o=r.hasOwnProperty,i="function"==typeof Symbol?Symbol:{},u=i.iterator||"@@iterator",c=i.asyncIterator||"@@asyncIterator",a=i.toStringTag||"@@toStringTag",f="object"==typeof t,s=n.regeneratorRuntime;if(s)f&&(t.exports=s);else{(s=n.regeneratorRuntime=f?t.exports:{}).wrap=w;var l="suspendedStart",p="suspendedYield",h="executing",d="completed",v={},y={};y[u]=function(){return this};var g=Object.getPrototypeOf,m=g&&g(g(j([])));m&&m!==r&&o.call(m,u)&&(y=m);var b=O.prototype=x.prototype=Object.create(y);_.prototype=b.constructor=O,O.constructor=_,O[a]=_.displayName="GeneratorFunction",s.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===_||"GeneratorFunction"===(n.displayName||n.name))},s.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,O):(t.__proto__=O,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(b),t},s.awrap=function(t){return{__await:t}},E(M.prototype),M.prototype[c]=function(){return this},s.AsyncIterator=M,s.async=function(t,n,e,r){var o=new M(w(t,n,e,r));return s.isGeneratorFunction(n)?o:o.next().then(function(t){return t.done?t.value:o.next()})},E(b),b[a]="Generator",b[u]=function(){return this},b.toString=function(){return"[object Generator]"},s.keys=function(t){var n=[];for(var e in t)n.push(e);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},s.values=j,I.prototype={constructor:I,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(F),!t)for(var n in this)"t"===n.charAt(0)&&o.call(this,n)&&!isNaN(+n.slice(1))&&(this[n]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var n=this;function r(r,o){return c.type="throw",c.arg=t,n.next=r,o&&(n.method="next",n.arg=e),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],c=u.completion;if("root"===u.tryLoc)return r("end");if(u.tryLoc<=this.prev){var a=o.call(u,"catchLoc"),f=o.call(u,"finallyLoc");if(a&&f){if(this.prev<u.catchLoc)return r(u.catchLoc,!0);if(this.prev<u.finallyLoc)return r(u.finallyLoc)}else if(a){if(this.prev<u.catchLoc)return r(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return r(u.finallyLoc)}}}},abrupt:function(t,n){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc<=this.prev&&o.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=n,i?(this.method="next",this.next=i.finallyLoc,v):this.complete(u)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),v},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),F(e),v}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.tryLoc===t){var r=e.completion;if("throw"===r.type){var o=r.arg;F(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,n,r){return this.delegate={iterator:j(t),resultName:n,nextLoc:r},"next"===this.method&&(this.arg=e),v}}}function w(t,n,e,r){var o=n&&n.prototype instanceof x?n:x,i=Object.create(o.prototype),u=new I(r||[]);return i._invoke=function(t,n,e){var r=l;return function(o,i){if(r===h)throw new Error("Generator is already running");if(r===d){if("throw"===o)throw i;return A()}for(e.method=o,e.arg=i;;){var u=e.delegate;if(u){var c=P(u,e);if(c){if(c===v)continue;return c}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(r===l)throw r=d,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r=h;var a=S(t,n,e);if("normal"===a.type){if(r=e.done?d:p,a.arg===v)continue;return{value:a.arg,done:e.done}}"throw"===a.type&&(r=d,e.method="throw",e.arg=a.arg)}}}(t,e,u),i}function S(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}function x(){}function _(){}function O(){}function E(t){["next","throw","return"].forEach(function(n){t[n]=function(t){return this._invoke(n,t)}})}function M(t){var n;this._invoke=function(e,r){function i(){return new Promise(function(n,i){!function n(e,r,i,u){var c=S(t[e],t,r);if("throw"!==c.type){var a=c.arg,f=a.value;return f&&"object"==typeof f&&o.call(f,"__await")?Promise.resolve(f.__await).then(function(t){n("next",t,i,u)},function(t){n("throw",t,i,u)}):Promise.resolve(f).then(function(t){a.value=t,i(a)},u)}u(c.arg)}(e,r,n,i)})}return n=n?n.then(i,i):i()}}function P(t,n){var r=t.iterator[n.method];if(r===e){if(n.delegate=null,"throw"===n.method){if(t.iterator.return&&(n.method="return",n.arg=e,P(t,n),"throw"===n.method))return v;n.method="throw",n.arg=new TypeError("The iterator does not provide a 'throw' method")}return v}var o=S(r,t.iterator,n.arg);if("throw"===o.type)return n.method="throw",n.arg=o.arg,n.delegate=null,v;var i=o.arg;return i?i.done?(n[t.resultName]=i.value,n.next=t.nextLoc,"return"!==n.method&&(n.method="next",n.arg=e),n.delegate=null,v):i:(n.method="throw",n.arg=new TypeError("iterator result is not an object"),n.delegate=null,v)}function T(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function F(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function I(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function j(t){if(t){var n=t[u];if(n)return n.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,i=function n(){for(;++r<t.length;)if(o.call(t,r))return n.value=t[r],n.done=!1,n;return n.value=e,n.done=!0,n};return i.next=i}}return{next:A}}function A(){return{value:e,done:!0}}}(function(){return this}()||Function("return this")())},function(t,n,e){t.exports={default:e(342),__esModule:!0}},function(t,n,e){e(343),t.exports=e(26).Object.getPrototypeOf},function(t,n,e){var r=e(142),o=e(143);e(344)("getPrototypeOf",function(){return function(t){return o(r(t))}})},function(t,n,e){var r=e(49),o=e(26),i=e(57);t.exports=function(t,n){var e=(o.Object||{})[t]||Object[t],u={};u[t]=n(e),r(r.S+r.F*i(function(){e(1)}),"Object",u)}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,e){"use strict";n.__esModule=!0,n.default=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}},function(t,n,e){"use strict";n.__esModule=!0;var r=function(t){return t&&t.__esModule?t:{default:t}}(e(348));n.default=function(){function t(t,n){for(var e=0;e<n.length;e++){var o=n[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),(0,r.default)(t,o.key,o)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}()},function(t,n,e){t.exports={default:e(349),__esModule:!0}},function(t,n,e){e(350);var r=e(26).Object;t.exports=function(t,n,e){return r.defineProperty(t,n,e)}},function(t,n,e){var r=e(49);r(r.S+r.F*!e(41),"Object",{defineProperty:e(40).f})},function(t,n,e){"use strict";n.__esModule=!0;var r=function(t){return t&&t.__esModule?t:{default:t}}(e(147));n.default=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!==(void 0===n?"undefined":(0,r.default)(n))&&"function"!=typeof n?t:n}},function(t,n,e){t.exports={default:e(353),__esModule:!0}},function(t,n,e){e(354),e(363),t.exports=e(109).f("iterator")},function(t,n,e){"use strict";var r=e(355)(!0);e(148)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,e=this._i;return e>=n.length?{value:void 0,done:!0}:(t=r(n,e),this._i+=t.length,{value:t,done:!1})})},function(t,n,e){var r=e(103),o=e(99);t.exports=function(t){return function(n,e){var i,u,c=String(o(n)),a=r(e),f=c.length;return a<0||a>=f?t?"":void 0:(i=c.charCodeAt(a))<55296||i>56319||a+1===f||(u=c.charCodeAt(a+1))<56320||u>57343?t?c.charAt(a):i:t?c.slice(a,a+2):u-56320+(i-55296<<10)+65536}}},function(t,n,e){"use strict";var r=e(105),o=e(73),i=e(108),u={};e(50)(u,e(53)("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(u,{next:o(1,e)}),i(t,n+" Iterator")}},function(t,n,e){var r=e(40),o=e(56),i=e(106);t.exports=e(41)?Object.defineProperties:function(t,n){o(t);for(var e,u=i(n),c=u.length,a=0;c>a;)r.f(t,e=u[a++],n[e]);return t}},function(t,n,e){var r=e(151);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,n,e){var r=e(52),o=e(360),i=e(361);t.exports=function(t){return function(n,e,u){var c,a=r(n),f=o(a.length),s=i(u,f);if(t&&e!=e){for(;f>s;)if((c=a[s++])!=c)return!0}else for(;f>s;s++)if((t||s in a)&&a[s]===e)return t||s||0;return!t&&-1}}},function(t,n,e){var r=e(103),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,n,e){var r=e(103),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=r(t))<0?o(t+n,0):i(t,n)}},function(t,n,e){var r=e(29).document;t.exports=r&&r.documentElement},function(t,n,e){e(364);for(var r=e(29),o=e(50),i=e(104),u=e(53)("toStringTag"),c="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),a=0;a<c.length;a++){var f=c[a],s=r[f],l=s&&s.prototype;l&&!l[u]&&o(l,u,f),i[f]=i.Array}},function(t,n,e){"use strict";var r=e(365),o=e(366),i=e(104),u=e(52);t.exports=e(148)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,n){t.exports=function(){}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,e){t.exports={default:e(368),__esModule:!0}},function(t,n,e){e(369),e(374),e(375),e(376),t.exports=e(26).Symbol},function(t,n,e){"use strict";var r=e(29),o=e(39),i=e(41),u=e(49),c=e(149),a=e(370).KEY,f=e(57),s=e(101),l=e(108),p=e(72),h=e(53),d=e(109),v=e(110),y=e(371),g=e(372),m=e(56),b=e(51),w=e(52),S=e(102),x=e(73),_=e(105),O=e(373),E=e(154),M=e(40),P=e(106),T=E.f,F=M.f,I=O.f,j=r.Symbol,A=r.JSON,k=A&&A.stringify,N=h("_hidden"),L=h("toPrimitive"),R={}.propertyIsEnumerable,C=s("symbol-registry"),z=s("symbols"),D=s("op-symbols"),W=Object.prototype,V="function"==typeof j,B=r.QObject,U=!B||!B.prototype||!B.prototype.findChild,H=i&&f(function(){return 7!=_(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a})?function(t,n,e){var r=T(W,n);r&&delete W[n],F(t,n,e),r&&t!==W&&F(W,n,r)}:F,G=function(t){var n=z[t]=_(j.prototype);return n._k=t,n},q=V&&"symbol"==typeof j.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof j},Y=function(t,n,e){return t===W&&Y(D,n,e),m(t),n=S(n,!0),m(e),o(z,n)?(e.enumerable?(o(t,N)&&t[N][n]&&(t[N][n]=!1),e=_(e,{enumerable:x(0,!1)})):(o(t,N)||F(t,N,x(1,{})),t[N][n]=!0),H(t,n,e)):F(t,n,e)},J=function(t,n){m(t);for(var e,r=y(n=w(n)),o=0,i=r.length;i>o;)Y(t,e=r[o++],n[e]);return t},K=function(t){var n=R.call(this,t=S(t,!0));return!(this===W&&o(z,t)&&!o(D,t))&&(!(n||!o(this,t)||!o(z,t)||o(this,N)&&this[N][t])||n)},X=function(t,n){if(t=w(t),n=S(n,!0),t!==W||!o(z,n)||o(D,n)){var e=T(t,n);return!e||!o(z,n)||o(t,N)&&t[N][n]||(e.enumerable=!0),e}},Q=function(t){for(var n,e=I(w(t)),r=[],i=0;e.length>i;)o(z,n=e[i++])||n==N||n==a||r.push(n);return r},$=function(t){for(var n,e=t===W,r=I(e?D:w(t)),i=[],u=0;r.length>u;)!o(z,n=r[u++])||e&&!o(W,n)||i.push(z[n]);return i};V||(c((j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),n=function(e){this===W&&n.call(D,e),o(this,N)&&o(this[N],t)&&(this[N][t]=!1),H(this,t,x(1,e))};return i&&U&&H(W,t,{configurable:!0,set:n}),G(t)}).prototype,"toString",function(){return this._k}),E.f=X,M.f=Y,e(153).f=O.f=Q,e(111).f=K,e(152).f=$,i&&!e(71)&&c(W,"propertyIsEnumerable",K,!0),d.f=function(t){return G(h(t))}),u(u.G+u.W+u.F*!V,{Symbol:j});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Z.length>tt;)h(Z[tt++]);for(var nt=P(h.store),et=0;nt.length>et;)v(nt[et++]);u(u.S+u.F*!V,"Symbol",{for:function(t){return o(C,t+="")?C[t]:C[t]=j(t)},keyFor:function(t){if(!q(t))throw TypeError(t+" is not a symbol!");for(var n in C)if(C[n]===t)return n},useSetter:function(){U=!0},useSimple:function(){U=!1}}),u(u.S+u.F*!V,"Object",{create:function(t,n){return void 0===n?_(t):J(_(t),n)},defineProperty:Y,defineProperties:J,getOwnPropertyDescriptor:X,getOwnPropertyNames:Q,getOwnPropertySymbols:$}),A&&u(u.S+u.F*(!V||f(function(){var t=j();return"[null]"!=k([t])||"{}"!=k({a:t})||"{}"!=k(Object(t))})),"JSON",{stringify:function(t){for(var n,e,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(e=n=r[1],(b(n)||void 0!==t)&&!q(t))return g(n)||(n=function(t,n){if("function"==typeof e&&(n=e.call(this,t,n)),!q(n))return n}),r[1]=n,k.apply(A,r)}}),j.prototype[L]||e(50)(j.prototype,L,j.prototype.valueOf),l(j,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(t,n,e){var r=e(72)("meta"),o=e(51),i=e(39),u=e(40).f,c=0,a=Object.isExtensible||function(){return!0},f=!e(57)(function(){return a(Object.preventExtensions({}))}),s=function(t){u(t,r,{value:{i:"O"+ ++c,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!a(t))return"F";if(!n)return"E";s(t)}return t[r].i},getWeak:function(t,n){if(!i(t,r)){if(!a(t))return!0;if(!n)return!1;s(t)}return t[r].w},onFreeze:function(t){return f&&l.NEED&&a(t)&&!i(t,r)&&s(t),t}}},function(t,n,e){var r=e(106),o=e(152),i=e(111);t.exports=function(t){var n=r(t),e=o.f;if(e)for(var u,c=e(t),a=i.f,f=0;c.length>f;)a.call(t,u=c[f++])&&n.push(u);return n}},function(t,n,e){var r=e(151);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,n,e){var r=e(52),o=e(153).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return u.slice()}}(t):o(r(t))}},function(t,n){},function(t,n,e){e(110)("asyncIterator")},function(t,n,e){e(110)("observable")},function(t,n,e){"use strict";n.__esModule=!0;var r=u(e(378)),o=u(e(382)),i=u(e(147));function u(t){return t&&t.__esModule?t:{default:t}}n.default=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+(void 0===n?"undefined":(0,i.default)(n)));t.prototype=(0,o.default)(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(r.default?(0,r.default)(t,n):t.__proto__=n)}},function(t,n,e){t.exports={default:e(379),__esModule:!0}},function(t,n,e){e(380),t.exports=e(26).Object.setPrototypeOf},function(t,n,e){var r=e(49);r(r.S,"Object",{setPrototypeOf:e(381).set})},function(t,n,e){var r=e(51),o=e(56),i=function(t,n){if(o(t),!r(n)&&null!==n)throw TypeError(n+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=e(144)(Function.call,e(154).f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return i(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:i}},function(t,n,e){t.exports={default:e(383),__esModule:!0}},function(t,n,e){e(384);var r=e(26).Object;t.exports=function(t,n){return r.create(t,n)}},function(t,n,e){var r=e(49);r(r.S,"Object",{create:e(105)})},function(t,n,e){t.exports=e(386)()},function(t,n,e){"use strict";var r=e(387);function o(){}t.exports=function(){function t(t,n,e,o,i,u){if(u!==r){var c=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw c.name="Invariant Violation",c}}function n(){return t}t.isRequired=t;var e={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:n,element:t,instanceOf:n,node:t,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n};return e.checkPropTypes=o,e.PropTypes=e,e}},function(t,n,e){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n){t.exports=ReactDOM},function(t,n,e){"use strict";t.exports=e(390)},function(t,n,e){n.iframeResizer=e(391),n.iframeResizerContentWindow=e(392)},function(t,n,e){var r,o,i;!function(e){"use strict";if("undefined"!=typeof window){var u=0,c=!1,a=!1,f="message".length,s="[iFrameSizer]",l=s.length,p=null,h=window.requestAnimationFrame,d={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},v={},y=null,g={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",closedCallback:function(){},initCallback:function(){},messageCallback:function(){E("MessageCallback function not defined")},resizedCallback:function(){},scrollCallback:function(){return!0}},m={};window.jQuery&&function(t){t.fn?t.fn.iFrameResize||(t.fn.iFrameResize=function(t){return this.filter("iframe").each(function(n,e){D(e,t)}).end()}):O("","Unable to bind to jQuery, it is not fully loaded.")}(window.jQuery),o=[],(i="function"==typeof(r=function(){function t(t,e){e&&(function(){if(!e.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==e.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+e.tagName+">")}(),D(e,t),n.push(e))}var n;return function(){var t,n=["moz","webkit","o","ms"];for(t=0;t<n.length&&!h;t+=1)h=window[n[t]+"RequestAnimationFrame"];h||_("setup","RequestAnimationFrame not supported")}(),b(window,"message",P),b(window,"resize",function(){V("resize")}),b(document,"visibilitychange",B),b(document,"-webkit-visibilitychange",B),b(window,"focusin",function(){V("focus")}),b(window,"focus",function(){V("focus")}),function(r,o){switch(n=[],function(t){t&&t.enablePublicMethods&&E("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(r),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),t.bind(e,r));break;case"object":t(r,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return n}})?r.apply(n,o):r)===e||(t.exports=i)}function b(t,n,e){"addEventListener"in window?t.addEventListener(n,e,!1):"attachEvent"in window&&t.attachEvent("on"+n,e)}function w(t,n,e){"removeEventListener"in window?t.removeEventListener(n,e,!1):"detachEvent"in window&&t.detachEvent("on"+n,e)}function S(t){return s+"["+function(t){var n="Host page: "+t;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+t:"Nested host page: "+t),n}(t)+"]"}function x(t){return v[t]?v[t].log:c}function _(t,n){M("log",t,n,x(t))}function O(t,n){M("info",t,n,x(t))}function E(t,n){M("warn",t,n,!0)}function M(t,n,e,r){!0===r&&"object"==typeof window.console&&console[t](S(n),e)}function P(t){function n(){e("Height"),e("Width"),R(function(){L(d),A(y),a("resizedCallback",d)},d,"init")}function e(t){var n=Number(v[y]["max"+t]),e=Number(v[y]["min"+t]),r=t.toLowerCase(),o=Number(d[r]);_(y,"Checking "+r+" is in range "+e+"-"+n),o<e&&(o=e,_(y,"Set "+r+" to min value")),o>n&&(o=n,_(y,"Set "+r+" to max value")),d[r]=""+o}function r(t){return h.substr(h.indexOf(":")+f+t)}function o(t,n){!function(t,n,e){m[e]||(m[e]=setTimeout(function(){m[e]=null,t()},n))}(function(){C("Send Page Info","pageInfo:"+function(){var t=document.body.getBoundingClientRect(),n=d.iframe.getBoundingClientRect();return JSON.stringify({iframeHeight:n.height,iframeWidth:n.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(n.top-t.top,10),offsetLeft:parseInt(n.left-t.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset})}(),t,n)},32,n)}function i(t){var n=t.getBoundingClientRect();return j(y),{x:Math.floor(Number(n.left)+Number(p.x)),y:Math.floor(Number(n.top)+Number(p.y))}}function u(t){var n=t?i(d.iframe):{x:0,y:0},e={x:Number(d.width)+n.x,y:Number(d.height)+n.y};_(y,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(t?"Offset":"")](e.x,e.y):E(y,"Unable to scroll to requested position, window.parentIFrame not found"):(p=e,c(),_(y,"--"))}function c(){!1!==a("scrollCallback",p)?A(y):k()}function a(t,n){return T(y,t,n)}var h=t.data,d={},y=null;"[iFrameResizerChild]Ready"===h?function(){for(var t in v)C("iFrame requested init",z(t),document.getElementById(t),t)}():s===(""+h).substr(0,l)&&h.substr(l).split(":")[0]in v?(d=function(){var t=h.substr(l).split(":");return{iframe:v[t[0]]&&v[t[0]].iframe,id:t[0],height:t[1],width:t[2],type:t[3]}}(),y=d.id,v[y]&&(v[y].loaded=!0),!function(){var t=d.type in{true:1,false:1,undefined:1};return t&&_(y,"Ignoring init message from meta parent page"),t}()&&function(t){var n=!0;return v[t]||(n=!1,E(d.type+" No settings for "+t+". Message was: "+h)),n}(y)&&(_(y,"Received: "+h),function(){var t=!0;return null===d.iframe&&(E(y,"IFrame ("+d.id+") not found"),t=!1),t}()&&function(){var n=t.origin,e=v[y]&&v[y].checkOrigin;if(e&&""+n!="null"&&!(e.constructor===Array?function(){var t=0,r=!1;for(_(y,"Checking connection is from allowed list of origins: "+e);t<e.length;t++)if(e[t]===n){r=!0;break}return r}():function(){var t=v[y]&&v[y].remoteHost;return _(y,"Checking connection is from: "+t),n===t}()))throw new Error("Unexpected message received from: "+n+" for "+d.iframe.id+". Message was: "+t.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(v[y]&&v[y].firstRun&&v[y]&&(v[y].firstRun=!1),d.type){case"close":v[y].closeRequestCallback?T(y,"closeRequestCallback",v[y].iframe):I(d.iframe);break;case"message":!function(t){_(y,"MessageCallback passed: {iframe: "+d.iframe.id+", message: "+t+"}"),a("messageCallback",{iframe:d.iframe,message:JSON.parse(t)}),_(y,"--")}(r(6));break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":o(v[y]&&v[y].iframe,y),function(){function t(t,r){function i(){v[e]?o(v[e].iframe,e):n()}["scroll","resize"].forEach(function(n){_(e,t+n+" listener for sendPageInfo"),r(window,n,i)})}function n(){t("Remove ",w)}var e=y;t("Add ",b),v[e]&&(v[e].stopPageInfo=n)}();break;case"pageInfoStop":v[y]&&v[y].stopPageInfo&&(v[y].stopPageInfo(),delete v[y].stopPageInfo);break;case"inPageLink":!function(t){var n=t.split("#")[1]||"",e=decodeURIComponent(n),r=document.getElementById(e)||document.getElementsByName(e)[0];r?function(){var t=i(r);_(y,"Moving to in page link (#"+n+") at x: "+t.x+" y: "+t.y),p={x:t.x,y:t.y},c(),_(y,"--")}():window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(n):_(y,"In page link #"+n+" not found and window.parentIFrame not found"):_(y,"In page link #"+n+" not found")}(r(9));break;case"reset":N(d);break;case"init":n(),a("initCallback",d.iframe);break;default:n()}}())):O(y,"Ignored: "+h)}function T(t,n,e){var r=null,o=null;if(v[t]){if("function"!=typeof(r=v[t][n]))throw new TypeError(n+" on iFrame["+t+"] is not a function");o=r(e)}return o}function F(t){var n=t.id;delete v[n]}function I(t){var n=t.id;_(n,"Removing iFrame: "+n);try{t.parentNode&&t.parentNode.removeChild(t)}catch(t){}T(n,"closedCallback",n),_(n,"--"),F(t)}function j(t){null===p&&_(t,"Get page position: "+(p={x:window.pageXOffset!==e?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==e?window.pageYOffset:document.documentElement.scrollTop}).x+","+p.y)}function A(t){null!==p&&(window.scrollTo(p.x,p.y),_(t,"Set page position: "+p.x+","+p.y),k())}function k(){p=null}function N(t){_(t.id,"Size reset requested by "+("init"===t.type?"host page":"iFrame")),j(t.id),R(function(){L(t),C("reset","reset",t.iframe,t.id)},t,"reset")}function L(t){function n(n){a||"0"!==t[n]||(a=!0,_(r,"Hidden iFrame detected, creating visibility listener"),function(){function t(){function t(t){function n(n){return"0px"===(v[t]&&v[t].iframe.style[n])}v[t]&&function(t){return null!==t.offsetParent}(v[t].iframe)&&(n("height")||n("width"))&&C("Visibility change","resize",v[t].iframe,t)}for(var n in v)t(n)}function n(n){_("window","Mutation observed: "+n[0].target+" "+n[0].type),W(t,16)}var e=window.MutationObserver||window.WebKitMutationObserver;e&&function(){var t=document.querySelector("body");new e(n).observe(t,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0})}()}())}function e(e){!function(n){t.id?(t.iframe.style[n]=t[n]+"px",_(t.id,"IFrame ("+r+") "+n+" set to "+t[n]+"px")):_("undefined","messageData id not set")}(e),n(e)}var r=t.iframe.id;v[r]&&(v[r].sizeHeight&&e("height"),v[r].sizeWidth&&e("width"))}function R(t,n,e){e!==n.type&&h?(_(n.id,"Requesting animation frame"),h(t)):t()}function C(t,n,e,r,o){var i=!1;r=r||e.id,v[r]&&(e&&"contentWindow"in e&&null!==e.contentWindow?function(){var o=v[r]&&v[r].targetOrigin;_(r,"["+t+"] Sending msg to iframe["+r+"] ("+n+") targetOrigin: "+o),e.contentWindow.postMessage(s+n,o)}():E(r,"["+t+"] IFrame("+r+") not found"),o&&v[r]&&v[r].warningTimeout&&(v[r].msgTimeout=setTimeout(function(){!v[r]||v[r].loaded||i||(i=!0,E(r,"IFrame has not responded within "+v[r].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))},v[r].warningTimeout)))}function z(t){return t+":"+v[t].bodyMarginV1+":"+v[t].sizeWidth+":"+v[t].log+":"+v[t].interval+":"+v[t].enablePublicMethods+":"+v[t].autoResize+":"+v[t].bodyMargin+":"+v[t].heightCalculationMethod+":"+v[t].bodyBackground+":"+v[t].bodyPadding+":"+v[t].tolerance+":"+v[t].inPageLinks+":"+v[t].resizeFrom+":"+v[t].widthCalculationMethod}function D(t,n){var r=function(e){return e,""===e&&(t.id=e=function(){var t=n&&n.id||g.id+u++;return null!==document.getElementById(t)&&(t+=u++),t}(),c=(n||{}).log,e,_(e,"Added missing iframe ID: "+e+" ("+t.src+")")),e}(t.id);r in v&&"iFrameResizer"in t?E(r,"Ignored iFrame, already setup."):(!function(n){n=n||{},v[r]={firstRun:!0,iframe:t,remoteHost:t.src.split("/").slice(0,3).join("/")},function(t){if("object"!=typeof t)throw new TypeError("Options is not an object")}(n),function(t){for(var n in g)g.hasOwnProperty(n)&&(v[r][n]=t.hasOwnProperty(n)?t[n]:g[n])}(n),v[r]&&(v[r].targetOrigin=!0===v[r].checkOrigin?function(t){return""===t||"file://"===t?"*":t}(v[r].remoteHost):"*")}(n),function(){switch(_(r,"IFrame scrolling "+(v[r]&&v[r].scrolling?"enabled":"disabled")+" for "+r),t.style.overflow=!1===(v[r]&&v[r].scrolling)?"hidden":"auto",v[r]&&v[r].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=v[r]?v[r].scrolling:"no"}}(),function(){function n(n){1/0!==v[r][n]&&0!==v[r][n]&&(t.style[n]=v[r][n]+"px",_(r,"Set "+n+" = "+v[r][n]+"px"))}function e(t){if(v[r]["min"+t]>v[r]["max"+t])throw new Error("Value for min"+t+" can not be greater than max"+t)}e("Height"),e("Width"),n("maxHeight"),n("minHeight"),n("maxWidth"),n("minWidth")}(),"number"!=typeof(v[r]&&v[r].bodyMargin)&&"0"!==(v[r]&&v[r].bodyMargin)||(v[r].bodyMarginV1=v[r].bodyMargin,v[r].bodyMargin=v[r].bodyMargin+"px"),function(n){b(t,"load",function(){C("iFrame.onload",n,t,e,!0),function(){var n=v[r]&&v[r].firstRun,e=v[r]&&v[r].heightCalculationMethod in d;!n&&e&&N({iframe:t,height:0,width:0,type:"init"})}()}),C("init",n,t,e,!0)}(z(r)),Function.prototype.bind&&v[r]&&(v[r].iframe.iFrameResizer={close:I.bind(null,v[r].iframe),removeListeners:F.bind(null,v[r].iframe),resize:C.bind(null,"Window resize","resize",v[r].iframe),moveToAnchor:function(t){C("Move to anchor","moveToAnchor:"+t,v[r].iframe,r)},sendMessage:function(t){C("Send Message","message:"+(t=JSON.stringify(t)),v[r].iframe,r)}}))}function W(t,n){null===y&&(y=setTimeout(function(){y=null,t()},n))}function V(t){_("window","Trigger event: "+t),W(function(){U("Window "+t,"resize")},16)}function B(){"hidden"!==document.visibilityState&&(_("document","Trigger event: Visiblity change"),W(function(){U("Tab Visable","resize")},16))}function U(t,n){function e(t){return v[t]&&"parent"===v[t].resizeFrom&&v[t].autoResize&&!v[t].firstRun}for(var r in v)e(r)&&C(t,n,document.getElementById(r),r)}}()},function(t,n,e){!function(n){"use strict";if("undefined"!=typeof window){var e=!0,r=10,o="",i=0,u="",c=null,a="",f=!1,s={resize:1,click:1},l=128,p=!0,h=1,d="bodyOffset",v=d,y=!0,g="",m={},b=32,w=null,S=!1,x="[iFrameSizer]",_=x.length,O="",E={max:1,min:1,bodyScroll:1,documentElementScroll:1},M="child",P=!0,T=window.parent,F="*",I=0,j=!1,A=null,k=16,N=1,L="scroll",R=L,C=window,z=function(){nt("MessageCallback function not defined")},D=function(){},W=function(){},V={height:function(){return nt("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return nt("Custom width calculation function not defined"),document.body.scrollWidth}},B={},U=!1;try{var H=Object.create({},{passive:{get:function(){U=!0}},once:{get:function(){!0}}});window.addEventListener("test",K,H),window.removeEventListener("test",K,H)}catch(t){}var G=Date.now||function(){return(new Date).getTime()},q={bodyOffset:function(){return document.body.offsetHeight+pt("marginTop")+pt("marginBottom")},offset:function(){return q.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return V.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,dt(q))},min:function(){return Math.min.apply(null,dt(q))},grow:function(){return q.max()},lowestElement:function(){return Math.max(q.bodyOffset()||q.documentElementOffset(),ht("bottom",yt()))},taggedElement:function(){return vt("bottom","data-iframe-height")}},Y={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return V.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(Y.bodyScroll(),Y.documentElementScroll())},max:function(){return Math.max.apply(null,dt(Y))},min:function(){return Math.min.apply(null,dt(Y))},rightMostElement:function(){return ht("right",yt())},taggedElement:function(){return vt("right","data-iframe-width")}},J=function(t){var n,e,r,o=null,i=0,u=function(){i=G(),o=null,r=t.apply(n,e),o||(n=e=null)};return function(){var c=G();i||(i=c);var a=k-(c-i);return n=this,e=arguments,a<=0||a>k?(o&&(clearTimeout(o),o=null),i=c,r=t.apply(n,e),o||(n=e=null)):o||(o=setTimeout(u,a)),r}}(gt);X(window,"message",_t),X(window,"readystatechange",Ot),Ot()}function K(){}function X(t,n,e,r){"addEventListener"in window?t.addEventListener(n,e,!!U&&(r||{})):"attachEvent"in window&&t.attachEvent("on"+n,e)}function Q(t,n,e){"removeEventListener"in window?t.removeEventListener(n,e,!1):"detachEvent"in window&&t.detachEvent("on"+n,e)}function $(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Z(t){return x+"["+O+"] "+t}function tt(t){S&&"object"==typeof window.console&&console.log(Z(t))}function nt(t){"object"==typeof window.console&&console.warn(Z(t))}function et(){!function(){function t(t){return"true"===t}var r=g.substr(_).split(":");O=r[0],i=n!==r[1]?Number(r[1]):i,f=n!==r[2]?t(r[2]):f,S=n!==r[3]?t(r[3]):S,b=n!==r[4]?Number(r[4]):b,e=n!==r[6]?t(r[6]):e,u=r[7],v=n!==r[8]?r[8]:v,o=r[9],a=r[10],I=n!==r[11]?Number(r[11]):I,m.enable=n!==r[12]&&t(r[12]),M=n!==r[13]?r[13]:M,R=n!==r[14]?r[14]:R}(),tt("Initialising iFrame ("+location.href+")"),function(){function t(t,n){return"function"==typeof t&&(tt("Setup custom "+n+"CalcMethod"),V[n]=t,t="custom"),t}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(!function(){var t=window.iFrameResizer;tt("Reading data from page: "+JSON.stringify(t)),z="messageCallback"in t?t.messageCallback:z,D="readyCallback"in t?t.readyCallback:D,F="targetOrigin"in t?t.targetOrigin:F,v="heightCalculationMethod"in t?t.heightCalculationMethod:v,R="widthCalculationMethod"in t?t.widthCalculationMethod:R}(),v=t(v,"height"),R=t(R,"width"));tt("TargetOrigin for parent set to: "+F)}(),function(){n===u&&(u=i+"px");rt("margin",function(t,n){-1!==n.indexOf("-")&&(nt("Negative CSS value ignored for "+t),n="");return n}("margin",u))}(),rt("background",o),rt("padding",a),function(){var t=document.createElement("div");t.style.clear="both",t.style.display="block",document.body.appendChild(t)}(),ct(),at(),document.documentElement.style.height="",document.body.style.height="",tt('HTML & body height set to "auto"'),tt("Enable public methods"),C.parentIFrame={autoResize:function(t){return!0===t&&!1===e?(e=!0,ft()):!1===t&&!0===e&&(e=!1,st()),e},close:function(){xt(0,0,"close"),tt("Disable outgoing messages"),P=!1,tt("Remove event listener: Message"),Q(window,"message",_t),!0===e&&st()},getId:function(){return O},getPageInfo:function(t){"function"==typeof t?(W=t,xt(0,0,"pageInfo")):(W=function(){},xt(0,0,"pageInfoStop"))},moveToAnchor:function(t){m.findTarget(t)},reset:function(){St("parentIFrame.reset")},scrollTo:function(t,n){xt(n,t,"scrollTo")},scrollToOffset:function(t,n){xt(n,t,"scrollToOffset")},sendMessage:function(t,n){xt(0,0,"message",JSON.stringify(t),n)},setHeightCalculationMethod:function(t){v=t,ct()},setWidthCalculationMethod:function(t){R=t,at()},setTargetOrigin:function(t){tt("Set targetOrigin: "+t),F=t},size:function(t,n){var e=(t||"")+(n?","+n:"");mt("size","parentIFrame.size("+e+")",t,n)}},ft(),m=function(){function t(t){var e=t.getBoundingClientRect(),r={x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop};return{x:parseInt(e.left,10)+parseInt(r.x,10),y:parseInt(e.top,10)+parseInt(r.y,10)}}function e(e){var r=e.split("#")[1]||e,o=decodeURIComponent(r),i=document.getElementById(o)||document.getElementsByName(o)[0];n!==i?function(n){var e=t(n);tt("Moving to in page link (#"+r+") at x: "+e.x+" y: "+e.y),xt(e.y,e.x,"scrollToOffset")}(i):(tt("In page link (#"+r+") not found in iFrame, so sending to parent"),xt(0,0,"inPageLink","#"+r))}function r(){""!==location.hash&&"#"!==location.hash&&e(location.href)}m.enable?Array.prototype.forEach&&document.querySelectorAll?(tt("Setting up location.hash handlers"),Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),function(t){"#"!==t.getAttribute("href")&&X(t,"click",function(t){t.preventDefault(),e(this.getAttribute("href"))})}),X(window,"hashchange",r),setTimeout(r,l)):nt("In page linking not fully supported in this browser! (See README.md for IE8 workaround)"):tt("In page linking not enabled");return{findTarget:e}}(),mt("init","Init message from host page"),D()}function rt(t,e){n!==e&&""!==e&&"null"!==e&&(document.body.style[t]=e,tt("Body "+t+' set to "'+e+'"'))}function ot(t){var n={add:function(n){function e(){mt(t.eventName,t.eventType)}B[n]=e,X(window,n,e,{passive:!0})},remove:function(t){var n=B[t];delete B[t],Q(window,t,n)}};t.eventNames&&Array.prototype.map?(t.eventName=t.eventNames[0],t.eventNames.map(n[t.method])):n[t.method](t.eventName),tt($(t.method)+" event listener: "+t.eventType)}function it(t){ot({method:t,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),ot({method:t,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),ot({method:t,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),ot({method:t,eventType:"Input",eventName:"input"}),ot({method:t,eventType:"Mouse Up",eventName:"mouseup"}),ot({method:t,eventType:"Mouse Down",eventName:"mousedown"}),ot({method:t,eventType:"Orientation Change",eventName:"orientationchange"}),ot({method:t,eventType:"Print",eventName:["afterprint","beforeprint"]}),ot({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),ot({method:t,eventType:"Touch Start",eventName:"touchstart"}),ot({method:t,eventType:"Touch End",eventName:"touchend"}),ot({method:t,eventType:"Touch Cancel",eventName:"touchcancel"}),ot({method:t,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),ot({method:t,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),ot({method:t,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===M&&ot({method:t,eventType:"IFrame Resized",eventName:"resize"})}function ut(t,n,e,r){return n!==t&&(t in e||(nt(t+" is not a valid option for "+r+"CalculationMethod."),t=n),tt(r+' calculation method set to "'+t+'"')),t}function ct(){v=ut(v,d,q,"height")}function at(){R=ut(R,L,Y,"width")}function ft(){!0===e?(it("add"),function(){var t=0>b;window.MutationObserver||window.WebKitMutationObserver?t?lt():c=function(){function t(t){function n(t){!1===t.complete&&(tt("Attach listeners to "+t.src),t.addEventListener("load",o,!1),t.addEventListener("error",i,!1),c.push(t))}"attributes"===t.type&&"src"===t.attributeName?n(t.target):"childList"===t.type&&Array.prototype.forEach.call(t.target.querySelectorAll("img"),n)}function e(t){tt("Remove listeners from "+t.src),t.removeEventListener("load",o,!1),t.removeEventListener("error",i,!1),function(t){c.splice(c.indexOf(t),1)}(t)}function r(t,r,o){e(t.target),mt(r,o+": "+t.target.src,n,n)}function o(t){r(t,"imageLoad","Image loaded")}function i(t){r(t,"imageLoadFailed","Image load failed")}function u(n){mt("mutationObserver","mutationObserver: "+n[0].target+" "+n[0].type),n.forEach(t)}var c=[],a=window.MutationObserver||window.WebKitMutationObserver,f=function(){var t=document.querySelector("body");return f=new a(u),tt("Create body MutationObserver"),f.observe(t,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),f}();return{disconnect:function(){"disconnect"in f&&(tt("Disconnect body MutationObserver"),f.disconnect(),c.forEach(e))}}}():(tt("MutationObserver not supported in this browser!"),lt())}()):tt("Auto Resize disabled")}function st(){it("remove"),null!==c&&c.disconnect(),clearInterval(w)}function lt(){0!==b&&(tt("setInterval: "+b+"ms"),w=setInterval(function(){mt("interval","setInterval: "+b)},Math.abs(b)))}function pt(t,n){var e=0;return n=n||document.body,e="defaultView"in document&&"getComputedStyle"in document.defaultView?null!==(e=document.defaultView.getComputedStyle(n,null))?e[t]:0:function(t){if(/^\d+(px)?$/i.test(t))return parseInt(t,r);var e=n.style.left,o=n.runtimeStyle.left;return n.runtimeStyle.left=n.currentStyle.left,n.style.left=t||0,t=n.style.pixelLeft,n.style.left=e,n.runtimeStyle.left=o,t}(n.currentStyle[t]),parseInt(e,r)}function ht(t,n){for(var e=n.length,r=0,o=0,i=$(t),u=G(),c=0;c<e;c++)(r=n[c].getBoundingClientRect()[t]+pt("margin"+i,n[c]))>o&&(o=r);return u=G()-u,tt("Parsed "+e+" HTML elements"),tt("Element position calculated in "+u+"ms"),function(t){t>k/2&&tt("Event throttle increased to "+(k=2*t)+"ms")}(u),o}function dt(t){return[t.bodyOffset(),t.bodyScroll(),t.documentElementOffset(),t.documentElementScroll()]}function vt(t,n){var e=document.querySelectorAll("["+n+"]");return 0===e.length&&(nt("No tagged elements ("+n+") found on page"),document.querySelectorAll("body *")),ht(t,e)}function yt(){return document.querySelectorAll("body *")}function gt(t,e,r,o){var i,u;!function(){function t(t,n){return!(Math.abs(t-n)<=I)}return i=n!==r?r:q[v](),u=n!==o?o:Y[R](),t(h,i)||f&&t(N,u)}()&&"init"!==t?t in{init:1,interval:1,size:1}||!(v in E||f&&R in E)?t in{interval:1}||tt("No change in size detected"):St(e):(bt(),xt(h=i,N=u,t))}function mt(t,n,e,r){j&&t in s?tt("Trigger event cancelled: "+t):(t in{reset:1,resetPage:1,init:1}||tt("Trigger event: "+n),"init"===t?gt(t,n,e,r):J(t,n,e,r))}function bt(){j||(j=!0,tt("Trigger event lock on")),clearTimeout(A),A=setTimeout(function(){j=!1,tt("Trigger event lock off"),tt("--")},l)}function wt(t){h=q[v](),N=Y[R](),xt(h,N,t)}function St(t){var n=v;v=d,tt("Reset trigger event: "+t),bt(),wt("reset"),v=n}function xt(t,e,r,o,i){!0===P&&(n===i?i=F:tt("Message targetOrigin: "+i),function(){var u=O+":"+t+":"+e+":"+r+(n!==o?":"+o:"");tt("Sending message to host page ("+u+")"),T.postMessage(x+u,i)}())}function _t(n){var e={init:function(){g=n.data,T=n.source,et(),p=!1,setTimeout(function(){y=!1},l)},reset:function(){y?tt("Page reset ignored by init"):(tt("Page size reset by host page"),wt("resetPage"))},resize:function(){mt("resizeParent","Parent window requested size check")},moveToAnchor:function(){m.findTarget(o())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var t=o();tt("PageInfoFromParent called from parent: "+t),W(JSON.parse(t)),tt(" --")},message:function(){var t=o();tt("MessageCallback called from parent: "+t),z(JSON.parse(t)),tt(" --")}};function r(){return n.data.split("]")[1].split(":")[0]}function o(){return n.data.substr(n.data.indexOf(":")+1)}function i(){return n.data.split(":")[2]in{true:1,false:1}}function u(){var o=r();o in e?e[o]():!t.exports&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype||i()||nt("Unexpected message ("+n.data+")")}x===(""+n.data).substr(0,_)&&(!1===p?u():i()?e.init():tt('Ignored message of type "'+r()+'". Received before initialization.'))}function Ot(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()}]);
|
1 |
+
!function(t){var n={};function e(r){if(n[r])return n[r].exports;var o=n[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,e),o.l=!0,o.exports}e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{enumerable:!0,get:r})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,n){if(1&n&&(t=e(t)),8&n)return t;if(4&n&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(e.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&n&&"string"!=typeof t)for(var o in t)e.d(r,o,function(n){return t[n]}.bind(null,o));return r},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},e.p="",e(e.s=179)}([function(t,n,e){var r=e(1),o=e(7),i=e(14),u=e(11),a=e(17),c=function(t,n,e){var f,s,l,p,h=t&c.F,d=t&c.G,v=t&c.S,y=t&c.P,g=t&c.B,m=d?r:v?r[n]||(r[n]={}):(r[n]||{}).prototype,b=d?o:o[n]||(o[n]={}),w=b.prototype||(b.prototype={});for(f in d&&(e=n),e)l=((s=!h&&m&&void 0!==m[f])?m:e)[f],p=g&&s?a(l,r):y&&"function"==typeof l?a(Function.call,l):l,m&&u(m,f,l,t&c.U),b[f]!=l&&i(b,f,p),y&&w[f]!=l&&(w[f]=l)};r.core=o,c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n,e){var r=e(4);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,e){var r=e(62)("wks"),o=e(32),i=e(1).Symbol,u="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=r},function(t,n,e){var r=e(19),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,n){var e=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=e)},function(t,n,e){var r=e(3),o=e(117),i=e(28),u=Object.defineProperty;n.f=e(9)?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return u(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){t.exports=!e(2)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(25);t.exports=function(t){return Object(r(t))}},function(t,n,e){var r=e(1),o=e(14),i=e(13),u=e(32)("src"),a=e(185),c=(""+a).split("toString");e(7).inspectSource=function(t){return a.call(t)},(t.exports=function(t,n,e,a){var f="function"==typeof e;f&&(i(e,"name")||o(e,"name",n)),t[n]!==e&&(f&&(i(e,u)||o(e,u,t[n]?""+t[n]:c.join(String(n)))),t===r?t[n]=e:a?t[n]?t[n]=e:o(t,n,e):(delete t[n],o(t,n,e)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[u]||a.call(this)})},function(t,n,e){var r=e(0),o=e(2),i=e(25),u=/"/g,a=function(t,n,e,r){var o=String(i(t)),a="<"+n;return""!==e&&(a+=" "+e+'="'+String(r).replace(u,""")+'"'),a+">"+o+"</"+n+">"};t.exports=function(t,n){var e={};e[t]=n(a),r(r.P+r.F*o(function(){var n=""[t]('"');return n!==n.toLowerCase()||n.split('"').length>3}),"String",e)}},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var r=e(8),o=e(31);t.exports=e(9)?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n,e){var r=e(55),o=e(25);t.exports=function(t){return r(o(t))}},function(t,n,e){"use strict";var r=e(2);t.exports=function(t,n){return!!t&&r(function(){n?t.call(null,function(){},1):t.call(null)})}},function(t,n,e){var r=e(18);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n,e){var r=e(56),o=e(31),i=e(15),u=e(28),a=e(13),c=e(117),f=Object.getOwnPropertyDescriptor;n.f=e(9)?f:function(t,n){if(t=i(t),n=u(n,!0),c)try{return f(t,n)}catch(t){}if(a(t,n))return o(!r.f.call(t,n),t[n])}},function(t,n,e){var r=e(0),o=e(7),i=e(2);t.exports=function(t,n){var e=(o.Object||{})[t]||Object[t],u={};u[t]=n(e),r(r.S+r.F*i(function(){e(1)}),"Object",u)}},function(t,n,e){var r=e(17),o=e(55),i=e(10),u=e(6),a=e(133);t.exports=function(t,n){var e=1==t,c=2==t,f=3==t,s=4==t,l=6==t,p=5==t||l,h=n||a;return function(n,a,d){for(var v,y,g=i(n),m=o(g),b=r(a,d,3),w=u(m.length),x=0,S=e?h(n,w):c?h(n,0):void 0;w>x;x++)if((p||x in m)&&(y=b(v=m[x],x,g),t))if(e)S[x]=y;else if(y)switch(t){case 3:return!0;case 5:return v;case 6:return x;case 2:S.push(v)}else if(s)return!1;return l?-1:f||s?s:S}}},function(t,n){var e=t.exports={version:"2.6.5"};"number"==typeof __e&&(__e=e)},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,e){"use strict";if(e(9)){var r=e(33),o=e(1),i=e(2),u=e(0),a=e(73),c=e(102),f=e(17),s=e(49),l=e(31),p=e(14),h=e(50),d=e(19),v=e(6),y=e(144),g=e(35),m=e(28),b=e(13),w=e(57),x=e(4),S=e(10),_=e(94),O=e(36),E=e(38),M=e(37).f,P=e(96),T=e(32),F=e(5),I=e(22),j=e(63),A=e(58),k=e(98),N=e(47),R=e(66),L=e(48),C=e(97),z=e(135),W=e(8),D=e(20),V=W.f,B=D.f,U=o.RangeError,G=o.TypeError,H=o.Uint8Array,q=Array.prototype,Y=c.ArrayBuffer,J=c.DataView,K=I(0),X=I(2),$=I(3),Q=I(4),Z=I(5),tt=I(6),nt=j(!0),et=j(!1),rt=k.values,ot=k.keys,it=k.entries,ut=q.lastIndexOf,at=q.reduce,ct=q.reduceRight,ft=q.join,st=q.sort,lt=q.slice,pt=q.toString,ht=q.toLocaleString,dt=F("iterator"),vt=F("toStringTag"),yt=T("typed_constructor"),gt=T("def_constructor"),mt=a.CONSTR,bt=a.TYPED,wt=a.VIEW,xt=I(1,function(t,n){return Mt(A(t,t[gt]),n)}),St=i(function(){return 1===new H(new Uint16Array([1]).buffer)[0]}),_t=!!H&&!!H.prototype.set&&i(function(){new H(1).set({})}),Ot=function(t,n){var e=d(t);if(e<0||e%n)throw U("Wrong offset!");return e},Et=function(t){if(x(t)&&bt in t)return t;throw G(t+" is not a typed array!")},Mt=function(t,n){if(!(x(t)&&yt in t))throw G("It is not a typed array constructor!");return new t(n)},Pt=function(t,n){return Tt(A(t,t[gt]),n)},Tt=function(t,n){for(var e=0,r=n.length,o=Mt(t,r);r>e;)o[e]=n[e++];return o},Ft=function(t,n,e){V(t,n,{get:function(){return this._d[e]}})},It=function(t){var n,e,r,o,i,u,a=S(t),c=arguments.length,s=c>1?arguments[1]:void 0,l=void 0!==s,p=P(a);if(null!=p&&!_(p)){for(u=p.call(a),r=[],n=0;!(i=u.next()).done;n++)r.push(i.value);a=r}for(l&&c>2&&(s=f(s,arguments[2],2)),n=0,e=v(a.length),o=Mt(this,e);e>n;n++)o[n]=l?s(a[n],n):a[n];return o},jt=function(){for(var t=0,n=arguments.length,e=Mt(this,n);n>t;)e[t]=arguments[t++];return e},At=!!H&&i(function(){ht.call(new H(1))}),kt=function(){return ht.apply(At?lt.call(Et(this)):Et(this),arguments)},Nt={copyWithin:function(t,n){return z.call(Et(this),t,n,arguments.length>2?arguments[2]:void 0)},every:function(t){return Q(Et(this),t,arguments.length>1?arguments[1]:void 0)},fill:function(t){return C.apply(Et(this),arguments)},filter:function(t){return Pt(this,X(Et(this),t,arguments.length>1?arguments[1]:void 0))},find:function(t){return Z(Et(this),t,arguments.length>1?arguments[1]:void 0)},findIndex:function(t){return tt(Et(this),t,arguments.length>1?arguments[1]:void 0)},forEach:function(t){K(Et(this),t,arguments.length>1?arguments[1]:void 0)},indexOf:function(t){return et(Et(this),t,arguments.length>1?arguments[1]:void 0)},includes:function(t){return nt(Et(this),t,arguments.length>1?arguments[1]:void 0)},join:function(t){return ft.apply(Et(this),arguments)},lastIndexOf:function(t){return ut.apply(Et(this),arguments)},map:function(t){return xt(Et(this),t,arguments.length>1?arguments[1]:void 0)},reduce:function(t){return at.apply(Et(this),arguments)},reduceRight:function(t){return ct.apply(Et(this),arguments)},reverse:function(){for(var t,n=Et(this).length,e=Math.floor(n/2),r=0;r<e;)t=this[r],this[r++]=this[--n],this[n]=t;return this},some:function(t){return $(Et(this),t,arguments.length>1?arguments[1]:void 0)},sort:function(t){return st.call(Et(this),t)},subarray:function(t,n){var e=Et(this),r=e.length,o=g(t,r);return new(A(e,e[gt]))(e.buffer,e.byteOffset+o*e.BYTES_PER_ELEMENT,v((void 0===n?r:g(n,r))-o))}},Rt=function(t,n){return Pt(this,lt.call(Et(this),t,n))},Lt=function(t){Et(this);var n=Ot(arguments[1],1),e=this.length,r=S(t),o=v(r.length),i=0;if(o+n>e)throw U("Wrong length!");for(;i<o;)this[n+i]=r[i++]},Ct={entries:function(){return it.call(Et(this))},keys:function(){return ot.call(Et(this))},values:function(){return rt.call(Et(this))}},zt=function(t,n){return x(t)&&t[bt]&&"symbol"!=typeof n&&n in t&&String(+n)==String(n)},Wt=function(t,n){return zt(t,n=m(n,!0))?l(2,t[n]):B(t,n)},Dt=function(t,n,e){return!(zt(t,n=m(n,!0))&&x(e)&&b(e,"value"))||b(e,"get")||b(e,"set")||e.configurable||b(e,"writable")&&!e.writable||b(e,"enumerable")&&!e.enumerable?V(t,n,e):(t[n]=e.value,t)};mt||(D.f=Wt,W.f=Dt),u(u.S+u.F*!mt,"Object",{getOwnPropertyDescriptor:Wt,defineProperty:Dt}),i(function(){pt.call({})})&&(pt=ht=function(){return ft.call(this)});var Vt=h({},Nt);h(Vt,Ct),p(Vt,dt,Ct.values),h(Vt,{slice:Rt,set:Lt,constructor:function(){},toString:pt,toLocaleString:kt}),Ft(Vt,"buffer","b"),Ft(Vt,"byteOffset","o"),Ft(Vt,"byteLength","l"),Ft(Vt,"length","e"),V(Vt,vt,{get:function(){return this[bt]}}),t.exports=function(t,n,e,c){var f=t+((c=!!c)?"Clamped":"")+"Array",l="get"+t,h="set"+t,d=o[f],g=d||{},m=d&&E(d),b=!d||!a.ABV,S={},_=d&&d.prototype,P=function(t,e){V(t,e,{get:function(){return function(t,e){var r=t._d;return r.v[l](e*n+r.o,St)}(this,e)},set:function(t){return function(t,e,r){var o=t._d;c&&(r=(r=Math.round(r))<0?0:r>255?255:255&r),o.v[h](e*n+o.o,r,St)}(this,e,t)},enumerable:!0})};b?(d=e(function(t,e,r,o){s(t,d,f,"_d");var i,u,a,c,l=0,h=0;if(x(e)){if(!(e instanceof Y||"ArrayBuffer"==(c=w(e))||"SharedArrayBuffer"==c))return bt in e?Tt(d,e):It.call(d,e);i=e,h=Ot(r,n);var g=e.byteLength;if(void 0===o){if(g%n)throw U("Wrong length!");if((u=g-h)<0)throw U("Wrong length!")}else if((u=v(o)*n)+h>g)throw U("Wrong length!");a=u/n}else a=y(e),i=new Y(u=a*n);for(p(t,"_d",{b:i,o:h,l:u,e:a,v:new J(i)});l<a;)P(t,l++)}),_=d.prototype=O(Vt),p(_,"constructor",d)):i(function(){d(1)})&&i(function(){new d(-1)})&&R(function(t){new d,new d(null),new d(1.5),new d(t)},!0)||(d=e(function(t,e,r,o){var i;return s(t,d,f),x(e)?e instanceof Y||"ArrayBuffer"==(i=w(e))||"SharedArrayBuffer"==i?void 0!==o?new g(e,Ot(r,n),o):void 0!==r?new g(e,Ot(r,n)):new g(e):bt in e?Tt(d,e):It.call(d,e):new g(y(e))}),K(m!==Function.prototype?M(g).concat(M(m)):M(g),function(t){t in d||p(d,t,g[t])}),d.prototype=_,r||(_.constructor=d));var T=_[dt],F=!!T&&("values"==T.name||null==T.name),I=Ct.values;p(d,yt,!0),p(_,bt,f),p(_,wt,!0),p(_,gt,d),(c?new d(1)[vt]==f:vt in _)||V(_,vt,{get:function(){return f}}),S[f]=d,u(u.G+u.W+u.F*(d!=g),S),u(u.S,f,{BYTES_PER_ELEMENT:n}),u(u.S+u.F*i(function(){g.of.call(d,1)}),f,{from:It,of:jt}),"BYTES_PER_ELEMENT"in _||p(_,"BYTES_PER_ELEMENT",n),u(u.P,f,Nt),L(f),u(u.P+u.F*_t,f,{set:Lt}),u(u.P+u.F*!F,f,Ct),r||_.toString==pt||(_.toString=pt),u(u.P+u.F*i(function(){new d(1).slice()}),f,{slice:Rt}),u(u.P+u.F*(i(function(){return[1,2].toLocaleString()!=new d([1,2]).toLocaleString()})||!i(function(){_.toLocaleString.call([1,2])})),f,{toLocaleString:kt}),N[f]=F?T:I,r||F||p(_,dt,I)}}else t.exports=function(){}},function(t,n){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)},function(t,n,e){var r=e(4);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n,e){var r=e(32)("meta"),o=e(4),i=e(13),u=e(8).f,a=0,c=Object.isExtensible||function(){return!0},f=!e(2)(function(){return c(Object.preventExtensions({}))}),s=function(t){u(t,r,{value:{i:"O"+ ++a,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!c(t))return"F";if(!n)return"E";s(t)}return t[r].i},getWeak:function(t,n){if(!i(t,r)){if(!c(t))return!0;if(!n)return!1;s(t)}return t[r].w},onFreeze:function(t){return f&&l.NEED&&c(t)&&!i(t,r)&&s(t),t}}},,function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,n){t.exports=!1},function(t,n,e){var r=e(119),o=e(81);t.exports=Object.keys||function(t){return r(t,o)}},function(t,n,e){var r=e(19),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=r(t))<0?o(t+n,0):i(t,n)}},function(t,n,e){var r=e(3),o=e(120),i=e(81),u=e(80)("IE_PROTO"),a=function(){},c=function(){var t,n=e(78)("iframe"),r=i.length;for(n.style.display="none",e(82).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),c=t.F;r--;)delete c.prototype[i[r]];return c()};t.exports=Object.create||function(t,n){var e;return null!==t?(a.prototype=r(t),e=new a,a.prototype=null,e[u]=t):e=c(),void 0===n?e:o(e,n)}},function(t,n,e){var r=e(119),o=e(81).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,n,e){var r=e(13),o=e(10),i=e(80)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,e){var r=e(5)("unscopables"),o=Array.prototype;null==o[r]&&e(14)(o,r,{}),t.exports=function(t){o[r][t]=!0}},function(t,n,e){var r=e(4);t.exports=function(t,n){if(!r(t)||t._t!==n)throw TypeError("Incompatible receiver, "+n+" required!");return t}},function(t,n,e){var r=e(27),o=e(23),i=e(148),u=e(51),a=e(44),c=function(t,n,e){var f,s,l,p=t&c.F,h=t&c.G,d=t&c.S,v=t&c.P,y=t&c.B,g=t&c.W,m=h?o:o[n]||(o[n]={}),b=m.prototype,w=h?r:d?r[n]:(r[n]||{}).prototype;for(f in h&&(e=n),e)(s=!p&&w&&void 0!==w[f])&&a(m,f)||(l=s?w[f]:e[f],m[f]=h&&"function"!=typeof w[f]?e[f]:y&&s?i(l,r):g&&w[f]==l?function(t){var n=function(n,e,r){if(this instanceof t){switch(arguments.length){case 0:return new t;case 1:return new t(n);case 2:return new t(n,e)}return new t(n,e,r)}return t.apply(this,arguments)};return n.prototype=t.prototype,n}(l):v&&"function"==typeof l?i(Function.call,l):l,v&&((m.virtual||(m.virtual={}))[f]=l,t&c.R&&b&&!b[f]&&u(b,f,l)))};c.F=1,c.G=2,c.S=4,c.P=8,c.B=16,c.W=32,c.U=64,c.R=128,t.exports=c},function(t,n,e){var r=e(59),o=e(149),i=e(103),u=Object.defineProperty;n.f=e(43)?Object.defineProperty:function(t,n,e){if(r(t),n=i(n,!0),r(e),o)try{return u(t,n,e)}catch(t){}if("get"in e||"set"in e)throw TypeError("Accessors not supported!");return"value"in e&&(t[n]=e.value),t}},function(t,n,e){t.exports=!e(60)(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a})},function(t,n){var e={}.hasOwnProperty;t.exports=function(t,n){return e.call(t,n)}},function(t,n,e){var r=e(8).f,o=e(13),i=e(5)("toStringTag");t.exports=function(t,n,e){t&&!o(t=e?t:t.prototype,i)&&r(t,i,{configurable:!0,value:n})}},function(t,n,e){var r=e(0),o=e(25),i=e(2),u=e(84),a="["+u+"]",c=RegExp("^"+a+a+"*"),f=RegExp(a+a+"*$"),s=function(t,n,e){var o={},a=i(function(){return!!u[t]()||"
"!="
"[t]()}),c=o[t]=a?n(l):u[t];e&&(o[e]=c),r(r.P+r.F*a,"String",o)},l=s.trim=function(t,n){return t=String(o(t)),1&n&&(t=t.replace(c,"")),2&n&&(t=t.replace(f,"")),t};t.exports=s},function(t,n){t.exports={}},function(t,n,e){"use strict";var r=e(1),o=e(8),i=e(9),u=e(5)("species");t.exports=function(t){var n=r[t];i&&n&&!n[u]&&o.f(n,u,{configurable:!0,get:function(){return this}})}},function(t,n){t.exports=function(t,n,e,r){if(!(t instanceof n)||void 0!==r&&r in t)throw TypeError(e+": incorrect invocation!");return t}},function(t,n,e){var r=e(11);t.exports=function(t,n,e){for(var o in n)r(t,o,n[o],e);return t}},function(t,n,e){var r=e(42),o=e(74);t.exports=e(43)?function(t,n,e){return r.f(t,n,o(1,e))}:function(t,n,e){return t[n]=e,t}},function(t,n){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,n,e){var r=e(373),o=e(104);t.exports=function(t){return r(o(t))}},function(t,n,e){var r=e(106)("wks"),o=e(76),i=e(27).Symbol,u="function"==typeof i;(t.exports=function(t){return r[t]||(r[t]=u&&i[t]||(u?i:o)("Symbol."+t))}).store=r},function(t,n,e){var r=e(24);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,e){var r=e(24),o=e(5)("toStringTag"),i="Arguments"==r(function(){return arguments}());t.exports=function(t){var n,e,u;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(e=function(t,n){try{return t[n]}catch(t){}}(n=Object(t),o))?e:i?r(n):"Object"==(u=r(n))&&"function"==typeof n.callee?"Arguments":u}},function(t,n,e){var r=e(3),o=e(18),i=e(5)("species");t.exports=function(t,n){var e,u=r(t).constructor;return void 0===u||null==(e=r(u)[i])?n:o(e)}},function(t,n,e){var r=e(52);t.exports=function(t){if(!r(t))throw TypeError(t+" is not an object!");return t}},function(t,n){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,n){t.exports=React},function(t,n,e){var r=e(7),o=e(1),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e(33)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,n,e){var r=e(15),o=e(6),i=e(35);t.exports=function(t){return function(n,e,u){var a,c=r(n),f=o(c.length),s=i(u,f);if(t&&e!=e){for(;f>s;)if((a=c[s++])!=a)return!0}else for(;f>s;s++)if((t||s in c)&&c[s]===e)return t||s||0;return!t&&-1}}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,e){var r=e(24);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,n,e){var r=e(5)("iterator"),o=!1;try{var i=[7][r]();i.return=function(){o=!0},Array.from(i,function(){throw 2})}catch(t){}t.exports=function(t,n){if(!n&&!o)return!1;var e=!1;try{var i=[7],u=i[r]();u.next=function(){return{done:e=!0}},i[r]=function(){return u},t(i)}catch(t){}return e}},function(t,n,e){"use strict";var r=e(3);t.exports=function(){var t=r(this),n="";return t.global&&(n+="g"),t.ignoreCase&&(n+="i"),t.multiline&&(n+="m"),t.unicode&&(n+="u"),t.sticky&&(n+="y"),n}},function(t,n,e){"use strict";var r=e(57),o=RegExp.prototype.exec;t.exports=function(t,n){var e=t.exec;if("function"==typeof e){var i=e.call(t,n);if("object"!=typeof i)throw new TypeError("RegExp exec method returned something other than an Object or null");return i}if("RegExp"!==r(t))throw new TypeError("RegExp#exec called on incompatible receiver");return o.call(t,n)}},function(t,n,e){"use strict";e(137);var r=e(11),o=e(14),i=e(2),u=e(25),a=e(5),c=e(99),f=a("species"),s=!i(function(){var t=/./;return t.exec=function(){var t=[];return t.groups={a:"7"},t},"7"!=="".replace(t,"$<a>")}),l=function(){var t=/(?:)/,n=t.exec;t.exec=function(){return n.apply(this,arguments)};var e="ab".split(t);return 2===e.length&&"a"===e[0]&&"b"===e[1]}();t.exports=function(t,n,e){var p=a(t),h=!i(function(){var n={};return n[p]=function(){return 7},7!=""[t](n)}),d=h?!i(function(){var n=!1,e=/a/;return e.exec=function(){return n=!0,null},"split"===t&&(e.constructor={},e.constructor[f]=function(){return e}),e[p](""),!n}):void 0;if(!h||!d||"replace"===t&&!s||"split"===t&&!l){var v=/./[p],y=e(u,p,""[t],function(t,n,e,r,o){return n.exec===c?h&&!o?{done:!0,value:v.call(n,e,r)}:{done:!0,value:t.call(e,n,r)}:{done:!1}}),g=y[0],m=y[1];r(String.prototype,t,g),o(RegExp.prototype,p,2==n?function(t,n){return m.call(t,this,n)}:function(t){return m.call(t,this)})}}},function(t,n,e){var r=e(17),o=e(132),i=e(94),u=e(3),a=e(6),c=e(96),f={},s={};(n=t.exports=function(t,n,e,l,p){var h,d,v,y,g=p?function(){return t}:c(t),m=r(e,l,n?2:1),b=0;if("function"!=typeof g)throw TypeError(t+" is not iterable!");if(i(g)){for(h=a(t.length);h>b;b++)if((y=n?m(u(d=t[b])[0],d[1]):m(t[b]))===f||y===s)return y}else for(v=g.call(t);!(d=v.next()).done;)if((y=o(v,m,d.value,n))===f||y===s)return y}).BREAK=f,n.RETURN=s},function(t,n,e){var r=e(1).navigator;t.exports=r&&r.userAgent||""},function(t,n,e){"use strict";var r=e(1),o=e(0),i=e(11),u=e(50),a=e(29),c=e(70),f=e(49),s=e(4),l=e(2),p=e(66),h=e(45),d=e(85);t.exports=function(t,n,e,v,y,g){var m=r[t],b=m,w=y?"set":"add",x=b&&b.prototype,S={},_=function(t){var n=x[t];i(x,t,"delete"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"has"==t?function(t){return!(g&&!s(t))&&n.call(this,0===t?0:t)}:"get"==t?function(t){return g&&!s(t)?void 0:n.call(this,0===t?0:t)}:"add"==t?function(t){return n.call(this,0===t?0:t),this}:function(t,e){return n.call(this,0===t?0:t,e),this})};if("function"==typeof b&&(g||x.forEach&&!l(function(){(new b).entries().next()}))){var O=new b,E=O[w](g?{}:-0,1)!=O,M=l(function(){O.has(1)}),P=p(function(t){new b(t)}),T=!g&&l(function(){for(var t=new b,n=5;n--;)t[w](n,n);return!t.has(-0)});P||((b=n(function(n,e){f(n,b,t);var r=d(new m,n,b);return null!=e&&c(e,y,r[w],r),r})).prototype=x,x.constructor=b),(M||T)&&(_("delete"),_("has"),y&&_("get")),(T||E)&&_(w),g&&x.clear&&delete x.clear}else b=v.getConstructor(n,t,y,w),u(b.prototype,e),a.NEED=!0;return h(b,t),S[t]=b,o(o.G+o.W+o.F*(b!=m),S),g||v.setStrong(b,t,y),b}},function(t,n,e){for(var r,o=e(1),i=e(14),u=e(32),a=u("typed_array"),c=u("view"),f=!(!o.ArrayBuffer||!o.DataView),s=f,l=0,p="Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array".split(",");l<9;)(r=o[p[l++]])?(i(r.prototype,a,!0),i(r.prototype,c,!0)):s=!1;t.exports={ABV:f,CONSTR:s,TYPED:a,VIEW:c}},function(t,n){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},function(t,n){t.exports=!0},function(t,n){var e=0,r=Math.random();t.exports=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++e+r).toString(36))}},function(t,n){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e},function(t,n,e){var r=e(4),o=e(1).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,e){n.f=e(5)},function(t,n,e){var r=e(62)("keys"),o=e(32);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,e){var r=e(1).document;t.exports=r&&r.documentElement},function(t,n,e){var r=e(4),o=e(3),i=function(t,n){if(o(t),!r(n)&&null!==n)throw TypeError(n+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=e(17)(Function.call,e(20).f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return i(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:i}},function(t,n){t.exports="\t\n\v\f\r \u2028\u2029\ufeff"},function(t,n,e){var r=e(4),o=e(83).set;t.exports=function(t,n,e){var i,u=n.constructor;return u!==e&&"function"==typeof u&&(i=u.prototype)!==e.prototype&&r(i)&&o&&o(t,i),t}},function(t,n,e){"use strict";var r=e(19),o=e(25);t.exports=function(t){var n=String(o(this)),e="",i=r(t);if(i<0||i==1/0)throw RangeError("Count can't be negative");for(;i>0;(i>>>=1)&&(n+=n))1&i&&(e+=n);return e}},function(t,n){t.exports=Math.sign||function(t){return 0==(t=+t)||t!=t?t:t<0?-1:1}},function(t,n){var e=Math.expm1;t.exports=!e||e(10)>22025.465794806718||e(10)<22025.465794806718||-2e-17!=e(-2e-17)?function(t){return 0==(t=+t)?t:t>-1e-6&&t<1e-6?t+t*t/2:Math.exp(t)-1}:e},function(t,n,e){var r=e(19),o=e(25);t.exports=function(t){return function(n,e){var i,u,a=String(o(n)),c=r(e),f=a.length;return c<0||c>=f?t?"":void 0:(i=a.charCodeAt(c))<55296||i>56319||c+1===f||(u=a.charCodeAt(c+1))<56320||u>57343?t?a.charAt(c):i:t?a.slice(c,c+2):u-56320+(i-55296<<10)+65536}}},function(t,n,e){"use strict";var r=e(33),o=e(0),i=e(11),u=e(14),a=e(47),c=e(131),f=e(45),s=e(38),l=e(5)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,n,e,d,v,y,g){c(e,n,d);var m,b,w,x=function(t){if(!p&&t in E)return E[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},S=n+" Iterator",_="values"==v,O=!1,E=t.prototype,M=E[l]||E["@@iterator"]||v&&E[v],P=M||x(v),T=v?_?x("entries"):P:void 0,F="Array"==n&&E.entries||M;if(F&&(w=s(F.call(new t)))!==Object.prototype&&w.next&&(f(w,S,!0),r||"function"==typeof w[l]||u(w,l,h)),_&&M&&"values"!==M.name&&(O=!0,P=function(){return M.call(this)}),r&&!g||!p&&!O&&E[l]||u(E,l,P),a[n]=P,a[S]=h,v)if(m={values:_?P:x("values"),keys:y?P:x("keys"),entries:T},g)for(b in m)b in E||i(E,b,m[b]);else o(o.P+o.F*(p||O),n,m);return m}},function(t,n,e){var r=e(92),o=e(25);t.exports=function(t,n,e){if(r(n))throw TypeError("String#"+e+" doesn't accept regex!");return String(o(t))}},function(t,n,e){var r=e(4),o=e(24),i=e(5)("match");t.exports=function(t){var n;return r(t)&&(void 0!==(n=t[i])?!!n:"RegExp"==o(t))}},function(t,n,e){var r=e(5)("match");t.exports=function(t){var n=/./;try{"/./"[t](n)}catch(e){try{return n[r]=!1,!"/./"[t](n)}catch(t){}}return!0}},function(t,n,e){var r=e(47),o=e(5)("iterator"),i=Array.prototype;t.exports=function(t){return void 0!==t&&(r.Array===t||i[o]===t)}},function(t,n,e){"use strict";var r=e(8),o=e(31);t.exports=function(t,n,e){n in t?r.f(t,n,o(0,e)):t[n]=e}},function(t,n,e){var r=e(57),o=e(5)("iterator"),i=e(47);t.exports=e(7).getIteratorMethod=function(t){if(null!=t)return t[o]||t["@@iterator"]||i[r(t)]}},function(t,n,e){"use strict";var r=e(10),o=e(35),i=e(6);t.exports=function(t){for(var n=r(this),e=i(n.length),u=arguments.length,a=o(u>1?arguments[1]:void 0,e),c=u>2?arguments[2]:void 0,f=void 0===c?e:o(c,e);f>a;)n[a++]=t;return n}},function(t,n,e){"use strict";var r=e(39),o=e(136),i=e(47),u=e(15);t.exports=e(90)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,n,e){"use strict";var r,o,i=e(67),u=RegExp.prototype.exec,a=String.prototype.replace,c=u,f=(r=/a/,o=/b*/g,u.call(r,"a"),u.call(o,"a"),0!==r.lastIndex||0!==o.lastIndex),s=void 0!==/()??/.exec("")[1];(f||s)&&(c=function(t){var n,e,r,o,c=this;return s&&(e=new RegExp("^"+c.source+"$(?!\\s)",i.call(c))),f&&(n=c.lastIndex),r=u.call(c,t),f&&r&&(c.lastIndex=c.global?r.index+r[0].length:n),s&&r&&r.length>1&&a.call(r[0],e,function(){for(o=1;o<arguments.length-2;o++)void 0===arguments[o]&&(r[o]=void 0)}),r}),t.exports=c},function(t,n,e){"use strict";var r=e(89)(!0);t.exports=function(t,n,e){return n+(e?r(t,n).length:1)}},function(t,n,e){var r,o,i,u=e(17),a=e(125),c=e(82),f=e(78),s=e(1),l=s.process,p=s.setImmediate,h=s.clearImmediate,d=s.MessageChannel,v=s.Dispatch,y=0,g={},m=function(){var t=+this;if(g.hasOwnProperty(t)){var n=g[t];delete g[t],n()}},b=function(t){m.call(t.data)};p&&h||(p=function(t){for(var n=[],e=1;arguments.length>e;)n.push(arguments[e++]);return g[++y]=function(){a("function"==typeof t?t:Function(t),n)},r(y),y},h=function(t){delete g[t]},"process"==e(24)(l)?r=function(t){l.nextTick(u(m,t,1))}:v&&v.now?r=function(t){v.now(u(m,t,1))}:d?(i=(o=new d).port2,o.port1.onmessage=b,r=u(i.postMessage,i,1)):s.addEventListener&&"function"==typeof postMessage&&!s.importScripts?(r=function(t){s.postMessage(t+"","*")},s.addEventListener("message",b,!1)):r="onreadystatechange"in f("script")?function(t){c.appendChild(f("script")).onreadystatechange=function(){c.removeChild(this),m.call(t)}}:function(t){setTimeout(u(m,t,1),0)}),t.exports={set:p,clear:h}},function(t,n,e){"use strict";var r=e(1),o=e(9),i=e(33),u=e(73),a=e(14),c=e(50),f=e(2),s=e(49),l=e(19),p=e(6),h=e(144),d=e(37).f,v=e(8).f,y=e(97),g=e(45),m="prototype",b="Wrong index!",w=r.ArrayBuffer,x=r.DataView,S=r.Math,_=r.RangeError,O=r.Infinity,E=w,M=S.abs,P=S.pow,T=S.floor,F=S.log,I=S.LN2,j=o?"_b":"buffer",A=o?"_l":"byteLength",k=o?"_o":"byteOffset";function N(t,n,e){var r,o,i,u=new Array(e),a=8*e-n-1,c=(1<<a)-1,f=c>>1,s=23===n?P(2,-24)-P(2,-77):0,l=0,p=t<0||0===t&&1/t<0?1:0;for((t=M(t))!=t||t===O?(o=t!=t?1:0,r=c):(r=T(F(t)/I),t*(i=P(2,-r))<1&&(r--,i*=2),(t+=r+f>=1?s/i:s*P(2,1-f))*i>=2&&(r++,i/=2),r+f>=c?(o=0,r=c):r+f>=1?(o=(t*i-1)*P(2,n),r+=f):(o=t*P(2,f-1)*P(2,n),r=0));n>=8;u[l++]=255&o,o/=256,n-=8);for(r=r<<n|o,a+=n;a>0;u[l++]=255&r,r/=256,a-=8);return u[--l]|=128*p,u}function R(t,n,e){var r,o=8*e-n-1,i=(1<<o)-1,u=i>>1,a=o-7,c=e-1,f=t[c--],s=127&f;for(f>>=7;a>0;s=256*s+t[c],c--,a-=8);for(r=s&(1<<-a)-1,s>>=-a,a+=n;a>0;r=256*r+t[c],c--,a-=8);if(0===s)s=1-u;else{if(s===i)return r?NaN:f?-O:O;r+=P(2,n),s-=u}return(f?-1:1)*r*P(2,s-n)}function L(t){return t[3]<<24|t[2]<<16|t[1]<<8|t[0]}function C(t){return[255&t]}function z(t){return[255&t,t>>8&255]}function W(t){return[255&t,t>>8&255,t>>16&255,t>>24&255]}function D(t){return N(t,52,8)}function V(t){return N(t,23,4)}function B(t,n,e){v(t[m],n,{get:function(){return this[e]}})}function U(t,n,e,r){var o=h(+e);if(o+n>t[A])throw _(b);var i=t[j]._b,u=o+t[k],a=i.slice(u,u+n);return r?a:a.reverse()}function G(t,n,e,r,o,i){var u=h(+e);if(u+n>t[A])throw _(b);for(var a=t[j]._b,c=u+t[k],f=r(+o),s=0;s<n;s++)a[c+s]=f[i?s:n-s-1]}if(u.ABV){if(!f(function(){w(1)})||!f(function(){new w(-1)})||f(function(){return new w,new w(1.5),new w(NaN),"ArrayBuffer"!=w.name})){for(var H,q=(w=function(t){return s(this,w),new E(h(t))})[m]=E[m],Y=d(E),J=0;Y.length>J;)(H=Y[J++])in w||a(w,H,E[H]);i||(q.constructor=w)}var K=new x(new w(2)),X=x[m].setInt8;K.setInt8(0,2147483648),K.setInt8(1,2147483649),!K.getInt8(0)&&K.getInt8(1)||c(x[m],{setInt8:function(t,n){X.call(this,t,n<<24>>24)},setUint8:function(t,n){X.call(this,t,n<<24>>24)}},!0)}else w=function(t){s(this,w,"ArrayBuffer");var n=h(t);this._b=y.call(new Array(n),0),this[A]=n},x=function(t,n,e){s(this,x,"DataView"),s(t,w,"DataView");var r=t[A],o=l(n);if(o<0||o>r)throw _("Wrong offset!");if(o+(e=void 0===e?r-o:p(e))>r)throw _("Wrong length!");this[j]=t,this[k]=o,this[A]=e},o&&(B(w,"byteLength","_l"),B(x,"buffer","_b"),B(x,"byteLength","_l"),B(x,"byteOffset","_o")),c(x[m],{getInt8:function(t){return U(this,1,t)[0]<<24>>24},getUint8:function(t){return U(this,1,t)[0]},getInt16:function(t){var n=U(this,2,t,arguments[1]);return(n[1]<<8|n[0])<<16>>16},getUint16:function(t){var n=U(this,2,t,arguments[1]);return n[1]<<8|n[0]},getInt32:function(t){return L(U(this,4,t,arguments[1]))},getUint32:function(t){return L(U(this,4,t,arguments[1]))>>>0},getFloat32:function(t){return R(U(this,4,t,arguments[1]),23,4)},getFloat64:function(t){return R(U(this,8,t,arguments[1]),52,8)},setInt8:function(t,n){G(this,1,t,C,n)},setUint8:function(t,n){G(this,1,t,C,n)},setInt16:function(t,n){G(this,2,t,z,n,arguments[2])},setUint16:function(t,n){G(this,2,t,z,n,arguments[2])},setInt32:function(t,n){G(this,4,t,W,n,arguments[2])},setUint32:function(t,n){G(this,4,t,W,n,arguments[2])},setFloat32:function(t,n){G(this,4,t,V,n,arguments[2])},setFloat64:function(t,n){G(this,8,t,D,n,arguments[2])}});g(w,"ArrayBuffer"),g(x,"DataView"),a(x[m],u.VIEW,!0),n.ArrayBuffer=w,n.DataView=x},function(t,n,e){var r=e(52);t.exports=function(t,n){if(!r(t))return t;var e,o;if(n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;if("function"==typeof(e=t.valueOf)&&!r(o=e.call(t)))return o;if(!n&&"function"==typeof(e=t.toString)&&!r(o=e.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},function(t,n){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},function(t,n,e){var r=e(106)("keys"),o=e(76);t.exports=function(t){return r[t]||(r[t]=o(t))}},function(t,n,e){var r=e(23),o=e(27),i=o["__core-js_shared__"]||(o["__core-js_shared__"]={});(t.exports=function(t,n){return i[t]||(i[t]=void 0!==n?n:{})})("versions",[]).push({version:r.version,mode:e(75)?"pure":"global",copyright:"© 2019 Denis Pushkarev (zloirock.ru)"})},function(t,n){var e=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:e)(t)}},function(t,n){t.exports={}},function(t,n,e){var r=e(59),o=e(372),i=e(111),u=e(105)("IE_PROTO"),a=function(){},c=function(){var t,n=e(150)("iframe"),r=i.length;for(n.style.display="none",e(377).appendChild(n),n.src="javascript:",(t=n.contentWindow.document).open(),t.write("<script>document.F=Object<\/script>"),t.close(),c=t.F;r--;)delete c.prototype[i[r]];return c()};t.exports=Object.create||function(t,n){var e;return null!==t?(a.prototype=r(t),e=new a,a.prototype=null,e[u]=t):e=c(),void 0===n?e:o(e,n)}},function(t,n,e){var r=e(156),o=e(111);t.exports=Object.keys||function(t){return r(t,o)}},function(t,n){t.exports="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(",")},function(t,n,e){var r=e(42).f,o=e(44),i=e(54)("toStringTag");t.exports=function(t,n,e){t&&!o(t=e?t:t.prototype,i)&&r(t,i,{configurable:!0,value:n})}},function(t,n,e){n.f=e(54)},function(t,n,e){var r=e(27),o=e(23),i=e(75),u=e(113),a=e(42).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in n||a(n,t,{value:u.f(t)})}},function(t,n){n.f={}.propertyIsEnumerable},function(t,n,e){"use strict";var r=e(61),o=e.n(r);function i(){return(i=Object.assign||function(t){for(var n=1;n<arguments.length;n++){var e=arguments[n];for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=e[r])}return t}).apply(this,arguments)}var u=o.a.createElement("g",{fill:"#555D66"},o.a.createElement("path",{d:"M11.4 10.2H3V21h8.4V10.2zM21 15h-8.4v6H21v-6zM11.4 3H3v6h8.4V3zM21 3h-8.4v10.8H21V3z"}));n.a=function(t){return o.a.createElement("svg",i({width:24,height:24,viewBox:"0 0 24 24",fill:"none"},t),u)}},function(t,n,e){t.exports=!e(9)&&!e(2)(function(){return 7!=Object.defineProperty(e(78)("div"),"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(1),o=e(7),i=e(33),u=e(79),a=e(8).f;t.exports=function(t){var n=o.Symbol||(o.Symbol=i?{}:r.Symbol||{});"_"==t.charAt(0)||t in n||a(n,t,{value:u.f(t)})}},function(t,n,e){var r=e(13),o=e(15),i=e(63)(!1),u=e(80)("IE_PROTO");t.exports=function(t,n){var e,a=o(t),c=0,f=[];for(e in a)e!=u&&r(a,e)&&f.push(e);for(;n.length>c;)r(a,e=n[c++])&&(~i(f,e)||f.push(e));return f}},function(t,n,e){var r=e(8),o=e(3),i=e(34);t.exports=e(9)?Object.defineProperties:function(t,n){o(t);for(var e,u=i(n),a=u.length,c=0;a>c;)r.f(t,e=u[c++],n[e]);return t}},function(t,n,e){var r=e(15),o=e(37).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return u.slice()}}(t):o(r(t))}},function(t,n,e){"use strict";var r=e(34),o=e(64),i=e(56),u=e(10),a=e(55),c=Object.assign;t.exports=!c||e(2)(function(){var t={},n={},e=Symbol(),r="abcdefghijklmnopqrst";return t[e]=7,r.split("").forEach(function(t){n[t]=t}),7!=c({},t)[e]||Object.keys(c({},n)).join("")!=r})?function(t,n){for(var e=u(t),c=arguments.length,f=1,s=o.f,l=i.f;c>f;)for(var p,h=a(arguments[f++]),d=s?r(h).concat(s(h)):r(h),v=d.length,y=0;v>y;)l.call(h,p=d[y++])&&(e[p]=h[p]);return e}:c},function(t,n){t.exports=Object.is||function(t,n){return t===n?0!==t||1/t==1/n:t!=t&&n!=n}},function(t,n,e){"use strict";var r=e(18),o=e(4),i=e(125),u=[].slice,a={};t.exports=Function.bind||function(t){var n=r(this),e=u.call(arguments,1),c=function(){var r=e.concat(u.call(arguments));return this instanceof c?function(t,n,e){if(!(n in a)){for(var r=[],o=0;o<n;o++)r[o]="a["+o+"]";a[n]=Function("F,a","return new F("+r.join(",")+")")}return a[n](t,e)}(n,r.length,r):i(n,r,t)};return o(n.prototype)&&(c.prototype=n.prototype),c}},function(t,n){t.exports=function(t,n,e){var r=void 0===e;switch(n.length){case 0:return r?t():t.call(e);case 1:return r?t(n[0]):t.call(e,n[0]);case 2:return r?t(n[0],n[1]):t.call(e,n[0],n[1]);case 3:return r?t(n[0],n[1],n[2]):t.call(e,n[0],n[1],n[2]);case 4:return r?t(n[0],n[1],n[2],n[3]):t.call(e,n[0],n[1],n[2],n[3])}return t.apply(e,n)}},function(t,n,e){var r=e(1).parseInt,o=e(46).trim,i=e(84),u=/^[-+]?0[xX]/;t.exports=8!==r(i+"08")||22!==r(i+"0x16")?function(t,n){var e=o(String(t),3);return r(e,n>>>0||(u.test(e)?16:10))}:r},function(t,n,e){var r=e(1).parseFloat,o=e(46).trim;t.exports=1/r(e(84)+"-0")!=-1/0?function(t){var n=o(String(t),3),e=r(n);return 0===e&&"-"==n.charAt(0)?-0:e}:r},function(t,n,e){var r=e(24);t.exports=function(t,n){if("number"!=typeof t&&"Number"!=r(t))throw TypeError(n);return+t}},function(t,n,e){var r=e(4),o=Math.floor;t.exports=function(t){return!r(t)&&isFinite(t)&&o(t)===t}},function(t,n){t.exports=Math.log1p||function(t){return(t=+t)>-1e-8&&t<1e-8?t-t*t/2:Math.log(1+t)}},function(t,n,e){"use strict";var r=e(36),o=e(31),i=e(45),u={};e(14)(u,e(5)("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(u,{next:o(1,e)}),i(t,n+" Iterator")}},function(t,n,e){var r=e(3);t.exports=function(t,n,e,o){try{return o?n(r(e)[0],e[1]):n(e)}catch(n){var i=t.return;throw void 0!==i&&r(i.call(t)),n}}},function(t,n,e){var r=e(275);t.exports=function(t,n){return new(r(t))(n)}},function(t,n,e){var r=e(18),o=e(10),i=e(55),u=e(6);t.exports=function(t,n,e,a,c){r(n);var f=o(t),s=i(f),l=u(f.length),p=c?l-1:0,h=c?-1:1;if(e<2)for(;;){if(p in s){a=s[p],p+=h;break}if(p+=h,c?p<0:l<=p)throw TypeError("Reduce of empty array with no initial value")}for(;c?p>=0:l>p;p+=h)p in s&&(a=n(a,s[p],p,f));return a}},function(t,n,e){"use strict";var r=e(10),o=e(35),i=e(6);t.exports=[].copyWithin||function(t,n){var e=r(this),u=i(e.length),a=o(t,u),c=o(n,u),f=arguments.length>2?arguments[2]:void 0,s=Math.min((void 0===f?u:o(f,u))-c,u-a),l=1;for(c<a&&a<c+s&&(l=-1,c+=s-1,a+=s-1);s-- >0;)c in e?e[a]=e[c]:delete e[a],a+=l,c+=l;return e}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,e){"use strict";var r=e(99);e(0)({target:"RegExp",proto:!0,forced:r!==/./.exec},{exec:r})},function(t,n,e){e(9)&&"g"!=/./g.flags&&e(8).f(RegExp.prototype,"flags",{configurable:!0,get:e(67)})},function(t,n,e){"use strict";var r,o,i,u,a=e(33),c=e(1),f=e(17),s=e(57),l=e(0),p=e(4),h=e(18),d=e(49),v=e(70),y=e(58),g=e(101).set,m=e(295)(),b=e(140),w=e(296),x=e(71),S=e(141),_=c.TypeError,O=c.process,E=O&&O.versions,M=E&&E.v8||"",P=c.Promise,T="process"==s(O),F=function(){},I=o=b.f,j=!!function(){try{var t=P.resolve(1),n=(t.constructor={})[e(5)("species")]=function(t){t(F,F)};return(T||"function"==typeof PromiseRejectionEvent)&&t.then(F)instanceof n&&0!==M.indexOf("6.6")&&-1===x.indexOf("Chrome/66")}catch(t){}}(),A=function(t){var n;return!(!p(t)||"function"!=typeof(n=t.then))&&n},k=function(t,n){if(!t._n){t._n=!0;var e=t._c;m(function(){for(var r=t._v,o=1==t._s,i=0,u=function(n){var e,i,u,a=o?n.ok:n.fail,c=n.resolve,f=n.reject,s=n.domain;try{a?(o||(2==t._h&&L(t),t._h=1),!0===a?e=r:(s&&s.enter(),e=a(r),s&&(s.exit(),u=!0)),e===n.promise?f(_("Promise-chain cycle")):(i=A(e))?i.call(e,c,f):c(e)):f(r)}catch(t){s&&!u&&s.exit(),f(t)}};e.length>i;)u(e[i++]);t._c=[],t._n=!1,n&&!t._h&&N(t)})}},N=function(t){g.call(c,function(){var n,e,r,o=t._v,i=R(t);if(i&&(n=w(function(){T?O.emit("unhandledRejection",o,t):(e=c.onunhandledrejection)?e({promise:t,reason:o}):(r=c.console)&&r.error&&r.error("Unhandled promise rejection",o)}),t._h=T||R(t)?2:1),t._a=void 0,i&&n.e)throw n.v})},R=function(t){return 1!==t._h&&0===(t._a||t._c).length},L=function(t){g.call(c,function(){var n;T?O.emit("rejectionHandled",t):(n=c.onrejectionhandled)&&n({promise:t,reason:t._v})})},C=function(t){var n=this;n._d||(n._d=!0,(n=n._w||n)._v=t,n._s=2,n._a||(n._a=n._c.slice()),k(n,!0))},z=function(t){var n,e=this;if(!e._d){e._d=!0,e=e._w||e;try{if(e===t)throw _("Promise can't be resolved itself");(n=A(t))?m(function(){var r={_w:e,_d:!1};try{n.call(t,f(z,r,1),f(C,r,1))}catch(t){C.call(r,t)}}):(e._v=t,e._s=1,k(e,!1))}catch(t){C.call({_w:e,_d:!1},t)}}};j||(P=function(t){d(this,P,"Promise","_h"),h(t),r.call(this);try{t(f(z,this,1),f(C,this,1))}catch(t){C.call(this,t)}},(r=function(t){this._c=[],this._a=void 0,this._s=0,this._d=!1,this._v=void 0,this._h=0,this._n=!1}).prototype=e(50)(P.prototype,{then:function(t,n){var e=I(y(this,P));return e.ok="function"!=typeof t||t,e.fail="function"==typeof n&&n,e.domain=T?O.domain:void 0,this._c.push(e),this._a&&this._a.push(e),this._s&&k(this,!1),e.promise},catch:function(t){return this.then(void 0,t)}}),i=function(){var t=new r;this.promise=t,this.resolve=f(z,t,1),this.reject=f(C,t,1)},b.f=I=function(t){return t===P||t===u?new i(t):o(t)}),l(l.G+l.W+l.F*!j,{Promise:P}),e(45)(P,"Promise"),e(48)("Promise"),u=e(7).Promise,l(l.S+l.F*!j,"Promise",{reject:function(t){var n=I(this);return(0,n.reject)(t),n.promise}}),l(l.S+l.F*(a||!j),"Promise",{resolve:function(t){return S(a&&this===u?P:this,t)}}),l(l.S+l.F*!(j&&e(66)(function(t){P.all(t).catch(F)})),"Promise",{all:function(t){var n=this,e=I(n),r=e.resolve,o=e.reject,i=w(function(){var e=[],i=0,u=1;v(t,!1,function(t){var a=i++,c=!1;e.push(void 0),u++,n.resolve(t).then(function(t){c||(c=!0,e[a]=t,--u||r(e))},o)}),--u||r(e)});return i.e&&o(i.v),e.promise},race:function(t){var n=this,e=I(n),r=e.reject,o=w(function(){v(t,!1,function(t){n.resolve(t).then(e.resolve,r)})});return o.e&&r(o.v),e.promise}})},function(t,n,e){"use strict";var r=e(18);function o(t){var n,e;this.promise=new t(function(t,r){if(void 0!==n||void 0!==e)throw TypeError("Bad Promise constructor");n=t,e=r}),this.resolve=r(n),this.reject=r(e)}t.exports.f=function(t){return new o(t)}},function(t,n,e){var r=e(3),o=e(4),i=e(140);t.exports=function(t,n){if(r(t),o(n)&&n.constructor===t)return n;var e=i.f(t);return(0,e.resolve)(n),e.promise}},function(t,n,e){"use strict";var r=e(8).f,o=e(36),i=e(50),u=e(17),a=e(49),c=e(70),f=e(90),s=e(136),l=e(48),p=e(9),h=e(29).fastKey,d=e(40),v=p?"_s":"size",y=function(t,n){var e,r=h(n);if("F"!==r)return t._i[r];for(e=t._f;e;e=e.n)if(e.k==n)return e};t.exports={getConstructor:function(t,n,e,f){var s=t(function(t,r){a(t,s,n,"_i"),t._t=n,t._i=o(null),t._f=void 0,t._l=void 0,t[v]=0,null!=r&&c(r,e,t[f],t)});return i(s.prototype,{clear:function(){for(var t=d(this,n),e=t._i,r=t._f;r;r=r.n)r.r=!0,r.p&&(r.p=r.p.n=void 0),delete e[r.i];t._f=t._l=void 0,t[v]=0},delete:function(t){var e=d(this,n),r=y(e,t);if(r){var o=r.n,i=r.p;delete e._i[r.i],r.r=!0,i&&(i.n=o),o&&(o.p=i),e._f==r&&(e._f=o),e._l==r&&(e._l=i),e[v]--}return!!r},forEach:function(t){d(this,n);for(var e,r=u(t,arguments.length>1?arguments[1]:void 0,3);e=e?e.n:this._f;)for(r(e.v,e.k,this);e&&e.r;)e=e.p},has:function(t){return!!y(d(this,n),t)}}),p&&r(s.prototype,"size",{get:function(){return d(this,n)[v]}}),s},def:function(t,n,e){var r,o,i=y(t,n);return i?i.v=e:(t._l=i={i:o=h(n,!0),k:n,v:e,p:r=t._l,n:void 0,r:!1},t._f||(t._f=i),r&&(r.n=i),t[v]++,"F"!==o&&(t._i[o]=i)),t},getEntry:y,setStrong:function(t,n,e){f(t,n,function(t,e){this._t=d(t,n),this._k=e,this._l=void 0},function(){for(var t=this._k,n=this._l;n&&n.r;)n=n.p;return this._t&&(this._l=n=n?n.n:this._t._f)?s(0,"keys"==t?n.k:"values"==t?n.v:[n.k,n.v]):(this._t=void 0,s(1))},e?"entries":"values",!e,!0),l(n)}}},function(t,n,e){"use strict";var r=e(50),o=e(29).getWeak,i=e(3),u=e(4),a=e(49),c=e(70),f=e(22),s=e(13),l=e(40),p=f(5),h=f(6),d=0,v=function(t){return t._l||(t._l=new y)},y=function(){this.a=[]},g=function(t,n){return p(t.a,function(t){return t[0]===n})};y.prototype={get:function(t){var n=g(this,t);if(n)return n[1]},has:function(t){return!!g(this,t)},set:function(t,n){var e=g(this,t);e?e[1]=n:this.a.push([t,n])},delete:function(t){var n=h(this.a,function(n){return n[0]===t});return~n&&this.a.splice(n,1),!!~n}},t.exports={getConstructor:function(t,n,e,i){var f=t(function(t,r){a(t,f,n,"_i"),t._t=n,t._i=d++,t._l=void 0,null!=r&&c(r,e,t[i],t)});return r(f.prototype,{delete:function(t){if(!u(t))return!1;var e=o(t);return!0===e?v(l(this,n)).delete(t):e&&s(e,this._i)&&delete e[this._i]},has:function(t){if(!u(t))return!1;var e=o(t);return!0===e?v(l(this,n)).has(t):e&&s(e,this._i)}}),f},def:function(t,n,e){var r=o(i(n),!0);return!0===r?v(t).set(n,e):r[t._i]=e,t},ufstore:v}},function(t,n,e){var r=e(19),o=e(6);t.exports=function(t){if(void 0===t)return 0;var n=r(t),e=o(n);if(n!==e)throw RangeError("Wrong length!");return e}},function(t,n,e){var r=e(37),o=e(64),i=e(3),u=e(1).Reflect;t.exports=u&&u.ownKeys||function(t){var n=r.f(i(t)),e=o.f;return e?n.concat(e(t)):n}},function(t,n,e){var r=e(6),o=e(86),i=e(25);t.exports=function(t,n,e,u){var a=String(i(t)),c=a.length,f=void 0===e?" ":String(e),s=r(n);if(s<=c||""==f)return a;var l=s-c,p=o.call(f,Math.ceil(l/f.length));return p.length>l&&(p=p.slice(0,l)),u?p+a:a+p}},function(t,n,e){var r=e(34),o=e(15),i=e(56).f;t.exports=function(t){return function(n){for(var e,u=o(n),a=r(u),c=a.length,f=0,s=[];c>f;)i.call(u,e=a[f++])&&s.push(t?[e,u[e]]:u[e]);return s}}},function(t,n,e){var r=e(356);t.exports=function(t,n,e){if(r(t),void 0===n)return t;switch(e){case 1:return function(e){return t.call(n,e)};case 2:return function(e,r){return t.call(n,e,r)};case 3:return function(e,r,o){return t.call(n,e,r,o)}}return function(){return t.apply(n,arguments)}}},function(t,n,e){t.exports=!e(43)&&!e(60)(function(){return 7!=Object.defineProperty(e(150)("div"),"a",{get:function(){return 7}}).a})},function(t,n,e){var r=e(52),o=e(27).document,i=r(o)&&r(o.createElement);t.exports=function(t){return i?o.createElement(t):{}}},function(t,n,e){var r=e(104);t.exports=function(t){return Object(r(t))}},function(t,n,e){var r=e(44),o=e(151),i=e(105)("IE_PROTO"),u=Object.prototype;t.exports=Object.getPrototypeOf||function(t){return t=o(t),r(t,i)?t[i]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?u:null}},function(t,n,e){"use strict";n.__esModule=!0;var r=u(e(367)),o=u(e(382)),i="function"==typeof o.default&&"symbol"==typeof r.default?function(t){return typeof t}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":typeof t};function u(t){return t&&t.__esModule?t:{default:t}}n.default="function"==typeof o.default&&"symbol"===i(r.default)?function(t){return void 0===t?"undefined":i(t)}:function(t){return t&&"function"==typeof o.default&&t.constructor===o.default&&t!==o.default.prototype?"symbol":void 0===t?"undefined":i(t)}},function(t,n,e){"use strict";var r=e(75),o=e(41),i=e(155),u=e(51),a=e(108),c=e(371),f=e(112),s=e(152),l=e(54)("iterator"),p=!([].keys&&"next"in[].keys()),h=function(){return this};t.exports=function(t,n,e,d,v,y,g){c(e,n,d);var m,b,w,x=function(t){if(!p&&t in E)return E[t];switch(t){case"keys":case"values":return function(){return new e(this,t)}}return function(){return new e(this,t)}},S=n+" Iterator",_="values"==v,O=!1,E=t.prototype,M=E[l]||E["@@iterator"]||v&&E[v],P=M||x(v),T=v?_?x("entries"):P:void 0,F="Array"==n&&E.entries||M;if(F&&(w=s(F.call(new t)))!==Object.prototype&&w.next&&(f(w,S,!0),r||"function"==typeof w[l]||u(w,l,h)),_&&M&&"values"!==M.name&&(O=!0,P=function(){return M.call(this)}),r&&!g||!p&&!O&&E[l]||u(E,l,P),a[n]=P,a[S]=h,v)if(m={values:_?P:x("values"),keys:y?P:x("keys"),entries:T},g)for(b in m)b in E||i(E,b,m[b]);else o(o.P+o.F*(p||O),n,m);return m}},function(t,n,e){t.exports=e(51)},function(t,n,e){var r=e(44),o=e(53),i=e(374)(!1),u=e(105)("IE_PROTO");t.exports=function(t,n){var e,a=o(t),c=0,f=[];for(e in a)e!=u&&r(a,e)&&f.push(e);for(;n.length>c;)r(a,e=n[c++])&&(~i(f,e)||f.push(e));return f}},function(t,n){var e={}.toString;t.exports=function(t){return e.call(t).slice(8,-1)}},function(t,n){n.f=Object.getOwnPropertySymbols},function(t,n,e){var r=e(156),o=e(111).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return r(t,o)}},function(t,n,e){var r=e(115),o=e(74),i=e(53),u=e(103),a=e(44),c=e(149),f=Object.getOwnPropertyDescriptor;n.f=e(43)?f:function(t,n){if(t=i(t),n=u(n,!0),c)try{return f(t,n)}catch(t){}if(a(t,n))return o(!r.f.call(t,n),t[n])}},,function(t,n,e){var r;
|
2 |
/*!
|
3 |
Copyright (c) 2017 Jed Watson.
|
4 |
Licensed under the MIT License (MIT), see
|
9 |
Licensed under the MIT License (MIT), see
|
10 |
http://jedwatson.github.io/classnames
|
11 |
*/
|
12 |
+
!function(){"use strict";var e=function(){function t(){}function n(t,n){for(var e=n.length,r=0;r<e;++r)o(t,n[r])}t.prototype=Object.create(null);var e={}.hasOwnProperty;var r=/\s+/;function o(t,o){if(o){var i=typeof o;"string"===i?function(t,n){for(var e=n.split(r),o=e.length,i=0;i<o;++i)t[e[i]]=!0}(t,o):Array.isArray(o)?n(t,o):"object"===i?function(t,n){for(var r in n)e.call(n,r)&&(t[r]=!!n[r])}(t,o):"number"===i&&function(t,n){t[n]=!0}(t,o)}}return function(){for(var e=arguments.length,r=Array(e),o=0;o<e;o++)r[o]=arguments[o];var i=new t;n(i,r);var u=[];for(var a in i)i[a]&&u.push(a);return u.join(" ")}}();t.exports?(e.default=e,t.exports=e):void 0===(r=function(){return e}.apply(n,[]))||(t.exports=r)}()},function(t,n,e){"use strict";Object.defineProperty(n,"__esModule",{value:!0});var r=p(e(357)),o=p(e(361)),i=p(e(362)),u=p(e(366)),a=p(e(392)),c=p(e(61)),f=p(e(400)),s=p(e(403)),l=e(404);function p(t){return t&&t.__esModule?t:{default:t}}var h=function(t){function n(){var t,e,i,a;(0,o.default)(this,n);for(var c=arguments.length,f=Array(c),p=0;p<c;p++)f[p]=arguments[p];return e=i=(0,u.default)(this,(t=n.__proto__||(0,r.default)(n)).call.apply(t,[this].concat(f))),i.updateIframe=function(t){if(!t.src){var n=t.content||t.children;if(n){var e=i.refs.frame;if(e){var r=e.contentDocument;r&&("string"==typeof n?(r.open(),r.write(n),r.close()):(r.open(),r.write('<div id="iframe-root"></div>'),r.close(),s.default.render(n,r.getElementById("iframe-root"))))}}}},i.injectIframeResizerUrl=function(){if(i.props.iframeResizerUrl){var t=i.refs.frame;if(t){var n=t.contentDocument;if(n){var e=null;if(["head","HEAD","body","BODY","div","DIV"].forEach(function(t){if(!e){var r=n.getElementsByTagName(t);r&&r.length&&(e=r[0])}}),e){var r=document.createElement("script");r.type="text/javascript",r.src=i.props.iframeResizerUrl,e.appendChild(r)}else console.error("Unable to inject iframe resizer script")}}}},i.onLoad=function(){i.injectIframeResizerUrl()},i.resizeIframe=function(t){var n=i.refs.frame;n&&t.iframeResizerEnable&&(0,l.iframeResizer)(t.iframeResizerOptions,n)},a=e,(0,u.default)(i,a)}return(0,a.default)(n,t),(0,i.default)(n,[{key:"componentDidMount",value:function(){this.updateIframe(this.props),this.resizeIframe(this.props)}},{key:"componentWillUnmount",value:function(){var t=this.refs.frame.iFrameResizer;t&&t.removeListeners()}},{key:"componentWillReceiveProps",value:function(t){this.updateIframe(t),this.resizeIframe(t)}},{key:"render",value:function(){var t=this.props,n=t.src,e=t.id,r=t.frameBorder,o=t.className,i=t.style;return c.default.createElement("iframe",{ref:"frame",src:n,id:e,frameBorder:r,className:o,style:i,onLoad:this.onLoad})}}]),n}(c.default.Component);h.propTypes={content:f.default.oneOfType([f.default.string,f.default.element]),src:f.default.string,iframeResizerEnable:f.default.bool,iframeResizerOptions:f.default.object,iframeResizerUrl:f.default.oneOfType([f.default.string,f.default.bool]),id:f.default.string,frameBorder:f.default.number,className:f.default.string,style:f.default.object},h.defaultProps={iframeResizerEnable:!0,iframeResizerOptions:{},iframeResizerUrl:"https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/3.5.8/iframeResizer.contentWindow.min.js",frameBorder:0,style:{width:"100%",minHeight:20}},n.default=h},,,,,,,,,,,,,,,,function(t,n,e){t.exports=e(180)},function(t,n,e){"use strict";e.r(n),function(t){var n=e(162),r=e.n(n),o=e(163),i=e.n(o),u=e(116);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function f(t,n){return!n||"object"!==a(n)&&"function"!=typeof n?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):n}function s(t){return(s=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function l(t,n){return(l=Object.setPrototypeOf||function(t,n){return t.__proto__=n,t})(t,n)}t._babelPolyfill||e(181);var p=window.VPAdminGutenbergVariables,h=wp.i18n.__,d=wp.element,v=d.Component,y=d.Fragment,g=d.RawHTML,m=wp.blocks.registerBlockType,b=wp.components,w=b.Placeholder,x=b.Spinner,S=b.SelectControl,_=wp.apiFetch,O=wp.data,E=O.registerStore,M=O.withSelect,P={apiFetch:function(t){return{type:"API_FETCH",request:t}},setPortfolioLayouts:function(t,n){return{type:"SET_PORTFOLIO_LAYOUTS",query:t,layouts:n}}};E("nk/visual-portfolio",{reducer:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{layouts:{}},n=arguments.length>1?arguments[1]:void 0;switch(n.type){case"SET_PORTFOLIO_LAYOUTS":return!t.layouts[n.query]&&n.layouts&&(t.layouts[n.query]=n.layouts),t}return t},actions:P,selectors:{getPortfolioLayouts:function(t,n){return t.layouts[n]}},controls:{API_FETCH:function(t){var n=t.request;return _(n).catch(function(t){return!(!t||!t.error||"no_layouts_found"!==t.error_code)&&{response:[],error:!1,success:!0}}).then(function(t){return!!(t&&t.success&&t.response)&&t.response})}},resolvers:{getPortfolioLayouts:regeneratorRuntime.mark(function t(n){var e;return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,P.apiFetch({path:n});case 2:return e=t.sent,t.abrupt("return",P.setPortfolioLayouts(n,e));case 4:case"end":return t.stop()}},t)})}});var T=function(t){function n(){return function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}(this,n),f(this,s(n).apply(this,arguments))}var e,o,a;return function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(n&&n.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),n&&l(t,n)}(n,v),e=n,(o=[{key:"shouldComponentUpdate",value:function(t){return this.props.attributes.id!==t.attributes.id||this.props.portfolioLayouts!==t.portfolioLayouts||this.props.className!==t.className}},{key:"render",value:function(){var t=this.props,n=t.portfolioLayouts,e=t.attributes,o=t.setAttributes,a=this.props.className,c=e.id,f=e.ghostkitClassname,s=!1,l=!1;f&&(a=r()(a,f)),n?(s=[{label:h("--- Select layout ---"),value:""}],Object.keys(n).map(function(t){var e=n[t];s.push({label:"#".concat(e.id," - ").concat(e.title),value:e.id}),c&&parseInt(c,10)===e.id&&(l=e.edit_url)})):c&&(s=[{label:"#".concat(c),value:c}]);var d=p.preview_url+(p.preview_url.split("?")[1]?"&":"?")+"vp_preview_frame=true&vp_preview_frame_id=".concat(c);return wp.element.createElement("div",{className:a},wp.element.createElement(w,{className:"visual-portfolio-gutenberg-placeholder",icon:wp.element.createElement(u.a,null),label:h("Visual Portfolio")},!Array.isArray(s)&&wp.element.createElement(x,null),Array.isArray(s)&&s.length&&wp.element.createElement(y,null,l&&wp.element.createElement("a",{href:l,target:"_blank"},h("Edit Layout")),wp.element.createElement(S,{value:c,onChange:function(t){return o({id:t})},options:s})),Array.isArray(s)&&!s.length&&h("No portfolio layouts found.")),c?wp.element.createElement("div",{className:"visual-portfolio-gutenberg-preview"},wp.element.createElement(i.a,{src:d,iframeResizerOptions:{resizedCallback:function(t){t.iframe&&jQuery(t.iframe).css("margin-bottom",-jQuery(t.iframe).height()/2)}}})):"")}}])&&c(e.prototype,o),a&&c(e,a),n}();m("nk/visual-portfolio",{title:"Visual Portfolio",icon:u.a,category:"common",keywords:["visual portfolio","vp","portfolio"],ghostkit:{supports:{spacings:!0,display:!0,scrollReveal:!0}},supports:{anchor:!0,className:!0,html:!1,align:["wide","full"]},attributes:{id:{type:"string"}},edit:M(function(t){return{portfolioLayouts:t("nk/visual-portfolio").getPortfolioLayouts("/visual-portfolio/v1/get_layouts/")}})(T),save:function(t){var n=t.attributes,e=n.id,r=n.className,o="[visual_portfolio";return e&&(o+=' id="'.concat(e,'"')),r&&(o+=' class="'.concat(r,'"')),o+="]",wp.element.createElement(g,null,o)},transforms:{from:[{type:"shortcode",tag:"visual_portfolio",attributes:{id:{type:"string",shortcode:function(t){return t.named.id}},className:{type:"string",shortcode:function(t){return t.named.class}}}}]}})}.call(this,e(77))},function(t,n,e){"use strict";e(182);var r,o=(r=e(354))&&r.__esModule?r:{default:r};o.default._babelPolyfill&&"undefined"!=typeof console&&console.warn&&console.warn("@babel/polyfill is loaded more than once on this page. This is probably not desirable/intended and may have consequences if different versions of the polyfills are applied sequentially. If you do need to load the polyfill more than once, use @babel/polyfill/noConflict instead to bypass the warning."),o.default._babelPolyfill=!0},function(t,n,e){"use strict";e(183),e(326),e(328),e(331),e(333),e(335),e(337),e(339),e(341),e(343),e(345),e(347),e(349),e(353)},function(t,n,e){e(184),e(187),e(188),e(189),e(190),e(191),e(192),e(193),e(194),e(195),e(196),e(197),e(198),e(199),e(200),e(201),e(202),e(203),e(204),e(205),e(206),e(207),e(208),e(209),e(210),e(211),e(212),e(213),e(214),e(215),e(216),e(217),e(218),e(219),e(220),e(221),e(222),e(223),e(224),e(225),e(226),e(227),e(228),e(230),e(231),e(232),e(233),e(234),e(235),e(236),e(237),e(238),e(239),e(240),e(241),e(242),e(243),e(244),e(245),e(246),e(247),e(248),e(249),e(250),e(251),e(252),e(253),e(254),e(255),e(256),e(257),e(258),e(259),e(260),e(261),e(262),e(263),e(265),e(266),e(268),e(269),e(270),e(271),e(272),e(273),e(274),e(276),e(277),e(278),e(279),e(280),e(281),e(282),e(283),e(284),e(285),e(286),e(287),e(288),e(98),e(289),e(137),e(290),e(138),e(291),e(292),e(293),e(294),e(139),e(297),e(298),e(299),e(300),e(301),e(302),e(303),e(304),e(305),e(306),e(307),e(308),e(309),e(310),e(311),e(312),e(313),e(314),e(315),e(316),e(317),e(318),e(319),e(320),e(321),e(322),e(323),e(324),e(325),t.exports=e(7)},function(t,n,e){"use strict";var r=e(1),o=e(13),i=e(9),u=e(0),a=e(11),c=e(29).KEY,f=e(2),s=e(62),l=e(45),p=e(32),h=e(5),d=e(79),v=e(118),y=e(186),g=e(65),m=e(3),b=e(4),w=e(15),x=e(28),S=e(31),_=e(36),O=e(121),E=e(20),M=e(8),P=e(34),T=E.f,F=M.f,I=O.f,j=r.Symbol,A=r.JSON,k=A&&A.stringify,N=h("_hidden"),R=h("toPrimitive"),L={}.propertyIsEnumerable,C=s("symbol-registry"),z=s("symbols"),W=s("op-symbols"),D=Object.prototype,V="function"==typeof j,B=r.QObject,U=!B||!B.prototype||!B.prototype.findChild,G=i&&f(function(){return 7!=_(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a})?function(t,n,e){var r=T(D,n);r&&delete D[n],F(t,n,e),r&&t!==D&&F(D,n,r)}:F,H=function(t){var n=z[t]=_(j.prototype);return n._k=t,n},q=V&&"symbol"==typeof j.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof j},Y=function(t,n,e){return t===D&&Y(W,n,e),m(t),n=x(n,!0),m(e),o(z,n)?(e.enumerable?(o(t,N)&&t[N][n]&&(t[N][n]=!1),e=_(e,{enumerable:S(0,!1)})):(o(t,N)||F(t,N,S(1,{})),t[N][n]=!0),G(t,n,e)):F(t,n,e)},J=function(t,n){m(t);for(var e,r=y(n=w(n)),o=0,i=r.length;i>o;)Y(t,e=r[o++],n[e]);return t},K=function(t){var n=L.call(this,t=x(t,!0));return!(this===D&&o(z,t)&&!o(W,t))&&(!(n||!o(this,t)||!o(z,t)||o(this,N)&&this[N][t])||n)},X=function(t,n){if(t=w(t),n=x(n,!0),t!==D||!o(z,n)||o(W,n)){var e=T(t,n);return!e||!o(z,n)||o(t,N)&&t[N][n]||(e.enumerable=!0),e}},$=function(t){for(var n,e=I(w(t)),r=[],i=0;e.length>i;)o(z,n=e[i++])||n==N||n==c||r.push(n);return r},Q=function(t){for(var n,e=t===D,r=I(e?W:w(t)),i=[],u=0;r.length>u;)!o(z,n=r[u++])||e&&!o(D,n)||i.push(z[n]);return i};V||(a((j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),n=function(e){this===D&&n.call(W,e),o(this,N)&&o(this[N],t)&&(this[N][t]=!1),G(this,t,S(1,e))};return i&&U&&G(D,t,{configurable:!0,set:n}),H(t)}).prototype,"toString",function(){return this._k}),E.f=X,M.f=Y,e(37).f=O.f=$,e(56).f=K,e(64).f=Q,i&&!e(33)&&a(D,"propertyIsEnumerable",K,!0),d.f=function(t){return H(h(t))}),u(u.G+u.W+u.F*!V,{Symbol:j});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Z.length>tt;)h(Z[tt++]);for(var nt=P(h.store),et=0;nt.length>et;)v(nt[et++]);u(u.S+u.F*!V,"Symbol",{for:function(t){return o(C,t+="")?C[t]:C[t]=j(t)},keyFor:function(t){if(!q(t))throw TypeError(t+" is not a symbol!");for(var n in C)if(C[n]===t)return n},useSetter:function(){U=!0},useSimple:function(){U=!1}}),u(u.S+u.F*!V,"Object",{create:function(t,n){return void 0===n?_(t):J(_(t),n)},defineProperty:Y,defineProperties:J,getOwnPropertyDescriptor:X,getOwnPropertyNames:$,getOwnPropertySymbols:Q}),A&&u(u.S+u.F*(!V||f(function(){var t=j();return"[null]"!=k([t])||"{}"!=k({a:t})||"{}"!=k(Object(t))})),"JSON",{stringify:function(t){for(var n,e,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(e=n=r[1],(b(n)||void 0!==t)&&!q(t))return g(n)||(n=function(t,n){if("function"==typeof e&&(n=e.call(this,t,n)),!q(n))return n}),r[1]=n,k.apply(A,r)}}),j.prototype[R]||e(14)(j.prototype,R,j.prototype.valueOf),l(j,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(t,n,e){t.exports=e(62)("native-function-to-string",Function.toString)},function(t,n,e){var r=e(34),o=e(64),i=e(56);t.exports=function(t){var n=r(t),e=o.f;if(e)for(var u,a=e(t),c=i.f,f=0;a.length>f;)c.call(t,u=a[f++])&&n.push(u);return n}},function(t,n,e){var r=e(0);r(r.S,"Object",{create:e(36)})},function(t,n,e){var r=e(0);r(r.S+r.F*!e(9),"Object",{defineProperty:e(8).f})},function(t,n,e){var r=e(0);r(r.S+r.F*!e(9),"Object",{defineProperties:e(120)})},function(t,n,e){var r=e(15),o=e(20).f;e(21)("getOwnPropertyDescriptor",function(){return function(t,n){return o(r(t),n)}})},function(t,n,e){var r=e(10),o=e(38);e(21)("getPrototypeOf",function(){return function(t){return o(r(t))}})},function(t,n,e){var r=e(10),o=e(34);e(21)("keys",function(){return function(t){return o(r(t))}})},function(t,n,e){e(21)("getOwnPropertyNames",function(){return e(121).f})},function(t,n,e){var r=e(4),o=e(29).onFreeze;e(21)("freeze",function(t){return function(n){return t&&r(n)?t(o(n)):n}})},function(t,n,e){var r=e(4),o=e(29).onFreeze;e(21)("seal",function(t){return function(n){return t&&r(n)?t(o(n)):n}})},function(t,n,e){var r=e(4),o=e(29).onFreeze;e(21)("preventExtensions",function(t){return function(n){return t&&r(n)?t(o(n)):n}})},function(t,n,e){var r=e(4);e(21)("isFrozen",function(t){return function(n){return!r(n)||!!t&&t(n)}})},function(t,n,e){var r=e(4);e(21)("isSealed",function(t){return function(n){return!r(n)||!!t&&t(n)}})},function(t,n,e){var r=e(4);e(21)("isExtensible",function(t){return function(n){return!!r(n)&&(!t||t(n))}})},function(t,n,e){var r=e(0);r(r.S+r.F,"Object",{assign:e(122)})},function(t,n,e){var r=e(0);r(r.S,"Object",{is:e(123)})},function(t,n,e){var r=e(0);r(r.S,"Object",{setPrototypeOf:e(83).set})},function(t,n,e){"use strict";var r=e(57),o={};o[e(5)("toStringTag")]="z",o+""!="[object z]"&&e(11)(Object.prototype,"toString",function(){return"[object "+r(this)+"]"},!0)},function(t,n,e){var r=e(0);r(r.P,"Function",{bind:e(124)})},function(t,n,e){var r=e(8).f,o=Function.prototype,i=/^\s*function ([^ (]*)/;"name"in o||e(9)&&r(o,"name",{configurable:!0,get:function(){try{return(""+this).match(i)[1]}catch(t){return""}}})},function(t,n,e){"use strict";var r=e(4),o=e(38),i=e(5)("hasInstance"),u=Function.prototype;i in u||e(8).f(u,i,{value:function(t){if("function"!=typeof this||!r(t))return!1;if(!r(this.prototype))return t instanceof this;for(;t=o(t);)if(this.prototype===t)return!0;return!1}})},function(t,n,e){var r=e(0),o=e(126);r(r.G+r.F*(parseInt!=o),{parseInt:o})},function(t,n,e){var r=e(0),o=e(127);r(r.G+r.F*(parseFloat!=o),{parseFloat:o})},function(t,n,e){"use strict";var r=e(1),o=e(13),i=e(24),u=e(85),a=e(28),c=e(2),f=e(37).f,s=e(20).f,l=e(8).f,p=e(46).trim,h=r.Number,d=h,v=h.prototype,y="Number"==i(e(36)(v)),g="trim"in String.prototype,m=function(t){var n=a(t,!1);if("string"==typeof n&&n.length>2){var e,r,o,i=(n=g?n.trim():p(n,3)).charCodeAt(0);if(43===i||45===i){if(88===(e=n.charCodeAt(2))||120===e)return NaN}else if(48===i){switch(n.charCodeAt(1)){case 66:case 98:r=2,o=49;break;case 79:case 111:r=8,o=55;break;default:return+n}for(var u,c=n.slice(2),f=0,s=c.length;f<s;f++)if((u=c.charCodeAt(f))<48||u>o)return NaN;return parseInt(c,r)}}return+n};if(!h(" 0o1")||!h("0b1")||h("+0x1")){h=function(t){var n=arguments.length<1?0:t,e=this;return e instanceof h&&(y?c(function(){v.valueOf.call(e)}):"Number"!=i(e))?u(new d(m(n)),e,h):m(n)};for(var b,w=e(9)?f(d):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger".split(","),x=0;w.length>x;x++)o(d,b=w[x])&&!o(h,b)&&l(h,b,s(d,b));h.prototype=v,v.constructor=h,e(11)(r,"Number",h)}},function(t,n,e){"use strict";var r=e(0),o=e(19),i=e(128),u=e(86),a=1..toFixed,c=Math.floor,f=[0,0,0,0,0,0],s="Number.toFixed: incorrect invocation!",l=function(t,n){for(var e=-1,r=n;++e<6;)r+=t*f[e],f[e]=r%1e7,r=c(r/1e7)},p=function(t){for(var n=6,e=0;--n>=0;)e+=f[n],f[n]=c(e/t),e=e%t*1e7},h=function(){for(var t=6,n="";--t>=0;)if(""!==n||0===t||0!==f[t]){var e=String(f[t]);n=""===n?e:n+u.call("0",7-e.length)+e}return n},d=function(t,n,e){return 0===n?e:n%2==1?d(t,n-1,e*t):d(t*t,n/2,e)};r(r.P+r.F*(!!a&&("0.000"!==8e-5.toFixed(3)||"1"!==.9.toFixed(0)||"1.25"!==1.255.toFixed(2)||"1000000000000000128"!==(0xde0b6b3a7640080).toFixed(0))||!e(2)(function(){a.call({})})),"Number",{toFixed:function(t){var n,e,r,a,c=i(this,s),f=o(t),v="",y="0";if(f<0||f>20)throw RangeError(s);if(c!=c)return"NaN";if(c<=-1e21||c>=1e21)return String(c);if(c<0&&(v="-",c=-c),c>1e-21)if(e=(n=function(t){for(var n=0,e=t;e>=4096;)n+=12,e/=4096;for(;e>=2;)n+=1,e/=2;return n}(c*d(2,69,1))-69)<0?c*d(2,-n,1):c/d(2,n,1),e*=4503599627370496,(n=52-n)>0){for(l(0,e),r=f;r>=7;)l(1e7,0),r-=7;for(l(d(10,r,1),0),r=n-1;r>=23;)p(1<<23),r-=23;p(1<<r),l(1,1),p(2),y=h()}else l(0,e),l(1<<-n,0),y=h()+u.call("0",f);return y=f>0?v+((a=y.length)<=f?"0."+u.call("0",f-a)+y:y.slice(0,a-f)+"."+y.slice(a-f)):v+y}})},function(t,n,e){"use strict";var r=e(0),o=e(2),i=e(128),u=1..toPrecision;r(r.P+r.F*(o(function(){return"1"!==u.call(1,void 0)})||!o(function(){u.call({})})),"Number",{toPrecision:function(t){var n=i(this,"Number#toPrecision: incorrect invocation!");return void 0===t?u.call(n):u.call(n,t)}})},function(t,n,e){var r=e(0);r(r.S,"Number",{EPSILON:Math.pow(2,-52)})},function(t,n,e){var r=e(0),o=e(1).isFinite;r(r.S,"Number",{isFinite:function(t){return"number"==typeof t&&o(t)}})},function(t,n,e){var r=e(0);r(r.S,"Number",{isInteger:e(129)})},function(t,n,e){var r=e(0);r(r.S,"Number",{isNaN:function(t){return t!=t}})},function(t,n,e){var r=e(0),o=e(129),i=Math.abs;r(r.S,"Number",{isSafeInteger:function(t){return o(t)&&i(t)<=9007199254740991}})},function(t,n,e){var r=e(0);r(r.S,"Number",{MAX_SAFE_INTEGER:9007199254740991})},function(t,n,e){var r=e(0);r(r.S,"Number",{MIN_SAFE_INTEGER:-9007199254740991})},function(t,n,e){var r=e(0),o=e(127);r(r.S+r.F*(Number.parseFloat!=o),"Number",{parseFloat:o})},function(t,n,e){var r=e(0),o=e(126);r(r.S+r.F*(Number.parseInt!=o),"Number",{parseInt:o})},function(t,n,e){var r=e(0),o=e(130),i=Math.sqrt,u=Math.acosh;r(r.S+r.F*!(u&&710==Math.floor(u(Number.MAX_VALUE))&&u(1/0)==1/0),"Math",{acosh:function(t){return(t=+t)<1?NaN:t>94906265.62425156?Math.log(t)+Math.LN2:o(t-1+i(t-1)*i(t+1))}})},function(t,n,e){var r=e(0),o=Math.asinh;r(r.S+r.F*!(o&&1/o(0)>0),"Math",{asinh:function t(n){return isFinite(n=+n)&&0!=n?n<0?-t(-n):Math.log(n+Math.sqrt(n*n+1)):n}})},function(t,n,e){var r=e(0),o=Math.atanh;r(r.S+r.F*!(o&&1/o(-0)<0),"Math",{atanh:function(t){return 0==(t=+t)?t:Math.log((1+t)/(1-t))/2}})},function(t,n,e){var r=e(0),o=e(87);r(r.S,"Math",{cbrt:function(t){return o(t=+t)*Math.pow(Math.abs(t),1/3)}})},function(t,n,e){var r=e(0);r(r.S,"Math",{clz32:function(t){return(t>>>=0)?31-Math.floor(Math.log(t+.5)*Math.LOG2E):32}})},function(t,n,e){var r=e(0),o=Math.exp;r(r.S,"Math",{cosh:function(t){return(o(t=+t)+o(-t))/2}})},function(t,n,e){var r=e(0),o=e(88);r(r.S+r.F*(o!=Math.expm1),"Math",{expm1:o})},function(t,n,e){var r=e(0);r(r.S,"Math",{fround:e(229)})},function(t,n,e){var r=e(87),o=Math.pow,i=o(2,-52),u=o(2,-23),a=o(2,127)*(2-u),c=o(2,-126);t.exports=Math.fround||function(t){var n,e,o=Math.abs(t),f=r(t);return o<c?f*(o/c/u+1/i-1/i)*c*u:(e=(n=(1+u/i)*o)-(n-o))>a||e!=e?f*(1/0):f*e}},function(t,n,e){var r=e(0),o=Math.abs;r(r.S,"Math",{hypot:function(t,n){for(var e,r,i=0,u=0,a=arguments.length,c=0;u<a;)c<(e=o(arguments[u++]))?(i=i*(r=c/e)*r+1,c=e):i+=e>0?(r=e/c)*r:e;return c===1/0?1/0:c*Math.sqrt(i)}})},function(t,n,e){var r=e(0),o=Math.imul;r(r.S+r.F*e(2)(function(){return-5!=o(4294967295,5)||2!=o.length}),"Math",{imul:function(t,n){var e=+t,r=+n,o=65535&e,i=65535&r;return 0|o*i+((65535&e>>>16)*i+o*(65535&r>>>16)<<16>>>0)}})},function(t,n,e){var r=e(0);r(r.S,"Math",{log10:function(t){return Math.log(t)*Math.LOG10E}})},function(t,n,e){var r=e(0);r(r.S,"Math",{log1p:e(130)})},function(t,n,e){var r=e(0);r(r.S,"Math",{log2:function(t){return Math.log(t)/Math.LN2}})},function(t,n,e){var r=e(0);r(r.S,"Math",{sign:e(87)})},function(t,n,e){var r=e(0),o=e(88),i=Math.exp;r(r.S+r.F*e(2)(function(){return-2e-17!=!Math.sinh(-2e-17)}),"Math",{sinh:function(t){return Math.abs(t=+t)<1?(o(t)-o(-t))/2:(i(t-1)-i(-t-1))*(Math.E/2)}})},function(t,n,e){var r=e(0),o=e(88),i=Math.exp;r(r.S,"Math",{tanh:function(t){var n=o(t=+t),e=o(-t);return n==1/0?1:e==1/0?-1:(n-e)/(i(t)+i(-t))}})},function(t,n,e){var r=e(0);r(r.S,"Math",{trunc:function(t){return(t>0?Math.floor:Math.ceil)(t)}})},function(t,n,e){var r=e(0),o=e(35),i=String.fromCharCode,u=String.fromCodePoint;r(r.S+r.F*(!!u&&1!=u.length),"String",{fromCodePoint:function(t){for(var n,e=[],r=arguments.length,u=0;r>u;){if(n=+arguments[u++],o(n,1114111)!==n)throw RangeError(n+" is not a valid code point");e.push(n<65536?i(n):i(55296+((n-=65536)>>10),n%1024+56320))}return e.join("")}})},function(t,n,e){var r=e(0),o=e(15),i=e(6);r(r.S,"String",{raw:function(t){for(var n=o(t.raw),e=i(n.length),r=arguments.length,u=[],a=0;e>a;)u.push(String(n[a++])),a<r&&u.push(String(arguments[a]));return u.join("")}})},function(t,n,e){"use strict";e(46)("trim",function(t){return function(){return t(this,3)}})},function(t,n,e){"use strict";var r=e(89)(!0);e(90)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,e=this._i;return e>=n.length?{value:void 0,done:!0}:(t=r(n,e),this._i+=t.length,{value:t,done:!1})})},function(t,n,e){"use strict";var r=e(0),o=e(89)(!1);r(r.P,"String",{codePointAt:function(t){return o(this,t)}})},function(t,n,e){"use strict";var r=e(0),o=e(6),i=e(91),u="".endsWith;r(r.P+r.F*e(93)("endsWith"),"String",{endsWith:function(t){var n=i(this,t,"endsWith"),e=arguments.length>1?arguments[1]:void 0,r=o(n.length),a=void 0===e?r:Math.min(o(e),r),c=String(t);return u?u.call(n,c,a):n.slice(a-c.length,a)===c}})},function(t,n,e){"use strict";var r=e(0),o=e(91);r(r.P+r.F*e(93)("includes"),"String",{includes:function(t){return!!~o(this,t,"includes").indexOf(t,arguments.length>1?arguments[1]:void 0)}})},function(t,n,e){var r=e(0);r(r.P,"String",{repeat:e(86)})},function(t,n,e){"use strict";var r=e(0),o=e(6),i=e(91),u="".startsWith;r(r.P+r.F*e(93)("startsWith"),"String",{startsWith:function(t){var n=i(this,t,"startsWith"),e=o(Math.min(arguments.length>1?arguments[1]:void 0,n.length)),r=String(t);return u?u.call(n,r,e):n.slice(e,e+r.length)===r}})},function(t,n,e){"use strict";e(12)("anchor",function(t){return function(n){return t(this,"a","name",n)}})},function(t,n,e){"use strict";e(12)("big",function(t){return function(){return t(this,"big","","")}})},function(t,n,e){"use strict";e(12)("blink",function(t){return function(){return t(this,"blink","","")}})},function(t,n,e){"use strict";e(12)("bold",function(t){return function(){return t(this,"b","","")}})},function(t,n,e){"use strict";e(12)("fixed",function(t){return function(){return t(this,"tt","","")}})},function(t,n,e){"use strict";e(12)("fontcolor",function(t){return function(n){return t(this,"font","color",n)}})},function(t,n,e){"use strict";e(12)("fontsize",function(t){return function(n){return t(this,"font","size",n)}})},function(t,n,e){"use strict";e(12)("italics",function(t){return function(){return t(this,"i","","")}})},function(t,n,e){"use strict";e(12)("link",function(t){return function(n){return t(this,"a","href",n)}})},function(t,n,e){"use strict";e(12)("small",function(t){return function(){return t(this,"small","","")}})},function(t,n,e){"use strict";e(12)("strike",function(t){return function(){return t(this,"strike","","")}})},function(t,n,e){"use strict";e(12)("sub",function(t){return function(){return t(this,"sub","","")}})},function(t,n,e){"use strict";e(12)("sup",function(t){return function(){return t(this,"sup","","")}})},function(t,n,e){var r=e(0);r(r.S,"Date",{now:function(){return(new Date).getTime()}})},function(t,n,e){"use strict";var r=e(0),o=e(10),i=e(28);r(r.P+r.F*e(2)(function(){return null!==new Date(NaN).toJSON()||1!==Date.prototype.toJSON.call({toISOString:function(){return 1}})}),"Date",{toJSON:function(t){var n=o(this),e=i(n);return"number"!=typeof e||isFinite(e)?n.toISOString():null}})},function(t,n,e){var r=e(0),o=e(264);r(r.P+r.F*(Date.prototype.toISOString!==o),"Date",{toISOString:o})},function(t,n,e){"use strict";var r=e(2),o=Date.prototype.getTime,i=Date.prototype.toISOString,u=function(t){return t>9?t:"0"+t};t.exports=r(function(){return"0385-07-25T07:06:39.999Z"!=i.call(new Date(-5e13-1))})||!r(function(){i.call(new Date(NaN))})?function(){if(!isFinite(o.call(this)))throw RangeError("Invalid time value");var t=this,n=t.getUTCFullYear(),e=t.getUTCMilliseconds(),r=n<0?"-":n>9999?"+":"";return r+("00000"+Math.abs(n)).slice(r?-6:-4)+"-"+u(t.getUTCMonth()+1)+"-"+u(t.getUTCDate())+"T"+u(t.getUTCHours())+":"+u(t.getUTCMinutes())+":"+u(t.getUTCSeconds())+"."+(e>99?e:"0"+u(e))+"Z"}:i},function(t,n,e){var r=Date.prototype,o=r.toString,i=r.getTime;new Date(NaN)+""!="Invalid Date"&&e(11)(r,"toString",function(){var t=i.call(this);return t==t?o.call(this):"Invalid Date"})},function(t,n,e){var r=e(5)("toPrimitive"),o=Date.prototype;r in o||e(14)(o,r,e(267))},function(t,n,e){"use strict";var r=e(3),o=e(28);t.exports=function(t){if("string"!==t&&"number"!==t&&"default"!==t)throw TypeError("Incorrect hint");return o(r(this),"number"!=t)}},function(t,n,e){var r=e(0);r(r.S,"Array",{isArray:e(65)})},function(t,n,e){"use strict";var r=e(17),o=e(0),i=e(10),u=e(132),a=e(94),c=e(6),f=e(95),s=e(96);o(o.S+o.F*!e(66)(function(t){Array.from(t)}),"Array",{from:function(t){var n,e,o,l,p=i(t),h="function"==typeof this?this:Array,d=arguments.length,v=d>1?arguments[1]:void 0,y=void 0!==v,g=0,m=s(p);if(y&&(v=r(v,d>2?arguments[2]:void 0,2)),null==m||h==Array&&a(m))for(e=new h(n=c(p.length));n>g;g++)f(e,g,y?v(p[g],g):p[g]);else for(l=m.call(p),e=new h;!(o=l.next()).done;g++)f(e,g,y?u(l,v,[o.value,g],!0):o.value);return e.length=g,e}})},function(t,n,e){"use strict";var r=e(0),o=e(95);r(r.S+r.F*e(2)(function(){function t(){}return!(Array.of.call(t)instanceof t)}),"Array",{of:function(){for(var t=0,n=arguments.length,e=new("function"==typeof this?this:Array)(n);n>t;)o(e,t,arguments[t++]);return e.length=n,e}})},function(t,n,e){"use strict";var r=e(0),o=e(15),i=[].join;r(r.P+r.F*(e(55)!=Object||!e(16)(i)),"Array",{join:function(t){return i.call(o(this),void 0===t?",":t)}})},function(t,n,e){"use strict";var r=e(0),o=e(82),i=e(24),u=e(35),a=e(6),c=[].slice;r(r.P+r.F*e(2)(function(){o&&c.call(o)}),"Array",{slice:function(t,n){var e=a(this.length),r=i(this);if(n=void 0===n?e:n,"Array"==r)return c.call(this,t,n);for(var o=u(t,e),f=u(n,e),s=a(f-o),l=new Array(s),p=0;p<s;p++)l[p]="String"==r?this.charAt(o+p):this[o+p];return l}})},function(t,n,e){"use strict";var r=e(0),o=e(18),i=e(10),u=e(2),a=[].sort,c=[1,2,3];r(r.P+r.F*(u(function(){c.sort(void 0)})||!u(function(){c.sort(null)})||!e(16)(a)),"Array",{sort:function(t){return void 0===t?a.call(i(this)):a.call(i(this),o(t))}})},function(t,n,e){"use strict";var r=e(0),o=e(22)(0),i=e(16)([].forEach,!0);r(r.P+r.F*!i,"Array",{forEach:function(t){return o(this,t,arguments[1])}})},function(t,n,e){var r=e(4),o=e(65),i=e(5)("species");t.exports=function(t){var n;return o(t)&&("function"!=typeof(n=t.constructor)||n!==Array&&!o(n.prototype)||(n=void 0),r(n)&&null===(n=n[i])&&(n=void 0)),void 0===n?Array:n}},function(t,n,e){"use strict";var r=e(0),o=e(22)(1);r(r.P+r.F*!e(16)([].map,!0),"Array",{map:function(t){return o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(22)(2);r(r.P+r.F*!e(16)([].filter,!0),"Array",{filter:function(t){return o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(22)(3);r(r.P+r.F*!e(16)([].some,!0),"Array",{some:function(t){return o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(22)(4);r(r.P+r.F*!e(16)([].every,!0),"Array",{every:function(t){return o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(134);r(r.P+r.F*!e(16)([].reduce,!0),"Array",{reduce:function(t){return o(this,t,arguments.length,arguments[1],!1)}})},function(t,n,e){"use strict";var r=e(0),o=e(134);r(r.P+r.F*!e(16)([].reduceRight,!0),"Array",{reduceRight:function(t){return o(this,t,arguments.length,arguments[1],!0)}})},function(t,n,e){"use strict";var r=e(0),o=e(63)(!1),i=[].indexOf,u=!!i&&1/[1].indexOf(1,-0)<0;r(r.P+r.F*(u||!e(16)(i)),"Array",{indexOf:function(t){return u?i.apply(this,arguments)||0:o(this,t,arguments[1])}})},function(t,n,e){"use strict";var r=e(0),o=e(15),i=e(19),u=e(6),a=[].lastIndexOf,c=!!a&&1/[1].lastIndexOf(1,-0)<0;r(r.P+r.F*(c||!e(16)(a)),"Array",{lastIndexOf:function(t){if(c)return a.apply(this,arguments)||0;var n=o(this),e=u(n.length),r=e-1;for(arguments.length>1&&(r=Math.min(r,i(arguments[1]))),r<0&&(r=e+r);r>=0;r--)if(r in n&&n[r]===t)return r||0;return-1}})},function(t,n,e){var r=e(0);r(r.P,"Array",{copyWithin:e(135)}),e(39)("copyWithin")},function(t,n,e){var r=e(0);r(r.P,"Array",{fill:e(97)}),e(39)("fill")},function(t,n,e){"use strict";var r=e(0),o=e(22)(5),i=!0;"find"in[]&&Array(1).find(function(){i=!1}),r(r.P+r.F*i,"Array",{find:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),e(39)("find")},function(t,n,e){"use strict";var r=e(0),o=e(22)(6),i="findIndex",u=!0;i in[]&&Array(1)[i](function(){u=!1}),r(r.P+r.F*u,"Array",{findIndex:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),e(39)(i)},function(t,n,e){e(48)("Array")},function(t,n,e){var r=e(1),o=e(85),i=e(8).f,u=e(37).f,a=e(92),c=e(67),f=r.RegExp,s=f,l=f.prototype,p=/a/g,h=/a/g,d=new f(p)!==p;if(e(9)&&(!d||e(2)(function(){return h[e(5)("match")]=!1,f(p)!=p||f(h)==h||"/a/i"!=f(p,"i")}))){f=function(t,n){var e=this instanceof f,r=a(t),i=void 0===n;return!e&&r&&t.constructor===f&&i?t:o(d?new s(r&&!i?t.source:t,n):s((r=t instanceof f)?t.source:t,r&&i?c.call(t):n),e?this:l,f)};for(var v=function(t){t in f||i(f,t,{configurable:!0,get:function(){return s[t]},set:function(n){s[t]=n}})},y=u(s),g=0;y.length>g;)v(y[g++]);l.constructor=f,f.prototype=l,e(11)(r,"RegExp",f)}e(48)("RegExp")},function(t,n,e){"use strict";e(138);var r=e(3),o=e(67),i=e(9),u=/./.toString,a=function(t){e(11)(RegExp.prototype,"toString",t,!0)};e(2)(function(){return"/a/b"!=u.call({source:"a",flags:"b"})})?a(function(){var t=r(this);return"/".concat(t.source,"/","flags"in t?t.flags:!i&&t instanceof RegExp?o.call(t):void 0)}):"toString"!=u.name&&a(function(){return u.call(this)})},function(t,n,e){"use strict";var r=e(3),o=e(6),i=e(100),u=e(68);e(69)("match",1,function(t,n,e,a){return[function(e){var r=t(this),o=null==e?void 0:e[n];return void 0!==o?o.call(e,r):new RegExp(e)[n](String(r))},function(t){var n=a(e,t,this);if(n.done)return n.value;var c=r(t),f=String(this);if(!c.global)return u(c,f);var s=c.unicode;c.lastIndex=0;for(var l,p=[],h=0;null!==(l=u(c,f));){var d=String(l[0]);p[h]=d,""===d&&(c.lastIndex=i(f,o(c.lastIndex),s)),h++}return 0===h?null:p}]})},function(t,n,e){"use strict";var r=e(3),o=e(10),i=e(6),u=e(19),a=e(100),c=e(68),f=Math.max,s=Math.min,l=Math.floor,p=/\$([$&`']|\d\d?|<[^>]*>)/g,h=/\$([$&`']|\d\d?)/g;e(69)("replace",2,function(t,n,e,d){return[function(r,o){var i=t(this),u=null==r?void 0:r[n];return void 0!==u?u.call(r,i,o):e.call(String(i),r,o)},function(t,n){var o=d(e,t,this,n);if(o.done)return o.value;var l=r(t),p=String(this),h="function"==typeof n;h||(n=String(n));var y=l.global;if(y){var g=l.unicode;l.lastIndex=0}for(var m=[];;){var b=c(l,p);if(null===b)break;if(m.push(b),!y)break;""===String(b[0])&&(l.lastIndex=a(p,i(l.lastIndex),g))}for(var w,x="",S=0,_=0;_<m.length;_++){b=m[_];for(var O=String(b[0]),E=f(s(u(b.index),p.length),0),M=[],P=1;P<b.length;P++)M.push(void 0===(w=b[P])?w:String(w));var T=b.groups;if(h){var F=[O].concat(M,E,p);void 0!==T&&F.push(T);var I=String(n.apply(void 0,F))}else I=v(O,p,E,M,T,n);E>=S&&(x+=p.slice(S,E)+I,S=E+O.length)}return x+p.slice(S)}];function v(t,n,r,i,u,a){var c=r+t.length,f=i.length,s=h;return void 0!==u&&(u=o(u),s=p),e.call(a,s,function(e,o){var a;switch(o.charAt(0)){case"$":return"$";case"&":return t;case"`":return n.slice(0,r);case"'":return n.slice(c);case"<":a=u[o.slice(1,-1)];break;default:var s=+o;if(0===s)return e;if(s>f){var p=l(s/10);return 0===p?e:p<=f?void 0===i[p-1]?o.charAt(1):i[p-1]+o.charAt(1):e}a=i[s-1]}return void 0===a?"":a})}})},function(t,n,e){"use strict";var r=e(3),o=e(123),i=e(68);e(69)("search",1,function(t,n,e,u){return[function(e){var r=t(this),o=null==e?void 0:e[n];return void 0!==o?o.call(e,r):new RegExp(e)[n](String(r))},function(t){var n=u(e,t,this);if(n.done)return n.value;var a=r(t),c=String(this),f=a.lastIndex;o(f,0)||(a.lastIndex=0);var s=i(a,c);return o(a.lastIndex,f)||(a.lastIndex=f),null===s?-1:s.index}]})},function(t,n,e){"use strict";var r=e(92),o=e(3),i=e(58),u=e(100),a=e(6),c=e(68),f=e(99),s=e(2),l=Math.min,p=[].push,h=!s(function(){RegExp(4294967295,"y")});e(69)("split",2,function(t,n,e,s){var d;return d="c"=="abbc".split(/(b)*/)[1]||4!="test".split(/(?:)/,-1).length||2!="ab".split(/(?:ab)*/).length||4!=".".split(/(.?)(.?)/).length||".".split(/()()/).length>1||"".split(/.?/).length?function(t,n){var o=String(this);if(void 0===t&&0===n)return[];if(!r(t))return e.call(o,t,n);for(var i,u,a,c=[],s=(t.ignoreCase?"i":"")+(t.multiline?"m":"")+(t.unicode?"u":"")+(t.sticky?"y":""),l=0,h=void 0===n?4294967295:n>>>0,d=new RegExp(t.source,s+"g");(i=f.call(d,o))&&!((u=d.lastIndex)>l&&(c.push(o.slice(l,i.index)),i.length>1&&i.index<o.length&&p.apply(c,i.slice(1)),a=i[0].length,l=u,c.length>=h));)d.lastIndex===i.index&&d.lastIndex++;return l===o.length?!a&&d.test("")||c.push(""):c.push(o.slice(l)),c.length>h?c.slice(0,h):c}:"0".split(void 0,0).length?function(t,n){return void 0===t&&0===n?[]:e.call(this,t,n)}:e,[function(e,r){var o=t(this),i=null==e?void 0:e[n];return void 0!==i?i.call(e,o,r):d.call(String(o),e,r)},function(t,n){var r=s(d,t,this,n,d!==e);if(r.done)return r.value;var f=o(t),p=String(this),v=i(f,RegExp),y=f.unicode,g=(f.ignoreCase?"i":"")+(f.multiline?"m":"")+(f.unicode?"u":"")+(h?"y":"g"),m=new v(h?f:"^(?:"+f.source+")",g),b=void 0===n?4294967295:n>>>0;if(0===b)return[];if(0===p.length)return null===c(m,p)?[p]:[];for(var w=0,x=0,S=[];x<p.length;){m.lastIndex=h?x:0;var _,O=c(m,h?p:p.slice(x));if(null===O||(_=l(a(m.lastIndex+(h?0:x)),p.length))===w)x=u(p,x,y);else{if(S.push(p.slice(w,x)),S.length===b)return S;for(var E=1;E<=O.length-1;E++)if(S.push(O[E]),S.length===b)return S;x=w=_}}return S.push(p.slice(w)),S}]})},function(t,n,e){var r=e(1),o=e(101).set,i=r.MutationObserver||r.WebKitMutationObserver,u=r.process,a=r.Promise,c="process"==e(24)(u);t.exports=function(){var t,n,e,f=function(){var r,o;for(c&&(r=u.domain)&&r.exit();t;){o=t.fn,t=t.next;try{o()}catch(r){throw t?e():n=void 0,r}}n=void 0,r&&r.enter()};if(c)e=function(){u.nextTick(f)};else if(!i||r.navigator&&r.navigator.standalone)if(a&&a.resolve){var s=a.resolve(void 0);e=function(){s.then(f)}}else e=function(){o.call(r,f)};else{var l=!0,p=document.createTextNode("");new i(f).observe(p,{characterData:!0}),e=function(){p.data=l=!l}}return function(r){var o={fn:r,next:void 0};n&&(n.next=o),t||(t=o,e()),n=o}}},function(t,n){t.exports=function(t){try{return{e:!1,v:t()}}catch(t){return{e:!0,v:t}}}},function(t,n,e){"use strict";var r=e(142),o=e(40);t.exports=e(72)("Map",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{get:function(t){var n=r.getEntry(o(this,"Map"),t);return n&&n.v},set:function(t,n){return r.def(o(this,"Map"),0===t?0:t,n)}},r,!0)},function(t,n,e){"use strict";var r=e(142),o=e(40);t.exports=e(72)("Set",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"Set"),t=0===t?0:t,t)}},r)},function(t,n,e){"use strict";var r,o=e(1),i=e(22)(0),u=e(11),a=e(29),c=e(122),f=e(143),s=e(4),l=e(40),p=e(40),h=!o.ActiveXObject&&"ActiveXObject"in o,d=a.getWeak,v=Object.isExtensible,y=f.ufstore,g=function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},m={get:function(t){if(s(t)){var n=d(t);return!0===n?y(l(this,"WeakMap")).get(t):n?n[this._i]:void 0}},set:function(t,n){return f.def(l(this,"WeakMap"),t,n)}},b=t.exports=e(72)("WeakMap",g,m,f,!0,!0);p&&h&&(c((r=f.getConstructor(g,"WeakMap")).prototype,m),a.NEED=!0,i(["delete","has","get","set"],function(t){var n=b.prototype,e=n[t];u(n,t,function(n,o){if(s(n)&&!v(n)){this._f||(this._f=new r);var i=this._f[t](n,o);return"set"==t?this:i}return e.call(this,n,o)})}))},function(t,n,e){"use strict";var r=e(143),o=e(40);e(72)("WeakSet",function(t){return function(){return t(this,arguments.length>0?arguments[0]:void 0)}},{add:function(t){return r.def(o(this,"WeakSet"),t,!0)}},r,!1,!0)},function(t,n,e){"use strict";var r=e(0),o=e(73),i=e(102),u=e(3),a=e(35),c=e(6),f=e(4),s=e(1).ArrayBuffer,l=e(58),p=i.ArrayBuffer,h=i.DataView,d=o.ABV&&s.isView,v=p.prototype.slice,y=o.VIEW;r(r.G+r.W+r.F*(s!==p),{ArrayBuffer:p}),r(r.S+r.F*!o.CONSTR,"ArrayBuffer",{isView:function(t){return d&&d(t)||f(t)&&y in t}}),r(r.P+r.U+r.F*e(2)(function(){return!new p(2).slice(1,void 0).byteLength}),"ArrayBuffer",{slice:function(t,n){if(void 0!==v&&void 0===n)return v.call(u(this),t);for(var e=u(this).byteLength,r=a(t,e),o=a(void 0===n?e:n,e),i=new(l(this,p))(c(o-r)),f=new h(this),s=new h(i),d=0;r<o;)s.setUint8(d++,f.getUint8(r++));return i}}),e(48)("ArrayBuffer")},function(t,n,e){var r=e(0);r(r.G+r.W+r.F*!e(73).ABV,{DataView:e(102).DataView})},function(t,n,e){e(26)("Int8",1,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(26)("Uint8",1,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(26)("Uint8",1,function(t){return function(n,e,r){return t(this,n,e,r)}},!0)},function(t,n,e){e(26)("Int16",2,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(26)("Uint16",2,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(26)("Int32",4,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(26)("Uint32",4,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(26)("Float32",4,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){e(26)("Float64",8,function(t){return function(n,e,r){return t(this,n,e,r)}})},function(t,n,e){var r=e(0),o=e(18),i=e(3),u=(e(1).Reflect||{}).apply,a=Function.apply;r(r.S+r.F*!e(2)(function(){u(function(){})}),"Reflect",{apply:function(t,n,e){var r=o(t),c=i(e);return u?u(r,n,c):a.call(r,n,c)}})},function(t,n,e){var r=e(0),o=e(36),i=e(18),u=e(3),a=e(4),c=e(2),f=e(124),s=(e(1).Reflect||{}).construct,l=c(function(){function t(){}return!(s(function(){},[],t)instanceof t)}),p=!c(function(){s(function(){})});r(r.S+r.F*(l||p),"Reflect",{construct:function(t,n){i(t),u(n);var e=arguments.length<3?t:i(arguments[2]);if(p&&!l)return s(t,n,e);if(t==e){switch(n.length){case 0:return new t;case 1:return new t(n[0]);case 2:return new t(n[0],n[1]);case 3:return new t(n[0],n[1],n[2]);case 4:return new t(n[0],n[1],n[2],n[3])}var r=[null];return r.push.apply(r,n),new(f.apply(t,r))}var c=e.prototype,h=o(a(c)?c:Object.prototype),d=Function.apply.call(t,h,n);return a(d)?d:h}})},function(t,n,e){var r=e(8),o=e(0),i=e(3),u=e(28);o(o.S+o.F*e(2)(function(){Reflect.defineProperty(r.f({},1,{value:1}),1,{value:2})}),"Reflect",{defineProperty:function(t,n,e){i(t),n=u(n,!0),i(e);try{return r.f(t,n,e),!0}catch(t){return!1}}})},function(t,n,e){var r=e(0),o=e(20).f,i=e(3);r(r.S,"Reflect",{deleteProperty:function(t,n){var e=o(i(t),n);return!(e&&!e.configurable)&&delete t[n]}})},function(t,n,e){"use strict";var r=e(0),o=e(3),i=function(t){this._t=o(t),this._i=0;var n,e=this._k=[];for(n in t)e.push(n)};e(131)(i,"Object",function(){var t,n=this._k;do{if(this._i>=n.length)return{value:void 0,done:!0}}while(!((t=n[this._i++])in this._t));return{value:t,done:!1}}),r(r.S,"Reflect",{enumerate:function(t){return new i(t)}})},function(t,n,e){var r=e(20),o=e(38),i=e(13),u=e(0),a=e(4),c=e(3);u(u.S,"Reflect",{get:function t(n,e){var u,f,s=arguments.length<3?n:arguments[2];return c(n)===s?n[e]:(u=r.f(n,e))?i(u,"value")?u.value:void 0!==u.get?u.get.call(s):void 0:a(f=o(n))?t(f,e,s):void 0}})},function(t,n,e){var r=e(20),o=e(0),i=e(3);o(o.S,"Reflect",{getOwnPropertyDescriptor:function(t,n){return r.f(i(t),n)}})},function(t,n,e){var r=e(0),o=e(38),i=e(3);r(r.S,"Reflect",{getPrototypeOf:function(t){return o(i(t))}})},function(t,n,e){var r=e(0);r(r.S,"Reflect",{has:function(t,n){return n in t}})},function(t,n,e){var r=e(0),o=e(3),i=Object.isExtensible;r(r.S,"Reflect",{isExtensible:function(t){return o(t),!i||i(t)}})},function(t,n,e){var r=e(0);r(r.S,"Reflect",{ownKeys:e(145)})},function(t,n,e){var r=e(0),o=e(3),i=Object.preventExtensions;r(r.S,"Reflect",{preventExtensions:function(t){o(t);try{return i&&i(t),!0}catch(t){return!1}}})},function(t,n,e){var r=e(8),o=e(20),i=e(38),u=e(13),a=e(0),c=e(31),f=e(3),s=e(4);a(a.S,"Reflect",{set:function t(n,e,a){var l,p,h=arguments.length<4?n:arguments[3],d=o.f(f(n),e);if(!d){if(s(p=i(n)))return t(p,e,a,h);d=c(0)}if(u(d,"value")){if(!1===d.writable||!s(h))return!1;if(l=o.f(h,e)){if(l.get||l.set||!1===l.writable)return!1;l.value=a,r.f(h,e,l)}else r.f(h,e,c(0,a));return!0}return void 0!==d.set&&(d.set.call(h,a),!0)}})},function(t,n,e){var r=e(0),o=e(83);o&&r(r.S,"Reflect",{setPrototypeOf:function(t,n){o.check(t,n);try{return o.set(t,n),!0}catch(t){return!1}}})},function(t,n,e){e(327),t.exports=e(7).Array.includes},function(t,n,e){"use strict";var r=e(0),o=e(63)(!0);r(r.P,"Array",{includes:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0)}}),e(39)("includes")},function(t,n,e){e(329),t.exports=e(7).Array.flatMap},function(t,n,e){"use strict";var r=e(0),o=e(330),i=e(10),u=e(6),a=e(18),c=e(133);r(r.P,"Array",{flatMap:function(t){var n,e,r=i(this);return a(t),n=u(r.length),e=c(r,0),o(e,r,r,n,0,1,t,arguments[1]),e}}),e(39)("flatMap")},function(t,n,e){"use strict";var r=e(65),o=e(4),i=e(6),u=e(17),a=e(5)("isConcatSpreadable");t.exports=function t(n,e,c,f,s,l,p,h){for(var d,v,y=s,g=0,m=!!p&&u(p,h,3);g<f;){if(g in c){if(d=m?m(c[g],g,e):c[g],v=!1,o(d)&&(v=void 0!==(v=d[a])?!!v:r(d)),v&&l>0)y=t(n,e,d,i(d.length),y,l-1)-1;else{if(y>=9007199254740991)throw TypeError();n[y]=d}y++}g++}return y}},function(t,n,e){e(332),t.exports=e(7).String.padStart},function(t,n,e){"use strict";var r=e(0),o=e(146),i=e(71),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);r(r.P+r.F*u,"String",{padStart:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!0)}})},function(t,n,e){e(334),t.exports=e(7).String.padEnd},function(t,n,e){"use strict";var r=e(0),o=e(146),i=e(71),u=/Version\/10\.\d+(\.\d+)?( Mobile\/\w+)? Safari\//.test(i);r(r.P+r.F*u,"String",{padEnd:function(t){return o(this,t,arguments.length>1?arguments[1]:void 0,!1)}})},function(t,n,e){e(336),t.exports=e(7).String.trimLeft},function(t,n,e){"use strict";e(46)("trimLeft",function(t){return function(){return t(this,1)}},"trimStart")},function(t,n,e){e(338),t.exports=e(7).String.trimRight},function(t,n,e){"use strict";e(46)("trimRight",function(t){return function(){return t(this,2)}},"trimEnd")},function(t,n,e){e(340),t.exports=e(79).f("asyncIterator")},function(t,n,e){e(118)("asyncIterator")},function(t,n,e){e(342),t.exports=e(7).Object.getOwnPropertyDescriptors},function(t,n,e){var r=e(0),o=e(145),i=e(15),u=e(20),a=e(95);r(r.S,"Object",{getOwnPropertyDescriptors:function(t){for(var n,e,r=i(t),c=u.f,f=o(r),s={},l=0;f.length>l;)void 0!==(e=c(r,n=f[l++]))&&a(s,n,e);return s}})},function(t,n,e){e(344),t.exports=e(7).Object.values},function(t,n,e){var r=e(0),o=e(147)(!1);r(r.S,"Object",{values:function(t){return o(t)}})},function(t,n,e){e(346),t.exports=e(7).Object.entries},function(t,n,e){var r=e(0),o=e(147)(!0);r(r.S,"Object",{entries:function(t){return o(t)}})},function(t,n,e){"use strict";e(139),e(348),t.exports=e(7).Promise.finally},function(t,n,e){"use strict";var r=e(0),o=e(7),i=e(1),u=e(58),a=e(141);r(r.P+r.R,"Promise",{finally:function(t){var n=u(this,o.Promise||i.Promise),e="function"==typeof t;return this.then(e?function(e){return a(n,t()).then(function(){return e})}:t,e?function(e){return a(n,t()).then(function(){throw e})}:t)}})},function(t,n,e){e(350),e(351),e(352),t.exports=e(7)},function(t,n,e){var r=e(1),o=e(0),i=e(71),u=[].slice,a=/MSIE .\./.test(i),c=function(t){return function(n,e){var r=arguments.length>2,o=!!r&&u.call(arguments,2);return t(r?function(){("function"==typeof n?n:Function(n)).apply(this,o)}:n,e)}};o(o.G+o.B+o.F*a,{setTimeout:c(r.setTimeout),setInterval:c(r.setInterval)})},function(t,n,e){var r=e(0),o=e(101);r(r.G+r.B,{setImmediate:o.set,clearImmediate:o.clear})},function(t,n,e){for(var r=e(98),o=e(34),i=e(11),u=e(1),a=e(14),c=e(47),f=e(5),s=f("iterator"),l=f("toStringTag"),p=c.Array,h={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},d=o(h),v=0;v<d.length;v++){var y,g=d[v],m=h[g],b=u[g],w=b&&b.prototype;if(w&&(w[s]||a(w,s,p),w[l]||a(w,l,g),c[g]=p,m))for(y in r)w[y]||i(w,y,r[y],!0)}},function(t,n,e){var r=function(t){"use strict";var n,e=Object.prototype,r=e.hasOwnProperty,o="function"==typeof Symbol?Symbol:{},i=o.iterator||"@@iterator",u=o.asyncIterator||"@@asyncIterator",a=o.toStringTag||"@@toStringTag";function c(t,n,e,r){var o=n&&n.prototype instanceof v?n:v,i=Object.create(o.prototype),u=new P(r||[]);return i._invoke=function(t,n,e){var r=s;return function(o,i){if(r===p)throw new Error("Generator is already running");if(r===h){if("throw"===o)throw i;return F()}for(e.method=o,e.arg=i;;){var u=e.delegate;if(u){var a=O(u,e);if(a){if(a===d)continue;return a}}if("next"===e.method)e.sent=e._sent=e.arg;else if("throw"===e.method){if(r===s)throw r=h,e.arg;e.dispatchException(e.arg)}else"return"===e.method&&e.abrupt("return",e.arg);r=p;var c=f(t,n,e);if("normal"===c.type){if(r=e.done?h:l,c.arg===d)continue;return{value:c.arg,done:e.done}}"throw"===c.type&&(r=h,e.method="throw",e.arg=c.arg)}}}(t,e,u),i}function f(t,n,e){try{return{type:"normal",arg:t.call(n,e)}}catch(t){return{type:"throw",arg:t}}}t.wrap=c;var s="suspendedStart",l="suspendedYield",p="executing",h="completed",d={};function v(){}function y(){}function g(){}var m={};m[i]=function(){return this};var b=Object.getPrototypeOf,w=b&&b(b(T([])));w&&w!==e&&r.call(w,i)&&(m=w);var x=g.prototype=v.prototype=Object.create(m);function S(t){["next","throw","return"].forEach(function(n){t[n]=function(t){return this._invoke(n,t)}})}function _(t){var n;this._invoke=function(e,o){function i(){return new Promise(function(n,i){!function n(e,o,i,u){var a=f(t[e],t,o);if("throw"!==a.type){var c=a.arg,s=c.value;return s&&"object"==typeof s&&r.call(s,"__await")?Promise.resolve(s.__await).then(function(t){n("next",t,i,u)},function(t){n("throw",t,i,u)}):Promise.resolve(s).then(function(t){c.value=t,i(c)},function(t){return n("throw",t,i,u)})}u(a.arg)}(e,o,n,i)})}return n=n?n.then(i,i):i()}}function O(t,e){var r=t.iterator[e.method];if(r===n){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=n,O(t,e),"throw"===e.method))return d;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return d}var o=f(r,t.iterator,e.arg);if("throw"===o.type)return e.method="throw",e.arg=o.arg,e.delegate=null,d;var i=o.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=n),e.delegate=null,d):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,d)}function E(t){var n={tryLoc:t[0]};1 in t&&(n.catchLoc=t[1]),2 in t&&(n.finallyLoc=t[2],n.afterLoc=t[3]),this.tryEntries.push(n)}function M(t){var n=t.completion||{};n.type="normal",delete n.arg,t.completion=n}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(E,this),this.reset(!0)}function T(t){if(t){var e=t[i];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var o=-1,u=function e(){for(;++o<t.length;)if(r.call(t,o))return e.value=t[o],e.done=!1,e;return e.value=n,e.done=!0,e};return u.next=u}}return{next:F}}function F(){return{value:n,done:!0}}return y.prototype=x.constructor=g,g.constructor=y,g[a]=y.displayName="GeneratorFunction",t.isGeneratorFunction=function(t){var n="function"==typeof t&&t.constructor;return!!n&&(n===y||"GeneratorFunction"===(n.displayName||n.name))},t.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,g):(t.__proto__=g,a in t||(t[a]="GeneratorFunction")),t.prototype=Object.create(x),t},t.awrap=function(t){return{__await:t}},S(_.prototype),_.prototype[u]=function(){return this},t.AsyncIterator=_,t.async=function(n,e,r,o){var i=new _(c(n,e,r,o));return t.isGeneratorFunction(e)?i:i.next().then(function(t){return t.done?t.value:i.next()})},S(x),x[a]="Generator",x[i]=function(){return this},x.toString=function(){return"[object Generator]"},t.keys=function(t){var n=[];for(var e in t)n.push(e);return n.reverse(),function e(){for(;n.length;){var r=n.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},t.values=T,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=n,this.done=!1,this.delegate=null,this.method="next",this.arg=n,this.tryEntries.forEach(M),!t)for(var e in this)"t"===e.charAt(0)&&r.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=n)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function o(r,o){return a.type="throw",a.arg=t,e.next=r,o&&(e.method="next",e.arg=n),!!o}for(var i=this.tryEntries.length-1;i>=0;--i){var u=this.tryEntries[i],a=u.completion;if("root"===u.tryLoc)return o("end");if(u.tryLoc<=this.prev){var c=r.call(u,"catchLoc"),f=r.call(u,"finallyLoc");if(c&&f){if(this.prev<u.catchLoc)return o(u.catchLoc,!0);if(this.prev<u.finallyLoc)return o(u.finallyLoc)}else if(c){if(this.prev<u.catchLoc)return o(u.catchLoc,!0)}else{if(!f)throw new Error("try statement without catch or finally");if(this.prev<u.finallyLoc)return o(u.finallyLoc)}}}},abrupt:function(t,n){for(var e=this.tryEntries.length-1;e>=0;--e){var o=this.tryEntries[e];if(o.tryLoc<=this.prev&&r.call(o,"finallyLoc")&&this.prev<o.finallyLoc){var i=o;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=n&&n<=i.finallyLoc&&(i=null);var u=i?i.completion:{};return u.type=t,u.arg=n,i?(this.method="next",this.next=i.finallyLoc,d):this.complete(u)},complete:function(t,n){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&n&&(this.next=n),d},finish:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.finallyLoc===t)return this.complete(e.completion,e.afterLoc),M(e),d}},catch:function(t){for(var n=this.tryEntries.length-1;n>=0;--n){var e=this.tryEntries[n];if(e.tryLoc===t){var r=e.completion;if("throw"===r.type){var o=r.arg;M(e)}return o}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:T(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=n),d}},t}(t.exports);try{regeneratorRuntime=r}catch(t){Function("r","regeneratorRuntime = r")(r)}},function(t,n,e){e(355),t.exports=e(23).global},function(t,n,e){var r=e(41);r(r.G,{global:e(27)})},function(t,n){t.exports=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t}},function(t,n,e){t.exports={default:e(358),__esModule:!0}},function(t,n,e){e(359),t.exports=e(23).Object.getPrototypeOf},function(t,n,e){var r=e(151),o=e(152);e(360)("getPrototypeOf",function(){return function(t){return o(r(t))}})},function(t,n,e){var r=e(41),o=e(23),i=e(60);t.exports=function(t,n){var e=(o.Object||{})[t]||Object[t],u={};u[t]=n(e),r(r.S+r.F*i(function(){e(1)}),"Object",u)}},function(t,n,e){"use strict";n.__esModule=!0,n.default=function(t,n){if(!(t instanceof n))throw new TypeError("Cannot call a class as a function")}},function(t,n,e){"use strict";n.__esModule=!0;var r,o=e(363),i=(r=o)&&r.__esModule?r:{default:r};n.default=function(){function t(t,n){for(var e=0;e<n.length;e++){var r=n[e];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),(0,i.default)(t,r.key,r)}}return function(n,e,r){return e&&t(n.prototype,e),r&&t(n,r),n}}()},function(t,n,e){t.exports={default:e(364),__esModule:!0}},function(t,n,e){e(365);var r=e(23).Object;t.exports=function(t,n,e){return r.defineProperty(t,n,e)}},function(t,n,e){var r=e(41);r(r.S+r.F*!e(43),"Object",{defineProperty:e(42).f})},function(t,n,e){"use strict";n.__esModule=!0;var r,o=e(153),i=(r=o)&&r.__esModule?r:{default:r};n.default=function(t,n){if(!t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return!n||"object"!==(void 0===n?"undefined":(0,i.default)(n))&&"function"!=typeof n?t:n}},function(t,n,e){t.exports={default:e(368),__esModule:!0}},function(t,n,e){e(369),e(378),t.exports=e(113).f("iterator")},function(t,n,e){"use strict";var r=e(370)(!0);e(154)(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,n=this._t,e=this._i;return e>=n.length?{value:void 0,done:!0}:(t=r(n,e),this._i+=t.length,{value:t,done:!1})})},function(t,n,e){var r=e(107),o=e(104);t.exports=function(t){return function(n,e){var i,u,a=String(o(n)),c=r(e),f=a.length;return c<0||c>=f?t?"":void 0:(i=a.charCodeAt(c))<55296||i>56319||c+1===f||(u=a.charCodeAt(c+1))<56320||u>57343?t?a.charAt(c):i:t?a.slice(c,c+2):u-56320+(i-55296<<10)+65536}}},function(t,n,e){"use strict";var r=e(109),o=e(74),i=e(112),u={};e(51)(u,e(54)("iterator"),function(){return this}),t.exports=function(t,n,e){t.prototype=r(u,{next:o(1,e)}),i(t,n+" Iterator")}},function(t,n,e){var r=e(42),o=e(59),i=e(110);t.exports=e(43)?Object.defineProperties:function(t,n){o(t);for(var e,u=i(n),a=u.length,c=0;a>c;)r.f(t,e=u[c++],n[e]);return t}},function(t,n,e){var r=e(157);t.exports=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==r(t)?t.split(""):Object(t)}},function(t,n,e){var r=e(53),o=e(375),i=e(376);t.exports=function(t){return function(n,e,u){var a,c=r(n),f=o(c.length),s=i(u,f);if(t&&e!=e){for(;f>s;)if((a=c[s++])!=a)return!0}else for(;f>s;s++)if((t||s in c)&&c[s]===e)return t||s||0;return!t&&-1}}},function(t,n,e){var r=e(107),o=Math.min;t.exports=function(t){return t>0?o(r(t),9007199254740991):0}},function(t,n,e){var r=e(107),o=Math.max,i=Math.min;t.exports=function(t,n){return(t=r(t))<0?o(t+n,0):i(t,n)}},function(t,n,e){var r=e(27).document;t.exports=r&&r.documentElement},function(t,n,e){e(379);for(var r=e(27),o=e(51),i=e(108),u=e(54)("toStringTag"),a="CSSRuleList,CSSStyleDeclaration,CSSValueList,ClientRectList,DOMRectList,DOMStringList,DOMTokenList,DataTransferItemList,FileList,HTMLAllCollection,HTMLCollection,HTMLFormElement,HTMLSelectElement,MediaList,MimeTypeArray,NamedNodeMap,NodeList,PaintRequestList,Plugin,PluginArray,SVGLengthList,SVGNumberList,SVGPathSegList,SVGPointList,SVGStringList,SVGTransformList,SourceBufferList,StyleSheetList,TextTrackCueList,TextTrackList,TouchList".split(","),c=0;c<a.length;c++){var f=a[c],s=r[f],l=s&&s.prototype;l&&!l[u]&&o(l,u,f),i[f]=i.Array}},function(t,n,e){"use strict";var r=e(380),o=e(381),i=e(108),u=e(53);t.exports=e(154)(Array,"Array",function(t,n){this._t=u(t),this._i=0,this._k=n},function(){var t=this._t,n=this._k,e=this._i++;return!t||e>=t.length?(this._t=void 0,o(1)):o(0,"keys"==n?e:"values"==n?t[e]:[e,t[e]])},"values"),i.Arguments=i.Array,r("keys"),r("values"),r("entries")},function(t,n){t.exports=function(){}},function(t,n){t.exports=function(t,n){return{value:n,done:!!t}}},function(t,n,e){t.exports={default:e(383),__esModule:!0}},function(t,n,e){e(384),e(389),e(390),e(391),t.exports=e(23).Symbol},function(t,n,e){"use strict";var r=e(27),o=e(44),i=e(43),u=e(41),a=e(155),c=e(385).KEY,f=e(60),s=e(106),l=e(112),p=e(76),h=e(54),d=e(113),v=e(114),y=e(386),g=e(387),m=e(59),b=e(52),w=e(53),x=e(103),S=e(74),_=e(109),O=e(388),E=e(160),M=e(42),P=e(110),T=E.f,F=M.f,I=O.f,j=r.Symbol,A=r.JSON,k=A&&A.stringify,N=h("_hidden"),R=h("toPrimitive"),L={}.propertyIsEnumerable,C=s("symbol-registry"),z=s("symbols"),W=s("op-symbols"),D=Object.prototype,V="function"==typeof j,B=r.QObject,U=!B||!B.prototype||!B.prototype.findChild,G=i&&f(function(){return 7!=_(F({},"a",{get:function(){return F(this,"a",{value:7}).a}})).a})?function(t,n,e){var r=T(D,n);r&&delete D[n],F(t,n,e),r&&t!==D&&F(D,n,r)}:F,H=function(t){var n=z[t]=_(j.prototype);return n._k=t,n},q=V&&"symbol"==typeof j.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof j},Y=function(t,n,e){return t===D&&Y(W,n,e),m(t),n=x(n,!0),m(e),o(z,n)?(e.enumerable?(o(t,N)&&t[N][n]&&(t[N][n]=!1),e=_(e,{enumerable:S(0,!1)})):(o(t,N)||F(t,N,S(1,{})),t[N][n]=!0),G(t,n,e)):F(t,n,e)},J=function(t,n){m(t);for(var e,r=y(n=w(n)),o=0,i=r.length;i>o;)Y(t,e=r[o++],n[e]);return t},K=function(t){var n=L.call(this,t=x(t,!0));return!(this===D&&o(z,t)&&!o(W,t))&&(!(n||!o(this,t)||!o(z,t)||o(this,N)&&this[N][t])||n)},X=function(t,n){if(t=w(t),n=x(n,!0),t!==D||!o(z,n)||o(W,n)){var e=T(t,n);return!e||!o(z,n)||o(t,N)&&t[N][n]||(e.enumerable=!0),e}},$=function(t){for(var n,e=I(w(t)),r=[],i=0;e.length>i;)o(z,n=e[i++])||n==N||n==c||r.push(n);return r},Q=function(t){for(var n,e=t===D,r=I(e?W:w(t)),i=[],u=0;r.length>u;)!o(z,n=r[u++])||e&&!o(D,n)||i.push(z[n]);return i};V||(a((j=function(){if(this instanceof j)throw TypeError("Symbol is not a constructor!");var t=p(arguments.length>0?arguments[0]:void 0),n=function(e){this===D&&n.call(W,e),o(this,N)&&o(this[N],t)&&(this[N][t]=!1),G(this,t,S(1,e))};return i&&U&&G(D,t,{configurable:!0,set:n}),H(t)}).prototype,"toString",function(){return this._k}),E.f=X,M.f=Y,e(159).f=O.f=$,e(115).f=K,e(158).f=Q,i&&!e(75)&&a(D,"propertyIsEnumerable",K,!0),d.f=function(t){return H(h(t))}),u(u.G+u.W+u.F*!V,{Symbol:j});for(var Z="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),tt=0;Z.length>tt;)h(Z[tt++]);for(var nt=P(h.store),et=0;nt.length>et;)v(nt[et++]);u(u.S+u.F*!V,"Symbol",{for:function(t){return o(C,t+="")?C[t]:C[t]=j(t)},keyFor:function(t){if(!q(t))throw TypeError(t+" is not a symbol!");for(var n in C)if(C[n]===t)return n},useSetter:function(){U=!0},useSimple:function(){U=!1}}),u(u.S+u.F*!V,"Object",{create:function(t,n){return void 0===n?_(t):J(_(t),n)},defineProperty:Y,defineProperties:J,getOwnPropertyDescriptor:X,getOwnPropertyNames:$,getOwnPropertySymbols:Q}),A&&u(u.S+u.F*(!V||f(function(){var t=j();return"[null]"!=k([t])||"{}"!=k({a:t})||"{}"!=k(Object(t))})),"JSON",{stringify:function(t){for(var n,e,r=[t],o=1;arguments.length>o;)r.push(arguments[o++]);if(e=n=r[1],(b(n)||void 0!==t)&&!q(t))return g(n)||(n=function(t,n){if("function"==typeof e&&(n=e.call(this,t,n)),!q(n))return n}),r[1]=n,k.apply(A,r)}}),j.prototype[R]||e(51)(j.prototype,R,j.prototype.valueOf),l(j,"Symbol"),l(Math,"Math",!0),l(r.JSON,"JSON",!0)},function(t,n,e){var r=e(76)("meta"),o=e(52),i=e(44),u=e(42).f,a=0,c=Object.isExtensible||function(){return!0},f=!e(60)(function(){return c(Object.preventExtensions({}))}),s=function(t){u(t,r,{value:{i:"O"+ ++a,w:{}}})},l=t.exports={KEY:r,NEED:!1,fastKey:function(t,n){if(!o(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!i(t,r)){if(!c(t))return"F";if(!n)return"E";s(t)}return t[r].i},getWeak:function(t,n){if(!i(t,r)){if(!c(t))return!0;if(!n)return!1;s(t)}return t[r].w},onFreeze:function(t){return f&&l.NEED&&c(t)&&!i(t,r)&&s(t),t}}},function(t,n,e){var r=e(110),o=e(158),i=e(115);t.exports=function(t){var n=r(t),e=o.f;if(e)for(var u,a=e(t),c=i.f,f=0;a.length>f;)c.call(t,u=a[f++])&&n.push(u);return n}},function(t,n,e){var r=e(157);t.exports=Array.isArray||function(t){return"Array"==r(t)}},function(t,n,e){var r=e(53),o=e(159).f,i={}.toString,u="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[];t.exports.f=function(t){return u&&"[object Window]"==i.call(t)?function(t){try{return o(t)}catch(t){return u.slice()}}(t):o(r(t))}},function(t,n){},function(t,n,e){e(114)("asyncIterator")},function(t,n,e){e(114)("observable")},function(t,n,e){"use strict";n.__esModule=!0;var r=u(e(393)),o=u(e(397)),i=u(e(153));function u(t){return t&&t.__esModule?t:{default:t}}n.default=function(t,n){if("function"!=typeof n&&null!==n)throw new TypeError("Super expression must either be null or a function, not "+(void 0===n?"undefined":(0,i.default)(n)));t.prototype=(0,o.default)(n&&n.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),n&&(r.default?(0,r.default)(t,n):t.__proto__=n)}},function(t,n,e){t.exports={default:e(394),__esModule:!0}},function(t,n,e){e(395),t.exports=e(23).Object.setPrototypeOf},function(t,n,e){var r=e(41);r(r.S,"Object",{setPrototypeOf:e(396).set})},function(t,n,e){var r=e(52),o=e(59),i=function(t,n){if(o(t),!r(n)&&null!==n)throw TypeError(n+": can't set as prototype!")};t.exports={set:Object.setPrototypeOf||("__proto__"in{}?function(t,n,r){try{(r=e(148)(Function.call,e(160).f(Object.prototype,"__proto__").set,2))(t,[]),n=!(t instanceof Array)}catch(t){n=!0}return function(t,e){return i(t,e),n?t.__proto__=e:r(t,e),t}}({},!1):void 0),check:i}},function(t,n,e){t.exports={default:e(398),__esModule:!0}},function(t,n,e){e(399);var r=e(23).Object;t.exports=function(t,n){return r.create(t,n)}},function(t,n,e){var r=e(41);r(r.S,"Object",{create:e(109)})},function(t,n,e){t.exports=e(401)()},function(t,n,e){"use strict";var r=e(402);function o(){}function i(){}i.resetWarningCache=o,t.exports=function(){function t(t,n,e,o,i,u){if(u!==r){var a=new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");throw a.name="Invariant Violation",a}}function n(){return t}t.isRequired=t;var e={array:t,bool:t,func:t,number:t,object:t,string:t,symbol:t,any:t,arrayOf:n,element:t,elementType:t,instanceOf:n,node:t,objectOf:n,oneOf:n,oneOfType:n,shape:n,exact:n,checkPropTypes:i,resetWarningCache:o};return e.PropTypes=e,e}},function(t,n,e){"use strict";t.exports="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED"},function(t,n){t.exports=ReactDOM},function(t,n,e){"use strict";t.exports=e(405)},function(t,n,e){n.iframeResizer=e(406),n.iframeResizerContentWindow=e(407)},function(t,n,e){var r,o,i;!function(e){"use strict";if("undefined"!=typeof window){var u,a=0,c=!1,f=!1,s="message".length,l="[iFrameSizer]",p=l.length,h=null,d=window.requestAnimationFrame,v={max:1,scroll:1,bodyScroll:1,documentElementScroll:1},y={},g=null,m={autoResize:!0,bodyBackground:null,bodyMargin:null,bodyMarginV1:8,bodyPadding:null,checkOrigin:!0,inPageLinks:!1,enablePublicMethods:!0,heightCalculationMethod:"bodyOffset",id:"iFrameResizer",interval:32,log:!1,maxHeight:1/0,maxWidth:1/0,minHeight:0,minWidth:0,resizeFrom:"parent",scrolling:!1,sizeHeight:!0,sizeWidth:!1,warningTimeout:5e3,tolerance:0,widthCalculationMethod:"scroll",closedCallback:function(){},initCallback:function(){},messageCallback:function(){P("MessageCallback function not defined")},resizedCallback:function(){},scrollCallback:function(){return!0}},b={};window.jQuery&&((u=window.jQuery).fn?u.fn.iFrameResize||(u.fn.iFrameResize=function(t){return this.filter("iframe").each(function(n,e){V(e,t)}).end()}):M("","Unable to bind to jQuery, it is not fully loaded.")),o=[],(i="function"==typeof(r=q)?r.apply(n,o):r)===e||(t.exports=i),window.iFrameResize=window.iFrameResize||q()}function w(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}function x(t,n,e){"addEventListener"in window?t.addEventListener(n,e,!1):"attachEvent"in window&&t.attachEvent("on"+n,e)}function S(t,n,e){"removeEventListener"in window?t.removeEventListener(n,e,!1):"detachEvent"in window&&t.detachEvent("on"+n,e)}function _(t){return l+"["+function(t){var n="Host page: "+t;return window.top!==window.self&&(n=window.parentIFrame&&window.parentIFrame.getId?window.parentIFrame.getId()+": "+t:"Nested host page: "+t),n}(t)+"]"}function O(t){return y[t]?y[t].log:c}function E(t,n){T("log",t,n,O(t))}function M(t,n){T("info",t,n,O(t))}function P(t,n){T("warn",t,n,!0)}function T(t,n,e,r){!0===r&&"object"==typeof window.console&&console[t](_(n),e)}function F(t){function n(){e("Height"),e("Width"),z(function(){C(m),N(w),c("resizedCallback",m)},m,"init")}function e(t){var n=Number(y[w]["max"+t]),e=Number(y[w]["min"+t]),r=t.toLowerCase(),o=Number(m[r]);E(w,"Checking "+r+" is in range "+e+"-"+n),o<e&&(o=e,E(w,"Set "+r+" to min value")),o>n&&(o=n,E(w,"Set "+r+" to max value")),m[r]=""+o}function r(t){return g.substr(g.indexOf(":")+s+t)}function o(t,n){var e,r,o;e=function(){var e,r;W("Send Page Info","pageInfo:"+(e=document.body.getBoundingClientRect(),r=m.iframe.getBoundingClientRect(),JSON.stringify({iframeHeight:r.height,iframeWidth:r.width,clientHeight:Math.max(document.documentElement.clientHeight,window.innerHeight||0),clientWidth:Math.max(document.documentElement.clientWidth,window.innerWidth||0),offsetTop:parseInt(r.top-e.top,10),offsetLeft:parseInt(r.left-e.left,10),scrollTop:window.pageYOffset,scrollLeft:window.pageXOffset})),t,n)},r=32,b[o=n]||(b[o]=setTimeout(function(){b[o]=null,e()},r))}function i(t){var n=t.getBoundingClientRect();return k(w),{x:Math.floor(Number(n.left)+Number(h.x)),y:Math.floor(Number(n.top)+Number(h.y))}}function u(t){var n=t?i(m.iframe):{x:0,y:0},e={x:Number(m.width)+n.x,y:Number(m.height)+n.y};E(w,"Reposition requested from iFrame (offset x:"+n.x+" y:"+n.y+")"),window.top!==window.self?window.parentIFrame?window.parentIFrame["scrollTo"+(t?"Offset":"")](e.x,e.y):P(w,"Unable to scroll to requested position, window.parentIFrame not found"):(h=e,a(),E(w,"--"))}function a(){!1!==c("scrollCallback",h)?N(w):R()}function c(t,n){return I(w,t,n)}var f,d,v,g=t.data,m={},w=null;"[iFrameResizerChild]Ready"===g?function(){for(var t in y)W("iFrame requested init",D(t),document.getElementById(t),t)}():l===(""+g).substr(0,p)&&g.substr(p).split(":")[0]in y?(v=g.substr(p).split(":"),m={iframe:y[v[0]]&&y[v[0]].iframe,id:v[0],height:v[1],width:v[2],type:v[3]},w=m.id,y[w]&&(y[w].loaded=!0),(d=m.type in{true:1,false:1,undefined:1})&&E(w,"Ignoring init message from meta parent page"),!d&&function(t){var n=!0;return y[t]||(n=!1,P(m.type+" No settings for "+t+". Message was: "+g)),n}(w)&&(E(w,"Received: "+g),f=!0,null===m.iframe&&(P(w,"IFrame ("+m.id+") not found"),f=!1),f&&function(){var n,e=t.origin,r=y[w]&&y[w].checkOrigin;if(r&&""+e!="null"&&!(r.constructor===Array?function(){var t=0,n=!1;for(E(w,"Checking connection is from allowed list of origins: "+r);t<r.length;t++)if(r[t]===e){n=!0;break}return n}():(n=y[w]&&y[w].remoteHost,E(w,"Checking connection is from: "+n),e===n)))throw new Error("Unexpected message received from: "+e+" for "+m.iframe.id+". Message was: "+t.data+". This error can be disabled by setting the checkOrigin: false option or by providing of array of trusted domains.");return!0}()&&function(){switch(y[w]&&y[w].firstRun&&y[w]&&(y[w].firstRun=!1),m.type){case"close":y[w].closeRequestCallback?I(w,"closeRequestCallback",y[w].iframe):A(m.iframe);break;case"message":p=r(6),E(w,"MessageCallback passed: {iframe: "+m.iframe.id+", message: "+p+"}"),c("messageCallback",{iframe:m.iframe,message:JSON.parse(p)}),E(w,"--");break;case"scrollTo":u(!1);break;case"scrollToOffset":u(!0);break;case"pageInfo":o(y[w]&&y[w].iframe,w),function(){function t(t,r){function i(){y[e]?o(y[e].iframe,e):n()}["scroll","resize"].forEach(function(n){E(e,t+n+" listener for sendPageInfo"),r(window,n,i)})}function n(){t("Remove ",S)}var e=w;t("Add ",x),y[e]&&(y[e].stopPageInfo=n)}();break;case"pageInfoStop":y[w]&&y[w].stopPageInfo&&(y[w].stopPageInfo(),delete y[w].stopPageInfo);break;case"inPageLink":t=r(9),f=t.split("#")[1]||"",s=decodeURIComponent(f),(l=document.getElementById(s)||document.getElementsByName(s)[0])?(e=i(l),E(w,"Moving to in page link (#"+f+") at x: "+e.x+" y: "+e.y),h={x:e.x,y:e.y},a(),E(w,"--")):window.top!==window.self?window.parentIFrame?window.parentIFrame.moveToAnchor(f):E(w,"In page link #"+f+" not found and window.parentIFrame not found"):E(w,"In page link #"+f+" not found");break;case"reset":L(m);break;case"init":n(),c("initCallback",m.iframe);break;default:n()}var t,e,f,s,l,p}())):M(w,"Ignored: "+g)}function I(t,n,e){var r=null,o=null;if(y[t]){if("function"!=typeof(r=y[t][n]))throw new TypeError(n+" on iFrame["+t+"] is not a function");o=r(e)}return o}function j(t){var n=t.id;delete y[n]}function A(t){var n=t.id;E(n,"Removing iFrame: "+n);try{t.parentNode&&t.parentNode.removeChild(t)}catch(t){}I(n,"closedCallback",n),E(n,"--"),j(t)}function k(t){null===h&&E(t,"Get page position: "+(h={x:window.pageXOffset!==e?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==e?window.pageYOffset:document.documentElement.scrollTop}).x+","+h.y)}function N(t){null!==h&&(window.scrollTo(h.x,h.y),E(t,"Set page position: "+h.x+","+h.y),R())}function R(){h=null}function L(t){E(t.id,"Size reset requested by "+("init"===t.type?"host page":"iFrame")),k(t.id),z(function(){C(t),W("reset","reset",t.iframe,t.id)},t,"reset")}function C(t){function n(n){f||"0"!==t[n]||(f=!0,E(r,"Hidden iFrame detected, creating visibility listener"),function(){function t(){function t(t){function n(n){return"0px"===(y[t]&&y[t].iframe.style[n])}y[t]&&null!==y[t].iframe.offsetParent&&(n("height")||n("width"))&&W("Visibility change","resize",y[t].iframe,t)}for(var n in y)t(n)}function n(n){E("window","Mutation observed: "+n[0].target+" "+n[0].type),B(t,16)}var e=w();e&&(r=document.querySelector("body"),new e(n).observe(r,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}));var r}())}function e(e){!function(n){t.id?(t.iframe.style[n]=t[n]+"px",E(t.id,"IFrame ("+r+") "+n+" set to "+t[n]+"px")):E("undefined","messageData id not set")}(e),n(e)}var r=t.iframe.id;y[r]&&(y[r].sizeHeight&&e("height"),y[r].sizeWidth&&e("width"))}function z(t,n,e){e!==n.type&&d?(E(n.id,"Requesting animation frame"),d(t)):t()}function W(t,n,e,r,o){var i,u=!1;r=r||e.id,y[r]&&(e&&"contentWindow"in e&&null!==e.contentWindow?(i=y[r]&&y[r].targetOrigin,E(r,"["+t+"] Sending msg to iframe["+r+"] ("+n+") targetOrigin: "+i),e.contentWindow.postMessage(l+n,i)):P(r,"["+t+"] IFrame("+r+") not found"),o&&y[r]&&y[r].warningTimeout&&(y[r].msgTimeout=setTimeout(function(){!y[r]||y[r].loaded||u||(u=!0,P(r,"IFrame has not responded within "+y[r].warningTimeout/1e3+" seconds. Check iFrameResizer.contentWindow.js has been loaded in iFrame. This message can be ignored if everything is working, or you can set the warningTimeout option to a higher value or zero to suppress this warning."))},y[r].warningTimeout)))}function D(t){return t+":"+y[t].bodyMarginV1+":"+y[t].sizeWidth+":"+y[t].log+":"+y[t].interval+":"+y[t].enablePublicMethods+":"+y[t].autoResize+":"+y[t].bodyMargin+":"+y[t].heightCalculationMethod+":"+y[t].bodyBackground+":"+y[t].bodyPadding+":"+y[t].tolerance+":"+y[t].inPageLinks+":"+y[t].resizeFrom+":"+y[t].widthCalculationMethod}function V(t,n){var r,o,i=function(e){var r;return e,""===e&&(t.id=(r=n&&n.id||m.id+a++,null!==document.getElementById(r)&&(r+=a++),e=r),c=(n||{}).log,e,E(e,"Added missing iframe ID: "+e+" ("+t.src+")")),e}(t.id);i in y&&"iFrameResizer"in t?P(i,"Ignored iFrame, already setup."):(!function(n){var e;n=n||{},y[i]={firstRun:!0,iframe:t,remoteHost:t.src.split("/").slice(0,3).join("/")},function(t){if("object"!=typeof t)throw new TypeError("Options is not an object")}(n),function(t){for(var n in m)m.hasOwnProperty(n)&&(y[i][n]=t.hasOwnProperty(n)?t[n]:m[n])}(n),y[i]&&(y[i].targetOrigin=!0===y[i].checkOrigin?""===(e=y[i].remoteHost)||"file://"===e?"*":e:"*")}(n),function(){switch(E(i,"IFrame scrolling "+(y[i]&&y[i].scrolling?"enabled":"disabled")+" for "+i),t.style.overflow=!1===(y[i]&&y[i].scrolling)?"hidden":"auto",y[i]&&y[i].scrolling){case"omit":break;case!0:t.scrolling="yes";break;case!1:t.scrolling="no";break;default:t.scrolling=y[i]?y[i].scrolling:"no"}}(),function(){function n(n){1/0!==y[i][n]&&0!==y[i][n]&&(t.style[n]=y[i][n]+"px",E(i,"Set "+n+" = "+y[i][n]+"px"))}function e(t){if(y[i]["min"+t]>y[i]["max"+t])throw new Error("Value for min"+t+" can not be greater than max"+t)}e("Height"),e("Width"),n("maxHeight"),n("minHeight"),n("maxWidth"),n("minWidth")}(),"number"!=typeof(y[i]&&y[i].bodyMargin)&&"0"!==(y[i]&&y[i].bodyMargin)||(y[i].bodyMarginV1=y[i].bodyMargin,y[i].bodyMargin=y[i].bodyMargin+"px"),r=D(i),(o=w())&&function(n){t.parentNode&&new n(function(n){n.forEach(function(n){Array.prototype.slice.call(n.removedNodes).forEach(function(n){n===t&&A(t)})})}).observe(t.parentNode,{childList:!0})}(o),x(t,"load",function(){var n,o;W("iFrame.onload",r,t,e,!0),n=y[i]&&y[i].firstRun,o=y[i]&&y[i].heightCalculationMethod in v,!n&&o&&L({iframe:t,height:0,width:0,type:"init"})}),W("init",r,t,e,!0),Function.prototype.bind&&y[i]&&(y[i].iframe.iFrameResizer={close:A.bind(null,y[i].iframe),removeListeners:j.bind(null,y[i].iframe),resize:W.bind(null,"Window resize","resize",y[i].iframe),moveToAnchor:function(t){W("Move to anchor","moveToAnchor:"+t,y[i].iframe,i)},sendMessage:function(t){W("Send Message","message:"+(t=JSON.stringify(t)),y[i].iframe,i)}}))}function B(t,n){null===g&&(g=setTimeout(function(){g=null,t()},n))}function U(t){E("window","Trigger event: "+t),B(function(){H("Window "+t,"resize")},16)}function G(){"hidden"!==document.visibilityState&&(E("document","Trigger event: Visiblity change"),B(function(){H("Tab Visable","resize")},16))}function H(t,n){function e(t){return y[t]&&"parent"===y[t].resizeFrom&&y[t].autoResize&&!y[t].firstRun}for(var r in y)e(r)&&W(t,n,document.getElementById(r),r)}function q(){function t(t,e){e&&(!function(){if(!e.tagName)throw new TypeError("Object is not a valid DOM element");if("IFRAME"!==e.tagName.toUpperCase())throw new TypeError("Expected <IFRAME> tag, found <"+e.tagName+">")}(),V(e,t),n.push(e))}var n;return function(){var t,n=["moz","webkit","o","ms"];for(t=0;t<n.length&&!d;t+=1)d=window[n[t]+"RequestAnimationFrame"];d||E("setup","RequestAnimationFrame not supported")}(),x(window,"message",F),x(window,"resize",function(){U("resize")}),x(document,"visibilitychange",G),x(document,"-webkit-visibilitychange",G),x(window,"focusin",function(){U("focus")}),x(window,"focus",function(){U("focus")}),function(r,o){switch(n=[],function(t){t&&t.enablePublicMethods&&P("enablePublicMethods option has been removed, public methods are now always available in the iFrame")}(r),typeof o){case"undefined":case"string":Array.prototype.forEach.call(document.querySelectorAll(o||"iframe"),t.bind(e,r));break;case"object":t(r,o);break;default:throw new TypeError("Unexpected data type ("+typeof o+")")}return n}}}()},function(t,n,e){!function(n){"use strict";if("undefined"!=typeof window){var e=!0,r=10,o="",i=0,u="",a=null,c="",f=!1,s={resize:1,click:1},l=128,p=!0,h=1,d="bodyOffset",v=d,y=!0,g="",m={},b=32,w=null,x=!1,S="[iFrameSizer]",_=S.length,O="",E={max:1,min:1,bodyScroll:1,documentElementScroll:1},M="child",P=!0,T=window.parent,F="*",I=0,j=!1,A=null,k=16,N=1,R="scroll",L=R,C=window,z=function(){ct("MessageCallback function not defined")},W=function(){},D=function(){},V={height:function(){return ct("Custom height calculation function not defined"),document.documentElement.offsetHeight},width:function(){return ct("Custom width calculation function not defined"),document.body.scrollWidth}},B={},U=!1;try{var G=Object.create({},{passive:{get:function(){U=!0}},once:{get:function(){!0}}});window.addEventListener("test",et,G),window.removeEventListener("test",et,G)}catch(t){}var H,q,Y,J,K,X,$,Q=Date.now||function(){return(new Date).getTime()},Z={bodyOffset:function(){return document.body.offsetHeight+bt("marginTop")+bt("marginBottom")},offset:function(){return Z.bodyOffset()},bodyScroll:function(){return document.body.scrollHeight},custom:function(){return V.height()},documentElementOffset:function(){return document.documentElement.offsetHeight},documentElementScroll:function(){return document.documentElement.scrollHeight},max:function(){return Math.max.apply(null,xt(Z))},min:function(){return Math.min.apply(null,xt(Z))},grow:function(){return Z.max()},lowestElement:function(){return Math.max(Z.bodyOffset()||Z.documentElementOffset(),wt("bottom",_t()))},taggedElement:function(){return St("bottom","data-iframe-height")}},tt={bodyScroll:function(){return document.body.scrollWidth},bodyOffset:function(){return document.body.offsetWidth},custom:function(){return V.width()},documentElementScroll:function(){return document.documentElement.scrollWidth},documentElementOffset:function(){return document.documentElement.offsetWidth},scroll:function(){return Math.max(tt.bodyScroll(),tt.documentElementScroll())},max:function(){return Math.max.apply(null,xt(tt))},min:function(){return Math.min.apply(null,xt(tt))},rightMostElement:function(){return wt("right",_t())},taggedElement:function(){return St("right","data-iframe-width")}},nt=(H=Ot,K=null,X=0,$=function(){X=Q(),K=null,J=H.apply(q,Y),K||(q=Y=null)},function(){var t=Q();X||(X=t);var n=k-(t-X);return q=this,Y=arguments,n<=0||n>k?(K&&(clearTimeout(K),K=null),X=t,J=H.apply(q,Y),K||(q=Y=null)):K||(K=setTimeout($,n)),J});rt(window,"message",It),rt(window,"readystatechange",jt),jt()}function et(){}function rt(t,n,e,r){"addEventListener"in window?t.addEventListener(n,e,!!U&&(r||{})):"attachEvent"in window&&t.attachEvent("on"+n,e)}function ot(t,n,e){"removeEventListener"in window?t.removeEventListener(n,e,!1):"detachEvent"in window&&t.detachEvent("on"+n,e)}function it(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ut(t){return S+"["+O+"] "+t}function at(t){x&&"object"==typeof window.console&&console.log(ut(t))}function ct(t){"object"==typeof window.console&&console.warn(ut(t))}function ft(){var t;!function(){function t(t){return"true"===t}var r=g.substr(_).split(":");O=r[0],i=n!==r[1]?Number(r[1]):i,f=n!==r[2]?t(r[2]):f,x=n!==r[3]?t(r[3]):x,b=n!==r[4]?Number(r[4]):b,e=n!==r[6]?t(r[6]):e,u=r[7],v=n!==r[8]?r[8]:v,o=r[9],c=r[10],I=n!==r[11]?Number(r[11]):I,m.enable=n!==r[12]&&t(r[12]),M=n!==r[13]?r[13]:M,L=n!==r[14]?r[14]:L}(),at("Initialising iFrame ("+location.href+")"),function(){function t(t,n){return"function"==typeof t&&(at("Setup custom "+n+"CalcMethod"),V[n]=t,t="custom"),t}"iFrameResizer"in window&&Object===window.iFrameResizer.constructor&&(n=window.iFrameResizer,at("Reading data from page: "+JSON.stringify(n)),z="messageCallback"in n?n.messageCallback:z,W="readyCallback"in n?n.readyCallback:W,F="targetOrigin"in n?n.targetOrigin:F,v="heightCalculationMethod"in n?n.heightCalculationMethod:v,L="widthCalculationMethod"in n?n.widthCalculationMethod:L,v=t(v,"height"),L=t(L,"width"));var n;at("TargetOrigin for parent set to: "+F)}(),function(){n===u&&(u=i+"px");st("margin",function(t,n){-1!==n.indexOf("-")&&(ct("Negative CSS value ignored for "+t),n="");return n}("margin",u))}(),st("background",o),st("padding",c),(t=document.createElement("div")).style.clear="both",t.style.display="block",document.body.appendChild(t),dt(),vt(),document.documentElement.style.height="",document.body.style.height="",at('HTML & body height set to "auto"'),at("Enable public methods"),C.parentIFrame={autoResize:function(t){return!0===t&&!1===e?(e=!0,yt()):!1===t&&!0===e&&(e=!1,gt()),e},close:function(){Ft(0,0,"close"),at("Disable outgoing messages"),P=!1,at("Remove event listener: Message"),ot(window,"message",It),!0===e&>()},getId:function(){return O},getPageInfo:function(t){"function"==typeof t?(D=t,Ft(0,0,"pageInfo")):(D=function(){},Ft(0,0,"pageInfoStop"))},moveToAnchor:function(t){m.findTarget(t)},reset:function(){Tt("parentIFrame.reset")},scrollTo:function(t,n){Ft(n,t,"scrollTo")},scrollToOffset:function(t,n){Ft(n,t,"scrollToOffset")},sendMessage:function(t,n){Ft(0,0,"message",JSON.stringify(t),n)},setHeightCalculationMethod:function(t){v=t,dt()},setWidthCalculationMethod:function(t){L=t,vt()},setTargetOrigin:function(t){at("Set targetOrigin: "+t),F=t},size:function(t,n){var e=(t||"")+(n?","+n:"");Et("size","parentIFrame.size("+e+")",t,n)}},yt(),m=function(){function t(t){var e=t.getBoundingClientRect(),r={x:window.pageXOffset!==n?window.pageXOffset:document.documentElement.scrollLeft,y:window.pageYOffset!==n?window.pageYOffset:document.documentElement.scrollTop};return{x:parseInt(e.left,10)+parseInt(r.x,10),y:parseInt(e.top,10)+parseInt(r.y,10)}}function e(e){var r=e.split("#")[1]||e,o=decodeURIComponent(r),i=document.getElementById(o)||document.getElementsByName(o)[0];n!==i?function(n){var e=t(n);at("Moving to in page link (#"+r+") at x: "+e.x+" y: "+e.y),Ft(e.y,e.x,"scrollToOffset")}(i):(at("In page link (#"+r+") not found in iFrame, so sending to parent"),Ft(0,0,"inPageLink","#"+r))}function r(){""!==location.hash&&"#"!==location.hash&&e(location.href)}m.enable?Array.prototype.forEach&&document.querySelectorAll?(at("Setting up location.hash handlers"),Array.prototype.forEach.call(document.querySelectorAll('a[href^="#"]'),function(t){"#"!==t.getAttribute("href")&&rt(t,"click",function(t){t.preventDefault(),e(this.getAttribute("href"))})}),rt(window,"hashchange",r),setTimeout(r,l)):ct("In page linking not fully supported in this browser! (See README.md for IE8 workaround)"):at("In page linking not enabled");return{findTarget:e}}(),Et("init","Init message from host page"),W()}function st(t,e){n!==e&&""!==e&&"null"!==e&&(document.body.style[t]=e,at("Body "+t+' set to "'+e+'"'))}function lt(t){var n={add:function(n){function e(){Et(t.eventName,t.eventType)}B[n]=e,rt(window,n,e,{passive:!0})},remove:function(t){var n=B[t];delete B[t],ot(window,t,n)}};t.eventNames&&Array.prototype.map?(t.eventName=t.eventNames[0],t.eventNames.map(n[t.method])):n[t.method](t.eventName),at(it(t.method)+" event listener: "+t.eventType)}function pt(t){lt({method:t,eventType:"Animation Start",eventNames:["animationstart","webkitAnimationStart"]}),lt({method:t,eventType:"Animation Iteration",eventNames:["animationiteration","webkitAnimationIteration"]}),lt({method:t,eventType:"Animation End",eventNames:["animationend","webkitAnimationEnd"]}),lt({method:t,eventType:"Input",eventName:"input"}),lt({method:t,eventType:"Mouse Up",eventName:"mouseup"}),lt({method:t,eventType:"Mouse Down",eventName:"mousedown"}),lt({method:t,eventType:"Orientation Change",eventName:"orientationchange"}),lt({method:t,eventType:"Print",eventName:["afterprint","beforeprint"]}),lt({method:t,eventType:"Ready State Change",eventName:"readystatechange"}),lt({method:t,eventType:"Touch Start",eventName:"touchstart"}),lt({method:t,eventType:"Touch End",eventName:"touchend"}),lt({method:t,eventType:"Touch Cancel",eventName:"touchcancel"}),lt({method:t,eventType:"Transition Start",eventNames:["transitionstart","webkitTransitionStart","MSTransitionStart","oTransitionStart","otransitionstart"]}),lt({method:t,eventType:"Transition Iteration",eventNames:["transitioniteration","webkitTransitionIteration","MSTransitionIteration","oTransitionIteration","otransitioniteration"]}),lt({method:t,eventType:"Transition End",eventNames:["transitionend","webkitTransitionEnd","MSTransitionEnd","oTransitionEnd","otransitionend"]}),"child"===M&<({method:t,eventType:"IFrame Resized",eventName:"resize"})}function ht(t,n,e,r){return n!==t&&(t in e||(ct(t+" is not a valid option for "+r+"CalculationMethod."),t=n),at(r+' calculation method set to "'+t+'"')),t}function dt(){v=ht(v,d,Z,"height")}function vt(){L=ht(L,R,tt,"width")}function yt(){var t;!0===e?(pt("add"),t=0>b,window.MutationObserver||window.WebKitMutationObserver?t?mt():a=function(){function t(t){function n(t){!1===t.complete&&(at("Attach listeners to "+t.src),t.addEventListener("load",o,!1),t.addEventListener("error",i,!1),c.push(t))}"attributes"===t.type&&"src"===t.attributeName?n(t.target):"childList"===t.type&&Array.prototype.forEach.call(t.target.querySelectorAll("img"),n)}function e(t){at("Remove listeners from "+t.src),t.removeEventListener("load",o,!1),t.removeEventListener("error",i,!1),function(t){c.splice(c.indexOf(t),1)}(t)}function r(t,r,o){e(t.target),Et(r,o+": "+t.target.src,n,n)}function o(t){r(t,"imageLoad","Image loaded")}function i(t){r(t,"imageLoadFailed","Image load failed")}function u(n){Et("mutationObserver","mutationObserver: "+n[0].target+" "+n[0].type),n.forEach(t)}var a,c=[],f=window.MutationObserver||window.WebKitMutationObserver,s=(a=document.querySelector("body"),s=new f(u),at("Create body MutationObserver"),s.observe(a,{attributes:!0,attributeOldValue:!1,characterData:!0,characterDataOldValue:!1,childList:!0,subtree:!0}),s);return{disconnect:function(){"disconnect"in s&&(at("Disconnect body MutationObserver"),s.disconnect(),c.forEach(e))}}}():(at("MutationObserver not supported in this browser!"),mt())):at("Auto Resize disabled")}function gt(){pt("remove"),null!==a&&a.disconnect(),clearInterval(w)}function mt(){0!==b&&(at("setInterval: "+b+"ms"),w=setInterval(function(){Et("interval","setInterval: "+b)},Math.abs(b)))}function bt(t,n){var e=0;return n=n||document.body,e="defaultView"in document&&"getComputedStyle"in document.defaultView?null!==(e=document.defaultView.getComputedStyle(n,null))?e[t]:0:function(t){if(/^\d+(px)?$/i.test(t))return parseInt(t,r);var e=n.style.left,o=n.runtimeStyle.left;return n.runtimeStyle.left=n.currentStyle.left,n.style.left=t||0,t=n.style.pixelLeft,n.style.left=e,n.runtimeStyle.left=o,t}(n.currentStyle[t]),parseInt(e,r)}function wt(t,n){for(var e=n.length,r=0,o=0,i=it(t),u=Q(),a=0;a<e;a++)(r=n[a].getBoundingClientRect()[t]+bt("margin"+i,n[a]))>o&&(o=r);return u=Q()-u,at("Parsed "+e+" HTML elements"),at("Element position calculated in "+u+"ms"),function(t){t>k/2&&at("Event throttle increased to "+(k=2*t)+"ms")}(u),o}function xt(t){return[t.bodyOffset(),t.bodyScroll(),t.documentElementOffset(),t.documentElementScroll()]}function St(t,n){var e=document.querySelectorAll("["+n+"]");return 0===e.length&&(ct("No tagged elements ("+n+") found on page"),document.querySelectorAll("body *")),wt(t,e)}function _t(){return document.querySelectorAll("body *")}function Ot(t,e,r,o){var i,u;!function(){function t(t,n){return!(Math.abs(t-n)<=I)}return i=n!==r?r:Z[v](),u=n!==o?o:tt[L](),t(h,i)||f&&t(N,u)}()&&"init"!==t?t in{init:1,interval:1,size:1}||!(v in E||f&&L in E)?t in{interval:1}||at("No change in size detected"):Tt(e):(Mt(),Ft(h=i,N=u,t))}function Et(t,n,e,r){j&&t in s?at("Trigger event cancelled: "+t):(t in{reset:1,resetPage:1,init:1}||at("Trigger event: "+n),"init"===t?Ot(t,n,e,r):nt(t,n,e,r))}function Mt(){j||(j=!0,at("Trigger event lock on")),clearTimeout(A),A=setTimeout(function(){j=!1,at("Trigger event lock off"),at("--")},l)}function Pt(t){h=Z[v](),N=tt[L](),Ft(h,N,t)}function Tt(t){var n=v;v=d,at("Reset trigger event: "+t),Mt(),Pt("reset"),v=n}function Ft(t,e,r,o,i){var u;!0===P&&(n===i?i=F:at("Message targetOrigin: "+i),at("Sending message to host page ("+(u=O+":"+t+":"+e+":"+r+(n!==o?":"+o:""))+")"),T.postMessage(S+u,i))}function It(n){var e={init:function(){g=n.data,T=n.source,ft(),p=!1,setTimeout(function(){y=!1},l)},reset:function(){y?at("Page reset ignored by init"):(at("Page size reset by host page"),Pt("resetPage"))},resize:function(){Et("resizeParent","Parent window requested size check")},moveToAnchor:function(){m.findTarget(o())},inPageLink:function(){this.moveToAnchor()},pageInfo:function(){var t=o();at("PageInfoFromParent called from parent: "+t),D(JSON.parse(t)),at(" --")},message:function(){var t=o();at("MessageCallback called from parent: "+t),z(JSON.parse(t)),at(" --")}};function r(){return n.data.split("]")[1].split(":")[0]}function o(){return n.data.substr(n.data.indexOf(":")+1)}function i(){return n.data.split(":")[2]in{true:1,false:1}}function u(){var o=r();o in e?e[o]():!t.exports&&"iFrameResize"in window||"jQuery"in window&&"iFrameResize"in window.jQuery.prototype||i()||ct("Unexpected message ("+n.data+")")}S===(""+n.data).substr(0,_)&&(!1===p?u():i()?e.init():at('Ignored message of type "'+r()+'". Received before initialization.'))}function jt(){"loading"!==document.readyState&&window.parent.postMessage("[iFrameResizerChild]Ready","*")}}()}]);
|
assets/admin/js/mce-dropdown.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=
|
2 |
/*!
|
3 |
* Name : Visual Portfolio
|
4 |
-
* Version : 1.
|
5 |
* Author : nK https://nkdev.info
|
6 |
*/
|
7 |
var n=window,o=n.tinymce,i=n.VPTinyMCEOptions;if(void 0!==i&&i.length){var r=[{text:"",value:""}];Object.keys(i).forEach(function(t){r.push({text:i[t].title,value:i[t].id})}),o.create("tinymce.plugins.visual_portfolio",{init:function(t){t.addButton("visual_portfolio",{type:"listbox",title:"Visual Portfolio",icon:"visual-portfolio",classes:"visual-portfolio-btn",onclick:function(){this.menu&&this.menu.$el.find(".mce-first").hide()},onselect:function(){this.value()&&t.insertContent('[visual_portfolio id="'.concat(this.value(),'"]')),this.value("")},values:r,value:""})}}),o.PluginManager.add("visual_portfolio",o.plugins.visual_portfolio)}}});
|
1 |
+
!function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=171)}({171:function(t,e,n){t.exports=n(172)},172:function(t,e){
|
2 |
/*!
|
3 |
* Name : Visual Portfolio
|
4 |
+
* Version : 1.11.0
|
5 |
* Author : nK https://nkdev.info
|
6 |
*/
|
7 |
var n=window,o=n.tinymce,i=n.VPTinyMCEOptions;if(void 0!==i&&i.length){var r=[{text:"",value:""}];Object.keys(i).forEach(function(t){r.push({text:i[t].title,value:i[t].id})}),o.create("tinymce.plugins.visual_portfolio",{init:function(t){t.addButton("visual_portfolio",{type:"listbox",title:"Visual Portfolio",icon:"visual-portfolio",classes:"visual-portfolio-btn",onclick:function(){this.menu&&this.menu.$el.find(".mce-first").hide()},onselect:function(){this.value()&&t.insertContent('[visual_portfolio id="'.concat(this.value(),'"]')),this.value("")},values:r,value:""})}}),o.PluginManager.add("visual_portfolio",o.plugins.visual_portfolio)}}});
|
assets/admin/js/mce-localize.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=173)}({173:function(e,t,n){e.exports=n(174)},174:function(e,t){}});
|
assets/admin/js/script.min.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
-
!function(t){var e={};function a(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)a.d(n,i,function(e){return t[e]}.bind(null,i));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=
|
2 |
/*!
|
3 |
* Name : Visual Portfolio
|
4 |
-
* Version : 1.
|
5 |
* Author : nK https://nkdev.info
|
6 |
-
*/(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var r=jQuery,l=window,c=l.ajaxurl,s=l.VPAdminVariables,d=l.Tooltip,p=l.CodeMirror,v=l.emmetCodeMirror,u=r("body"),f=r(window),m=r('form[name="post"]'),g=r('[name="post_type"]'),h=r("#postID, #post_ID").eq(0).val();u.on("focus",'[name="vp_list_shortcode"], [name="vp_filter_shortcode"]',function(){this.select()}),u.on("click",".vp-onclick-selection",function(){window.getSelection().selectAllChildren(this)});var _=r("#vp_format_video"),y=r("#post-format-video");function b(){_[y.is(":checked")?"show":"hide"]()}_.length&&y.length&&(b(),u.on("change","[name=post_format]",function(){b()}));var w=null;function k(t){w=r.ajax({url:c,method:"GET",dataType:"json",data:{action:"vp_find_oembed",q:t.val(),nonce:s.nonce},complete:function(e){var a=e.responseJSON;a&&void 0!==a.html&&t.next(".vp-oembed-preview").html(a.html)}})}function C(){var t=r('[name="vp_popup_gallery[show_caption]"]');t.closest("tbody").find("tr.caption_title, tr.caption_description")[t.is(":checked")?"show":"hide"]()}k=Object(n.a)(300,k),u.on("change input",'.vp-input[name="video_url"]',function(){null!==w&&w.abort();var t=r(this);t.next(".vp-oembed-preview").html(""),k(t)}),void 0!==d&&r('[data-hint]:not([data-hint=""]):not([data-hint="false"])').each(function(){var t=r(this);new d(this,{placement:t.attr("data-hint-place")||"top",title:t.attr("data-hint"),container:r("body")[0],boundariesElement:"viewport"})}),function(){if("vp_lists"===g.val()&&m.length){var t=r(".vp-content-source"),e=t.find('[name="vp_content_source"]');t.on("click",".vp-content-source__item",function(){var a=r(this).attr("data-content");t.find('[data-content="'.concat(a,'"]')).addClass("active").siblings().removeClass("active"),e.val(a).change()}),t.children('[data-content="'.concat(e.val(),'"]')).click(),r.fn.conditionize&&m.conditionize(),r(".vp-control-range").each(function(){var t=r(this).find("input"),e=t.filter('[type="hidden"]');t.on("change input",function(a){t.val(r(this).val()),e.trigger("vp-fake-".concat(a.type))})}),r.fn.wpColorPicker&&r(".vp-color-picker").each(function(){r(this).data("change",Object(n.a)(300,function(t){r(t.target).change()})).wpColorPicker()}),r.fn.imagepicker&&r(".vp-image-picker").imagepicker();var a=r(".vp_list_preview iframe"),l=!1,d=!1,_=r('<form target="vp_list_preview_iframe" method="post" style="display: none">').attr("action",a.attr("src")).insertAfter(m);r.fn.iFrameResize&&a.iFrameResize({interval:10}),I=Object(n.a)(400,I),m.on("change input vp-fake-change vp-fake-input",'[name*="vp_"]',function(t){var e=r(this);if(!e.closest(".vp-no-reload").length)if(r('[name="'.concat(e.attr("name"),'__style[]"]')).length)D();else{var a={name:e.attr("name"),value:e.is("[type=checkbox], [type=radio]")?e.is(":checked"):e.val(),reload:"change"===t.type||"vp-fake-change"===t.type,jQuery:d,$portfolio:l},n=_.find('[name="'.concat(a.name,'"]'));n.length||(n=r('<input type="hidden" name="'.concat(a.name,'" />')).appendTo(_)),n.attr("value",a.value),f.trigger("vp-preview-change",a),a.reload||D(),!a.reload&&l||I()}}),a.on("load",function(){d=this.contentWindow.jQuery,l=d(".vp-portfolio"),D()}),f.on("vp-preview-change",function(t,e){if(e.$portfolio)switch(e.name){case"vp_layout":case"vp_tiles_type":case"vp_masonry_columns":case"vp_grid_columns":case"vp_justified_row_height":case"vp_justified_row_height_tolerance":case"vp_slider_effect":case"vp_slider_speed":case"vp_slider_autoplay":case"vp_slider_autoplay_hover_pause":case"vp_slider_centered_slides":case"vp_slider_loop":case"vp_slider_free_mode":case"vp_slider_free_mode_sticky":case"vp_slider_arrows":case"vp_slider_arrows_icon_prev":case"vp_slider_arrows_icon_next":case"vp_slider_bullets":case"vp_slider_bullets_dynamic":case"vp_items_gap":var a=e.name;a=(a=a.substring(3)).replace(/_/g,"-"),e.$portfolio.attr("data-vp-".concat(a),e.value),e.$portfolio.vpf("init"),e.reload=!1;break;case"vp_filter_align":e.$portfolio.find(".vp-filter").removeClass("vp-filter__align-center vp-filter__align-left vp-filter__align-right").addClass("vp-filter__align-".concat(e.value)),e.reload=!1;break;case"vp_pagination_align":e.$portfolio.find(".vp-pagination").removeClass("vp-pagination__align-center vp-pagination__align-left vp-pagination__align-right").addClass("vp-pagination__align-".concat(e.value)),e.reload=!1;break;case"vp_controls_styles":var n=e.$portfolio.closest("html"),i="vp-controls-styles-".concat(h,"-inline-css"),o=n.find("#".concat(i));o.length||(o=e.jQuery('<style id="'.concat(i,'">')),n.find("body").prepend(o)),o.html(e.value),e.reload=!1;break;case"vp_custom_css":var r=e.$portfolio.closest("html"),l="vp-custom-css-".concat(h,"-inline-css"),c=r.find("#".concat(l));c.length||(c=e.jQuery('<style id="'.concat(l,'">')),r.find("body").prepend(c)),c.html(e.value),e.reload=!1;break;case"vp_list_name":case"vp_stretch":e.reload=!1}}),u.on("click",".vp-control-image-dropdown",function(t){r(t.target).closest(".vp-control-image-dropdown__content").length||r(this).toggleClass("active")}),u.on("mousedown",function(t){var e=r(t.target).closest(".vp-control-image-dropdown");r(".vp-control-image-dropdown.active").each(function(){this!==e[0]&&r(this).removeClass("active")})}),u.on("change",".vp-control-image-dropdown .vp-image-picker",function(){var t=r(this),e=t.data("picker");if(e){var a=e.select.find('option[value="'.concat(e.select.val(),'"]')),n=a.parent("optgroup"),i=t.closest(".vp-control-image-dropdown"),o=a.attr("data-img-src");i.length&&(i.children(".vp-control-image-dropdown__preview").html('<img src="'.concat(o,'" alt="">')),n.length&&i.children(".vp-control-image-dropdown__title").html(n.attr("label")))}});var y=r('[name="vp_list_name"]'),b=r('[name="post_title"]');y.length&&b.length&&(y.on("input",function(){b.val()!==y.val()&&b.val(y.val()).change()}),b.on("input",function(){y.val(b.val())})),r.fn.select2&&r(".vp-select2").each(function(){var t=r(this),e={width:"100%",minimumResultsForSearch:t.hasClass("vp-select2-nosearch")?-1:1,tags:t.hasClass("vp-select2-tags")},a=!!t.attr("data-post-type")&&r(t.attr("data-post-type"));t.closest(".vp-select2-posts-ajax").length&&(e=r.extend({minimumInputLength:1,ajax:{url:c,dataType:"json",delay:250,data:function(t){return{action:"vp_find_posts",q:t.term,post_type:!!a&&a.val(),nonce:s.nonce}},processResults:function(t){return{results:!(!t||!t.length)&&t}},cache:!0},escapeMarkup:function(t){return t},templateResult:function(t){if(t.loading)return t.text;var e="";t.title&&(e=t.title);var a="";t.post_type&&(a=t.post_type);var n="";return t.img&&(n="style=\"background-image: url('".concat(t.img,"');\"")),"".concat('<div class="vp-select2-ajax__result"><div class="vp-select2-ajax__result-img" ').concat(n,"></div>")+'<div class="vp-select2-ajax__result-data">'+'<div class="vp-select2-ajax__result-title">'.concat(e,"</div>")+'<div class="vp-select2-ajax__result-post-type">'.concat(a,"</div>")+"</div></div>"},templateSelection:function(t){return t.title||t.text}},e)),t.closest(".vp-select2-taxonomies-ajax").length&&(e=r.extend({minimumInputLength:1,ajax:{url:c,dataType:"json",delay:250,data:function(t){return{action:"vp_find_taxonomies",q:t.term,post_type:!!a&&a.val(),nonce:s.nonce}},processResults:function(t){var e=[];return t&&Object.keys(t).forEach(function(a){e.push({text:a,children:t[a]})}),{results:e}},cache:!0}},e)),t.select2(e).data("select2").$dropdown.addClass("select2-vp-container")});var w=r(".vp-control-gallery"),k=0;if(r.fn.sortable&&(w.each(function(){var t=r(this),e=t.children(".vp-control-gallery-items-default");t.children(".vp-control-gallery-items").sortable({animation:150,draggable:".vp-control-gallery-items-img",onUpdate:function(){Q(t)}}),t.on("click",".vp-control-gallery-items-remove",function(e){e.preventDefault(),r(this).parent().remove(),Q(t)}),t.on("click",".vp-control-gallery-items-add",function(a){a.preventDefault();var n=t.data("wp-frame");n?n.open():wp.media?(n=wp.media({title:"Select or Upload Images",button:{text:"Add images"},multiple:!0,library:{type:"image"}}),t.data("wp-frame",n),n.on("select",function(){var a=n.state().get("selection").models;a&&a.length&&(a.forEach(function(a){var n=a.attributes.url;a.attributes.sizes&&a.attributes.sizes.thumbnail&&(n=a.attributes.sizes.thumbnail.url);var i=e.children().clone();i.attr("data-image-id",a.id),i.children("img").attr("src",n),i.find('[data-meta="width"]').html(a.attributes.width),i.find('[data-meta="height"]').html(a.attributes.height),i.find('[data-meta="filename"]').html(a.attributes.filename),i.find('[data-meta="editLink"]').html(a.attributes.editLink),i.find('[data-meta="filesizeHumanReadable"]').html(a.attributes.filesizeHumanReadable),a.attributes.title&&i.find('[data-additional="title"]').html(a.attributes.title),a.attributes.description&&i.find('[data-additional="description"]').html(a.attributes.description),t.find(".vp-control-gallery-items-add").before(i)}),Q(t))}),n.open()):console.error("Can't access wp.media object.")}),t.on("click",".vp-control-gallery-items-img",function(e){e.preventDefault(),U(t,r(this).attr("data-image-id"))}),t.on("change input",".vp-control-gallery-additional-data [name]",Object(n.a)(200,function(){var e=t.children(".vp-control-gallery-additional-data"),a=t.children("textarea").attr("name"),n=t.children(".vp-control-gallery-items").find(".vp-control-gallery-items-img.active").attr("data-image-id");if(n){var o=t.children(".vp-control-gallery-items").find('[data-image-id="'+n+'"]');e.find('[name*="'+a+'_additional_"]').each(function(){var t=r(this).attr("name").replace(a+"_additional_","").replace("[]",""),e=r(this).val()||"";"object"===i(e)&&(e=JSON.stringify(e)),o.find('[data-additional="'+t+'"]').html(e||"")}),Q(t)}}))}),w.length)){var C=w.children(".vp-control-gallery-additional-data");r(document).on("mousedown",function(t){if(k){var e=t.target;r(e).closest(".vp-control-gallery-additional-data, .vp-control-gallery-items-img, .select2-vp-container").length||(C.removeClass("active"),w.children(".vp-control-gallery-items").find(".vp-control-gallery-items-img.active").removeClass("active"),k=w.find(".vp-control-gallery-additional-data.active").length)}})}var x=r('[name="vp_custom_css"]'),j=!1,S=!0;if(void 0!==p&&x.length){var O=function(t){$.css("height",Math.max(200,M+t.originalEvent.y-A)),z.setSize(null,Math.max(200,M+t.y-A)+"px")},E=function t(){u.off("mousemove",O),u.off("mouseup",t)};if(s&&s.classnames){var T=p.hint.css;p.hint.css=function(t){var e=t.getCursor(),a=T(t)||{from:e,to:t.getCursor(),list:[]},n=t.getTokenAt(e);return"top"===n.state.state&&0===n.string.indexOf(".")&&(a={from:p.Pos(e.line,n.start),to:p.Pos(e.line,n.end),list:[]},s.classnames.forEach(function(t){-1!==t.indexOf(n.string)&&a.list.push(t)})),a}}var z=p.fromTextArea(x[0],{mode:"css",theme:"eclipse",indentUnit:4,autoCloseTags:!0,autoCloseBrackets:!0,matchBrackets:!0,foldGutter:!0,lint:{options:{errors:!0,"box-model":!0,"display-property-grouping":!0,"duplicate-properties":!0,"known-properties":!0,"outline-none":!0},onUpdateLinting:function(t,e,a){var n=[];t.forEach(function(t){"error"===t.severity&&n.push(t)}),a.vcLintErrors=n,j||q(a.vcLintErrors,!0)}},lineNumbers:!0,lineWrapping:!0,scrollPastEnd:!0,emmet_active:!0,emmet:!0,styleActiveLine:!0,continueComments:!0,scrollbarStyle:"simple",extraKeys:{"Ctrl-Space":"autocomplete","Ctrl-/":"toggleComment","Cmd-/":"toggleComment","Alt-F":"findPersistent"},gutters:["CodeMirror-lint-markers","CodeMirror-linenumbers","CodeMirror-foldgutter"]});v(z),x.data("CodeMirrorInstance",z),z.on("change",function(){z.save(),x.change()}),z.on("keyup",function(t,e){var a=/^[a-zA-Z]$/.test(e.key);if(!t.state.completionActive||!a){var n=t.getTokenAt(t.getCursor());if("string"!==n.type&&"comment"!==n.type){var i=t.doc.getLine(t.doc.getCursor().line).substr(0,t.doc.getCursor().ch);(a||":"===e.key||" "===e.key&&/:\s+$/.test(i))&&t.showHint({completeSingle:!1})}}});var A,M,L=r(".CodeMirror-resizer").after(x),$=L.prev(".CodeMirror");L.on("mousedown",function(t){A=t.originalEvent.y,M=$.height(),u.on("mousemove",O),u.on("mouseup",E)})}var P=!1;u.on("click","#publish:not(.disabled)",function(t){if(P=!0,!j){var e=r(this),a=x.length&&x.data("CodeMirrorInstance");a&&a.vcLintErrors&&a.vcLintErrors.length&&(t.preventDefault(),e.addClass("disabled button-disabled button-primary-disabled"),setTimeout(function(){e.removeClass("disabled button-disabled button-primary-disabled")},1500),q(a.vcLintErrors,!1),r("html,body").animate({scrollTop:r("#vp_custom_css").offset().top-100},300),a.focus(),a.setCursor(a.vcLintErrors[0].from.line))}});var R=m.serialize();r(window).on("beforeunload",function(){if(!P)return R!==m.serialize()||void 0;P=!1}),u.on("change","#vp_custom_css_notice_prevent",function(){j=!0,r(this).closest(".notice").slideUp()})}function D(){var t="",e=r('[name="vp_controls_styles"]'),a=".vp-id-".concat(h),n=e.val();r('.vp-control-style [type="hidden"]').each(function(){var e=r(this),n=e.closest(".vp-control");if("none"!==n.css("display")){var i=(e.attr("data-style-mask")||"$").replace("$",n.find(e.attr("data-style-from")).val()),o=a+" "+e.attr("data-style-element"),l=e.attr("data-style-property");t&&(t+=" "),t+="".concat(o," { ").concat(l,": ").concat(i,"; }")}}),n!==t&&e.val(t).trigger("vp-fake-change")}function I(){d=!1,l=!1,_.submit()}function N(t,e){var a={id:e};return t.find('[data-image-id="'+e+'"]').find("[data-additional]").each(function(){var t=r(this),e=t.attr("data-additional");if(a[e]=t.html(),"true"===t.attr("data-to-json"))try{a[e]=JSON.parse(a[e])}catch(t){a[e]=""}}),a}function Q(t){var e=[];t.children(".vp-control-gallery-items").find(".vp-control-gallery-items-img").each(function(){e.push(N(t,r(this).attr("data-image-id")))});var a=JSON.stringify(e),n=t.children("textarea");a!==n.val()&&n.val(a).change()}function U(t,e){var a=t.children("textarea").attr("name"),n=t.children(".vp-control-gallery-additional-data"),i=n.children(".vp-control-gallery-additional-data-preview"),l=t.children(".vp-control-gallery-items").find('.vp-control-gallery-items-img[data-image-id="'+e+'"]'),c=N(t,e),s=function(t,e){var a={};return t.find('[data-image-id="'+e+'"]').find("[data-meta]").each(function(){a[r(this).attr("data-meta")]=r(this).html()}),a}(t,e);c&&Object.keys(c).forEach(function(e){var i=n.find('[name="'+a+"_additional_"+e+'"], [name="'+a+"_additional_"+e+'[]"]').val(c[e]||"");if(i.hasClass("vp-select2")){if(i.hasClass("vp-select2-tags")){var l=[],s=[];t.children(".vp-control-gallery-items").find(".vp-control-gallery-items-img").each(function(){var a=N(t,r(this).attr("data-image-id"));a&&void 0!==a[e]&&a[e]&&(l=o(new Set(o(l).concat(o(a[e])))))}),l.forEach(function(t){s.push(new window.Option(t,t,!1,!1))}),i.html(s.length?s:""),i.val(void 0!==c[e]&&c[e]?c[e]:"")}i.trigger("change")}}),i.find(".vp-control-gallery-additional-data-preview-image img").attr("src",l.children("img").attr("src")||""),i.find(".vp-control-gallery-additional-data-preview-name").html(s.filename),i.find(".vp-control-gallery-additional-data-preview-size").html(s.width+"x"+s.height+" ("+s.filesizeHumanReadable+")"),i.find(".vp-control-gallery-additional-data-preview-edit a").attr("href",s.editLink.replace("&","&")),l.siblings().removeClass("active"),l.addClass("active"),n.addClass("active"),k=w.find(".vp-control-gallery-additional-data.active").length}function q(t,e){if(S&&(e=!1,S=!1),s&&s.css_editor_error_notice){var a=!1;if(1===t.length?a=s.css_editor_error_notice.singular.replace("%d","1"):t.length>1&&(a=s.css_editor_error_notice.plural.replace("%d",String(t.length))),a){var n=x.prev("#vp_custom_css_notice");if(n.length||e||(n=r('<div class="notice notice-error inline" id="vp_custom_css_notice"></div>'),x.before(n)),!n.length)return;var i='<p class="notification-message">'.concat(a,"</p>")+'<p><input id="vp_custom_css_notice_prevent" type="checkbox">'+'<label for="vp_custom_css_notice_prevent">'.concat(s.css_editor_error_checkbox,"</label>")+"</p>";n.html(i)}else x.prev("#vp_custom_css_notice").remove()}}}(),u.hasClass("portfolio_page_visual-portfolio-settings")&&(u.on("change",'[name="vp_popup_gallery[show_caption]"]',C),f.on("ready",C),C())},30:function(t,e,a){"use strict";function n(t,e,a,n){var i,o=0;return"boolean"!=typeof e&&(n=a,a=e,e=void 0),function(){var r=this,l=Number(new Date)-o,c=arguments;function s(){o=Number(new Date),a.apply(r,c)}n&&!i&&s(),i&&clearTimeout(i),void 0===n&&l>t?s():!0!==e&&(i=setTimeout(n?function(){i=void 0}:s,void 0===n?t-l:t))}}function i(t,e,a){return void 0===a?n(t,e,!1):n(t,a,!1!==e)}a.d(e,"b",function(){return n}),a.d(e,"a",function(){return i})}});
|
1 |
+
!function(t){var e={};function a(n){if(e[n])return e[n].exports;var i=e[n]={i:n,l:!1,exports:{}};return t[n].call(i.exports,i,i.exports,a),i.l=!0,i.exports}a.m=t,a.c=e,a.d=function(t,e,n){a.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:n})},a.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},a.t=function(t,e){if(1&e&&(t=a(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var n=Object.create(null);if(a.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)a.d(n,i,function(e){return t[e]}.bind(null,i));return n},a.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return a.d(e,"a",e),e},a.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},a.p="",a(a.s=175)}({175:function(t,e,a){t.exports=a(176)},176:function(t,e,a){"use strict";a.r(e);var n=a(30);function i(t){return(i="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t){return function(t){if(Array.isArray(t)){for(var e=0,a=new Array(t.length);e<t.length;e++)a[e]=t[e];return a}}
|
2 |
/*!
|
3 |
* Name : Visual Portfolio
|
4 |
+
* Version : 1.11.0
|
5 |
* Author : nK https://nkdev.info
|
6 |
+
*/(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}var r=jQuery,l=window,c=l.ajaxurl,s=l.VPAdminVariables,d=l.Tooltip,p=l.CodeMirror,v=l.emmetCodeMirror,u=r("body"),f=r(window),m=r('form[name="post"]'),g=r('[name="post_type"]'),h=r("#postID, #post_ID").eq(0).val();u.on("focus",'[name="vp_list_shortcode"], [name="vp_filter_shortcode"], [name="vp_sort_shortcode"]',function(){this.select()}),u.on("click",".vp-onclick-selection",function(){window.getSelection().selectAllChildren(this)});var _=r("#vp_format_video"),y=r("#post-format-video");function b(){_[y.is(":checked")?"show":"hide"]()}_.length&&y.length&&(b(),u.on("change","[name=post_format]",function(){b()}));var w=null;function k(t){w=r.ajax({url:c,method:"GET",dataType:"json",data:{action:"vp_find_oembed",q:t.val(),nonce:s.nonce},complete:function(e){var a=e.responseJSON;a&&void 0!==a.html&&t.next(".vp-oembed-preview").html(a.html)}})}k=Object(n.a)(300,k),u.on("change input",'.vp-input[name="video_url"]',function(){null!==w&&w.abort();var t=r(this);t.next(".vp-oembed-preview").html(""),k(t)}),void 0!==d&&r('[data-hint]:not([data-hint=""]):not([data-hint="false"])').each(function(){var t=r(this);new d(this,{placement:t.attr("data-hint-place")||"top",title:t.attr("data-hint"),container:r("body")[0],boundariesElement:"viewport"})}),function(){if("vp_lists"===g.val()&&m.length){var t=r(".vp-content-source"),e=t.find('[name="vp_content_source"]');t.on("click",".vp-content-source__item",function(){var a=r(this).attr("data-content");t.find('[data-content="'.concat(a,'"]')).addClass("active").siblings().removeClass("active"),e.val(a).change()}),t.children('[data-content="'.concat(e.val(),'"]')).click(),r.fn.conditionize&&m.conditionize(),r(".vp-control-range").each(function(){var t=r(this).find("input"),e=t.filter('[type="hidden"]');t.on("change input",function(a){t.val(r(this).val()),e.trigger("vp-fake-".concat(a.type))})}),r.fn.wpColorPicker&&r(".vp-color-picker").each(function(){r(this).data("change",Object(n.a)(300,function(t){r(t.target).change()})).wpColorPicker()}),r.fn.imagepicker&&r(".vp-image-picker").imagepicker();var a=r(".vp_list_preview iframe"),l=!1,d=!1,_=r('<form target="vp_list_preview_iframe" method="post" style="display: none">').attr("action",a.attr("src")).insertAfter(m);r.fn.iFrameResize&&a.iFrameResize({interval:10}),I=Object(n.a)(400,I),m.on("change input vp-fake-change vp-fake-input",'[name*="vp_"]',function(t){var e=r(this);if(!e.closest(".vp-no-reload").length)if(r('[name="'.concat(e.attr("name"),'__style[]"]')).length)D();else{var a={name:e.attr("name"),value:e.is("[type=checkbox], [type=radio]")?e.is(":checked"):e.val(),reload:"change"===t.type||"vp-fake-change"===t.type,jQuery:d,$portfolio:l},n=_.find('[name="'.concat(a.name,'"]'));n.length||(n=r('<input type="hidden" name="'.concat(a.name,'" />')).appendTo(_)),n.attr("value",a.value),f.trigger("vp-preview-change",a),a.reload||D(),!a.reload&&l||I()}}),a.on("load",function(){d=this.contentWindow.jQuery,l=d(".vp-portfolio"),D()}),f.on("vp-preview-change",function(t,e){if(e.$portfolio)switch(e.name){case"vp_layout":case"vp_tiles_type":case"vp_masonry_columns":case"vp_grid_columns":case"vp_justified_row_height":case"vp_justified_row_height_tolerance":case"vp_slider_effect":case"vp_slider_speed":case"vp_slider_autoplay":case"vp_slider_autoplay_hover_pause":case"vp_slider_centered_slides":case"vp_slider_loop":case"vp_slider_free_mode":case"vp_slider_free_mode_sticky":case"vp_slider_arrows":case"vp_slider_arrows_icon_prev":case"vp_slider_arrows_icon_next":case"vp_slider_bullets":case"vp_slider_bullets_dynamic":case"vp_items_gap":var a=e.name;a=(a=a.substring(3)).replace(/_/g,"-"),e.$portfolio.attr("data-vp-".concat(a),e.value),e.$portfolio.vpf("init"),e.reload=!1;break;case"vp_filter_align":e.$portfolio.find(".vp-filter").removeClass("vp-filter__align-center vp-filter__align-left vp-filter__align-right").addClass("vp-filter__align-".concat(e.value)),e.reload=!1;break;case"vp_sort_align":e.$portfolio.find(".vp-sort").removeClass("vp-sort__align-center vp-sort__align-left vp-sort__align-right").addClass("vp-sort__align-".concat(e.value)),e.reload=!1;break;case"vp_pagination_align":e.$portfolio.find(".vp-pagination").removeClass("vp-pagination__align-center vp-pagination__align-left vp-pagination__align-right").addClass("vp-pagination__align-".concat(e.value)),e.reload=!1;break;case"vp_controls_styles":var n=e.$portfolio.closest("html"),i="vp-controls-styles-".concat(h,"-inline-css"),o=n.find("#".concat(i));o.length||(o=e.jQuery('<style id="'.concat(i,'">')),n.find("body").prepend(o)),o.html(e.value),e.reload=!1;break;case"vp_custom_css":var r=e.$portfolio.closest("html"),l="vp-custom-css-".concat(h,"-inline-css"),c=r.find("#".concat(l));c.length||(c=e.jQuery('<style id="'.concat(l,'">')),r.find("body").prepend(c)),c.html(e.value),e.reload=!1;break;case"vp_list_name":case"vp_stretch":e.reload=!1}}),u.on("click",".vp-control-image-dropdown",function(t){r(t.target).closest(".vp-control-image-dropdown__content").length||r(this).toggleClass("active")}),u.on("mousedown",function(t){var e=r(t.target).closest(".vp-control-image-dropdown");r(".vp-control-image-dropdown.active").each(function(){this!==e[0]&&r(this).removeClass("active")})}),u.on("change",".vp-control-image-dropdown .vp-image-picker",function(){var t=r(this),e=t.data("picker");if(e){var a=e.select.find('option[value="'.concat(e.select.val(),'"]')),n=a.parent("optgroup"),i=t.closest(".vp-control-image-dropdown"),o=a.attr("data-img-src");i.length&&(i.children(".vp-control-image-dropdown__preview").html('<img src="'.concat(o,'" alt="">')),n.length&&i.children(".vp-control-image-dropdown__title").html(n.attr("label")))}});var y=r('[name="vp_list_name"]'),b=r('[name="post_title"]');y.length&&b.length&&(y.on("input",function(){b.val()!==y.val()&&b.val(y.val()).change()}),b.on("input",function(){y.val(b.val())})),r.fn.select2&&r(".vp-select2").each(function(){var t=r(this),e={width:"100%",minimumResultsForSearch:t.hasClass("vp-select2-nosearch")?-1:1,tags:t.hasClass("vp-select2-tags")},a=!!t.attr("data-post-type")&&r(t.attr("data-post-type"));t.closest(".vp-select2-posts-ajax").length&&(e=r.extend({minimumInputLength:1,ajax:{url:c,dataType:"json",delay:250,data:function(t){return{action:"vp_find_posts",q:t.term,post_type:!!a&&a.val(),nonce:s.nonce}},processResults:function(t){return{results:!(!t||!t.length)&&t}},cache:!0},escapeMarkup:function(t){return t},templateResult:function(t){if(t.loading)return t.text;var e="";t.title&&(e=t.title);var a="";t.post_type&&(a=t.post_type);var n="";return t.img&&(n="style=\"background-image: url('".concat(t.img,"');\"")),"".concat('<div class="vp-select2-ajax__result"><div class="vp-select2-ajax__result-img" ').concat(n,"></div>")+'<div class="vp-select2-ajax__result-data">'+'<div class="vp-select2-ajax__result-title">'.concat(e,"</div>")+'<div class="vp-select2-ajax__result-post-type">'.concat(a,"</div>")+"</div></div>"},templateSelection:function(t){return t.title||t.text}},e)),t.closest(".vp-select2-taxonomies-ajax").length&&(e=r.extend({minimumInputLength:1,ajax:{url:c,dataType:"json",delay:250,data:function(t){return{action:"vp_find_taxonomies",q:t.term,post_type:!!a&&a.val(),nonce:s.nonce}},processResults:function(t){var e=[];return t&&Object.keys(t).forEach(function(a){e.push({text:a,children:t[a]})}),{results:e}},cache:!0}},e)),t.select2(e).data("select2").$dropdown.addClass("select2-vp-container")});var w=r(".vp-control-gallery"),k=0;if(r.fn.sortable&&(w.each(function(){var t=r(this),e=t.children(".vp-control-gallery-items-default");t.children(".vp-control-gallery-items").sortable({animation:150,draggable:".vp-control-gallery-items-img",onUpdate:function(){Q(t)}}),t.on("click",".vp-control-gallery-items-remove",function(e){e.preventDefault(),r(this).parent().remove(),Q(t)}),t.on("click",".vp-control-gallery-items-add",function(a){a.preventDefault();var n=t.data("wp-frame");n?n.open():wp.media?(n=wp.media({title:"Select or Upload Images",button:{text:"Add images"},multiple:!0,library:{type:"image"}}),t.data("wp-frame",n),n.on("select",function(){var a=n.state().get("selection").models;a&&a.length&&(a.forEach(function(a){var n=a.attributes.url;a.attributes.sizes&&a.attributes.sizes.thumbnail&&(n=a.attributes.sizes.thumbnail.url);var i=e.children().clone();i.attr("data-image-id",a.id),i.children("img").attr("src",n),i.find('[data-meta="width"]').html(a.attributes.width),i.find('[data-meta="height"]').html(a.attributes.height),i.find('[data-meta="filename"]').html(a.attributes.filename),i.find('[data-meta="editLink"]').html(a.attributes.editLink),i.find('[data-meta="filesizeHumanReadable"]').html(a.attributes.filesizeHumanReadable),a.attributes.title&&i.find('[data-additional="title"]').html(a.attributes.title),a.attributes.description&&i.find('[data-additional="description"]').html(a.attributes.description),t.find(".vp-control-gallery-items-add").before(i)}),Q(t))}),n.open()):console.error("Can't access wp.media object.")}),t.on("click",".vp-control-gallery-items-img",function(e){e.preventDefault(),U(t,r(this).attr("data-image-id"))}),t.on("change input",".vp-control-gallery-additional-data [name]",Object(n.a)(200,function(){var e=t.children(".vp-control-gallery-additional-data"),a=t.children("textarea").attr("name"),n=t.children(".vp-control-gallery-items").find(".vp-control-gallery-items-img.active").attr("data-image-id");if(n){var o=t.children(".vp-control-gallery-items").find('[data-image-id="'+n+'"]');e.find('[name*="'+a+'_additional_"]').each(function(){var t=r(this).attr("name").replace(a+"_additional_","").replace("[]",""),e=r(this).val()||"";"object"===i(e)&&(e=JSON.stringify(e)),o.find('[data-additional="'+t+'"]').html(e||"")}),Q(t)}}))}),w.length)){var C=w.children(".vp-control-gallery-additional-data");r(document).on("mousedown",function(t){if(k){var e=t.target;r(e).closest(".vp-control-gallery-additional-data, .vp-control-gallery-items-img, .select2-vp-container").length||(C.removeClass("active"),w.children(".vp-control-gallery-items").find(".vp-control-gallery-items-img.active").removeClass("active"),k=w.find(".vp-control-gallery-additional-data.active").length)}})}var x=r('[name="vp_custom_css"]'),j=!1,S=!0;if(void 0!==p&&x.length){var O=function(t){$.css("height",Math.max(200,M+t.originalEvent.y-A)),z.setSize(null,Math.max(200,M+t.y-A)+"px")},E=function t(){u.off("mousemove",O),u.off("mouseup",t)};if(s&&s.classnames){var T=p.hint.css;p.hint.css=function(t){var e=t.getCursor(),a=T(t)||{from:e,to:t.getCursor(),list:[]},n=t.getTokenAt(e);return"top"===n.state.state&&0===n.string.indexOf(".")&&(a={from:p.Pos(e.line,n.start),to:p.Pos(e.line,n.end),list:[]},s.classnames.forEach(function(t){-1!==t.indexOf(n.string)&&a.list.push(t)})),a}}var z=p.fromTextArea(x[0],{mode:"css",theme:"eclipse",indentUnit:4,autoCloseTags:!0,autoCloseBrackets:!0,matchBrackets:!0,foldGutter:!0,lint:{options:{errors:!0,"box-model":!0,"display-property-grouping":!0,"duplicate-properties":!0,"known-properties":!0,"outline-none":!0},onUpdateLinting:function(t,e,a){var n=[];t.forEach(function(t){"error"===t.severity&&n.push(t)}),a.vcLintErrors=n,j||q(a.vcLintErrors,!0)}},lineNumbers:!0,lineWrapping:!0,scrollPastEnd:!0,emmet_active:!0,emmet:!0,styleActiveLine:!0,continueComments:!0,scrollbarStyle:"simple",extraKeys:{"Ctrl-Space":"autocomplete","Ctrl-/":"toggleComment","Cmd-/":"toggleComment","Alt-F":"findPersistent"},gutters:["CodeMirror-lint-markers","CodeMirror-linenumbers","CodeMirror-foldgutter"]});v(z),x.data("CodeMirrorInstance",z),z.on("change",function(){z.save(),x.change()}),z.on("keyup",function(t,e){var a=/^[a-zA-Z]$/.test(e.key);if(!t.state.completionActive||!a){var n=t.getTokenAt(t.getCursor());if("string"!==n.type&&"comment"!==n.type){var i=t.doc.getLine(t.doc.getCursor().line).substr(0,t.doc.getCursor().ch);(a||":"===e.key||" "===e.key&&/:\s+$/.test(i))&&t.showHint({completeSingle:!1})}}});var A,M,L=r(".CodeMirror-resizer").after(x),$=L.prev(".CodeMirror");L.on("mousedown",function(t){A=t.originalEvent.y,M=$.height(),u.on("mousemove",O),u.on("mouseup",E)})}var P=!1;u.on("click","#publish:not(.disabled)",function(t){if(P=!0,!j){var e=r(this),a=x.length&&x.data("CodeMirrorInstance");a&&a.vcLintErrors&&a.vcLintErrors.length&&(t.preventDefault(),e.addClass("disabled button-disabled button-primary-disabled"),setTimeout(function(){e.removeClass("disabled button-disabled button-primary-disabled")},1500),q(a.vcLintErrors,!1),r("html,body").animate({scrollTop:r("#vp_custom_css").offset().top-100},300),a.focus(),a.setCursor(a.vcLintErrors[0].from.line))}});var R=m.serialize();r(window).on("beforeunload",function(){if(!P)return R!==m.serialize()||void 0;P=!1}),u.on("change","#vp_custom_css_notice_prevent",function(){j=!0,r(this).closest(".notice").slideUp()})}function D(){var t="",e=r('[name="vp_controls_styles"]'),a=".vp-id-".concat(h),n=e.val();r('.vp-control-style [type="hidden"]').each(function(){var e=r(this),n=e.closest(".vp-control");if("none"!==n.css("display")){var i=(e.attr("data-style-mask")||"$").replace("$",n.find(e.attr("data-style-from")).val()),o=a+" "+e.attr("data-style-element"),l=e.attr("data-style-property");t&&(t+=" "),t+="".concat(o," { ").concat(l,": ").concat(i,"; }")}}),n!==t&&e.val(t).trigger("vp-fake-change")}function I(){d=!1,l=!1,_.submit()}function N(t,e){var a=t.find('[data-image-id="'+e+'"]'),n={id:e};return a.find("[data-additional]").each(function(){var t=r(this),e=t.attr("data-additional");if(n[e]=t.html(),"true"===t.attr("data-to-json"))try{n[e]=JSON.parse(n[e])}catch(t){n[e]=""}}),n}function Q(t){var e=[];t.children(".vp-control-gallery-items").find(".vp-control-gallery-items-img").each(function(){e.push(N(t,r(this).attr("data-image-id")))});var a=JSON.stringify(e),n=t.children("textarea");a!==n.val()&&n.val(a).change()}function U(t,e){var a=t.children("textarea").attr("name"),n=t.children(".vp-control-gallery-additional-data"),i=n.children(".vp-control-gallery-additional-data-preview"),l=t.children(".vp-control-gallery-items").find('.vp-control-gallery-items-img[data-image-id="'+e+'"]'),c=N(t,e),s=function(t,e){var a=t.find('[data-image-id="'+e+'"]'),n={};return a.find("[data-meta]").each(function(){n[r(this).attr("data-meta")]=r(this).html()}),n}(t,e);c&&Object.keys(c).forEach(function(e){var i=n.find('[name="'+a+"_additional_"+e+'"], [name="'+a+"_additional_"+e+'[]"]').val(c[e]||"");if(i.hasClass("vp-select2")){if(i.hasClass("vp-select2-tags")){var l=[],s=[];t.children(".vp-control-gallery-items").find(".vp-control-gallery-items-img").each(function(){var a=N(t,r(this).attr("data-image-id"));a&&void 0!==a[e]&&a[e]&&(l=o(new Set([].concat(o(l),o(a[e])))))}),l.forEach(function(t){s.push(new window.Option(t,t,!1,!1))}),i.html(s.length?s:""),i.val(void 0!==c[e]&&c[e]?c[e]:"")}i.trigger("change")}}),i.find(".vp-control-gallery-additional-data-preview-image img").attr("src",l.children("img").attr("src")||""),i.find(".vp-control-gallery-additional-data-preview-name").html(s.filename),i.find(".vp-control-gallery-additional-data-preview-size").html(s.width+"x"+s.height+" ("+s.filesizeHumanReadable+")"),i.find(".vp-control-gallery-additional-data-preview-edit a").attr("href",s.editLink.replace("&","&")),l.siblings().removeClass("active"),l.addClass("active"),n.addClass("active"),k=w.find(".vp-control-gallery-additional-data.active").length}function q(t,e){if(S&&(e=!1,S=!1),s&&s.css_editor_error_notice){var a=!1;if(1===t.length?a=s.css_editor_error_notice.singular.replace("%d","1"):t.length>1&&(a=s.css_editor_error_notice.plural.replace("%d",String(t.length))),a){var n=x.prev("#vp_custom_css_notice");if(n.length||e||(n=r('<div class="notice notice-error inline" id="vp_custom_css_notice"></div>'),x.before(n)),!n.length)return;var i='<p class="notification-message">'.concat(a,"</p>")+'<p><input id="vp_custom_css_notice_prevent" type="checkbox">'+'<label for="vp_custom_css_notice_prevent">'.concat(s.css_editor_error_checkbox,"</label>")+"</p>";n.html(i)}else x.prev("#vp_custom_css_notice").remove()}}}()},30:function(t,e,a){"use strict";function n(t,e,a,n){var i,o=!1,r=0;function l(){i&&clearTimeout(i)}function c(){var c=this,s=Date.now()-r,d=arguments;function p(){r=Date.now(),a.apply(c,d)}o||(n&&!i&&p(),l(),void 0===n&&s>t?p():!0!==e&&(i=setTimeout(n?function(){i=void 0}:p,void 0===n?t-s:t)))}return"boolean"!=typeof e&&(n=a,a=e,e=void 0),c.cancel=function(){l(),o=!0},c}function i(t,e,a){return void 0===a?n(t,e,!1):n(t,a,!1!==e)}a.d(e,"b",function(){return n}),a.d(e,"a",function(){return i})}});
|
assets/admin/js/vc-frontend.min.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=
|
2 |
/*!
|
3 |
* Additional js for frontend VC
|
4 |
*
|
5 |
* Name : Visual Portfolio
|
6 |
-
* Version : 1.
|
7 |
* Author : nK https://nkdev.info
|
8 |
*/
|
9 |
var n=window.vc;jQuery(function(){void 0!==n&&n.events.on("shortcodes:add shortcodeView:updated",function(e){if("visual_portfolio"===e.settings.base){var t=n.$frame[0].contentWindow,r=!!t&&t.jQuery;if(r){var o=r(e.view.el).children(".vp-portfolio");o.length&&void 0!==o.vpf&&o.vpf()}}})})}});
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var o=t[r]={i:r,l:!1,exports:{}};return e[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)n.d(r,o,function(t){return e[t]}.bind(null,o));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=177)}({177:function(e,t,n){e.exports=n(178)},178:function(e,t){
|
2 |
/*!
|
3 |
* Additional js for frontend VC
|
4 |
*
|
5 |
* Name : Visual Portfolio
|
6 |
+
* Version : 1.11.0
|
7 |
* Author : nK https://nkdev.info
|
8 |
*/
|
9 |
var n=window.vc;jQuery(function(){void 0!==n&&n.events.on("shortcodes:add shortcodeView:updated",function(e){if("visual_portfolio"===e.settings.base){var t=n.$frame[0].contentWindow,r=!!t&&t.jQuery;if(r){var o=r(e.view.el).children(".vp-portfolio");o.length&&void 0!==o.vpf&&o.vpf()}}})})}});
|
assets/css/noscript.min.css
ADDED
@@ -0,0 +1,5 @@
|
|
|
|
|
|
|
|
|
|
|
1 |
+
/*!
|
2 |
+
* Name : Visual Portfolio Noscript
|
3 |
+
* Version : 1.11.0
|
4 |
+
* Author : nK https://nkdev.info
|
5 |
+
*/.vp-portfolio__preloader-wrap{display:none}.vp-portfolio__items-wrap,.vp-portfolio__filter-wrap,.vp-portfolio__sort-wrap,.vp-portfolio__pagination-wrap{visibility:visible;opacity:1}.vp-portfolio__item .vp-portfolio__item-img noscript+img{display:none}.vp-portfolio__thumbnails-wrap{display:none}
|
assets/css/style.min.css
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
/*!
|
2 |
* Name : Visual Portfolio
|
3 |
-
* Version : 1.
|
4 |
* Author : nK https://nkdev.info
|
5 |
-
*/.vp-portfolio{position:relative;min-height:114px}.vp-portfolio,.vp-portfolio *{box-sizing:border-box}.vp-portfolio__items{transition:.3s height ease-in-out, .3s transform ease-in-out;will-change:height, transform}.vp-portfolio::after,.vp-portfolio__items::after{content:"";display:block;clear:both}.vp-portfolio__items-wrap,.vp-portfolio__filter-wrap,.vp-portfolio__pagination-wrap,.vp-portfolio__item{position:relative;overflow:hidden}.vp-portfolio__items-wrap,.vp-portfolio__filter-wrap,.vp-portfolio__pagination-wrap{visibility:hidden;opacity:0;transition:.3s opacity, .3s visibility;will-change:opacity, visibility}.vp-portfolio__item-wrap{position:relative;float:left;width:33.333%}.vp-portfolio__item .vp-portfolio__item-img img,.vp-portfolio__item .vp-portfolio__item-img a{display:block;width:100%;height:auto}.vp-portfolio__item-img{position:relative}.vp-portfolio figure.vp-portfolio__item{margin:0}[class^="wp-block-"]:not(.wp-block-gallery) figcaption.vp-portfolio__item-meta,.vp-portfolio figcaption.vp-portfolio__item-meta{margin-bottom:0;font-style:inherit}.vp-portfolio__preloader-wrap{visibility:visible;opacity:1;transition:.3s opacity, .3s visibility;will-change:opacity, visibility}.vp-portfolio__preloader{position:absolute;left:50%;width:23px;height:24px;margin-top:45px;margin-left:-11px;-webkit-animation:vp-preloader 2s linear infinite;animation:vp-preloader 2s linear infinite}.vp-portfolio__preloader span{position:absolute;display:block;top:0;left:0;width:10px;height:7px;background-color:#8a8a8a}.vp-portfolio__preloader span:nth-of-type(1){height:14px}.vp-portfolio__preloader span:nth-of-type(2){left:12px}.vp-portfolio__preloader span:nth-of-type(3){top:16px}.vp-portfolio__preloader span:nth-of-type(4){top:9px;left:12px;height:14px}@-webkit-keyframes vp-preloader{0%,100%{opacity:.5}40%,60%{opacity:1}}@keyframes vp-preloader{0%,100%{opacity:.5}40%,60%{opacity:1}}[data-vp-layout="tiles"] .vp-portfolio__item-img img,[data-vp-layout="tiles"] .vp-portfolio__item-img{position:absolute;top:0;right:0;bottom:0;left:0}[data-vp-layout="tiles"] .vp-portfolio__item-img-wrap{position:relative;display:block;overflow:hidden}[data-vp-layout="tiles"] .vp-portfolio__item-img-wrap::before{content:"";display:block;margin-top:56%}[data-vp-layout="tiles"] .vp-portfolio__item-img img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:50% 50%;object-position:50% 50%;font-family:"object-fit: cover; object-position: 50% 50%;"}[data-vp-layout="justified"] .vp-portfolio__items{transition:.2s height ease-in-out;will-change:height}[data-vp-layout="justified"] .vp-portfolio__item-wrap{float:left;top:0;left:0;transition:.2s transform ease-in-out, .2s width ease-in-out, .2s height ease-in-out;will-change:transform, width, height}[data-vp-layout="slider"] .vp-portfolio__item-wrap{float:none
|
1 |
/*!
|
2 |
* Name : Visual Portfolio
|
3 |
+
* Version : 1.11.0
|
4 |
* Author : nK https://nkdev.info
|
5 |
+
*/.vp-portfolio{position:relative;min-height:114px}.vp-portfolio,.vp-portfolio *{box-sizing:border-box}.vp-portfolio__items{transition:.3s height ease-in-out, .3s transform ease-in-out;will-change:height, transform}.vp-portfolio::after,.vp-portfolio__items::after{content:"";display:block;clear:both}.vp-portfolio__items-wrap,.vp-portfolio__filter-wrap,.vp-portfolio__sort-wrap,.vp-portfolio__pagination-wrap,.vp-portfolio__item{position:relative;overflow:hidden}.vp-portfolio__items-wrap,.vp-portfolio__filter-wrap,.vp-portfolio__sort-wrap,.vp-portfolio__pagination-wrap{visibility:hidden;opacity:0;transition:.3s opacity, .3s visibility;will-change:opacity, visibility}.vp-portfolio__item-wrap{position:relative;float:left;width:33.333%}.vp-portfolio__item .vp-portfolio__item-img img,.vp-portfolio__item .vp-portfolio__item-img a,.vp-portfolio__item .vp-portfolio__thumbnail-img img{display:block;width:100%;height:auto}.vp-portfolio__item-img,.vp-portfolio__thumbnail-img{position:relative}.vp-portfolio__filter-sort-wrap{display:flex;flex-wrap:wrap}.vp-portfolio__filter-sort-wrap .vp-portfolio__sort-wrap{margin-left:auto}.vp-portfolio figure.vp-portfolio__item{margin:0}[class^="wp-block-"]:not(.wp-block-gallery) figcaption.vp-portfolio__item-meta,.vp-portfolio figcaption.vp-portfolio__item-meta{margin-bottom:0;font-style:inherit}.vp-portfolio__preloader-wrap{visibility:visible;opacity:1;transition:.3s opacity, .3s visibility;will-change:opacity, visibility}.vp-portfolio__preloader{position:absolute;left:50%;width:23px;height:24px;margin-top:45px;margin-left:-11px;-webkit-animation:vp-preloader 2s linear infinite;animation:vp-preloader 2s linear infinite}.vp-portfolio__preloader span{position:absolute;display:block;top:0;left:0;width:10px;height:7px;background-color:#8a8a8a}.vp-portfolio__preloader span:nth-of-type(1){height:14px}.vp-portfolio__preloader span:nth-of-type(2){left:12px}.vp-portfolio__preloader span:nth-of-type(3){top:16px}.vp-portfolio__preloader span:nth-of-type(4){top:9px;left:12px;height:14px}@-webkit-keyframes vp-preloader{0%,100%{opacity:.5}40%,60%{opacity:1}}@keyframes vp-preloader{0%,100%{opacity:.5}40%,60%{opacity:1}}[data-vp-layout="tiles"] .vp-portfolio__item-img img,[data-vp-layout="tiles"] .vp-portfolio__item-img{position:absolute;top:0;right:0;bottom:0;left:0}[data-vp-layout="tiles"] .vp-portfolio__item-img-wrap{position:relative;display:block;overflow:hidden}[data-vp-layout="tiles"] .vp-portfolio__item-img-wrap::before{content:"";display:block;margin-top:56%}[data-vp-layout="tiles"] .vp-portfolio__item-img img{width:100%;height:100%;-o-object-fit:cover;object-fit:cover;-o-object-position:50% 50%;object-position:50% 50%;font-family:"object-fit: cover; object-position: 50% 50%;"}[data-vp-layout="justified"] .vp-portfolio__items{transition:.2s height ease-in-out;will-change:height}[data-vp-layout="justified"] .vp-portfolio__item-wrap{float:left;top:0;left:0;transition:.2s transform ease-in-out, .2s width ease-in-out, .2s height ease-in-out;will-change:transform, width, height}[data-vp-layout="slider"] .vp-portfolio__item-wrap{float:none}[data-vp-layout="slider"] .vp-portfolio__item-img-wrap,[data-vp-layout="slider"] .vp-portfolio__thumbnail-img-wrap{position:relative;display:block;overflow:hidden}[data-vp-layout="slider"] .vp-portfolio__item-img-wrap::before,[data-vp-layout="slider"] .vp-portfolio__thumbnail-img-wrap::before{content:"";display:block}[data-vp-layout="slider"] .vp-portfolio__item-img img,[data-vp-layout="slider"] .vp-portfolio__thumbnail-img img{-o-object-fit:cover;object-fit:cover;-o-object-position:50% 50%;object-position:50% 50%;font-family:"object-fit: cover; object-position: 50% 50%;"}[data-vp-layout="slider"] .vp-portfolio__items-arrow{position:absolute;display:flex;align-items:center;justify-content:center;top:50%;width:40px;height:40px;margin-top:-20px;color:#6c7781;cursor:pointer;background-color:#fff;border-radius:50%;box-shadow:0 0 7px 2px rgba(0,0,0,0.04);opacity:.5;transition:.2s opacity ease-in-out, .2s box-shadow ease-in-out;will-change:opacity, box-shadow;z-index:1}[data-vp-layout="slider"] .vp-portfolio__items-arrow::after{content:"";position:absolute;display:block;top:-10px;right:-10px;bottom:-10px;left:-10px}[data-vp-layout="slider"] .vp-portfolio__items-arrow:hover{box-shadow:0 2px 15px 2px rgba(0,0,0,0.04);opacity:1}[data-vp-layout="slider"] .vp-portfolio__items-arrow-prev{left:10px}[data-vp-layout="slider"] .vp-portfolio__items-arrow-next{right:10px}[data-vp-layout="slider"][data-vp-slider-bullets="true"] .vp-portfolio__items-wrap{padding-bottom:25px}[data-vp-layout="slider"][data-vp-slider-bullets="true"] .vp-portfolio__items-wrap .vp-portfolio__items-arrow{margin-top:-32.5px}[data-vp-layout="slider"] .vp-portfolio__items-bullets{position:absolute;margin-bottom:-15px;text-align:center;z-index:1}[data-vp-layout="slider"] .vp-portfolio__items-bullets.swiper-pagination-bullets-dynamic{margin-bottom:-7px}[data-vp-layout="slider"] .vp-portfolio__items-bullets>span{position:relative;cursor:pointer;background-color:#6c7781;opacity:.2;transition:.15s opacity ease-in-out;will-change:opacity}[data-vp-layout="slider"] .vp-portfolio__items-bullets>span:hover{opacity:.5}[data-vp-layout="slider"] .vp-portfolio__items-bullets>span.swiper-pagination-bullet-active{opacity:1}[data-vp-layout="slider"] .vp-portfolio__items-bullets>span::after{content:"";position:absolute;display:block;top:-4px;right:-4px;bottom:-4px;left:-4px}[data-vp-layout="slider"] .vp-portfolio__thumbnails-wrap .vp-portfolio__thumbnail-wrap{cursor:pointer;opacity:.5;transition:.2s opacity}[data-vp-layout="slider"] .vp-portfolio__thumbnails-wrap .vp-portfolio__thumbnail-wrap:hover,[data-vp-layout="slider"] .vp-portfolio__thumbnails-wrap .vp-portfolio__thumbnail-wrap:focus,[data-vp-layout="slider"] .vp-portfolio__thumbnails-wrap .vp-portfolio__thumbnail-wrap.swiper-slide-thumb-active{opacity:1}.vp-portfolio.vp-portfolio__ready{min-height:initial}.vp-portfolio.vp-portfolio__ready .vp-portfolio__items-wrap,.vp-portfolio.vp-portfolio__ready .vp-portfolio__filter-wrap,.vp-portfolio.vp-portfolio__ready .vp-portfolio__sort-wrap,.vp-portfolio.vp-portfolio__ready .vp-portfolio__pagination-wrap{visibility:visible;opacity:1}.vp-portfolio.vp-portfolio__ready .vp-portfolio__preloader-wrap{visibility:hidden;opacity:0}.vp-portfolio.vp-portfolio__ready .vp-portfolio__preloader-wrap .vp-portfolio__preloader{-webkit-animation:none;animation:none}.vp-single-filter.vp-single-filter__ready .vp-portfolio__filter-wrap{visibility:visible;opacity:1}.vp-single-sort.vp-single-sort__ready .vp-portfolio__sort-wrap{visibility:visible;opacity:1}.vp-portfolio.vp-portfolio__loading::before{content:"";position:absolute;display:block;top:0;right:0;bottom:0;left:0;z-index:1}.vp-portfolio.vp-portfolio__loading .vp-portfolio__items-wrap,.vp-portfolio.vp-portfolio__loading .vp-portfolio__filter-wrap,.vp-portfolio.vp-portfolio__loading .vp-portfolio__sort-wrap,.vp-portfolio.vp-portfolio__loading .vp-portfolio__pagination-wrap{opacity:.5}.vp-portfolio__item-popup{display:none}.vp-pswp{z-index:1500}body.admin-bar .vp-pswp{top:32px;height:calc(100% - 32px)}@media screen and (max-width: 782px){body.admin-bar .vp-pswp{top:42px;height:calc(100% - 42px)}}@media screen and (max-width: 600px){body.admin-bar .vp-pswp{top:0;height:100%}}.vp-pswp .pswp__caption{background-color:rgba(0,0,0,0.75)}.vp-pswp .pswp__caption>div{max-width:600px;font-size:12px;color:#fff}.vp-pswp .pswp__caption h3{color:inherit}.vp-pswp .pswp__caption a{color:inherit}.vp-pswp .pswp__caption a:hover{opacity:.8}.vp-pswp .pswp__caption .vp-portfolio__item-meta-title{margin-top:0;margin-bottom:3px;font-size:14px;color:inherit}.vp-pswp .pswp__caption .vp-portfolio__item-meta-title a{text-decoration:none}.vp-pswp .pswp__preloader{position:absolute;right:0;bottom:0;z-index:1}.vp-pswp .vp-pswp-video{position:relative;display:flex;align-items:center;width:100%;max-width:1920px;height:100%;margin:0 auto;line-height:0;text-align:left;vertical-align:middle;z-index:1045}.vp-pswp .vp-pswp-video>div{position:relative;width:100%;height:0;padding-bottom:56.25%}.vp-pswp .vp-pswp-video>div iframe{position:absolute;top:0;left:0;width:100%;height:100%;margin:0}.vp-pswp .vp-pswp-video>div video{width:100% !important;height:auto !important;margin:0}img.visual-portfolio-lazyload{opacity:1;transition:.3s opacity;will-change:opacity}.vp-portfolio__item-img::before,.vp-portfolio__thumbnail-img::before{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:linear-gradient(-70deg, rgba(255,255,255,0) 42%, rgba(255,255,255,0.55) 50%, rgba(255,255,255,0) 58%);background-color:rgba(132,136,177,0.05);background-position:0% 50%;background-size:500% 100%;transition:.3s .3s opacity, .3s .3s visibility}.vp-portfolio__item-img-lazyloading::before,.vp-portfolio__thumbnail-img-lazyloading::before{visibility:visible;opacity:1;transition:none;-webkit-animation:vp-lazyload-placeholder 3s linear infinite;animation:vp-lazyload-placeholder 3s linear infinite}.vp-portfolio__item-img-lazyloading img.visual-portfolio-lazyload,.vp-portfolio__thumbnail-img-lazyloading img.visual-portfolio-lazyload{opacity:0}@-webkit-keyframes vp-lazyload-placeholder{0%,80%{background-position:100% 50%}100%{background-position:0% 50%}}@keyframes vp-lazyload-placeholder{0%,80%{background-position:100% 50%}100%{background-position:0% 50%}}
|
assets/js/lazysizes-object-fit-cover.min.js
CHANGED
@@ -1 +1 @@
|
|
1 |
-
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=
|
1 |
+
!function(e){var t={};function n(r){if(t[r])return t[r].exports;var i=t[r]={i:r,l:!1,exports:{}};return e[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var i in e)n.d(r,i,function(t){return e[t]}.bind(null,i));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=164)}({164:function(e,t,n){e.exports=n(165)},165:function(e,t){!function(e,t){var n=function n(){t(e.lazySizes),e.removeEventListener("lazyunveilread",n,!0)};t=t.bind(null,e,e.document),e.lazySizes?n():e.addEventListener("lazyunveilread",n,!0)}(window,function(e,t,n){"use strict";if(e.addEventListener){var r={calculateSize:function(t,n){var r,i=(r=t,e.getComputedStyle(r,null)||{});if(i&&i.objectFit&&"cover"===i.objectFit){var o=parseInt(t.getAttribute("height")),u=parseInt(t.getAttribute("width"));o&&u/o>t.clientWidth/t.clientHeight&&(n=parseInt(t.clientHeight*u/o,10))}return n}};n.objectFitCover=r,t.addEventListener("lazybeforesizes",function(e){if(!e.defaultPrevented&&e.detail.instance===n){var t=e.target;e.detail.width=r.calculateSize(t,e.detail.width)}})}})}});
|
assets/js/script-preview.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=
|
2 |
/*!
|
3 |
* Name : Visual Portfolio
|
4 |
-
* Version : 1.
|
5 |
* Author : nK https://nkdev.info
|
6 |
*/
|
7 |
-
|
1 |
+
!function(e){var t={};function r(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,r),o.l=!0,o.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var o in e)r.d(n,o,function(t){return e[t]}.bind(null,o));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=166)}({166:function(e,t,r){e.exports=r(167)},167:function(e,t){
|
2 |
/*!
|
3 |
* Name : Visual Portfolio
|
4 |
+
* Version : 1.11.0
|
5 |
* Author : nK https://nkdev.info
|
6 |
*/
|
7 |
+
var r;(r=jQuery("#vp_preview > .vp-portfolio")).on("click",".vp-portfolio__item, .vp-portfolio__item a",function(e){e.preventDefault(),e.stopPropagation()}),window.iFrameResizer={heightCalculationMethod:function(){return r.outerHeight(!0)}}}});
|
assets/js/script.min.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
-
!function(t){var i={};function e(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,e),s.l=!0,s.exports}e.m=t,e.c=i,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var s in t)e.d(o,s,function(i){return t[i]}.bind(null,s));return o},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=
|
2 |
/*!
|
3 |
* Name : Visual Portfolio
|
4 |
-
* Version : 1.
|
5 |
* Author : nK https://nkdev.info
|
6 |
*/
|
7 |
-
var l=jQuery,d=window,c=d.VPData,f=d.objectFitImages,v=d.PhotoSwipe,h=d.PhotoSwipeUI_Default,u=c.__,m=c.settingsPopupGallery,_=l(window),y=0,w=0;function g(){y=_.width(),w=_.height()}g(),_.on("resize load orientationchange",g);var b=[320,576,768,992,1200];void 0!==f&&(f(".vp-portfolio img:not(.visual-portfolio-lazyload)"),l(document).on("lazybeforeunveil",function(t){var i=l(t.target);i.hasClass("visual-portfolio-lazyload")&&i.one("load",function(){f(i[0])})}));var x=function(){function t(i,e){!function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,t);this.$item=i;for(var o=i[0].className.split(/\s+/),s=0;s<o.length;s++)o[s]&&/^vp-uid-/.test(o[s])&&(this.uid=o[s].replace(/^vp-uid-/,"")),o[s]&&/^vp-id-/.test(o[s])&&(this.id=o[s].replace(/^vp-id-/,""));this.uid?(this.$items_wrap=i.find(".vp-portfolio__items"),this.$pagination=i.find(".vp-portfolio__pagination-wrap"),this.$filter=i.find(".vp-portfolio__filter-wrap"),this.id&&(this.$filter=this.$filter.add(".vp-single-filter.vp-id-".concat(this.id," .vp-portfolio__filter-wrap"))),this.userOptions=e,this.firstRun=!0,this.init()):console.error(u.couldnt_retrieve_vp)}return function(t,i,e){i&&p(t.prototype,i),e&&p(t,e)}(t,[{key:"emitEvent",value:function(t,i){i=i?[this].concat(i):[this],this.$item.trigger("".concat(t,".vpf"),i),this.$item.trigger("".concat(t,".vpf-uid-").concat(this.uid),i)}},{key:"init",value:function(){this.firstRun||this.destroy(),this.destroyed=!1,this.initOptions(),this.initEvents(),this.prepareLazyLoad(),this.initLayout(),this.initCustomColors(),this.initPhotoswipe(),this.emitEvent("init"),this.$item.addClass("vp-portfolio__ready"),this.id&&l(".vp-single-filter.vp-id-".concat(this.id)).addClass("vp-single-filter__ready"),this.initIsotope(),this.initFjGallery(),this.initSwiper(),this.resized(),this.imagesLoaded(),this.firstRun=!1}},{key:"resized",value:function(){if("function"==typeof window.Event)window.dispatchEvent(new window.Event("resize"));else{var t=window.document.createEvent("UIEvents");t.initUIEvent("resize",!0,!1,window,0),window.dispatchEvent(t)}this.emitEvent("resized")}},{key:"imagesLoaded",value:function(){var t=this,i=this;i.$items_wrap.imagesLoaded&&i.$items_wrap.imagesLoaded(function(){i.initIsotope("layout"),i.initFjGallery(),t.emitEvent("imagesLoaded")})}},{key:"destroy",value:function(){this.$item.removeClass("vp-portfolio__ready"),this.id&&l(".vp-single-filter.vp-id-".concat(this.id)).removeClass("vp-single-filter__ready"),this.destroyEvents(),this.removeStyle(),this.renderStyle(),this.destroyPhotoswipe(),this.destroyIsotope(),this.destroyFjGallery(),this.destroySwiper(),this.emitEvent("destroy"),this.destroyed=!0}},{key:"addStyle",value:function(t,i,e){e=e||"";var o=this.uid;this.stylesList||(this.stylesList={}),void 0===this.stylesList[o]&&(this.stylesList[o]={}),void 0===this.stylesList[o][e]&&(this.stylesList[o][e]={}),void 0===this.stylesList[o][e][t]&&(this.stylesList[o][e][t]={}),this.stylesList[o][e][t]=l.extend(this.stylesList[o][e][t],i),this.emitEvent("addStyle",[t,i,e,this.stylesList])}},{key:"removeStyle",value:function(t,i,e){e=e||"";var o=this.uid;this.stylesList||(this.stylesList={}),void 0===this.stylesList[o]||t||(this.stylesList[o]={}),void 0!==this.stylesList[o]&&void 0!==this.stylesList[o][e]&&void 0!==this.stylesList[o][e][t]&&t&&delete this.stylesList[o][e][t],this.emitEvent("removeStyle",[t,i,this.stylesList])}},{key:"renderStyle",value:function(){var t=this,i=t.uid,e="";t.stylesList||(t.stylesList={}),void 0!==t.stylesList[i]&&Object.keys(t.stylesList[i]).forEach(function(o){o&&(e+="@media ".concat(o," {")),Object.keys(t.stylesList[i][o]).forEach(function(s){e+=".vp-uid-".concat(i," ").concat(s," {"),Object.keys(t.stylesList[i][o][s]).forEach(function(n){e+="".concat(n,":").concat(t.stylesList[i][o][s][n],";")}),e+="}"}),o&&(e+="}")});var o=l("#vp-style-".concat(i));o.length||(o=l("<style>").attr("id","vp-style-".concat(i)).appendTo("head")),o.html(e),t.emitEvent("renderStyle",[e,t.stylesList,o])}},{key:"firstToLowerCase",value:function(t){return t.substr(0,1).toLowerCase()+t.substr(1)}},{key:"initOptions",value:function(t){var i=this;i.defaults={layout:"tile",itemsGap:0,tilesType:"3|1,1|",masonryColumns:3,gridColumns:3,justifiedRowHeight:250,justifiedRowHeightTolerance:.25,pagination:"load-more"},t&&(i.userOptions=t);var e=i.$item[0].dataset,o={};Object.keys(e).forEach(function(t){t&&"vp"===t.substring(0,2)&&(o[i.firstToLowerCase(t.substring(2))]=e[t])}),i.options=l.extend({},i.defaults,o,i.userOptions),i.emitEvent("initOptions")}},{key:"isCrossLine",value:function(t,i,e,o){var s=(o.x-e.x)*(t.y-e.y)-(o.y-e.y)*(t.x-e.x),n=(o.x-e.x)*(i.y-e.y)-(o.y-e.y)*(i.x-e.x),a=(i.x-t.x)*(e.y-t.y)-(i.y-t.y)*(e.x-t.x),r=(i.x-t.x)*(o.y-t.y)-(i.y-t.y)*(o.x-t.x);return s*n<=0&&a*r<=0}},{key:"initEvents",value:function(){var t,i=this,e=".vpf-uid-".concat(i.uid);function o(){var t=i.$item[0].getBoundingClientRect(),e=t.left,o=y-t.right,s=parseFloat(i.$item.css("margin-left")||0),n=parseFloat(i.$item.css("margin-right")||0);i.$item.css({"margin-left":s-e,"margin-right":n-o})}if(i.$item.hasClass("vp-portfolio__stretch")&&(_.on("load".concat(e," resize").concat(e," orientationchange").concat(e),function(){o()}),o()),"fly"===i.options.itemsStyle){var s={};_.on("mousemove".concat(e),function(t){s={x:t.clientX,y:t.clientY}}),i.$item.on("mouseenter".concat(e," mouseleave").concat(e),".vp-portfolio__item",function(t){var e=l(this),o=e[0].getBoundingClientRect(),n=e.find(".vp-portfolio__item-overlay"),a="mouseenter"===t.type,r="0%",p="0%",d={x:t.clientX,y:t.clientY},c=i.isCrossLine({x:o.left,y:o.top},{x:o.left+o.width,y:o.top},d,s),f=i.isCrossLine({x:o.left,y:o.top+o.height},{x:o.left+o.width,y:o.top+o.height},d,s),v=i.isCrossLine({x:o.left,y:o.top},{x:o.left,y:o.top+o.height},d,s),h=i.isCrossLine({x:o.left+o.width,y:o.top},{x:o.left+o.width,y:o.top+o.height},d,s);if(!(c||f||v||h)){var u=(o.width/2-d.x+o.left)/(o.width/2),m=(o.height/2-d.y+o.top)/(o.height/2);Math.abs(u)>Math.abs(m)?u>0?v=!0:h=!0:m>0?c=!0:f=!0}c?p="-10".concat(p):f?p="10".concat(p):v?r="-10".concat(r):h&&(r="10".concat(r)),a&&(n.css({transition:"none",transform:"translateX(".concat(r,") translateY(").concat(p,") translateZ(0)")}),n[0].offsetHeight),n.css({transition:".2s transform ease-in-out",transform:"translateX(".concat(a?"0%":r,") translateY(").concat(a?"0%":p,") translateZ(0)")})})}i.$filter.on("click".concat(e),".vp-filter .vp-filter__item a",function(t){t.preventDefault();var e=l(this);i.loading||e.closest(".vp-filter__item").addClass("vp-filter__item-active").siblings().removeClass("vp-filter__item-active"),i.loadNewItems(e.attr("href"),!0)}),i.$item.on("click".concat(e),".vp-pagination .vp-pagination__item a",function(t){t.preventDefault();var e=l(this);e.hasClass("vp-pagination__no-more")&&"paged"!==i.options.pagination||i.loadNewItems(e.attr("href"),"paged"===i.options.pagination)}),i.$item.on("click".concat(e),".vp-portfolio__items .vp-portfolio__item-meta-category a",function(t){t.preventDefault(),t.stopPropagation(),i.loadNewItems(l(this).attr("href"),!0)});var n=250;function a(){var t=i.$item[0].getBoundingClientRect();t.bottom>0&&t.bottom-n<=w&&i.loadNewItems(i.options.nextPageUrl,!1,function(){a()})}"infinite"===i.options.pagination&&(_.on("load".concat(e," scroll").concat(e," resize").concat(e," orientationchange").concat(e),function(){clearTimeout(t),t=setTimeout(function(){a()},60)}),a()),i.$item.on("transitionend".concat(e),".vp-portfolio__items",function(t){t.currentTarget===t.target&&i.resized()}),i.emitEvent("initEvents")}},{key:"destroyEvents",value:function(){var t=".vpf-uid-".concat(this.uid);this.$item.off(t),this.$filter.off(t),_.off(t),this.emitEvent("destroyEvents")}},{key:"prepareLazyLoad",value:function(){var t=window.lazySizesConfig;if(t){var i={"data-vpf-src":t.srcAttr,"data-vpf-sizes":t.sizesAttr,"data-vpf-srcset":t.srcsetAttr};this.$items_wrap.find(".visual-portfolio-lazyload:not(.".concat(t.lazyClass,")")).each(function(){var e=l(this);Object.keys(i).forEach(function(t){i[t]&&t!==i[t]&&e.attr(t)&&(e.attr(i[t],e.attr(t)),e.removeAttr(t))}),e.addClass(t.lazyClass)})}}},{key:"getTilesSettings",value:function(){var t=this.options.tilesType.split(/[:|]/);return void 0===t[t.length-1]||t[t.length-1]||t.pop(),t}},{key:"initLayout",value:function(){if(this.options.layout)switch(this.options.layout){case"tiles":var t=this.getTilesSettings(),i=parseInt(t[0],10)||1;if(t.shift(),this.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/i,"%")}),t&&t.length)for(var e=0;e<t.length;e++){var o=t[e].split(","),s=parseFloat(o[0])||1,n=parseFloat(o[1])||1,a=".vp-portfolio__item-wrap";t.length>1&&(a+=":nth-of-type(".concat(t.length,"n+").concat(e+1,")")),s&&1!==s&&this.addStyle(a,{width:"".concat(100*s/i,"%")}),this.addStyle("".concat(a," .vp-portfolio__item-img-wrap::before"),{"margin-top":"".concat(100*n,"%")})}for(var r=i-1,p=Math.min(b.length-1,r);p>=0;p--)r>0&&void 0!==b[p]&&(this.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/r,"%")},"screen and (max-width: ".concat(b[p],"px)")),this.addStyle(".vp-portfolio__item-wrap:nth-of-type(n)",{width:"".concat(100/r,"%")},"screen and (max-width: ".concat(b[p],"px)"))),r-=1;break;case"masonry":case"grid":var l=this.options["masonry"===this.options.layout?"masonryColumns":"gridColumns"];this.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/l,"%")});for(var d=l-1,c=Math.min(b.length-1,d);c>=0;c--)d>0&&void 0!==b[c]&&this.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/d,"%")},"screen and (max-width: ".concat(b[c],"px)")),d-=1;case"justified":break;case"slider":"auto"!==this.options.sliderItemsHeight&&("auto"===this.options.sliderSlidesPerView?this.options.sliderItemsHeight.indexOf("%")===this.options.sliderItemsHeight.length-1?(this.addStyle(".vp-portfolio__items-wrap::before",{content:'""',display:"block",width:"100%","margin-top":isNaN(this.options.sliderItemsHeight)?this.options.sliderItemsHeight:"".concat(this.options.sliderItemsHeight,"px")}),this.addStyle(".vp-portfolio__items",{position:"absolute",top:0,left:0,right:0,bottom:0}),this.addStyle(".vp-portfolio__item-wrap",{height:"true"===this.options.sliderBullets?"calc( 100% - 25px )":"100%"}),this.addStyle(".vp-portfolio__item, .vp-portfolio__item-img-wrap, .vp-portfolio__item-img, .vp-portfolio__item-wrap .vp-portfolio__item .vp-portfolio__item-img a, .vp-portfolio__item-wrap .vp-portfolio__item .vp-portfolio__item-img img",{width:"auto",height:"100%"})):this.addStyle(".vp-portfolio__item .vp-portfolio__item-img img",{width:"auto",height:isNaN(this.options.sliderItemsHeight)?this.options.sliderItemsHeight:"".concat(this.options.sliderItemsHeight,"px")}):(this.addStyle(".vp-portfolio__item-img-wrap::before",{"margin-top":isNaN(this.options.sliderItemsHeight)?this.options.sliderItemsHeight:"".concat(this.options.sliderItemsHeight,"px")}),this.addStyle(".vp-portfolio__item-img img",{position:"absolute",top:0,right:0,bottom:0,left:0}),this.addStyle(".vp-portfolio__item-img",{position:"absolute",top:0,right:0,bottom:0,left:0}),this.addStyle(".vp-portfolio__item .vp-portfolio__item-img img",{width:"100%",height:"100%"})))}var f=parseInt(this.options.itemsGap,10);if(f&&("tiles"===this.options.layout||"masonry"===this.options.layout||"grid"===this.options.layout)){this.addStyle(".vp-portfolio__items",{"margin-left":"-".concat(f,"px"),"margin-top":"-".concat(f,"px")});var v="".concat(f,"px");this.addStyle(".vp-portfolio__item-wrap .vp-portfolio__item",{"margin-left":v,"margin-top":v}),"tiles"===this.options.layout&&(this.addStyle(".vp-portfolio__item-wrap .vp-portfolio__item-img-wrap",{"margin-left":"-".concat(v),"margin-top":"-".concat(v)}),this.addStyle(".vp-portfolio__item-wrap .vp-portfolio__item-img",{left:v,top:v}))}this.renderStyle(),this.emitEvent("initLayout")}},{key:"initCustomColors",value:function(){var t=this;t.$item.find("[data-vp-bg-color]").each(function(){var i=l(this).attr("data-vp-bg-color");t.addStyle('[data-vp-bg-color="'.concat(i,'"]'),{"background-color":"".concat(i," !important")})}),t.$item.find("[data-vp-text-color]").each(function(){var i=l(this).attr("data-vp-text-color");t.addStyle('[data-vp-text-color="'.concat(i,'"]'),{color:"".concat(i," !important")})}),t.renderStyle(),t.emitEvent("initCustomColors")}},{key:"initIsotope",value:function(t){if(this.$items_wrap.isotope&&("tiles"===this.options.layout||"masonry"===this.options.layout||"grid"===this.options.layout)){var i=t||{itemSelector:".vp-portfolio__item-wrap",layoutMode:"grid"===this.options.layout?"fitRows":"masonry",transitionDuration:"0.3s",percentPosition:!0};this.emitEvent("beforeInitIsotope",[t]),this.$items_wrap.isotope(i),this.emitEvent("initIsotope",[t])}}},{key:"destroyIsotope",value:function(){this.$items_wrap.data("isotope")&&(this.$items_wrap.isotope("destroy"),this.emitEvent("destroyIsotope"))}},{key:"initFjGallery",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.$items_wrap.fjGallery&&"justified"===this.options.layout){var e=!1!==t?t:{gutter:parseFloat(this.options.itemsGap)||0,rowHeight:parseFloat(this.options.justifiedRowHeight)||200,rowHeightTolerance:parseFloat(this.options.justifiedRowHeightTolerance)||0,itemSelector:".vp-portfolio__item-wrap",imageSelector:".vp-portfolio__item-img img"};this.emitEvent("beforeInitFjGallery",[e,i]),this.$items_wrap.fjGallery(e,i),this.emitEvent("initFjGallery",[e,i])}}},{key:"destroyFjGallery",value:function(){this.$items_wrap.data("fjGallery")&&(this.$items_wrap.fjGallery("destroy"),this.emitEvent("destroyFjGallery"))}},{key:"initSwiper",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("slider"===this.options.layout&&void 0!==window.Swiper){var i=this.$items_wrap.parent();i.addClass("swiper-container"),this.$items_wrap.addClass("swiper-wrapper"),this.$items_wrap.children().addClass("swiper-slide"),"true"!==this.options.sliderArrows||i.find(".vp-portfolio__items-arrow").length||i.append('\n <div class="vp-portfolio__items-arrow vp-portfolio__items-arrow-prev"><span class="'.concat(this.options.sliderArrowsIconPrev,'"></span></div>\n <div class="vp-portfolio__items-arrow vp-portfolio__items-arrow-next"><span class="').concat(this.options.sliderArrowsIconNext,'"></span></div>\n ')),"true"!==this.options.sliderBullets||i.find(".vp-portfolio__items-bullets").length||i.append('<div class="vp-portfolio__items-bullets"></div>');var e=this.options.sliderSlidesPerView||3,o={};if(!isNaN(e))for(var s=e-1,n=Math.min(b.length-1,s);n>=0;n--)s>0&&void 0!==b[n]&&(o[b[n]]={slidesPerView:s}),s-=1;0===(t=t||{speed:1e3*(parseFloat(this.options.sliderSpeed)||0),autoHeight:"auto"===this.options.sliderItemsHeight,effect:this.options.sliderEffect||"slide",spaceBetween:parseFloat(this.options.itemsGap)||0,centeredSlides:"true"===this.options.sliderCenteredSlides,freeMode:"true"===this.options.sliderFreeMode,freeModeSticky:"true"===this.options.sliderFreeModeSticky,loop:"true"===this.options.sliderLoop,autoplay:parseFloat(this.options.sliderAutoplay)>0&&{delay:1e3*parseFloat(this.options.sliderAutoplay),disableOnInteraction:!1},navigation:"true"===this.options.sliderArrows&&{nextEl:".vp-portfolio__items-arrow-next",prevEl:".vp-portfolio__items-arrow-prev"},pagination:"true"===this.options.sliderBullets&&{el:".vp-portfolio__items-bullets",clickable:!0,dynamicBullets:"true"===this.options.sliderBulletsDynamic,renderBullet:function(t,i){return'<span class="'.concat(i,'" data-bullet-index="').concat(t,'" data-bullet-number="').concat(t+1,'"></span>')}},mousewheel:"true"===this.options.sliderMousewheel,slidesPerView:e,breakpoints:o,keyboard:!0,grabCursor:!0}).speed&&(t.speed=1);var a=0;t.on={transitionEnd:function(){0===a?(a=1,this.setTransition(1),this.setTranslate(this.translate+.1)):1===a&&(a=2,this.slideReset())}},this.emitEvent("beforeInitSwiper",[t]),new window.Swiper(i[0],t),"true"===this.options.sliderAutoplayHoverPause&&parseFloat(this.options.sliderAutoplay)>0&&(this.$item.on("mouseenter.vpf-uid-".concat(this.uid),".swiper-container",function(){i[0].swiper.autoplay.stop()}),this.$item.on("mouseleave.vpf-uid-".concat(this.uid),".swiper-container",function(){i[0].swiper.autoplay.start()})),this.emitEvent("initSwiper",[t])}}},{key:"destroySwiper",value:function(){var t=this.$items_wrap.parent(),i=t[0].swiper;i&&(i.destroy(),t.removeClass("swiper-container"),this.$items_wrap.removeClass("swiper-wrapper"),this.$items_wrap.children().removeClass("swiper-slide"),t.find(".vp-portfolio__items-arrow, .vp-portfolio__items-bullets").remove(),this.emitEvent("destroySwiper"))}},{key:"initPhotoswipe",value:function(){var t=this;if(void 0!==v&&t.options.itemsClickAction&&"popup_gallery"===t.options.itemsClickAction&&!t.$item.closest("#vp_preview").length){if(!l(".vp-pswp").length){var i='\n <div class="pswp vp-pswp vp-pswp-uid-'.concat(t.uid,'" tabindex="-1" role="dialog" aria-hidden="true">\n <div class="pswp__bg"></div>\n <div class="pswp__scroll-wrap">\n <div class="pswp__container">\n <div class="pswp__item"></div>\n <div class="pswp__item"></div>\n <div class="pswp__item"></div>\n </div>\n <div class="pswp__ui pswp__ui--hidden">\n <div class="pswp__top-bar">\n <div class="pswp__counter"></div>\n <a class="pswp__button pswp__button--close" title="').concat(u.pswp_close,'"></a>\n <a class="pswp__button pswp__button--share" title="').concat(u.pswp_share,'"></a>\n <a class="pswp__button pswp__button--fs" title="').concat(u.pswp_fs,'"></a>\n <a class="pswp__button pswp__button--zoom" title="').concat(u.pswp_zoom,'"></a>\n </div>\n <div class="pswp__preloader">\n <div class="pswp__preloader__icn">\n <div class="pswp__preloader__cut">\n <div class="pswp__preloader__donut"></div>\n </div>\n </div>\n </div>\n <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">\n <div class="pswp__share-tooltip"></div>\n </div>\n <a class="pswp__button pswp__button--arrow--left" title="').concat(u.pswp_prev,'"></a>\n <a class="pswp__button pswp__button--arrow--right" title="').concat(u.pswp_next,'"></a>\n <div class="pswp__caption">\n <div class="pswp__caption__center"></div>\n </div>\n </div>\n </div>\n </div>\n ');l("body").append(i)}var e=function(i,e,o,n){var a=l(".vp-pswp")[0],r=function(t){var i,e,o,s,n,a=[];return l(t).find(".vp-portfolio__item-wrap").each(function(){if(i=l(this).find(".vp-portfolio__item-popup"),e=(i.attr("data-vp-popup-img-size")||"1920x1080").split("x"),o=(i.attr("data-vp-popup-video-size")||"1920x1080").split("x"),n=i.attr("data-vp-popup-video"))s={html:n,vw:parseInt(o[0],10),vh:parseInt(o[1],10)};else{s={src:i.attr("data-vp-popup-img"),w:parseInt(e[0],10),h:parseInt(e[1],10)};var t=i.html();t&&(s.title=t),s.el=this;var r=i.attr("data-vp-popup-md-img")||s.src;r&&(e=(i.attr("data-vp-popup-md-img-size")||i.attr("data-vp-popup-img-size")||"1920x1080").split("x"),s.m={src:r,w:parseInt(e[0],10),h:parseInt(e[1],10)}),s.o={src:s.src,w:s.w,h:s.h}}a.push(s)}),a}(e),p={captionAndToolbarShowEmptyCaptions:!1,closeEl:m.show_close_button,captionEl:m.show_caption,fullscreenEl:m.show_fullscreen_button,zoomEl:m.show_zoom_button,shareEl:m.show_share_button,counterEl:m.show_counter,arrowEl:m.show_arrows,shareButtons:[{id:"facebook",label:u.pswp_share_fb,url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:u.pswp_share_tw,url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{id:"pinterest",label:u.pswp_share_pin,url:"https://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"}],bgOpacity:1,tapToClose:!0,tapToToggleControls:!1,showHideOpacity:!0,galleryUID:t.uid};if(n)if(p.galleryPIDs){for(var d=0;d<r.length;d++)if(r[d].pid===i){p.index=d;break}}else p.index=parseInt(i,10)-1;else p.index=parseInt(i,10);if(!isNaN(p.index)){o&&(p.showAnimationDuration=0);var c,f,_=new v(a,h,r,p),y=!1,w=!0;_.listen("beforeResize",function(){c=_.viewportSize.x*window.devicePixelRatio,y&&c<1e3?(y=!1,f=!0):!y&&c>=1e3&&(y=!0,f=!0),f&&!w&&_.invalidateCurrItems(),w&&(w=!1),f=!1}),_.listen("gettingData",function(t,i){i.html||(y?(i.src=i.o.src,i.w=i.o.w,i.h=i.o.h):(i.src=i.m.src,i.w=i.m.w,i.h=i.m.h))}),_.listen("resize",function(){s(this)}),_.listen("afterChange",function(){s(this)}),_.listen("beforeChange",function(){if(this&&this.itemHolders.length){var t=this.getCurrentIndex();this.itemHolders.forEach(function(i){if(i.el&&i.index!==t){var e=l(i.el).find(".vp-pswp-video iframe");e.length&&e.attr("src",e.attr("src"))}})}}),_.listen("destroy",function(){this&&this.itemHolders.length&&this.itemHolders.forEach(function(t){t.el&&l(t.el).find(".vp-pswp-video").remove()})}),_.init()}};t.$item.on("click.vpf-uid-".concat(t.uid),".vp-portfolio__item",function(i){i.preventDefault();var o=0,s=this;t.$item.find(".vp-portfolio__item").each(function(t){return this!==s||(o=t,!1)}),e(o,t.$item[0])});var o=function(){var t=window.location.hash.substring(1),i={};if(t.length<5)return i;for(var e=t.split("&"),o=0;o<e.length;o++)if(e[o]){var s=e[o].split("=");s.length<2||(i[s[0]]=s[1])}return i}();o.pid&&o.gid===t.uid&&e(o.pid,t.$item[0],!0,!0)}function s(t,i){if(void 0!==i){var e,o=t.viewportSize.x,n=t.viewportSize.y,a=i.vw/i.vh,r=l(i.container),p=t.options.barsSize,d=0,c=0;p&&(d=p.top&&"auto"!==p.top?p.top:0,c=p.bottom&&"auto"!==p.bottom?p.bottom:0),e=a>o/(n-=d+c)?o:n*a,r.find(".vp-pswp-video").css("max-width",e),r.css({top:d,bottom:c})}else t&&t.itemHolders.length&&t.itemHolders.forEach(function(i){i.item&&i.item.html&&s(t,i.item)})}}},{key:"destroyPhotoswipe",value:function(){this.$item.off("click.vpf-uid-".concat(this.uid)),l(".vp-pswp-uid-".concat(this.uid)).remove()}},{key:"addItems",value:function(t,i){var e=this,o=e.$items_wrap.data("isotope"),s=e.$items_wrap.data("fjGallery"),n=e.$items_wrap.parent()[0].swiper;if(o){if(i){var a=e.$items_wrap.find(".vp-portfolio__item-wrap");e.$items_wrap.isotope("remove",a),e.$items_wrap.prepend(t).isotope("prepended",t)}else e.$items_wrap.append(t).isotope("appended",t);setTimeout(function(){e.initIsotope("layout")},0)}else if(s)i?(e.destroyFjGallery(),e.$items_wrap.find(".vp-portfolio__item-wrap").remove(),e.$items_wrap.prepend(t),e.initFjGallery()):(e.$items_wrap.append(t),e.initFjGallery("appendImages",t));else if(n){i&&n.removeAllSlides();var r=[];t.addClass("swiper-slide").each(function(){r.push(this)}),n.appendSlide(r)}e.emitEvent("addItems",[t,i])}},{key:"removeItems",value:function(t){this.$items_wrap.data("isotope")&&this.$items_wrap.isotope("remove",t),this.emitEvent("removeItems",[t])}},{key:"loadNewItems",value:function(t,i,e){var o=this;!o.loading&&t&&(o.loading=!0,o.$item.addClass("vp-portfolio__loading"),o.emitEvent("startLoadingNewItems",[t]),l.get(t,{},function(t){t=t.replace("<body",'<body><div id="vp-infinite-load-body"').replace("</body>","</div></body>");var s=l(t).filter("#vp-infinite-load-body"),n=s.find(".vp-portfolio.vp-uid-".concat(o.uid));if(n.length){var a=n.find(".vp-portfolio__items").html();o.$filter.length&&o.$filter.each(function(){var t=l(this),i="";i=t.parent().hasClass("vp-single-filter")?s.find('[class="'.concat(t.parent().attr("class").replace(" vp-single-filter__ready",""),'"] .vp-portfolio__filter-wrap')).html():n.find(".vp-portfolio__filter-wrap").html(),t.html(i)}),o.$pagination.length&&o.$pagination.html(n.find(".vp-portfolio__pagination-wrap").html()),o.addItems(l(a),i),o.emitEvent("loadedNewItems",[n,n,t])}var r=n.attr("data-vp-next-page-url");o.options.nextPageUrl=r,o.$item.attr("data-vp-next-page-url",r),o.$item.removeClass("vp-portfolio__loading"),o.loading=!1,o.emitEvent("endLoadingNewItems"),o.prepareLazyLoad(),o.initCustomColors(),e&&e()}))}}]),t}();l(document).on("lazybeforeunveil",function(t){var i=l(t.target);i.hasClass("visual-portfolio-lazyload")&&i.closest(".vp-portfolio__item-img").addClass("vp-portfolio__item-img-lazyloading")}),l(document).on("lazyloaded",function(t){var i=l(t.target);i.hasClass("visual-portfolio-lazyload")&&i.closest(".vp-portfolio__item-img-lazyloading").removeClass("vp-portfolio__item-img-lazyloading")});var S=function(t){var i,e=Array.prototype.slice.call(arguments,1);return this.each(function(){if(void 0===i)if("object"===r(t)||void 0===t)this.vpf||(this.vpf=new x(l(this),t));else if(this.vpf){var o;i=(o=this.vpf)[t].apply(o,a(e))}}),void 0!==i?i:this};S.constructor=x;var $=jQuery.fn.vpf;jQuery.fn.vpf=S,jQuery.fn.vpf.noConflict=function(){return jQuery.fn.vpf=$,this},l(".vp-portfolio").vpf(),l(function(){l(".vp-portfolio").vpf()});var C=Object(o.b)(200,function(){n()(function(){l(".vp-portfolio:not(.vp-portfolio__ready)").vpf()})});window.MutationObserver?new window.MutationObserver(C).observe(document.documentElement,{childList:!0,subtree:!0}):l(document).on("DOMContentLoaded DOMNodeInserted load",function(){C()})},164:function(t,i,e){(function(i){var e;e="undefined"!=typeof window?window:void 0!==i?i:"undefined"!=typeof self?self:{},t.exports=e}).call(this,e(59))},30:function(t,i,e){"use strict";function o(t,i,e,o){var s,n=0;return"boolean"!=typeof i&&(o=e,e=i,i=void 0),function(){var a=this,r=Number(new Date)-n,p=arguments;function l(){n=Number(new Date),e.apply(a,p)}o&&!s&&l(),s&&clearTimeout(s),void 0===o&&r>t?l():!0!==i&&(s=setTimeout(o?function(){s=void 0}:l,void 0===o?t-r:t))}}function s(t,i,e){return void 0===e?o(t,i,!1):o(t,e,!1!==i)}e.d(i,"b",function(){return o}),e.d(i,"a",function(){return s})},59:function(t,i){var e;e=function(){return this}();try{e=e||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(e=window)}t.exports=e}});
|
1 |
+
!function(t){var i={};function e(o){if(i[o])return i[o].exports;var s=i[o]={i:o,l:!1,exports:{}};return t[o].call(s.exports,s,s.exports,e),s.l=!0,s.exports}e.m=t,e.c=i,e.d=function(t,i,o){e.o(t,i)||Object.defineProperty(t,i,{enumerable:!0,get:o})},e.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},e.t=function(t,i){if(1&i&&(t=e(t)),8&i)return t;if(4&i&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(e.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&i&&"string"!=typeof t)for(var s in t)e.d(o,s,function(i){return t[i]}.bind(null,s));return o},e.n=function(t){var i=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(i,"a",i),i},e.o=function(t,i){return Object.prototype.hasOwnProperty.call(t,i)},e.p="",e(e.s=168)}({161:function(t,i,e){var o=e(170),s=o.requestAnimationFrame||o.webkitRequestAnimationFrame||o.mozRequestAnimationFrame||function(t){var i=+new Date,e=Math.max(0,16-(i-n)),o=setTimeout(t,e);return n=i,o},n=+new Date;var a=o.cancelAnimationFrame||o.webkitCancelAnimationFrame||o.mozCancelAnimationFrame||clearTimeout;Function.prototype.bind&&(s=s.bind(o),a=a.bind(o)),(t.exports=s).cancel=a},168:function(t,i,e){t.exports=e(169)},169:function(t,i,e){"use strict";e.r(i);var o=e(30),s=e(161),n=e.n(s);function a(t){return function(t){if(Array.isArray(t)){for(var i=0,e=new Array(t.length);i<t.length;i++)e[i]=t[i];return e}}(t)||function(t){if(Symbol.iterator in Object(t)||"[object Arguments]"===Object.prototype.toString.call(t))return Array.from(t)}(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance")}()}function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function p(t,i){for(var e=0;e<i.length;e++){var o=i[e];o.enumerable=o.enumerable||!1,o.configurable=!0,"value"in o&&(o.writable=!0),Object.defineProperty(t,o.key,o)}}
|
2 |
/*!
|
3 |
* Name : Visual Portfolio
|
4 |
+
* Version : 1.11.0
|
5 |
* Author : nK https://nkdev.info
|
6 |
*/
|
7 |
+
var l=jQuery,d=window,c=d.VPData,f=d.objectFitImages,v=d.PhotoSwipe,u=d.PhotoSwipeUI_Default,h=c.__,m=c.settingsPopupGallery,_=l(window),w=0,y=0;function g(){w=_.width(),y=_.height()}g(),_.on("resize load orientationchange",g);var b=[320,576,768,992,1200];void 0!==f&&(f(".vp-portfolio img:not(.visual-portfolio-lazyload)"),l(document).on("lazybeforeunveil",function(t){var i=l(t.target);i.hasClass("visual-portfolio-lazyload")&&i.one("load",function(){f(i[0])})}));var x=function(){function t(i,e){!function(t,i){if(!(t instanceof i))throw new TypeError("Cannot call a class as a function")}(this,t);this.$item=i;for(var o=i[0].className.split(/\s+/),s=0;s<o.length;s++)o[s]&&/^vp-uid-/.test(o[s])&&(this.uid=o[s].replace(/^vp-uid-/,"")),o[s]&&/^vp-id-/.test(o[s])&&(this.id=o[s].replace(/^vp-id-/,""));this.uid?(this.$items_wrap=i.find(".vp-portfolio__items"),this.$slider_thumbnails_wrap=i.find(".vp-portfolio__thumbnails"),this.$pagination=i.find(".vp-portfolio__pagination-wrap"),this.$filter=i.find(".vp-portfolio__filter-wrap"),this.$sort=i.find(".vp-portfolio__sort-wrap"),this.id&&(this.$filter=this.$filter.add(".vp-single-filter.vp-id-".concat(this.id," .vp-portfolio__filter-wrap"))),this.id&&(this.$sort=this.$sort.add(".vp-single-sort.vp-id-".concat(this.id," .vp-portfolio__sort-wrap"))),this.userOptions=e,this.firstRun=!0,this.init()):console.error(h.couldnt_retrieve_vp)}var i,e,o;return i=t,(e=[{key:"emitEvent",value:function(t,i){i=i?[this].concat(i):[this],this.$item.trigger("".concat(t,".vpf"),i),this.$item.trigger("".concat(t,".vpf-uid-").concat(this.uid),i)}},{key:"init",value:function(){this.firstRun||this.destroy(),this.destroyed=!1,this.initOptions(),this.initEvents(),this.prepareLazyLoad(),this.initLayout(),this.initCustomColors(),this.initPhotoswipe(),this.emitEvent("init"),this.$item.addClass("vp-portfolio__ready"),this.id&&(l(".vp-single-filter.vp-id-".concat(this.id)).addClass("vp-single-filter__ready"),l(".vp-single-sort.vp-id-".concat(this.id)).addClass("vp-single-sort__ready")),this.initIsotope(),this.initFjGallery(),this.initSwiper(),this.resized(),this.imagesLoaded(),this.firstRun=!1}},{key:"resized",value:function(){if("function"==typeof window.Event)window.dispatchEvent(new window.Event("resize"));else{var t=window.document.createEvent("UIEvents");t.initUIEvent("resize",!0,!1,window,0),window.dispatchEvent(t)}this.emitEvent("resized")}},{key:"imagesLoaded",value:function(){var t=this,i=this;i.$items_wrap.imagesLoaded&&i.$items_wrap.imagesLoaded(function(){i.initIsotope("layout"),i.initFjGallery(),t.emitEvent("imagesLoaded")})}},{key:"destroy",value:function(){this.$item.removeClass("vp-portfolio__ready"),this.id&&(l(".vp-single-filter.vp-id-".concat(this.id)).removeClass("vp-single-filter__ready"),l(".vp-single-sort.vp-id-".concat(this.id)).removeClass("vp-single-sort__ready")),this.destroyEvents(),this.removeStyle(),this.renderStyle(),this.destroyPhotoswipe(),this.destroyIsotope(),this.destroyFjGallery(),this.destroySwiper(),this.emitEvent("destroy"),this.destroyed=!0}},{key:"addStyle",value:function(t,i,e){e=e||"";var o=this.uid;this.stylesList||(this.stylesList={}),void 0===this.stylesList[o]&&(this.stylesList[o]={}),void 0===this.stylesList[o][e]&&(this.stylesList[o][e]={}),void 0===this.stylesList[o][e][t]&&(this.stylesList[o][e][t]={}),this.stylesList[o][e][t]=l.extend(this.stylesList[o][e][t],i),this.emitEvent("addStyle",[t,i,e,this.stylesList])}},{key:"removeStyle",value:function(t,i,e){e=e||"";var o=this.uid;this.stylesList||(this.stylesList={}),void 0===this.stylesList[o]||t||(this.stylesList[o]={}),void 0!==this.stylesList[o]&&void 0!==this.stylesList[o][e]&&void 0!==this.stylesList[o][e][t]&&t&&delete this.stylesList[o][e][t],this.emitEvent("removeStyle",[t,i,this.stylesList])}},{key:"renderStyle",value:function(){var t=this,i=t.uid,e="";t.stylesList||(t.stylesList={}),void 0!==t.stylesList[i]&&Object.keys(t.stylesList[i]).forEach(function(o){o&&(e+="@media ".concat(o," {")),Object.keys(t.stylesList[i][o]).forEach(function(s){e+=".vp-uid-".concat(i," ").concat(s," {"),Object.keys(t.stylesList[i][o][s]).forEach(function(n){e+="".concat(n,":").concat(t.stylesList[i][o][s][n],";")}),e+="}"}),o&&(e+="}")});var o=l("#vp-style-".concat(i));o.length||(o=l("<style>").attr("id","vp-style-".concat(i)).appendTo("head")),o.html(e),t.emitEvent("renderStyle",[e,t.stylesList,o])}},{key:"firstToLowerCase",value:function(t){return t.substr(0,1).toLowerCase()+t.substr(1)}},{key:"initOptions",value:function(t){var i=this;i.defaults={layout:"tile",itemsGap:0,tilesType:"3|1,1|",masonryColumns:3,gridColumns:3,justifiedRowHeight:250,justifiedRowHeightTolerance:.25,pagination:"load-more"},t&&(i.userOptions=t);var e=i.$item[0].dataset,o={};Object.keys(e).forEach(function(t){t&&"vp"===t.substring(0,2)&&(o[i.firstToLowerCase(t.substring(2))]=e[t])}),i.options=l.extend({},i.defaults,o,i.userOptions),i.emitEvent("initOptions")}},{key:"isCrossLine",value:function(t,i,e,o){var s=(o.x-e.x)*(t.y-e.y)-(o.y-e.y)*(t.x-e.x),n=(o.x-e.x)*(i.y-e.y)-(o.y-e.y)*(i.x-e.x),a=(i.x-t.x)*(e.y-t.y)-(i.y-t.y)*(e.x-t.x),r=(i.x-t.x)*(o.y-t.y)-(i.y-t.y)*(o.x-t.x);return s*n<=0&&a*r<=0}},{key:"initEvents",value:function(){var t,i=this,e=".vpf-uid-".concat(i.uid);function o(){var t=i.$item[0].getBoundingClientRect(),e=t.left,o=w-t.right,s=parseFloat(i.$item.css("margin-left")||0),n=parseFloat(i.$item.css("margin-right")||0);i.$item.css({"margin-left":s-e,"margin-right":n-o})}if(i.$item.hasClass("vp-portfolio__stretch")&&(_.on("load".concat(e," resize").concat(e," orientationchange").concat(e),function(){o()}),o()),"fly"===i.options.itemsStyle){var s={};_.on("mousemove".concat(e),function(t){s={x:t.clientX,y:t.clientY}}),i.$item.on("mouseenter".concat(e," mouseleave").concat(e),".vp-portfolio__item",function(t){var e=l(this),o=e[0].getBoundingClientRect(),n=e.find(".vp-portfolio__item-overlay"),a="mouseenter"===t.type,r="0%",p="0%",d={x:t.clientX,y:t.clientY},c=i.isCrossLine({x:o.left,y:o.top},{x:o.left+o.width,y:o.top},d,s),f=i.isCrossLine({x:o.left,y:o.top+o.height},{x:o.left+o.width,y:o.top+o.height},d,s),v=i.isCrossLine({x:o.left,y:o.top},{x:o.left,y:o.top+o.height},d,s),u=i.isCrossLine({x:o.left+o.width,y:o.top},{x:o.left+o.width,y:o.top+o.height},d,s);if(!(c||f||v||u)){var h=(o.width/2-d.x+o.left)/(o.width/2),m=(o.height/2-d.y+o.top)/(o.height/2);Math.abs(h)>Math.abs(m)?h>0?v=!0:u=!0:m>0?c=!0:f=!0}c?p="-10".concat(p):f?p="10".concat(p):v?r="-10".concat(r):u&&(r="10".concat(r)),a&&(n.css({transition:"none",transform:"translateX(".concat(r,") translateY(").concat(p,") translateZ(0)")}),n[0].offsetHeight),n.css({transition:".2s transform ease-in-out",transform:"translateX(".concat(a?"0%":r,") translateY(").concat(a?"0%":p,") translateZ(0)")})})}i.$filter.on("click".concat(e),".vp-filter .vp-filter__item a",function(t){t.preventDefault();var e=l(this);i.loading||e.closest(".vp-filter__item").addClass("vp-filter__item-active").siblings().removeClass("vp-filter__item-active"),i.loadNewItems(e.attr("href"),!0)}),i.$sort.on("click".concat(e),".vp-sort .vp-sort__item a",function(t){t.preventDefault();var e=l(this);i.loading||e.closest(".vp-sort__item").addClass("vp-sort__item-active").siblings().removeClass("vp-sort__item-active"),i.loadNewItems(e.attr("href"),!0)}),i.$filter.add(i.$sort).on("change".concat(e),".vp-filter select, .vp-sort select",function(){var t=l(this),e=t.val(),o=t.find('[value="'.concat(e,'"]'));o.length&&i.loadNewItems(o.attr("data-vp-url"),!0)}),i.$item.on("click".concat(e),".vp-pagination .vp-pagination__item a",function(t){t.preventDefault();var e=l(this);e.hasClass("vp-pagination__no-more")&&"paged"!==i.options.pagination||i.loadNewItems(e.attr("href"),"paged"===i.options.pagination)}),i.$item.on("click".concat(e),".vp-portfolio__items .vp-portfolio__item-meta-category a",function(t){t.preventDefault(),t.stopPropagation(),i.loadNewItems(l(this).attr("href"),!0)});var n=250;function a(){var t=i.$item[0].getBoundingClientRect();t.bottom>0&&t.bottom-n<=y&&i.loadNewItems(i.options.nextPageUrl,!1,function(){a()})}"infinite"===i.options.pagination&&(_.on("load".concat(e," scroll").concat(e," resize").concat(e," orientationchange").concat(e),function(){clearTimeout(t),t=setTimeout(function(){a()},60)}),a()),i.$item.on("transitionend".concat(e),".vp-portfolio__items",function(t){t.currentTarget===t.target&&i.resized()}),i.emitEvent("initEvents")}},{key:"destroyEvents",value:function(){var t=".vpf-uid-".concat(this.uid);this.$item.off(t),this.$filter.off(t),this.$sort.off(t),_.off(t),this.emitEvent("destroyEvents")}},{key:"prepareLazyLoad",value:function(){var t=window.lazySizesConfig;if(t){var i={"data-vpf-src":t.srcAttr,"data-vpf-sizes":t.sizesAttr,"data-vpf-srcset":t.srcsetAttr};this.$items_wrap.add(this.$slider_thumbnails_wrap).find(".visual-portfolio-lazyload:not(.".concat(t.lazyClass,")")).each(function(){var e=l(this);Object.keys(i).forEach(function(t){i[t]&&t!==i[t]&&e.attr(t)&&(e.attr(i[t],e.attr(t)),e.removeAttr(t))}),e.addClass(t.lazyClass)})}}},{key:"getTilesSettings",value:function(){var t=this.options.tilesType.split(/[:|]/);return void 0===t[t.length-1]||t[t.length-1]||t.pop(),t}},{key:"initLayout",value:function(){var t=this;if(t.options.layout)switch(t.options.layout){case"tiles":var i=t.getTilesSettings(),e=parseInt(i[0],10)||1;if(i.shift(),t.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/e,"%")}),i&&i.length)for(var o=0;o<i.length;o++){var s=i[o].split(","),n=parseFloat(s[0])||1,a=parseFloat(s[1])||1,r=".vp-portfolio__item-wrap";i.length>1&&(r+=":nth-of-type(".concat(i.length,"n+").concat(o+1,")")),n&&1!==n&&t.addStyle(r,{width:"".concat(100*n/e,"%")}),t.addStyle("".concat(r," .vp-portfolio__item-img-wrap::before"),{"margin-top":"".concat(100*a,"%")})}for(var p=e-1,l=Math.min(b.length-1,p);l>=0;l--)p>0&&void 0!==b[l]&&(t.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/p,"%")},"screen and (max-width: ".concat(b[l],"px)")),t.addStyle(".vp-portfolio__item-wrap:nth-of-type(n)",{width:"".concat(100/p,"%")},"screen and (max-width: ".concat(b[l],"px)"))),p-=1;break;case"masonry":case"grid":var d=t.options["masonry"===t.options.layout?"masonryColumns":"gridColumns"];t.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/d,"%")});for(var c=d-1,f=Math.min(b.length-1,c);f>=0;f--)c>0&&void 0!==b[f]&&t.addStyle(".vp-portfolio__item-wrap",{width:"".concat(100/c,"%")},"screen and (max-width: ".concat(b[f],"px)")),c-=1;case"justified":break;case"slider":["items","thumbnails"].forEach(function(i){var e="items"===i?t.options.sliderItemsHeight:t.options.sliderThumbnailsHeight,o=i.replace(/s$/g,"");if("auto"!==e)if("auto"===("items"===i?t.options.sliderSlidesPerView:t.options.sliderThumbnailsPerView)){var s="auto";"items"===i&&"fade"===t.options.sliderEffect&&(s="100%"),e.indexOf("%")===e.length-1?(t.addStyle(".vp-portfolio__".concat(i,"-wrap::before"),{content:'""',display:"block",width:"100%","margin-top":isNaN(e)?e:"".concat(e,"px")}),t.addStyle(".vp-portfolio__".concat(i),{position:"absolute",top:0,left:0,right:0,bottom:0}),t.addStyle(".vp-portfolio__".concat(o,"-wrap"),{width:"auto",height:"true"===t.options.sliderBullets?"calc( 100% - 25px )":"100%"}),t.addStyle(".vp-portfolio__".concat(o,", .vp-portfolio__").concat(o,"-img-wrap, .vp-portfolio__").concat(o,"-img, .vp-portfolio__").concat(o,"-wrap .vp-portfolio__").concat(o," .vp-portfolio__").concat(o,"-img a, .vp-portfolio__").concat(o,"-wrap .vp-portfolio__").concat(o," .vp-portfolio__").concat(o,"-img img"),{width:s,height:"100%"})):(t.addStyle(".vp-portfolio__".concat(o,"-wrap"),{width:"auto"}),t.addStyle(".vp-portfolio__".concat(o," .vp-portfolio__").concat(o,"-img img"),{width:s,height:isNaN(e)?e:"".concat(e,"px")}))}else t.addStyle(".vp-portfolio__".concat(o,"-img-wrap::before"),{"margin-top":isNaN(e)?e:"".concat(e,"px")}),t.addStyle(".vp-portfolio__".concat(o,"-img img"),{position:"absolute",top:0,right:0,bottom:0,left:0}),t.addStyle(".vp-portfolio__".concat(o,"-img"),{position:"absolute",top:0,right:0,bottom:0,left:0}),t.addStyle(".vp-portfolio__".concat(o," .vp-portfolio__").concat(o,"-img img"),{width:"100%",height:"100%"})}),t.options.sliderThumbnailsGap&&t.addStyle(".vp-portfolio__thumbnails-wrap",{"margin-top":"".concat(t.options.sliderThumbnailsGap,"px")})}var v=parseInt(t.options.itemsGap,10);if(v&&("tiles"===t.options.layout||"masonry"===t.options.layout||"grid"===t.options.layout)){t.addStyle(".vp-portfolio__items",{"margin-left":"-".concat(v,"px"),"margin-top":"-".concat(v,"px")});var u="".concat(v,"px");t.addStyle(".vp-portfolio__items .vp-portfolio__item-wrap .vp-portfolio__item",{"margin-left":u,"margin-top":u}),"tiles"===t.options.layout&&(t.addStyle(".vp-portfolio__item-wrap .vp-portfolio__item-img-wrap",{"margin-left":"-".concat(u),"margin-top":"-".concat(u)}),t.addStyle(".vp-portfolio__item-wrap .vp-portfolio__item-img",{left:u,top:u}))}t.renderStyle(),t.emitEvent("initLayout")}},{key:"initCustomColors",value:function(){var t=this;t.$item.find("[data-vp-bg-color]").each(function(){var i=l(this).attr("data-vp-bg-color");t.addStyle('[data-vp-bg-color="'.concat(i,'"]'),{"background-color":"".concat(i," !important")})}),t.$item.find("[data-vp-text-color]").each(function(){var i=l(this).attr("data-vp-text-color");t.addStyle('[data-vp-text-color="'.concat(i,'"]'),{color:"".concat(i," !important")})}),t.renderStyle(),t.emitEvent("initCustomColors")}},{key:"initIsotope",value:function(t){if(this.$items_wrap.isotope&&("tiles"===this.options.layout||"masonry"===this.options.layout||"grid"===this.options.layout)){var i=t||{itemSelector:".vp-portfolio__item-wrap",layoutMode:"grid"===this.options.layout?"fitRows":"masonry",transitionDuration:"0.3s",percentPosition:!0};this.emitEvent("beforeInitIsotope",[t]),this.$items_wrap.isotope(i),this.emitEvent("initIsotope",[t])}}},{key:"destroyIsotope",value:function(){this.$items_wrap.data("isotope")&&(this.$items_wrap.isotope("destroy"),this.emitEvent("destroyIsotope"))}},{key:"initFjGallery",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0],i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(this.$items_wrap.fjGallery&&"justified"===this.options.layout){var e=!1!==t?t:{gutter:parseFloat(this.options.itemsGap)||0,rowHeight:parseFloat(this.options.justifiedRowHeight)||200,rowHeightTolerance:parseFloat(this.options.justifiedRowHeightTolerance)||0,itemSelector:".vp-portfolio__item-wrap",imageSelector:".vp-portfolio__item-img img"};this.emitEvent("beforeInitFjGallery",[e,i]),this.$items_wrap.fjGallery(e,i),this.emitEvent("initFjGallery",[e,i])}}},{key:"destroyFjGallery",value:function(){this.$items_wrap.data("fjGallery")&&(this.$items_wrap.fjGallery("destroy"),this.emitEvent("destroyFjGallery"))}},{key:"initSwiper",value:function(){var t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if("slider"===this.options.layout&&void 0!==window.Swiper){var i=this.$items_wrap.parent();i.addClass("swiper-container"),this.$items_wrap.addClass("swiper-wrapper"),this.$items_wrap.children().addClass("swiper-slide"),"true"!==this.options.sliderArrows||i.find(".vp-portfolio__items-arrow").length||i.append('\n <div class="vp-portfolio__items-arrow vp-portfolio__items-arrow-prev"><span class="'.concat(this.options.sliderArrowsIconPrev,'"></span></div>\n <div class="vp-portfolio__items-arrow vp-portfolio__items-arrow-next"><span class="').concat(this.options.sliderArrowsIconNext,'"></span></div>\n ')),"true"!==this.options.sliderBullets||i.find(".vp-portfolio__items-bullets").length||i.append('<div class="vp-portfolio__items-bullets"></div>');var e=this.options.sliderSlidesPerView||3,o={};if(!isNaN(e))for(var s=e-1,n=Math.min(b.length-1,s);n>=0;n--)s>0&&void 0!==b[n]&&(o[b[n]]={slidesPerView:s}),s-=1;"fade"===(t=t||{speed:1e3*(parseFloat(this.options.sliderSpeed)||0),autoHeight:"auto"===this.options.sliderItemsHeight,effect:this.options.sliderEffect||"slide",spaceBetween:parseFloat(this.options.itemsGap)||0,centeredSlides:"true"===this.options.sliderCenteredSlides,freeMode:"true"===this.options.sliderFreeMode,freeModeSticky:"true"===this.options.sliderFreeModeSticky,loop:"true"===this.options.sliderLoop,autoplay:parseFloat(this.options.sliderAutoplay)>0&&{delay:1e3*parseFloat(this.options.sliderAutoplay),disableOnInteraction:!1},navigation:"true"===this.options.sliderArrows&&{nextEl:".vp-portfolio__items-arrow-next",prevEl:".vp-portfolio__items-arrow-prev"},pagination:"true"===this.options.sliderBullets&&{el:".vp-portfolio__items-bullets",clickable:!0,dynamicBullets:"true"===this.options.sliderBulletsDynamic,renderBullet:function(t,i){return'<span class="'.concat(i,'" data-bullet-index="').concat(t,'" data-bullet-number="').concat(t+1,'"></span>')}},mousewheel:"true"===this.options.sliderMousewheel,slidesPerView:e,breakpoints:o,keyboard:!0,grabCursor:!0}).effect&&(t.fadeEffect={crossFade:!0}),0===t.speed&&(t.speed=1);var a=0;if(t.on={transitionEnd:function(){0===a?(a=1,this.setTransition(1),this.setTranslate(this.translate+.1)):1===a&&(a=2,this.slideReset())}},this.emitEvent("beforeInitSwiper",[t]),this.$slider_thumbnails_wrap.length){var r=this.$slider_thumbnails_wrap.parent();r.addClass("swiper-container"),this.$slider_thumbnails_wrap.addClass("swiper-wrapper"),this.$slider_thumbnails_wrap.children().addClass("swiper-slide");var p=this.options.sliderThumbnailsPerView||8,l={};if(!isNaN(p))for(var d=p-1,c=Math.min(b.length-1,d);c>=0;c--)d>0&&void 0!==b[c]&&(l[b[c]]={slidesPerView:d}),d-=1;var f=new window.Swiper(r[0],{autoHeight:"auto"===this.options.sliderThumbnailsHeight,effect:"slide",spaceBetween:parseFloat(this.options.sliderThumbnailsGap)||0,loop:!1,freeMode:!0,freeModeSticky:!0,loopedSlides:5,slidesPerView:p,breakpoints:l,keyboard:!0,grabCursor:!0,watchSlidesVisibility:!0,watchSlidesProgress:!0});t.thumbs={swiper:f}}new window.Swiper(i[0],t),"true"===this.options.sliderAutoplayHoverPause&&parseFloat(this.options.sliderAutoplay)>0&&(this.$item.on("mouseenter.vpf-uid-".concat(this.uid),".swiper-container",function(){i[0].swiper.autoplay.stop()}),this.$item.on("mouseleave.vpf-uid-".concat(this.uid),".swiper-container",function(){i[0].swiper.autoplay.start()})),this.emitEvent("initSwiper",[t])}}},{key:"destroySwiper",value:function(){var t=this.$items_wrap.parent(),i=t[0].swiper;i&&(i.destroy(),t.removeClass("swiper-container"),this.$items_wrap.removeClass("swiper-wrapper"),this.$items_wrap.children().removeClass("swiper-slide"),t.find(".vp-portfolio__items-arrow, .vp-portfolio__items-bullets").remove(),this.emitEvent("destroySwiper"))}},{key:"initPhotoswipe",value:function(){var t=this;if(void 0!==v&&t.options.itemsClickAction&&"popup_gallery"===t.options.itemsClickAction&&!t.$item.closest("#vp_preview").length){if(!l(".vp-pswp").length){var i='\n <div class="pswp vp-pswp vp-pswp-uid-'.concat(t.uid,'" tabindex="-1" role="dialog" aria-hidden="true">\n <div class="pswp__bg"></div>\n <div class="pswp__scroll-wrap">\n <div class="pswp__container">\n <div class="pswp__item"></div>\n <div class="pswp__item"></div>\n <div class="pswp__item"></div>\n </div>\n <div class="pswp__ui pswp__ui--hidden">\n <div class="pswp__top-bar">\n <div class="pswp__counter"></div>\n <a class="pswp__button pswp__button--close" title="').concat(h.pswp_close,'"></a>\n <a class="pswp__button pswp__button--share" title="').concat(h.pswp_share,'"></a>\n <a class="pswp__button pswp__button--fs" title="').concat(h.pswp_fs,'"></a>\n <a class="pswp__button pswp__button--zoom" title="').concat(h.pswp_zoom,'"></a>\n </div>\n <div class="pswp__preloader">\n <div class="pswp__preloader__icn">\n <div class="pswp__preloader__cut">\n <div class="pswp__preloader__donut"></div>\n </div>\n </div>\n </div>\n <div class="pswp__share-modal pswp__share-modal--hidden pswp__single-tap">\n <div class="pswp__share-tooltip"></div>\n </div>\n <a class="pswp__button pswp__button--arrow--left" title="').concat(h.pswp_prev,'"></a>\n <a class="pswp__button pswp__button--arrow--right" title="').concat(h.pswp_next,'"></a>\n <div class="pswp__caption">\n <div class="pswp__caption__center"></div>\n </div>\n </div>\n </div>\n </div>\n ');l("body").append(i)}var e=function(i,e,o,n){var a=l(".vp-pswp"),r=a[0],p=function(t){var i,e,o,s,n,a=l(t).find(".vp-portfolio__item-wrap"),r=[];return a.each(function(){if((i=l(this).find(".vp-portfolio__item-popup"))&&i.length){if(e=(i.attr("data-vp-popup-img-size")||"1920x1080").split("x"),o=(i.attr("data-vp-popup-video-size")||"1920x1080").split("x"),n=i.attr("data-vp-popup-video"))s={html:n,vw:parseInt(o[0],10),vh:parseInt(o[1],10)};else{s={src:i.attr("data-vp-popup-img"),w:parseInt(e[0],10),h:parseInt(e[1],10)};var t=i.children(".vp-portfolio__item-popup-title").get(0),a=i.children(".vp-portfolio__item-popup-description").get(0);(t||a)&&(s.title=(t?t.outerHTML:"")+(a?a.outerHTML:"")),s.el=this;var p=i.attr("data-vp-popup-md-img")||s.src;p&&(e=(i.attr("data-vp-popup-md-img-size")||i.attr("data-vp-popup-img-size")||"1920x1080").split("x"),s.m={src:p,w:parseInt(e[0],10),h:parseInt(e[1],10)},s.msrc=p),s.o={src:s.src,w:s.w,h:s.h}}r.push(s)}}),r}(e),d={captionAndToolbarShowEmptyCaptions:!1,closeEl:m.show_close_button,captionEl:!0,fullscreenEl:m.show_fullscreen_button,zoomEl:m.show_zoom_button,shareEl:m.show_share_button,counterEl:m.show_counter,arrowEl:m.show_arrows,shareButtons:[{id:"facebook",label:h.pswp_share_fb,url:"https://www.facebook.com/sharer/sharer.php?u={{url}}"},{id:"twitter",label:h.pswp_share_tw,url:"https://twitter.com/intent/tweet?text={{text}}&url={{url}}"},{id:"pinterest",label:h.pswp_share_pin,url:"https://www.pinterest.com/pin/create/button/?url={{url}}&media={{image_url}}&description={{text}}"}],bgOpacity:1,tapToClose:!1,tapToToggleControls:!0,showHideOpacity:!0,galleryUID:t.uid,getThumbBoundsFn:function(t){if(!p[t]||!p[t].el)return!1;var i=l(p[t].el).find("img")[0];if(!i)return!1;var e=i.getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,s=parseFloat(a.css("top"))||0;return{x:e.left,y:e.top+o-s,w:e.width,h:e.height}}};if(n)if(d.galleryPIDs){for(var c=0;c<p.length;c++)if(p[c].pid===i){d.index=c;break}}else d.index=parseInt(i,10)-1;else d.index=parseInt(i,10);if(!isNaN(d.index)){o&&(d.showAnimationDuration=0);var f,_,w=new v(r,u,p,d),y=!1,g=!0;w.listen("beforeResize",function(){f=w.viewportSize.x*window.devicePixelRatio,y&&f<1e3?(y=!1,_=!0):!y&&f>=1e3&&(y=!0,_=!0),_&&!g&&w.invalidateCurrItems(),g&&(g=!1),_=!1}),w.listen("gettingData",function(t,i){i.html||(y?(i.src=i.o.src,i.w=i.o.w,i.h=i.o.h):(i.src=i.m.src,i.w=i.m.w,i.h=i.m.h))}),w.listen("resize",function(){s(this)}),w.listen("afterChange",function(){s(this)}),w.listen("beforeChange",function(){if(this&&this.itemHolders.length){var t=this.getCurrentIndex();this.itemHolders.forEach(function(i){if(i.el&&i.index!==t){var e=l(i.el).find(".vp-pswp-video iframe");e.length&&e.attr("src",e.attr("src"))}})}}),w.listen("destroy",function(){this&&this.itemHolders.length&&this.itemHolders.forEach(function(t){t.el&&l(t.el).find(".vp-pswp-video").remove()})}),w.init()}};t.$item.on("click.vpf-uid-".concat(t.uid),".vp-portfolio__item",function(i){if(l(this).closest(".vp-portfolio__item-wrap").find(".vp-portfolio__item-popup").length){i.preventDefault();var o=0,s=this;t.$item.find(".vp-portfolio__item-wrap .vp-portfolio__item-popup").each(function(t){return l(this).closest(".vp-portfolio__item-wrap").find(".vp-portfolio__item")[0]!==s||(o=t,!1)}),e(o,t.$item[0])}});var o=function(){var t=window.location.hash.substring(1),i={};if(t.length<5)return i;for(var e=t.split("&"),o=0;o<e.length;o++)if(e[o]){var s=e[o].split("=");s.length<2||(i[s[0]]=s[1])}return i}();o.pid&&o.gid===t.uid&&e(o.pid,t.$item[0],!0,!0)}function s(t,i){if(void 0!==i){var e,o=t.viewportSize.x,n=t.viewportSize.y,a=i.vw/i.vh,r=l(i.container),p=t.options.barsSize,d=0,c=0;p&&(d=p.top&&"auto"!==p.top?p.top:0,c=p.bottom&&"auto"!==p.bottom?p.bottom:0),e=a>o/(n-=d+c)?o:n*a,r.find(".vp-pswp-video").css("max-width",e),r.css({top:d,bottom:c})}else t&&t.itemHolders.length&&t.itemHolders.forEach(function(i){i.item&&i.item.html&&s(t,i.item)})}}},{key:"destroyPhotoswipe",value:function(){this.$item.off("click.vpf-uid-".concat(this.uid)),l(".vp-pswp-uid-".concat(this.uid)).remove()}},{key:"addItems",value:function(t,i){var e=this,o=e.$items_wrap.data("isotope"),s=e.$items_wrap.data("fjGallery"),n=e.$items_wrap.parent()[0].swiper;if(o){if(i){var a=e.$items_wrap.find(".vp-portfolio__item-wrap");e.$items_wrap.isotope("remove",a),e.$items_wrap.prepend(t).isotope("prepended",t)}else e.$items_wrap.append(t).isotope("appended",t);setTimeout(function(){e.initIsotope("layout")},0)}else if(s)i?(e.destroyFjGallery(),e.$items_wrap.find(".vp-portfolio__item-wrap").remove(),e.$items_wrap.prepend(t),e.initFjGallery()):(e.$items_wrap.append(t),e.initFjGallery("appendImages",t));else if(n){i&&n.removeAllSlides();var r=[];t.addClass("swiper-slide").each(function(){r.push(this)}),n.appendSlide(r)}e.emitEvent("addItems",[t,i])}},{key:"removeItems",value:function(t){this.$items_wrap.data("isotope")&&this.$items_wrap.isotope("remove",t),this.emitEvent("removeItems",[t])}},{key:"loadNewItems",value:function(t,i,e){var o=this;!o.loading&&t&&(o.loading=!0,o.$item.addClass("vp-portfolio__loading"),o.emitEvent("startLoadingNewItems",[t]),l.get(t,{},function(t){t=t.replace("<body",'<body><div id="vp-infinite-load-body"').replace("</body>","</div></body>");var s=l(t).filter("#vp-infinite-load-body"),n=s.find(".vp-portfolio.vp-uid-".concat(o.uid));if(n.length){var a=n.find(".vp-portfolio__items").html();o.$filter.length&&o.$filter.each(function(){var t=l(this),i="";i=t.parent().hasClass("vp-single-filter")?s.find('[class="'.concat(t.parent().attr("class").replace(" vp-single-filter__ready",""),'"] .vp-portfolio__filter-wrap')).html():n.find(".vp-portfolio__filter-wrap").html(),t.html(i)}),o.$sort.length&&o.$sort.each(function(){var t=l(this),i="";i=t.parent().hasClass("vp-single-sort")?s.find('[class="'.concat(t.parent().attr("class").replace(" vp-single-sort__ready",""),'"] .vp-portfolio__sort-wrap')).html():n.find(".vp-portfolio__sort-wrap").html(),t.html(i)}),o.$pagination.length&&o.$pagination.html(n.find(".vp-portfolio__pagination-wrap").html()),o.addItems(l(a),i),o.emitEvent("loadedNewItems",[n,n,t])}var r=n.attr("data-vp-next-page-url");o.options.nextPageUrl=r,o.$item.attr("data-vp-next-page-url",r),o.$item.removeClass("vp-portfolio__loading"),o.loading=!1,o.emitEvent("endLoadingNewItems"),o.prepareLazyLoad(),o.initCustomColors(),e&&e()}))}}])&&p(i.prototype,e),o&&p(i,o),t}();l(document).on("lazybeforeunveil",function(t){var i=l(t.target);i.hasClass("visual-portfolio-lazyload")&&(i.closest(".vp-portfolio__item-img").addClass("vp-portfolio__item-img-lazyloading"),i.closest(".vp-portfolio__thumbnail-img").addClass("vp-portfolio__thumbnail-img-lazyloading"))}),l(document).on("lazyloaded",function(t){var i=l(t.target);i.hasClass("visual-portfolio-lazyload")&&(i.closest(".vp-portfolio__item-img-lazyloading").removeClass("vp-portfolio__item-img-lazyloading"),i.closest(".vp-portfolio__thumbnail-img-lazyloading").removeClass("vp-portfolio__thumbnail-img-lazyloading"))}),l(".elementor").length&&l(document).on("init.vpf addItems.vpf",function(t,i){i.$item.find(".vp-portfolio__item a").each(function(){/\.(png|jpe?g|gif|svg)(\?.*)?$/i.test(this.href)&&l(this).attr("data-elementor-open-lightbox","no")})});var $=function(t){var i,e=Array.prototype.slice.call(arguments,1);return this.each(function(){if(void 0===i)if("object"===r(t)||void 0===t)this.vpf||(this.vpf=new x(l(this),t));else if(this.vpf){var o;i=(o=this.vpf)[t].apply(o,a(e))}}),void 0!==i?i:this};$.constructor=x;var S=jQuery.fn.vpf;jQuery.fn.vpf=$,jQuery.fn.vpf.noConflict=function(){return jQuery.fn.vpf=S,this},l(".vp-portfolio").vpf(),l(function(){l(".vp-portfolio").vpf()});var C=Object(o.b)(200,function(){n()(function(){l(".vp-portfolio:not(.vp-portfolio__ready)").vpf()})});window.MutationObserver?new window.MutationObserver(C).observe(document.documentElement,{childList:!0,subtree:!0}):l(document).on("DOMContentLoaded DOMNodeInserted load",function(){C()})},170:function(t,i,e){(function(i){var e;e="undefined"!=typeof window?window:void 0!==i?i:"undefined"!=typeof self?self:{},t.exports=e}).call(this,e(77))},30:function(t,i,e){"use strict";function o(t,i,e,o){var s,n=!1,a=0;function r(){s&&clearTimeout(s)}function p(){var p=this,l=Date.now()-a,d=arguments;function c(){a=Date.now(),e.apply(p,d)}n||(o&&!s&&c(),r(),void 0===o&&l>t?c():!0!==i&&(s=setTimeout(o?function(){s=void 0}:c,void 0===o?t-l:t)))}return"boolean"!=typeof i&&(o=e,e=i,i=void 0),p.cancel=function(){r(),n=!0},p}function s(t,i,e){return void 0===e?o(t,i,!1):o(t,e,!1!==i)}e.d(i,"b",function(){return o}),e.d(i,"a",function(){return s})},77:function(t,i){var e;e=function(){return this}();try{e=e||new Function("return this")()}catch(t){"object"==typeof window&&(e=window)}t.exports=e}});
|
assets/vendor/codemirror/addon/comment/comment.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/comment/continuecomment.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/dialog/dialog.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
// Open simple dialogs on top of an editor. Relies on dialog.css.
|
5 |
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
// Open simple dialogs on top of an editor. Relies on dialog.css.
|
5 |
|
assets/vendor/codemirror/addon/edit/closebrackets.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -11,6 +11,7 @@
|
|
11 |
})(function(CodeMirror) {
|
12 |
var defaults = {
|
13 |
pairs: "()[]{}''\"\"",
|
|
|
14 |
triples: "",
|
15 |
explode: "[]{}"
|
16 |
};
|
@@ -109,6 +110,9 @@
|
|
109 |
var pairs = getOption(conf, "pairs");
|
110 |
var pos = pairs.indexOf(ch);
|
111 |
if (pos == -1) return CodeMirror.Pass;
|
|
|
|
|
|
|
112 |
var triples = getOption(conf, "triples");
|
113 |
|
114 |
var identical = pairs.charAt(pos + 1) == ch;
|
@@ -136,9 +140,7 @@
|
|
136 |
var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur)
|
137 |
if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both";
|
138 |
else return CodeMirror.Pass;
|
139 |
-
} else if (opening && (
|
140 |
-
isClosingBracket(next, pairs) ||
|
141 |
-
/\s/.test(next))) {
|
142 |
curType = "both";
|
143 |
} else {
|
144 |
return CodeMirror.Pass;
|
@@ -175,11 +177,6 @@
|
|
175 |
});
|
176 |
}
|
177 |
|
178 |
-
function isClosingBracket(ch, pairs) {
|
179 |
-
var pos = pairs.lastIndexOf(ch);
|
180 |
-
return pos > -1 && pos % 2 == 1;
|
181 |
-
}
|
182 |
-
|
183 |
function charsAround(cm, pos) {
|
184 |
var str = cm.getRange(Pos(pos.line, pos.ch - 1),
|
185 |
Pos(pos.line, pos.ch + 1));
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
11 |
})(function(CodeMirror) {
|
12 |
var defaults = {
|
13 |
pairs: "()[]{}''\"\"",
|
14 |
+
closeBefore: ")]}'\":;>",
|
15 |
triples: "",
|
16 |
explode: "[]{}"
|
17 |
};
|
110 |
var pairs = getOption(conf, "pairs");
|
111 |
var pos = pairs.indexOf(ch);
|
112 |
if (pos == -1) return CodeMirror.Pass;
|
113 |
+
|
114 |
+
var closeBefore = getOption(conf,"closeBefore");
|
115 |
+
|
116 |
var triples = getOption(conf, "triples");
|
117 |
|
118 |
var identical = pairs.charAt(pos + 1) == ch;
|
140 |
var prev = cur.ch == 0 ? " " : cm.getRange(Pos(cur.line, cur.ch - 1), cur)
|
141 |
if (!CodeMirror.isWordChar(next) && prev != ch && !CodeMirror.isWordChar(prev)) curType = "both";
|
142 |
else return CodeMirror.Pass;
|
143 |
+
} else if (opening && (next.length === 0 || /\s/.test(next) || closeBefore.indexOf(next) > -1)) {
|
|
|
|
|
144 |
curType = "both";
|
145 |
} else {
|
146 |
return CodeMirror.Pass;
|
177 |
});
|
178 |
}
|
179 |
|
|
|
|
|
|
|
|
|
|
|
180 |
function charsAround(cm, pos) {
|
181 |
var str = cm.getRange(Pos(pos.line, pos.ch - 1),
|
182 |
Pos(pos.line, pos.ch + 1));
|
assets/vendor/codemirror/addon/edit/closetag.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
/**
|
5 |
* Tag-closer extension for CodeMirror.
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
/**
|
5 |
* Tag-closer extension for CodeMirror.
|
assets/vendor/codemirror/addon/edit/continuelist.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -20,7 +20,17 @@
|
|
20 |
var ranges = cm.listSelections(), replacements = [];
|
21 |
for (var i = 0; i < ranges.length; i++) {
|
22 |
var pos = ranges[i].head;
|
|
|
|
|
23 |
var eolState = cm.getStateAfter(pos.line);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
var inList = eolState.list !== false;
|
25 |
var inQuote = eolState.quote !== 0;
|
26 |
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
20 |
var ranges = cm.listSelections(), replacements = [];
|
21 |
for (var i = 0; i < ranges.length; i++) {
|
22 |
var pos = ranges[i].head;
|
23 |
+
|
24 |
+
// If we're not in Markdown mode, fall back to normal newlineAndIndent
|
25 |
var eolState = cm.getStateAfter(pos.line);
|
26 |
+
var inner = cm.getMode().innerMode(eolState);
|
27 |
+
if (inner.mode.name !== "markdown") {
|
28 |
+
cm.execCommand("newlineAndIndent");
|
29 |
+
return;
|
30 |
+
} else {
|
31 |
+
eolState = inner.state;
|
32 |
+
}
|
33 |
+
|
34 |
var inList = eolState.list !== false;
|
35 |
var inQuote = eolState.quote !== 0;
|
36 |
|
assets/vendor/codemirror/addon/edit/matchbrackets.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -14,20 +14,25 @@
|
|
14 |
|
15 |
var Pos = CodeMirror.Pos;
|
16 |
|
17 |
-
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"};
|
|
|
|
|
|
|
|
|
18 |
|
19 |
function findMatchingBracket(cm, where, config) {
|
20 |
var line = cm.getLineHandle(where.line), pos = where.ch - 1;
|
21 |
var afterCursor = config && config.afterCursor
|
22 |
if (afterCursor == null)
|
23 |
afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
|
|
|
24 |
|
25 |
// A cursor is defined as between two characters, but in in vim command mode
|
26 |
// (i.e. not insert mode), the cursor is visually represented as a
|
27 |
// highlighted box on top of the 2nd character. Otherwise, we allow matches
|
28 |
// from before or after the cursor.
|
29 |
-
var match = (!afterCursor && pos >= 0 && matching[line.text.charAt(pos)]) ||
|
30 |
-
matching[line.text.charAt(++pos)];
|
31 |
if (!match) return null;
|
32 |
var dir = match.charAt(1) == ">" ? 1 : -1;
|
33 |
if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
|
@@ -51,7 +56,7 @@
|
|
51 |
var maxScanLines = (config && config.maxScanLines) || 1000;
|
52 |
|
53 |
var stack = [];
|
54 |
-
var re =
|
55 |
var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
|
56 |
: Math.max(cm.firstLine() - 1, where.line - maxScanLines);
|
57 |
for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
|
@@ -64,7 +69,7 @@
|
|
64 |
var ch = line.charAt(pos);
|
65 |
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
|
66 |
var match = matching[ch];
|
67 |
-
if ((match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
|
68 |
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
|
69 |
else stack.pop();
|
70 |
}
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
14 |
|
15 |
var Pos = CodeMirror.Pos;
|
16 |
|
17 |
+
var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<", "<": ">>", ">": "<<"};
|
18 |
+
|
19 |
+
function bracketRegex(config) {
|
20 |
+
return config && config.bracketRegex || /[(){}[\]]/
|
21 |
+
}
|
22 |
|
23 |
function findMatchingBracket(cm, where, config) {
|
24 |
var line = cm.getLineHandle(where.line), pos = where.ch - 1;
|
25 |
var afterCursor = config && config.afterCursor
|
26 |
if (afterCursor == null)
|
27 |
afterCursor = /(^| )cm-fat-cursor($| )/.test(cm.getWrapperElement().className)
|
28 |
+
var re = bracketRegex(config)
|
29 |
|
30 |
// A cursor is defined as between two characters, but in in vim command mode
|
31 |
// (i.e. not insert mode), the cursor is visually represented as a
|
32 |
// highlighted box on top of the 2nd character. Otherwise, we allow matches
|
33 |
// from before or after the cursor.
|
34 |
+
var match = (!afterCursor && pos >= 0 && re.test(line.text.charAt(pos)) && matching[line.text.charAt(pos)]) ||
|
35 |
+
re.test(line.text.charAt(pos + 1)) && matching[line.text.charAt(++pos)];
|
36 |
if (!match) return null;
|
37 |
var dir = match.charAt(1) == ">" ? 1 : -1;
|
38 |
if (config && config.strict && (dir > 0) != (pos == where.ch)) return null;
|
56 |
var maxScanLines = (config && config.maxScanLines) || 1000;
|
57 |
|
58 |
var stack = [];
|
59 |
+
var re = bracketRegex(config)
|
60 |
var lineEnd = dir > 0 ? Math.min(where.line + maxScanLines, cm.lastLine() + 1)
|
61 |
: Math.max(cm.firstLine() - 1, where.line - maxScanLines);
|
62 |
for (var lineNo = where.line; lineNo != lineEnd; lineNo += dir) {
|
69 |
var ch = line.charAt(pos);
|
70 |
if (re.test(ch) && (style === undefined || cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style)) {
|
71 |
var match = matching[ch];
|
72 |
+
if (match && (match.charAt(1) == ">") == (dir > 0)) stack.push(ch);
|
73 |
else if (!stack.length) return {pos: Pos(lineNo, pos), ch: ch};
|
74 |
else stack.pop();
|
75 |
}
|
assets/vendor/codemirror/addon/edit/matchtags.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/edit/trailingspace.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/fold/brace-fold.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -54,7 +54,7 @@ CodeMirror.registerHelper("fold", "brace", function(cm, start) {
|
|
54 |
++pos;
|
55 |
}
|
56 |
}
|
57 |
-
if (end == null || line == end
|
58 |
return {from: CodeMirror.Pos(line, startCh),
|
59 |
to: CodeMirror.Pos(end, endCh)};
|
60 |
});
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
54 |
++pos;
|
55 |
}
|
56 |
}
|
57 |
+
if (end == null || line == end) return;
|
58 |
return {from: CodeMirror.Pos(line, startCh),
|
59 |
to: CodeMirror.Pos(end, endCh)};
|
60 |
});
|
assets/vendor/codemirror/addon/fold/comment-fold.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/fold/foldcode.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/fold/foldgutter.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/fold/indent-fold.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/fold/markdown-fold.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/fold/xml-fold.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/hint/anyword-hint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/hint/css-hint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/hint/html-hint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -322,6 +322,8 @@
|
|
322 |
itemtype: null,
|
323 |
lang: ["en", "es"],
|
324 |
spellcheck: ["true", "false"],
|
|
|
|
|
325 |
style: null,
|
326 |
tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
327 |
title: null,
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
322 |
itemtype: null,
|
323 |
lang: ["en", "es"],
|
324 |
spellcheck: ["true", "false"],
|
325 |
+
autocorrect: ["true", "false"],
|
326 |
+
autocapitalize: ["true", "false"],
|
327 |
style: null,
|
328 |
tabindex: ["1", "2", "3", "4", "5", "6", "7", "8", "9"],
|
329 |
title: null,
|
assets/vendor/codemirror/addon/hint/javascript-hint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/hint/show-hint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -46,6 +46,10 @@
|
|
46 |
completion.update(true);
|
47 |
});
|
48 |
|
|
|
|
|
|
|
|
|
49 |
function Completion(cm, options) {
|
50 |
this.cm = cm;
|
51 |
this.options = options;
|
@@ -98,7 +102,7 @@
|
|
98 |
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
|
99 |
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
|
100 |
pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
|
101 |
-
(pos.ch
|
102 |
this.close();
|
103 |
} else {
|
104 |
var self = this;
|
@@ -163,6 +167,14 @@
|
|
163 |
Tab: handle.pick,
|
164 |
Esc: handle.close
|
165 |
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
var custom = completion.options.customKeys;
|
167 |
var ourMap = custom ? {} : baseMap;
|
168 |
function addBinding(key, val) {
|
@@ -198,19 +210,22 @@
|
|
198 |
this.data = data;
|
199 |
this.picked = false;
|
200 |
var widget = this, cm = completion.cm;
|
|
|
|
|
201 |
|
202 |
-
var hints = this.hints =
|
203 |
-
|
|
|
204 |
this.selectedHint = data.selectedHint || 0;
|
205 |
|
206 |
var completions = data.list;
|
207 |
for (var i = 0; i < completions.length; ++i) {
|
208 |
-
var elt = hints.appendChild(
|
209 |
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
|
210 |
if (cur.className != null) className = cur.className + " " + className;
|
211 |
elt.className = className;
|
212 |
if (cur.render) cur.render(elt, data, cur);
|
213 |
-
else elt.appendChild(
|
214 |
elt.hintId = i;
|
215 |
}
|
216 |
|
@@ -219,9 +234,9 @@
|
|
219 |
hints.style.left = left + "px";
|
220 |
hints.style.top = top + "px";
|
221 |
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
222 |
-
var winW =
|
223 |
-
var winH =
|
224 |
-
(completion.options.container ||
|
225 |
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
|
226 |
var scrolls = hints.scrollHeight > hints.clientHeight + 1
|
227 |
var startScroll = cm.getScrollInfo();
|
@@ -272,7 +287,7 @@
|
|
272 |
cm.on("scroll", this.onScroll = function() {
|
273 |
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
|
274 |
var newTop = top + startScroll.top - curScroll.top;
|
275 |
-
var point = newTop - (
|
276 |
if (!below) point += hints.offsetHeight;
|
277 |
if (point <= editor.top || point >= editor.bottom) return completion.close();
|
278 |
hints.style.top = newTop + "px";
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
46 |
completion.update(true);
|
47 |
});
|
48 |
|
49 |
+
CodeMirror.defineExtension("closeHint", function() {
|
50 |
+
if (this.state.completionActive) this.state.completionActive.close()
|
51 |
+
})
|
52 |
+
|
53 |
function Completion(cm, options) {
|
54 |
this.cm = cm;
|
55 |
this.options = options;
|
102 |
var pos = this.cm.getCursor(), line = this.cm.getLine(pos.line);
|
103 |
if (pos.line != this.startPos.line || line.length - pos.ch != this.startLen - this.startPos.ch ||
|
104 |
pos.ch < this.startPos.ch || this.cm.somethingSelected() ||
|
105 |
+
(!pos.ch || this.options.closeCharacters.test(line.charAt(pos.ch - 1)))) {
|
106 |
this.close();
|
107 |
} else {
|
108 |
var self = this;
|
167 |
Tab: handle.pick,
|
168 |
Esc: handle.close
|
169 |
};
|
170 |
+
|
171 |
+
var mac = /Mac/.test(navigator.platform);
|
172 |
+
|
173 |
+
if (mac) {
|
174 |
+
baseMap["Ctrl-P"] = function() {handle.moveFocus(-1);};
|
175 |
+
baseMap["Ctrl-N"] = function() {handle.moveFocus(1);};
|
176 |
+
}
|
177 |
+
|
178 |
var custom = completion.options.customKeys;
|
179 |
var ourMap = custom ? {} : baseMap;
|
180 |
function addBinding(key, val) {
|
210 |
this.data = data;
|
211 |
this.picked = false;
|
212 |
var widget = this, cm = completion.cm;
|
213 |
+
var ownerDocument = cm.getInputField().ownerDocument;
|
214 |
+
var parentWindow = ownerDocument.defaultView || ownerDocument.parentWindow;
|
215 |
|
216 |
+
var hints = this.hints = ownerDocument.createElement("ul");
|
217 |
+
var theme = completion.cm.options.theme;
|
218 |
+
hints.className = "CodeMirror-hints " + theme;
|
219 |
this.selectedHint = data.selectedHint || 0;
|
220 |
|
221 |
var completions = data.list;
|
222 |
for (var i = 0; i < completions.length; ++i) {
|
223 |
+
var elt = hints.appendChild(ownerDocument.createElement("li")), cur = completions[i];
|
224 |
var className = HINT_ELEMENT_CLASS + (i != this.selectedHint ? "" : " " + ACTIVE_HINT_ELEMENT_CLASS);
|
225 |
if (cur.className != null) className = cur.className + " " + className;
|
226 |
elt.className = className;
|
227 |
if (cur.render) cur.render(elt, data, cur);
|
228 |
+
else elt.appendChild(ownerDocument.createTextNode(cur.displayText || getText(cur)));
|
229 |
elt.hintId = i;
|
230 |
}
|
231 |
|
234 |
hints.style.left = left + "px";
|
235 |
hints.style.top = top + "px";
|
236 |
// If we're at the edge of the screen, then we want the menu to appear on the left of the cursor.
|
237 |
+
var winW = parentWindow.innerWidth || Math.max(ownerDocument.body.offsetWidth, ownerDocument.documentElement.offsetWidth);
|
238 |
+
var winH = parentWindow.innerHeight || Math.max(ownerDocument.body.offsetHeight, ownerDocument.documentElement.offsetHeight);
|
239 |
+
(completion.options.container || ownerDocument.body).appendChild(hints);
|
240 |
var box = hints.getBoundingClientRect(), overlapY = box.bottom - winH;
|
241 |
var scrolls = hints.scrollHeight > hints.clientHeight + 1
|
242 |
var startScroll = cm.getScrollInfo();
|
287 |
cm.on("scroll", this.onScroll = function() {
|
288 |
var curScroll = cm.getScrollInfo(), editor = cm.getWrapperElement().getBoundingClientRect();
|
289 |
var newTop = top + startScroll.top - curScroll.top;
|
290 |
+
var point = newTop - (parentWindow.pageYOffset || (ownerDocument.documentElement || ownerDocument.body).scrollTop);
|
291 |
if (!below) point += hints.offsetHeight;
|
292 |
if (point <= editor.top || point >= editor.bottom) return completion.close();
|
293 |
hints.style.top = newTop + "px";
|
assets/vendor/codemirror/addon/hint/sql-hint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -275,24 +275,29 @@
|
|
275 |
if (search.charAt(0) == "." || search.charAt(0) == identifierQuote) {
|
276 |
start = nameCompletion(cur, token, result, editor);
|
277 |
} else {
|
278 |
-
|
279 |
-
|
280 |
-
|
281 |
-
|
282 |
-
|
283 |
-
|
284 |
-
|
285 |
-
|
286 |
-
|
287 |
-
|
288 |
-
|
289 |
-
|
290 |
-
|
291 |
-
|
292 |
-
|
293 |
-
|
294 |
-
|
295 |
-
|
|
|
|
|
|
|
|
|
|
|
296 |
|
297 |
return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
|
298 |
});
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
275 |
if (search.charAt(0) == "." || search.charAt(0) == identifierQuote) {
|
276 |
start = nameCompletion(cur, token, result, editor);
|
277 |
} else {
|
278 |
+
var objectOrClass = function(w, className) {
|
279 |
+
if (typeof w === "object") {
|
280 |
+
w.className = className;
|
281 |
+
} else {
|
282 |
+
w = { text: w, className: className };
|
283 |
+
}
|
284 |
+
return w;
|
285 |
+
};
|
286 |
+
addMatches(result, search, defaultTable, function(w) {
|
287 |
+
return objectOrClass(w, "CodeMirror-hint-table CodeMirror-hint-default-table");
|
288 |
+
});
|
289 |
+
addMatches(
|
290 |
+
result,
|
291 |
+
search,
|
292 |
+
tables, function(w) {
|
293 |
+
return objectOrClass(w, "CodeMirror-hint-table");
|
294 |
+
}
|
295 |
+
);
|
296 |
+
if (!disableKeywords)
|
297 |
+
addMatches(result, search, keywords, function(w) {
|
298 |
+
return objectOrClass(w.toUpperCase(), "CodeMirror-hint-keyword");
|
299 |
+
});
|
300 |
+
}
|
301 |
|
302 |
return {list: result, from: Pos(cur.line, start), to: Pos(cur.line, end)};
|
303 |
});
|
assets/vendor/codemirror/addon/hint/xml-hint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -13,9 +13,15 @@
|
|
13 |
|
14 |
var Pos = CodeMirror.Pos;
|
15 |
|
|
|
|
|
|
|
|
|
|
|
16 |
function getHints(cm, options) {
|
17 |
var tags = options && options.schemaInfo;
|
18 |
var quote = (options && options.quoteChar) || '"';
|
|
|
19 |
if (!tags) return;
|
20 |
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
|
21 |
if (token.end > cur.ch) {
|
@@ -45,14 +51,14 @@
|
|
45 |
var cx = inner.state.context, curTag = cx && tags[cx.tagName];
|
46 |
var childList = cx ? curTag && curTag.children : tags["!top"];
|
47 |
if (childList && tagType != "close") {
|
48 |
-
for (var i = 0; i < childList.length; ++i) if (!prefix || childList[i]
|
49 |
result.push("<" + childList[i]);
|
50 |
} else if (tagType != "close") {
|
51 |
for (var name in tags)
|
52 |
-
if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || name
|
53 |
result.push("<" + name);
|
54 |
}
|
55 |
-
if (cx && (!prefix || tagType == "close" && cx.tagName
|
56 |
result.push("</" + cx.tagName + ">");
|
57 |
} else {
|
58 |
// Attribute completion
|
@@ -88,14 +94,14 @@
|
|
88 |
}
|
89 |
replaceToken = true;
|
90 |
}
|
91 |
-
for (var i = 0; i < atValues.length; ++i) if (!prefix || atValues[i]
|
92 |
result.push(quote + atValues[i] + quote);
|
93 |
} else { // An attribute name
|
94 |
if (token.type == "attribute") {
|
95 |
prefix = token.string;
|
96 |
replaceToken = true;
|
97 |
}
|
98 |
-
for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || attr
|
99 |
result.push(attr);
|
100 |
}
|
101 |
}
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
13 |
|
14 |
var Pos = CodeMirror.Pos;
|
15 |
|
16 |
+
function matches(hint, typed, matchInMiddle) {
|
17 |
+
if (matchInMiddle) return hint.indexOf(typed) >= 0;
|
18 |
+
else return hint.lastIndexOf(typed, 0) == 0;
|
19 |
+
}
|
20 |
+
|
21 |
function getHints(cm, options) {
|
22 |
var tags = options && options.schemaInfo;
|
23 |
var quote = (options && options.quoteChar) || '"';
|
24 |
+
var matchInMiddle = options && options.matchInMiddle;
|
25 |
if (!tags) return;
|
26 |
var cur = cm.getCursor(), token = cm.getTokenAt(cur);
|
27 |
if (token.end > cur.ch) {
|
51 |
var cx = inner.state.context, curTag = cx && tags[cx.tagName];
|
52 |
var childList = cx ? curTag && curTag.children : tags["!top"];
|
53 |
if (childList && tagType != "close") {
|
54 |
+
for (var i = 0; i < childList.length; ++i) if (!prefix || matches(childList[i], prefix, matchInMiddle))
|
55 |
result.push("<" + childList[i]);
|
56 |
} else if (tagType != "close") {
|
57 |
for (var name in tags)
|
58 |
+
if (tags.hasOwnProperty(name) && name != "!top" && name != "!attrs" && (!prefix || matches(name, prefix, matchInMiddle)))
|
59 |
result.push("<" + name);
|
60 |
}
|
61 |
+
if (cx && (!prefix || tagType == "close" && matches(cx.tagName, prefix, matchInMiddle)))
|
62 |
result.push("</" + cx.tagName + ">");
|
63 |
} else {
|
64 |
// Attribute completion
|
94 |
}
|
95 |
replaceToken = true;
|
96 |
}
|
97 |
+
for (var i = 0; i < atValues.length; ++i) if (!prefix || matches(atValues[i], prefix, matchInMiddle))
|
98 |
result.push(quote + atValues[i] + quote);
|
99 |
} else { // An attribute name
|
100 |
if (token.type == "attribute") {
|
101 |
prefix = token.string;
|
102 |
replaceToken = true;
|
103 |
}
|
104 |
+
for (var attr in attrs) if (attrs.hasOwnProperty(attr) && (!prefix || matches(attr, prefix, matchInMiddle)))
|
105 |
result.push(attr);
|
106 |
}
|
107 |
}
|
assets/vendor/codemirror/addon/lint/coffeescript-lint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
// Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js
|
5 |
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
// Depends on coffeelint.js from http://www.coffeelint.org/js/coffeelint.js
|
5 |
|
assets/vendor/codemirror/addon/lint/css-lint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
// Depends on csslint.js from https://github.com/stubbornella/csslint
|
5 |
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
// Depends on csslint.js from https://github.com/stubbornella/csslint
|
5 |
|
assets/vendor/codemirror/addon/lint/html-lint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js
|
5 |
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
// Depends on htmlhint.js from http://htmlhint.com/js/htmlhint.js
|
5 |
|
assets/vendor/codemirror/addon/lint/javascript-lint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/lint/json-lint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
// Depends on jsonlint.js from https://github.com/zaach/jsonlint
|
5 |
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
// Depends on jsonlint.js from https://github.com/zaach/jsonlint
|
5 |
|
assets/vendor/codemirror/addon/lint/lint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/lint/yaml-lint.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
@@ -23,7 +23,7 @@ CodeMirror.registerHelper("lint", "yaml", function(text) {
|
|
23 |
}
|
24 |
return found;
|
25 |
}
|
26 |
-
try { jsyaml.
|
27 |
catch(e) {
|
28 |
var loc = e.mark,
|
29 |
// js-yaml YAMLException doesn't always provide an accurate lineno
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
23 |
}
|
24 |
return found;
|
25 |
}
|
26 |
+
try { jsyaml.loadAll(text); }
|
27 |
catch(e) {
|
28 |
var loc = e.mark,
|
29 |
// js-yaml YAMLException doesn't always provide an accurate lineno
|
assets/vendor/codemirror/addon/scroll/annotatescrollbar.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/scroll/scrollpastend.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/scroll/simplescrollbars.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/search/jump-to-line.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
// Defines jumpToLine command. Uses dialog.js if present.
|
5 |
|
@@ -18,8 +18,9 @@
|
|
18 |
else f(prompt(shortText, deflt));
|
19 |
}
|
20 |
|
21 |
-
|
22 |
-
|
|
|
23 |
|
24 |
function interpretLine(cm, string) {
|
25 |
var num = Number(string)
|
@@ -29,7 +30,7 @@
|
|
29 |
|
30 |
CodeMirror.commands.jumpToLine = function(cm) {
|
31 |
var cur = cm.getCursor();
|
32 |
-
dialog(cm,
|
33 |
if (!posStr) return;
|
34 |
|
35 |
var match;
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
// Defines jumpToLine command. Uses dialog.js if present.
|
5 |
|
18 |
else f(prompt(shortText, deflt));
|
19 |
}
|
20 |
|
21 |
+
function getJumpDialog(cm) {
|
22 |
+
return cm.phrase("Jump to line:") + ' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use line:column or scroll% syntax)") + '</span>';
|
23 |
+
}
|
24 |
|
25 |
function interpretLine(cm, string) {
|
26 |
var num = Number(string)
|
30 |
|
31 |
CodeMirror.commands.jumpToLine = function(cm) {
|
32 |
var cur = cm.getCursor();
|
33 |
+
dialog(cm, getJumpDialog(cm), cm.phrase("Jump to line:"), (cur.line + 1) + ":" + cur.ch, function(posStr) {
|
34 |
if (!posStr) return;
|
35 |
|
36 |
var match;
|
assets/vendor/codemirror/addon/search/match-highlighter.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
// Highlighting text that matches the selection
|
5 |
//
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
// Highlighting text that matches the selection
|
5 |
//
|
assets/vendor/codemirror/addon/search/matchesonscrollbar.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/addon/search/search.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
// Define search commands. Depends on dialog.js or another
|
5 |
// implementation of the openDialog method.
|
@@ -98,9 +98,6 @@
|
|
98 |
return query;
|
99 |
}
|
100 |
|
101 |
-
var queryDialog =
|
102 |
-
'<span class="CodeMirror-search-label">Search:</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">(Use /re/ syntax for regexp search)</span>';
|
103 |
-
|
104 |
function startSearch(cm, state, query) {
|
105 |
state.queryText = query;
|
106 |
state.query = parseQuery(query);
|
@@ -136,7 +133,7 @@
|
|
136 |
(hiding = dialog).style.opacity = .4
|
137 |
})
|
138 |
};
|
139 |
-
persistentDialog(cm,
|
140 |
var keyName = CodeMirror.keyName(event)
|
141 |
var extra = cm.getOption('extraKeys'), cmd = (extra && extra[keyName]) || CodeMirror.keyMap[cm.getOption("keyMap")][keyName]
|
142 |
if (cmd == "findNext" || cmd == "findPrev" ||
|
@@ -154,7 +151,7 @@
|
|
154 |
findNext(cm, rev);
|
155 |
}
|
156 |
} else {
|
157 |
-
dialog(cm,
|
158 |
if (query && !state.query) cm.operation(function() {
|
159 |
startSearch(cm, state, query);
|
160 |
state.posFrom = state.posTo = cm.getCursor();
|
@@ -186,10 +183,19 @@
|
|
186 |
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
|
187 |
});}
|
188 |
|
189 |
-
|
190 |
-
|
191 |
-
|
192 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
193 |
|
194 |
function replaceAll(cm, query, text) {
|
195 |
cm.operation(function() {
|
@@ -205,11 +211,11 @@
|
|
205 |
function replace(cm, all) {
|
206 |
if (cm.getOption("readOnly")) return;
|
207 |
var query = cm.getSelection() || getSearchState(cm).lastQuery;
|
208 |
-
var dialogText = '<span class="CodeMirror-search-label">' + (all ?
|
209 |
-
dialog(cm, dialogText +
|
210 |
if (!query) return;
|
211 |
query = parseQuery(query);
|
212 |
-
dialog(cm,
|
213 |
text = parseString(text)
|
214 |
if (all) {
|
215 |
replaceAll(cm, query, text)
|
@@ -225,7 +231,7 @@
|
|
225 |
}
|
226 |
cm.setSelection(cursor.from(), cursor.to());
|
227 |
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
|
228 |
-
confirmDialog(cm,
|
229 |
[function() {doReplace(match);}, advance,
|
230 |
function() {replaceAll(cm, query, text)}]);
|
231 |
};
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
// Define search commands. Depends on dialog.js or another
|
5 |
// implementation of the openDialog method.
|
98 |
return query;
|
99 |
}
|
100 |
|
|
|
|
|
|
|
101 |
function startSearch(cm, state, query) {
|
102 |
state.queryText = query;
|
103 |
state.query = parseQuery(query);
|
133 |
(hiding = dialog).style.opacity = .4
|
134 |
})
|
135 |
};
|
136 |
+
persistentDialog(cm, getQueryDialog(cm), q, searchNext, function(event, query) {
|
137 |
var keyName = CodeMirror.keyName(event)
|
138 |
var extra = cm.getOption('extraKeys'), cmd = (extra && extra[keyName]) || CodeMirror.keyMap[cm.getOption("keyMap")][keyName]
|
139 |
if (cmd == "findNext" || cmd == "findPrev" ||
|
151 |
findNext(cm, rev);
|
152 |
}
|
153 |
} else {
|
154 |
+
dialog(cm, getQueryDialog(cm), "Search for:", q, function(query) {
|
155 |
if (query && !state.query) cm.operation(function() {
|
156 |
startSearch(cm, state, query);
|
157 |
state.posFrom = state.posTo = cm.getCursor();
|
183 |
if (state.annotate) { state.annotate.clear(); state.annotate = null; }
|
184 |
});}
|
185 |
|
186 |
+
|
187 |
+
function getQueryDialog(cm) {
|
188 |
+
return '<span class="CodeMirror-search-label">' + cm.phrase("Search:") + '</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use /re/ syntax for regexp search)") + '</span>';
|
189 |
+
}
|
190 |
+
function getReplaceQueryDialog(cm) {
|
191 |
+
return ' <input type="text" style="width: 10em" class="CodeMirror-search-field"/> <span style="color: #888" class="CodeMirror-search-hint">' + cm.phrase("(Use /re/ syntax for regexp search)") + '</span>';
|
192 |
+
}
|
193 |
+
function getReplacementQueryDialog(cm) {
|
194 |
+
return '<span class="CodeMirror-search-label">' + cm.phrase("With:") + '</span> <input type="text" style="width: 10em" class="CodeMirror-search-field"/>';
|
195 |
+
}
|
196 |
+
function getDoReplaceConfirm(cm) {
|
197 |
+
return '<span class="CodeMirror-search-label">' + cm.phrase("Replace?") + '</span> <button>' + cm.phrase("Yes") + '</button> <button>' + cm.phrase("No") + '</button> <button>' + cm.phrase("All") + '</button> <button>' + cm.phrase("Stop") + '</button> ';
|
198 |
+
}
|
199 |
|
200 |
function replaceAll(cm, query, text) {
|
201 |
cm.operation(function() {
|
211 |
function replace(cm, all) {
|
212 |
if (cm.getOption("readOnly")) return;
|
213 |
var query = cm.getSelection() || getSearchState(cm).lastQuery;
|
214 |
+
var dialogText = '<span class="CodeMirror-search-label">' + (all ? cm.phrase("Replace all:") : cm.phrase("Replace:")) + '</span>';
|
215 |
+
dialog(cm, dialogText + getReplaceQueryDialog(cm), dialogText, query, function(query) {
|
216 |
if (!query) return;
|
217 |
query = parseQuery(query);
|
218 |
+
dialog(cm, getReplacementQueryDialog(cm), cm.phrase("Replace with:"), "", function(text) {
|
219 |
text = parseString(text)
|
220 |
if (all) {
|
221 |
replaceAll(cm, query, text)
|
231 |
}
|
232 |
cm.setSelection(cursor.from(), cursor.to());
|
233 |
cm.scrollIntoView({from: cursor.from(), to: cursor.to()});
|
234 |
+
confirmDialog(cm, getDoReplaceConfirm(cm), cm.phrase("Replace?"),
|
235 |
[function() {doReplace(match);}, advance,
|
236 |
function() {replaceAll(cm, query, text)}]);
|
237 |
};
|
assets/vendor/codemirror/addon/search/searchcursor.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
(function(mod) {
|
5 |
if (typeof exports == "object" && typeof module == "object") // CommonJS
|
assets/vendor/codemirror/codemirror.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
-
// Distributed under an MIT license:
|
3 |
|
4 |
-
// This is CodeMirror (
|
5 |
// implemented in JavaScript on top of the browser's DOM.
|
6 |
//
|
7 |
// You can find some technical background for some of the code below
|
@@ -13,9673 +13,9728 @@
|
|
13 |
(global.CodeMirror = factory());
|
14 |
}(this, (function () { 'use strict';
|
15 |
|
16 |
-
// Kludges for bugs and behavior differences that can't be feature
|
17 |
-
// detected are enabled based on userAgent etc sniffing.
|
18 |
-
var userAgent = navigator.userAgent
|
19 |
-
var platform = navigator.platform
|
20 |
-
|
21 |
-
var gecko = /gecko\/\d/i.test(userAgent)
|
22 |
-
var ie_upto10 = /MSIE \d/.test(userAgent)
|
23 |
-
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent)
|
24 |
-
var edge = /Edge\/(\d+)/.exec(userAgent)
|
25 |
-
var ie = ie_upto10 || ie_11up || edge
|
26 |
-
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1])
|
27 |
-
var webkit = !edge && /WebKit\//.test(userAgent)
|
28 |
-
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent)
|
29 |
-
var chrome = !edge && /Chrome\//.test(userAgent)
|
30 |
-
var presto = /Opera\//.test(userAgent)
|
31 |
-
var safari = /Apple Computer/.test(navigator.vendor)
|
32 |
-
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent)
|
33 |
-
var phantom = /PhantomJS/.test(userAgent)
|
34 |
-
|
35 |
-
var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent)
|
36 |
-
var android = /Android/.test(userAgent)
|
37 |
-
// This is woefully incomplete. Suggestions for alternative methods welcome.
|
38 |
-
var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent)
|
39 |
-
var mac = ios || /Mac/.test(platform)
|
40 |
-
var chromeOS = /\bCrOS\b/.test(userAgent)
|
41 |
-
var windows = /win/i.test(platform)
|
42 |
-
|
43 |
-
var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/)
|
44 |
-
if (presto_version) { presto_version = Number(presto_version[1]) }
|
45 |
-
if (presto_version && presto_version >= 15) { presto = false; webkit = true }
|
46 |
-
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
|
47 |
-
var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11))
|
48 |
-
var captureRightClick = gecko || (ie && ie_version >= 9)
|
49 |
-
|
50 |
-
function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
|
51 |
-
|
52 |
-
var rmClass = function(node, cls) {
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
}
|
59 |
-
}
|
60 |
-
|
61 |
-
function removeChildren(e) {
|
62 |
-
for (var count = e.childNodes.length; count > 0; --count)
|
63 |
-
{ e.removeChild(e.firstChild) }
|
64 |
-
return e
|
65 |
-
}
|
66 |
-
|
67 |
-
function removeChildrenAndAdd(parent, e) {
|
68 |
-
return removeChildren(parent).appendChild(e)
|
69 |
-
}
|
70 |
-
|
71 |
-
function elt(tag, content, className, style) {
|
72 |
-
var e = document.createElement(tag)
|
73 |
-
if (className) { e.className = className }
|
74 |
-
if (style) { e.style.cssText = style }
|
75 |
-
if (typeof content == "string") { e.appendChild(document.createTextNode(content)) }
|
76 |
-
else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]) } }
|
77 |
-
return e
|
78 |
-
}
|
79 |
-
// wrapper for elt, which removes the elt from the accessibility tree
|
80 |
-
function eltP(tag, content, className, style) {
|
81 |
-
var e = elt(tag, content, className, style)
|
82 |
-
e.setAttribute("role", "presentation")
|
83 |
-
return e
|
84 |
-
}
|
85 |
-
|
86 |
-
var range
|
87 |
-
if (document.createRange) { range = function(node, start, end, endNode) {
|
88 |
-
var r = document.createRange()
|
89 |
-
r.setEnd(endNode || node, end)
|
90 |
-
r.setStart(node, start)
|
91 |
-
return r
|
92 |
-
} }
|
93 |
-
else { range = function(node, start, end) {
|
94 |
-
var r = document.body.createTextRange()
|
95 |
-
try { r.moveToElementText(node.parentNode) }
|
96 |
-
catch(e) { return r }
|
97 |
-
r.collapse(true)
|
98 |
-
r.moveEnd("character", end)
|
99 |
-
r.moveStart("character", start)
|
100 |
-
return r
|
101 |
-
} }
|
102 |
-
|
103 |
-
function contains(parent, child) {
|
104 |
-
if (child.nodeType == 3) // Android browser always returns false when child is a textnode
|
105 |
-
{ child = child.parentNode }
|
106 |
-
if (parent.contains)
|
107 |
-
{ return parent.contains(child) }
|
108 |
-
do {
|
109 |
-
if (child.nodeType == 11) { child = child.host }
|
110 |
-
if (child == parent) { return true }
|
111 |
-
} while (child = child.parentNode)
|
112 |
-
}
|
113 |
-
|
114 |
-
function activeElt() {
|
115 |
-
// IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
|
116 |
-
// IE < 10 will throw when accessed while the page is loading or in an iframe.
|
117 |
-
// IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
|
118 |
-
var activeElement
|
119 |
-
try {
|
120 |
-
activeElement = document.activeElement
|
121 |
-
} catch(e) {
|
122 |
-
activeElement = document.body || null
|
123 |
-
}
|
124 |
-
while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
|
125 |
-
{ activeElement = activeElement.shadowRoot.activeElement }
|
126 |
-
return activeElement
|
127 |
-
}
|
128 |
-
|
129 |
-
function addClass(node, cls) {
|
130 |
-
var current = node.className
|
131 |
-
if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls }
|
132 |
-
}
|
133 |
-
function joinClasses(a, b) {
|
134 |
-
var as = a.split(" ")
|
135 |
-
for (var i = 0; i < as.length; i++)
|
136 |
-
{ if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i] } }
|
137 |
-
return b
|
138 |
-
}
|
139 |
-
|
140 |
-
var selectInput = function(node) { node.select() }
|
141 |
-
if (ios) // Mobile Safari apparently has a bug where select() is broken.
|
142 |
-
{ selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length } }
|
143 |
-
else if (ie) // Suppress mysterious IE10 errors
|
144 |
-
{ selectInput = function(node) { try { node.select() } catch(_e) {} } }
|
145 |
-
|
146 |
-
function bind(f) {
|
147 |
-
var args = Array.prototype.slice.call(arguments, 1)
|
148 |
-
return function(){return f.apply(null, args)}
|
149 |
-
}
|
150 |
-
|
151 |
-
function copyObj(obj, target, overwrite) {
|
152 |
-
if (!target) { target = {} }
|
153 |
-
for (var prop in obj)
|
154 |
-
{ if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
|
155 |
-
{ target[prop] = obj[prop] } }
|
156 |
-
return target
|
157 |
-
}
|
158 |
-
|
159 |
-
// Counts the column offset in a string, taking tabs into account.
|
160 |
-
// Used mostly to find indentation.
|
161 |
-
function countColumn(string, end, tabSize, startIndex, startValue) {
|
162 |
-
if (end == null) {
|
163 |
-
end = string.search(/[^\s\u00a0]/)
|
164 |
-
if (end == -1) { end = string.length }
|
165 |
-
}
|
166 |
-
for (var i = startIndex || 0, n = startValue || 0;;) {
|
167 |
-
var nextTab = string.indexOf("\t", i)
|
168 |
-
if (nextTab < 0 || nextTab >= end)
|
169 |
-
{ return n + (end - i) }
|
170 |
-
n += nextTab - i
|
171 |
-
n += tabSize - (n % tabSize)
|
172 |
-
i = nextTab + 1
|
173 |
-
}
|
174 |
-
}
|
175 |
-
|
176 |
-
var Delayed = function() {this.id = null};
|
177 |
-
Delayed.prototype.set = function (ms, f) {
|
178 |
-
clearTimeout(this.id)
|
179 |
-
this.id = setTimeout(f, ms)
|
180 |
-
};
|
181 |
-
|
182 |
-
function indexOf(array, elt) {
|
183 |
-
for (var i = 0; i < array.length; ++i)
|
184 |
-
{ if (array[i] == elt) { return i } }
|
185 |
-
return -1
|
186 |
-
}
|
187 |
-
|
188 |
-
// Number of pixels added to scroller and sizer to hide scrollbar
|
189 |
-
var scrollerGap = 30
|
190 |
-
|
191 |
-
// Returned or thrown by various protocols to signal 'I'm not
|
192 |
-
// handling this'.
|
193 |
-
var Pass = {toString: function(){return "CodeMirror.Pass"}}
|
194 |
-
|
195 |
-
// Reused option objects for setSelection & friends
|
196 |
-
var sel_dontScroll = {scroll: false};
|
197 |
-
var sel_mouse = {origin: "*mouse"};
|
198 |
-
var sel_move = {origin: "+move"};
|
199 |
-
// The inverse of countColumn -- find the offset that corresponds to
|
200 |
-
// a particular column.
|
201 |
-
function findColumn(string, goal, tabSize) {
|
202 |
-
for (var pos = 0, col = 0;;) {
|
203 |
-
var nextTab = string.indexOf("\t", pos)
|
204 |
-
if (nextTab == -1) { nextTab = string.length }
|
205 |
-
var skipped = nextTab - pos
|
206 |
-
if (nextTab == string.length || col + skipped >= goal)
|
207 |
-
{ return pos + Math.min(skipped, goal - col) }
|
208 |
-
col += nextTab - pos
|
209 |
-
col += tabSize - (col % tabSize)
|
210 |
-
pos = nextTab + 1
|
211 |
-
if (col >= goal) { return pos }
|
212 |
-
}
|
213 |
-
}
|
214 |
-
|
215 |
-
var spaceStrs = [""]
|
216 |
-
function spaceStr(n) {
|
217 |
-
while (spaceStrs.length <= n)
|
218 |
-
{ spaceStrs.push(lst(spaceStrs) + " ") }
|
219 |
-
return spaceStrs[n]
|
220 |
-
}
|
221 |
-
|
222 |
-
function lst(arr) { return arr[arr.length-1] }
|
223 |
-
|
224 |
-
function map(array, f) {
|
225 |
-
var out = []
|
226 |
-
for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i) }
|
227 |
-
return out
|
228 |
-
}
|
229 |
-
|
230 |
-
function insertSorted(array, value, score) {
|
231 |
-
var pos = 0, priority = score(value)
|
232 |
-
while (pos < array.length && score(array[pos]) <= priority) { pos++ }
|
233 |
-
array.splice(pos, 0, value)
|
234 |
-
}
|
235 |
-
|
236 |
-
function nothing() {}
|
237 |
-
|
238 |
-
function createObj(base, props) {
|
239 |
-
var inst
|
240 |
-
if (Object.create) {
|
241 |
-
inst = Object.create(base)
|
242 |
-
} else {
|
243 |
-
nothing.prototype = base
|
244 |
-
inst = new nothing()
|
245 |
-
}
|
246 |
-
if (props) { copyObj(props, inst) }
|
247 |
-
return inst
|
248 |
-
}
|
249 |
-
|
250 |
-
var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/
|
251 |
-
function isWordCharBasic(ch) {
|
252 |
-
return /\w/.test(ch) || ch > "\x80" &&
|
253 |
-
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
|
254 |
-
}
|
255 |
-
function isWordChar(ch, helper) {
|
256 |
-
if (!helper) { return isWordCharBasic(ch) }
|
257 |
-
if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
|
258 |
-
return helper.test(ch)
|
259 |
-
}
|
260 |
-
|
261 |
-
function isEmpty(obj) {
|
262 |
-
for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
|
263 |
-
return true
|
264 |
-
}
|
265 |
-
|
266 |
-
// Extending unicode characters. A series of a non-extending char +
|
267 |
-
// any number of extending chars is treated as a single unit as far
|
268 |
-
// as editing and measuring is concerned. This is not fully correct,
|
269 |
-
// since some scripts/fonts/browsers also treat other configurations
|
270 |
-
// of code points as a group.
|
271 |
-
var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/
|
272 |
-
function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
|
273 |
-
|
274 |
-
// Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
|
275 |
-
function skipExtendingChars(str, pos, dir) {
|
276 |
-
while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir }
|
277 |
-
return pos
|
278 |
-
}
|
279 |
-
|
280 |
-
// Returns the value from the range [`from`; `to`] that satisfies
|
281 |
-
// `pred` and is closest to `from`. Assumes that at least `to`
|
282 |
-
// satisfies `pred`. Supports `from` being greater than `to`.
|
283 |
-
function findFirst(pred, from, to) {
|
284 |
-
// At any point we are certain `to` satisfies `pred`, don't know
|
285 |
-
// whether `from` does.
|
286 |
-
var dir = from > to ? -1 : 1
|
287 |
-
for (;;) {
|
288 |
-
if (from == to) { return from }
|
289 |
-
var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF)
|
290 |
-
if (mid == from) { return pred(mid) ? from : to }
|
291 |
-
if (pred(mid)) { to = mid }
|
292 |
-
else { from = mid + dir }
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
-
// The display handles the DOM integration, both for input reading
|
297 |
-
// and content drawing. It holds references to DOM nodes and
|
298 |
-
// display-related state.
|
299 |
-
|
300 |
-
function Display(place, doc, input) {
|
301 |
-
var d = this
|
302 |
-
this.input = input
|
303 |
-
|
304 |
-
// Covers bottom-right square when both scrollbars are present.
|
305 |
-
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler")
|
306 |
-
d.scrollbarFiller.setAttribute("cm-not-content", "true")
|
307 |
-
// Covers bottom of gutter when coverGutterNextToScrollbar is on
|
308 |
-
// and h scrollbar is present.
|
309 |
-
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler")
|
310 |
-
d.gutterFiller.setAttribute("cm-not-content", "true")
|
311 |
-
// Will contain the actual code, positioned to cover the viewport.
|
312 |
-
d.lineDiv = eltP("div", null, "CodeMirror-code")
|
313 |
-
// Elements are added to these to represent selection and cursors.
|
314 |
-
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1")
|
315 |
-
d.cursorDiv = elt("div", null, "CodeMirror-cursors")
|
316 |
-
// A visibility: hidden element used to find the size of things.
|
317 |
-
d.measure = elt("div", null, "CodeMirror-measure")
|
318 |
-
// When lines outside of the viewport are measured, they are drawn in this.
|
319 |
-
d.lineMeasure = elt("div", null, "CodeMirror-measure")
|
320 |
-
// Wraps everything that needs to exist inside the vertically-padded coordinate system
|
321 |
-
d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
|
322 |
-
null, "position: relative; outline: none")
|
323 |
-
var lines = eltP("div", [d.lineSpace], "CodeMirror-lines")
|
324 |
-
// Moved around its parent to cover visible view.
|
325 |
-
d.mover = elt("div", [lines], null, "position: relative")
|
326 |
-
// Set to the height of the document, allowing scrolling.
|
327 |
-
d.sizer = elt("div", [d.mover], "CodeMirror-sizer")
|
328 |
-
d.sizerWidth = null
|
329 |
-
// Behavior of elts with overflow: auto and padding is
|
330 |
-
// inconsistent across browsers. This is used to ensure the
|
331 |
-
// scrollable area is big enough.
|
332 |
-
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;")
|
333 |
-
// Will contain the gutters, if any.
|
334 |
-
d.gutters = elt("div", null, "CodeMirror-gutters")
|
335 |
-
d.lineGutter = null
|
336 |
-
// Actual scrollable element.
|
337 |
-
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll")
|
338 |
-
d.scroller.setAttribute("tabIndex", "-1")
|
339 |
-
// The element in which the editor lives.
|
340 |
-
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror")
|
341 |
-
|
342 |
-
// Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
|
343 |
-
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0 }
|
344 |
-
if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true }
|
345 |
-
|
346 |
-
if (place) {
|
347 |
-
if (place.appendChild) { place.appendChild(d.wrapper) }
|
348 |
-
else { place(d.wrapper) }
|
349 |
-
}
|
350 |
-
|
351 |
-
// Current rendered range (may be bigger than the view window).
|
352 |
-
d.viewFrom = d.viewTo = doc.first
|
353 |
-
d.reportedViewFrom = d.reportedViewTo = doc.first
|
354 |
-
// Information about the rendered lines.
|
355 |
-
d.view = []
|
356 |
-
d.renderedView = null
|
357 |
-
// Holds info about a single rendered line when it was rendered
|
358 |
-
// for measurement, while not in view.
|
359 |
-
d.externalMeasured = null
|
360 |
-
// Empty space (in pixels) above the view
|
361 |
-
d.viewOffset = 0
|
362 |
-
d.lastWrapHeight = d.lastWrapWidth = 0
|
363 |
-
d.updateLineNumbers = null
|
364 |
-
|
365 |
-
d.nativeBarWidth = d.barHeight = d.barWidth = 0
|
366 |
-
d.scrollbarsClipped = false
|
367 |
-
|
368 |
-
// Used to only resize the line number gutter when necessary (when
|
369 |
-
// the amount of lines crosses a boundary that makes its width change)
|
370 |
-
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null
|
371 |
-
// Set to true when a non-horizontal-scrolling line widget is
|
372 |
-
// added. As an optimization, line widget aligning is skipped when
|
373 |
-
// this is false.
|
374 |
-
d.alignWidgets = false
|
375 |
-
|
376 |
-
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null
|
377 |
-
|
378 |
-
// Tracks the maximum line length so that the horizontal scrollbar
|
379 |
-
// can be kept static when scrolling.
|
380 |
-
d.maxLine = null
|
381 |
-
d.maxLineLength = 0
|
382 |
-
d.maxLineChanged = false
|
383 |
-
|
384 |
-
// Used for measuring wheel scrolling granularity
|
385 |
-
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null
|
386 |
-
|
387 |
-
// True when shift is held down.
|
388 |
-
d.shift = false
|
389 |
-
|
390 |
-
// Used to track whether anything happened since the context menu
|
391 |
-
// was opened.
|
392 |
-
d.selForContextMenu = null
|
393 |
-
|
394 |
-
d.activeTouch = null
|
395 |
-
|
396 |
-
input.init(d)
|
397 |
-
}
|
398 |
-
|
399 |
-
// Find the line object corresponding to the given line number.
|
400 |
-
function getLine(doc, n) {
|
401 |
-
n -= doc.first
|
402 |
-
if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
|
403 |
-
var chunk = doc
|
404 |
-
while (!chunk.lines) {
|
405 |
-
for (var i = 0;; ++i) {
|
406 |
-
var child = chunk.children[i], sz = child.chunkSize()
|
407 |
-
if (n < sz) { chunk = child; break }
|
408 |
-
n -= sz
|
409 |
-
}
|
410 |
-
}
|
411 |
-
return chunk.lines[n]
|
412 |
-
}
|
413 |
-
|
414 |
-
// Get the part of a document between two positions, as an array of
|
415 |
-
// strings.
|
416 |
-
function getBetween(doc, start, end) {
|
417 |
-
var out = [], n = start.line
|
418 |
-
doc.iter(start.line, end.line + 1, function (line) {
|
419 |
-
var text = line.text
|
420 |
-
if (n == end.line) { text = text.slice(0, end.ch) }
|
421 |
-
if (n == start.line) { text = text.slice(start.ch) }
|
422 |
-
out.push(text)
|
423 |
-
++n
|
424 |
-
})
|
425 |
-
return out
|
426 |
-
}
|
427 |
-
// Get the lines between from and to, as array of strings.
|
428 |
-
function getLines(doc, from, to) {
|
429 |
-
var out = []
|
430 |
-
doc.iter(from, to, function (line) { out.push(line.text) }) // iter aborts when callback returns truthy value
|
431 |
-
return out
|
432 |
-
}
|
433 |
-
|
434 |
-
// Update the height of a line, propagating the height change
|
435 |
-
// upwards to parent nodes.
|
436 |
-
function updateLineHeight(line, height) {
|
437 |
-
var diff = height - line.height
|
438 |
-
if (diff) { for (var n = line; n; n = n.parent) { n.height += diff } }
|
439 |
-
}
|
440 |
-
|
441 |
-
// Given a line object, find its line number by walking up through
|
442 |
-
// its parent links.
|
443 |
-
function lineNo(line) {
|
444 |
-
if (line.parent == null) { return null }
|
445 |
-
var cur = line.parent, no = indexOf(cur.lines, line)
|
446 |
-
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
|
447 |
-
for (var i = 0;; ++i) {
|
448 |
-
if (chunk.children[i] == cur) { break }
|
449 |
-
no += chunk.children[i].chunkSize()
|
450 |
-
}
|
451 |
-
}
|
452 |
-
return no + cur.first
|
453 |
-
}
|
454 |
-
|
455 |
-
// Find the line at the given vertical position, using the height
|
456 |
-
// information in the document tree.
|
457 |
-
function lineAtHeight(chunk, h) {
|
458 |
-
var n = chunk.first
|
459 |
-
outer: do {
|
460 |
-
for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
|
461 |
-
var child = chunk.children[i$1], ch = child.height
|
462 |
-
if (h < ch) { chunk = child; continue outer }
|
463 |
-
h -= ch
|
464 |
-
n += child.chunkSize()
|
465 |
-
}
|
466 |
-
return n
|
467 |
-
} while (!chunk.lines)
|
468 |
-
var i = 0
|
469 |
-
for (; i < chunk.lines.length; ++i) {
|
470 |
-
var line = chunk.lines[i], lh = line.height
|
471 |
-
if (h < lh) { break }
|
472 |
-
h -= lh
|
473 |
-
}
|
474 |
-
return n + i
|
475 |
-
}
|
476 |
-
|
477 |
-
function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
|
478 |
-
|
479 |
-
function lineNumberFor(options, i) {
|
480 |
-
return String(options.lineNumberFormatter(i + options.firstLineNumber))
|
481 |
-
}
|
482 |
-
|
483 |
-
// A Pos instance represents a position within the text.
|
484 |
-
function Pos(line, ch, sticky) {
|
485 |
-
if ( sticky === void 0 ) sticky = null;
|
486 |
-
|
487 |
-
if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
|
488 |
-
this.line = line
|
489 |
-
this.ch = ch
|
490 |
-
this.sticky = sticky
|
491 |
-
}
|
492 |
-
|
493 |
-
// Compare two positions, return 0 if they are the same, a negative
|
494 |
-
// number when a is less, and a positive number otherwise.
|
495 |
-
function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
|
496 |
-
|
497 |
-
function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
|
498 |
-
|
499 |
-
function copyPos(x) {return Pos(x.line, x.ch)}
|
500 |
-
function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
|
501 |
-
function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
|
502 |
-
|
503 |
-
// Most of the external API clips given positions to make sure they
|
504 |
-
// actually exist within the document.
|
505 |
-
function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
|
506 |
-
function clipPos(doc, pos) {
|
507 |
-
if (pos.line < doc.first) { return Pos(doc.first, 0) }
|
508 |
-
var last = doc.first + doc.size - 1
|
509 |
-
if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
|
510 |
-
return clipToLen(pos, getLine(doc, pos.line).text.length)
|
511 |
-
}
|
512 |
-
function clipToLen(pos, linelen) {
|
513 |
-
var ch = pos.ch
|
514 |
-
if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
|
515 |
-
else if (ch < 0) { return Pos(pos.line, 0) }
|
516 |
-
else { return pos }
|
517 |
-
}
|
518 |
-
function clipPosArray(doc, array) {
|
519 |
-
var out = []
|
520 |
-
for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]) }
|
521 |
-
return out
|
522 |
-
}
|
523 |
-
|
524 |
-
// Optimize some code when these features are not used.
|
525 |
-
var sawReadOnlySpans = false;
|
526 |
-
var sawCollapsedSpans = false;
|
527 |
-
function seeReadOnlySpans() {
|
528 |
-
sawReadOnlySpans = true
|
529 |
-
}
|
530 |
-
|
531 |
-
function seeCollapsedSpans() {
|
532 |
-
sawCollapsedSpans = true
|
533 |
-
}
|
534 |
-
|
535 |
-
// TEXTMARKER SPANS
|
536 |
-
|
537 |
-
function MarkedSpan(marker, from, to) {
|
538 |
-
this.marker = marker
|
539 |
-
this.from = from; this.to = to
|
540 |
-
}
|
541 |
-
|
542 |
-
// Search an array of spans for a span matching the given marker.
|
543 |
-
function getMarkedSpanFor(spans, marker) {
|
544 |
-
if (spans) { for (var i = 0; i < spans.length; ++i) {
|
545 |
-
var span = spans[i]
|
546 |
-
if (span.marker == marker) { return span }
|
547 |
-
} }
|
548 |
-
}
|
549 |
-
// Remove a span from an array, returning undefined if no spans are
|
550 |
-
// left (we don't store arrays for lines without spans).
|
551 |
-
function removeMarkedSpan(spans, span) {
|
552 |
-
var r
|
553 |
-
for (var i = 0; i < spans.length; ++i)
|
554 |
-
{ if (spans[i] != span) { (r || (r = [])).push(spans[i]) } }
|
555 |
-
return r
|
556 |
-
}
|
557 |
-
// Add a span to a line.
|
558 |
-
function addMarkedSpan(line, span) {
|
559 |
-
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span]
|
560 |
-
span.marker.attachLine(line)
|
561 |
-
}
|
562 |
-
|
563 |
-
// Used for the algorithm that adjusts markers for a change in the
|
564 |
-
// document. These functions cut an array of spans at a given
|
565 |
-
// character position, returning an array of remaining chunks (or
|
566 |
-
// undefined if nothing remains).
|
567 |
-
function markedSpansBefore(old, startCh, isInsert) {
|
568 |
-
var nw
|
569 |
-
if (old) { for (var i = 0; i < old.length; ++i) {
|
570 |
-
var span = old[i], marker = span.marker
|
571 |
-
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh)
|
572 |
-
if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
|
573 |
-
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
|
574 |
-
;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to))
|
575 |
-
}
|
576 |
-
} }
|
577 |
-
return nw
|
578 |
-
}
|
579 |
-
function markedSpansAfter(old, endCh, isInsert) {
|
580 |
-
var nw
|
581 |
-
if (old) { for (var i = 0; i < old.length; ++i) {
|
582 |
-
var span = old[i], marker = span.marker
|
583 |
-
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh)
|
584 |
-
if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
|
585 |
-
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
|
586 |
-
;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
|
587 |
-
span.to == null ? null : span.to - endCh))
|
588 |
-
}
|
589 |
-
} }
|
590 |
-
return nw
|
591 |
-
}
|
592 |
-
|
593 |
-
// Given a change object, compute the new set of marker spans that
|
594 |
-
// cover the line in which the change took place. Removes spans
|
595 |
-
// entirely within the change, reconnects spans belonging to the
|
596 |
-
// same marker that appear on both sides of the change, and cuts off
|
597 |
-
// spans partially within the change. Returns an array of span
|
598 |
-
// arrays with one element for each line in (after) the change.
|
599 |
-
function stretchSpansOverChange(doc, change) {
|
600 |
-
if (change.full) { return null }
|
601 |
-
var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans
|
602 |
-
var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans
|
603 |
-
if (!oldFirst && !oldLast) { return null }
|
604 |
-
|
605 |
-
var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0
|
606 |
-
// Get the spans that 'stick out' on both sides
|
607 |
-
var first = markedSpansBefore(oldFirst, startCh, isInsert)
|
608 |
-
var last = markedSpansAfter(oldLast, endCh, isInsert)
|
609 |
-
|
610 |
-
// Next, merge those two ends
|
611 |
-
var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0)
|
612 |
-
if (first) {
|
613 |
-
// Fix up .to properties of first
|
614 |
-
for (var i = 0; i < first.length; ++i) {
|
615 |
-
var span = first[i]
|
616 |
-
if (span.to == null) {
|
617 |
-
var found = getMarkedSpanFor(last, span.marker)
|
618 |
-
if (!found) { span.to = startCh }
|
619 |
-
else if (sameLine) { span.to = found.to == null ? null : found.to + offset }
|
620 |
-
}
|
621 |
-
}
|
622 |
-
}
|
623 |
-
if (last) {
|
624 |
-
// Fix up .from in last (or move them into first in case of sameLine)
|
625 |
-
for (var i$1 = 0; i$1 < last.length; ++i$1) {
|
626 |
-
var span$1 = last[i$1]
|
627 |
-
if (span$1.to != null) { span$1.to += offset }
|
628 |
-
if (span$1.from == null) {
|
629 |
-
var found$1 = getMarkedSpanFor(first, span$1.marker)
|
630 |
-
if (!found$1) {
|
631 |
-
span$1.from = offset
|
632 |
-
if (sameLine) { (first || (first = [])).push(span$1) }
|
633 |
-
}
|
634 |
-
} else {
|
635 |
-
span$1.from += offset
|
636 |
-
if (sameLine) { (first || (first = [])).push(span$1) }
|
637 |
-
}
|
638 |
-
}
|
639 |
-
}
|
640 |
-
// Make sure we didn't create any zero-length spans
|
641 |
-
if (first) { first = clearEmptySpans(first) }
|
642 |
-
if (last && last != first) { last = clearEmptySpans(last) }
|
643 |
-
|
644 |
-
var newMarkers = [first]
|
645 |
-
if (!sameLine) {
|
646 |
-
// Fill gap with whole-line-spans
|
647 |
-
var gap = change.text.length - 2, gapMarkers
|
648 |
-
if (gap > 0 && first)
|
649 |
-
{ for (var i$2 = 0; i$2 < first.length; ++i$2)
|
650 |
-
{ if (first[i$2].to == null)
|
651 |
-
{ (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)) } } }
|
652 |
-
for (var i$3 = 0; i$3 < gap; ++i$3)
|
653 |
-
{ newMarkers.push(gapMarkers) }
|
654 |
-
newMarkers.push(last)
|
655 |
-
}
|
656 |
-
return newMarkers
|
657 |
-
}
|
658 |
-
|
659 |
-
// Remove spans that are empty and don't have a clearWhenEmpty
|
660 |
-
// option of false.
|
661 |
-
function clearEmptySpans(spans) {
|
662 |
-
for (var i = 0; i < spans.length; ++i) {
|
663 |
-
var span = spans[i]
|
664 |
-
if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
|
665 |
-
{ spans.splice(i--, 1) }
|
666 |
-
}
|
667 |
-
if (!spans.length) { return null }
|
668 |
-
return spans
|
669 |
-
}
|
670 |
-
|
671 |
-
// Used to 'clip' out readOnly ranges when making a change.
|
672 |
-
function removeReadOnlyRanges(doc, from, to) {
|
673 |
-
var markers = null
|
674 |
-
doc.iter(from.line, to.line + 1, function (line) {
|
675 |
-
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
676 |
-
var mark = line.markedSpans[i].marker
|
677 |
-
if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
|
678 |
-
{ (markers || (markers = [])).push(mark) }
|
679 |
-
} }
|
680 |
-
})
|
681 |
-
if (!markers) { return null }
|
682 |
-
var parts = [{from: from, to: to}]
|
683 |
-
for (var i = 0; i < markers.length; ++i) {
|
684 |
-
var mk = markers[i], m = mk.find(0)
|
685 |
-
for (var j = 0; j < parts.length; ++j) {
|
686 |
-
var p = parts[j]
|
687 |
-
if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
|
688 |
-
var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to)
|
689 |
-
if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
|
690 |
-
{ newParts.push({from: p.from, to: m.from}) }
|
691 |
-
if (dto > 0 || !mk.inclusiveRight && !dto)
|
692 |
-
{ newParts.push({from: m.to, to: p.to}) }
|
693 |
-
parts.splice.apply(parts, newParts)
|
694 |
-
j += newParts.length - 3
|
695 |
-
}
|
696 |
-
}
|
697 |
-
return parts
|
698 |
-
}
|
699 |
-
|
700 |
-
// Connect or disconnect spans from a line.
|
701 |
-
function detachMarkedSpans(line) {
|
702 |
-
var spans = line.markedSpans
|
703 |
-
if (!spans) { return }
|
704 |
-
for (var i = 0; i < spans.length; ++i)
|
705 |
-
{ spans[i].marker.detachLine(line) }
|
706 |
-
line.markedSpans = null
|
707 |
-
}
|
708 |
-
function attachMarkedSpans(line, spans) {
|
709 |
-
if (!spans) { return }
|
710 |
-
for (var i = 0; i < spans.length; ++i)
|
711 |
-
{ spans[i].marker.attachLine(line) }
|
712 |
-
line.markedSpans = spans
|
713 |
-
}
|
714 |
-
|
715 |
-
// Helpers used when computing which overlapping collapsed span
|
716 |
-
// counts as the larger one.
|
717 |
-
function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
|
718 |
-
function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
|
719 |
-
|
720 |
-
// Returns a number indicating which of two overlapping collapsed
|
721 |
-
// spans is larger (and thus includes the other). Falls back to
|
722 |
-
// comparing ids when the spans cover exactly the same range.
|
723 |
-
function compareCollapsedMarkers(a, b) {
|
724 |
-
var lenDiff = a.lines.length - b.lines.length
|
725 |
-
if (lenDiff != 0) { return lenDiff }
|
726 |
-
var aPos = a.find(), bPos = b.find()
|
727 |
-
var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b)
|
728 |
-
if (fromCmp) { return -fromCmp }
|
729 |
-
var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b)
|
730 |
-
if (toCmp) { return toCmp }
|
731 |
-
return b.id - a.id
|
732 |
-
}
|
733 |
-
|
734 |
-
// Find out whether a line ends or starts in a collapsed span. If
|
735 |
-
// so, return the marker for that span.
|
736 |
-
function collapsedSpanAtSide(line, start) {
|
737 |
-
var sps = sawCollapsedSpans && line.markedSpans, found
|
738 |
-
if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
|
739 |
-
sp = sps[i]
|
740 |
-
if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
|
741 |
-
(!found || compareCollapsedMarkers(found, sp.marker) < 0))
|
742 |
-
{ found = sp.marker }
|
743 |
-
} }
|
744 |
-
return found
|
745 |
-
}
|
746 |
-
function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
|
747 |
-
function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
|
748 |
-
|
749 |
-
function collapsedSpanAround(line, ch) {
|
750 |
-
var sps = sawCollapsedSpans && line.markedSpans, found
|
751 |
-
if (sps) { for (var i = 0; i < sps.length; ++i) {
|
752 |
-
var sp = sps[i]
|
753 |
-
if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
|
754 |
-
(!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker }
|
755 |
-
} }
|
756 |
-
return found
|
757 |
-
}
|
758 |
-
|
759 |
-
// Test whether there exists a collapsed span that partially
|
760 |
-
// overlaps (covers the start or end, but not both) of a new span.
|
761 |
-
// Such overlap is not allowed.
|
762 |
-
function conflictingCollapsedRange(doc, lineNo, from, to, marker) {
|
763 |
-
var line = getLine(doc, lineNo)
|
764 |
-
var sps = sawCollapsedSpans && line.markedSpans
|
765 |
-
if (sps) { for (var i = 0; i < sps.length; ++i) {
|
766 |
-
var sp = sps[i]
|
767 |
-
if (!sp.marker.collapsed) { continue }
|
768 |
-
var found = sp.marker.find(0)
|
769 |
-
var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker)
|
770 |
-
var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker)
|
771 |
-
if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
|
772 |
-
if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
|
773 |
-
fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
|
774 |
-
{ return true }
|
775 |
-
} }
|
776 |
-
}
|
777 |
-
|
778 |
-
// A visual line is a line as drawn on the screen. Folding, for
|
779 |
-
// example, can cause multiple logical lines to appear on the same
|
780 |
-
// visual line. This finds the start of the visual line that the
|
781 |
-
// given line is part of (usually that is the line itself).
|
782 |
-
function visualLine(line) {
|
783 |
-
var merged
|
784 |
-
while (merged = collapsedSpanAtStart(line))
|
785 |
-
{ line = merged.find(-1, true).line }
|
786 |
-
return line
|
787 |
-
}
|
788 |
-
|
789 |
-
function visualLineEnd(line) {
|
790 |
-
var merged
|
791 |
-
while (merged = collapsedSpanAtEnd(line))
|
792 |
-
{ line = merged.find(1, true).line }
|
793 |
-
return line
|
794 |
-
}
|
795 |
-
|
796 |
-
// Returns an array of logical lines that continue the visual line
|
797 |
-
// started by the argument, or undefined if there are no such lines.
|
798 |
-
function visualLineContinued(line) {
|
799 |
-
var merged, lines
|
800 |
-
while (merged = collapsedSpanAtEnd(line)) {
|
801 |
-
line = merged.find(1, true).line
|
802 |
-
;(lines || (lines = [])).push(line)
|
803 |
-
}
|
804 |
-
return lines
|
805 |
-
}
|
806 |
-
|
807 |
-
// Get the line number of the start of the visual line that the
|
808 |
-
// given line number is part of.
|
809 |
-
function visualLineNo(doc, lineN) {
|
810 |
-
var line = getLine(doc, lineN), vis = visualLine(line)
|
811 |
-
if (line == vis) { return lineN }
|
812 |
-
return lineNo(vis)
|
813 |
-
}
|
814 |
-
|
815 |
-
// Get the line number of the start of the next visual line after
|
816 |
-
// the given line.
|
817 |
-
function visualLineEndNo(doc, lineN) {
|
818 |
-
if (lineN > doc.lastLine()) { return lineN }
|
819 |
-
var line = getLine(doc, lineN), merged
|
820 |
-
if (!lineIsHidden(doc, line)) { return lineN }
|
821 |
-
while (merged = collapsedSpanAtEnd(line))
|
822 |
-
{ line = merged.find(1, true).line }
|
823 |
-
return lineNo(line) + 1
|
824 |
-
}
|
825 |
-
|
826 |
-
// Compute whether a line is hidden. Lines count as hidden when they
|
827 |
-
// are part of a visual line that starts with another line, or when
|
828 |
-
// they are entirely covered by collapsed, non-widget span.
|
829 |
-
function lineIsHidden(doc, line) {
|
830 |
-
var sps = sawCollapsedSpans && line.markedSpans
|
831 |
-
if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
|
832 |
-
sp = sps[i]
|
833 |
-
if (!sp.marker.collapsed) { continue }
|
834 |
-
if (sp.from == null) { return true }
|
835 |
-
if (sp.marker.widgetNode) { continue }
|
836 |
-
if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
|
837 |
-
{ return true }
|
838 |
-
} }
|
839 |
-
}
|
840 |
-
function lineIsHiddenInner(doc, line, span) {
|
841 |
-
if (span.to == null) {
|
842 |
-
var end = span.marker.find(1, true)
|
843 |
-
return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
|
844 |
-
}
|
845 |
-
if (span.marker.inclusiveRight && span.to == line.text.length)
|
846 |
-
{ return true }
|
847 |
-
for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
|
848 |
-
sp = line.markedSpans[i]
|
849 |
-
if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
|
850 |
-
(sp.to == null || sp.to != span.from) &&
|
851 |
-
(sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
|
852 |
-
lineIsHiddenInner(doc, line, sp)) { return true }
|
853 |
-
}
|
854 |
-
}
|
855 |
-
|
856 |
-
// Find the height above the given line.
|
857 |
-
function heightAtLine(lineObj) {
|
858 |
-
lineObj = visualLine(lineObj)
|
859 |
-
|
860 |
-
var h = 0, chunk = lineObj.parent
|
861 |
-
for (var i = 0; i < chunk.lines.length; ++i) {
|
862 |
-
var line = chunk.lines[i]
|
863 |
-
if (line == lineObj) { break }
|
864 |
-
else { h += line.height }
|
865 |
-
}
|
866 |
-
for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
|
867 |
-
for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
|
868 |
-
var cur = p.children[i$1]
|
869 |
-
if (cur == chunk) { break }
|
870 |
-
else { h += cur.height }
|
871 |
-
}
|
872 |
-
}
|
873 |
-
return h
|
874 |
-
}
|
875 |
-
|
876 |
-
// Compute the character length of a line, taking into account
|
877 |
-
// collapsed ranges (see markText) that might hide parts, and join
|
878 |
-
// other lines onto it.
|
879 |
-
function lineLength(line) {
|
880 |
-
if (line.height == 0) { return 0 }
|
881 |
-
var len = line.text.length, merged, cur = line
|
882 |
-
while (merged = collapsedSpanAtStart(cur)) {
|
883 |
-
var found = merged.find(0, true)
|
884 |
-
cur = found.from.line
|
885 |
-
len += found.from.ch - found.to.ch
|
886 |
-
}
|
887 |
-
cur = line
|
888 |
-
while (merged = collapsedSpanAtEnd(cur)) {
|
889 |
-
var found$1 = merged.find(0, true)
|
890 |
-
len -= cur.text.length - found$1.from.ch
|
891 |
-
cur = found$1.to.line
|
892 |
-
len += cur.text.length - found$1.to.ch
|
893 |
-
}
|
894 |
-
return len
|
895 |
-
}
|
896 |
-
|
897 |
-
// Find the longest line in the document.
|
898 |
-
function findMaxLine(cm) {
|
899 |
-
var d = cm.display, doc = cm.doc
|
900 |
-
d.maxLine = getLine(doc, doc.first)
|
901 |
-
d.maxLineLength = lineLength(d.maxLine)
|
902 |
-
d.maxLineChanged = true
|
903 |
-
doc.iter(function (line) {
|
904 |
-
var len = lineLength(line)
|
905 |
-
if (len > d.maxLineLength) {
|
906 |
-
d.maxLineLength = len
|
907 |
-
d.maxLine = line
|
908 |
-
}
|
909 |
-
})
|
910 |
-
}
|
911 |
-
|
912 |
-
// BIDI HELPERS
|
913 |
-
|
914 |
-
function iterateBidiSections(order, from, to, f) {
|
915 |
-
if (!order) { return f(from, to, "ltr", 0) }
|
916 |
-
var found = false
|
917 |
-
for (var i = 0; i < order.length; ++i) {
|
918 |
-
var part = order[i]
|
919 |
-
if (part.from < to && part.to > from || from == to && part.to == from) {
|
920 |
-
f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i)
|
921 |
-
found = true
|
922 |
-
}
|
923 |
-
}
|
924 |
-
if (!found) { f(from, to, "ltr") }
|
925 |
-
}
|
926 |
-
|
927 |
-
var bidiOther = null
|
928 |
-
function getBidiPartAt(order, ch, sticky) {
|
929 |
-
var found
|
930 |
-
bidiOther = null
|
931 |
-
for (var i = 0; i < order.length; ++i) {
|
932 |
-
var cur = order[i]
|
933 |
-
if (cur.from < ch && cur.to > ch) { return i }
|
934 |
-
if (cur.to == ch) {
|
935 |
-
if (cur.from != cur.to && sticky == "before") { found = i }
|
936 |
-
else { bidiOther = i }
|
937 |
-
}
|
938 |
-
if (cur.from == ch) {
|
939 |
-
if (cur.from != cur.to && sticky != "before") { found = i }
|
940 |
-
else { bidiOther = i }
|
941 |
-
}
|
942 |
-
}
|
943 |
-
return found != null ? found : bidiOther
|
944 |
-
}
|
945 |
-
|
946 |
-
// Bidirectional ordering algorithm
|
947 |
-
// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
|
948 |
-
// that this (partially) implements.
|
949 |
-
|
950 |
-
// One-char codes used for character types:
|
951 |
-
// L (L): Left-to-Right
|
952 |
-
// R (R): Right-to-Left
|
953 |
-
// r (AL): Right-to-Left Arabic
|
954 |
-
// 1 (EN): European Number
|
955 |
-
// + (ES): European Number Separator
|
956 |
-
// % (ET): European Number Terminator
|
957 |
-
// n (AN): Arabic Number
|
958 |
-
// , (CS): Common Number Separator
|
959 |
-
// m (NSM): Non-Spacing Mark
|
960 |
-
// b (BN): Boundary Neutral
|
961 |
-
// s (B): Paragraph Separator
|
962 |
-
// t (S): Segment Separator
|
963 |
-
// w (WS): Whitespace
|
964 |
-
// N (ON): Other Neutrals
|
965 |
-
|
966 |
-
// Returns null if characters are ordered as they appear
|
967 |
-
// (left-to-right), or an array of sections ({from, to, level}
|
968 |
-
// objects) in the order in which they occur visually.
|
969 |
-
var bidiOrdering = (function() {
|
970 |
-
// Character types for codepoints 0 to 0xff
|
971 |
-
var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN"
|
972 |
-
// Character types for codepoints 0x600 to 0x6f9
|
973 |
-
var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111"
|
974 |
-
function charType(code) {
|
975 |
-
if (code <= 0xf7) { return lowTypes.charAt(code) }
|
976 |
-
else if (0x590 <= code && code <= 0x5f4) { return "R" }
|
977 |
-
else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
|
978 |
-
else if (0x6ee <= code && code <= 0x8ac) { return "r" }
|
979 |
-
else if (0x2000 <= code && code <= 0x200b) { return "w" }
|
980 |
-
else if (code == 0x200c) { return "b" }
|
981 |
-
else { return "L" }
|
982 |
-
}
|
983 |
-
|
984 |
-
var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/
|
985 |
-
var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/
|
986 |
-
|
987 |
-
function BidiSpan(level, from, to) {
|
988 |
-
this.level = level
|
989 |
-
this.from = from; this.to = to
|
990 |
-
}
|
991 |
-
|
992 |
-
return function(str, direction) {
|
993 |
-
var outerType = direction == "ltr" ? "L" : "R"
|
994 |
-
|
995 |
-
if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
|
996 |
-
var len = str.length, types = []
|
997 |
-
for (var i = 0; i < len; ++i)
|
998 |
-
{ types.push(charType(str.charCodeAt(i))) }
|
999 |
-
|
1000 |
-
// W1. Examine each non-spacing mark (NSM) in the level run, and
|
1001 |
-
// change the type of the NSM to the type of the previous
|
1002 |
-
// character. If the NSM is at the start of the level run, it will
|
1003 |
-
// get the type of sor.
|
1004 |
-
for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
|
1005 |
-
var type = types[i$1]
|
1006 |
-
if (type == "m") { types[i$1] = prev }
|
1007 |
-
else { prev = type }
|
1008 |
-
}
|
1009 |
-
|
1010 |
-
// W2. Search backwards from each instance of a European number
|
1011 |
-
// until the first strong type (R, L, AL, or sor) is found. If an
|
1012 |
-
// AL is found, change the type of the European number to Arabic
|
1013 |
-
// number.
|
1014 |
-
// W3. Change all ALs to R.
|
1015 |
-
for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
|
1016 |
-
var type$1 = types[i$2]
|
1017 |
-
if (type$1 == "1" && cur == "r") { types[i$2] = "n" }
|
1018 |
-
else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R" } }
|
1019 |
-
}
|
1020 |
-
|
1021 |
-
// W4. A single European separator between two European numbers
|
1022 |
-
// changes to a European number. A single common separator between
|
1023 |
-
// two numbers of the same type changes to that type.
|
1024 |
-
for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
|
1025 |
-
var type$2 = types[i$3]
|
1026 |
-
if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1" }
|
1027 |
-
else if (type$2 == "," && prev$1 == types[i$3+1] &&
|
1028 |
-
(prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1 }
|
1029 |
-
prev$1 = type$2
|
1030 |
-
}
|
1031 |
-
|
1032 |
-
// W5. A sequence of European terminators adjacent to European
|
1033 |
-
// numbers changes to all European numbers.
|
1034 |
-
// W6. Otherwise, separators and terminators change to Other
|
1035 |
-
// Neutral.
|
1036 |
-
for (var i$4 = 0; i$4 < len; ++i$4) {
|
1037 |
-
var type$3 = types[i$4]
|
1038 |
-
if (type$3 == ",") { types[i$4] = "N" }
|
1039 |
-
else if (type$3 == "%") {
|
1040 |
-
var end = (void 0)
|
1041 |
-
for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
|
1042 |
-
var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N"
|
1043 |
-
for (var j = i$4; j < end; ++j) { types[j] = replace }
|
1044 |
-
i$4 = end - 1
|
1045 |
-
}
|
1046 |
-
}
|
1047 |
-
|
1048 |
-
// W7. Search backwards from each instance of a European number
|
1049 |
-
// until the first strong type (R, L, or sor) is found. If an L is
|
1050 |
-
// found, then change the type of the European number to L.
|
1051 |
-
for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
|
1052 |
-
var type$4 = types[i$5]
|
1053 |
-
if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L" }
|
1054 |
-
else if (isStrong.test(type$4)) { cur$1 = type$4 }
|
1055 |
-
}
|
1056 |
-
|
1057 |
-
// N1. A sequence of neutrals takes the direction of the
|
1058 |
-
// surrounding strong text if the text on both sides has the same
|
1059 |
-
// direction. European and Arabic numbers act as if they were R in
|
1060 |
-
// terms of their influence on neutrals. Start-of-level-run (sor)
|
1061 |
-
// and end-of-level-run (eor) are used at level run boundaries.
|
1062 |
-
// N2. Any remaining neutrals take the embedding direction.
|
1063 |
-
for (var i$6 = 0; i$6 < len; ++i$6) {
|
1064 |
-
if (isNeutral.test(types[i$6])) {
|
1065 |
-
var end$1 = (void 0)
|
1066 |
-
for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
|
1067 |
-
var before = (i$6 ? types[i$6-1] : outerType) == "L"
|
1068 |
-
var after = (end$1 < len ? types[end$1] : outerType) == "L"
|
1069 |
-
var replace$1 = before == after ? (before ? "L" : "R") : outerType
|
1070 |
-
for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1 }
|
1071 |
-
i$6 = end$1 - 1
|
1072 |
-
}
|
1073 |
-
}
|
1074 |
-
|
1075 |
-
// Here we depart from the documented algorithm, in order to avoid
|
1076 |
-
// building up an actual levels array. Since there are only three
|
1077 |
-
// levels (0, 1, 2) in an implementation that doesn't take
|
1078 |
-
// explicit embedding into account, we can build up the order on
|
1079 |
-
// the fly, without following the level-based algorithm.
|
1080 |
-
var order = [], m
|
1081 |
-
for (var i$7 = 0; i$7 < len;) {
|
1082 |
-
if (countsAsLeft.test(types[i$7])) {
|
1083 |
-
var start = i$7
|
1084 |
-
for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
|
1085 |
-
order.push(new BidiSpan(0, start, i$7))
|
1086 |
-
} else {
|
1087 |
-
var pos = i$7, at = order.length
|
1088 |
-
for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
|
1089 |
-
for (var j$2 = pos; j$2 < i$7;) {
|
1090 |
-
if (countsAsNum.test(types[j$2])) {
|
1091 |
-
if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)) }
|
1092 |
-
var nstart = j$2
|
1093 |
-
for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
|
1094 |
-
order.splice(at, 0, new BidiSpan(2, nstart, j$2))
|
1095 |
-
pos = j$2
|
1096 |
-
} else { ++j$2 }
|
1097 |
-
}
|
1098 |
-
if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)) }
|
1099 |
-
}
|
1100 |
-
}
|
1101 |
-
if (direction == "ltr") {
|
1102 |
-
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
|
1103 |
-
order[0].from = m[0].length
|
1104 |
-
order.unshift(new BidiSpan(0, 0, m[0].length))
|
1105 |
-
}
|
1106 |
-
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
|
1107 |
-
lst(order).to -= m[0].length
|
1108 |
-
order.push(new BidiSpan(0, len - m[0].length, len))
|
1109 |
-
}
|
1110 |
-
}
|
1111 |
-
|
1112 |
-
return direction == "rtl" ? order.reverse() : order
|
1113 |
-
}
|
1114 |
-
})()
|
1115 |
-
|
1116 |
-
// Get the bidi ordering for the given line (and cache it). Returns
|
1117 |
-
// false for lines that are fully left-to-right, and an array of
|
1118 |
-
// BidiSpan objects otherwise.
|
1119 |
-
function getOrder(line, direction) {
|
1120 |
-
var order = line.order
|
1121 |
-
if (order == null) { order = line.order = bidiOrdering(line.text, direction) }
|
1122 |
-
return order
|
1123 |
-
}
|
1124 |
-
|
1125 |
-
// EVENT HANDLING
|
1126 |
-
|
1127 |
-
// Lightweight event framework. on/off also work on DOM nodes,
|
1128 |
-
// registering native DOM handlers.
|
1129 |
-
|
1130 |
-
var noHandlers = []
|
1131 |
-
|
1132 |
-
var on = function(emitter, type, f) {
|
1133 |
-
if (emitter.addEventListener) {
|
1134 |
-
emitter.addEventListener(type, f, false)
|
1135 |
-
} else if (emitter.attachEvent) {
|
1136 |
-
emitter.attachEvent("on" + type, f)
|
1137 |
-
} else {
|
1138 |
-
var map = emitter._handlers || (emitter._handlers = {})
|
1139 |
-
map[type] = (map[type] || noHandlers).concat(f)
|
1140 |
-
}
|
1141 |
-
}
|
1142 |
-
|
1143 |
-
function getHandlers(emitter, type) {
|
1144 |
-
return emitter._handlers && emitter._handlers[type] || noHandlers
|
1145 |
-
}
|
1146 |
-
|
1147 |
-
function off(emitter, type, f) {
|
1148 |
-
if (emitter.removeEventListener) {
|
1149 |
-
emitter.removeEventListener(type, f, false)
|
1150 |
-
} else if (emitter.detachEvent) {
|
1151 |
-
emitter.detachEvent("on" + type, f)
|
1152 |
-
} else {
|
1153 |
-
var map = emitter._handlers, arr = map && map[type]
|
1154 |
-
if (arr) {
|
1155 |
-
var index = indexOf(arr, f)
|
1156 |
-
if (index > -1)
|
1157 |
-
{ map[type] = arr.slice(0, index).concat(arr.slice(index + 1)) }
|
1158 |
-
}
|
1159 |
-
}
|
1160 |
-
}
|
1161 |
-
|
1162 |
-
function signal(emitter, type /*, values...*/) {
|
1163 |
-
var handlers = getHandlers(emitter, type)
|
1164 |
-
if (!handlers.length) { return }
|
1165 |
-
var args = Array.prototype.slice.call(arguments, 2)
|
1166 |
-
for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args) }
|
1167 |
-
}
|
1168 |
-
|
1169 |
-
// The DOM events that CodeMirror handles can be overridden by
|
1170 |
-
// registering a (non-DOM) handler on the editor for the event name,
|
1171 |
-
// and preventDefault-ing the event in that handler.
|
1172 |
-
function signalDOMEvent(cm, e, override) {
|
1173 |
-
if (typeof e == "string")
|
1174 |
-
{ e = {type: e, preventDefault: function() { this.defaultPrevented = true }} }
|
1175 |
-
signal(cm, override || e.type, cm, e)
|
1176 |
-
return e_defaultPrevented(e) || e.codemirrorIgnore
|
1177 |
-
}
|
1178 |
-
|
1179 |
-
function signalCursorActivity(cm) {
|
1180 |
-
var arr = cm._handlers && cm._handlers.cursorActivity
|
1181 |
-
if (!arr) { return }
|
1182 |
-
var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = [])
|
1183 |
-
for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
|
1184 |
-
{ set.push(arr[i]) } }
|
1185 |
-
}
|
1186 |
-
|
1187 |
-
function hasHandler(emitter, type) {
|
1188 |
-
return getHandlers(emitter, type).length > 0
|
1189 |
-
}
|
1190 |
-
|
1191 |
-
// Add on and off methods to a constructor's prototype, to make
|
1192 |
-
// registering events on such objects more convenient.
|
1193 |
-
function eventMixin(ctor) {
|
1194 |
-
ctor.prototype.on = function(type, f) {on(this, type, f)}
|
1195 |
-
ctor.prototype.off = function(type, f) {off(this, type, f)}
|
1196 |
-
}
|
1197 |
-
|
1198 |
-
// Due to the fact that we still support jurassic IE versions, some
|
1199 |
-
// compatibility wrappers are needed.
|
1200 |
-
|
1201 |
-
function e_preventDefault(e) {
|
1202 |
-
if (e.preventDefault) { e.preventDefault() }
|
1203 |
-
else { e.returnValue = false }
|
1204 |
-
}
|
1205 |
-
function e_stopPropagation(e) {
|
1206 |
-
if (e.stopPropagation) { e.stopPropagation() }
|
1207 |
-
else { e.cancelBubble = true }
|
1208 |
-
}
|
1209 |
-
function e_defaultPrevented(e) {
|
1210 |
-
return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
|
1211 |
-
}
|
1212 |
-
function e_stop(e) {e_preventDefault(e); e_stopPropagation(e)}
|
1213 |
-
|
1214 |
-
function e_target(e) {return e.target || e.srcElement}
|
1215 |
-
function e_button(e) {
|
1216 |
-
var b = e.which
|
1217 |
-
if (b == null) {
|
1218 |
-
if (e.button & 1) { b = 1 }
|
1219 |
-
else if (e.button & 2) { b = 3 }
|
1220 |
-
else if (e.button & 4) { b = 2 }
|
1221 |
-
}
|
1222 |
-
if (mac && e.ctrlKey && b == 1) { b = 3 }
|
1223 |
-
return b
|
1224 |
-
}
|
1225 |
-
|
1226 |
-
// Detect drag-and-drop
|
1227 |
-
var dragAndDrop = function() {
|
1228 |
-
// There is *some* kind of drag-and-drop support in IE6-8, but I
|
1229 |
-
// couldn't get it to work yet.
|
1230 |
-
if (ie && ie_version < 9) { return false }
|
1231 |
-
var div = elt('div')
|
1232 |
-
return "draggable" in div || "dragDrop" in div
|
1233 |
-
}()
|
1234 |
-
|
1235 |
-
var zwspSupported
|
1236 |
-
function zeroWidthElement(measure) {
|
1237 |
-
if (zwspSupported == null) {
|
1238 |
-
var test = elt("span", "\u200b")
|
1239 |
-
removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]))
|
1240 |
-
if (measure.firstChild.offsetHeight != 0)
|
1241 |
-
{ zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8) }
|
1242 |
-
}
|
1243 |
-
var node = zwspSupported ? elt("span", "\u200b") :
|
1244 |
-
elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px")
|
1245 |
-
node.setAttribute("cm-text", "")
|
1246 |
-
return node
|
1247 |
-
}
|
1248 |
-
|
1249 |
-
// Feature-detect IE's crummy client rect reporting for bidi text
|
1250 |
-
var badBidiRects
|
1251 |
-
function hasBadBidiRects(measure) {
|
1252 |
-
if (badBidiRects != null) { return badBidiRects }
|
1253 |
-
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"))
|
1254 |
-
var r0 = range(txt, 0, 1).getBoundingClientRect()
|
1255 |
-
var r1 = range(txt, 1, 2).getBoundingClientRect()
|
1256 |
-
removeChildren(measure)
|
1257 |
-
if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
|
1258 |
-
return badBidiRects = (r1.right - r0.right < 3)
|
1259 |
-
}
|
1260 |
-
|
1261 |
-
// See if "".split is the broken IE version, if so, provide an
|
1262 |
-
// alternative way to split lines.
|
1263 |
-
var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
|
1264 |
-
var pos = 0, result = [], l = string.length
|
1265 |
-
while (pos <= l) {
|
1266 |
-
var nl = string.indexOf("\n", pos)
|
1267 |
-
if (nl == -1) { nl = string.length }
|
1268 |
-
var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl)
|
1269 |
-
var rt = line.indexOf("\r")
|
1270 |
-
if (rt != -1) {
|
1271 |
-
result.push(line.slice(0, rt))
|
1272 |
-
pos += rt + 1
|
1273 |
-
} else {
|
1274 |
-
result.push(line)
|
1275 |
-
pos = nl + 1
|
1276 |
-
}
|
1277 |
-
}
|
1278 |
-
return result
|
1279 |
-
} : function (string) { return string.split(/\r\n?|\n/); }
|
1280 |
-
|
1281 |
-
var hasSelection = window.getSelection ? function (te) {
|
1282 |
-
try { return te.selectionStart != te.selectionEnd }
|
1283 |
-
catch(e) { return false }
|
1284 |
-
} : function (te) {
|
1285 |
-
var range
|
1286 |
-
try {range = te.ownerDocument.selection.createRange()}
|
1287 |
-
catch(e) {}
|
1288 |
-
if (!range || range.parentElement() != te) { return false }
|
1289 |
-
return range.compareEndPoints("StartToEnd", range) != 0
|
1290 |
-
}
|
1291 |
-
|
1292 |
-
var hasCopyEvent = (function () {
|
1293 |
-
var e = elt("div")
|
1294 |
-
if ("oncopy" in e) { return true }
|
1295 |
-
e.setAttribute("oncopy", "return;")
|
1296 |
-
return typeof e.oncopy == "function"
|
1297 |
-
})()
|
1298 |
-
|
1299 |
-
var badZoomedRects = null
|
1300 |
-
function hasBadZoomedRects(measure) {
|
1301 |
-
if (badZoomedRects != null) { return badZoomedRects }
|
1302 |
-
var node = removeChildrenAndAdd(measure, elt("span", "x"))
|
1303 |
-
var normal = node.getBoundingClientRect()
|
1304 |
-
var fromRange = range(node, 0, 1).getBoundingClientRect()
|
1305 |
-
return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
|
1306 |
-
}
|
1307 |
-
|
1308 |
-
var modes = {};
|
1309 |
-
var mimeModes = {};
|
1310 |
-
// Extra arguments are stored as the mode's dependencies, which is
|
1311 |
-
// used by (legacy) mechanisms like loadmode.js to automatically
|
1312 |
-
// load a mode. (Preferred mechanism is the require/define calls.)
|
1313 |
-
function defineMode(name, mode) {
|
1314 |
-
if (arguments.length > 2)
|
1315 |
-
{ mode.dependencies = Array.prototype.slice.call(arguments, 2) }
|
1316 |
-
modes[name] = mode
|
1317 |
-
}
|
1318 |
-
|
1319 |
-
function defineMIME(mime, spec) {
|
1320 |
-
mimeModes[mime] = spec
|
1321 |
-
}
|
1322 |
-
|
1323 |
-
// Given a MIME type, a {name, ...options} config object, or a name
|
1324 |
-
// string, return a mode config object.
|
1325 |
-
function resolveMode(spec) {
|
1326 |
-
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
1327 |
-
spec = mimeModes[spec]
|
1328 |
-
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
1329 |
-
var found = mimeModes[spec.name]
|
1330 |
-
if (typeof found == "string") { found = {name: found} }
|
1331 |
-
spec = createObj(found, spec)
|
1332 |
-
spec.name = found.name
|
1333 |
-
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
|
1334 |
-
return resolveMode("application/xml")
|
1335 |
-
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
|
1336 |
-
return resolveMode("application/json")
|
1337 |
-
}
|
1338 |
-
if (typeof spec == "string") { return {name: spec} }
|
1339 |
-
else { return spec || {name: "null"} }
|
1340 |
-
}
|
1341 |
-
|
1342 |
-
// Given a mode spec (anything that resolveMode accepts), find and
|
1343 |
-
// initialize an actual mode object.
|
1344 |
-
function getMode(options, spec) {
|
1345 |
-
spec = resolveMode(spec)
|
1346 |
-
var mfactory = modes[spec.name]
|
1347 |
-
if (!mfactory) { return getMode(options, "text/plain") }
|
1348 |
-
var modeObj = mfactory(options, spec)
|
1349 |
-
if (modeExtensions.hasOwnProperty(spec.name)) {
|
1350 |
-
var exts = modeExtensions[spec.name]
|
1351 |
-
for (var prop in exts) {
|
1352 |
-
if (!exts.hasOwnProperty(prop)) { continue }
|
1353 |
-
if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop] }
|
1354 |
-
modeObj[prop] = exts[prop]
|
1355 |
-
}
|
1356 |
-
}
|
1357 |
-
modeObj.name = spec.name
|
1358 |
-
if (spec.helperType) { modeObj.helperType = spec.helperType }
|
1359 |
-
if (spec.modeProps) { for (var prop$1 in spec.modeProps)
|
1360 |
-
{ modeObj[prop$1] = spec.modeProps[prop$1] } }
|
1361 |
-
|
1362 |
-
return modeObj
|
1363 |
-
}
|
1364 |
-
|
1365 |
-
// This can be used to attach properties to mode objects from
|
1366 |
-
// outside the actual mode definition.
|
1367 |
-
var modeExtensions = {}
|
1368 |
-
function extendMode(mode, properties) {
|
1369 |
-
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {})
|
1370 |
-
copyObj(properties, exts)
|
1371 |
-
}
|
1372 |
-
|
1373 |
-
function copyState(mode, state) {
|
1374 |
-
if (state === true) { return state }
|
1375 |
-
if (mode.copyState) { return mode.copyState(state) }
|
1376 |
-
var nstate = {}
|
1377 |
-
for (var n in state) {
|
1378 |
-
var val = state[n]
|
1379 |
-
if (val instanceof Array) { val = val.concat([]) }
|
1380 |
-
nstate[n] = val
|
1381 |
-
}
|
1382 |
-
return nstate
|
1383 |
-
}
|
1384 |
-
|
1385 |
-
// Given a mode and a state (for that mode), find the inner mode and
|
1386 |
-
// state at the position that the state refers to.
|
1387 |
-
function innerMode(mode, state) {
|
1388 |
-
var info
|
1389 |
-
while (mode.innerMode) {
|
1390 |
-
info = mode.innerMode(state)
|
1391 |
-
if (!info || info.mode == mode) { break }
|
1392 |
-
state = info.state
|
1393 |
-
mode = info.mode
|
1394 |
-
}
|
1395 |
-
return info || {mode: mode, state: state}
|
1396 |
-
}
|
1397 |
-
|
1398 |
-
function startState(mode, a1, a2) {
|
1399 |
-
return mode.startState ? mode.startState(a1, a2) : true
|
1400 |
-
}
|
1401 |
-
|
1402 |
-
// STRING STREAM
|
1403 |
-
|
1404 |
-
// Fed to the mode parsers, provides helper functions to make
|
1405 |
-
// parsers more succinct.
|
1406 |
-
|
1407 |
-
var StringStream = function(string, tabSize, lineOracle) {
|
1408 |
-
this.pos = this.start = 0
|
1409 |
-
this.string = string
|
1410 |
-
this.tabSize = tabSize || 8
|
1411 |
-
this.lastColumnPos = this.lastColumnValue = 0
|
1412 |
-
this.lineStart = 0
|
1413 |
-
this.lineOracle = lineOracle
|
1414 |
-
};
|
1415 |
-
|
1416 |
-
StringStream.prototype.eol = function () {return this.pos >= this.string.length};
|
1417 |
-
StringStream.prototype.sol = function () {return this.pos == this.lineStart};
|
1418 |
-
StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
|
1419 |
-
StringStream.prototype.next = function () {
|
1420 |
-
if (this.pos < this.string.length)
|
1421 |
-
{ return this.string.charAt(this.pos++) }
|
1422 |
-
};
|
1423 |
-
StringStream.prototype.eat = function (match) {
|
1424 |
-
var ch = this.string.charAt(this.pos)
|
1425 |
-
var ok
|
1426 |
-
if (typeof match == "string") { ok = ch == match }
|
1427 |
-
else { ok = ch && (match.test ? match.test(ch) : match(ch)) }
|
1428 |
-
if (ok) {++this.pos; return ch}
|
1429 |
-
};
|
1430 |
-
StringStream.prototype.eatWhile = function (match) {
|
1431 |
-
var start = this.pos
|
1432 |
-
while (this.eat(match)){}
|
1433 |
-
return this.pos > start
|
1434 |
-
};
|
1435 |
-
StringStream.prototype.eatSpace = function () {
|
1436 |
-
var this$1 = this;
|
1437 |
-
|
1438 |
-
var start = this.pos
|
1439 |
-
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos }
|
1440 |
-
return this.pos > start
|
1441 |
-
};
|
1442 |
-
StringStream.prototype.skipToEnd = function () {this.pos = this.string.length};
|
1443 |
-
StringStream.prototype.skipTo = function (ch) {
|
1444 |
-
var found = this.string.indexOf(ch, this.pos)
|
1445 |
-
if (found > -1) {this.pos = found; return true}
|
1446 |
-
};
|
1447 |
-
StringStream.prototype.backUp = function (n) {this.pos -= n};
|
1448 |
-
StringStream.prototype.column = function () {
|
1449 |
-
if (this.lastColumnPos < this.start) {
|
1450 |
-
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue)
|
1451 |
-
this.lastColumnPos = this.start
|
1452 |
-
}
|
1453 |
-
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
1454 |
-
};
|
1455 |
-
StringStream.prototype.indentation = function () {
|
1456 |
-
return countColumn(this.string, null, this.tabSize) -
|
1457 |
-
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
1458 |
-
};
|
1459 |
-
StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
|
1460 |
-
if (typeof pattern == "string") {
|
1461 |
-
var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; }
|
1462 |
-
var substr = this.string.substr(this.pos, pattern.length)
|
1463 |
-
if (cased(substr) == cased(pattern)) {
|
1464 |
-
if (consume !== false) { this.pos += pattern.length }
|
1465 |
-
return true
|
1466 |
}
|
1467 |
-
} else {
|
1468 |
-
var match = this.string.slice(this.pos).match(pattern)
|
1469 |
-
if (match && match.index > 0) { return null }
|
1470 |
-
if (match && consume !== false) { this.pos += match[0].length }
|
1471 |
-
return match
|
1472 |
-
}
|
1473 |
-
};
|
1474 |
-
StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
|
1475 |
-
StringStream.prototype.hideFirstChars = function (n, inner) {
|
1476 |
-
this.lineStart += n
|
1477 |
-
try { return inner() }
|
1478 |
-
finally { this.lineStart -= n }
|
1479 |
-
};
|
1480 |
-
StringStream.prototype.lookAhead = function (n) {
|
1481 |
-
var oracle = this.lineOracle
|
1482 |
-
return oracle && oracle.lookAhead(n)
|
1483 |
-
};
|
1484 |
-
StringStream.prototype.baseToken = function () {
|
1485 |
-
var oracle = this.lineOracle
|
1486 |
-
return oracle && oracle.baseToken(this.pos)
|
1487 |
-
};
|
1488 |
-
|
1489 |
-
var SavedContext = function(state, lookAhead) {
|
1490 |
-
this.state = state
|
1491 |
-
this.lookAhead = lookAhead
|
1492 |
-
};
|
1493 |
-
|
1494 |
-
var Context = function(doc, state, line, lookAhead) {
|
1495 |
-
this.state = state
|
1496 |
-
this.doc = doc
|
1497 |
-
this.line = line
|
1498 |
-
this.maxLookAhead = lookAhead || 0
|
1499 |
-
this.baseTokens = null
|
1500 |
-
this.baseTokenPos = 1
|
1501 |
-
};
|
1502 |
-
|
1503 |
-
Context.prototype.lookAhead = function (n) {
|
1504 |
-
var line = this.doc.getLine(this.line + n)
|
1505 |
-
if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n }
|
1506 |
-
return line
|
1507 |
-
};
|
1508 |
-
|
1509 |
-
Context.prototype.baseToken = function (n) {
|
1510 |
-
var this$1 = this;
|
1511 |
-
|
1512 |
-
if (!this.baseTokens) { return null }
|
1513 |
-
while (this.baseTokens[this.baseTokenPos] <= n)
|
1514 |
-
{ this$1.baseTokenPos += 2 }
|
1515 |
-
var type = this.baseTokens[this.baseTokenPos + 1]
|
1516 |
-
return {type: type && type.replace(/( |^)overlay .*/, ""),
|
1517 |
-
size: this.baseTokens[this.baseTokenPos] - n}
|
1518 |
-
};
|
1519 |
-
|
1520 |
-
Context.prototype.nextLine = function () {
|
1521 |
-
this.line++
|
1522 |
-
if (this.maxLookAhead > 0) { this.maxLookAhead-- }
|
1523 |
-
};
|
1524 |
-
|
1525 |
-
Context.fromSaved = function (doc, saved, line) {
|
1526 |
-
if (saved instanceof SavedContext)
|
1527 |
-
{ return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
|
1528 |
-
else
|
1529 |
-
{ return new Context(doc, copyState(doc.mode, saved), line) }
|
1530 |
-
};
|
1531 |
-
|
1532 |
-
Context.prototype.save = function (copy) {
|
1533 |
-
var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state
|
1534 |
-
return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
|
1535 |
-
};
|
1536 |
-
|
1537 |
-
|
1538 |
-
// Compute a style array (an array starting with a mode generation
|
1539 |
-
// -- for invalidation -- followed by pairs of end positions and
|
1540 |
-
// style strings), which is used to highlight the tokens on the
|
1541 |
-
// line.
|
1542 |
-
function highlightLine(cm, line, context, forceToEnd) {
|
1543 |
-
// A styles array always starts with a number identifying the
|
1544 |
-
// mode/overlays that it is based on (for easy invalidation).
|
1545 |
-
var st = [cm.state.modeGen], lineClasses = {}
|
1546 |
-
// Compute the base array of styles
|
1547 |
-
runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
|
1548 |
-
lineClasses, forceToEnd)
|
1549 |
-
var state = context.state
|
1550 |
-
|
1551 |
-
// Run overlays, adjust style array.
|
1552 |
-
var loop = function ( o ) {
|
1553 |
-
context.baseTokens = st
|
1554 |
-
var overlay = cm.state.overlays[o], i = 1, at = 0
|
1555 |
-
context.state = true
|
1556 |
-
runMode(cm, line.text, overlay.mode, context, function (end, style) {
|
1557 |
-
var start = i
|
1558 |
-
// Ensure there's a token end at the current position, and that i points at it
|
1559 |
-
while (at < end) {
|
1560 |
-
var i_end = st[i]
|
1561 |
-
if (i_end > end)
|
1562 |
-
{ st.splice(i, 1, end, st[i+1], i_end) }
|
1563 |
-
i += 2
|
1564 |
-
at = Math.min(end, i_end)
|
1565 |
-
}
|
1566 |
-
if (!style) { return }
|
1567 |
-
if (overlay.opaque) {
|
1568 |
-
st.splice(start, i - start, end, "overlay " + style)
|
1569 |
-
i = start + 2
|
1570 |
-
} else {
|
1571 |
-
for (; start < i; start += 2) {
|
1572 |
-
var cur = st[start+1]
|
1573 |
-
st[start+1] = (cur ? cur + " " : "") + "overlay " + style
|
1574 |
-
}
|
1575 |
-
}
|
1576 |
-
}, lineClasses)
|
1577 |
-
context.state = state
|
1578 |
-
context.baseTokens = null
|
1579 |
-
context.baseTokenPos = 1
|
1580 |
};
|
1581 |
|
1582 |
-
|
1583 |
-
|
1584 |
-
|
1585 |
-
|
1586 |
-
|
1587 |
-
|
1588 |
-
|
1589 |
-
|
1590 |
-
|
1591 |
-
|
1592 |
-
|
1593 |
-
|
1594 |
-
|
1595 |
-
if (
|
1596 |
-
|
1597 |
-
if (
|
1598 |
-
|
1599 |
-
}
|
1600 |
-
|
1601 |
-
|
1602 |
-
|
1603 |
-
|
1604 |
-
|
1605 |
-
|
1606 |
-
|
1607 |
-
var
|
1608 |
-
|
1609 |
-
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
}
|
1633 |
-
|
1634 |
-
function callBlankLine(mode, state) {
|
1635 |
-
if (mode.blankLine) { return mode.blankLine(state) }
|
1636 |
-
if (!mode.innerMode) { return }
|
1637 |
-
var inner = innerMode(mode, state)
|
1638 |
-
if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
|
1639 |
-
}
|
1640 |
-
|
1641 |
-
function readToken(mode, stream, state, inner) {
|
1642 |
-
for (var i = 0; i < 10; i++) {
|
1643 |
-
if (inner) { inner[0] = innerMode(mode, state).mode }
|
1644 |
-
var style = mode.token(stream, state)
|
1645 |
-
if (stream.pos > stream.start) { return style }
|
1646 |
-
}
|
1647 |
-
throw new Error("Mode " + mode.name + " failed to advance stream.")
|
1648 |
-
}
|
1649 |
-
|
1650 |
-
var Token = function(stream, type, state) {
|
1651 |
-
this.start = stream.start; this.end = stream.pos
|
1652 |
-
this.string = stream.current()
|
1653 |
-
this.type = type || null
|
1654 |
-
this.state = state
|
1655 |
-
};
|
1656 |
-
|
1657 |
-
// Utility for getTokenAt and getLineTokens
|
1658 |
-
function takeToken(cm, pos, precise, asArray) {
|
1659 |
-
var doc = cm.doc, mode = doc.mode, style
|
1660 |
-
pos = clipPos(doc, pos)
|
1661 |
-
var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise)
|
1662 |
-
var stream = new StringStream(line.text, cm.options.tabSize, context), tokens
|
1663 |
-
if (asArray) { tokens = [] }
|
1664 |
-
while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
|
1665 |
-
stream.start = stream.pos
|
1666 |
-
style = readToken(mode, stream, context.state)
|
1667 |
-
if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))) }
|
1668 |
-
}
|
1669 |
-
return asArray ? tokens : new Token(stream, style, context.state)
|
1670 |
-
}
|
1671 |
-
|
1672 |
-
function extractLineClasses(type, output) {
|
1673 |
-
if (type) { for (;;) {
|
1674 |
-
var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/)
|
1675 |
-
if (!lineClass) { break }
|
1676 |
-
type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length)
|
1677 |
-
var prop = lineClass[1] ? "bgClass" : "textClass"
|
1678 |
-
if (output[prop] == null)
|
1679 |
-
{ output[prop] = lineClass[2] }
|
1680 |
-
else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
|
1681 |
-
{ output[prop] += " " + lineClass[2] }
|
1682 |
-
} }
|
1683 |
-
return type
|
1684 |
-
}
|
1685 |
-
|
1686 |
-
// Run the given mode's parser over a line, calling f for each token.
|
1687 |
-
function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
|
1688 |
-
var flattenSpans = mode.flattenSpans
|
1689 |
-
if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans }
|
1690 |
-
var curStart = 0, curStyle = null
|
1691 |
-
var stream = new StringStream(text, cm.options.tabSize, context), style
|
1692 |
-
var inner = cm.options.addModeClass && [null]
|
1693 |
-
if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses) }
|
1694 |
-
while (!stream.eol()) {
|
1695 |
-
if (stream.pos > cm.options.maxHighlightLength) {
|
1696 |
-
flattenSpans = false
|
1697 |
-
if (forceToEnd) { processLine(cm, text, context, stream.pos) }
|
1698 |
-
stream.pos = text.length
|
1699 |
-
style = null
|
1700 |
-
} else {
|
1701 |
-
style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses)
|
1702 |
-
}
|
1703 |
-
if (inner) {
|
1704 |
-
var mName = inner[0].name
|
1705 |
-
if (mName) { style = "m-" + (style ? mName + " " + style : mName) }
|
1706 |
-
}
|
1707 |
-
if (!flattenSpans || curStyle != style) {
|
1708 |
-
while (curStart < stream.start) {
|
1709 |
-
curStart = Math.min(stream.start, curStart + 5000)
|
1710 |
-
f(curStart, curStyle)
|
1711 |
-
}
|
1712 |
-
curStyle = style
|
1713 |
-
}
|
1714 |
-
stream.start = stream.pos
|
1715 |
-
}
|
1716 |
-
while (curStart < stream.pos) {
|
1717 |
-
// Webkit seems to refuse to render text nodes longer than 57444
|
1718 |
-
// characters, and returns inaccurate measurements in nodes
|
1719 |
-
// starting around 5000 chars.
|
1720 |
-
var pos = Math.min(stream.pos, curStart + 5000)
|
1721 |
-
f(pos, curStyle)
|
1722 |
-
curStart = pos
|
1723 |
-
}
|
1724 |
-
}
|
1725 |
-
|
1726 |
-
// Finds the line to start with when starting a parse. Tries to
|
1727 |
-
// find a line with a stateAfter, so that it can start with a
|
1728 |
-
// valid state. If that fails, it returns the line with the
|
1729 |
-
// smallest indentation, which tends to need the least context to
|
1730 |
-
// parse correctly.
|
1731 |
-
function findStartLine(cm, n, precise) {
|
1732 |
-
var minindent, minline, doc = cm.doc
|
1733 |
-
var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100)
|
1734 |
-
for (var search = n; search > lim; --search) {
|
1735 |
-
if (search <= doc.first) { return doc.first }
|
1736 |
-
var line = getLine(doc, search - 1), after = line.stateAfter
|
1737 |
-
if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
|
1738 |
-
{ return search }
|
1739 |
-
var indented = countColumn(line.text, null, cm.options.tabSize)
|
1740 |
-
if (minline == null || minindent > indented) {
|
1741 |
-
minline = search - 1
|
1742 |
-
minindent = indented
|
1743 |
-
}
|
1744 |
-
}
|
1745 |
-
return minline
|
1746 |
-
}
|
1747 |
-
|
1748 |
-
function retreatFrontier(doc, n) {
|
1749 |
-
doc.modeFrontier = Math.min(doc.modeFrontier, n)
|
1750 |
-
if (doc.highlightFrontier < n - 10) { return }
|
1751 |
-
var start = doc.first
|
1752 |
-
for (var line = n - 1; line > start; line--) {
|
1753 |
-
var saved = getLine(doc, line).stateAfter
|
1754 |
-
// change is on 3
|
1755 |
-
// state on line 1 looked ahead 2 -- so saw 3
|
1756 |
-
// test 1 + 2 < 3 should cover this
|
1757 |
-
if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
|
1758 |
-
start = line + 1
|
1759 |
-
break
|
1760 |
-
}
|
1761 |
-
}
|
1762 |
-
doc.highlightFrontier = Math.min(doc.highlightFrontier, start)
|
1763 |
-
}
|
1764 |
-
|
1765 |
-
// LINE DATA STRUCTURE
|
1766 |
-
|
1767 |
-
// Line objects. These hold state related to a line, including
|
1768 |
-
// highlighting info (the styles array).
|
1769 |
-
var Line = function(text, markedSpans, estimateHeight) {
|
1770 |
-
this.text = text
|
1771 |
-
attachMarkedSpans(this, markedSpans)
|
1772 |
-
this.height = estimateHeight ? estimateHeight(this) : 1
|
1773 |
-
};
|
1774 |
-
|
1775 |
-
Line.prototype.lineNo = function () { return lineNo(this) };
|
1776 |
-
eventMixin(Line)
|
1777 |
-
|
1778 |
-
// Change the content (text, markers) of a line. Automatically
|
1779 |
-
// invalidates cached information and tries to re-estimate the
|
1780 |
-
// line's height.
|
1781 |
-
function updateLine(line, text, markedSpans, estimateHeight) {
|
1782 |
-
line.text = text
|
1783 |
-
if (line.stateAfter) { line.stateAfter = null }
|
1784 |
-
if (line.styles) { line.styles = null }
|
1785 |
-
if (line.order != null) { line.order = null }
|
1786 |
-
detachMarkedSpans(line)
|
1787 |
-
attachMarkedSpans(line, markedSpans)
|
1788 |
-
var estHeight = estimateHeight ? estimateHeight(line) : 1
|
1789 |
-
if (estHeight != line.height) { updateLineHeight(line, estHeight) }
|
1790 |
-
}
|
1791 |
-
|
1792 |
-
// Detach a line from the document tree and its markers.
|
1793 |
-
function cleanUpLine(line) {
|
1794 |
-
line.parent = null
|
1795 |
-
detachMarkedSpans(line)
|
1796 |
-
}
|
1797 |
-
|
1798 |
-
// Convert a style as returned by a mode (either null, or a string
|
1799 |
-
// containing one or more styles) to a CSS style. This is cached,
|
1800 |
-
// and also looks for line-wide styles.
|
1801 |
-
var styleToClassCache = {};
|
1802 |
-
var styleToClassCacheWithMode = {};
|
1803 |
-
function interpretTokenStyle(style, options) {
|
1804 |
-
if (!style || /^\s*$/.test(style)) { return null }
|
1805 |
-
var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache
|
1806 |
-
return cache[style] ||
|
1807 |
-
(cache[style] = style.replace(/\S+/g, "cm-$&"))
|
1808 |
-
}
|
1809 |
-
|
1810 |
-
// Render the DOM representation of the text of a line. Also builds
|
1811 |
-
// up a 'line map', which points at the DOM nodes that represent
|
1812 |
-
// specific stretches of text, and is used by the measuring code.
|
1813 |
-
// The returned object contains the DOM node, this map, and
|
1814 |
-
// information about line-wide styles that were set by the mode.
|
1815 |
-
function buildLineContent(cm, lineView) {
|
1816 |
-
// The padding-right forces the element to have a 'border', which
|
1817 |
-
// is needed on Webkit to be able to get line-level bounding
|
1818 |
-
// rectangles for it (in measureChar).
|
1819 |
-
var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null)
|
1820 |
-
var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
|
1821 |
-
col: 0, pos: 0, cm: cm,
|
1822 |
-
trailingSpace: false,
|
1823 |
-
splitSpaces: (ie || webkit) && cm.getOption("lineWrapping")}
|
1824 |
-
lineView.measure = {}
|
1825 |
-
|
1826 |
-
// Iterate over the logical lines that make up this visual line.
|
1827 |
-
for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
|
1828 |
-
var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0)
|
1829 |
-
builder.pos = 0
|
1830 |
-
builder.addToken = buildToken
|
1831 |
-
// Optionally wire in some hacks into the token-rendering
|
1832 |
-
// algorithm, to deal with browser quirks.
|
1833 |
-
if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
|
1834 |
-
{ builder.addToken = buildTokenBadBidi(builder.addToken, order) }
|
1835 |
-
builder.map = []
|
1836 |
-
var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line)
|
1837 |
-
insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate))
|
1838 |
-
if (line.styleClasses) {
|
1839 |
-
if (line.styleClasses.bgClass)
|
1840 |
-
{ builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || "") }
|
1841 |
-
if (line.styleClasses.textClass)
|
1842 |
-
{ builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || "") }
|
1843 |
-
}
|
1844 |
-
|
1845 |
-
// Ensure at least a single node is present, for measuring.
|
1846 |
-
if (builder.map.length == 0)
|
1847 |
-
{ builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))) }
|
1848 |
-
|
1849 |
-
// Store the map and a cache object for the current logical line
|
1850 |
-
if (i == 0) {
|
1851 |
-
lineView.measure.map = builder.map
|
1852 |
-
lineView.measure.cache = {}
|
1853 |
-
} else {
|
1854 |
-
;(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
|
1855 |
-
;(lineView.measure.caches || (lineView.measure.caches = [])).push({})
|
1856 |
-
}
|
1857 |
-
}
|
1858 |
-
|
1859 |
-
// See issue #2901
|
1860 |
-
if (webkit) {
|
1861 |
-
var last = builder.content.lastChild
|
1862 |
-
if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
|
1863 |
-
{ builder.content.className = "cm-tab-wrap-hack" }
|
1864 |
-
}
|
1865 |
-
|
1866 |
-
signal(cm, "renderLine", cm, lineView.line, builder.pre)
|
1867 |
-
if (builder.pre.className)
|
1868 |
-
{ builder.textClass = joinClasses(builder.pre.className, builder.textClass || "") }
|
1869 |
-
|
1870 |
-
return builder
|
1871 |
-
}
|
1872 |
-
|
1873 |
-
function defaultSpecialCharPlaceholder(ch) {
|
1874 |
-
var token = elt("span", "\u2022", "cm-invalidchar")
|
1875 |
-
token.title = "\\u" + ch.charCodeAt(0).toString(16)
|
1876 |
-
token.setAttribute("aria-label", token.title)
|
1877 |
-
return token
|
1878 |
-
}
|
1879 |
-
|
1880 |
-
// Build up the DOM representation for a single token, and add it to
|
1881 |
-
// the line map. Takes care to render special characters separately.
|
1882 |
-
function buildToken(builder, text, style, startStyle, endStyle, title, css) {
|
1883 |
-
if (!text) { return }
|
1884 |
-
var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text
|
1885 |
-
var special = builder.cm.state.specialChars, mustWrap = false
|
1886 |
-
var content
|
1887 |
-
if (!special.test(text)) {
|
1888 |
-
builder.col += text.length
|
1889 |
-
content = document.createTextNode(displayText)
|
1890 |
-
builder.map.push(builder.pos, builder.pos + text.length, content)
|
1891 |
-
if (ie && ie_version < 9) { mustWrap = true }
|
1892 |
-
builder.pos += text.length
|
1893 |
-
} else {
|
1894 |
-
content = document.createDocumentFragment()
|
1895 |
-
var pos = 0
|
1896 |
-
while (true) {
|
1897 |
-
special.lastIndex = pos
|
1898 |
-
var m = special.exec(text)
|
1899 |
-
var skipped = m ? m.index - pos : text.length - pos
|
1900 |
-
if (skipped) {
|
1901 |
-
var txt = document.createTextNode(displayText.slice(pos, pos + skipped))
|
1902 |
-
if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])) }
|
1903 |
-
else { content.appendChild(txt) }
|
1904 |
-
builder.map.push(builder.pos, builder.pos + skipped, txt)
|
1905 |
-
builder.col += skipped
|
1906 |
-
builder.pos += skipped
|
1907 |
-
}
|
1908 |
-
if (!m) { break }
|
1909 |
-
pos += skipped + 1
|
1910 |
-
var txt$1 = (void 0)
|
1911 |
-
if (m[0] == "\t") {
|
1912 |
-
var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize
|
1913 |
-
txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"))
|
1914 |
-
txt$1.setAttribute("role", "presentation")
|
1915 |
-
txt$1.setAttribute("cm-text", "\t")
|
1916 |
-
builder.col += tabWidth
|
1917 |
-
} else if (m[0] == "\r" || m[0] == "\n") {
|
1918 |
-
txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"))
|
1919 |
-
txt$1.setAttribute("cm-text", m[0])
|
1920 |
-
builder.col += 1
|
1921 |
-
} else {
|
1922 |
-
txt$1 = builder.cm.options.specialCharPlaceholder(m[0])
|
1923 |
-
txt$1.setAttribute("cm-text", m[0])
|
1924 |
-
if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])) }
|
1925 |
-
else { content.appendChild(txt$1) }
|
1926 |
-
builder.col += 1
|
1927 |
-
}
|
1928 |
-
builder.map.push(builder.pos, builder.pos + 1, txt$1)
|
1929 |
-
builder.pos++
|
1930 |
-
}
|
1931 |
-
}
|
1932 |
-
builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32
|
1933 |
-
if (style || startStyle || endStyle || mustWrap || css) {
|
1934 |
-
var fullStyle = style || ""
|
1935 |
-
if (startStyle) { fullStyle += startStyle }
|
1936 |
-
if (endStyle) { fullStyle += endStyle }
|
1937 |
-
var token = elt("span", [content], fullStyle, css)
|
1938 |
-
if (title) { token.title = title }
|
1939 |
-
return builder.content.appendChild(token)
|
1940 |
-
}
|
1941 |
-
builder.content.appendChild(content)
|
1942 |
-
}
|
1943 |
-
|
1944 |
-
function splitSpaces(text, trailingBefore) {
|
1945 |
-
if (text.length > 1 && !/ /.test(text)) { return text }
|
1946 |
-
var spaceBefore = trailingBefore, result = ""
|
1947 |
-
for (var i = 0; i < text.length; i++) {
|
1948 |
-
var ch = text.charAt(i)
|
1949 |
-
if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
|
1950 |
-
{ ch = "\u00a0" }
|
1951 |
-
result += ch
|
1952 |
-
spaceBefore = ch == " "
|
1953 |
-
}
|
1954 |
-
return result
|
1955 |
-
}
|
1956 |
-
|
1957 |
-
// Work around nonsense dimensions being reported for stretches of
|
1958 |
-
// right-to-left text.
|
1959 |
-
function buildTokenBadBidi(inner, order) {
|
1960 |
-
return function (builder, text, style, startStyle, endStyle, title, css) {
|
1961 |
-
style = style ? style + " cm-force-border" : "cm-force-border"
|
1962 |
-
var start = builder.pos, end = start + text.length
|
1963 |
-
for (;;) {
|
1964 |
-
// Find the part that overlaps with the start of this text
|
1965 |
-
var part = (void 0)
|
1966 |
-
for (var i = 0; i < order.length; i++) {
|
1967 |
-
part = order[i]
|
1968 |
-
if (part.to > start && part.from <= start) { break }
|
1969 |
-
}
|
1970 |
-
if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, title, css) }
|
1971 |
-
inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css)
|
1972 |
-
startStyle = null
|
1973 |
-
text = text.slice(part.to - start)
|
1974 |
-
start = part.to
|
1975 |
-
}
|
1976 |
-
}
|
1977 |
-
}
|
1978 |
-
|
1979 |
-
function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
|
1980 |
-
var widget = !ignoreWidget && marker.widgetNode
|
1981 |
-
if (widget) { builder.map.push(builder.pos, builder.pos + size, widget) }
|
1982 |
-
if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
|
1983 |
-
if (!widget)
|
1984 |
-
{ widget = builder.content.appendChild(document.createElement("span")) }
|
1985 |
-
widget.setAttribute("cm-marker", marker.id)
|
1986 |
-
}
|
1987 |
-
if (widget) {
|
1988 |
-
builder.cm.display.input.setUneditable(widget)
|
1989 |
-
builder.content.appendChild(widget)
|
1990 |
-
}
|
1991 |
-
builder.pos += size
|
1992 |
-
builder.trailingSpace = false
|
1993 |
-
}
|
1994 |
-
|
1995 |
-
// Outputs a number of spans to make up a line, taking highlighting
|
1996 |
-
// and marked text into account.
|
1997 |
-
function insertLineContent(line, builder, styles) {
|
1998 |
-
var spans = line.markedSpans, allText = line.text, at = 0
|
1999 |
-
if (!spans) {
|
2000 |
-
for (var i$1 = 1; i$1 < styles.length; i$1+=2)
|
2001 |
-
{ builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)) }
|
2002 |
-
return
|
2003 |
-
}
|
2004 |
-
|
2005 |
-
var len = allText.length, pos = 0, i = 1, text = "", style, css
|
2006 |
-
var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed
|
2007 |
-
for (;;) {
|
2008 |
-
if (nextChange == pos) { // Update current marker set
|
2009 |
-
spanStyle = spanEndStyle = spanStartStyle = title = css = ""
|
2010 |
-
collapsed = null; nextChange = Infinity
|
2011 |
-
var foundBookmarks = [], endStyles = (void 0)
|
2012 |
-
for (var j = 0; j < spans.length; ++j) {
|
2013 |
-
var sp = spans[j], m = sp.marker
|
2014 |
-
if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
|
2015 |
-
foundBookmarks.push(m)
|
2016 |
-
} else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
|
2017 |
-
if (sp.to != null && sp.to != pos && nextChange > sp.to) {
|
2018 |
-
nextChange = sp.to
|
2019 |
-
spanEndStyle = ""
|
2020 |
-
}
|
2021 |
-
if (m.className) { spanStyle += " " + m.className }
|
2022 |
-
if (m.css) { css = (css ? css + ";" : "") + m.css }
|
2023 |
-
if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle }
|
2024 |
-
if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to) }
|
2025 |
-
if (m.title && !title) { title = m.title }
|
2026 |
-
if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
|
2027 |
-
{ collapsed = sp }
|
2028 |
-
} else if (sp.from > pos && nextChange > sp.from) {
|
2029 |
-
nextChange = sp.from
|
2030 |
-
}
|
2031 |
-
}
|
2032 |
-
if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
|
2033 |
-
{ if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1] } } }
|
2034 |
|
2035 |
-
|
2036 |
-
|
2037 |
-
|
2038 |
-
|
2039 |
-
|
2040 |
-
|
2041 |
-
|
2042 |
-
|
|
|
2043 |
}
|
2044 |
-
|
2045 |
-
|
2046 |
-
|
2047 |
-
while (true) {
|
2048 |
-
if (text) {
|
2049 |
-
var end = pos + text.length
|
2050 |
-
if (!collapsed) {
|
2051 |
-
var tokenText = end > upto ? text.slice(0, upto - pos) : text
|
2052 |
-
builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
|
2053 |
-
spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", title, css)
|
2054 |
-
}
|
2055 |
-
if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
|
2056 |
-
pos = end
|
2057 |
-
spanStartStyle = ""
|
2058 |
-
}
|
2059 |
-
text = allText.slice(at, at = styles[i++])
|
2060 |
-
style = interpretTokenStyle(styles[i++], builder.cm.options)
|
2061 |
-
}
|
2062 |
-
}
|
2063 |
-
}
|
2064 |
-
|
2065 |
-
|
2066 |
-
// These objects are used to represent the visible (currently drawn)
|
2067 |
-
// part of the document. A LineView may correspond to multiple
|
2068 |
-
// logical lines, if those are connected by collapsed ranges.
|
2069 |
-
function LineView(doc, line, lineN) {
|
2070 |
-
// The starting line
|
2071 |
-
this.line = line
|
2072 |
-
// Continuing lines, if any
|
2073 |
-
this.rest = visualLineContinued(line)
|
2074 |
-
// Number of logical lines in this visual line
|
2075 |
-
this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1
|
2076 |
-
this.node = this.text = null
|
2077 |
-
this.hidden = lineIsHidden(doc, line)
|
2078 |
-
}
|
2079 |
-
|
2080 |
-
// Create a range of LineView objects for the given lines.
|
2081 |
-
function buildViewArray(cm, from, to) {
|
2082 |
-
var array = [], nextPos
|
2083 |
-
for (var pos = from; pos < to; pos = nextPos) {
|
2084 |
-
var view = new LineView(cm.doc, getLine(cm.doc, pos), pos)
|
2085 |
-
nextPos = pos + view.size
|
2086 |
-
array.push(view)
|
2087 |
-
}
|
2088 |
-
return array
|
2089 |
-
}
|
2090 |
-
|
2091 |
-
var operationGroup = null
|
2092 |
-
|
2093 |
-
function pushOperation(op) {
|
2094 |
-
if (operationGroup) {
|
2095 |
-
operationGroup.ops.push(op)
|
2096 |
-
} else {
|
2097 |
-
op.ownsGroup = operationGroup = {
|
2098 |
-
ops: [op],
|
2099 |
-
delayedCallbacks: []
|
2100 |
-
}
|
2101 |
-
}
|
2102 |
-
}
|
2103 |
-
|
2104 |
-
function fireCallbacksForOps(group) {
|
2105 |
-
// Calls delayed callbacks and cursorActivity handlers until no
|
2106 |
-
// new ones appear
|
2107 |
-
var callbacks = group.delayedCallbacks, i = 0
|
2108 |
-
do {
|
2109 |
-
for (; i < callbacks.length; i++)
|
2110 |
-
{ callbacks[i].call(null) }
|
2111 |
-
for (var j = 0; j < group.ops.length; j++) {
|
2112 |
-
var op = group.ops[j]
|
2113 |
-
if (op.cursorActivityHandlers)
|
2114 |
-
{ while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
|
2115 |
-
{ op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm) } }
|
2116 |
-
}
|
2117 |
-
} while (i < callbacks.length)
|
2118 |
-
}
|
2119 |
-
|
2120 |
-
function finishOperation(op, endCb) {
|
2121 |
-
var group = op.ownsGroup
|
2122 |
-
if (!group) { return }
|
2123 |
-
|
2124 |
-
try { fireCallbacksForOps(group) }
|
2125 |
-
finally {
|
2126 |
-
operationGroup = null
|
2127 |
-
endCb(group)
|
2128 |
-
}
|
2129 |
-
}
|
2130 |
-
|
2131 |
-
var orphanDelayedCallbacks = null
|
2132 |
-
|
2133 |
-
// Often, we want to signal events at a point where we are in the
|
2134 |
-
// middle of some work, but don't want the handler to start calling
|
2135 |
-
// other methods on the editor, which might be in an inconsistent
|
2136 |
-
// state or simply not expect any other events to happen.
|
2137 |
-
// signalLater looks whether there are any handlers, and schedules
|
2138 |
-
// them to be executed when the last operation ends, or, if no
|
2139 |
-
// operation is active, when a timeout fires.
|
2140 |
-
function signalLater(emitter, type /*, values...*/) {
|
2141 |
-
var arr = getHandlers(emitter, type)
|
2142 |
-
if (!arr.length) { return }
|
2143 |
-
var args = Array.prototype.slice.call(arguments, 2), list
|
2144 |
-
if (operationGroup) {
|
2145 |
-
list = operationGroup.delayedCallbacks
|
2146 |
-
} else if (orphanDelayedCallbacks) {
|
2147 |
-
list = orphanDelayedCallbacks
|
2148 |
-
} else {
|
2149 |
-
list = orphanDelayedCallbacks = []
|
2150 |
-
setTimeout(fireOrphanDelayed, 0)
|
2151 |
-
}
|
2152 |
-
var loop = function ( i ) {
|
2153 |
-
list.push(function () { return arr[i].apply(null, args); })
|
2154 |
-
};
|
2155 |
-
|
2156 |
-
for (var i = 0; i < arr.length; ++i)
|
2157 |
-
loop( i );
|
2158 |
-
}
|
2159 |
-
|
2160 |
-
function fireOrphanDelayed() {
|
2161 |
-
var delayed = orphanDelayedCallbacks
|
2162 |
-
orphanDelayedCallbacks = null
|
2163 |
-
for (var i = 0; i < delayed.length; ++i) { delayed[i]() }
|
2164 |
-
}
|
2165 |
-
|
2166 |
-
// When an aspect of a line changes, a string is added to
|
2167 |
-
// lineView.changes. This updates the relevant part of the line's
|
2168 |
-
// DOM structure.
|
2169 |
-
function updateLineForChanges(cm, lineView, lineN, dims) {
|
2170 |
-
for (var j = 0; j < lineView.changes.length; j++) {
|
2171 |
-
var type = lineView.changes[j]
|
2172 |
-
if (type == "text") { updateLineText(cm, lineView) }
|
2173 |
-
else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims) }
|
2174 |
-
else if (type == "class") { updateLineClasses(cm, lineView) }
|
2175 |
-
else if (type == "widget") { updateLineWidgets(cm, lineView, dims) }
|
2176 |
-
}
|
2177 |
-
lineView.changes = null
|
2178 |
-
}
|
2179 |
-
|
2180 |
-
// Lines with gutter elements, widgets or a background class need to
|
2181 |
-
// be wrapped, and have the extra elements added to the wrapper div
|
2182 |
-
function ensureLineWrapped(lineView) {
|
2183 |
-
if (lineView.node == lineView.text) {
|
2184 |
-
lineView.node = elt("div", null, null, "position: relative")
|
2185 |
-
if (lineView.text.parentNode)
|
2186 |
-
{ lineView.text.parentNode.replaceChild(lineView.node, lineView.text) }
|
2187 |
-
lineView.node.appendChild(lineView.text)
|
2188 |
-
if (ie && ie_version < 8) { lineView.node.style.zIndex = 2 }
|
2189 |
-
}
|
2190 |
-
return lineView.node
|
2191 |
-
}
|
2192 |
-
|
2193 |
-
function updateLineBackground(cm, lineView) {
|
2194 |
-
var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass
|
2195 |
-
if (cls) { cls += " CodeMirror-linebackground" }
|
2196 |
-
if (lineView.background) {
|
2197 |
-
if (cls) { lineView.background.className = cls }
|
2198 |
-
else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null }
|
2199 |
-
} else if (cls) {
|
2200 |
-
var wrap = ensureLineWrapped(lineView)
|
2201 |
-
lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild)
|
2202 |
-
cm.display.input.setUneditable(lineView.background)
|
2203 |
-
}
|
2204 |
-
}
|
2205 |
-
|
2206 |
-
// Wrapper around buildLineContent which will reuse the structure
|
2207 |
-
// in display.externalMeasured when possible.
|
2208 |
-
function getLineContent(cm, lineView) {
|
2209 |
-
var ext = cm.display.externalMeasured
|
2210 |
-
if (ext && ext.line == lineView.line) {
|
2211 |
-
cm.display.externalMeasured = null
|
2212 |
-
lineView.measure = ext.measure
|
2213 |
-
return ext.built
|
2214 |
-
}
|
2215 |
-
return buildLineContent(cm, lineView)
|
2216 |
-
}
|
2217 |
-
|
2218 |
-
// Redraw the line's text. Interacts with the background and text
|
2219 |
-
// classes because the mode may output tokens that influence these
|
2220 |
-
// classes.
|
2221 |
-
function updateLineText(cm, lineView) {
|
2222 |
-
var cls = lineView.text.className
|
2223 |
-
var built = getLineContent(cm, lineView)
|
2224 |
-
if (lineView.text == lineView.node) { lineView.node = built.pre }
|
2225 |
-
lineView.text.parentNode.replaceChild(built.pre, lineView.text)
|
2226 |
-
lineView.text = built.pre
|
2227 |
-
if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
|
2228 |
-
lineView.bgClass = built.bgClass
|
2229 |
-
lineView.textClass = built.textClass
|
2230 |
-
updateLineClasses(cm, lineView)
|
2231 |
-
} else if (cls) {
|
2232 |
-
lineView.text.className = cls
|
2233 |
-
}
|
2234 |
-
}
|
2235 |
-
|
2236 |
-
function updateLineClasses(cm, lineView) {
|
2237 |
-
updateLineBackground(cm, lineView)
|
2238 |
-
if (lineView.line.wrapClass)
|
2239 |
-
{ ensureLineWrapped(lineView).className = lineView.line.wrapClass }
|
2240 |
-
else if (lineView.node != lineView.text)
|
2241 |
-
{ lineView.node.className = "" }
|
2242 |
-
var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass
|
2243 |
-
lineView.text.className = textClass || ""
|
2244 |
-
}
|
2245 |
-
|
2246 |
-
function updateLineGutter(cm, lineView, lineN, dims) {
|
2247 |
-
if (lineView.gutter) {
|
2248 |
-
lineView.node.removeChild(lineView.gutter)
|
2249 |
-
lineView.gutter = null
|
2250 |
-
}
|
2251 |
-
if (lineView.gutterBackground) {
|
2252 |
-
lineView.node.removeChild(lineView.gutterBackground)
|
2253 |
-
lineView.gutterBackground = null
|
2254 |
-
}
|
2255 |
-
if (lineView.line.gutterClass) {
|
2256 |
-
var wrap = ensureLineWrapped(lineView)
|
2257 |
-
lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
|
2258 |
-
("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"))
|
2259 |
-
cm.display.input.setUneditable(lineView.gutterBackground)
|
2260 |
-
wrap.insertBefore(lineView.gutterBackground, lineView.text)
|
2261 |
-
}
|
2262 |
-
var markers = lineView.line.gutterMarkers
|
2263 |
-
if (cm.options.lineNumbers || markers) {
|
2264 |
-
var wrap$1 = ensureLineWrapped(lineView)
|
2265 |
-
var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"))
|
2266 |
-
cm.display.input.setUneditable(gutterWrap)
|
2267 |
-
wrap$1.insertBefore(gutterWrap, lineView.text)
|
2268 |
-
if (lineView.line.gutterClass)
|
2269 |
-
{ gutterWrap.className += " " + lineView.line.gutterClass }
|
2270 |
-
if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
|
2271 |
-
{ lineView.lineNumber = gutterWrap.appendChild(
|
2272 |
-
elt("div", lineNumberFor(cm.options, lineN),
|
2273 |
-
"CodeMirror-linenumber CodeMirror-gutter-elt",
|
2274 |
-
("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))) }
|
2275 |
-
if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
|
2276 |
-
var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id]
|
2277 |
-
if (found)
|
2278 |
-
{ gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
|
2279 |
-
("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))) }
|
2280 |
-
} }
|
2281 |
}
|
2282 |
-
|
2283 |
-
|
2284 |
-
|
2285 |
-
|
2286 |
-
for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
|
2287 |
-
next = node.nextSibling
|
2288 |
-
if (node.className == "CodeMirror-linewidget")
|
2289 |
-
{ lineView.node.removeChild(node) }
|
2290 |
-
}
|
2291 |
-
insertLineWidgets(cm, lineView, dims)
|
2292 |
-
}
|
2293 |
-
|
2294 |
-
// Build a line's DOM representation from scratch
|
2295 |
-
function buildLineElement(cm, lineView, lineN, dims) {
|
2296 |
-
var built = getLineContent(cm, lineView)
|
2297 |
-
lineView.text = lineView.node = built.pre
|
2298 |
-
if (built.bgClass) { lineView.bgClass = built.bgClass }
|
2299 |
-
if (built.textClass) { lineView.textClass = built.textClass }
|
2300 |
-
|
2301 |
-
updateLineClasses(cm, lineView)
|
2302 |
-
updateLineGutter(cm, lineView, lineN, dims)
|
2303 |
-
insertLineWidgets(cm, lineView, dims)
|
2304 |
-
return lineView.node
|
2305 |
-
}
|
2306 |
-
|
2307 |
-
// A lineView may contain multiple logical lines (when merged by
|
2308 |
-
// collapsed spans). The widgets for all of them need to be drawn.
|
2309 |
-
function insertLineWidgets(cm, lineView, dims) {
|
2310 |
-
insertLineWidgetsFor(cm, lineView.line, lineView, dims, true)
|
2311 |
-
if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
|
2312 |
-
{ insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false) } }
|
2313 |
-
}
|
2314 |
-
|
2315 |
-
function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
|
2316 |
-
if (!line.widgets) { return }
|
2317 |
-
var wrap = ensureLineWrapped(lineView)
|
2318 |
-
for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
|
2319 |
-
var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget")
|
2320 |
-
if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true") }
|
2321 |
-
positionLineWidget(widget, node, lineView, dims)
|
2322 |
-
cm.display.input.setUneditable(node)
|
2323 |
-
if (allowAbove && widget.above)
|
2324 |
-
{ wrap.insertBefore(node, lineView.gutter || lineView.text) }
|
2325 |
-
else
|
2326 |
-
{ wrap.appendChild(node) }
|
2327 |
-
signalLater(widget, "redraw")
|
2328 |
-
}
|
2329 |
-
}
|
2330 |
-
|
2331 |
-
function positionLineWidget(widget, node, lineView, dims) {
|
2332 |
-
if (widget.noHScroll) {
|
2333 |
-
;(lineView.alignable || (lineView.alignable = [])).push(node)
|
2334 |
-
var width = dims.wrapperWidth
|
2335 |
-
node.style.left = dims.fixedPos + "px"
|
2336 |
-
if (!widget.coverGutter) {
|
2337 |
-
width -= dims.gutterTotalWidth
|
2338 |
-
node.style.paddingLeft = dims.gutterTotalWidth + "px"
|
2339 |
-
}
|
2340 |
-
node.style.width = width + "px"
|
2341 |
-
}
|
2342 |
-
if (widget.coverGutter) {
|
2343 |
-
node.style.zIndex = 5
|
2344 |
-
node.style.position = "relative"
|
2345 |
-
if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px" }
|
2346 |
-
}
|
2347 |
-
}
|
2348 |
-
|
2349 |
-
function widgetHeight(widget) {
|
2350 |
-
if (widget.height != null) { return widget.height }
|
2351 |
-
var cm = widget.doc.cm
|
2352 |
-
if (!cm) { return 0 }
|
2353 |
-
if (!contains(document.body, widget.node)) {
|
2354 |
-
var parentStyle = "position: relative;"
|
2355 |
-
if (widget.coverGutter)
|
2356 |
-
{ parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;" }
|
2357 |
-
if (widget.noHScroll)
|
2358 |
-
{ parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;" }
|
2359 |
-
removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle))
|
2360 |
-
}
|
2361 |
-
return widget.height = widget.node.parentNode.offsetHeight
|
2362 |
-
}
|
2363 |
-
|
2364 |
-
// Return true when the given mouse event happened in a widget
|
2365 |
-
function eventInWidget(display, e) {
|
2366 |
-
for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
|
2367 |
-
if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
|
2368 |
-
(n.parentNode == display.sizer && n != display.mover))
|
2369 |
-
{ return true }
|
2370 |
}
|
2371 |
-
|
2372 |
-
|
2373 |
-
|
2374 |
-
|
2375 |
-
|
2376 |
-
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
|
2377 |
-
function paddingH(display) {
|
2378 |
-
if (display.cachedPaddingH) { return display.cachedPaddingH }
|
2379 |
-
var e = removeChildrenAndAdd(display.measure, elt("pre", "x"))
|
2380 |
-
var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle
|
2381 |
-
var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)}
|
2382 |
-
if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data }
|
2383 |
-
return data
|
2384 |
-
}
|
2385 |
-
|
2386 |
-
function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
|
2387 |
-
function displayWidth(cm) {
|
2388 |
-
return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
|
2389 |
-
}
|
2390 |
-
function displayHeight(cm) {
|
2391 |
-
return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
|
2392 |
-
}
|
2393 |
-
|
2394 |
-
// Ensure the lineView.wrapping.heights array is populated. This is
|
2395 |
-
// an array of bottom offsets for the lines that make up a drawn
|
2396 |
-
// line. When lineWrapping is on, there might be more than one
|
2397 |
-
// height.
|
2398 |
-
function ensureLineHeights(cm, lineView, rect) {
|
2399 |
-
var wrapping = cm.options.lineWrapping
|
2400 |
-
var curWidth = wrapping && displayWidth(cm)
|
2401 |
-
if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
|
2402 |
-
var heights = lineView.measure.heights = []
|
2403 |
-
if (wrapping) {
|
2404 |
-
lineView.measure.width = curWidth
|
2405 |
-
var rects = lineView.text.firstChild.getClientRects()
|
2406 |
-
for (var i = 0; i < rects.length - 1; i++) {
|
2407 |
-
var cur = rects[i], next = rects[i + 1]
|
2408 |
-
if (Math.abs(cur.bottom - next.bottom) > 2)
|
2409 |
-
{ heights.push((cur.bottom + next.top) / 2 - rect.top) }
|
2410 |
-
}
|
2411 |
-
}
|
2412 |
-
heights.push(rect.bottom - rect.top)
|
2413 |
-
}
|
2414 |
-
}
|
2415 |
-
|
2416 |
-
// Find a line map (mapping character offsets to text nodes) and a
|
2417 |
-
// measurement cache for the given line number. (A line view might
|
2418 |
-
// contain multiple lines when collapsed ranges are present.)
|
2419 |
-
function mapFromLineView(lineView, line, lineN) {
|
2420 |
-
if (lineView.line == line)
|
2421 |
-
{ return {map: lineView.measure.map, cache: lineView.measure.cache} }
|
2422 |
-
for (var i = 0; i < lineView.rest.length; i++)
|
2423 |
-
{ if (lineView.rest[i] == line)
|
2424 |
-
{ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
|
2425 |
-
for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
|
2426 |
-
{ if (lineNo(lineView.rest[i$1]) > lineN)
|
2427 |
-
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
|
2428 |
-
}
|
2429 |
-
|
2430 |
-
// Render a line into the hidden node display.externalMeasured. Used
|
2431 |
-
// when measurement is needed for a line that's not in the viewport.
|
2432 |
-
function updateExternalMeasurement(cm, line) {
|
2433 |
-
line = visualLine(line)
|
2434 |
-
var lineN = lineNo(line)
|
2435 |
-
var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN)
|
2436 |
-
view.lineN = lineN
|
2437 |
-
var built = view.built = buildLineContent(cm, view)
|
2438 |
-
view.text = built.pre
|
2439 |
-
removeChildrenAndAdd(cm.display.lineMeasure, built.pre)
|
2440 |
-
return view
|
2441 |
-
}
|
2442 |
-
|
2443 |
-
// Get a {top, bottom, left, right} box (in line-local coordinates)
|
2444 |
-
// for a given character.
|
2445 |
-
function measureChar(cm, line, ch, bias) {
|
2446 |
-
return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
|
2447 |
-
}
|
2448 |
-
|
2449 |
-
// Find a line view that corresponds to the given line number.
|
2450 |
-
function findViewForLine(cm, lineN) {
|
2451 |
-
if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
|
2452 |
-
{ return cm.display.view[findViewIndex(cm, lineN)] }
|
2453 |
-
var ext = cm.display.externalMeasured
|
2454 |
-
if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
|
2455 |
-
{ return ext }
|
2456 |
-
}
|
2457 |
-
|
2458 |
-
// Measurement can be split in two steps, the set-up work that
|
2459 |
-
// applies to the whole line, and the measurement of the actual
|
2460 |
-
// character. Functions like coordsChar, that need to do a lot of
|
2461 |
-
// measurements in a row, can thus ensure that the set-up work is
|
2462 |
-
// only done once.
|
2463 |
-
function prepareMeasureForLine(cm, line) {
|
2464 |
-
var lineN = lineNo(line)
|
2465 |
-
var view = findViewForLine(cm, lineN)
|
2466 |
-
if (view && !view.text) {
|
2467 |
-
view = null
|
2468 |
-
} else if (view && view.changes) {
|
2469 |
-
updateLineForChanges(cm, view, lineN, getDimensions(cm))
|
2470 |
-
cm.curOp.forceUpdate = true
|
2471 |
-
}
|
2472 |
-
if (!view)
|
2473 |
-
{ view = updateExternalMeasurement(cm, line) }
|
2474 |
-
|
2475 |
-
var info = mapFromLineView(view, line, lineN)
|
2476 |
-
return {
|
2477 |
-
line: line, view: view, rect: null,
|
2478 |
-
map: info.map, cache: info.cache, before: info.before,
|
2479 |
-
hasHeights: false
|
2480 |
-
}
|
2481 |
-
}
|
2482 |
-
|
2483 |
-
// Given a prepared measurement object, measures the position of an
|
2484 |
-
// actual character (or fetches it from the cache).
|
2485 |
-
function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
|
2486 |
-
if (prepared.before) { ch = -1 }
|
2487 |
-
var key = ch + (bias || ""), found
|
2488 |
-
if (prepared.cache.hasOwnProperty(key)) {
|
2489 |
-
found = prepared.cache[key]
|
2490 |
-
} else {
|
2491 |
-
if (!prepared.rect)
|
2492 |
-
{ prepared.rect = prepared.view.text.getBoundingClientRect() }
|
2493 |
-
if (!prepared.hasHeights) {
|
2494 |
-
ensureLineHeights(cm, prepared.view, prepared.rect)
|
2495 |
-
prepared.hasHeights = true
|
2496 |
-
}
|
2497 |
-
found = measureCharInner(cm, prepared, ch, bias)
|
2498 |
-
if (!found.bogus) { prepared.cache[key] = found }
|
2499 |
-
}
|
2500 |
-
return {left: found.left, right: found.right,
|
2501 |
-
top: varHeight ? found.rtop : found.top,
|
2502 |
-
bottom: varHeight ? found.rbottom : found.bottom}
|
2503 |
-
}
|
2504 |
-
|
2505 |
-
var nullRect = {left: 0, right: 0, top: 0, bottom: 0}
|
2506 |
-
|
2507 |
-
function nodeAndOffsetInLineMap(map, ch, bias) {
|
2508 |
-
var node, start, end, collapse, mStart, mEnd
|
2509 |
-
// First, search the line map for the text node corresponding to,
|
2510 |
-
// or closest to, the target character.
|
2511 |
-
for (var i = 0; i < map.length; i += 3) {
|
2512 |
-
mStart = map[i]
|
2513 |
-
mEnd = map[i + 1]
|
2514 |
-
if (ch < mStart) {
|
2515 |
-
start = 0; end = 1
|
2516 |
-
collapse = "left"
|
2517 |
-
} else if (ch < mEnd) {
|
2518 |
-
start = ch - mStart
|
2519 |
-
end = start + 1
|
2520 |
-
} else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {
|
2521 |
-
end = mEnd - mStart
|
2522 |
-
start = end - 1
|
2523 |
-
if (ch >= mEnd) { collapse = "right" }
|
2524 |
-
}
|
2525 |
-
if (start != null) {
|
2526 |
-
node = map[i + 2]
|
2527 |
-
if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
|
2528 |
-
{ collapse = bias }
|
2529 |
-
if (bias == "left" && start == 0)
|
2530 |
-
{ while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {
|
2531 |
-
node = map[(i -= 3) + 2]
|
2532 |
-
collapse = "left"
|
2533 |
-
} }
|
2534 |
-
if (bias == "right" && start == mEnd - mStart)
|
2535 |
-
{ while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {
|
2536 |
-
node = map[(i += 3) + 2]
|
2537 |
-
collapse = "right"
|
2538 |
-
} }
|
2539 |
-
break
|
2540 |
-
}
|
2541 |
-
}
|
2542 |
-
return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
|
2543 |
-
}
|
2544 |
-
|
2545 |
-
function getUsefulRect(rects, bias) {
|
2546 |
-
var rect = nullRect
|
2547 |
-
if (bias == "left") { for (var i = 0; i < rects.length; i++) {
|
2548 |
-
if ((rect = rects[i]).left != rect.right) { break }
|
2549 |
-
} } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
|
2550 |
-
if ((rect = rects[i$1]).left != rect.right) { break }
|
2551 |
-
} }
|
2552 |
-
return rect
|
2553 |
-
}
|
2554 |
-
|
2555 |
-
function measureCharInner(cm, prepared, ch, bias) {
|
2556 |
-
var place = nodeAndOffsetInLineMap(prepared.map, ch, bias)
|
2557 |
-
var node = place.node, start = place.start, end = place.end, collapse = place.collapse
|
2558 |
-
|
2559 |
-
var rect
|
2560 |
-
if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
|
2561 |
-
for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
|
2562 |
-
while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start }
|
2563 |
-
while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end }
|
2564 |
-
if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
|
2565 |
-
{ rect = node.parentNode.getBoundingClientRect() }
|
2566 |
-
else
|
2567 |
-
{ rect = getUsefulRect(range(node, start, end).getClientRects(), bias) }
|
2568 |
-
if (rect.left || rect.right || start == 0) { break }
|
2569 |
-
end = start
|
2570 |
-
start = start - 1
|
2571 |
-
collapse = "right"
|
2572 |
-
}
|
2573 |
-
if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect) }
|
2574 |
-
} else { // If it is a widget, simply get the box for the whole widget.
|
2575 |
-
if (start > 0) { collapse = bias = "right" }
|
2576 |
-
var rects
|
2577 |
-
if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
|
2578 |
-
{ rect = rects[bias == "right" ? rects.length - 1 : 0] }
|
2579 |
-
else
|
2580 |
-
{ rect = node.getBoundingClientRect() }
|
2581 |
}
|
2582 |
-
if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
|
2583 |
-
var rSpan = node.parentNode.getClientRects()[0]
|
2584 |
-
if (rSpan)
|
2585 |
-
{ rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom} }
|
2586 |
-
else
|
2587 |
-
{ rect = nullRect }
|
2588 |
-
}
|
2589 |
-
|
2590 |
-
var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top
|
2591 |
-
var mid = (rtop + rbot) / 2
|
2592 |
-
var heights = prepared.view.measure.heights
|
2593 |
-
var i = 0
|
2594 |
-
for (; i < heights.length - 1; i++)
|
2595 |
-
{ if (mid < heights[i]) { break } }
|
2596 |
-
var top = i ? heights[i - 1] : 0, bot = heights[i]
|
2597 |
-
var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
|
2598 |
-
right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
|
2599 |
-
top: top, bottom: bot}
|
2600 |
-
if (!rect.left && !rect.right) { result.bogus = true }
|
2601 |
-
if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot }
|
2602 |
-
|
2603 |
-
return result
|
2604 |
-
}
|
2605 |
-
|
2606 |
-
// Work around problem with bounding client rects on ranges being
|
2607 |
-
// returned incorrectly when zoomed on IE10 and below.
|
2608 |
-
function maybeUpdateRectForZooming(measure, rect) {
|
2609 |
-
if (!window.screen || screen.logicalXDPI == null ||
|
2610 |
-
screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
|
2611 |
-
{ return rect }
|
2612 |
-
var scaleX = screen.logicalXDPI / screen.deviceXDPI
|
2613 |
-
var scaleY = screen.logicalYDPI / screen.deviceYDPI
|
2614 |
-
return {left: rect.left * scaleX, right: rect.right * scaleX,
|
2615 |
-
top: rect.top * scaleY, bottom: rect.bottom * scaleY}
|
2616 |
-
}
|
2617 |
-
|
2618 |
-
function clearLineMeasurementCacheFor(lineView) {
|
2619 |
-
if (lineView.measure) {
|
2620 |
-
lineView.measure.cache = {}
|
2621 |
-
lineView.measure.heights = null
|
2622 |
-
if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
|
2623 |
-
{ lineView.measure.caches[i] = {} } }
|
2624 |
-
}
|
2625 |
-
}
|
2626 |
-
|
2627 |
-
function clearLineMeasurementCache(cm) {
|
2628 |
-
cm.display.externalMeasure = null
|
2629 |
-
removeChildren(cm.display.lineMeasure)
|
2630 |
-
for (var i = 0; i < cm.display.view.length; i++)
|
2631 |
-
{ clearLineMeasurementCacheFor(cm.display.view[i]) }
|
2632 |
-
}
|
2633 |
-
|
2634 |
-
function clearCaches(cm) {
|
2635 |
-
clearLineMeasurementCache(cm)
|
2636 |
-
cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null
|
2637 |
-
if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true }
|
2638 |
-
cm.display.lineNumChars = null
|
2639 |
-
}
|
2640 |
-
|
2641 |
-
function pageScrollX() {
|
2642 |
-
// Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
|
2643 |
-
// which causes page_Offset and bounding client rects to use
|
2644 |
-
// different reference viewports and invalidate our calculations.
|
2645 |
-
if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
|
2646 |
-
return window.pageXOffset || (document.documentElement || document.body).scrollLeft
|
2647 |
-
}
|
2648 |
-
function pageScrollY() {
|
2649 |
-
if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
|
2650 |
-
return window.pageYOffset || (document.documentElement || document.body).scrollTop
|
2651 |
-
}
|
2652 |
-
|
2653 |
-
function widgetTopHeight(lineObj) {
|
2654 |
-
var height = 0
|
2655 |
-
if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)
|
2656 |
-
{ height += widgetHeight(lineObj.widgets[i]) } } }
|
2657 |
-
return height
|
2658 |
-
}
|
2659 |
-
|
2660 |
-
// Converts a {top, bottom, left, right} box from line-local
|
2661 |
-
// coordinates into another coordinate system. Context may be one of
|
2662 |
-
// "line", "div" (display.lineDiv), "local"./null (editor), "window",
|
2663 |
-
// or "page".
|
2664 |
-
function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
|
2665 |
-
if (!includeWidgets) {
|
2666 |
-
var height = widgetTopHeight(lineObj)
|
2667 |
-
rect.top += height; rect.bottom += height
|
2668 |
-
}
|
2669 |
-
if (context == "line") { return rect }
|
2670 |
-
if (!context) { context = "local" }
|
2671 |
-
var yOff = heightAtLine(lineObj)
|
2672 |
-
if (context == "local") { yOff += paddingTop(cm.display) }
|
2673 |
-
else { yOff -= cm.display.viewOffset }
|
2674 |
-
if (context == "page" || context == "window") {
|
2675 |
-
var lOff = cm.display.lineSpace.getBoundingClientRect()
|
2676 |
-
yOff += lOff.top + (context == "window" ? 0 : pageScrollY())
|
2677 |
-
var xOff = lOff.left + (context == "window" ? 0 : pageScrollX())
|
2678 |
-
rect.left += xOff; rect.right += xOff
|
2679 |
-
}
|
2680 |
-
rect.top += yOff; rect.bottom += yOff
|
2681 |
-
return rect
|
2682 |
-
}
|
2683 |
-
|
2684 |
-
// Coverts a box from "div" coords to another coordinate system.
|
2685 |
-
// Context may be "window", "page", "div", or "local"./null.
|
2686 |
-
function fromCoordSystem(cm, coords, context) {
|
2687 |
-
if (context == "div") { return coords }
|
2688 |
-
var left = coords.left, top = coords.top
|
2689 |
-
// First move into "page" coordinate system
|
2690 |
-
if (context == "page") {
|
2691 |
-
left -= pageScrollX()
|
2692 |
-
top -= pageScrollY()
|
2693 |
-
} else if (context == "local" || !context) {
|
2694 |
-
var localBox = cm.display.sizer.getBoundingClientRect()
|
2695 |
-
left += localBox.left
|
2696 |
-
top += localBox.top
|
2697 |
-
}
|
2698 |
-
|
2699 |
-
var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect()
|
2700 |
-
return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
|
2701 |
-
}
|
2702 |
-
|
2703 |
-
function charCoords(cm, pos, context, lineObj, bias) {
|
2704 |
-
if (!lineObj) { lineObj = getLine(cm.doc, pos.line) }
|
2705 |
-
return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
|
2706 |
-
}
|
2707 |
-
|
2708 |
-
// Returns a box for a given cursor position, which may have an
|
2709 |
-
// 'other' property containing the position of the secondary cursor
|
2710 |
-
// on a bidi boundary.
|
2711 |
-
// A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
|
2712 |
-
// and after `char - 1` in writing order of `char - 1`
|
2713 |
-
// A cursor Pos(line, char, "after") is on the same visual line as `char`
|
2714 |
-
// and before `char` in writing order of `char`
|
2715 |
-
// Examples (upper-case letters are RTL, lower-case are LTR):
|
2716 |
-
// Pos(0, 1, ...)
|
2717 |
-
// before after
|
2718 |
-
// ab a|b a|b
|
2719 |
-
// aB a|B aB|
|
2720 |
-
// Ab |Ab A|b
|
2721 |
-
// AB B|A B|A
|
2722 |
-
// Every position after the last character on a line is considered to stick
|
2723 |
-
// to the last character on the line.
|
2724 |
-
function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
|
2725 |
-
lineObj = lineObj || getLine(cm.doc, pos.line)
|
2726 |
-
if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) }
|
2727 |
-
function get(ch, right) {
|
2728 |
-
var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight)
|
2729 |
-
if (right) { m.left = m.right; } else { m.right = m.left }
|
2730 |
-
return intoCoordSystem(cm, lineObj, m, context)
|
2731 |
-
}
|
2732 |
-
var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky
|
2733 |
-
if (ch >= lineObj.text.length) {
|
2734 |
-
ch = lineObj.text.length
|
2735 |
-
sticky = "before"
|
2736 |
-
} else if (ch <= 0) {
|
2737 |
-
ch = 0
|
2738 |
-
sticky = "after"
|
2739 |
-
}
|
2740 |
-
if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
|
2741 |
-
|
2742 |
-
function getBidi(ch, partPos, invert) {
|
2743 |
-
var part = order[partPos], right = part.level == 1
|
2744 |
-
return get(invert ? ch - 1 : ch, right != invert)
|
2745 |
-
}
|
2746 |
-
var partPos = getBidiPartAt(order, ch, sticky)
|
2747 |
-
var other = bidiOther
|
2748 |
-
var val = getBidi(ch, partPos, sticky == "before")
|
2749 |
-
if (other != null) { val.other = getBidi(ch, other, sticky != "before") }
|
2750 |
-
return val
|
2751 |
-
}
|
2752 |
-
|
2753 |
-
// Used to cheaply estimate the coordinates for a position. Used for
|
2754 |
-
// intermediate scroll updates.
|
2755 |
-
function estimateCoords(cm, pos) {
|
2756 |
-
var left = 0
|
2757 |
-
pos = clipPos(cm.doc, pos)
|
2758 |
-
if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch }
|
2759 |
-
var lineObj = getLine(cm.doc, pos.line)
|
2760 |
-
var top = heightAtLine(lineObj) + paddingTop(cm.display)
|
2761 |
-
return {left: left, right: left, top: top, bottom: top + lineObj.height}
|
2762 |
-
}
|
2763 |
-
|
2764 |
-
// Positions returned by coordsChar contain some extra information.
|
2765 |
-
// xRel is the relative x position of the input coordinates compared
|
2766 |
-
// to the found position (so xRel > 0 means the coordinates are to
|
2767 |
-
// the right of the character position, for example). When outside
|
2768 |
-
// is true, that means the coordinates lie outside the line's
|
2769 |
-
// vertical range.
|
2770 |
-
function PosWithInfo(line, ch, sticky, outside, xRel) {
|
2771 |
-
var pos = Pos(line, ch, sticky)
|
2772 |
-
pos.xRel = xRel
|
2773 |
-
if (outside) { pos.outside = true }
|
2774 |
-
return pos
|
2775 |
-
}
|
2776 |
-
|
2777 |
-
// Compute the character position closest to the given coordinates.
|
2778 |
-
// Input must be lineSpace-local ("div" coordinate system).
|
2779 |
-
function coordsChar(cm, x, y) {
|
2780 |
-
var doc = cm.doc
|
2781 |
-
y += cm.display.viewOffset
|
2782 |
-
if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
|
2783 |
-
var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1
|
2784 |
-
if (lineN > last)
|
2785 |
-
{ return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
|
2786 |
-
if (x < 0) { x = 0 }
|
2787 |
-
|
2788 |
-
var lineObj = getLine(doc, lineN)
|
2789 |
-
for (;;) {
|
2790 |
-
var found = coordsCharInner(cm, lineObj, lineN, x, y)
|
2791 |
-
var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0))
|
2792 |
-
if (!collapsed) { return found }
|
2793 |
-
var rangeEnd = collapsed.find(1)
|
2794 |
-
if (rangeEnd.line == lineN) { return rangeEnd }
|
2795 |
-
lineObj = getLine(doc, lineN = rangeEnd.line)
|
2796 |
-
}
|
2797 |
-
}
|
2798 |
-
|
2799 |
-
function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
|
2800 |
-
y -= widgetTopHeight(lineObj)
|
2801 |
-
var end = lineObj.text.length
|
2802 |
-
var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0)
|
2803 |
-
end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end)
|
2804 |
-
return {begin: begin, end: end}
|
2805 |
-
}
|
2806 |
-
|
2807 |
-
function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
|
2808 |
-
if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj) }
|
2809 |
-
var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top
|
2810 |
-
return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
|
2811 |
-
}
|
2812 |
-
|
2813 |
-
// Returns true if the given side of a box is after the given
|
2814 |
-
// coordinates, in top-to-bottom, left-to-right order.
|
2815 |
-
function boxIsAfter(box, x, y, left) {
|
2816 |
-
return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
|
2817 |
-
}
|
2818 |
-
|
2819 |
-
function coordsCharInner(cm, lineObj, lineNo, x, y) {
|
2820 |
-
// Move y into line-local coordinate space
|
2821 |
-
y -= heightAtLine(lineObj)
|
2822 |
-
var preparedMeasure = prepareMeasureForLine(cm, lineObj)
|
2823 |
-
// When directly calling `measureCharPrepared`, we have to adjust
|
2824 |
-
// for the widgets at this line.
|
2825 |
-
var widgetHeight = widgetTopHeight(lineObj)
|
2826 |
-
var begin = 0, end = lineObj.text.length, ltr = true
|
2827 |
-
|
2828 |
-
var order = getOrder(lineObj, cm.doc.direction)
|
2829 |
-
// If the line isn't plain left-to-right text, first figure out
|
2830 |
-
// which bidi section the coordinates fall into.
|
2831 |
-
if (order) {
|
2832 |
-
var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
|
2833 |
-
(cm, lineObj, lineNo, preparedMeasure, order, x, y)
|
2834 |
-
ltr = part.level != 1
|
2835 |
-
// The awkward -1 offsets are needed because findFirst (called
|
2836 |
-
// on these below) will treat its first bound as inclusive,
|
2837 |
-
// second as exclusive, but we want to actually address the
|
2838 |
-
// characters in the part's range
|
2839 |
-
begin = ltr ? part.from : part.to - 1
|
2840 |
-
end = ltr ? part.to : part.from - 1
|
2841 |
-
}
|
2842 |
-
|
2843 |
-
// A binary search to find the first character whose bounding box
|
2844 |
-
// starts after the coordinates. If we run across any whose box wrap
|
2845 |
-
// the coordinates, store that.
|
2846 |
-
var chAround = null, boxAround = null
|
2847 |
-
var ch = findFirst(function (ch) {
|
2848 |
-
var box = measureCharPrepared(cm, preparedMeasure, ch)
|
2849 |
-
box.top += widgetHeight; box.bottom += widgetHeight
|
2850 |
-
if (!boxIsAfter(box, x, y, false)) { return false }
|
2851 |
-
if (box.top <= y && box.left <= x) {
|
2852 |
-
chAround = ch
|
2853 |
-
boxAround = box
|
2854 |
-
}
|
2855 |
-
return true
|
2856 |
-
}, begin, end)
|
2857 |
-
|
2858 |
-
var baseX, sticky, outside = false
|
2859 |
-
// If a box around the coordinates was found, use that
|
2860 |
-
if (boxAround) {
|
2861 |
-
// Distinguish coordinates nearer to the left or right side of the box
|
2862 |
-
var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr
|
2863 |
-
ch = chAround + (atStart ? 0 : 1)
|
2864 |
-
sticky = atStart ? "after" : "before"
|
2865 |
-
baseX = atLeft ? boxAround.left : boxAround.right
|
2866 |
-
} else {
|
2867 |
-
// (Adjust for extended bound, if necessary.)
|
2868 |
-
if (!ltr && (ch == end || ch == begin)) { ch++ }
|
2869 |
-
// To determine which side to associate with, get the box to the
|
2870 |
-
// left of the character and compare it's vertical position to the
|
2871 |
-
// coordinates
|
2872 |
-
sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
|
2873 |
-
(measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?
|
2874 |
-
"after" : "before"
|
2875 |
-
// Now get accurate coordinates for this place, in order to get a
|
2876 |
-
// base X position
|
2877 |
-
var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), "line", lineObj, preparedMeasure)
|
2878 |
-
baseX = coords.left
|
2879 |
-
outside = y < coords.top || y >= coords.bottom
|
2880 |
-
}
|
2881 |
-
|
2882 |
-
ch = skipExtendingChars(lineObj.text, ch, 1)
|
2883 |
-
return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)
|
2884 |
-
}
|
2885 |
-
|
2886 |
-
function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {
|
2887 |
-
// Bidi parts are sorted left-to-right, and in a non-line-wrapping
|
2888 |
-
// situation, we can take this ordering to correspond to the visual
|
2889 |
-
// ordering. This finds the first part whose end is after the given
|
2890 |
-
// coordinates.
|
2891 |
-
var index = findFirst(function (i) {
|
2892 |
-
var part = order[i], ltr = part.level != 1
|
2893 |
-
return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? "before" : "after"),
|
2894 |
-
"line", lineObj, preparedMeasure), x, y, true)
|
2895 |
-
}, 0, order.length - 1)
|
2896 |
-
var part = order[index]
|
2897 |
-
// If this isn't the first part, the part's start is also after
|
2898 |
-
// the coordinates, and the coordinates aren't on the same line as
|
2899 |
-
// that start, move one part back.
|
2900 |
-
if (index > 0) {
|
2901 |
-
var ltr = part.level != 1
|
2902 |
-
var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? "after" : "before"),
|
2903 |
-
"line", lineObj, preparedMeasure)
|
2904 |
-
if (boxIsAfter(start, x, y, true) && start.top > y)
|
2905 |
-
{ part = order[index - 1] }
|
2906 |
-
}
|
2907 |
-
return part
|
2908 |
-
}
|
2909 |
-
|
2910 |
-
function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
|
2911 |
-
// In a wrapped line, rtl text on wrapping boundaries can do things
|
2912 |
-
// that don't correspond to the ordering in our `order` array at
|
2913 |
-
// all, so a binary search doesn't work, and we want to return a
|
2914 |
-
// part that only spans one line so that the binary search in
|
2915 |
-
// coordsCharInner is safe. As such, we first find the extent of the
|
2916 |
-
// wrapped line, and then do a flat search in which we discard any
|
2917 |
-
// spans that aren't on the line.
|
2918 |
-
var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
|
2919 |
-
var begin = ref.begin;
|
2920 |
-
var end = ref.end;
|
2921 |
-
if (/\s/.test(lineObj.text.charAt(end - 1))) { end-- }
|
2922 |
-
var part = null, closestDist = null
|
2923 |
-
for (var i = 0; i < order.length; i++) {
|
2924 |
-
var p = order[i]
|
2925 |
-
if (p.from >= end || p.to <= begin) { continue }
|
2926 |
-
var ltr = p.level != 1
|
2927 |
-
var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right
|
2928 |
-
// Weigh against spans ending before this, so that they are only
|
2929 |
-
// picked if nothing ends after
|
2930 |
-
var dist = endX < x ? x - endX + 1e9 : endX - x
|
2931 |
-
if (!part || closestDist > dist) {
|
2932 |
-
part = p
|
2933 |
-
closestDist = dist
|
2934 |
-
}
|
2935 |
-
}
|
2936 |
-
if (!part) { part = order[order.length - 1] }
|
2937 |
-
// Clip the part to the wrapped line.
|
2938 |
-
if (part.from < begin) { part = {from: begin, to: part.to, level: part.level} }
|
2939 |
-
if (part.to > end) { part = {from: part.from, to: end, level: part.level} }
|
2940 |
-
return part
|
2941 |
-
}
|
2942 |
-
|
2943 |
-
var measureText
|
2944 |
-
// Compute the default text height.
|
2945 |
-
function textHeight(display) {
|
2946 |
-
if (display.cachedTextHeight != null) { return display.cachedTextHeight }
|
2947 |
-
if (measureText == null) {
|
2948 |
-
measureText = elt("pre")
|
2949 |
-
// Measure a bunch of lines, for browsers that compute
|
2950 |
-
// fractional heights.
|
2951 |
-
for (var i = 0; i < 49; ++i) {
|
2952 |
-
measureText.appendChild(document.createTextNode("x"))
|
2953 |
-
measureText.appendChild(elt("br"))
|
2954 |
-
}
|
2955 |
-
measureText.appendChild(document.createTextNode("x"))
|
2956 |
-
}
|
2957 |
-
removeChildrenAndAdd(display.measure, measureText)
|
2958 |
-
var height = measureText.offsetHeight / 50
|
2959 |
-
if (height > 3) { display.cachedTextHeight = height }
|
2960 |
-
removeChildren(display.measure)
|
2961 |
-
return height || 1
|
2962 |
-
}
|
2963 |
-
|
2964 |
-
// Compute the default character width.
|
2965 |
-
function charWidth(display) {
|
2966 |
-
if (display.cachedCharWidth != null) { return display.cachedCharWidth }
|
2967 |
-
var anchor = elt("span", "xxxxxxxxxx")
|
2968 |
-
var pre = elt("pre", [anchor])
|
2969 |
-
removeChildrenAndAdd(display.measure, pre)
|
2970 |
-
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10
|
2971 |
-
if (width > 2) { display.cachedCharWidth = width }
|
2972 |
-
return width || 10
|
2973 |
-
}
|
2974 |
-
|
2975 |
-
// Do a bulk-read of the DOM positions and sizes needed to draw the
|
2976 |
-
// view, so that we don't interleave reading and writing to the DOM.
|
2977 |
-
function getDimensions(cm) {
|
2978 |
-
var d = cm.display, left = {}, width = {}
|
2979 |
-
var gutterLeft = d.gutters.clientLeft
|
2980 |
-
for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
|
2981 |
-
left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft
|
2982 |
-
width[cm.options.gutters[i]] = n.clientWidth
|
2983 |
-
}
|
2984 |
-
return {fixedPos: compensateForHScroll(d),
|
2985 |
-
gutterTotalWidth: d.gutters.offsetWidth,
|
2986 |
-
gutterLeft: left,
|
2987 |
-
gutterWidth: width,
|
2988 |
-
wrapperWidth: d.wrapper.clientWidth}
|
2989 |
-
}
|
2990 |
-
|
2991 |
-
// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
|
2992 |
-
// but using getBoundingClientRect to get a sub-pixel-accurate
|
2993 |
-
// result.
|
2994 |
-
function compensateForHScroll(display) {
|
2995 |
-
return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
|
2996 |
-
}
|
2997 |
-
|
2998 |
-
// Returns a function that estimates the height of a line, to use as
|
2999 |
-
// first approximation until the line becomes visible (and is thus
|
3000 |
-
// properly measurable).
|
3001 |
-
function estimateHeight(cm) {
|
3002 |
-
var th = textHeight(cm.display), wrapping = cm.options.lineWrapping
|
3003 |
-
var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3)
|
3004 |
-
return function (line) {
|
3005 |
-
if (lineIsHidden(cm.doc, line)) { return 0 }
|
3006 |
-
|
3007 |
-
var widgetsHeight = 0
|
3008 |
-
if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
|
3009 |
-
if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height }
|
3010 |
-
} }
|
3011 |
|
3012 |
-
|
3013 |
-
|
3014 |
-
|
3015 |
-
|
3016 |
-
|
3017 |
-
}
|
3018 |
-
|
3019 |
-
function estimateLineHeights(cm) {
|
3020 |
-
var doc = cm.doc, est = estimateHeight(cm)
|
3021 |
-
doc.iter(function (line) {
|
3022 |
-
var estHeight = est(line)
|
3023 |
-
if (estHeight != line.height) { updateLineHeight(line, estHeight) }
|
3024 |
-
})
|
3025 |
-
}
|
3026 |
-
|
3027 |
-
// Given a mouse event, find the corresponding position. If liberal
|
3028 |
-
// is false, it checks whether a gutter or scrollbar was clicked,
|
3029 |
-
// and returns null if it was. forRect is used by rectangular
|
3030 |
-
// selections, and tries to estimate a character position even for
|
3031 |
-
// coordinates beyond the right of the text.
|
3032 |
-
function posFromMouse(cm, e, liberal, forRect) {
|
3033 |
-
var display = cm.display
|
3034 |
-
if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
|
3035 |
-
|
3036 |
-
var x, y, space = display.lineSpace.getBoundingClientRect()
|
3037 |
-
// Fails unpredictably on IE[67] when mouse is dragged around quickly.
|
3038 |
-
try { x = e.clientX - space.left; y = e.clientY - space.top }
|
3039 |
-
catch (e) { return null }
|
3040 |
-
var coords = coordsChar(cm, x, y), line
|
3041 |
-
if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
|
3042 |
-
var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length
|
3043 |
-
coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff))
|
3044 |
-
}
|
3045 |
-
return coords
|
3046 |
-
}
|
3047 |
-
|
3048 |
-
// Find the view element corresponding to a given line. Return null
|
3049 |
-
// when the line isn't visible.
|
3050 |
-
function findViewIndex(cm, n) {
|
3051 |
-
if (n >= cm.display.viewTo) { return null }
|
3052 |
-
n -= cm.display.viewFrom
|
3053 |
-
if (n < 0) { return null }
|
3054 |
-
var view = cm.display.view
|
3055 |
-
for (var i = 0; i < view.length; i++) {
|
3056 |
-
n -= view[i].size
|
3057 |
-
if (n < 0) { return i }
|
3058 |
-
}
|
3059 |
-
}
|
3060 |
-
|
3061 |
-
function updateSelection(cm) {
|
3062 |
-
cm.display.input.showSelection(cm.display.input.prepareSelection())
|
3063 |
-
}
|
3064 |
-
|
3065 |
-
function prepareSelection(cm, primary) {
|
3066 |
-
if ( primary === void 0 ) primary = true;
|
3067 |
-
|
3068 |
-
var doc = cm.doc, result = {}
|
3069 |
-
var curFragment = result.cursors = document.createDocumentFragment()
|
3070 |
-
var selFragment = result.selection = document.createDocumentFragment()
|
3071 |
-
|
3072 |
-
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
3073 |
-
if (!primary && i == doc.sel.primIndex) { continue }
|
3074 |
-
var range = doc.sel.ranges[i]
|
3075 |
-
if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }
|
3076 |
-
var collapsed = range.empty()
|
3077 |
-
if (collapsed || cm.options.showCursorWhenSelecting)
|
3078 |
-
{ drawSelectionCursor(cm, range.head, curFragment) }
|
3079 |
-
if (!collapsed)
|
3080 |
-
{ drawSelectionRange(cm, range, selFragment) }
|
3081 |
-
}
|
3082 |
-
return result
|
3083 |
-
}
|
3084 |
-
|
3085 |
-
// Draws a cursor for the given range
|
3086 |
-
function drawSelectionCursor(cm, head, output) {
|
3087 |
-
var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine)
|
3088 |
-
|
3089 |
-
var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"))
|
3090 |
-
cursor.style.left = pos.left + "px"
|
3091 |
-
cursor.style.top = pos.top + "px"
|
3092 |
-
cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px"
|
3093 |
-
|
3094 |
-
if (pos.other) {
|
3095 |
-
// Secondary cursor, shown when on a 'jump' in bi-directional text
|
3096 |
-
var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"))
|
3097 |
-
otherCursor.style.display = ""
|
3098 |
-
otherCursor.style.left = pos.other.left + "px"
|
3099 |
-
otherCursor.style.top = pos.other.top + "px"
|
3100 |
-
otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px"
|
3101 |
-
}
|
3102 |
-
}
|
3103 |
-
|
3104 |
-
function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
|
3105 |
-
|
3106 |
-
// Draws the given range as a highlighted selection
|
3107 |
-
function drawSelectionRange(cm, range, output) {
|
3108 |
-
var display = cm.display, doc = cm.doc
|
3109 |
-
var fragment = document.createDocumentFragment()
|
3110 |
-
var padding = paddingH(cm.display), leftSide = padding.left
|
3111 |
-
var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right
|
3112 |
-
var docLTR = doc.direction == "ltr"
|
3113 |
-
|
3114 |
-
function add(left, top, width, bottom) {
|
3115 |
-
if (top < 0) { top = 0 }
|
3116 |
-
top = Math.round(top)
|
3117 |
-
bottom = Math.round(bottom)
|
3118 |
-
fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")))
|
3119 |
-
}
|
3120 |
-
|
3121 |
-
function drawForLine(line, fromArg, toArg) {
|
3122 |
-
var lineObj = getLine(doc, line)
|
3123 |
-
var lineLen = lineObj.text.length
|
3124 |
-
var start, end
|
3125 |
-
function coords(ch, bias) {
|
3126 |
-
return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
|
3127 |
-
}
|
3128 |
-
|
3129 |
-
function wrapX(pos, dir, side) {
|
3130 |
-
var extent = wrappedLineExtentChar(cm, lineObj, null, pos)
|
3131 |
-
var prop = (dir == "ltr") == (side == "after") ? "left" : "right"
|
3132 |
-
var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1)
|
3133 |
-
return coords(ch, prop)[prop]
|
3134 |
-
}
|
3135 |
-
|
3136 |
-
var order = getOrder(lineObj, doc.direction)
|
3137 |
-
iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
|
3138 |
-
var ltr = dir == "ltr"
|
3139 |
-
var fromPos = coords(from, ltr ? "left" : "right")
|
3140 |
-
var toPos = coords(to - 1, ltr ? "right" : "left")
|
3141 |
-
|
3142 |
-
var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen
|
3143 |
-
var first = i == 0, last = !order || i == order.length - 1
|
3144 |
-
if (toPos.top - fromPos.top <= 3) { // Single line
|
3145 |
-
var openLeft = (docLTR ? openStart : openEnd) && first
|
3146 |
-
var openRight = (docLTR ? openEnd : openStart) && last
|
3147 |
-
var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left
|
3148 |
-
var right = openRight ? rightSide : (ltr ? toPos : fromPos).right
|
3149 |
-
add(left, fromPos.top, right - left, fromPos.bottom)
|
3150 |
-
} else { // Multiple lines
|
3151 |
-
var topLeft, topRight, botLeft, botRight
|
3152 |
-
if (ltr) {
|
3153 |
-
topLeft = docLTR && openStart && first ? leftSide : fromPos.left
|
3154 |
-
topRight = docLTR ? rightSide : wrapX(from, dir, "before")
|
3155 |
-
botLeft = docLTR ? leftSide : wrapX(to, dir, "after")
|
3156 |
-
botRight = docLTR && openEnd && last ? rightSide : toPos.right
|
3157 |
-
} else {
|
3158 |
-
topLeft = !docLTR ? leftSide : wrapX(from, dir, "before")
|
3159 |
-
topRight = !docLTR && openStart && first ? rightSide : fromPos.right
|
3160 |
-
botLeft = !docLTR && openEnd && last ? leftSide : toPos.left
|
3161 |
-
botRight = !docLTR ? rightSide : wrapX(to, dir, "after")
|
3162 |
-
}
|
3163 |
-
add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom)
|
3164 |
-
if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top) }
|
3165 |
-
add(botLeft, toPos.top, botRight - botLeft, toPos.bottom)
|
3166 |
-
}
|
3167 |
|
3168 |
-
|
3169 |
-
|
3170 |
-
|
3171 |
-
if (cmpCoords(toPos, end) < 0) { end = toPos }
|
3172 |
-
})
|
3173 |
-
return {start: start, end: end}
|
3174 |
-
}
|
3175 |
-
|
3176 |
-
var sFrom = range.from(), sTo = range.to()
|
3177 |
-
if (sFrom.line == sTo.line) {
|
3178 |
-
drawForLine(sFrom.line, sFrom.ch, sTo.ch)
|
3179 |
-
} else {
|
3180 |
-
var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line)
|
3181 |
-
var singleVLine = visualLine(fromLine) == visualLine(toLine)
|
3182 |
-
var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end
|
3183 |
-
var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start
|
3184 |
-
if (singleVLine) {
|
3185 |
-
if (leftEnd.top < rightStart.top - 2) {
|
3186 |
-
add(leftEnd.right, leftEnd.top, null, leftEnd.bottom)
|
3187 |
-
add(leftSide, rightStart.top, rightStart.left, rightStart.bottom)
|
3188 |
-
} else {
|
3189 |
-
add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom)
|
3190 |
-
}
|
3191 |
-
}
|
3192 |
-
if (leftEnd.bottom < rightStart.top)
|
3193 |
-
{ add(leftSide, leftEnd.bottom, null, rightStart.top) }
|
3194 |
-
}
|
3195 |
-
|
3196 |
-
output.appendChild(fragment)
|
3197 |
-
}
|
3198 |
-
|
3199 |
-
// Cursor-blinking
|
3200 |
-
function restartBlink(cm) {
|
3201 |
-
if (!cm.state.focused) { return }
|
3202 |
-
var display = cm.display
|
3203 |
-
clearInterval(display.blinker)
|
3204 |
-
var on = true
|
3205 |
-
display.cursorDiv.style.visibility = ""
|
3206 |
-
if (cm.options.cursorBlinkRate > 0)
|
3207 |
-
{ display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
|
3208 |
-
cm.options.cursorBlinkRate) }
|
3209 |
-
else if (cm.options.cursorBlinkRate < 0)
|
3210 |
-
{ display.cursorDiv.style.visibility = "hidden" }
|
3211 |
-
}
|
3212 |
-
|
3213 |
-
function ensureFocus(cm) {
|
3214 |
-
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm) }
|
3215 |
-
}
|
3216 |
-
|
3217 |
-
function delayBlurEvent(cm) {
|
3218 |
-
cm.state.delayingBlurEvent = true
|
3219 |
-
setTimeout(function () { if (cm.state.delayingBlurEvent) {
|
3220 |
-
cm.state.delayingBlurEvent = false
|
3221 |
-
onBlur(cm)
|
3222 |
-
} }, 100)
|
3223 |
-
}
|
3224 |
-
|
3225 |
-
function onFocus(cm, e) {
|
3226 |
-
if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false }
|
3227 |
-
|
3228 |
-
if (cm.options.readOnly == "nocursor") { return }
|
3229 |
-
if (!cm.state.focused) {
|
3230 |
-
signal(cm, "focus", cm, e)
|
3231 |
-
cm.state.focused = true
|
3232 |
-
addClass(cm.display.wrapper, "CodeMirror-focused")
|
3233 |
-
// This test prevents this from firing when a context
|
3234 |
-
// menu is closed (since the input reset would kill the
|
3235 |
-
// select-all detection hack)
|
3236 |
-
if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
|
3237 |
-
cm.display.input.reset()
|
3238 |
-
if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20) } // Issue #1730
|
3239 |
-
}
|
3240 |
-
cm.display.input.receivedFocus()
|
3241 |
-
}
|
3242 |
-
restartBlink(cm)
|
3243 |
-
}
|
3244 |
-
function onBlur(cm, e) {
|
3245 |
-
if (cm.state.delayingBlurEvent) { return }
|
3246 |
-
|
3247 |
-
if (cm.state.focused) {
|
3248 |
-
signal(cm, "blur", cm, e)
|
3249 |
-
cm.state.focused = false
|
3250 |
-
rmClass(cm.display.wrapper, "CodeMirror-focused")
|
3251 |
-
}
|
3252 |
-
clearInterval(cm.display.blinker)
|
3253 |
-
setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false } }, 150)
|
3254 |
-
}
|
3255 |
-
|
3256 |
-
// Read the actual heights of the rendered lines, and update their
|
3257 |
-
// stored heights to match.
|
3258 |
-
function updateHeightsInViewport(cm) {
|
3259 |
-
var display = cm.display
|
3260 |
-
var prevBottom = display.lineDiv.offsetTop
|
3261 |
-
for (var i = 0; i < display.view.length; i++) {
|
3262 |
-
var cur = display.view[i], height = (void 0)
|
3263 |
-
if (cur.hidden) { continue }
|
3264 |
-
if (ie && ie_version < 8) {
|
3265 |
-
var bot = cur.node.offsetTop + cur.node.offsetHeight
|
3266 |
-
height = bot - prevBottom
|
3267 |
-
prevBottom = bot
|
3268 |
-
} else {
|
3269 |
-
var box = cur.node.getBoundingClientRect()
|
3270 |
-
height = box.bottom - box.top
|
3271 |
-
}
|
3272 |
-
var diff = cur.line.height - height
|
3273 |
-
if (height < 2) { height = textHeight(display) }
|
3274 |
-
if (diff > .005 || diff < -.005) {
|
3275 |
-
updateLineHeight(cur.line, height)
|
3276 |
-
updateWidgetHeight(cur.line)
|
3277 |
-
if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
|
3278 |
-
{ updateWidgetHeight(cur.rest[j]) } }
|
3279 |
-
}
|
3280 |
-
}
|
3281 |
-
}
|
3282 |
-
|
3283 |
-
// Read and store the height of line widgets associated with the
|
3284 |
-
// given line.
|
3285 |
-
function updateWidgetHeight(line) {
|
3286 |
-
if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
|
3287 |
-
var w = line.widgets[i], parent = w.node.parentNode
|
3288 |
-
if (parent) { w.height = parent.offsetHeight }
|
3289 |
-
} }
|
3290 |
-
}
|
3291 |
-
|
3292 |
-
// Compute the lines that are visible in a given viewport (defaults
|
3293 |
-
// the the current scroll position). viewport may contain top,
|
3294 |
-
// height, and ensure (see op.scrollToPos) properties.
|
3295 |
-
function visibleLines(display, doc, viewport) {
|
3296 |
-
var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop
|
3297 |
-
top = Math.floor(top - paddingTop(display))
|
3298 |
-
var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight
|
3299 |
-
|
3300 |
-
var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom)
|
3301 |
-
// Ensure is a {from: {line, ch}, to: {line, ch}} object, and
|
3302 |
-
// forces those lines into the viewport (if possible).
|
3303 |
-
if (viewport && viewport.ensure) {
|
3304 |
-
var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line
|
3305 |
-
if (ensureFrom < from) {
|
3306 |
-
from = ensureFrom
|
3307 |
-
to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight)
|
3308 |
-
} else if (Math.min(ensureTo, doc.lastLine()) >= to) {
|
3309 |
-
from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight)
|
3310 |
-
to = ensureTo
|
3311 |
-
}
|
3312 |
-
}
|
3313 |
-
return {from: from, to: Math.max(to, from + 1)}
|
3314 |
-
}
|
3315 |
-
|
3316 |
-
// Re-align line numbers and gutter marks to compensate for
|
3317 |
-
// horizontal scrolling.
|
3318 |
-
function alignHorizontally(cm) {
|
3319 |
-
var display = cm.display, view = display.view
|
3320 |
-
if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
|
3321 |
-
var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft
|
3322 |
-
var gutterW = display.gutters.offsetWidth, left = comp + "px"
|
3323 |
-
for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
|
3324 |
-
if (cm.options.fixedGutter) {
|
3325 |
-
if (view[i].gutter)
|
3326 |
-
{ view[i].gutter.style.left = left }
|
3327 |
-
if (view[i].gutterBackground)
|
3328 |
-
{ view[i].gutterBackground.style.left = left }
|
3329 |
-
}
|
3330 |
-
var align = view[i].alignable
|
3331 |
-
if (align) { for (var j = 0; j < align.length; j++)
|
3332 |
-
{ align[j].style.left = left } }
|
3333 |
-
} }
|
3334 |
-
if (cm.options.fixedGutter)
|
3335 |
-
{ display.gutters.style.left = (comp + gutterW) + "px" }
|
3336 |
-
}
|
3337 |
-
|
3338 |
-
// Used to ensure that the line number gutter is still the right
|
3339 |
-
// size for the current document size. Returns true when an update
|
3340 |
-
// is needed.
|
3341 |
-
function maybeUpdateLineNumberWidth(cm) {
|
3342 |
-
if (!cm.options.lineNumbers) { return false }
|
3343 |
-
var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display
|
3344 |
-
if (last.length != display.lineNumChars) {
|
3345 |
-
var test = display.measure.appendChild(elt("div", [elt("div", last)],
|
3346 |
-
"CodeMirror-linenumber CodeMirror-gutter-elt"))
|
3347 |
-
var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW
|
3348 |
-
display.lineGutter.style.width = ""
|
3349 |
-
display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1
|
3350 |
-
display.lineNumWidth = display.lineNumInnerWidth + padding
|
3351 |
-
display.lineNumChars = display.lineNumInnerWidth ? last.length : -1
|
3352 |
-
display.lineGutter.style.width = display.lineNumWidth + "px"
|
3353 |
-
updateGutterSpace(cm)
|
3354 |
-
return true
|
3355 |
-
}
|
3356 |
-
return false
|
3357 |
-
}
|
3358 |
-
|
3359 |
-
// SCROLLING THINGS INTO VIEW
|
3360 |
-
|
3361 |
-
// If an editor sits on the top or bottom of the window, partially
|
3362 |
-
// scrolled out of view, this ensures that the cursor is visible.
|
3363 |
-
function maybeScrollWindow(cm, rect) {
|
3364 |
-
if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
|
3365 |
-
|
3366 |
-
var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null
|
3367 |
-
if (rect.top + box.top < 0) { doScroll = true }
|
3368 |
-
else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false }
|
3369 |
-
if (doScroll != null && !phantom) {
|
3370 |
-
var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"))
|
3371 |
-
cm.display.lineSpace.appendChild(scrollNode)
|
3372 |
-
scrollNode.scrollIntoView(doScroll)
|
3373 |
-
cm.display.lineSpace.removeChild(scrollNode)
|
3374 |
-
}
|
3375 |
-
}
|
3376 |
-
|
3377 |
-
// Scroll a given position into view (immediately), verifying that
|
3378 |
-
// it actually became visible (as line heights are accurately
|
3379 |
-
// measured, the position of something may 'drift' during drawing).
|
3380 |
-
function scrollPosIntoView(cm, pos, end, margin) {
|
3381 |
-
if (margin == null) { margin = 0 }
|
3382 |
-
var rect
|
3383 |
-
if (!cm.options.lineWrapping && pos == end) {
|
3384 |
-
// Set pos and end to the cursor positions around the character pos sticks to
|
3385 |
-
// If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
|
3386 |
-
// If pos == Pos(_, 0, "before"), pos and end are unchanged
|
3387 |
-
pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos
|
3388 |
-
end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos
|
3389 |
-
}
|
3390 |
-
for (var limit = 0; limit < 5; limit++) {
|
3391 |
-
var changed = false
|
3392 |
-
var coords = cursorCoords(cm, pos)
|
3393 |
-
var endCoords = !end || end == pos ? coords : cursorCoords(cm, end)
|
3394 |
-
rect = {left: Math.min(coords.left, endCoords.left),
|
3395 |
-
top: Math.min(coords.top, endCoords.top) - margin,
|
3396 |
-
right: Math.max(coords.left, endCoords.left),
|
3397 |
-
bottom: Math.max(coords.bottom, endCoords.bottom) + margin}
|
3398 |
-
var scrollPos = calculateScrollPos(cm, rect)
|
3399 |
-
var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft
|
3400 |
-
if (scrollPos.scrollTop != null) {
|
3401 |
-
updateScrollTop(cm, scrollPos.scrollTop)
|
3402 |
-
if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true }
|
3403 |
-
}
|
3404 |
-
if (scrollPos.scrollLeft != null) {
|
3405 |
-
setScrollLeft(cm, scrollPos.scrollLeft)
|
3406 |
-
if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true }
|
3407 |
-
}
|
3408 |
-
if (!changed) { break }
|
3409 |
-
}
|
3410 |
-
return rect
|
3411 |
-
}
|
3412 |
-
|
3413 |
-
// Scroll a given set of coordinates into view (immediately).
|
3414 |
-
function scrollIntoView(cm, rect) {
|
3415 |
-
var scrollPos = calculateScrollPos(cm, rect)
|
3416 |
-
if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop) }
|
3417 |
-
if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft) }
|
3418 |
-
}
|
3419 |
-
|
3420 |
-
// Calculate a new scroll position needed to scroll the given
|
3421 |
-
// rectangle into view. Returns an object with scrollTop and
|
3422 |
-
// scrollLeft properties. When these are undefined, the
|
3423 |
-
// vertical/horizontal position does not need to be adjusted.
|
3424 |
-
function calculateScrollPos(cm, rect) {
|
3425 |
-
var display = cm.display, snapMargin = textHeight(cm.display)
|
3426 |
-
if (rect.top < 0) { rect.top = 0 }
|
3427 |
-
var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop
|
3428 |
-
var screen = displayHeight(cm), result = {}
|
3429 |
-
if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen }
|
3430 |
-
var docBottom = cm.doc.height + paddingVert(display)
|
3431 |
-
var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin
|
3432 |
-
if (rect.top < screentop) {
|
3433 |
-
result.scrollTop = atTop ? 0 : rect.top
|
3434 |
-
} else if (rect.bottom > screentop + screen) {
|
3435 |
-
var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen)
|
3436 |
-
if (newTop != screentop) { result.scrollTop = newTop }
|
3437 |
-
}
|
3438 |
-
|
3439 |
-
var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft
|
3440 |
-
var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0)
|
3441 |
-
var tooWide = rect.right - rect.left > screenw
|
3442 |
-
if (tooWide) { rect.right = rect.left + screenw }
|
3443 |
-
if (rect.left < 10)
|
3444 |
-
{ result.scrollLeft = 0 }
|
3445 |
-
else if (rect.left < screenleft)
|
3446 |
-
{ result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)) }
|
3447 |
-
else if (rect.right > screenw + screenleft - 3)
|
3448 |
-
{ result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw }
|
3449 |
-
return result
|
3450 |
-
}
|
3451 |
-
|
3452 |
-
// Store a relative adjustment to the scroll position in the current
|
3453 |
-
// operation (to be applied when the operation finishes).
|
3454 |
-
function addToScrollTop(cm, top) {
|
3455 |
-
if (top == null) { return }
|
3456 |
-
resolveScrollToPos(cm)
|
3457 |
-
cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top
|
3458 |
-
}
|
3459 |
-
|
3460 |
-
// Make sure that at the end of the operation the current cursor is
|
3461 |
-
// shown.
|
3462 |
-
function ensureCursorVisible(cm) {
|
3463 |
-
resolveScrollToPos(cm)
|
3464 |
-
var cur = cm.getCursor()
|
3465 |
-
cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin}
|
3466 |
-
}
|
3467 |
-
|
3468 |
-
function scrollToCoords(cm, x, y) {
|
3469 |
-
if (x != null || y != null) { resolveScrollToPos(cm) }
|
3470 |
-
if (x != null) { cm.curOp.scrollLeft = x }
|
3471 |
-
if (y != null) { cm.curOp.scrollTop = y }
|
3472 |
-
}
|
3473 |
-
|
3474 |
-
function scrollToRange(cm, range) {
|
3475 |
-
resolveScrollToPos(cm)
|
3476 |
-
cm.curOp.scrollToPos = range
|
3477 |
-
}
|
3478 |
-
|
3479 |
-
// When an operation has its scrollToPos property set, and another
|
3480 |
-
// scroll action is applied before the end of the operation, this
|
3481 |
-
// 'simulates' scrolling that position into view in a cheap way, so
|
3482 |
-
// that the effect of intermediate scroll commands is not ignored.
|
3483 |
-
function resolveScrollToPos(cm) {
|
3484 |
-
var range = cm.curOp.scrollToPos
|
3485 |
-
if (range) {
|
3486 |
-
cm.curOp.scrollToPos = null
|
3487 |
-
var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to)
|
3488 |
-
scrollToCoordsRange(cm, from, to, range.margin)
|
3489 |
-
}
|
3490 |
-
}
|
3491 |
-
|
3492 |
-
function scrollToCoordsRange(cm, from, to, margin) {
|
3493 |
-
var sPos = calculateScrollPos(cm, {
|
3494 |
-
left: Math.min(from.left, to.left),
|
3495 |
-
top: Math.min(from.top, to.top) - margin,
|
3496 |
-
right: Math.max(from.right, to.right),
|
3497 |
-
bottom: Math.max(from.bottom, to.bottom) + margin
|
3498 |
-
})
|
3499 |
-
scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop)
|
3500 |
-
}
|
3501 |
-
|
3502 |
-
// Sync the scrollable area and scrollbars, ensure the viewport
|
3503 |
-
// covers the visible area.
|
3504 |
-
function updateScrollTop(cm, val) {
|
3505 |
-
if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
|
3506 |
-
if (!gecko) { updateDisplaySimple(cm, {top: val}) }
|
3507 |
-
setScrollTop(cm, val, true)
|
3508 |
-
if (gecko) { updateDisplaySimple(cm) }
|
3509 |
-
startWorker(cm, 100)
|
3510 |
-
}
|
3511 |
-
|
3512 |
-
function setScrollTop(cm, val, forceScroll) {
|
3513 |
-
val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val)
|
3514 |
-
if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
|
3515 |
-
cm.doc.scrollTop = val
|
3516 |
-
cm.display.scrollbars.setScrollTop(val)
|
3517 |
-
if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val }
|
3518 |
-
}
|
3519 |
-
|
3520 |
-
// Sync scroller and scrollbar, ensure the gutter elements are
|
3521 |
-
// aligned.
|
3522 |
-
function setScrollLeft(cm, val, isScroller, forceScroll) {
|
3523 |
-
val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth)
|
3524 |
-
if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
|
3525 |
-
cm.doc.scrollLeft = val
|
3526 |
-
alignHorizontally(cm)
|
3527 |
-
if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val }
|
3528 |
-
cm.display.scrollbars.setScrollLeft(val)
|
3529 |
-
}
|
3530 |
-
|
3531 |
-
// SCROLLBARS
|
3532 |
-
|
3533 |
-
// Prepare DOM reads needed to update the scrollbars. Done in one
|
3534 |
-
// shot to minimize update/measure roundtrips.
|
3535 |
-
function measureForScrollbars(cm) {
|
3536 |
-
var d = cm.display, gutterW = d.gutters.offsetWidth
|
3537 |
-
var docH = Math.round(cm.doc.height + paddingVert(cm.display))
|
3538 |
-
return {
|
3539 |
-
clientHeight: d.scroller.clientHeight,
|
3540 |
-
viewHeight: d.wrapper.clientHeight,
|
3541 |
-
scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
|
3542 |
-
viewWidth: d.wrapper.clientWidth,
|
3543 |
-
barLeft: cm.options.fixedGutter ? gutterW : 0,
|
3544 |
-
docHeight: docH,
|
3545 |
-
scrollHeight: docH + scrollGap(cm) + d.barHeight,
|
3546 |
-
nativeBarWidth: d.nativeBarWidth,
|
3547 |
-
gutterWidth: gutterW
|
3548 |
-
}
|
3549 |
-
}
|
3550 |
-
|
3551 |
-
var NativeScrollbars = function(place, scroll, cm) {
|
3552 |
-
this.cm = cm
|
3553 |
-
var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar")
|
3554 |
-
var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar")
|
3555 |
-
vert.tabIndex = horiz.tabIndex = -1
|
3556 |
-
place(vert); place(horiz)
|
3557 |
-
|
3558 |
-
on(vert, "scroll", function () {
|
3559 |
-
if (vert.clientHeight) { scroll(vert.scrollTop, "vertical") }
|
3560 |
-
})
|
3561 |
-
on(horiz, "scroll", function () {
|
3562 |
-
if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal") }
|
3563 |
-
})
|
3564 |
-
|
3565 |
-
this.checkedZeroWidth = false
|
3566 |
-
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
|
3567 |
-
if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px" }
|
3568 |
-
};
|
3569 |
-
|
3570 |
-
NativeScrollbars.prototype.update = function (measure) {
|
3571 |
-
var needsH = measure.scrollWidth > measure.clientWidth + 1
|
3572 |
-
var needsV = measure.scrollHeight > measure.clientHeight + 1
|
3573 |
-
var sWidth = measure.nativeBarWidth
|
3574 |
-
|
3575 |
-
if (needsV) {
|
3576 |
-
this.vert.style.display = "block"
|
3577 |
-
this.vert.style.bottom = needsH ? sWidth + "px" : "0"
|
3578 |
-
var totalHeight = measure.viewHeight - (needsH ? sWidth : 0)
|
3579 |
-
// A bug in IE8 can cause this value to be negative, so guard it.
|
3580 |
-
this.vert.firstChild.style.height =
|
3581 |
-
Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px"
|
3582 |
-
} else {
|
3583 |
-
this.vert.style.display = ""
|
3584 |
-
this.vert.firstChild.style.height = "0"
|
3585 |
-
}
|
3586 |
-
|
3587 |
-
if (needsH) {
|
3588 |
-
this.horiz.style.display = "block"
|
3589 |
-
this.horiz.style.right = needsV ? sWidth + "px" : "0"
|
3590 |
-
this.horiz.style.left = measure.barLeft + "px"
|
3591 |
-
var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0)
|
3592 |
-
this.horiz.firstChild.style.width =
|
3593 |
-
Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px"
|
3594 |
-
} else {
|
3595 |
-
this.horiz.style.display = ""
|
3596 |
-
this.horiz.firstChild.style.width = "0"
|
3597 |
-
}
|
3598 |
-
|
3599 |
-
if (!this.checkedZeroWidth && measure.clientHeight > 0) {
|
3600 |
-
if (sWidth == 0) { this.zeroWidthHack() }
|
3601 |
-
this.checkedZeroWidth = true
|
3602 |
-
}
|
3603 |
-
|
3604 |
-
return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
|
3605 |
-
};
|
3606 |
-
|
3607 |
-
NativeScrollbars.prototype.setScrollLeft = function (pos) {
|
3608 |
-
if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos }
|
3609 |
-
if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz") }
|
3610 |
-
};
|
3611 |
-
|
3612 |
-
NativeScrollbars.prototype.setScrollTop = function (pos) {
|
3613 |
-
if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos }
|
3614 |
-
if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert") }
|
3615 |
-
};
|
3616 |
-
|
3617 |
-
NativeScrollbars.prototype.zeroWidthHack = function () {
|
3618 |
-
var w = mac && !mac_geMountainLion ? "12px" : "18px"
|
3619 |
-
this.horiz.style.height = this.vert.style.width = w
|
3620 |
-
this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none"
|
3621 |
-
this.disableHoriz = new Delayed
|
3622 |
-
this.disableVert = new Delayed
|
3623 |
-
};
|
3624 |
-
|
3625 |
-
NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
|
3626 |
-
bar.style.pointerEvents = "auto"
|
3627 |
-
function maybeDisable() {
|
3628 |
-
// To find out whether the scrollbar is still visible, we
|
3629 |
-
// check whether the element under the pixel in the bottom
|
3630 |
-
// right corner of the scrollbar box is the scrollbar box
|
3631 |
-
// itself (when the bar is still visible) or its filler child
|
3632 |
-
// (when the bar is hidden). If it is still visible, we keep
|
3633 |
-
// it enabled, if it's hidden, we disable pointer events.
|
3634 |
-
var box = bar.getBoundingClientRect()
|
3635 |
-
var elt = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
|
3636 |
-
: document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1)
|
3637 |
-
if (elt != bar) { bar.style.pointerEvents = "none" }
|
3638 |
-
else { delay.set(1000, maybeDisable) }
|
3639 |
-
}
|
3640 |
-
delay.set(1000, maybeDisable)
|
3641 |
-
};
|
3642 |
-
|
3643 |
-
NativeScrollbars.prototype.clear = function () {
|
3644 |
-
var parent = this.horiz.parentNode
|
3645 |
-
parent.removeChild(this.horiz)
|
3646 |
-
parent.removeChild(this.vert)
|
3647 |
-
};
|
3648 |
-
|
3649 |
-
var NullScrollbars = function () {};
|
3650 |
-
|
3651 |
-
NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
|
3652 |
-
NullScrollbars.prototype.setScrollLeft = function () {};
|
3653 |
-
NullScrollbars.prototype.setScrollTop = function () {};
|
3654 |
-
NullScrollbars.prototype.clear = function () {};
|
3655 |
-
|
3656 |
-
function updateScrollbars(cm, measure) {
|
3657 |
-
if (!measure) { measure = measureForScrollbars(cm) }
|
3658 |
-
var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight
|
3659 |
-
updateScrollbarsInner(cm, measure)
|
3660 |
-
for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
|
3661 |
-
if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
|
3662 |
-
{ updateHeightsInViewport(cm) }
|
3663 |
-
updateScrollbarsInner(cm, measureForScrollbars(cm))
|
3664 |
-
startWidth = cm.display.barWidth; startHeight = cm.display.barHeight
|
3665 |
-
}
|
3666 |
-
}
|
3667 |
-
|
3668 |
-
// Re-synchronize the fake scrollbars with the actual size of the
|
3669 |
-
// content.
|
3670 |
-
function updateScrollbarsInner(cm, measure) {
|
3671 |
-
var d = cm.display
|
3672 |
-
var sizes = d.scrollbars.update(measure)
|
3673 |
-
|
3674 |
-
d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px"
|
3675 |
-
d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px"
|
3676 |
-
d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent"
|
3677 |
-
|
3678 |
-
if (sizes.right && sizes.bottom) {
|
3679 |
-
d.scrollbarFiller.style.display = "block"
|
3680 |
-
d.scrollbarFiller.style.height = sizes.bottom + "px"
|
3681 |
-
d.scrollbarFiller.style.width = sizes.right + "px"
|
3682 |
-
} else { d.scrollbarFiller.style.display = "" }
|
3683 |
-
if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
|
3684 |
-
d.gutterFiller.style.display = "block"
|
3685 |
-
d.gutterFiller.style.height = sizes.bottom + "px"
|
3686 |
-
d.gutterFiller.style.width = measure.gutterWidth + "px"
|
3687 |
-
} else { d.gutterFiller.style.display = "" }
|
3688 |
-
}
|
3689 |
-
|
3690 |
-
var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars}
|
3691 |
-
|
3692 |
-
function initScrollbars(cm) {
|
3693 |
-
if (cm.display.scrollbars) {
|
3694 |
-
cm.display.scrollbars.clear()
|
3695 |
-
if (cm.display.scrollbars.addClass)
|
3696 |
-
{ rmClass(cm.display.wrapper, cm.display.scrollbars.addClass) }
|
3697 |
}
|
3698 |
|
3699 |
-
|
3700 |
-
|
3701 |
-
|
3702 |
-
|
3703 |
-
|
3704 |
-
|
3705 |
-
node.setAttribute("cm-not-content", "true")
|
3706 |
-
}, function (pos, axis) {
|
3707 |
-
if (axis == "horizontal") { setScrollLeft(cm, pos) }
|
3708 |
-
else { updateScrollTop(cm, pos) }
|
3709 |
-
}, cm)
|
3710 |
-
if (cm.display.scrollbars.addClass)
|
3711 |
-
{ addClass(cm.display.wrapper, cm.display.scrollbars.addClass) }
|
3712 |
-
}
|
3713 |
-
|
3714 |
-
// Operations are used to wrap a series of changes to the editor
|
3715 |
-
// state in such a way that each change won't have to update the
|
3716 |
-
// cursor and display (which would be awkward, slow, and
|
3717 |
-
// error-prone). Instead, display updates are batched and then all
|
3718 |
-
// combined and executed at once.
|
3719 |
-
|
3720 |
-
var nextOpId = 0
|
3721 |
-
// Start a new operation.
|
3722 |
-
function startOperation(cm) {
|
3723 |
-
cm.curOp = {
|
3724 |
-
cm: cm,
|
3725 |
-
viewChanged: false, // Flag that indicates that lines might need to be redrawn
|
3726 |
-
startHeight: cm.doc.height, // Used to detect need to update scrollbar
|
3727 |
-
forceUpdate: false, // Used to force a redraw
|
3728 |
-
updateInput: null, // Whether to reset the input textarea
|
3729 |
-
typing: false, // Whether this reset should be careful to leave existing text (for compositing)
|
3730 |
-
changeObjs: null, // Accumulated changes, for firing change events
|
3731 |
-
cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
|
3732 |
-
cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
|
3733 |
-
selectionChanged: false, // Whether the selection needs to be redrawn
|
3734 |
-
updateMaxLine: false, // Set when the widest line needs to be determined anew
|
3735 |
-
scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
|
3736 |
-
scrollToPos: null, // Used to scroll to a specific position
|
3737 |
-
focus: false,
|
3738 |
-
id: ++nextOpId // Unique ID
|
3739 |
-
}
|
3740 |
-
pushOperation(cm.curOp)
|
3741 |
-
}
|
3742 |
-
|
3743 |
-
// Finish an operation, updating the display and signalling delayed events
|
3744 |
-
function endOperation(cm) {
|
3745 |
-
var op = cm.curOp
|
3746 |
-
finishOperation(op, function (group) {
|
3747 |
-
for (var i = 0; i < group.ops.length; i++)
|
3748 |
-
{ group.ops[i].cm.curOp = null }
|
3749 |
-
endOperations(group)
|
3750 |
-
})
|
3751 |
-
}
|
3752 |
-
|
3753 |
-
// The DOM updates done when an operation finishes are batched so
|
3754 |
-
// that the minimum number of relayouts are required.
|
3755 |
-
function endOperations(group) {
|
3756 |
-
var ops = group.ops
|
3757 |
-
for (var i = 0; i < ops.length; i++) // Read DOM
|
3758 |
-
{ endOperation_R1(ops[i]) }
|
3759 |
-
for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
|
3760 |
-
{ endOperation_W1(ops[i$1]) }
|
3761 |
-
for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
|
3762 |
-
{ endOperation_R2(ops[i$2]) }
|
3763 |
-
for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
|
3764 |
-
{ endOperation_W2(ops[i$3]) }
|
3765 |
-
for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
|
3766 |
-
{ endOperation_finish(ops[i$4]) }
|
3767 |
-
}
|
3768 |
-
|
3769 |
-
function endOperation_R1(op) {
|
3770 |
-
var cm = op.cm, display = cm.display
|
3771 |
-
maybeClipScrollbars(cm)
|
3772 |
-
if (op.updateMaxLine) { findMaxLine(cm) }
|
3773 |
-
|
3774 |
-
op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
|
3775 |
-
op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
|
3776 |
-
op.scrollToPos.to.line >= display.viewTo) ||
|
3777 |
-
display.maxLineChanged && cm.options.lineWrapping
|
3778 |
-
op.update = op.mustUpdate &&
|
3779 |
-
new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate)
|
3780 |
-
}
|
3781 |
-
|
3782 |
-
function endOperation_W1(op) {
|
3783 |
-
op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update)
|
3784 |
-
}
|
3785 |
-
|
3786 |
-
function endOperation_R2(op) {
|
3787 |
-
var cm = op.cm, display = cm.display
|
3788 |
-
if (op.updatedDisplay) { updateHeightsInViewport(cm) }
|
3789 |
-
|
3790 |
-
op.barMeasure = measureForScrollbars(cm)
|
3791 |
-
|
3792 |
-
// If the max line changed since it was last measured, measure it,
|
3793 |
-
// and ensure the document's width matches it.
|
3794 |
-
// updateDisplay_W2 will use these properties to do the actual resizing
|
3795 |
-
if (display.maxLineChanged && !cm.options.lineWrapping) {
|
3796 |
-
op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3
|
3797 |
-
cm.display.sizerWidth = op.adjustWidthTo
|
3798 |
-
op.barMeasure.scrollWidth =
|
3799 |
-
Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth)
|
3800 |
-
op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm))
|
3801 |
-
}
|
3802 |
-
|
3803 |
-
if (op.updatedDisplay || op.selectionChanged)
|
3804 |
-
{ op.preparedSelection = display.input.prepareSelection() }
|
3805 |
-
}
|
3806 |
-
|
3807 |
-
function endOperation_W2(op) {
|
3808 |
-
var cm = op.cm
|
3809 |
-
|
3810 |
-
if (op.adjustWidthTo != null) {
|
3811 |
-
cm.display.sizer.style.minWidth = op.adjustWidthTo + "px"
|
3812 |
-
if (op.maxScrollLeft < cm.doc.scrollLeft)
|
3813 |
-
{ setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true) }
|
3814 |
-
cm.display.maxLineChanged = false
|
3815 |
-
}
|
3816 |
-
|
3817 |
-
var takeFocus = op.focus && op.focus == activeElt()
|
3818 |
-
if (op.preparedSelection)
|
3819 |
-
{ cm.display.input.showSelection(op.preparedSelection, takeFocus) }
|
3820 |
-
if (op.updatedDisplay || op.startHeight != cm.doc.height)
|
3821 |
-
{ updateScrollbars(cm, op.barMeasure) }
|
3822 |
-
if (op.updatedDisplay)
|
3823 |
-
{ setDocumentHeight(cm, op.barMeasure) }
|
3824 |
-
|
3825 |
-
if (op.selectionChanged) { restartBlink(cm) }
|
3826 |
-
|
3827 |
-
if (cm.state.focused && op.updateInput)
|
3828 |
-
{ cm.display.input.reset(op.typing) }
|
3829 |
-
if (takeFocus) { ensureFocus(op.cm) }
|
3830 |
-
}
|
3831 |
-
|
3832 |
-
function endOperation_finish(op) {
|
3833 |
-
var cm = op.cm, display = cm.display, doc = cm.doc
|
3834 |
-
|
3835 |
-
if (op.updatedDisplay) { postUpdateDisplay(cm, op.update) }
|
3836 |
-
|
3837 |
-
// Abort mouse wheel delta measurement, when scrolling explicitly
|
3838 |
-
if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
|
3839 |
-
{ display.wheelStartX = display.wheelStartY = null }
|
3840 |
-
|
3841 |
-
// Propagate the scroll position to the actual DOM scroller
|
3842 |
-
if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll) }
|
3843 |
-
|
3844 |
-
if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true) }
|
3845 |
-
// If we need to scroll a specific position into view, do so.
|
3846 |
-
if (op.scrollToPos) {
|
3847 |
-
var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
|
3848 |
-
clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin)
|
3849 |
-
maybeScrollWindow(cm, rect)
|
3850 |
-
}
|
3851 |
-
|
3852 |
-
// Fire events for markers that are hidden/unidden by editing or
|
3853 |
-
// undoing
|
3854 |
-
var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers
|
3855 |
-
if (hidden) { for (var i = 0; i < hidden.length; ++i)
|
3856 |
-
{ if (!hidden[i].lines.length) { signal(hidden[i], "hide") } } }
|
3857 |
-
if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
|
3858 |
-
{ if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide") } } }
|
3859 |
-
|
3860 |
-
if (display.wrapper.offsetHeight)
|
3861 |
-
{ doc.scrollTop = cm.display.scroller.scrollTop }
|
3862 |
-
|
3863 |
-
// Fire change events, and delayed event handlers
|
3864 |
-
if (op.changeObjs)
|
3865 |
-
{ signal(cm, "changes", cm, op.changeObjs) }
|
3866 |
-
if (op.update)
|
3867 |
-
{ op.update.finish() }
|
3868 |
-
}
|
3869 |
-
|
3870 |
-
// Run the given function in an operation
|
3871 |
-
function runInOp(cm, f) {
|
3872 |
-
if (cm.curOp) { return f() }
|
3873 |
-
startOperation(cm)
|
3874 |
-
try { return f() }
|
3875 |
-
finally { endOperation(cm) }
|
3876 |
-
}
|
3877 |
-
// Wraps a function in an operation. Returns the wrapped function.
|
3878 |
-
function operation(cm, f) {
|
3879 |
-
return function() {
|
3880 |
-
if (cm.curOp) { return f.apply(cm, arguments) }
|
3881 |
-
startOperation(cm)
|
3882 |
-
try { return f.apply(cm, arguments) }
|
3883 |
-
finally { endOperation(cm) }
|
3884 |
-
}
|
3885 |
-
}
|
3886 |
-
// Used to add methods to editor and doc instances, wrapping them in
|
3887 |
-
// operations.
|
3888 |
-
function methodOp(f) {
|
3889 |
-
return function() {
|
3890 |
-
if (this.curOp) { return f.apply(this, arguments) }
|
3891 |
-
startOperation(this)
|
3892 |
-
try { return f.apply(this, arguments) }
|
3893 |
-
finally { endOperation(this) }
|
3894 |
-
}
|
3895 |
-
}
|
3896 |
-
function docMethodOp(f) {
|
3897 |
-
return function() {
|
3898 |
-
var cm = this.cm
|
3899 |
-
if (!cm || cm.curOp) { return f.apply(this, arguments) }
|
3900 |
-
startOperation(cm)
|
3901 |
-
try { return f.apply(this, arguments) }
|
3902 |
-
finally { endOperation(cm) }
|
3903 |
-
}
|
3904 |
-
}
|
3905 |
-
|
3906 |
-
// Updates the display.view data structure for a given change to the
|
3907 |
-
// document. From and to are in pre-change coordinates. Lendiff is
|
3908 |
-
// the amount of lines added or subtracted by the change. This is
|
3909 |
-
// used for changes that span multiple lines, or change the way
|
3910 |
-
// lines are divided into visual lines. regLineChange (below)
|
3911 |
-
// registers single-line changes.
|
3912 |
-
function regChange(cm, from, to, lendiff) {
|
3913 |
-
if (from == null) { from = cm.doc.first }
|
3914 |
-
if (to == null) { to = cm.doc.first + cm.doc.size }
|
3915 |
-
if (!lendiff) { lendiff = 0 }
|
3916 |
-
|
3917 |
-
var display = cm.display
|
3918 |
-
if (lendiff && to < display.viewTo &&
|
3919 |
-
(display.updateLineNumbers == null || display.updateLineNumbers > from))
|
3920 |
-
{ display.updateLineNumbers = from }
|
3921 |
-
|
3922 |
-
cm.curOp.viewChanged = true
|
3923 |
-
|
3924 |
-
if (from >= display.viewTo) { // Change after
|
3925 |
-
if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
|
3926 |
-
{ resetView(cm) }
|
3927 |
-
} else if (to <= display.viewFrom) { // Change before
|
3928 |
-
if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
|
3929 |
-
resetView(cm)
|
3930 |
-
} else {
|
3931 |
-
display.viewFrom += lendiff
|
3932 |
-
display.viewTo += lendiff
|
3933 |
-
}
|
3934 |
-
} else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
|
3935 |
-
resetView(cm)
|
3936 |
-
} else if (from <= display.viewFrom) { // Top overlap
|
3937 |
-
var cut = viewCuttingPoint(cm, to, to + lendiff, 1)
|
3938 |
-
if (cut) {
|
3939 |
-
display.view = display.view.slice(cut.index)
|
3940 |
-
display.viewFrom = cut.lineN
|
3941 |
-
display.viewTo += lendiff
|
3942 |
-
} else {
|
3943 |
-
resetView(cm)
|
3944 |
-
}
|
3945 |
-
} else if (to >= display.viewTo) { // Bottom overlap
|
3946 |
-
var cut$1 = viewCuttingPoint(cm, from, from, -1)
|
3947 |
-
if (cut$1) {
|
3948 |
-
display.view = display.view.slice(0, cut$1.index)
|
3949 |
-
display.viewTo = cut$1.lineN
|
3950 |
-
} else {
|
3951 |
-
resetView(cm)
|
3952 |
-
}
|
3953 |
-
} else { // Gap in the middle
|
3954 |
-
var cutTop = viewCuttingPoint(cm, from, from, -1)
|
3955 |
-
var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1)
|
3956 |
-
if (cutTop && cutBot) {
|
3957 |
-
display.view = display.view.slice(0, cutTop.index)
|
3958 |
-
.concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
|
3959 |
-
.concat(display.view.slice(cutBot.index))
|
3960 |
-
display.viewTo += lendiff
|
3961 |
-
} else {
|
3962 |
-
resetView(cm)
|
3963 |
-
}
|
3964 |
-
}
|
3965 |
-
|
3966 |
-
var ext = display.externalMeasured
|
3967 |
-
if (ext) {
|
3968 |
-
if (to < ext.lineN)
|
3969 |
-
{ ext.lineN += lendiff }
|
3970 |
-
else if (from < ext.lineN + ext.size)
|
3971 |
-
{ display.externalMeasured = null }
|
3972 |
-
}
|
3973 |
-
}
|
3974 |
-
|
3975 |
-
// Register a change to a single line. Type must be one of "text",
|
3976 |
-
// "gutter", "class", "widget"
|
3977 |
-
function regLineChange(cm, line, type) {
|
3978 |
-
cm.curOp.viewChanged = true
|
3979 |
-
var display = cm.display, ext = cm.display.externalMeasured
|
3980 |
-
if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
|
3981 |
-
{ display.externalMeasured = null }
|
3982 |
-
|
3983 |
-
if (line < display.viewFrom || line >= display.viewTo) { return }
|
3984 |
-
var lineView = display.view[findViewIndex(cm, line)]
|
3985 |
-
if (lineView.node == null) { return }
|
3986 |
-
var arr = lineView.changes || (lineView.changes = [])
|
3987 |
-
if (indexOf(arr, type) == -1) { arr.push(type) }
|
3988 |
-
}
|
3989 |
-
|
3990 |
-
// Clear the view.
|
3991 |
-
function resetView(cm) {
|
3992 |
-
cm.display.viewFrom = cm.display.viewTo = cm.doc.first
|
3993 |
-
cm.display.view = []
|
3994 |
-
cm.display.viewOffset = 0
|
3995 |
-
}
|
3996 |
-
|
3997 |
-
function viewCuttingPoint(cm, oldN, newN, dir) {
|
3998 |
-
var index = findViewIndex(cm, oldN), diff, view = cm.display.view
|
3999 |
-
if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
|
4000 |
-
{ return {index: index, lineN: newN} }
|
4001 |
-
var n = cm.display.viewFrom
|
4002 |
-
for (var i = 0; i < index; i++)
|
4003 |
-
{ n += view[i].size }
|
4004 |
-
if (n != oldN) {
|
4005 |
-
if (dir > 0) {
|
4006 |
-
if (index == view.length - 1) { return null }
|
4007 |
-
diff = (n + view[index].size) - oldN
|
4008 |
-
index++
|
4009 |
-
} else {
|
4010 |
-
diff = n - oldN
|
4011 |
-
}
|
4012 |
-
oldN += diff; newN += diff
|
4013 |
-
}
|
4014 |
-
while (visualLineNo(cm.doc, newN) != newN) {
|
4015 |
-
if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
|
4016 |
-
newN += dir * view[index - (dir < 0 ? 1 : 0)].size
|
4017 |
-
index += dir
|
4018 |
-
}
|
4019 |
-
return {index: index, lineN: newN}
|
4020 |
-
}
|
4021 |
-
|
4022 |
-
// Force the view to cover a given range, adding empty view element
|
4023 |
-
// or clipping off existing ones as needed.
|
4024 |
-
function adjustView(cm, from, to) {
|
4025 |
-
var display = cm.display, view = display.view
|
4026 |
-
if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
|
4027 |
-
display.view = buildViewArray(cm, from, to)
|
4028 |
-
display.viewFrom = from
|
4029 |
-
} else {
|
4030 |
-
if (display.viewFrom > from)
|
4031 |
-
{ display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view) }
|
4032 |
-
else if (display.viewFrom < from)
|
4033 |
-
{ display.view = display.view.slice(findViewIndex(cm, from)) }
|
4034 |
-
display.viewFrom = from
|
4035 |
-
if (display.viewTo < to)
|
4036 |
-
{ display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)) }
|
4037 |
-
else if (display.viewTo > to)
|
4038 |
-
{ display.view = display.view.slice(0, findViewIndex(cm, to)) }
|
4039 |
-
}
|
4040 |
-
display.viewTo = to
|
4041 |
-
}
|
4042 |
-
|
4043 |
-
// Count the number of lines in the view whose DOM representation is
|
4044 |
-
// out of date (or nonexistent).
|
4045 |
-
function countDirtyView(cm) {
|
4046 |
-
var view = cm.display.view, dirty = 0
|
4047 |
-
for (var i = 0; i < view.length; i++) {
|
4048 |
-
var lineView = view[i]
|
4049 |
-
if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty }
|
4050 |
-
}
|
4051 |
-
return dirty
|
4052 |
-
}
|
4053 |
-
|
4054 |
-
// HIGHLIGHT WORKER
|
4055 |
-
|
4056 |
-
function startWorker(cm, time) {
|
4057 |
-
if (cm.doc.highlightFrontier < cm.display.viewTo)
|
4058 |
-
{ cm.state.highlight.set(time, bind(highlightWorker, cm)) }
|
4059 |
-
}
|
4060 |
-
|
4061 |
-
function highlightWorker(cm) {
|
4062 |
-
var doc = cm.doc
|
4063 |
-
if (doc.highlightFrontier >= cm.display.viewTo) { return }
|
4064 |
-
var end = +new Date + cm.options.workTime
|
4065 |
-
var context = getContextBefore(cm, doc.highlightFrontier)
|
4066 |
-
var changedLines = []
|
4067 |
-
|
4068 |
-
doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
|
4069 |
-
if (context.line >= cm.display.viewFrom) { // Visible
|
4070 |
-
var oldStyles = line.styles
|
4071 |
-
var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null
|
4072 |
-
var highlighted = highlightLine(cm, line, context, true)
|
4073 |
-
if (resetState) { context.state = resetState }
|
4074 |
-
line.styles = highlighted.styles
|
4075 |
-
var oldCls = line.styleClasses, newCls = highlighted.classes
|
4076 |
-
if (newCls) { line.styleClasses = newCls }
|
4077 |
-
else if (oldCls) { line.styleClasses = null }
|
4078 |
-
var ischange = !oldStyles || oldStyles.length != line.styles.length ||
|
4079 |
-
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass)
|
4080 |
-
for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i] }
|
4081 |
-
if (ischange) { changedLines.push(context.line) }
|
4082 |
-
line.stateAfter = context.save()
|
4083 |
-
context.nextLine()
|
4084 |
-
} else {
|
4085 |
-
if (line.text.length <= cm.options.maxHighlightLength)
|
4086 |
-
{ processLine(cm, line.text, context) }
|
4087 |
-
line.stateAfter = context.line % 5 == 0 ? context.save() : null
|
4088 |
-
context.nextLine()
|
4089 |
-
}
|
4090 |
-
if (+new Date > end) {
|
4091 |
-
startWorker(cm, cm.options.workDelay)
|
4092 |
-
return true
|
4093 |
-
}
|
4094 |
-
})
|
4095 |
-
doc.highlightFrontier = context.line
|
4096 |
-
doc.modeFrontier = Math.max(doc.modeFrontier, context.line)
|
4097 |
-
if (changedLines.length) { runInOp(cm, function () {
|
4098 |
-
for (var i = 0; i < changedLines.length; i++)
|
4099 |
-
{ regLineChange(cm, changedLines[i], "text") }
|
4100 |
-
}) }
|
4101 |
-
}
|
4102 |
-
|
4103 |
-
// DISPLAY DRAWING
|
4104 |
-
|
4105 |
-
var DisplayUpdate = function(cm, viewport, force) {
|
4106 |
-
var display = cm.display
|
4107 |
-
|
4108 |
-
this.viewport = viewport
|
4109 |
-
// Store some values that we'll need later (but don't want to force a relayout for)
|
4110 |
-
this.visible = visibleLines(display, cm.doc, viewport)
|
4111 |
-
this.editorIsHidden = !display.wrapper.offsetWidth
|
4112 |
-
this.wrapperHeight = display.wrapper.clientHeight
|
4113 |
-
this.wrapperWidth = display.wrapper.clientWidth
|
4114 |
-
this.oldDisplayWidth = displayWidth(cm)
|
4115 |
-
this.force = force
|
4116 |
-
this.dims = getDimensions(cm)
|
4117 |
-
this.events = []
|
4118 |
-
};
|
4119 |
-
|
4120 |
-
DisplayUpdate.prototype.signal = function (emitter, type) {
|
4121 |
-
if (hasHandler(emitter, type))
|
4122 |
-
{ this.events.push(arguments) }
|
4123 |
-
};
|
4124 |
-
DisplayUpdate.prototype.finish = function () {
|
4125 |
-
var this$1 = this;
|
4126 |
-
|
4127 |
-
for (var i = 0; i < this.events.length; i++)
|
4128 |
-
{ signal.apply(null, this$1.events[i]) }
|
4129 |
-
};
|
4130 |
-
|
4131 |
-
function maybeClipScrollbars(cm) {
|
4132 |
-
var display = cm.display
|
4133 |
-
if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
|
4134 |
-
display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth
|
4135 |
-
display.heightForcer.style.height = scrollGap(cm) + "px"
|
4136 |
-
display.sizer.style.marginBottom = -display.nativeBarWidth + "px"
|
4137 |
-
display.sizer.style.borderRightWidth = scrollGap(cm) + "px"
|
4138 |
-
display.scrollbarsClipped = true
|
4139 |
-
}
|
4140 |
-
}
|
4141 |
-
|
4142 |
-
function selectionSnapshot(cm) {
|
4143 |
-
if (cm.hasFocus()) { return null }
|
4144 |
-
var active = activeElt()
|
4145 |
-
if (!active || !contains(cm.display.lineDiv, active)) { return null }
|
4146 |
-
var result = {activeElt: active}
|
4147 |
-
if (window.getSelection) {
|
4148 |
-
var sel = window.getSelection()
|
4149 |
-
if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
|
4150 |
-
result.anchorNode = sel.anchorNode
|
4151 |
-
result.anchorOffset = sel.anchorOffset
|
4152 |
-
result.focusNode = sel.focusNode
|
4153 |
-
result.focusOffset = sel.focusOffset
|
4154 |
-
}
|
4155 |
-
}
|
4156 |
-
return result
|
4157 |
-
}
|
4158 |
-
|
4159 |
-
function restoreSelection(snapshot) {
|
4160 |
-
if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
|
4161 |
-
snapshot.activeElt.focus()
|
4162 |
-
if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
|
4163 |
-
var sel = window.getSelection(), range = document.createRange()
|
4164 |
-
range.setEnd(snapshot.anchorNode, snapshot.anchorOffset)
|
4165 |
-
range.collapse(false)
|
4166 |
-
sel.removeAllRanges()
|
4167 |
-
sel.addRange(range)
|
4168 |
-
sel.extend(snapshot.focusNode, snapshot.focusOffset)
|
4169 |
-
}
|
4170 |
-
}
|
4171 |
-
|
4172 |
-
// Does the actual updating of the line display. Bails out
|
4173 |
-
// (returning false) when there is nothing to be done and forced is
|
4174 |
-
// false.
|
4175 |
-
function updateDisplayIfNeeded(cm, update) {
|
4176 |
-
var display = cm.display, doc = cm.doc
|
4177 |
-
|
4178 |
-
if (update.editorIsHidden) {
|
4179 |
-
resetView(cm)
|
4180 |
-
return false
|
4181 |
}
|
4182 |
|
4183 |
-
//
|
4184 |
-
|
4185 |
-
|
4186 |
-
|
4187 |
-
|
4188 |
-
|
4189 |
-
|
4190 |
-
if (maybeUpdateLineNumberWidth(cm)) {
|
4191 |
-
resetView(cm)
|
4192 |
-
update.dims = getDimensions(cm)
|
4193 |
-
}
|
4194 |
-
|
4195 |
-
// Compute a suitable new viewport (from & to)
|
4196 |
-
var end = doc.first + doc.size
|
4197 |
-
var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first)
|
4198 |
-
var to = Math.min(end, update.visible.to + cm.options.viewportMargin)
|
4199 |
-
if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom) }
|
4200 |
-
if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo) }
|
4201 |
-
if (sawCollapsedSpans) {
|
4202 |
-
from = visualLineNo(cm.doc, from)
|
4203 |
-
to = visualLineEndNo(cm.doc, to)
|
4204 |
-
}
|
4205 |
-
|
4206 |
-
var different = from != display.viewFrom || to != display.viewTo ||
|
4207 |
-
display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth
|
4208 |
-
adjustView(cm, from, to)
|
4209 |
-
|
4210 |
-
display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom))
|
4211 |
-
// Position the mover div to align with the current scroll position
|
4212 |
-
cm.display.mover.style.top = display.viewOffset + "px"
|
4213 |
-
|
4214 |
-
var toUpdate = countDirtyView(cm)
|
4215 |
-
if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
|
4216 |
-
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
|
4217 |
-
{ return false }
|
4218 |
-
|
4219 |
-
// For big changes, we hide the enclosing element during the
|
4220 |
-
// update, since that speeds up the operations on most browsers.
|
4221 |
-
var selSnapshot = selectionSnapshot(cm)
|
4222 |
-
if (toUpdate > 4) { display.lineDiv.style.display = "none" }
|
4223 |
-
patchDisplay(cm, display.updateLineNumbers, update.dims)
|
4224 |
-
if (toUpdate > 4) { display.lineDiv.style.display = "" }
|
4225 |
-
display.renderedView = display.view
|
4226 |
-
// There might have been a widget with a focused element that got
|
4227 |
-
// hidden or updated, if so re-focus it.
|
4228 |
-
restoreSelection(selSnapshot)
|
4229 |
-
|
4230 |
-
// Prevent selection and cursors from interfering with the scroll
|
4231 |
-
// width and height.
|
4232 |
-
removeChildren(display.cursorDiv)
|
4233 |
-
removeChildren(display.selectionDiv)
|
4234 |
-
display.gutters.style.height = display.sizer.style.minHeight = 0
|
4235 |
-
|
4236 |
-
if (different) {
|
4237 |
-
display.lastWrapHeight = update.wrapperHeight
|
4238 |
-
display.lastWrapWidth = update.wrapperWidth
|
4239 |
-
startWorker(cm, 400)
|
4240 |
-
}
|
4241 |
-
|
4242 |
-
display.updateLineNumbers = null
|
4243 |
-
|
4244 |
-
return true
|
4245 |
-
}
|
4246 |
-
|
4247 |
-
function postUpdateDisplay(cm, update) {
|
4248 |
-
var viewport = update.viewport
|
4249 |
-
|
4250 |
-
for (var first = true;; first = false) {
|
4251 |
-
if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
|
4252 |
-
// Clip forced viewport to actual scrollable area.
|
4253 |
-
if (viewport && viewport.top != null)
|
4254 |
-
{ viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)} }
|
4255 |
-
// Updated line heights might result in the drawn area not
|
4256 |
-
// actually covering the viewport. Keep looping until it does.
|
4257 |
-
update.visible = visibleLines(cm.display, cm.doc, viewport)
|
4258 |
-
if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
|
4259 |
-
{ break }
|
4260 |
}
|
4261 |
-
|
4262 |
-
|
4263 |
-
|
4264 |
-
|
4265 |
-
|
4266 |
-
|
4267 |
-
|
4268 |
-
}
|
4269 |
-
|
4270 |
-
update.signal(cm, "update", cm)
|
4271 |
-
if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
|
4272 |
-
update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo)
|
4273 |
-
cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo
|
4274 |
-
}
|
4275 |
-
}
|
4276 |
-
|
4277 |
-
function updateDisplaySimple(cm, viewport) {
|
4278 |
-
var update = new DisplayUpdate(cm, viewport)
|
4279 |
-
if (updateDisplayIfNeeded(cm, update)) {
|
4280 |
-
updateHeightsInViewport(cm)
|
4281 |
-
postUpdateDisplay(cm, update)
|
4282 |
-
var barMeasure = measureForScrollbars(cm)
|
4283 |
-
updateSelection(cm)
|
4284 |
-
updateScrollbars(cm, barMeasure)
|
4285 |
-
setDocumentHeight(cm, barMeasure)
|
4286 |
-
update.finish()
|
4287 |
-
}
|
4288 |
-
}
|
4289 |
-
|
4290 |
-
// Sync the actual display DOM structure with display.view, removing
|
4291 |
-
// nodes for lines that are no longer in view, and creating the ones
|
4292 |
-
// that are not there yet, and updating the ones that are out of
|
4293 |
-
// date.
|
4294 |
-
function patchDisplay(cm, updateNumbersFrom, dims) {
|
4295 |
-
var display = cm.display, lineNumbers = cm.options.lineNumbers
|
4296 |
-
var container = display.lineDiv, cur = container.firstChild
|
4297 |
-
|
4298 |
-
function rm(node) {
|
4299 |
-
var next = node.nextSibling
|
4300 |
-
// Works around a throw-scroll bug in OS X Webkit
|
4301 |
-
if (webkit && mac && cm.display.currentWheelTarget == node)
|
4302 |
-
{ node.style.display = "none" }
|
4303 |
-
else
|
4304 |
-
{ node.parentNode.removeChild(node) }
|
4305 |
-
return next
|
4306 |
-
}
|
4307 |
-
|
4308 |
-
var view = display.view, lineN = display.viewFrom
|
4309 |
-
// Loop over the elements in the view, syncing cur (the DOM nodes
|
4310 |
-
// in display.lineDiv) with the view as we go.
|
4311 |
-
for (var i = 0; i < view.length; i++) {
|
4312 |
-
var lineView = view[i]
|
4313 |
-
if (lineView.hidden) {
|
4314 |
-
} else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
|
4315 |
-
var node = buildLineElement(cm, lineView, lineN, dims)
|
4316 |
-
container.insertBefore(node, cur)
|
4317 |
-
} else { // Already drawn
|
4318 |
-
while (cur != lineView.node) { cur = rm(cur) }
|
4319 |
-
var updateNumber = lineNumbers && updateNumbersFrom != null &&
|
4320 |
-
updateNumbersFrom <= lineN && lineView.lineNumber
|
4321 |
-
if (lineView.changes) {
|
4322 |
-
if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false }
|
4323 |
-
updateLineForChanges(cm, lineView, lineN, dims)
|
4324 |
-
}
|
4325 |
-
if (updateNumber) {
|
4326 |
-
removeChildren(lineView.lineNumber)
|
4327 |
-
lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)))
|
4328 |
-
}
|
4329 |
-
cur = lineView.node.nextSibling
|
4330 |
-
}
|
4331 |
-
lineN += lineView.size
|
4332 |
-
}
|
4333 |
-
while (cur) { cur = rm(cur) }
|
4334 |
-
}
|
4335 |
-
|
4336 |
-
function updateGutterSpace(cm) {
|
4337 |
-
var width = cm.display.gutters.offsetWidth
|
4338 |
-
cm.display.sizer.style.marginLeft = width + "px"
|
4339 |
-
}
|
4340 |
-
|
4341 |
-
function setDocumentHeight(cm, measure) {
|
4342 |
-
cm.display.sizer.style.minHeight = measure.docHeight + "px"
|
4343 |
-
cm.display.heightForcer.style.top = measure.docHeight + "px"
|
4344 |
-
cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px"
|
4345 |
-
}
|
4346 |
-
|
4347 |
-
// Rebuild the gutter elements, ensure the margin to the left of the
|
4348 |
-
// code matches their width.
|
4349 |
-
function updateGutters(cm) {
|
4350 |
-
var gutters = cm.display.gutters, specs = cm.options.gutters
|
4351 |
-
removeChildren(gutters)
|
4352 |
-
var i = 0
|
4353 |
-
for (; i < specs.length; ++i) {
|
4354 |
-
var gutterClass = specs[i]
|
4355 |
-
var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass))
|
4356 |
-
if (gutterClass == "CodeMirror-linenumbers") {
|
4357 |
-
cm.display.lineGutter = gElt
|
4358 |
-
gElt.style.width = (cm.display.lineNumWidth || 1) + "px"
|
4359 |
-
}
|
4360 |
-
}
|
4361 |
-
gutters.style.display = i ? "" : "none"
|
4362 |
-
updateGutterSpace(cm)
|
4363 |
-
}
|
4364 |
-
|
4365 |
-
// Make sure the gutters options contains the element
|
4366 |
-
// "CodeMirror-linenumbers" when the lineNumbers option is true.
|
4367 |
-
function setGuttersForLineNumbers(options) {
|
4368 |
-
var found = indexOf(options.gutters, "CodeMirror-linenumbers")
|
4369 |
-
if (found == -1 && options.lineNumbers) {
|
4370 |
-
options.gutters = options.gutters.concat(["CodeMirror-linenumbers"])
|
4371 |
-
} else if (found > -1 && !options.lineNumbers) {
|
4372 |
-
options.gutters = options.gutters.slice(0)
|
4373 |
-
options.gutters.splice(found, 1)
|
4374 |
-
}
|
4375 |
-
}
|
4376 |
-
|
4377 |
-
var wheelSamples = 0;
|
4378 |
-
var wheelPixelsPerUnit = null;
|
4379 |
-
// Fill in a browser-detected starting value on browsers where we
|
4380 |
-
// know one. These don't have to be accurate -- the result of them
|
4381 |
-
// being wrong would just be a slight flicker on the first wheel
|
4382 |
-
// scroll (if it is large enough).
|
4383 |
-
if (ie) { wheelPixelsPerUnit = -.53 }
|
4384 |
-
else if (gecko) { wheelPixelsPerUnit = 15 }
|
4385 |
-
else if (chrome) { wheelPixelsPerUnit = -.7 }
|
4386 |
-
else if (safari) { wheelPixelsPerUnit = -1/3 }
|
4387 |
-
|
4388 |
-
function wheelEventDelta(e) {
|
4389 |
-
var dx = e.wheelDeltaX, dy = e.wheelDeltaY
|
4390 |
-
if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail }
|
4391 |
-
if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail }
|
4392 |
-
else if (dy == null) { dy = e.wheelDelta }
|
4393 |
-
return {x: dx, y: dy}
|
4394 |
-
}
|
4395 |
-
function wheelEventPixels(e) {
|
4396 |
-
var delta = wheelEventDelta(e)
|
4397 |
-
delta.x *= wheelPixelsPerUnit
|
4398 |
-
delta.y *= wheelPixelsPerUnit
|
4399 |
-
return delta
|
4400 |
-
}
|
4401 |
-
|
4402 |
-
function onScrollWheel(cm, e) {
|
4403 |
-
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y
|
4404 |
-
|
4405 |
-
var display = cm.display, scroll = display.scroller
|
4406 |
-
// Quit if there's nothing to scroll here
|
4407 |
-
var canScrollX = scroll.scrollWidth > scroll.clientWidth
|
4408 |
-
var canScrollY = scroll.scrollHeight > scroll.clientHeight
|
4409 |
-
if (!(dx && canScrollX || dy && canScrollY)) { return }
|
4410 |
-
|
4411 |
-
// Webkit browsers on OS X abort momentum scrolls when the target
|
4412 |
-
// of the scroll event is removed from the scrollable element.
|
4413 |
-
// This hack (see related code in patchDisplay) makes sure the
|
4414 |
-
// element is kept around.
|
4415 |
-
if (dy && mac && webkit) {
|
4416 |
-
outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
|
4417 |
-
for (var i = 0; i < view.length; i++) {
|
4418 |
-
if (view[i].node == cur) {
|
4419 |
-
cm.display.currentWheelTarget = cur
|
4420 |
-
break outer
|
4421 |
-
}
|
4422 |
-
}
|
4423 |
}
|
4424 |
}
|
4425 |
|
4426 |
-
|
4427 |
-
|
4428 |
-
|
4429 |
-
|
4430 |
-
|
4431 |
-
|
4432 |
-
|
4433 |
-
|
4434 |
-
{
|
4435 |
-
|
4436 |
-
// Only prevent default scrolling if vertical scrolling is
|
4437 |
-
// actually possible. Otherwise, it causes vertical scroll
|
4438 |
-
// jitter on OSX trackpads when deltaX is small and deltaY
|
4439 |
-
// is large (issue #3579)
|
4440 |
-
if (!dy || (dy && canScrollY))
|
4441 |
-
{ e_preventDefault(e) }
|
4442 |
-
display.wheelStartX = null // Abort measurement, if in progress
|
4443 |
-
return
|
4444 |
-
}
|
4445 |
-
|
4446 |
-
// 'Project' the visible viewport to cover the area that is being
|
4447 |
-
// scrolled into view (if we know enough to estimate it).
|
4448 |
-
if (dy && wheelPixelsPerUnit != null) {
|
4449 |
-
var pixels = dy * wheelPixelsPerUnit
|
4450 |
-
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight
|
4451 |
-
if (pixels < 0) { top = Math.max(0, top + pixels - 50) }
|
4452 |
-
else { bot = Math.min(cm.doc.height, bot + pixels + 50) }
|
4453 |
-
updateDisplaySimple(cm, {top: top, bottom: bot})
|
4454 |
-
}
|
4455 |
-
|
4456 |
-
if (wheelSamples < 20) {
|
4457 |
-
if (display.wheelStartX == null) {
|
4458 |
-
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop
|
4459 |
-
display.wheelDX = dx; display.wheelDY = dy
|
4460 |
-
setTimeout(function () {
|
4461 |
-
if (display.wheelStartX == null) { return }
|
4462 |
-
var movedX = scroll.scrollLeft - display.wheelStartX
|
4463 |
-
var movedY = scroll.scrollTop - display.wheelStartY
|
4464 |
-
var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
|
4465 |
-
(movedX && display.wheelDX && movedX / display.wheelDX)
|
4466 |
-
display.wheelStartX = display.wheelStartY = null
|
4467 |
-
if (!sample) { return }
|
4468 |
-
wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1)
|
4469 |
-
++wheelSamples
|
4470 |
-
}, 200)
|
4471 |
-
} else {
|
4472 |
-
display.wheelDX += dx; display.wheelDY += dy
|
4473 |
-
}
|
4474 |
}
|
4475 |
-
}
|
4476 |
|
4477 |
-
//
|
4478 |
-
|
4479 |
-
// (and non-touching) ranges, sorted, and an integer that indicates
|
4480 |
-
// which one is the primary selection (the one that's scrolled into
|
4481 |
-
// view, that getCursor returns, etc).
|
4482 |
-
var Selection = function(ranges, primIndex) {
|
4483 |
-
this.ranges = ranges
|
4484 |
-
this.primIndex = primIndex
|
4485 |
-
};
|
4486 |
|
4487 |
-
|
|
|
|
|
4488 |
|
4489 |
-
|
4490 |
-
|
4491 |
|
4492 |
-
|
4493 |
-
|
4494 |
-
|
4495 |
-
var
|
4496 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4497 |
}
|
4498 |
-
return true
|
4499 |
-
};
|
4500 |
|
4501 |
-
|
4502 |
-
|
|
|
|
|
|
|
|
|
4503 |
|
4504 |
-
|
4505 |
-
for (var i = 0; i < this.ranges.length; i++)
|
4506 |
-
{ out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)) }
|
4507 |
-
return new Selection(out, this.primIndex)
|
4508 |
-
};
|
4509 |
|
4510 |
-
|
4511 |
-
var
|
|
|
|
|
|
|
4512 |
|
4513 |
-
|
4514 |
-
|
4515 |
-
|
4516 |
-
|
|
|
4517 |
|
4518 |
-
|
4519 |
-
var this$1 = this;
|
4520 |
|
4521 |
-
|
4522 |
-
|
4523 |
-
|
4524 |
-
|
4525 |
-
{ return i }
|
4526 |
-
}
|
4527 |
-
return -1
|
4528 |
-
};
|
4529 |
-
|
4530 |
-
var Range = function(anchor, head) {
|
4531 |
-
this.anchor = anchor; this.head = head
|
4532 |
-
};
|
4533 |
-
|
4534 |
-
Range.prototype.from = function () { return minPos(this.anchor, this.head) };
|
4535 |
-
Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
|
4536 |
-
Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
|
4537 |
-
|
4538 |
-
// Take an unsorted, potentially overlapping set of ranges, and
|
4539 |
-
// build a selection out of it. 'Consumes' ranges array (modifying
|
4540 |
-
// it).
|
4541 |
-
function normalizeSelection(ranges, primIndex) {
|
4542 |
-
var prim = ranges[primIndex]
|
4543 |
-
ranges.sort(function (a, b) { return cmp(a.from(), b.from()); })
|
4544 |
-
primIndex = indexOf(ranges, prim)
|
4545 |
-
for (var i = 1; i < ranges.length; i++) {
|
4546 |
-
var cur = ranges[i], prev = ranges[i - 1]
|
4547 |
-
if (cmp(prev.to(), cur.from()) >= 0) {
|
4548 |
-
var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to())
|
4549 |
-
var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head
|
4550 |
-
if (i <= primIndex) { --primIndex }
|
4551 |
-
ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to))
|
4552 |
-
}
|
4553 |
-
}
|
4554 |
-
return new Selection(ranges, primIndex)
|
4555 |
-
}
|
4556 |
-
|
4557 |
-
function simpleSelection(anchor, head) {
|
4558 |
-
return new Selection([new Range(anchor, head || anchor)], 0)
|
4559 |
-
}
|
4560 |
-
|
4561 |
-
// Compute the position of the end of a change (its 'to' property
|
4562 |
-
// refers to the pre-change end).
|
4563 |
-
function changeEnd(change) {
|
4564 |
-
if (!change.text) { return change.to }
|
4565 |
-
return Pos(change.from.line + change.text.length - 1,
|
4566 |
-
lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
|
4567 |
-
}
|
4568 |
-
|
4569 |
-
// Adjust a position to refer to the post-change position of the
|
4570 |
-
// same text, or the end of the change if the change covers it.
|
4571 |
-
function adjustForChange(pos, change) {
|
4572 |
-
if (cmp(pos, change.from) < 0) { return pos }
|
4573 |
-
if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
|
4574 |
-
|
4575 |
-
var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch
|
4576 |
-
if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch }
|
4577 |
-
return Pos(line, ch)
|
4578 |
-
}
|
4579 |
-
|
4580 |
-
function computeSelAfterChange(doc, change) {
|
4581 |
-
var out = []
|
4582 |
-
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
4583 |
-
var range = doc.sel.ranges[i]
|
4584 |
-
out.push(new Range(adjustForChange(range.anchor, change),
|
4585 |
-
adjustForChange(range.head, change)))
|
4586 |
-
}
|
4587 |
-
return normalizeSelection(out, doc.sel.primIndex)
|
4588 |
-
}
|
4589 |
-
|
4590 |
-
function offsetPos(pos, old, nw) {
|
4591 |
-
if (pos.line == old.line)
|
4592 |
-
{ return Pos(nw.line, pos.ch - old.ch + nw.ch) }
|
4593 |
-
else
|
4594 |
-
{ return Pos(nw.line + (pos.line - old.line), pos.ch) }
|
4595 |
-
}
|
4596 |
-
|
4597 |
-
// Used by replaceSelections to allow moving the selection to the
|
4598 |
-
// start or around the replaced test. Hint may be "start" or "around".
|
4599 |
-
function computeReplacedSel(doc, changes, hint) {
|
4600 |
-
var out = []
|
4601 |
-
var oldPrev = Pos(doc.first, 0), newPrev = oldPrev
|
4602 |
-
for (var i = 0; i < changes.length; i++) {
|
4603 |
-
var change = changes[i]
|
4604 |
-
var from = offsetPos(change.from, oldPrev, newPrev)
|
4605 |
-
var to = offsetPos(changeEnd(change), oldPrev, newPrev)
|
4606 |
-
oldPrev = change.to
|
4607 |
-
newPrev = to
|
4608 |
-
if (hint == "around") {
|
4609 |
-
var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0
|
4610 |
-
out[i] = new Range(inv ? to : from, inv ? from : to)
|
4611 |
} else {
|
4612 |
-
|
4613 |
-
|
4614 |
-
|
4615 |
-
|
4616 |
-
|
4617 |
-
|
4618 |
-
// Used to get the editor into a consistent state again when options change.
|
4619 |
-
|
4620 |
-
function loadMode(cm) {
|
4621 |
-
cm.doc.mode = getMode(cm.options, cm.doc.modeOption)
|
4622 |
-
resetModeState(cm)
|
4623 |
-
}
|
4624 |
-
|
4625 |
-
function resetModeState(cm) {
|
4626 |
-
cm.doc.iter(function (line) {
|
4627 |
-
if (line.stateAfter) { line.stateAfter = null }
|
4628 |
-
if (line.styles) { line.styles = null }
|
4629 |
-
})
|
4630 |
-
cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first
|
4631 |
-
startWorker(cm, 100)
|
4632 |
-
cm.state.modeGen++
|
4633 |
-
if (cm.curOp) { regChange(cm) }
|
4634 |
-
}
|
4635 |
-
|
4636 |
-
// DOCUMENT DATA STRUCTURE
|
4637 |
-
|
4638 |
-
// By default, updates that start and end at the beginning of a line
|
4639 |
-
// are treated specially, in order to make the association of line
|
4640 |
-
// widgets and marker elements with the text behave more intuitive.
|
4641 |
-
function isWholeLineUpdate(doc, change) {
|
4642 |
-
return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
|
4643 |
-
(!doc.cm || doc.cm.options.wholeLineUpdateBefore)
|
4644 |
-
}
|
4645 |
-
|
4646 |
-
// Perform a change on the document data structure.
|
4647 |
-
function updateDoc(doc, change, markedSpans, estimateHeight) {
|
4648 |
-
function spansFor(n) {return markedSpans ? markedSpans[n] : null}
|
4649 |
-
function update(line, text, spans) {
|
4650 |
-
updateLine(line, text, spans, estimateHeight)
|
4651 |
-
signalLater(line, "change", line, change)
|
4652 |
-
}
|
4653 |
-
function linesFor(start, end) {
|
4654 |
-
var result = []
|
4655 |
-
for (var i = start; i < end; ++i)
|
4656 |
-
{ result.push(new Line(text[i], spansFor(i), estimateHeight)) }
|
4657 |
-
return result
|
4658 |
}
|
4659 |
|
4660 |
-
var
|
4661 |
-
|
4662 |
-
|
4663 |
-
|
4664 |
-
|
4665 |
-
|
4666 |
-
|
4667 |
-
|
4668 |
-
|
4669 |
-
// This is a whole-line replace. Treated specially to make
|
4670 |
-
// sure line objects move the way they are supposed to.
|
4671 |
-
var added = linesFor(0, text.length - 1)
|
4672 |
-
update(lastLine, lastLine.text, lastSpans)
|
4673 |
-
if (nlines) { doc.remove(from.line, nlines) }
|
4674 |
-
if (added.length) { doc.insert(from.line, added) }
|
4675 |
-
} else if (firstLine == lastLine) {
|
4676 |
-
if (text.length == 1) {
|
4677 |
-
update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans)
|
4678 |
-
} else {
|
4679 |
-
var added$1 = linesFor(1, text.length - 1)
|
4680 |
-
added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight))
|
4681 |
-
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
|
4682 |
-
doc.insert(from.line + 1, added$1)
|
4683 |
-
}
|
4684 |
-
} else if (text.length == 1) {
|
4685 |
-
update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0))
|
4686 |
-
doc.remove(from.line + 1, nlines)
|
4687 |
-
} else {
|
4688 |
-
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0))
|
4689 |
-
update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans)
|
4690 |
-
var added$2 = linesFor(1, text.length - 1)
|
4691 |
-
if (nlines > 1) { doc.remove(from.line + 1, nlines - 1) }
|
4692 |
-
doc.insert(from.line + 1, added$2)
|
4693 |
-
}
|
4694 |
-
|
4695 |
-
signalLater(doc, "change", doc, change)
|
4696 |
-
}
|
4697 |
-
|
4698 |
-
// Call f for all linked documents.
|
4699 |
-
function linkedDocs(doc, f, sharedHistOnly) {
|
4700 |
-
function propagate(doc, skip, sharedHist) {
|
4701 |
-
if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
|
4702 |
-
var rel = doc.linked[i]
|
4703 |
-
if (rel.doc == skip) { continue }
|
4704 |
-
var shared = sharedHist && rel.sharedHist
|
4705 |
-
if (sharedHistOnly && !shared) { continue }
|
4706 |
-
f(rel.doc, shared)
|
4707 |
-
propagate(rel.doc, doc, shared)
|
4708 |
-
} }
|
4709 |
}
|
4710 |
-
propagate(doc, null, true)
|
4711 |
-
}
|
4712 |
-
|
4713 |
-
// Attach a document to an editor.
|
4714 |
-
function attachDoc(cm, doc) {
|
4715 |
-
if (doc.cm) { throw new Error("This document is already in use.") }
|
4716 |
-
cm.doc = doc
|
4717 |
-
doc.cm = cm
|
4718 |
-
estimateLineHeights(cm)
|
4719 |
-
loadMode(cm)
|
4720 |
-
setDirectionClass(cm)
|
4721 |
-
if (!cm.options.lineWrapping) { findMaxLine(cm) }
|
4722 |
-
cm.options.mode = doc.modeOption
|
4723 |
-
regChange(cm)
|
4724 |
-
}
|
4725 |
-
|
4726 |
-
function setDirectionClass(cm) {
|
4727 |
-
;(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl")
|
4728 |
-
}
|
4729 |
-
|
4730 |
-
function directionChanged(cm) {
|
4731 |
-
runInOp(cm, function () {
|
4732 |
-
setDirectionClass(cm)
|
4733 |
-
regChange(cm)
|
4734 |
-
})
|
4735 |
-
}
|
4736 |
-
|
4737 |
-
function History(startGen) {
|
4738 |
-
// Arrays of change events and selections. Doing something adds an
|
4739 |
-
// event to done and clears undo. Undoing moves events from done
|
4740 |
-
// to undone, redoing moves them in the other direction.
|
4741 |
-
this.done = []; this.undone = []
|
4742 |
-
this.undoDepth = Infinity
|
4743 |
-
// Used to track when changes can be merged into a single undo
|
4744 |
-
// event
|
4745 |
-
this.lastModTime = this.lastSelTime = 0
|
4746 |
-
this.lastOp = this.lastSelOp = null
|
4747 |
-
this.lastOrigin = this.lastSelOrigin = null
|
4748 |
-
// Used by the isClean() method
|
4749 |
-
this.generation = this.maxGeneration = startGen || 1
|
4750 |
-
}
|
4751 |
-
|
4752 |
-
// Create a history change event from an updateDoc-style change
|
4753 |
-
// object.
|
4754 |
-
function historyChangeFromChange(doc, change) {
|
4755 |
-
var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)}
|
4756 |
-
attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1)
|
4757 |
-
linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true)
|
4758 |
-
return histChange
|
4759 |
-
}
|
4760 |
-
|
4761 |
-
// Pop all selection events off the end of a history array. Stop at
|
4762 |
-
// a change event.
|
4763 |
-
function clearSelectionEvents(array) {
|
4764 |
-
while (array.length) {
|
4765 |
-
var last = lst(array)
|
4766 |
-
if (last.ranges) { array.pop() }
|
4767 |
-
else { break }
|
4768 |
-
}
|
4769 |
-
}
|
4770 |
-
|
4771 |
-
// Find the top change event in the history. Pop off selection
|
4772 |
-
// events that are in the way.
|
4773 |
-
function lastChangeEvent(hist, force) {
|
4774 |
-
if (force) {
|
4775 |
-
clearSelectionEvents(hist.done)
|
4776 |
-
return lst(hist.done)
|
4777 |
-
} else if (hist.done.length && !lst(hist.done).ranges) {
|
4778 |
-
return lst(hist.done)
|
4779 |
-
} else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
|
4780 |
-
hist.done.pop()
|
4781 |
-
return lst(hist.done)
|
4782 |
-
}
|
4783 |
-
}
|
4784 |
-
|
4785 |
-
// Register a change in the history. Merges changes that are within
|
4786 |
-
// a single operation, or are close together with an origin that
|
4787 |
-
// allows merging (starting with "+") into a single event.
|
4788 |
-
function addChangeToHistory(doc, change, selAfter, opId) {
|
4789 |
-
var hist = doc.history
|
4790 |
-
hist.undone.length = 0
|
4791 |
-
var time = +new Date, cur
|
4792 |
-
var last
|
4793 |
-
|
4794 |
-
if ((hist.lastOp == opId ||
|
4795 |
-
hist.lastOrigin == change.origin && change.origin &&
|
4796 |
-
((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
|
4797 |
-
change.origin.charAt(0) == "*")) &&
|
4798 |
-
(cur = lastChangeEvent(hist, hist.lastOp == opId))) {
|
4799 |
-
// Merge this change into the last event
|
4800 |
-
last = lst(cur.changes)
|
4801 |
-
if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
|
4802 |
-
// Optimized case for simple insertion -- don't want to add
|
4803 |
-
// new changesets for every character typed
|
4804 |
-
last.to = changeEnd(change)
|
4805 |
-
} else {
|
4806 |
-
// Add new sub-event
|
4807 |
-
cur.changes.push(historyChangeFromChange(doc, change))
|
4808 |
-
}
|
4809 |
-
} else {
|
4810 |
-
// Can not be merged, start a new event.
|
4811 |
-
var before = lst(hist.done)
|
4812 |
-
if (!before || !before.ranges)
|
4813 |
-
{ pushSelectionToHistory(doc.sel, hist.done) }
|
4814 |
-
cur = {changes: [historyChangeFromChange(doc, change)],
|
4815 |
-
generation: hist.generation}
|
4816 |
-
hist.done.push(cur)
|
4817 |
-
while (hist.done.length > hist.undoDepth) {
|
4818 |
-
hist.done.shift()
|
4819 |
-
if (!hist.done[0].ranges) { hist.done.shift() }
|
4820 |
-
}
|
4821 |
-
}
|
4822 |
-
hist.done.push(selAfter)
|
4823 |
-
hist.generation = ++hist.maxGeneration
|
4824 |
-
hist.lastModTime = hist.lastSelTime = time
|
4825 |
-
hist.lastOp = hist.lastSelOp = opId
|
4826 |
-
hist.lastOrigin = hist.lastSelOrigin = change.origin
|
4827 |
-
|
4828 |
-
if (!last) { signal(doc, "historyAdded") }
|
4829 |
-
}
|
4830 |
-
|
4831 |
-
function selectionEventCanBeMerged(doc, origin, prev, sel) {
|
4832 |
-
var ch = origin.charAt(0)
|
4833 |
-
return ch == "*" ||
|
4834 |
-
ch == "+" &&
|
4835 |
-
prev.ranges.length == sel.ranges.length &&
|
4836 |
-
prev.somethingSelected() == sel.somethingSelected() &&
|
4837 |
-
new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
|
4838 |
-
}
|
4839 |
-
|
4840 |
-
// Called whenever the selection changes, sets the new selection as
|
4841 |
-
// the pending selection in the history, and pushes the old pending
|
4842 |
-
// selection into the 'done' array when it was significantly
|
4843 |
-
// different (in number of selected ranges, emptiness, or time).
|
4844 |
-
function addSelectionToHistory(doc, sel, opId, options) {
|
4845 |
-
var hist = doc.history, origin = options && options.origin
|
4846 |
-
|
4847 |
-
// A new event is started when the previous origin does not match
|
4848 |
-
// the current, or the origins don't allow matching. Origins
|
4849 |
-
// starting with * are always merged, those starting with + are
|
4850 |
-
// merged when similar and close together in time.
|
4851 |
-
if (opId == hist.lastSelOp ||
|
4852 |
-
(origin && hist.lastSelOrigin == origin &&
|
4853 |
-
(hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
|
4854 |
-
selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
|
4855 |
-
{ hist.done[hist.done.length - 1] = sel }
|
4856 |
-
else
|
4857 |
-
{ pushSelectionToHistory(sel, hist.done) }
|
4858 |
-
|
4859 |
-
hist.lastSelTime = +new Date
|
4860 |
-
hist.lastSelOrigin = origin
|
4861 |
-
hist.lastSelOp = opId
|
4862 |
-
if (options && options.clearRedo !== false)
|
4863 |
-
{ clearSelectionEvents(hist.undone) }
|
4864 |
-
}
|
4865 |
-
|
4866 |
-
function pushSelectionToHistory(sel, dest) {
|
4867 |
-
var top = lst(dest)
|
4868 |
-
if (!(top && top.ranges && top.equals(sel)))
|
4869 |
-
{ dest.push(sel) }
|
4870 |
-
}
|
4871 |
-
|
4872 |
-
// Used to store marked span information in the history.
|
4873 |
-
function attachLocalSpans(doc, change, from, to) {
|
4874 |
-
var existing = change["spans_" + doc.id], n = 0
|
4875 |
-
doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
|
4876 |
-
if (line.markedSpans)
|
4877 |
-
{ (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans }
|
4878 |
-
++n
|
4879 |
-
})
|
4880 |
-
}
|
4881 |
-
|
4882 |
-
// When un/re-doing restores text containing marked spans, those
|
4883 |
-
// that have been explicitly cleared should not be restored.
|
4884 |
-
function removeClearedSpans(spans) {
|
4885 |
-
if (!spans) { return null }
|
4886 |
-
var out
|
4887 |
-
for (var i = 0; i < spans.length; ++i) {
|
4888 |
-
if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i) } }
|
4889 |
-
else if (out) { out.push(spans[i]) }
|
4890 |
-
}
|
4891 |
-
return !out ? spans : out.length ? out : null
|
4892 |
-
}
|
4893 |
-
|
4894 |
-
// Retrieve and filter the old marked spans stored in a change event.
|
4895 |
-
function getOldSpans(doc, change) {
|
4896 |
-
var found = change["spans_" + doc.id]
|
4897 |
-
if (!found) { return null }
|
4898 |
-
var nw = []
|
4899 |
-
for (var i = 0; i < change.text.length; ++i)
|
4900 |
-
{ nw.push(removeClearedSpans(found[i])) }
|
4901 |
-
return nw
|
4902 |
-
}
|
4903 |
-
|
4904 |
-
// Used for un/re-doing changes from the history. Combines the
|
4905 |
-
// result of computing the existing spans with the set of spans that
|
4906 |
-
// existed in the history (so that deleting around a span and then
|
4907 |
-
// undoing brings back the span).
|
4908 |
-
function mergeOldSpans(doc, change) {
|
4909 |
-
var old = getOldSpans(doc, change)
|
4910 |
-
var stretched = stretchSpansOverChange(doc, change)
|
4911 |
-
if (!old) { return stretched }
|
4912 |
-
if (!stretched) { return old }
|
4913 |
-
|
4914 |
-
for (var i = 0; i < old.length; ++i) {
|
4915 |
-
var oldCur = old[i], stretchCur = stretched[i]
|
4916 |
-
if (oldCur && stretchCur) {
|
4917 |
-
spans: for (var j = 0; j < stretchCur.length; ++j) {
|
4918 |
-
var span = stretchCur[j]
|
4919 |
-
for (var k = 0; k < oldCur.length; ++k)
|
4920 |
-
{ if (oldCur[k].marker == span.marker) { continue spans } }
|
4921 |
-
oldCur.push(span)
|
4922 |
-
}
|
4923 |
-
} else if (stretchCur) {
|
4924 |
-
old[i] = stretchCur
|
4925 |
-
}
|
4926 |
-
}
|
4927 |
-
return old
|
4928 |
-
}
|
4929 |
-
|
4930 |
-
// Used both to provide a JSON-safe object in .getHistory, and, when
|
4931 |
-
// detaching a document, to split the history in two
|
4932 |
-
function copyHistoryArray(events, newGroup, instantiateSel) {
|
4933 |
-
var copy = []
|
4934 |
-
for (var i = 0; i < events.length; ++i) {
|
4935 |
-
var event = events[i]
|
4936 |
-
if (event.ranges) {
|
4937 |
-
copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event)
|
4938 |
-
continue
|
4939 |
-
}
|
4940 |
-
var changes = event.changes, newChanges = []
|
4941 |
-
copy.push({changes: newChanges})
|
4942 |
-
for (var j = 0; j < changes.length; ++j) {
|
4943 |
-
var change = changes[j], m = (void 0)
|
4944 |
-
newChanges.push({from: change.from, to: change.to, text: change.text})
|
4945 |
-
if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
|
4946 |
-
if (indexOf(newGroup, Number(m[1])) > -1) {
|
4947 |
-
lst(newChanges)[prop] = change[prop]
|
4948 |
-
delete change[prop]
|
4949 |
-
}
|
4950 |
-
} } }
|
4951 |
-
}
|
4952 |
-
}
|
4953 |
-
return copy
|
4954 |
-
}
|
4955 |
-
|
4956 |
-
// The 'scroll' parameter given to many of these indicated whether
|
4957 |
-
// the new cursor position should be scrolled into view after
|
4958 |
-
// modifying the selection.
|
4959 |
-
|
4960 |
-
// If shift is held or the extend flag is set, extends a range to
|
4961 |
-
// include a given position (and optionally a second position).
|
4962 |
-
// Otherwise, simply returns the range between the given positions.
|
4963 |
-
// Used for cursor motion and such.
|
4964 |
-
function extendRange(range, head, other, extend) {
|
4965 |
-
if (extend) {
|
4966 |
-
var anchor = range.anchor
|
4967 |
-
if (other) {
|
4968 |
-
var posBefore = cmp(head, anchor) < 0
|
4969 |
-
if (posBefore != (cmp(other, anchor) < 0)) {
|
4970 |
-
anchor = head
|
4971 |
-
head = other
|
4972 |
-
} else if (posBefore != (cmp(head, other) < 0)) {
|
4973 |
-
head = other
|
4974 |
-
}
|
4975 |
-
}
|
4976 |
-
return new Range(anchor, head)
|
4977 |
-
} else {
|
4978 |
-
return new Range(other || head, head)
|
4979 |
-
}
|
4980 |
-
}
|
4981 |
-
|
4982 |
-
// Extend the primary selection range, discard the rest.
|
4983 |
-
function extendSelection(doc, head, other, options, extend) {
|
4984 |
-
if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend) }
|
4985 |
-
setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options)
|
4986 |
-
}
|
4987 |
-
|
4988 |
-
// Extend all selections (pos is an array of selections with length
|
4989 |
-
// equal the number of selections)
|
4990 |
-
function extendSelections(doc, heads, options) {
|
4991 |
-
var out = []
|
4992 |
-
var extend = doc.cm && (doc.cm.display.shift || doc.extend)
|
4993 |
-
for (var i = 0; i < doc.sel.ranges.length; i++)
|
4994 |
-
{ out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend) }
|
4995 |
-
var newSel = normalizeSelection(out, doc.sel.primIndex)
|
4996 |
-
setSelection(doc, newSel, options)
|
4997 |
-
}
|
4998 |
-
|
4999 |
-
// Updates a single range in the selection.
|
5000 |
-
function replaceOneSelection(doc, i, range, options) {
|
5001 |
-
var ranges = doc.sel.ranges.slice(0)
|
5002 |
-
ranges[i] = range
|
5003 |
-
setSelection(doc, normalizeSelection(ranges, doc.sel.primIndex), options)
|
5004 |
-
}
|
5005 |
-
|
5006 |
-
// Reset the selection to a single range.
|
5007 |
-
function setSimpleSelection(doc, anchor, head, options) {
|
5008 |
-
setSelection(doc, simpleSelection(anchor, head), options)
|
5009 |
-
}
|
5010 |
-
|
5011 |
-
// Give beforeSelectionChange handlers a change to influence a
|
5012 |
-
// selection update.
|
5013 |
-
function filterSelectionChange(doc, sel, options) {
|
5014 |
-
var obj = {
|
5015 |
-
ranges: sel.ranges,
|
5016 |
-
update: function(ranges) {
|
5017 |
-
var this$1 = this;
|
5018 |
|
5019 |
-
|
5020 |
-
|
5021 |
-
|
5022 |
-
clipPos(doc, ranges[i].head)) }
|
5023 |
-
},
|
5024 |
-
origin: options && options.origin
|
5025 |
-
}
|
5026 |
-
signal(doc, "beforeSelectionChange", doc, obj)
|
5027 |
-
if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj) }
|
5028 |
-
if (obj.ranges != sel.ranges) { return normalizeSelection(obj.ranges, obj.ranges.length - 1) }
|
5029 |
-
else { return sel }
|
5030 |
-
}
|
5031 |
-
|
5032 |
-
function setSelectionReplaceHistory(doc, sel, options) {
|
5033 |
-
var done = doc.history.done, last = lst(done)
|
5034 |
-
if (last && last.ranges) {
|
5035 |
-
done[done.length - 1] = sel
|
5036 |
-
setSelectionNoUndo(doc, sel, options)
|
5037 |
-
} else {
|
5038 |
-
setSelection(doc, sel, options)
|
5039 |
-
}
|
5040 |
-
}
|
5041 |
-
|
5042 |
-
// Set a new selection.
|
5043 |
-
function setSelection(doc, sel, options) {
|
5044 |
-
setSelectionNoUndo(doc, sel, options)
|
5045 |
-
addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options)
|
5046 |
-
}
|
5047 |
-
|
5048 |
-
function setSelectionNoUndo(doc, sel, options) {
|
5049 |
-
if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
|
5050 |
-
{ sel = filterSelectionChange(doc, sel, options) }
|
5051 |
-
|
5052 |
-
var bias = options && options.bias ||
|
5053 |
-
(cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1)
|
5054 |
-
setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true))
|
5055 |
-
|
5056 |
-
if (!(options && options.scroll === false) && doc.cm)
|
5057 |
-
{ ensureCursorVisible(doc.cm) }
|
5058 |
-
}
|
5059 |
-
|
5060 |
-
function setSelectionInner(doc, sel) {
|
5061 |
-
if (sel.equals(doc.sel)) { return }
|
5062 |
-
|
5063 |
-
doc.sel = sel
|
5064 |
-
|
5065 |
-
if (doc.cm) {
|
5066 |
-
doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true
|
5067 |
-
signalCursorActivity(doc.cm)
|
5068 |
-
}
|
5069 |
-
signalLater(doc, "cursorActivity", doc)
|
5070 |
-
}
|
5071 |
-
|
5072 |
-
// Verify that the selection does not partially select any atomic
|
5073 |
-
// marked ranges.
|
5074 |
-
function reCheckSelection(doc) {
|
5075 |
-
setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false))
|
5076 |
-
}
|
5077 |
-
|
5078 |
-
// Return a selection that does not partially select any atomic
|
5079 |
-
// ranges.
|
5080 |
-
function skipAtomicInSelection(doc, sel, bias, mayClear) {
|
5081 |
-
var out
|
5082 |
-
for (var i = 0; i < sel.ranges.length; i++) {
|
5083 |
-
var range = sel.ranges[i]
|
5084 |
-
var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i]
|
5085 |
-
var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear)
|
5086 |
-
var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear)
|
5087 |
-
if (out || newAnchor != range.anchor || newHead != range.head) {
|
5088 |
-
if (!out) { out = sel.ranges.slice(0, i) }
|
5089 |
-
out[i] = new Range(newAnchor, newHead)
|
5090 |
-
}
|
5091 |
-
}
|
5092 |
-
return out ? normalizeSelection(out, sel.primIndex) : sel
|
5093 |
-
}
|
5094 |
-
|
5095 |
-
function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
|
5096 |
-
var line = getLine(doc, pos.line)
|
5097 |
-
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
5098 |
-
var sp = line.markedSpans[i], m = sp.marker
|
5099 |
-
if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
|
5100 |
-
(sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
|
5101 |
-
if (mayClear) {
|
5102 |
-
signal(m, "beforeCursorEnter")
|
5103 |
-
if (m.explicitlyCleared) {
|
5104 |
-
if (!line.markedSpans) { break }
|
5105 |
-
else {--i; continue}
|
5106 |
-
}
|
5107 |
-
}
|
5108 |
-
if (!m.atomic) { continue }
|
5109 |
-
|
5110 |
-
if (oldPos) {
|
5111 |
-
var near = m.find(dir < 0 ? 1 : -1), diff = (void 0)
|
5112 |
-
if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
|
5113 |
-
{ near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null) }
|
5114 |
-
if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
|
5115 |
-
{ return skipAtomicInner(doc, near, pos, dir, mayClear) }
|
5116 |
-
}
|
5117 |
-
|
5118 |
-
var far = m.find(dir < 0 ? -1 : 1)
|
5119 |
-
if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
|
5120 |
-
{ far = movePos(doc, far, dir, far.line == pos.line ? line : null) }
|
5121 |
-
return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
|
5122 |
-
}
|
5123 |
-
} }
|
5124 |
-
return pos
|
5125 |
-
}
|
5126 |
-
|
5127 |
-
// Ensure a given position is not inside an atomic range.
|
5128 |
-
function skipAtomic(doc, pos, oldPos, bias, mayClear) {
|
5129 |
-
var dir = bias || 1
|
5130 |
-
var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
|
5131 |
-
(!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
|
5132 |
-
skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
|
5133 |
-
(!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true))
|
5134 |
-
if (!found) {
|
5135 |
-
doc.cantEdit = true
|
5136 |
-
return Pos(doc.first, 0)
|
5137 |
-
}
|
5138 |
-
return found
|
5139 |
-
}
|
5140 |
-
|
5141 |
-
function movePos(doc, pos, dir, line) {
|
5142 |
-
if (dir < 0 && pos.ch == 0) {
|
5143 |
-
if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
|
5144 |
-
else { return null }
|
5145 |
-
} else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
|
5146 |
-
if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
|
5147 |
-
else { return null }
|
5148 |
-
} else {
|
5149 |
-
return new Pos(pos.line, pos.ch + dir)
|
5150 |
-
}
|
5151 |
-
}
|
5152 |
-
|
5153 |
-
function selectAll(cm) {
|
5154 |
-
cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll)
|
5155 |
-
}
|
5156 |
-
|
5157 |
-
// UPDATING
|
5158 |
-
|
5159 |
-
// Allow "beforeChange" event handlers to influence a change
|
5160 |
-
function filterChange(doc, change, update) {
|
5161 |
-
var obj = {
|
5162 |
-
canceled: false,
|
5163 |
-
from: change.from,
|
5164 |
-
to: change.to,
|
5165 |
-
text: change.text,
|
5166 |
-
origin: change.origin,
|
5167 |
-
cancel: function () { return obj.canceled = true; }
|
5168 |
-
}
|
5169 |
-
if (update) { obj.update = function (from, to, text, origin) {
|
5170 |
-
if (from) { obj.from = clipPos(doc, from) }
|
5171 |
-
if (to) { obj.to = clipPos(doc, to) }
|
5172 |
-
if (text) { obj.text = text }
|
5173 |
-
if (origin !== undefined) { obj.origin = origin }
|
5174 |
-
} }
|
5175 |
-
signal(doc, "beforeChange", doc, obj)
|
5176 |
-
if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj) }
|
5177 |
-
|
5178 |
-
if (obj.canceled) { return null }
|
5179 |
-
return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
|
5180 |
-
}
|
5181 |
-
|
5182 |
-
// Apply a change to a document, and add it to the document's
|
5183 |
-
// history, and propagating it to all linked documents.
|
5184 |
-
function makeChange(doc, change, ignoreReadOnly) {
|
5185 |
-
if (doc.cm) {
|
5186 |
-
if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
|
5187 |
-
if (doc.cm.state.suppressEdits) { return }
|
5188 |
-
}
|
5189 |
-
|
5190 |
-
if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
|
5191 |
-
change = filterChange(doc, change, true)
|
5192 |
-
if (!change) { return }
|
5193 |
-
}
|
5194 |
-
|
5195 |
-
// Possibly split or suppress the update based on the presence
|
5196 |
-
// of read-only spans in its range.
|
5197 |
-
var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to)
|
5198 |
-
if (split) {
|
5199 |
-
for (var i = split.length - 1; i >= 0; --i)
|
5200 |
-
{ makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}) }
|
5201 |
-
} else {
|
5202 |
-
makeChangeInner(doc, change)
|
5203 |
-
}
|
5204 |
-
}
|
5205 |
-
|
5206 |
-
function makeChangeInner(doc, change) {
|
5207 |
-
if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
|
5208 |
-
var selAfter = computeSelAfterChange(doc, change)
|
5209 |
-
addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN)
|
5210 |
-
|
5211 |
-
makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change))
|
5212 |
-
var rebased = []
|
5213 |
-
|
5214 |
-
linkedDocs(doc, function (doc, sharedHist) {
|
5215 |
-
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
5216 |
-
rebaseHist(doc.history, change)
|
5217 |
-
rebased.push(doc.history)
|
5218 |
-
}
|
5219 |
-
makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change))
|
5220 |
-
})
|
5221 |
-
}
|
5222 |
-
|
5223 |
-
// Revert a change stored in a document's history.
|
5224 |
-
function makeChangeFromHistory(doc, type, allowSelectionOnly) {
|
5225 |
-
var suppress = doc.cm && doc.cm.state.suppressEdits
|
5226 |
-
if (suppress && !allowSelectionOnly) { return }
|
5227 |
-
|
5228 |
-
var hist = doc.history, event, selAfter = doc.sel
|
5229 |
-
var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done
|
5230 |
-
|
5231 |
-
// Verify that there is a useable event (so that ctrl-z won't
|
5232 |
-
// needlessly clear selection events)
|
5233 |
-
var i = 0
|
5234 |
-
for (; i < source.length; i++) {
|
5235 |
-
event = source[i]
|
5236 |
-
if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
|
5237 |
-
{ break }
|
5238 |
-
}
|
5239 |
-
if (i == source.length) { return }
|
5240 |
-
hist.lastOrigin = hist.lastSelOrigin = null
|
5241 |
-
|
5242 |
-
for (;;) {
|
5243 |
-
event = source.pop()
|
5244 |
-
if (event.ranges) {
|
5245 |
-
pushSelectionToHistory(event, dest)
|
5246 |
-
if (allowSelectionOnly && !event.equals(doc.sel)) {
|
5247 |
-
setSelection(doc, event, {clearRedo: false})
|
5248 |
-
return
|
5249 |
-
}
|
5250 |
-
selAfter = event
|
5251 |
-
} else if (suppress) {
|
5252 |
-
source.push(event)
|
5253 |
-
return
|
5254 |
-
} else { break }
|
5255 |
}
|
5256 |
|
5257 |
-
//
|
5258 |
-
//
|
5259 |
-
|
5260 |
-
|
5261 |
-
|
5262 |
-
|
|
|
5263 |
|
5264 |
-
|
|
|
|
|
|
|
|
|
5265 |
|
5266 |
-
|
5267 |
-
|
5268 |
-
|
5269 |
-
|
5270 |
-
|
5271 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5272 |
}
|
5273 |
-
|
5274 |
-
|
5275 |
-
|
5276 |
-
|
5277 |
-
|
5278 |
-
|
5279 |
-
var
|
5280 |
-
|
5281 |
-
|
5282 |
-
|
5283 |
-
if (
|
5284 |
-
|
5285 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5286 |
}
|
5287 |
-
|
5288 |
-
|
5289 |
-
}
|
5290 |
|
5291 |
-
|
5292 |
-
|
5293 |
-
|
5294 |
-
|
5295 |
-
|
5296 |
-
|
5297 |
-
|
5298 |
-
|
5299 |
-
|
5300 |
-
|
5301 |
-
if (distance == 0) { return }
|
5302 |
-
doc.first += distance
|
5303 |
-
doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
|
5304 |
-
Pos(range.anchor.line + distance, range.anchor.ch),
|
5305 |
-
Pos(range.head.line + distance, range.head.ch)
|
5306 |
-
); }), doc.sel.primIndex)
|
5307 |
-
if (doc.cm) {
|
5308 |
-
regChange(doc.cm, doc.first, doc.first - distance, distance)
|
5309 |
-
for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
|
5310 |
-
{ regLineChange(doc.cm, l, "gutter") }
|
5311 |
-
}
|
5312 |
-
}
|
5313 |
-
|
5314 |
-
// More lower-level change function, handling only a single document
|
5315 |
-
// (not linked ones).
|
5316 |
-
function makeChangeSingleDoc(doc, change, selAfter, spans) {
|
5317 |
-
if (doc.cm && !doc.cm.curOp)
|
5318 |
-
{ return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
|
5319 |
-
|
5320 |
-
if (change.to.line < doc.first) {
|
5321 |
-
shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line))
|
5322 |
-
return
|
5323 |
-
}
|
5324 |
-
if (change.from.line > doc.lastLine()) { return }
|
5325 |
-
|
5326 |
-
// Clip the change to the size of this doc
|
5327 |
-
if (change.from.line < doc.first) {
|
5328 |
-
var shift = change.text.length - 1 - (doc.first - change.from.line)
|
5329 |
-
shiftDoc(doc, shift)
|
5330 |
-
change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
|
5331 |
-
text: [lst(change.text)], origin: change.origin}
|
5332 |
-
}
|
5333 |
-
var last = doc.lastLine()
|
5334 |
-
if (change.to.line > last) {
|
5335 |
-
change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
|
5336 |
-
text: [change.text[0]], origin: change.origin}
|
5337 |
-
}
|
5338 |
-
|
5339 |
-
change.removed = getBetween(doc, change.from, change.to)
|
5340 |
-
|
5341 |
-
if (!selAfter) { selAfter = computeSelAfterChange(doc, change) }
|
5342 |
-
if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans) }
|
5343 |
-
else { updateDoc(doc, change, spans) }
|
5344 |
-
setSelectionNoUndo(doc, selAfter, sel_dontScroll)
|
5345 |
-
}
|
5346 |
-
|
5347 |
-
// Handle the interaction of a change to a document with the editor
|
5348 |
-
// that this document is part of.
|
5349 |
-
function makeChangeSingleDocInEditor(cm, change, spans) {
|
5350 |
-
var doc = cm.doc, display = cm.display, from = change.from, to = change.to
|
5351 |
-
|
5352 |
-
var recomputeMaxLength = false, checkWidthStart = from.line
|
5353 |
-
if (!cm.options.lineWrapping) {
|
5354 |
-
checkWidthStart = lineNo(visualLine(getLine(doc, from.line)))
|
5355 |
-
doc.iter(checkWidthStart, to.line + 1, function (line) {
|
5356 |
-
if (line == display.maxLine) {
|
5357 |
-
recomputeMaxLength = true
|
5358 |
-
return true
|
5359 |
}
|
5360 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5361 |
}
|
5362 |
|
5363 |
-
|
5364 |
-
|
|
|
|
|
|
|
5365 |
|
5366 |
-
|
|
|
|
|
5367 |
|
5368 |
-
|
5369 |
-
|
5370 |
-
|
5371 |
-
|
5372 |
-
display.maxLine = line
|
5373 |
-
display.maxLineLength = len
|
5374 |
-
display.maxLineChanged = true
|
5375 |
-
recomputeMaxLength = false
|
5376 |
-
}
|
5377 |
-
})
|
5378 |
-
if (recomputeMaxLength) { cm.curOp.updateMaxLine = true }
|
5379 |
}
|
5380 |
|
5381 |
-
|
5382 |
-
|
|
|
5383 |
|
5384 |
-
|
5385 |
-
// Remember that these lines changed, for updating the display
|
5386 |
-
if (change.full)
|
5387 |
-
{ regChange(cm) }
|
5388 |
-
else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
|
5389 |
-
{ regLineChange(cm, from.line, "text") }
|
5390 |
-
else
|
5391 |
-
{ regChange(cm, from.line, to.line + 1, lendiff) }
|
5392 |
|
5393 |
-
|
5394 |
-
|
5395 |
-
|
5396 |
-
|
5397 |
-
|
5398 |
-
|
5399 |
-
|
5400 |
-
|
5401 |
-
if (
|
5402 |
-
|
5403 |
-
|
5404 |
-
|
5405 |
-
}
|
5406 |
-
|
5407 |
-
|
5408 |
-
|
5409 |
-
|
5410 |
-
|
5411 |
-
|
5412 |
-
|
5413 |
-
|
5414 |
-
|
5415 |
-
|
5416 |
-
|
5417 |
-
function rebaseHistSelSingle(pos, from, to, diff) {
|
5418 |
-
if (to < pos.line) {
|
5419 |
-
pos.line += diff
|
5420 |
-
} else if (from < pos.line) {
|
5421 |
-
pos.line = from
|
5422 |
-
pos.ch = 0
|
5423 |
-
}
|
5424 |
-
}
|
5425 |
-
|
5426 |
-
// Tries to rebase an array of history events given a change in the
|
5427 |
-
// document. If the change touches the same lines as the event, the
|
5428 |
-
// event, and everything 'behind' it, is discarded. If the change is
|
5429 |
-
// before the event, the event's positions are updated. Uses a
|
5430 |
-
// copy-on-write scheme for the positions, to avoid having to
|
5431 |
-
// reallocate them all on every rebase, but also avoid problems with
|
5432 |
-
// shared position objects being unsafely updated.
|
5433 |
-
function rebaseHistArray(array, from, to, diff) {
|
5434 |
-
for (var i = 0; i < array.length; ++i) {
|
5435 |
-
var sub = array[i], ok = true
|
5436 |
-
if (sub.ranges) {
|
5437 |
-
if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true }
|
5438 |
-
for (var j = 0; j < sub.ranges.length; j++) {
|
5439 |
-
rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff)
|
5440 |
-
rebaseHistSelSingle(sub.ranges[j].head, from, to, diff)
|
5441 |
-
}
|
5442 |
-
continue
|
5443 |
-
}
|
5444 |
-
for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
|
5445 |
-
var cur = sub.changes[j$1]
|
5446 |
-
if (to < cur.from.line) {
|
5447 |
-
cur.from = Pos(cur.from.line + diff, cur.from.ch)
|
5448 |
-
cur.to = Pos(cur.to.line + diff, cur.to.ch)
|
5449 |
-
} else if (from <= cur.to.line) {
|
5450 |
-
ok = false
|
5451 |
-
break
|
5452 |
-
}
|
5453 |
-
}
|
5454 |
-
if (!ok) {
|
5455 |
-
array.splice(0, i + 1)
|
5456 |
-
i = 0
|
5457 |
-
}
|
5458 |
-
}
|
5459 |
-
}
|
5460 |
-
|
5461 |
-
function rebaseHist(hist, change) {
|
5462 |
-
var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1
|
5463 |
-
rebaseHistArray(hist.done, from, to, diff)
|
5464 |
-
rebaseHistArray(hist.undone, from, to, diff)
|
5465 |
-
}
|
5466 |
-
|
5467 |
-
// Utility for applying a change to a line by handle or number,
|
5468 |
-
// returning the number and optionally registering the line as
|
5469 |
-
// changed.
|
5470 |
-
function changeLine(doc, handle, changeType, op) {
|
5471 |
-
var no = handle, line = handle
|
5472 |
-
if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)) }
|
5473 |
-
else { no = lineNo(handle) }
|
5474 |
-
if (no == null) { return null }
|
5475 |
-
if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType) }
|
5476 |
-
return line
|
5477 |
-
}
|
5478 |
-
|
5479 |
-
// The document is represented as a BTree consisting of leaves, with
|
5480 |
-
// chunk of lines in them, and branches, with up to ten leaves or
|
5481 |
-
// other branch nodes below them. The top node is always a branch
|
5482 |
-
// node, and is the document object itself (meaning it has
|
5483 |
-
// additional methods and properties).
|
5484 |
-
//
|
5485 |
-
// All nodes have parent links. The tree is used both to go from
|
5486 |
-
// line numbers to line objects, and to go from objects to numbers.
|
5487 |
-
// It also indexes by height, and is used to convert between height
|
5488 |
-
// and line object, and to find the total height of the document.
|
5489 |
-
//
|
5490 |
-
// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
|
5491 |
|
5492 |
-
|
5493 |
-
var
|
5494 |
|
5495 |
-
|
5496 |
-
|
5497 |
-
var height = 0
|
5498 |
-
for (var i = 0; i < lines.length; ++i) {
|
5499 |
-
lines[i].parent = this$1
|
5500 |
-
height += lines[i].height
|
5501 |
}
|
5502 |
-
this.height = height
|
5503 |
-
}
|
5504 |
|
5505 |
-
|
5506 |
-
|
|
|
5507 |
|
5508 |
-
//
|
5509 |
-
removeInner: function removeInner(at, n) {
|
5510 |
-
var this$1 = this;
|
5511 |
|
5512 |
-
|
5513 |
-
|
5514 |
-
|
5515 |
-
|
5516 |
-
signalLater(line, "delete")
|
5517 |
-
}
|
5518 |
-
this.lines.splice(at, n)
|
5519 |
-
},
|
5520 |
|
5521 |
-
//
|
5522 |
-
|
5523 |
-
|
5524 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5525 |
|
5526 |
-
//
|
5527 |
-
|
5528 |
-
|
5529 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5530 |
|
5531 |
-
|
5532 |
-
|
5533 |
-
for (var i = 0; i <
|
5534 |
-
|
|
|
|
|
|
|
|
|
|
|
5535 |
|
5536 |
-
//
|
5537 |
-
|
5538 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5539 |
|
5540 |
-
|
5541 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5542 |
}
|
5543 |
-
}
|
5544 |
|
5545 |
-
|
5546 |
-
var this$1 = this;
|
5547 |
|
5548 |
-
|
5549 |
-
|
5550 |
-
|
5551 |
-
var
|
5552 |
-
|
5553 |
-
|
|
|
|
|
|
|
|
|
|
|
5554 |
}
|
5555 |
-
this.size = size
|
5556 |
-
this.height = height
|
5557 |
-
this.parent = null
|
5558 |
-
}
|
5559 |
|
5560 |
-
|
5561 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5562 |
|
5563 |
-
|
5564 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5565 |
|
5566 |
-
|
5567 |
-
|
5568 |
-
|
5569 |
-
|
5570 |
-
var
|
5571 |
-
|
5572 |
-
|
5573 |
-
|
5574 |
-
|
5575 |
-
|
5576 |
-
} else { at -= sz }
|
5577 |
-
}
|
5578 |
-
// If the result is smaller than 25 lines, ensure that it is a
|
5579 |
-
// single leaf node.
|
5580 |
-
if (this.size - n < 25 &&
|
5581 |
-
(this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
|
5582 |
-
var lines = []
|
5583 |
-
this.collapse(lines)
|
5584 |
-
this.children = [new LeafChunk(lines)]
|
5585 |
-
this.children[0].parent = this
|
5586 |
-
}
|
5587 |
-
},
|
5588 |
-
|
5589 |
-
collapse: function collapse(lines) {
|
5590 |
-
var this$1 = this;
|
5591 |
|
5592 |
-
|
5593 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5594 |
|
5595 |
-
|
5596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
5597 |
|
5598 |
-
|
5599 |
-
|
5600 |
-
|
5601 |
-
|
5602 |
-
|
5603 |
-
|
5604 |
-
|
5605 |
-
|
5606 |
-
|
5607 |
-
|
5608 |
-
|
5609 |
-
|
5610 |
-
|
5611 |
-
|
5612 |
-
|
5613 |
-
}
|
5614 |
-
child.lines = child.lines.slice(0, remaining)
|
5615 |
-
this$1.maybeSpill()
|
5616 |
}
|
5617 |
-
break
|
5618 |
}
|
5619 |
-
at -= sz
|
5620 |
-
}
|
5621 |
-
},
|
5622 |
|
5623 |
-
|
5624 |
-
|
5625 |
-
|
5626 |
-
|
5627 |
-
|
5628 |
-
var
|
5629 |
-
var
|
5630 |
-
|
5631 |
-
|
5632 |
-
|
5633 |
-
|
5634 |
-
|
5635 |
-
|
5636 |
-
|
5637 |
-
|
5638 |
-
|
5639 |
-
|
5640 |
-
|
5641 |
-
|
5642 |
-
|
5643 |
-
|
5644 |
-
|
5645 |
-
|
5646 |
-
|
5647 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5648 |
|
5649 |
-
|
5650 |
-
var child = this$1.children[i], sz = child.chunkSize()
|
5651 |
-
if (at < sz) {
|
5652 |
-
var used = Math.min(n, sz - at)
|
5653 |
-
if (child.iterN(at, used, op)) { return true }
|
5654 |
-
if ((n -= used) == 0) { break }
|
5655 |
-
at = 0
|
5656 |
-
} else { at -= sz }
|
5657 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5658 |
}
|
5659 |
-
}
|
5660 |
|
5661 |
-
//
|
5662 |
|
5663 |
-
|
5664 |
-
|
5665 |
|
5666 |
-
|
5667 |
-
{ this$1[opt] = options[opt] } } }
|
5668 |
-
this.doc = doc
|
5669 |
-
this.node = node
|
5670 |
-
};
|
5671 |
|
5672 |
-
|
5673 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5674 |
|
5675 |
-
|
5676 |
-
|
5677 |
-
for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1) } }
|
5678 |
-
if (!ws.length) { line.widgets = null }
|
5679 |
-
var height = widgetHeight(this)
|
5680 |
-
updateLineHeight(line, Math.max(0, line.height - height))
|
5681 |
-
if (cm) {
|
5682 |
-
runInOp(cm, function () {
|
5683 |
-
adjustScrollWhenAboveVisible(cm, line, -height)
|
5684 |
-
regLineChange(cm, no, "widget")
|
5685 |
-
})
|
5686 |
-
signalLater(cm, "lineWidgetCleared", cm, this, no)
|
5687 |
}
|
5688 |
-
};
|
5689 |
|
5690 |
-
|
5691 |
-
|
5692 |
-
|
5693 |
-
|
5694 |
-
|
5695 |
-
|
5696 |
-
|
5697 |
-
|
5698 |
-
|
5699 |
-
|
5700 |
-
|
5701 |
-
|
5702 |
-
signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line))
|
5703 |
-
})
|
5704 |
-
}
|
5705 |
-
};
|
5706 |
-
eventMixin(LineWidget)
|
5707 |
-
|
5708 |
-
function adjustScrollWhenAboveVisible(cm, line, diff) {
|
5709 |
-
if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
|
5710 |
-
{ addToScrollTop(cm, diff) }
|
5711 |
-
}
|
5712 |
-
|
5713 |
-
function addLineWidget(doc, handle, node, options) {
|
5714 |
-
var widget = new LineWidget(doc, node, options)
|
5715 |
-
var cm = doc.cm
|
5716 |
-
if (cm && widget.noHScroll) { cm.display.alignWidgets = true }
|
5717 |
-
changeLine(doc, handle, "widget", function (line) {
|
5718 |
-
var widgets = line.widgets || (line.widgets = [])
|
5719 |
-
if (widget.insertAt == null) { widgets.push(widget) }
|
5720 |
-
else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget) }
|
5721 |
-
widget.line = line
|
5722 |
-
if (cm && !lineIsHidden(doc, line)) {
|
5723 |
-
var aboveVisible = heightAtLine(line) < doc.scrollTop
|
5724 |
-
updateLineHeight(line, line.height + widgetHeight(widget))
|
5725 |
-
if (aboveVisible) { addToScrollTop(cm, widget.height) }
|
5726 |
-
cm.curOp.forceUpdate = true
|
5727 |
}
|
5728 |
-
|
5729 |
-
})
|
5730 |
-
if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)) }
|
5731 |
-
return widget
|
5732 |
-
}
|
5733 |
-
|
5734 |
-
// TEXTMARKERS
|
5735 |
-
|
5736 |
-
// Created with markText and setBookmark methods. A TextMarker is a
|
5737 |
-
// handle that can be used to clear or find a marked position in the
|
5738 |
-
// document. Line objects hold arrays (markedSpans) containing
|
5739 |
-
// {from, to, marker} object pointing to such marker objects, and
|
5740 |
-
// indicating that such a marker is present on that line. Multiple
|
5741 |
-
// lines may point to the same marker when it spans across lines.
|
5742 |
-
// The spans will have null for their from/to properties when the
|
5743 |
-
// marker continues beyond the start/end of the line. Markers have
|
5744 |
-
// links back to the lines they currently touch.
|
5745 |
-
|
5746 |
-
// Collapsed markers have unique ids, in order to be able to order
|
5747 |
-
// them, which is needed for uniquely determining an outer marker
|
5748 |
-
// when they overlap (they may nest, but not partially overlap).
|
5749 |
-
var nextMarkerId = 0
|
5750 |
-
|
5751 |
-
var TextMarker = function(doc, type) {
|
5752 |
-
this.lines = []
|
5753 |
-
this.type = type
|
5754 |
-
this.doc = doc
|
5755 |
-
this.id = ++nextMarkerId
|
5756 |
-
};
|
5757 |
-
|
5758 |
-
// Clear the marker.
|
5759 |
-
TextMarker.prototype.clear = function () {
|
5760 |
-
var this$1 = this;
|
5761 |
-
|
5762 |
-
if (this.explicitlyCleared) { return }
|
5763 |
-
var cm = this.doc.cm, withOp = cm && !cm.curOp
|
5764 |
-
if (withOp) { startOperation(cm) }
|
5765 |
-
if (hasHandler(this, "clear")) {
|
5766 |
-
var found = this.find()
|
5767 |
-
if (found) { signalLater(this, "clear", found.from, found.to) }
|
5768 |
-
}
|
5769 |
-
var min = null, max = null
|
5770 |
-
for (var i = 0; i < this.lines.length; ++i) {
|
5771 |
-
var line = this$1.lines[i]
|
5772 |
-
var span = getMarkedSpanFor(line.markedSpans, this$1)
|
5773 |
-
if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text") }
|
5774 |
-
else if (cm) {
|
5775 |
-
if (span.to != null) { max = lineNo(line) }
|
5776 |
-
if (span.from != null) { min = lineNo(line) }
|
5777 |
-
}
|
5778 |
-
line.markedSpans = removeMarkedSpan(line.markedSpans, span)
|
5779 |
-
if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
|
5780 |
-
{ updateLineHeight(line, textHeight(cm.display)) }
|
5781 |
-
}
|
5782 |
-
if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
|
5783 |
-
var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual)
|
5784 |
-
if (len > cm.display.maxLineLength) {
|
5785 |
-
cm.display.maxLine = visual
|
5786 |
-
cm.display.maxLineLength = len
|
5787 |
-
cm.display.maxLineChanged = true
|
5788 |
-
}
|
5789 |
-
} }
|
5790 |
-
|
5791 |
-
if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1) }
|
5792 |
-
this.lines.length = 0
|
5793 |
-
this.explicitlyCleared = true
|
5794 |
-
if (this.atomic && this.doc.cantEdit) {
|
5795 |
-
this.doc.cantEdit = false
|
5796 |
-
if (cm) { reCheckSelection(cm.doc) }
|
5797 |
-
}
|
5798 |
-
if (cm) { signalLater(cm, "markerCleared", cm, this, min, max) }
|
5799 |
-
if (withOp) { endOperation(cm) }
|
5800 |
-
if (this.parent) { this.parent.clear() }
|
5801 |
-
};
|
5802 |
-
|
5803 |
-
// Find the position of the marker in the document. Returns a {from,
|
5804 |
-
// to} object by default. Side can be passed to get a specific side
|
5805 |
-
// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
|
5806 |
-
// Pos objects returned contain a line object, rather than a line
|
5807 |
-
// number (used to prevent looking up the same line twice).
|
5808 |
-
TextMarker.prototype.find = function (side, lineObj) {
|
5809 |
-
var this$1 = this;
|
5810 |
|
5811 |
-
|
5812 |
-
|
5813 |
-
|
5814 |
-
var
|
5815 |
-
var
|
5816 |
-
if (span.from != null) {
|
5817 |
-
from = Pos(lineObj ? line : lineNo(line), span.from)
|
5818 |
-
if (side == -1) { return from }
|
5819 |
-
}
|
5820 |
-
if (span.to != null) {
|
5821 |
-
to = Pos(lineObj ? line : lineNo(line), span.to)
|
5822 |
-
if (side == 1) { return to }
|
5823 |
-
}
|
5824 |
}
|
5825 |
-
return from && {from: from, to: to}
|
5826 |
-
};
|
5827 |
|
5828 |
-
//
|
5829 |
-
//
|
5830 |
-
|
5831 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5832 |
|
5833 |
-
var
|
5834 |
-
|
5835 |
-
|
5836 |
-
|
5837 |
-
var
|
5838 |
-
|
5839 |
-
|
5840 |
-
|
5841 |
-
|
5842 |
-
|
5843 |
-
if (!lineIsHidden(widget.doc, line) && widget.height != null) {
|
5844 |
-
var oldHeight = widget.height
|
5845 |
-
widget.height = null
|
5846 |
-
var dHeight = widgetHeight(widget) - oldHeight
|
5847 |
-
if (dHeight)
|
5848 |
-
{ updateLineHeight(line, line.height + dHeight) }
|
5849 |
-
}
|
5850 |
-
signalLater(cm, "markerChanged", cm, this$1)
|
5851 |
-
})
|
5852 |
-
};
|
5853 |
-
|
5854 |
-
TextMarker.prototype.attachLine = function (line) {
|
5855 |
-
if (!this.lines.length && this.doc.cm) {
|
5856 |
-
var op = this.doc.cm.curOp
|
5857 |
-
if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
|
5858 |
-
{ (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this) }
|
5859 |
-
}
|
5860 |
-
this.lines.push(line)
|
5861 |
-
};
|
5862 |
-
|
5863 |
-
TextMarker.prototype.detachLine = function (line) {
|
5864 |
-
this.lines.splice(indexOf(this.lines, line), 1)
|
5865 |
-
if (!this.lines.length && this.doc.cm) {
|
5866 |
-
var op = this.doc.cm.curOp
|
5867 |
-
;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this)
|
5868 |
-
}
|
5869 |
-
};
|
5870 |
-
eventMixin(TextMarker)
|
5871 |
-
|
5872 |
-
// Create a marker, wire it up to the right lines, and
|
5873 |
-
function markText(doc, from, to, options, type) {
|
5874 |
-
// Shared markers (across linked documents) are handled separately
|
5875 |
-
// (markTextShared will call out to this again, once per
|
5876 |
-
// document).
|
5877 |
-
if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
|
5878 |
-
// Ensure we are in an operation.
|
5879 |
-
if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
|
5880 |
-
|
5881 |
-
var marker = new TextMarker(doc, type), diff = cmp(from, to)
|
5882 |
-
if (options) { copyObj(options, marker, false) }
|
5883 |
-
// Don't connect empty markers unless clearWhenEmpty is false
|
5884 |
-
if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
|
5885 |
-
{ return marker }
|
5886 |
-
if (marker.replacedWith) {
|
5887 |
-
// Showing up as a widget implies collapsed (widget replaces text)
|
5888 |
-
marker.collapsed = true
|
5889 |
-
marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget")
|
5890 |
-
if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true") }
|
5891 |
-
if (options.insertLeft) { marker.widgetNode.insertLeft = true }
|
5892 |
-
}
|
5893 |
-
if (marker.collapsed) {
|
5894 |
-
if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
|
5895 |
-
from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
|
5896 |
-
{ throw new Error("Inserting collapsed marker partially overlapping an existing one") }
|
5897 |
-
seeCollapsedSpans()
|
5898 |
-
}
|
5899 |
-
|
5900 |
-
if (marker.addToHistory)
|
5901 |
-
{ addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN) }
|
5902 |
-
|
5903 |
-
var curLine = from.line, cm = doc.cm, updateMaxLine
|
5904 |
-
doc.iter(curLine, to.line + 1, function (line) {
|
5905 |
-
if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
|
5906 |
-
{ updateMaxLine = true }
|
5907 |
-
if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0) }
|
5908 |
-
addMarkedSpan(line, new MarkedSpan(marker,
|
5909 |
-
curLine == from.line ? from.ch : null,
|
5910 |
-
curLine == to.line ? to.ch : null))
|
5911 |
-
++curLine
|
5912 |
-
})
|
5913 |
-
// lineIsHidden depends on the presence of the spans, so needs a second pass
|
5914 |
-
if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
|
5915 |
-
if (lineIsHidden(doc, line)) { updateLineHeight(line, 0) }
|
5916 |
-
}) }
|
5917 |
-
|
5918 |
-
if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }) }
|
5919 |
-
|
5920 |
-
if (marker.readOnly) {
|
5921 |
-
seeReadOnlySpans()
|
5922 |
-
if (doc.history.done.length || doc.history.undone.length)
|
5923 |
-
{ doc.clearHistory() }
|
5924 |
-
}
|
5925 |
-
if (marker.collapsed) {
|
5926 |
-
marker.id = ++nextMarkerId
|
5927 |
-
marker.atomic = true
|
5928 |
-
}
|
5929 |
-
if (cm) {
|
5930 |
-
// Sync editor state
|
5931 |
-
if (updateMaxLine) { cm.curOp.updateMaxLine = true }
|
5932 |
-
if (marker.collapsed)
|
5933 |
-
{ regChange(cm, from.line, to.line + 1) }
|
5934 |
-
else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css)
|
5935 |
-
{ for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text") } }
|
5936 |
-
if (marker.atomic) { reCheckSelection(cm.doc) }
|
5937 |
-
signalLater(cm, "markerAdded", cm, marker)
|
5938 |
-
}
|
5939 |
-
return marker
|
5940 |
-
}
|
5941 |
-
|
5942 |
-
// SHARED TEXTMARKERS
|
5943 |
-
|
5944 |
-
// A shared marker spans multiple linked documents. It is
|
5945 |
-
// implemented as a meta-marker-object controlling multiple normal
|
5946 |
-
// markers.
|
5947 |
-
var SharedTextMarker = function(markers, primary) {
|
5948 |
-
var this$1 = this;
|
5949 |
-
|
5950 |
-
this.markers = markers
|
5951 |
-
this.primary = primary
|
5952 |
-
for (var i = 0; i < markers.length; ++i)
|
5953 |
-
{ markers[i].parent = this$1 }
|
5954 |
-
};
|
5955 |
-
|
5956 |
-
SharedTextMarker.prototype.clear = function () {
|
5957 |
-
var this$1 = this;
|
5958 |
|
5959 |
-
|
5960 |
-
|
5961 |
-
|
5962 |
-
|
5963 |
-
|
5964 |
-
};
|
5965 |
-
|
5966 |
-
|
5967 |
-
|
5968 |
-
}
|
5969 |
-
|
5970 |
-
|
5971 |
-
|
5972 |
-
|
5973 |
-
|
5974 |
-
|
5975 |
-
|
5976 |
-
|
5977 |
-
|
5978 |
-
|
5979 |
-
|
5980 |
-
|
5981 |
-
|
5982 |
-
|
5983 |
-
|
5984 |
-
|
5985 |
-
|
5986 |
-
|
5987 |
-
|
5988 |
-
|
5989 |
-
|
5990 |
-
|
5991 |
-
|
5992 |
-
|
5993 |
-
|
5994 |
-
if (
|
5995 |
-
|
5996 |
-
|
5997 |
-
|
5998 |
-
|
5999 |
-
|
6000 |
-
|
6001 |
-
|
6002 |
-
|
6003 |
-
|
6004 |
-
|
6005 |
-
|
6006 |
-
|
6007 |
-
|
6008 |
-
|
6009 |
-
|
6010 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6011 |
}
|
6012 |
}
|
6013 |
-
|
|
|
|
|
|
|
6014 |
|
6015 |
-
|
6016 |
-
}
|
6017 |
-
|
6018 |
-
var nextDocId = 0
|
6019 |
-
var Doc = function(text, mode, firstLine, lineSep, direction) {
|
6020 |
-
if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
|
6021 |
-
if (firstLine == null) { firstLine = 0 }
|
6022 |
-
|
6023 |
-
BranchChunk.call(this, [new LeafChunk([new Line("", null)])])
|
6024 |
-
this.first = firstLine
|
6025 |
-
this.scrollTop = this.scrollLeft = 0
|
6026 |
-
this.cantEdit = false
|
6027 |
-
this.cleanGeneration = 1
|
6028 |
-
this.modeFrontier = this.highlightFrontier = firstLine
|
6029 |
-
var start = Pos(firstLine, 0)
|
6030 |
-
this.sel = simpleSelection(start)
|
6031 |
-
this.history = new History(null)
|
6032 |
-
this.id = ++nextDocId
|
6033 |
-
this.modeOption = mode
|
6034 |
-
this.lineSep = lineSep
|
6035 |
-
this.direction = (direction == "rtl") ? "rtl" : "ltr"
|
6036 |
-
this.extend = false
|
6037 |
-
|
6038 |
-
if (typeof text == "string") { text = this.splitLines(text) }
|
6039 |
-
updateDoc(this, {from: start, to: start, text: text})
|
6040 |
-
setSelection(this, simpleSelection(start), sel_dontScroll)
|
6041 |
-
}
|
6042 |
-
|
6043 |
-
Doc.prototype = createObj(BranchChunk.prototype, {
|
6044 |
-
constructor: Doc,
|
6045 |
-
// Iterate over the document. Supports two forms -- with only one
|
6046 |
-
// argument, it calls that for each line in the document. With
|
6047 |
-
// three, it iterates over the range given by the first two (with
|
6048 |
-
// the second being non-inclusive).
|
6049 |
-
iter: function(from, to, op) {
|
6050 |
-
if (op) { this.iterN(from - this.first, to - from, op) }
|
6051 |
-
else { this.iterN(this.first, this.first + this.size, from) }
|
6052 |
-
},
|
6053 |
-
|
6054 |
-
// Non-public interface for adding and removing lines.
|
6055 |
-
insert: function(at, lines) {
|
6056 |
-
var height = 0
|
6057 |
-
for (var i = 0; i < lines.length; ++i) { height += lines[i].height }
|
6058 |
-
this.insertInner(at - this.first, lines, height)
|
6059 |
-
},
|
6060 |
-
remove: function(at, n) { this.removeInner(at - this.first, n) },
|
6061 |
-
|
6062 |
-
// From here, the methods are part of the public interface. Most
|
6063 |
-
// are also available from CodeMirror (editor) instances.
|
6064 |
-
|
6065 |
-
getValue: function(lineSep) {
|
6066 |
-
var lines = getLines(this, this.first, this.first + this.size)
|
6067 |
-
if (lineSep === false) { return lines }
|
6068 |
-
return lines.join(lineSep || this.lineSeparator())
|
6069 |
-
},
|
6070 |
-
setValue: docMethodOp(function(code) {
|
6071 |
-
var top = Pos(this.first, 0), last = this.first + this.size - 1
|
6072 |
-
makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
|
6073 |
-
text: this.splitLines(code), origin: "setValue", full: true}, true)
|
6074 |
-
if (this.cm) { scrollToCoords(this.cm, 0, 0) }
|
6075 |
-
setSelection(this, simpleSelection(top), sel_dontScroll)
|
6076 |
-
}),
|
6077 |
-
replaceRange: function(code, from, to, origin) {
|
6078 |
-
from = clipPos(this, from)
|
6079 |
-
to = to ? clipPos(this, to) : from
|
6080 |
-
replaceRange(this, code, from, to, origin)
|
6081 |
-
},
|
6082 |
-
getRange: function(from, to, lineSep) {
|
6083 |
-
var lines = getBetween(this, clipPos(this, from), clipPos(this, to))
|
6084 |
-
if (lineSep === false) { return lines }
|
6085 |
-
return lines.join(lineSep || this.lineSeparator())
|
6086 |
-
},
|
6087 |
-
|
6088 |
-
getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
|
6089 |
-
|
6090 |
-
getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
|
6091 |
-
getLineNumber: function(line) {return lineNo(line)},
|
6092 |
-
|
6093 |
-
getLineHandleVisualStart: function(line) {
|
6094 |
-
if (typeof line == "number") { line = getLine(this, line) }
|
6095 |
-
return visualLine(line)
|
6096 |
-
},
|
6097 |
-
|
6098 |
-
lineCount: function() {return this.size},
|
6099 |
-
firstLine: function() {return this.first},
|
6100 |
-
lastLine: function() {return this.first + this.size - 1},
|
6101 |
-
|
6102 |
-
clipPos: function(pos) {return clipPos(this, pos)},
|
6103 |
-
|
6104 |
-
getCursor: function(start) {
|
6105 |
-
var range = this.sel.primary(), pos
|
6106 |
-
if (start == null || start == "head") { pos = range.head }
|
6107 |
-
else if (start == "anchor") { pos = range.anchor }
|
6108 |
-
else if (start == "end" || start == "to" || start === false) { pos = range.to() }
|
6109 |
-
else { pos = range.from() }
|
6110 |
-
return pos
|
6111 |
-
},
|
6112 |
-
listSelections: function() { return this.sel.ranges },
|
6113 |
-
somethingSelected: function() {return this.sel.somethingSelected()},
|
6114 |
-
|
6115 |
-
setCursor: docMethodOp(function(line, ch, options) {
|
6116 |
-
setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options)
|
6117 |
-
}),
|
6118 |
-
setSelection: docMethodOp(function(anchor, head, options) {
|
6119 |
-
setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options)
|
6120 |
-
}),
|
6121 |
-
extendSelection: docMethodOp(function(head, other, options) {
|
6122 |
-
extendSelection(this, clipPos(this, head), other && clipPos(this, other), options)
|
6123 |
-
}),
|
6124 |
-
extendSelections: docMethodOp(function(heads, options) {
|
6125 |
-
extendSelections(this, clipPosArray(this, heads), options)
|
6126 |
-
}),
|
6127 |
-
extendSelectionsBy: docMethodOp(function(f, options) {
|
6128 |
-
var heads = map(this.sel.ranges, f)
|
6129 |
-
extendSelections(this, clipPosArray(this, heads), options)
|
6130 |
-
}),
|
6131 |
-
setSelections: docMethodOp(function(ranges, primary, options) {
|
6132 |
-
var this$1 = this;
|
6133 |
|
6134 |
-
|
6135 |
-
|
6136 |
-
|
6137 |
-
|
6138 |
-
|
6139 |
-
|
6140 |
-
|
6141 |
-
}),
|
6142 |
-
addSelection: docMethodOp(function(anchor, head, options) {
|
6143 |
-
var ranges = this.sel.ranges.slice(0)
|
6144 |
-
ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)))
|
6145 |
-
setSelection(this, normalizeSelection(ranges, ranges.length - 1), options)
|
6146 |
-
}),
|
6147 |
-
|
6148 |
-
getSelection: function(lineSep) {
|
6149 |
-
var this$1 = this;
|
6150 |
|
6151 |
-
|
6152 |
-
|
6153 |
-
|
6154 |
-
|
|
|
|
|
|
|
|
|
6155 |
}
|
6156 |
-
|
6157 |
-
|
6158 |
-
},
|
6159 |
-
getSelections: function(lineSep) {
|
6160 |
-
var this$1 = this;
|
6161 |
|
6162 |
-
|
6163 |
-
|
6164 |
-
|
6165 |
-
|
6166 |
-
|
|
|
|
|
|
|
|
|
6167 |
}
|
6168 |
-
return
|
6169 |
-
}
|
6170 |
-
replaceSelection: function(code, collapse, origin) {
|
6171 |
-
var dup = []
|
6172 |
-
for (var i = 0; i < this.sel.ranges.length; i++)
|
6173 |
-
{ dup[i] = code }
|
6174 |
-
this.replaceSelections(dup, collapse, origin || "+input")
|
6175 |
-
},
|
6176 |
-
replaceSelections: docMethodOp(function(code, collapse, origin) {
|
6177 |
-
var this$1 = this;
|
6178 |
|
6179 |
-
|
6180 |
-
|
6181 |
-
|
6182 |
-
changes[i] = {from: range.from(), to: range.to(), text: this$1.splitLines(code[i]), origin: origin}
|
6183 |
-
}
|
6184 |
-
var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse)
|
6185 |
-
for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
|
6186 |
-
{ makeChange(this$1, changes[i$1]) }
|
6187 |
-
if (newSel) { setSelectionReplaceHistory(this, newSel) }
|
6188 |
-
else if (this.cm) { ensureCursorVisible(this.cm) }
|
6189 |
-
}),
|
6190 |
-
undo: docMethodOp(function() {makeChangeFromHistory(this, "undo")}),
|
6191 |
-
redo: docMethodOp(function() {makeChangeFromHistory(this, "redo")}),
|
6192 |
-
undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true)}),
|
6193 |
-
redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true)}),
|
6194 |
-
|
6195 |
-
setExtending: function(val) {this.extend = val},
|
6196 |
-
getExtending: function() {return this.extend},
|
6197 |
-
|
6198 |
-
historySize: function() {
|
6199 |
-
var hist = this.history, done = 0, undone = 0
|
6200 |
-
for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done } }
|
6201 |
-
for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone } }
|
6202 |
-
return {undo: done, redo: undone}
|
6203 |
-
},
|
6204 |
-
clearHistory: function() {this.history = new History(this.history.maxGeneration)},
|
6205 |
-
|
6206 |
-
markClean: function() {
|
6207 |
-
this.cleanGeneration = this.changeGeneration(true)
|
6208 |
-
},
|
6209 |
-
changeGeneration: function(forceSplit) {
|
6210 |
-
if (forceSplit)
|
6211 |
-
{ this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null }
|
6212 |
-
return this.history.generation
|
6213 |
-
},
|
6214 |
-
isClean: function (gen) {
|
6215 |
-
return this.history.generation == (gen || this.cleanGeneration)
|
6216 |
-
},
|
6217 |
-
|
6218 |
-
getHistory: function() {
|
6219 |
-
return {done: copyHistoryArray(this.history.done),
|
6220 |
-
undone: copyHistoryArray(this.history.undone)}
|
6221 |
-
},
|
6222 |
-
setHistory: function(histData) {
|
6223 |
-
var hist = this.history = new History(this.history.maxGeneration)
|
6224 |
-
hist.done = copyHistoryArray(histData.done.slice(0), null, true)
|
6225 |
-
hist.undone = copyHistoryArray(histData.undone.slice(0), null, true)
|
6226 |
-
},
|
6227 |
-
|
6228 |
-
setGutterMarker: docMethodOp(function(line, gutterID, value) {
|
6229 |
-
return changeLine(this, line, "gutter", function (line) {
|
6230 |
-
var markers = line.gutterMarkers || (line.gutterMarkers = {})
|
6231 |
-
markers[gutterID] = value
|
6232 |
-
if (!value && isEmpty(markers)) { line.gutterMarkers = null }
|
6233 |
-
return true
|
6234 |
-
})
|
6235 |
-
}),
|
6236 |
|
6237 |
-
|
6238 |
-
var this$1 = this;
|
6239 |
|
6240 |
-
|
6241 |
-
|
6242 |
-
|
6243 |
-
|
6244 |
-
|
6245 |
-
|
6246 |
-
|
6247 |
-
|
6248 |
-
|
6249 |
-
|
6250 |
-
|
6251 |
-
|
6252 |
-
|
6253 |
-
|
6254 |
-
|
6255 |
-
|
6256 |
-
|
6257 |
-
|
6258 |
-
|
6259 |
-
|
6260 |
-
|
6261 |
-
|
6262 |
-
|
6263 |
-
|
6264 |
-
|
6265 |
-
}
|
6266 |
-
|
6267 |
-
|
6268 |
-
|
6269 |
-
|
6270 |
-
|
6271 |
-
|
6272 |
-
|
6273 |
-
|
6274 |
-
|
6275 |
-
|
6276 |
-
|
6277 |
-
}
|
6278 |
-
|
6279 |
-
|
6280 |
-
|
6281 |
-
|
6282 |
-
|
6283 |
-
|
6284 |
-
|
6285 |
-
|
6286 |
-
|
6287 |
-
|
6288 |
-
|
6289 |
-
|
6290 |
-
|
6291 |
-
|
6292 |
-
|
6293 |
-
|
6294 |
-
}
|
6295 |
-
|
6296 |
-
|
6297 |
-
|
6298 |
-
|
6299 |
-
|
6300 |
-
|
6301 |
-
|
6302 |
-
|
6303 |
-
|
6304 |
-
|
6305 |
-
|
6306 |
-
|
6307 |
-
|
6308 |
-
|
6309 |
-
|
6310 |
-
|
6311 |
-
|
6312 |
-
|
6313 |
-
|
6314 |
-
|
6315 |
-
|
6316 |
-
|
6317 |
-
|
6318 |
-
|
6319 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6320 |
} }
|
6321 |
-
return
|
6322 |
-
}
|
6323 |
-
|
6324 |
-
|
6325 |
-
|
6326 |
-
|
6327 |
-
|
6328 |
-
|
6329 |
-
|
6330 |
-
|
6331 |
-
|
6332 |
-
|
6333 |
-
|
6334 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6335 |
} }
|
6336 |
-
|
6337 |
-
|
6338 |
-
|
6339 |
-
|
6340 |
-
|
6341 |
-
var
|
6342 |
-
|
6343 |
-
|
6344 |
-
|
6345 |
-
|
6346 |
-
|
6347 |
-
|
6348 |
-
|
6349 |
-
|
6350 |
-
|
6351 |
-
var
|
6352 |
-
|
6353 |
-
|
6354 |
-
|
6355 |
-
|
6356 |
-
|
6357 |
-
|
6358 |
-
|
6359 |
-
|
6360 |
-
|
6361 |
-
|
6362 |
-
|
6363 |
-
|
6364 |
-
|
6365 |
-
|
6366 |
-
|
6367 |
-
|
6368 |
-
|
6369 |
-
|
6370 |
-
|
6371 |
-
|
6372 |
-
var
|
6373 |
-
|
6374 |
-
|
6375 |
-
|
6376 |
-
|
6377 |
-
|
6378 |
-
|
6379 |
-
|
6380 |
-
|
6381 |
-
|
6382 |
-
|
6383 |
-
|
6384 |
-
|
6385 |
-
|
6386 |
-
|
6387 |
-
if (
|
6388 |
-
|
6389 |
-
|
6390 |
-
|
6391 |
-
|
6392 |
-
|
6393 |
-
|
6394 |
-
|
6395 |
-
|
6396 |
-
|
6397 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6398 |
|
6399 |
-
|
6400 |
-
|
6401 |
-
|
6402 |
-
if (
|
6403 |
-
|
6404 |
-
|
6405 |
-
detachSharedMarkers(findSharedMarkers(this$1))
|
6406 |
-
break
|
6407 |
} }
|
6408 |
-
|
6409 |
-
|
6410 |
-
|
6411 |
-
|
6412 |
-
|
6413 |
-
|
6414 |
-
|
6415 |
-
|
6416 |
-
|
6417 |
-
|
6418 |
-
|
6419 |
-
|
6420 |
-
|
6421 |
-
|
6422 |
-
|
6423 |
-
|
6424 |
-
|
6425 |
-
|
6426 |
-
|
6427 |
-
|
6428 |
-
|
6429 |
-
|
6430 |
-
|
6431 |
-
|
6432 |
-
|
6433 |
-
|
6434 |
-
|
6435 |
-
|
6436 |
-
|
6437 |
-
|
6438 |
-
|
6439 |
-
|
6440 |
-
|
6441 |
-
|
6442 |
-
|
6443 |
-
|
6444 |
-
|
6445 |
-
|
6446 |
-
|
6447 |
-
|
6448 |
-
|
6449 |
-
|
6450 |
-
|
6451 |
-
|
6452 |
-
|
6453 |
-
|
6454 |
-
|
6455 |
-
|
6456 |
-
|
6457 |
-
|
6458 |
-
|
6459 |
-
|
6460 |
-
|
6461 |
-
|
6462 |
-
|
6463 |
-
|
6464 |
-
|
6465 |
-
|
6466 |
-
|
6467 |
-
|
6468 |
-
|
6469 |
-
|
6470 |
-
|
6471 |
-
|
6472 |
-
|
6473 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6474 |
}
|
6475 |
-
}
|
6476 |
-
|
6477 |
-
}
|
6478 |
-
for (var i = 0; i < n; ++i) { loadFile(files[i], i) }
|
6479 |
-
} else { // Normal drop
|
6480 |
-
// Don't do a replace if the drop happened inside of the selected text.
|
6481 |
-
if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
|
6482 |
-
cm.state.draggingText(e)
|
6483 |
-
// Ensure the editor is re-focused
|
6484 |
-
setTimeout(function () { return cm.display.input.focus(); }, 20)
|
6485 |
-
return
|
6486 |
}
|
6487 |
-
|
6488 |
-
|
6489 |
-
|
6490 |
-
|
6491 |
-
|
6492 |
-
|
6493 |
-
|
6494 |
-
|
6495 |
-
|
6496 |
-
|
6497 |
-
|
6498 |
-
|
6499 |
-
|
6500 |
-
|
6501 |
-
|
6502 |
-
|
6503 |
-
|
6504 |
-
|
6505 |
-
|
6506 |
-
|
6507 |
-
|
6508 |
-
|
6509 |
-
|
6510 |
-
|
6511 |
-
|
6512 |
-
|
6513 |
-
|
6514 |
-
|
6515 |
-
|
6516 |
-
|
6517 |
-
|
6518 |
-
cm.display.
|
6519 |
-
|
6520 |
-
|
6521 |
-
|
6522 |
-
|
6523 |
-
|
6524 |
-
|
6525 |
-
|
6526 |
-
|
6527 |
-
|
6528 |
-
|
6529 |
-
|
6530 |
-
|
6531 |
-
|
6532 |
-
|
6533 |
-
|
6534 |
-
|
6535 |
-
|
6536 |
-
|
6537 |
-
|
6538 |
-
|
6539 |
-
|
6540 |
-
|
6541 |
-
|
6542 |
-
|
6543 |
-
|
6544 |
-
}
|
6545 |
-
|
6546 |
-
|
6547 |
-
|
6548 |
-
|
6549 |
-
|
6550 |
-
|
6551 |
-
|
6552 |
-
|
6553 |
-
|
6554 |
-
|
6555 |
-
|
6556 |
-
|
6557 |
-
|
6558 |
-
|
6559 |
-
|
6560 |
-
|
6561 |
-
|
6562 |
-
|
6563 |
-
|
6564 |
-
}
|
6565 |
-
|
6566 |
-
|
6567 |
-
|
6568 |
-
|
6569 |
-
|
6570 |
-
|
6571 |
-
|
6572 |
-
|
6573 |
-
|
6574 |
-
|
6575 |
-
|
6576 |
-
|
6577 |
-
|
6578 |
-
|
6579 |
-
|
6580 |
-
|
6581 |
-
|
6582 |
-
|
6583 |
-
|
6584 |
-
|
6585 |
-
|
6586 |
-
}
|
6587 |
-
|
6588 |
-
var keyNames =
|
6589 |
-
|
6590 |
-
|
6591 |
-
|
6592 |
-
|
6593 |
-
|
6594 |
-
|
6595 |
-
|
6596 |
-
|
6597 |
-
|
6598 |
-
|
6599 |
-
|
6600 |
-
|
6601 |
-
|
6602 |
-
|
6603 |
-
//
|
6604 |
-
|
6605 |
-
|
6606 |
-
|
6607 |
-
|
6608 |
-
|
6609 |
-
|
6610 |
-
|
6611 |
-
|
6612 |
-
|
6613 |
-
|
6614 |
-
|
6615 |
-
|
6616 |
-
|
6617 |
-
|
6618 |
-
|
6619 |
-
|
6620 |
-
|
6621 |
-
|
6622 |
-
|
6623 |
-
|
6624 |
-
|
6625 |
-
|
6626 |
-
|
6627 |
-
|
6628 |
-
|
6629 |
-
|
6630 |
-
|
6631 |
-
|
6632 |
-
|
6633 |
-
"
|
6634 |
-
|
6635 |
-
|
6636 |
-
|
6637 |
-
|
6638 |
-
|
6639 |
-
|
6640 |
-
|
6641 |
-
|
6642 |
-
|
6643 |
-
|
6644 |
-
|
6645 |
-
|
6646 |
-
}
|
6647 |
-
|
6648 |
-
|
6649 |
-
|
6650 |
-
|
6651 |
-
|
6652 |
-
|
6653 |
-
|
6654 |
-
|
6655 |
-
|
6656 |
-
|
6657 |
-
|
6658 |
-
|
6659 |
-
|
6660 |
-
|
6661 |
-
|
6662 |
-
|
6663 |
-
|
6664 |
-
|
6665 |
-
|
6666 |
-
|
6667 |
-
|
6668 |
-
|
6669 |
-
|
6670 |
-
|
6671 |
-
|
6672 |
-
|
6673 |
-
|
6674 |
-
|
6675 |
-
|
6676 |
-
|
6677 |
-
|
6678 |
-
|
6679 |
-
|
6680 |
-
|
6681 |
-
|
6682 |
-
|
6683 |
-
|
6684 |
-
|
6685 |
-
|
6686 |
-
|
6687 |
-
|
6688 |
-
|
6689 |
-
|
6690 |
-
|
6691 |
-
|
6692 |
-
|
6693 |
-
|
6694 |
-
|
6695 |
-
|
6696 |
-
|
6697 |
-
|
6698 |
-
|
6699 |
-
|
6700 |
-
}
|
6701 |
-
|
6702 |
-
function lookupKey(key, map, handle, context) {
|
6703 |
-
map = getKeyMap(map)
|
6704 |
-
var found = map.call ? map.call(key, context) : map[key]
|
6705 |
-
if (found === false) { return "nothing" }
|
6706 |
-
if (found === "...") { return "multi" }
|
6707 |
-
if (found != null && handle(found)) { return "handled" }
|
6708 |
-
|
6709 |
-
if (map.fallthrough) {
|
6710 |
-
if (Object.prototype.toString.call(map.fallthrough) != "[object Array]")
|
6711 |
-
{ return lookupKey(key, map.fallthrough, handle, context) }
|
6712 |
-
for (var i = 0; i < map.fallthrough.length; i++) {
|
6713 |
-
var result = lookupKey(key, map.fallthrough[i], handle, context)
|
6714 |
-
if (result) { return result }
|
6715 |
}
|
6716 |
}
|
6717 |
-
|
6718 |
-
|
6719 |
-
//
|
6720 |
-
|
6721 |
-
|
6722 |
-
|
6723 |
-
|
6724 |
-
|
6725 |
-
|
6726 |
-
|
6727 |
-
|
6728 |
-
|
6729 |
-
|
6730 |
-
|
6731 |
-
|
6732 |
-
|
6733 |
-
|
6734 |
-
|
6735 |
-
|
6736 |
-
|
6737 |
-
|
6738 |
-
|
6739 |
-
|
6740 |
-
|
6741 |
-
|
6742 |
-
|
6743 |
-
|
6744 |
-
|
6745 |
-
|
6746 |
-
|
6747 |
-
|
6748 |
-
|
6749 |
-
|
6750 |
-
//
|
6751 |
-
|
6752 |
-
|
6753 |
-
|
6754 |
-
|
6755 |
-
|
6756 |
-
|
6757 |
-
|
6758 |
-
|
6759 |
-
|
6760 |
-
|
6761 |
-
|
6762 |
-
|
6763 |
}
|
|
|
6764 |
}
|
6765 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6766 |
}
|
6767 |
-
// Next, remove those actual ranges.
|
6768 |
-
runInOp(cm, function () {
|
6769 |
-
for (var i = kill.length - 1; i >= 0; i--)
|
6770 |
-
{ replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete") }
|
6771 |
-
ensureCursorVisible(cm)
|
6772 |
-
})
|
6773 |
-
}
|
6774 |
|
6775 |
-
function
|
6776 |
-
|
6777 |
-
|
6778 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6779 |
|
6780 |
-
|
6781 |
-
|
6782 |
-
return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
|
6783 |
-
}
|
6784 |
|
6785 |
-
function
|
6786 |
-
|
6787 |
-
|
6788 |
-
|
6789 |
-
|
6790 |
-
|
6791 |
-
|
6792 |
-
|
6793 |
-
|
6794 |
-
|
6795 |
-
|
6796 |
-
|
6797 |
-
|
6798 |
-
|
6799 |
-
|
6800 |
-
|
6801 |
-
|
6802 |
-
var targetTop = measureCharPrepared(cm, prep, ch).top
|
6803 |
-
ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch)
|
6804 |
-
if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1) }
|
6805 |
-
} else { ch = dir < 0 ? part.to : part.from }
|
6806 |
-
return new Pos(lineNo, ch, sticky)
|
6807 |
-
}
|
6808 |
-
}
|
6809 |
-
return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
|
6810 |
-
}
|
6811 |
-
|
6812 |
-
function moveVisually(cm, line, start, dir) {
|
6813 |
-
var bidi = getOrder(line, cm.doc.direction)
|
6814 |
-
if (!bidi) { return moveLogically(line, start, dir) }
|
6815 |
-
if (start.ch >= line.text.length) {
|
6816 |
-
start.ch = line.text.length
|
6817 |
-
start.sticky = "before"
|
6818 |
-
} else if (start.ch <= 0) {
|
6819 |
-
start.ch = 0
|
6820 |
-
start.sticky = "after"
|
6821 |
-
}
|
6822 |
-
var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos]
|
6823 |
-
if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
|
6824 |
-
// Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
|
6825 |
-
// nothing interesting happens.
|
6826 |
-
return moveLogically(line, start, dir)
|
6827 |
-
}
|
6828 |
-
|
6829 |
-
var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); }
|
6830 |
-
var prep
|
6831 |
-
var getWrappedLineExtent = function (ch) {
|
6832 |
-
if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
|
6833 |
-
prep = prep || prepareMeasureForLine(cm, line)
|
6834 |
-
return wrappedLineExtentChar(cm, line, prep, ch)
|
6835 |
-
}
|
6836 |
-
var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch)
|
6837 |
-
|
6838 |
-
if (cm.doc.direction == "rtl" || part.level == 1) {
|
6839 |
-
var moveInStorageOrder = (part.level == 1) == (dir < 0)
|
6840 |
-
var ch = mv(start, moveInStorageOrder ? 1 : -1)
|
6841 |
-
if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
|
6842 |
-
// Case 2: We move within an rtl part or in an rtl editor on the same visual line
|
6843 |
-
var sticky = moveInStorageOrder ? "before" : "after"
|
6844 |
-
return new Pos(start.line, ch, sticky)
|
6845 |
-
}
|
6846 |
-
}
|
6847 |
-
|
6848 |
-
// Case 3: Could not move within this bidi part in this visual line, so leave
|
6849 |
-
// the current bidi part
|
6850 |
-
|
6851 |
-
var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
|
6852 |
-
var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
|
6853 |
-
? new Pos(start.line, mv(ch, 1), "before")
|
6854 |
-
: new Pos(start.line, ch, "after"); }
|
6855 |
-
|
6856 |
-
for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
|
6857 |
-
var part = bidi[partPos]
|
6858 |
-
var moveInStorageOrder = (dir > 0) == (part.level != 1)
|
6859 |
-
var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1)
|
6860 |
-
if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
|
6861 |
-
ch = moveInStorageOrder ? part.from : mv(part.to, -1)
|
6862 |
-
if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
|
6863 |
-
}
|
6864 |
-
}
|
6865 |
-
|
6866 |
-
// Case 3a: Look for other bidi parts on the same visual line
|
6867 |
-
var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent)
|
6868 |
-
if (res) { return res }
|
6869 |
-
|
6870 |
-
// Case 3b: Look for other bidi parts on the next visual line
|
6871 |
-
var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1)
|
6872 |
-
if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
|
6873 |
-
res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh))
|
6874 |
if (res) { return res }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6875 |
}
|
6876 |
|
6877 |
-
// Case 4: Nowhere to move
|
6878 |
-
return null
|
6879 |
-
}
|
6880 |
-
|
6881 |
-
// Commands are parameter-less actions that can be performed on an
|
6882 |
-
// editor, mostly used for keybindings.
|
6883 |
-
var commands = {
|
6884 |
-
selectAll: selectAll,
|
6885 |
-
singleSelection: function (cm) { return cm.setSelection(cm.getCursor("anchor"), cm.getCursor("head"), sel_dontScroll); },
|
6886 |
-
killLine: function (cm) { return deleteNearSelection(cm, function (range) {
|
6887 |
-
if (range.empty()) {
|
6888 |
-
var len = getLine(cm.doc, range.head.line).text.length
|
6889 |
-
if (range.head.ch == len && range.head.line < cm.lastLine())
|
6890 |
-
{ return {from: range.head, to: Pos(range.head.line + 1, 0)} }
|
6891 |
-
else
|
6892 |
-
{ return {from: range.head, to: Pos(range.head.line, len)} }
|
6893 |
-
} else {
|
6894 |
-
return {from: range.from(), to: range.to()}
|
6895 |
-
}
|
6896 |
-
}); },
|
6897 |
-
deleteLine: function (cm) { retur
|
1 |
// CodeMirror, copyright (c) by Marijn Haverbeke and others
|
2 |
+
// Distributed under an MIT license: https://codemirror.net/LICENSE
|
3 |
|
4 |
+
// This is CodeMirror (https://codemirror.net), a code editor
|
5 |
// implemented in JavaScript on top of the browser's DOM.
|
6 |
//
|
7 |
// You can find some technical background for some of the code below
|
13 |
(global.CodeMirror = factory());
|
14 |
}(this, (function () { 'use strict';
|
15 |
|
16 |
+
// Kludges for bugs and behavior differences that can't be feature
|
17 |
+
// detected are enabled based on userAgent etc sniffing.
|
18 |
+
var userAgent = navigator.userAgent;
|
19 |
+
var platform = navigator.platform;
|
20 |
+
|
21 |
+
var gecko = /gecko\/\d/i.test(userAgent);
|
22 |
+
var ie_upto10 = /MSIE \d/.test(userAgent);
|
23 |
+
var ie_11up = /Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent);
|
24 |
+
var edge = /Edge\/(\d+)/.exec(userAgent);
|
25 |
+
var ie = ie_upto10 || ie_11up || edge;
|
26 |
+
var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);
|
27 |
+
var webkit = !edge && /WebKit\//.test(userAgent);
|
28 |
+
var qtwebkit = webkit && /Qt\/\d+\.\d+/.test(userAgent);
|
29 |
+
var chrome = !edge && /Chrome\//.test(userAgent);
|
30 |
+
var presto = /Opera\//.test(userAgent);
|
31 |
+
var safari = /Apple Computer/.test(navigator.vendor);
|
32 |
+
var mac_geMountainLion = /Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent);
|
33 |
+
var phantom = /PhantomJS/.test(userAgent);
|
34 |
+
|
35 |
+
var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\/\w+/.test(userAgent);
|
36 |
+
var android = /Android/.test(userAgent);
|
37 |
+
// This is woefully incomplete. Suggestions for alternative methods welcome.
|
38 |
+
var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);
|
39 |
+
var mac = ios || /Mac/.test(platform);
|
40 |
+
var chromeOS = /\bCrOS\b/.test(userAgent);
|
41 |
+
var windows = /win/i.test(platform);
|
42 |
+
|
43 |
+
var presto_version = presto && userAgent.match(/Version\/(\d*\.\d*)/);
|
44 |
+
if (presto_version) { presto_version = Number(presto_version[1]); }
|
45 |
+
if (presto_version && presto_version >= 15) { presto = false; webkit = true; }
|
46 |
+
// Some browsers use the wrong event properties to signal cmd/ctrl on OS X
|
47 |
+
var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));
|
48 |
+
var captureRightClick = gecko || (ie && ie_version >= 9);
|
49 |
+
|
50 |
+
function classTest(cls) { return new RegExp("(^|\\s)" + cls + "(?:$|\\s)\\s*") }
|
51 |
+
|
52 |
+
var rmClass = function(node, cls) {
|
53 |
+
var current = node.className;
|
54 |
+
var match = classTest(cls).exec(current);
|
55 |
+
if (match) {
|
56 |
+
var after = current.slice(match.index + match[0].length);
|
57 |
+
node.className = current.slice(0, match.index) + (after ? match[1] + after : "");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
};
|
60 |
|
61 |
+
function removeChildren(e) {
|
62 |
+
for (var count = e.childNodes.length; count > 0; --count)
|
63 |
+
{ e.removeChild(e.firstChild); }
|
64 |
+
return e
|
65 |
+
}
|
66 |
+
|
67 |
+
function removeChildrenAndAdd(parent, e) {
|
68 |
+
return removeChildren(parent).appendChild(e)
|
69 |
+
}
|
70 |
+
|
71 |
+
function elt(tag, content, className, style) {
|
72 |
+
var e = document.createElement(tag);
|
73 |
+
if (className) { e.className = className; }
|
74 |
+
if (style) { e.style.cssText = style; }
|
75 |
+
if (typeof content == "string") { e.appendChild(document.createTextNode(content)); }
|
76 |
+
else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }
|
77 |
+
return e
|
78 |
+
}
|
79 |
+
// wrapper for elt, which removes the elt from the accessibility tree
|
80 |
+
function eltP(tag, content, className, style) {
|
81 |
+
var e = elt(tag, content, className, style);
|
82 |
+
e.setAttribute("role", "presentation");
|
83 |
+
return e
|
84 |
+
}
|
85 |
+
|
86 |
+
var range;
|
87 |
+
if (document.createRange) { range = function(node, start, end, endNode) {
|
88 |
+
var r = document.createRange();
|
89 |
+
r.setEnd(endNode || node, end);
|
90 |
+
r.setStart(node, start);
|
91 |
+
return r
|
92 |
+
}; }
|
93 |
+
else { range = function(node, start, end) {
|
94 |
+
var r = document.body.createTextRange();
|
95 |
+
try { r.moveToElementText(node.parentNode); }
|
96 |
+
catch(e) { return r }
|
97 |
+
r.collapse(true);
|
98 |
+
r.moveEnd("character", end);
|
99 |
+
r.moveStart("character", start);
|
100 |
+
return r
|
101 |
+
}; }
|
102 |
+
|
103 |
+
function contains(parent, child) {
|
104 |
+
if (child.nodeType == 3) // Android browser always returns false when child is a textnode
|
105 |
+
{ child = child.parentNode; }
|
106 |
+
if (parent.contains)
|
107 |
+
{ return parent.contains(child) }
|
108 |
+
do {
|
109 |
+
if (child.nodeType == 11) { child = child.host; }
|
110 |
+
if (child == parent) { return true }
|
111 |
+
} while (child = child.parentNode)
|
112 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
113 |
|
114 |
+
function activeElt() {
|
115 |
+
// IE and Edge may throw an "Unspecified Error" when accessing document.activeElement.
|
116 |
+
// IE < 10 will throw when accessed while the page is loading or in an iframe.
|
117 |
+
// IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.
|
118 |
+
var activeElement;
|
119 |
+
try {
|
120 |
+
activeElement = document.activeElement;
|
121 |
+
} catch(e) {
|
122 |
+
activeElement = document.body || null;
|
123 |
}
|
124 |
+
while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)
|
125 |
+
{ activeElement = activeElement.shadowRoot.activeElement; }
|
126 |
+
return activeElement
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
127 |
}
|
128 |
+
|
129 |
+
function addClass(node, cls) {
|
130 |
+
var current = node.className;
|
131 |
+
if (!classTest(cls).test(current)) { node.className += (current ? " " : "") + cls; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
}
|
133 |
+
function joinClasses(a, b) {
|
134 |
+
var as = a.split(" ");
|
135 |
+
for (var i = 0; i < as.length; i++)
|
136 |
+
{ if (as[i] && !classTest(as[i]).test(b)) { b += " " + as[i]; } }
|
137 |
+
return b
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
138 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
139 |
|
140 |
+
var selectInput = function(node) { node.select(); };
|
141 |
+
if (ios) // Mobile Safari apparently has a bug where select() is broken.
|
142 |
+
{ selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }
|
143 |
+
else if (ie) // Suppress mysterious IE10 errors
|
144 |
+
{ selectInput = function(node) { try { node.select(); } catch(_e) {} }; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
145 |
|
146 |
+
function bind(f) {
|
147 |
+
var args = Array.prototype.slice.call(arguments, 1);
|
148 |
+
return function(){return f.apply(null, args)}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
149 |
}
|
150 |
|
151 |
+
function copyObj(obj, target, overwrite) {
|
152 |
+
if (!target) { target = {}; }
|
153 |
+
for (var prop in obj)
|
154 |
+
{ if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))
|
155 |
+
{ target[prop] = obj[prop]; } }
|
156 |
+
return target
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
157 |
}
|
158 |
|
159 |
+
// Counts the column offset in a string, taking tabs into account.
|
160 |
+
// Used mostly to find indentation.
|
161 |
+
function countColumn(string, end, tabSize, startIndex, startValue) {
|
162 |
+
if (end == null) {
|
163 |
+
end = string.search(/[^\s\u00a0]/);
|
164 |
+
if (end == -1) { end = string.length; }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
165 |
}
|
166 |
+
for (var i = startIndex || 0, n = startValue || 0;;) {
|
167 |
+
var nextTab = string.indexOf("\t", i);
|
168 |
+
if (nextTab < 0 || nextTab >= end)
|
169 |
+
{ return n + (end - i) }
|
170 |
+
n += nextTab - i;
|
171 |
+
n += tabSize - (n % tabSize);
|
172 |
+
i = nextTab + 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
173 |
}
|
174 |
}
|
175 |
|
176 |
+
var Delayed = function() {this.id = null;};
|
177 |
+
Delayed.prototype.set = function (ms, f) {
|
178 |
+
clearTimeout(this.id);
|
179 |
+
this.id = setTimeout(f, ms);
|
180 |
+
};
|
181 |
+
|
182 |
+
function indexOf(array, elt) {
|
183 |
+
for (var i = 0; i < array.length; ++i)
|
184 |
+
{ if (array[i] == elt) { return i } }
|
185 |
+
return -1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
186 |
}
|
|
|
187 |
|
188 |
+
// Number of pixels added to scroller and sizer to hide scrollbar
|
189 |
+
var scrollerGap = 30;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
190 |
|
191 |
+
// Returned or thrown by various protocols to signal 'I'm not
|
192 |
+
// handling this'.
|
193 |
+
var Pass = {toString: function(){return "CodeMirror.Pass"}};
|
194 |
|
195 |
+
// Reused option objects for setSelection & friends
|
196 |
+
var sel_dontScroll = {scroll: false}, sel_mouse = {origin: "*mouse"}, sel_move = {origin: "+move"};
|
197 |
|
198 |
+
// The inverse of countColumn -- find the offset that corresponds to
|
199 |
+
// a particular column.
|
200 |
+
function findColumn(string, goal, tabSize) {
|
201 |
+
for (var pos = 0, col = 0;;) {
|
202 |
+
var nextTab = string.indexOf("\t", pos);
|
203 |
+
if (nextTab == -1) { nextTab = string.length; }
|
204 |
+
var skipped = nextTab - pos;
|
205 |
+
if (nextTab == string.length || col + skipped >= goal)
|
206 |
+
{ return pos + Math.min(skipped, goal - col) }
|
207 |
+
col += nextTab - pos;
|
208 |
+
col += tabSize - (col % tabSize);
|
209 |
+
pos = nextTab + 1;
|
210 |
+
if (col >= goal) { return pos }
|
211 |
+
}
|
212 |
}
|
|
|
|
|
213 |
|
214 |
+
var spaceStrs = [""];
|
215 |
+
function spaceStr(n) {
|
216 |
+
while (spaceStrs.length <= n)
|
217 |
+
{ spaceStrs.push(lst(spaceStrs) + " "); }
|
218 |
+
return spaceStrs[n]
|
219 |
+
}
|
220 |
|
221 |
+
function lst(arr) { return arr[arr.length-1] }
|
|
|
|
|
|
|
|
|
222 |
|
223 |
+
function map(array, f) {
|
224 |
+
var out = [];
|
225 |
+
for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }
|
226 |
+
return out
|
227 |
+
}
|
228 |
|
229 |
+
function insertSorted(array, value, score) {
|
230 |
+
var pos = 0, priority = score(value);
|
231 |
+
while (pos < array.length && score(array[pos]) <= priority) { pos++; }
|
232 |
+
array.splice(pos, 0, value);
|
233 |
+
}
|
234 |
|
235 |
+
function nothing() {}
|
|
|
236 |
|
237 |
+
function createObj(base, props) {
|
238 |
+
var inst;
|
239 |
+
if (Object.create) {
|
240 |
+
inst = Object.create(base);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
241 |
} else {
|
242 |
+
nothing.prototype = base;
|
243 |
+
inst = new nothing();
|
244 |
+
}
|
245 |
+
if (props) { copyObj(props, inst); }
|
246 |
+
return inst
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
247 |
}
|
248 |
|
249 |
+
var nonASCIISingleCaseWordChar = /[\u00df\u0587\u0590-\u05f4\u0600-\u06ff\u3040-\u309f\u30a0-\u30ff\u3400-\u4db5\u4e00-\u9fcc\uac00-\ud7af]/;
|
250 |
+
function isWordCharBasic(ch) {
|
251 |
+
return /\w/.test(ch) || ch > "\x80" &&
|
252 |
+
(ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))
|
253 |
+
}
|
254 |
+
function isWordChar(ch, helper) {
|
255 |
+
if (!helper) { return isWordCharBasic(ch) }
|
256 |
+
if (helper.source.indexOf("\\w") > -1 && isWordCharBasic(ch)) { return true }
|
257 |
+
return helper.test(ch)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
259 |
|
260 |
+
function isEmpty(obj) {
|
261 |
+
for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }
|
262 |
+
return true
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
263 |
}
|
264 |
|
265 |
+
// Extending unicode characters. A series of a non-extending char +
|
266 |
+
// any number of extending chars is treated as a single unit as far
|
267 |
+
// as editing and measuring is concerned. This is not fully correct,
|
268 |
+
// since some scripts/fonts/browsers also treat other configurations
|
269 |
+
// of code points as a group.
|
270 |
+
var extendingChars = /[\u0300-\u036f\u0483-\u0489\u0591-\u05bd\u05bf\u05c1\u05c2\u05c4\u05c5\u05c7\u0610-\u061a\u064b-\u065e\u0670\u06d6-\u06dc\u06de-\u06e4\u06e7\u06e8\u06ea-\u06ed\u0711\u0730-\u074a\u07a6-\u07b0\u07eb-\u07f3\u0816-\u0819\u081b-\u0823\u0825-\u0827\u0829-\u082d\u0900-\u0902\u093c\u0941-\u0948\u094d\u0951-\u0955\u0962\u0963\u0981\u09bc\u09be\u09c1-\u09c4\u09cd\u09d7\u09e2\u09e3\u0a01\u0a02\u0a3c\u0a41\u0a42\u0a47\u0a48\u0a4b-\u0a4d\u0a51\u0a70\u0a71\u0a75\u0a81\u0a82\u0abc\u0ac1-\u0ac5\u0ac7\u0ac8\u0acd\u0ae2\u0ae3\u0b01\u0b3c\u0b3e\u0b3f\u0b41-\u0b44\u0b4d\u0b56\u0b57\u0b62\u0b63\u0b82\u0bbe\u0bc0\u0bcd\u0bd7\u0c3e-\u0c40\u0c46-\u0c48\u0c4a-\u0c4d\u0c55\u0c56\u0c62\u0c63\u0cbc\u0cbf\u0cc2\u0cc6\u0ccc\u0ccd\u0cd5\u0cd6\u0ce2\u0ce3\u0d3e\u0d41-\u0d44\u0d4d\u0d57\u0d62\u0d63\u0dca\u0dcf\u0dd2-\u0dd4\u0dd6\u0ddf\u0e31\u0e34-\u0e3a\u0e47-\u0e4e\u0eb1\u0eb4-\u0eb9\u0ebb\u0ebc\u0ec8-\u0ecd\u0f18\u0f19\u0f35\u0f37\u0f39\u0f71-\u0f7e\u0f80-\u0f84\u0f86\u0f87\u0f90-\u0f97\u0f99-\u0fbc\u0fc6\u102d-\u1030\u1032-\u1037\u1039\u103a\u103d\u103e\u1058\u1059\u105e-\u1060\u1071-\u1074\u1082\u1085\u1086\u108d\u109d\u135f\u1712-\u1714\u1732-\u1734\u1752\u1753\u1772\u1773\u17b7-\u17bd\u17c6\u17c9-\u17d3\u17dd\u180b-\u180d\u18a9\u1920-\u1922\u1927\u1928\u1932\u1939-\u193b\u1a17\u1a18\u1a56\u1a58-\u1a5e\u1a60\u1a62\u1a65-\u1a6c\u1a73-\u1a7c\u1a7f\u1b00-\u1b03\u1b34\u1b36-\u1b3a\u1b3c\u1b42\u1b6b-\u1b73\u1b80\u1b81\u1ba2-\u1ba5\u1ba8\u1ba9\u1c2c-\u1c33\u1c36\u1c37\u1cd0-\u1cd2\u1cd4-\u1ce0\u1ce2-\u1ce8\u1ced\u1dc0-\u1de6\u1dfd-\u1dff\u200c\u200d\u20d0-\u20f0\u2cef-\u2cf1\u2de0-\u2dff\u302a-\u302f\u3099\u309a\ua66f-\ua672\ua67c\ua67d\ua6f0\ua6f1\ua802\ua806\ua80b\ua825\ua826\ua8c4\ua8e0-\ua8f1\ua926-\ua92d\ua947-\ua951\ua980-\ua982\ua9b3\ua9b6-\ua9b9\ua9bc\uaa29-\uaa2e\uaa31\uaa32\uaa35\uaa36\uaa43\uaa4c\uaab0\uaab2-\uaab4\uaab7\uaab8\uaabe\uaabf\uaac1\uabe5\uabe8\uabed\udc00-\udfff\ufb1e\ufe00-\ufe0f\ufe20-\ufe26\uff9e\uff9f]/;
|
271 |
+
function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }
|
272 |
|
273 |
+
// Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.
|
274 |
+
function skipExtendingChars(str, pos, dir) {
|
275 |
+
while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }
|
276 |
+
return pos
|
277 |
+
}
|
278 |
|
279 |
+
// Returns the value from the range [`from`; `to`] that satisfies
|
280 |
+
// `pred` and is closest to `from`. Assumes that at least `to`
|
281 |
+
// satisfies `pred`. Supports `from` being greater than `to`.
|
282 |
+
function findFirst(pred, from, to) {
|
283 |
+
// At any point we are certain `to` satisfies `pred`, don't know
|
284 |
+
// whether `from` does.
|
285 |
+
var dir = from > to ? -1 : 1;
|
286 |
+
for (;;) {
|
287 |
+
if (from == to) { return from }
|
288 |
+
var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);
|
289 |
+
if (mid == from) { return pred(mid) ? from : to }
|
290 |
+
if (pred(mid)) { to = mid; }
|
291 |
+
else { from = mid + dir; }
|
292 |
+
}
|
293 |
+
}
|
294 |
+
|
295 |
+
// The display handles the DOM integration, both for input reading
|
296 |
+
// and content drawing. It holds references to DOM nodes and
|
297 |
+
// display-related state.
|
298 |
+
|
299 |
+
function Display(place, doc, input) {
|
300 |
+
var d = this;
|
301 |
+
this.input = input;
|
302 |
+
|
303 |
+
// Covers bottom-right square when both scrollbars are present.
|
304 |
+
d.scrollbarFiller = elt("div", null, "CodeMirror-scrollbar-filler");
|
305 |
+
d.scrollbarFiller.setAttribute("cm-not-content", "true");
|
306 |
+
// Covers bottom of gutter when coverGutterNextToScrollbar is on
|
307 |
+
// and h scrollbar is present.
|
308 |
+
d.gutterFiller = elt("div", null, "CodeMirror-gutter-filler");
|
309 |
+
d.gutterFiller.setAttribute("cm-not-content", "true");
|
310 |
+
// Will contain the actual code, positioned to cover the viewport.
|
311 |
+
d.lineDiv = eltP("div", null, "CodeMirror-code");
|
312 |
+
// Elements are added to these to represent selection and cursors.
|
313 |
+
d.selectionDiv = elt("div", null, null, "position: relative; z-index: 1");
|
314 |
+
d.cursorDiv = elt("div", null, "CodeMirror-cursors");
|
315 |
+
// A visibility: hidden element used to find the size of things.
|
316 |
+
d.measure = elt("div", null, "CodeMirror-measure");
|
317 |
+
// When lines outside of the viewport are measured, they are drawn in this.
|
318 |
+
d.lineMeasure = elt("div", null, "CodeMirror-measure");
|
319 |
+
// Wraps everything that needs to exist inside the vertically-padded coordinate system
|
320 |
+
d.lineSpace = eltP("div", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],
|
321 |
+
null, "position: relative; outline: none");
|
322 |
+
var lines = eltP("div", [d.lineSpace], "CodeMirror-lines");
|
323 |
+
// Moved around its parent to cover visible view.
|
324 |
+
d.mover = elt("div", [lines], null, "position: relative");
|
325 |
+
// Set to the height of the document, allowing scrolling.
|
326 |
+
d.sizer = elt("div", [d.mover], "CodeMirror-sizer");
|
327 |
+
d.sizerWidth = null;
|
328 |
+
// Behavior of elts with overflow: auto and padding is
|
329 |
+
// inconsistent across browsers. This is used to ensure the
|
330 |
+
// scrollable area is big enough.
|
331 |
+
d.heightForcer = elt("div", null, null, "position: absolute; height: " + scrollerGap + "px; width: 1px;");
|
332 |
+
// Will contain the gutters, if any.
|
333 |
+
d.gutters = elt("div", null, "CodeMirror-gutters");
|
334 |
+
d.lineGutter = null;
|
335 |
+
// Actual scrollable element.
|
336 |
+
d.scroller = elt("div", [d.sizer, d.heightForcer, d.gutters], "CodeMirror-scroll");
|
337 |
+
d.scroller.setAttribute("tabIndex", "-1");
|
338 |
+
// The element in which the editor lives.
|
339 |
+
d.wrapper = elt("div", [d.scrollbarFiller, d.gutterFiller, d.scroller], "CodeMirror");
|
340 |
+
|
341 |
+
// Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)
|
342 |
+
if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }
|
343 |
+
if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }
|
344 |
+
|
345 |
+
if (place) {
|
346 |
+
if (place.appendChild) { place.appendChild(d.wrapper); }
|
347 |
+
else { place(d.wrapper); }
|
348 |
+
}
|
349 |
+
|
350 |
+
// Current rendered range (may be bigger than the view window).
|
351 |
+
d.viewFrom = d.viewTo = doc.first;
|
352 |
+
d.reportedViewFrom = d.reportedViewTo = doc.first;
|
353 |
+
// Information about the rendered lines.
|
354 |
+
d.view = [];
|
355 |
+
d.renderedView = null;
|
356 |
+
// Holds info about a single rendered line when it was rendered
|
357 |
+
// for measurement, while not in view.
|
358 |
+
d.externalMeasured = null;
|
359 |
+
// Empty space (in pixels) above the view
|
360 |
+
d.viewOffset = 0;
|
361 |
+
d.lastWrapHeight = d.lastWrapWidth = 0;
|
362 |
+
d.updateLineNumbers = null;
|
363 |
+
|
364 |
+
d.nativeBarWidth = d.barHeight = d.barWidth = 0;
|
365 |
+
d.scrollbarsClipped = false;
|
366 |
+
|
367 |
+
// Used to only resize the line number gutter when necessary (when
|
368 |
+
// the amount of lines crosses a boundary that makes its width change)
|
369 |
+
d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;
|
370 |
+
// Set to true when a non-horizontal-scrolling line widget is
|
371 |
+
// added. As an optimization, line widget aligning is skipped when
|
372 |
+
// this is false.
|
373 |
+
d.alignWidgets = false;
|
374 |
+
|
375 |
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
|
376 |
+
|
377 |
+
// Tracks the maximum line length so that the horizontal scrollbar
|
378 |
+
// can be kept static when scrolling.
|
379 |
+
d.maxLine = null;
|
380 |
+
d.maxLineLength = 0;
|
381 |
+
d.maxLineChanged = false;
|
382 |
+
|
383 |
+
// Used for measuring wheel scrolling granularity
|
384 |
+
d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;
|
385 |
+
|
386 |
+
// True when shift is held down.
|
387 |
+
d.shift = false;
|
388 |
+
|
389 |
+
// Used to track whether anything happened since the context menu
|
390 |
+
// was opened.
|
391 |
+
d.selForContextMenu = null;
|
392 |
+
|
393 |
+
d.activeTouch = null;
|
394 |
+
|
395 |
+
input.init(d);
|
396 |
+
}
|
397 |
+
|
398 |
+
// Find the line object corresponding to the given line number.
|
399 |
+
function getLine(doc, n) {
|
400 |
+
n -= doc.first;
|
401 |
+
if (n < 0 || n >= doc.size) { throw new Error("There is no line " + (n + doc.first) + " in the document.") }
|
402 |
+
var chunk = doc;
|
403 |
+
while (!chunk.lines) {
|
404 |
+
for (var i = 0;; ++i) {
|
405 |
+
var child = chunk.children[i], sz = child.chunkSize();
|
406 |
+
if (n < sz) { chunk = child; break }
|
407 |
+
n -= sz;
|
408 |
+
}
|
409 |
}
|
410 |
+
return chunk.lines[n]
|
411 |
+
}
|
412 |
+
|
413 |
+
// Get the part of a document between two positions, as an array of
|
414 |
+
// strings.
|
415 |
+
function getBetween(doc, start, end) {
|
416 |
+
var out = [], n = start.line;
|
417 |
+
doc.iter(start.line, end.line + 1, function (line) {
|
418 |
+
var text = line.text;
|
419 |
+
if (n == end.line) { text = text.slice(0, end.ch); }
|
420 |
+
if (n == start.line) { text = text.slice(start.ch); }
|
421 |
+
out.push(text);
|
422 |
+
++n;
|
423 |
+
});
|
424 |
+
return out
|
425 |
+
}
|
426 |
+
// Get the lines between from and to, as array of strings.
|
427 |
+
function getLines(doc, from, to) {
|
428 |
+
var out = [];
|
429 |
+
doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value
|
430 |
+
return out
|
431 |
+
}
|
432 |
+
|
433 |
+
// Update the height of a line, propagating the height change
|
434 |
+
// upwards to parent nodes.
|
435 |
+
function updateLineHeight(line, height) {
|
436 |
+
var diff = height - line.height;
|
437 |
+
if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }
|
438 |
+
}
|
439 |
+
|
440 |
+
// Given a line object, find its line number by walking up through
|
441 |
+
// its parent links.
|
442 |
+
function lineNo(line) {
|
443 |
+
if (line.parent == null) { return null }
|
444 |
+
var cur = line.parent, no = indexOf(cur.lines, line);
|
445 |
+
for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {
|
446 |
+
for (var i = 0;; ++i) {
|
447 |
+
if (chunk.children[i] == cur) { break }
|
448 |
+
no += chunk.children[i].chunkSize();
|
449 |
}
|
450 |
+
}
|
451 |
+
return no + cur.first
|
452 |
+
}
|
453 |
|
454 |
+
// Find the line at the given vertical position, using the height
|
455 |
+
// information in the document tree.
|
456 |
+
function lineAtHeight(chunk, h) {
|
457 |
+
var n = chunk.first;
|
458 |
+
outer: do {
|
459 |
+
for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {
|
460 |
+
var child = chunk.children[i$1], ch = child.height;
|
461 |
+
if (h < ch) { chunk = child; continue outer }
|
462 |
+
h -= ch;
|
463 |
+
n += child.chunkSize();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
}
|
465 |
+
return n
|
466 |
+
} while (!chunk.lines)
|
467 |
+
var i = 0;
|
468 |
+
for (; i < chunk.lines.length; ++i) {
|
469 |
+
var line = chunk.lines[i], lh = line.height;
|
470 |
+
if (h < lh) { break }
|
471 |
+
h -= lh;
|
472 |
+
}
|
473 |
+
return n + i
|
474 |
}
|
475 |
|
476 |
+
function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}
|
477 |
+
|
478 |
+
function lineNumberFor(options, i) {
|
479 |
+
return String(options.lineNumberFormatter(i + options.firstLineNumber))
|
480 |
+
}
|
481 |
|
482 |
+
// A Pos instance represents a position within the text.
|
483 |
+
function Pos(line, ch, sticky) {
|
484 |
+
if ( sticky === void 0 ) sticky = null;
|
485 |
|
486 |
+
if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }
|
487 |
+
this.line = line;
|
488 |
+
this.ch = ch;
|
489 |
+
this.sticky = sticky;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
490 |
}
|
491 |
|
492 |
+
// Compare two positions, return 0 if they are the same, a negative
|
493 |
+
// number when a is less, and a positive number otherwise.
|
494 |
+
function cmp(a, b) { return a.line - b.line || a.ch - b.ch }
|
495 |
|
496 |
+
function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
497 |
|
498 |
+
function copyPos(x) {return Pos(x.line, x.ch)}
|
499 |
+
function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }
|
500 |
+
function minPos(a, b) { return cmp(a, b) < 0 ? a : b }
|
501 |
+
|
502 |
+
// Most of the external API clips given positions to make sure they
|
503 |
+
// actually exist within the document.
|
504 |
+
function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}
|
505 |
+
function clipPos(doc, pos) {
|
506 |
+
if (pos.line < doc.first) { return Pos(doc.first, 0) }
|
507 |
+
var last = doc.first + doc.size - 1;
|
508 |
+
if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }
|
509 |
+
return clipToLen(pos, getLine(doc, pos.line).text.length)
|
510 |
+
}
|
511 |
+
function clipToLen(pos, linelen) {
|
512 |
+
var ch = pos.ch;
|
513 |
+
if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }
|
514 |
+
else if (ch < 0) { return Pos(pos.line, 0) }
|
515 |
+
else { return pos }
|
516 |
+
}
|
517 |
+
function clipPosArray(doc, array) {
|
518 |
+
var out = [];
|
519 |
+
for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }
|
520 |
+
return out
|
521 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
522 |
|
523 |
+
// Optimize some code when these features are not used.
|
524 |
+
var sawReadOnlySpans = false, sawCollapsedSpans = false;
|
525 |
|
526 |
+
function seeReadOnlySpans() {
|
527 |
+
sawReadOnlySpans = true;
|
|
|
|
|
|
|
|
|
528 |
}
|
|
|
|
|
529 |
|
530 |
+
function seeCollapsedSpans() {
|
531 |
+
sawCollapsedSpans = true;
|
532 |
+
}
|
533 |
|
534 |
+
// TEXTMARKER SPANS
|
|
|
|
|
535 |
|
536 |
+
function MarkedSpan(marker, from, to) {
|
537 |
+
this.marker = marker;
|
538 |
+
this.from = from; this.to = to;
|
539 |
+
}
|
|
|
|
|
|
|
|
|
540 |
|
541 |
+
// Search an array of spans for a span matching the given marker.
|
542 |
+
function getMarkedSpanFor(spans, marker) {
|
543 |
+
if (spans) { for (var i = 0; i < spans.length; ++i) {
|
544 |
+
var span = spans[i];
|
545 |
+
if (span.marker == marker) { return span }
|
546 |
+
} }
|
547 |
+
}
|
548 |
+
// Remove a span from an array, returning undefined if no spans are
|
549 |
+
// left (we don't store arrays for lines without spans).
|
550 |
+
function removeMarkedSpan(spans, span) {
|
551 |
+
var r;
|
552 |
+
for (var i = 0; i < spans.length; ++i)
|
553 |
+
{ if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }
|
554 |
+
return r
|
555 |
+
}
|
556 |
+
// Add a span to a line.
|
557 |
+
function addMarkedSpan(line, span) {
|
558 |
+
line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];
|
559 |
+
span.marker.attachLine(line);
|
560 |
+
}
|
561 |
+
|
562 |
+
// Used for the algorithm that adjusts markers for a change in the
|
563 |
+
// document. These functions cut an array of spans at a given
|
564 |
+
// character position, returning an array of remaining chunks (or
|
565 |
+
// undefined if nothing remains).
|
566 |
+
function markedSpansBefore(old, startCh, isInsert) {
|
567 |
+
var nw;
|
568 |
+
if (old) { for (var i = 0; i < old.length; ++i) {
|
569 |
+
var span = old[i], marker = span.marker;
|
570 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);
|
571 |
+
if (startsBefore || span.from == startCh && marker.type == "bookmark" && (!isInsert || !span.marker.insertLeft)) {
|
572 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)
|
573 |
+
;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));
|
574 |
+
}
|
575 |
+
} }
|
576 |
+
return nw
|
577 |
+
}
|
578 |
+
function markedSpansAfter(old, endCh, isInsert) {
|
579 |
+
var nw;
|
580 |
+
if (old) { for (var i = 0; i < old.length; ++i) {
|
581 |
+
var span = old[i], marker = span.marker;
|
582 |
+
var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);
|
583 |
+
if (endsAfter || span.from == endCh && marker.type == "bookmark" && (!isInsert || span.marker.insertLeft)) {
|
584 |
+
var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)
|
585 |
+
;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,
|
586 |
+
span.to == null ? null : span.to - endCh));
|
587 |
+
}
|
588 |
+
} }
|
589 |
+
return nw
|
590 |
+
}
|
591 |
+
|
592 |
+
// Given a change object, compute the new set of marker spans that
|
593 |
+
// cover the line in which the change took place. Removes spans
|
594 |
+
// entirely within the change, reconnects spans belonging to the
|
595 |
+
// same marker that appear on both sides of the change, and cuts off
|
596 |
+
// spans partially within the change. Returns an array of span
|
597 |
+
// arrays with one element for each line in (after) the change.
|
598 |
+
function stretchSpansOverChange(doc, change) {
|
599 |
+
if (change.full) { return null }
|
600 |
+
var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;
|
601 |
+
var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;
|
602 |
+
if (!oldFirst && !oldLast) { return null }
|
603 |
+
|
604 |
+
var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;
|
605 |
+
// Get the spans that 'stick out' on both sides
|
606 |
+
var first = markedSpansBefore(oldFirst, startCh, isInsert);
|
607 |
+
var last = markedSpansAfter(oldLast, endCh, isInsert);
|
608 |
+
|
609 |
+
// Next, merge those two ends
|
610 |
+
var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);
|
611 |
+
if (first) {
|
612 |
+
// Fix up .to properties of first
|
613 |
+
for (var i = 0; i < first.length; ++i) {
|
614 |
+
var span = first[i];
|
615 |
+
if (span.to == null) {
|
616 |
+
var found = getMarkedSpanFor(last, span.marker);
|
617 |
+
if (!found) { span.to = startCh; }
|
618 |
+
else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }
|
619 |
+
}
|
620 |
+
}
|
621 |
+
}
|
622 |
+
if (last) {
|
623 |
+
// Fix up .from in last (or move them into first in case of sameLine)
|
624 |
+
for (var i$1 = 0; i$1 < last.length; ++i$1) {
|
625 |
+
var span$1 = last[i$1];
|
626 |
+
if (span$1.to != null) { span$1.to += offset; }
|
627 |
+
if (span$1.from == null) {
|
628 |
+
var found$1 = getMarkedSpanFor(first, span$1.marker);
|
629 |
+
if (!found$1) {
|
630 |
+
span$1.from = offset;
|
631 |
+
if (sameLine) { (first || (first = [])).push(span$1); }
|
632 |
+
}
|
633 |
+
} else {
|
634 |
+
span$1.from += offset;
|
635 |
+
if (sameLine) { (first || (first = [])).push(span$1); }
|
636 |
+
}
|
637 |
+
}
|
638 |
+
}
|
639 |
+
// Make sure we didn't create any zero-length spans
|
640 |
+
if (first) { first = clearEmptySpans(first); }
|
641 |
+
if (last && last != first) { last = clearEmptySpans(last); }
|
642 |
+
|
643 |
+
var newMarkers = [first];
|
644 |
+
if (!sameLine) {
|
645 |
+
// Fill gap with whole-line-spans
|
646 |
+
var gap = change.text.length - 2, gapMarkers;
|
647 |
+
if (gap > 0 && first)
|
648 |
+
{ for (var i$2 = 0; i$2 < first.length; ++i$2)
|
649 |
+
{ if (first[i$2].to == null)
|
650 |
+
{ (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }
|
651 |
+
for (var i$3 = 0; i$3 < gap; ++i$3)
|
652 |
+
{ newMarkers.push(gapMarkers); }
|
653 |
+
newMarkers.push(last);
|
654 |
+
}
|
655 |
+
return newMarkers
|
656 |
+
}
|
657 |
+
|
658 |
+
// Remove spans that are empty and don't have a clearWhenEmpty
|
659 |
+
// option of false.
|
660 |
+
function clearEmptySpans(spans) {
|
661 |
+
for (var i = 0; i < spans.length; ++i) {
|
662 |
+
var span = spans[i];
|
663 |
+
if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)
|
664 |
+
{ spans.splice(i--, 1); }
|
665 |
+
}
|
666 |
+
if (!spans.length) { return null }
|
667 |
+
return spans
|
668 |
+
}
|
669 |
+
|
670 |
+
// Used to 'clip' out readOnly ranges when making a change.
|
671 |
+
function removeReadOnlyRanges(doc, from, to) {
|
672 |
+
var markers = null;
|
673 |
+
doc.iter(from.line, to.line + 1, function (line) {
|
674 |
+
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
675 |
+
var mark = line.markedSpans[i].marker;
|
676 |
+
if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))
|
677 |
+
{ (markers || (markers = [])).push(mark); }
|
678 |
+
} }
|
679 |
+
});
|
680 |
+
if (!markers) { return null }
|
681 |
+
var parts = [{from: from, to: to}];
|
682 |
+
for (var i = 0; i < markers.length; ++i) {
|
683 |
+
var mk = markers[i], m = mk.find(0);
|
684 |
+
for (var j = 0; j < parts.length; ++j) {
|
685 |
+
var p = parts[j];
|
686 |
+
if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }
|
687 |
+
var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);
|
688 |
+
if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)
|
689 |
+
{ newParts.push({from: p.from, to: m.from}); }
|
690 |
+
if (dto > 0 || !mk.inclusiveRight && !dto)
|
691 |
+
{ newParts.push({from: m.to, to: p.to}); }
|
692 |
+
parts.splice.apply(parts, newParts);
|
693 |
+
j += newParts.length - 3;
|
694 |
+
}
|
695 |
+
}
|
696 |
+
return parts
|
697 |
+
}
|
698 |
|
699 |
+
// Connect or disconnect spans from a line.
|
700 |
+
function detachMarkedSpans(line) {
|
701 |
+
var spans = line.markedSpans;
|
702 |
+
if (!spans) { return }
|
703 |
+
for (var i = 0; i < spans.length; ++i)
|
704 |
+
{ spans[i].marker.detachLine(line); }
|
705 |
+
line.markedSpans = null;
|
706 |
+
}
|
707 |
+
function attachMarkedSpans(line, spans) {
|
708 |
+
if (!spans) { return }
|
709 |
+
for (var i = 0; i < spans.length; ++i)
|
710 |
+
{ spans[i].marker.attachLine(line); }
|
711 |
+
line.markedSpans = spans;
|
712 |
+
}
|
713 |
+
|
714 |
+
// Helpers used when computing which overlapping collapsed span
|
715 |
+
// counts as the larger one.
|
716 |
+
function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }
|
717 |
+
function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }
|
718 |
+
|
719 |
+
// Returns a number indicating which of two overlapping collapsed
|
720 |
+
// spans is larger (and thus includes the other). Falls back to
|
721 |
+
// comparing ids when the spans cover exactly the same range.
|
722 |
+
function compareCollapsedMarkers(a, b) {
|
723 |
+
var lenDiff = a.lines.length - b.lines.length;
|
724 |
+
if (lenDiff != 0) { return lenDiff }
|
725 |
+
var aPos = a.find(), bPos = b.find();
|
726 |
+
var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);
|
727 |
+
if (fromCmp) { return -fromCmp }
|
728 |
+
var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);
|
729 |
+
if (toCmp) { return toCmp }
|
730 |
+
return b.id - a.id
|
731 |
+
}
|
732 |
+
|
733 |
+
// Find out whether a line ends or starts in a collapsed span. If
|
734 |
+
// so, return the marker for that span.
|
735 |
+
function collapsedSpanAtSide(line, start) {
|
736 |
+
var sps = sawCollapsedSpans && line.markedSpans, found;
|
737 |
+
if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
|
738 |
+
sp = sps[i];
|
739 |
+
if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&
|
740 |
+
(!found || compareCollapsedMarkers(found, sp.marker) < 0))
|
741 |
+
{ found = sp.marker; }
|
742 |
+
} }
|
743 |
+
return found
|
744 |
+
}
|
745 |
+
function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }
|
746 |
+
function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }
|
747 |
|
748 |
+
function collapsedSpanAround(line, ch) {
|
749 |
+
var sps = sawCollapsedSpans && line.markedSpans, found;
|
750 |
+
if (sps) { for (var i = 0; i < sps.length; ++i) {
|
751 |
+
var sp = sps[i];
|
752 |
+
if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&
|
753 |
+
(!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }
|
754 |
+
} }
|
755 |
+
return found
|
756 |
+
}
|
757 |
|
758 |
+
// Test whether there exists a collapsed span that partially
|
759 |
+
// overlaps (covers the start or end, but not both) of a new span.
|
760 |
+
// Such overlap is not allowed.
|
761 |
+
function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {
|
762 |
+
var line = getLine(doc, lineNo$$1);
|
763 |
+
var sps = sawCollapsedSpans && line.markedSpans;
|
764 |
+
if (sps) { for (var i = 0; i < sps.length; ++i) {
|
765 |
+
var sp = sps[i];
|
766 |
+
if (!sp.marker.collapsed) { continue }
|
767 |
+
var found = sp.marker.find(0);
|
768 |
+
var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);
|
769 |
+
var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);
|
770 |
+
if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }
|
771 |
+
if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||
|
772 |
+
fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))
|
773 |
+
{ return true }
|
774 |
+
} }
|
775 |
+
}
|
776 |
|
777 |
+
// A visual line is a line as drawn on the screen. Folding, for
|
778 |
+
// example, can cause multiple logical lines to appear on the same
|
779 |
+
// visual line. This finds the start of the visual line that the
|
780 |
+
// given line is part of (usually that is the line itself).
|
781 |
+
function visualLine(line) {
|
782 |
+
var merged;
|
783 |
+
while (merged = collapsedSpanAtStart(line))
|
784 |
+
{ line = merged.find(-1, true).line; }
|
785 |
+
return line
|
786 |
+
}
|
787 |
+
|
788 |
+
function visualLineEnd(line) {
|
789 |
+
var merged;
|
790 |
+
while (merged = collapsedSpanAtEnd(line))
|
791 |
+
{ line = merged.find(1, true).line; }
|
792 |
+
return line
|
793 |
+
}
|
794 |
+
|
795 |
+
// Returns an array of logical lines that continue the visual line
|
796 |
+
// started by the argument, or undefined if there are no such lines.
|
797 |
+
function visualLineContinued(line) {
|
798 |
+
var merged, lines;
|
799 |
+
while (merged = collapsedSpanAtEnd(line)) {
|
800 |
+
line = merged.find(1, true).line
|
801 |
+
;(lines || (lines = [])).push(line);
|
802 |
+
}
|
803 |
+
return lines
|
804 |
+
}
|
805 |
+
|
806 |
+
// Get the line number of the start of the visual line that the
|
807 |
+
// given line number is part of.
|
808 |
+
function visualLineNo(doc, lineN) {
|
809 |
+
var line = getLine(doc, lineN), vis = visualLine(line);
|
810 |
+
if (line == vis) { return lineN }
|
811 |
+
return lineNo(vis)
|
812 |
+
}
|
813 |
+
|
814 |
+
// Get the line number of the start of the next visual line after
|
815 |
+
// the given line.
|
816 |
+
function visualLineEndNo(doc, lineN) {
|
817 |
+
if (lineN > doc.lastLine()) { return lineN }
|
818 |
+
var line = getLine(doc, lineN), merged;
|
819 |
+
if (!lineIsHidden(doc, line)) { return lineN }
|
820 |
+
while (merged = collapsedSpanAtEnd(line))
|
821 |
+
{ line = merged.find(1, true).line; }
|
822 |
+
return lineNo(line) + 1
|
823 |
+
}
|
824 |
+
|
825 |
+
// Compute whether a line is hidden. Lines count as hidden when they
|
826 |
+
// are part of a visual line that starts with another line, or when
|
827 |
+
// they are entirely covered by collapsed, non-widget span.
|
828 |
+
function lineIsHidden(doc, line) {
|
829 |
+
var sps = sawCollapsedSpans && line.markedSpans;
|
830 |
+
if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {
|
831 |
+
sp = sps[i];
|
832 |
+
if (!sp.marker.collapsed) { continue }
|
833 |
+
if (sp.from == null) { return true }
|
834 |
+
if (sp.marker.widgetNode) { continue }
|
835 |
+
if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))
|
836 |
+
{ return true }
|
837 |
+
} }
|
838 |
+
}
|
839 |
+
function lineIsHiddenInner(doc, line, span) {
|
840 |
+
if (span.to == null) {
|
841 |
+
var end = span.marker.find(1, true);
|
842 |
+
return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))
|
843 |
+
}
|
844 |
+
if (span.marker.inclusiveRight && span.to == line.text.length)
|
845 |
+
{ return true }
|
846 |
+
for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {
|
847 |
+
sp = line.markedSpans[i];
|
848 |
+
if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&
|
849 |
+
(sp.to == null || sp.to != span.from) &&
|
850 |
+
(sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&
|
851 |
+
lineIsHiddenInner(doc, line, sp)) { return true }
|
852 |
+
}
|
853 |
+
}
|
854 |
+
|
855 |
+
// Find the height above the given line.
|
856 |
+
function heightAtLine(lineObj) {
|
857 |
+
lineObj = visualLine(lineObj);
|
858 |
+
|
859 |
+
var h = 0, chunk = lineObj.parent;
|
860 |
+
for (var i = 0; i < chunk.lines.length; ++i) {
|
861 |
+
var line = chunk.lines[i];
|
862 |
+
if (line == lineObj) { break }
|
863 |
+
else { h += line.height; }
|
864 |
+
}
|
865 |
+
for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {
|
866 |
+
for (var i$1 = 0; i$1 < p.children.length; ++i$1) {
|
867 |
+
var cur = p.children[i$1];
|
868 |
+
if (cur == chunk) { break }
|
869 |
+
else { h += cur.height; }
|
870 |
+
}
|
871 |
+
}
|
872 |
+
return h
|
873 |
+
}
|
874 |
+
|
875 |
+
// Compute the character length of a line, taking into account
|
876 |
+
// collapsed ranges (see markText) that might hide parts, and join
|
877 |
+
// other lines onto it.
|
878 |
+
function lineLength(line) {
|
879 |
+
if (line.height == 0) { return 0 }
|
880 |
+
var len = line.text.length, merged, cur = line;
|
881 |
+
while (merged = collapsedSpanAtStart(cur)) {
|
882 |
+
var found = merged.find(0, true);
|
883 |
+
cur = found.from.line;
|
884 |
+
len += found.from.ch - found.to.ch;
|
885 |
+
}
|
886 |
+
cur = line;
|
887 |
+
while (merged = collapsedSpanAtEnd(cur)) {
|
888 |
+
var found$1 = merged.find(0, true);
|
889 |
+
len -= cur.text.length - found$1.from.ch;
|
890 |
+
cur = found$1.to.line;
|
891 |
+
len += cur.text.length - found$1.to.ch;
|
892 |
+
}
|
893 |
+
return len
|
894 |
+
}
|
895 |
+
|
896 |
+
// Find the longest line in the document.
|
897 |
+
function findMaxLine(cm) {
|
898 |
+
var d = cm.display, doc = cm.doc;
|
899 |
+
d.maxLine = getLine(doc, doc.first);
|
900 |
+
d.maxLineLength = lineLength(d.maxLine);
|
901 |
+
d.maxLineChanged = true;
|
902 |
+
doc.iter(function (line) {
|
903 |
+
var len = lineLength(line);
|
904 |
+
if (len > d.maxLineLength) {
|
905 |
+
d.maxLineLength = len;
|
906 |
+
d.maxLine = line;
|
907 |
+
}
|
908 |
+
});
|
909 |
}
|
|
|
910 |
|
911 |
+
// BIDI HELPERS
|
|
|
912 |
|
913 |
+
function iterateBidiSections(order, from, to, f) {
|
914 |
+
if (!order) { return f(from, to, "ltr", 0) }
|
915 |
+
var found = false;
|
916 |
+
for (var i = 0; i < order.length; ++i) {
|
917 |
+
var part = order[i];
|
918 |
+
if (part.from < to && part.to > from || from == to && part.to == from) {
|
919 |
+
f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? "rtl" : "ltr", i);
|
920 |
+
found = true;
|
921 |
+
}
|
922 |
+
}
|
923 |
+
if (!found) { f(from, to, "ltr"); }
|
924 |
}
|
|
|
|
|
|
|
|
|
925 |
|
926 |
+
var bidiOther = null;
|
927 |
+
function getBidiPartAt(order, ch, sticky) {
|
928 |
+
var found;
|
929 |
+
bidiOther = null;
|
930 |
+
for (var i = 0; i < order.length; ++i) {
|
931 |
+
var cur = order[i];
|
932 |
+
if (cur.from < ch && cur.to > ch) { return i }
|
933 |
+
if (cur.to == ch) {
|
934 |
+
if (cur.from != cur.to && sticky == "before") { found = i; }
|
935 |
+
else { bidiOther = i; }
|
936 |
+
}
|
937 |
+
if (cur.from == ch) {
|
938 |
+
if (cur.from != cur.to && sticky != "before") { found = i; }
|
939 |
+
else { bidiOther = i; }
|
940 |
+
}
|
941 |
+
}
|
942 |
+
return found != null ? found : bidiOther
|
943 |
+
}
|
944 |
+
|
945 |
+
// Bidirectional ordering algorithm
|
946 |
+
// See http://unicode.org/reports/tr9/tr9-13.html for the algorithm
|
947 |
+
// that this (partially) implements.
|
948 |
+
|
949 |
+
// One-char codes used for character types:
|
950 |
+
// L (L): Left-to-Right
|
951 |
+
// R (R): Right-to-Left
|
952 |
+
// r (AL): Right-to-Left Arabic
|
953 |
+
// 1 (EN): European Number
|
954 |
+
// + (ES): European Number Separator
|
955 |
+
// % (ET): European Number Terminator
|
956 |
+
// n (AN): Arabic Number
|
957 |
+
// , (CS): Common Number Separator
|
958 |
+
// m (NSM): Non-Spacing Mark
|
959 |
+
// b (BN): Boundary Neutral
|
960 |
+
// s (B): Paragraph Separator
|
961 |
+
// t (S): Segment Separator
|
962 |
+
// w (WS): Whitespace
|
963 |
+
// N (ON): Other Neutrals
|
964 |
+
|
965 |
+
// Returns null if characters are ordered as they appear
|
966 |
+
// (left-to-right), or an array of sections ({from, to, level}
|
967 |
+
// objects) in the order in which they occur visually.
|
968 |
+
var bidiOrdering = (function() {
|
969 |
+
// Character types for codepoints 0 to 0xff
|
970 |
+
var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN";
|
971 |
+
// Character types for codepoints 0x600 to 0x6f9
|
972 |
+
var arabicTypes = "nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111";
|
973 |
+
function charType(code) {
|
974 |
+
if (code <= 0xf7) { return lowTypes.charAt(code) }
|
975 |
+
else if (0x590 <= code && code <= 0x5f4) { return "R" }
|
976 |
+
else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }
|
977 |
+
else if (0x6ee <= code && code <= 0x8ac) { return "r" }
|
978 |
+
else if (0x2000 <= code && code <= 0x200b) { return "w" }
|
979 |
+
else if (code == 0x200c) { return "b" }
|
980 |
+
else { return "L" }
|
981 |
+
}
|
982 |
+
|
983 |
+
var bidiRE = /[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/;
|
984 |
+
var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;
|
985 |
+
|
986 |
+
function BidiSpan(level, from, to) {
|
987 |
+
this.level = level;
|
988 |
+
this.from = from; this.to = to;
|
989 |
+
}
|
990 |
+
|
991 |
+
return function(str, direction) {
|
992 |
+
var outerType = direction == "ltr" ? "L" : "R";
|
993 |
+
|
994 |
+
if (str.length == 0 || direction == "ltr" && !bidiRE.test(str)) { return false }
|
995 |
+
var len = str.length, types = [];
|
996 |
+
for (var i = 0; i < len; ++i)
|
997 |
+
{ types.push(charType(str.charCodeAt(i))); }
|
998 |
+
|
999 |
+
// W1. Examine each non-spacing mark (NSM) in the level run, and
|
1000 |
+
// change the type of the NSM to the type of the previous
|
1001 |
+
// character. If the NSM is at the start of the level run, it will
|
1002 |
+
// get the type of sor.
|
1003 |
+
for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {
|
1004 |
+
var type = types[i$1];
|
1005 |
+
if (type == "m") { types[i$1] = prev; }
|
1006 |
+
else { prev = type; }
|
1007 |
+
}
|
1008 |
|
1009 |
+
// W2. Search backwards from each instance of a European number
|
1010 |
+
// until the first strong type (R, L, AL, or sor) is found. If an
|
1011 |
+
// AL is found, change the type of the European number to Arabic
|
1012 |
+
// number.
|
1013 |
+
// W3. Change all ALs to R.
|
1014 |
+
for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {
|
1015 |
+
var type$1 = types[i$2];
|
1016 |
+
if (type$1 == "1" && cur == "r") { types[i$2] = "n"; }
|
1017 |
+
else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == "r") { types[i$2] = "R"; } }
|
1018 |
+
}
|
1019 |
|
1020 |
+
// W4. A single European separator between two European numbers
|
1021 |
+
// changes to a European number. A single common separator between
|
1022 |
+
// two numbers of the same type changes to that type.
|
1023 |
+
for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {
|
1024 |
+
var type$2 = types[i$3];
|
1025 |
+
if (type$2 == "+" && prev$1 == "1" && types[i$3+1] == "1") { types[i$3] = "1"; }
|
1026 |
+
else if (type$2 == "," && prev$1 == types[i$3+1] &&
|
1027 |
+
(prev$1 == "1" || prev$1 == "n")) { types[i$3] = prev$1; }
|
1028 |
+
prev$1 = type$2;
|
1029 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1030 |
|
1031 |
+
// W5. A sequence of European terminators adjacent to European
|
1032 |
+
// numbers changes to all European numbers.
|
1033 |
+
// W6. Otherwise, separators and terminators change to Other
|
1034 |
+
// Neutral.
|
1035 |
+
for (var i$4 = 0; i$4 < len; ++i$4) {
|
1036 |
+
var type$3 = types[i$4];
|
1037 |
+
if (type$3 == ",") { types[i$4] = "N"; }
|
1038 |
+
else if (type$3 == "%") {
|
1039 |
+
var end = (void 0);
|
1040 |
+
for (end = i$4 + 1; end < len && types[end] == "%"; ++end) {}
|
1041 |
+
var replace = (i$4 && types[i$4-1] == "!") || (end < len && types[end] == "1") ? "1" : "N";
|
1042 |
+
for (var j = i$4; j < end; ++j) { types[j] = replace; }
|
1043 |
+
i$4 = end - 1;
|
1044 |
+
}
|
1045 |
+
}
|
1046 |
|
1047 |
+
// W7. Search backwards from each instance of a European number
|
1048 |
+
// until the first strong type (R, L, or sor) is found. If an L is
|
1049 |
+
// found, then change the type of the European number to L.
|
1050 |
+
for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {
|
1051 |
+
var type$4 = types[i$5];
|
1052 |
+
if (cur$1 == "L" && type$4 == "1") { types[i$5] = "L"; }
|
1053 |
+
else if (isStrong.test(type$4)) { cur$1 = type$4; }
|
1054 |
+
}
|
1055 |
|
1056 |
+
// N1. A sequence of neutrals takes the direction of the
|
1057 |
+
// surrounding strong text if the text on both sides has the same
|
1058 |
+
// direction. European and Arabic numbers act as if they were R in
|
1059 |
+
// terms of their influence on neutrals. Start-of-level-run (sor)
|
1060 |
+
// and end-of-level-run (eor) are used at level run boundaries.
|
1061 |
+
// N2. Any remaining neutrals take the embedding direction.
|
1062 |
+
for (var i$6 = 0; i$6 < len; ++i$6) {
|
1063 |
+
if (isNeutral.test(types[i$6])) {
|
1064 |
+
var end$1 = (void 0);
|
1065 |
+
for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}
|
1066 |
+
var before = (i$6 ? types[i$6-1] : outerType) == "L";
|
1067 |
+
var after = (end$1 < len ? types[end$1] : outerType) == "L";
|
1068 |
+
var replace$1 = before == after ? (before ? "L" : "R") : outerType;
|
1069 |
+
for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }
|
1070 |
+
i$6 = end$1 - 1;
|
|
|
|
|
|
|
1071 |
}
|
|
|
1072 |
}
|
|
|
|
|
|
|
1073 |
|
1074 |
+
// Here we depart from the documented algorithm, in order to avoid
|
1075 |
+
// building up an actual levels array. Since there are only three
|
1076 |
+
// levels (0, 1, 2) in an implementation that doesn't take
|
1077 |
+
// explicit embedding into account, we can build up the order on
|
1078 |
+
// the fly, without following the level-based algorithm.
|
1079 |
+
var order = [], m;
|
1080 |
+
for (var i$7 = 0; i$7 < len;) {
|
1081 |
+
if (countsAsLeft.test(types[i$7])) {
|
1082 |
+
var start = i$7;
|
1083 |
+
for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}
|
1084 |
+
order.push(new BidiSpan(0, start, i$7));
|
1085 |
+
} else {
|
1086 |
+
var pos = i$7, at = order.length;
|
1087 |
+
for (++i$7; i$7 < len && types[i$7] != "L"; ++i$7) {}
|
1088 |
+
for (var j$2 = pos; j$2 < i$7;) {
|
1089 |
+
if (countsAsNum.test(types[j$2])) {
|
1090 |
+
if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); }
|
1091 |
+
var nstart = j$2;
|
1092 |
+
for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}
|
1093 |
+
order.splice(at, 0, new BidiSpan(2, nstart, j$2));
|
1094 |
+
pos = j$2;
|
1095 |
+
} else { ++j$2; }
|
1096 |
+
}
|
1097 |
+
if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }
|
1098 |
+
}
|
1099 |
+
}
|
1100 |
+
if (direction == "ltr") {
|
1101 |
+
if (order[0].level == 1 && (m = str.match(/^\s+/))) {
|
1102 |
+
order[0].from = m[0].length;
|
1103 |
+
order.unshift(new BidiSpan(0, 0, m[0].length));
|
1104 |
+
}
|
1105 |
+
if (lst(order).level == 1 && (m = str.match(/\s+$/))) {
|
1106 |
+
lst(order).to -= m[0].length;
|
1107 |
+
order.push(new BidiSpan(0, len - m[0].length, len));
|
1108 |
+
}
|
1109 |
+
}
|
1110 |
|
1111 |
+
return direction == "rtl" ? order.reverse() : order
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1112 |
}
|
1113 |
+
})();
|
1114 |
+
|
1115 |
+
// Get the bidi ordering for the given line (and cache it). Returns
|
1116 |
+
// false for lines that are fully left-to-right, and an array of
|
1117 |
+
// BidiSpan objects otherwise.
|
1118 |
+
function getOrder(line, direction) {
|
1119 |
+
var order = line.order;
|
1120 |
+
if (order == null) { order = line.order = bidiOrdering(line.text, direction); }
|
1121 |
+
return order
|
1122 |
}
|
|
|
1123 |
|
1124 |
+
// EVENT HANDLING
|
1125 |
|
1126 |
+
// Lightweight event framework. on/off also work on DOM nodes,
|
1127 |
+
// registering native DOM handlers.
|
1128 |
|
1129 |
+
var noHandlers = [];
|
|
|
|
|
|
|
|
|
1130 |
|
1131 |
+
var on = function(emitter, type, f) {
|
1132 |
+
if (emitter.addEventListener) {
|
1133 |
+
emitter.addEventListener(type, f, false);
|
1134 |
+
} else if (emitter.attachEvent) {
|
1135 |
+
emitter.attachEvent("on" + type, f);
|
1136 |
+
} else {
|
1137 |
+
var map$$1 = emitter._handlers || (emitter._handlers = {});
|
1138 |
+
map$$1[type] = (map$$1[type] || noHandlers).concat(f);
|
1139 |
+
}
|
1140 |
+
};
|
1141 |
|
1142 |
+
function getHandlers(emitter, type) {
|
1143 |
+
return emitter._handlers && emitter._handlers[type] || noHandlers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1144 |
}
|
|
|
1145 |
|
1146 |
+
function off(emitter, type, f) {
|
1147 |
+
if (emitter.removeEventListener) {
|
1148 |
+
emitter.removeEventListener(type, f, false);
|
1149 |
+
} else if (emitter.detachEvent) {
|
1150 |
+
emitter.detachEvent("on" + type, f);
|
1151 |
+
} else {
|
1152 |
+
var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];
|
1153 |
+
if (arr) {
|
1154 |
+
var index = indexOf(arr, f);
|
1155 |
+
if (index > -1)
|
1156 |
+
{ map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }
|
1157 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1158 |
}
|
1159 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1160 |
|
1161 |
+
function signal(emitter, type /*, values...*/) {
|
1162 |
+
var handlers = getHandlers(emitter, type);
|
1163 |
+
if (!handlers.length) { return }
|
1164 |
+
var args = Array.prototype.slice.call(arguments, 2);
|
1165 |
+
for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1166 |
}
|
|
|
|
|
1167 |
|
1168 |
+
// The DOM events that CodeMirror handles can be overridden by
|
1169 |
+
// registering a (non-DOM) handler on the editor for the event name,
|
1170 |
+
// and preventDefault-ing the event in that handler.
|
1171 |
+
function signalDOMEvent(cm, e, override) {
|
1172 |
+
if (typeof e == "string")
|
1173 |
+
{ e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }
|
1174 |
+
signal(cm, override || e.type, cm, e);
|
1175 |
+
return e_defaultPrevented(e) || e.codemirrorIgnore
|
1176 |
+
}
|
1177 |
+
|
1178 |
+
function signalCursorActivity(cm) {
|
1179 |
+
var arr = cm._handlers && cm._handlers.cursorActivity;
|
1180 |
+
if (!arr) { return }
|
1181 |
+
var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);
|
1182 |
+
for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)
|
1183 |
+
{ set.push(arr[i]); } }
|
1184 |
+
}
|
1185 |
+
|
1186 |
+
function hasHandler(emitter, type) {
|
1187 |
+
return getHandlers(emitter, type).length > 0
|
1188 |
+
}
|
1189 |
+
|
1190 |
+
// Add on and off methods to a constructor's prototype, to make
|
1191 |
+
// registering events on such objects more convenient.
|
1192 |
+
function eventMixin(ctor) {
|
1193 |
+
ctor.prototype.on = function(type, f) {on(this, type, f);};
|
1194 |
+
ctor.prototype.off = function(type, f) {off(this, type, f);};
|
1195 |
+
}
|
1196 |
+
|
1197 |
+
// Due to the fact that we still support jurassic IE versions, some
|
1198 |
+
// compatibility wrappers are needed.
|
1199 |
+
|
1200 |
+
function e_preventDefault(e) {
|
1201 |
+
if (e.preventDefault) { e.preventDefault(); }
|
1202 |
+
else { e.returnValue = false; }
|
1203 |
+
}
|
1204 |
+
function e_stopPropagation(e) {
|
1205 |
+
if (e.stopPropagation) { e.stopPropagation(); }
|
1206 |
+
else { e.cancelBubble = true; }
|
1207 |
+
}
|
1208 |
+
function e_defaultPrevented(e) {
|
1209 |
+
return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false
|
1210 |
+
}
|
1211 |
+
function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}
|
1212 |
+
|
1213 |
+
function e_target(e) {return e.target || e.srcElement}
|
1214 |
+
function e_button(e) {
|
1215 |
+
var b = e.which;
|
1216 |
+
if (b == null) {
|
1217 |
+
if (e.button & 1) { b = 1; }
|
1218 |
+
else if (e.button & 2) { b = 3; }
|
1219 |
+
else if (e.button & 4) { b = 2; }
|
1220 |
+
}
|
1221 |
+
if (mac && e.ctrlKey && b == 1) { b = 3; }
|
1222 |
+
return b
|
1223 |
+
}
|
1224 |
+
|
1225 |
+
// Detect drag-and-drop
|
1226 |
+
var dragAndDrop = function() {
|
1227 |
+
// There is *some* kind of drag-and-drop support in IE6-8, but I
|
1228 |
+
// couldn't get it to work yet.
|
1229 |
+
if (ie && ie_version < 9) { return false }
|
1230 |
+
var div = elt('div');
|
1231 |
+
return "draggable" in div || "dragDrop" in div
|
1232 |
+
}();
|
1233 |
+
|
1234 |
+
var zwspSupported;
|
1235 |
+
function zeroWidthElement(measure) {
|
1236 |
+
if (zwspSupported == null) {
|
1237 |
+
var test = elt("span", "\u200b");
|
1238 |
+
removeChildrenAndAdd(measure, elt("span", [test, document.createTextNode("x")]));
|
1239 |
+
if (measure.firstChild.offsetHeight != 0)
|
1240 |
+
{ zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }
|
1241 |
+
}
|
1242 |
+
var node = zwspSupported ? elt("span", "\u200b") :
|
1243 |
+
elt("span", "\u00a0", null, "display: inline-block; width: 1px; margin-right: -1px");
|
1244 |
+
node.setAttribute("cm-text", "");
|
1245 |
+
return node
|
1246 |
+
}
|
1247 |
+
|
1248 |
+
// Feature-detect IE's crummy client rect reporting for bidi text
|
1249 |
+
var badBidiRects;
|
1250 |
+
function hasBadBidiRects(measure) {
|
1251 |
+
if (badBidiRects != null) { return badBidiRects }
|
1252 |
+
var txt = removeChildrenAndAdd(measure, document.createTextNode("A\u062eA"));
|
1253 |
+
var r0 = range(txt, 0, 1).getBoundingClientRect();
|
1254 |
+
var r1 = range(txt, 1, 2).getBoundingClientRect();
|
1255 |
+
removeChildren(measure);
|
1256 |
+
if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)
|
1257 |
+
return badBidiRects = (r1.right - r0.right < 3)
|
1258 |
+
}
|
1259 |
+
|
1260 |
+
// See if "".split is the broken IE version, if so, provide an
|
1261 |
+
// alternative way to split lines.
|
1262 |
+
var splitLinesAuto = "\n\nb".split(/\n/).length != 3 ? function (string) {
|
1263 |
+
var pos = 0, result = [], l = string.length;
|
1264 |
+
while (pos <= l) {
|
1265 |
+
var nl = string.indexOf("\n", pos);
|
1266 |
+
if (nl == -1) { nl = string.length; }
|
1267 |
+
var line = string.slice(pos, string.charAt(nl - 1) == "\r" ? nl - 1 : nl);
|
1268 |
+
var rt = line.indexOf("\r");
|
1269 |
+
if (rt != -1) {
|
1270 |
+
result.push(line.slice(0, rt));
|
1271 |
+
pos += rt + 1;
|
1272 |
+
} else {
|
1273 |
+
result.push(line);
|
1274 |
+
pos = nl + 1;
|
1275 |
+
}
|
1276 |
+
}
|
1277 |
+
return result
|
1278 |
+
} : function (string) { return string.split(/\r\n?|\n/); };
|
1279 |
|
1280 |
+
var hasSelection = window.getSelection ? function (te) {
|
1281 |
+
try { return te.selectionStart != te.selectionEnd }
|
1282 |
+
catch(e) { return false }
|
1283 |
+
} : function (te) {
|
1284 |
+
var range$$1;
|
1285 |
+
try {range$$1 = te.ownerDocument.selection.createRange();}
|
1286 |
+
catch(e) {}
|
1287 |
+
if (!range$$1 || range$$1.parentElement() != te) { return false }
|
1288 |
+
return range$$1.compareEndPoints("StartToEnd", range$$1) != 0
|
1289 |
+
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1290 |
|
1291 |
+
var hasCopyEvent = (function () {
|
1292 |
+
var e = elt("div");
|
1293 |
+
if ("oncopy" in e) { return true }
|
1294 |
+
e.setAttribute("oncopy", "return;");
|
1295 |
+
return typeof e.oncopy == "function"
|
1296 |
+
})();
|
1297 |
+
|
1298 |
+
var badZoomedRects = null;
|
1299 |
+
function hasBadZoomedRects(measure) {
|
1300 |
+
if (badZoomedRects != null) { return badZoomedRects }
|
1301 |
+
var node = removeChildrenAndAdd(measure, elt("span", "x"));
|
1302 |
+
var normal = node.getBoundingClientRect();
|
1303 |
+
var fromRange = range(node, 0, 1).getBoundingClientRect();
|
1304 |
+
return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1
|
1305 |
+
}
|
1306 |
+
|
1307 |
+
// Known modes, by name and by MIME
|
1308 |
+
var modes = {}, mimeModes = {};
|
1309 |
+
|
1310 |
+
// Extra arguments are stored as the mode's dependencies, which is
|
1311 |
+
// used by (legacy) mechanisms like loadmode.js to automatically
|
1312 |
+
// load a mode. (Preferred mechanism is the require/define calls.)
|
1313 |
+
function defineMode(name, mode) {
|
1314 |
+
if (arguments.length > 2)
|
1315 |
+
{ mode.dependencies = Array.prototype.slice.call(arguments, 2); }
|
1316 |
+
modes[name] = mode;
|
1317 |
+
}
|
1318 |
+
|
1319 |
+
function defineMIME(mime, spec) {
|
1320 |
+
mimeModes[mime] = spec;
|
1321 |
+
}
|
1322 |
+
|
1323 |
+
// Given a MIME type, a {name, ...options} config object, or a name
|
1324 |
+
// string, return a mode config object.
|
1325 |
+
function resolveMode(spec) {
|
1326 |
+
if (typeof spec == "string" && mimeModes.hasOwnProperty(spec)) {
|
1327 |
+
spec = mimeModes[spec];
|
1328 |
+
} else if (spec && typeof spec.name == "string" && mimeModes.hasOwnProperty(spec.name)) {
|
1329 |
+
var found = mimeModes[spec.name];
|
1330 |
+
if (typeof found == "string") { found = {name: found}; }
|
1331 |
+
spec = createObj(found, spec);
|
1332 |
+
spec.name = found.name;
|
1333 |
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+xml$/.test(spec)) {
|
1334 |
+
return resolveMode("application/xml")
|
1335 |
+
} else if (typeof spec == "string" && /^[\w\-]+\/[\w\-]+\+json$/.test(spec)) {
|
1336 |
+
return resolveMode("application/json")
|
1337 |
+
}
|
1338 |
+
if (typeof spec == "string") { return {name: spec} }
|
1339 |
+
else { return spec || {name: "null"} }
|
1340 |
+
}
|
1341 |
+
|
1342 |
+
// Given a mode spec (anything that resolveMode accepts), find and
|
1343 |
+
// initialize an actual mode object.
|
1344 |
+
function getMode(options, spec) {
|
1345 |
+
spec = resolveMode(spec);
|
1346 |
+
var mfactory = modes[spec.name];
|
1347 |
+
if (!mfactory) { return getMode(options, "text/plain") }
|
1348 |
+
var modeObj = mfactory(options, spec);
|
1349 |
+
if (modeExtensions.hasOwnProperty(spec.name)) {
|
1350 |
+
var exts = modeExtensions[spec.name];
|
1351 |
+
for (var prop in exts) {
|
1352 |
+
if (!exts.hasOwnProperty(prop)) { continue }
|
1353 |
+
if (modeObj.hasOwnProperty(prop)) { modeObj["_" + prop] = modeObj[prop]; }
|
1354 |
+
modeObj[prop] = exts[prop];
|
1355 |
}
|
1356 |
}
|
1357 |
+
modeObj.name = spec.name;
|
1358 |
+
if (spec.helperType) { modeObj.helperType = spec.helperType; }
|
1359 |
+
if (spec.modeProps) { for (var prop$1 in spec.modeProps)
|
1360 |
+
{ modeObj[prop$1] = spec.modeProps[prop$1]; } }
|
1361 |
|
1362 |
+
return modeObj
|
1363 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1364 |
|
1365 |
+
// This can be used to attach properties to mode objects from
|
1366 |
+
// outside the actual mode definition.
|
1367 |
+
var modeExtensions = {};
|
1368 |
+
function extendMode(mode, properties) {
|
1369 |
+
var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});
|
1370 |
+
copyObj(properties, exts);
|
1371 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1372 |
|
1373 |
+
function copyState(mode, state) {
|
1374 |
+
if (state === true) { return state }
|
1375 |
+
if (mode.copyState) { return mode.copyState(state) }
|
1376 |
+
var nstate = {};
|
1377 |
+
for (var n in state) {
|
1378 |
+
var val = state[n];
|
1379 |
+
if (val instanceof Array) { val = val.concat([]); }
|
1380 |
+
nstate[n] = val;
|
1381 |
}
|
1382 |
+
return nstate
|
1383 |
+
}
|
|
|
|
|
|
|
1384 |
|
1385 |
+
// Given a mode and a state (for that mode), find the inner mode and
|
1386 |
+
// state at the position that the state refers to.
|
1387 |
+
function innerMode(mode, state) {
|
1388 |
+
var info;
|
1389 |
+
while (mode.innerMode) {
|
1390 |
+
info = mode.innerMode(state);
|
1391 |
+
if (!info || info.mode == mode) { break }
|
1392 |
+
state = info.state;
|
1393 |
+
mode = info.mode;
|
1394 |
}
|
1395 |
+
return info || {mode: mode, state: state}
|
1396 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1397 |
|
1398 |
+
function startState(mode, a1, a2) {
|
1399 |
+
return mode.startState ? mode.startState(a1, a2) : true
|
1400 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1401 |
|
1402 |
+
// STRING STREAM
|
|
|
1403 |
|
1404 |
+
// Fed to the mode parsers, provides helper functions to make
|
1405 |
+
// parsers more succinct.
|
1406 |
+
|
1407 |
+
var StringStream = function(string, tabSize, lineOracle) {
|
1408 |
+
this.pos = this.start = 0;
|
1409 |
+
this.string = string;
|
1410 |
+
this.tabSize = tabSize || 8;
|
1411 |
+
this.lastColumnPos = this.lastColumnValue = 0;
|
1412 |
+
this.lineStart = 0;
|
1413 |
+
this.lineOracle = lineOracle;
|
1414 |
+
};
|
1415 |
+
|
1416 |
+
StringStream.prototype.eol = function () {return this.pos >= this.string.length};
|
1417 |
+
StringStream.prototype.sol = function () {return this.pos == this.lineStart};
|
1418 |
+
StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};
|
1419 |
+
StringStream.prototype.next = function () {
|
1420 |
+
if (this.pos < this.string.length)
|
1421 |
+
{ return this.string.charAt(this.pos++) }
|
1422 |
+
};
|
1423 |
+
StringStream.prototype.eat = function (match) {
|
1424 |
+
var ch = this.string.charAt(this.pos);
|
1425 |
+
var ok;
|
1426 |
+
if (typeof match == "string") { ok = ch == match; }
|
1427 |
+
else { ok = ch && (match.test ? match.test(ch) : match(ch)); }
|
1428 |
+
if (ok) {++this.pos; return ch}
|
1429 |
+
};
|
1430 |
+
StringStream.prototype.eatWhile = function (match) {
|
1431 |
+
var start = this.pos;
|
1432 |
+
while (this.eat(match)){}
|
1433 |
+
return this.pos > start
|
1434 |
+
};
|
1435 |
+
StringStream.prototype.eatSpace = function () {
|
1436 |
+
var this$1 = this;
|
1437 |
+
|
1438 |
+
var start = this.pos;
|
1439 |
+
while (/[\s\u00a0]/.test(this.string.charAt(this.pos))) { ++this$1.pos; }
|
1440 |
+
return this.pos > start
|
1441 |
+
};
|
1442 |
+
StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};
|
1443 |
+
StringStream.prototype.skipTo = function (ch) {
|
1444 |
+
var found = this.string.indexOf(ch, this.pos);
|
1445 |
+
if (found > -1) {this.pos = found; return true}
|
1446 |
+
};
|
1447 |
+
StringStream.prototype.backUp = function (n) {this.pos -= n;};
|
1448 |
+
StringStream.prototype.column = function () {
|
1449 |
+
if (this.lastColumnPos < this.start) {
|
1450 |
+
this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);
|
1451 |
+
this.lastColumnPos = this.start;
|
1452 |
+
}
|
1453 |
+
return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
1454 |
+
};
|
1455 |
+
StringStream.prototype.indentation = function () {
|
1456 |
+
return countColumn(this.string, null, this.tabSize) -
|
1457 |
+
(this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)
|
1458 |
+
};
|
1459 |
+
StringStream.prototype.match = function (pattern, consume, caseInsensitive) {
|
1460 |
+
if (typeof pattern == "string") {
|
1461 |
+
var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };
|
1462 |
+
var substr = this.string.substr(this.pos, pattern.length);
|
1463 |
+
if (cased(substr) == cased(pattern)) {
|
1464 |
+
if (consume !== false) { this.pos += pattern.length; }
|
1465 |
+
return true
|
1466 |
+
}
|
1467 |
+
} else {
|
1468 |
+
var match = this.string.slice(this.pos).match(pattern);
|
1469 |
+
if (match && match.index > 0) { return null }
|
1470 |
+
if (match && consume !== false) { this.pos += match[0].length; }
|
1471 |
+
return match
|
1472 |
+
}
|
1473 |
+
};
|
1474 |
+
StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};
|
1475 |
+
StringStream.prototype.hideFirstChars = function (n, inner) {
|
1476 |
+
this.lineStart += n;
|
1477 |
+
try { return inner() }
|
1478 |
+
finally { this.lineStart -= n; }
|
1479 |
+
};
|
1480 |
+
StringStream.prototype.lookAhead = function (n) {
|
1481 |
+
var oracle = this.lineOracle;
|
1482 |
+
return oracle && oracle.lookAhead(n)
|
1483 |
+
};
|
1484 |
+
StringStream.prototype.baseToken = function () {
|
1485 |
+
var oracle = this.lineOracle;
|
1486 |
+
return oracle && oracle.baseToken(this.pos)
|
1487 |
+
};
|
1488 |
+
|
1489 |
+
var SavedContext = function(state, lookAhead) {
|
1490 |
+
this.state = state;
|
1491 |
+
this.lookAhead = lookAhead;
|
1492 |
+
};
|
1493 |
+
|
1494 |
+
var Context = function(doc, state, line, lookAhead) {
|
1495 |
+
this.state = state;
|
1496 |
+
this.doc = doc;
|
1497 |
+
this.line = line;
|
1498 |
+
this.maxLookAhead = lookAhead || 0;
|
1499 |
+
this.baseTokens = null;
|
1500 |
+
this.baseTokenPos = 1;
|
1501 |
+
};
|
1502 |
+
|
1503 |
+
Context.prototype.lookAhead = function (n) {
|
1504 |
+
var line = this.doc.getLine(this.line + n);
|
1505 |
+
if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }
|
1506 |
+
return line
|
1507 |
+
};
|
1508 |
+
|
1509 |
+
Context.prototype.baseToken = function (n) {
|
1510 |
+
var this$1 = this;
|
1511 |
+
|
1512 |
+
if (!this.baseTokens) { return null }
|
1513 |
+
while (this.baseTokens[this.baseTokenPos] <= n)
|
1514 |
+
{ this$1.baseTokenPos += 2; }
|
1515 |
+
var type = this.baseTokens[this.baseTokenPos + 1];
|
1516 |
+
return {type: type && type.replace(/( |^)overlay .*/, ""),
|
1517 |
+
size: this.baseTokens[this.baseTokenPos] - n}
|
1518 |
+
};
|
1519 |
+
|
1520 |
+
Context.prototype.nextLine = function () {
|
1521 |
+
this.line++;
|
1522 |
+
if (this.maxLookAhead > 0) { this.maxLookAhead--; }
|
1523 |
+
};
|
1524 |
+
|
1525 |
+
Context.fromSaved = function (doc, saved, line) {
|
1526 |
+
if (saved instanceof SavedContext)
|
1527 |
+
{ return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }
|
1528 |
+
else
|
1529 |
+
{ return new Context(doc, copyState(doc.mode, saved), line) }
|
1530 |
+
};
|
1531 |
+
|
1532 |
+
Context.prototype.save = function (copy) {
|
1533 |
+
var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;
|
1534 |
+
return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state
|
1535 |
+
};
|
1536 |
+
|
1537 |
+
|
1538 |
+
// Compute a style array (an array starting with a mode generation
|
1539 |
+
// -- for invalidation -- followed by pairs of end positions and
|
1540 |
+
// style strings), which is used to highlight the tokens on the
|
1541 |
+
// line.
|
1542 |
+
function highlightLine(cm, line, context, forceToEnd) {
|
1543 |
+
// A styles array always starts with a number identifying the
|
1544 |
+
// mode/overlays that it is based on (for easy invalidation).
|
1545 |
+
var st = [cm.state.modeGen], lineClasses = {};
|
1546 |
+
// Compute the base array of styles
|
1547 |
+
runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },
|
1548 |
+
lineClasses, forceToEnd);
|
1549 |
+
var state = context.state;
|
1550 |
+
|
1551 |
+
// Run overlays, adjust style array.
|
1552 |
+
var loop = function ( o ) {
|
1553 |
+
context.baseTokens = st;
|
1554 |
+
var overlay = cm.state.overlays[o], i = 1, at = 0;
|
1555 |
+
context.state = true;
|
1556 |
+
runMode(cm, line.text, overlay.mode, context, function (end, style) {
|
1557 |
+
var start = i;
|
1558 |
+
// Ensure there's a token end at the current position, and that i points at it
|
1559 |
+
while (at < end) {
|
1560 |
+
var i_end = st[i];
|
1561 |
+
if (i_end > end)
|
1562 |
+
{ st.splice(i, 1, end, st[i+1], i_end); }
|
1563 |
+
i += 2;
|
1564 |
+
at = Math.min(end, i_end);
|
1565 |
+
}
|
1566 |
+
if (!style) { return }
|
1567 |
+
if (overlay.opaque) {
|
1568 |
+
st.splice(start, i - start, end, "overlay " + style);
|
1569 |
+
i = start + 2;
|
1570 |
+
} else {
|
1571 |
+
for (; start < i; start += 2) {
|
1572 |
+
var cur = st[start+1];
|
1573 |
+
st[start+1] = (cur ? cur + " " : "") + "overlay " + style;
|
1574 |
+
}
|
1575 |
+
}
|
1576 |
+
}, lineClasses);
|
1577 |
+
context.state = state;
|
1578 |
+
context.baseTokens = null;
|
1579 |
+
context.baseTokenPos = 1;
|
1580 |
+
};
|
1581 |
+
|
1582 |
+
for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );
|
1583 |
+
|
1584 |
+
return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}
|
1585 |
+
}
|
1586 |
+
|
1587 |
+
function getLineStyles(cm, line, updateFrontier) {
|
1588 |
+
if (!line.styles || line.styles[0] != cm.state.modeGen) {
|
1589 |
+
var context = getContextBefore(cm, lineNo(line));
|
1590 |
+
var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);
|
1591 |
+
var result = highlightLine(cm, line, context);
|
1592 |
+
if (resetState) { context.state = resetState; }
|
1593 |
+
line.stateAfter = context.save(!resetState);
|
1594 |
+
line.styles = result.styles;
|
1595 |
+
if (result.classes) { line.styleClasses = result.classes; }
|
1596 |
+
else if (line.styleClasses) { line.styleClasses = null; }
|
1597 |
+
if (updateFrontier === cm.doc.highlightFrontier)
|
1598 |
+
{ cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }
|
1599 |
+
}
|
1600 |
+
return line.styles
|
1601 |
+
}
|
1602 |
+
|
1603 |
+
function getContextBefore(cm, n, precise) {
|
1604 |
+
var doc = cm.doc, display = cm.display;
|
1605 |
+
if (!doc.mode.startState) { return new Context(doc, true, n) }
|
1606 |
+
var start = findStartLine(cm, n, precise);
|
1607 |
+
var saved = start > doc.first && getLine(doc, start - 1).stateAfter;
|
1608 |
+
var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);
|
1609 |
+
|
1610 |
+
doc.iter(start, n, function (line) {
|
1611 |
+
processLine(cm, line.text, context);
|
1612 |
+
var pos = context.line;
|
1613 |
+
line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;
|
1614 |
+
context.nextLine();
|
1615 |
+
});
|
1616 |
+
if (precise) { doc.modeFrontier = context.line; }
|
1617 |
+
return context
|
1618 |
+
}
|
1619 |
+
|
1620 |
+
// Lightweight form of highlight -- proceed over this line and
|
1621 |
+
// update state, but don't save a style array. Used for lines that
|
1622 |
+
// aren't currently visible.
|
1623 |
+
function processLine(cm, text, context, startAt) {
|
1624 |
+
var mode = cm.doc.mode;
|
1625 |
+
var stream = new StringStream(text, cm.options.tabSize, context);
|
1626 |
+
stream.start = stream.pos = startAt || 0;
|
1627 |
+
if (text == "") { callBlankLine(mode, context.state); }
|
1628 |
+
while (!stream.eol()) {
|
1629 |
+
readToken(mode, stream, context.state);
|
1630 |
+
stream.start = stream.pos;
|
1631 |
+
}
|
1632 |
+
}
|
1633 |
+
|
1634 |
+
function callBlankLine(mode, state) {
|
1635 |
+
if (mode.blankLine) { return mode.blankLine(state) }
|
1636 |
+
if (!mode.innerMode) { return }
|
1637 |
+
var inner = innerMode(mode, state);
|
1638 |
+
if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }
|
1639 |
+
}
|
1640 |
+
|
1641 |
+
function readToken(mode, stream, state, inner) {
|
1642 |
+
for (var i = 0; i < 10; i++) {
|
1643 |
+
if (inner) { inner[0] = innerMode(mode, state).mode; }
|
1644 |
+
var style = mode.token(stream, state);
|
1645 |
+
if (stream.pos > stream.start) { return style }
|
1646 |
+
}
|
1647 |
+
throw new Error("Mode " + mode.name + " failed to advance stream.")
|
1648 |
+
}
|
1649 |
+
|
1650 |
+
var Token = function(stream, type, state) {
|
1651 |
+
this.start = stream.start; this.end = stream.pos;
|
1652 |
+
this.string = stream.current();
|
1653 |
+
this.type = type || null;
|
1654 |
+
this.state = state;
|
1655 |
+
};
|
1656 |
+
|
1657 |
+
// Utility for getTokenAt and getLineTokens
|
1658 |
+
function takeToken(cm, pos, precise, asArray) {
|
1659 |
+
var doc = cm.doc, mode = doc.mode, style;
|
1660 |
+
pos = clipPos(doc, pos);
|
1661 |
+
var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);
|
1662 |
+
var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;
|
1663 |
+
if (asArray) { tokens = []; }
|
1664 |
+
while ((asArray || stream.pos < pos.ch) && !stream.eol()) {
|
1665 |
+
stream.start = stream.pos;
|
1666 |
+
style = readToken(mode, stream, context.state);
|
1667 |
+
if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }
|
1668 |
+
}
|
1669 |
+
return asArray ? tokens : new Token(stream, style, context.state)
|
1670 |
+
}
|
1671 |
+
|
1672 |
+
function extractLineClasses(type, output) {
|
1673 |
+
if (type) { for (;;) {
|
1674 |
+
var lineClass = type.match(/(?:^|\s+)line-(background-)?(\S+)/);
|
1675 |
+
if (!lineClass) { break }
|
1676 |
+
type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);
|
1677 |
+
var prop = lineClass[1] ? "bgClass" : "textClass";
|
1678 |
+
if (output[prop] == null)
|
1679 |
+
{ output[prop] = lineClass[2]; }
|
1680 |
+
else if (!(new RegExp("(?:^|\s)" + lineClass[2] + "(?:$|\s)")).test(output[prop]))
|
1681 |
+
{ output[prop] += " " + lineClass[2]; }
|
1682 |
} }
|
1683 |
+
return type
|
1684 |
+
}
|
1685 |
+
|
1686 |
+
// Run the given mode's parser over a line, calling f for each token.
|
1687 |
+
function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {
|
1688 |
+
var flattenSpans = mode.flattenSpans;
|
1689 |
+
if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }
|
1690 |
+
var curStart = 0, curStyle = null;
|
1691 |
+
var stream = new StringStream(text, cm.options.tabSize, context), style;
|
1692 |
+
var inner = cm.options.addModeClass && [null];
|
1693 |
+
if (text == "") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }
|
1694 |
+
while (!stream.eol()) {
|
1695 |
+
if (stream.pos > cm.options.maxHighlightLength) {
|
1696 |
+
flattenSpans = false;
|
1697 |
+
if (forceToEnd) { processLine(cm, text, context, stream.pos); }
|
1698 |
+
stream.pos = text.length;
|
1699 |
+
style = null;
|
1700 |
+
} else {
|
1701 |
+
style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);
|
1702 |
+
}
|
1703 |
+
if (inner) {
|
1704 |
+
var mName = inner[0].name;
|
1705 |
+
if (mName) { style = "m-" + (style ? mName + " " + style : mName); }
|
1706 |
+
}
|
1707 |
+
if (!flattenSpans || curStyle != style) {
|
1708 |
+
while (curStart < stream.start) {
|
1709 |
+
curStart = Math.min(stream.start, curStart + 5000);
|
1710 |
+
f(curStart, curStyle);
|
1711 |
+
}
|
1712 |
+
curStyle = style;
|
1713 |
+
}
|
1714 |
+
stream.start = stream.pos;
|
1715 |
+
}
|
1716 |
+
while (curStart < stream.pos) {
|
1717 |
+
// Webkit seems to refuse to render text nodes longer than 57444
|
1718 |
+
// characters, and returns inaccurate measurements in nodes
|
1719 |
+
// starting around 5000 chars.
|
1720 |
+
var pos = Math.min(stream.pos, curStart + 5000);
|
1721 |
+
f(pos, curStyle);
|
1722 |
+
curStart = pos;
|
1723 |
+
}
|
1724 |
+
}
|
1725 |
+
|
1726 |
+
// Finds the line to start with when starting a parse. Tries to
|
1727 |
+
// find a line with a stateAfter, so that it can start with a
|
1728 |
+
// valid state. If that fails, it returns the line with the
|
1729 |
+
// smallest indentation, which tends to need the least context to
|
1730 |
+
// parse correctly.
|
1731 |
+
function findStartLine(cm, n, precise) {
|
1732 |
+
var minindent, minline, doc = cm.doc;
|
1733 |
+
var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);
|
1734 |
+
for (var search = n; search > lim; --search) {
|
1735 |
+
if (search <= doc.first) { return doc.first }
|
1736 |
+
var line = getLine(doc, search - 1), after = line.stateAfter;
|
1737 |
+
if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))
|
1738 |
+
{ return search }
|
1739 |
+
var indented = countColumn(line.text, null, cm.options.tabSize);
|
1740 |
+
if (minline == null || minindent > indented) {
|
1741 |
+
minline = search - 1;
|
1742 |
+
minindent = indented;
|
1743 |
+
}
|
1744 |
+
}
|
1745 |
+
return minline
|
1746 |
+
}
|
1747 |
+
|
1748 |
+
function retreatFrontier(doc, n) {
|
1749 |
+
doc.modeFrontier = Math.min(doc.modeFrontier, n);
|
1750 |
+
if (doc.highlightFrontier < n - 10) { return }
|
1751 |
+
var start = doc.first;
|
1752 |
+
for (var line = n - 1; line > start; line--) {
|
1753 |
+
var saved = getLine(doc, line).stateAfter;
|
1754 |
+
// change is on 3
|
1755 |
+
// state on line 1 looked ahead 2 -- so saw 3
|
1756 |
+
// test 1 + 2 < 3 should cover this
|
1757 |
+
if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {
|
1758 |
+
start = line + 1;
|
1759 |
+
break
|
1760 |
+
}
|
1761 |
+
}
|
1762 |
+
doc.highlightFrontier = Math.min(doc.highlightFrontier, start);
|
1763 |
+
}
|
1764 |
+
|
1765 |
+
// LINE DATA STRUCTURE
|
1766 |
+
|
1767 |
+
// Line objects. These hold state related to a line, including
|
1768 |
+
// highlighting info (the styles array).
|
1769 |
+
var Line = function(text, markedSpans, estimateHeight) {
|
1770 |
+
this.text = text;
|
1771 |
+
attachMarkedSpans(this, markedSpans);
|
1772 |
+
this.height = estimateHeight ? estimateHeight(this) : 1;
|
1773 |
+
};
|
1774 |
+
|
1775 |
+
Line.prototype.lineNo = function () { return lineNo(this) };
|
1776 |
+
eventMixin(Line);
|
1777 |
+
|
1778 |
+
// Change the content (text, markers) of a line. Automatically
|
1779 |
+
// invalidates cached information and tries to re-estimate the
|
1780 |
+
// line's height.
|
1781 |
+
function updateLine(line, text, markedSpans, estimateHeight) {
|
1782 |
+
line.text = text;
|
1783 |
+
if (line.stateAfter) { line.stateAfter = null; }
|
1784 |
+
if (line.styles) { line.styles = null; }
|
1785 |
+
if (line.order != null) { line.order = null; }
|
1786 |
+
detachMarkedSpans(line);
|
1787 |
+
attachMarkedSpans(line, markedSpans);
|
1788 |
+
var estHeight = estimateHeight ? estimateHeight(line) : 1;
|
1789 |
+
if (estHeight != line.height) { updateLineHeight(line, estHeight); }
|
1790 |
+
}
|
1791 |
+
|
1792 |
+
// Detach a line from the document tree and its markers.
|
1793 |
+
function cleanUpLine(line) {
|
1794 |
+
line.parent = null;
|
1795 |
+
detachMarkedSpans(line);
|
1796 |
+
}
|
1797 |
+
|
1798 |
+
// Convert a style as returned by a mode (either null, or a string
|
1799 |
+
// containing one or more styles) to a CSS style. This is cached,
|
1800 |
+
// and also looks for line-wide styles.
|
1801 |
+
var styleToClassCache = {}, styleToClassCacheWithMode = {};
|
1802 |
+
function interpretTokenStyle(style, options) {
|
1803 |
+
if (!style || /^\s*$/.test(style)) { return null }
|
1804 |
+
var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;
|
1805 |
+
return cache[style] ||
|
1806 |
+
(cache[style] = style.replace(/\S+/g, "cm-$&"))
|
1807 |
+
}
|
1808 |
+
|
1809 |
+
// Render the DOM representation of the text of a line. Also builds
|
1810 |
+
// up a 'line map', which points at the DOM nodes that represent
|
1811 |
+
// specific stretches of text, and is used by the measuring code.
|
1812 |
+
// The returned object contains the DOM node, this map, and
|
1813 |
+
// information about line-wide styles that were set by the mode.
|
1814 |
+
function buildLineContent(cm, lineView) {
|
1815 |
+
// The padding-right forces the element to have a 'border', which
|
1816 |
+
// is needed on Webkit to be able to get line-level bounding
|
1817 |
+
// rectangles for it (in measureChar).
|
1818 |
+
var content = eltP("span", null, null, webkit ? "padding-right: .1px" : null);
|
1819 |
+
var builder = {pre: eltP("pre", [content], "CodeMirror-line"), content: content,
|
1820 |
+
col: 0, pos: 0, cm: cm,
|
1821 |
+
trailingSpace: false,
|
1822 |
+
splitSpaces: cm.getOption("lineWrapping")};
|
1823 |
+
lineView.measure = {};
|
1824 |
+
|
1825 |
+
// Iterate over the logical lines that make up this visual line.
|
1826 |
+
for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {
|
1827 |
+
var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);
|
1828 |
+
builder.pos = 0;
|
1829 |
+
builder.addToken = buildToken;
|
1830 |
+
// Optionally wire in some hacks into the token-rendering
|
1831 |
+
// algorithm, to deal with browser quirks.
|
1832 |
+
if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))
|
1833 |
+
{ builder.addToken = buildTokenBadBidi(builder.addToken, order); }
|
1834 |
+
builder.map = [];
|
1835 |
+
var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);
|
1836 |
+
insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));
|
1837 |
+
if (line.styleClasses) {
|
1838 |
+
if (line.styleClasses.bgClass)
|
1839 |
+
{ builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || ""); }
|
1840 |
+
if (line.styleClasses.textClass)
|
1841 |
+
{ builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || ""); }
|
1842 |
+
}
|
1843 |
+
|
1844 |
+
// Ensure at least a single node is present, for measuring.
|
1845 |
+
if (builder.map.length == 0)
|
1846 |
+
{ builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }
|
1847 |
+
|
1848 |
+
// Store the map and a cache object for the current logical line
|
1849 |
+
if (i == 0) {
|
1850 |
+
lineView.measure.map = builder.map;
|
1851 |
+
lineView.measure.cache = {};
|
1852 |
+
} else {
|
1853 |
+
(lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)
|
1854 |
+
;(lineView.measure.caches || (lineView.measure.caches = [])).push({});
|
1855 |
+
}
|
1856 |
+
}
|
1857 |
+
|
1858 |
+
// See issue #2901
|
1859 |
+
if (webkit) {
|
1860 |
+
var last = builder.content.lastChild;
|
1861 |
+
if (/\bcm-tab\b/.test(last.className) || (last.querySelector && last.querySelector(".cm-tab")))
|
1862 |
+
{ builder.content.className = "cm-tab-wrap-hack"; }
|
1863 |
+
}
|
1864 |
+
|
1865 |
+
signal(cm, "renderLine", cm, lineView.line, builder.pre);
|
1866 |
+
if (builder.pre.className)
|
1867 |
+
{ builder.textClass = joinClasses(builder.pre.className, builder.textClass || ""); }
|
1868 |
+
|
1869 |
+
return builder
|
1870 |
+
}
|
1871 |
+
|
1872 |
+
function defaultSpecialCharPlaceholder(ch) {
|
1873 |
+
var token = elt("span", "\u2022", "cm-invalidchar");
|
1874 |
+
token.title = "\\u" + ch.charCodeAt(0).toString(16);
|
1875 |
+
token.setAttribute("aria-label", token.title);
|
1876 |
+
return token
|
1877 |
+
}
|
1878 |
+
|
1879 |
+
// Build up the DOM representation for a single token, and add it to
|
1880 |
+
// the line map. Takes care to render special characters separately.
|
1881 |
+
function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {
|
1882 |
+
if (!text) { return }
|
1883 |
+
var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;
|
1884 |
+
var special = builder.cm.state.specialChars, mustWrap = false;
|
1885 |
+
var content;
|
1886 |
+
if (!special.test(text)) {
|
1887 |
+
builder.col += text.length;
|
1888 |
+
content = document.createTextNode(displayText);
|
1889 |
+
builder.map.push(builder.pos, builder.pos + text.length, content);
|
1890 |
+
if (ie && ie_version < 9) { mustWrap = true; }
|
1891 |
+
builder.pos += text.length;
|
1892 |
+
} else {
|
1893 |
+
content = document.createDocumentFragment();
|
1894 |
+
var pos = 0;
|
1895 |
+
while (true) {
|
1896 |
+
special.lastIndex = pos;
|
1897 |
+
var m = special.exec(text);
|
1898 |
+
var skipped = m ? m.index - pos : text.length - pos;
|
1899 |
+
if (skipped) {
|
1900 |
+
var txt = document.createTextNode(displayText.slice(pos, pos + skipped));
|
1901 |
+
if (ie && ie_version < 9) { content.appendChild(elt("span", [txt])); }
|
1902 |
+
else { content.appendChild(txt); }
|
1903 |
+
builder.map.push(builder.pos, builder.pos + skipped, txt);
|
1904 |
+
builder.col += skipped;
|
1905 |
+
builder.pos += skipped;
|
1906 |
+
}
|
1907 |
+
if (!m) { break }
|
1908 |
+
pos += skipped + 1;
|
1909 |
+
var txt$1 = (void 0);
|
1910 |
+
if (m[0] == "\t") {
|
1911 |
+
var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;
|
1912 |
+
txt$1 = content.appendChild(elt("span", spaceStr(tabWidth), "cm-tab"));
|
1913 |
+
txt$1.setAttribute("role", "presentation");
|
1914 |
+
txt$1.setAttribute("cm-text", "\t");
|
1915 |
+
builder.col += tabWidth;
|
1916 |
+
} else if (m[0] == "\r" || m[0] == "\n") {
|
1917 |
+
txt$1 = content.appendChild(elt("span", m[0] == "\r" ? "\u240d" : "\u2424", "cm-invalidchar"));
|
1918 |
+
txt$1.setAttribute("cm-text", m[0]);
|
1919 |
+
builder.col += 1;
|
1920 |
+
} else {
|
1921 |
+
txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);
|
1922 |
+
txt$1.setAttribute("cm-text", m[0]);
|
1923 |
+
if (ie && ie_version < 9) { content.appendChild(elt("span", [txt$1])); }
|
1924 |
+
else { content.appendChild(txt$1); }
|
1925 |
+
builder.col += 1;
|
1926 |
+
}
|
1927 |
+
builder.map.push(builder.pos, builder.pos + 1, txt$1);
|
1928 |
+
builder.pos++;
|
1929 |
+
}
|
1930 |
+
}
|
1931 |
+
builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;
|
1932 |
+
if (style || startStyle || endStyle || mustWrap || css) {
|
1933 |
+
var fullStyle = style || "";
|
1934 |
+
if (startStyle) { fullStyle += startStyle; }
|
1935 |
+
if (endStyle) { fullStyle += endStyle; }
|
1936 |
+
var token = elt("span", [content], fullStyle, css);
|
1937 |
+
if (attributes) {
|
1938 |
+
for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != "style" && attr != "class")
|
1939 |
+
{ token.setAttribute(attr, attributes[attr]); } }
|
1940 |
+
}
|
1941 |
+
return builder.content.appendChild(token)
|
1942 |
+
}
|
1943 |
+
builder.content.appendChild(content);
|
1944 |
+
}
|
1945 |
+
|
1946 |
+
// Change some spaces to NBSP to prevent the browser from collapsing
|
1947 |
+
// trailing spaces at the end of a line when rendering text (issue #1362).
|
1948 |
+
function splitSpaces(text, trailingBefore) {
|
1949 |
+
if (text.length > 1 && !/ /.test(text)) { return text }
|
1950 |
+
var spaceBefore = trailingBefore, result = "";
|
1951 |
+
for (var i = 0; i < text.length; i++) {
|
1952 |
+
var ch = text.charAt(i);
|
1953 |
+
if (ch == " " && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))
|
1954 |
+
{ ch = "\u00a0"; }
|
1955 |
+
result += ch;
|
1956 |
+
spaceBefore = ch == " ";
|
1957 |
+
}
|
1958 |
+
return result
|
1959 |
+
}
|
1960 |
+
|
1961 |
+
// Work around nonsense dimensions being reported for stretches of
|
1962 |
+
// right-to-left text.
|
1963 |
+
function buildTokenBadBidi(inner, order) {
|
1964 |
+
return function (builder, text, style, startStyle, endStyle, css, attributes) {
|
1965 |
+
style = style ? style + " cm-force-border" : "cm-force-border";
|
1966 |
+
var start = builder.pos, end = start + text.length;
|
1967 |
+
for (;;) {
|
1968 |
+
// Find the part that overlaps with the start of this text
|
1969 |
+
var part = (void 0);
|
1970 |
+
for (var i = 0; i < order.length; i++) {
|
1971 |
+
part = order[i];
|
1972 |
+
if (part.to > start && part.from <= start) { break }
|
1973 |
+
}
|
1974 |
+
if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }
|
1975 |
+
inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);
|
1976 |
+
startStyle = null;
|
1977 |
+
text = text.slice(part.to - start);
|
1978 |
+
start = part.to;
|
1979 |
+
}
|
1980 |
+
}
|
1981 |
+
}
|
1982 |
+
|
1983 |
+
function buildCollapsedSpan(builder, size, marker, ignoreWidget) {
|
1984 |
+
var widget = !ignoreWidget && marker.widgetNode;
|
1985 |
+
if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }
|
1986 |
+
if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {
|
1987 |
+
if (!widget)
|
1988 |
+
{ widget = builder.content.appendChild(document.createElement("span")); }
|
1989 |
+
widget.setAttribute("cm-marker", marker.id);
|
1990 |
+
}
|
1991 |
+
if (widget) {
|
1992 |
+
builder.cm.display.input.setUneditable(widget);
|
1993 |
+
builder.content.appendChild(widget);
|
1994 |
+
}
|
1995 |
+
builder.pos += size;
|
1996 |
+
builder.trailingSpace = false;
|
1997 |
+
}
|
1998 |
+
|
1999 |
+
// Outputs a number of spans to make up a line, taking highlighting
|
2000 |
+
// and marked text into account.
|
2001 |
+
function insertLineContent(line, builder, styles) {
|
2002 |
+
var spans = line.markedSpans, allText = line.text, at = 0;
|
2003 |
+
if (!spans) {
|
2004 |
+
for (var i$1 = 1; i$1 < styles.length; i$1+=2)
|
2005 |
+
{ builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }
|
2006 |
+
return
|
2007 |
+
}
|
2008 |
+
|
2009 |
+
var len = allText.length, pos = 0, i = 1, text = "", style, css;
|
2010 |
+
var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;
|
2011 |
+
for (;;) {
|
2012 |
+
if (nextChange == pos) { // Update current marker set
|
2013 |
+
spanStyle = spanEndStyle = spanStartStyle = css = "";
|
2014 |
+
attributes = null;
|
2015 |
+
collapsed = null; nextChange = Infinity;
|
2016 |
+
var foundBookmarks = [], endStyles = (void 0);
|
2017 |
+
for (var j = 0; j < spans.length; ++j) {
|
2018 |
+
var sp = spans[j], m = sp.marker;
|
2019 |
+
if (m.type == "bookmark" && sp.from == pos && m.widgetNode) {
|
2020 |
+
foundBookmarks.push(m);
|
2021 |
+
} else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {
|
2022 |
+
if (sp.to != null && sp.to != pos && nextChange > sp.to) {
|
2023 |
+
nextChange = sp.to;
|
2024 |
+
spanEndStyle = "";
|
2025 |
+
}
|
2026 |
+
if (m.className) { spanStyle += " " + m.className; }
|
2027 |
+
if (m.css) { css = (css ? css + ";" : "") + m.css; }
|
2028 |
+
if (m.startStyle && sp.from == pos) { spanStartStyle += " " + m.startStyle; }
|
2029 |
+
if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }
|
2030 |
+
// support for the old title property
|
2031 |
+
// https://github.com/codemirror/CodeMirror/pull/5673
|
2032 |
+
if (m.title) { (attributes || (attributes = {})).title = m.title; }
|
2033 |
+
if (m.attributes) {
|
2034 |
+
for (var attr in m.attributes)
|
2035 |
+
{ (attributes || (attributes = {}))[attr] = m.attributes[attr]; }
|
2036 |
+
}
|
2037 |
+
if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))
|
2038 |
+
{ collapsed = sp; }
|
2039 |
+
} else if (sp.from > pos && nextChange > sp.from) {
|
2040 |
+
nextChange = sp.from;
|
2041 |
+
}
|
2042 |
+
}
|
2043 |
+
if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)
|
2044 |
+
{ if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += " " + endStyles[j$1]; } } }
|
2045 |
+
|
2046 |
+
if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)
|
2047 |
+
{ buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }
|
2048 |
+
if (collapsed && (collapsed.from || 0) == pos) {
|
2049 |
+
buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,
|
2050 |
+
collapsed.marker, collapsed.from == null);
|
2051 |
+
if (collapsed.to == null) { return }
|
2052 |
+
if (collapsed.to == pos) { collapsed = false; }
|
2053 |
+
}
|
2054 |
+
}
|
2055 |
+
if (pos >= len) { break }
|
2056 |
+
|
2057 |
+
var upto = Math.min(len, nextChange);
|
2058 |
+
while (true) {
|
2059 |
+
if (text) {
|
2060 |
+
var end = pos + text.length;
|
2061 |
+
if (!collapsed) {
|
2062 |
+
var tokenText = end > upto ? text.slice(0, upto - pos) : text;
|
2063 |
+
builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,
|
2064 |
+
spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : "", css, attributes);
|
2065 |
+
}
|
2066 |
+
if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}
|
2067 |
+
pos = end;
|
2068 |
+
spanStartStyle = "";
|
2069 |
+
}
|
2070 |
+
text = allText.slice(at, at = styles[i++]);
|
2071 |
+
style = interpretTokenStyle(styles[i++], builder.cm.options);
|
2072 |
+
}
|
2073 |
+
}
|
2074 |
+
}
|
2075 |
+
|
2076 |
+
|
2077 |
+
// These objects are used to represent the visible (currently drawn)
|
2078 |
+
// part of the document. A LineView may correspond to multiple
|
2079 |
+
// logical lines, if those are connected by collapsed ranges.
|
2080 |
+
function LineView(doc, line, lineN) {
|
2081 |
+
// The starting line
|
2082 |
+
this.line = line;
|
2083 |
+
// Continuing lines, if any
|
2084 |
+
this.rest = visualLineContinued(line);
|
2085 |
+
// Number of logical lines in this visual line
|
2086 |
+
this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;
|
2087 |
+
this.node = this.text = null;
|
2088 |
+
this.hidden = lineIsHidden(doc, line);
|
2089 |
+
}
|
2090 |
+
|
2091 |
+
// Create a range of LineView objects for the given lines.
|
2092 |
+
function buildViewArray(cm, from, to) {
|
2093 |
+
var array = [], nextPos;
|
2094 |
+
for (var pos = from; pos < to; pos = nextPos) {
|
2095 |
+
var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);
|
2096 |
+
nextPos = pos + view.size;
|
2097 |
+
array.push(view);
|
2098 |
+
}
|
2099 |
+
return array
|
2100 |
+
}
|
2101 |
+
|
2102 |
+
var operationGroup = null;
|
2103 |
+
|
2104 |
+
function pushOperation(op) {
|
2105 |
+
if (operationGroup) {
|
2106 |
+
operationGroup.ops.push(op);
|
2107 |
+
} else {
|
2108 |
+
op.ownsGroup = operationGroup = {
|
2109 |
+
ops: [op],
|
2110 |
+
delayedCallbacks: []
|
2111 |
+
};
|
2112 |
+
}
|
2113 |
+
}
|
2114 |
+
|
2115 |
+
function fireCallbacksForOps(group) {
|
2116 |
+
// Calls delayed callbacks and cursorActivity handlers until no
|
2117 |
+
// new ones appear
|
2118 |
+
var callbacks = group.delayedCallbacks, i = 0;
|
2119 |
+
do {
|
2120 |
+
for (; i < callbacks.length; i++)
|
2121 |
+
{ callbacks[i].call(null); }
|
2122 |
+
for (var j = 0; j < group.ops.length; j++) {
|
2123 |
+
var op = group.ops[j];
|
2124 |
+
if (op.cursorActivityHandlers)
|
2125 |
+
{ while (op.cursorActivityCalled < op.cursorActivityHandlers.length)
|
2126 |
+
{ op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }
|
2127 |
+
}
|
2128 |
+
} while (i < callbacks.length)
|
2129 |
+
}
|
2130 |
+
|
2131 |
+
function finishOperation(op, endCb) {
|
2132 |
+
var group = op.ownsGroup;
|
2133 |
+
if (!group) { return }
|
2134 |
+
|
2135 |
+
try { fireCallbacksForOps(group); }
|
2136 |
+
finally {
|
2137 |
+
operationGroup = null;
|
2138 |
+
endCb(group);
|
2139 |
+
}
|
2140 |
+
}
|
2141 |
+
|
2142 |
+
var orphanDelayedCallbacks = null;
|
2143 |
+
|
2144 |
+
// Often, we want to signal events at a point where we are in the
|
2145 |
+
// middle of some work, but don't want the handler to start calling
|
2146 |
+
// other methods on the editor, which might be in an inconsistent
|
2147 |
+
// state or simply not expect any other events to happen.
|
2148 |
+
// signalLater looks whether there are any handlers, and schedules
|
2149 |
+
// them to be executed when the last operation ends, or, if no
|
2150 |
+
// operation is active, when a timeout fires.
|
2151 |
+
function signalLater(emitter, type /*, values...*/) {
|
2152 |
+
var arr = getHandlers(emitter, type);
|
2153 |
+
if (!arr.length) { return }
|
2154 |
+
var args = Array.prototype.slice.call(arguments, 2), list;
|
2155 |
+
if (operationGroup) {
|
2156 |
+
list = operationGroup.delayedCallbacks;
|
2157 |
+
} else if (orphanDelayedCallbacks) {
|
2158 |
+
list = orphanDelayedCallbacks;
|
2159 |
+
} else {
|
2160 |
+
list = orphanDelayedCallbacks = [];
|
2161 |
+
setTimeout(fireOrphanDelayed, 0);
|
2162 |
+
}
|
2163 |
+
var loop = function ( i ) {
|
2164 |
+
list.push(function () { return arr[i].apply(null, args); });
|
2165 |
+
};
|
2166 |
+
|
2167 |
+
for (var i = 0; i < arr.length; ++i)
|
2168 |
+
loop( i );
|
2169 |
+
}
|
2170 |
+
|
2171 |
+
function fireOrphanDelayed() {
|
2172 |
+
var delayed = orphanDelayedCallbacks;
|
2173 |
+
orphanDelayedCallbacks = null;
|
2174 |
+
for (var i = 0; i < delayed.length; ++i) { delayed[i](); }
|
2175 |
+
}
|
2176 |
+
|
2177 |
+
// When an aspect of a line changes, a string is added to
|
2178 |
+
// lineView.changes. This updates the relevant part of the line's
|
2179 |
+
// DOM structure.
|
2180 |
+
function updateLineForChanges(cm, lineView, lineN, dims) {
|
2181 |
+
for (var j = 0; j < lineView.changes.length; j++) {
|
2182 |
+
var type = lineView.changes[j];
|
2183 |
+
if (type == "text") { updateLineText(cm, lineView); }
|
2184 |
+
else if (type == "gutter") { updateLineGutter(cm, lineView, lineN, dims); }
|
2185 |
+
else if (type == "class") { updateLineClasses(cm, lineView); }
|
2186 |
+
else if (type == "widget") { updateLineWidgets(cm, lineView, dims); }
|
2187 |
+
}
|
2188 |
+
lineView.changes = null;
|
2189 |
+
}
|
2190 |
+
|
2191 |
+
// Lines with gutter elements, widgets or a background class need to
|
2192 |
+
// be wrapped, and have the extra elements added to the wrapper div
|
2193 |
+
function ensureLineWrapped(lineView) {
|
2194 |
+
if (lineView.node == lineView.text) {
|
2195 |
+
lineView.node = elt("div", null, null, "position: relative");
|
2196 |
+
if (lineView.text.parentNode)
|
2197 |
+
{ lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }
|
2198 |
+
lineView.node.appendChild(lineView.text);
|
2199 |
+
if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }
|
2200 |
+
}
|
2201 |
+
return lineView.node
|
2202 |
+
}
|
2203 |
+
|
2204 |
+
function updateLineBackground(cm, lineView) {
|
2205 |
+
var cls = lineView.bgClass ? lineView.bgClass + " " + (lineView.line.bgClass || "") : lineView.line.bgClass;
|
2206 |
+
if (cls) { cls += " CodeMirror-linebackground"; }
|
2207 |
+
if (lineView.background) {
|
2208 |
+
if (cls) { lineView.background.className = cls; }
|
2209 |
+
else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }
|
2210 |
+
} else if (cls) {
|
2211 |
+
var wrap = ensureLineWrapped(lineView);
|
2212 |
+
lineView.background = wrap.insertBefore(elt("div", null, cls), wrap.firstChild);
|
2213 |
+
cm.display.input.setUneditable(lineView.background);
|
2214 |
+
}
|
2215 |
+
}
|
2216 |
+
|
2217 |
+
// Wrapper around buildLineContent which will reuse the structure
|
2218 |
+
// in display.externalMeasured when possible.
|
2219 |
+
function getLineContent(cm, lineView) {
|
2220 |
+
var ext = cm.display.externalMeasured;
|
2221 |
+
if (ext && ext.line == lineView.line) {
|
2222 |
+
cm.display.externalMeasured = null;
|
2223 |
+
lineView.measure = ext.measure;
|
2224 |
+
return ext.built
|
2225 |
+
}
|
2226 |
+
return buildLineContent(cm, lineView)
|
2227 |
+
}
|
2228 |
+
|
2229 |
+
// Redraw the line's text. Interacts with the background and text
|
2230 |
+
// classes because the mode may output tokens that influence these
|
2231 |
+
// classes.
|
2232 |
+
function updateLineText(cm, lineView) {
|
2233 |
+
var cls = lineView.text.className;
|
2234 |
+
var built = getLineContent(cm, lineView);
|
2235 |
+
if (lineView.text == lineView.node) { lineView.node = built.pre; }
|
2236 |
+
lineView.text.parentNode.replaceChild(built.pre, lineView.text);
|
2237 |
+
lineView.text = built.pre;
|
2238 |
+
if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {
|
2239 |
+
lineView.bgClass = built.bgClass;
|
2240 |
+
lineView.textClass = built.textClass;
|
2241 |
+
updateLineClasses(cm, lineView);
|
2242 |
+
} else if (cls) {
|
2243 |
+
lineView.text.className = cls;
|
2244 |
+
}
|
2245 |
+
}
|
2246 |
+
|
2247 |
+
function updateLineClasses(cm, lineView) {
|
2248 |
+
updateLineBackground(cm, lineView);
|
2249 |
+
if (lineView.line.wrapClass)
|
2250 |
+
{ ensureLineWrapped(lineView).className = lineView.line.wrapClass; }
|
2251 |
+
else if (lineView.node != lineView.text)
|
2252 |
+
{ lineView.node.className = ""; }
|
2253 |
+
var textClass = lineView.textClass ? lineView.textClass + " " + (lineView.line.textClass || "") : lineView.line.textClass;
|
2254 |
+
lineView.text.className = textClass || "";
|
2255 |
+
}
|
2256 |
+
|
2257 |
+
function updateLineGutter(cm, lineView, lineN, dims) {
|
2258 |
+
if (lineView.gutter) {
|
2259 |
+
lineView.node.removeChild(lineView.gutter);
|
2260 |
+
lineView.gutter = null;
|
2261 |
+
}
|
2262 |
+
if (lineView.gutterBackground) {
|
2263 |
+
lineView.node.removeChild(lineView.gutterBackground);
|
2264 |
+
lineView.gutterBackground = null;
|
2265 |
+
}
|
2266 |
+
if (lineView.line.gutterClass) {
|
2267 |
+
var wrap = ensureLineWrapped(lineView);
|
2268 |
+
lineView.gutterBackground = elt("div", null, "CodeMirror-gutter-background " + lineView.line.gutterClass,
|
2269 |
+
("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px; width: " + (dims.gutterTotalWidth) + "px"));
|
2270 |
+
cm.display.input.setUneditable(lineView.gutterBackground);
|
2271 |
+
wrap.insertBefore(lineView.gutterBackground, lineView.text);
|
2272 |
+
}
|
2273 |
+
var markers = lineView.line.gutterMarkers;
|
2274 |
+
if (cm.options.lineNumbers || markers) {
|
2275 |
+
var wrap$1 = ensureLineWrapped(lineView);
|
2276 |
+
var gutterWrap = lineView.gutter = elt("div", null, "CodeMirror-gutter-wrapper", ("left: " + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + "px"));
|
2277 |
+
cm.display.input.setUneditable(gutterWrap);
|
2278 |
+
wrap$1.insertBefore(gutterWrap, lineView.text);
|
2279 |
+
if (lineView.line.gutterClass)
|
2280 |
+
{ gutterWrap.className += " " + lineView.line.gutterClass; }
|
2281 |
+
if (cm.options.lineNumbers && (!markers || !markers["CodeMirror-linenumbers"]))
|
2282 |
+
{ lineView.lineNumber = gutterWrap.appendChild(
|
2283 |
+
elt("div", lineNumberFor(cm.options, lineN),
|
2284 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt",
|
2285 |
+
("left: " + (dims.gutterLeft["CodeMirror-linenumbers"]) + "px; width: " + (cm.display.lineNumInnerWidth) + "px"))); }
|
2286 |
+
if (markers) { for (var k = 0; k < cm.options.gutters.length; ++k) {
|
2287 |
+
var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];
|
2288 |
+
if (found)
|
2289 |
+
{ gutterWrap.appendChild(elt("div", [found], "CodeMirror-gutter-elt",
|
2290 |
+
("left: " + (dims.gutterLeft[id]) + "px; width: " + (dims.gutterWidth[id]) + "px"))); }
|
2291 |
} }
|
2292 |
+
}
|
2293 |
+
}
|
2294 |
+
|
2295 |
+
function updateLineWidgets(cm, lineView, dims) {
|
2296 |
+
if (lineView.alignable) { lineView.alignable = null; }
|
2297 |
+
for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {
|
2298 |
+
next = node.nextSibling;
|
2299 |
+
if (node.className == "CodeMirror-linewidget")
|
2300 |
+
{ lineView.node.removeChild(node); }
|
2301 |
+
}
|
2302 |
+
insertLineWidgets(cm, lineView, dims);
|
2303 |
+
}
|
2304 |
+
|
2305 |
+
// Build a line's DOM representation from scratch
|
2306 |
+
function buildLineElement(cm, lineView, lineN, dims) {
|
2307 |
+
var built = getLineContent(cm, lineView);
|
2308 |
+
lineView.text = lineView.node = built.pre;
|
2309 |
+
if (built.bgClass) { lineView.bgClass = built.bgClass; }
|
2310 |
+
if (built.textClass) { lineView.textClass = built.textClass; }
|
2311 |
+
|
2312 |
+
updateLineClasses(cm, lineView);
|
2313 |
+
updateLineGutter(cm, lineView, lineN, dims);
|
2314 |
+
insertLineWidgets(cm, lineView, dims);
|
2315 |
+
return lineView.node
|
2316 |
+
}
|
2317 |
+
|
2318 |
+
// A lineView may contain multiple logical lines (when merged by
|
2319 |
+
// collapsed spans). The widgets for all of them need to be drawn.
|
2320 |
+
function insertLineWidgets(cm, lineView, dims) {
|
2321 |
+
insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);
|
2322 |
+
if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
|
2323 |
+
{ insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }
|
2324 |
+
}
|
2325 |
+
|
2326 |
+
function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {
|
2327 |
+
if (!line.widgets) { return }
|
2328 |
+
var wrap = ensureLineWrapped(lineView);
|
2329 |
+
for (var i = 0, ws = line.widgets; i < ws.length; ++i) {
|
2330 |
+
var widget = ws[i], node = elt("div", [widget.node], "CodeMirror-linewidget");
|
2331 |
+
if (!widget.handleMouseEvents) { node.setAttribute("cm-ignore-events", "true"); }
|
2332 |
+
positionLineWidget(widget, node, lineView, dims);
|
2333 |
+
cm.display.input.setUneditable(node);
|
2334 |
+
if (allowAbove && widget.above)
|
2335 |
+
{ wrap.insertBefore(node, lineView.gutter || lineView.text); }
|
2336 |
+
else
|
2337 |
+
{ wrap.appendChild(node); }
|
2338 |
+
signalLater(widget, "redraw");
|
2339 |
+
}
|
2340 |
+
}
|
2341 |
+
|
2342 |
+
function positionLineWidget(widget, node, lineView, dims) {
|
2343 |
+
if (widget.noHScroll) {
|
2344 |
+
(lineView.alignable || (lineView.alignable = [])).push(node);
|
2345 |
+
var width = dims.wrapperWidth;
|
2346 |
+
node.style.left = dims.fixedPos + "px";
|
2347 |
+
if (!widget.coverGutter) {
|
2348 |
+
width -= dims.gutterTotalWidth;
|
2349 |
+
node.style.paddingLeft = dims.gutterTotalWidth + "px";
|
2350 |
+
}
|
2351 |
+
node.style.width = width + "px";
|
2352 |
+
}
|
2353 |
+
if (widget.coverGutter) {
|
2354 |
+
node.style.zIndex = 5;
|
2355 |
+
node.style.position = "relative";
|
2356 |
+
if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + "px"; }
|
2357 |
+
}
|
2358 |
+
}
|
2359 |
+
|
2360 |
+
function widgetHeight(widget) {
|
2361 |
+
if (widget.height != null) { return widget.height }
|
2362 |
+
var cm = widget.doc.cm;
|
2363 |
+
if (!cm) { return 0 }
|
2364 |
+
if (!contains(document.body, widget.node)) {
|
2365 |
+
var parentStyle = "position: relative;";
|
2366 |
+
if (widget.coverGutter)
|
2367 |
+
{ parentStyle += "margin-left: -" + cm.display.gutters.offsetWidth + "px;"; }
|
2368 |
+
if (widget.noHScroll)
|
2369 |
+
{ parentStyle += "width: " + cm.display.wrapper.clientWidth + "px;"; }
|
2370 |
+
removeChildrenAndAdd(cm.display.measure, elt("div", [widget.node], null, parentStyle));
|
2371 |
+
}
|
2372 |
+
return widget.height = widget.node.parentNode.offsetHeight
|
2373 |
+
}
|
2374 |
+
|
2375 |
+
// Return true when the given mouse event happened in a widget
|
2376 |
+
function eventInWidget(display, e) {
|
2377 |
+
for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {
|
2378 |
+
if (!n || (n.nodeType == 1 && n.getAttribute("cm-ignore-events") == "true") ||
|
2379 |
+
(n.parentNode == display.sizer && n != display.mover))
|
2380 |
+
{ return true }
|
2381 |
+
}
|
2382 |
+
}
|
2383 |
+
|
2384 |
+
// POSITION MEASUREMENT
|
2385 |
+
|
2386 |
+
function paddingTop(display) {return display.lineSpace.offsetTop}
|
2387 |
+
function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}
|
2388 |
+
function paddingH(display) {
|
2389 |
+
if (display.cachedPaddingH) { return display.cachedPaddingH }
|
2390 |
+
var e = removeChildrenAndAdd(display.measure, elt("pre", "x"));
|
2391 |
+
var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;
|
2392 |
+
var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};
|
2393 |
+
if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }
|
2394 |
+
return data
|
2395 |
+
}
|
2396 |
+
|
2397 |
+
function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }
|
2398 |
+
function displayWidth(cm) {
|
2399 |
+
return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth
|
2400 |
+
}
|
2401 |
+
function displayHeight(cm) {
|
2402 |
+
return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight
|
2403 |
+
}
|
2404 |
+
|
2405 |
+
// Ensure the lineView.wrapping.heights array is populated. This is
|
2406 |
+
// an array of bottom offsets for the lines that make up a drawn
|
2407 |
+
// line. When lineWrapping is on, there might be more than one
|
2408 |
+
// height.
|
2409 |
+
function ensureLineHeights(cm, lineView, rect) {
|
2410 |
+
var wrapping = cm.options.lineWrapping;
|
2411 |
+
var curWidth = wrapping && displayWidth(cm);
|
2412 |
+
if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {
|
2413 |
+
var heights = lineView.measure.heights = [];
|
2414 |
+
if (wrapping) {
|
2415 |
+
lineView.measure.width = curWidth;
|
2416 |
+
var rects = lineView.text.firstChild.getClientRects();
|
2417 |
+
for (var i = 0; i < rects.length - 1; i++) {
|
2418 |
+
var cur = rects[i], next = rects[i + 1];
|
2419 |
+
if (Math.abs(cur.bottom - next.bottom) > 2)
|
2420 |
+
{ heights.push((cur.bottom + next.top) / 2 - rect.top); }
|
2421 |
+
}
|
2422 |
+
}
|
2423 |
+
heights.push(rect.bottom - rect.top);
|
2424 |
+
}
|
2425 |
+
}
|
2426 |
+
|
2427 |
+
// Find a line map (mapping character offsets to text nodes) and a
|
2428 |
+
// measurement cache for the given line number. (A line view might
|
2429 |
+
// contain multiple lines when collapsed ranges are present.)
|
2430 |
+
function mapFromLineView(lineView, line, lineN) {
|
2431 |
+
if (lineView.line == line)
|
2432 |
+
{ return {map: lineView.measure.map, cache: lineView.measure.cache} }
|
2433 |
+
for (var i = 0; i < lineView.rest.length; i++)
|
2434 |
+
{ if (lineView.rest[i] == line)
|
2435 |
+
{ return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }
|
2436 |
+
for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)
|
2437 |
+
{ if (lineNo(lineView.rest[i$1]) > lineN)
|
2438 |
+
{ return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }
|
2439 |
+
}
|
2440 |
+
|
2441 |
+
// Render a line into the hidden node display.externalMeasured. Used
|
2442 |
+
// when measurement is needed for a line that's not in the viewport.
|
2443 |
+
function updateExternalMeasurement(cm, line) {
|
2444 |
+
line = visualLine(line);
|
2445 |
+
var lineN = lineNo(line);
|
2446 |
+
var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);
|
2447 |
+
view.lineN = lineN;
|
2448 |
+
var built = view.built = buildLineContent(cm, view);
|
2449 |
+
view.text = built.pre;
|
2450 |
+
removeChildrenAndAdd(cm.display.lineMeasure, built.pre);
|
2451 |
+
return view
|
2452 |
+
}
|
2453 |
+
|
2454 |
+
// Get a {top, bottom, left, right} box (in line-local coordinates)
|
2455 |
+
// for a given character.
|
2456 |
+
function measureChar(cm, line, ch, bias) {
|
2457 |
+
return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)
|
2458 |
+
}
|
2459 |
+
|
2460 |
+
// Find a line view that corresponds to the given line number.
|
2461 |
+
function findViewForLine(cm, lineN) {
|
2462 |
+
if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)
|
2463 |
+
{ return cm.display.view[findViewIndex(cm, lineN)] }
|
2464 |
+
var ext = cm.display.externalMeasured;
|
2465 |
+
if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)
|
2466 |
+
{ return ext }
|
2467 |
+
}
|
2468 |
+
|
2469 |
+
// Measurement can be split in two steps, the set-up work that
|
2470 |
+
// applies to the whole line, and the measurement of the actual
|
2471 |
+
// character. Functions like coordsChar, that need to do a lot of
|
2472 |
+
// measurements in a row, can thus ensure that the set-up work is
|
2473 |
+
// only done once.
|
2474 |
+
function prepareMeasureForLine(cm, line) {
|
2475 |
+
var lineN = lineNo(line);
|
2476 |
+
var view = findViewForLine(cm, lineN);
|
2477 |
+
if (view && !view.text) {
|
2478 |
+
view = null;
|
2479 |
+
} else if (view && view.changes) {
|
2480 |
+
updateLineForChanges(cm, view, lineN, getDimensions(cm));
|
2481 |
+
cm.curOp.forceUpdate = true;
|
2482 |
+
}
|
2483 |
+
if (!view)
|
2484 |
+
{ view = updateExternalMeasurement(cm, line); }
|
2485 |
+
|
2486 |
+
var info = mapFromLineView(view, line, lineN);
|
2487 |
+
return {
|
2488 |
+
line: line, view: view, rect: null,
|
2489 |
+
map: info.map, cache: info.cache, before: info.before,
|
2490 |
+
hasHeights: false
|
2491 |
+
}
|
2492 |
+
}
|
2493 |
+
|
2494 |
+
// Given a prepared measurement object, measures the position of an
|
2495 |
+
// actual character (or fetches it from the cache).
|
2496 |
+
function measureCharPrepared(cm, prepared, ch, bias, varHeight) {
|
2497 |
+
if (prepared.before) { ch = -1; }
|
2498 |
+
var key = ch + (bias || ""), found;
|
2499 |
+
if (prepared.cache.hasOwnProperty(key)) {
|
2500 |
+
found = prepared.cache[key];
|
2501 |
+
} else {
|
2502 |
+
if (!prepared.rect)
|
2503 |
+
{ prepared.rect = prepared.view.text.getBoundingClientRect(); }
|
2504 |
+
if (!prepared.hasHeights) {
|
2505 |
+
ensureLineHeights(cm, prepared.view, prepared.rect);
|
2506 |
+
prepared.hasHeights = true;
|
2507 |
+
}
|
2508 |
+
found = measureCharInner(cm, prepared, ch, bias);
|
2509 |
+
if (!found.bogus) { prepared.cache[key] = found; }
|
2510 |
+
}
|
2511 |
+
return {left: found.left, right: found.right,
|
2512 |
+
top: varHeight ? found.rtop : found.top,
|
2513 |
+
bottom: varHeight ? found.rbottom : found.bottom}
|
2514 |
+
}
|
2515 |
+
|
2516 |
+
var nullRect = {left: 0, right: 0, top: 0, bottom: 0};
|
2517 |
+
|
2518 |
+
function nodeAndOffsetInLineMap(map$$1, ch, bias) {
|
2519 |
+
var node, start, end, collapse, mStart, mEnd;
|
2520 |
+
// First, search the line map for the text node corresponding to,
|
2521 |
+
// or closest to, the target character.
|
2522 |
+
for (var i = 0; i < map$$1.length; i += 3) {
|
2523 |
+
mStart = map$$1[i];
|
2524 |
+
mEnd = map$$1[i + 1];
|
2525 |
+
if (ch < mStart) {
|
2526 |
+
start = 0; end = 1;
|
2527 |
+
collapse = "left";
|
2528 |
+
} else if (ch < mEnd) {
|
2529 |
+
start = ch - mStart;
|
2530 |
+
end = start + 1;
|
2531 |
+
} else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {
|
2532 |
+
end = mEnd - mStart;
|
2533 |
+
start = end - 1;
|
2534 |
+
if (ch >= mEnd) { collapse = "right"; }
|
2535 |
+
}
|
2536 |
+
if (start != null) {
|
2537 |
+
node = map$$1[i + 2];
|
2538 |
+
if (mStart == mEnd && bias == (node.insertLeft ? "left" : "right"))
|
2539 |
+
{ collapse = bias; }
|
2540 |
+
if (bias == "left" && start == 0)
|
2541 |
+
{ while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {
|
2542 |
+
node = map$$1[(i -= 3) + 2];
|
2543 |
+
collapse = "left";
|
2544 |
+
} }
|
2545 |
+
if (bias == "right" && start == mEnd - mStart)
|
2546 |
+
{ while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {
|
2547 |
+
node = map$$1[(i += 3) + 2];
|
2548 |
+
collapse = "right";
|
2549 |
+
} }
|
2550 |
+
break
|
2551 |
+
}
|
2552 |
+
}
|
2553 |
+
return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}
|
2554 |
+
}
|
2555 |
|
2556 |
+
function getUsefulRect(rects, bias) {
|
2557 |
+
var rect = nullRect;
|
2558 |
+
if (bias == "left") { for (var i = 0; i < rects.length; i++) {
|
2559 |
+
if ((rect = rects[i]).left != rect.right) { break }
|
2560 |
+
} } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {
|
2561 |
+
if ((rect = rects[i$1]).left != rect.right) { break }
|
|
|
|
|
2562 |
} }
|
2563 |
+
return rect
|
2564 |
+
}
|
2565 |
+
|
2566 |
+
function measureCharInner(cm, prepared, ch, bias) {
|
2567 |
+
var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);
|
2568 |
+
var node = place.node, start = place.start, end = place.end, collapse = place.collapse;
|
2569 |
+
|
2570 |
+
var rect;
|
2571 |
+
if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.
|
2572 |
+
for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned
|
2573 |
+
while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }
|
2574 |
+
while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }
|
2575 |
+
if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)
|
2576 |
+
{ rect = node.parentNode.getBoundingClientRect(); }
|
2577 |
+
else
|
2578 |
+
{ rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }
|
2579 |
+
if (rect.left || rect.right || start == 0) { break }
|
2580 |
+
end = start;
|
2581 |
+
start = start - 1;
|
2582 |
+
collapse = "right";
|
2583 |
+
}
|
2584 |
+
if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }
|
2585 |
+
} else { // If it is a widget, simply get the box for the whole widget.
|
2586 |
+
if (start > 0) { collapse = bias = "right"; }
|
2587 |
+
var rects;
|
2588 |
+
if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)
|
2589 |
+
{ rect = rects[bias == "right" ? rects.length - 1 : 0]; }
|
2590 |
+
else
|
2591 |
+
{ rect = node.getBoundingClientRect(); }
|
2592 |
+
}
|
2593 |
+
if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {
|
2594 |
+
var rSpan = node.parentNode.getClientRects()[0];
|
2595 |
+
if (rSpan)
|
2596 |
+
{ rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }
|
2597 |
+
else
|
2598 |
+
{ rect = nullRect; }
|
2599 |
+
}
|
2600 |
+
|
2601 |
+
var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;
|
2602 |
+
var mid = (rtop + rbot) / 2;
|
2603 |
+
var heights = prepared.view.measure.heights;
|
2604 |
+
var i = 0;
|
2605 |
+
for (; i < heights.length - 1; i++)
|
2606 |
+
{ if (mid < heights[i]) { break } }
|
2607 |
+
var top = i ? heights[i - 1] : 0, bot = heights[i];
|
2608 |
+
var result = {left: (collapse == "right" ? rect.right : rect.left) - prepared.rect.left,
|
2609 |
+
right: (collapse == "left" ? rect.left : rect.right) - prepared.rect.left,
|
2610 |
+
top: top, bottom: bot};
|
2611 |
+
if (!rect.left && !rect.right) { result.bogus = true; }
|
2612 |
+
if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }
|
2613 |
+
|
2614 |
+
return result
|
2615 |
+
}
|
2616 |
+
|
2617 |
+
// Work around problem with bounding client rects on ranges being
|
2618 |
+
// returned incorrectly when zoomed on IE10 and below.
|
2619 |
+
function maybeUpdateRectForZooming(measure, rect) {
|
2620 |
+
if (!window.screen || screen.logicalXDPI == null ||
|
2621 |
+
screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))
|
2622 |
+
{ return rect }
|
2623 |
+
var scaleX = screen.logicalXDPI / screen.deviceXDPI;
|
2624 |
+
var scaleY = screen.logicalYDPI / screen.deviceYDPI;
|
2625 |
+
return {left: rect.left * scaleX, right: rect.right * scaleX,
|
2626 |
+
top: rect.top * scaleY, bottom: rect.bottom * scaleY}
|
2627 |
+
}
|
2628 |
+
|
2629 |
+
function clearLineMeasurementCacheFor(lineView) {
|
2630 |
+
if (lineView.measure) {
|
2631 |
+
lineView.measure.cache = {};
|
2632 |
+
lineView.measure.heights = null;
|
2633 |
+
if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)
|
2634 |
+
{ lineView.measure.caches[i] = {}; } }
|
2635 |
+
}
|
2636 |
+
}
|
2637 |
+
|
2638 |
+
function clearLineMeasurementCache(cm) {
|
2639 |
+
cm.display.externalMeasure = null;
|
2640 |
+
removeChildren(cm.display.lineMeasure);
|
2641 |
+
for (var i = 0; i < cm.display.view.length; i++)
|
2642 |
+
{ clearLineMeasurementCacheFor(cm.display.view[i]); }
|
2643 |
+
}
|
2644 |
+
|
2645 |
+
function clearCaches(cm) {
|
2646 |
+
clearLineMeasurementCache(cm);
|
2647 |
+
cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;
|
2648 |
+
if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }
|
2649 |
+
cm.display.lineNumChars = null;
|
2650 |
+
}
|
2651 |
+
|
2652 |
+
function pageScrollX() {
|
2653 |
+
// Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206
|
2654 |
+
// which causes page_Offset and bounding client rects to use
|
2655 |
+
// different reference viewports and invalidate our calculations.
|
2656 |
+
if (chrome && android) { return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft)) }
|
2657 |
+
return window.pageXOffset || (document.documentElement || document.body).scrollLeft
|
2658 |
+
}
|
2659 |
+
function pageScrollY() {
|
2660 |
+
if (chrome && android) { return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop)) }
|
2661 |
+
return window.pageYOffset || (document.documentElement || document.body).scrollTop
|
2662 |
+
}
|
2663 |
+
|
2664 |
+
function widgetTopHeight(lineObj) {
|
2665 |
+
var height = 0;
|
2666 |
+
if (lineObj.widgets) { for (var i = 0; i < lineObj.widgets.length; ++i) { if (lineObj.widgets[i].above)
|
2667 |
+
{ height += widgetHeight(lineObj.widgets[i]); } } }
|
2668 |
+
return height
|
2669 |
+
}
|
2670 |
+
|
2671 |
+
// Converts a {top, bottom, left, right} box from line-local
|
2672 |
+
// coordinates into another coordinate system. Context may be one of
|
2673 |
+
// "line", "div" (display.lineDiv), "local"./null (editor), "window",
|
2674 |
+
// or "page".
|
2675 |
+
function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {
|
2676 |
+
if (!includeWidgets) {
|
2677 |
+
var height = widgetTopHeight(lineObj);
|
2678 |
+
rect.top += height; rect.bottom += height;
|
2679 |
+
}
|
2680 |
+
if (context == "line") { return rect }
|
2681 |
+
if (!context) { context = "local"; }
|
2682 |
+
var yOff = heightAtLine(lineObj);
|
2683 |
+
if (context == "local") { yOff += paddingTop(cm.display); }
|
2684 |
+
else { yOff -= cm.display.viewOffset; }
|
2685 |
+
if (context == "page" || context == "window") {
|
2686 |
+
var lOff = cm.display.lineSpace.getBoundingClientRect();
|
2687 |
+
yOff += lOff.top + (context == "window" ? 0 : pageScrollY());
|
2688 |
+
var xOff = lOff.left + (context == "window" ? 0 : pageScrollX());
|
2689 |
+
rect.left += xOff; rect.right += xOff;
|
2690 |
+
}
|
2691 |
+
rect.top += yOff; rect.bottom += yOff;
|
2692 |
+
return rect
|
2693 |
+
}
|
2694 |
+
|
2695 |
+
// Coverts a box from "div" coords to another coordinate system.
|
2696 |
+
// Context may be "window", "page", "div", or "local"./null.
|
2697 |
+
function fromCoordSystem(cm, coords, context) {
|
2698 |
+
if (context == "div") { return coords }
|
2699 |
+
var left = coords.left, top = coords.top;
|
2700 |
+
// First move into "page" coordinate system
|
2701 |
+
if (context == "page") {
|
2702 |
+
left -= pageScrollX();
|
2703 |
+
top -= pageScrollY();
|
2704 |
+
} else if (context == "local" || !context) {
|
2705 |
+
var localBox = cm.display.sizer.getBoundingClientRect();
|
2706 |
+
left += localBox.left;
|
2707 |
+
top += localBox.top;
|
2708 |
+
}
|
2709 |
+
|
2710 |
+
var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();
|
2711 |
+
return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}
|
2712 |
+
}
|
2713 |
+
|
2714 |
+
function charCoords(cm, pos, context, lineObj, bias) {
|
2715 |
+
if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }
|
2716 |
+
return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)
|
2717 |
+
}
|
2718 |
+
|
2719 |
+
// Returns a box for a given cursor position, which may have an
|
2720 |
+
// 'other' property containing the position of the secondary cursor
|
2721 |
+
// on a bidi boundary.
|
2722 |
+
// A cursor Pos(line, char, "before") is on the same visual line as `char - 1`
|
2723 |
+
// and after `char - 1` in writing order of `char - 1`
|
2724 |
+
// A cursor Pos(line, char, "after") is on the same visual line as `char`
|
2725 |
+
// and before `char` in writing order of `char`
|
2726 |
+
// Examples (upper-case letters are RTL, lower-case are LTR):
|
2727 |
+
// Pos(0, 1, ...)
|
2728 |
+
// before after
|
2729 |
+
// ab a|b a|b
|
2730 |
+
// aB a|B aB|
|
2731 |
+
// Ab |Ab A|b
|
2732 |
+
// AB B|A B|A
|
2733 |
+
// Every position after the last character on a line is considered to stick
|
2734 |
+
// to the last character on the line.
|
2735 |
+
function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {
|
2736 |
+
lineObj = lineObj || getLine(cm.doc, pos.line);
|
2737 |
+
if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
|
2738 |
+
function get(ch, right) {
|
2739 |
+
var m = measureCharPrepared(cm, preparedMeasure, ch, right ? "right" : "left", varHeight);
|
2740 |
+
if (right) { m.left = m.right; } else { m.right = m.left; }
|
2741 |
+
return intoCoordSystem(cm, lineObj, m, context)
|
2742 |
+
}
|
2743 |
+
var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;
|
2744 |
+
if (ch >= lineObj.text.length) {
|
2745 |
+
ch = lineObj.text.length;
|
2746 |
+
sticky = "before";
|
2747 |
+
} else if (ch <= 0) {
|
2748 |
+
ch = 0;
|
2749 |
+
sticky = "after";
|
2750 |
+
}
|
2751 |
+
if (!order) { return get(sticky == "before" ? ch - 1 : ch, sticky == "before") }
|
2752 |
+
|
2753 |
+
function getBidi(ch, partPos, invert) {
|
2754 |
+
var part = order[partPos], right = part.level == 1;
|
2755 |
+
return get(invert ? ch - 1 : ch, right != invert)
|
2756 |
+
}
|
2757 |
+
var partPos = getBidiPartAt(order, ch, sticky);
|
2758 |
+
var other = bidiOther;
|
2759 |
+
var val = getBidi(ch, partPos, sticky == "before");
|
2760 |
+
if (other != null) { val.other = getBidi(ch, other, sticky != "before"); }
|
2761 |
+
return val
|
2762 |
+
}
|
2763 |
+
|
2764 |
+
// Used to cheaply estimate the coordinates for a position. Used for
|
2765 |
+
// intermediate scroll updates.
|
2766 |
+
function estimateCoords(cm, pos) {
|
2767 |
+
var left = 0;
|
2768 |
+
pos = clipPos(cm.doc, pos);
|
2769 |
+
if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }
|
2770 |
+
var lineObj = getLine(cm.doc, pos.line);
|
2771 |
+
var top = heightAtLine(lineObj) + paddingTop(cm.display);
|
2772 |
+
return {left: left, right: left, top: top, bottom: top + lineObj.height}
|
2773 |
+
}
|
2774 |
+
|
2775 |
+
// Positions returned by coordsChar contain some extra information.
|
2776 |
+
// xRel is the relative x position of the input coordinates compared
|
2777 |
+
// to the found position (so xRel > 0 means the coordinates are to
|
2778 |
+
// the right of the character position, for example). When outside
|
2779 |
+
// is true, that means the coordinates lie outside the line's
|
2780 |
+
// vertical range.
|
2781 |
+
function PosWithInfo(line, ch, sticky, outside, xRel) {
|
2782 |
+
var pos = Pos(line, ch, sticky);
|
2783 |
+
pos.xRel = xRel;
|
2784 |
+
if (outside) { pos.outside = true; }
|
2785 |
+
return pos
|
2786 |
+
}
|
2787 |
+
|
2788 |
+
// Compute the character position closest to the given coordinates.
|
2789 |
+
// Input must be lineSpace-local ("div" coordinate system).
|
2790 |
+
function coordsChar(cm, x, y) {
|
2791 |
+
var doc = cm.doc;
|
2792 |
+
y += cm.display.viewOffset;
|
2793 |
+
if (y < 0) { return PosWithInfo(doc.first, 0, null, true, -1) }
|
2794 |
+
var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;
|
2795 |
+
if (lineN > last)
|
2796 |
+
{ return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1) }
|
2797 |
+
if (x < 0) { x = 0; }
|
2798 |
+
|
2799 |
+
var lineObj = getLine(doc, lineN);
|
2800 |
+
for (;;) {
|
2801 |
+
var found = coordsCharInner(cm, lineObj, lineN, x, y);
|
2802 |
+
var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));
|
2803 |
+
if (!collapsed) { return found }
|
2804 |
+
var rangeEnd = collapsed.find(1);
|
2805 |
+
if (rangeEnd.line == lineN) { return rangeEnd }
|
2806 |
+
lineObj = getLine(doc, lineN = rangeEnd.line);
|
2807 |
+
}
|
2808 |
+
}
|
2809 |
+
|
2810 |
+
function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {
|
2811 |
+
y -= widgetTopHeight(lineObj);
|
2812 |
+
var end = lineObj.text.length;
|
2813 |
+
var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);
|
2814 |
+
end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);
|
2815 |
+
return {begin: begin, end: end}
|
2816 |
+
}
|
2817 |
+
|
2818 |
+
function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {
|
2819 |
+
if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }
|
2820 |
+
var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), "line").top;
|
2821 |
+
return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)
|
2822 |
+
}
|
2823 |
+
|
2824 |
+
// Returns true if the given side of a box is after the given
|
2825 |
+
// coordinates, in top-to-bottom, left-to-right order.
|
2826 |
+
function boxIsAfter(box, x, y, left) {
|
2827 |
+
return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x
|
2828 |
+
}
|
2829 |
+
|
2830 |
+
function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {
|
2831 |
+
// Move y into line-local coordinate space
|
2832 |
+
y -= heightAtLine(lineObj);
|
2833 |
+
var preparedMeasure = prepareMeasureForLine(cm, lineObj);
|
2834 |
+
// When directly calling `measureCharPrepared`, we have to adjust
|
2835 |
+
// for the widgets at this line.
|
2836 |
+
var widgetHeight$$1 = widgetTopHeight(lineObj);
|
2837 |
+
var begin = 0, end = lineObj.text.length, ltr = true;
|
2838 |
+
|
2839 |
+
var order = getOrder(lineObj, cm.doc.direction);
|
2840 |
+
// If the line isn't plain left-to-right text, first figure out
|
2841 |
+
// which bidi section the coordinates fall into.
|
2842 |
+
if (order) {
|
2843 |
+
var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)
|
2844 |
+
(cm, lineObj, lineNo$$1, preparedMeasure, order, x, y);
|
2845 |
+
ltr = part.level != 1;
|
2846 |
+
// The awkward -1 offsets are needed because findFirst (called
|
2847 |
+
// on these below) will treat its first bound as inclusive,
|
2848 |
+
// second as exclusive, but we want to actually address the
|
2849 |
+
// characters in the part's range
|
2850 |
+
begin = ltr ? part.from : part.to - 1;
|
2851 |
+
end = ltr ? part.to : part.from - 1;
|
2852 |
+
}
|
2853 |
+
|
2854 |
+
// A binary search to find the first character whose bounding box
|
2855 |
+
// starts after the coordinates. If we run across any whose box wrap
|
2856 |
+
// the coordinates, store that.
|
2857 |
+
var chAround = null, boxAround = null;
|
2858 |
+
var ch = findFirst(function (ch) {
|
2859 |
+
var box = measureCharPrepared(cm, preparedMeasure, ch);
|
2860 |
+
box.top += widgetHeight$$1; box.bottom += widgetHeight$$1;
|
2861 |
+
if (!boxIsAfter(box, x, y, false)) { return false }
|
2862 |
+
if (box.top <= y && box.left <= x) {
|
2863 |
+
chAround = ch;
|
2864 |
+
boxAround = box;
|
2865 |
+
}
|
2866 |
+
return true
|
2867 |
+
}, begin, end);
|
2868 |
+
|
2869 |
+
var baseX, sticky, outside = false;
|
2870 |
+
// If a box around the coordinates was found, use that
|
2871 |
+
if (boxAround) {
|
2872 |
+
// Distinguish coordinates nearer to the left or right side of the box
|
2873 |
+
var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;
|
2874 |
+
ch = chAround + (atStart ? 0 : 1);
|
2875 |
+
sticky = atStart ? "after" : "before";
|
2876 |
+
baseX = atLeft ? boxAround.left : boxAround.right;
|
2877 |
+
} else {
|
2878 |
+
// (Adjust for extended bound, if necessary.)
|
2879 |
+
if (!ltr && (ch == end || ch == begin)) { ch++; }
|
2880 |
+
// To determine which side to associate with, get the box to the
|
2881 |
+
// left of the character and compare it's vertical position to the
|
2882 |
+
// coordinates
|
2883 |
+
sticky = ch == 0 ? "after" : ch == lineObj.text.length ? "before" :
|
2884 |
+
(measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight$$1 <= y) == ltr ?
|
2885 |
+
"after" : "before";
|
2886 |
+
// Now get accurate coordinates for this place, in order to get a
|
2887 |
+
// base X position
|
2888 |
+
var coords = cursorCoords(cm, Pos(lineNo$$1, ch, sticky), "line", lineObj, preparedMeasure);
|
2889 |
+
baseX = coords.left;
|
2890 |
+
outside = y < coords.top || y >= coords.bottom;
|
2891 |
+
}
|
2892 |
+
|
2893 |
+
ch = skipExtendingChars(lineObj.text, ch, 1);
|
2894 |
+
return PosWithInfo(lineNo$$1, ch, sticky, outside, x - baseX)
|
2895 |
+
}
|
2896 |
+
|
2897 |
+
function coordsBidiPart(cm, lineObj, lineNo$$1, preparedMeasure, order, x, y) {
|
2898 |
+
// Bidi parts are sorted left-to-right, and in a non-line-wrapping
|
2899 |
+
// situation, we can take this ordering to correspond to the visual
|
2900 |
+
// ordering. This finds the first part whose end is after the given
|
2901 |
+
// coordinates.
|
2902 |
+
var index = findFirst(function (i) {
|
2903 |
+
var part = order[i], ltr = part.level != 1;
|
2904 |
+
return boxIsAfter(cursorCoords(cm, Pos(lineNo$$1, ltr ? part.to : part.from, ltr ? "before" : "after"),
|
2905 |
+
"line", lineObj, preparedMeasure), x, y, true)
|
2906 |
+
}, 0, order.length - 1);
|
2907 |
+
var part = order[index];
|
2908 |
+
// If this isn't the first part, the part's start is also after
|
2909 |
+
// the coordinates, and the coordinates aren't on the same line as
|
2910 |
+
// that start, move one part back.
|
2911 |
+
if (index > 0) {
|
2912 |
+
var ltr = part.level != 1;
|
2913 |
+
var start = cursorCoords(cm, Pos(lineNo$$1, ltr ? part.from : part.to, ltr ? "after" : "before"),
|
2914 |
+
"line", lineObj, preparedMeasure);
|
2915 |
+
if (boxIsAfter(start, x, y, true) && start.top > y)
|
2916 |
+
{ part = order[index - 1]; }
|
2917 |
+
}
|
2918 |
+
return part
|
2919 |
+
}
|
2920 |
+
|
2921 |
+
function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {
|
2922 |
+
// In a wrapped line, rtl text on wrapping boundaries can do things
|
2923 |
+
// that don't correspond to the ordering in our `order` array at
|
2924 |
+
// all, so a binary search doesn't work, and we want to return a
|
2925 |
+
// part that only spans one line so that the binary search in
|
2926 |
+
// coordsCharInner is safe. As such, we first find the extent of the
|
2927 |
+
// wrapped line, and then do a flat search in which we discard any
|
2928 |
+
// spans that aren't on the line.
|
2929 |
+
var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);
|
2930 |
+
var begin = ref.begin;
|
2931 |
+
var end = ref.end;
|
2932 |
+
if (/\s/.test(lineObj.text.charAt(end - 1))) { end--; }
|
2933 |
+
var part = null, closestDist = null;
|
2934 |
+
for (var i = 0; i < order.length; i++) {
|
2935 |
+
var p = order[i];
|
2936 |
+
if (p.from >= end || p.to <= begin) { continue }
|
2937 |
+
var ltr = p.level != 1;
|
2938 |
+
var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;
|
2939 |
+
// Weigh against spans ending before this, so that they are only
|
2940 |
+
// picked if nothing ends after
|
2941 |
+
var dist = endX < x ? x - endX + 1e9 : endX - x;
|
2942 |
+
if (!part || closestDist > dist) {
|
2943 |
+
part = p;
|
2944 |
+
closestDist = dist;
|
2945 |
+
}
|
2946 |
+
}
|
2947 |
+
if (!part) { part = order[order.length - 1]; }
|
2948 |
+
// Clip the part to the wrapped line.
|
2949 |
+
if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }
|
2950 |
+
if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }
|
2951 |
+
return part
|
2952 |
+
}
|
2953 |
+
|
2954 |
+
var measureText;
|
2955 |
+
// Compute the default text height.
|
2956 |
+
function textHeight(display) {
|
2957 |
+
if (display.cachedTextHeight != null) { return display.cachedTextHeight }
|
2958 |
+
if (measureText == null) {
|
2959 |
+
measureText = elt("pre");
|
2960 |
+
// Measure a bunch of lines, for browsers that compute
|
2961 |
+
// fractional heights.
|
2962 |
+
for (var i = 0; i < 49; ++i) {
|
2963 |
+
measureText.appendChild(document.createTextNode("x"));
|
2964 |
+
measureText.appendChild(elt("br"));
|
2965 |
+
}
|
2966 |
+
measureText.appendChild(document.createTextNode("x"));
|
2967 |
+
}
|
2968 |
+
removeChildrenAndAdd(display.measure, measureText);
|
2969 |
+
var height = measureText.offsetHeight / 50;
|
2970 |
+
if (height > 3) { display.cachedTextHeight = height; }
|
2971 |
+
removeChildren(display.measure);
|
2972 |
+
return height || 1
|
2973 |
+
}
|
2974 |
+
|
2975 |
+
// Compute the default character width.
|
2976 |
+
function charWidth(display) {
|
2977 |
+
if (display.cachedCharWidth != null) { return display.cachedCharWidth }
|
2978 |
+
var anchor = elt("span", "xxxxxxxxxx");
|
2979 |
+
var pre = elt("pre", [anchor]);
|
2980 |
+
removeChildrenAndAdd(display.measure, pre);
|
2981 |
+
var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;
|
2982 |
+
if (width > 2) { display.cachedCharWidth = width; }
|
2983 |
+
return width || 10
|
2984 |
+
}
|
2985 |
+
|
2986 |
+
// Do a bulk-read of the DOM positions and sizes needed to draw the
|
2987 |
+
// view, so that we don't interleave reading and writing to the DOM.
|
2988 |
+
function getDimensions(cm) {
|
2989 |
+
var d = cm.display, left = {}, width = {};
|
2990 |
+
var gutterLeft = d.gutters.clientLeft;
|
2991 |
+
for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {
|
2992 |
+
left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;
|
2993 |
+
width[cm.options.gutters[i]] = n.clientWidth;
|
2994 |
+
}
|
2995 |
+
return {fixedPos: compensateForHScroll(d),
|
2996 |
+
gutterTotalWidth: d.gutters.offsetWidth,
|
2997 |
+
gutterLeft: left,
|
2998 |
+
gutterWidth: width,
|
2999 |
+
wrapperWidth: d.wrapper.clientWidth}
|
3000 |
+
}
|
3001 |
+
|
3002 |
+
// Computes display.scroller.scrollLeft + display.gutters.offsetWidth,
|
3003 |
+
// but using getBoundingClientRect to get a sub-pixel-accurate
|
3004 |
+
// result.
|
3005 |
+
function compensateForHScroll(display) {
|
3006 |
+
return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left
|
3007 |
+
}
|
3008 |
+
|
3009 |
+
// Returns a function that estimates the height of a line, to use as
|
3010 |
+
// first approximation until the line becomes visible (and is thus
|
3011 |
+
// properly measurable).
|
3012 |
+
function estimateHeight(cm) {
|
3013 |
+
var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;
|
3014 |
+
var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);
|
3015 |
+
return function (line) {
|
3016 |
+
if (lineIsHidden(cm.doc, line)) { return 0 }
|
3017 |
+
|
3018 |
+
var widgetsHeight = 0;
|
3019 |
+
if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {
|
3020 |
+
if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }
|
3021 |
+
} }
|
3022 |
+
|
3023 |
+
if (wrapping)
|
3024 |
+
{ return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }
|
3025 |
+
else
|
3026 |
+
{ return widgetsHeight + th }
|
3027 |
+
}
|
3028 |
+
}
|
3029 |
+
|
3030 |
+
function estimateLineHeights(cm) {
|
3031 |
+
var doc = cm.doc, est = estimateHeight(cm);
|
3032 |
+
doc.iter(function (line) {
|
3033 |
+
var estHeight = est(line);
|
3034 |
+
if (estHeight != line.height) { updateLineHeight(line, estHeight); }
|
3035 |
+
});
|
3036 |
+
}
|
3037 |
+
|
3038 |
+
// Given a mouse event, find the corresponding position. If liberal
|
3039 |
+
// is false, it checks whether a gutter or scrollbar was clicked,
|
3040 |
+
// and returns null if it was. forRect is used by rectangular
|
3041 |
+
// selections, and tries to estimate a character position even for
|
3042 |
+
// coordinates beyond the right of the text.
|
3043 |
+
function posFromMouse(cm, e, liberal, forRect) {
|
3044 |
+
var display = cm.display;
|
3045 |
+
if (!liberal && e_target(e).getAttribute("cm-not-content") == "true") { return null }
|
3046 |
+
|
3047 |
+
var x, y, space = display.lineSpace.getBoundingClientRect();
|
3048 |
+
// Fails unpredictably on IE[67] when mouse is dragged around quickly.
|
3049 |
+
try { x = e.clientX - space.left; y = e.clientY - space.top; }
|
3050 |
+
catch (e) { return null }
|
3051 |
+
var coords = coordsChar(cm, x, y), line;
|
3052 |
+
if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {
|
3053 |
+
var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;
|
3054 |
+
coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));
|
3055 |
+
}
|
3056 |
+
return coords
|
3057 |
+
}
|
3058 |
+
|
3059 |
+
// Find the view element corresponding to a given line. Return null
|
3060 |
+
// when the line isn't visible.
|
3061 |
+
function findViewIndex(cm, n) {
|
3062 |
+
if (n >= cm.display.viewTo) { return null }
|
3063 |
+
n -= cm.display.viewFrom;
|
3064 |
+
if (n < 0) { return null }
|
3065 |
+
var view = cm.display.view;
|
3066 |
+
for (var i = 0; i < view.length; i++) {
|
3067 |
+
n -= view[i].size;
|
3068 |
+
if (n < 0) { return i }
|
3069 |
+
}
|
3070 |
+
}
|
3071 |
+
|
3072 |
+
function updateSelection(cm) {
|
3073 |
+
cm.display.input.showSelection(cm.display.input.prepareSelection());
|
3074 |
+
}
|
3075 |
+
|
3076 |
+
function prepareSelection(cm, primary) {
|
3077 |
+
if ( primary === void 0 ) primary = true;
|
3078 |
+
|
3079 |
+
var doc = cm.doc, result = {};
|
3080 |
+
var curFragment = result.cursors = document.createDocumentFragment();
|
3081 |
+
var selFragment = result.selection = document.createDocumentFragment();
|
3082 |
+
|
3083 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
3084 |
+
if (!primary && i == doc.sel.primIndex) { continue }
|
3085 |
+
var range$$1 = doc.sel.ranges[i];
|
3086 |
+
if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) { continue }
|
3087 |
+
var collapsed = range$$1.empty();
|
3088 |
+
if (collapsed || cm.options.showCursorWhenSelecting)
|
3089 |
+
{ drawSelectionCursor(cm, range$$1.head, curFragment); }
|
3090 |
+
if (!collapsed)
|
3091 |
+
{ drawSelectionRange(cm, range$$1, selFragment); }
|
3092 |
+
}
|
3093 |
+
return result
|
3094 |
+
}
|
3095 |
+
|
3096 |
+
// Draws a cursor for the given range
|
3097 |
+
function drawSelectionCursor(cm, head, output) {
|
3098 |
+
var pos = cursorCoords(cm, head, "div", null, null, !cm.options.singleCursorHeightPerLine);
|
3099 |
+
|
3100 |
+
var cursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor"));
|
3101 |
+
cursor.style.left = pos.left + "px";
|
3102 |
+
cursor.style.top = pos.top + "px";
|
3103 |
+
cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + "px";
|
3104 |
+
|
3105 |
+
if (pos.other) {
|
3106 |
+
// Secondary cursor, shown when on a 'jump' in bi-directional text
|
3107 |
+
var otherCursor = output.appendChild(elt("div", "\u00a0", "CodeMirror-cursor CodeMirror-secondarycursor"));
|
3108 |
+
otherCursor.style.display = "";
|
3109 |
+
otherCursor.style.left = pos.other.left + "px";
|
3110 |
+
otherCursor.style.top = pos.other.top + "px";
|
3111 |
+
otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + "px";
|
3112 |
+
}
|
3113 |
+
}
|
3114 |
+
|
3115 |
+
function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }
|
3116 |
+
|
3117 |
+
// Draws the given range as a highlighted selection
|
3118 |
+
function drawSelectionRange(cm, range$$1, output) {
|
3119 |
+
var display = cm.display, doc = cm.doc;
|
3120 |
+
var fragment = document.createDocumentFragment();
|
3121 |
+
var padding = paddingH(cm.display), leftSide = padding.left;
|
3122 |
+
var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;
|
3123 |
+
var docLTR = doc.direction == "ltr";
|
3124 |
+
|
3125 |
+
function add(left, top, width, bottom) {
|
3126 |
+
if (top < 0) { top = 0; }
|
3127 |
+
top = Math.round(top);
|
3128 |
+
bottom = Math.round(bottom);
|
3129 |
+
fragment.appendChild(elt("div", null, "CodeMirror-selected", ("position: absolute; left: " + left + "px;\n top: " + top + "px; width: " + (width == null ? rightSide - left : width) + "px;\n height: " + (bottom - top) + "px")));
|
3130 |
+
}
|
3131 |
+
|
3132 |
+
function drawForLine(line, fromArg, toArg) {
|
3133 |
+
var lineObj = getLine(doc, line);
|
3134 |
+
var lineLen = lineObj.text.length;
|
3135 |
+
var start, end;
|
3136 |
+
function coords(ch, bias) {
|
3137 |
+
return charCoords(cm, Pos(line, ch), "div", lineObj, bias)
|
3138 |
+
}
|
3139 |
+
|
3140 |
+
function wrapX(pos, dir, side) {
|
3141 |
+
var extent = wrappedLineExtentChar(cm, lineObj, null, pos);
|
3142 |
+
var prop = (dir == "ltr") == (side == "after") ? "left" : "right";
|
3143 |
+
var ch = side == "after" ? extent.begin : extent.end - (/\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);
|
3144 |
+
return coords(ch, prop)[prop]
|
3145 |
+
}
|
3146 |
+
|
3147 |
+
var order = getOrder(lineObj, doc.direction);
|
3148 |
+
iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {
|
3149 |
+
var ltr = dir == "ltr";
|
3150 |
+
var fromPos = coords(from, ltr ? "left" : "right");
|
3151 |
+
var toPos = coords(to - 1, ltr ? "right" : "left");
|
3152 |
+
|
3153 |
+
var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;
|
3154 |
+
var first = i == 0, last = !order || i == order.length - 1;
|
3155 |
+
if (toPos.top - fromPos.top <= 3) { // Single line
|
3156 |
+
var openLeft = (docLTR ? openStart : openEnd) && first;
|
3157 |
+
var openRight = (docLTR ? openEnd : openStart) && last;
|
3158 |
+
var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;
|
3159 |
+
var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;
|
3160 |
+
add(left, fromPos.top, right - left, fromPos.bottom);
|
3161 |
+
} else { // Multiple lines
|
3162 |
+
var topLeft, topRight, botLeft, botRight;
|
3163 |
+
if (ltr) {
|
3164 |
+
topLeft = docLTR && openStart && first ? leftSide : fromPos.left;
|
3165 |
+
topRight = docLTR ? rightSide : wrapX(from, dir, "before");
|
3166 |
+
botLeft = docLTR ? leftSide : wrapX(to, dir, "after");
|
3167 |
+
botRight = docLTR && openEnd && last ? rightSide : toPos.right;
|
3168 |
+
} else {
|
3169 |
+
topLeft = !docLTR ? leftSide : wrapX(from, dir, "before");
|
3170 |
+
topRight = !docLTR && openStart && first ? rightSide : fromPos.right;
|
3171 |
+
botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;
|
3172 |
+
botRight = !docLTR ? rightSide : wrapX(to, dir, "after");
|
3173 |
+
}
|
3174 |
+
add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);
|
3175 |
+
if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }
|
3176 |
+
add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);
|
3177 |
+
}
|
3178 |
+
|
3179 |
+
if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }
|
3180 |
+
if (cmpCoords(toPos, start) < 0) { start = toPos; }
|
3181 |
+
if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }
|
3182 |
+
if (cmpCoords(toPos, end) < 0) { end = toPos; }
|
3183 |
+
});
|
3184 |
+
return {start: start, end: end}
|
3185 |
+
}
|
3186 |
+
|
3187 |
+
var sFrom = range$$1.from(), sTo = range$$1.to();
|
3188 |
+
if (sFrom.line == sTo.line) {
|
3189 |
+
drawForLine(sFrom.line, sFrom.ch, sTo.ch);
|
3190 |
+
} else {
|
3191 |
+
var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);
|
3192 |
+
var singleVLine = visualLine(fromLine) == visualLine(toLine);
|
3193 |
+
var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;
|
3194 |
+
var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;
|
3195 |
+
if (singleVLine) {
|
3196 |
+
if (leftEnd.top < rightStart.top - 2) {
|
3197 |
+
add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);
|
3198 |
+
add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);
|
3199 |
+
} else {
|
3200 |
+
add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);
|
3201 |
+
}
|
3202 |
+
}
|
3203 |
+
if (leftEnd.bottom < rightStart.top)
|
3204 |
+
{ add(leftSide, leftEnd.bottom, null, rightStart.top); }
|
3205 |
+
}
|
3206 |
+
|
3207 |
+
output.appendChild(fragment);
|
3208 |
+
}
|
3209 |
+
|
3210 |
+
// Cursor-blinking
|
3211 |
+
function restartBlink(cm) {
|
3212 |
+
if (!cm.state.focused) { return }
|
3213 |
+
var display = cm.display;
|
3214 |
+
clearInterval(display.blinker);
|
3215 |
+
var on = true;
|
3216 |
+
display.cursorDiv.style.visibility = "";
|
3217 |
+
if (cm.options.cursorBlinkRate > 0)
|
3218 |
+
{ display.blinker = setInterval(function () { return display.cursorDiv.style.visibility = (on = !on) ? "" : "hidden"; },
|
3219 |
+
cm.options.cursorBlinkRate); }
|
3220 |
+
else if (cm.options.cursorBlinkRate < 0)
|
3221 |
+
{ display.cursorDiv.style.visibility = "hidden"; }
|
3222 |
+
}
|
3223 |
+
|
3224 |
+
function ensureFocus(cm) {
|
3225 |
+
if (!cm.state.focused) { cm.display.input.focus(); onFocus(cm); }
|
3226 |
+
}
|
3227 |
+
|
3228 |
+
function delayBlurEvent(cm) {
|
3229 |
+
cm.state.delayingBlurEvent = true;
|
3230 |
+
setTimeout(function () { if (cm.state.delayingBlurEvent) {
|
3231 |
+
cm.state.delayingBlurEvent = false;
|
3232 |
+
onBlur(cm);
|
3233 |
+
} }, 100);
|
3234 |
+
}
|
3235 |
+
|
3236 |
+
function onFocus(cm, e) {
|
3237 |
+
if (cm.state.delayingBlurEvent) { cm.state.delayingBlurEvent = false; }
|
3238 |
+
|
3239 |
+
if (cm.options.readOnly == "nocursor") { return }
|
3240 |
+
if (!cm.state.focused) {
|
3241 |
+
signal(cm, "focus", cm, e);
|
3242 |
+
cm.state.focused = true;
|
3243 |
+
addClass(cm.display.wrapper, "CodeMirror-focused");
|
3244 |
+
// This test prevents this from firing when a context
|
3245 |
+
// menu is closed (since the input reset would kill the
|
3246 |
+
// select-all detection hack)
|
3247 |
+
if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {
|
3248 |
+
cm.display.input.reset();
|
3249 |
+
if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730
|
3250 |
+
}
|
3251 |
+
cm.display.input.receivedFocus();
|
3252 |
+
}
|
3253 |
+
restartBlink(cm);
|
3254 |
+
}
|
3255 |
+
function onBlur(cm, e) {
|
3256 |
+
if (cm.state.delayingBlurEvent) { return }
|
3257 |
+
|
3258 |
+
if (cm.state.focused) {
|
3259 |
+
signal(cm, "blur", cm, e);
|
3260 |
+
cm.state.focused = false;
|
3261 |
+
rmClass(cm.display.wrapper, "CodeMirror-focused");
|
3262 |
+
}
|
3263 |
+
clearInterval(cm.display.blinker);
|
3264 |
+
setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);
|
3265 |
+
}
|
3266 |
+
|
3267 |
+
// Read the actual heights of the rendered lines, and update their
|
3268 |
+
// stored heights to match.
|
3269 |
+
function updateHeightsInViewport(cm) {
|
3270 |
+
var display = cm.display;
|
3271 |
+
var prevBottom = display.lineDiv.offsetTop;
|
3272 |
+
for (var i = 0; i < display.view.length; i++) {
|
3273 |
+
var cur = display.view[i], wrapping = cm.options.lineWrapping;
|
3274 |
+
var height = (void 0), width = 0;
|
3275 |
+
if (cur.hidden) { continue }
|
3276 |
+
if (ie && ie_version < 8) {
|
3277 |
+
var bot = cur.node.offsetTop + cur.node.offsetHeight;
|
3278 |
+
height = bot - prevBottom;
|
3279 |
+
prevBottom = bot;
|
3280 |
+
} else {
|
3281 |
+
var box = cur.node.getBoundingClientRect();
|
3282 |
+
height = box.bottom - box.top;
|
3283 |
+
// Check that lines don't extend past the right of the current
|
3284 |
+
// editor width
|
3285 |
+
if (!wrapping && cur.text.firstChild)
|
3286 |
+
{ width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }
|
3287 |
+
}
|
3288 |
+
var diff = cur.line.height - height;
|
3289 |
+
if (diff > .005 || diff < -.005) {
|
3290 |
+
updateLineHeight(cur.line, height);
|
3291 |
+
updateWidgetHeight(cur.line);
|
3292 |
+
if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)
|
3293 |
+
{ updateWidgetHeight(cur.rest[j]); } }
|
3294 |
+
}
|
3295 |
+
if (width > cm.display.sizerWidth) {
|
3296 |
+
var chWidth = Math.ceil(width / charWidth(cm.display));
|
3297 |
+
if (chWidth > cm.display.maxLineLength) {
|
3298 |
+
cm.display.maxLineLength = chWidth;
|
3299 |
+
cm.display.maxLine = cur.line;
|
3300 |
+
cm.display.maxLineChanged = true;
|
3301 |
+
}
|
3302 |
+
}
|
3303 |
+
}
|
3304 |
+
}
|
3305 |
+
|
3306 |
+
// Read and store the height of line widgets associated with the
|
3307 |
+
// given line.
|
3308 |
+
function updateWidgetHeight(line) {
|
3309 |
+
if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {
|
3310 |
+
var w = line.widgets[i], parent = w.node.parentNode;
|
3311 |
+
if (parent) { w.height = parent.offsetHeight; }
|
3312 |
+
} }
|
3313 |
+
}
|
3314 |
+
|
3315 |
+
// Compute the lines that are visible in a given viewport (defaults
|
3316 |
+
// the the current scroll position). viewport may contain top,
|
3317 |
+
// height, and ensure (see op.scrollToPos) properties.
|
3318 |
+
function visibleLines(display, doc, viewport) {
|
3319 |
+
var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;
|
3320 |
+
top = Math.floor(top - paddingTop(display));
|
3321 |
+
var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;
|
3322 |
+
|
3323 |
+
var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);
|
3324 |
+
// Ensure is a {from: {line, ch}, to: {line, ch}} object, and
|
3325 |
+
// forces those lines into the viewport (if possible).
|
3326 |
+
if (viewport && viewport.ensure) {
|
3327 |
+
var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;
|
3328 |
+
if (ensureFrom < from) {
|
3329 |
+
from = ensureFrom;
|
3330 |
+
to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);
|
3331 |
+
} else if (Math.min(ensureTo, doc.lastLine()) >= to) {
|
3332 |
+
from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);
|
3333 |
+
to = ensureTo;
|
3334 |
+
}
|
3335 |
+
}
|
3336 |
+
return {from: from, to: Math.max(to, from + 1)}
|
3337 |
+
}
|
3338 |
+
|
3339 |
+
// Re-align line numbers and gutter marks to compensate for
|
3340 |
+
// horizontal scrolling.
|
3341 |
+
function alignHorizontally(cm) {
|
3342 |
+
var display = cm.display, view = display.view;
|
3343 |
+
if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }
|
3344 |
+
var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;
|
3345 |
+
var gutterW = display.gutters.offsetWidth, left = comp + "px";
|
3346 |
+
for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {
|
3347 |
+
if (cm.options.fixedGutter) {
|
3348 |
+
if (view[i].gutter)
|
3349 |
+
{ view[i].gutter.style.left = left; }
|
3350 |
+
if (view[i].gutterBackground)
|
3351 |
+
{ view[i].gutterBackground.style.left = left; }
|
3352 |
+
}
|
3353 |
+
var align = view[i].alignable;
|
3354 |
+
if (align) { for (var j = 0; j < align.length; j++)
|
3355 |
+
{ align[j].style.left = left; } }
|
3356 |
+
} }
|
3357 |
+
if (cm.options.fixedGutter)
|
3358 |
+
{ display.gutters.style.left = (comp + gutterW) + "px"; }
|
3359 |
+
}
|
3360 |
+
|
3361 |
+
// Used to ensure that the line number gutter is still the right
|
3362 |
+
// size for the current document size. Returns true when an update
|
3363 |
+
// is needed.
|
3364 |
+
function maybeUpdateLineNumberWidth(cm) {
|
3365 |
+
if (!cm.options.lineNumbers) { return false }
|
3366 |
+
var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;
|
3367 |
+
if (last.length != display.lineNumChars) {
|
3368 |
+
var test = display.measure.appendChild(elt("div", [elt("div", last)],
|
3369 |
+
"CodeMirror-linenumber CodeMirror-gutter-elt"));
|
3370 |
+
var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;
|
3371 |
+
display.lineGutter.style.width = "";
|
3372 |
+
display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;
|
3373 |
+
display.lineNumWidth = display.lineNumInnerWidth + padding;
|
3374 |
+
display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;
|
3375 |
+
display.lineGutter.style.width = display.lineNumWidth + "px";
|
3376 |
+
updateGutterSpace(cm);
|
3377 |
+
return true
|
3378 |
+
}
|
3379 |
+
return false
|
3380 |
+
}
|
3381 |
+
|
3382 |
+
// SCROLLING THINGS INTO VIEW
|
3383 |
+
|
3384 |
+
// If an editor sits on the top or bottom of the window, partially
|
3385 |
+
// scrolled out of view, this ensures that the cursor is visible.
|
3386 |
+
function maybeScrollWindow(cm, rect) {
|
3387 |
+
if (signalDOMEvent(cm, "scrollCursorIntoView")) { return }
|
3388 |
+
|
3389 |
+
var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;
|
3390 |
+
if (rect.top + box.top < 0) { doScroll = true; }
|
3391 |
+
else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) { doScroll = false; }
|
3392 |
+
if (doScroll != null && !phantom) {
|
3393 |
+
var scrollNode = elt("div", "\u200b", null, ("position: absolute;\n top: " + (rect.top - display.viewOffset - paddingTop(cm.display)) + "px;\n height: " + (rect.bottom - rect.top + scrollGap(cm) + display.barHeight) + "px;\n left: " + (rect.left) + "px; width: " + (Math.max(2, rect.right - rect.left)) + "px;"));
|
3394 |
+
cm.display.lineSpace.appendChild(scrollNode);
|
3395 |
+
scrollNode.scrollIntoView(doScroll);
|
3396 |
+
cm.display.lineSpace.removeChild(scrollNode);
|
3397 |
+
}
|
3398 |
+
}
|
3399 |
+
|
3400 |
+
// Scroll a given position into view (immediately), verifying that
|
3401 |
+
// it actually became visible (as line heights are accurately
|
3402 |
+
// measured, the position of something may 'drift' during drawing).
|
3403 |
+
function scrollPosIntoView(cm, pos, end, margin) {
|
3404 |
+
if (margin == null) { margin = 0; }
|
3405 |
+
var rect;
|
3406 |
+
if (!cm.options.lineWrapping && pos == end) {
|
3407 |
+
// Set pos and end to the cursor positions around the character pos sticks to
|
3408 |
+
// If pos.sticky == "before", that is around pos.ch - 1, otherwise around pos.ch
|
3409 |
+
// If pos == Pos(_, 0, "before"), pos and end are unchanged
|
3410 |
+
pos = pos.ch ? Pos(pos.line, pos.sticky == "before" ? pos.ch - 1 : pos.ch, "after") : pos;
|
3411 |
+
end = pos.sticky == "before" ? Pos(pos.line, pos.ch + 1, "before") : pos;
|
3412 |
+
}
|
3413 |
+
for (var limit = 0; limit < 5; limit++) {
|
3414 |
+
var changed = false;
|
3415 |
+
var coords = cursorCoords(cm, pos);
|
3416 |
+
var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);
|
3417 |
+
rect = {left: Math.min(coords.left, endCoords.left),
|
3418 |
+
top: Math.min(coords.top, endCoords.top) - margin,
|
3419 |
+
right: Math.max(coords.left, endCoords.left),
|
3420 |
+
bottom: Math.max(coords.bottom, endCoords.bottom) + margin};
|
3421 |
+
var scrollPos = calculateScrollPos(cm, rect);
|
3422 |
+
var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;
|
3423 |
+
if (scrollPos.scrollTop != null) {
|
3424 |
+
updateScrollTop(cm, scrollPos.scrollTop);
|
3425 |
+
if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }
|
3426 |
+
}
|
3427 |
+
if (scrollPos.scrollLeft != null) {
|
3428 |
+
setScrollLeft(cm, scrollPos.scrollLeft);
|
3429 |
+
if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }
|
3430 |
+
}
|
3431 |
+
if (!changed) { break }
|
3432 |
+
}
|
3433 |
+
return rect
|
3434 |
+
}
|
3435 |
+
|
3436 |
+
// Scroll a given set of coordinates into view (immediately).
|
3437 |
+
function scrollIntoView(cm, rect) {
|
3438 |
+
var scrollPos = calculateScrollPos(cm, rect);
|
3439 |
+
if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }
|
3440 |
+
if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }
|
3441 |
+
}
|
3442 |
+
|
3443 |
+
// Calculate a new scroll position needed to scroll the given
|
3444 |
+
// rectangle into view. Returns an object with scrollTop and
|
3445 |
+
// scrollLeft properties. When these are undefined, the
|
3446 |
+
// vertical/horizontal position does not need to be adjusted.
|
3447 |
+
function calculateScrollPos(cm, rect) {
|
3448 |
+
var display = cm.display, snapMargin = textHeight(cm.display);
|
3449 |
+
if (rect.top < 0) { rect.top = 0; }
|
3450 |
+
var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;
|
3451 |
+
var screen = displayHeight(cm), result = {};
|
3452 |
+
if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }
|
3453 |
+
var docBottom = cm.doc.height + paddingVert(display);
|
3454 |
+
var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;
|
3455 |
+
if (rect.top < screentop) {
|
3456 |
+
result.scrollTop = atTop ? 0 : rect.top;
|
3457 |
+
} else if (rect.bottom > screentop + screen) {
|
3458 |
+
var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);
|
3459 |
+
if (newTop != screentop) { result.scrollTop = newTop; }
|
3460 |
+
}
|
3461 |
+
|
3462 |
+
var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;
|
3463 |
+
var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);
|
3464 |
+
var tooWide = rect.right - rect.left > screenw;
|
3465 |
+
if (tooWide) { rect.right = rect.left + screenw; }
|
3466 |
+
if (rect.left < 10)
|
3467 |
+
{ result.scrollLeft = 0; }
|
3468 |
+
else if (rect.left < screenleft)
|
3469 |
+
{ result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10)); }
|
3470 |
+
else if (rect.right > screenw + screenleft - 3)
|
3471 |
+
{ result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }
|
3472 |
+
return result
|
3473 |
+
}
|
3474 |
+
|
3475 |
+
// Store a relative adjustment to the scroll position in the current
|
3476 |
+
// operation (to be applied when the operation finishes).
|
3477 |
+
function addToScrollTop(cm, top) {
|
3478 |
+
if (top == null) { return }
|
3479 |
+
resolveScrollToPos(cm);
|
3480 |
+
cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;
|
3481 |
+
}
|
3482 |
+
|
3483 |
+
// Make sure that at the end of the operation the current cursor is
|
3484 |
+
// shown.
|
3485 |
+
function ensureCursorVisible(cm) {
|
3486 |
+
resolveScrollToPos(cm);
|
3487 |
+
var cur = cm.getCursor();
|
3488 |
+
cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};
|
3489 |
+
}
|
3490 |
+
|
3491 |
+
function scrollToCoords(cm, x, y) {
|
3492 |
+
if (x != null || y != null) { resolveScrollToPos(cm); }
|
3493 |
+
if (x != null) { cm.curOp.scrollLeft = x; }
|
3494 |
+
if (y != null) { cm.curOp.scrollTop = y; }
|
3495 |
+
}
|
3496 |
+
|
3497 |
+
function scrollToRange(cm, range$$1) {
|
3498 |
+
resolveScrollToPos(cm);
|
3499 |
+
cm.curOp.scrollToPos = range$$1;
|
3500 |
+
}
|
3501 |
+
|
3502 |
+
// When an operation has its scrollToPos property set, and another
|
3503 |
+
// scroll action is applied before the end of the operation, this
|
3504 |
+
// 'simulates' scrolling that position into view in a cheap way, so
|
3505 |
+
// that the effect of intermediate scroll commands is not ignored.
|
3506 |
+
function resolveScrollToPos(cm) {
|
3507 |
+
var range$$1 = cm.curOp.scrollToPos;
|
3508 |
+
if (range$$1) {
|
3509 |
+
cm.curOp.scrollToPos = null;
|
3510 |
+
var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);
|
3511 |
+
scrollToCoordsRange(cm, from, to, range$$1.margin);
|
3512 |
+
}
|
3513 |
+
}
|
3514 |
+
|
3515 |
+
function scrollToCoordsRange(cm, from, to, margin) {
|
3516 |
+
var sPos = calculateScrollPos(cm, {
|
3517 |
+
left: Math.min(from.left, to.left),
|
3518 |
+
top: Math.min(from.top, to.top) - margin,
|
3519 |
+
right: Math.max(from.right, to.right),
|
3520 |
+
bottom: Math.max(from.bottom, to.bottom) + margin
|
3521 |
+
});
|
3522 |
+
scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);
|
3523 |
+
}
|
3524 |
+
|
3525 |
+
// Sync the scrollable area and scrollbars, ensure the viewport
|
3526 |
+
// covers the visible area.
|
3527 |
+
function updateScrollTop(cm, val) {
|
3528 |
+
if (Math.abs(cm.doc.scrollTop - val) < 2) { return }
|
3529 |
+
if (!gecko) { updateDisplaySimple(cm, {top: val}); }
|
3530 |
+
setScrollTop(cm, val, true);
|
3531 |
+
if (gecko) { updateDisplaySimple(cm); }
|
3532 |
+
startWorker(cm, 100);
|
3533 |
+
}
|
3534 |
+
|
3535 |
+
function setScrollTop(cm, val, forceScroll) {
|
3536 |
+
val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val);
|
3537 |
+
if (cm.display.scroller.scrollTop == val && !forceScroll) { return }
|
3538 |
+
cm.doc.scrollTop = val;
|
3539 |
+
cm.display.scrollbars.setScrollTop(val);
|
3540 |
+
if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }
|
3541 |
+
}
|
3542 |
+
|
3543 |
+
// Sync scroller and scrollbar, ensure the gutter elements are
|
3544 |
+
// aligned.
|
3545 |
+
function setScrollLeft(cm, val, isScroller, forceScroll) {
|
3546 |
+
val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);
|
3547 |
+
if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }
|
3548 |
+
cm.doc.scrollLeft = val;
|
3549 |
+
alignHorizontally(cm);
|
3550 |
+
if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }
|
3551 |
+
cm.display.scrollbars.setScrollLeft(val);
|
3552 |
+
}
|
3553 |
+
|
3554 |
+
// SCROLLBARS
|
3555 |
+
|
3556 |
+
// Prepare DOM reads needed to update the scrollbars. Done in one
|
3557 |
+
// shot to minimize update/measure roundtrips.
|
3558 |
+
function measureForScrollbars(cm) {
|
3559 |
+
var d = cm.display, gutterW = d.gutters.offsetWidth;
|
3560 |
+
var docH = Math.round(cm.doc.height + paddingVert(cm.display));
|
3561 |
+
return {
|
3562 |
+
clientHeight: d.scroller.clientHeight,
|
3563 |
+
viewHeight: d.wrapper.clientHeight,
|
3564 |
+
scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,
|
3565 |
+
viewWidth: d.wrapper.clientWidth,
|
3566 |
+
barLeft: cm.options.fixedGutter ? gutterW : 0,
|
3567 |
+
docHeight: docH,
|
3568 |
+
scrollHeight: docH + scrollGap(cm) + d.barHeight,
|
3569 |
+
nativeBarWidth: d.nativeBarWidth,
|
3570 |
+
gutterWidth: gutterW
|
3571 |
+
}
|
3572 |
+
}
|
3573 |
+
|
3574 |
+
var NativeScrollbars = function(place, scroll, cm) {
|
3575 |
+
this.cm = cm;
|
3576 |
+
var vert = this.vert = elt("div", [elt("div", null, null, "min-width: 1px")], "CodeMirror-vscrollbar");
|
3577 |
+
var horiz = this.horiz = elt("div", [elt("div", null, null, "height: 100%; min-height: 1px")], "CodeMirror-hscrollbar");
|
3578 |
+
vert.tabIndex = horiz.tabIndex = -1;
|
3579 |
+
place(vert); place(horiz);
|
3580 |
+
|
3581 |
+
on(vert, "scroll", function () {
|
3582 |
+
if (vert.clientHeight) { scroll(vert.scrollTop, "vertical"); }
|
3583 |
+
});
|
3584 |
+
on(horiz, "scroll", function () {
|
3585 |
+
if (horiz.clientWidth) { scroll(horiz.scrollLeft, "horizontal"); }
|
3586 |
+
});
|
3587 |
+
|
3588 |
+
this.checkedZeroWidth = false;
|
3589 |
+
// Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).
|
3590 |
+
if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = "18px"; }
|
3591 |
+
};
|
3592 |
+
|
3593 |
+
NativeScrollbars.prototype.update = function (measure) {
|
3594 |
+
var needsH = measure.scrollWidth > measure.clientWidth + 1;
|
3595 |
+
var needsV = measure.scrollHeight > measure.clientHeight + 1;
|
3596 |
+
var sWidth = measure.nativeBarWidth;
|
3597 |
+
|
3598 |
+
if (needsV) {
|
3599 |
+
this.vert.style.display = "block";
|
3600 |
+
this.vert.style.bottom = needsH ? sWidth + "px" : "0";
|
3601 |
+
var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);
|
3602 |
+
// A bug in IE8 can cause this value to be negative, so guard it.
|
3603 |
+
this.vert.firstChild.style.height =
|
3604 |
+
Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + "px";
|
3605 |
+
} else {
|
3606 |
+
this.vert.style.display = "";
|
3607 |
+
this.vert.firstChild.style.height = "0";
|
3608 |
+
}
|
3609 |
+
|
3610 |
+
if (needsH) {
|
3611 |
+
this.horiz.style.display = "block";
|
3612 |
+
this.horiz.style.right = needsV ? sWidth + "px" : "0";
|
3613 |
+
this.horiz.style.left = measure.barLeft + "px";
|
3614 |
+
var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);
|
3615 |
+
this.horiz.firstChild.style.width =
|
3616 |
+
Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + "px";
|
3617 |
+
} else {
|
3618 |
+
this.horiz.style.display = "";
|
3619 |
+
this.horiz.firstChild.style.width = "0";
|
3620 |
+
}
|
3621 |
+
|
3622 |
+
if (!this.checkedZeroWidth && measure.clientHeight > 0) {
|
3623 |
+
if (sWidth == 0) { this.zeroWidthHack(); }
|
3624 |
+
this.checkedZeroWidth = true;
|
3625 |
+
}
|
3626 |
+
|
3627 |
+
return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}
|
3628 |
+
};
|
3629 |
+
|
3630 |
+
NativeScrollbars.prototype.setScrollLeft = function (pos) {
|
3631 |
+
if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }
|
3632 |
+
if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, "horiz"); }
|
3633 |
+
};
|
3634 |
+
|
3635 |
+
NativeScrollbars.prototype.setScrollTop = function (pos) {
|
3636 |
+
if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }
|
3637 |
+
if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, "vert"); }
|
3638 |
+
};
|
3639 |
+
|
3640 |
+
NativeScrollbars.prototype.zeroWidthHack = function () {
|
3641 |
+
var w = mac && !mac_geMountainLion ? "12px" : "18px";
|
3642 |
+
this.horiz.style.height = this.vert.style.width = w;
|
3643 |
+
this.horiz.style.pointerEvents = this.vert.style.pointerEvents = "none";
|
3644 |
+
this.disableHoriz = new Delayed;
|
3645 |
+
this.disableVert = new Delayed;
|
3646 |
+
};
|
3647 |
+
|
3648 |
+
NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {
|
3649 |
+
bar.style.pointerEvents = "auto";
|
3650 |
+
function maybeDisable() {
|
3651 |
+
// To find out whether the scrollbar is still visible, we
|
3652 |
+
// check whether the element under the pixel in the bottom
|
3653 |
+
// right corner of the scrollbar box is the scrollbar box
|
3654 |
+
// itself (when the bar is still visible) or its filler child
|
3655 |
+
// (when the bar is hidden). If it is still visible, we keep
|
3656 |
+
// it enabled, if it's hidden, we disable pointer events.
|
3657 |
+
var box = bar.getBoundingClientRect();
|
3658 |
+
var elt$$1 = type == "vert" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)
|
3659 |
+
: document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);
|
3660 |
+
if (elt$$1 != bar) { bar.style.pointerEvents = "none"; }
|
3661 |
+
else { delay.set(1000, maybeDisable); }
|
3662 |
+
}
|
3663 |
+
delay.set(1000, maybeDisable);
|
3664 |
+
};
|
3665 |
+
|
3666 |
+
NativeScrollbars.prototype.clear = function () {
|
3667 |
+
var parent = this.horiz.parentNode;
|
3668 |
+
parent.removeChild(this.horiz);
|
3669 |
+
parent.removeChild(this.vert);
|
3670 |
+
};
|
3671 |
+
|
3672 |
+
var NullScrollbars = function () {};
|
3673 |
+
|
3674 |
+
NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };
|
3675 |
+
NullScrollbars.prototype.setScrollLeft = function () {};
|
3676 |
+
NullScrollbars.prototype.setScrollTop = function () {};
|
3677 |
+
NullScrollbars.prototype.clear = function () {};
|
3678 |
+
|
3679 |
+
function updateScrollbars(cm, measure) {
|
3680 |
+
if (!measure) { measure = measureForScrollbars(cm); }
|
3681 |
+
var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;
|
3682 |
+
updateScrollbarsInner(cm, measure);
|
3683 |
+
for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {
|
3684 |
+
if (startWidth != cm.display.barWidth && cm.options.lineWrapping)
|
3685 |
+
{ updateHeightsInViewport(cm); }
|
3686 |
+
updateScrollbarsInner(cm, measureForScrollbars(cm));
|
3687 |
+
startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;
|
3688 |
+
}
|
3689 |
+
}
|
3690 |
+
|
3691 |
+
// Re-synchronize the fake scrollbars with the actual size of the
|
3692 |
+
// content.
|
3693 |
+
function updateScrollbarsInner(cm, measure) {
|
3694 |
+
var d = cm.display;
|
3695 |
+
var sizes = d.scrollbars.update(measure);
|
3696 |
+
|
3697 |
+
d.sizer.style.paddingRight = (d.barWidth = sizes.right) + "px";
|
3698 |
+
d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + "px";
|
3699 |
+
d.heightForcer.style.borderBottom = sizes.bottom + "px solid transparent";
|
3700 |
+
|
3701 |
+
if (sizes.right && sizes.bottom) {
|
3702 |
+
d.scrollbarFiller.style.display = "block";
|
3703 |
+
d.scrollbarFiller.style.height = sizes.bottom + "px";
|
3704 |
+
d.scrollbarFiller.style.width = sizes.right + "px";
|
3705 |
+
} else { d.scrollbarFiller.style.display = ""; }
|
3706 |
+
if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {
|
3707 |
+
d.gutterFiller.style.display = "block";
|
3708 |
+
d.gutterFiller.style.height = sizes.bottom + "px";
|
3709 |
+
d.gutterFiller.style.width = measure.gutterWidth + "px";
|
3710 |
+
} else { d.gutterFiller.style.display = ""; }
|
3711 |
+
}
|
3712 |
+
|
3713 |
+
var scrollbarModel = {"native": NativeScrollbars, "null": NullScrollbars};
|
3714 |
+
|
3715 |
+
function initScrollbars(cm) {
|
3716 |
+
if (cm.display.scrollbars) {
|
3717 |
+
cm.display.scrollbars.clear();
|
3718 |
+
if (cm.display.scrollbars.addClass)
|
3719 |
+
{ rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
|
3720 |
+
}
|
3721 |
+
|
3722 |
+
cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {
|
3723 |
+
cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);
|
3724 |
+
// Prevent clicks in the scrollbars from killing focus
|
3725 |
+
on(node, "mousedown", function () {
|
3726 |
+
if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }
|
3727 |
+
});
|
3728 |
+
node.setAttribute("cm-not-content", "true");
|
3729 |
+
}, function (pos, axis) {
|
3730 |
+
if (axis == "horizontal") { setScrollLeft(cm, pos); }
|
3731 |
+
else { updateScrollTop(cm, pos); }
|
3732 |
+
}, cm);
|
3733 |
+
if (cm.display.scrollbars.addClass)
|
3734 |
+
{ addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }
|
3735 |
+
}
|
3736 |
+
|
3737 |
+
// Operations are used to wrap a series of changes to the editor
|
3738 |
+
// state in such a way that each change won't have to update the
|
3739 |
+
// cursor and display (which would be awkward, slow, and
|
3740 |
+
// error-prone). Instead, display updates are batched and then all
|
3741 |
+
// combined and executed at once.
|
3742 |
+
|
3743 |
+
var nextOpId = 0;
|
3744 |
+
// Start a new operation.
|
3745 |
+
function startOperation(cm) {
|
3746 |
+
cm.curOp = {
|
3747 |
+
cm: cm,
|
3748 |
+
viewChanged: false, // Flag that indicates that lines might need to be redrawn
|
3749 |
+
startHeight: cm.doc.height, // Used to detect need to update scrollbar
|
3750 |
+
forceUpdate: false, // Used to force a redraw
|
3751 |
+
updateInput: 0, // Whether to reset the input textarea
|
3752 |
+
typing: false, // Whether this reset should be careful to leave existing text (for compositing)
|
3753 |
+
changeObjs: null, // Accumulated changes, for firing change events
|
3754 |
+
cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on
|
3755 |
+
cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already
|
3756 |
+
selectionChanged: false, // Whether the selection needs to be redrawn
|
3757 |
+
updateMaxLine: false, // Set when the widest line needs to be determined anew
|
3758 |
+
scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet
|
3759 |
+
scrollToPos: null, // Used to scroll to a specific position
|
3760 |
+
focus: false,
|
3761 |
+
id: ++nextOpId // Unique ID
|
3762 |
+
};
|
3763 |
+
pushOperation(cm.curOp);
|
3764 |
+
}
|
3765 |
+
|
3766 |
+
// Finish an operation, updating the display and signalling delayed events
|
3767 |
+
function endOperation(cm) {
|
3768 |
+
var op = cm.curOp;
|
3769 |
+
if (op) { finishOperation(op, function (group) {
|
3770 |
+
for (var i = 0; i < group.ops.length; i++)
|
3771 |
+
{ group.ops[i].cm.curOp = null; }
|
3772 |
+
endOperations(group);
|
3773 |
+
}); }
|
3774 |
+
}
|
3775 |
+
|
3776 |
+
// The DOM updates done when an operation finishes are batched so
|
3777 |
+
// that the minimum number of relayouts are required.
|
3778 |
+
function endOperations(group) {
|
3779 |
+
var ops = group.ops;
|
3780 |
+
for (var i = 0; i < ops.length; i++) // Read DOM
|
3781 |
+
{ endOperation_R1(ops[i]); }
|
3782 |
+
for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)
|
3783 |
+
{ endOperation_W1(ops[i$1]); }
|
3784 |
+
for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM
|
3785 |
+
{ endOperation_R2(ops[i$2]); }
|
3786 |
+
for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)
|
3787 |
+
{ endOperation_W2(ops[i$3]); }
|
3788 |
+
for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM
|
3789 |
+
{ endOperation_finish(ops[i$4]); }
|
3790 |
+
}
|
3791 |
+
|
3792 |
+
function endOperation_R1(op) {
|
3793 |
+
var cm = op.cm, display = cm.display;
|
3794 |
+
maybeClipScrollbars(cm);
|
3795 |
+
if (op.updateMaxLine) { findMaxLine(cm); }
|
3796 |
+
|
3797 |
+
op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||
|
3798 |
+
op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||
|
3799 |
+
op.scrollToPos.to.line >= display.viewTo) ||
|
3800 |
+
display.maxLineChanged && cm.options.lineWrapping;
|
3801 |
+
op.update = op.mustUpdate &&
|
3802 |
+
new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);
|
3803 |
+
}
|
3804 |
+
|
3805 |
+
function endOperation_W1(op) {
|
3806 |
+
op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);
|
3807 |
+
}
|
3808 |
+
|
3809 |
+
function endOperation_R2(op) {
|
3810 |
+
var cm = op.cm, display = cm.display;
|
3811 |
+
if (op.updatedDisplay) { updateHeightsInViewport(cm); }
|
3812 |
+
|
3813 |
+
op.barMeasure = measureForScrollbars(cm);
|
3814 |
+
|
3815 |
+
// If the max line changed since it was last measured, measure it,
|
3816 |
+
// and ensure the document's width matches it.
|
3817 |
+
// updateDisplay_W2 will use these properties to do the actual resizing
|
3818 |
+
if (display.maxLineChanged && !cm.options.lineWrapping) {
|
3819 |
+
op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;
|
3820 |
+
cm.display.sizerWidth = op.adjustWidthTo;
|
3821 |
+
op.barMeasure.scrollWidth =
|
3822 |
+
Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);
|
3823 |
+
op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));
|
3824 |
+
}
|
3825 |
+
|
3826 |
+
if (op.updatedDisplay || op.selectionChanged)
|
3827 |
+
{ op.preparedSelection = display.input.prepareSelection(); }
|
3828 |
+
}
|
3829 |
+
|
3830 |
+
function endOperation_W2(op) {
|
3831 |
+
var cm = op.cm;
|
3832 |
+
|
3833 |
+
if (op.adjustWidthTo != null) {
|
3834 |
+
cm.display.sizer.style.minWidth = op.adjustWidthTo + "px";
|
3835 |
+
if (op.maxScrollLeft < cm.doc.scrollLeft)
|
3836 |
+
{ setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }
|
3837 |
+
cm.display.maxLineChanged = false;
|
3838 |
+
}
|
3839 |
+
|
3840 |
+
var takeFocus = op.focus && op.focus == activeElt();
|
3841 |
+
if (op.preparedSelection)
|
3842 |
+
{ cm.display.input.showSelection(op.preparedSelection, takeFocus); }
|
3843 |
+
if (op.updatedDisplay || op.startHeight != cm.doc.height)
|
3844 |
+
{ updateScrollbars(cm, op.barMeasure); }
|
3845 |
+
if (op.updatedDisplay)
|
3846 |
+
{ setDocumentHeight(cm, op.barMeasure); }
|
3847 |
+
|
3848 |
+
if (op.selectionChanged) { restartBlink(cm); }
|
3849 |
+
|
3850 |
+
if (cm.state.focused && op.updateInput)
|
3851 |
+
{ cm.display.input.reset(op.typing); }
|
3852 |
+
if (takeFocus) { ensureFocus(op.cm); }
|
3853 |
+
}
|
3854 |
+
|
3855 |
+
function endOperation_finish(op) {
|
3856 |
+
var cm = op.cm, display = cm.display, doc = cm.doc;
|
3857 |
+
|
3858 |
+
if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }
|
3859 |
+
|
3860 |
+
// Abort mouse wheel delta measurement, when scrolling explicitly
|
3861 |
+
if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))
|
3862 |
+
{ display.wheelStartX = display.wheelStartY = null; }
|
3863 |
+
|
3864 |
+
// Propagate the scroll position to the actual DOM scroller
|
3865 |
+
if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }
|
3866 |
+
|
3867 |
+
if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }
|
3868 |
+
// If we need to scroll a specific position into view, do so.
|
3869 |
+
if (op.scrollToPos) {
|
3870 |
+
var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),
|
3871 |
+
clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);
|
3872 |
+
maybeScrollWindow(cm, rect);
|
3873 |
+
}
|
3874 |
+
|
3875 |
+
// Fire events for markers that are hidden/unidden by editing or
|
3876 |
+
// undoing
|
3877 |
+
var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;
|
3878 |
+
if (hidden) { for (var i = 0; i < hidden.length; ++i)
|
3879 |
+
{ if (!hidden[i].lines.length) { signal(hidden[i], "hide"); } } }
|
3880 |
+
if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)
|
3881 |
+
{ if (unhidden[i$1].lines.length) { signal(unhidden[i$1], "unhide"); } } }
|
3882 |
+
|
3883 |
+
if (display.wrapper.offsetHeight)
|
3884 |
+
{ doc.scrollTop = cm.display.scroller.scrollTop; }
|
3885 |
+
|
3886 |
+
// Fire change events, and delayed event handlers
|
3887 |
+
if (op.changeObjs)
|
3888 |
+
{ signal(cm, "changes", cm, op.changeObjs); }
|
3889 |
+
if (op.update)
|
3890 |
+
{ op.update.finish(); }
|
3891 |
+
}
|
3892 |
+
|
3893 |
+
// Run the given function in an operation
|
3894 |
+
function runInOp(cm, f) {
|
3895 |
+
if (cm.curOp) { return f() }
|
3896 |
+
startOperation(cm);
|
3897 |
+
try { return f() }
|
3898 |
+
finally { endOperation(cm); }
|
3899 |
+
}
|
3900 |
+
// Wraps a function in an operation. Returns the wrapped function.
|
3901 |
+
function operation(cm, f) {
|
3902 |
+
return function() {
|
3903 |
+
if (cm.curOp) { return f.apply(cm, arguments) }
|
3904 |
+
startOperation(cm);
|
3905 |
+
try { return f.apply(cm, arguments) }
|
3906 |
+
finally { endOperation(cm); }
|
3907 |
+
}
|
3908 |
+
}
|
3909 |
+
// Used to add methods to editor and doc instances, wrapping them in
|
3910 |
+
// operations.
|
3911 |
+
function methodOp(f) {
|
3912 |
+
return function() {
|
3913 |
+
if (this.curOp) { return f.apply(this, arguments) }
|
3914 |
+
startOperation(this);
|
3915 |
+
try { return f.apply(this, arguments) }
|
3916 |
+
finally { endOperation(this); }
|
3917 |
+
}
|
3918 |
+
}
|
3919 |
+
function docMethodOp(f) {
|
3920 |
+
return function() {
|
3921 |
+
var cm = this.cm;
|
3922 |
+
if (!cm || cm.curOp) { return f.apply(this, arguments) }
|
3923 |
+
startOperation(cm);
|
3924 |
+
try { return f.apply(this, arguments) }
|
3925 |
+
finally { endOperation(cm); }
|
3926 |
+
}
|
3927 |
+
}
|
3928 |
+
|
3929 |
+
// Updates the display.view data structure for a given change to the
|
3930 |
+
// document. From and to are in pre-change coordinates. Lendiff is
|
3931 |
+
// the amount of lines added or subtracted by the change. This is
|
3932 |
+
// used for changes that span multiple lines, or change the way
|
3933 |
+
// lines are divided into visual lines. regLineChange (below)
|
3934 |
+
// registers single-line changes.
|
3935 |
+
function regChange(cm, from, to, lendiff) {
|
3936 |
+
if (from == null) { from = cm.doc.first; }
|
3937 |
+
if (to == null) { to = cm.doc.first + cm.doc.size; }
|
3938 |
+
if (!lendiff) { lendiff = 0; }
|
3939 |
+
|
3940 |
+
var display = cm.display;
|
3941 |
+
if (lendiff && to < display.viewTo &&
|
3942 |
+
(display.updateLineNumbers == null || display.updateLineNumbers > from))
|
3943 |
+
{ display.updateLineNumbers = from; }
|
3944 |
+
|
3945 |
+
cm.curOp.viewChanged = true;
|
3946 |
+
|
3947 |
+
if (from >= display.viewTo) { // Change after
|
3948 |
+
if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)
|
3949 |
+
{ resetView(cm); }
|
3950 |
+
} else if (to <= display.viewFrom) { // Change before
|
3951 |
+
if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {
|
3952 |
+
resetView(cm);
|
3953 |
+
} else {
|
3954 |
+
display.viewFrom += lendiff;
|
3955 |
+
display.viewTo += lendiff;
|
3956 |
+
}
|
3957 |
+
} else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap
|
3958 |
+
resetView(cm);
|
3959 |
+
} else if (from <= display.viewFrom) { // Top overlap
|
3960 |
+
var cut = viewCuttingPoint(cm, to, to + lendiff, 1);
|
3961 |
+
if (cut) {
|
3962 |
+
display.view = display.view.slice(cut.index);
|
3963 |
+
display.viewFrom = cut.lineN;
|
3964 |
+
display.viewTo += lendiff;
|
3965 |
+
} else {
|
3966 |
+
resetView(cm);
|
3967 |
+
}
|
3968 |
+
} else if (to >= display.viewTo) { // Bottom overlap
|
3969 |
+
var cut$1 = viewCuttingPoint(cm, from, from, -1);
|
3970 |
+
if (cut$1) {
|
3971 |
+
display.view = display.view.slice(0, cut$1.index);
|
3972 |
+
display.viewTo = cut$1.lineN;
|
3973 |
+
} else {
|
3974 |
+
resetView(cm);
|
3975 |
+
}
|
3976 |
+
} else { // Gap in the middle
|
3977 |
+
var cutTop = viewCuttingPoint(cm, from, from, -1);
|
3978 |
+
var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);
|
3979 |
+
if (cutTop && cutBot) {
|
3980 |
+
display.view = display.view.slice(0, cutTop.index)
|
3981 |
+
.concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))
|
3982 |
+
.concat(display.view.slice(cutBot.index));
|
3983 |
+
display.viewTo += lendiff;
|
3984 |
+
} else {
|
3985 |
+
resetView(cm);
|
3986 |
+
}
|
3987 |
+
}
|
3988 |
+
|
3989 |
+
var ext = display.externalMeasured;
|
3990 |
+
if (ext) {
|
3991 |
+
if (to < ext.lineN)
|
3992 |
+
{ ext.lineN += lendiff; }
|
3993 |
+
else if (from < ext.lineN + ext.size)
|
3994 |
+
{ display.externalMeasured = null; }
|
3995 |
+
}
|
3996 |
+
}
|
3997 |
+
|
3998 |
+
// Register a change to a single line. Type must be one of "text",
|
3999 |
+
// "gutter", "class", "widget"
|
4000 |
+
function regLineChange(cm, line, type) {
|
4001 |
+
cm.curOp.viewChanged = true;
|
4002 |
+
var display = cm.display, ext = cm.display.externalMeasured;
|
4003 |
+
if (ext && line >= ext.lineN && line < ext.lineN + ext.size)
|
4004 |
+
{ display.externalMeasured = null; }
|
4005 |
+
|
4006 |
+
if (line < display.viewFrom || line >= display.viewTo) { return }
|
4007 |
+
var lineView = display.view[findViewIndex(cm, line)];
|
4008 |
+
if (lineView.node == null) { return }
|
4009 |
+
var arr = lineView.changes || (lineView.changes = []);
|
4010 |
+
if (indexOf(arr, type) == -1) { arr.push(type); }
|
4011 |
+
}
|
4012 |
+
|
4013 |
+
// Clear the view.
|
4014 |
+
function resetView(cm) {
|
4015 |
+
cm.display.viewFrom = cm.display.viewTo = cm.doc.first;
|
4016 |
+
cm.display.view = [];
|
4017 |
+
cm.display.viewOffset = 0;
|
4018 |
+
}
|
4019 |
+
|
4020 |
+
function viewCuttingPoint(cm, oldN, newN, dir) {
|
4021 |
+
var index = findViewIndex(cm, oldN), diff, view = cm.display.view;
|
4022 |
+
if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)
|
4023 |
+
{ return {index: index, lineN: newN} }
|
4024 |
+
var n = cm.display.viewFrom;
|
4025 |
+
for (var i = 0; i < index; i++)
|
4026 |
+
{ n += view[i].size; }
|
4027 |
+
if (n != oldN) {
|
4028 |
+
if (dir > 0) {
|
4029 |
+
if (index == view.length - 1) { return null }
|
4030 |
+
diff = (n + view[index].size) - oldN;
|
4031 |
+
index++;
|
4032 |
+
} else {
|
4033 |
+
diff = n - oldN;
|
4034 |
+
}
|
4035 |
+
oldN += diff; newN += diff;
|
4036 |
+
}
|
4037 |
+
while (visualLineNo(cm.doc, newN) != newN) {
|
4038 |
+
if (index == (dir < 0 ? 0 : view.length - 1)) { return null }
|
4039 |
+
newN += dir * view[index - (dir < 0 ? 1 : 0)].size;
|
4040 |
+
index += dir;
|
4041 |
+
}
|
4042 |
+
return {index: index, lineN: newN}
|
4043 |
+
}
|
4044 |
+
|
4045 |
+
// Force the view to cover a given range, adding empty view element
|
4046 |
+
// or clipping off existing ones as needed.
|
4047 |
+
function adjustView(cm, from, to) {
|
4048 |
+
var display = cm.display, view = display.view;
|
4049 |
+
if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {
|
4050 |
+
display.view = buildViewArray(cm, from, to);
|
4051 |
+
display.viewFrom = from;
|
4052 |
+
} else {
|
4053 |
+
if (display.viewFrom > from)
|
4054 |
+
{ display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }
|
4055 |
+
else if (display.viewFrom < from)
|
4056 |
+
{ display.view = display.view.slice(findViewIndex(cm, from)); }
|
4057 |
+
display.viewFrom = from;
|
4058 |
+
if (display.viewTo < to)
|
4059 |
+
{ display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }
|
4060 |
+
else if (display.viewTo > to)
|
4061 |
+
{ display.view = display.view.slice(0, findViewIndex(cm, to)); }
|
4062 |
+
}
|
4063 |
+
display.viewTo = to;
|
4064 |
+
}
|
4065 |
+
|
4066 |
+
// Count the number of lines in the view whose DOM representation is
|
4067 |
+
// out of date (or nonexistent).
|
4068 |
+
function countDirtyView(cm) {
|
4069 |
+
var view = cm.display.view, dirty = 0;
|
4070 |
+
for (var i = 0; i < view.length; i++) {
|
4071 |
+
var lineView = view[i];
|
4072 |
+
if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }
|
4073 |
+
}
|
4074 |
+
return dirty
|
4075 |
+
}
|
4076 |
+
|
4077 |
+
// HIGHLIGHT WORKER
|
4078 |
+
|
4079 |
+
function startWorker(cm, time) {
|
4080 |
+
if (cm.doc.highlightFrontier < cm.display.viewTo)
|
4081 |
+
{ cm.state.highlight.set(time, bind(highlightWorker, cm)); }
|
4082 |
+
}
|
4083 |
+
|
4084 |
+
function highlightWorker(cm) {
|
4085 |
+
var doc = cm.doc;
|
4086 |
+
if (doc.highlightFrontier >= cm.display.viewTo) { return }
|
4087 |
+
var end = +new Date + cm.options.workTime;
|
4088 |
+
var context = getContextBefore(cm, doc.highlightFrontier);
|
4089 |
+
var changedLines = [];
|
4090 |
+
|
4091 |
+
doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {
|
4092 |
+
if (context.line >= cm.display.viewFrom) { // Visible
|
4093 |
+
var oldStyles = line.styles;
|
4094 |
+
var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;
|
4095 |
+
var highlighted = highlightLine(cm, line, context, true);
|
4096 |
+
if (resetState) { context.state = resetState; }
|
4097 |
+
line.styles = highlighted.styles;
|
4098 |
+
var oldCls = line.styleClasses, newCls = highlighted.classes;
|
4099 |
+
if (newCls) { line.styleClasses = newCls; }
|
4100 |
+
else if (oldCls) { line.styleClasses = null; }
|
4101 |
+
var ischange = !oldStyles || oldStyles.length != line.styles.length ||
|
4102 |
+
oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);
|
4103 |
+
for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }
|
4104 |
+
if (ischange) { changedLines.push(context.line); }
|
4105 |
+
line.stateAfter = context.save();
|
4106 |
+
context.nextLine();
|
4107 |
+
} else {
|
4108 |
+
if (line.text.length <= cm.options.maxHighlightLength)
|
4109 |
+
{ processLine(cm, line.text, context); }
|
4110 |
+
line.stateAfter = context.line % 5 == 0 ? context.save() : null;
|
4111 |
+
context.nextLine();
|
4112 |
+
}
|
4113 |
+
if (+new Date > end) {
|
4114 |
+
startWorker(cm, cm.options.workDelay);
|
4115 |
+
return true
|
4116 |
+
}
|
4117 |
+
});
|
4118 |
+
doc.highlightFrontier = context.line;
|
4119 |
+
doc.modeFrontier = Math.max(doc.modeFrontier, context.line);
|
4120 |
+
if (changedLines.length) { runInOp(cm, function () {
|
4121 |
+
for (var i = 0; i < changedLines.length; i++)
|
4122 |
+
{ regLineChange(cm, changedLines[i], "text"); }
|
4123 |
+
}); }
|
4124 |
+
}
|
4125 |
+
|
4126 |
+
// DISPLAY DRAWING
|
4127 |
+
|
4128 |
+
var DisplayUpdate = function(cm, viewport, force) {
|
4129 |
+
var display = cm.display;
|
4130 |
+
|
4131 |
+
this.viewport = viewport;
|
4132 |
+
// Store some values that we'll need later (but don't want to force a relayout for)
|
4133 |
+
this.visible = visibleLines(display, cm.doc, viewport);
|
4134 |
+
this.editorIsHidden = !display.wrapper.offsetWidth;
|
4135 |
+
this.wrapperHeight = display.wrapper.clientHeight;
|
4136 |
+
this.wrapperWidth = display.wrapper.clientWidth;
|
4137 |
+
this.oldDisplayWidth = displayWidth(cm);
|
4138 |
+
this.force = force;
|
4139 |
+
this.dims = getDimensions(cm);
|
4140 |
+
this.events = [];
|
4141 |
+
};
|
4142 |
+
|
4143 |
+
DisplayUpdate.prototype.signal = function (emitter, type) {
|
4144 |
+
if (hasHandler(emitter, type))
|
4145 |
+
{ this.events.push(arguments); }
|
4146 |
+
};
|
4147 |
+
DisplayUpdate.prototype.finish = function () {
|
4148 |
+
var this$1 = this;
|
4149 |
+
|
4150 |
+
for (var i = 0; i < this.events.length; i++)
|
4151 |
+
{ signal.apply(null, this$1.events[i]); }
|
4152 |
+
};
|
4153 |
+
|
4154 |
+
function maybeClipScrollbars(cm) {
|
4155 |
+
var display = cm.display;
|
4156 |
+
if (!display.scrollbarsClipped && display.scroller.offsetWidth) {
|
4157 |
+
display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;
|
4158 |
+
display.heightForcer.style.height = scrollGap(cm) + "px";
|
4159 |
+
display.sizer.style.marginBottom = -display.nativeBarWidth + "px";
|
4160 |
+
display.sizer.style.borderRightWidth = scrollGap(cm) + "px";
|
4161 |
+
display.scrollbarsClipped = true;
|
4162 |
+
}
|
4163 |
+
}
|
4164 |
+
|
4165 |
+
function selectionSnapshot(cm) {
|
4166 |
+
if (cm.hasFocus()) { return null }
|
4167 |
+
var active = activeElt();
|
4168 |
+
if (!active || !contains(cm.display.lineDiv, active)) { return null }
|
4169 |
+
var result = {activeElt: active};
|
4170 |
+
if (window.getSelection) {
|
4171 |
+
var sel = window.getSelection();
|
4172 |
+
if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {
|
4173 |
+
result.anchorNode = sel.anchorNode;
|
4174 |
+
result.anchorOffset = sel.anchorOffset;
|
4175 |
+
result.focusNode = sel.focusNode;
|
4176 |
+
result.focusOffset = sel.focusOffset;
|
4177 |
+
}
|
4178 |
+
}
|
4179 |
+
return result
|
4180 |
+
}
|
4181 |
+
|
4182 |
+
function restoreSelection(snapshot) {
|
4183 |
+
if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) { return }
|
4184 |
+
snapshot.activeElt.focus();
|
4185 |
+
if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {
|
4186 |
+
var sel = window.getSelection(), range$$1 = document.createRange();
|
4187 |
+
range$$1.setEnd(snapshot.anchorNode, snapshot.anchorOffset);
|
4188 |
+
range$$1.collapse(false);
|
4189 |
+
sel.removeAllRanges();
|
4190 |
+
sel.addRange(range$$1);
|
4191 |
+
sel.extend(snapshot.focusNode, snapshot.focusOffset);
|
4192 |
+
}
|
4193 |
+
}
|
4194 |
+
|
4195 |
+
// Does the actual updating of the line display. Bails out
|
4196 |
+
// (returning false) when there is nothing to be done and forced is
|
4197 |
+
// false.
|
4198 |
+
function updateDisplayIfNeeded(cm, update) {
|
4199 |
+
var display = cm.display, doc = cm.doc;
|
4200 |
+
|
4201 |
+
if (update.editorIsHidden) {
|
4202 |
+
resetView(cm);
|
4203 |
+
return false
|
4204 |
+
}
|
4205 |
+
|
4206 |
+
// Bail out if the visible area is already rendered and nothing changed.
|
4207 |
+
if (!update.force &&
|
4208 |
+
update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&
|
4209 |
+
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&
|
4210 |
+
display.renderedView == display.view && countDirtyView(cm) == 0)
|
4211 |
+
{ return false }
|
4212 |
+
|
4213 |
+
if (maybeUpdateLineNumberWidth(cm)) {
|
4214 |
+
resetView(cm);
|
4215 |
+
update.dims = getDimensions(cm);
|
4216 |
+
}
|
4217 |
+
|
4218 |
+
// Compute a suitable new viewport (from & to)
|
4219 |
+
var end = doc.first + doc.size;
|
4220 |
+
var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);
|
4221 |
+
var to = Math.min(end, update.visible.to + cm.options.viewportMargin);
|
4222 |
+
if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }
|
4223 |
+
if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }
|
4224 |
+
if (sawCollapsedSpans) {
|
4225 |
+
from = visualLineNo(cm.doc, from);
|
4226 |
+
to = visualLineEndNo(cm.doc, to);
|
4227 |
+
}
|
4228 |
+
|
4229 |
+
var different = from != display.viewFrom || to != display.viewTo ||
|
4230 |
+
display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;
|
4231 |
+
adjustView(cm, from, to);
|
4232 |
+
|
4233 |
+
display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));
|
4234 |
+
// Position the mover div to align with the current scroll position
|
4235 |
+
cm.display.mover.style.top = display.viewOffset + "px";
|
4236 |
+
|
4237 |
+
var toUpdate = countDirtyView(cm);
|
4238 |
+
if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&
|
4239 |
+
(display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))
|
4240 |
+
{ return false }
|
4241 |
+
|
4242 |
+
// For big changes, we hide the enclosing element during the
|
4243 |
+
// update, since that speeds up the operations on most browsers.
|
4244 |
+
var selSnapshot = selectionSnapshot(cm);
|
4245 |
+
if (toUpdate > 4) { display.lineDiv.style.display = "none"; }
|
4246 |
+
patchDisplay(cm, display.updateLineNumbers, update.dims);
|
4247 |
+
if (toUpdate > 4) { display.lineDiv.style.display = ""; }
|
4248 |
+
display.renderedView = display.view;
|
4249 |
+
// There might have been a widget with a focused element that got
|
4250 |
+
// hidden or updated, if so re-focus it.
|
4251 |
+
restoreSelection(selSnapshot);
|
4252 |
+
|
4253 |
+
// Prevent selection and cursors from interfering with the scroll
|
4254 |
+
// width and height.
|
4255 |
+
removeChildren(display.cursorDiv);
|
4256 |
+
removeChildren(display.selectionDiv);
|
4257 |
+
display.gutters.style.height = display.sizer.style.minHeight = 0;
|
4258 |
+
|
4259 |
+
if (different) {
|
4260 |
+
display.lastWrapHeight = update.wrapperHeight;
|
4261 |
+
display.lastWrapWidth = update.wrapperWidth;
|
4262 |
+
startWorker(cm, 400);
|
4263 |
+
}
|
4264 |
+
|
4265 |
+
display.updateLineNumbers = null;
|
4266 |
+
|
4267 |
+
return true
|
4268 |
+
}
|
4269 |
+
|
4270 |
+
function postUpdateDisplay(cm, update) {
|
4271 |
+
var viewport = update.viewport;
|
4272 |
+
|
4273 |
+
for (var first = true;; first = false) {
|
4274 |
+
if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {
|
4275 |
+
// Clip forced viewport to actual scrollable area.
|
4276 |
+
if (viewport && viewport.top != null)
|
4277 |
+
{ viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }
|
4278 |
+
// Updated line heights might result in the drawn area not
|
4279 |
+
// actually covering the viewport. Keep looping until it does.
|
4280 |
+
update.visible = visibleLines(cm.display, cm.doc, viewport);
|
4281 |
+
if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)
|
4282 |
+
{ break }
|
4283 |
+
}
|
4284 |
+
if (!updateDisplayIfNeeded(cm, update)) { break }
|
4285 |
+
updateHeightsInViewport(cm);
|
4286 |
+
var barMeasure = measureForScrollbars(cm);
|
4287 |
+
updateSelection(cm);
|
4288 |
+
updateScrollbars(cm, barMeasure);
|
4289 |
+
setDocumentHeight(cm, barMeasure);
|
4290 |
+
update.force = false;
|
4291 |
+
}
|
4292 |
+
|
4293 |
+
update.signal(cm, "update", cm);
|
4294 |
+
if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {
|
4295 |
+
update.signal(cm, "viewportChange", cm, cm.display.viewFrom, cm.display.viewTo);
|
4296 |
+
cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;
|
4297 |
+
}
|
4298 |
+
}
|
4299 |
+
|
4300 |
+
function updateDisplaySimple(cm, viewport) {
|
4301 |
+
var update = new DisplayUpdate(cm, viewport);
|
4302 |
+
if (updateDisplayIfNeeded(cm, update)) {
|
4303 |
+
updateHeightsInViewport(cm);
|
4304 |
+
postUpdateDisplay(cm, update);
|
4305 |
+
var barMeasure = measureForScrollbars(cm);
|
4306 |
+
updateSelection(cm);
|
4307 |
+
updateScrollbars(cm, barMeasure);
|
4308 |
+
setDocumentHeight(cm, barMeasure);
|
4309 |
+
update.finish();
|
4310 |
+
}
|
4311 |
+
}
|
4312 |
+
|
4313 |
+
// Sync the actual display DOM structure with display.view, removing
|
4314 |
+
// nodes for lines that are no longer in view, and creating the ones
|
4315 |
+
// that are not there yet, and updating the ones that are out of
|
4316 |
+
// date.
|
4317 |
+
function patchDisplay(cm, updateNumbersFrom, dims) {
|
4318 |
+
var display = cm.display, lineNumbers = cm.options.lineNumbers;
|
4319 |
+
var container = display.lineDiv, cur = container.firstChild;
|
4320 |
+
|
4321 |
+
function rm(node) {
|
4322 |
+
var next = node.nextSibling;
|
4323 |
+
// Works around a throw-scroll bug in OS X Webkit
|
4324 |
+
if (webkit && mac && cm.display.currentWheelTarget == node)
|
4325 |
+
{ node.style.display = "none"; }
|
4326 |
+
else
|
4327 |
+
{ node.parentNode.removeChild(node); }
|
4328 |
+
return next
|
4329 |
+
}
|
4330 |
+
|
4331 |
+
var view = display.view, lineN = display.viewFrom;
|
4332 |
+
// Loop over the elements in the view, syncing cur (the DOM nodes
|
4333 |
+
// in display.lineDiv) with the view as we go.
|
4334 |
+
for (var i = 0; i < view.length; i++) {
|
4335 |
+
var lineView = view[i];
|
4336 |
+
if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet
|
4337 |
+
var node = buildLineElement(cm, lineView, lineN, dims);
|
4338 |
+
container.insertBefore(node, cur);
|
4339 |
+
} else { // Already drawn
|
4340 |
+
while (cur != lineView.node) { cur = rm(cur); }
|
4341 |
+
var updateNumber = lineNumbers && updateNumbersFrom != null &&
|
4342 |
+
updateNumbersFrom <= lineN && lineView.lineNumber;
|
4343 |
+
if (lineView.changes) {
|
4344 |
+
if (indexOf(lineView.changes, "gutter") > -1) { updateNumber = false; }
|
4345 |
+
updateLineForChanges(cm, lineView, lineN, dims);
|
4346 |
+
}
|
4347 |
+
if (updateNumber) {
|
4348 |
+
removeChildren(lineView.lineNumber);
|
4349 |
+
lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));
|
4350 |
+
}
|
4351 |
+
cur = lineView.node.nextSibling;
|
4352 |
+
}
|
4353 |
+
lineN += lineView.size;
|
4354 |
+
}
|
4355 |
+
while (cur) { cur = rm(cur); }
|
4356 |
+
}
|
4357 |
+
|
4358 |
+
function updateGutterSpace(cm) {
|
4359 |
+
var width = cm.display.gutters.offsetWidth;
|
4360 |
+
cm.display.sizer.style.marginLeft = width + "px";
|
4361 |
+
}
|
4362 |
+
|
4363 |
+
function setDocumentHeight(cm, measure) {
|
4364 |
+
cm.display.sizer.style.minHeight = measure.docHeight + "px";
|
4365 |
+
cm.display.heightForcer.style.top = measure.docHeight + "px";
|
4366 |
+
cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + "px";
|
4367 |
+
}
|
4368 |
+
|
4369 |
+
// Rebuild the gutter elements, ensure the margin to the left of the
|
4370 |
+
// code matches their width.
|
4371 |
+
function updateGutters(cm) {
|
4372 |
+
var gutters = cm.display.gutters, specs = cm.options.gutters;
|
4373 |
+
removeChildren(gutters);
|
4374 |
+
var i = 0;
|
4375 |
+
for (; i < specs.length; ++i) {
|
4376 |
+
var gutterClass = specs[i];
|
4377 |
+
var gElt = gutters.appendChild(elt("div", null, "CodeMirror-gutter " + gutterClass));
|
4378 |
+
if (gutterClass == "CodeMirror-linenumbers") {
|
4379 |
+
cm.display.lineGutter = gElt;
|
4380 |
+
gElt.style.width = (cm.display.lineNumWidth || 1) + "px";
|
4381 |
+
}
|
4382 |
+
}
|
4383 |
+
gutters.style.display = i ? "" : "none";
|
4384 |
+
updateGutterSpace(cm);
|
4385 |
+
}
|
4386 |
+
|
4387 |
+
// Make sure the gutters options contains the element
|
4388 |
+
// "CodeMirror-linenumbers" when the lineNumbers option is true.
|
4389 |
+
function setGuttersForLineNumbers(options) {
|
4390 |
+
var found = indexOf(options.gutters, "CodeMirror-linenumbers");
|
4391 |
+
if (found == -1 && options.lineNumbers) {
|
4392 |
+
options.gutters = options.gutters.concat(["CodeMirror-linenumbers"]);
|
4393 |
+
} else if (found > -1 && !options.lineNumbers) {
|
4394 |
+
options.gutters = options.gutters.slice(0);
|
4395 |
+
options.gutters.splice(found, 1);
|
4396 |
+
}
|
4397 |
+
}
|
4398 |
+
|
4399 |
+
// Since the delta values reported on mouse wheel events are
|
4400 |
+
// unstandardized between browsers and even browser versions, and
|
4401 |
+
// generally horribly unpredictable, this code starts by measuring
|
4402 |
+
// the scroll effect that the first few mouse wheel events have,
|
4403 |
+
// and, from that, detects the way it can convert deltas to pixel
|
4404 |
+
// offsets afterwards.
|
4405 |
+
//
|
4406 |
+
// The reason we want to know the amount a wheel event will scroll
|
4407 |
+
// is that it gives us a chance to update the display before the
|
4408 |
+
// actual scrolling happens, reducing flickering.
|
4409 |
+
|
4410 |
+
var wheelSamples = 0, wheelPixelsPerUnit = null;
|
4411 |
+
// Fill in a browser-detected starting value on browsers where we
|
4412 |
+
// know one. These don't have to be accurate -- the result of them
|
4413 |
+
// being wrong would just be a slight flicker on the first wheel
|
4414 |
+
// scroll (if it is large enough).
|
4415 |
+
if (ie) { wheelPixelsPerUnit = -.53; }
|
4416 |
+
else if (gecko) { wheelPixelsPerUnit = 15; }
|
4417 |
+
else if (chrome) { wheelPixelsPerUnit = -.7; }
|
4418 |
+
else if (safari) { wheelPixelsPerUnit = -1/3; }
|
4419 |
+
|
4420 |
+
function wheelEventDelta(e) {
|
4421 |
+
var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
|
4422 |
+
if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }
|
4423 |
+
if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }
|
4424 |
+
else if (dy == null) { dy = e.wheelDelta; }
|
4425 |
+
return {x: dx, y: dy}
|
4426 |
+
}
|
4427 |
+
function wheelEventPixels(e) {
|
4428 |
+
var delta = wheelEventDelta(e);
|
4429 |
+
delta.x *= wheelPixelsPerUnit;
|
4430 |
+
delta.y *= wheelPixelsPerUnit;
|
4431 |
+
return delta
|
4432 |
+
}
|
4433 |
+
|
4434 |
+
function onScrollWheel(cm, e) {
|
4435 |
+
var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;
|
4436 |
+
|
4437 |
+
var display = cm.display, scroll = display.scroller;
|
4438 |
+
// Quit if there's nothing to scroll here
|
4439 |
+
var canScrollX = scroll.scrollWidth > scroll.clientWidth;
|
4440 |
+
var canScrollY = scroll.scrollHeight > scroll.clientHeight;
|
4441 |
+
if (!(dx && canScrollX || dy && canScrollY)) { return }
|
4442 |
+
|
4443 |
+
// Webkit browsers on OS X abort momentum scrolls when the target
|
4444 |
+
// of the scroll event is removed from the scrollable element.
|
4445 |
+
// This hack (see related code in patchDisplay) makes sure the
|
4446 |
+
// element is kept around.
|
4447 |
+
if (dy && mac && webkit) {
|
4448 |
+
outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {
|
4449 |
+
for (var i = 0; i < view.length; i++) {
|
4450 |
+
if (view[i].node == cur) {
|
4451 |
+
cm.display.currentWheelTarget = cur;
|
4452 |
+
break outer
|
4453 |
+
}
|
4454 |
+
}
|
4455 |
+
}
|
4456 |
+
}
|
4457 |
+
|
4458 |
+
// On some browsers, horizontal scrolling will cause redraws to
|
4459 |
+
// happen before the gutter has been realigned, causing it to
|
4460 |
+
// wriggle around in a most unseemly way. When we have an
|
4461 |
+
// estimated pixels/delta value, we just handle horizontal
|
4462 |
+
// scrolling entirely here. It'll be slightly off from native, but
|
4463 |
+
// better than glitching out.
|
4464 |
+
if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {
|
4465 |
+
if (dy && canScrollY)
|
4466 |
+
{ updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit)); }
|
4467 |
+
setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));
|
4468 |
+
// Only prevent default scrolling if vertical scrolling is
|
4469 |
+
// actually possible. Otherwise, it causes vertical scroll
|
4470 |
+
// jitter on OSX trackpads when deltaX is small and deltaY
|
4471 |
+
// is large (issue #3579)
|
4472 |
+
if (!dy || (dy && canScrollY))
|
4473 |
+
{ e_preventDefault(e); }
|
4474 |
+
display.wheelStartX = null; // Abort measurement, if in progress
|
4475 |
+
return
|
4476 |
+
}
|
4477 |
+
|
4478 |
+
// 'Project' the visible viewport to cover the area that is being
|
4479 |
+
// scrolled into view (if we know enough to estimate it).
|
4480 |
+
if (dy && wheelPixelsPerUnit != null) {
|
4481 |
+
var pixels = dy * wheelPixelsPerUnit;
|
4482 |
+
var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;
|
4483 |
+
if (pixels < 0) { top = Math.max(0, top + pixels - 50); }
|
4484 |
+
else { bot = Math.min(cm.doc.height, bot + pixels + 50); }
|
4485 |
+
updateDisplaySimple(cm, {top: top, bottom: bot});
|
4486 |
+
}
|
4487 |
+
|
4488 |
+
if (wheelSamples < 20) {
|
4489 |
+
if (display.wheelStartX == null) {
|
4490 |
+
display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;
|
4491 |
+
display.wheelDX = dx; display.wheelDY = dy;
|
4492 |
+
setTimeout(function () {
|
4493 |
+
if (display.wheelStartX == null) { return }
|
4494 |
+
var movedX = scroll.scrollLeft - display.wheelStartX;
|
4495 |
+
var movedY = scroll.scrollTop - display.wheelStartY;
|
4496 |
+
var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||
|
4497 |
+
(movedX && display.wheelDX && movedX / display.wheelDX);
|
4498 |
+
display.wheelStartX = display.wheelStartY = null;
|
4499 |
+
if (!sample) { return }
|
4500 |
+
wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);
|
4501 |
+
++wheelSamples;
|
4502 |
+
}, 200);
|
4503 |
+
} else {
|
4504 |
+
display.wheelDX += dx; display.wheelDY += dy;
|
4505 |
+
}
|
4506 |
+
}
|
4507 |
+
}
|
4508 |
+
|
4509 |
+
// Selection objects are immutable. A new one is created every time
|
4510 |
+
// the selection changes. A selection is one or more non-overlapping
|
4511 |
+
// (and non-touching) ranges, sorted, and an integer that indicates
|
4512 |
+
// which one is the primary selection (the one that's scrolled into
|
4513 |
+
// view, that getCursor returns, etc).
|
4514 |
+
var Selection = function(ranges, primIndex) {
|
4515 |
+
this.ranges = ranges;
|
4516 |
+
this.primIndex = primIndex;
|
4517 |
+
};
|
4518 |
+
|
4519 |
+
Selection.prototype.primary = function () { return this.ranges[this.primIndex] };
|
4520 |
+
|
4521 |
+
Selection.prototype.equals = function (other) {
|
4522 |
+
var this$1 = this;
|
4523 |
+
|
4524 |
+
if (other == this) { return true }
|
4525 |
+
if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }
|
4526 |
+
for (var i = 0; i < this.ranges.length; i++) {
|
4527 |
+
var here = this$1.ranges[i], there = other.ranges[i];
|
4528 |
+
if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }
|
4529 |
+
}
|
4530 |
+
return true
|
4531 |
+
};
|
4532 |
+
|
4533 |
+
Selection.prototype.deepCopy = function () {
|
4534 |
+
var this$1 = this;
|
4535 |
+
|
4536 |
+
var out = [];
|
4537 |
+
for (var i = 0; i < this.ranges.length; i++)
|
4538 |
+
{ out[i] = new Range(copyPos(this$1.ranges[i].anchor), copyPos(this$1.ranges[i].head)); }
|
4539 |
+
return new Selection(out, this.primIndex)
|
4540 |
+
};
|
4541 |
+
|
4542 |
+
Selection.prototype.somethingSelected = function () {
|
4543 |
+
var this$1 = this;
|
4544 |
+
|
4545 |
+
for (var i = 0; i < this.ranges.length; i++)
|
4546 |
+
{ if (!this$1.ranges[i].empty()) { return true } }
|
4547 |
+
return false
|
4548 |
+
};
|
4549 |
+
|
4550 |
+
Selection.prototype.contains = function (pos, end) {
|
4551 |
+
var this$1 = this;
|
4552 |
+
|
4553 |
+
if (!end) { end = pos; }
|
4554 |
+
for (var i = 0; i < this.ranges.length; i++) {
|
4555 |
+
var range = this$1.ranges[i];
|
4556 |
+
if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)
|
4557 |
+
{ return i }
|
4558 |
+
}
|
4559 |
+
return -1
|
4560 |
+
};
|
4561 |
+
|
4562 |
+
var Range = function(anchor, head) {
|
4563 |
+
this.anchor = anchor; this.head = head;
|
4564 |
+
};
|
4565 |
+
|
4566 |
+
Range.prototype.from = function () { return minPos(this.anchor, this.head) };
|
4567 |
+
Range.prototype.to = function () { return maxPos(this.anchor, this.head) };
|
4568 |
+
Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };
|
4569 |
+
|
4570 |
+
// Take an unsorted, potentially overlapping set of ranges, and
|
4571 |
+
// build a selection out of it. 'Consumes' ranges array (modifying
|
4572 |
+
// it).
|
4573 |
+
function normalizeSelection(cm, ranges, primIndex) {
|
4574 |
+
var mayTouch = cm && cm.options.selectionsMayTouch;
|
4575 |
+
var prim = ranges[primIndex];
|
4576 |
+
ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });
|
4577 |
+
primIndex = indexOf(ranges, prim);
|
4578 |
+
for (var i = 1; i < ranges.length; i++) {
|
4579 |
+
var cur = ranges[i], prev = ranges[i - 1];
|
4580 |
+
var diff = cmp(prev.to(), cur.from());
|
4581 |
+
if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {
|
4582 |
+
var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());
|
4583 |
+
var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;
|
4584 |
+
if (i <= primIndex) { --primIndex; }
|
4585 |
+
ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));
|
4586 |
+
}
|
4587 |
+
}
|
4588 |
+
return new Selection(ranges, primIndex)
|
4589 |
+
}
|
4590 |
+
|
4591 |
+
function simpleSelection(anchor, head) {
|
4592 |
+
return new Selection([new Range(anchor, head || anchor)], 0)
|
4593 |
+
}
|
4594 |
+
|
4595 |
+
// Compute the position of the end of a change (its 'to' property
|
4596 |
+
// refers to the pre-change end).
|
4597 |
+
function changeEnd(change) {
|
4598 |
+
if (!change.text) { return change.to }
|
4599 |
+
return Pos(change.from.line + change.text.length - 1,
|
4600 |
+
lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))
|
4601 |
+
}
|
4602 |
+
|
4603 |
+
// Adjust a position to refer to the post-change position of the
|
4604 |
+
// same text, or the end of the change if the change covers it.
|
4605 |
+
function adjustForChange(pos, change) {
|
4606 |
+
if (cmp(pos, change.from) < 0) { return pos }
|
4607 |
+
if (cmp(pos, change.to) <= 0) { return changeEnd(change) }
|
4608 |
+
|
4609 |
+
var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;
|
4610 |
+
if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }
|
4611 |
+
return Pos(line, ch)
|
4612 |
+
}
|
4613 |
+
|
4614 |
+
function computeSelAfterChange(doc, change) {
|
4615 |
+
var out = [];
|
4616 |
+
for (var i = 0; i < doc.sel.ranges.length; i++) {
|
4617 |
+
var range = doc.sel.ranges[i];
|
4618 |
+
out.push(new Range(adjustForChange(range.anchor, change),
|
4619 |
+
adjustForChange(range.head, change)));
|
4620 |
+
}
|
4621 |
+
return normalizeSelection(doc.cm, out, doc.sel.primIndex)
|
4622 |
+
}
|
4623 |
+
|
4624 |
+
function offsetPos(pos, old, nw) {
|
4625 |
+
if (pos.line == old.line)
|
4626 |
+
{ return Pos(nw.line, pos.ch - old.ch + nw.ch) }
|
4627 |
+
else
|
4628 |
+
{ return Pos(nw.line + (pos.line - old.line), pos.ch) }
|
4629 |
+
}
|
4630 |
+
|
4631 |
+
// Used by replaceSelections to allow moving the selection to the
|
4632 |
+
// start or around the replaced test. Hint may be "start" or "around".
|
4633 |
+
function computeReplacedSel(doc, changes, hint) {
|
4634 |
+
var out = [];
|
4635 |
+
var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;
|
4636 |
+
for (var i = 0; i < changes.length; i++) {
|
4637 |
+
var change = changes[i];
|
4638 |
+
var from = offsetPos(change.from, oldPrev, newPrev);
|
4639 |
+
var to = offsetPos(changeEnd(change), oldPrev, newPrev);
|
4640 |
+
oldPrev = change.to;
|
4641 |
+
newPrev = to;
|
4642 |
+
if (hint == "around") {
|
4643 |
+
var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;
|
4644 |
+
out[i] = new Range(inv ? to : from, inv ? from : to);
|
4645 |
+
} else {
|
4646 |
+
out[i] = new Range(from, from);
|
4647 |
+
}
|
4648 |
+
}
|
4649 |
+
return new Selection(out, doc.sel.primIndex)
|
4650 |
+
}
|
4651 |
+
|
4652 |
+
// Used to get the editor into a consistent state again when options change.
|
4653 |
+
|
4654 |
+
function loadMode(cm) {
|
4655 |
+
cm.doc.mode = getMode(cm.options, cm.doc.modeOption);
|
4656 |
+
resetModeState(cm);
|
4657 |
+
}
|
4658 |
+
|
4659 |
+
function resetModeState(cm) {
|
4660 |
+
cm.doc.iter(function (line) {
|
4661 |
+
if (line.stateAfter) { line.stateAfter = null; }
|
4662 |
+
if (line.styles) { line.styles = null; }
|
4663 |
+
});
|
4664 |
+
cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;
|
4665 |
+
startWorker(cm, 100);
|
4666 |
+
cm.state.modeGen++;
|
4667 |
+
if (cm.curOp) { regChange(cm); }
|
4668 |
+
}
|
4669 |
+
|
4670 |
+
// DOCUMENT DATA STRUCTURE
|
4671 |
+
|
4672 |
+
// By default, updates that start and end at the beginning of a line
|
4673 |
+
// are treated specially, in order to make the association of line
|
4674 |
+
// widgets and marker elements with the text behave more intuitive.
|
4675 |
+
function isWholeLineUpdate(doc, change) {
|
4676 |
+
return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == "" &&
|
4677 |
+
(!doc.cm || doc.cm.options.wholeLineUpdateBefore)
|
4678 |
+
}
|
4679 |
+
|
4680 |
+
// Perform a change on the document data structure.
|
4681 |
+
function updateDoc(doc, change, markedSpans, estimateHeight$$1) {
|
4682 |
+
function spansFor(n) {return markedSpans ? markedSpans[n] : null}
|
4683 |
+
function update(line, text, spans) {
|
4684 |
+
updateLine(line, text, spans, estimateHeight$$1);
|
4685 |
+
signalLater(line, "change", line, change);
|
4686 |
+
}
|
4687 |
+
function linesFor(start, end) {
|
4688 |
+
var result = [];
|
4689 |
+
for (var i = start; i < end; ++i)
|
4690 |
+
{ result.push(new Line(text[i], spansFor(i), estimateHeight$$1)); }
|
4691 |
+
return result
|
4692 |
+
}
|
4693 |
+
|
4694 |
+
var from = change.from, to = change.to, text = change.text;
|
4695 |
+
var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
|
4696 |
+
var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;
|
4697 |
+
|
4698 |
+
// Adjust the line structure
|
4699 |
+
if (change.full) {
|
4700 |
+
doc.insert(0, linesFor(0, text.length));
|
4701 |
+
doc.remove(text.length, doc.size - text.length);
|
4702 |
+
} else if (isWholeLineUpdate(doc, change)) {
|
4703 |
+
// This is a whole-line replace. Treated specially to make
|
4704 |
+
// sure line objects move the way they are supposed to.
|
4705 |
+
var added = linesFor(0, text.length - 1);
|
4706 |
+
update(lastLine, lastLine.text, lastSpans);
|
4707 |
+
if (nlines) { doc.remove(from.line, nlines); }
|
4708 |
+
if (added.length) { doc.insert(from.line, added); }
|
4709 |
+
} else if (firstLine == lastLine) {
|
4710 |
+
if (text.length == 1) {
|
4711 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);
|
4712 |
+
} else {
|
4713 |
+
var added$1 = linesFor(1, text.length - 1);
|
4714 |
+
added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));
|
4715 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
|
4716 |
+
doc.insert(from.line + 1, added$1);
|
4717 |
+
}
|
4718 |
+
} else if (text.length == 1) {
|
4719 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));
|
4720 |
+
doc.remove(from.line + 1, nlines);
|
4721 |
+
} else {
|
4722 |
+
update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));
|
4723 |
+
update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);
|
4724 |
+
var added$2 = linesFor(1, text.length - 1);
|
4725 |
+
if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }
|
4726 |
+
doc.insert(from.line + 1, added$2);
|
4727 |
+
}
|
4728 |
+
|
4729 |
+
signalLater(doc, "change", doc, change);
|
4730 |
+
}
|
4731 |
+
|
4732 |
+
// Call f for all linked documents.
|
4733 |
+
function linkedDocs(doc, f, sharedHistOnly) {
|
4734 |
+
function propagate(doc, skip, sharedHist) {
|
4735 |
+
if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {
|
4736 |
+
var rel = doc.linked[i];
|
4737 |
+
if (rel.doc == skip) { continue }
|
4738 |
+
var shared = sharedHist && rel.sharedHist;
|
4739 |
+
if (sharedHistOnly && !shared) { continue }
|
4740 |
+
f(rel.doc, shared);
|
4741 |
+
propagate(rel.doc, doc, shared);
|
4742 |
+
} }
|
4743 |
+
}
|
4744 |
+
propagate(doc, null, true);
|
4745 |
+
}
|
4746 |
+
|
4747 |
+
// Attach a document to an editor.
|
4748 |
+
function attachDoc(cm, doc) {
|
4749 |
+
if (doc.cm) { throw new Error("This document is already in use.") }
|
4750 |
+
cm.doc = doc;
|
4751 |
+
doc.cm = cm;
|
4752 |
+
estimateLineHeights(cm);
|
4753 |
+
loadMode(cm);
|
4754 |
+
setDirectionClass(cm);
|
4755 |
+
if (!cm.options.lineWrapping) { findMaxLine(cm); }
|
4756 |
+
cm.options.mode = doc.modeOption;
|
4757 |
+
regChange(cm);
|
4758 |
+
}
|
4759 |
+
|
4760 |
+
function setDirectionClass(cm) {
|
4761 |
+
(cm.doc.direction == "rtl" ? addClass : rmClass)(cm.display.lineDiv, "CodeMirror-rtl");
|
4762 |
+
}
|
4763 |
+
|
4764 |
+
function directionChanged(cm) {
|
4765 |
+
runInOp(cm, function () {
|
4766 |
+
setDirectionClass(cm);
|
4767 |
+
regChange(cm);
|
4768 |
+
});
|
4769 |
+
}
|
4770 |
+
|
4771 |
+
function History(startGen) {
|
4772 |
+
// Arrays of change events and selections. Doing something adds an
|
4773 |
+
// event to done and clears undo. Undoing moves events from done
|
4774 |
+
// to undone, redoing moves them in the other direction.
|
4775 |
+
this.done = []; this.undone = [];
|
4776 |
+
this.undoDepth = Infinity;
|
4777 |
+
// Used to track when changes can be merged into a single undo
|
4778 |
+
// event
|
4779 |
+
this.lastModTime = this.lastSelTime = 0;
|
4780 |
+
this.lastOp = this.lastSelOp = null;
|
4781 |
+
this.lastOrigin = this.lastSelOrigin = null;
|
4782 |
+
// Used by the isClean() method
|
4783 |
+
this.generation = this.maxGeneration = startGen || 1;
|
4784 |
+
}
|
4785 |
+
|
4786 |
+
// Create a history change event from an updateDoc-style change
|
4787 |
+
// object.
|
4788 |
+
function historyChangeFromChange(doc, change) {
|
4789 |
+
var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};
|
4790 |
+
attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);
|
4791 |
+
linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);
|
4792 |
+
return histChange
|
4793 |
+
}
|
4794 |
+
|
4795 |
+
// Pop all selection events off the end of a history array. Stop at
|
4796 |
+
// a change event.
|
4797 |
+
function clearSelectionEvents(array) {
|
4798 |
+
while (array.length) {
|
4799 |
+
var last = lst(array);
|
4800 |
+
if (last.ranges) { array.pop(); }
|
4801 |
+
else { break }
|
4802 |
+
}
|
4803 |
+
}
|
4804 |
+
|
4805 |
+
// Find the top change event in the history. Pop off selection
|
4806 |
+
// events that are in the way.
|
4807 |
+
function lastChangeEvent(hist, force) {
|
4808 |
+
if (force) {
|
4809 |
+
clearSelectionEvents(hist.done);
|
4810 |
+
return lst(hist.done)
|
4811 |
+
} else if (hist.done.length && !lst(hist.done).ranges) {
|
4812 |
+
return lst(hist.done)
|
4813 |
+
} else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {
|
4814 |
+
hist.done.pop();
|
4815 |
+
return lst(hist.done)
|
4816 |
+
}
|
4817 |
+
}
|
4818 |
+
|
4819 |
+
// Register a change in the history. Merges changes that are within
|
4820 |
+
// a single operation, or are close together with an origin that
|
4821 |
+
// allows merging (starting with "+") into a single event.
|
4822 |
+
function addChangeToHistory(doc, change, selAfter, opId) {
|
4823 |
+
var hist = doc.history;
|
4824 |
+
hist.undone.length = 0;
|
4825 |
+
var time = +new Date, cur;
|
4826 |
+
var last;
|
4827 |
+
|
4828 |
+
if ((hist.lastOp == opId ||
|
4829 |
+
hist.lastOrigin == change.origin && change.origin &&
|
4830 |
+
((change.origin.charAt(0) == "+" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||
|
4831 |
+
change.origin.charAt(0) == "*")) &&
|
4832 |
+
(cur = lastChangeEvent(hist, hist.lastOp == opId))) {
|
4833 |
+
// Merge this change into the last event
|
4834 |
+
last = lst(cur.changes);
|
4835 |
+
if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {
|
4836 |
+
// Optimized case for simple insertion -- don't want to add
|
4837 |
+
// new changesets for every character typed
|
4838 |
+
last.to = changeEnd(change);
|
4839 |
+
} else {
|
4840 |
+
// Add new sub-event
|
4841 |
+
cur.changes.push(historyChangeFromChange(doc, change));
|
4842 |
+
}
|
4843 |
+
} else {
|
4844 |
+
// Can not be merged, start a new event.
|
4845 |
+
var before = lst(hist.done);
|
4846 |
+
if (!before || !before.ranges)
|
4847 |
+
{ pushSelectionToHistory(doc.sel, hist.done); }
|
4848 |
+
cur = {changes: [historyChangeFromChange(doc, change)],
|
4849 |
+
generation: hist.generation};
|
4850 |
+
hist.done.push(cur);
|
4851 |
+
while (hist.done.length > hist.undoDepth) {
|
4852 |
+
hist.done.shift();
|
4853 |
+
if (!hist.done[0].ranges) { hist.done.shift(); }
|
4854 |
+
}
|
4855 |
+
}
|
4856 |
+
hist.done.push(selAfter);
|
4857 |
+
hist.generation = ++hist.maxGeneration;
|
4858 |
+
hist.lastModTime = hist.lastSelTime = time;
|
4859 |
+
hist.lastOp = hist.lastSelOp = opId;
|
4860 |
+
hist.lastOrigin = hist.lastSelOrigin = change.origin;
|
4861 |
+
|
4862 |
+
if (!last) { signal(doc, "historyAdded"); }
|
4863 |
+
}
|
4864 |
+
|
4865 |
+
function selectionEventCanBeMerged(doc, origin, prev, sel) {
|
4866 |
+
var ch = origin.charAt(0);
|
4867 |
+
return ch == "*" ||
|
4868 |
+
ch == "+" &&
|
4869 |
+
prev.ranges.length == sel.ranges.length &&
|
4870 |
+
prev.somethingSelected() == sel.somethingSelected() &&
|
4871 |
+
new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)
|
4872 |
+
}
|
4873 |
+
|
4874 |
+
// Called whenever the selection changes, sets the new selection as
|
4875 |
+
// the pending selection in the history, and pushes the old pending
|
4876 |
+
// selection into the 'done' array when it was significantly
|
4877 |
+
// different (in number of selected ranges, emptiness, or time).
|
4878 |
+
function addSelectionToHistory(doc, sel, opId, options) {
|
4879 |
+
var hist = doc.history, origin = options && options.origin;
|
4880 |
+
|
4881 |
+
// A new event is started when the previous origin does not match
|
4882 |
+
// the current, or the origins don't allow matching. Origins
|
4883 |
+
// starting with * are always merged, those starting with + are
|
4884 |
+
// merged when similar and close together in time.
|
4885 |
+
if (opId == hist.lastSelOp ||
|
4886 |
+
(origin && hist.lastSelOrigin == origin &&
|
4887 |
+
(hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||
|
4888 |
+
selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))
|
4889 |
+
{ hist.done[hist.done.length - 1] = sel; }
|
4890 |
+
else
|
4891 |
+
{ pushSelectionToHistory(sel, hist.done); }
|
4892 |
+
|
4893 |
+
hist.lastSelTime = +new Date;
|
4894 |
+
hist.lastSelOrigin = origin;
|
4895 |
+
hist.lastSelOp = opId;
|
4896 |
+
if (options && options.clearRedo !== false)
|
4897 |
+
{ clearSelectionEvents(hist.undone); }
|
4898 |
+
}
|
4899 |
+
|
4900 |
+
function pushSelectionToHistory(sel, dest) {
|
4901 |
+
var top = lst(dest);
|
4902 |
+
if (!(top && top.ranges && top.equals(sel)))
|
4903 |
+
{ dest.push(sel); }
|
4904 |
+
}
|
4905 |
+
|
4906 |
+
// Used to store marked span information in the history.
|
4907 |
+
function attachLocalSpans(doc, change, from, to) {
|
4908 |
+
var existing = change["spans_" + doc.id], n = 0;
|
4909 |
+
doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {
|
4910 |
+
if (line.markedSpans)
|
4911 |
+
{ (existing || (existing = change["spans_" + doc.id] = {}))[n] = line.markedSpans; }
|
4912 |
+
++n;
|
4913 |
+
});
|
4914 |
+
}
|
4915 |
+
|
4916 |
+
// When un/re-doing restores text containing marked spans, those
|
4917 |
+
// that have been explicitly cleared should not be restored.
|
4918 |
+
function removeClearedSpans(spans) {
|
4919 |
+
if (!spans) { return null }
|
4920 |
+
var out;
|
4921 |
+
for (var i = 0; i < spans.length; ++i) {
|
4922 |
+
if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }
|
4923 |
+
else if (out) { out.push(spans[i]); }
|
4924 |
+
}
|
4925 |
+
return !out ? spans : out.length ? out : null
|
4926 |
+
}
|
4927 |
+
|
4928 |
+
// Retrieve and filter the old marked spans stored in a change event.
|
4929 |
+
function getOldSpans(doc, change) {
|
4930 |
+
var found = change["spans_" + doc.id];
|
4931 |
+
if (!found) { return null }
|
4932 |
+
var nw = [];
|
4933 |
+
for (var i = 0; i < change.text.length; ++i)
|
4934 |
+
{ nw.push(removeClearedSpans(found[i])); }
|
4935 |
+
return nw
|
4936 |
+
}
|
4937 |
+
|
4938 |
+
// Used for un/re-doing changes from the history. Combines the
|
4939 |
+
// result of computing the existing spans with the set of spans that
|
4940 |
+
// existed in the history (so that deleting around a span and then
|
4941 |
+
// undoing brings back the span).
|
4942 |
+
function mergeOldSpans(doc, change) {
|
4943 |
+
var old = getOldSpans(doc, change);
|
4944 |
+
var stretched = stretchSpansOverChange(doc, change);
|
4945 |
+
if (!old) { return stretched }
|
4946 |
+
if (!stretched) { return old }
|
4947 |
+
|
4948 |
+
for (var i = 0; i < old.length; ++i) {
|
4949 |
+
var oldCur = old[i], stretchCur = stretched[i];
|
4950 |
+
if (oldCur && stretchCur) {
|
4951 |
+
spans: for (var j = 0; j < stretchCur.length; ++j) {
|
4952 |
+
var span = stretchCur[j];
|
4953 |
+
for (var k = 0; k < oldCur.length; ++k)
|
4954 |
+
{ if (oldCur[k].marker == span.marker) { continue spans } }
|
4955 |
+
oldCur.push(span);
|
4956 |
+
}
|
4957 |
+
} else if (stretchCur) {
|
4958 |
+
old[i] = stretchCur;
|
4959 |
+
}
|
4960 |
+
}
|
4961 |
+
return old
|
4962 |
+
}
|
4963 |
+
|
4964 |
+
// Used both to provide a JSON-safe object in .getHistory, and, when
|
4965 |
+
// detaching a document, to split the history in two
|
4966 |
+
function copyHistoryArray(events, newGroup, instantiateSel) {
|
4967 |
+
var copy = [];
|
4968 |
+
for (var i = 0; i < events.length; ++i) {
|
4969 |
+
var event = events[i];
|
4970 |
+
if (event.ranges) {
|
4971 |
+
copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);
|
4972 |
+
continue
|
4973 |
+
}
|
4974 |
+
var changes = event.changes, newChanges = [];
|
4975 |
+
copy.push({changes: newChanges});
|
4976 |
+
for (var j = 0; j < changes.length; ++j) {
|
4977 |
+
var change = changes[j], m = (void 0);
|
4978 |
+
newChanges.push({from: change.from, to: change.to, text: change.text});
|
4979 |
+
if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\d+)$/)) {
|
4980 |
+
if (indexOf(newGroup, Number(m[1])) > -1) {
|
4981 |
+
lst(newChanges)[prop] = change[prop];
|
4982 |
+
delete change[prop];
|
4983 |
+
}
|
4984 |
+
} } }
|
4985 |
+
}
|
4986 |
+
}
|
4987 |
+
return copy
|
4988 |
+
}
|
4989 |
+
|
4990 |
+
// The 'scroll' parameter given to many of these indicated whether
|
4991 |
+
// the new cursor position should be scrolled into view after
|
4992 |
+
// modifying the selection.
|
4993 |
+
|
4994 |
+
// If shift is held or the extend flag is set, extends a range to
|
4995 |
+
// include a given position (and optionally a second position).
|
4996 |
+
// Otherwise, simply returns the range between the given positions.
|
4997 |
+
// Used for cursor motion and such.
|
4998 |
+
function extendRange(range, head, other, extend) {
|
4999 |
+
if (extend) {
|
5000 |
+
var anchor = range.anchor;
|
5001 |
+
if (other) {
|
5002 |
+
var posBefore = cmp(head, anchor) < 0;
|
5003 |
+
if (posBefore != (cmp(other, anchor) < 0)) {
|
5004 |
+
anchor = head;
|
5005 |
+
head = other;
|
5006 |
+
} else if (posBefore != (cmp(head, other) < 0)) {
|
5007 |
+
head = other;
|
5008 |
+
}
|
5009 |
+
}
|
5010 |
+
return new Range(anchor, head)
|
5011 |
+
} else {
|
5012 |
+
return new Range(other || head, head)
|
5013 |
+
}
|
5014 |
+
}
|
5015 |
+
|
5016 |
+
// Extend the primary selection range, discard the rest.
|
5017 |
+
function extendSelection(doc, head, other, options, extend) {
|
5018 |
+
if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }
|
5019 |
+
setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);
|
5020 |
+
}
|
5021 |
+
|
5022 |
+
// Extend all selections (pos is an array of selections with length
|
5023 |
+
// equal the number of selections)
|
5024 |
+
function extendSelections(doc, heads, options) {
|
5025 |
+
var out = [];
|
5026 |
+
var extend = doc.cm && (doc.cm.display.shift || doc.extend);
|
5027 |
+
for (var i = 0; i < doc.sel.ranges.length; i++)
|
5028 |
+
{ out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }
|
5029 |
+
var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);
|
5030 |
+
setSelection(doc, newSel, options);
|
5031 |
+
}
|
5032 |
+
|
5033 |
+
// Updates a single range in the selection.
|
5034 |
+
function replaceOneSelection(doc, i, range, options) {
|
5035 |
+
var ranges = doc.sel.ranges.slice(0);
|
5036 |
+
ranges[i] = range;
|
5037 |
+
setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);
|
5038 |
+
}
|
5039 |
+
|
5040 |
+
// Reset the selection to a single range.
|
5041 |
+
function setSimpleSelection(doc, anchor, head, options) {
|
5042 |
+
setSelection(doc, simpleSelection(anchor, head), options);
|
5043 |
+
}
|
5044 |
+
|
5045 |
+
// Give beforeSelectionChange handlers a change to influence a
|
5046 |
+
// selection update.
|
5047 |
+
function filterSelectionChange(doc, sel, options) {
|
5048 |
+
var obj = {
|
5049 |
+
ranges: sel.ranges,
|
5050 |
+
update: function(ranges) {
|
5051 |
+
var this$1 = this;
|
5052 |
+
|
5053 |
+
this.ranges = [];
|
5054 |
+
for (var i = 0; i < ranges.length; i++)
|
5055 |
+
{ this$1.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),
|
5056 |
+
clipPos(doc, ranges[i].head)); }
|
5057 |
+
},
|
5058 |
+
origin: options && options.origin
|
5059 |
+
};
|
5060 |
+
signal(doc, "beforeSelectionChange", doc, obj);
|
5061 |
+
if (doc.cm) { signal(doc.cm, "beforeSelectionChange", doc.cm, obj); }
|
5062 |
+
if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }
|
5063 |
+
else { return sel }
|
5064 |
+
}
|
5065 |
+
|
5066 |
+
function setSelectionReplaceHistory(doc, sel, options) {
|
5067 |
+
var done = doc.history.done, last = lst(done);
|
5068 |
+
if (last && last.ranges) {
|
5069 |
+
done[done.length - 1] = sel;
|
5070 |
+
setSelectionNoUndo(doc, sel, options);
|
5071 |
+
} else {
|
5072 |
+
setSelection(doc, sel, options);
|
5073 |
+
}
|
5074 |
+
}
|
5075 |
+
|
5076 |
+
// Set a new selection.
|
5077 |
+
function setSelection(doc, sel, options) {
|
5078 |
+
setSelectionNoUndo(doc, sel, options);
|
5079 |
+
addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);
|
5080 |
+
}
|
5081 |
+
|
5082 |
+
function setSelectionNoUndo(doc, sel, options) {
|
5083 |
+
if (hasHandler(doc, "beforeSelectionChange") || doc.cm && hasHandler(doc.cm, "beforeSelectionChange"))
|
5084 |
+
{ sel = filterSelectionChange(doc, sel, options); }
|
5085 |
+
|
5086 |
+
var bias = options && options.bias ||
|
5087 |
+
(cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);
|
5088 |
+
setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));
|
5089 |
+
|
5090 |
+
if (!(options && options.scroll === false) && doc.cm)
|
5091 |
+
{ ensureCursorVisible(doc.cm); }
|
5092 |
+
}
|
5093 |
+
|
5094 |
+
function setSelectionInner(doc, sel) {
|
5095 |
+
if (sel.equals(doc.sel)) { return }
|
5096 |
+
|
5097 |
+
doc.sel = sel;
|
5098 |
+
|
5099 |
+
if (doc.cm) {
|
5100 |
+
doc.cm.curOp.updateInput = 1;
|
5101 |
+
doc.cm.curOp.selectionChanged = true;
|
5102 |
+
signalCursorActivity(doc.cm);
|
5103 |
+
}
|
5104 |
+
signalLater(doc, "cursorActivity", doc);
|
5105 |
+
}
|
5106 |
+
|
5107 |
+
// Verify that the selection does not partially select any atomic
|
5108 |
+
// marked ranges.
|
5109 |
+
function reCheckSelection(doc) {
|
5110 |
+
setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));
|
5111 |
+
}
|
5112 |
+
|
5113 |
+
// Return a selection that does not partially select any atomic
|
5114 |
+
// ranges.
|
5115 |
+
function skipAtomicInSelection(doc, sel, bias, mayClear) {
|
5116 |
+
var out;
|
5117 |
+
for (var i = 0; i < sel.ranges.length; i++) {
|
5118 |
+
var range = sel.ranges[i];
|
5119 |
+
var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];
|
5120 |
+
var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);
|
5121 |
+
var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);
|
5122 |
+
if (out || newAnchor != range.anchor || newHead != range.head) {
|
5123 |
+
if (!out) { out = sel.ranges.slice(0, i); }
|
5124 |
+
out[i] = new Range(newAnchor, newHead);
|
5125 |
+
}
|
5126 |
+
}
|
5127 |
+
return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel
|
5128 |
+
}
|
5129 |
+
|
5130 |
+
function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {
|
5131 |
+
var line = getLine(doc, pos.line);
|
5132 |
+
if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {
|
5133 |
+
var sp = line.markedSpans[i], m = sp.marker;
|
5134 |
+
if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&
|
5135 |
+
(sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {
|
5136 |
+
if (mayClear) {
|
5137 |
+
signal(m, "beforeCursorEnter");
|
5138 |
+
if (m.explicitlyCleared) {
|
5139 |
+
if (!line.markedSpans) { break }
|
5140 |
+
else {--i; continue}
|
5141 |
+
}
|
5142 |
+
}
|
5143 |
+
if (!m.atomic) { continue }
|
5144 |
+
|
5145 |
+
if (oldPos) {
|
5146 |
+
var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);
|
5147 |
+
if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft)
|
5148 |
+
{ near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }
|
5149 |
+
if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))
|
5150 |
+
{ return skipAtomicInner(doc, near, pos, dir, mayClear) }
|
5151 |
+
}
|
5152 |
+
|
5153 |
+
var far = m.find(dir < 0 ? -1 : 1);
|
5154 |
+
if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight)
|
5155 |
+
{ far = movePos(doc, far, dir, far.line == pos.line ? line : null); }
|
5156 |
+
return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null
|
5157 |
+
}
|
5158 |
+
} }
|
5159 |
+
return pos
|
5160 |
+
}
|
5161 |
+
|
5162 |
+
// Ensure a given position is not inside an atomic range.
|
5163 |
+
function skipAtomic(doc, pos, oldPos, bias, mayClear) {
|
5164 |
+
var dir = bias || 1;
|
5165 |
+
var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||
|
5166 |
+
(!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||
|
5167 |
+
skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||
|
5168 |
+
(!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));
|
5169 |
+
if (!found) {
|
5170 |
+
doc.cantEdit = true;
|
5171 |
+
return Pos(doc.first, 0)
|
5172 |
+
}
|
5173 |
+
return found
|
5174 |
+
}
|
5175 |
+
|
5176 |
+
function movePos(doc, pos, dir, line) {
|
5177 |
+
if (dir < 0 && pos.ch == 0) {
|
5178 |
+
if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }
|
5179 |
+
else { return null }
|
5180 |
+
} else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {
|
5181 |
+
if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }
|
5182 |
+
else { return null }
|
5183 |
+
} else {
|
5184 |
+
return new Pos(pos.line, pos.ch + dir)
|
5185 |
+
}
|
5186 |
+
}
|
5187 |
+
|
5188 |
+
function selectAll(cm) {
|
5189 |
+
cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);
|
5190 |
+
}
|
5191 |
+
|
5192 |
+
// UPDATING
|
5193 |
+
|
5194 |
+
// Allow "beforeChange" event handlers to influence a change
|
5195 |
+
function filterChange(doc, change, update) {
|
5196 |
+
var obj = {
|
5197 |
+
canceled: false,
|
5198 |
+
from: change.from,
|
5199 |
+
to: change.to,
|
5200 |
+
text: change.text,
|
5201 |
+
origin: change.origin,
|
5202 |
+
cancel: function () { return obj.canceled = true; }
|
5203 |
+
};
|
5204 |
+
if (update) { obj.update = function (from, to, text, origin) {
|
5205 |
+
if (from) { obj.from = clipPos(doc, from); }
|
5206 |
+
if (to) { obj.to = clipPos(doc, to); }
|
5207 |
+
if (text) { obj.text = text; }
|
5208 |
+
if (origin !== undefined) { obj.origin = origin; }
|
5209 |
+
}; }
|
5210 |
+
signal(doc, "beforeChange", doc, obj);
|
5211 |
+
if (doc.cm) { signal(doc.cm, "beforeChange", doc.cm, obj); }
|
5212 |
+
|
5213 |
+
if (obj.canceled) {
|
5214 |
+
if (doc.cm) { doc.cm.curOp.updateInput = 2; }
|
5215 |
+
return null
|
5216 |
+
}
|
5217 |
+
return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}
|
5218 |
+
}
|
5219 |
+
|
5220 |
+
// Apply a change to a document, and add it to the document's
|
5221 |
+
// history, and propagating it to all linked documents.
|
5222 |
+
function makeChange(doc, change, ignoreReadOnly) {
|
5223 |
+
if (doc.cm) {
|
5224 |
+
if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }
|
5225 |
+
if (doc.cm.state.suppressEdits) { return }
|
5226 |
+
}
|
5227 |
+
|
5228 |
+
if (hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange")) {
|
5229 |
+
change = filterChange(doc, change, true);
|
5230 |
+
if (!change) { return }
|
5231 |
+
}
|
5232 |
+
|
5233 |
+
// Possibly split or suppress the update based on the presence
|
5234 |
+
// of read-only spans in its range.
|
5235 |
+
var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);
|
5236 |
+
if (split) {
|
5237 |
+
for (var i = split.length - 1; i >= 0; --i)
|
5238 |
+
{ makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [""] : change.text, origin: change.origin}); }
|
5239 |
+
} else {
|
5240 |
+
makeChangeInner(doc, change);
|
5241 |
+
}
|
5242 |
+
}
|
5243 |
+
|
5244 |
+
function makeChangeInner(doc, change) {
|
5245 |
+
if (change.text.length == 1 && change.text[0] == "" && cmp(change.from, change.to) == 0) { return }
|
5246 |
+
var selAfter = computeSelAfterChange(doc, change);
|
5247 |
+
addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);
|
5248 |
+
|
5249 |
+
makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));
|
5250 |
+
var rebased = [];
|
5251 |
+
|
5252 |
+
linkedDocs(doc, function (doc, sharedHist) {
|
5253 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
5254 |
+
rebaseHist(doc.history, change);
|
5255 |
+
rebased.push(doc.history);
|
5256 |
+
}
|
5257 |
+
makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));
|
5258 |
+
});
|
5259 |
+
}
|
5260 |
+
|
5261 |
+
// Revert a change stored in a document's history.
|
5262 |
+
function makeChangeFromHistory(doc, type, allowSelectionOnly) {
|
5263 |
+
var suppress = doc.cm && doc.cm.state.suppressEdits;
|
5264 |
+
if (suppress && !allowSelectionOnly) { return }
|
5265 |
+
|
5266 |
+
var hist = doc.history, event, selAfter = doc.sel;
|
5267 |
+
var source = type == "undo" ? hist.done : hist.undone, dest = type == "undo" ? hist.undone : hist.done;
|
5268 |
+
|
5269 |
+
// Verify that there is a useable event (so that ctrl-z won't
|
5270 |
+
// needlessly clear selection events)
|
5271 |
+
var i = 0;
|
5272 |
+
for (; i < source.length; i++) {
|
5273 |
+
event = source[i];
|
5274 |
+
if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)
|
5275 |
+
{ break }
|
5276 |
+
}
|
5277 |
+
if (i == source.length) { return }
|
5278 |
+
hist.lastOrigin = hist.lastSelOrigin = null;
|
5279 |
+
|
5280 |
+
for (;;) {
|
5281 |
+
event = source.pop();
|
5282 |
+
if (event.ranges) {
|
5283 |
+
pushSelectionToHistory(event, dest);
|
5284 |
+
if (allowSelectionOnly && !event.equals(doc.sel)) {
|
5285 |
+
setSelection(doc, event, {clearRedo: false});
|
5286 |
+
return
|
5287 |
+
}
|
5288 |
+
selAfter = event;
|
5289 |
+
} else if (suppress) {
|
5290 |
+
source.push(event);
|
5291 |
+
return
|
5292 |
+
} else { break }
|
5293 |
+
}
|
5294 |
+
|
5295 |
+
// Build up a reverse change object to add to the opposite history
|
5296 |
+
// stack (redo when undoing, and vice versa).
|
5297 |
+
var antiChanges = [];
|
5298 |
+
pushSelectionToHistory(selAfter, dest);
|
5299 |
+
dest.push({changes: antiChanges, generation: hist.generation});
|
5300 |
+
hist.generation = event.generation || ++hist.maxGeneration;
|
5301 |
+
|
5302 |
+
var filter = hasHandler(doc, "beforeChange") || doc.cm && hasHandler(doc.cm, "beforeChange");
|
5303 |
+
|
5304 |
+
var loop = function ( i ) {
|
5305 |
+
var change = event.changes[i];
|
5306 |
+
change.origin = type;
|
5307 |
+
if (filter && !filterChange(doc, change, false)) {
|
5308 |
+
source.length = 0;
|
5309 |
+
return {}
|
5310 |
+
}
|
5311 |
+
|
5312 |
+
antiChanges.push(historyChangeFromChange(doc, change));
|
5313 |
+
|
5314 |
+
var after = i ? computeSelAfterChange(doc, change) : lst(source);
|
5315 |
+
makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));
|
5316 |
+
if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }
|
5317 |
+
var rebased = [];
|
5318 |
+
|
5319 |
+
// Propagate to the linked documents
|
5320 |
+
linkedDocs(doc, function (doc, sharedHist) {
|
5321 |
+
if (!sharedHist && indexOf(rebased, doc.history) == -1) {
|
5322 |
+
rebaseHist(doc.history, change);
|
5323 |
+
rebased.push(doc.history);
|
5324 |
+
}
|
5325 |
+
makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));
|
5326 |
+
});
|
5327 |
+
};
|
5328 |
+
|
5329 |
+
for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {
|
5330 |
+
var returned = loop( i$1 );
|
5331 |
+
|
5332 |
+
if ( returned ) return returned.v;
|
5333 |
+
}
|
5334 |
+
}
|
5335 |
+
|
5336 |
+
// Sub-views need their line numbers shifted when text is added
|
5337 |
+
// above or below them in the parent document.
|
5338 |
+
function shiftDoc(doc, distance) {
|
5339 |
+
if (distance == 0) { return }
|
5340 |
+
doc.first += distance;
|
5341 |
+
doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(
|
5342 |
+
Pos(range.anchor.line + distance, range.anchor.ch),
|
5343 |
+
Pos(range.head.line + distance, range.head.ch)
|
5344 |
+
); }), doc.sel.primIndex);
|
5345 |
+
if (doc.cm) {
|
5346 |
+
regChange(doc.cm, doc.first, doc.first - distance, distance);
|
5347 |
+
for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)
|
5348 |
+
{ regLineChange(doc.cm, l, "gutter"); }
|
5349 |
+
}
|
5350 |
+
}
|
5351 |
+
|
5352 |
+
// More lower-level change function, handling only a single document
|
5353 |
+
// (not linked ones).
|
5354 |
+
function makeChangeSingleDoc(doc, change, selAfter, spans) {
|
5355 |
+
if (doc.cm && !doc.cm.curOp)
|
5356 |
+
{ return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }
|
5357 |
+
|
5358 |
+
if (change.to.line < doc.first) {
|
5359 |
+
shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));
|
5360 |
+
return
|
5361 |
+
}
|
5362 |
+
if (change.from.line > doc.lastLine()) { return }
|
5363 |
+
|
5364 |
+
// Clip the change to the size of this doc
|
5365 |
+
if (change.from.line < doc.first) {
|
5366 |
+
var shift = change.text.length - 1 - (doc.first - change.from.line);
|
5367 |
+
shiftDoc(doc, shift);
|
5368 |
+
change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),
|
5369 |
+
text: [lst(change.text)], origin: change.origin};
|
5370 |
+
}
|
5371 |
+
var last = doc.lastLine();
|
5372 |
+
if (change.to.line > last) {
|
5373 |
+
change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),
|
5374 |
+
text: [change.text[0]], origin: change.origin};
|
5375 |
+
}
|
5376 |
+
|
5377 |
+
change.removed = getBetween(doc, change.from, change.to);
|
5378 |
+
|
5379 |
+
if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }
|
5380 |
+
if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }
|
5381 |
+
else { updateDoc(doc, change, spans); }
|
5382 |
+
setSelectionNoUndo(doc, selAfter, sel_dontScroll);
|
5383 |
+
}
|
5384 |
+
|
5385 |
+
// Handle the interaction of a change to a document with the editor
|
5386 |
+
// that this document is part of.
|
5387 |
+
function makeChangeSingleDocInEditor(cm, change, spans) {
|
5388 |
+
var doc = cm.doc, display = cm.display, from = change.from, to = change.to;
|
5389 |
+
|
5390 |
+
var recomputeMaxLength = false, checkWidthStart = from.line;
|
5391 |
+
if (!cm.options.lineWrapping) {
|
5392 |
+
checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));
|
5393 |
+
doc.iter(checkWidthStart, to.line + 1, function (line) {
|
5394 |
+
if (line == display.maxLine) {
|
5395 |
+
recomputeMaxLength = true;
|
5396 |
+
return true
|
5397 |
+
}
|
5398 |
+
});
|
5399 |
+
}
|
5400 |
+
|
5401 |
+
if (doc.sel.contains(change.from, change.to) > -1)
|
5402 |
+
{ signalCursorActivity(cm); }
|
5403 |
+
|
5404 |
+
updateDoc(doc, change, spans, estimateHeight(cm));
|
5405 |
+
|
5406 |
+
if (!cm.options.lineWrapping) {
|
5407 |
+
doc.iter(checkWidthStart, from.line + change.text.length, function (line) {
|
5408 |
+
var len = lineLength(line);
|
5409 |
+
if (len > display.maxLineLength) {
|
5410 |
+
display.maxLine = line;
|
5411 |
+
display.maxLineLength = len;
|
5412 |
+
display.maxLineChanged = true;
|
5413 |
+
recomputeMaxLength = false;
|
5414 |
+
}
|
5415 |
+
});
|
5416 |
+
if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }
|
5417 |
+
}
|
5418 |
+
|
5419 |
+
retreatFrontier(doc, from.line);
|
5420 |
+
startWorker(cm, 400);
|
5421 |
+
|
5422 |
+
var lendiff = change.text.length - (to.line - from.line) - 1;
|
5423 |
+
// Remember that these lines changed, for updating the display
|
5424 |
+
if (change.full)
|
5425 |
+
{ regChange(cm); }
|
5426 |
+
else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))
|
5427 |
+
{ regLineChange(cm, from.line, "text"); }
|
5428 |
+
else
|
5429 |
+
{ regChange(cm, from.line, to.line + 1, lendiff); }
|
5430 |
+
|
5431 |
+
var changesHandler = hasHandler(cm, "changes"), changeHandler = hasHandler(cm, "change");
|
5432 |
+
if (changeHandler || changesHandler) {
|
5433 |
+
var obj = {
|
5434 |
+
from: from, to: to,
|
5435 |
+
text: change.text,
|
5436 |
+
removed: change.removed,
|
5437 |
+
origin: change.origin
|
5438 |
+
};
|
5439 |
+
if (changeHandler) { signalLater(cm, "change", cm, obj); }
|
5440 |
+
if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }
|
5441 |
+
}
|
5442 |
+
cm.display.selForContextMenu = null;
|
5443 |
+
}
|
5444 |
+
|
5445 |
+
function replaceRange(doc, code, from, to, origin) {
|
5446 |
+
var assign;
|
5447 |
+
|
5448 |
+
if (!to) { to = from; }
|
5449 |
+
if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }
|
5450 |
+
if (typeof code == "string") { code = doc.splitLines(code); }
|
5451 |
+
makeChange(doc, {from: from, to: to, text: code, origin: origin});
|
5452 |
+
}
|
5453 |
+
|
5454 |
+
// Rebasing/resetting history to deal with externally-sourced changes
|
5455 |
+
|
5456 |
+
function rebaseHistSelSingle(pos, from, to, diff) {
|
5457 |
+
if (to < pos.line) {
|
5458 |
+
pos.line += diff;
|
5459 |
+
} else if (from < pos.line) {
|
5460 |
+
pos.line = from;
|
5461 |
+
pos.ch = 0;
|
5462 |
+
}
|
5463 |
+
}
|
5464 |
+
|
5465 |
+
// Tries to rebase an array of history events given a change in the
|
5466 |
+
// document. If the change touches the same lines as the event, the
|
5467 |
+
// event, and everything 'behind' it, is discarded. If the change is
|
5468 |
+
// before the event, the event's positions are updated. Uses a
|
5469 |
+
// copy-on-write scheme for the positions, to avoid having to
|
5470 |
+
// reallocate them all on every rebase, but also avoid problems with
|
5471 |
+
// shared position objects being unsafely updated.
|
5472 |
+
function rebaseHistArray(array, from, to, diff) {
|
5473 |
+
for (var i = 0; i < array.length; ++i) {
|
5474 |
+
var sub = array[i], ok = true;
|
5475 |
+
if (sub.ranges) {
|
5476 |
+
if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }
|
5477 |
+
for (var j = 0; j < sub.ranges.length; j++) {
|
5478 |
+
rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);
|
5479 |
+
rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);
|
5480 |
+
}
|
5481 |
+
continue
|
5482 |
+
}
|
5483 |
+
for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {
|
5484 |
+
var cur = sub.changes[j$1];
|
5485 |
+
if (to < cur.from.line) {
|
5486 |
+
cur.from = Pos(cur.from.line + diff, cur.from.ch);
|
5487 |
+
cur.to = Pos(cur.to.line + diff, cur.to.ch);
|
5488 |
+
} else if (from <= cur.to.line) {
|
5489 |
+
ok = false;
|
5490 |
+
break
|
5491 |
+
}
|
5492 |
+
}
|
5493 |
+
if (!ok) {
|
5494 |
+
array.splice(0, i + 1);
|
5495 |
+
i = 0;
|
5496 |
+
}
|
5497 |
+
}
|
5498 |
+
}
|
5499 |
+
|
5500 |
+
function rebaseHist(hist, change) {
|
5501 |
+
var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;
|
5502 |
+
rebaseHistArray(hist.done, from, to, diff);
|
5503 |
+
rebaseHistArray(hist.undone, from, to, diff);
|
5504 |
+
}
|
5505 |
+
|
5506 |
+
// Utility for applying a change to a line by handle or number,
|
5507 |
+
// returning the number and optionally registering the line as
|
5508 |
+
// changed.
|
5509 |
+
function changeLine(doc, handle, changeType, op) {
|
5510 |
+
var no = handle, line = handle;
|
5511 |
+
if (typeof handle == "number") { line = getLine(doc, clipLine(doc, handle)); }
|
5512 |
+
else { no = lineNo(handle); }
|
5513 |
+
if (no == null) { return null }
|
5514 |
+
if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }
|
5515 |
+
return line
|
5516 |
+
}
|
5517 |
+
|
5518 |
+
// The document is represented as a BTree consisting of leaves, with
|
5519 |
+
// chunk of lines in them, and branches, with up to ten leaves or
|
5520 |
+
// other branch nodes below them. The top node is always a branch
|
5521 |
+
// node, and is the document object itself (meaning it has
|
5522 |
+
// additional methods and properties).
|
5523 |
+
//
|
5524 |
+
// All nodes have parent links. The tree is used both to go from
|
5525 |
+
// line numbers to line objects, and to go from objects to numbers.
|
5526 |
+
// It also indexes by height, and is used to convert between height
|
5527 |
+
// and line object, and to find the total height of the document.
|
5528 |
+
//
|
5529 |
+
// See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html
|
5530 |
+
|
5531 |
+
function LeafChunk(lines) {
|
5532 |
+
var this$1 = this;
|
5533 |
+
|
5534 |
+
this.lines = lines;
|
5535 |
+
this.parent = null;
|
5536 |
+
var height = 0;
|
5537 |
+
for (var i = 0; i < lines.length; ++i) {
|
5538 |
+
lines[i].parent = this$1;
|
5539 |
+
height += lines[i].height;
|
5540 |
+
}
|
5541 |
+
this.height = height;
|
5542 |
+
}
|
5543 |
+
|
5544 |
+
LeafChunk.prototype = {
|
5545 |
+
chunkSize: function() { return this.lines.length },
|
5546 |
+
|
5547 |
+
// Remove the n lines at offset 'at'.
|
5548 |
+
removeInner: function(at, n) {
|
5549 |
+
var this$1 = this;
|
5550 |
+
|
5551 |
+
for (var i = at, e = at + n; i < e; ++i) {
|
5552 |
+
var line = this$1.lines[i];
|
5553 |
+
this$1.height -= line.height;
|
5554 |
+
cleanUpLine(line);
|
5555 |
+
signalLater(line, "delete");
|
5556 |
+
}
|
5557 |
+
this.lines.splice(at, n);
|
5558 |
+
},
|
5559 |
+
|
5560 |
+
// Helper used to collapse a small branch into a single leaf.
|
5561 |
+
collapse: function(lines) {
|
5562 |
+
lines.push.apply(lines, this.lines);
|
5563 |
+
},
|
5564 |
+
|
5565 |
+
// Insert the given array of lines at offset 'at', count them as
|
5566 |
+
// having the given height.
|
5567 |
+
insertInner: function(at, lines, height) {
|
5568 |
+
var this$1 = this;
|
5569 |
+
|
5570 |
+
this.height += height;
|
5571 |
+
this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));
|
5572 |
+
for (var i = 0; i < lines.length; ++i) { lines[i].parent = this$1; }
|
5573 |
+
},
|
5574 |
+
|
5575 |
+
// Used to iterate over a part of the tree.
|
5576 |
+
iterN: function(at, n, op) {
|
5577 |
+
var this$1 = this;
|
5578 |
+
|
5579 |
+
for (var e = at + n; at < e; ++at)
|
5580 |
+
{ if (op(this$1.lines[at])) { return true } }
|
5581 |
+
}
|
5582 |
+
};
|
5583 |
+
|
5584 |
+
function BranchChunk(children) {
|
5585 |
+
var this$1 = this;
|
5586 |
+
|
5587 |
+
this.children = children;
|
5588 |
+
var size = 0, height = 0;
|
5589 |
+
for (var i = 0; i < children.length; ++i) {
|
5590 |
+
var ch = children[i];
|
5591 |
+
size += ch.chunkSize(); height += ch.height;
|
5592 |
+
ch.parent = this$1;
|
5593 |
+
}
|
5594 |
+
this.size = size;
|
5595 |
+
this.height = height;
|
5596 |
+
this.parent = null;
|
5597 |
+
}
|
5598 |
+
|
5599 |
+
BranchChunk.prototype = {
|
5600 |
+
chunkSize: function() { return this.size },
|
5601 |
+
|
5602 |
+
removeInner: function(at, n) {
|
5603 |
+
var this$1 = this;
|
5604 |
+
|
5605 |
+
this.size -= n;
|
5606 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5607 |
+
var child = this$1.children[i], sz = child.chunkSize();
|
5608 |
+
if (at < sz) {
|
5609 |
+
var rm = Math.min(n, sz - at), oldHeight = child.height;
|
5610 |
+
child.removeInner(at, rm);
|
5611 |
+
this$1.height -= oldHeight - child.height;
|
5612 |
+
if (sz == rm) { this$1.children.splice(i--, 1); child.parent = null; }
|
5613 |
+
if ((n -= rm) == 0) { break }
|
5614 |
+
at = 0;
|
5615 |
+
} else { at -= sz; }
|
5616 |
+
}
|
5617 |
+
// If the result is smaller than 25 lines, ensure that it is a
|
5618 |
+
// single leaf node.
|
5619 |
+
if (this.size - n < 25 &&
|
5620 |
+
(this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {
|
5621 |
+
var lines = [];
|
5622 |
+
this.collapse(lines);
|
5623 |
+
this.children = [new LeafChunk(lines)];
|
5624 |
+
this.children[0].parent = this;
|
5625 |
+
}
|
5626 |
+
},
|
5627 |
+
|
5628 |
+
collapse: function(lines) {
|
5629 |
+
var this$1 = this;
|
5630 |
+
|
5631 |
+
for (var i = 0; i < this.children.length; ++i) { this$1.children[i].collapse(lines); }
|
5632 |
+
},
|
5633 |
+
|
5634 |
+
insertInner: function(at, lines, height) {
|
5635 |
+
var this$1 = this;
|
5636 |
+
|
5637 |
+
this.size += lines.length;
|
5638 |
+
this.height += height;
|
5639 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5640 |
+
var child = this$1.children[i], sz = child.chunkSize();
|
5641 |
+
if (at <= sz) {
|
5642 |
+
child.insertInner(at, lines, height);
|
5643 |
+
if (child.lines && child.lines.length > 50) {
|
5644 |
+
// To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.
|
5645 |
+
// Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.
|
5646 |
+
var remaining = child.lines.length % 25 + 25;
|
5647 |
+
for (var pos = remaining; pos < child.lines.length;) {
|
5648 |
+
var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));
|
5649 |
+
child.height -= leaf.height;
|
5650 |
+
this$1.children.splice(++i, 0, leaf);
|
5651 |
+
leaf.parent = this$1;
|
5652 |
+
}
|
5653 |
+
child.lines = child.lines.slice(0, remaining);
|
5654 |
+
this$1.maybeSpill();
|
5655 |
+
}
|
5656 |
+
break
|
5657 |
+
}
|
5658 |
+
at -= sz;
|
5659 |
+
}
|
5660 |
+
},
|
5661 |
+
|
5662 |
+
// When a node has grown, check whether it should be split.
|
5663 |
+
maybeSpill: function() {
|
5664 |
+
if (this.children.length <= 10) { return }
|
5665 |
+
var me = this;
|
5666 |
+
do {
|
5667 |
+
var spilled = me.children.splice(me.children.length - 5, 5);
|
5668 |
+
var sibling = new BranchChunk(spilled);
|
5669 |
+
if (!me.parent) { // Become the parent node
|
5670 |
+
var copy = new BranchChunk(me.children);
|
5671 |
+
copy.parent = me;
|
5672 |
+
me.children = [copy, sibling];
|
5673 |
+
me = copy;
|
5674 |
+
} else {
|
5675 |
+
me.size -= sibling.size;
|
5676 |
+
me.height -= sibling.height;
|
5677 |
+
var myIndex = indexOf(me.parent.children, me);
|
5678 |
+
me.parent.children.splice(myIndex + 1, 0, sibling);
|
5679 |
+
}
|
5680 |
+
sibling.parent = me.parent;
|
5681 |
+
} while (me.children.length > 10)
|
5682 |
+
me.parent.maybeSpill();
|
5683 |
+
},
|
5684 |
+
|
5685 |
+
iterN: function(at, n, op) {
|
5686 |
+
var this$1 = this;
|
5687 |
+
|
5688 |
+
for (var i = 0; i < this.children.length; ++i) {
|
5689 |
+
var child = this$1.children[i], sz = child.chunkSize();
|
5690 |
+
if (at < sz) {
|
5691 |
+
var used = Math.min(n, sz - at);
|
5692 |
+
if (child.iterN(at, used, op)) { return true }
|
5693 |
+
if ((n -= used) == 0) { break }
|
5694 |
+
at = 0;
|
5695 |
+
} else { at -= sz; }
|
5696 |
+
}
|
5697 |
+
}
|
5698 |
+
};
|
5699 |
+
|
5700 |
+
// Line widgets are block elements displayed above or below a line.
|
5701 |
+
|
5702 |
+
var LineWidget = function(doc, node, options) {
|
5703 |
+
var this$1 = this;
|
5704 |
+
|
5705 |
+
if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))
|
5706 |
+
{ this$1[opt] = options[opt]; } } }
|
5707 |
+
this.doc = doc;
|
5708 |
+
this.node = node;
|
5709 |
+
};
|
5710 |
+
|
5711 |
+
LineWidget.prototype.clear = function () {
|
5712 |
+
var this$1 = this;
|
5713 |
+
|
5714 |
+
var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);
|
5715 |
+
if (no == null || !ws) { return }
|
5716 |
+
for (var i = 0; i < ws.length; ++i) { if (ws[i] == this$1) { ws.splice(i--, 1); } }
|
5717 |
+
if (!ws.length) { line.widgets = null; }
|
5718 |
+
var height = widgetHeight(this);
|
5719 |
+
updateLineHeight(line, Math.max(0, line.height - height));
|
5720 |
+
if (cm) {
|
5721 |
+
runInOp(cm, function () {
|
5722 |
+
adjustScrollWhenAboveVisible(cm, line, -height);
|
5723 |
+
regLineChange(cm, no, "widget");
|
5724 |
+
});
|
5725 |
+
signalLater(cm, "lineWidgetCleared", cm, this, no);
|
5726 |
+
}
|
5727 |
+
};
|
5728 |
+
|
5729 |
+
LineWidget.prototype.changed = function () {
|
5730 |
+
var this$1 = this;
|
5731 |
+
|
5732 |
+
var oldH = this.height, cm = this.doc.cm, line = this.line;
|
5733 |
+
this.height = null;
|
5734 |
+
var diff = widgetHeight(this) - oldH;
|
5735 |
+
if (!diff) { return }
|
5736 |
+
if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }
|
5737 |
+
if (cm) {
|
5738 |
+
runInOp(cm, function () {
|
5739 |
+
cm.curOp.forceUpdate = true;
|
5740 |
+
adjustScrollWhenAboveVisible(cm, line, diff);
|
5741 |
+
signalLater(cm, "lineWidgetChanged", cm, this$1, lineNo(line));
|
5742 |
+
});
|
5743 |
+
}
|
5744 |
+
};
|
5745 |
+
eventMixin(LineWidget);
|
5746 |
+
|
5747 |
+
function adjustScrollWhenAboveVisible(cm, line, diff) {
|
5748 |
+
if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))
|
5749 |
+
{ addToScrollTop(cm, diff); }
|
5750 |
+
}
|
5751 |
+
|
5752 |
+
function addLineWidget(doc, handle, node, options) {
|
5753 |
+
var widget = new LineWidget(doc, node, options);
|
5754 |
+
var cm = doc.cm;
|
5755 |
+
if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }
|
5756 |
+
changeLine(doc, handle, "widget", function (line) {
|
5757 |
+
var widgets = line.widgets || (line.widgets = []);
|
5758 |
+
if (widget.insertAt == null) { widgets.push(widget); }
|
5759 |
+
else { widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget); }
|
5760 |
+
widget.line = line;
|
5761 |
+
if (cm && !lineIsHidden(doc, line)) {
|
5762 |
+
var aboveVisible = heightAtLine(line) < doc.scrollTop;
|
5763 |
+
updateLineHeight(line, line.height + widgetHeight(widget));
|
5764 |
+
if (aboveVisible) { addToScrollTop(cm, widget.height); }
|
5765 |
+
cm.curOp.forceUpdate = true;
|
5766 |
+
}
|
5767 |
+
return true
|
5768 |
+
});
|
5769 |
+
if (cm) { signalLater(cm, "lineWidgetAdded", cm, widget, typeof handle == "number" ? handle : lineNo(handle)); }
|
5770 |
+
return widget
|
5771 |
+
}
|
5772 |
+
|
5773 |
+
// TEXTMARKERS
|
5774 |
+
|
5775 |
+
// Created with markText and setBookmark methods. A TextMarker is a
|
5776 |
+
// handle that can be used to clear or find a marked position in the
|
5777 |
+
// document. Line objects hold arrays (markedSpans) containing
|
5778 |
+
// {from, to, marker} object pointing to such marker objects, and
|
5779 |
+
// indicating that such a marker is present on that line. Multiple
|
5780 |
+
// lines may point to the same marker when it spans across lines.
|
5781 |
+
// The spans will have null for their from/to properties when the
|
5782 |
+
// marker continues beyond the start/end of the line. Markers have
|
5783 |
+
// links back to the lines they currently touch.
|
5784 |
+
|
5785 |
+
// Collapsed markers have unique ids, in order to be able to order
|
5786 |
+
// them, which is needed for uniquely determining an outer marker
|
5787 |
+
// when they overlap (they may nest, but not partially overlap).
|
5788 |
+
var nextMarkerId = 0;
|
5789 |
+
|
5790 |
+
var TextMarker = function(doc, type) {
|
5791 |
+
this.lines = [];
|
5792 |
+
this.type = type;
|
5793 |
+
this.doc = doc;
|
5794 |
+
this.id = ++nextMarkerId;
|
5795 |
+
};
|
5796 |
+
|
5797 |
+
// Clear the marker.
|
5798 |
+
TextMarker.prototype.clear = function () {
|
5799 |
+
var this$1 = this;
|
5800 |
+
|
5801 |
+
if (this.explicitlyCleared) { return }
|
5802 |
+
var cm = this.doc.cm, withOp = cm && !cm.curOp;
|
5803 |
+
if (withOp) { startOperation(cm); }
|
5804 |
+
if (hasHandler(this, "clear")) {
|
5805 |
+
var found = this.find();
|
5806 |
+
if (found) { signalLater(this, "clear", found.from, found.to); }
|
5807 |
+
}
|
5808 |
+
var min = null, max = null;
|
5809 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
5810 |
+
var line = this$1.lines[i];
|
5811 |
+
var span = getMarkedSpanFor(line.markedSpans, this$1);
|
5812 |
+
if (cm && !this$1.collapsed) { regLineChange(cm, lineNo(line), "text"); }
|
5813 |
+
else if (cm) {
|
5814 |
+
if (span.to != null) { max = lineNo(line); }
|
5815 |
+
if (span.from != null) { min = lineNo(line); }
|
5816 |
+
}
|
5817 |
+
line.markedSpans = removeMarkedSpan(line.markedSpans, span);
|
5818 |
+
if (span.from == null && this$1.collapsed && !lineIsHidden(this$1.doc, line) && cm)
|
5819 |
+
{ updateLineHeight(line, textHeight(cm.display)); }
|
5820 |
+
}
|
5821 |
+
if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {
|
5822 |
+
var visual = visualLine(this$1.lines[i$1]), len = lineLength(visual);
|
5823 |
+
if (len > cm.display.maxLineLength) {
|
5824 |
+
cm.display.maxLine = visual;
|
5825 |
+
cm.display.maxLineLength = len;
|
5826 |
+
cm.display.maxLineChanged = true;
|
5827 |
+
}
|
5828 |
+
} }
|
5829 |
+
|
5830 |
+
if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }
|
5831 |
+
this.lines.length = 0;
|
5832 |
+
this.explicitlyCleared = true;
|
5833 |
+
if (this.atomic && this.doc.cantEdit) {
|
5834 |
+
this.doc.cantEdit = false;
|
5835 |
+
if (cm) { reCheckSelection(cm.doc); }
|
5836 |
+
}
|
5837 |
+
if (cm) { signalLater(cm, "markerCleared", cm, this, min, max); }
|
5838 |
+
if (withOp) { endOperation(cm); }
|
5839 |
+
if (this.parent) { this.parent.clear(); }
|
5840 |
+
};
|
5841 |
+
|
5842 |
+
// Find the position of the marker in the document. Returns a {from,
|
5843 |
+
// to} object by default. Side can be passed to get a specific side
|
5844 |
+
// -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the
|
5845 |
+
// Pos objects returned contain a line object, rather than a line
|
5846 |
+
// number (used to prevent looking up the same line twice).
|
5847 |
+
TextMarker.prototype.find = function (side, lineObj) {
|
5848 |
+
var this$1 = this;
|
5849 |
+
|
5850 |
+
if (side == null && this.type == "bookmark") { side = 1; }
|
5851 |
+
var from, to;
|
5852 |
+
for (var i = 0; i < this.lines.length; ++i) {
|
5853 |
+
var line = this$1.lines[i];
|
5854 |
+
var span = getMarkedSpanFor(line.markedSpans, this$1);
|
5855 |
+
if (span.from != null) {
|
5856 |
+
from = Pos(lineObj ? line : lineNo(line), span.from);
|
5857 |
+
if (side == -1) { return from }
|
5858 |
+
}
|
5859 |
+
if (span.to != null) {
|
5860 |
+
to = Pos(lineObj ? line : lineNo(line), span.to);
|
5861 |
+
if (side == 1) { return to }
|
5862 |
+
}
|
5863 |
+
}
|
5864 |
+
return from && {from: from, to: to}
|
5865 |
+
};
|
5866 |
+
|
5867 |
+
// Signals that the marker's widget changed, and surrounding layout
|
5868 |
+
// should be recomputed.
|
5869 |
+
TextMarker.prototype.changed = function () {
|
5870 |
+
var this$1 = this;
|
5871 |
+
|
5872 |
+
var pos = this.find(-1, true), widget = this, cm = this.doc.cm;
|
5873 |
+
if (!pos || !cm) { return }
|
5874 |
+
runInOp(cm, function () {
|
5875 |
+
var line = pos.line, lineN = lineNo(pos.line);
|
5876 |
+
var view = findViewForLine(cm, lineN);
|
5877 |
+
if (view) {
|
5878 |
+
clearLineMeasurementCacheFor(view);
|
5879 |
+
cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;
|
5880 |
+
}
|
5881 |
+
cm.curOp.updateMaxLine = true;
|
5882 |
+
if (!lineIsHidden(widget.doc, line) && widget.height != null) {
|
5883 |
+
var oldHeight = widget.height;
|
5884 |
+
widget.height = null;
|
5885 |
+
var dHeight = widgetHeight(widget) - oldHeight;
|
5886 |
+
if (dHeight)
|
5887 |
+
{ updateLineHeight(line, line.height + dHeight); }
|
5888 |
+
}
|
5889 |
+
signalLater(cm, "markerChanged", cm, this$1);
|
5890 |
+
});
|
5891 |
+
};
|
5892 |
+
|
5893 |
+
TextMarker.prototype.attachLine = function (line) {
|
5894 |
+
if (!this.lines.length && this.doc.cm) {
|
5895 |
+
var op = this.doc.cm.curOp;
|
5896 |
+
if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)
|
5897 |
+
{ (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }
|
5898 |
+
}
|
5899 |
+
this.lines.push(line);
|
5900 |
+
};
|
5901 |
+
|
5902 |
+
TextMarker.prototype.detachLine = function (line) {
|
5903 |
+
this.lines.splice(indexOf(this.lines, line), 1);
|
5904 |
+
if (!this.lines.length && this.doc.cm) {
|
5905 |
+
var op = this.doc.cm.curOp
|
5906 |
+
;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);
|
5907 |
+
}
|
5908 |
+
};
|
5909 |
+
eventMixin(TextMarker);
|
5910 |
+
|
5911 |
+
// Create a marker, wire it up to the right lines, and
|
5912 |
+
function markText(doc, from, to, options, type) {
|
5913 |
+
// Shared markers (across linked documents) are handled separately
|
5914 |
+
// (markTextShared will call out to this again, once per
|
5915 |
+
// document).
|
5916 |
+
if (options && options.shared) { return markTextShared(doc, from, to, options, type) }
|
5917 |
+
// Ensure we are in an operation.
|
5918 |
+
if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }
|
5919 |
+
|
5920 |
+
var marker = new TextMarker(doc, type), diff = cmp(from, to);
|
5921 |
+
if (options) { copyObj(options, marker, false); }
|
5922 |
+
// Don't connect empty markers unless clearWhenEmpty is false
|
5923 |
+
if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)
|
5924 |
+
{ return marker }
|
5925 |
+
if (marker.replacedWith) {
|
5926 |
+
// Showing up as a widget implies collapsed (widget replaces text)
|
5927 |
+
marker.collapsed = true;
|
5928 |
+
marker.widgetNode = eltP("span", [marker.replacedWith], "CodeMirror-widget");
|
5929 |
+
if (!options.handleMouseEvents) { marker.widgetNode.setAttribute("cm-ignore-events", "true"); }
|
5930 |
+
if (options.insertLeft) { marker.widgetNode.insertLeft = true; }
|
5931 |
+
}
|
5932 |
+
if (marker.collapsed) {
|
5933 |
+
if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||
|
5934 |
+
from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))
|
5935 |
+
{ throw new Error("Inserting collapsed marker partially overlapping an existing one") }
|
5936 |
+
seeCollapsedSpans();
|
5937 |
+
}
|
5938 |
+
|
5939 |
+
if (marker.addToHistory)
|
5940 |
+
{ addChangeToHistory(doc, {from: from, to: to, origin: "markText"}, doc.sel, NaN); }
|
5941 |
+
|
5942 |
+
var curLine = from.line, cm = doc.cm, updateMaxLine;
|
5943 |
+
doc.iter(curLine, to.line + 1, function (line) {
|
5944 |
+
if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)
|
5945 |
+
{ updateMaxLine = true; }
|
5946 |
+
if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }
|
5947 |
+
addMarkedSpan(line, new MarkedSpan(marker,
|
5948 |
+
curLine == from.line ? from.ch : null,
|
5949 |
+
curLine == to.line ? to.ch : null));
|
5950 |
+
++curLine;
|
5951 |
+
});
|
5952 |
+
// lineIsHidden depends on the presence of the spans, so needs a second pass
|
5953 |
+
if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {
|
5954 |
+
if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }
|
5955 |
+
}); }
|
5956 |
+
|
5957 |
+
if (marker.clearOnEnter) { on(marker, "beforeCursorEnter", function () { return marker.clear(); }); }
|
5958 |
+
|
5959 |
+
if (marker.readOnly) {
|
5960 |
+
seeReadOnlySpans();
|
5961 |
+
if (doc.history.done.length || doc.history.undone.length)
|
5962 |
+
{ doc.clearHistory(); }
|
5963 |
+
}
|
5964 |
+
if (marker.collapsed) {
|
5965 |
+
marker.id = ++nextMarkerId;
|
5966 |
+
marker.atomic = true;
|
5967 |
+
}
|
5968 |
+
if (cm) {
|
5969 |
+
// Sync editor state
|
5970 |
+
if (updateMaxLine) { cm.curOp.updateMaxLine = true; }
|
5971 |
+
if (marker.collapsed)
|
5972 |
+
{ regChange(cm, from.line, to.line + 1); }
|
5973 |
+
else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||
|
5974 |
+
marker.attributes || marker.title)
|
5975 |
+
{ for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, "text"); } }
|
5976 |
+
if (marker.atomic) { reCheckSelection(cm.doc); }
|
5977 |
+
signalLater(cm, "markerAdded", cm, marker);
|
5978 |
+
}
|
5979 |
+
return marker
|
5980 |
+
}
|
5981 |
+
|
5982 |
+
// SHARED TEXTMARKERS
|
5983 |
+
|
5984 |
+
// A shared marker spans multiple linked documents. It is
|
5985 |
+
// implemented as a meta-marker-object controlling multiple normal
|
5986 |
+
// markers.
|
5987 |
+
var SharedTextMarker = function(markers, primary) {
|
5988 |
+
var this$1 = this;
|
5989 |
+
|
5990 |
+
this.markers = markers;
|
5991 |
+
this.primary = primary;
|
5992 |
+
for (var i = 0; i < markers.length; ++i)
|
5993 |
+
{ markers[i].parent = this$1; }
|
5994 |
+
};
|
5995 |
+
|
5996 |
+
SharedTextMarker.prototype.clear = function () {
|
5997 |
+
var this$1 = this;
|
5998 |
+
|
5999 |
+
if (this.explicitlyCleared) { return }
|
6000 |
+
this.explicitlyCleared = true;
|
6001 |
+
for (var i = 0; i < this.markers.length; ++i)
|
6002 |
+
{ this$1.markers[i].clear(); }
|
6003 |
+
signalLater(this, "clear");
|
6004 |
+
};
|
6005 |
+
|
6006 |
+
SharedTextMarker.prototype.find = function (side, lineObj) {
|
6007 |
+
return this.primary.find(side, lineObj)
|
6008 |
+
};
|
6009 |
+
eventMixin(SharedTextMarker);
|
6010 |
+
|
6011 |
+
function markTextShared(doc, from, to, options, type) {
|
6012 |
+
options = copyObj(options);
|
6013 |
+
options.shared = false;
|
6014 |
+
var markers = [markText(doc, from, to, options, type)], primary = markers[0];
|
6015 |
+
var widget = options.widgetNode;
|
6016 |
+
linkedDocs(doc, function (doc) {
|
6017 |
+
if (widget) { options.widgetNode = widget.cloneNode(true); }
|
6018 |
+
markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));
|
6019 |
+
for (var i = 0; i < doc.linked.length; ++i)
|
6020 |
+
{ if (doc.linked[i].isParent) { return } }
|
6021 |
+
primary = lst(markers);
|
6022 |
+
});
|
6023 |
+
return new SharedTextMarker(markers, primary)
|
6024 |
+
}
|
6025 |
+
|
6026 |
+
function findSharedMarkers(doc) {
|
6027 |
+
return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })
|
6028 |
+
}
|
6029 |
+
|
6030 |
+
function copySharedMarkers(doc, markers) {
|
6031 |
+
for (var i = 0; i < markers.length; i++) {
|
6032 |
+
var marker = markers[i], pos = marker.find();
|
6033 |
+
var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);
|
6034 |
+
if (cmp(mFrom, mTo)) {
|
6035 |
+
var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);
|
6036 |
+
marker.markers.push(subMark);
|
6037 |
+
subMark.parent = marker;
|
6038 |
+
}
|
6039 |
+
}
|
6040 |
+
}
|
6041 |
+
|
6042 |
+
function detachSharedMarkers(markers) {
|
6043 |
+
var loop = function ( i ) {
|
6044 |
+
var marker = markers[i], linked = [marker.primary.doc];
|
6045 |
+
linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });
|
6046 |
+
for (var j = 0; j < marker.markers.length; j++) {
|
6047 |
+
var subMarker = marker.markers[j];
|
6048 |
+
if (indexOf(linked, subMarker.doc) == -1) {
|
6049 |
+
subMarker.parent = null;
|
6050 |
+
marker.markers.splice(j--, 1);
|
6051 |
+
}
|
6052 |
+
}
|
6053 |
+
};
|
6054 |
+
|
6055 |
+
for (var i = 0; i < markers.length; i++) loop( i );
|
6056 |
+
}
|
6057 |
+
|
6058 |
+
var nextDocId = 0;
|
6059 |
+
var Doc = function(text, mode, firstLine, lineSep, direction) {
|
6060 |
+
if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }
|
6061 |
+
if (firstLine == null) { firstLine = 0; }
|
6062 |
+
|
6063 |
+
BranchChunk.call(this, [new LeafChunk([new Line("", null)])]);
|
6064 |
+
this.first = firstLine;
|
6065 |
+
this.scrollTop = this.scrollLeft = 0;
|
6066 |
+
this.cantEdit = false;
|
6067 |
+
this.cleanGeneration = 1;
|
6068 |
+
this.modeFrontier = this.highlightFrontier = firstLine;
|
6069 |
+
var start = Pos(firstLine, 0);
|
6070 |
+
this.sel = simpleSelection(start);
|
6071 |
+
this.history = new History(null);
|
6072 |
+
this.id = ++nextDocId;
|
6073 |
+
this.modeOption = mode;
|
6074 |
+
this.lineSep = lineSep;
|
6075 |
+
this.direction = (direction == "rtl") ? "rtl" : "ltr";
|
6076 |
+
this.extend = false;
|
6077 |
+
|
6078 |
+
if (typeof text == "string") { text = this.splitLines(text); }
|
6079 |
+
updateDoc(this, {from: start, to: start, text: text});
|
6080 |
+
setSelection(this, simpleSelection(start), sel_dontScroll);
|
6081 |
+
};
|
6082 |
+
|
6083 |
+
Doc.prototype = createObj(BranchChunk.prototype, {
|
6084 |
+
constructor: Doc,
|
6085 |
+
// Iterate over the document. Supports two forms -- with only one
|
6086 |
+
// argument, it calls that for each line in the document. With
|
6087 |
+
// three, it iterates over the range given by the first two (with
|
6088 |
+
// the second being non-inclusive).
|
6089 |
+
iter: function(from, to, op) {
|
6090 |
+
if (op) { this.iterN(from - this.first, to - from, op); }
|
6091 |
+
else { this.iterN(this.first, this.first + this.size, from); }
|
6092 |
+
},
|
6093 |
+
|
6094 |
+
// Non-public interface for adding and removing lines.
|
6095 |
+
insert: function(at, lines) {
|
6096 |
+
var height = 0;
|
6097 |
+
for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }
|
6098 |
+
this.insertInner(at - this.first, lines, height);
|
6099 |
+
},
|
6100 |
+
remove: function(at, n) { this.removeInner(at - this.first, n); },
|
6101 |
+
|
6102 |
+
// From here, the methods are part of the public interface. Most
|
6103 |
+
// are also available from CodeMirror (editor) instances.
|
6104 |
+
|
6105 |
+
getValue: function(lineSep) {
|
6106 |
+
var lines = getLines(this, this.first, this.first + this.size);
|
6107 |
+
if (lineSep === false) { return lines }
|
6108 |
+
return lines.join(lineSep || this.lineSeparator())
|
6109 |
+
},
|
6110 |
+
setValue: docMethodOp(function(code) {
|
6111 |
+
var top = Pos(this.first, 0), last = this.first + this.size - 1;
|
6112 |
+
makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),
|
6113 |
+
text: this.splitLines(code), origin: "setValue", full: true}, true);
|
6114 |
+
if (this.cm) { scrollToCoords(this.cm, 0, 0); }
|
6115 |
+
setSelection(this, simpleSelection(top), sel_dontScroll);
|
6116 |
+
}),
|
6117 |
+
replaceRange: function(code, from, to, origin) {
|
6118 |
+
from = clipPos(this, from);
|
6119 |
+
to = to ? clipPos(this, to) : from;
|
6120 |
+
replaceRange(this, code, from, to, origin);
|
6121 |
+
},
|
6122 |
+
getRange: function(from, to, lineSep) {
|
6123 |
+
var lines = getBetween(this, clipPos(this, from), clipPos(this, to));
|
6124 |
+
if (lineSep === false) { return lines }
|
6125 |
+
return lines.join(lineSep || this.lineSeparator())
|
6126 |
+
},
|
6127 |
+
|
6128 |
+
getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},
|
6129 |
+
|
6130 |
+
getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},
|
6131 |
+
getLineNumber: function(line) {return lineNo(line)},
|
6132 |
+
|
6133 |
+
getLineHandleVisualStart: function(line) {
|
6134 |
+
if (typeof line == "number") { line = getLine(this, line); }
|
6135 |
+
return visualLine(line)
|
6136 |
+
},
|
6137 |
+
|
6138 |
+
lineCount: function() {return this.size},
|
6139 |
+
firstLine: function() {return this.first},
|
6140 |
+
lastLine: function() {return this.first + this.size - 1},
|
6141 |
+
|
6142 |
+
clipPos: function(pos) {return clipPos(this, pos)},
|
6143 |
+
|
6144 |
+
getCursor: function(start) {
|
6145 |
+
var range$$1 = this.sel.primary(), pos;
|
6146 |
+
if (start == null || start == "head") { pos = range$$1.head; }
|
6147 |
+
else if (start == "anchor") { pos = range$$1.anchor; }
|
6148 |
+
else if (start == "end" || start == "to" || start === false) { pos = range$$1.to(); }
|
6149 |
+
else { pos = range$$1.from(); }
|
6150 |
+
return pos
|
6151 |
+
},
|
6152 |
+
listSelections: function() { return this.sel.ranges },
|
6153 |
+
somethingSelected: function() {return this.sel.somethingSelected()},
|
6154 |
+
|
6155 |
+
setCursor: docMethodOp(function(line, ch, options) {
|
6156 |
+
setSimpleSelection(this, clipPos(this, typeof line == "number" ? Pos(line, ch || 0) : line), null, options);
|
6157 |
+
}),
|
6158 |
+
setSelection: docMethodOp(function(anchor, head, options) {
|
6159 |
+
setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);
|
6160 |
+
}),
|
6161 |
+
extendSelection: docMethodOp(function(head, other, options) {
|
6162 |
+
extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);
|
6163 |
+
}),
|
6164 |
+
extendSelections: docMethodOp(function(heads, options) {
|
6165 |
+
extendSelections(this, clipPosArray(this, heads), options);
|
6166 |
+
}),
|
6167 |
+
extendSelectionsBy: docMethodOp(function(f, options) {
|
6168 |
+
var heads = map(this.sel.ranges, f);
|
6169 |
+
extendSelections(this, clipPosArray(this, heads), options);
|
6170 |
+
}),
|
6171 |
+
setSelections: docMethodOp(function(ranges, primary, options) {
|
6172 |
+
var this$1 = this;
|
6173 |
+
|
6174 |
+
if (!ranges.length) { return }
|
6175 |
+
var out = [];
|
6176 |
+
for (var i = 0; i < ranges.length; i++)
|
6177 |
+
{ out[i] = new Range(clipPos(this$1, ranges[i].anchor),
|
6178 |
+
clipPos(this$1, ranges[i].head)); }
|
6179 |
+
if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }
|
6180 |
+
setSelection(this, normalizeSelection(this.cm, out, primary), options);
|
6181 |
+
}),
|
6182 |
+
addSelection: docMethodOp(function(anchor, head, options) {
|
6183 |
+
var ranges = this.sel.ranges.slice(0);
|
6184 |
+
ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));
|
6185 |
+
setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);
|
6186 |
+
}),
|
6187 |
+
|
6188 |
+
getSelection: function(lineSep) {
|
6189 |
+
var this$1 = this;
|
6190 |
+
|
6191 |
+
var ranges = this.sel.ranges, lines;
|
6192 |
+
for (var i = 0; i < ranges.length; i++) {
|
6193 |
+
var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
|
6194 |
+
lines = lines ? lines.concat(sel) : sel;
|
6195 |
+
}
|
6196 |
+
if (lineSep === false) { return lines }
|
6197 |
+
else { return lines.join(lineSep || this.lineSeparator()) }
|
6198 |
+
},
|
6199 |
+
getSelections: function(lineSep) {
|
6200 |
+
var this$1 = this;
|
6201 |
+
|
6202 |
+
var parts = [], ranges = this.sel.ranges;
|
6203 |
+
for (var i = 0; i < ranges.length; i++) {
|
6204 |
+
var sel = getBetween(this$1, ranges[i].from(), ranges[i].to());
|
6205 |
+
if (lineSep !== false) { sel = sel.join(lineSep || this$1.lineSeparator()); }
|
6206 |
+
parts[i] = sel;
|
6207 |
+
}
|
6208 |
+
return parts
|
6209 |
+
},
|
6210 |
+
replaceSelection: function(code, collapse, origin) {
|
6211 |
+
var dup = [];
|
6212 |
+
for (var i = 0; i < this.sel.ranges.length; i++)
|
6213 |
+
{ dup[i] = code; }
|
6214 |
+
this.replaceSelections(dup, collapse, origin || "+input");
|
6215 |
+
},
|
6216 |
+
replaceSelections: docMethodOp(function(code, collapse, origin) {
|
6217 |
+
var this$1 = this;
|
6218 |
+
|
6219 |
+
var changes = [], sel = this.sel;
|
6220 |
+
for (var i = 0; i < sel.ranges.length; i++) {
|
6221 |
+
var range$$1 = sel.ranges[i];
|
6222 |
+
changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this$1.splitLines(code[i]), origin: origin};
|
6223 |
+
}
|
6224 |
+
var newSel = collapse && collapse != "end" && computeReplacedSel(this, changes, collapse);
|
6225 |
+
for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)
|
6226 |
+
{ makeChange(this$1, changes[i$1]); }
|
6227 |
+
if (newSel) { setSelectionReplaceHistory(this, newSel); }
|
6228 |
+
else if (this.cm) { ensureCursorVisible(this.cm); }
|
6229 |
+
}),
|
6230 |
+
undo: docMethodOp(function() {makeChangeFromHistory(this, "undo");}),
|
6231 |
+
redo: docMethodOp(function() {makeChangeFromHistory(this, "redo");}),
|
6232 |
+
undoSelection: docMethodOp(function() {makeChangeFromHistory(this, "undo", true);}),
|
6233 |
+
redoSelection: docMethodOp(function() {makeChangeFromHistory(this, "redo", true);}),
|
6234 |
+
|
6235 |
+
setExtending: function(val) {this.extend = val;},
|
6236 |
+
getExtending: function() {return this.extend},
|
6237 |
+
|
6238 |
+
historySize: function() {
|
6239 |
+
var hist = this.history, done = 0, undone = 0;
|
6240 |
+
for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }
|
6241 |
+
for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }
|
6242 |
+
return {undo: done, redo: undone}
|
6243 |
+
},
|
6244 |
+
clearHistory: function() {this.history = new History(this.history.maxGeneration);},
|
6245 |
+
|
6246 |
+
markClean: function() {
|
6247 |
+
this.cleanGeneration = this.changeGeneration(true);
|
6248 |
+
},
|
6249 |
+
changeGeneration: function(forceSplit) {
|
6250 |
+
if (forceSplit)
|
6251 |
+
{ this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }
|
6252 |
+
return this.history.generation
|
6253 |
+
},
|
6254 |
+
isClean: function (gen) {
|
6255 |
+
return this.history.generation == (gen || this.cleanGeneration)
|
6256 |
+
},
|
6257 |
+
|
6258 |
+
getHistory: function() {
|
6259 |
+
return {done: copyHistoryArray(this.history.done),
|
6260 |
+
undone: copyHistoryArray(this.history.undone)}
|
6261 |
+
},
|
6262 |
+
setHistory: function(histData) {
|
6263 |
+
var hist = this.history = new History(this.history.maxGeneration);
|
6264 |
+
hist.done = copyHistoryArray(histData.done.slice(0), null, true);
|
6265 |
+
hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);
|
6266 |
+
},
|
6267 |
+
|
6268 |
+
setGutterMarker: docMethodOp(function(line, gutterID, value) {
|
6269 |
+
return changeLine(this, line, "gutter", function (line) {
|
6270 |
+
var markers = line.gutterMarkers || (line.gutterMarkers = {});
|
6271 |
+
markers[gutterID] = value;
|
6272 |
+
if (!value && isEmpty(markers)) { line.gutterMarkers = null; }
|
6273 |
+
return true
|
6274 |
+
})
|
6275 |
+
}),
|
6276 |
+
|
6277 |
+
clearGutter: docMethodOp(function(gutterID) {
|
6278 |
+
var this$1 = this;
|
6279 |
+
|
6280 |
+
this.iter(function (line) {
|
6281 |
+
if (line.gutterMarkers && line.gutterMarkers[gutterID]) {
|
6282 |
+
changeLine(this$1, line, "gutter", function () {
|
6283 |
+
line.gutterMarkers[gutterID] = null;
|
6284 |
+
if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }
|
6285 |
+
return true
|
6286 |
+
});
|
6287 |
+
}
|
6288 |
+
});
|
6289 |
+
}),
|
6290 |
+
|
6291 |
+
lineInfo: function(line) {
|
6292 |
+
var n;
|
6293 |
+
if (typeof line == "number") {
|
6294 |
+
if (!isLine(this, line)) { return null }
|
6295 |
+
n = line;
|
6296 |
+
line = getLine(this, line);
|
6297 |
+
if (!line) { return null }
|
6298 |
+
} else {
|
6299 |
+
n = lineNo(line);
|
6300 |
+
if (n == null) { return null }
|
6301 |
+
}
|
6302 |
+
return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,
|
6303 |
+
textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,
|
6304 |
+
widgets: line.widgets}
|
6305 |
+
},
|
6306 |
+
|
6307 |
+
addLineClass: docMethodOp(function(handle, where, cls) {
|
6308 |
+
return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
|
6309 |
+
var prop = where == "text" ? "textClass"
|
6310 |
+
: where == "background" ? "bgClass"
|
6311 |
+
: where == "gutter" ? "gutterClass" : "wrapClass";
|
6312 |
+
if (!line[prop]) { line[prop] = cls; }
|
6313 |
+
else if (classTest(cls).test(line[prop])) { return false }
|
6314 |
+
else { line[prop] += " " + cls; }
|
6315 |
+
return true
|
6316 |
+
})
|
6317 |
+
}),
|
6318 |
+
removeLineClass: docMethodOp(function(handle, where, cls) {
|
6319 |
+
return changeLine(this, handle, where == "gutter" ? "gutter" : "class", function (line) {
|
6320 |
+
var prop = where == "text" ? "textClass"
|
6321 |
+
: where == "background" ? "bgClass"
|
6322 |
+
: where == "gutter" ? "gutterClass" : "wrapClass";
|
6323 |
+
var cur = line[prop];
|
6324 |
+
if (!cur) { return false }
|
6325 |
+
else if (cls == null) { line[prop] = null; }
|
6326 |
+
else {
|
6327 |
+
var found = cur.match(classTest(cls));
|
6328 |
+
if (!found) { return false }
|
6329 |
+
var end = found.index + found[0].length;
|
6330 |
+
line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? "" : " ") + cur.slice(end) || null;
|
6331 |
+
}
|
6332 |
+
return true
|
6333 |
+
})
|
6334 |
+
}),
|
6335 |
+
|
6336 |
+
addLineWidget: docMethodOp(function(handle, node, options) {
|
6337 |
+
return addLineWidget(this, handle, node, options)
|
6338 |
+
}),
|
6339 |
+
removeLineWidget: function(widget) { widget.clear(); },
|
6340 |
+
|
6341 |
+
markText: function(from, to, options) {
|
6342 |
+
return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || "range")
|
6343 |
+
},
|
6344 |
+
setBookmark: function(pos, options) {
|
6345 |
+
var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),
|
6346 |
+
insertLeft: options && options.insertLeft,
|
6347 |
+
clearWhenEmpty: false, shared: options && options.shared,
|
6348 |
+
handleMouseEvents: options && options.handleMouseEvents};
|
6349 |
+
pos = clipPos(this, pos);
|
6350 |
+
return markText(this, pos, pos, realOpts, "bookmark")
|
6351 |
+
},
|
6352 |
+
findMarksAt: function(pos) {
|
6353 |
+
pos = clipPos(this, pos);
|
6354 |
+
var markers = [], spans = getLine(this, pos.line).markedSpans;
|
6355 |
+
if (spans) { for (var i = 0; i < spans.length; ++i) {
|
6356 |
+
var span = spans[i];
|
6357 |
+
if ((span.from == null || span.from <= pos.ch) &&
|
6358 |
+
(span.to == null || span.to >= pos.ch))
|
6359 |
+
{ markers.push(span.marker.parent || span.marker); }
|
6360 |
+
} }
|
6361 |
+
return markers
|
6362 |
+
},
|
6363 |
+
findMarks: function(from, to, filter) {
|
6364 |
+
from = clipPos(this, from); to = clipPos(this, to);
|
6365 |
+
var found = [], lineNo$$1 = from.line;
|
6366 |
+
this.iter(from.line, to.line + 1, function (line) {
|
6367 |
+
var spans = line.markedSpans;
|
6368 |
+
if (spans) { for (var i = 0; i < spans.length; i++) {
|
6369 |
+
var span = spans[i];
|
6370 |
+
if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||
|
6371 |
+
span.from == null && lineNo$$1 != from.line ||
|
6372 |
+
span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&
|
6373 |
+
(!filter || filter(span.marker)))
|
6374 |
+
{ found.push(span.marker.parent || span.marker); }
|
6375 |
+
} }
|
6376 |
+
++lineNo$$1;
|
6377 |
+
});
|
6378 |
+
return found
|
6379 |
+
},
|
6380 |
+
getAllMarks: function() {
|
6381 |
+
var markers = [];
|
6382 |
+
this.iter(function (line) {
|
6383 |
+
var sps = line.markedSpans;
|
6384 |
+
if (sps) { for (var i = 0; i < sps.length; ++i)
|
6385 |
+
{ if (sps[i].from != null) { markers.push(sps[i].marker); } } }
|
6386 |
+
});
|
6387 |
+
return markers
|
6388 |
+
},
|
6389 |
+
|
6390 |
+
posFromIndex: function(off) {
|
6391 |
+
var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;
|
6392 |
+
this.iter(function (line) {
|
6393 |
+
var sz = line.text.length + sepSize;
|
6394 |
+
if (sz > off) { ch = off; return true }
|
6395 |
+
off -= sz;
|
6396 |
+
++lineNo$$1;
|
6397 |
+
});
|
6398 |
+
return clipPos(this, Pos(lineNo$$1, ch))
|
6399 |
+
},
|
6400 |
+
indexFromPos: function (coords) {
|
6401 |
+
coords = clipPos(this, coords);
|
6402 |
+
var index = coords.ch;
|
6403 |
+
if (coords.line < this.first || coords.ch < 0) { return 0 }
|
6404 |
+
var sepSize = this.lineSeparator().length;
|
6405 |
+
this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value
|
6406 |
+
index += line.text.length + sepSize;
|
6407 |
+
});
|
6408 |
+
return index
|
6409 |
+
},
|
6410 |
+
|
6411 |
+
copy: function(copyHistory) {
|
6412 |
+
var doc = new Doc(getLines(this, this.first, this.first + this.size),
|
6413 |
+
this.modeOption, this.first, this.lineSep, this.direction);
|
6414 |
+
doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;
|
6415 |
+
doc.sel = this.sel;
|
6416 |
+
doc.extend = false;
|
6417 |
+
if (copyHistory) {
|
6418 |
+
doc.history.undoDepth = this.history.undoDepth;
|
6419 |
+
doc.setHistory(this.getHistory());
|
6420 |
+
}
|
6421 |
+
return doc
|
6422 |
+
},
|
6423 |
+
|
6424 |
+
linkedDoc: function(options) {
|
6425 |
+
if (!options) { options = {}; }
|
6426 |
+
var from = this.first, to = this.first + this.size;
|
6427 |
+
if (options.from != null && options.from > from) { from = options.from; }
|
6428 |
+
if (options.to != null && options.to < to) { to = options.to; }
|
6429 |
+
var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);
|
6430 |
+
if (options.sharedHist) { copy.history = this.history
|
6431 |
+
; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});
|
6432 |
+
copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];
|
6433 |
+
copySharedMarkers(copy, findSharedMarkers(this));
|
6434 |
+
return copy
|
6435 |
+
},
|
6436 |
+
unlinkDoc: function(other) {
|
6437 |
+
var this$1 = this;
|
6438 |
+
|
6439 |
+
if (other instanceof CodeMirror) { other = other.doc; }
|
6440 |
+
if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {
|
6441 |
+
var link = this$1.linked[i];
|
6442 |
+
if (link.doc != other) { continue }
|
6443 |
+
this$1.linked.splice(i, 1);
|
6444 |
+
other.unlinkDoc(this$1);
|
6445 |
+
detachSharedMarkers(findSharedMarkers(this$1));
|
6446 |
+
break
|
6447 |
+
} }
|
6448 |
+
// If the histories were shared, split them again
|
6449 |
+
if (other.history == this.history) {
|
6450 |
+
var splitIds = [other.id];
|
6451 |
+
linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);
|
6452 |
+
other.history = new History(null);
|
6453 |
+
other.history.done = copyHistoryArray(this.history.done, splitIds);
|
6454 |
+
other.history.undone = copyHistoryArray(this.history.undone, splitIds);
|
6455 |
+
}
|
6456 |
+
},
|
6457 |
+
iterLinkedDocs: function(f) {linkedDocs(this, f);},
|
6458 |
+
|
6459 |
+
getMode: function() {return this.mode},
|
6460 |
+
getEditor: function() {return this.cm},
|
6461 |
+
|
6462 |
+
splitLines: function(str) {
|
6463 |
+
if (this.lineSep) { return str.split(this.lineSep) }
|
6464 |
+
return splitLinesAuto(str)
|
6465 |
+
},
|
6466 |
+
lineSeparator: function() { return this.lineSep || "\n" },
|
6467 |
+
|
6468 |
+
setDirection: docMethodOp(function (dir) {
|
6469 |
+
if (dir != "rtl") { dir = "ltr"; }
|
6470 |
+
if (dir == this.direction) { return }
|
6471 |
+
this.direction = dir;
|
6472 |
+
this.iter(function (line) { return line.order = null; });
|
6473 |
+
if (this.cm) { directionChanged(this.cm); }
|
6474 |
+
})
|
6475 |
+
});
|
6476 |
+
|
6477 |
+
// Public alias.
|
6478 |
+
Doc.prototype.eachLine = Doc.prototype.iter;
|
6479 |
+
|
6480 |
+
// Kludge to work around strange IE behavior where it'll sometimes
|
6481 |
+
// re-fire a series of drag-related events right after the drop (#1551)
|
6482 |
+
var lastDrop = 0;
|
6483 |
+
|
6484 |
+
function onDrop(e) {
|
6485 |
+
var cm = this;
|
6486 |
+
clearDragCursor(cm);
|
6487 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))
|
6488 |
+
{ return }
|
6489 |
+
e_preventDefault(e);
|
6490 |
+
if (ie) { lastDrop = +new Date; }
|
6491 |
+
var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;
|
6492 |
+
if (!pos || cm.isReadOnly()) { return }
|
6493 |
+
// Might be a file drop, in which case we simply extract the text
|
6494 |
+
// and insert it.
|
6495 |
+
if (files && files.length && window.FileReader && window.File) {
|
6496 |
+
var n = files.length, text = Array(n), read = 0;
|
6497 |
+
var loadFile = function (file, i) {
|
6498 |
+
if (cm.options.allowDropFileTypes &&
|
6499 |
+
indexOf(cm.options.allowDropFileTypes, file.type) == -1)
|
6500 |
+
{ return }
|
6501 |
+
|
6502 |
+
var reader = new FileReader;
|
6503 |
+
reader.onload = operation(cm, function () {
|
6504 |
+
var content = reader.result;
|
6505 |
+
if (/[\x00-\x08\x0e-\x1f]{2}/.test(content)) { content = ""; }
|
6506 |
+
text[i] = content;
|
6507 |
+
if (++read == n) {
|
6508 |
+
pos = clipPos(cm.doc, pos);
|
6509 |
+
var change = {from: pos, to: pos,
|
6510 |
+
text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),
|
6511 |
+
origin: "paste"};
|
6512 |
+
makeChange(cm.doc, change);
|
6513 |
+
setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));
|
6514 |
+
}
|
6515 |
+
});
|
6516 |
+
reader.readAsText(file);
|
6517 |
+
};
|
6518 |
+
for (var i = 0; i < n; ++i) { loadFile(files[i], i); }
|
6519 |
+
} else { // Normal drop
|
6520 |
+
// Don't do a replace if the drop happened inside of the selected text.
|
6521 |
+
if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {
|
6522 |
+
cm.state.draggingText(e);
|
6523 |
+
// Ensure the editor is re-focused
|
6524 |
+
setTimeout(function () { return cm.display.input.focus(); }, 20);
|
6525 |
+
return
|
6526 |
+
}
|
6527 |
+
try {
|
6528 |
+
var text$1 = e.dataTransfer.getData("Text");
|
6529 |
+
if (text$1) {
|
6530 |
+
var selected;
|
6531 |
+
if (cm.state.draggingText && !cm.state.draggingText.copy)
|
6532 |
+
{ selected = cm.listSelections(); }
|
6533 |
+
setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));
|
6534 |
+
if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)
|
6535 |
+
{ replaceRange(cm.doc, "", selected[i$1].anchor, selected[i$1].head, "drag"); } }
|
6536 |
+
cm.replaceSelection(text$1, "around", "paste");
|
6537 |
+
cm.display.input.focus();
|
6538 |
}
|
6539 |
+
}
|
6540 |
+
catch(e){}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6541 |
}
|
6542 |
+
}
|
6543 |
+
|
6544 |
+
function onDragStart(cm, e) {
|
6545 |
+
if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }
|
6546 |
+
if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }
|
6547 |
+
|
6548 |
+
e.dataTransfer.setData("Text", cm.getSelection());
|
6549 |
+
e.dataTransfer.effectAllowed = "copyMove";
|
6550 |
+
|
6551 |
+
// Use dummy image instead of default browsers image.
|
6552 |
+
// Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.
|
6553 |
+
if (e.dataTransfer.setDragImage && !safari) {
|
6554 |
+
var img = elt("img", null, null, "position: fixed; left: 0; top: 0;");
|
6555 |
+
img.src = "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==";
|
6556 |
+
if (presto) {
|
6557 |
+
img.width = img.height = 1;
|
6558 |
+
cm.display.wrapper.appendChild(img);
|
6559 |
+
// Force a relayout, or Opera won't use our image for some obscure reason
|
6560 |
+
img._top = img.offsetTop;
|
6561 |
+
}
|
6562 |
+
e.dataTransfer.setDragImage(img, 0, 0);
|
6563 |
+
if (presto) { img.parentNode.removeChild(img); }
|
6564 |
+
}
|
6565 |
+
}
|
6566 |
+
|
6567 |
+
function onDragOver(cm, e) {
|
6568 |
+
var pos = posFromMouse(cm, e);
|
6569 |
+
if (!pos) { return }
|
6570 |
+
var frag = document.createDocumentFragment();
|
6571 |
+
drawSelectionCursor(cm, pos, frag);
|
6572 |
+
if (!cm.display.dragCursor) {
|
6573 |
+
cm.display.dragCursor = elt("div", null, "CodeMirror-cursors CodeMirror-dragcursors");
|
6574 |
+
cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);
|
6575 |
+
}
|
6576 |
+
removeChildrenAndAdd(cm.display.dragCursor, frag);
|
6577 |
+
}
|
6578 |
+
|
6579 |
+
function clearDragCursor(cm) {
|
6580 |
+
if (cm.display.dragCursor) {
|
6581 |
+
cm.display.lineSpace.removeChild(cm.display.dragCursor);
|
6582 |
+
cm.display.dragCursor = null;
|
6583 |
+
}
|
6584 |
+
}
|
6585 |
+
|
6586 |
+
// These must be handled carefully, because naively registering a
|
6587 |
+
// handler for each editor will cause the editors to never be
|
6588 |
+
// garbage collected.
|
6589 |
+
|
6590 |
+
function forEachCodeMirror(f) {
|
6591 |
+
if (!document.getElementsByClassName) { return }
|
6592 |
+
var byClass = document.getElementsByClassName("CodeMirror"), editors = [];
|
6593 |
+
for (var i = 0; i < byClass.length; i++) {
|
6594 |
+
var cm = byClass[i].CodeMirror;
|
6595 |
+
if (cm) { editors.push(cm); }
|
6596 |
+
}
|
6597 |
+
if (editors.length) { editors[0].operation(function () {
|
6598 |
+
for (var i = 0; i < editors.length; i++) { f(editors[i]); }
|
6599 |
+
}); }
|
6600 |
+
}
|
6601 |
+
|
6602 |
+
var globalsRegistered = false;
|
6603 |
+
function ensureGlobalHandlers() {
|
6604 |
+
if (globalsRegistered) { return }
|
6605 |
+
registerGlobalHandlers();
|
6606 |
+
globalsRegistered = true;
|
6607 |
+
}
|
6608 |
+
function registerGlobalHandlers() {
|
6609 |
+
// When the window resizes, we need to refresh active editors.
|
6610 |
+
var resizeTimer;
|
6611 |
+
on(window, "resize", function () {
|
6612 |
+
if (resizeTimer == null) { resizeTimer = setTimeout(function () {
|
6613 |
+
resizeTimer = null;
|
6614 |
+
forEachCodeMirror(onResize);
|
6615 |
+
}, 100); }
|
6616 |
+
});
|
6617 |
+
// When the window loses focus, we want to show the editor as blurred
|
6618 |
+
on(window, "blur", function () { return forEachCodeMirror(onBlur); });
|
6619 |
+
}
|
6620 |
+
// Called when the window resizes
|
6621 |
+
function onResize(cm) {
|
6622 |
+
var d = cm.display;
|
6623 |
+
// Might be a text scaling operation, clear size caches.
|
6624 |
+
d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;
|
6625 |
+
d.scrollbarsClipped = false;
|
6626 |
+
cm.setSize();
|
6627 |
+
}
|
6628 |
+
|
6629 |
+
var keyNames = {
|
6630 |
+
3: "Pause", 8: "Backspace", 9: "Tab", 13: "Enter", 16: "Shift", 17: "Ctrl", 18: "Alt",
|
6631 |
+
19: "Pause", 20: "CapsLock", 27: "Esc", 32: "Space", 33: "PageUp", 34: "PageDown", 35: "End",
|
6632 |
+
36: "Home", 37: "Left", 38: "Up", 39: "Right", 40: "Down", 44: "PrintScrn", 45: "Insert",
|
6633 |
+
46: "Delete", 59: ";", 61: "=", 91: "Mod", 92: "Mod", 93: "Mod",
|
6634 |
+
106: "*", 107: "=", 109: "-", 110: ".", 111: "/", 127: "Delete", 145: "ScrollLock",
|
6635 |
+
173: "-", 186: ";", 187: "=", 188: ",", 189: "-", 190: ".", 191: "/", 192: "`", 219: "[", 220: "\\",
|
6636 |
+
221: "]", 222: "'", 63232: "Up", 63233: "Down", 63234: "Left", 63235: "Right", 63272: "Delete",
|
6637 |
+
63273: "Home", 63275: "End", 63276: "PageUp", 63277: "PageDown", 63302: "Insert"
|
6638 |
+
};
|
6639 |
+
|
6640 |
+
// Number keys
|
6641 |
+
for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }
|
6642 |
+
// Alphabetic keys
|
6643 |
+
for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }
|
6644 |
+
// Function keys
|
6645 |
+
for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = "F" + i$2; }
|
6646 |
+
|
6647 |
+
var keyMap = {};
|
6648 |
+
|
6649 |
+
keyMap.basic = {
|
6650 |
+
"Left": "goCharLeft", "Right": "goCharRight", "Up": "goLineUp", "Down": "goLineDown",
|
6651 |
+
"End": "goLineEnd", "Home": "goLineStartSmart", "PageUp": "goPageUp", "PageDown": "goPageDown",
|
6652 |
+
"Delete": "delCharAfter", "Backspace": "delCharBefore", "Shift-Backspace": "delCharBefore",
|
6653 |
+
"Tab": "defaultTab", "Shift-Tab": "indentAuto",
|
6654 |
+
"Enter": "newlineAndIndent", "Insert": "toggleOverwrite",
|
6655 |
+
"Esc": "singleSelection"
|
6656 |
+
};
|
6657 |
+
// Note that the save and find-related commands aren't defined by
|
6658 |
+
// default. User code or addons can define them. Unknown commands
|
6659 |
+
// are simply ignored.
|
6660 |
+
keyMap.pcDefault = {
|
6661 |
+
"Ctrl-A": "selectAll", "Ctrl-D": "deleteLine", "Ctrl-Z": "undo", "Shift-Ctrl-Z": "redo", "Ctrl-Y": "redo",
|
6662 |
+
"Ctrl-Home": "goDocStart", "Ctrl-End": "goDocEnd", "Ctrl-Up": "goLineUp", "Ctrl-Down": "goLineDown",
|
6663 |
+
"Ctrl-Left": "goGroupLeft", "Ctrl-Right": "goGroupRight", "Alt-Left": "goLineStart", "Alt-Right": "goLineEnd",
|
6664 |
+
"Ctrl-Backspace": "delGroupBefore", "Ctrl-Delete": "delGroupAfter", "Ctrl-S": "save", "Ctrl-F": "find",
|
6665 |
+
"Ctrl-G": "findNext", "Shift-Ctrl-G": "findPrev", "Shift-Ctrl-F": "replace", "Shift-Ctrl-R": "replaceAll",
|
6666 |
+
"Ctrl-[": "indentLess", "Ctrl-]": "indentMore",
|
6667 |
+
"Ctrl-U": "undoSelection", "Shift-Ctrl-U": "redoSelection", "Alt-U": "redoSelection",
|
6668 |
+
"fallthrough": "basic"
|
6669 |
+
};
|
6670 |
+
// Very basic readline/emacs-style bindings, which are standard on Mac.
|
6671 |
+
keyMap.emacsy = {
|
6672 |
+
"Ctrl-F": "goCharRight", "Ctrl-B": "goCharLeft", "Ctrl-P": "goLineUp", "Ctrl-N": "goLineDown",
|
6673 |
+
"Alt-F": "goWordRight", "Alt-B": "goWordLeft", "Ctrl-A": "goLineStart", "Ctrl-E": "goLineEnd",
|
6674 |
+
"Ctrl-V": "goPageDown", "Shift-Ctrl-V": "goPageUp", "Ctrl-D": "delCharAfter", "Ctrl-H": "delCharBefore",
|
6675 |
+
"Alt-D": "delWordAfter", "Alt-Backspace": "delWordBefore", "Ctrl-K": "killLine", "Ctrl-T": "transposeChars",
|
6676 |
+
"Ctrl-O": "openLine"
|
6677 |
+
};
|
6678 |
+
keyMap.macDefault = {
|
6679 |
+
"Cmd-A": "selectAll", "Cmd-D": "deleteLine", "Cmd-Z": "undo", "Shift-Cmd-Z": "redo", "Cmd-Y": "redo",
|
6680 |
+
"Cmd-Home": "goDocStart", "Cmd-Up": "goDocStart", "Cmd-End": "goDocEnd", "Cmd-Down": "goDocEnd", "Alt-Left": "goGroupLeft",
|
6681 |
+
"Alt-Right": "goGroupRight", "Cmd-Left": "goLineLeft", "Cmd-Right": "goLineRight", "Alt-Backspace": "delGroupBefore",
|
6682 |
+
"Ctrl-Alt-Backspace": "delGroupAfter", "Alt-Delete": "delGroupAfter", "Cmd-S": "save", "Cmd-F": "find",
|
6683 |
+
"Cmd-G": "findNext", "Shift-Cmd-G": "findPrev", "Cmd-Alt-F": "replace", "Shift-Cmd-Alt-F": "replaceAll",
|
6684 |
+
"Cmd-[": "indentLess", "Cmd-]": "indentMore", "Cmd-Backspace": "delWrappedLineLeft", "Cmd-Delete": "delWrappedLineRight",
|
6685 |
+
"Cmd-U": "undoSelection", "Shift-Cmd-U": "redoSelection", "Ctrl-Up": "goDocStart", "Ctrl-Down": "goDocEnd",
|
6686 |
+
"fallthrough": ["basic", "emacsy"]
|
6687 |
+
};
|
6688 |
+
keyMap["default"] = mac ? keyMap.macDefault : keyMap.pcDefault;
|
6689 |
+
|
6690 |
+
// KEYMAP DISPATCH
|
6691 |
+
|
6692 |
+
function normalizeKeyName(name) {
|
6693 |
+
var parts = name.split(/-(?!$)/);
|
6694 |
+
name = parts[parts.length - 1];
|
6695 |
+
var alt, ctrl, shift, cmd;
|
6696 |
+
for (var i = 0; i < parts.length - 1; i++) {
|
6697 |
+
var mod = parts[i];
|
6698 |
+
if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }
|
6699 |
+
else if (/^a(lt)?$/i.test(mod)) { alt = true; }
|
6700 |
+
else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }
|
6701 |
+
else if (/^s(hift)?$/i.test(mod)) { shift = true; }
|
6702 |
+
else { throw new Error("Unrecognized modifier name: " + mod) }
|
6703 |
+
}
|
6704 |
+
if (alt) { name = "Alt-" + name; }
|
6705 |
+
if (ctrl) { name = "Ctrl-" + name; }
|
6706 |
+
if (cmd) { name = "Cmd-" + name; }
|
6707 |
+
if (shift) { name = "Shift-" + name; }
|
6708 |
+
return name
|
6709 |
+
}
|
6710 |
+
|
6711 |
+
// This is a kludge to keep keymaps mostly working as raw objects
|
6712 |
+
// (backwards compatibility) while at the same time support features
|
6713 |
+
// like normalization and multi-stroke key bindings. It compiles a
|
6714 |
+
// new normalized keymap, and then updates the old object to reflect
|
6715 |
+
// this.
|
6716 |
+
function normalizeKeyMap(keymap) {
|
6717 |
+
var copy = {};
|
6718 |
+
for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {
|
6719 |
+
var value = keymap[keyname];
|
6720 |
+
if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }
|
6721 |
+
if (value == "...") { delete keymap[keyname]; continue }
|
6722 |
+
|
6723 |
+
var keys = map(keyname.split(" "), normalizeKeyName);
|
6724 |
+
for (var i = 0; i < keys.length; i++) {
|
6725 |
+
var val = (void 0), name = (void 0);
|
6726 |
+
if (i == keys.length - 1) {
|
6727 |
+
name = keys.join(" ");
|
6728 |
+
val = value;
|
6729 |
+
} else {
|
6730 |
+
name = keys.slice(0, i + 1).join(" ");
|
6731 |
+
val = "...";
|
6732 |
+
}
|
6733 |
+
var prev = copy[name];
|
6734 |
+
if (!prev) { copy[name] = val; }
|
6735 |
+
else if (prev != val) { throw new Error("Inconsistent bindings for " + name) }
|
6736 |
+
}
|
6737 |
+
delete keymap[keyname];
|
6738 |
+
} }
|
6739 |
+
for (var prop in copy) { keymap[prop] = copy[prop]; }
|
6740 |
+
return keymap
|
6741 |
+
}
|
6742 |
+
|
6743 |
+
function lookupKey(key, map$$1, handle, context) {
|
6744 |
+
map$$1 = getKeyMap(map$$1);
|
6745 |
+
var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];
|
6746 |
+
if (found === false) { return "nothing" }
|
6747 |
+
if (found === "...") { return "multi" }
|
6748 |
+
if (found != null && handle(found)) { return "handled" }
|
6749 |
+
|
6750 |
+
if (map$$1.fallthrough) {
|
6751 |
+
if (Object.prototype.toString.call(map$$1.fallthrough) != "[object Array]")
|
6752 |
+
{ return lookupKey(key, map$$1.fallthrough, handle, context) }
|
6753 |
+
for (var i = 0; i < map$$1.fallthrough.length; i++) {
|
6754 |
+
var result = lookupKey(key, map$$1.fallthrough[i], handle, context);
|
6755 |
+
if (result) { return result }
|
6756 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6757 |
}
|
6758 |
}
|
6759 |
+
|
6760 |
+
// Modifier key presses don't count as 'real' key presses for the
|
6761 |
+
// purpose of keymap fallthrough.
|
6762 |
+
function isModifierKey(value) {
|
6763 |
+
var name = typeof value == "string" ? value : keyNames[value.keyCode];
|
6764 |
+
return name == "Ctrl" || name == "Alt" || name == "Shift" || name == "Mod"
|
6765 |
+
}
|
6766 |
+
|
6767 |
+
function addModifierNames(name, event, noShift) {
|
6768 |
+
var base = name;
|
6769 |
+
if (event.altKey && base != "Alt") { name = "Alt-" + name; }
|
6770 |
+
if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != "Ctrl") { name = "Ctrl-" + name; }
|
6771 |
+
if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != "Cmd") { name = "Cmd-" + name; }
|
6772 |
+
if (!noShift && event.shiftKey && base != "Shift") { name = "Shift-" + name; }
|
6773 |
+
return name
|
6774 |
+
}
|
6775 |
+
|
6776 |
+
// Look up the name of a key as indicated by an event object.
|
6777 |
+
function keyName(event, noShift) {
|
6778 |
+
if (presto && event.keyCode == 34 && event["char"]) { return false }
|
6779 |
+
var name = keyNames[event.keyCode];
|
6780 |
+
if (name == null || event.altGraphKey) { return false }
|
6781 |
+
// Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,
|
6782 |
+
// so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)
|
6783 |
+
if (event.keyCode == 3 && event.code) { name = event.code; }
|
6784 |
+
return addModifierNames(name, event, noShift)
|
6785 |
+
}
|
6786 |
+
|
6787 |
+
function getKeyMap(val) {
|
6788 |
+
return typeof val == "string" ? keyMap[val] : val
|
6789 |
+
}
|
6790 |
+
|
6791 |
+
// Helper for deleting text near the selection(s), used to implement
|
6792 |
+
// backspace, delete, and similar functionality.
|
6793 |
+
function deleteNearSelection(cm, compute) {
|
6794 |
+
var ranges = cm.doc.sel.ranges, kill = [];
|
6795 |
+
// Build up a set of ranges to kill first, merging overlapping
|
6796 |
+
// ranges.
|
6797 |
+
for (var i = 0; i < ranges.length; i++) {
|
6798 |
+
var toKill = compute(ranges[i]);
|
6799 |
+
while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {
|
6800 |
+
var replaced = kill.pop();
|
6801 |
+
if (cmp(replaced.from, toKill.from) < 0) {
|
6802 |
+
toKill.from = replaced.from;
|
6803 |
+
break
|
6804 |
+
}
|
6805 |
}
|
6806 |
+
kill.push(toKill);
|
6807 |
}
|
6808 |
+
// Next, remove those actual ranges.
|
6809 |
+
runInOp(cm, function () {
|
6810 |
+
for (var i = kill.length - 1; i >= 0; i--)
|
6811 |
+
{ replaceRange(cm.doc, "", kill[i].from, kill[i].to, "+delete"); }
|
6812 |
+
ensureCursorVisible(cm);
|
6813 |
+
});
|
6814 |
+
}
|
6815 |
+
|
6816 |
+
function moveCharLogically(line, ch, dir) {
|
6817 |
+
var target = skipExtendingChars(line.text, ch + dir, dir);
|
6818 |
+
return target < 0 || target > line.text.length ? null : target
|
6819 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6820 |
|
6821 |
+
function moveLogically(line, start, dir) {
|
6822 |
+
var ch = moveCharLogically(line, start.ch, dir);
|
6823 |
+
return ch == null ? null : new Pos(start.line, ch, dir < 0 ? "after" : "before")
|
6824 |
+
}
|
6825 |
+
|
6826 |
+
function endOfLine(visually, cm, lineObj, lineNo, dir) {
|
6827 |
+
if (visually) {
|
6828 |
+
var order = getOrder(lineObj, cm.doc.direction);
|
6829 |
+
if (order) {
|
6830 |
+
var part = dir < 0 ? lst(order) : order[0];
|
6831 |
+
var moveInStorageOrder = (dir < 0) == (part.level == 1);
|
6832 |
+
var sticky = moveInStorageOrder ? "after" : "before";
|
6833 |
+
var ch;
|
6834 |
+
// With a wrapped rtl chunk (possibly spanning multiple bidi parts),
|
6835 |
+
// it could be that the last bidi part is not on the last visual line,
|
6836 |
+
// since visual lines contain content order-consecutive chunks.
|
6837 |
+
// Thus, in rtl, we are looking for the first (content-order) character
|
6838 |
+
// in the rtl chunk that is on the last line (that is, the same line
|
6839 |
+
// as the last (content-order) character).
|
6840 |
+
if (part.level > 0 || cm.doc.direction == "rtl") {
|
6841 |
+
var prep = prepareMeasureForLine(cm, lineObj);
|
6842 |
+
ch = dir < 0 ? lineObj.text.length - 1 : 0;
|
6843 |
+
var targetTop = measureCharPrepared(cm, prep, ch).top;
|
6844 |
+
ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);
|
6845 |
+
if (sticky == "before") { ch = moveCharLogically(lineObj, ch, 1); }
|
6846 |
+
} else { ch = dir < 0 ? part.to : part.from; }
|
6847 |
+
return new Pos(lineNo, ch, sticky)
|
6848 |
+
}
|
6849 |
+
}
|
6850 |
+
return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? "before" : "after")
|
6851 |
+
}
|
6852 |
+
|
6853 |
+
function moveVisually(cm, line, start, dir) {
|
6854 |
+
var bidi = getOrder(line, cm.doc.direction);
|
6855 |
+
if (!bidi) { return moveLogically(line, start, dir) }
|
6856 |
+
if (start.ch >= line.text.length) {
|
6857 |
+
start.ch = line.text.length;
|
6858 |
+
start.sticky = "before";
|
6859 |
+
} else if (start.ch <= 0) {
|
6860 |
+
start.ch = 0;
|
6861 |
+
start.sticky = "after";
|
6862 |
+
}
|
6863 |
+
var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];
|
6864 |
+
if (cm.doc.direction == "ltr" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {
|
6865 |
+
// Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,
|
6866 |
+
// nothing interesting happens.
|
6867 |
+
return moveLogically(line, start, dir)
|
6868 |
+
}
|
6869 |
+
|
6870 |
+
var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };
|
6871 |
+
var prep;
|
6872 |
+
var getWrappedLineExtent = function (ch) {
|
6873 |
+
if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }
|
6874 |
+
prep = prep || prepareMeasureForLine(cm, line);
|
6875 |
+
return wrappedLineExtentChar(cm, line, prep, ch)
|
6876 |
+
};
|
6877 |
+
var wrappedLineExtent = getWrappedLineExtent(start.sticky == "before" ? mv(start, -1) : start.ch);
|
6878 |
+
|
6879 |
+
if (cm.doc.direction == "rtl" || part.level == 1) {
|
6880 |
+
var moveInStorageOrder = (part.level == 1) == (dir < 0);
|
6881 |
+
var ch = mv(start, moveInStorageOrder ? 1 : -1);
|
6882 |
+
if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {
|
6883 |
+
// Case 2: We move within an rtl part or in an rtl editor on the same visual line
|
6884 |
+
var sticky = moveInStorageOrder ? "before" : "after";
|
6885 |
+
return new Pos(start.line, ch, sticky)
|
6886 |
+
}
|
6887 |
+
}
|
6888 |
|
6889 |
+
// Case 3: Could not move within this bidi part in this visual line, so leave
|
6890 |
+
// the current bidi part
|
|
|
|
|
6891 |
|
6892 |
+
var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {
|
6893 |
+
var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder
|
6894 |
+
? new Pos(start.line, mv(ch, 1), "before")
|
6895 |
+
: new Pos(start.line, ch, "after"); };
|
6896 |
+
|
6897 |
+
for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {
|
6898 |
+
var part = bidi[partPos];
|
6899 |
+
var moveInStorageOrder = (dir > 0) == (part.level != 1);
|
6900 |
+
var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);
|
6901 |
+
if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }
|
6902 |
+
ch = moveInStorageOrder ? part.from : mv(part.to, -1);
|
6903 |
+
if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }
|
6904 |
+
}
|
6905 |
+
};
|
6906 |
+
|
6907 |
+
// Case 3a: Look for other bidi parts on the same visual line
|
6908 |
+
var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
6909 |
if (res) { return res }
|
6910 |
+
|
6911 |
+
// Case 3b: Look for other bidi parts on the next visual line
|
6912 |
+
var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);
|
6913 |
+
if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {
|
6914 |
+
res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));
|
6915 |
+
if (res) { return res }
|
6916 |
+
}
|
6917 |
+
|
6918 |
+
// Case 4: Nowhere to move
|
6919 |
+
return null
|
6920 |
}
|
6921 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|