From 77ccb8883f203afcf9267391147b15da1568bd50 Mon Sep 17 00:00:00 2001 From: Luuk Verhoeven Date: Mon, 18 Dec 2023 15:44:21 +0100 Subject: [PATCH] Refactor for MOODLE41 & PHP 7.4 --- README.txt | 5 + amd/build/codemirror.min.js | 2 +- amd/build/codemirror.min.js.map | 2 +- amd/build/jquery.dataTables.min.js | 2 +- amd/build/jquery.dataTables.min.js.map | 2 +- amd/build/jquery.tablesorter.min.js | 2 +- amd/build/jquery.tablesorter.min.js.map | 2 +- amd/build/sql.min.js | 2 +- amd/build/sql.min.js.map | 2 +- amd/src/codemirror.js | 9959 +++---- amd/src/jquery.dataTables.js | 23812 +++++++++------- amd/src/jquery.tablesorter.js | 88 +- amd/src/sql.js | 576 +- lib/pChart2/README.md | 60 +- lib/pChart2/change.log | Bin 25310 -> 6279 bytes lib/pChart2/class/Barcodes/Aztec/Binary.php | 32 + lib/pChart2/class/Barcodes/Aztec/Dynamic.php | 329 + lib/pChart2/class/Barcodes/Aztec/Encoder.php | 309 + .../class/Barcodes/Aztec/ReedSolomon.php | 168 + lib/pChart2/class/Barcodes/Aztec/Token.php | 49 + lib/pChart2/class/Barcodes/DMTX/Encoder.php | 461 + lib/pChart2/class/Barcodes/Linear/Codabar.php | 57 + lib/pChart2/class/Barcodes/Linear/Code11.php | 82 + lib/pChart2/class/Barcodes/Linear/Code128.php | 224 + lib/pChart2/class/Barcodes/Linear/Code39.php | 143 + lib/pChart2/class/Barcodes/Linear/Code93.php | 161 + lib/pChart2/class/Barcodes/Linear/Eanext.php | 105 + lib/pChart2/class/Barcodes/Linear/IMB.php | 287 + lib/pChart2/class/Barcodes/Linear/ITF.php | 71 + lib/pChart2/class/Barcodes/Linear/MSI.php | 79 + .../class/Barcodes/Linear/Pharmacode.php | 74 + lib/pChart2/class/Barcodes/Linear/Postnet.php | 85 + lib/pChart2/class/Barcodes/Linear/Rms4cc.php | 164 + lib/pChart2/class/Barcodes/Linear/UPC.php | 36 + lib/pChart2/class/Barcodes/Linear/b2of5.php | 127 + lib/pChart2/class/Barcodes/PDF417/Codes.php | 434 + lib/pChart2/class/Barcodes/PDF417/Encoder.php | 239 + .../class/Barcodes/PDF417/EncoderByte.php | 88 + .../class/Barcodes/PDF417/EncoderNumber.php | 54 + .../class/Barcodes/PDF417/EncoderText.php | 215 + .../class/Barcodes/PDF417/ReedSolomon.php | 163 + lib/pChart2/class/Barcodes/QRCode/Encoder.php | 421 + lib/pChart2/class/Barcodes/QRCode/Frame.php | 350 + lib/pChart2/class/Barcodes/QRCode/Mask.php | 250 + .../class/Barcodes/QRCode/ReedSolomon.php | 132 + lib/pChart2/class/Barcodes/pConf.php | 55 + lib/pChart2/class/pBarcode128.class.php | 168 - lib/pChart2/class/pBarcode39.class.php | 190 - lib/pChart2/class/pBarcodes1D.php | 176 + lib/pChart2/class/pBarcodes2D.php | 156 + lib/pChart2/class/pBubble.class.php | 332 - lib/pChart2/class/pBubble.php | 242 + lib/pChart2/class/pCache.class.php | 271 - lib/pChart2/class/pCharts.php | 2429 ++ lib/pChart2/class/pColor.php | 154 + lib/pChart2/class/pColorGradient.php | 72 + lib/pChart2/class/pData.class.php | 961 - lib/pChart2/class/pData.php | 578 + lib/pChart2/class/pDraw.class.php | 7214 ----- lib/pChart2/class/pDraw.php | 4265 +++ lib/pChart2/class/pException.php | 107 + lib/pChart2/class/pImage.class.php | 577 - lib/pChart2/class/pIndicator.class.php | 234 - lib/pChart2/class/pIndicator.php | 216 + lib/pChart2/class/pPie.class.php | 1678 -- lib/pChart2/class/pPie.php | 1261 + lib/pChart2/class/pPyramid.php | 121 + lib/pChart2/class/pRadar.class.php | 693 - lib/pChart2/class/pRadar.php | 589 + lib/pChart2/class/pScatter.class.php | 1237 - lib/pChart2/class/pScatter.php | 1077 + lib/pChart2/class/pSplit.class.php | 134 - lib/pChart2/class/pSpring.class.php | 806 - lib/pChart2/class/pSpring.php | 737 + lib/pChart2/class/pStock.class.php | 267 - lib/pChart2/class/pStock.php | 163 + lib/pChart2/class/pSurface.class.php | 321 - lib/pChart2/class/pSurface.php | 284 + lib/pChart2/composer.json | 15 +- lib/pChart2/data/128B.db | 107 - lib/pChart2/data/39.db | 44 - lib/pChart2/fonts/Abel-Regular.ttf | Bin 0 -> 33184 bytes lib/pChart2/fonts/Bedizen.ttf | Bin 42912 -> 0 bytes lib/pChart2/fonts/Cairo-Regular.ttf | Bin 0 -> 151580 bytes lib/pChart2/fonts/Dosis-Light.ttf | Bin 0 -> 88400 bytes lib/pChart2/fonts/Forgotte.ttf | Bin 42148 -> 0 bytes lib/pChart2/fonts/Gayathri-Regular.ttf | Bin 0 -> 150676 bytes lib/pChart2/fonts/GeosansLight.ttf | Bin 60072 -> 0 bytes lib/pChart2/fonts/MankSans.ttf | Bin 58492 -> 0 bytes lib/pChart2/fonts/PressStart2P-Regular.ttf | Bin 0 -> 116008 bytes lib/pChart2/fonts/Signika-Regular.ttf | Bin 0 -> 111720 bytes lib/pChart2/fonts/Silkscreen.ttf | Bin 16172 -> 0 bytes lib/pChart2/fonts/advent_light.ttf | Bin 45768 -> 0 bytes lib/pChart2/fonts/calibri.ttf | Bin 811052 -> 0 bytes lib/pChart2/fonts/pf_arma_five.ttf | Bin 21936 -> 0 bytes lib/pChart2/fonts/verdana.ttf | Bin 189144 -> 0 bytes lib/pChart2/palettes/autumn.color | 6 - lib/pChart2/palettes/blind.color | 6 - lib/pChart2/palettes/evening.color | 6 - lib/pChart2/palettes/kitchen.color | 6 - lib/pChart2/palettes/light.color | 7 - lib/pChart2/palettes/navy.color | 6 - lib/pChart2/palettes/shade.color | 6 - lib/pChart2/palettes/spring.color | 6 - lib/pChart2/palettes/summer.color | 6 - lib/pChart2/readme.txt | Bin 12528 -> 6240 bytes styles.css | 64 +- version.php | 2 +- 108 files changed, 36250 insertions(+), 31707 deletions(-) create mode 100644 lib/pChart2/class/Barcodes/Aztec/Binary.php create mode 100644 lib/pChart2/class/Barcodes/Aztec/Dynamic.php create mode 100644 lib/pChart2/class/Barcodes/Aztec/Encoder.php create mode 100644 lib/pChart2/class/Barcodes/Aztec/ReedSolomon.php create mode 100644 lib/pChart2/class/Barcodes/Aztec/Token.php create mode 100644 lib/pChart2/class/Barcodes/DMTX/Encoder.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Codabar.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Code11.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Code128.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Code39.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Code93.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Eanext.php create mode 100644 lib/pChart2/class/Barcodes/Linear/IMB.php create mode 100644 lib/pChart2/class/Barcodes/Linear/ITF.php create mode 100644 lib/pChart2/class/Barcodes/Linear/MSI.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Pharmacode.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Postnet.php create mode 100644 lib/pChart2/class/Barcodes/Linear/Rms4cc.php create mode 100644 lib/pChart2/class/Barcodes/Linear/UPC.php create mode 100644 lib/pChart2/class/Barcodes/Linear/b2of5.php create mode 100644 lib/pChart2/class/Barcodes/PDF417/Codes.php create mode 100644 lib/pChart2/class/Barcodes/PDF417/Encoder.php create mode 100644 lib/pChart2/class/Barcodes/PDF417/EncoderByte.php create mode 100644 lib/pChart2/class/Barcodes/PDF417/EncoderNumber.php create mode 100644 lib/pChart2/class/Barcodes/PDF417/EncoderText.php create mode 100644 lib/pChart2/class/Barcodes/PDF417/ReedSolomon.php create mode 100644 lib/pChart2/class/Barcodes/QRCode/Encoder.php create mode 100644 lib/pChart2/class/Barcodes/QRCode/Frame.php create mode 100644 lib/pChart2/class/Barcodes/QRCode/Mask.php create mode 100644 lib/pChart2/class/Barcodes/QRCode/ReedSolomon.php create mode 100644 lib/pChart2/class/Barcodes/pConf.php delete mode 100644 lib/pChart2/class/pBarcode128.class.php delete mode 100644 lib/pChart2/class/pBarcode39.class.php create mode 100644 lib/pChart2/class/pBarcodes1D.php create mode 100644 lib/pChart2/class/pBarcodes2D.php delete mode 100644 lib/pChart2/class/pBubble.class.php create mode 100644 lib/pChart2/class/pBubble.php delete mode 100644 lib/pChart2/class/pCache.class.php create mode 100644 lib/pChart2/class/pCharts.php create mode 100644 lib/pChart2/class/pColor.php create mode 100644 lib/pChart2/class/pColorGradient.php delete mode 100644 lib/pChart2/class/pData.class.php create mode 100644 lib/pChart2/class/pData.php delete mode 100644 lib/pChart2/class/pDraw.class.php create mode 100644 lib/pChart2/class/pDraw.php create mode 100644 lib/pChart2/class/pException.php delete mode 100644 lib/pChart2/class/pImage.class.php delete mode 100644 lib/pChart2/class/pIndicator.class.php create mode 100644 lib/pChart2/class/pIndicator.php delete mode 100644 lib/pChart2/class/pPie.class.php create mode 100644 lib/pChart2/class/pPie.php create mode 100644 lib/pChart2/class/pPyramid.php delete mode 100644 lib/pChart2/class/pRadar.class.php create mode 100644 lib/pChart2/class/pRadar.php delete mode 100644 lib/pChart2/class/pScatter.class.php create mode 100644 lib/pChart2/class/pScatter.php delete mode 100644 lib/pChart2/class/pSplit.class.php delete mode 100644 lib/pChart2/class/pSpring.class.php create mode 100644 lib/pChart2/class/pSpring.php delete mode 100644 lib/pChart2/class/pStock.class.php create mode 100644 lib/pChart2/class/pStock.php delete mode 100644 lib/pChart2/class/pSurface.class.php create mode 100644 lib/pChart2/class/pSurface.php delete mode 100644 lib/pChart2/data/128B.db delete mode 100644 lib/pChart2/data/39.db create mode 100644 lib/pChart2/fonts/Abel-Regular.ttf delete mode 100644 lib/pChart2/fonts/Bedizen.ttf create mode 100644 lib/pChart2/fonts/Cairo-Regular.ttf create mode 100644 lib/pChart2/fonts/Dosis-Light.ttf delete mode 100644 lib/pChart2/fonts/Forgotte.ttf create mode 100644 lib/pChart2/fonts/Gayathri-Regular.ttf delete mode 100644 lib/pChart2/fonts/GeosansLight.ttf delete mode 100644 lib/pChart2/fonts/MankSans.ttf create mode 100644 lib/pChart2/fonts/PressStart2P-Regular.ttf create mode 100644 lib/pChart2/fonts/Signika-Regular.ttf delete mode 100644 lib/pChart2/fonts/Silkscreen.ttf delete mode 100644 lib/pChart2/fonts/advent_light.ttf delete mode 100644 lib/pChart2/fonts/calibri.ttf delete mode 100644 lib/pChart2/fonts/pf_arma_five.ttf delete mode 100644 lib/pChart2/fonts/verdana.ttf delete mode 100644 lib/pChart2/palettes/autumn.color delete mode 100644 lib/pChart2/palettes/blind.color delete mode 100644 lib/pChart2/palettes/evening.color delete mode 100644 lib/pChart2/palettes/kitchen.color delete mode 100644 lib/pChart2/palettes/light.color delete mode 100644 lib/pChart2/palettes/navy.color delete mode 100644 lib/pChart2/palettes/shade.color delete mode 100644 lib/pChart2/palettes/spring.color delete mode 100644 lib/pChart2/palettes/summer.color diff --git a/README.txt b/README.txt index 339e69eb..d9339a83 100644 --- a/README.txt +++ b/README.txt @@ -36,6 +36,11 @@ This release focuses on solving issues in Moodle 4.1 and PHP 7.4 and start with - Add PHP 7.4 support - minimum PHP version is now 7.4 - Add PHP 8.0 support - Add PHP 8.1 support +- pChart library updated to version 2.4.0 +- JS tablesorter library updated to version 2.31.3 +- JS CodeMirror library updated to version 5.65.16 + + - Move repository to https://github.com/Lesterhuis-Training-en-Consultancy/moodle-block_configurablereports - Original repository (https://github.com/jleyva/moodle-block_configurablereports) can be used for older release or use the old branches within this repository - removed cr_add_to_log not used anymore diff --git a/amd/build/codemirror.min.js b/amd/build/codemirror.min.js index 6ed80005..cec8fd78 100644 --- a/amd/build/codemirror.min.js +++ b/amd/build/codemirror.min.js @@ -1,3 +1,3 @@ -var global,factory;global=window,factory=function(){var userAgent=navigator.userAgent,platform=navigator.platform,gecko=/gecko\/\d/i.test(userAgent),ie_upto10=/MSIE \d/.test(userAgent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent),edge=/Edge\/(\d+)/.exec(userAgent),ie=ie_upto10||ie_11up||edge,ie_version=ie&&(ie_upto10?document.documentMode||6:+(edge||ie_11up)[1]),webkit=!edge&&/WebKit\//.test(userAgent),qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(userAgent),chrome=!edge&&/Chrome\//.test(userAgent),presto=/Opera\//.test(userAgent),safari=/Apple Computer/.test(navigator.vendor),mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent),phantom=/PhantomJS/.test(userAgent),ios=!edge&&/AppleWebKit/.test(userAgent)&&/Mobile\/\w+/.test(userAgent),android=/Android/.test(userAgent),mobile=ios||android||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent),mac=ios||/Mac/.test(platform),chromeOS=/\bCrOS\b/.test(userAgent),windows=/win/i.test(platform),presto_version=presto&&userAgent.match(/Version\/(\d*\.\d*)/);presto_version&&(presto_version=Number(presto_version[1])),presto_version&&presto_version>=15&&(presto=!1,webkit=!0);var flipCtrlCmd=mac&&(qtwebkit||presto&&(null==presto_version||presto_version<12.11)),captureRightClick=gecko||ie&&ie_version>=9;function classTest(cls){return new RegExp("(^|\\s)"+cls+"(?:$|\\s)\\s*")}var range,rmClass=function(node,cls){var current=node.className,match=classTest(cls).exec(current);if(match){var after=current.slice(match.index+match[0].length);node.className=current.slice(0,match.index)+(after?match[1]+after:"")}};function removeChildren(e){for(var count=e.childNodes.length;count>0;--count)e.removeChild(e.firstChild);return e}function removeChildrenAndAdd(parent,e){return removeChildren(parent).appendChild(e)}function elt(tag,content,className,style){var e=document.createElement(tag);if(className&&(e.className=className),style&&(e.style.cssText=style),"string"==typeof content)e.appendChild(document.createTextNode(content));else if(content)for(var i=0;i=end)return n+(end-i);n+=nextTab-i,n+=tabSize-n%tabSize,i=nextTab+1}}ios?selectInput=function(node){node.selectionStart=0,node.selectionEnd=node.value.length}:ie&&(selectInput=function(node){try{node.select()}catch(_e){}});var Delayed=function(){this.id=null};function indexOf(array,elt){for(var i=0;i=goal)return pos+Math.min(skipped,goal-col);if(col+=nextTab-pos,pos=nextTab+1,(col+=tabSize-col%tabSize)>=goal)return pos}}var spaceStrs=[""];function spaceStr(n){for(;spaceStrs.length<=n;)spaceStrs.push(lst(spaceStrs)+" ");return spaceStrs[n]}function lst(arr){return arr[arr.length-1]}function map(array,f){for(var out=[],i=0;i"€"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function isWordChar(ch,helper){return helper?!!(helper.source.indexOf("\\w")>-1&&isWordCharBasic(ch))||helper.test(ch):isWordCharBasic(ch)}function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return!1;return!0}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]/;function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChars.test(ch)}function skipExtendingChars(str,pos,dir){for(;(dir<0?pos>0:posto?-1:1;;){if(from==to)return from;var midF=(from+to)/2,mid=dir<0?Math.ceil(midF):Math.floor(midF);if(mid==from)return pred(mid)?from:to;pred(mid)?to=mid:from=mid+dir}}function Display(place,doc,input){var d=this;this.input=input,d.scrollbarFiller=elt("div",null,"CodeMirror-scrollbar-filler"),d.scrollbarFiller.setAttribute("cm-not-content","true"),d.gutterFiller=elt("div",null,"CodeMirror-gutter-filler"),d.gutterFiller.setAttribute("cm-not-content","true"),d.lineDiv=eltP("div",null,"CodeMirror-code"),d.selectionDiv=elt("div",null,null,"position: relative; z-index: 1"),d.cursorDiv=elt("div",null,"CodeMirror-cursors"),d.measure=elt("div",null,"CodeMirror-measure"),d.lineMeasure=elt("div",null,"CodeMirror-measure"),d.lineSpace=eltP("div",[d.measure,d.lineMeasure,d.selectionDiv,d.cursorDiv,d.lineDiv],null,"position: relative; outline: none");var lines=eltP("div",[d.lineSpace],"CodeMirror-lines");d.mover=elt("div",[lines],null,"position: relative"),d.sizer=elt("div",[d.mover],"CodeMirror-sizer"),d.sizerWidth=null,d.heightForcer=elt("div",null,null,"position: absolute; height: 30px; width: 1px;"),d.gutters=elt("div",null,"CodeMirror-gutters"),d.lineGutter=null,d.scroller=elt("div",[d.sizer,d.heightForcer,d.gutters],"CodeMirror-scroll"),d.scroller.setAttribute("tabIndex","-1"),d.wrapper=elt("div",[d.scrollbarFiller,d.gutterFiller,d.scroller],"CodeMirror"),ie&&ie_version<8&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),webkit||gecko&&mobile||(d.scroller.draggable=!0),place&&(place.appendChild?place.appendChild(d.wrapper):place(d.wrapper)),d.viewFrom=d.viewTo=doc.first,d.reportedViewFrom=d.reportedViewTo=doc.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,input.init(d)}function getLine(doc,n){if((n-=doc.first)<0||n>=doc.size)throw new Error("There is no line "+(n+doc.first)+" in the document.");for(var chunk=doc;!chunk.lines;)for(var i=0;;++i){var child=chunk.children[i],sz=child.chunkSize();if(n=doc.first&&llast?Pos(last,getLine(doc,last).text.length):function(pos,linelen){var ch=pos.ch;return null==ch||ch>linelen?Pos(pos.line,linelen):ch<0?Pos(pos.line,0):pos}(pos,getLine(doc,pos.line).text.length)}function clipPosArray(doc,array){for(var out=[],i=0;i=startCh:span.to>startCh);(nw||(nw=[])).push(new MarkedSpan(marker,span.from,endsAfter?null:span.to))}}return nw}(oldFirst,startCh,isInsert),last=function(old,endCh,isInsert){var nw;if(old)for(var i=0;i=endCh:span.to>endCh)||span.from==endCh&&"bookmark"==marker.type&&(!isInsert||span.marker.insertLeft)){var startsBefore=null==span.from||(marker.inclusiveLeft?span.from<=endCh:span.from0&&first)for(var i$2=0;i$2ch)&&(!found||compareCollapsedMarkers(found,sp.marker)<0)&&(found=sp.marker)}return found}function conflictingCollapsedRange(doc,lineNo$$1,from,to,marker){var line=getLine(doc,lineNo$$1),sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var i=0;i=0&&toCmp<=0||fromCmp<=0&&toCmp>=0)&&(fromCmp<=0&&(sp.marker.inclusiveRight&&marker.inclusiveLeft?cmp(found.to,from)>=0:cmp(found.to,from)>0)||fromCmp>=0&&(sp.marker.inclusiveRight&&marker.inclusiveLeft?cmp(found.from,to)<=0:cmp(found.from,to)<0)))return!0}}}function visualLine(line){for(var merged;merged=collapsedSpanAtStart(line);)line=merged.find(-1,!0).line;return line}function visualLineNo(doc,lineN){var line=getLine(doc,lineN),vis=visualLine(line);return line==vis?lineN:lineNo(vis)}function visualLineEndNo(doc,lineN){if(lineN>doc.lastLine())return lineN;var merged,line=getLine(doc,lineN);if(!lineIsHidden(doc,line))return lineN;for(;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line;return lineNo(line)+1}function lineIsHidden(doc,line){var sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var sp=void 0,i=0;id.maxLineLength&&(d.maxLineLength=len,d.maxLine=line)}))}var bidiOther=null;function getBidiPartAt(order,ch,sticky){var found;bidiOther=null;for(var i=0;ich)return i;cur.to==ch&&(cur.from!=cur.to&&"before"==sticky?found=i:bidiOther=i),cur.from==ch&&(cur.from!=cur.to&&"before"!=sticky?found=i:bidiOther=i)}return null!=found?found:bidiOther}var bidiOrdering=function(){var bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,isNeutral=/[stwN]/,isStrong=/[LRr]/,countsAsLeft=/[Lb1n]/,countsAsNum=/[1n]/;function BidiSpan(level,from,to){this.level=level,this.from=from,this.to=to}return function(str,direction){var outerType="ltr"==direction?"L":"R";if(0==str.length||"ltr"==direction&&!bidiRE.test(str))return!1;for(var code,len=str.length,types=[],i=0;i-1&&(map$$1[type]=arr.slice(0,index).concat(arr.slice(index+1)))}}}function signal(emitter,type){var handlers=getHandlers(emitter,type);if(handlers.length)for(var args=Array.prototype.slice.call(arguments,2),i=0;i0}function eventMixin(ctor){ctor.prototype.on=function(type,f){on(this,type,f)},ctor.prototype.off=function(type,f){off(this,type,f)}}function e_preventDefault(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function e_stopPropagation(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function e_defaultPrevented(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function e_stop(e){e_preventDefault(e),e_stopPropagation(e)}function e_target(e){return e.target||e.srcElement}function e_button(e){var b=e.which;return null==b&&(1&e.button?b=1:2&e.button?b=3:4&e.button&&(b=2)),mac&&e.ctrlKey&&1==b&&(b=3),b}var zwspSupported,badBidiRects,dragAndDrop=function(){if(ie&&ie_version<9)return!1;var div=elt("div");return"draggable"in div||"dragDrop"in div}();function zeroWidthElement(measure){if(null==zwspSupported){var test=elt("span","​");removeChildrenAndAdd(measure,elt("span",[test,document.createTextNode("x")])),0!=measure.firstChild.offsetHeight&&(zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!(ie&&ie_version<8))}var node=zwspSupported?elt("span","​"):elt("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return node.setAttribute("cm-text",""),node}function hasBadBidiRects(measure){if(null!=badBidiRects)return badBidiRects;var txt=removeChildrenAndAdd(measure,document.createTextNode("AخA")),r0=range(txt,0,1).getBoundingClientRect(),r1=range(txt,1,2).getBoundingClientRect();return removeChildren(measure),!(!r0||r0.left==r0.right)&&(badBidiRects=r1.right-r0.right<3)}var e,splitLinesAuto=3!="\n\nb".split(/\n/).length?function(string){for(var pos=0,result=[],l=string.length;pos<=l;){var nl=string.indexOf("\n",pos);-1==nl&&(nl=string.length);var line=string.slice(pos,"\r"==string.charAt(nl-1)?nl-1:nl),rt=line.indexOf("\r");-1!=rt?(result.push(line.slice(0,rt)),pos+=rt+1):(result.push(line),pos=nl+1)}return result}:function(string){return string.split(/\r\n?|\n/)},hasSelection=window.getSelection?function(te){try{return te.selectionStart!=te.selectionEnd}catch(e){return!1}}:function(te){var range$$1;try{range$$1=te.ownerDocument.selection.createRange()}catch(e){}return!(!range$$1||range$$1.parentElement()!=te)&&0!=range$$1.compareEndPoints("StartToEnd",range$$1)},hasCopyEvent="oncopy"in(e=elt("div"))||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy),badZoomedRects=null,modes={},mimeModes={};function defineMode(name,mode){arguments.length>2&&(mode.dependencies=Array.prototype.slice.call(arguments,2)),modes[name]=mode}function resolveMode(spec){if("string"==typeof spec&&mimeModes.hasOwnProperty(spec))spec=mimeModes[spec];else if(spec&&"string"==typeof spec.name&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];"string"==typeof found&&(found={name:found}),(spec=createObj(found,spec)).name=found.name}else{if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+xml$/.test(spec))return resolveMode("application/xml");if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+json$/.test(spec))return resolveMode("application/json")}return"string"==typeof spec?{name:spec}:spec||{name:"null"}}function getMode(options,spec){spec=resolveMode(spec);var mfactory=modes[spec.name];if(!mfactory)return getMode(options,"text/plain");var modeObj=mfactory(options,spec);if(modeExtensions.hasOwnProperty(spec.name)){var exts=modeExtensions[spec.name];for(var prop in exts)exts.hasOwnProperty(prop)&&(modeObj.hasOwnProperty(prop)&&(modeObj["_"+prop]=modeObj[prop]),modeObj[prop]=exts[prop])}if(modeObj.name=spec.name,spec.helperType&&(modeObj.helperType=spec.helperType),spec.modeProps)for(var prop$1 in spec.modeProps)modeObj[prop$1]=spec.modeProps[prop$1];return modeObj}var modeExtensions={};function extendMode(mode,properties){copyObj(properties,modeExtensions.hasOwnProperty(mode)?modeExtensions[mode]:modeExtensions[mode]={})}function copyState(mode,state){if(!0===state)return state;if(mode.copyState)return mode.copyState(state);var nstate={};for(var n in state){var val=state[n];val instanceof Array&&(val=val.concat([])),nstate[n]=val}return nstate}function innerMode(mode,state){for(var info;mode.innerMode&&(info=mode.innerMode(state))&&info.mode!=mode;)state=info.state,mode=info.mode;return info||{mode:mode,state:state}}function startState(mode,a1,a2){return!mode.startState||mode.startState(a1,a2)}var StringStream=function(string,tabSize,lineOracle){this.pos=this.start=0,this.string=string,this.tabSize=tabSize||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=lineOracle};StringStream.prototype.eol=function(){return this.pos>=this.string.length},StringStream.prototype.sol=function(){return this.pos==this.lineStart},StringStream.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},StringStream.prototype.next=function(){if(this.posstart},StringStream.prototype.eatSpace=function(){for(var start=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>start},StringStream.prototype.skipToEnd=function(){this.pos=this.string.length},StringStream.prototype.skipTo=function(ch){var found=this.string.indexOf(ch,this.pos);if(found>-1)return this.pos=found,!0},StringStream.prototype.backUp=function(n){this.pos-=n},StringStream.prototype.column=function(){return this.lastColumnPos0?null:(match&&!1!==consume&&(this.pos+=match[0].length),match)}var cased=function(str){return caseInsensitive?str.toLowerCase():str};if(cased(this.string.substr(this.pos,pattern.length))==cased(pattern))return!1!==consume&&(this.pos+=pattern.length),!0},StringStream.prototype.current=function(){return this.string.slice(this.start,this.pos)},StringStream.prototype.hideFirstChars=function(n,inner){this.lineStart+=n;try{return inner()}finally{this.lineStart-=n}},StringStream.prototype.lookAhead=function(n){var oracle=this.lineOracle;return oracle&&oracle.lookAhead(n)},StringStream.prototype.baseToken=function(){var oracle=this.lineOracle;return oracle&&oracle.baseToken(this.pos)};var SavedContext=function(state,lookAhead){this.state=state,this.lookAhead=lookAhead},Context=function(doc,state,line,lookAhead){this.state=state,this.doc=doc,this.line=line,this.maxLookAhead=lookAhead||0,this.baseTokens=null,this.baseTokenPos=1};function highlightLine(cm,line,context,forceToEnd){var st=[cm.state.modeGen],lineClasses={};runMode(cm,line.text,cm.doc.mode,context,(function(end,style){return st.push(end,style)}),lineClasses,forceToEnd);for(var state=context.state,loop=function(o){context.baseTokens=st;var overlay=cm.state.overlays[o],i=1,at=0;context.state=!0,runMode(cm,line.text,overlay.mode,context,(function(end,style){for(var start=i;atend&&st.splice(i,1,end,st[i+1],i_end),i+=2,at=Math.min(end,i_end)}if(style)if(overlay.opaque)st.splice(start,i-start,end,"overlay "+style),i=start+2;else for(;startcm.options.maxHighlightLength&©State(cm.doc.mode,context.state),result=highlightLine(cm,line,context);resetState&&(context.state=resetState),line.stateAfter=context.save(!resetState),line.styles=result.styles,result.classes?line.styleClasses=result.classes:line.styleClasses&&(line.styleClasses=null),updateFrontier===cm.doc.highlightFrontier&&(cm.doc.modeFrontier=Math.max(cm.doc.modeFrontier,++cm.doc.highlightFrontier))}return line.styles}function getContextBefore(cm,n,precise){var doc=cm.doc,display=cm.display;if(!doc.mode.startState)return new Context(doc,!0,n);var start=function(cm,n,precise){for(var minindent,minline,doc=cm.doc,lim=precise?-1:n-(cm.doc.mode.innerMode?1e3:100),search=n;search>lim;--search){if(search<=doc.first)return doc.first;var line=getLine(doc,search-1),after=line.stateAfter;if(after&&(!precise||search+(after instanceof SavedContext?after.lookAhead:0)<=doc.modeFrontier))return search;var indented=countColumn(line.text,null,cm.options.tabSize);(null==minline||minindent>indented)&&(minline=search-1,minindent=indented)}return minline}(cm,n,precise),saved=start>doc.first&&getLine(doc,start-1).stateAfter,context=saved?Context.fromSaved(doc,saved,start):new Context(doc,startState(doc.mode),start);return doc.iter(start,n,(function(line){processLine(cm,line.text,context);var pos=context.line;line.stateAfter=pos==n-1||pos%5==0||pos>=display.viewFrom&&posstream.start)return style}throw new Error("Mode "+mode.name+" failed to advance stream.")}Context.prototype.lookAhead=function(n){var line=this.doc.getLine(this.line+n);return null!=line&&n>this.maxLookAhead&&(this.maxLookAhead=n),line},Context.prototype.baseToken=function(n){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=n;)this.baseTokenPos+=2;var type=this.baseTokens[this.baseTokenPos+1];return{type:type&&type.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-n}},Context.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Context.fromSaved=function(doc,saved,line){return saved instanceof SavedContext?new Context(doc,copyState(doc.mode,saved.state),line,saved.lookAhead):new Context(doc,copyState(doc.mode,saved),line)},Context.prototype.save=function(copy){var state=!1!==copy?copyState(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new SavedContext(state,this.maxLookAhead):state};var Token=function(stream,type,state){this.start=stream.start,this.end=stream.pos,this.string=stream.current(),this.type=type||null,this.state=state};function takeToken(cm,pos,precise,asArray){var style,tokens,doc=cm.doc,mode=doc.mode,line=getLine(doc,(pos=clipPos(doc,pos)).line),context=getContextBefore(cm,pos.line,precise),stream=new StringStream(line.text,cm.options.tabSize,context);for(asArray&&(tokens=[]);(asArray||stream.poscm.options.maxHighlightLength?(flattenSpans=!1,forceToEnd&&processLine(cm,text,context,stream.pos),stream.pos=text.length,style=null):style=extractLineClasses(readToken(mode,stream,context.state,inner),lineClasses),inner){var mName=inner[0].name;mName&&(style="m-"+(style?mName+" "+style:mName))}if(!flattenSpans||curStyle!=style){for(;curStart1&&!/ /.test(text))return text;for(var spaceBefore=trailingBefore,result="",i=0;istart&&part.from<=start);i++);if(part.to>=end)return inner(builder,text,style,startStyle,endStyle,title,css);inner(builder,text.slice(0,part.to-start),style,startStyle,null,title,css),startStyle=null,text=text.slice(part.to-start),start=part.to}}}function buildCollapsedSpan(builder,size,marker,ignoreWidget){var widget=!ignoreWidget&&marker.widgetNode;widget&&builder.map.push(builder.pos,builder.pos+size,widget),!ignoreWidget&&builder.cm.display.input.needsContentAttribute&&(widget||(widget=builder.content.appendChild(document.createElement("span"))),widget.setAttribute("cm-marker",marker.id)),widget&&(builder.cm.display.input.setUneditable(widget),builder.content.appendChild(widget)),builder.pos+=size,builder.trailingSpace=!1}function insertLineContent(line,builder,styles){var spans=line.markedSpans,allText=line.text,at=0;if(spans)for(var style,css,spanStyle,spanEndStyle,spanStartStyle,title,collapsed,len=allText.length,pos=0,i=1,text="",nextChange=0;;){if(nextChange==pos){spanStyle=spanEndStyle=spanStartStyle=title=css="",collapsed=null,nextChange=1/0;for(var foundBookmarks=[],endStyles=void 0,j=0;jpos||m.collapsed&&sp.to==pos&&sp.from==pos)?(null!=sp.to&&sp.to!=pos&&nextChange>sp.to&&(nextChange=sp.to,spanEndStyle=""),m.className&&(spanStyle+=" "+m.className),m.css&&(css=(css?css+";":"")+m.css),m.startStyle&&sp.from==pos&&(spanStartStyle+=" "+m.startStyle),m.endStyle&&sp.to==nextChange&&(endStyles||(endStyles=[])).push(m.endStyle,sp.to),m.title&&!title&&(title=m.title),m.collapsed&&(!collapsed||compareCollapsedMarkers(collapsed.marker,m)<0)&&(collapsed=sp)):sp.from>pos&&nextChange>sp.from&&(nextChange=sp.from)}if(endStyles)for(var j$1=0;j$1=len)break;for(var upto=Math.min(len,nextChange);;){if(text){var end=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):text;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartStyle,pos+tokenText.length==nextChange?spanEndStyle:"",title,css)}if(end>=upto){text=text.slice(upto-pos),pos=upto;break}pos=end,spanStartStyle=""}text=allText.slice(at,at=styles[i++]),style=interpretTokenStyle(styles[i++],builder.cm.options)}}else for(var i$1=1;i$1lineN)return{map:lineView.measure.maps[i$1],cache:lineView.measure.caches[i$1],before:!0}}function measureChar(cm,line,ch,bias){return measureCharPrepared(cm,prepareMeasureForLine(cm,line),ch,bias)}function findViewForLine(cm,lineN){if(lineN>=cm.display.viewFrom&&lineN=ext.lineN&&lineN2&&heights.push((cur.bottom+next.top)/2-rect.top)}}heights.push(rect.bottom-rect.top)}}(cm,prepared.view,prepared.rect),prepared.hasHeights=!0),found=function(cm,prepared,ch,bias){var rect,place=nodeAndOffsetInLineMap(prepared.map,ch,bias),node=place.node,start=place.start,end=place.end,collapse=place.collapse;if(3==node.nodeType){for(var i$1=0;i$1<4;i$1++){for(;start&&isExtendingChar(prepared.line.text.charAt(place.coverStart+start));)--start;for(;place.coverStart+end1}(measure))return rect;var scaleX=screen.logicalXDPI/screen.deviceXDPI,scaleY=screen.logicalYDPI/screen.deviceYDPI;return{left:rect.left*scaleX,right:rect.right*scaleX,top:rect.top*scaleY,bottom:rect.bottom*scaleY}}(cm.display.measure,rect))}else{var rects;start>0&&(collapse=bias="right"),rect=cm.options.lineWrapping&&(rects=node.getClientRects()).length>1?rects["right"==bias?rects.length-1:0]:node.getBoundingClientRect()}if(ie&&ie_version<9&&!start&&(!rect||!rect.left&&!rect.right)){var rSpan=node.parentNode.getClientRects()[0];rect=rSpan?{left:rSpan.left,right:rSpan.left+charWidth(cm.display),top:rSpan.top,bottom:rSpan.bottom}:nullRect}for(var rtop=rect.top-prepared.rect.top,rbot=rect.bottom-prepared.rect.top,mid=(rtop+rbot)/2,heights=prepared.view.measure.heights,i=0;ich)&&(start=(end=mEnd-mStart)-1,ch>=mEnd&&(collapse="right")),null!=start){if(node=map$$1[i+2],mStart==mEnd&&bias==(node.insertLeft?"left":"right")&&(collapse=bias),"left"==bias&&0==start)for(;i&&map$$1[i-2]==map$$1[i-3]&&map$$1[i-1].insertLeft;)node=map$$1[2+(i-=3)],collapse="left";if("right"==bias&&start==mEnd-mStart)for(;i=0&&(rect=rects[i$1]).left==rect.right;i$1--);return rect}function clearLineMeasurementCacheFor(lineView){if(lineView.measure&&(lineView.measure.cache={},lineView.measure.heights=null,lineView.rest))for(var i=0;i=lineObj.text.length?(ch=lineObj.text.length,sticky="before"):ch<=0&&(ch=0,sticky="after"),!order)return get("before"==sticky?ch-1:ch,"before"==sticky);function getBidi(ch,partPos,invert){return get(invert?ch-1:ch,1==order[partPos].level!=invert)}var partPos=getBidiPartAt(order,ch,sticky),other=bidiOther,val=getBidi(ch,partPos,"before"==sticky);return null!=other&&(val.other=getBidi(ch,other,"before"!=sticky)),val}function estimateCoords(cm,pos){var left=0;pos=clipPos(cm.doc,pos),cm.options.lineWrapping||(left=charWidth(cm.display)*pos.ch);var lineObj=getLine(cm.doc,pos.line),top=heightAtLine(lineObj)+paddingTop(cm.display);return{left:left,right:left,top:top,bottom:top+lineObj.height}}function PosWithInfo(line,ch,sticky,outside,xRel){var pos=Pos(line,ch,sticky);return pos.xRel=xRel,outside&&(pos.outside=!0),pos}function coordsChar(cm,x,y){var doc=cm.doc;if((y+=cm.display.viewOffset)<0)return PosWithInfo(doc.first,0,null,!0,-1);var lineN=lineAtHeight(doc,y),last=doc.first+doc.size-1;if(lineN>last)return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,null,!0,1);x<0&&(x=0);for(var lineObj=getLine(doc,lineN);;){var found=coordsCharInner(cm,lineObj,lineN,x,y),collapsed=collapsedSpanAround(lineObj,found.ch+(found.xRel>0?1:0));if(!collapsed)return found;var rangeEnd=collapsed.find(1);if(rangeEnd.line==lineN)return rangeEnd;lineObj=getLine(doc,lineN=rangeEnd.line)}}function wrappedLineExtent(cm,lineObj,preparedMeasure,y){y-=widgetTopHeight(lineObj);var end=lineObj.text.length,begin=findFirst((function(ch){return measureCharPrepared(cm,preparedMeasure,ch-1).bottom<=y}),end,0);return{begin:begin,end:end=findFirst((function(ch){return measureCharPrepared(cm,preparedMeasure,ch).top>y}),begin,end)}}function wrappedLineExtentChar(cm,lineObj,preparedMeasure,target){return preparedMeasure||(preparedMeasure=prepareMeasureForLine(cm,lineObj)),wrappedLineExtent(cm,lineObj,preparedMeasure,intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,target),"line").top)}function boxIsAfter(box,x,y,left){return!(box.bottom<=y)&&(box.top>y||(left?box.left:box.right)>x)}function coordsCharInner(cm,lineObj,lineNo$$1,x,y){y-=heightAtLine(lineObj);var preparedMeasure=prepareMeasureForLine(cm,lineObj),widgetHeight$$1=widgetTopHeight(lineObj),begin=0,end=lineObj.text.length,ltr=!0,order=getOrder(lineObj,cm.doc.direction);if(order){var part=(cm.options.lineWrapping?coordsBidiPartWrapped:coordsBidiPart)(cm,lineObj,lineNo$$1,preparedMeasure,order,x,y);begin=(ltr=1!=part.level)?part.from:part.to-1,end=ltr?part.to:part.from-1}var baseX,sticky,chAround=null,boxAround=null,ch=findFirst((function(ch){var box=measureCharPrepared(cm,preparedMeasure,ch);return box.top+=widgetHeight$$1,box.bottom+=widgetHeight$$1,!!boxIsAfter(box,x,y,!1)&&(box.top<=y&&box.left<=x&&(chAround=ch,boxAround=box),!0)}),begin,end),outside=!1;if(boxAround){var atLeft=x-boxAround.left=coords.bottom}return PosWithInfo(lineNo$$1,ch=skipExtendingChars(lineObj.text,ch,1),sticky,outside,x-baseX)}function coordsBidiPart(cm,lineObj,lineNo$$1,preparedMeasure,order,x,y){var index=findFirst((function(i){var part=order[i],ltr=1!=part.level;return boxIsAfter(cursorCoords(cm,Pos(lineNo$$1,ltr?part.to:part.from,ltr?"before":"after"),"line",lineObj,preparedMeasure),x,y,!0)}),0,order.length-1),part=order[index];if(index>0){var ltr=1!=part.level,start=cursorCoords(cm,Pos(lineNo$$1,ltr?part.from:part.to,ltr?"after":"before"),"line",lineObj,preparedMeasure);boxIsAfter(start,x,y,!0)&&start.top>y&&(part=order[index-1])}return part}function coordsBidiPartWrapped(cm,lineObj,_lineNo,preparedMeasure,order,x,y){var ref=wrappedLineExtent(cm,lineObj,preparedMeasure,y),begin=ref.begin,end=ref.end;/\s/.test(lineObj.text.charAt(end-1))&&end--;for(var part=null,closestDist=null,i=0;i=end||p.to<=begin)){var endX=measureCharPrepared(cm,preparedMeasure,1!=p.level?Math.min(end,p.to)-1:Math.max(begin,p.from)).right,dist=endXdist)&&(part=p,closestDist=dist)}}return part||(part=order[order.length-1]),part.fromend&&(part={from:part.from,to:end,level:part.level}),part}function textHeight(display){if(null!=display.cachedTextHeight)return display.cachedTextHeight;if(null==measureText){measureText=elt("pre");for(var i=0;i<49;++i)measureText.appendChild(document.createTextNode("x")),measureText.appendChild(elt("br"));measureText.appendChild(document.createTextNode("x"))}removeChildrenAndAdd(display.measure,measureText);var height=measureText.offsetHeight/50;return height>3&&(display.cachedTextHeight=height),removeChildren(display.measure),height||1}function charWidth(display){if(null!=display.cachedCharWidth)return display.cachedCharWidth;var anchor=elt("span","xxxxxxxxxx"),pre=elt("pre",[anchor]);removeChildrenAndAdd(display.measure,pre);var rect=anchor.getBoundingClientRect(),width=(rect.right-rect.left)/10;return width>2&&(display.cachedCharWidth=width),width||10}function getDimensions(cm){for(var d=cm.display,left={},width={},gutterLeft=d.gutters.clientLeft,n=d.gutters.firstChild,i=0;n;n=n.nextSibling,++i)left[cm.options.gutters[i]]=n.offsetLeft+n.clientLeft+gutterLeft,width[cm.options.gutters[i]]=n.clientWidth;return{fixedPos:compensateForHScroll(d),gutterTotalWidth:d.gutters.offsetWidth,gutterLeft:left,gutterWidth:width,wrapperWidth:d.wrapper.clientWidth}}function compensateForHScroll(display){return display.scroller.getBoundingClientRect().left-display.sizer.getBoundingClientRect().left}function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.lineWrapping,perLine=wrapping&&Math.max(5,cm.display.scroller.clientWidth/charWidth(cm.display)-3);return function(line){if(lineIsHidden(cm.doc,line))return 0;var widgetsHeight=0;if(line.widgets)for(var i=0;i=cm.display.viewTo)return null;if((n-=cm.display.viewFrom)<0)return null;for(var view=cm.display.view,i=0;i=cm.display.viewTo||range$$1.to().linefrom||from==to&&part.to==from)&&(f(Math.max(part.from,from),Math.min(part.to,to),1==part.level?"rtl":"ltr",i),found=!0)}found||f(from,to,"ltr")}(order,fromArg||0,null==toArg?lineLen:toArg,(function(from,to,dir,i){var ltr="ltr"==dir,fromPos=coords(from,ltr?"left":"right"),toPos=coords(to-1,ltr?"right":"left"),openStart=null==fromArg&&0==from,openEnd=null==toArg&&to==lineLen,first=0==i,last=!order||i==order.length-1;if(toPos.top-fromPos.top<=3){var openRight=(docLTR?openEnd:openStart)&&last,left=(docLTR?openStart:openEnd)&&first?leftSide:(ltr?fromPos:toPos).left,right=openRight?rightSide:(ltr?toPos:fromPos).right;add(left,fromPos.top,right-left,fromPos.bottom)}else{var topLeft,topRight,botLeft,botRight;ltr?(topLeft=docLTR&&openStart&&first?leftSide:fromPos.left,topRight=docLTR?rightSide:wrapX(from,dir,"before"),botLeft=docLTR?leftSide:wrapX(to,dir,"after"),botRight=docLTR&&openEnd&&last?rightSide:toPos.right):(topLeft=docLTR?wrapX(from,dir,"before"):leftSide,topRight=!docLTR&&openStart&&first?rightSide:fromPos.right,botLeft=!docLTR&&openEnd&&last?leftSide:toPos.left,botRight=docLTR?wrapX(to,dir,"after"):rightSide),add(topLeft,fromPos.top,topRight-topLeft,fromPos.bottom),fromPos.bottom0?display.blinker=setInterval((function(){return display.cursorDiv.style.visibility=(on=!on)?"":"hidden"}),cm.options.cursorBlinkRate):cm.options.cursorBlinkRate<0&&(display.cursorDiv.style.visibility="hidden")}}function ensureFocus(cm){cm.state.focused||(cm.display.input.focus(),onFocus(cm))}function delayBlurEvent(cm){cm.state.delayingBlurEvent=!0,setTimeout((function(){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1,onBlur(cm))}),100)}function onFocus(cm,e){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1),"nocursor"!=cm.options.readOnly&&(cm.state.focused||(signal(cm,"focus",cm,e),cm.state.focused=!0,addClass(cm.display.wrapper,"CodeMirror-focused"),cm.curOp||cm.display.selForContextMenu==cm.doc.sel||(cm.display.input.reset(),webkit&&setTimeout((function(){return cm.display.input.reset(!0)}),20)),cm.display.input.receivedFocus()),restartBlink(cm))}function onBlur(cm,e){cm.state.delayingBlurEvent||(cm.state.focused&&(signal(cm,"blur",cm,e),cm.state.focused=!1,rmClass(cm.display.wrapper,"CodeMirror-focused")),clearInterval(cm.display.blinker),setTimeout((function(){cm.state.focused||(cm.display.shift=!1)}),150))}function updateHeightsInViewport(cm){for(var display=cm.display,prevBottom=display.lineDiv.offsetTop,i=0;i.005||diff<-.005)&&(updateLineHeight(cur.line,height),updateWidgetHeight(cur.line),cur.rest))for(var j=0;j=to&&(from=lineAtHeight(doc,heightAtLine(getLine(doc,ensureTo))-display.wrapper.clientHeight),to=ensureTo)}return{from:from,to:Math.max(to,from+1)}}function alignHorizontally(cm){var display=cm.display,view=display.view;if(display.alignWidgets||display.gutters.firstChild&&cm.options.fixedGutter){for(var comp=compensateForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft,gutterW=display.gutters.offsetWidth,left=comp+"px",i=0;iscreen&&(rect.bottom=rect.top+screen);var docBottom=cm.doc.height+paddingVert(display),atTop=rect.topdocBottom-snapMargin;if(rect.topscreentop+screen){var newTop=Math.min(rect.top,(atBottom?docBottom:rect.bottom)-screen);newTop!=screentop&&(result.scrollTop=newTop)}var screenleft=cm.curOp&&null!=cm.curOp.scrollLeft?cm.curOp.scrollLeft:display.scroller.scrollLeft,screenw=displayWidth(cm)-(cm.options.fixedGutter?display.gutters.offsetWidth:0),tooWide=rect.right-rect.left>screenw;return tooWide&&(rect.right=rect.left+screenw),rect.left<10?result.scrollLeft=0:rect.leftscreenw+screenleft-3&&(result.scrollLeft=rect.right+(tooWide?0:10)-screenw),result}function addToScrollTop(cm,top){null!=top&&(resolveScrollToPos(cm),cm.curOp.scrollTop=(null==cm.curOp.scrollTop?cm.doc.scrollTop:cm.curOp.scrollTop)+top)}function ensureCursorVisible(cm){resolveScrollToPos(cm);var cur=cm.getCursor();cm.curOp.scrollToPos={from:cur,to:cur,margin:cm.options.cursorScrollMargin}}function scrollToCoords(cm,x,y){null==x&&null==y||resolveScrollToPos(cm),null!=x&&(cm.curOp.scrollLeft=x),null!=y&&(cm.curOp.scrollTop=y)}function resolveScrollToPos(cm){var range$$1=cm.curOp.scrollToPos;range$$1&&(cm.curOp.scrollToPos=null,scrollToCoordsRange(cm,estimateCoords(cm,range$$1.from),estimateCoords(cm,range$$1.to),range$$1.margin))}function scrollToCoordsRange(cm,from,to,margin){var sPos=calculateScrollPos(cm,{left:Math.min(from.left,to.left),top:Math.min(from.top,to.top)-margin,right:Math.max(from.right,to.right),bottom:Math.max(from.bottom,to.bottom)+margin});scrollToCoords(cm,sPos.scrollLeft,sPos.scrollTop)}function updateScrollTop(cm,val){Math.abs(cm.doc.scrollTop-val)<2||(gecko||updateDisplaySimple(cm,{top:val}),setScrollTop(cm,val,!0),gecko&&updateDisplaySimple(cm),startWorker(cm,100))}function setScrollTop(cm,val,forceScroll){val=Math.min(cm.display.scroller.scrollHeight-cm.display.scroller.clientHeight,val),(cm.display.scroller.scrollTop!=val||forceScroll)&&(cm.doc.scrollTop=val,cm.display.scrollbars.setScrollTop(val),cm.display.scroller.scrollTop!=val&&(cm.display.scroller.scrollTop=val))}function setScrollLeft(cm,val,isScroller,forceScroll){val=Math.min(val,cm.display.scroller.scrollWidth-cm.display.scroller.clientWidth),(isScroller?val==cm.doc.scrollLeft:Math.abs(cm.doc.scrollLeft-val)<2)&&!forceScroll||(cm.doc.scrollLeft=val,alignHorizontally(cm),cm.display.scroller.scrollLeft!=val&&(cm.display.scroller.scrollLeft=val),cm.display.scrollbars.setScrollLeft(val))}function measureForScrollbars(cm){var d=cm.display,gutterW=d.gutters.offsetWidth,docH=Math.round(cm.doc.height+paddingVert(cm.display));return{clientHeight:d.scroller.clientHeight,viewHeight:d.wrapper.clientHeight,scrollWidth:d.scroller.scrollWidth,clientWidth:d.scroller.clientWidth,viewWidth:d.wrapper.clientWidth,barLeft:cm.options.fixedGutter?gutterW:0,docHeight:docH,scrollHeight:docH+scrollGap(cm)+d.barHeight,nativeBarWidth:d.nativeBarWidth,gutterWidth:gutterW}}var NativeScrollbars=function(place,scroll,cm){this.cm=cm;var vert=this.vert=elt("div",[elt("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),horiz=this.horiz=elt("div",[elt("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");vert.tabIndex=horiz.tabIndex=-1,place(vert),place(horiz),on(vert,"scroll",(function(){vert.clientHeight&&scroll(vert.scrollTop,"vertical")})),on(horiz,"scroll",(function(){horiz.clientWidth&&scroll(horiz.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,ie&&ie_version<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};NativeScrollbars.prototype.update=function(measure){var needsH=measure.scrollWidth>measure.clientWidth+1,needsV=measure.scrollHeight>measure.clientHeight+1,sWidth=measure.nativeBarWidth;if(needsV){this.vert.style.display="block",this.vert.style.bottom=needsH?sWidth+"px":"0";var totalHeight=measure.viewHeight-(needsH?sWidth:0);this.vert.firstChild.style.height=Math.max(0,measure.scrollHeight-measure.clientHeight+totalHeight)+"px"}else this.vert.style.display="",this.vert.firstChild.style.height="0";if(needsH){this.horiz.style.display="block",this.horiz.style.right=needsV?sWidth+"px":"0",this.horiz.style.left=measure.barLeft+"px";var totalWidth=measure.viewWidth-measure.barLeft-(needsV?sWidth:0);this.horiz.firstChild.style.width=Math.max(0,measure.scrollWidth-measure.clientWidth+totalWidth)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&measure.clientHeight>0&&(0==sWidth&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:needsV?sWidth:0,bottom:needsH?sWidth:0}},NativeScrollbars.prototype.setScrollLeft=function(pos){this.horiz.scrollLeft!=pos&&(this.horiz.scrollLeft=pos),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},NativeScrollbars.prototype.setScrollTop=function(pos){this.vert.scrollTop!=pos&&(this.vert.scrollTop=pos),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},NativeScrollbars.prototype.zeroWidthHack=function(){var w=mac&&!mac_geMountainLion?"12px":"18px";this.horiz.style.height=this.vert.style.width=w,this.horiz.style.pointerEvents=this.vert.style.pointerEvents="none",this.disableHoriz=new Delayed,this.disableVert=new Delayed},NativeScrollbars.prototype.enableZeroWidthBar=function(bar,delay,type){bar.style.pointerEvents="auto",delay.set(1e3,(function maybeDisable(){var box=bar.getBoundingClientRect();("vert"==type?document.elementFromPoint(box.right-1,(box.top+box.bottom)/2):document.elementFromPoint((box.right+box.left)/2,box.bottom-1))!=bar?bar.style.pointerEvents="none":delay.set(1e3,maybeDisable)}))},NativeScrollbars.prototype.clear=function(){var parent=this.horiz.parentNode;parent.removeChild(this.horiz),parent.removeChild(this.vert)};var NullScrollbars=function(){};function updateScrollbars(cm,measure){measure||(measure=measureForScrollbars(cm));var startWidth=cm.display.barWidth,startHeight=cm.display.barHeight;updateScrollbarsInner(cm,measure);for(var i=0;i<4&&startWidth!=cm.display.barWidth||startHeight!=cm.display.barHeight;i++)startWidth!=cm.display.barWidth&&cm.options.lineWrapping&&updateHeightsInViewport(cm),updateScrollbarsInner(cm,measureForScrollbars(cm)),startWidth=cm.display.barWidth,startHeight=cm.display.barHeight}function updateScrollbarsInner(cm,measure){var d=cm.display,sizes=d.scrollbars.update(measure);d.sizer.style.paddingRight=(d.barWidth=sizes.right)+"px",d.sizer.style.paddingBottom=(d.barHeight=sizes.bottom)+"px",d.heightForcer.style.borderBottom=sizes.bottom+"px solid transparent",sizes.right&&sizes.bottom?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=sizes.bottom+"px",d.scrollbarFiller.style.width=sizes.right+"px"):d.scrollbarFiller.style.display="",sizes.bottom&&cm.options.coverGutterNextToScrollbar&&cm.options.fixedGutter?(d.gutterFiller.style.display="block",d.gutterFiller.style.height=sizes.bottom+"px",d.gutterFiller.style.width=measure.gutterWidth+"px"):d.gutterFiller.style.display=""}NullScrollbars.prototype.update=function(){return{bottom:0,right:0}},NullScrollbars.prototype.setScrollLeft=function(){},NullScrollbars.prototype.setScrollTop=function(){},NullScrollbars.prototype.clear=function(){};var scrollbarModel={native:NativeScrollbars,null:NullScrollbars};function initScrollbars(cm){cm.display.scrollbars&&(cm.display.scrollbars.clear(),cm.display.scrollbars.addClass&&rmClass(cm.display.wrapper,cm.display.scrollbars.addClass)),cm.display.scrollbars=new scrollbarModel[cm.options.scrollbarStyle]((function(node){cm.display.wrapper.insertBefore(node,cm.display.scrollbarFiller),on(node,"mousedown",(function(){cm.state.focused&&setTimeout((function(){return cm.display.input.focus()}),0)})),node.setAttribute("cm-not-content","true")}),(function(pos,axis){"horizontal"==axis?setScrollLeft(cm,pos):updateScrollTop(cm,pos)}),cm),cm.display.scrollbars.addClass&&addClass(cm.display.wrapper,cm.display.scrollbars.addClass)}var nextOpId=0;function startOperation(cm){var op;cm.curOp={cm:cm,viewChanged:!1,startHeight:cm.doc.height,forceUpdate:!1,updateInput:null,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++nextOpId},op=cm.curOp,operationGroup?operationGroup.ops.push(op):op.ownsGroup=operationGroup={ops:[op],delayedCallbacks:[]}}function endOperation(cm){var op=cm.curOp;op&&function(op,endCb){var group=op.ownsGroup;if(group)try{!function(group){var callbacks=group.delayedCallbacks,i=0;do{for(;i=display.viewTo)||display.maxLineChanged&&cm.options.lineWrapping,op.update=op.mustUpdate&&new DisplayUpdate(cm,op.mustUpdate&&{top:op.scrollTop,ensure:op.scrollToPos},op.forceUpdate)}function endOperation_W1(op){op.updatedDisplay=op.mustUpdate&&updateDisplayIfNeeded(op.cm,op.update)}function endOperation_R2(op){var cm=op.cm,display=cm.display;op.updatedDisplay&&updateHeightsInViewport(cm),op.barMeasure=measureForScrollbars(cm),display.maxLineChanged&&!cm.options.lineWrapping&&(op.adjustWidthTo=measureChar(cm,display.maxLine,display.maxLine.text.length).left+3,cm.display.sizerWidth=op.adjustWidthTo,op.barMeasure.scrollWidth=Math.max(display.scroller.clientWidth,display.sizer.offsetLeft+op.adjustWidthTo+scrollGap(cm)+cm.display.barWidth),op.maxScrollLeft=Math.max(0,display.sizer.offsetLeft+op.adjustWidthTo-displayWidth(cm))),(op.updatedDisplay||op.selectionChanged)&&(op.preparedSelection=display.input.prepareSelection())}function endOperation_W2(op){var cm=op.cm;null!=op.adjustWidthTo&&(cm.display.sizer.style.minWidth=op.adjustWidthTo+"px",op.maxScrollLeft1&&(changed=!0)),null!=scrollPos.scrollLeft&&(setScrollLeft(cm,scrollPos.scrollLeft),Math.abs(cm.doc.scrollLeft-startLeft)>1&&(changed=!0)),!changed)break}return rect}(cm,clipPos(doc,op.scrollToPos.from),clipPos(doc,op.scrollToPos.to),op.scrollToPos.margin);!function(cm,rect){if(!signalDOMEvent(cm,"scrollCursorIntoView")){var display=cm.display,box=display.sizer.getBoundingClientRect(),doScroll=null;if(rect.top+box.top<0?doScroll=!0:rect.bottom+box.top>(window.innerHeight||document.documentElement.clientHeight)&&(doScroll=!1),null!=doScroll&&!phantom){var scrollNode=elt("div","​",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;");cm.display.lineSpace.appendChild(scrollNode),scrollNode.scrollIntoView(doScroll),cm.display.lineSpace.removeChild(scrollNode)}}}(cm,rect)}var hidden=op.maybeHiddenMarkers,unhidden=op.maybeUnhiddenMarkers;if(hidden)for(var i=0;ifrom)&&(display.updateLineNumbers=from),cm.curOp.viewChanged=!0,from>=display.viewTo)sawCollapsedSpans&&visualLineNo(cm.doc,from)display.viewFrom?resetView(cm):(display.viewFrom+=lendiff,display.viewTo+=lendiff);else if(from<=display.viewFrom&&to>=display.viewTo)resetView(cm);else if(from<=display.viewFrom){var cut=viewCuttingPoint(cm,to,to+lendiff,1);cut?(display.view=display.view.slice(cut.index),display.viewFrom=cut.lineN,display.viewTo+=lendiff):resetView(cm)}else if(to>=display.viewTo){var cut$1=viewCuttingPoint(cm,from,from,-1);cut$1?(display.view=display.view.slice(0,cut$1.index),display.viewTo=cut$1.lineN):resetView(cm)}else{var cutTop=viewCuttingPoint(cm,from,from,-1),cutBot=viewCuttingPoint(cm,to,to+lendiff,1);cutTop&&cutBot?(display.view=display.view.slice(0,cutTop.index).concat(buildViewArray(cm,cutTop.lineN,cutBot.lineN)).concat(display.view.slice(cutBot.index)),display.viewTo+=lendiff):resetView(cm)}var ext=display.externalMeasured;ext&&(to=ext.lineN&&line=display.viewTo)){var lineView=display.view[findViewIndex(cm,line)];if(null!=lineView.node){var arr=lineView.changes||(lineView.changes=[]);-1==indexOf(arr,type)&&arr.push(type)}}}function resetView(cm){cm.display.viewFrom=cm.display.viewTo=cm.doc.first,cm.display.view=[],cm.display.viewOffset=0}function viewCuttingPoint(cm,oldN,newN,dir){var diff,index=findViewIndex(cm,oldN),view=cm.display.view;if(!sawCollapsedSpans||newN==cm.doc.first+cm.doc.size)return{index:index,lineN:newN};for(var n=cm.display.viewFrom,i=0;i0){if(index==view.length-1)return null;diff=n+view[index].size-oldN,index++}else diff=n-oldN;oldN+=diff,newN+=diff}for(;visualLineNo(cm.doc,newN)!=newN;){if(index==(dir<0?0:view.length-1))return null;newN+=dir*view[index-(dir<0?1:0)].size,index+=dir}return{index:index,lineN:newN}}function countDirtyView(cm){for(var view=cm.display.view,dirty=0,i=0;i=cm.display.viewTo)){var end=+new Date+cm.options.workTime,context=getContextBefore(cm,doc.highlightFrontier),changedLines=[];doc.iter(context.line,Math.min(doc.first+doc.size,cm.display.viewTo+500),(function(line){if(context.line>=cm.display.viewFrom){var oldStyles=line.styles,resetState=line.text.length>cm.options.maxHighlightLength?copyState(doc.mode,context.state):null,highlighted=highlightLine(cm,line,context,!0);resetState&&(context.state=resetState),line.styles=highlighted.styles;var oldCls=line.styleClasses,newCls=highlighted.classes;newCls?line.styleClasses=newCls:oldCls&&(line.styleClasses=null);for(var ischange=!oldStyles||oldStyles.length!=line.styles.length||oldCls!=newCls&&(!oldCls||!newCls||oldCls.bgClass!=newCls.bgClass||oldCls.textClass!=newCls.textClass),i=0;!ischange&&iend)return startWorker(cm,cm.options.workDelay),!0})),doc.highlightFrontier=context.line,doc.modeFrontier=Math.max(doc.modeFrontier,context.line),changedLines.length&&runInOp(cm,(function(){for(var i=0;i=display.viewFrom&&update.visible.to<=display.viewTo&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo)&&display.renderedView==display.view&&0==countDirtyView(cm))return!1;maybeUpdateLineNumberWidth(cm)&&(resetView(cm),update.dims=getDimensions(cm));var end=doc.first+doc.size,from=Math.max(update.visible.from-cm.options.viewportMargin,doc.first),to=Math.min(end,update.visible.to+cm.options.viewportMargin);display.viewFromto&&display.viewTo-to<20&&(to=Math.min(end,display.viewTo)),sawCollapsedSpans&&(from=visualLineNo(cm.doc,from),to=visualLineEndNo(cm.doc,to));var different=from!=display.viewFrom||to!=display.viewTo||display.lastWrapHeight!=update.wrapperHeight||display.lastWrapWidth!=update.wrapperWidth;!function(cm,from,to){var display=cm.display;0==display.view.length||from>=display.viewTo||to<=display.viewFrom?(display.view=buildViewArray(cm,from,to),display.viewFrom=from):(display.viewFrom>from?display.view=buildViewArray(cm,from,display.viewFrom).concat(display.view):display.viewFromto&&(display.view=display.view.slice(0,findViewIndex(cm,to)))),display.viewTo=to}(cm,from,to),display.viewOffset=heightAtLine(getLine(cm.doc,display.viewFrom)),cm.display.mover.style.top=display.viewOffset+"px";var toUpdate=countDirtyView(cm);if(!different&&0==toUpdate&&!update.force&&display.renderedView==display.view&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo))return!1;var selSnapshot=function(cm){if(cm.hasFocus())return null;var active=activeElt();if(!active||!contains(cm.display.lineDiv,active))return null;var result={activeElt:active};if(window.getSelection){var sel=window.getSelection();sel.anchorNode&&sel.extend&&contains(cm.display.lineDiv,sel.anchorNode)&&(result.anchorNode=sel.anchorNode,result.anchorOffset=sel.anchorOffset,result.focusNode=sel.focusNode,result.focusOffset=sel.focusOffset)}return result}(cm);return toUpdate>4&&(display.lineDiv.style.display="none"),function(cm,updateNumbersFrom,dims){var display=cm.display,lineNumbers=cm.options.lineNumbers,container=display.lineDiv,cur=container.firstChild;function rm(node){var next=node.nextSibling;return webkit&&mac&&cm.display.currentWheelTarget==node?node.style.display="none":node.parentNode.removeChild(node),next}for(var view=display.view,lineN=display.viewFrom,i=0;i-1&&(updateNumber=!1),updateLineForChanges(cm,lineView,lineN,dims)),updateNumber&&(removeChildren(lineView.lineNumber),lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options,lineN)))),cur=lineView.node.nextSibling}else{var node=buildLineElement(cm,lineView,lineN,dims);container.insertBefore(node,cur)}lineN+=lineView.size}for(;cur;)cur=rm(cur)}(cm,display.updateLineNumbers,update.dims),toUpdate>4&&(display.lineDiv.style.display=""),display.renderedView=display.view,function(snapshot){if(snapshot&&snapshot.activeElt&&snapshot.activeElt!=activeElt()&&(snapshot.activeElt.focus(),snapshot.anchorNode&&contains(document.body,snapshot.anchorNode)&&contains(document.body,snapshot.focusNode))){var sel=window.getSelection(),range$$1=document.createRange();range$$1.setEnd(snapshot.anchorNode,snapshot.anchorOffset),range$$1.collapse(!1),sel.removeAllRanges(),sel.addRange(range$$1),sel.extend(snapshot.focusNode,snapshot.focusOffset)}}(selSnapshot),removeChildren(display.cursorDiv),removeChildren(display.selectionDiv),display.gutters.style.height=display.sizer.style.minHeight=0,different&&(display.lastWrapHeight=update.wrapperHeight,display.lastWrapWidth=update.wrapperWidth,startWorker(cm,400)),display.updateLineNumbers=null,!0}function postUpdateDisplay(cm,update){for(var viewport=update.viewport,first=!0;(first&&cm.options.lineWrapping&&update.oldDisplayWidth!=displayWidth(cm)||(viewport&&null!=viewport.top&&(viewport={top:Math.min(cm.doc.height+paddingVert(cm.display)-displayHeight(cm),viewport.top)}),update.visible=visibleLines(cm.display,cm.doc,viewport),!(update.visible.from>=cm.display.viewFrom&&update.visible.to<=cm.display.viewTo)))&&updateDisplayIfNeeded(cm,update);first=!1){updateHeightsInViewport(cm);var barMeasure=measureForScrollbars(cm);updateSelection(cm),updateScrollbars(cm,barMeasure),setDocumentHeight(cm,barMeasure),update.force=!1}update.signal(cm,"update",cm),cm.display.viewFrom==cm.display.reportedViewFrom&&cm.display.viewTo==cm.display.reportedViewTo||(update.signal(cm,"viewportChange",cm,cm.display.viewFrom,cm.display.viewTo),cm.display.reportedViewFrom=cm.display.viewFrom,cm.display.reportedViewTo=cm.display.viewTo)}function updateDisplaySimple(cm,viewport){var update=new DisplayUpdate(cm,viewport);if(updateDisplayIfNeeded(cm,update)){updateHeightsInViewport(cm),postUpdateDisplay(cm,update);var barMeasure=measureForScrollbars(cm);updateSelection(cm),updateScrollbars(cm,barMeasure),setDocumentHeight(cm,barMeasure),update.finish()}}function updateGutterSpace(cm){var width=cm.display.gutters.offsetWidth;cm.display.sizer.style.marginLeft=width+"px"}function setDocumentHeight(cm,measure){cm.display.sizer.style.minHeight=measure.docHeight+"px",cm.display.heightForcer.style.top=measure.docHeight+"px",cm.display.gutters.style.height=measure.docHeight+cm.display.barHeight+scrollGap(cm)+"px"}function updateGutters(cm){var gutters=cm.display.gutters,specs=cm.options.gutters;removeChildren(gutters);for(var i=0;i-1&&!options.lineNumbers&&(options.gutters=options.gutters.slice(0),options.gutters.splice(found,1))}DisplayUpdate.prototype.signal=function(emitter,type){hasHandler(emitter,type)&&this.events.push(arguments)},DisplayUpdate.prototype.finish=function(){for(var i=0;iscroll.clientWidth,canScrollY=scroll.scrollHeight>scroll.clientHeight;if(dx&&canScrollX||dy&&canScrollY){if(dy&&mac&&webkit)outer:for(var cur=e.target,view=display.view;cur!=scroll;cur=cur.parentNode)for(var i=0;i=0&&cmp(pos,range.to())<=0)return i}return-1};var Range=function(anchor,head){this.anchor=anchor,this.head=head};function normalizeSelection(cm,ranges,primIndex){var mayTouch=cm&&cm.options.selectionsMayTouch,prim=ranges[primIndex];ranges.sort((function(a,b){return cmp(a.from(),b.from())})),primIndex=indexOf(ranges,prim);for(var i=1;i0:diff>=0){var from=minPos(prev.from(),cur.from()),to=maxPos(prev.to(),cur.to()),inv=prev.empty()?cur.from()==cur.head:prev.from()==prev.head;i<=primIndex&&--primIndex,ranges.splice(--i,2,new Range(inv?to:from,inv?from:to))}}return new Selection(ranges,primIndex)}function simpleSelection(anchor,head){return new Selection([new Range(anchor,head||anchor)],0)}function changeEnd(change){return change.text?Pos(change.from.line+change.text.length-1,lst(change.text).length+(1==change.text.length?change.from.ch:0)):change.to}function adjustForChange(pos,change){if(cmp(pos,change.from)<0)return pos;if(cmp(pos,change.to)<=0)return changeEnd(change);var line=pos.line+change.text.length-(change.to.line-change.from.line)-1,ch=pos.ch;return pos.line==change.to.line&&(ch+=changeEnd(change).ch-change.to.ch),Pos(line,ch)}function computeSelAfterChange(doc,change){for(var out=[],i=0;i1&&doc.remove(from.line+1,nlines-1),doc.insert(from.line+1,added$2)}signalLater(doc,"change",doc,change)}function linkedDocs(doc,f,sharedHistOnly){!function propagate(doc,skip,sharedHist){if(doc.linked)for(var i=0;itime-(doc.cm?doc.cm.options.historyEventDelay:500)||"*"==change.origin.charAt(0)))&&(cur=function(hist,force){return force?(clearSelectionEvents(hist.done),lst(hist.done)):hist.done.length&&!lst(hist.done).ranges?lst(hist.done):hist.done.length>1&&!hist.done[hist.done.length-2].ranges?(hist.done.pop(),lst(hist.done)):void 0}(hist,hist.lastOp==opId)))last=lst(cur.changes),0==cmp(change.from,change.to)&&0==cmp(change.from,last.to)?last.to=changeEnd(change):cur.changes.push(historyChangeFromChange(doc,change));else{var before=lst(hist.done);for(before&&before.ranges||pushSelectionToHistory(doc.sel,hist.done),cur={changes:[historyChangeFromChange(doc,change)],generation:hist.generation},hist.done.push(cur);hist.done.length>hist.undoDepth;)hist.done.shift(),hist.done[0].ranges||hist.done.shift()}hist.done.push(selAfter),hist.generation=++hist.maxGeneration,hist.lastModTime=hist.lastSelTime=time,hist.lastOp=hist.lastSelOp=opId,hist.lastOrigin=hist.lastSelOrigin=change.origin,last||signal(doc,"historyAdded")}function addSelectionToHistory(doc,sel,opId,options){var hist=doc.history,origin=options&&options.origin;opId==hist.lastSelOp||origin&&hist.lastSelOrigin==origin&&(hist.lastModTime==hist.lastSelTime&&hist.lastOrigin==origin||function(doc,origin,prev,sel){var ch=origin.charAt(0);return"*"==ch||"+"==ch&&prev.ranges.length==sel.ranges.length&&prev.somethingSelected()==sel.somethingSelected()&&new Date-doc.history.lastSelTime<=(doc.cm?doc.cm.options.historyEventDelay:500)}(doc,origin,lst(hist.done),sel))?hist.done[hist.done.length-1]=sel:pushSelectionToHistory(sel,hist.done),hist.lastSelTime=+new Date,hist.lastSelOrigin=origin,hist.lastSelOp=opId,options&&!1!==options.clearRedo&&clearSelectionEvents(hist.undone)}function pushSelectionToHistory(sel,dest){var top=lst(dest);top&&top.ranges&&top.equals(sel)||dest.push(sel)}function attachLocalSpans(doc,change,from,to){var existing=change["spans_"+doc.id],n=0;doc.iter(Math.max(doc.first,from),Math.min(doc.first+doc.size,to),(function(line){line.markedSpans&&((existing||(existing=change["spans_"+doc.id]={}))[n]=line.markedSpans),++n}))}function removeClearedSpans(spans){if(!spans)return null;for(var out,i=0;i-1&&(lst(newChanges)[prop]=change[prop],delete change[prop])}}}return copy}function extendRange(range,head,other,extend){if(extend){var anchor=range.anchor;if(other){var posBefore=cmp(head,anchor)<0;posBefore!=cmp(other,anchor)<0?(anchor=head,head=other):posBefore!=cmp(head,other)<0&&(head=other)}return new Range(anchor,head)}return new Range(other||head,head)}function extendSelection(doc,head,other,options,extend){null==extend&&(extend=doc.cm&&(doc.cm.display.shift||doc.extend)),setSelection(doc,new Selection([extendRange(doc.sel.primary(),head,other,extend)],0),options)}function extendSelections(doc,heads,options){for(var out=[],extend=doc.cm&&(doc.cm.display.shift||doc.extend),i=0;i=pos.ch:sp.to>pos.ch))){if(mayClear&&(signal(m,"beforeCursorEnter"),m.explicitlyCleared)){if(line.markedSpans){--i;continue}break}if(!m.atomic)continue;if(oldPos){var near=m.find(dir<0?1:-1),diff=void 0;if((dir<0?m.inclusiveRight:m.inclusiveLeft)&&(near=movePos(doc,near,-dir,near&&near.line==pos.line?line:null)),near&&near.line==pos.line&&(diff=cmp(near,oldPos))&&(dir<0?diff<0:diff>0))return skipAtomicInner(doc,near,pos,dir,mayClear)}var far=m.find(dir<0?-1:1);return(dir<0?m.inclusiveLeft:m.inclusiveRight)&&(far=movePos(doc,far,dir,far.line==pos.line?line:null)),far?skipAtomicInner(doc,far,pos,dir,mayClear):null}}return pos}function skipAtomic(doc,pos,oldPos,bias,mayClear){var dir=bias||1,found=skipAtomicInner(doc,pos,oldPos,dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,dir,!0)||skipAtomicInner(doc,pos,oldPos,-dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,-dir,!0);return found||(doc.cantEdit=!0,Pos(doc.first,0))}function movePos(doc,pos,dir,line){return dir<0&&0==pos.ch?pos.line>doc.first?clipPos(doc,Pos(pos.line-1)):null:dir>0&&pos.ch==(line||getLine(doc,pos.line)).text.length?pos.line0)){var newParts=[j,1],dfrom=cmp(p.from,m.from),dto=cmp(p.to,m.to);(dfrom<0||!mk.inclusiveLeft&&!dfrom)&&newParts.push({from:p.from,to:m.from}),(dto>0||!mk.inclusiveRight&&!dto)&&newParts.push({from:m.to,to:p.to}),parts.splice.apply(parts,newParts),j+=newParts.length-3}}return parts}(doc,change.from,change.to);if(split)for(var i=split.length-1;i>=0;--i)makeChangeInner(doc,{from:split[i].from,to:split[i].to,text:i?[""]:change.text,origin:change.origin});else makeChangeInner(doc,change)}}function makeChangeInner(doc,change){if(1!=change.text.length||""!=change.text[0]||0!=cmp(change.from,change.to)){var selAfter=computeSelAfterChange(doc,change);addChangeToHistory(doc,change,selAfter,doc.cm?doc.cm.curOp.id:NaN),makeChangeSingleDoc(doc,change,selAfter,stretchSpansOverChange(doc,change));var rebased=[];linkedDocs(doc,(function(doc,sharedHist){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,stretchSpansOverChange(doc,change))}))}}function makeChangeFromHistory(doc,type,allowSelectionOnly){var suppress=doc.cm&&doc.cm.state.suppressEdits;if(!suppress||allowSelectionOnly){for(var event,hist=doc.history,selAfter=doc.sel,source="undo"==type?hist.done:hist.undone,dest="undo"==type?hist.undone:hist.done,i=0;i=0;--i$1){var returned=loop(i$1);if(returned)return returned.v}}}}function shiftDoc(doc,distance){if(0!=distance&&(doc.first+=distance,doc.sel=new Selection(map(doc.sel.ranges,(function(range){return new Range(Pos(range.anchor.line+distance,range.anchor.ch),Pos(range.head.line+distance,range.head.ch))})),doc.sel.primIndex),doc.cm)){regChange(doc.cm,doc.first,doc.first-distance,distance);for(var d=doc.cm.display,l=d.viewFrom;ldoc.lastLine())){if(change.from.linelast&&(change={from:change.from,to:Pos(last,getLine(doc,last).text.length),text:[change.text[0]],origin:change.origin}),change.removed=getBetween(doc,change.from,change.to),selAfter||(selAfter=computeSelAfterChange(doc,change)),doc.cm?function(cm,change,spans){var doc=cm.doc,display=cm.display,from=change.from,to=change.to,recomputeMaxLength=!1,checkWidthStart=from.line;cm.options.lineWrapping||(checkWidthStart=lineNo(visualLine(getLine(doc,from.line))),doc.iter(checkWidthStart,to.line+1,(function(line){if(line==display.maxLine)return recomputeMaxLength=!0,!0}))),doc.sel.contains(change.from,change.to)>-1&&signalCursorActivity(cm),updateDoc(doc,change,spans,estimateHeight(cm)),cm.options.lineWrapping||(doc.iter(checkWidthStart,from.line+change.text.length,(function(line){var len=lineLength(line);len>display.maxLineLength&&(display.maxLine=line,display.maxLineLength=len,display.maxLineChanged=!0,recomputeMaxLength=!1)})),recomputeMaxLength&&(cm.curOp.updateMaxLine=!0)),function(doc,n){if(doc.modeFrontier=Math.min(doc.modeFrontier,n),!(doc.highlightFrontierstart;line--){var saved=getLine(doc,line).stateAfter;if(saved&&(!(saved instanceof SavedContext)||line+saved.lookAhead1||!(this.children[0]instanceof LeafChunk))){var lines=[];this.collapse(lines),this.children=[new LeafChunk(lines)],this.children[0].parent=this}},collapse:function(lines){for(var i=0;i50){for(var remaining=child.lines.length%25+25,pos=remaining;pos10);me.parent.maybeSpill()}},iterN:function(at,n,op){for(var i=0;i0||0==diff&&!1!==marker.clearWhenEmpty)return marker;if(marker.replacedWith&&(marker.collapsed=!0,marker.widgetNode=eltP("span",[marker.replacedWith],"CodeMirror-widget"),options.handleMouseEvents||marker.widgetNode.setAttribute("cm-ignore-events","true"),options.insertLeft&&(marker.widgetNode.insertLeft=!0)),marker.collapsed){if(conflictingCollapsedRange(doc,from.line,from,to,marker)||from.line!=to.line&&conflictingCollapsedRange(doc,to.line,from,to,marker))throw new Error("Inserting collapsed marker partially overlapping an existing one");sawCollapsedSpans=!0}marker.addToHistory&&addChangeToHistory(doc,{from:from,to:to,origin:"markText"},doc.sel,NaN);var updateMaxLine,curLine=from.line,cm=doc.cm;if(doc.iter(curLine,to.line+1,(function(line){cm&&marker.collapsed&&!cm.options.lineWrapping&&visualLine(line)==cm.display.maxLine&&(updateMaxLine=!0),marker.collapsed&&curLine!=from.line&&updateLineHeight(line,0),function(line,span){line.markedSpans=line.markedSpans?line.markedSpans.concat([span]):[span],span.marker.attachLine(line)}(line,new MarkedSpan(marker,curLine==from.line?from.ch:null,curLine==to.line?to.ch:null)),++curLine})),marker.collapsed&&doc.iter(from.line,to.line+1,(function(line){lineIsHidden(doc,line)&&updateLineHeight(line,0)})),marker.clearOnEnter&&on(marker,"beforeCursorEnter",(function(){return marker.clear()})),marker.readOnly&&(sawReadOnlySpans=!0,(doc.history.done.length||doc.history.undone.length)&&doc.clearHistory()),marker.collapsed&&(marker.id=++nextMarkerId,marker.atomic=!0),cm){if(updateMaxLine&&(cm.curOp.updateMaxLine=!0),marker.collapsed)regChange(cm,from.line,to.line+1);else if(marker.className||marker.title||marker.startStyle||marker.endStyle||marker.css)for(var i=from.line;i<=to.line;i++)regLineChange(cm,i,"text");marker.atomic&&reCheckSelection(cm.doc),signalLater(cm,"markerAdded",cm,marker)}return marker}TextMarker.prototype.clear=function(){if(!this.explicitlyCleared){var cm=this.doc.cm,withOp=cm&&!cm.curOp;if(withOp&&startOperation(cm),hasHandler(this,"clear")){var found=this.find();found&&signalLater(this,"clear",found.from,found.to)}for(var min=null,max=null,i=0;icm.display.maxLineLength&&(cm.display.maxLine=visual,cm.display.maxLineLength=len,cm.display.maxLineChanged=!0)}null!=min&&cm&&this.collapsed&®Change(cm,min,max+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,cm&&reCheckSelection(cm.doc)),cm&&signalLater(cm,"markerCleared",cm,this,min,max),withOp&&endOperation(cm),this.parent&&this.parent.clear()}},TextMarker.prototype.find=function(side,lineObj){var from,to;null==side&&"bookmark"==this.type&&(side=1);for(var i=0;i=0;i$1--)makeChange(this,changes[i$1]);newSel?setSelectionReplaceHistory(this,newSel):this.cm&&ensureCursorVisible(this.cm)})),undo:docMethodOp((function(){makeChangeFromHistory(this,"undo")})),redo:docMethodOp((function(){makeChangeFromHistory(this,"redo")})),undoSelection:docMethodOp((function(){makeChangeFromHistory(this,"undo",!0)})),redoSelection:docMethodOp((function(){makeChangeFromHistory(this,"redo",!0)})),setExtending:function(val){this.extend=val},getExtending:function(){return this.extend},historySize:function(){for(var hist=this.history,done=0,undone=0,i=0;i=pos.ch)&&markers.push(span.marker.parent||span.marker)}return markers},findMarks:function(from,to,filter){from=clipPos(this,from),to=clipPos(this,to);var found=[],lineNo$$1=from.line;return this.iter(from.line,to.line+1,(function(line){var spans=line.markedSpans;if(spans)for(var i=0;i=span.to||null==span.from&&lineNo$$1!=from.line||null!=span.from&&lineNo$$1==to.line&&span.from>=to.ch||filter&&!filter(span.marker)||found.push(span.marker.parent||span.marker)}++lineNo$$1})),found},getAllMarks:function(){var markers=[];return this.iter((function(line){var sps=line.markedSpans;if(sps)for(var i=0;ioff)return ch=off,!0;off-=sz,++lineNo$$1})),clipPos(this,Pos(lineNo$$1,ch))},indexFromPos:function(coords){var index=(coords=clipPos(this,coords)).ch;if(coords.linefrom&&(from=options.from),null!=options.to&&options.to-1)return cm.state.draggingText(e),void setTimeout((function(){return cm.display.input.focus()}),20);try{var text$1=e.dataTransfer.getData("Text");if(text$1){var selected;if(cm.state.draggingText&&!cm.state.draggingText.copy&&(selected=cm.listSelections()),setSelectionNoUndo(cm.doc,simpleSelection(pos,pos)),selected)for(var i$1=0;i$1=0;i--)replaceRange(cm.doc,"",kill[i].from,kill[i].to,"+delete");ensureCursorVisible(cm)}))}function moveCharLogically(line,ch,dir){var target=skipExtendingChars(line.text,ch+dir,dir);return target<0||target>line.text.length?null:target}function moveLogically(line,start,dir){var ch=moveCharLogically(line,start.ch,dir);return null==ch?null:new Pos(start.line,ch,dir<0?"after":"before")}function endOfLine(visually,cm,lineObj,lineNo,dir){if(visually){var order=getOrder(lineObj,cm.doc.direction);if(order){var ch,part=dir<0?lst(order):order[0],sticky=dir<0==(1==part.level)?"after":"before";if(part.level>0||"rtl"==cm.doc.direction){var prep=prepareMeasureForLine(cm,lineObj);ch=dir<0?lineObj.text.length-1:0;var targetTop=measureCharPrepared(cm,prep,ch).top;ch=findFirst((function(ch){return measureCharPrepared(cm,prep,ch).top==targetTop}),dir<0==(1==part.level)?part.from:part.to-1,ch),"before"==sticky&&(ch=moveCharLogically(lineObj,ch,1))}else ch=dir<0?part.to:part.from;return new Pos(lineNo,ch,sticky)}}return new Pos(lineNo,dir<0?lineObj.text.length:0,dir<0?"before":"after")}keyMap.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},keyMap.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},keyMap.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Alt-F":"goWordRight","Alt-B":"goWordLeft","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-D":"delWordAfter","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},keyMap.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},keyMap.default=mac?keyMap.macDefault:keyMap.pcDefault;var commands={selectAll:selectAll,singleSelection:function(cm){return cm.setSelection(cm.getCursor("anchor"),cm.getCursor("head"),sel_dontScroll)},killLine:function(cm){return deleteNearSelection(cm,(function(range){if(range.empty()){var len=getLine(cm.doc,range.head.line).text.length;return range.head.ch==len&&range.head.line0)cur=new Pos(cur.line,cur.ch+1),cm.replaceRange(line.charAt(cur.ch-1)+line.charAt(cur.ch-2),Pos(cur.line,cur.ch-2),cur,"+transpose");else if(cur.line>cm.doc.first){var prev=getLine(cm.doc,cur.line-1).text;prev&&(cur=new Pos(cur.line,1),cm.replaceRange(line.charAt(0)+cm.doc.lineSeparator()+prev.charAt(prev.length-1),Pos(cur.line-1,prev.length-1),cur,"+transpose"))}newSel.push(new Range(cur,cur))}cm.setSelections(newSel)}))},newlineAndIndent:function(cm){return runInOp(cm,(function(){for(var sels=cm.listSelections(),i=sels.length-1;i>=0;i--)cm.replaceRange(cm.doc.lineSeparator(),sels[i].anchor,sels[i].head,"+input");sels=cm.listSelections();for(var i$1=0;i$1-1&&(cmp((contained=sel.ranges[contained]).from(),pos)<0||pos.xRel>0)&&(cmp(contained.to(),pos)>0||pos.xRel<0)?function(cm,event,pos,behavior){var display=cm.display,moved=!1,dragEnd=operation(cm,(function(e){webkit&&(display.scroller.draggable=!1),cm.state.draggingText=!1,off(display.wrapper.ownerDocument,"mouseup",dragEnd),off(display.wrapper.ownerDocument,"mousemove",mouseMove),off(display.scroller,"dragstart",dragStart),off(display.scroller,"drop",dragEnd),moved||(e_preventDefault(e),behavior.addNew||extendSelection(cm.doc,pos,null,null,behavior.extend),webkit||ie&&9==ie_version?setTimeout((function(){display.wrapper.ownerDocument.body.focus(),display.input.focus()}),20):display.input.focus())})),mouseMove=function(e2){moved=moved||Math.abs(event.clientX-e2.clientX)+Math.abs(event.clientY-e2.clientY)>=10},dragStart=function(){return moved=!0};webkit&&(display.scroller.draggable=!0),cm.state.draggingText=dragEnd,dragEnd.copy=!behavior.moveOnDrag,display.scroller.dragDrop&&display.scroller.dragDrop(),on(display.wrapper.ownerDocument,"mouseup",dragEnd),on(display.wrapper.ownerDocument,"mousemove",mouseMove),on(display.scroller,"dragstart",dragStart),on(display.scroller,"drop",dragEnd),delayBlurEvent(cm),setTimeout((function(){return display.input.focus()}),20)}(cm,event,pos,behavior):function(cm,event,start,behavior){var display=cm.display,doc=cm.doc;e_preventDefault(event);var ourRange,ourIndex,startSel=doc.sel,ranges=startSel.ranges;if(behavior.addNew&&!behavior.extend?(ourIndex=doc.sel.contains(start),ourRange=ourIndex>-1?ranges[ourIndex]:new Range(start,start)):(ourRange=doc.sel.primary(),ourIndex=doc.sel.primIndex),"rectangle"==behavior.unit)behavior.addNew||(ourRange=new Range(start,start)),start=posFromMouse(cm,event,!0,!0),ourIndex=-1;else{var range$$1=rangeForUnit(cm,start,behavior.unit);ourRange=behavior.extend?extendRange(ourRange,range$$1.anchor,range$$1.head,behavior.extend):range$$1}behavior.addNew?-1==ourIndex?(ourIndex=ranges.length,setSelection(doc,normalizeSelection(cm,ranges.concat([ourRange]),ourIndex),{scroll:!1,origin:"*mouse"})):ranges.length>1&&ranges[ourIndex].empty()&&"char"==behavior.unit&&!behavior.extend?(setSelection(doc,normalizeSelection(cm,ranges.slice(0,ourIndex).concat(ranges.slice(ourIndex+1)),0),{scroll:!1,origin:"*mouse"}),startSel=doc.sel):replaceOneSelection(doc,ourIndex,ourRange,sel_mouse):(ourIndex=0,setSelection(doc,new Selection([ourRange],0),sel_mouse),startSel=doc.sel);var lastPos=start;function extendTo(pos){if(0!=cmp(lastPos,pos))if(lastPos=pos,"rectangle"==behavior.unit){for(var ranges=[],tabSize=cm.options.tabSize,startCol=countColumn(getLine(doc,start.line).text,start.ch,tabSize),posCol=countColumn(getLine(doc,pos.line).text,pos.ch,tabSize),left=Math.min(startCol,posCol),right=Math.max(startCol,posCol),line=Math.min(start.line,pos.line),end=Math.min(cm.lastLine(),Math.max(start.line,pos.line));line<=end;line++){var text=getLine(doc,line).text,leftPos=findColumn(text,left,tabSize);left==right?ranges.push(new Range(Pos(line,leftPos),Pos(line,leftPos))):text.length>leftPos&&ranges.push(new Range(Pos(line,leftPos),Pos(line,findColumn(text,right,tabSize))))}ranges.length||ranges.push(new Range(start,start)),setSelection(doc,normalizeSelection(cm,startSel.ranges.slice(0,ourIndex).concat(ranges),ourIndex),{origin:"*mouse",scroll:!1}),cm.scrollIntoView(pos)}else{var head,oldRange=ourRange,range$$1=rangeForUnit(cm,pos,behavior.unit),anchor=oldRange.anchor;cmp(range$$1.anchor,anchor)>0?(head=range$$1.head,anchor=minPos(oldRange.from(),range$$1.anchor)):(head=range$$1.anchor,anchor=maxPos(oldRange.to(),range$$1.head));var ranges$1=startSel.ranges.slice(0);ranges$1[ourIndex]=function(cm,range$$1){var anchor=range$$1.anchor,head=range$$1.head,anchorLine=getLine(cm.doc,anchor.line);if(0==cmp(anchor,head)&&anchor.sticky==head.sticky)return range$$1;var order=getOrder(anchorLine);if(!order)return range$$1;var index=getBidiPartAt(order,anchor.ch,anchor.sticky),part=order[index];if(part.from!=anchor.ch&&part.to!=anchor.ch)return range$$1;var leftSide,boundary=index+(part.from==anchor.ch==(1!=part.level)?0:1);if(0==boundary||boundary==order.length)return range$$1;if(head.line!=anchor.line)leftSide=(head.line-anchor.line)*("ltr"==cm.doc.direction?1:-1)>0;else{var headIndex=getBidiPartAt(order,head.ch,head.sticky),dir=headIndex-index||(head.ch-anchor.ch)*(1==part.level?-1:1);leftSide=headIndex==boundary-1||headIndex==boundary?dir<0:dir>0}var usePart=order[boundary+(leftSide?-1:0)],from=leftSide==(1==usePart.level),ch=from?usePart.from:usePart.to,sticky=from?"after":"before";return anchor.ch==ch&&anchor.sticky==sticky?range$$1:new Range(new Pos(anchor.line,ch,sticky),head)}(cm,new Range(clipPos(doc,anchor),head)),setSelection(doc,normalizeSelection(cm,ranges$1,ourIndex),sel_mouse)}}var editorSize=display.wrapper.getBoundingClientRect(),counter=0;function extend(e){var curCount=++counter,cur=posFromMouse(cm,e,!0,"rectangle"==behavior.unit);if(cur)if(0!=cmp(cur,lastPos)){cm.curOp.focus=activeElt(),extendTo(cur);var visible=visibleLines(display,doc);(cur.line>=visible.to||cur.lineeditorSize.bottom?20:0;outside&&setTimeout(operation(cm,(function(){counter==curCount&&(display.scroller.scrollTop+=outside,extend(e))})),50)}}function done(e){cm.state.selectingText=!1,counter=1/0,e_preventDefault(e),display.input.focus(),off(display.wrapper.ownerDocument,"mousemove",move),off(display.wrapper.ownerDocument,"mouseup",up),doc.history.lastSelOrigin=null}var move=operation(cm,(function(e){0!==e.buttons&&e_button(e)?extend(e):done(e)})),up=operation(cm,done);cm.state.selectingText=up,on(display.wrapper.ownerDocument,"mousemove",move),on(display.wrapper.ownerDocument,"mouseup",up)}(cm,event,pos,behavior)}(cm,pos,repeat,e):e_target(e)==display.scroller&&e_preventDefault(e):2==button?(pos&&extendSelection(cm.doc,pos),setTimeout((function(){return display.input.focus()}),20)):3==button&&(captureRightClick?cm.display.input.onContextMenu(e):delayBlurEvent(cm)))}}function rangeForUnit(cm,pos,unit){if("char"==unit)return new Range(pos,pos);if("word"==unit)return cm.findWordAt(pos);if("line"==unit)return new Range(Pos(pos.line,0),clipPos(cm.doc,Pos(pos.line+1,0)));var result=unit(cm,pos);return new Range(result.from,result.to)}function gutterEvent(cm,e,type,prevent){var mX,mY;if(e.touches)mX=e.touches[0].clientX,mY=e.touches[0].clientY;else try{mX=e.clientX,mY=e.clientY}catch(e){return!1}if(mX>=Math.floor(cm.display.gutters.getBoundingClientRect().right))return!1;prevent&&e_preventDefault(e);var display=cm.display,lineBox=display.lineDiv.getBoundingClientRect();if(mY>lineBox.bottom||!hasHandler(cm,type))return e_defaultPrevented(e);mY-=lineBox.top-display.viewOffset;for(var i=0;i=mX)return signal(cm,type,cm,lineAtHeight(cm.doc,mY),cm.options.gutters[i],e),e_defaultPrevented(e)}}function clickInGutter(cm,e){return gutterEvent(cm,e,"gutterClick",!0)}function onContextMenu(cm,e){eventInWidget(cm.display,e)||function(cm,e){return!!hasHandler(cm,"gutterContextMenu")&&gutterEvent(cm,e,"gutterContextMenu",!1)}(cm,e)||signalDOMEvent(cm,e,"contextmenu")||captureRightClick||cm.display.input.onContextMenu(e)}function themeChanged(cm){cm.display.wrapper.className=cm.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+cm.options.theme.replace(/(^|\s)\s*/g," cm-s-"),clearCaches(cm)}PastClick.prototype.compare=function(time,pos,button){return this.time+400>time&&0==cmp(pos,this.pos)&&button==this.button};var Init={toString:function(){return"CodeMirror.Init"}},defaults={},optionHandlers={};function guttersChanged(cm){updateGutters(cm),regChange(cm),alignHorizontally(cm)}function dragDropChanged(cm,value,old){if(!value!=!(old&&old!=Init)){var funcs=cm.display.dragFunctions,toggle=value?on:off;toggle(cm.display.scroller,"dragstart",funcs.start),toggle(cm.display.scroller,"dragenter",funcs.enter),toggle(cm.display.scroller,"dragover",funcs.over),toggle(cm.display.scroller,"dragleave",funcs.leave),toggle(cm.display.scroller,"drop",funcs.drop)}}function wrappingChanged(cm){cm.options.lineWrapping?(addClass(cm.display.wrapper,"CodeMirror-wrap"),cm.display.sizer.style.minWidth="",cm.display.sizerWidth=null):(rmClass(cm.display.wrapper,"CodeMirror-wrap"),findMaxLine(cm)),estimateLineHeights(cm),regChange(cm),clearCaches(cm),setTimeout((function(){return updateScrollbars(cm)}),100)}function CodeMirror(place,options){var this$1$1=this;if(!(this instanceof CodeMirror))return new CodeMirror(place,options);this.options=options=options?copyObj(options):{},copyObj(defaults,options,!1),setGuttersForLineNumbers(options);var doc=options.value;"string"==typeof doc?doc=new Doc(doc,options.mode,null,options.lineSeparator,options.direction):options.mode&&(doc.modeOption=options.mode),this.doc=doc;var input=new CodeMirror.inputStyles[options.inputStyle](this),display=this.display=new Display(place,doc,input);for(var opt in display.wrapper.CodeMirror=this,updateGutters(this),themeChanged(this),options.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),initScrollbars(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:!1,cutIncoming:!1,selectingText:!1,draggingText:!1,highlight:new Delayed,keySeq:null,specialChars:null},options.autofocus&&!mobile&&display.input.focus(),ie&&ie_version<11&&setTimeout((function(){return this$1$1.display.input.reset(!0)}),20),function(cm){var d=cm.display;on(d.scroller,"mousedown",operation(cm,onMouseDown)),on(d.scroller,"dblclick",ie&&ie_version<11?operation(cm,(function(e){if(!signalDOMEvent(cm,e)){var pos=posFromMouse(cm,e);if(pos&&!clickInGutter(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e);var word=cm.findWordAt(pos);extendSelection(cm.doc,word.anchor,word.head)}}})):function(e){return signalDOMEvent(cm,e)||e_preventDefault(e)}),on(d.scroller,"contextmenu",(function(e){return onContextMenu(cm,e)}));var touchFinished,prevTouch={end:0};function finishTouch(){d.activeTouch&&(touchFinished=setTimeout((function(){return d.activeTouch=null}),1e3),(prevTouch=d.activeTouch).end=+new Date)}function isMouseLikeTouchEvent(e){if(1!=e.touches.length)return!1;var touch=e.touches[0];return touch.radiusX<=1&&touch.radiusY<=1}function farAway(touch,other){if(null==other.left)return!0;var dx=other.left-touch.left,dy=other.top-touch.top;return dx*dx+dy*dy>400}on(d.scroller,"touchstart",(function(e){if(!signalDOMEvent(cm,e)&&!isMouseLikeTouchEvent(e)&&!clickInGutter(cm,e)){d.input.ensurePolled(),clearTimeout(touchFinished);var now=+new Date;d.activeTouch={start:now,moved:!1,prev:now-prevTouch.end<=300?prevTouch:null},1==e.touches.length&&(d.activeTouch.left=e.touches[0].pageX,d.activeTouch.top=e.touches[0].pageY)}})),on(d.scroller,"touchmove",(function(){d.activeTouch&&(d.activeTouch.moved=!0)})),on(d.scroller,"touchend",(function(e){var touch=d.activeTouch;if(touch&&!eventInWidget(d,e)&&null!=touch.left&&!touch.moved&&new Date-touch.start<300){var range,pos=cm.coordsChar(d.activeTouch,"page");range=!touch.prev||farAway(touch,touch.prev)?new Range(pos,pos):!touch.prev.prev||farAway(touch,touch.prev.prev)?cm.findWordAt(pos):new Range(Pos(pos.line,0),clipPos(cm.doc,Pos(pos.line+1,0))),cm.setSelection(range.anchor,range.head),cm.focus(),e_preventDefault(e)}finishTouch()})),on(d.scroller,"touchcancel",finishTouch),on(d.scroller,"scroll",(function(){d.scroller.clientHeight&&(updateScrollTop(cm,d.scroller.scrollTop),setScrollLeft(cm,d.scroller.scrollLeft,!0),signal(cm,"scroll",cm))})),on(d.scroller,"mousewheel",(function(e){return onScrollWheel(cm,e)})),on(d.scroller,"DOMMouseScroll",(function(e){return onScrollWheel(cm,e)})),on(d.wrapper,"scroll",(function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0})),d.dragFunctions={enter:function(e){signalDOMEvent(cm,e)||e_stop(e)},over:function(e){signalDOMEvent(cm,e)||(function(cm,e){var pos=posFromMouse(cm,e);if(pos){var frag=document.createDocumentFragment();drawSelectionCursor(cm,pos,frag),cm.display.dragCursor||(cm.display.dragCursor=elt("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),cm.display.lineSpace.insertBefore(cm.display.dragCursor,cm.display.cursorDiv)),removeChildrenAndAdd(cm.display.dragCursor,frag)}}(cm,e),e_stop(e))},start:function(e){return function(cm,e){if(ie&&(!cm.state.draggingText||+new Date-lastDrop<100))e_stop(e);else if(!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)&&(e.dataTransfer.setData("Text",cm.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!safari)){var img=elt("img",null,null,"position: fixed; left: 0; top: 0;");img.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",presto&&(img.width=img.height=1,cm.display.wrapper.appendChild(img),img._top=img.offsetTop),e.dataTransfer.setDragImage(img,0,0),presto&&img.parentNode.removeChild(img)}}(cm,e)},drop:operation(cm,onDrop),leave:function(e){signalDOMEvent(cm,e)||clearDragCursor(cm)}};var inp=d.input.getField();on(inp,"keyup",(function(e){return onKeyUp.call(cm,e)})),on(inp,"keydown",operation(cm,onKeyDown)),on(inp,"keypress",operation(cm,onKeyPress)),on(inp,"focus",(function(e){return onFocus(cm,e)})),on(inp,"blur",(function(e){return onBlur(cm,e)}))}(this),ensureGlobalHandlers(),startOperation(this),this.curOp.forceUpdate=!0,attachDoc(this,doc),options.autofocus&&!mobile||this.hasFocus()?setTimeout(bind(onFocus,this),20):onBlur(this),optionHandlers)optionHandlers.hasOwnProperty(opt)&&optionHandlers[opt](this,options[opt],Init);maybeUpdateLineNumberWidth(this),options.finishInit&&options.finishInit(this);for(var i=0;i150)){if(!aggressive)return;how="prev"}}else indentation=0,how="not";"prev"==how?indentation=n>doc.first?countColumn(getLine(doc,n-1).text,null,tabSize):0:"add"==how?indentation=curSpace+cm.options.indentUnit:"subtract"==how?indentation=curSpace-cm.options.indentUnit:"number"==typeof how&&(indentation=curSpace+how),indentation=Math.max(0,indentation);var indentString="",pos=0;if(cm.options.indentWithTabs)for(var i=Math.floor(indentation/tabSize);i;--i)pos+=tabSize,indentString+="\t";if(pos1)if(lastCopied&&lastCopied.text.join("\n")==inserted){if(sel.ranges.length%lastCopied.text.length==0){multiPaste=[];for(var i=0;i=0;i$1--){var range$$1=sel.ranges[i$1],from=range$$1.from(),to=range$$1.to();range$$1.empty()&&(deleted&&deleted>0?from=Pos(from.line,from.ch-deleted):cm.state.overwrite&&!paste?to=Pos(to.line,Math.min(getLine(doc,to.line).text.length,to.ch+lst(textLines).length)):paste&&lastCopied&&lastCopied.lineWise&&lastCopied.text.join("\n")==inserted&&(from=to=Pos(from.line,0))),updateInput=cm.curOp.updateInput;var changeEvent={from:from,to:to,text:multiPaste?multiPaste[i$1%multiPaste.length]:textLines,origin:origin||(paste?"paste":cm.state.cutIncoming?"cut":"+input")};makeChange(cm.doc,changeEvent),signalLater(cm,"inputRead",cm,changeEvent)}inserted&&!paste&&triggerElectric(cm,inserted),ensureCursorVisible(cm),cm.curOp.updateInput=updateInput,cm.curOp.typing=!0,cm.state.pasteIncoming=cm.state.cutIncoming=!1}function handlePaste(e,cm){var pasted=e.clipboardData&&e.clipboardData.getData("Text");if(pasted)return e.preventDefault(),cm.isReadOnly()||cm.options.disableInput||runInOp(cm,(function(){return applyTextInput(cm,pasted,0,null,"paste")})),!0}function triggerElectric(cm,inserted){if(cm.options.electricChars&&cm.options.smartIndent)for(var sel=cm.doc.sel,i=sel.ranges.length-1;i>=0;i--){var range$$1=sel.ranges[i];if(!(range$$1.head.ch>100||i&&sel.ranges[i-1].head.line==range$$1.head.line)){var mode=cm.getModeAt(range$$1.head),indented=!1;if(mode.electricChars){for(var j=0;j-1){indented=indentLine(cm,range$$1.head.line,"smart");break}}else mode.electricInput&&mode.electricInput.test(getLine(cm.doc,range$$1.head.line).text.slice(0,range$$1.head.ch))&&(indented=indentLine(cm,range$$1.head.line,"smart"));indented&&signalLater(cm,"electricInput",cm,range$$1.head.line)}}}function copyableRanges(cm){for(var text=[],ranges=[],i=0;i=line.text.length?(start.ch=line.text.length,start.sticky="before"):start.ch<=0&&(start.ch=0,start.sticky="after");var partPos=getBidiPartAt(bidi,start.ch,start.sticky),part=bidi[partPos];if("ltr"==cm.doc.direction&&part.level%2==0&&(dir>0?part.to>start.ch:part.from=part.from&&ch>=wrappedLineExtent.begin)){var sticky=moveInStorageOrder?"before":"after";return new Pos(start.line,ch,sticky)}}var searchInVisualLine=function(partPos,dir,wrappedLineExtent){for(var getRes=function(ch,moveInStorageOrder){return moveInStorageOrder?new Pos(start.line,mv(ch,1),"before"):new Pos(start.line,ch,"after")};partPos>=0&&partPos0==(1!=part.level),ch=moveInStorageOrder?wrappedLineExtent.begin:mv(wrappedLineExtent.end,-1);if(part.from<=ch&&ch0?wrappedLineExtent.end:mv(wrappedLineExtent.begin,-1);return null==nextCh||dir>0&&nextCh==line.text.length||!(res=searchInVisualLine(dir>0?0:bidi.length-1,dir,getWrappedLineExtent(nextCh)))?null:res}(doc.cm,lineObj,pos,dir):moveLogically(lineObj,pos,dir),null==next){if(boundToLine||(l=pos.line+dir)=doc.first+doc.size||(pos=new Pos(l,pos.ch,pos.sticky),!(lineObj=getLine(doc,l))))return!1;pos=endOfLine(visually,doc.cm,lineObj,pos.line,dir)}else pos=next;return!0}if("char"==unit)moveOnce();else if("column"==unit)moveOnce(!0);else if("word"==unit||"group"==unit)for(var sawType=null,group="group"==unit,helper=doc.cm&&doc.cm.getHelper(pos,"wordChars"),first=!0;!(dir<0)||moveOnce(!first);first=!1){var cur=lineObj.text.charAt(pos.ch)||"\n",type=isWordChar(cur,helper)?"w":group&&"\n"==cur?"n":!group||/\s/.test(cur)?null:"p";if(!group||first||type||(type="s"),sawType&&sawType!=type){dir<0&&(dir=1,moveOnce(),pos.sticky="after");break}if(type&&(sawType=type),dir>0&&!moveOnce(!first))break}var result=skipAtomic(doc,pos,oldPos,origDir,!0);return equalCursorPos(oldPos,result)&&(result.hitSide=!0),result}function findPosV(cm,pos,dir,unit){var y,target,doc=cm.doc,x=pos.left;if("page"==unit){var pageSize=Math.min(cm.display.wrapper.clientHeight,window.innerHeight||document.documentElement.clientHeight),moveAmount=Math.max(pageSize-.5*textHeight(cm.display),3);y=(dir>0?pos.bottom:pos.top)+dir*moveAmount}else"line"==unit&&(y=dir>0?pos.bottom+3:pos.top-3);for(;(target=coordsChar(cm,x,y)).outside;){if(dir<0?y<=0:y>=doc.height){target.hitSide=!0;break}y+=5*dir}return target}var ContentEditableInput=function(cm){this.cm=cm,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Delayed,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function posToDOM(cm,pos){var view=findViewForLine(cm,pos.line);if(!view||view.hidden)return null;var line=getLine(cm.doc,pos.line),info=mapFromLineView(view,line,pos.line),order=getOrder(line,cm.doc.direction),side="left";order&&(side=getBidiPartAt(order,pos.ch)%2?"right":"left");var result=nodeAndOffsetInLineMap(info.map,pos.ch,side);return result.offset="right"==result.collapse?result.end:result.start,result}function badPos(pos,bad){return bad&&(pos.bad=!0),pos}function domToPos(cm,node,offset){var lineNode;if(node==cm.display.lineDiv){if(!(lineNode=cm.display.lineDiv.childNodes[offset]))return badPos(cm.clipPos(Pos(cm.display.viewTo-1)),!0);node=null,offset=0}else for(lineNode=node;;lineNode=lineNode.parentNode){if(!lineNode||lineNode==cm.display.lineDiv)return null;if(lineNode.parentNode&&lineNode.parentNode==cm.display.lineDiv)break}for(var i=0;i=cm.display.viewTo||to.line=cm.display.viewFrom&&posToDOM(cm,from)||{node:view[0].measure.map[2],offset:0},end=to.linecm.firstLine()&&(from=Pos(from.line-1,getLine(cm.doc,from.line-1).length)),to.ch==getLine(cm.doc,to.line).text.length&&to.linedisplay.viewTo-1)return!1;from.line==display.viewFrom||0==(fromIndex=findViewIndex(cm,from.line))?(fromLine=lineNo(display.view[0].line),fromNode=display.view[0].node):(fromLine=lineNo(display.view[fromIndex].line),fromNode=display.view[fromIndex-1].node.nextSibling);var toLine,toNode,toIndex=findViewIndex(cm,to.line);if(toIndex==display.view.length-1?(toLine=display.viewTo-1,toNode=display.lineDiv.lastChild):(toLine=lineNo(display.view[toIndex+1].line)-1,toNode=display.view[toIndex+1].node.previousSibling),!fromNode)return!1;for(var newText=cm.doc.splitLines(function(cm,from,to,fromLine,toLine){var text="",closing=!1,lineSep=cm.doc.lineSeparator(),extraLinebreak=!1;function recognizeMarker(id){return function(marker){return marker.id==id}}function close(){closing&&(text+=lineSep,extraLinebreak&&(text+=lineSep),closing=extraLinebreak=!1)}function addText(str){str&&(close(),text+=str)}function walk(node){if(1==node.nodeType){var cmText=node.getAttribute("cm-text");if(cmText)return void addText(cmText);var range$$1,markerID=node.getAttribute("cm-marker");if(markerID){var found=cm.findMarks(Pos(fromLine,0),Pos(toLine+1,0),recognizeMarker(+markerID));return void(found.length&&(range$$1=found[0].find(0))&&addText(getBetween(cm.doc,range$$1.from,range$$1.to).join(lineSep)))}if("false"==node.getAttribute("contenteditable"))return;var isBlock=/^(pre|div|p|li|table|br)$/i.test(node.nodeName);if(!/^br$/i.test(node.nodeName)&&0==node.textContent.length)return;isBlock&&close();for(var i=0;i1&&oldText.length>1;)if(lst(newText)==lst(oldText))newText.pop(),oldText.pop(),toLine--;else{if(newText[0]!=oldText[0])break;newText.shift(),oldText.shift(),fromLine++}for(var cutFront=0,cutEnd=0,newTop=newText[0],oldTop=oldText[0],maxCutFront=Math.min(newTop.length,oldTop.length);cutFrontfrom.ch&&newBot.charCodeAt(newBot.length-cutEnd-1)==oldBot.charCodeAt(oldBot.length-cutEnd-1);)cutFront--,cutEnd++;newText[newText.length-1]=newBot.slice(0,newBot.length-cutEnd).replace(/^\u200b+/,""),newText[0]=newText[0].slice(cutFront).replace(/\u200b+$/,"");var chFrom=Pos(fromLine,cutFront),chTo=Pos(toLine,oldText.length?lst(oldText).length-cutEnd:0);return newText.length>1||newText[0]||cmp(chFrom,chTo)?(replaceRange(cm.doc,newText,chFrom,chTo,"+input"),!0):void 0},ContentEditableInput.prototype.ensurePolled=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.reset=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ContentEditableInput.prototype.readFromDOMSoon=function(){var this$1$1=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(this$1$1.readDOMTimeout=null,this$1$1.composing){if(!this$1$1.composing.done)return;this$1$1.composing=null}this$1$1.updateFromDOM()}),80))},ContentEditableInput.prototype.updateFromDOM=function(){var this$1$1=this;!this.cm.isReadOnly()&&this.pollContent()||runInOp(this.cm,(function(){return regChange(this$1$1.cm)}))},ContentEditableInput.prototype.setUneditable=function(node){node.contentEditable="false"},ContentEditableInput.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||operation(this.cm,applyTextInput)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ContentEditableInput.prototype.readOnlyChanged=function(val){this.div.contentEditable=String("nocursor"!=val)},ContentEditableInput.prototype.onContextMenu=function(){},ContentEditableInput.prototype.resetPosition=function(){},ContentEditableInput.prototype.needsContentAttribute=!0;var TextareaInput=function(cm){this.cm=cm,this.prevInput="",this.pollingFast=!1,this.polling=new Delayed,this.hasSelection=!1,this.composing=null};TextareaInput.prototype.init=function(display){var this$1$1=this,input=this,cm=this.cm;this.createField(display);var te=this.textarea;function prepareCopyCut(e){if(!signalDOMEvent(cm,e)){if(cm.somethingSelected())setLastCopied({lineWise:!1,text:cm.getSelections()});else{if(!cm.options.lineWiseCopyCut)return;var ranges=copyableRanges(cm);setLastCopied({lineWise:!0,text:ranges.text}),"cut"==e.type?cm.setSelections(ranges.ranges,null,sel_dontScroll):(input.prevInput="",te.value=ranges.text.join("\n"),selectInput(te))}"cut"==e.type&&(cm.state.cutIncoming=!0)}}display.wrapper.insertBefore(this.wrapper,display.wrapper.firstChild),ios&&(te.style.width="0px"),on(te,"input",(function(){ie&&ie_version>=9&&this$1$1.hasSelection&&(this$1$1.hasSelection=null),input.poll()})),on(te,"paste",(function(e){signalDOMEvent(cm,e)||handlePaste(e,cm)||(cm.state.pasteIncoming=!0,input.fastPoll())})),on(te,"cut",prepareCopyCut),on(te,"copy",prepareCopyCut),on(display.scroller,"paste",(function(e){eventInWidget(display,e)||signalDOMEvent(cm,e)||(cm.state.pasteIncoming=!0,input.focus())})),on(display.lineSpace,"selectstart",(function(e){eventInWidget(display,e)||e_preventDefault(e)})),on(te,"compositionstart",(function(){var start=cm.getCursor("from");input.composing&&input.composing.range.clear(),input.composing={start:start,range:cm.markText(start,cm.getCursor("to"),{className:"CodeMirror-composing"})}})),on(te,"compositionend",(function(){input.composing&&(input.poll(),input.composing.range.clear(),input.composing=null)}))},TextareaInput.prototype.createField=function(_display){this.wrapper=hiddenTextarea(),this.textarea=this.wrapper.firstChild},TextareaInput.prototype.prepareSelection=function(){var cm=this.cm,display=cm.display,doc=cm.doc,result=prepareSelection(cm);if(cm.options.moveInputWithCursor){var headPos=cursorCoords(cm,doc.sel.primary().head,"div"),wrapOff=display.wrapper.getBoundingClientRect(),lineOff=display.lineDiv.getBoundingClientRect();result.teTop=Math.max(0,Math.min(display.wrapper.clientHeight-10,headPos.top+lineOff.top-wrapOff.top)),result.teLeft=Math.max(0,Math.min(display.wrapper.clientWidth-10,headPos.left+lineOff.left-wrapOff.left))}return result},TextareaInput.prototype.showSelection=function(drawn){var display=this.cm.display;removeChildrenAndAdd(display.cursorDiv,drawn.cursors),removeChildrenAndAdd(display.selectionDiv,drawn.selection),null!=drawn.teTop&&(this.wrapper.style.top=drawn.teTop+"px",this.wrapper.style.left=drawn.teLeft+"px")},TextareaInput.prototype.reset=function(typing){if(!this.contextMenuPending&&!this.composing){var cm=this.cm;if(cm.somethingSelected()){this.prevInput="";var content=cm.getSelection();this.textarea.value=content,cm.state.focused&&selectInput(this.textarea),ie&&ie_version>=9&&(this.hasSelection=content)}else typing||(this.prevInput=this.textarea.value="",ie&&ie_version>=9&&(this.hasSelection=null))}},TextareaInput.prototype.getField=function(){return this.textarea},TextareaInput.prototype.supportsTouch=function(){return!1},TextareaInput.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!mobile||activeElt()!=this.textarea))try{this.textarea.focus()}catch(e){}},TextareaInput.prototype.blur=function(){this.textarea.blur()},TextareaInput.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},TextareaInput.prototype.receivedFocus=function(){this.slowPoll()},TextareaInput.prototype.slowPoll=function(){var this$1$1=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){this$1$1.poll(),this$1$1.cm.state.focused&&this$1$1.slowPoll()}))},TextareaInput.prototype.fastPoll=function(){var missed=!1,input=this;input.pollingFast=!0,input.polling.set(20,(function p(){input.poll()||missed?(input.pollingFast=!1,input.slowPoll()):(missed=!0,input.polling.set(60,p))}))},TextareaInput.prototype.poll=function(){var this$1$1=this,cm=this.cm,input=this.textarea,prevInput=this.prevInput;if(this.contextMenuPending||!cm.state.focused||hasSelection(input)&&!prevInput&&!this.composing||cm.isReadOnly()||cm.options.disableInput||cm.state.keySeq)return!1;var text=input.value;if(text==prevInput&&!cm.somethingSelected())return!1;if(ie&&ie_version>=9&&this.hasSelection===text||mac&&/[\uf700-\uf7ff]/.test(text))return cm.display.input.reset(),!1;if(cm.doc.sel==cm.display.selForContextMenu){var first=text.charCodeAt(0);if(8203!=first||prevInput||(prevInput="​"),8666==first)return this.reset(),this.cm.execCommand("undo")}for(var same=0,l=Math.min(prevInput.length,text.length);same1e3||text.indexOf("\n")>-1?input.value=this$1$1.prevInput="":this$1$1.prevInput=text,this$1$1.composing&&(this$1$1.composing.range.clear(),this$1$1.composing.range=cm.markText(this$1$1.composing.start,cm.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},TextareaInput.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},TextareaInput.prototype.onKeyPress=function(){ie&&ie_version>=9&&(this.hasSelection=null),this.fastPoll()},TextareaInput.prototype.onContextMenu=function(e){var input=this,cm=input.cm,display=cm.display,te=input.textarea,pos=posFromMouse(cm,e),scrollPos=display.scroller.scrollTop;if(pos&&!presto){cm.options.resetSelectionOnContextMenu&&-1==cm.doc.sel.contains(pos)&&operation(cm,setSelection)(cm.doc,simpleSelection(pos),sel_dontScroll);var oldCSS=te.style.cssText,oldWrapperCSS=input.wrapper.style.cssText;input.wrapper.style.cssText="position: absolute";var oldScrollY,wrapperBox=input.wrapper.getBoundingClientRect();if(te.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-wrapperBox.top-5)+"px; left: "+(e.clientX-wrapperBox.left-5)+"px;\n z-index: 1000; background: "+(ie?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",webkit&&(oldScrollY=window.scrollY),display.input.focus(),webkit&&window.scrollTo(null,oldScrollY),display.input.reset(),cm.somethingSelected()||(te.value=input.prevInput=" "),input.contextMenuPending=!0,display.selForContextMenu=cm.doc.sel,clearTimeout(display.detectingSelectAll),ie&&ie_version>=9&&prepareSelectAllHack(),captureRightClick){e_stop(e);var mouseup=function(){off(window,"mouseup",mouseup),setTimeout(rehide,20)};on(window,"mouseup",mouseup)}else setTimeout(rehide,50)}function prepareSelectAllHack(){if(null!=te.selectionStart){var selected=cm.somethingSelected(),extval="​"+(selected?te.value:"");te.value="⇚",te.value=extval,input.prevInput=selected?"":"​",te.selectionStart=1,te.selectionEnd=extval.length,display.selForContextMenu=cm.doc.sel}}function rehide(){if(input.contextMenuPending=!1,input.wrapper.style.cssText=oldWrapperCSS,te.style.cssText=oldCSS,ie&&ie_version<9&&display.scrollbars.setScrollTop(display.scroller.scrollTop=scrollPos),null!=te.selectionStart){(!ie||ie&&ie_version<9)&&prepareSelectAllHack();var i=0,poll=function(){display.selForContextMenu==cm.doc.sel&&0==te.selectionStart&&te.selectionEnd>0&&"​"==input.prevInput?operation(cm,selectAll)(cm):i++<10?display.detectingSelectAll=setTimeout(poll,500):(display.selForContextMenu=null,display.input.reset())};display.detectingSelectAll=setTimeout(poll,200)}}},TextareaInput.prototype.readOnlyChanged=function(val){val||this.reset(),this.textarea.disabled="nocursor"==val},TextareaInput.prototype.setUneditable=function(){},TextareaInput.prototype.needsContentAttribute=!1,function(CodeMirror){var optionHandlers=CodeMirror.optionHandlers;function option(name,deflt,handle,notOnInit){CodeMirror.defaults[name]=deflt,handle&&(optionHandlers[name]=notOnInit?function(cm,val,old){old!=Init&&handle(cm,val,old)}:handle)}CodeMirror.defineOption=option,CodeMirror.Init=Init,option("value","",(function(cm,val){return cm.setValue(val)}),!0),option("mode",null,(function(cm,val){cm.doc.modeOption=val,loadMode(cm)}),!0),option("indentUnit",2,loadMode,!0),option("indentWithTabs",!1),option("smartIndent",!0),option("tabSize",4,(function(cm){resetModeState(cm),clearCaches(cm),regChange(cm)}),!0),option("lineSeparator",null,(function(cm,val){if(cm.doc.lineSep=val,val){var newBreaks=[],lineNo=cm.doc.first;cm.doc.iter((function(line){for(var pos=0;;){var found=line.text.indexOf(val,pos);if(-1==found)break;pos=found+val.length,newBreaks.push(Pos(lineNo,found))}lineNo++}));for(var i=newBreaks.length-1;i>=0;i--)replaceRange(cm.doc,val,newBreaks[i],Pos(newBreaks[i].line,newBreaks[i].ch+val.length))}})),option("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b-\u200f\u2028\u2029\ufeff]/g,(function(cm,val,old){cm.state.specialChars=new RegExp(val.source+(val.test("\t")?"":"|\t"),"g"),old!=Init&&cm.refresh()})),option("specialCharPlaceholder",defaultSpecialCharPlaceholder,(function(cm){return cm.refresh()}),!0),option("electricChars",!0),option("inputStyle",mobile?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),option("spellcheck",!1,(function(cm,val){return cm.getInputField().spellcheck=val}),!0),option("rtlMoveVisually",!windows),option("wholeLineUpdateBefore",!0),option("theme","default",(function(cm){themeChanged(cm),guttersChanged(cm)}),!0),option("keyMap","default",(function(cm,val,old){var next=getKeyMap(val),prev=old!=Init&&getKeyMap(old);prev&&prev.detach&&prev.detach(cm,next),next.attach&&next.attach(cm,prev||null)})),option("extraKeys",null),option("configureMouse",null),option("lineWrapping",!1,wrappingChanged,!0),option("gutters",[],(function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)}),!0),option("fixedGutter",!0,(function(cm,val){cm.display.gutters.style.left=val?compensateForHScroll(cm.display)+"px":"0",cm.refresh()}),!0),option("coverGutterNextToScrollbar",!1,(function(cm){return updateScrollbars(cm)}),!0),option("scrollbarStyle","native",(function(cm){initScrollbars(cm),updateScrollbars(cm),cm.display.scrollbars.setScrollTop(cm.doc.scrollTop),cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)}),!0),option("lineNumbers",!1,(function(cm){setGuttersForLineNumbers(cm.options),guttersChanged(cm)}),!0),option("firstLineNumber",1,guttersChanged,!0),option("lineNumberFormatter",(function(integer){return integer}),guttersChanged,!0),option("showCursorWhenSelecting",!1,updateSelection,!0),option("resetSelectionOnContextMenu",!0),option("lineWiseCopyCut",!0),option("pasteLinesPerSelection",!0),option("selectionsMayTouch",!1),option("readOnly",!1,(function(cm,val){"nocursor"==val&&(onBlur(cm),cm.display.input.blur()),cm.display.input.readOnlyChanged(val)})),option("disableInput",!1,(function(cm,val){val||cm.display.input.reset()}),!0),option("dragDrop",!0,dragDropChanged),option("allowDropFileTypes",null),option("cursorBlinkRate",530),option("cursorScrollMargin",0),option("cursorHeight",1,updateSelection,!0),option("singleCursorHeightPerLine",!0,updateSelection,!0),option("workTime",100),option("workDelay",100),option("flattenSpans",!0,resetModeState,!0),option("addModeClass",!1,resetModeState,!0),option("pollInterval",100),option("undoDepth",200,(function(cm,val){return cm.doc.history.undoDepth=val})),option("historyEventDelay",1250),option("viewportMargin",10,(function(cm){return cm.refresh()}),!0),option("maxHighlightLength",1e4,resetModeState,!0),option("moveInputWithCursor",!0,(function(cm,val){val||cm.display.input.resetPosition()})),option("tabindex",null,(function(cm,val){return cm.display.input.getField().tabIndex=val||""})),option("autofocus",null),option("direction","ltr",(function(cm,val){return cm.doc.setDirection(val)}),!0),option("phrases",null)}(CodeMirror),function(CodeMirror){var optionHandlers=CodeMirror.optionHandlers,helpers=CodeMirror.helpers={};CodeMirror.prototype={constructor:CodeMirror,focus:function(){window.focus(),this.display.input.focus()},setOption:function(option,value){var options=this.options,old=options[option];options[option]==value&&"mode"!=option||(options[option]=value,optionHandlers.hasOwnProperty(option)&&operation(this,optionHandlers[option])(this,value,old),signal(this,"optionChange",this,option))},getOption:function(option){return this.options[option]},getDoc:function(){return this.doc},addKeyMap:function(map$$1,bottom){this.state.keyMaps[bottom?"push":"unshift"](getKeyMap(map$$1))},removeKeyMap:function(map$$1){for(var maps=this.state.keyMaps,i=0;iend&&(indentLine(this,range$$1.head.line,how,!0),end=range$$1.head.line,i==this.doc.sel.primIndex&&ensureCursorVisible(this));else{var from=range$$1.from(),to=range$$1.to(),start=Math.max(end,from.line);end=Math.min(this.lastLine(),to.line-(to.ch?0:1))+1;for(var j=start;j0&&replaceOneSelection(this.doc,i,new Range(from,newRanges[i].to()),sel_dontScroll)}}})),getTokenAt:function(pos,precise){return takeToken(this,pos,precise)},getLineTokens:function(line,precise){return takeToken(this,Pos(line),precise,!0)},getTokenTypeAt:function(pos){pos=clipPos(this.doc,pos);var type,styles=getLineStyles(this,getLine(this.doc,pos.line)),before=0,after=(styles.length-1)/2,ch=pos.ch;if(0==ch)type=styles[2];else for(;;){var mid=before+after>>1;if((mid?styles[2*mid-1]:0)>=ch)after=mid;else{if(!(styles[2*mid+1]last&&(line=last,end=!0),lineObj=getLine(this.doc,line)}else lineObj=line;return intoCoordSystem(this,lineObj,{top:0,left:0},mode||"page",includeWidgets||end).top+(end?this.doc.height-heightAtLine(lineObj):0)},defaultTextHeight:function(){return textHeight(this.display)},defaultCharWidth:function(){return charWidth(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(pos,node,scroll,vert,horiz){var cm,rect,scrollPos,display=this.display,top=(pos=cursorCoords(this,clipPos(this.doc,pos))).bottom,left=pos.left;if(node.style.position="absolute",node.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(node),display.sizer.appendChild(node),"over"==vert)top=pos.top;else if("above"==vert||"near"==vert){var vspace=Math.max(display.wrapper.clientHeight,this.doc.height),hspace=Math.max(display.sizer.clientWidth,display.lineSpace.clientWidth);("above"==vert||pos.bottom+node.offsetHeight>vspace)&&pos.top>node.offsetHeight?top=pos.top-node.offsetHeight:pos.bottom+node.offsetHeight<=vspace&&(top=pos.bottom),left+node.offsetWidth>hspace&&(left=hspace-node.offsetWidth)}node.style.top=top+"px",node.style.left=node.style.right="","right"==horiz?(left=display.sizer.clientWidth-node.offsetWidth,node.style.right="0px"):("left"==horiz?left=0:"middle"==horiz&&(left=(display.sizer.clientWidth-node.offsetWidth)/2),node.style.left=left+"px"),scroll&&(cm=this,rect={left:left,top:top,right:left+node.offsetWidth,bottom:top+node.offsetHeight},null!=(scrollPos=calculateScrollPos(cm,rect)).scrollTop&&updateScrollTop(cm,scrollPos.scrollTop),null!=scrollPos.scrollLeft&&setScrollLeft(cm,scrollPos.scrollLeft))},triggerOnKeyDown:methodOp(onKeyDown),triggerOnKeyPress:methodOp(onKeyPress),triggerOnKeyUp:onKeyUp,triggerOnMouseDown:methodOp(onMouseDown),execCommand:function(cmd){if(commands.hasOwnProperty(cmd))return commands[cmd].call(null,this)},triggerElectric:methodOp((function(text){triggerElectric(this,text)})),findPosH:function(from,amount,unit,visually){var dir=1;amount<0&&(dir=-1,amount=-amount);for(var cur=clipPos(this.doc,from),i=0;i0&&check(line.charAt(start-1));)--start;for(;end.5)&&estimateLineHeights(this),signal(this,"refresh",this)})),swapDoc:methodOp((function(doc){var old=this.doc;return old.cm=null,attachDoc(this,doc),clearCaches(this),this.display.input.reset(),scrollToCoords(this,doc.scrollLeft,doc.scrollTop),this.curOp.forceScroll=!0,signalLater(this,"swapDoc",this,old),old})),phrase:function(phraseText){var phrases=this.options.phrases;return phrases&&Object.prototype.hasOwnProperty.call(phrases,phraseText)?phrases[phraseText]:phraseText},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},eventMixin(CodeMirror),CodeMirror.registerHelper=function(type,name,value){helpers.hasOwnProperty(type)||(helpers[type]=CodeMirror[type]={_global:[]}),helpers[type][name]=value},CodeMirror.registerGlobalHelper=function(type,name,predicate,value){CodeMirror.registerHelper(type,name,value),helpers[type]._global.push({pred:predicate,val:value})}}(CodeMirror);var dontDelegate="iter insert remove copy getEditor constructor".split(" ");for(var prop in Doc.prototype)Doc.prototype.hasOwnProperty(prop)&&indexOf(dontDelegate,prop)<0&&(CodeMirror.prototype[prop]=function(method){return function(){return method.apply(this.doc,arguments)}}(Doc.prototype[prop]));return eventMixin(Doc),CodeMirror.inputStyles={textarea:TextareaInput,contenteditable:ContentEditableInput},CodeMirror.defineMode=function(name){CodeMirror.defaults.mode||"null"==name||(CodeMirror.defaults.mode=name),defineMode.apply(this,arguments)},CodeMirror.defineMIME=function(mime,spec){mimeModes[mime]=spec},CodeMirror.defineMode("null",(function(){return{token:function(stream){return stream.skipToEnd()}}})),CodeMirror.defineMIME("text/plain","null"),CodeMirror.defineExtension=function(name,func){CodeMirror.prototype[name]=func},CodeMirror.defineDocExtension=function(name,func){Doc.prototype[name]=func},CodeMirror.fromTextArea=function(textarea,options){if((options=options?copyObj(options):{}).value=textarea.value,!options.tabindex&&textarea.tabIndex&&(options.tabindex=textarea.tabIndex),!options.placeholder&&textarea.placeholder&&(options.placeholder=textarea.placeholder),null==options.autofocus){var hasFocus=activeElt();options.autofocus=hasFocus==textarea||null!=textarea.getAttribute("autofocus")&&hasFocus==document.body}function save(){textarea.value=cm.getValue()}var realSubmit;if(textarea.form&&(on(textarea.form,"submit",save),!options.leaveSubmitMethodAlone)){var form=textarea.form;realSubmit=form.submit;try{var wrappedSubmit=form.submit=function(){save(),form.submit=realSubmit,form.submit(),form.submit=wrappedSubmit}}catch(e){}}options.finishInit=function(cm){cm.save=save,cm.getTextArea=function(){return textarea},cm.toTextArea=function(){cm.toTextArea=isNaN,save(),textarea.parentNode.removeChild(cm.getWrapperElement()),textarea.style.display="",textarea.form&&(off(textarea.form,"submit",save),"function"==typeof textarea.form.submit&&(textarea.form.submit=realSubmit))}},textarea.style.display="none";var cm=CodeMirror((function(node){return textarea.parentNode.insertBefore(node,textarea.nextSibling)}),options);return cm},function(CodeMirror){CodeMirror.off=off,CodeMirror.on=on,CodeMirror.wheelEventPixels=wheelEventPixels,CodeMirror.Doc=Doc,CodeMirror.splitLines=splitLinesAuto,CodeMirror.countColumn=countColumn,CodeMirror.findColumn=findColumn,CodeMirror.isWordChar=isWordCharBasic,CodeMirror.Pass=Pass,CodeMirror.signal=signal,CodeMirror.Line=Line,CodeMirror.changeEnd=changeEnd,CodeMirror.scrollbarModel=scrollbarModel,CodeMirror.Pos=Pos,CodeMirror.cmpPos=cmp,CodeMirror.modes=modes,CodeMirror.mimeModes=mimeModes,CodeMirror.resolveMode=resolveMode,CodeMirror.getMode=getMode,CodeMirror.modeExtensions=modeExtensions,CodeMirror.extendMode=extendMode,CodeMirror.copyState=copyState,CodeMirror.startState=startState,CodeMirror.innerMode=innerMode,CodeMirror.commands=commands,CodeMirror.keyMap=keyMap,CodeMirror.keyName=keyName,CodeMirror.isModifierKey=isModifierKey,CodeMirror.lookupKey=lookupKey,CodeMirror.normalizeKeyMap=normalizeKeyMap,CodeMirror.StringStream=StringStream,CodeMirror.SharedTextMarker=SharedTextMarker,CodeMirror.TextMarker=TextMarker,CodeMirror.LineWidget=LineWidget,CodeMirror.e_preventDefault=e_preventDefault,CodeMirror.e_stopPropagation=e_stopPropagation,CodeMirror.e_stop=e_stop,CodeMirror.addClass=addClass,CodeMirror.contains=contains,CodeMirror.rmClass=rmClass,CodeMirror.keyNames=keyNames}(CodeMirror),CodeMirror.version="5.41.0",CodeMirror},"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define("block_configurable_reports/codemirror",factory):global.CodeMirror=factory(); +var global,factory;global=window,factory=function(){var userAgent=navigator.userAgent,platform=navigator.platform,gecko=/gecko\/\d/i.test(userAgent),ie_upto10=/MSIE \d/.test(userAgent),ie_11up=/Trident\/(?:[7-9]|\d{2,})\..*rv:(\d+)/.exec(userAgent),edge=/Edge\/(\d+)/.exec(userAgent),ie=ie_upto10||ie_11up||edge,ie_version=ie&&(ie_upto10?document.documentMode||6:+(edge||ie_11up)[1]),webkit=!edge&&/WebKit\//.test(userAgent),qtwebkit=webkit&&/Qt\/\d+\.\d+/.test(userAgent),chrome=!edge&&/Chrome\/(\d+)/.exec(userAgent),chrome_version=chrome&&+chrome[1],presto=/Opera\//.test(userAgent),safari=/Apple Computer/.test(navigator.vendor),mac_geMountainLion=/Mac OS X 1\d\D([8-9]|\d\d)\D/.test(userAgent),phantom=/PhantomJS/.test(userAgent),ios=safari&&(/Mobile\/\w+/.test(userAgent)||navigator.maxTouchPoints>2),android=/Android/.test(userAgent),mobile=ios||android||/webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent),mac=ios||/Mac/.test(platform),chromeOS=/\bCrOS\b/.test(userAgent),windows=/win/i.test(platform),presto_version=presto&&userAgent.match(/Version\/(\d*\.\d*)/);presto_version&&(presto_version=Number(presto_version[1])),presto_version&&presto_version>=15&&(presto=!1,webkit=!0);var flipCtrlCmd=mac&&(qtwebkit||presto&&(null==presto_version||presto_version<12.11)),captureRightClick=gecko||ie&&ie_version>=9;function classTest(cls){return new RegExp("(^|\\s)"+cls+"(?:$|\\s)\\s*")}var range,rmClass=function(node,cls){var current=node.className,match=classTest(cls).exec(current);if(match){var after=current.slice(match.index+match[0].length);node.className=current.slice(0,match.index)+(after?match[1]+after:"")}};function removeChildren(e){for(var count=e.childNodes.length;count>0;--count)e.removeChild(e.firstChild);return e}function removeChildrenAndAdd(parent,e){return removeChildren(parent).appendChild(e)}function elt(tag,content,className,style){var e=document.createElement(tag);if(className&&(e.className=className),style&&(e.style.cssText=style),"string"==typeof content)e.appendChild(document.createTextNode(content));else if(content)for(var i=0;i=end)return n+(end-i);n+=nextTab-i,n+=tabSize-n%tabSize,i=nextTab+1}}ios?selectInput=function(node){node.selectionStart=0,node.selectionEnd=node.value.length}:ie&&(selectInput=function(node){try{node.select()}catch(_e){}});var Delayed=function(){this.id=null,this.f=null,this.time=0,this.handler=bind(this.onTimeout,this)};function indexOf(array,elt){for(var i=0;i=goal)return pos+Math.min(skipped,goal-col);if(col+=nextTab-pos,pos=nextTab+1,(col+=tabSize-col%tabSize)>=goal)return pos}}var spaceStrs=[""];function spaceStr(n){for(;spaceStrs.length<=n;)spaceStrs.push(lst(spaceStrs)+" ");return spaceStrs[n]}function lst(arr){return arr[arr.length-1]}function map(array,f){for(var out=[],i=0;i"€"&&(ch.toUpperCase()!=ch.toLowerCase()||nonASCIISingleCaseWordChar.test(ch))}function isWordChar(ch,helper){return helper?!!(helper.source.indexOf("\\w")>-1&&isWordCharBasic(ch))||helper.test(ch):isWordCharBasic(ch)}function isEmpty(obj){for(var n in obj)if(obj.hasOwnProperty(n)&&obj[n])return!1;return!0}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]/;function isExtendingChar(ch){return ch.charCodeAt(0)>=768&&extendingChars.test(ch)}function skipExtendingChars(str,pos,dir){for(;(dir<0?pos>0:posto?-1:1;;){if(from==to)return from;var midF=(from+to)/2,mid=dir<0?Math.ceil(midF):Math.floor(midF);if(mid==from)return pred(mid)?from:to;pred(mid)?to=mid:from=mid+dir}}var bidiOther=null;function getBidiPartAt(order,ch,sticky){var found;bidiOther=null;for(var i=0;ich)return i;cur.to==ch&&(cur.from!=cur.to&&"before"==sticky?found=i:bidiOther=i),cur.from==ch&&(cur.from!=cur.to&&"before"!=sticky?found=i:bidiOther=i)}return null!=found?found:bidiOther}var bidiOrdering=function(){var bidiRE=/[\u0590-\u05f4\u0600-\u06ff\u0700-\u08ac]/,isNeutral=/[stwN]/,isStrong=/[LRr]/,countsAsLeft=/[Lb1n]/,countsAsNum=/[1n]/;function BidiSpan(level,from,to){this.level=level,this.from=from,this.to=to}return function(str,direction){var outerType="ltr"==direction?"L":"R";if(0==str.length||"ltr"==direction&&!bidiRE.test(str))return!1;for(var code,len=str.length,types=[],i=0;i-1&&(map[type]=arr.slice(0,index).concat(arr.slice(index+1)))}}}function signal(emitter,type){var handlers=getHandlers(emitter,type);if(handlers.length)for(var args=Array.prototype.slice.call(arguments,2),i=0;i0}function eventMixin(ctor){ctor.prototype.on=function(type,f){on(this,type,f)},ctor.prototype.off=function(type,f){off(this,type,f)}}function e_preventDefault(e){e.preventDefault?e.preventDefault():e.returnValue=!1}function e_stopPropagation(e){e.stopPropagation?e.stopPropagation():e.cancelBubble=!0}function e_defaultPrevented(e){return null!=e.defaultPrevented?e.defaultPrevented:0==e.returnValue}function e_stop(e){e_preventDefault(e),e_stopPropagation(e)}function e_target(e){return e.target||e.srcElement}function e_button(e){var b=e.which;return null==b&&(1&e.button?b=1:2&e.button?b=3:4&e.button&&(b=2)),mac&&e.ctrlKey&&1==b&&(b=3),b}var zwspSupported,badBidiRects,dragAndDrop=function(){if(ie&&ie_version<9)return!1;var div=elt("div");return"draggable"in div||"dragDrop"in div}();function zeroWidthElement(measure){if(null==zwspSupported){var test=elt("span","​");removeChildrenAndAdd(measure,elt("span",[test,document.createTextNode("x")])),0!=measure.firstChild.offsetHeight&&(zwspSupported=test.offsetWidth<=1&&test.offsetHeight>2&&!(ie&&ie_version<8))}var node=zwspSupported?elt("span","​"):elt("span"," ",null,"display: inline-block; width: 1px; margin-right: -1px");return node.setAttribute("cm-text",""),node}function hasBadBidiRects(measure){if(null!=badBidiRects)return badBidiRects;var txt=removeChildrenAndAdd(measure,document.createTextNode("AخA")),r0=range(txt,0,1).getBoundingClientRect(),r1=range(txt,1,2).getBoundingClientRect();return removeChildren(measure),!(!r0||r0.left==r0.right)&&(badBidiRects=r1.right-r0.right<3)}var e,splitLinesAuto=3!="\n\nb".split(/\n/).length?function(string){for(var pos=0,result=[],l=string.length;pos<=l;){var nl=string.indexOf("\n",pos);-1==nl&&(nl=string.length);var line=string.slice(pos,"\r"==string.charAt(nl-1)?nl-1:nl),rt=line.indexOf("\r");-1!=rt?(result.push(line.slice(0,rt)),pos+=rt+1):(result.push(line),pos=nl+1)}return result}:function(string){return string.split(/\r\n?|\n/)},hasSelection=window.getSelection?function(te){try{return te.selectionStart!=te.selectionEnd}catch(e){return!1}}:function(te){var range;try{range=te.ownerDocument.selection.createRange()}catch(e){}return!(!range||range.parentElement()!=te)&&0!=range.compareEndPoints("StartToEnd",range)},hasCopyEvent="oncopy"in(e=elt("div"))||(e.setAttribute("oncopy","return;"),"function"==typeof e.oncopy),badZoomedRects=null,modes={},mimeModes={};function defineMode(name,mode){arguments.length>2&&(mode.dependencies=Array.prototype.slice.call(arguments,2)),modes[name]=mode}function resolveMode(spec){if("string"==typeof spec&&mimeModes.hasOwnProperty(spec))spec=mimeModes[spec];else if(spec&&"string"==typeof spec.name&&mimeModes.hasOwnProperty(spec.name)){var found=mimeModes[spec.name];"string"==typeof found&&(found={name:found}),(spec=createObj(found,spec)).name=found.name}else{if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+xml$/.test(spec))return resolveMode("application/xml");if("string"==typeof spec&&/^[\w\-]+\/[\w\-]+\+json$/.test(spec))return resolveMode("application/json")}return"string"==typeof spec?{name:spec}:spec||{name:"null"}}function getMode(options,spec){spec=resolveMode(spec);var mfactory=modes[spec.name];if(!mfactory)return getMode(options,"text/plain");var modeObj=mfactory(options,spec);if(modeExtensions.hasOwnProperty(spec.name)){var exts=modeExtensions[spec.name];for(var prop in exts)exts.hasOwnProperty(prop)&&(modeObj.hasOwnProperty(prop)&&(modeObj["_"+prop]=modeObj[prop]),modeObj[prop]=exts[prop])}if(modeObj.name=spec.name,spec.helperType&&(modeObj.helperType=spec.helperType),spec.modeProps)for(var prop$1 in spec.modeProps)modeObj[prop$1]=spec.modeProps[prop$1];return modeObj}var modeExtensions={};function extendMode(mode,properties){copyObj(properties,modeExtensions.hasOwnProperty(mode)?modeExtensions[mode]:modeExtensions[mode]={})}function copyState(mode,state){if(!0===state)return state;if(mode.copyState)return mode.copyState(state);var nstate={};for(var n in state){var val=state[n];val instanceof Array&&(val=val.concat([])),nstate[n]=val}return nstate}function innerMode(mode,state){for(var info;mode.innerMode&&(info=mode.innerMode(state))&&info.mode!=mode;)state=info.state,mode=info.mode;return info||{mode:mode,state:state}}function startState(mode,a1,a2){return!mode.startState||mode.startState(a1,a2)}var StringStream=function(string,tabSize,lineOracle){this.pos=this.start=0,this.string=string,this.tabSize=tabSize||8,this.lastColumnPos=this.lastColumnValue=0,this.lineStart=0,this.lineOracle=lineOracle};function getLine(doc,n){if((n-=doc.first)<0||n>=doc.size)throw new Error("There is no line "+(n+doc.first)+" in the document.");for(var chunk=doc;!chunk.lines;)for(var i=0;;++i){var child=chunk.children[i],sz=child.chunkSize();if(n=doc.first&&llast?Pos(last,getLine(doc,last).text.length):function(pos,linelen){var ch=pos.ch;return null==ch||ch>linelen?Pos(pos.line,linelen):ch<0?Pos(pos.line,0):pos}(pos,getLine(doc,pos.line).text.length)}function clipPosArray(doc,array){for(var out=[],i=0;i=this.string.length},StringStream.prototype.sol=function(){return this.pos==this.lineStart},StringStream.prototype.peek=function(){return this.string.charAt(this.pos)||void 0},StringStream.prototype.next=function(){if(this.posstart},StringStream.prototype.eatSpace=function(){for(var start=this.pos;/[\s\u00a0]/.test(this.string.charAt(this.pos));)++this.pos;return this.pos>start},StringStream.prototype.skipToEnd=function(){this.pos=this.string.length},StringStream.prototype.skipTo=function(ch){var found=this.string.indexOf(ch,this.pos);if(found>-1)return this.pos=found,!0},StringStream.prototype.backUp=function(n){this.pos-=n},StringStream.prototype.column=function(){return this.lastColumnPos0?null:(match&&!1!==consume&&(this.pos+=match[0].length),match)}var cased=function(str){return caseInsensitive?str.toLowerCase():str};if(cased(this.string.substr(this.pos,pattern.length))==cased(pattern))return!1!==consume&&(this.pos+=pattern.length),!0},StringStream.prototype.current=function(){return this.string.slice(this.start,this.pos)},StringStream.prototype.hideFirstChars=function(n,inner){this.lineStart+=n;try{return inner()}finally{this.lineStart-=n}},StringStream.prototype.lookAhead=function(n){var oracle=this.lineOracle;return oracle&&oracle.lookAhead(n)},StringStream.prototype.baseToken=function(){var oracle=this.lineOracle;return oracle&&oracle.baseToken(this.pos)};var SavedContext=function(state,lookAhead){this.state=state,this.lookAhead=lookAhead},Context=function(doc,state,line,lookAhead){this.state=state,this.doc=doc,this.line=line,this.maxLookAhead=lookAhead||0,this.baseTokens=null,this.baseTokenPos=1};function highlightLine(cm,line,context,forceToEnd){var st=[cm.state.modeGen],lineClasses={};runMode(cm,line.text,cm.doc.mode,context,(function(end,style){return st.push(end,style)}),lineClasses,forceToEnd);for(var state=context.state,loop=function(o){context.baseTokens=st;var overlay=cm.state.overlays[o],i=1,at=0;context.state=!0,runMode(cm,line.text,overlay.mode,context,(function(end,style){for(var start=i;atend&&st.splice(i,1,end,st[i+1],i_end),i+=2,at=Math.min(end,i_end)}if(style)if(overlay.opaque)st.splice(start,i-start,end,"overlay "+style),i=start+2;else for(;startcm.options.maxHighlightLength&©State(cm.doc.mode,context.state),result=highlightLine(cm,line,context);resetState&&(context.state=resetState),line.stateAfter=context.save(!resetState),line.styles=result.styles,result.classes?line.styleClasses=result.classes:line.styleClasses&&(line.styleClasses=null),updateFrontier===cm.doc.highlightFrontier&&(cm.doc.modeFrontier=Math.max(cm.doc.modeFrontier,++cm.doc.highlightFrontier))}return line.styles}function getContextBefore(cm,n,precise){var doc=cm.doc,display=cm.display;if(!doc.mode.startState)return new Context(doc,!0,n);var start=function(cm,n,precise){for(var minindent,minline,doc=cm.doc,lim=precise?-1:n-(cm.doc.mode.innerMode?1e3:100),search=n;search>lim;--search){if(search<=doc.first)return doc.first;var line=getLine(doc,search-1),after=line.stateAfter;if(after&&(!precise||search+(after instanceof SavedContext?after.lookAhead:0)<=doc.modeFrontier))return search;var indented=countColumn(line.text,null,cm.options.tabSize);(null==minline||minindent>indented)&&(minline=search-1,minindent=indented)}return minline}(cm,n,precise),saved=start>doc.first&&getLine(doc,start-1).stateAfter,context=saved?Context.fromSaved(doc,saved,start):new Context(doc,startState(doc.mode),start);return doc.iter(start,n,(function(line){processLine(cm,line.text,context);var pos=context.line;line.stateAfter=pos==n-1||pos%5==0||pos>=display.viewFrom&&posstream.start)return style}throw new Error("Mode "+mode.name+" failed to advance stream.")}Context.prototype.lookAhead=function(n){var line=this.doc.getLine(this.line+n);return null!=line&&n>this.maxLookAhead&&(this.maxLookAhead=n),line},Context.prototype.baseToken=function(n){if(!this.baseTokens)return null;for(;this.baseTokens[this.baseTokenPos]<=n;)this.baseTokenPos+=2;var type=this.baseTokens[this.baseTokenPos+1];return{type:type&&type.replace(/( |^)overlay .*/,""),size:this.baseTokens[this.baseTokenPos]-n}},Context.prototype.nextLine=function(){this.line++,this.maxLookAhead>0&&this.maxLookAhead--},Context.fromSaved=function(doc,saved,line){return saved instanceof SavedContext?new Context(doc,copyState(doc.mode,saved.state),line,saved.lookAhead):new Context(doc,copyState(doc.mode,saved),line)},Context.prototype.save=function(copy){var state=!1!==copy?copyState(this.doc.mode,this.state):this.state;return this.maxLookAhead>0?new SavedContext(state,this.maxLookAhead):state};var Token=function(stream,type,state){this.start=stream.start,this.end=stream.pos,this.string=stream.current(),this.type=type||null,this.state=state};function takeToken(cm,pos,precise,asArray){var style,tokens,doc=cm.doc,mode=doc.mode,line=getLine(doc,(pos=clipPos(doc,pos)).line),context=getContextBefore(cm,pos.line,precise),stream=new StringStream(line.text,cm.options.tabSize,context);for(asArray&&(tokens=[]);(asArray||stream.poscm.options.maxHighlightLength?(flattenSpans=!1,forceToEnd&&processLine(cm,text,context,stream.pos),stream.pos=text.length,style=null):style=extractLineClasses(readToken(mode,stream,context.state,inner),lineClasses),inner){var mName=inner[0].name;mName&&(style="m-"+(style?mName+" "+style:mName))}if(!flattenSpans||curStyle!=style){for(;curStart=startCh:span.to>startCh);(nw||(nw=[])).push(new MarkedSpan(marker,span.from,endsAfter?null:span.to))}}return nw}(oldFirst,startCh,isInsert),last=function(old,endCh,isInsert){var nw;if(old)for(var i=0;i=endCh:span.to>endCh)||span.from==endCh&&"bookmark"==marker.type&&(!isInsert||span.marker.insertLeft)){var startsBefore=null==span.from||(marker.inclusiveLeft?span.from<=endCh:span.from0&&first)for(var i$2=0;i$2ch)&&(!found||compareCollapsedMarkers(found,sp.marker)<0)&&(found=sp.marker)}return found}function conflictingCollapsedRange(doc,lineNo,from,to,marker){var line=getLine(doc,lineNo),sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var i=0;i=0&&toCmp<=0||fromCmp<=0&&toCmp>=0)&&(fromCmp<=0&&(sp.marker.inclusiveRight&&marker.inclusiveLeft?cmp(found.to,from)>=0:cmp(found.to,from)>0)||fromCmp>=0&&(sp.marker.inclusiveRight&&marker.inclusiveLeft?cmp(found.from,to)<=0:cmp(found.from,to)<0)))return!0}}}function visualLine(line){for(var merged;merged=collapsedSpanAtStart(line);)line=merged.find(-1,!0).line;return line}function visualLineNo(doc,lineN){var line=getLine(doc,lineN),vis=visualLine(line);return line==vis?lineN:lineNo(vis)}function visualLineEndNo(doc,lineN){if(lineN>doc.lastLine())return lineN;var merged,line=getLine(doc,lineN);if(!lineIsHidden(doc,line))return lineN;for(;merged=collapsedSpanAtEnd(line);)line=merged.find(1,!0).line;return lineNo(line)+1}function lineIsHidden(doc,line){var sps=sawCollapsedSpans&&line.markedSpans;if(sps)for(var sp=void 0,i=0;id.maxLineLength&&(d.maxLineLength=len,d.maxLine=line)}))}var Line=function(text,markedSpans,estimateHeight){this.text=text,attachMarkedSpans(this,markedSpans),this.height=estimateHeight?estimateHeight(this):1};function cleanUpLine(line){line.parent=null,detachMarkedSpans(line)}Line.prototype.lineNo=function(){return lineNo(this)},eventMixin(Line);var styleToClassCache={},styleToClassCacheWithMode={};function interpretTokenStyle(style,options){if(!style||/^\s*$/.test(style))return null;var cache=options.addModeClass?styleToClassCacheWithMode:styleToClassCache;return cache[style]||(cache[style]=style.replace(/\S+/g,"cm-$&"))}function buildLineContent(cm,lineView){var content=eltP("span",null,null,webkit?"padding-right: .1px":null),builder={pre:eltP("pre",[content],"CodeMirror-line"),content:content,col:0,pos:0,cm:cm,trailingSpace:!1,splitSpaces:cm.getOption("lineWrapping")};lineView.measure={};for(var i=0;i<=(lineView.rest?lineView.rest.length:0);i++){var line=i?lineView.rest[i-1]:lineView.line,order=void 0;builder.pos=0,builder.addToken=buildToken,hasBadBidiRects(cm.display.measure)&&(order=getOrder(line,cm.doc.direction))&&(builder.addToken=buildTokenBadBidi(builder.addToken,order)),builder.map=[],insertLineContent(line,builder,getLineStyles(cm,line,lineView!=cm.display.externalMeasured&&lineNo(line))),line.styleClasses&&(line.styleClasses.bgClass&&(builder.bgClass=joinClasses(line.styleClasses.bgClass,builder.bgClass||"")),line.styleClasses.textClass&&(builder.textClass=joinClasses(line.styleClasses.textClass,builder.textClass||""))),0==builder.map.length&&builder.map.push(0,0,builder.content.appendChild(zeroWidthElement(cm.display.measure))),0==i?(lineView.measure.map=builder.map,lineView.measure.cache={}):((lineView.measure.maps||(lineView.measure.maps=[])).push(builder.map),(lineView.measure.caches||(lineView.measure.caches=[])).push({}))}if(webkit){var last=builder.content.lastChild;(/\bcm-tab\b/.test(last.className)||last.querySelector&&last.querySelector(".cm-tab"))&&(builder.content.className="cm-tab-wrap-hack")}return signal(cm,"renderLine",cm,lineView.line,builder.pre),builder.pre.className&&(builder.textClass=joinClasses(builder.pre.className,builder.textClass||"")),builder}function defaultSpecialCharPlaceholder(ch){var token=elt("span","•","cm-invalidchar");return token.title="\\u"+ch.charCodeAt(0).toString(16),token.setAttribute("aria-label",token.title),token}function buildToken(builder,text,style,startStyle,endStyle,css,attributes){if(text){var content,displayText=builder.splitSpaces?function(text,trailingBefore){if(text.length>1&&!/ /.test(text))return text;for(var spaceBefore=trailingBefore,result="",i=0;istart&&part.from<=start);i++);if(part.to>=end)return inner(builder,text,style,startStyle,endStyle,css,attributes);inner(builder,text.slice(0,part.to-start),style,startStyle,null,css,attributes),startStyle=null,text=text.slice(part.to-start),start=part.to}}}function buildCollapsedSpan(builder,size,marker,ignoreWidget){var widget=!ignoreWidget&&marker.widgetNode;widget&&builder.map.push(builder.pos,builder.pos+size,widget),!ignoreWidget&&builder.cm.display.input.needsContentAttribute&&(widget||(widget=builder.content.appendChild(document.createElement("span"))),widget.setAttribute("cm-marker",marker.id)),widget&&(builder.cm.display.input.setUneditable(widget),builder.content.appendChild(widget)),builder.pos+=size,builder.trailingSpace=!1}function insertLineContent(line,builder,styles){var spans=line.markedSpans,allText=line.text,at=0;if(spans)for(var style,css,spanStyle,spanEndStyle,spanStartStyle,collapsed,attributes,len=allText.length,pos=0,i=1,text="",nextChange=0;;){if(nextChange==pos){spanStyle=spanEndStyle=spanStartStyle=css="",attributes=null,collapsed=null,nextChange=1/0;for(var foundBookmarks=[],endStyles=void 0,j=0;jpos||m.collapsed&&sp.to==pos&&sp.from==pos)){if(null!=sp.to&&sp.to!=pos&&nextChange>sp.to&&(nextChange=sp.to,spanEndStyle=""),m.className&&(spanStyle+=" "+m.className),m.css&&(css=(css?css+";":"")+m.css),m.startStyle&&sp.from==pos&&(spanStartStyle+=" "+m.startStyle),m.endStyle&&sp.to==nextChange&&(endStyles||(endStyles=[])).push(m.endStyle,sp.to),m.title&&((attributes||(attributes={})).title=m.title),m.attributes)for(var attr in m.attributes)(attributes||(attributes={}))[attr]=m.attributes[attr];m.collapsed&&(!collapsed||compareCollapsedMarkers(collapsed.marker,m)<0)&&(collapsed=sp)}else sp.from>pos&&nextChange>sp.from&&(nextChange=sp.from)}if(endStyles)for(var j$1=0;j$1=len)break;for(var upto=Math.min(len,nextChange);;){if(text){var end=pos+text.length;if(!collapsed){var tokenText=end>upto?text.slice(0,upto-pos):text;builder.addToken(builder,tokenText,style?style+spanStyle:spanStyle,spanStartStyle,pos+tokenText.length==nextChange?spanEndStyle:"",css,attributes)}if(end>=upto){text=text.slice(upto-pos),pos=upto;break}pos=end,spanStartStyle=""}text=allText.slice(at,at=styles[i++]),style=interpretTokenStyle(styles[i++],builder.cm.options)}}else for(var i$1=1;i$1lineN)return{map:lineView.measure.maps[i$1],cache:lineView.measure.caches[i$1],before:!0}}}function measureChar(cm,line,ch,bias){return measureCharPrepared(cm,prepareMeasureForLine(cm,line),ch,bias)}function findViewForLine(cm,lineN){if(lineN>=cm.display.viewFrom&&lineN=ext.lineN&&lineN2&&heights.push((cur.bottom+next.top)/2-rect.top)}}heights.push(rect.bottom-rect.top)}}(cm,prepared.view,prepared.rect),prepared.hasHeights=!0),found=function(cm,prepared,ch,bias){var rect,place=nodeAndOffsetInLineMap(prepared.map,ch,bias),node=place.node,start=place.start,end=place.end,collapse=place.collapse;if(3==node.nodeType){for(var i$1=0;i$1<4;i$1++){for(;start&&isExtendingChar(prepared.line.text.charAt(place.coverStart+start));)--start;for(;place.coverStart+end1}(measure))return rect;var scaleX=screen.logicalXDPI/screen.deviceXDPI,scaleY=screen.logicalYDPI/screen.deviceYDPI;return{left:rect.left*scaleX,right:rect.right*scaleX,top:rect.top*scaleY,bottom:rect.bottom*scaleY}}(cm.display.measure,rect))}else{var rects;start>0&&(collapse=bias="right"),rect=cm.options.lineWrapping&&(rects=node.getClientRects()).length>1?rects["right"==bias?rects.length-1:0]:node.getBoundingClientRect()}if(ie&&ie_version<9&&!start&&(!rect||!rect.left&&!rect.right)){var rSpan=node.parentNode.getClientRects()[0];rect=rSpan?{left:rSpan.left,right:rSpan.left+charWidth(cm.display),top:rSpan.top,bottom:rSpan.bottom}:nullRect}for(var rtop=rect.top-prepared.rect.top,rbot=rect.bottom-prepared.rect.top,mid=(rtop+rbot)/2,heights=prepared.view.measure.heights,i=0;ich)&&(start=(end=mEnd-mStart)-1,ch>=mEnd&&(collapse="right")),null!=start){if(node=map[i+2],mStart==mEnd&&bias==(node.insertLeft?"left":"right")&&(collapse=bias),"left"==bias&&0==start)for(;i&&map[i-2]==map[i-3]&&map[i-1].insertLeft;)node=map[2+(i-=3)],collapse="left";if("right"==bias&&start==mEnd-mStart)for(;i=0&&(rect=rects[i$1]).left==rect.right;i$1--);return rect}function clearLineMeasurementCacheFor(lineView){if(lineView.measure&&(lineView.measure.cache={},lineView.measure.heights=null,lineView.rest))for(var i=0;i=lineObj.text.length?(ch=lineObj.text.length,sticky="before"):ch<=0&&(ch=0,sticky="after"),!order)return get("before"==sticky?ch-1:ch,"before"==sticky);function getBidi(ch,partPos,invert){return get(invert?ch-1:ch,1==order[partPos].level!=invert)}var partPos=getBidiPartAt(order,ch,sticky),other=bidiOther,val=getBidi(ch,partPos,"before"==sticky);return null!=other&&(val.other=getBidi(ch,other,"before"!=sticky)),val}function estimateCoords(cm,pos){var left=0;pos=clipPos(cm.doc,pos),cm.options.lineWrapping||(left=charWidth(cm.display)*pos.ch);var lineObj=getLine(cm.doc,pos.line),top=heightAtLine(lineObj)+paddingTop(cm.display);return{left:left,right:left,top:top,bottom:top+lineObj.height}}function PosWithInfo(line,ch,sticky,outside,xRel){var pos=Pos(line,ch,sticky);return pos.xRel=xRel,outside&&(pos.outside=outside),pos}function coordsChar(cm,x,y){var doc=cm.doc;if((y+=cm.display.viewOffset)<0)return PosWithInfo(doc.first,0,null,-1,-1);var lineN=lineAtHeight(doc,y),last=doc.first+doc.size-1;if(lineN>last)return PosWithInfo(doc.first+doc.size-1,getLine(doc,last).text.length,null,1,1);x<0&&(x=0);for(var lineObj=getLine(doc,lineN);;){var found=coordsCharInner(cm,lineObj,lineN,x,y),collapsed=collapsedSpanAround(lineObj,found.ch+(found.xRel>0||found.outside>0?1:0));if(!collapsed)return found;var rangeEnd=collapsed.find(1);if(rangeEnd.line==lineN)return rangeEnd;lineObj=getLine(doc,lineN=rangeEnd.line)}}function wrappedLineExtent(cm,lineObj,preparedMeasure,y){y-=widgetTopHeight(lineObj);var end=lineObj.text.length,begin=findFirst((function(ch){return measureCharPrepared(cm,preparedMeasure,ch-1).bottom<=y}),end,0);return{begin:begin,end:end=findFirst((function(ch){return measureCharPrepared(cm,preparedMeasure,ch).top>y}),begin,end)}}function wrappedLineExtentChar(cm,lineObj,preparedMeasure,target){return preparedMeasure||(preparedMeasure=prepareMeasureForLine(cm,lineObj)),wrappedLineExtent(cm,lineObj,preparedMeasure,intoCoordSystem(cm,lineObj,measureCharPrepared(cm,preparedMeasure,target),"line").top)}function boxIsAfter(box,x,y,left){return!(box.bottom<=y)&&(box.top>y||(left?box.left:box.right)>x)}function coordsCharInner(cm,lineObj,lineNo,x,y){y-=heightAtLine(lineObj);var preparedMeasure=prepareMeasureForLine(cm,lineObj),widgetHeight=widgetTopHeight(lineObj),begin=0,end=lineObj.text.length,ltr=!0,order=getOrder(lineObj,cm.doc.direction);if(order){var part=(cm.options.lineWrapping?coordsBidiPartWrapped:coordsBidiPart)(cm,lineObj,lineNo,preparedMeasure,order,x,y);begin=(ltr=1!=part.level)?part.from:part.to-1,end=ltr?part.to:part.from-1}var baseX,sticky,chAround=null,boxAround=null,ch=findFirst((function(ch){var box=measureCharPrepared(cm,preparedMeasure,ch);return box.top+=widgetHeight,box.bottom+=widgetHeight,!!boxIsAfter(box,x,y,!1)&&(box.top<=y&&box.left<=x&&(chAround=ch,boxAround=box),!0)}),begin,end),outside=!1;if(boxAround){var atLeft=x-boxAround.left=coords.bottom?1:0}return PosWithInfo(lineNo,ch=skipExtendingChars(lineObj.text,ch,1),sticky,outside,x-baseX)}function coordsBidiPart(cm,lineObj,lineNo,preparedMeasure,order,x,y){var index=findFirst((function(i){var part=order[i],ltr=1!=part.level;return boxIsAfter(cursorCoords(cm,Pos(lineNo,ltr?part.to:part.from,ltr?"before":"after"),"line",lineObj,preparedMeasure),x,y,!0)}),0,order.length-1),part=order[index];if(index>0){var ltr=1!=part.level,start=cursorCoords(cm,Pos(lineNo,ltr?part.from:part.to,ltr?"after":"before"),"line",lineObj,preparedMeasure);boxIsAfter(start,x,y,!0)&&start.top>y&&(part=order[index-1])}return part}function coordsBidiPartWrapped(cm,lineObj,_lineNo,preparedMeasure,order,x,y){var ref=wrappedLineExtent(cm,lineObj,preparedMeasure,y),begin=ref.begin,end=ref.end;/\s/.test(lineObj.text.charAt(end-1))&&end--;for(var part=null,closestDist=null,i=0;i=end||p.to<=begin)){var endX=measureCharPrepared(cm,preparedMeasure,1!=p.level?Math.min(end,p.to)-1:Math.max(begin,p.from)).right,dist=endXdist)&&(part=p,closestDist=dist)}}return part||(part=order[order.length-1]),part.fromend&&(part={from:part.from,to:end,level:part.level}),part}function textHeight(display){if(null!=display.cachedTextHeight)return display.cachedTextHeight;if(null==measureText){measureText=elt("pre",null,"CodeMirror-line-like");for(var i=0;i<49;++i)measureText.appendChild(document.createTextNode("x")),measureText.appendChild(elt("br"));measureText.appendChild(document.createTextNode("x"))}removeChildrenAndAdd(display.measure,measureText);var height=measureText.offsetHeight/50;return height>3&&(display.cachedTextHeight=height),removeChildren(display.measure),height||1}function charWidth(display){if(null!=display.cachedCharWidth)return display.cachedCharWidth;var anchor=elt("span","xxxxxxxxxx"),pre=elt("pre",[anchor],"CodeMirror-line-like");removeChildrenAndAdd(display.measure,pre);var rect=anchor.getBoundingClientRect(),width=(rect.right-rect.left)/10;return width>2&&(display.cachedCharWidth=width),width||10}function getDimensions(cm){for(var d=cm.display,left={},width={},gutterLeft=d.gutters.clientLeft,n=d.gutters.firstChild,i=0;n;n=n.nextSibling,++i){var id=cm.display.gutterSpecs[i].className;left[id]=n.offsetLeft+n.clientLeft+gutterLeft,width[id]=n.clientWidth}return{fixedPos:compensateForHScroll(d),gutterTotalWidth:d.gutters.offsetWidth,gutterLeft:left,gutterWidth:width,wrapperWidth:d.wrapper.clientWidth}}function compensateForHScroll(display){return display.scroller.getBoundingClientRect().left-display.sizer.getBoundingClientRect().left}function estimateHeight(cm){var th=textHeight(cm.display),wrapping=cm.options.lineWrapping,perLine=wrapping&&Math.max(5,cm.display.scroller.clientWidth/charWidth(cm.display)-3);return function(line){if(lineIsHidden(cm.doc,line))return 0;var widgetsHeight=0;if(line.widgets)for(var i=0;i0&&(line=getLine(cm.doc,coords.line).text).length==coords.ch){var colDiff=countColumn(line,line.length,cm.options.tabSize)-line.length;coords=Pos(coords.line,Math.max(0,Math.round((x-paddingH(cm.display).left)/charWidth(cm.display))-colDiff))}return coords}function findViewIndex(cm,n){if(n>=cm.display.viewTo)return null;if((n-=cm.display.viewFrom)<0)return null;for(var view=cm.display.view,i=0;ifrom)&&(display.updateLineNumbers=from),cm.curOp.viewChanged=!0,from>=display.viewTo)sawCollapsedSpans&&visualLineNo(cm.doc,from)display.viewFrom?resetView(cm):(display.viewFrom+=lendiff,display.viewTo+=lendiff);else if(from<=display.viewFrom&&to>=display.viewTo)resetView(cm);else if(from<=display.viewFrom){var cut=viewCuttingPoint(cm,to,to+lendiff,1);cut?(display.view=display.view.slice(cut.index),display.viewFrom=cut.lineN,display.viewTo+=lendiff):resetView(cm)}else if(to>=display.viewTo){var cut$1=viewCuttingPoint(cm,from,from,-1);cut$1?(display.view=display.view.slice(0,cut$1.index),display.viewTo=cut$1.lineN):resetView(cm)}else{var cutTop=viewCuttingPoint(cm,from,from,-1),cutBot=viewCuttingPoint(cm,to,to+lendiff,1);cutTop&&cutBot?(display.view=display.view.slice(0,cutTop.index).concat(buildViewArray(cm,cutTop.lineN,cutBot.lineN)).concat(display.view.slice(cutBot.index)),display.viewTo+=lendiff):resetView(cm)}var ext=display.externalMeasured;ext&&(to=ext.lineN&&line=display.viewTo)){var lineView=display.view[findViewIndex(cm,line)];if(null!=lineView.node){var arr=lineView.changes||(lineView.changes=[]);-1==indexOf(arr,type)&&arr.push(type)}}}function resetView(cm){cm.display.viewFrom=cm.display.viewTo=cm.doc.first,cm.display.view=[],cm.display.viewOffset=0}function viewCuttingPoint(cm,oldN,newN,dir){var diff,index=findViewIndex(cm,oldN),view=cm.display.view;if(!sawCollapsedSpans||newN==cm.doc.first+cm.doc.size)return{index:index,lineN:newN};for(var n=cm.display.viewFrom,i=0;i0){if(index==view.length-1)return null;diff=n+view[index].size-oldN,index++}else diff=n-oldN;oldN+=diff,newN+=diff}for(;visualLineNo(cm.doc,newN)!=newN;){if(index==(dir<0?0:view.length-1))return null;newN+=dir*view[index-(dir<0?1:0)].size,index+=dir}return{index:index,lineN:newN}}function countDirtyView(cm){for(var view=cm.display.view,dirty=0,i=0;i=cm.display.viewTo||range.to().line0?width:cm.defaultCharWidth())+"px"}if(pos.other){var otherCursor=output.appendChild(elt("div"," ","CodeMirror-cursor CodeMirror-secondarycursor"));otherCursor.style.display="",otherCursor.style.left=pos.other.left+"px",otherCursor.style.top=pos.other.top+"px",otherCursor.style.height=.85*(pos.other.bottom-pos.other.top)+"px"}}function cmpCoords(a,b){return a.top-b.top||a.left-b.left}function drawSelectionRange(cm,range,output){var display=cm.display,doc=cm.doc,fragment=document.createDocumentFragment(),padding=paddingH(cm.display),leftSide=padding.left,rightSide=Math.max(display.sizerWidth,displayWidth(cm)-display.sizer.offsetLeft)-padding.right,docLTR="ltr"==doc.direction;function add(left,top,width,bottom){top<0&&(top=0),top=Math.round(top),bottom=Math.round(bottom),fragment.appendChild(elt("div",null,"CodeMirror-selected","position: absolute; left: "+left+"px;\n top: "+top+"px; width: "+(null==width?rightSide-left:width)+"px;\n height: "+(bottom-top)+"px"))}function drawForLine(line,fromArg,toArg){var start,end,lineObj=getLine(doc,line),lineLen=lineObj.text.length;function coords(ch,bias){return charCoords(cm,Pos(line,ch),"div",lineObj,bias)}function wrapX(pos,dir,side){var extent=wrappedLineExtentChar(cm,lineObj,null,pos),prop="ltr"==dir==("after"==side)?"left":"right";return coords("after"==side?extent.begin:extent.end-(/\s/.test(lineObj.text.charAt(extent.end-1))?2:1),prop)[prop]}var order=getOrder(lineObj,doc.direction);return function(order,from,to,f){if(!order)return f(from,to,"ltr",0);for(var found=!1,i=0;ifrom||from==to&&part.to==from)&&(f(Math.max(part.from,from),Math.min(part.to,to),1==part.level?"rtl":"ltr",i),found=!0)}found||f(from,to,"ltr")}(order,fromArg||0,null==toArg?lineLen:toArg,(function(from,to,dir,i){var ltr="ltr"==dir,fromPos=coords(from,ltr?"left":"right"),toPos=coords(to-1,ltr?"right":"left"),openStart=null==fromArg&&0==from,openEnd=null==toArg&&to==lineLen,first=0==i,last=!order||i==order.length-1;if(toPos.top-fromPos.top<=3){var openRight=(docLTR?openEnd:openStart)&&last,left=(docLTR?openStart:openEnd)&&first?leftSide:(ltr?fromPos:toPos).left,right=openRight?rightSide:(ltr?toPos:fromPos).right;add(left,fromPos.top,right-left,fromPos.bottom)}else{var topLeft,topRight,botLeft,botRight;ltr?(topLeft=docLTR&&openStart&&first?leftSide:fromPos.left,topRight=docLTR?rightSide:wrapX(from,dir,"before"),botLeft=docLTR?leftSide:wrapX(to,dir,"after"),botRight=docLTR&&openEnd&&last?rightSide:toPos.right):(topLeft=docLTR?wrapX(from,dir,"before"):leftSide,topRight=!docLTR&&openStart&&first?rightSide:fromPos.right,botLeft=!docLTR&&openEnd&&last?leftSide:toPos.left,botRight=docLTR?wrapX(to,dir,"after"):rightSide),add(topLeft,fromPos.top,topRight-topLeft,fromPos.bottom),fromPos.bottom0?display.blinker=setInterval((function(){cm.hasFocus()||onBlur(cm),display.cursorDiv.style.visibility=(on=!on)?"":"hidden"}),cm.options.cursorBlinkRate):cm.options.cursorBlinkRate<0&&(display.cursorDiv.style.visibility="hidden")}}function ensureFocus(cm){cm.hasFocus()||(cm.display.input.focus(),cm.state.focused||onFocus(cm))}function delayBlurEvent(cm){cm.state.delayingBlurEvent=!0,setTimeout((function(){cm.state.delayingBlurEvent&&(cm.state.delayingBlurEvent=!1,cm.state.focused&&onBlur(cm))}),100)}function onFocus(cm,e){cm.state.delayingBlurEvent&&!cm.state.draggingText&&(cm.state.delayingBlurEvent=!1),"nocursor"!=cm.options.readOnly&&(cm.state.focused||(signal(cm,"focus",cm,e),cm.state.focused=!0,addClass(cm.display.wrapper,"CodeMirror-focused"),cm.curOp||cm.display.selForContextMenu==cm.doc.sel||(cm.display.input.reset(),webkit&&setTimeout((function(){return cm.display.input.reset(!0)}),20)),cm.display.input.receivedFocus()),restartBlink(cm))}function onBlur(cm,e){cm.state.delayingBlurEvent||(cm.state.focused&&(signal(cm,"blur",cm,e),cm.state.focused=!1,rmClass(cm.display.wrapper,"CodeMirror-focused")),clearInterval(cm.display.blinker),setTimeout((function(){cm.state.focused||(cm.display.shift=!1)}),150))}function updateHeightsInViewport(cm){for(var display=cm.display,prevBottom=display.lineDiv.offsetTop,viewTop=Math.max(0,display.scroller.getBoundingClientRect().top),oldHeight=display.lineDiv.getBoundingClientRect().top,mustScroll=0,i=0;i.005||diff<-.005)&&(oldHeightcm.display.sizerWidth){var chWidth=Math.ceil(width/charWidth(cm.display));chWidth>cm.display.maxLineLength&&(cm.display.maxLineLength=chWidth,cm.display.maxLine=cur.line,cm.display.maxLineChanged=!0)}}}Math.abs(mustScroll)>2&&(display.scroller.scrollTop+=mustScroll)}function updateWidgetHeight(line){if(line.widgets)for(var i=0;i=to&&(from=lineAtHeight(doc,heightAtLine(getLine(doc,ensureTo))-display.wrapper.clientHeight),to=ensureTo)}return{from:from,to:Math.max(to,from+1)}}function calculateScrollPos(cm,rect){var display=cm.display,snapMargin=textHeight(cm.display);rect.top<0&&(rect.top=0);var screentop=cm.curOp&&null!=cm.curOp.scrollTop?cm.curOp.scrollTop:display.scroller.scrollTop,screen=displayHeight(cm),result={};rect.bottom-rect.top>screen&&(rect.bottom=rect.top+screen);var docBottom=cm.doc.height+paddingVert(display),atTop=rect.topdocBottom-snapMargin;if(rect.topscreentop+screen){var newTop=Math.min(rect.top,(atBottom?docBottom:rect.bottom)-screen);newTop!=screentop&&(result.scrollTop=newTop)}var gutterSpace=cm.options.fixedGutter?0:display.gutters.offsetWidth,screenleft=cm.curOp&&null!=cm.curOp.scrollLeft?cm.curOp.scrollLeft:display.scroller.scrollLeft-gutterSpace,screenw=displayWidth(cm)-display.gutters.offsetWidth,tooWide=rect.right-rect.left>screenw;return tooWide&&(rect.right=rect.left+screenw),rect.left<10?result.scrollLeft=0:rect.leftscreenw+screenleft-3&&(result.scrollLeft=rect.right+(tooWide?0:10)-screenw),result}function addToScrollTop(cm,top){null!=top&&(resolveScrollToPos(cm),cm.curOp.scrollTop=(null==cm.curOp.scrollTop?cm.doc.scrollTop:cm.curOp.scrollTop)+top)}function ensureCursorVisible(cm){resolveScrollToPos(cm);var cur=cm.getCursor();cm.curOp.scrollToPos={from:cur,to:cur,margin:cm.options.cursorScrollMargin}}function scrollToCoords(cm,x,y){null==x&&null==y||resolveScrollToPos(cm),null!=x&&(cm.curOp.scrollLeft=x),null!=y&&(cm.curOp.scrollTop=y)}function resolveScrollToPos(cm){var range=cm.curOp.scrollToPos;range&&(cm.curOp.scrollToPos=null,scrollToCoordsRange(cm,estimateCoords(cm,range.from),estimateCoords(cm,range.to),range.margin))}function scrollToCoordsRange(cm,from,to,margin){var sPos=calculateScrollPos(cm,{left:Math.min(from.left,to.left),top:Math.min(from.top,to.top)-margin,right:Math.max(from.right,to.right),bottom:Math.max(from.bottom,to.bottom)+margin});scrollToCoords(cm,sPos.scrollLeft,sPos.scrollTop)}function updateScrollTop(cm,val){Math.abs(cm.doc.scrollTop-val)<2||(gecko||updateDisplaySimple(cm,{top:val}),setScrollTop(cm,val,!0),gecko&&updateDisplaySimple(cm),startWorker(cm,100))}function setScrollTop(cm,val,forceScroll){val=Math.max(0,Math.min(cm.display.scroller.scrollHeight-cm.display.scroller.clientHeight,val)),(cm.display.scroller.scrollTop!=val||forceScroll)&&(cm.doc.scrollTop=val,cm.display.scrollbars.setScrollTop(val),cm.display.scroller.scrollTop!=val&&(cm.display.scroller.scrollTop=val))}function setScrollLeft(cm,val,isScroller,forceScroll){val=Math.max(0,Math.min(val,cm.display.scroller.scrollWidth-cm.display.scroller.clientWidth)),(isScroller?val==cm.doc.scrollLeft:Math.abs(cm.doc.scrollLeft-val)<2)&&!forceScroll||(cm.doc.scrollLeft=val,alignHorizontally(cm),cm.display.scroller.scrollLeft!=val&&(cm.display.scroller.scrollLeft=val),cm.display.scrollbars.setScrollLeft(val))}function measureForScrollbars(cm){var d=cm.display,gutterW=d.gutters.offsetWidth,docH=Math.round(cm.doc.height+paddingVert(cm.display));return{clientHeight:d.scroller.clientHeight,viewHeight:d.wrapper.clientHeight,scrollWidth:d.scroller.scrollWidth,clientWidth:d.scroller.clientWidth,viewWidth:d.wrapper.clientWidth,barLeft:cm.options.fixedGutter?gutterW:0,docHeight:docH,scrollHeight:docH+scrollGap(cm)+d.barHeight,nativeBarWidth:d.nativeBarWidth,gutterWidth:gutterW}}var NativeScrollbars=function(place,scroll,cm){this.cm=cm;var vert=this.vert=elt("div",[elt("div",null,null,"min-width: 1px")],"CodeMirror-vscrollbar"),horiz=this.horiz=elt("div",[elt("div",null,null,"height: 100%; min-height: 1px")],"CodeMirror-hscrollbar");vert.tabIndex=horiz.tabIndex=-1,place(vert),place(horiz),on(vert,"scroll",(function(){vert.clientHeight&&scroll(vert.scrollTop,"vertical")})),on(horiz,"scroll",(function(){horiz.clientWidth&&scroll(horiz.scrollLeft,"horizontal")})),this.checkedZeroWidth=!1,ie&&ie_version<8&&(this.horiz.style.minHeight=this.vert.style.minWidth="18px")};NativeScrollbars.prototype.update=function(measure){var needsH=measure.scrollWidth>measure.clientWidth+1,needsV=measure.scrollHeight>measure.clientHeight+1,sWidth=measure.nativeBarWidth;if(needsV){this.vert.style.display="block",this.vert.style.bottom=needsH?sWidth+"px":"0";var totalHeight=measure.viewHeight-(needsH?sWidth:0);this.vert.firstChild.style.height=Math.max(0,measure.scrollHeight-measure.clientHeight+totalHeight)+"px"}else this.vert.scrollTop=0,this.vert.style.display="",this.vert.firstChild.style.height="0";if(needsH){this.horiz.style.display="block",this.horiz.style.right=needsV?sWidth+"px":"0",this.horiz.style.left=measure.barLeft+"px";var totalWidth=measure.viewWidth-measure.barLeft-(needsV?sWidth:0);this.horiz.firstChild.style.width=Math.max(0,measure.scrollWidth-measure.clientWidth+totalWidth)+"px"}else this.horiz.style.display="",this.horiz.firstChild.style.width="0";return!this.checkedZeroWidth&&measure.clientHeight>0&&(0==sWidth&&this.zeroWidthHack(),this.checkedZeroWidth=!0),{right:needsV?sWidth:0,bottom:needsH?sWidth:0}},NativeScrollbars.prototype.setScrollLeft=function(pos){this.horiz.scrollLeft!=pos&&(this.horiz.scrollLeft=pos),this.disableHoriz&&this.enableZeroWidthBar(this.horiz,this.disableHoriz,"horiz")},NativeScrollbars.prototype.setScrollTop=function(pos){this.vert.scrollTop!=pos&&(this.vert.scrollTop=pos),this.disableVert&&this.enableZeroWidthBar(this.vert,this.disableVert,"vert")},NativeScrollbars.prototype.zeroWidthHack=function(){var w=mac&&!mac_geMountainLion?"12px":"18px";this.horiz.style.height=this.vert.style.width=w,this.horiz.style.visibility=this.vert.style.visibility="hidden",this.disableHoriz=new Delayed,this.disableVert=new Delayed},NativeScrollbars.prototype.enableZeroWidthBar=function(bar,delay,type){bar.style.visibility="",delay.set(1e3,(function maybeDisable(){var box=bar.getBoundingClientRect();("vert"==type?document.elementFromPoint(box.right-1,(box.top+box.bottom)/2):document.elementFromPoint((box.right+box.left)/2,box.bottom-1))!=bar?bar.style.visibility="hidden":delay.set(1e3,maybeDisable)}))},NativeScrollbars.prototype.clear=function(){var parent=this.horiz.parentNode;parent.removeChild(this.horiz),parent.removeChild(this.vert)};var NullScrollbars=function(){};function updateScrollbars(cm,measure){measure||(measure=measureForScrollbars(cm));var startWidth=cm.display.barWidth,startHeight=cm.display.barHeight;updateScrollbarsInner(cm,measure);for(var i=0;i<4&&startWidth!=cm.display.barWidth||startHeight!=cm.display.barHeight;i++)startWidth!=cm.display.barWidth&&cm.options.lineWrapping&&updateHeightsInViewport(cm),updateScrollbarsInner(cm,measureForScrollbars(cm)),startWidth=cm.display.barWidth,startHeight=cm.display.barHeight}function updateScrollbarsInner(cm,measure){var d=cm.display,sizes=d.scrollbars.update(measure);d.sizer.style.paddingRight=(d.barWidth=sizes.right)+"px",d.sizer.style.paddingBottom=(d.barHeight=sizes.bottom)+"px",d.heightForcer.style.borderBottom=sizes.bottom+"px solid transparent",sizes.right&&sizes.bottom?(d.scrollbarFiller.style.display="block",d.scrollbarFiller.style.height=sizes.bottom+"px",d.scrollbarFiller.style.width=sizes.right+"px"):d.scrollbarFiller.style.display="",sizes.bottom&&cm.options.coverGutterNextToScrollbar&&cm.options.fixedGutter?(d.gutterFiller.style.display="block",d.gutterFiller.style.height=sizes.bottom+"px",d.gutterFiller.style.width=measure.gutterWidth+"px"):d.gutterFiller.style.display=""}NullScrollbars.prototype.update=function(){return{bottom:0,right:0}},NullScrollbars.prototype.setScrollLeft=function(){},NullScrollbars.prototype.setScrollTop=function(){},NullScrollbars.prototype.clear=function(){};var scrollbarModel={native:NativeScrollbars,null:NullScrollbars};function initScrollbars(cm){cm.display.scrollbars&&(cm.display.scrollbars.clear(),cm.display.scrollbars.addClass&&rmClass(cm.display.wrapper,cm.display.scrollbars.addClass)),cm.display.scrollbars=new scrollbarModel[cm.options.scrollbarStyle]((function(node){cm.display.wrapper.insertBefore(node,cm.display.scrollbarFiller),on(node,"mousedown",(function(){cm.state.focused&&setTimeout((function(){return cm.display.input.focus()}),0)})),node.setAttribute("cm-not-content","true")}),(function(pos,axis){"horizontal"==axis?setScrollLeft(cm,pos):updateScrollTop(cm,pos)}),cm),cm.display.scrollbars.addClass&&addClass(cm.display.wrapper,cm.display.scrollbars.addClass)}var nextOpId=0;function startOperation(cm){var op;cm.curOp={cm:cm,viewChanged:!1,startHeight:cm.doc.height,forceUpdate:!1,updateInput:0,typing:!1,changeObjs:null,cursorActivityHandlers:null,cursorActivityCalled:0,selectionChanged:!1,updateMaxLine:!1,scrollLeft:null,scrollTop:null,scrollToPos:null,focus:!1,id:++nextOpId,markArrays:null},op=cm.curOp,operationGroup?operationGroup.ops.push(op):op.ownsGroup=operationGroup={ops:[op],delayedCallbacks:[]}}function endOperation(cm){var op=cm.curOp;op&&function(op,endCb){var group=op.ownsGroup;if(group)try{!function(group){var callbacks=group.delayedCallbacks,i=0;do{for(;i=display.viewTo)||display.maxLineChanged&&cm.options.lineWrapping,op.update=op.mustUpdate&&new DisplayUpdate(cm,op.mustUpdate&&{top:op.scrollTop,ensure:op.scrollToPos},op.forceUpdate)}function endOperation_W1(op){op.updatedDisplay=op.mustUpdate&&updateDisplayIfNeeded(op.cm,op.update)}function endOperation_R2(op){var cm=op.cm,display=cm.display;op.updatedDisplay&&updateHeightsInViewport(cm),op.barMeasure=measureForScrollbars(cm),display.maxLineChanged&&!cm.options.lineWrapping&&(op.adjustWidthTo=measureChar(cm,display.maxLine,display.maxLine.text.length).left+3,cm.display.sizerWidth=op.adjustWidthTo,op.barMeasure.scrollWidth=Math.max(display.scroller.clientWidth,display.sizer.offsetLeft+op.adjustWidthTo+scrollGap(cm)+cm.display.barWidth),op.maxScrollLeft=Math.max(0,display.sizer.offsetLeft+op.adjustWidthTo-displayWidth(cm))),(op.updatedDisplay||op.selectionChanged)&&(op.preparedSelection=display.input.prepareSelection())}function endOperation_W2(op){var cm=op.cm;null!=op.adjustWidthTo&&(cm.display.sizer.style.minWidth=op.adjustWidthTo+"px",op.maxScrollLeft1&&(changed=!0)),null!=scrollPos.scrollLeft&&(setScrollLeft(cm,scrollPos.scrollLeft),Math.abs(cm.doc.scrollLeft-startLeft)>1&&(changed=!0)),!changed)break}return rect}(cm,clipPos(doc,op.scrollToPos.from),clipPos(doc,op.scrollToPos.to),op.scrollToPos.margin);!function(cm,rect){if(!signalDOMEvent(cm,"scrollCursorIntoView")){var display=cm.display,box=display.sizer.getBoundingClientRect(),doScroll=null,doc=display.wrapper.ownerDocument;if(rect.top+box.top<0?doScroll=!0:rect.bottom+box.top>(doc.defaultView.innerHeight||doc.documentElement.clientHeight)&&(doScroll=!1),null!=doScroll&&!phantom){var scrollNode=elt("div","​",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;");cm.display.lineSpace.appendChild(scrollNode),scrollNode.scrollIntoView(doScroll),cm.display.lineSpace.removeChild(scrollNode)}}}(cm,rect)}var hidden=op.maybeHiddenMarkers,unhidden=op.maybeUnhiddenMarkers;if(hidden)for(var i=0;i=cm.display.viewTo)){var end=+new Date+cm.options.workTime,context=getContextBefore(cm,doc.highlightFrontier),changedLines=[];doc.iter(context.line,Math.min(doc.first+doc.size,cm.display.viewTo+500),(function(line){if(context.line>=cm.display.viewFrom){var oldStyles=line.styles,resetState=line.text.length>cm.options.maxHighlightLength?copyState(doc.mode,context.state):null,highlighted=highlightLine(cm,line,context,!0);resetState&&(context.state=resetState),line.styles=highlighted.styles;var oldCls=line.styleClasses,newCls=highlighted.classes;newCls?line.styleClasses=newCls:oldCls&&(line.styleClasses=null);for(var ischange=!oldStyles||oldStyles.length!=line.styles.length||oldCls!=newCls&&(!oldCls||!newCls||oldCls.bgClass!=newCls.bgClass||oldCls.textClass!=newCls.textClass),i=0;!ischange&&iend)return startWorker(cm,cm.options.workDelay),!0})),doc.highlightFrontier=context.line,doc.modeFrontier=Math.max(doc.modeFrontier,context.line),changedLines.length&&runInOp(cm,(function(){for(var i=0;i=display.viewFrom&&update.visible.to<=display.viewTo&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo)&&display.renderedView==display.view&&0==countDirtyView(cm))return!1;maybeUpdateLineNumberWidth(cm)&&(resetView(cm),update.dims=getDimensions(cm));var end=doc.first+doc.size,from=Math.max(update.visible.from-cm.options.viewportMargin,doc.first),to=Math.min(end,update.visible.to+cm.options.viewportMargin);display.viewFromto&&display.viewTo-to<20&&(to=Math.min(end,display.viewTo)),sawCollapsedSpans&&(from=visualLineNo(cm.doc,from),to=visualLineEndNo(cm.doc,to));var different=from!=display.viewFrom||to!=display.viewTo||display.lastWrapHeight!=update.wrapperHeight||display.lastWrapWidth!=update.wrapperWidth;!function(cm,from,to){var display=cm.display;0==display.view.length||from>=display.viewTo||to<=display.viewFrom?(display.view=buildViewArray(cm,from,to),display.viewFrom=from):(display.viewFrom>from?display.view=buildViewArray(cm,from,display.viewFrom).concat(display.view):display.viewFromto&&(display.view=display.view.slice(0,findViewIndex(cm,to)))),display.viewTo=to}(cm,from,to),display.viewOffset=heightAtLine(getLine(cm.doc,display.viewFrom)),cm.display.mover.style.top=display.viewOffset+"px";var toUpdate=countDirtyView(cm);if(!different&&0==toUpdate&&!update.force&&display.renderedView==display.view&&(null==display.updateLineNumbers||display.updateLineNumbers>=display.viewTo))return!1;var selSnapshot=function(cm){if(cm.hasFocus())return null;var active=activeElt(root(cm));if(!active||!contains(cm.display.lineDiv,active))return null;var result={activeElt:active};if(window.getSelection){var sel=win(cm).getSelection();sel.anchorNode&&sel.extend&&contains(cm.display.lineDiv,sel.anchorNode)&&(result.anchorNode=sel.anchorNode,result.anchorOffset=sel.anchorOffset,result.focusNode=sel.focusNode,result.focusOffset=sel.focusOffset)}return result}(cm);return toUpdate>4&&(display.lineDiv.style.display="none"),function(cm,updateNumbersFrom,dims){var display=cm.display,lineNumbers=cm.options.lineNumbers,container=display.lineDiv,cur=container.firstChild;function rm(node){var next=node.nextSibling;return webkit&&mac&&cm.display.currentWheelTarget==node?node.style.display="none":node.parentNode.removeChild(node),next}for(var view=display.view,lineN=display.viewFrom,i=0;i-1&&(updateNumber=!1),updateLineForChanges(cm,lineView,lineN,dims)),updateNumber&&(removeChildren(lineView.lineNumber),lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options,lineN)))),cur=lineView.node.nextSibling}else{var node=buildLineElement(cm,lineView,lineN,dims);container.insertBefore(node,cur)}lineN+=lineView.size}for(;cur;)cur=rm(cur)}(cm,display.updateLineNumbers,update.dims),toUpdate>4&&(display.lineDiv.style.display=""),display.renderedView=display.view,function(snapshot){if(snapshot&&snapshot.activeElt&&snapshot.activeElt!=activeElt(rootNode(snapshot.activeElt))&&(snapshot.activeElt.focus(),!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName)&&snapshot.anchorNode&&contains(document.body,snapshot.anchorNode)&&contains(document.body,snapshot.focusNode))){var doc=snapshot.activeElt.ownerDocument,sel=doc.defaultView.getSelection(),range=doc.createRange();range.setEnd(snapshot.anchorNode,snapshot.anchorOffset),range.collapse(!1),sel.removeAllRanges(),sel.addRange(range),sel.extend(snapshot.focusNode,snapshot.focusOffset)}}(selSnapshot),removeChildren(display.cursorDiv),removeChildren(display.selectionDiv),display.gutters.style.height=display.sizer.style.minHeight=0,different&&(display.lastWrapHeight=update.wrapperHeight,display.lastWrapWidth=update.wrapperWidth,startWorker(cm,400)),display.updateLineNumbers=null,!0}function postUpdateDisplay(cm,update){for(var viewport=update.viewport,first=!0;;first=!1){if(first&&cm.options.lineWrapping&&update.oldDisplayWidth!=displayWidth(cm))first&&(update.visible=visibleLines(cm.display,cm.doc,viewport));else if(viewport&&null!=viewport.top&&(viewport={top:Math.min(cm.doc.height+paddingVert(cm.display)-displayHeight(cm),viewport.top)}),update.visible=visibleLines(cm.display,cm.doc,viewport),update.visible.from>=cm.display.viewFrom&&update.visible.to<=cm.display.viewTo)break;if(!updateDisplayIfNeeded(cm,update))break;updateHeightsInViewport(cm);var barMeasure=measureForScrollbars(cm);updateSelection(cm),updateScrollbars(cm,barMeasure),setDocumentHeight(cm,barMeasure),update.force=!1}update.signal(cm,"update",cm),cm.display.viewFrom==cm.display.reportedViewFrom&&cm.display.viewTo==cm.display.reportedViewTo||(update.signal(cm,"viewportChange",cm,cm.display.viewFrom,cm.display.viewTo),cm.display.reportedViewFrom=cm.display.viewFrom,cm.display.reportedViewTo=cm.display.viewTo)}function updateDisplaySimple(cm,viewport){var update=new DisplayUpdate(cm,viewport);if(updateDisplayIfNeeded(cm,update)){updateHeightsInViewport(cm),postUpdateDisplay(cm,update);var barMeasure=measureForScrollbars(cm);updateSelection(cm),updateScrollbars(cm,barMeasure),setDocumentHeight(cm,barMeasure),update.finish()}}function updateGutterSpace(display){var width=display.gutters.offsetWidth;display.sizer.style.marginLeft=width+"px",signalLater(display,"gutterChanged",display)}function setDocumentHeight(cm,measure){cm.display.sizer.style.minHeight=measure.docHeight+"px",cm.display.heightForcer.style.top=measure.docHeight+"px",cm.display.gutters.style.height=measure.docHeight+cm.display.barHeight+scrollGap(cm)+"px"}function alignHorizontally(cm){var display=cm.display,view=display.view;if(display.alignWidgets||display.gutters.firstChild&&cm.options.fixedGutter){for(var comp=compensateForHScroll(display)-display.scroller.scrollLeft+cm.doc.scrollLeft,gutterW=display.gutters.offsetWidth,left=comp+"px",i=0;i=105&&(d.wrapper.style.clipPath="inset(0px)"),d.wrapper.setAttribute("translate","no"),ie&&ie_version<8&&(d.gutters.style.zIndex=-1,d.scroller.style.paddingRight=0),webkit||gecko&&mobile||(d.scroller.draggable=!0),place&&(place.appendChild?place.appendChild(d.wrapper):place(d.wrapper)),d.viewFrom=d.viewTo=doc.first,d.reportedViewFrom=d.reportedViewTo=doc.first,d.view=[],d.renderedView=null,d.externalMeasured=null,d.viewOffset=0,d.lastWrapHeight=d.lastWrapWidth=0,d.updateLineNumbers=null,d.nativeBarWidth=d.barHeight=d.barWidth=0,d.scrollbarsClipped=!1,d.lineNumWidth=d.lineNumInnerWidth=d.lineNumChars=null,d.alignWidgets=!1,d.cachedCharWidth=d.cachedTextHeight=d.cachedPaddingH=null,d.maxLine=null,d.maxLineLength=0,d.maxLineChanged=!1,d.wheelDX=d.wheelDY=d.wheelStartX=d.wheelStartY=null,d.shift=!1,d.selForContextMenu=null,d.activeTouch=null,d.gutterSpecs=getGutters(options.gutters,options.lineNumbers),renderGutters(d),input.init(d)}DisplayUpdate.prototype.signal=function(emitter,type){hasHandler(emitter,type)&&this.events.push(arguments)},DisplayUpdate.prototype.finish=function(){for(var i=0;iscroll.clientWidth,canScrollY=scroll.scrollHeight>scroll.clientHeight;if(dx&&canScrollX||dy&&canScrollY){if(dy&&mac&&webkit)outer:for(var cur=e.target,view=display.view;cur!=scroll;cur=cur.parentNode)for(var i=0;i=0&&cmp(pos,range.to())<=0)return i}return-1};var Range=function(anchor,head){this.anchor=anchor,this.head=head};function normalizeSelection(cm,ranges,primIndex){var mayTouch=cm&&cm.options.selectionsMayTouch,prim=ranges[primIndex];ranges.sort((function(a,b){return cmp(a.from(),b.from())})),primIndex=indexOf(ranges,prim);for(var i=1;i0:diff>=0){var from=minPos(prev.from(),cur.from()),to=maxPos(prev.to(),cur.to()),inv=prev.empty()?cur.from()==cur.head:prev.from()==prev.head;i<=primIndex&&--primIndex,ranges.splice(--i,2,new Range(inv?to:from,inv?from:to))}}return new Selection(ranges,primIndex)}function simpleSelection(anchor,head){return new Selection([new Range(anchor,head||anchor)],0)}function changeEnd(change){return change.text?Pos(change.from.line+change.text.length-1,lst(change.text).length+(1==change.text.length?change.from.ch:0)):change.to}function adjustForChange(pos,change){if(cmp(pos,change.from)<0)return pos;if(cmp(pos,change.to)<=0)return changeEnd(change);var line=pos.line+change.text.length-(change.to.line-change.from.line)-1,ch=pos.ch;return pos.line==change.to.line&&(ch+=changeEnd(change).ch-change.to.ch),Pos(line,ch)}function computeSelAfterChange(doc,change){for(var out=[],i=0;i1&&doc.remove(from.line+1,nlines-1),doc.insert(from.line+1,added$2)}signalLater(doc,"change",doc,change)}function linkedDocs(doc,f,sharedHistOnly){!function propagate(doc,skip,sharedHist){if(doc.linked)for(var i=0;itime-(doc.cm?doc.cm.options.historyEventDelay:500)||"*"==change.origin.charAt(0)))&&(cur=function(hist,force){return force?(clearSelectionEvents(hist.done),lst(hist.done)):hist.done.length&&!lst(hist.done).ranges?lst(hist.done):hist.done.length>1&&!hist.done[hist.done.length-2].ranges?(hist.done.pop(),lst(hist.done)):void 0}(hist,hist.lastOp==opId)))last=lst(cur.changes),0==cmp(change.from,change.to)&&0==cmp(change.from,last.to)?last.to=changeEnd(change):cur.changes.push(historyChangeFromChange(doc,change));else{var before=lst(hist.done);for(before&&before.ranges||pushSelectionToHistory(doc.sel,hist.done),cur={changes:[historyChangeFromChange(doc,change)],generation:hist.generation},hist.done.push(cur);hist.done.length>hist.undoDepth;)hist.done.shift(),hist.done[0].ranges||hist.done.shift()}hist.done.push(selAfter),hist.generation=++hist.maxGeneration,hist.lastModTime=hist.lastSelTime=time,hist.lastOp=hist.lastSelOp=opId,hist.lastOrigin=hist.lastSelOrigin=change.origin,last||signal(doc,"historyAdded")}function addSelectionToHistory(doc,sel,opId,options){var hist=doc.history,origin=options&&options.origin;opId==hist.lastSelOp||origin&&hist.lastSelOrigin==origin&&(hist.lastModTime==hist.lastSelTime&&hist.lastOrigin==origin||function(doc,origin,prev,sel){var ch=origin.charAt(0);return"*"==ch||"+"==ch&&prev.ranges.length==sel.ranges.length&&prev.somethingSelected()==sel.somethingSelected()&&new Date-doc.history.lastSelTime<=(doc.cm?doc.cm.options.historyEventDelay:500)}(doc,origin,lst(hist.done),sel))?hist.done[hist.done.length-1]=sel:pushSelectionToHistory(sel,hist.done),hist.lastSelTime=+new Date,hist.lastSelOrigin=origin,hist.lastSelOp=opId,options&&!1!==options.clearRedo&&clearSelectionEvents(hist.undone)}function pushSelectionToHistory(sel,dest){var top=lst(dest);top&&top.ranges&&top.equals(sel)||dest.push(sel)}function attachLocalSpans(doc,change,from,to){var existing=change["spans_"+doc.id],n=0;doc.iter(Math.max(doc.first,from),Math.min(doc.first+doc.size,to),(function(line){line.markedSpans&&((existing||(existing=change["spans_"+doc.id]={}))[n]=line.markedSpans),++n}))}function removeClearedSpans(spans){if(!spans)return null;for(var out,i=0;i-1&&(lst(newChanges)[prop]=change[prop],delete change[prop])}}}return copy}function extendRange(range,head,other,extend){if(extend){var anchor=range.anchor;if(other){var posBefore=cmp(head,anchor)<0;posBefore!=cmp(other,anchor)<0?(anchor=head,head=other):posBefore!=cmp(head,other)<0&&(head=other)}return new Range(anchor,head)}return new Range(other||head,head)}function extendSelection(doc,head,other,options,extend){null==extend&&(extend=doc.cm&&(doc.cm.display.shift||doc.extend)),setSelection(doc,new Selection([extendRange(doc.sel.primary(),head,other,extend)],0),options)}function extendSelections(doc,heads,options){for(var out=[],extend=doc.cm&&(doc.cm.display.shift||doc.extend),i=0;i=pos.ch:sp.to>pos.ch))){if(mayClear&&(signal(m,"beforeCursorEnter"),m.explicitlyCleared)){if(line.markedSpans){--i;continue}break}if(!m.atomic)continue;if(oldPos){var near=m.find(dir<0?1:-1),diff=void 0;if((dir<0?preventCursorRight:preventCursorLeft)&&(near=movePos(doc,near,-dir,near&&near.line==pos.line?line:null)),near&&near.line==pos.line&&(diff=cmp(near,oldPos))&&(dir<0?diff<0:diff>0))return skipAtomicInner(doc,near,pos,dir,mayClear)}var far=m.find(dir<0?-1:1);return(dir<0?preventCursorLeft:preventCursorRight)&&(far=movePos(doc,far,dir,far.line==pos.line?line:null)),far?skipAtomicInner(doc,far,pos,dir,mayClear):null}}return pos}function skipAtomic(doc,pos,oldPos,bias,mayClear){var dir=bias||1,found=skipAtomicInner(doc,pos,oldPos,dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,dir,!0)||skipAtomicInner(doc,pos,oldPos,-dir,mayClear)||!mayClear&&skipAtomicInner(doc,pos,oldPos,-dir,!0);return found||(doc.cantEdit=!0,Pos(doc.first,0))}function movePos(doc,pos,dir,line){return dir<0&&0==pos.ch?pos.line>doc.first?clipPos(doc,Pos(pos.line-1)):null:dir>0&&pos.ch==(line||getLine(doc,pos.line)).text.length?pos.line0)){var newParts=[j,1],dfrom=cmp(p.from,m.from),dto=cmp(p.to,m.to);(dfrom<0||!mk.inclusiveLeft&&!dfrom)&&newParts.push({from:p.from,to:m.from}),(dto>0||!mk.inclusiveRight&&!dto)&&newParts.push({from:m.to,to:p.to}),parts.splice.apply(parts,newParts),j+=newParts.length-3}}return parts}(doc,change.from,change.to);if(split)for(var i=split.length-1;i>=0;--i)makeChangeInner(doc,{from:split[i].from,to:split[i].to,text:i?[""]:change.text,origin:change.origin});else makeChangeInner(doc,change)}}function makeChangeInner(doc,change){if(1!=change.text.length||""!=change.text[0]||0!=cmp(change.from,change.to)){var selAfter=computeSelAfterChange(doc,change);addChangeToHistory(doc,change,selAfter,doc.cm?doc.cm.curOp.id:NaN),makeChangeSingleDoc(doc,change,selAfter,stretchSpansOverChange(doc,change));var rebased=[];linkedDocs(doc,(function(doc,sharedHist){sharedHist||-1!=indexOf(rebased,doc.history)||(rebaseHist(doc.history,change),rebased.push(doc.history)),makeChangeSingleDoc(doc,change,null,stretchSpansOverChange(doc,change))}))}}function makeChangeFromHistory(doc,type,allowSelectionOnly){var suppress=doc.cm&&doc.cm.state.suppressEdits;if(!suppress||allowSelectionOnly){for(var event,hist=doc.history,selAfter=doc.sel,source="undo"==type?hist.done:hist.undone,dest="undo"==type?hist.undone:hist.done,i=0;i=0;--i$1){var returned=loop(i$1);if(returned)return returned.v}}}}function shiftDoc(doc,distance){if(0!=distance&&(doc.first+=distance,doc.sel=new Selection(map(doc.sel.ranges,(function(range){return new Range(Pos(range.anchor.line+distance,range.anchor.ch),Pos(range.head.line+distance,range.head.ch))})),doc.sel.primIndex),doc.cm)){regChange(doc.cm,doc.first,doc.first-distance,distance);for(var d=doc.cm.display,l=d.viewFrom;ldoc.lastLine())){if(change.from.linelast&&(change={from:change.from,to:Pos(last,getLine(doc,last).text.length),text:[change.text[0]],origin:change.origin}),change.removed=getBetween(doc,change.from,change.to),selAfter||(selAfter=computeSelAfterChange(doc,change)),doc.cm?function(cm,change,spans){var doc=cm.doc,display=cm.display,from=change.from,to=change.to,recomputeMaxLength=!1,checkWidthStart=from.line;cm.options.lineWrapping||(checkWidthStart=lineNo(visualLine(getLine(doc,from.line))),doc.iter(checkWidthStart,to.line+1,(function(line){if(line==display.maxLine)return recomputeMaxLength=!0,!0}))),doc.sel.contains(change.from,change.to)>-1&&signalCursorActivity(cm),updateDoc(doc,change,spans,estimateHeight(cm)),cm.options.lineWrapping||(doc.iter(checkWidthStart,from.line+change.text.length,(function(line){var len=lineLength(line);len>display.maxLineLength&&(display.maxLine=line,display.maxLineLength=len,display.maxLineChanged=!0,recomputeMaxLength=!1)})),recomputeMaxLength&&(cm.curOp.updateMaxLine=!0)),function(doc,n){if(doc.modeFrontier=Math.min(doc.modeFrontier,n),!(doc.highlightFrontierstart;line--){var saved=getLine(doc,line).stateAfter;if(saved&&(!(saved instanceof SavedContext)||line+saved.lookAhead1||!(this.children[0]instanceof LeafChunk))){var lines=[];this.collapse(lines),this.children=[new LeafChunk(lines)],this.children[0].parent=this}},collapse:function(lines){for(var i=0;i50){for(var remaining=child.lines.length%25+25,pos=remaining;pos10);me.parent.maybeSpill()}},iterN:function(at,n,op){for(var i=0;i0||0==diff&&!1!==marker.clearWhenEmpty)return marker;if(marker.replacedWith&&(marker.collapsed=!0,marker.widgetNode=eltP("span",[marker.replacedWith],"CodeMirror-widget"),options.handleMouseEvents||marker.widgetNode.setAttribute("cm-ignore-events","true"),options.insertLeft&&(marker.widgetNode.insertLeft=!0)),marker.collapsed){if(conflictingCollapsedRange(doc,from.line,from,to,marker)||from.line!=to.line&&conflictingCollapsedRange(doc,to.line,from,to,marker))throw new Error("Inserting collapsed marker partially overlapping an existing one");sawCollapsedSpans=!0}marker.addToHistory&&addChangeToHistory(doc,{from:from,to:to,origin:"markText"},doc.sel,NaN);var updateMaxLine,curLine=from.line,cm=doc.cm;if(doc.iter(curLine,to.line+1,(function(line){cm&&marker.collapsed&&!cm.options.lineWrapping&&visualLine(line)==cm.display.maxLine&&(updateMaxLine=!0),marker.collapsed&&curLine!=from.line&&updateLineHeight(line,0),function(line,span,op){var inThisOp=op&&window.WeakSet&&(op.markedSpans||(op.markedSpans=new WeakSet));inThisOp&&line.markedSpans&&inThisOp.has(line.markedSpans)?line.markedSpans.push(span):(line.markedSpans=line.markedSpans?line.markedSpans.concat([span]):[span],inThisOp&&inThisOp.add(line.markedSpans)),span.marker.attachLine(line)}(line,new MarkedSpan(marker,curLine==from.line?from.ch:null,curLine==to.line?to.ch:null),doc.cm&&doc.cm.curOp),++curLine})),marker.collapsed&&doc.iter(from.line,to.line+1,(function(line){lineIsHidden(doc,line)&&updateLineHeight(line,0)})),marker.clearOnEnter&&on(marker,"beforeCursorEnter",(function(){return marker.clear()})),marker.readOnly&&(sawReadOnlySpans=!0,(doc.history.done.length||doc.history.undone.length)&&doc.clearHistory()),marker.collapsed&&(marker.id=++nextMarkerId,marker.atomic=!0),cm){if(updateMaxLine&&(cm.curOp.updateMaxLine=!0),marker.collapsed)regChange(cm,from.line,to.line+1);else if(marker.className||marker.startStyle||marker.endStyle||marker.css||marker.attributes||marker.title)for(var i=from.line;i<=to.line;i++)regLineChange(cm,i,"text");marker.atomic&&reCheckSelection(cm.doc),signalLater(cm,"markerAdded",cm,marker)}return marker}TextMarker.prototype.clear=function(){if(!this.explicitlyCleared){var cm=this.doc.cm,withOp=cm&&!cm.curOp;if(withOp&&startOperation(cm),hasHandler(this,"clear")){var found=this.find();found&&signalLater(this,"clear",found.from,found.to)}for(var min=null,max=null,i=0;icm.display.maxLineLength&&(cm.display.maxLine=visual,cm.display.maxLineLength=len,cm.display.maxLineChanged=!0)}null!=min&&cm&&this.collapsed&®Change(cm,min,max+1),this.lines.length=0,this.explicitlyCleared=!0,this.atomic&&this.doc.cantEdit&&(this.doc.cantEdit=!1,cm&&reCheckSelection(cm.doc)),cm&&signalLater(cm,"markerCleared",cm,this,min,max),withOp&&endOperation(cm),this.parent&&this.parent.clear()}},TextMarker.prototype.find=function(side,lineObj){var from,to;null==side&&"bookmark"==this.type&&(side=1);for(var i=0;i=0;i$1--)makeChange(this,changes[i$1]);newSel?setSelectionReplaceHistory(this,newSel):this.cm&&ensureCursorVisible(this.cm)})),undo:docMethodOp((function(){makeChangeFromHistory(this,"undo")})),redo:docMethodOp((function(){makeChangeFromHistory(this,"redo")})),undoSelection:docMethodOp((function(){makeChangeFromHistory(this,"undo",!0)})),redoSelection:docMethodOp((function(){makeChangeFromHistory(this,"redo",!0)})),setExtending:function(val){this.extend=val},getExtending:function(){return this.extend},historySize:function(){for(var hist=this.history,done=0,undone=0,i=0;i=pos.ch)&&markers.push(span.marker.parent||span.marker)}return markers},findMarks:function(from,to,filter){from=clipPos(this,from),to=clipPos(this,to);var found=[],lineNo=from.line;return this.iter(from.line,to.line+1,(function(line){var spans=line.markedSpans;if(spans)for(var i=0;i=span.to||null==span.from&&lineNo!=from.line||null!=span.from&&lineNo==to.line&&span.from>=to.ch||filter&&!filter(span.marker)||found.push(span.marker.parent||span.marker)}++lineNo})),found},getAllMarks:function(){var markers=[];return this.iter((function(line){var sps=line.markedSpans;if(sps)for(var i=0;ioff)return ch=off,!0;off-=sz,++lineNo})),clipPos(this,Pos(lineNo,ch))},indexFromPos:function(coords){var index=(coords=clipPos(this,coords)).ch;if(coords.linefrom&&(from=options.from),null!=options.to&&options.to-1)return cm.state.draggingText(e),void setTimeout((function(){return cm.display.input.focus()}),20);try{var text$1=e.dataTransfer.getData("Text");if(text$1){var selected;if(cm.state.draggingText&&!cm.state.draggingText.copy&&(selected=cm.listSelections()),setSelectionNoUndo(cm.doc,simpleSelection(pos,pos)),selected)for(var i$1=0;i$1=0;i--)replaceRange(cm.doc,"",kill[i].from,kill[i].to,"+delete");ensureCursorVisible(cm)}))}function moveCharLogically(line,ch,dir){var target=skipExtendingChars(line.text,ch+dir,dir);return target<0||target>line.text.length?null:target}function moveLogically(line,start,dir){var ch=moveCharLogically(line,start.ch,dir);return null==ch?null:new Pos(start.line,ch,dir<0?"after":"before")}function endOfLine(visually,cm,lineObj,lineNo,dir){if(visually){"rtl"==cm.doc.direction&&(dir=-dir);var order=getOrder(lineObj,cm.doc.direction);if(order){var ch,part=dir<0?lst(order):order[0],sticky=dir<0==(1==part.level)?"after":"before";if(part.level>0||"rtl"==cm.doc.direction){var prep=prepareMeasureForLine(cm,lineObj);ch=dir<0?lineObj.text.length-1:0;var targetTop=measureCharPrepared(cm,prep,ch).top;ch=findFirst((function(ch){return measureCharPrepared(cm,prep,ch).top==targetTop}),dir<0==(1==part.level)?part.from:part.to-1,ch),"before"==sticky&&(ch=moveCharLogically(lineObj,ch,1))}else ch=dir<0?part.to:part.from;return new Pos(lineNo,ch,sticky)}}return new Pos(lineNo,dir<0?lineObj.text.length:0,dir<0?"before":"after")}keyMap.basic={Left:"goCharLeft",Right:"goCharRight",Up:"goLineUp",Down:"goLineDown",End:"goLineEnd",Home:"goLineStartSmart",PageUp:"goPageUp",PageDown:"goPageDown",Delete:"delCharAfter",Backspace:"delCharBefore","Shift-Backspace":"delCharBefore",Tab:"defaultTab","Shift-Tab":"indentAuto",Enter:"newlineAndIndent",Insert:"toggleOverwrite",Esc:"singleSelection"},keyMap.pcDefault={"Ctrl-A":"selectAll","Ctrl-D":"deleteLine","Ctrl-Z":"undo","Shift-Ctrl-Z":"redo","Ctrl-Y":"redo","Ctrl-Home":"goDocStart","Ctrl-End":"goDocEnd","Ctrl-Up":"goLineUp","Ctrl-Down":"goLineDown","Ctrl-Left":"goGroupLeft","Ctrl-Right":"goGroupRight","Alt-Left":"goLineStart","Alt-Right":"goLineEnd","Ctrl-Backspace":"delGroupBefore","Ctrl-Delete":"delGroupAfter","Ctrl-S":"save","Ctrl-F":"find","Ctrl-G":"findNext","Shift-Ctrl-G":"findPrev","Shift-Ctrl-F":"replace","Shift-Ctrl-R":"replaceAll","Ctrl-[":"indentLess","Ctrl-]":"indentMore","Ctrl-U":"undoSelection","Shift-Ctrl-U":"redoSelection","Alt-U":"redoSelection",fallthrough:"basic"},keyMap.emacsy={"Ctrl-F":"goCharRight","Ctrl-B":"goCharLeft","Ctrl-P":"goLineUp","Ctrl-N":"goLineDown","Ctrl-A":"goLineStart","Ctrl-E":"goLineEnd","Ctrl-V":"goPageDown","Shift-Ctrl-V":"goPageUp","Ctrl-D":"delCharAfter","Ctrl-H":"delCharBefore","Alt-Backspace":"delWordBefore","Ctrl-K":"killLine","Ctrl-T":"transposeChars","Ctrl-O":"openLine"},keyMap.macDefault={"Cmd-A":"selectAll","Cmd-D":"deleteLine","Cmd-Z":"undo","Shift-Cmd-Z":"redo","Cmd-Y":"redo","Cmd-Home":"goDocStart","Cmd-Up":"goDocStart","Cmd-End":"goDocEnd","Cmd-Down":"goDocEnd","Alt-Left":"goGroupLeft","Alt-Right":"goGroupRight","Cmd-Left":"goLineLeft","Cmd-Right":"goLineRight","Alt-Backspace":"delGroupBefore","Ctrl-Alt-Backspace":"delGroupAfter","Alt-Delete":"delGroupAfter","Cmd-S":"save","Cmd-F":"find","Cmd-G":"findNext","Shift-Cmd-G":"findPrev","Cmd-Alt-F":"replace","Shift-Cmd-Alt-F":"replaceAll","Cmd-[":"indentLess","Cmd-]":"indentMore","Cmd-Backspace":"delWrappedLineLeft","Cmd-Delete":"delWrappedLineRight","Cmd-U":"undoSelection","Shift-Cmd-U":"redoSelection","Ctrl-Up":"goDocStart","Ctrl-Down":"goDocEnd",fallthrough:["basic","emacsy"]},keyMap.default=mac?keyMap.macDefault:keyMap.pcDefault;var commands={selectAll:selectAll,singleSelection:function(cm){return cm.setSelection(cm.getCursor("anchor"),cm.getCursor("head"),sel_dontScroll)},killLine:function(cm){return deleteNearSelection(cm,(function(range){if(range.empty()){var len=getLine(cm.doc,range.head.line).text.length;return range.head.ch==len&&range.head.line0)cur=new Pos(cur.line,cur.ch+1),cm.replaceRange(line.charAt(cur.ch-1)+line.charAt(cur.ch-2),Pos(cur.line,cur.ch-2),cur,"+transpose");else if(cur.line>cm.doc.first){var prev=getLine(cm.doc,cur.line-1).text;prev&&(cur=new Pos(cur.line,1),cm.replaceRange(line.charAt(0)+cm.doc.lineSeparator()+prev.charAt(prev.length-1),Pos(cur.line-1,prev.length-1),cur,"+transpose"))}newSel.push(new Range(cur,cur))}cm.setSelections(newSel)}))},newlineAndIndent:function(cm){return runInOp(cm,(function(){for(var sels=cm.listSelections(),i=sels.length-1;i>=0;i--)cm.replaceRange(cm.doc.lineSeparator(),sels[i].anchor,sels[i].head,"+input");sels=cm.listSelections();for(var i$1=0;i$1-1&&(cmp((contained=sel.ranges[contained]).from(),pos)<0||pos.xRel>0)&&(cmp(contained.to(),pos)>0||pos.xRel<0)?function(cm,event,pos,behavior){var display=cm.display,moved=!1,dragEnd=operation(cm,(function(e){webkit&&(display.scroller.draggable=!1),cm.state.draggingText=!1,cm.state.delayingBlurEvent&&(cm.hasFocus()?cm.state.delayingBlurEvent=!1:delayBlurEvent(cm)),off(display.wrapper.ownerDocument,"mouseup",dragEnd),off(display.wrapper.ownerDocument,"mousemove",mouseMove),off(display.scroller,"dragstart",dragStart),off(display.scroller,"drop",dragEnd),moved||(e_preventDefault(e),behavior.addNew||extendSelection(cm.doc,pos,null,null,behavior.extend),webkit&&!safari||ie&&9==ie_version?setTimeout((function(){display.wrapper.ownerDocument.body.focus({preventScroll:!0}),display.input.focus()}),20):display.input.focus())})),mouseMove=function(e2){moved=moved||Math.abs(event.clientX-e2.clientX)+Math.abs(event.clientY-e2.clientY)>=10},dragStart=function(){return moved=!0};webkit&&(display.scroller.draggable=!0),cm.state.draggingText=dragEnd,dragEnd.copy=!behavior.moveOnDrag,on(display.wrapper.ownerDocument,"mouseup",dragEnd),on(display.wrapper.ownerDocument,"mousemove",mouseMove),on(display.scroller,"dragstart",dragStart),on(display.scroller,"drop",dragEnd),cm.state.delayingBlurEvent=!0,setTimeout((function(){return display.input.focus()}),20),display.scroller.dragDrop&&display.scroller.dragDrop()}(cm,event,pos,behavior):function(cm,event,start,behavior){ie&&delayBlurEvent(cm);var display=cm.display,doc=cm.doc;e_preventDefault(event);var ourRange,ourIndex,startSel=doc.sel,ranges=startSel.ranges;if(behavior.addNew&&!behavior.extend?(ourIndex=doc.sel.contains(start),ourRange=ourIndex>-1?ranges[ourIndex]:new Range(start,start)):(ourRange=doc.sel.primary(),ourIndex=doc.sel.primIndex),"rectangle"==behavior.unit)behavior.addNew||(ourRange=new Range(start,start)),start=posFromMouse(cm,event,!0,!0),ourIndex=-1;else{var range=rangeForUnit(cm,start,behavior.unit);ourRange=behavior.extend?extendRange(ourRange,range.anchor,range.head,behavior.extend):range}behavior.addNew?-1==ourIndex?(ourIndex=ranges.length,setSelection(doc,normalizeSelection(cm,ranges.concat([ourRange]),ourIndex),{scroll:!1,origin:"*mouse"})):ranges.length>1&&ranges[ourIndex].empty()&&"char"==behavior.unit&&!behavior.extend?(setSelection(doc,normalizeSelection(cm,ranges.slice(0,ourIndex).concat(ranges.slice(ourIndex+1)),0),{scroll:!1,origin:"*mouse"}),startSel=doc.sel):replaceOneSelection(doc,ourIndex,ourRange,sel_mouse):(ourIndex=0,setSelection(doc,new Selection([ourRange],0),sel_mouse),startSel=doc.sel);var lastPos=start;function extendTo(pos){if(0!=cmp(lastPos,pos))if(lastPos=pos,"rectangle"==behavior.unit){for(var ranges=[],tabSize=cm.options.tabSize,startCol=countColumn(getLine(doc,start.line).text,start.ch,tabSize),posCol=countColumn(getLine(doc,pos.line).text,pos.ch,tabSize),left=Math.min(startCol,posCol),right=Math.max(startCol,posCol),line=Math.min(start.line,pos.line),end=Math.min(cm.lastLine(),Math.max(start.line,pos.line));line<=end;line++){var text=getLine(doc,line).text,leftPos=findColumn(text,left,tabSize);left==right?ranges.push(new Range(Pos(line,leftPos),Pos(line,leftPos))):text.length>leftPos&&ranges.push(new Range(Pos(line,leftPos),Pos(line,findColumn(text,right,tabSize))))}ranges.length||ranges.push(new Range(start,start)),setSelection(doc,normalizeSelection(cm,startSel.ranges.slice(0,ourIndex).concat(ranges),ourIndex),{origin:"*mouse",scroll:!1}),cm.scrollIntoView(pos)}else{var head,oldRange=ourRange,range=rangeForUnit(cm,pos,behavior.unit),anchor=oldRange.anchor;cmp(range.anchor,anchor)>0?(head=range.head,anchor=minPos(oldRange.from(),range.anchor)):(head=range.anchor,anchor=maxPos(oldRange.to(),range.head));var ranges$1=startSel.ranges.slice(0);ranges$1[ourIndex]=function(cm,range){var anchor=range.anchor,head=range.head,anchorLine=getLine(cm.doc,anchor.line);if(0==cmp(anchor,head)&&anchor.sticky==head.sticky)return range;var order=getOrder(anchorLine);if(!order)return range;var index=getBidiPartAt(order,anchor.ch,anchor.sticky),part=order[index];if(part.from!=anchor.ch&&part.to!=anchor.ch)return range;var leftSide,boundary=index+(part.from==anchor.ch==(1!=part.level)?0:1);if(0==boundary||boundary==order.length)return range;if(head.line!=anchor.line)leftSide=(head.line-anchor.line)*("ltr"==cm.doc.direction?1:-1)>0;else{var headIndex=getBidiPartAt(order,head.ch,head.sticky),dir=headIndex-index||(head.ch-anchor.ch)*(1==part.level?-1:1);leftSide=headIndex==boundary-1||headIndex==boundary?dir<0:dir>0}var usePart=order[boundary+(leftSide?-1:0)],from=leftSide==(1==usePart.level),ch=from?usePart.from:usePart.to,sticky=from?"after":"before";return anchor.ch==ch&&anchor.sticky==sticky?range:new Range(new Pos(anchor.line,ch,sticky),head)}(cm,new Range(clipPos(doc,anchor),head)),setSelection(doc,normalizeSelection(cm,ranges$1,ourIndex),sel_mouse)}}var editorSize=display.wrapper.getBoundingClientRect(),counter=0;function extend(e){var curCount=++counter,cur=posFromMouse(cm,e,!0,"rectangle"==behavior.unit);if(cur)if(0!=cmp(cur,lastPos)){cm.curOp.focus=activeElt(root(cm)),extendTo(cur);var visible=visibleLines(display,doc);(cur.line>=visible.to||cur.lineeditorSize.bottom?20:0;outside&&setTimeout(operation(cm,(function(){counter==curCount&&(display.scroller.scrollTop+=outside,extend(e))})),50)}}function done(e){cm.state.selectingText=!1,counter=1/0,e&&(e_preventDefault(e),display.input.focus()),off(display.wrapper.ownerDocument,"mousemove",move),off(display.wrapper.ownerDocument,"mouseup",up),doc.history.lastSelOrigin=null}var move=operation(cm,(function(e){0!==e.buttons&&e_button(e)?extend(e):done(e)})),up=operation(cm,done);cm.state.selectingText=up,on(display.wrapper.ownerDocument,"mousemove",move),on(display.wrapper.ownerDocument,"mouseup",up)}(cm,event,pos,behavior)}(cm,pos,repeat,e):e_target(e)==display.scroller&&e_preventDefault(e):2==button?(pos&&extendSelection(cm.doc,pos),setTimeout((function(){return display.input.focus()}),20)):3==button&&(captureRightClick?cm.display.input.onContextMenu(e):delayBlurEvent(cm)))}}function rangeForUnit(cm,pos,unit){if("char"==unit)return new Range(pos,pos);if("word"==unit)return cm.findWordAt(pos);if("line"==unit)return new Range(Pos(pos.line,0),clipPos(cm.doc,Pos(pos.line+1,0)));var result=unit(cm,pos);return new Range(result.from,result.to)}function gutterEvent(cm,e,type,prevent){var mX,mY;if(e.touches)mX=e.touches[0].clientX,mY=e.touches[0].clientY;else try{mX=e.clientX,mY=e.clientY}catch(e$1){return!1}if(mX>=Math.floor(cm.display.gutters.getBoundingClientRect().right))return!1;prevent&&e_preventDefault(e);var display=cm.display,lineBox=display.lineDiv.getBoundingClientRect();if(mY>lineBox.bottom||!hasHandler(cm,type))return e_defaultPrevented(e);mY-=lineBox.top-display.viewOffset;for(var i=0;i=mX)return signal(cm,type,cm,lineAtHeight(cm.doc,mY),cm.display.gutterSpecs[i].className,e),e_defaultPrevented(e)}}function clickInGutter(cm,e){return gutterEvent(cm,e,"gutterClick",!0)}function onContextMenu(cm,e){eventInWidget(cm.display,e)||function(cm,e){return!!hasHandler(cm,"gutterContextMenu")&&gutterEvent(cm,e,"gutterContextMenu",!1)}(cm,e)||signalDOMEvent(cm,e,"contextmenu")||captureRightClick||cm.display.input.onContextMenu(e)}function themeChanged(cm){cm.display.wrapper.className=cm.display.wrapper.className.replace(/\s*cm-s-\S+/g,"")+cm.options.theme.replace(/(^|\s)\s*/g," cm-s-"),clearCaches(cm)}PastClick.prototype.compare=function(time,pos,button){return this.time+400>time&&0==cmp(pos,this.pos)&&button==this.button};var Init={toString:function(){return"CodeMirror.Init"}},defaults={},optionHandlers={};function dragDropChanged(cm,value,old){if(!value!=!(old&&old!=Init)){var funcs=cm.display.dragFunctions,toggle=value?on:off;toggle(cm.display.scroller,"dragstart",funcs.start),toggle(cm.display.scroller,"dragenter",funcs.enter),toggle(cm.display.scroller,"dragover",funcs.over),toggle(cm.display.scroller,"dragleave",funcs.leave),toggle(cm.display.scroller,"drop",funcs.drop)}}function wrappingChanged(cm){cm.options.lineWrapping?(addClass(cm.display.wrapper,"CodeMirror-wrap"),cm.display.sizer.style.minWidth="",cm.display.sizerWidth=null):(rmClass(cm.display.wrapper,"CodeMirror-wrap"),findMaxLine(cm)),estimateLineHeights(cm),regChange(cm),clearCaches(cm),setTimeout((function(){return updateScrollbars(cm)}),100)}function CodeMirror(place,options){var this$1$1=this;if(!(this instanceof CodeMirror))return new CodeMirror(place,options);this.options=options=options?copyObj(options):{},copyObj(defaults,options,!1);var doc=options.value;"string"==typeof doc?doc=new Doc(doc,options.mode,null,options.lineSeparator,options.direction):options.mode&&(doc.modeOption=options.mode),this.doc=doc;var input=new CodeMirror.inputStyles[options.inputStyle](this),display=this.display=new Display(place,doc,input,options);for(var opt in display.wrapper.CodeMirror=this,themeChanged(this),options.lineWrapping&&(this.display.wrapper.className+=" CodeMirror-wrap"),initScrollbars(this),this.state={keyMaps:[],overlays:[],modeGen:0,overwrite:!1,delayingBlurEvent:!1,focused:!1,suppressEdits:!1,pasteIncoming:-1,cutIncoming:-1,selectingText:!1,draggingText:!1,highlight:new Delayed,keySeq:null,specialChars:null},options.autofocus&&!mobile&&display.input.focus(),ie&&ie_version<11&&setTimeout((function(){return this$1$1.display.input.reset(!0)}),20),function(cm){var d=cm.display;on(d.scroller,"mousedown",operation(cm,onMouseDown)),on(d.scroller,"dblclick",ie&&ie_version<11?operation(cm,(function(e){if(!signalDOMEvent(cm,e)){var pos=posFromMouse(cm,e);if(pos&&!clickInGutter(cm,e)&&!eventInWidget(cm.display,e)){e_preventDefault(e);var word=cm.findWordAt(pos);extendSelection(cm.doc,word.anchor,word.head)}}})):function(e){return signalDOMEvent(cm,e)||e_preventDefault(e)}),on(d.scroller,"contextmenu",(function(e){return onContextMenu(cm,e)})),on(d.input.getField(),"contextmenu",(function(e){d.scroller.contains(e.target)||onContextMenu(cm,e)}));var touchFinished,prevTouch={end:0};function finishTouch(){d.activeTouch&&(touchFinished=setTimeout((function(){return d.activeTouch=null}),1e3),(prevTouch=d.activeTouch).end=+new Date)}function isMouseLikeTouchEvent(e){if(1!=e.touches.length)return!1;var touch=e.touches[0];return touch.radiusX<=1&&touch.radiusY<=1}function farAway(touch,other){if(null==other.left)return!0;var dx=other.left-touch.left,dy=other.top-touch.top;return dx*dx+dy*dy>400}on(d.scroller,"touchstart",(function(e){if(!signalDOMEvent(cm,e)&&!isMouseLikeTouchEvent(e)&&!clickInGutter(cm,e)){d.input.ensurePolled(),clearTimeout(touchFinished);var now=+new Date;d.activeTouch={start:now,moved:!1,prev:now-prevTouch.end<=300?prevTouch:null},1==e.touches.length&&(d.activeTouch.left=e.touches[0].pageX,d.activeTouch.top=e.touches[0].pageY)}})),on(d.scroller,"touchmove",(function(){d.activeTouch&&(d.activeTouch.moved=!0)})),on(d.scroller,"touchend",(function(e){var touch=d.activeTouch;if(touch&&!eventInWidget(d,e)&&null!=touch.left&&!touch.moved&&new Date-touch.start<300){var range,pos=cm.coordsChar(d.activeTouch,"page");range=!touch.prev||farAway(touch,touch.prev)?new Range(pos,pos):!touch.prev.prev||farAway(touch,touch.prev.prev)?cm.findWordAt(pos):new Range(Pos(pos.line,0),clipPos(cm.doc,Pos(pos.line+1,0))),cm.setSelection(range.anchor,range.head),cm.focus(),e_preventDefault(e)}finishTouch()})),on(d.scroller,"touchcancel",finishTouch),on(d.scroller,"scroll",(function(){d.scroller.clientHeight&&(updateScrollTop(cm,d.scroller.scrollTop),setScrollLeft(cm,d.scroller.scrollLeft,!0),signal(cm,"scroll",cm))})),on(d.scroller,"mousewheel",(function(e){return onScrollWheel(cm,e)})),on(d.scroller,"DOMMouseScroll",(function(e){return onScrollWheel(cm,e)})),on(d.wrapper,"scroll",(function(){return d.wrapper.scrollTop=d.wrapper.scrollLeft=0})),d.dragFunctions={enter:function(e){signalDOMEvent(cm,e)||e_stop(e)},over:function(e){signalDOMEvent(cm,e)||(function(cm,e){var pos=posFromMouse(cm,e);if(pos){var frag=document.createDocumentFragment();drawSelectionCursor(cm,pos,frag),cm.display.dragCursor||(cm.display.dragCursor=elt("div",null,"CodeMirror-cursors CodeMirror-dragcursors"),cm.display.lineSpace.insertBefore(cm.display.dragCursor,cm.display.cursorDiv)),removeChildrenAndAdd(cm.display.dragCursor,frag)}}(cm,e),e_stop(e))},start:function(e){return function(cm,e){if(ie&&(!cm.state.draggingText||+new Date-lastDrop<100))e_stop(e);else if(!signalDOMEvent(cm,e)&&!eventInWidget(cm.display,e)&&(e.dataTransfer.setData("Text",cm.getSelection()),e.dataTransfer.effectAllowed="copyMove",e.dataTransfer.setDragImage&&!safari)){var img=elt("img",null,null,"position: fixed; left: 0; top: 0;");img.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",presto&&(img.width=img.height=1,cm.display.wrapper.appendChild(img),img._top=img.offsetTop),e.dataTransfer.setDragImage(img,0,0),presto&&img.parentNode.removeChild(img)}}(cm,e)},drop:operation(cm,onDrop),leave:function(e){signalDOMEvent(cm,e)||clearDragCursor(cm)}};var inp=d.input.getField();on(inp,"keyup",(function(e){return onKeyUp.call(cm,e)})),on(inp,"keydown",operation(cm,onKeyDown)),on(inp,"keypress",operation(cm,onKeyPress)),on(inp,"focus",(function(e){return onFocus(cm,e)})),on(inp,"blur",(function(e){return onBlur(cm,e)}))}(this),ensureGlobalHandlers(),startOperation(this),this.curOp.forceUpdate=!0,attachDoc(this,doc),options.autofocus&&!mobile||this.hasFocus()?setTimeout((function(){this$1$1.hasFocus()&&!this$1$1.state.focused&&onFocus(this$1$1)}),20):onBlur(this),optionHandlers)optionHandlers.hasOwnProperty(opt)&&optionHandlers[opt](this,options[opt],Init);maybeUpdateLineNumberWidth(this),options.finishInit&&options.finishInit(this);for(var i=0;i150)){if(!aggressive)return;how="prev"}}else indentation=0,how="not";"prev"==how?indentation=n>doc.first?countColumn(getLine(doc,n-1).text,null,tabSize):0:"add"==how?indentation=curSpace+cm.options.indentUnit:"subtract"==how?indentation=curSpace-cm.options.indentUnit:"number"==typeof how&&(indentation=curSpace+how),indentation=Math.max(0,indentation);var indentString="",pos=0;if(cm.options.indentWithTabs)for(var i=Math.floor(indentation/tabSize);i;--i)pos+=tabSize,indentString+="\t";if(posrecent,textLines=splitLinesAuto(inserted),multiPaste=null;if(paste&&sel.ranges.length>1)if(lastCopied&&lastCopied.text.join("\n")==inserted){if(sel.ranges.length%lastCopied.text.length==0){multiPaste=[];for(var i=0;i=0;i$1--){var range=sel.ranges[i$1],from=range.from(),to=range.to();range.empty()&&(deleted&&deleted>0?from=Pos(from.line,from.ch-deleted):cm.state.overwrite&&!paste?to=Pos(to.line,Math.min(getLine(doc,to.line).text.length,to.ch+lst(textLines).length)):paste&&lastCopied&&lastCopied.lineWise&&lastCopied.text.join("\n")==textLines.join("\n")&&(from=to=Pos(from.line,0)));var changeEvent={from:from,to:to,text:multiPaste?multiPaste[i$1%multiPaste.length]:textLines,origin:origin||(paste?"paste":cm.state.cutIncoming>recent?"cut":"+input")};makeChange(cm.doc,changeEvent),signalLater(cm,"inputRead",cm,changeEvent)}inserted&&!paste&&triggerElectric(cm,inserted),ensureCursorVisible(cm),cm.curOp.updateInput<2&&(cm.curOp.updateInput=updateInput),cm.curOp.typing=!0,cm.state.pasteIncoming=cm.state.cutIncoming=-1}function handlePaste(e,cm){var pasted=e.clipboardData&&e.clipboardData.getData("Text");if(pasted)return e.preventDefault(),cm.isReadOnly()||cm.options.disableInput||!cm.hasFocus()||runInOp(cm,(function(){return applyTextInput(cm,pasted,0,null,"paste")})),!0}function triggerElectric(cm,inserted){if(cm.options.electricChars&&cm.options.smartIndent)for(var sel=cm.doc.sel,i=sel.ranges.length-1;i>=0;i--){var range=sel.ranges[i];if(!(range.head.ch>100||i&&sel.ranges[i-1].head.line==range.head.line)){var mode=cm.getModeAt(range.head),indented=!1;if(mode.electricChars){for(var j=0;j-1){indented=indentLine(cm,range.head.line,"smart");break}}else mode.electricInput&&mode.electricInput.test(getLine(cm.doc,range.head.line).text.slice(0,range.head.ch))&&(indented=indentLine(cm,range.head.line,"smart"));indented&&signalLater(cm,"electricInput",cm,range.head.line)}}}function copyableRanges(cm){for(var text=[],ranges=[],i=0;i0?0:-1));if(isNaN(ch))next=null;else{var astral=dir>0?ch>=55296&&ch<56320:ch>=56320&&ch<57343;next=new Pos(pos.line,Math.max(0,Math.min(lineObj.text.length,pos.ch+dir*(astral?2:1))),-dir)}}else next=visually?function(cm,line,start,dir){var bidi=getOrder(line,cm.doc.direction);if(!bidi)return moveLogically(line,start,dir);start.ch>=line.text.length?(start.ch=line.text.length,start.sticky="before"):start.ch<=0&&(start.ch=0,start.sticky="after");var partPos=getBidiPartAt(bidi,start.ch,start.sticky),part=bidi[partPos];if("ltr"==cm.doc.direction&&part.level%2==0&&(dir>0?part.to>start.ch:part.from=part.from&&ch>=wrappedLineExtent.begin)){var sticky=moveInStorageOrder?"before":"after";return new Pos(start.line,ch,sticky)}}var searchInVisualLine=function(partPos,dir,wrappedLineExtent){for(var getRes=function(ch,moveInStorageOrder){return moveInStorageOrder?new Pos(start.line,mv(ch,1),"before"):new Pos(start.line,ch,"after")};partPos>=0&&partPos0==(1!=part.level),ch=moveInStorageOrder?wrappedLineExtent.begin:mv(wrappedLineExtent.end,-1);if(part.from<=ch&&ch0?wrappedLineExtent.end:mv(wrappedLineExtent.begin,-1);return null==nextCh||dir>0&&nextCh==line.text.length||!(res=searchInVisualLine(dir>0?0:bidi.length-1,dir,getWrappedLineExtent(nextCh)))?null:res}(doc.cm,lineObj,pos,dir):moveLogically(lineObj,pos,dir);if(null==next){if(boundToLine||(l=pos.line+lineDir)=doc.first+doc.size||(pos=new Pos(l,pos.ch,pos.sticky),!(lineObj=getLine(doc,l))))return!1;pos=endOfLine(visually,doc.cm,lineObj,pos.line,lineDir)}else pos=next;return!0}if("char"==unit||"codepoint"==unit)moveOnce();else if("column"==unit)moveOnce(!0);else if("word"==unit||"group"==unit)for(var sawType=null,group="group"==unit,helper=doc.cm&&doc.cm.getHelper(pos,"wordChars"),first=!0;!(dir<0)||moveOnce(!first);first=!1){var cur=lineObj.text.charAt(pos.ch)||"\n",type=isWordChar(cur,helper)?"w":group&&"\n"==cur?"n":!group||/\s/.test(cur)?null:"p";if(!group||first||type||(type="s"),sawType&&sawType!=type){dir<0&&(dir=1,moveOnce(),pos.sticky="after");break}if(type&&(sawType=type),dir>0&&!moveOnce(!first))break}var result=skipAtomic(doc,pos,oldPos,origDir,!0);return equalCursorPos(oldPos,result)&&(result.hitSide=!0),result}function findPosV(cm,pos,dir,unit){var y,target,doc=cm.doc,x=pos.left;if("page"==unit){var pageSize=Math.min(cm.display.wrapper.clientHeight,win(cm).innerHeight||doc(cm).documentElement.clientHeight),moveAmount=Math.max(pageSize-.5*textHeight(cm.display),3);y=(dir>0?pos.bottom:pos.top)+dir*moveAmount}else"line"==unit&&(y=dir>0?pos.bottom+3:pos.top-3);for(;(target=coordsChar(cm,x,y)).outside;){if(dir<0?y<=0:y>=doc.height){target.hitSide=!0;break}y+=5*dir}return target}var ContentEditableInput=function(cm){this.cm=cm,this.lastAnchorNode=this.lastAnchorOffset=this.lastFocusNode=this.lastFocusOffset=null,this.polling=new Delayed,this.composing=null,this.gracePeriod=!1,this.readDOMTimeout=null};function posToDOM(cm,pos){var view=findViewForLine(cm,pos.line);if(!view||view.hidden)return null;var line=getLine(cm.doc,pos.line),info=mapFromLineView(view,line,pos.line),order=getOrder(line,cm.doc.direction),side="left";order&&(side=getBidiPartAt(order,pos.ch)%2?"right":"left");var result=nodeAndOffsetInLineMap(info.map,pos.ch,side);return result.offset="right"==result.collapse?result.end:result.start,result}function badPos(pos,bad){return bad&&(pos.bad=!0),pos}function domToPos(cm,node,offset){var lineNode;if(node==cm.display.lineDiv){if(!(lineNode=cm.display.lineDiv.childNodes[offset]))return badPos(cm.clipPos(Pos(cm.display.viewTo-1)),!0);node=null,offset=0}else for(lineNode=node;;lineNode=lineNode.parentNode){if(!lineNode||lineNode==cm.display.lineDiv)return null;if(lineNode.parentNode&&lineNode.parentNode==cm.display.lineDiv)break}for(var i=0;i=cm.display.viewTo||to.line=cm.display.viewFrom&&posToDOM(cm,from)||{node:view[0].measure.map[2],offset:0},end=to.linecm.firstLine()&&(from=Pos(from.line-1,getLine(cm.doc,from.line-1).length)),to.ch==getLine(cm.doc,to.line).text.length&&to.linedisplay.viewTo-1)return!1;from.line==display.viewFrom||0==(fromIndex=findViewIndex(cm,from.line))?(fromLine=lineNo(display.view[0].line),fromNode=display.view[0].node):(fromLine=lineNo(display.view[fromIndex].line),fromNode=display.view[fromIndex-1].node.nextSibling);var toLine,toNode,toIndex=findViewIndex(cm,to.line);if(toIndex==display.view.length-1?(toLine=display.viewTo-1,toNode=display.lineDiv.lastChild):(toLine=lineNo(display.view[toIndex+1].line)-1,toNode=display.view[toIndex+1].node.previousSibling),!fromNode)return!1;for(var newText=cm.doc.splitLines(function(cm,from,to,fromLine,toLine){var text="",closing=!1,lineSep=cm.doc.lineSeparator(),extraLinebreak=!1;function recognizeMarker(id){return function(marker){return marker.id==id}}function close(){closing&&(text+=lineSep,extraLinebreak&&(text+=lineSep),closing=extraLinebreak=!1)}function addText(str){str&&(close(),text+=str)}function walk(node){if(1==node.nodeType){var cmText=node.getAttribute("cm-text");if(cmText)return void addText(cmText);var range,markerID=node.getAttribute("cm-marker");if(markerID){var found=cm.findMarks(Pos(fromLine,0),Pos(toLine+1,0),recognizeMarker(+markerID));return void(found.length&&(range=found[0].find(0))&&addText(getBetween(cm.doc,range.from,range.to).join(lineSep)))}if("false"==node.getAttribute("contenteditable"))return;var isBlock=/^(pre|div|p|li|table|br)$/i.test(node.nodeName);if(!/^br$/i.test(node.nodeName)&&0==node.textContent.length)return;isBlock&&close();for(var i=0;i1&&oldText.length>1;)if(lst(newText)==lst(oldText))newText.pop(),oldText.pop(),toLine--;else{if(newText[0]!=oldText[0])break;newText.shift(),oldText.shift(),fromLine++}for(var cutFront=0,cutEnd=0,newTop=newText[0],oldTop=oldText[0],maxCutFront=Math.min(newTop.length,oldTop.length);cutFrontfrom.ch&&newBot.charCodeAt(newBot.length-cutEnd-1)==oldBot.charCodeAt(oldBot.length-cutEnd-1);)cutFront--,cutEnd++;newText[newText.length-1]=newBot.slice(0,newBot.length-cutEnd).replace(/^\u200b+/,""),newText[0]=newText[0].slice(cutFront).replace(/\u200b+$/,"");var chFrom=Pos(fromLine,cutFront),chTo=Pos(toLine,oldText.length?lst(oldText).length-cutEnd:0);return newText.length>1||newText[0]||cmp(chFrom,chTo)?(replaceRange(cm.doc,newText,chFrom,chTo,"+input"),!0):void 0},ContentEditableInput.prototype.ensurePolled=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.reset=function(){this.forceCompositionEnd()},ContentEditableInput.prototype.forceCompositionEnd=function(){this.composing&&(clearTimeout(this.readDOMTimeout),this.composing=null,this.updateFromDOM(),this.div.blur(),this.div.focus())},ContentEditableInput.prototype.readFromDOMSoon=function(){var this$1$1=this;null==this.readDOMTimeout&&(this.readDOMTimeout=setTimeout((function(){if(this$1$1.readDOMTimeout=null,this$1$1.composing){if(!this$1$1.composing.done)return;this$1$1.composing=null}this$1$1.updateFromDOM()}),80))},ContentEditableInput.prototype.updateFromDOM=function(){var this$1$1=this;!this.cm.isReadOnly()&&this.pollContent()||runInOp(this.cm,(function(){return regChange(this$1$1.cm)}))},ContentEditableInput.prototype.setUneditable=function(node){node.contentEditable="false"},ContentEditableInput.prototype.onKeyPress=function(e){0==e.charCode||this.composing||(e.preventDefault(),this.cm.isReadOnly()||operation(this.cm,applyTextInput)(this.cm,String.fromCharCode(null==e.charCode?e.keyCode:e.charCode),0))},ContentEditableInput.prototype.readOnlyChanged=function(val){this.div.contentEditable=String("nocursor"!=val)},ContentEditableInput.prototype.onContextMenu=function(){},ContentEditableInput.prototype.resetPosition=function(){},ContentEditableInput.prototype.needsContentAttribute=!0;var TextareaInput=function(cm){this.cm=cm,this.prevInput="",this.pollingFast=!1,this.polling=new Delayed,this.hasSelection=!1,this.composing=null,this.resetting=!1};TextareaInput.prototype.init=function(display){var this$1$1=this,input=this,cm=this.cm;this.createField(display);var te=this.textarea;function prepareCopyCut(e){if(!signalDOMEvent(cm,e)){if(cm.somethingSelected())setLastCopied({lineWise:!1,text:cm.getSelections()});else{if(!cm.options.lineWiseCopyCut)return;var ranges=copyableRanges(cm);setLastCopied({lineWise:!0,text:ranges.text}),"cut"==e.type?cm.setSelections(ranges.ranges,null,sel_dontScroll):(input.prevInput="",te.value=ranges.text.join("\n"),selectInput(te))}"cut"==e.type&&(cm.state.cutIncoming=+new Date)}}display.wrapper.insertBefore(this.wrapper,display.wrapper.firstChild),ios&&(te.style.width="0px"),on(te,"input",(function(){ie&&ie_version>=9&&this$1$1.hasSelection&&(this$1$1.hasSelection=null),input.poll()})),on(te,"paste",(function(e){signalDOMEvent(cm,e)||handlePaste(e,cm)||(cm.state.pasteIncoming=+new Date,input.fastPoll())})),on(te,"cut",prepareCopyCut),on(te,"copy",prepareCopyCut),on(display.scroller,"paste",(function(e){if(!eventInWidget(display,e)&&!signalDOMEvent(cm,e)){if(!te.dispatchEvent)return cm.state.pasteIncoming=+new Date,void input.focus();var event=new Event("paste");event.clipboardData=e.clipboardData,te.dispatchEvent(event)}})),on(display.lineSpace,"selectstart",(function(e){eventInWidget(display,e)||e_preventDefault(e)})),on(te,"compositionstart",(function(){var start=cm.getCursor("from");input.composing&&input.composing.range.clear(),input.composing={start:start,range:cm.markText(start,cm.getCursor("to"),{className:"CodeMirror-composing"})}})),on(te,"compositionend",(function(){input.composing&&(input.poll(),input.composing.range.clear(),input.composing=null)}))},TextareaInput.prototype.createField=function(_display){this.wrapper=hiddenTextarea(),this.textarea=this.wrapper.firstChild;var opts=this.cm.options;disableBrowserMagic(this.textarea,opts.spellcheck,opts.autocorrect,opts.autocapitalize)},TextareaInput.prototype.screenReaderLabelChanged=function(label){label?this.textarea.setAttribute("aria-label",label):this.textarea.removeAttribute("aria-label")},TextareaInput.prototype.prepareSelection=function(){var cm=this.cm,display=cm.display,doc=cm.doc,result=prepareSelection(cm);if(cm.options.moveInputWithCursor){var headPos=cursorCoords(cm,doc.sel.primary().head,"div"),wrapOff=display.wrapper.getBoundingClientRect(),lineOff=display.lineDiv.getBoundingClientRect();result.teTop=Math.max(0,Math.min(display.wrapper.clientHeight-10,headPos.top+lineOff.top-wrapOff.top)),result.teLeft=Math.max(0,Math.min(display.wrapper.clientWidth-10,headPos.left+lineOff.left-wrapOff.left))}return result},TextareaInput.prototype.showSelection=function(drawn){var display=this.cm.display;removeChildrenAndAdd(display.cursorDiv,drawn.cursors),removeChildrenAndAdd(display.selectionDiv,drawn.selection),null!=drawn.teTop&&(this.wrapper.style.top=drawn.teTop+"px",this.wrapper.style.left=drawn.teLeft+"px")},TextareaInput.prototype.reset=function(typing){if(!(this.contextMenuPending||this.composing&&typing)){var cm=this.cm;if(this.resetting=!0,cm.somethingSelected()){this.prevInput="";var content=cm.getSelection();this.textarea.value=content,cm.state.focused&&selectInput(this.textarea),ie&&ie_version>=9&&(this.hasSelection=content)}else typing||(this.prevInput=this.textarea.value="",ie&&ie_version>=9&&(this.hasSelection=null));this.resetting=!1}},TextareaInput.prototype.getField=function(){return this.textarea},TextareaInput.prototype.supportsTouch=function(){return!1},TextareaInput.prototype.focus=function(){if("nocursor"!=this.cm.options.readOnly&&(!mobile||activeElt(rootNode(this.textarea))!=this.textarea))try{this.textarea.focus()}catch(e){}},TextareaInput.prototype.blur=function(){this.textarea.blur()},TextareaInput.prototype.resetPosition=function(){this.wrapper.style.top=this.wrapper.style.left=0},TextareaInput.prototype.receivedFocus=function(){this.slowPoll()},TextareaInput.prototype.slowPoll=function(){var this$1$1=this;this.pollingFast||this.polling.set(this.cm.options.pollInterval,(function(){this$1$1.poll(),this$1$1.cm.state.focused&&this$1$1.slowPoll()}))},TextareaInput.prototype.fastPoll=function(){var missed=!1,input=this;input.pollingFast=!0,input.polling.set(20,(function p(){input.poll()||missed?(input.pollingFast=!1,input.slowPoll()):(missed=!0,input.polling.set(60,p))}))},TextareaInput.prototype.poll=function(){var this$1$1=this,cm=this.cm,input=this.textarea,prevInput=this.prevInput;if(this.contextMenuPending||this.resetting||!cm.state.focused||hasSelection(input)&&!prevInput&&!this.composing||cm.isReadOnly()||cm.options.disableInput||cm.state.keySeq)return!1;var text=input.value;if(text==prevInput&&!cm.somethingSelected())return!1;if(ie&&ie_version>=9&&this.hasSelection===text||mac&&/[\uf700-\uf7ff]/.test(text))return cm.display.input.reset(),!1;if(cm.doc.sel==cm.display.selForContextMenu){var first=text.charCodeAt(0);if(8203!=first||prevInput||(prevInput="​"),8666==first)return this.reset(),this.cm.execCommand("undo")}for(var same=0,l=Math.min(prevInput.length,text.length);same1e3||text.indexOf("\n")>-1?input.value=this$1$1.prevInput="":this$1$1.prevInput=text,this$1$1.composing&&(this$1$1.composing.range.clear(),this$1$1.composing.range=cm.markText(this$1$1.composing.start,cm.getCursor("to"),{className:"CodeMirror-composing"}))})),!0},TextareaInput.prototype.ensurePolled=function(){this.pollingFast&&this.poll()&&(this.pollingFast=!1)},TextareaInput.prototype.onKeyPress=function(){ie&&ie_version>=9&&(this.hasSelection=null),this.fastPoll()},TextareaInput.prototype.onContextMenu=function(e){var input=this,cm=input.cm,display=cm.display,te=input.textarea;input.contextMenuPending&&input.contextMenuPending();var pos=posFromMouse(cm,e),scrollPos=display.scroller.scrollTop;if(pos&&!presto){cm.options.resetSelectionOnContextMenu&&-1==cm.doc.sel.contains(pos)&&operation(cm,setSelection)(cm.doc,simpleSelection(pos),sel_dontScroll);var oldScrollY,oldCSS=te.style.cssText,oldWrapperCSS=input.wrapper.style.cssText,wrapperBox=input.wrapper.offsetParent.getBoundingClientRect();if(input.wrapper.style.cssText="position: static",te.style.cssText="position: absolute; width: 30px; height: 30px;\n top: "+(e.clientY-wrapperBox.top-5)+"px; left: "+(e.clientX-wrapperBox.left-5)+"px;\n z-index: 1000; background: "+(ie?"rgba(255, 255, 255, .05)":"transparent")+";\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);",webkit&&(oldScrollY=te.ownerDocument.defaultView.scrollY),display.input.focus(),webkit&&te.ownerDocument.defaultView.scrollTo(null,oldScrollY),display.input.reset(),cm.somethingSelected()||(te.value=input.prevInput=" "),input.contextMenuPending=rehide,display.selForContextMenu=cm.doc.sel,clearTimeout(display.detectingSelectAll),ie&&ie_version>=9&&prepareSelectAllHack(),captureRightClick){e_stop(e);var mouseup=function(){off(window,"mouseup",mouseup),setTimeout(rehide,20)};on(window,"mouseup",mouseup)}else setTimeout(rehide,50)}function prepareSelectAllHack(){if(null!=te.selectionStart){var selected=cm.somethingSelected(),extval="​"+(selected?te.value:"");te.value="⇚",te.value=extval,input.prevInput=selected?"":"​",te.selectionStart=1,te.selectionEnd=extval.length,display.selForContextMenu=cm.doc.sel}}function rehide(){if(input.contextMenuPending==rehide&&(input.contextMenuPending=!1,input.wrapper.style.cssText=oldWrapperCSS,te.style.cssText=oldCSS,ie&&ie_version<9&&display.scrollbars.setScrollTop(display.scroller.scrollTop=scrollPos),null!=te.selectionStart)){(!ie||ie&&ie_version<9)&&prepareSelectAllHack();var i=0,poll=function(){display.selForContextMenu==cm.doc.sel&&0==te.selectionStart&&te.selectionEnd>0&&"​"==input.prevInput?operation(cm,selectAll)(cm):i++<10?display.detectingSelectAll=setTimeout(poll,500):(display.selForContextMenu=null,display.input.reset())};display.detectingSelectAll=setTimeout(poll,200)}}},TextareaInput.prototype.readOnlyChanged=function(val){val||this.reset(),this.textarea.disabled="nocursor"==val,this.textarea.readOnly=!!val},TextareaInput.prototype.setUneditable=function(){},TextareaInput.prototype.needsContentAttribute=!1,function(CodeMirror){var optionHandlers=CodeMirror.optionHandlers;function option(name,deflt,handle,notOnInit){CodeMirror.defaults[name]=deflt,handle&&(optionHandlers[name]=notOnInit?function(cm,val,old){old!=Init&&handle(cm,val,old)}:handle)}CodeMirror.defineOption=option,CodeMirror.Init=Init,option("value","",(function(cm,val){return cm.setValue(val)}),!0),option("mode",null,(function(cm,val){cm.doc.modeOption=val,loadMode(cm)}),!0),option("indentUnit",2,loadMode,!0),option("indentWithTabs",!1),option("smartIndent",!0),option("tabSize",4,(function(cm){resetModeState(cm),clearCaches(cm),regChange(cm)}),!0),option("lineSeparator",null,(function(cm,val){if(cm.doc.lineSep=val,val){var newBreaks=[],lineNo=cm.doc.first;cm.doc.iter((function(line){for(var pos=0;;){var found=line.text.indexOf(val,pos);if(-1==found)break;pos=found+val.length,newBreaks.push(Pos(lineNo,found))}lineNo++}));for(var i=newBreaks.length-1;i>=0;i--)replaceRange(cm.doc,val,newBreaks[i],Pos(newBreaks[i].line,newBreaks[i].ch+val.length))}})),option("specialChars",/[\u0000-\u001f\u007f-\u009f\u00ad\u061c\u200b\u200e\u200f\u2028\u2029\u202d\u202e\u2066\u2067\u2069\ufeff\ufff9-\ufffc]/g,(function(cm,val,old){cm.state.specialChars=new RegExp(val.source+(val.test("\t")?"":"|\t"),"g"),old!=Init&&cm.refresh()})),option("specialCharPlaceholder",defaultSpecialCharPlaceholder,(function(cm){return cm.refresh()}),!0),option("electricChars",!0),option("inputStyle",mobile?"contenteditable":"textarea",(function(){throw new Error("inputStyle can not (yet) be changed in a running editor")}),!0),option("spellcheck",!1,(function(cm,val){return cm.getInputField().spellcheck=val}),!0),option("autocorrect",!1,(function(cm,val){return cm.getInputField().autocorrect=val}),!0),option("autocapitalize",!1,(function(cm,val){return cm.getInputField().autocapitalize=val}),!0),option("rtlMoveVisually",!windows),option("wholeLineUpdateBefore",!0),option("theme","default",(function(cm){themeChanged(cm),updateGutters(cm)}),!0),option("keyMap","default",(function(cm,val,old){var next=getKeyMap(val),prev=old!=Init&&getKeyMap(old);prev&&prev.detach&&prev.detach(cm,next),next.attach&&next.attach(cm,prev||null)})),option("extraKeys",null),option("configureMouse",null),option("lineWrapping",!1,wrappingChanged,!0),option("gutters",[],(function(cm,val){cm.display.gutterSpecs=getGutters(val,cm.options.lineNumbers),updateGutters(cm)}),!0),option("fixedGutter",!0,(function(cm,val){cm.display.gutters.style.left=val?compensateForHScroll(cm.display)+"px":"0",cm.refresh()}),!0),option("coverGutterNextToScrollbar",!1,(function(cm){return updateScrollbars(cm)}),!0),option("scrollbarStyle","native",(function(cm){initScrollbars(cm),updateScrollbars(cm),cm.display.scrollbars.setScrollTop(cm.doc.scrollTop),cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft)}),!0),option("lineNumbers",!1,(function(cm,val){cm.display.gutterSpecs=getGutters(cm.options.gutters,val),updateGutters(cm)}),!0),option("firstLineNumber",1,updateGutters,!0),option("lineNumberFormatter",(function(integer){return integer}),updateGutters,!0),option("showCursorWhenSelecting",!1,updateSelection,!0),option("resetSelectionOnContextMenu",!0),option("lineWiseCopyCut",!0),option("pasteLinesPerSelection",!0),option("selectionsMayTouch",!1),option("readOnly",!1,(function(cm,val){"nocursor"==val&&(onBlur(cm),cm.display.input.blur()),cm.display.input.readOnlyChanged(val)})),option("screenReaderLabel",null,(function(cm,val){val=""===val?null:val,cm.display.input.screenReaderLabelChanged(val)})),option("disableInput",!1,(function(cm,val){val||cm.display.input.reset()}),!0),option("dragDrop",!0,dragDropChanged),option("allowDropFileTypes",null),option("cursorBlinkRate",530),option("cursorScrollMargin",0),option("cursorHeight",1,updateSelection,!0),option("singleCursorHeightPerLine",!0,updateSelection,!0),option("workTime",100),option("workDelay",100),option("flattenSpans",!0,resetModeState,!0),option("addModeClass",!1,resetModeState,!0),option("pollInterval",100),option("undoDepth",200,(function(cm,val){return cm.doc.history.undoDepth=val})),option("historyEventDelay",1250),option("viewportMargin",10,(function(cm){return cm.refresh()}),!0),option("maxHighlightLength",1e4,resetModeState,!0),option("moveInputWithCursor",!0,(function(cm,val){val||cm.display.input.resetPosition()})),option("tabindex",null,(function(cm,val){return cm.display.input.getField().tabIndex=val||""})),option("autofocus",null),option("direction","ltr",(function(cm,val){return cm.doc.setDirection(val)}),!0),option("phrases",null)}(CodeMirror),function(CodeMirror){var optionHandlers=CodeMirror.optionHandlers,helpers=CodeMirror.helpers={};CodeMirror.prototype={constructor:CodeMirror,focus:function(){win(this).focus(),this.display.input.focus()},setOption:function(option,value){var options=this.options,old=options[option];options[option]==value&&"mode"!=option||(options[option]=value,optionHandlers.hasOwnProperty(option)&&operation(this,optionHandlers[option])(this,value,old),signal(this,"optionChange",this,option))},getOption:function(option){return this.options[option]},getDoc:function(){return this.doc},addKeyMap:function(map,bottom){this.state.keyMaps[bottom?"push":"unshift"](getKeyMap(map))},removeKeyMap:function(map){for(var maps=this.state.keyMaps,i=0;iend&&(indentLine(this,range.head.line,how,!0),end=range.head.line,i==this.doc.sel.primIndex&&ensureCursorVisible(this));else{var from=range.from(),to=range.to(),start=Math.max(end,from.line);end=Math.min(this.lastLine(),to.line-(to.ch?0:1))+1;for(var j=start;j0&&replaceOneSelection(this.doc,i,new Range(from,newRanges[i].to()),sel_dontScroll)}}})),getTokenAt:function(pos,precise){return takeToken(this,pos,precise)},getLineTokens:function(line,precise){return takeToken(this,Pos(line),precise,!0)},getTokenTypeAt:function(pos){pos=clipPos(this.doc,pos);var type,styles=getLineStyles(this,getLine(this.doc,pos.line)),before=0,after=(styles.length-1)/2,ch=pos.ch;if(0==ch)type=styles[2];else for(;;){var mid=before+after>>1;if((mid?styles[2*mid-1]:0)>=ch)after=mid;else{if(!(styles[2*mid+1]last&&(line=last,end=!0),lineObj=getLine(this.doc,line)}else lineObj=line;return intoCoordSystem(this,lineObj,{top:0,left:0},mode||"page",includeWidgets||end).top+(end?this.doc.height-heightAtLine(lineObj):0)},defaultTextHeight:function(){return textHeight(this.display)},defaultCharWidth:function(){return charWidth(this.display)},getViewport:function(){return{from:this.display.viewFrom,to:this.display.viewTo}},addWidget:function(pos,node,scroll,vert,horiz){var cm,rect,scrollPos,display=this.display,top=(pos=cursorCoords(this,clipPos(this.doc,pos))).bottom,left=pos.left;if(node.style.position="absolute",node.setAttribute("cm-ignore-events","true"),this.display.input.setUneditable(node),display.sizer.appendChild(node),"over"==vert)top=pos.top;else if("above"==vert||"near"==vert){var vspace=Math.max(display.wrapper.clientHeight,this.doc.height),hspace=Math.max(display.sizer.clientWidth,display.lineSpace.clientWidth);("above"==vert||pos.bottom+node.offsetHeight>vspace)&&pos.top>node.offsetHeight?top=pos.top-node.offsetHeight:pos.bottom+node.offsetHeight<=vspace&&(top=pos.bottom),left+node.offsetWidth>hspace&&(left=hspace-node.offsetWidth)}node.style.top=top+"px",node.style.left=node.style.right="","right"==horiz?(left=display.sizer.clientWidth-node.offsetWidth,node.style.right="0px"):("left"==horiz?left=0:"middle"==horiz&&(left=(display.sizer.clientWidth-node.offsetWidth)/2),node.style.left=left+"px"),scroll&&(cm=this,rect={left:left,top:top,right:left+node.offsetWidth,bottom:top+node.offsetHeight},null!=(scrollPos=calculateScrollPos(cm,rect)).scrollTop&&updateScrollTop(cm,scrollPos.scrollTop),null!=scrollPos.scrollLeft&&setScrollLeft(cm,scrollPos.scrollLeft))},triggerOnKeyDown:methodOp(onKeyDown),triggerOnKeyPress:methodOp(onKeyPress),triggerOnKeyUp:onKeyUp,triggerOnMouseDown:methodOp(onMouseDown),execCommand:function(cmd){if(commands.hasOwnProperty(cmd))return commands[cmd].call(null,this)},triggerElectric:methodOp((function(text){triggerElectric(this,text)})),findPosH:function(from,amount,unit,visually){var dir=1;amount<0&&(dir=-1,amount=-amount);for(var cur=clipPos(this.doc,from),i=0;i0&&check(line.charAt(start-1));)--start;for(;end.5||this.options.lineWrapping)&&estimateLineHeights(this),signal(this,"refresh",this)})),swapDoc:methodOp((function(doc){var old=this.doc;return old.cm=null,this.state.selectingText&&this.state.selectingText(),attachDoc(this,doc),clearCaches(this),this.display.input.reset(),scrollToCoords(this,doc.scrollLeft,doc.scrollTop),this.curOp.forceScroll=!0,signalLater(this,"swapDoc",this,old),old})),phrase:function(phraseText){var phrases=this.options.phrases;return phrases&&Object.prototype.hasOwnProperty.call(phrases,phraseText)?phrases[phraseText]:phraseText},getInputField:function(){return this.display.input.getField()},getWrapperElement:function(){return this.display.wrapper},getScrollerElement:function(){return this.display.scroller},getGutterElement:function(){return this.display.gutters}},eventMixin(CodeMirror),CodeMirror.registerHelper=function(type,name,value){helpers.hasOwnProperty(type)||(helpers[type]=CodeMirror[type]={_global:[]}),helpers[type][name]=value},CodeMirror.registerGlobalHelper=function(type,name,predicate,value){CodeMirror.registerHelper(type,name,value),helpers[type]._global.push({pred:predicate,val:value})}}(CodeMirror);var dontDelegate="iter insert remove copy getEditor constructor".split(" ");for(var prop in Doc.prototype)Doc.prototype.hasOwnProperty(prop)&&indexOf(dontDelegate,prop)<0&&(CodeMirror.prototype[prop]=function(method){return function(){return method.apply(this.doc,arguments)}}(Doc.prototype[prop]));return eventMixin(Doc),CodeMirror.inputStyles={textarea:TextareaInput,contenteditable:ContentEditableInput},CodeMirror.defineMode=function(name){CodeMirror.defaults.mode||"null"==name||(CodeMirror.defaults.mode=name),defineMode.apply(this,arguments)},CodeMirror.defineMIME=function(mime,spec){mimeModes[mime]=spec},CodeMirror.defineMode("null",(function(){return{token:function(stream){return stream.skipToEnd()}}})),CodeMirror.defineMIME("text/plain","null"),CodeMirror.defineExtension=function(name,func){CodeMirror.prototype[name]=func},CodeMirror.defineDocExtension=function(name,func){Doc.prototype[name]=func},CodeMirror.fromTextArea=function(textarea,options){if((options=options?copyObj(options):{}).value=textarea.value,!options.tabindex&&textarea.tabIndex&&(options.tabindex=textarea.tabIndex),!options.placeholder&&textarea.placeholder&&(options.placeholder=textarea.placeholder),null==options.autofocus){var hasFocus=activeElt(rootNode(textarea));options.autofocus=hasFocus==textarea||null!=textarea.getAttribute("autofocus")&&hasFocus==document.body}function save(){textarea.value=cm.getValue()}var realSubmit;if(textarea.form&&(on(textarea.form,"submit",save),!options.leaveSubmitMethodAlone)){var form=textarea.form;realSubmit=form.submit;try{var wrappedSubmit=form.submit=function(){save(),form.submit=realSubmit,form.submit(),form.submit=wrappedSubmit}}catch(e){}}options.finishInit=function(cm){cm.save=save,cm.getTextArea=function(){return textarea},cm.toTextArea=function(){cm.toTextArea=isNaN,save(),textarea.parentNode.removeChild(cm.getWrapperElement()),textarea.style.display="",textarea.form&&(off(textarea.form,"submit",save),options.leaveSubmitMethodAlone||"function"!=typeof textarea.form.submit||(textarea.form.submit=realSubmit))}},textarea.style.display="none";var cm=CodeMirror((function(node){return textarea.parentNode.insertBefore(node,textarea.nextSibling)}),options);return cm},function(CodeMirror){CodeMirror.off=off,CodeMirror.on=on,CodeMirror.wheelEventPixels=wheelEventPixels,CodeMirror.Doc=Doc,CodeMirror.splitLines=splitLinesAuto,CodeMirror.countColumn=countColumn,CodeMirror.findColumn=findColumn,CodeMirror.isWordChar=isWordCharBasic,CodeMirror.Pass=Pass,CodeMirror.signal=signal,CodeMirror.Line=Line,CodeMirror.changeEnd=changeEnd,CodeMirror.scrollbarModel=scrollbarModel,CodeMirror.Pos=Pos,CodeMirror.cmpPos=cmp,CodeMirror.modes=modes,CodeMirror.mimeModes=mimeModes,CodeMirror.resolveMode=resolveMode,CodeMirror.getMode=getMode,CodeMirror.modeExtensions=modeExtensions,CodeMirror.extendMode=extendMode,CodeMirror.copyState=copyState,CodeMirror.startState=startState,CodeMirror.innerMode=innerMode,CodeMirror.commands=commands,CodeMirror.keyMap=keyMap,CodeMirror.keyName=keyName,CodeMirror.isModifierKey=isModifierKey,CodeMirror.lookupKey=lookupKey,CodeMirror.normalizeKeyMap=normalizeKeyMap,CodeMirror.StringStream=StringStream,CodeMirror.SharedTextMarker=SharedTextMarker,CodeMirror.TextMarker=TextMarker,CodeMirror.LineWidget=LineWidget,CodeMirror.e_preventDefault=e_preventDefault,CodeMirror.e_stopPropagation=e_stopPropagation,CodeMirror.e_stop=e_stop,CodeMirror.addClass=addClass,CodeMirror.contains=contains,CodeMirror.rmClass=rmClass,CodeMirror.keyNames=keyNames}(CodeMirror),CodeMirror.version="5.65.16",CodeMirror},"object"==typeof exports&&"undefined"!=typeof module?module.exports=factory():"function"==typeof define&&define.amd?define("block_configurable_reports/codemirror",factory):(global=global||self).CodeMirror=factory(); //# sourceMappingURL=codemirror.min.js.map \ No newline at end of file diff --git a/amd/build/codemirror.min.js.map b/amd/build/codemirror.min.js.map index ee1de95f..97a57104 100644 --- a/amd/build/codemirror.min.js.map +++ b/amd/build/codemirror.min.js.map @@ -1 +1 @@ -{"version":3,"file":"codemirror.min.js","sources":["../src/codemirror.js"],"sourcesContent":["/*eslint-disable*/\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/LICENSE\n\n// This is CodeMirror (https://codemirror.net), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function(global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global.CodeMirror = factory());\n}(this, (function() {\n 'use strict';\n\n // Kludges for bugs and behavior differences that can't be feature\n // detected are enabled based on userAgent etc sniffing.\n var userAgent = navigator.userAgent;\n var platform = navigator.platform;\n\n var gecko = /gecko\\/\\d/i.test(userAgent);\n var ie_upto10 = /MSIE \\d/.test(userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n var edge = /Edge\\/(\\d+)/.exec(userAgent);\n var ie = ie_upto10 || ie_11up || edge;\n var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);\n var webkit = !edge && /WebKit\\//.test(userAgent);\n var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n var chrome = !edge && /Chrome\\//.test(userAgent);\n var presto = /Opera\\//.test(userAgent);\n var safari = /Apple Computer/.test(navigator.vendor);\n var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n var phantom = /PhantomJS/.test(userAgent);\n\n var ios = !edge && /AppleWebKit/.test(userAgent) && /Mobile\\/\\w+/.test(userAgent);\n var android = /Android/.test(userAgent);\n // This is woefully incomplete. Suggestions for alternative methods welcome.\n var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n var mac = ios || /Mac/.test(platform);\n var chromeOS = /\\bCrOS\\b/.test(userAgent);\n var windows = /win/i.test(platform);\n\n var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n if (presto_version) {\n presto_version = Number(presto_version[1]);\n }\n if (presto_version && presto_version >= 15) {\n presto = false;\n webkit = true;\n }\n // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n var captureRightClick = gecko || (ie && ie_version >= 9);\n\n function classTest(cls) {\n return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\")\n }\n\n var rmClass = function(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n };\n\n function removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count) {\n e.removeChild(e.firstChild);\n }\n return e\n }\n\n function removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e)\n }\n\n function elt(tag, content, className, style) {\n var e = document.createElement(tag);\n if (className) {\n e.className = className;\n }\n if (style) {\n e.style.cssText = style;\n }\n if (typeof content == \"string\") {\n e.appendChild(document.createTextNode(content));\n } else if (content) {\n for (var i = 0; i < content.length; ++i) {\n e.appendChild(content[i]);\n }\n }\n return e\n }\n\n // wrapper for elt, which removes the elt from the accessibility tree\n function eltP(tag, content, className, style) {\n var e = elt(tag, content, className, style);\n e.setAttribute(\"role\", \"presentation\");\n return e\n }\n\n var range;\n if (document.createRange) {\n range = function(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r\n };\n } else {\n range = function(node, start, end) {\n var r = document.body.createTextRange();\n try {\n r.moveToElementText(node.parentNode);\n } catch (e) {\n return r\n }\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r\n };\n }\n\n function contains(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n {\n child = child.parentNode;\n }\n if (parent.contains) {\n return parent.contains(child)\n }\n do {\n if (child.nodeType == 11) {\n child = child.host;\n }\n if (child == parent) {\n return true\n }\n } while (child = child.parentNode)\n }\n\n function activeElt() {\n // IE and Edge may throw an \"Unspecified Error\" when accessing document.activeElement.\n // IE < 10 will throw when accessed while the page is loading or in an iframe.\n // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.\n var activeElement;\n try {\n activeElement = document.activeElement;\n } catch (e) {\n activeElement = document.body || null;\n }\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement) {\n activeElement = activeElement.shadowRoot.activeElement;\n }\n return activeElement\n }\n\n function addClass(node, cls) {\n var current = node.className;\n if (!classTest(cls).test(current)) {\n node.className += (current ? \" \" : \"\") + cls;\n }\n }\n\n function joinClasses(a, b) {\n var as = a.split(\" \");\n for (var i = 0; i < as.length; i++) {\n if (as[i] && !classTest(as[i]).test(b)) {\n b += \" \" + as[i];\n }\n }\n return b\n }\n\n var selectInput = function(node) {\n node.select();\n };\n if (ios) // Mobile Safari apparently has a bug where select() is broken.\n {\n selectInput = function(node) {\n node.selectionStart = 0;\n node.selectionEnd = node.value.length;\n };\n } else if (ie) // Suppress mysterious IE10 errors\n {\n selectInput = function(node) {\n try {\n node.select();\n } catch (_e) {\n }\n };\n }\n\n function bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function() {\n return f.apply(null, args)\n }\n }\n\n function copyObj(obj, target, overwrite) {\n if (!target) {\n target = {};\n }\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop))) {\n target[prop] = obj[prop];\n }\n }\n return target\n }\n\n // Counts the column offset in a string, taking tabs into account.\n // Used mostly to find indentation.\n function countColumn(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) {\n end = string.length;\n }\n }\n for (var i = startIndex || 0, n = startValue || 0; ;) {\n var nextTab = string.indexOf(\"\\t\", i);\n if (nextTab < 0 || nextTab >= end) {\n return n + (end - i)\n }\n n += nextTab - i;\n n += tabSize - (n % tabSize);\n i = nextTab + 1;\n }\n }\n\n var Delayed = function() {\n this.id = null;\n };\n Delayed.prototype.set = function(ms, f) {\n clearTimeout(this.id);\n this.id = setTimeout(f, ms);\n };\n\n function indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i) {\n if (array[i] == elt) {\n return i\n }\n }\n return -1\n }\n\n // Number of pixels added to scroller and sizer to hide scrollbar\n var scrollerGap = 30;\n\n // Returned or thrown by various protocols to signal 'I'm not\n // handling this'.\n var Pass = {\n toString: function() {\n return \"CodeMirror.Pass\"\n }\n };\n\n // Reused option objects for setSelection & friends\n var sel_dontScroll = {scroll: false}, sel_mouse = {origin: \"*mouse\"}, sel_move = {origin: \"+move\"};\n\n // The inverse of countColumn -- find the offset that corresponds to\n // a particular column.\n function findColumn(string, goal, tabSize) {\n for (var pos = 0, col = 0; ;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n if (nextTab == -1) {\n nextTab = string.length;\n }\n var skipped = nextTab - pos;\n if (nextTab == string.length || col + skipped >= goal) {\n return pos + Math.min(skipped, goal - col)\n }\n col += nextTab - pos;\n col += tabSize - (col % tabSize);\n pos = nextTab + 1;\n if (col >= goal) {\n return pos\n }\n }\n }\n\n var spaceStrs = [\"\"];\n\n function spaceStr(n) {\n while (spaceStrs.length <= n) {\n spaceStrs.push(lst(spaceStrs) + \" \");\n }\n return spaceStrs[n]\n }\n\n function lst(arr) {\n return arr[arr.length - 1]\n }\n\n function map(array, f) {\n var out = [];\n for (var i = 0; i < array.length; i++) {\n out[i] = f(array[i], i);\n }\n return out\n }\n\n function insertSorted(array, value, score) {\n var pos = 0, priority = score(value);\n while (pos < array.length && score(array[pos]) <= priority) {\n pos++;\n }\n array.splice(pos, 0, value);\n }\n\n function nothing() {\n }\n\n function createObj(base, props) {\n var inst;\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n if (props) {\n copyObj(props, inst);\n }\n return inst\n }\n\n var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n\n function isWordCharBasic(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" &&\n (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))\n }\n\n function isWordChar(ch, helper) {\n if (!helper) {\n return isWordCharBasic(ch)\n }\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) {\n return true\n }\n return helper.test(ch)\n }\n\n function isEmpty(obj) {\n for (var n in obj) {\n if (obj.hasOwnProperty(n) && obj[n]) {\n return false\n }\n }\n return true\n }\n\n // Extending unicode characters. A series of a non-extending char +\n // any number of extending chars is treated as a single unit as far\n // as editing and measuring is concerned. This is not fully correct,\n // since some scripts/fonts/browsers also treat other configurations\n // of code points as a group.\n 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]/;\n\n function isExtendingChar(ch) {\n return ch.charCodeAt(0) >= 768 && extendingChars.test(ch)\n }\n\n // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.\n function skipExtendingChars(str, pos, dir) {\n while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) {\n pos += dir;\n }\n return pos\n }\n\n // Returns the value from the range [`from`; `to`] that satisfies\n // `pred` and is closest to `from`. Assumes that at least `to`\n // satisfies `pred`. Supports `from` being greater than `to`.\n function findFirst(pred, from, to) {\n // At any point we are certain `to` satisfies `pred`, don't know\n // whether `from` does.\n var dir = from > to ? -1 : 1;\n for (; ;) {\n if (from == to) {\n return from\n }\n var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);\n if (mid == from) {\n return pred(mid) ? from : to\n }\n if (pred(mid)) {\n to = mid;\n } else {\n from = mid + dir;\n }\n }\n }\n\n // The display handles the DOM integration, both for input reading\n // and content drawing. It holds references to DOM nodes and\n // display-related state.\n\n function Display(place, doc, input) {\n var d = this;\n this.input = input;\n\n // Covers bottom-right square when both scrollbars are present.\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n // Will contain the actual code, positioned to cover the viewport.\n d.lineDiv = eltP(\"div\", null, \"CodeMirror-code\");\n // Elements are added to these to represent selection and cursors.\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n // A visibility: hidden element used to find the size of things.\n d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n // When lines outside of the viewport are measured, they are drawn in this.\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n // Wraps everything that needs to exist inside the vertically-padded coordinate system\n d.lineSpace = eltP(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n null, \"position: relative; outline: none\");\n var lines = eltP(\"div\", [d.lineSpace], \"CodeMirror-lines\");\n // Moved around its parent to cover visible view.\n d.mover = elt(\"div\", [lines], null, \"position: relative\");\n // Set to the height of the document, allowing scrolling.\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null;\n // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n // Will contain the gutters, if any.\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null;\n // Actual scrollable element.\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\");\n // The element in which the editor lives.\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n\n // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n if (ie && ie_version < 8) {\n d.gutters.style.zIndex = -1;\n d.scroller.style.paddingRight = 0;\n }\n if (!webkit && !(gecko && mobile)) {\n d.scroller.draggable = true;\n }\n\n if (place) {\n if (place.appendChild) {\n place.appendChild(d.wrapper);\n } else {\n place(d.wrapper);\n }\n }\n\n // Current rendered range (may be bigger than the view window).\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first;\n // Information about the rendered lines.\n d.view = [];\n d.renderedView = null;\n // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n d.externalMeasured = null;\n // Empty space (in pixels) above the view\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false;\n\n // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n d.alignWidgets = false;\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false;\n\n // Used for measuring wheel scrolling granularity\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n // True when shift is held down.\n d.shift = false;\n\n // Used to track whether anything happened since the context menu\n // was opened.\n d.selForContextMenu = null;\n\n d.activeTouch = null;\n\n input.init(d);\n }\n\n // Find the line object corresponding to the given line number.\n function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) {\n throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\")\n }\n var chunk = doc;\n while (!chunk.lines) {\n for (var i = 0; ; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) {\n chunk = child;\n break\n }\n n -= sz;\n }\n }\n return chunk.lines[n]\n }\n\n // Get the part of a document between two positions, as an array of\n // strings.\n function getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function(line) {\n var text = line.text;\n if (n == end.line) {\n text = text.slice(0, end.ch);\n }\n if (n == start.line) {\n text = text.slice(start.ch);\n }\n out.push(text);\n ++n;\n });\n return out\n }\n\n // Get the lines between from and to, as array of strings.\n function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function(line) {\n out.push(line.text);\n }); // iter aborts when callback returns truthy value\n return out\n }\n\n // Update the height of a line, propagating the height change\n // upwards to parent nodes.\n function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) {\n for (var n = line; n; n = n.parent) {\n n.height += diff;\n }\n }\n }\n\n // Given a line object, find its line number by walking up through\n // its parent links.\n function lineNo(line) {\n if (line.parent == null) {\n return null\n }\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0; ; ++i) {\n if (chunk.children[i] == cur) {\n break\n }\n no += chunk.children[i].chunkSize();\n }\n }\n return no + cur.first\n }\n\n // Find the line at the given vertical position, using the height\n // information in the document tree.\n function lineAtHeight(chunk, h) {\n var n = chunk.first;\n outer: do {\n for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {\n var child = chunk.children[i$1], ch = child.height;\n if (h < ch) {\n chunk = child;\n continue outer\n }\n h -= ch;\n n += child.chunkSize();\n }\n return n\n } while (!chunk.lines)\n var i = 0;\n for (; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i], lh = line.height;\n if (h < lh) {\n break\n }\n h -= lh;\n }\n return n + i\n }\n\n function isLine(doc, l) {\n return l >= doc.first && l < doc.first + doc.size\n }\n\n function lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber))\n }\n\n // A Pos instance represents a position within the text.\n function Pos(line, ch, sticky) {\n if (sticky === void 0) sticky = null;\n\n if (!(this instanceof Pos)) {\n return new Pos(line, ch, sticky)\n }\n this.line = line;\n this.ch = ch;\n this.sticky = sticky;\n }\n\n // Compare two positions, return 0 if they are the same, a negative\n // number when a is less, and a positive number otherwise.\n function cmp(a, b) {\n return a.line - b.line || a.ch - b.ch\n }\n\n function equalCursorPos(a, b) {\n return a.sticky == b.sticky && cmp(a, b) == 0\n }\n\n function copyPos(x) {\n return Pos(x.line, x.ch)\n }\n\n function maxPos(a, b) {\n return cmp(a, b) < 0 ? b : a\n }\n\n function minPos(a, b) {\n return cmp(a, b) < 0 ? a : b\n }\n\n // Most of the external API clips given positions to make sure they\n // actually exist within the document.\n function clipLine(doc, n) {\n return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))\n }\n\n function clipPos(doc, pos) {\n if (pos.line < doc.first) {\n return Pos(doc.first, 0)\n }\n var last = doc.first + doc.size - 1;\n if (pos.line > last) {\n return Pos(last, getLine(doc, last).text.length)\n }\n return clipToLen(pos, getLine(doc, pos.line).text.length)\n }\n\n function clipToLen(pos, linelen) {\n var ch = pos.ch;\n if (ch == null || ch > linelen) {\n return Pos(pos.line, linelen)\n } else if (ch < 0) {\n return Pos(pos.line, 0)\n } else {\n return pos\n }\n }\n\n function clipPosArray(doc, array) {\n var out = [];\n for (var i = 0; i < array.length; i++) {\n out[i] = clipPos(doc, array[i]);\n }\n return out\n }\n\n // Optimize some code when these features are not used.\n var sawReadOnlySpans = false, sawCollapsedSpans = false;\n\n function seeReadOnlySpans() {\n sawReadOnlySpans = true;\n }\n\n function seeCollapsedSpans() {\n sawCollapsedSpans = true;\n }\n\n // TEXTMARKER SPANS\n\n function MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from;\n this.to = to;\n }\n\n // Search an array of spans for a span matching the given marker.\n function getMarkedSpanFor(spans, marker) {\n if (spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) {\n return span\n }\n }\n }\n }\n\n // Remove a span from an array, returning undefined if no spans are\n // left (we don't store arrays for lines without spans).\n function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i] != span) {\n (r || (r = [])).push(spans[i]);\n }\n }\n return r\n }\n\n // Add a span to a line.\n function addMarkedSpan(line, span) {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n span.marker.attachLine(line);\n }\n\n // Used for the algorithm that adjusts markers for a change in the\n // document. These functions cut an array of spans at a given\n // character position, returning an array of remaining chunks (or\n // undefined if nothing remains).\n function markedSpansBefore(old, startCh, isInsert) {\n var nw;\n if (old) {\n for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n }\n }\n return nw\n }\n\n function markedSpansAfter(old, endCh, isInsert) {\n var nw;\n if (old) {\n for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n span.to == null ? null : span.to - endCh));\n }\n }\n }\n return nw\n }\n\n // Given a change object, compute the new set of marker spans that\n // cover the line in which the change took place. Removes spans\n // entirely within the change, reconnects spans belonging to the\n // same marker that appear on both sides of the change, and cuts off\n // spans partially within the change. Returns an array of span\n // arrays with one element for each line in (after) the change.\n function stretchSpansOverChange(doc, change) {\n if (change.full) {\n return null\n }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) {\n return null\n }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) {\n span.to = startCh;\n } else if (sameLine) {\n span.to = found.to == null ? null : found.to + offset;\n }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) {\n span$1.to += offset;\n }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) {\n (first || (first = [])).push(span$1);\n }\n }\n } else {\n span$1.from += offset;\n if (sameLine) {\n (first || (first = [])).push(span$1);\n }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) {\n first = clearEmptySpans(first);\n }\n if (last && last != first) {\n last = clearEmptySpans(last);\n }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first) {\n for (var i$2 = 0; i$2 < first.length; ++i$2) {\n if (first[i$2].to == null) {\n (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null));\n }\n }\n }\n for (var i$3 = 0; i$3 < gap; ++i$3) {\n newMarkers.push(gapMarkers);\n }\n newMarkers.push(last);\n }\n return newMarkers\n }\n\n // Remove spans that are empty and don't have a clearWhenEmpty\n // option of false.\n function clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false) {\n spans.splice(i--, 1);\n }\n }\n if (!spans.length) {\n return null\n }\n return spans\n }\n\n // Used to 'clip' out readOnly ranges when making a change.\n function removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function(line) {\n if (line.markedSpans) {\n for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1)) {\n (markers || (markers = [])).push(mark);\n }\n }\n }\n });\n if (!markers) {\n return null\n }\n var parts = [{from: from, to: to}];\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i], m = mk.find(0);\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) {\n continue\n }\n var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom) {\n newParts.push({from: p.from, to: m.from});\n }\n if (dto > 0 || !mk.inclusiveRight && !dto) {\n newParts.push({from: m.to, to: p.to});\n }\n parts.splice.apply(parts, newParts);\n j += newParts.length - 3;\n }\n }\n return parts\n }\n\n // Connect or disconnect spans from a line.\n function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) {\n return\n }\n for (var i = 0; i < spans.length; ++i) {\n spans[i].marker.detachLine(line);\n }\n line.markedSpans = null;\n }\n\n function attachMarkedSpans(line, spans) {\n if (!spans) {\n return\n }\n for (var i = 0; i < spans.length; ++i) {\n spans[i].marker.attachLine(line);\n }\n line.markedSpans = spans;\n }\n\n // Helpers used when computing which overlapping collapsed span\n // counts as the larger one.\n function extraLeft(marker) {\n return marker.inclusiveLeft ? -1 : 0\n }\n\n function extraRight(marker) {\n return marker.inclusiveRight ? 1 : 0\n }\n\n // Returns a number indicating which of two overlapping collapsed\n // spans is larger (and thus includes the other). Falls back to\n // comparing ids when the spans cover exactly the same range.\n function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n if (lenDiff != 0) {\n return lenDiff\n }\n var aPos = a.find(), bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n if (fromCmp) {\n return -fromCmp\n }\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n if (toCmp) {\n return toCmp\n }\n return b.id - a.id\n }\n\n // Find out whether a line ends or starts in a collapsed span. If\n // so, return the marker for that span.\n function collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) {\n for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0)) {\n found = sp.marker;\n }\n }\n }\n return found\n }\n\n function collapsedSpanAtStart(line) {\n return collapsedSpanAtSide(line, true)\n }\n\n function collapsedSpanAtEnd(line) {\n return collapsedSpanAtSide(line, false)\n }\n\n function collapsedSpanAround(line, ch) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) {\n for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0)) {\n found = sp.marker;\n }\n }\n }\n return found\n }\n\n // Test whether there exists a collapsed span that partially\n // overlaps (covers the start or end, but not both) of a new span.\n // Such overlap is not allowed.\n function conflictingCollapsedRange(doc, lineNo$$1, from, to, marker) {\n var line = getLine(doc, lineNo$$1);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) {\n for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) {\n continue\n }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) {\n continue\n }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0)) {\n return true\n }\n }\n }\n }\n\n // A visual line is a line as drawn on the screen. Folding, for\n // example, can cause multiple logical lines to appear on the same\n // visual line. This finds the start of the visual line that the\n // given line is part of (usually that is the line itself).\n function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line)) {\n line = merged.find(-1, true).line;\n }\n return line\n }\n\n function visualLineEnd(line) {\n var merged;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n }\n return line\n }\n\n // Returns an array of logical lines that continue the visual line\n // started by the argument, or undefined if there are no such lines.\n function visualLineContinued(line) {\n var merged, lines;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line\n ;(lines || (lines = [])).push(line);\n }\n return lines\n }\n\n // Get the line number of the start of the visual line that the\n // given line number is part of.\n function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) {\n return lineN\n }\n return lineNo(vis)\n }\n\n // Get the line number of the start of the next visual line after\n // the given line.\n function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) {\n return lineN\n }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) {\n return lineN\n }\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line;\n }\n return lineNo(line) + 1\n }\n\n // Compute whether a line is hidden. Lines count as hidden when they\n // are part of a visual line that starts with another line, or when\n // they are entirely covered by collapsed, non-widget span.\n function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) {\n for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) {\n continue\n }\n if (sp.from == null) {\n return true\n }\n if (sp.marker.widgetNode) {\n continue\n }\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp)) {\n return true\n }\n }\n }\n }\n\n function lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))\n }\n if (span.marker.inclusiveRight && span.to == line.text.length) {\n return true\n }\n for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n (sp.to == null || sp.to != span.from) &&\n (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n lineIsHiddenInner(doc, line, sp)) {\n return true\n }\n }\n }\n\n // Find the height above the given line.\n function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) {\n break\n } else {\n h += line.height;\n }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) {\n break\n } else {\n h += cur.height;\n }\n }\n }\n return h\n }\n\n // Compute the character length of a line, taking into account\n // collapsed ranges (see markText) that might hide parts, and join\n // other lines onto it.\n function lineLength(line) {\n if (line.height == 0) {\n return 0\n }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }\n\n // Find the longest line in the document.\n function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function(line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }\n\n // BIDI HELPERS\n\n function iterateBidiSections(order, from, to, f) {\n if (!order) {\n return f(from, to, \"ltr\", 0)\n }\n var found = false;\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\", i);\n found = true;\n }\n }\n if (!found) {\n f(from, to, \"ltr\");\n }\n }\n\n var bidiOther = null;\n\n function getBidiPartAt(order, ch, sticky) {\n var found;\n bidiOther = null;\n for (var i = 0; i < order.length; ++i) {\n var cur = order[i];\n if (cur.from < ch && cur.to > ch) {\n return i\n }\n if (cur.to == ch) {\n if (cur.from != cur.to && sticky == \"before\") {\n found = i;\n } else {\n bidiOther = i;\n }\n }\n if (cur.from == ch) {\n if (cur.from != cur.to && sticky != \"before\") {\n found = i;\n } else {\n bidiOther = i;\n }\n }\n }\n return found != null ? found : bidiOther\n }\n\n // Bidirectional ordering algorithm\n // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n // that this (partially) implements.\n\n // One-char codes used for character types:\n // L (L): Left-to-Right\n // R (R): Right-to-Left\n // r (AL): Right-to-Left Arabic\n // 1 (EN): European Number\n // + (ES): European Number Separator\n // % (ET): European Number Terminator\n // n (AN): Arabic Number\n // , (CS): Common Number Separator\n // m (NSM): Non-Spacing Mark\n // b (BN): Boundary Neutral\n // s (B): Paragraph Separator\n // t (S): Segment Separator\n // w (WS): Whitespace\n // N (ON): Other Neutrals\n\n // Returns null if characters are ordered as they appear\n // (left-to-right), or an array of sections ({from, to, level}\n // objects) in the order in which they occur visually.\n var bidiOrdering = (function() {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n // Character types for codepoints 0x600 to 0x6f9\n var arabicTypes = \"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111\";\n\n function charType(code) {\n if (code <= 0xf7) {\n return lowTypes.charAt(code)\n } else if (0x590 <= code && code <= 0x5f4) {\n return \"R\"\n } else if (0x600 <= code && code <= 0x6f9) {\n return arabicTypes.charAt(code - 0x600)\n } else if (0x6ee <= code && code <= 0x8ac) {\n return \"r\"\n } else if (0x2000 <= code && code <= 0x200b) {\n return \"w\"\n } else if (code == 0x200c) {\n return \"b\"\n } else {\n return \"L\"\n }\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from;\n this.to = to;\n }\n\n return function(str, direction) {\n var outerType = direction == \"ltr\" ? \"L\" : \"R\";\n\n if (str.length == 0 || direction == \"ltr\" && !bidiRE.test(str)) {\n return false\n }\n var len = str.length, types = [];\n for (var i = 0; i < len; ++i) {\n types.push(charType(str.charCodeAt(i)));\n }\n\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {\n var type = types[i$1];\n if (type == \"m\") {\n types[i$1] = prev;\n } else {\n prev = type;\n }\n }\n\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {\n var type$1 = types[i$2];\n if (type$1 == \"1\" && cur == \"r\") {\n types[i$2] = \"n\";\n } else if (isStrong.test(type$1)) {\n cur = type$1;\n if (type$1 == \"r\") {\n types[i$2] = \"R\";\n }\n }\n }\n\n // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {\n var type$2 = types[i$3];\n if (type$2 == \"+\" && prev$1 == \"1\" && types[i$3 + 1] == \"1\") {\n types[i$3] = \"1\";\n } else if (type$2 == \",\" && prev$1 == types[i$3 + 1] &&\n (prev$1 == \"1\" || prev$1 == \"n\")) {\n types[i$3] = prev$1;\n }\n prev$1 = type$2;\n }\n\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n for (var i$4 = 0; i$4 < len; ++i$4) {\n var type$3 = types[i$4];\n if (type$3 == \",\") {\n types[i$4] = \"N\";\n } else if (type$3 == \"%\") {\n var end = (void 0);\n for (end = i$4 + 1; end < len && types[end] == \"%\"; ++end) {\n }\n var replace = (i$4 && types[i$4 - 1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n for (var j = i$4; j < end; ++j) {\n types[j] = replace;\n }\n i$4 = end - 1;\n }\n }\n\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {\n var type$4 = types[i$5];\n if (cur$1 == \"L\" && type$4 == \"1\") {\n types[i$5] = \"L\";\n } else if (isStrong.test(type$4)) {\n cur$1 = type$4;\n }\n }\n\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n for (var i$6 = 0; i$6 < len; ++i$6) {\n if (isNeutral.test(types[i$6])) {\n var end$1 = (void 0);\n for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {\n }\n var before = (i$6 ? types[i$6 - 1] : outerType) == \"L\";\n var after = (end$1 < len ? types[end$1] : outerType) == \"L\";\n var replace$1 = before == after ? (before ? \"L\" : \"R\") : outerType;\n for (var j$1 = i$6; j$1 < end$1; ++j$1) {\n types[j$1] = replace$1;\n }\n i$6 = end$1 - 1;\n }\n }\n\n // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n var order = [], m;\n for (var i$7 = 0; i$7 < len;) {\n if (countsAsLeft.test(types[i$7])) {\n var start = i$7;\n for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {\n }\n order.push(new BidiSpan(0, start, i$7));\n } else {\n var pos = i$7, at = order.length;\n for (++i$7; i$7 < len && types[i$7] != \"L\"; ++i$7) {\n }\n for (var j$2 = pos; j$2 < i$7;) {\n if (countsAsNum.test(types[j$2])) {\n if (pos < j$2) {\n order.splice(at, 0, new BidiSpan(1, pos, j$2));\n }\n var nstart = j$2;\n for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {\n }\n order.splice(at, 0, new BidiSpan(2, nstart, j$2));\n pos = j$2;\n } else {\n ++j$2;\n }\n }\n if (pos < i$7) {\n order.splice(at, 0, new BidiSpan(1, pos, i$7));\n }\n }\n }\n if (direction == \"ltr\") {\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n }\n\n return direction == \"rtl\" ? order.reverse() : order\n }\n })();\n\n // Get the bidi ordering for the given line (and cache it). Returns\n // false for lines that are fully left-to-right, and an array of\n // BidiSpan objects otherwise.\n function getOrder(line, direction) {\n var order = line.order;\n if (order == null) {\n order = line.order = bidiOrdering(line.text, direction);\n }\n return order\n }\n\n // EVENT HANDLING\n\n // Lightweight event framework. on/off also work on DOM nodes,\n // registering native DOM handlers.\n\n var noHandlers = [];\n\n var on = function(emitter, type, f) {\n if (emitter.addEventListener) {\n emitter.addEventListener(type, f, false);\n } else if (emitter.attachEvent) {\n emitter.attachEvent(\"on\" + type, f);\n } else {\n var map$$1 = emitter._handlers || (emitter._handlers = {});\n map$$1[type] = (map$$1[type] || noHandlers).concat(f);\n }\n };\n\n function getHandlers(emitter, type) {\n return emitter._handlers && emitter._handlers[type] || noHandlers\n }\n\n function off(emitter, type, f) {\n if (emitter.removeEventListener) {\n emitter.removeEventListener(type, f, false);\n } else if (emitter.detachEvent) {\n emitter.detachEvent(\"on\" + type, f);\n } else {\n var map$$1 = emitter._handlers, arr = map$$1 && map$$1[type];\n if (arr) {\n var index = indexOf(arr, f);\n if (index > -1) {\n map$$1[type] = arr.slice(0, index).concat(arr.slice(index + 1));\n }\n }\n }\n }\n\n function signal(emitter, type /*, values...*/) {\n var handlers = getHandlers(emitter, type);\n if (!handlers.length) {\n return\n }\n var args = Array.prototype.slice.call(arguments, 2);\n for (var i = 0; i < handlers.length; ++i) {\n handlers[i].apply(null, args);\n }\n }\n\n // The DOM events that CodeMirror handles can be overridden by\n // registering a (non-DOM) handler on the editor for the event name,\n // and preventDefault-ing the event in that handler.\n function signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\") {\n e = {\n type: e, preventDefault: function() {\n this.defaultPrevented = true;\n }\n };\n }\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore\n }\n\n function signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n if (!arr) {\n return\n }\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n for (var i = 0; i < arr.length; ++i) {\n if (indexOf(set, arr[i]) == -1) {\n set.push(arr[i]);\n }\n }\n }\n\n function hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0\n }\n\n // Add on and off methods to a constructor's prototype, to make\n // registering events on such objects more convenient.\n function eventMixin(ctor) {\n ctor.prototype.on = function(type, f) {\n on(this, type, f);\n };\n ctor.prototype.off = function(type, f) {\n off(this, type, f);\n };\n }\n\n // Due to the fact that we still support jurassic IE versions, some\n // compatibility wrappers are needed.\n\n function e_preventDefault(e) {\n if (e.preventDefault) {\n e.preventDefault();\n } else {\n e.returnValue = false;\n }\n }\n\n function e_stopPropagation(e) {\n if (e.stopPropagation) {\n e.stopPropagation();\n } else {\n e.cancelBubble = true;\n }\n }\n\n function e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false\n }\n\n function e_stop(e) {\n e_preventDefault(e);\n e_stopPropagation(e);\n }\n\n function e_target(e) {\n return e.target || e.srcElement\n }\n\n function e_button(e) {\n var b = e.which;\n if (b == null) {\n if (e.button & 1) {\n b = 1;\n } else if (e.button & 2) {\n b = 3;\n } else if (e.button & 4) {\n b = 2;\n }\n }\n if (mac && e.ctrlKey && b == 1) {\n b = 3;\n }\n return b\n }\n\n // Detect drag-and-drop\n var dragAndDrop = function() {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) {\n return false\n }\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div\n }();\n\n var zwspSupported;\n\n function zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200b\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n if (measure.firstChild.offsetHeight != 0) {\n zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8);\n }\n }\n var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node\n }\n\n // Feature-detect IE's crummy client rect reporting for bidi text\n var badBidiRects;\n\n function hasBadBidiRects(measure) {\n if (badBidiRects != null) {\n return badBidiRects\n }\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n removeChildren(measure);\n if (!r0 || r0.left == r0.right) {\n return false\n } // Safari returns null in some cases (#2780)\n return badBidiRects = (r1.right - r0.right < 3)\n }\n\n // See if \"\".split is the broken IE version, if so, provide an\n // alternative way to split lines.\n var splitLinesAuto = \"\\n\\nb\".split(/\\n/).length != 3 ? function(string) {\n var pos = 0, result = [], l = string.length;\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n if (nl == -1) {\n nl = string.length;\n }\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n return result\n } : function(string) {\n return string.split(/\\r\\n?|\\n/);\n };\n\n var hasSelection = window.getSelection ? function(te) {\n try {\n return te.selectionStart != te.selectionEnd\n } catch (e) {\n return false\n }\n } : function(te) {\n var range$$1;\n try {\n range$$1 = te.ownerDocument.selection.createRange();\n } catch (e) {\n }\n if (!range$$1 || range$$1.parentElement() != te) {\n return false\n }\n return range$$1.compareEndPoints(\"StartToEnd\", range$$1) != 0\n };\n\n var hasCopyEvent = (function() {\n var e = elt(\"div\");\n if (\"oncopy\" in e) {\n return true\n }\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\"\n })();\n\n var badZoomedRects = null;\n\n function hasBadZoomedRects(measure) {\n if (badZoomedRects != null) {\n return badZoomedRects\n }\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1\n }\n\n // Known modes, by name and by MIME\n var modes = {}, mimeModes = {};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n function defineMode(name, mode) {\n if (arguments.length > 2) {\n mode.dependencies = Array.prototype.slice.call(arguments, 2);\n }\n modes[name] = mode;\n }\n\n function defineMIME(mime, spec) {\n mimeModes[mime] = spec;\n }\n\n // Given a MIME type, a {name, ...options} config object, or a name\n // string, return a mode config object.\n function resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n if (typeof found == \"string\") {\n found = {name: found};\n }\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return resolveMode(\"application/xml\")\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+json$/.test(spec)) {\n return resolveMode(\"application/json\")\n }\n if (typeof spec == \"string\") {\n return {name: spec}\n } else {\n return spec || {name: \"null\"}\n }\n }\n\n // Given a mode spec (anything that resolveMode accepts), find and\n // initialize an actual mode object.\n function getMode(options, spec) {\n spec = resolveMode(spec);\n var mfactory = modes[spec.name];\n if (!mfactory) {\n return getMode(options, \"text/plain\")\n }\n var modeObj = mfactory(options, spec);\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) {\n continue\n }\n if (modeObj.hasOwnProperty(prop)) {\n modeObj[\"_\" + prop] = modeObj[prop];\n }\n modeObj[prop] = exts[prop];\n }\n }\n modeObj.name = spec.name;\n if (spec.helperType) {\n modeObj.helperType = spec.helperType;\n }\n if (spec.modeProps) {\n for (var prop$1 in spec.modeProps) {\n modeObj[prop$1] = spec.modeProps[prop$1];\n }\n }\n\n return modeObj\n }\n\n // This can be used to attach properties to mode objects from\n // outside the actual mode definition.\n var modeExtensions = {};\n\n function extendMode(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n copyObj(properties, exts);\n }\n\n function copyState(mode, state) {\n if (state === true) {\n return state\n }\n if (mode.copyState) {\n return mode.copyState(state)\n }\n var nstate = {};\n for (var n in state) {\n var val = state[n];\n if (val instanceof Array) {\n val = val.concat([]);\n }\n nstate[n] = val;\n }\n return nstate\n }\n\n // Given a mode and a state (for that mode), find the inner mode and\n // state at the position that the state refers to.\n function innerMode(mode, state) {\n var info;\n while (mode.innerMode) {\n info = mode.innerMode(state);\n if (!info || info.mode == mode) {\n break\n }\n state = info.state;\n mode = info.mode;\n }\n return info || {mode: mode, state: state}\n }\n\n function startState(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true\n }\n\n // STRING STREAM\n\n // Fed to the mode parsers, provides helper functions to make\n // parsers more succinct.\n\n var StringStream = function(string, tabSize, lineOracle) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n this.lineOracle = lineOracle;\n };\n\n StringStream.prototype.eol = function() {\n return this.pos >= this.string.length\n };\n StringStream.prototype.sol = function() {\n return this.pos == this.lineStart\n };\n StringStream.prototype.peek = function() {\n return this.string.charAt(this.pos) || undefined\n };\n StringStream.prototype.next = function() {\n if (this.pos < this.string.length) {\n return this.string.charAt(this.pos++)\n }\n };\n StringStream.prototype.eat = function(match) {\n var ch = this.string.charAt(this.pos);\n var ok;\n if (typeof match == \"string\") {\n ok = ch == match;\n } else {\n ok = ch && (match.test ? match.test(ch) : match(ch));\n }\n if (ok) {\n ++this.pos;\n return ch\n }\n };\n StringStream.prototype.eatWhile = function(match) {\n var start = this.pos;\n while (this.eat(match)) {\n }\n return this.pos > start\n };\n StringStream.prototype.eatSpace = function() {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) {\n ++this.pos;\n }\n return this.pos > start\n };\n StringStream.prototype.skipToEnd = function() {\n this.pos = this.string.length;\n };\n StringStream.prototype.skipTo = function(ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {\n this.pos = found;\n return true\n }\n };\n StringStream.prototype.backUp = function(n) {\n this.pos -= n;\n };\n StringStream.prototype.column = function() {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.indentation = function() {\n return countColumn(this.string, null, this.tabSize) -\n (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.match = function(pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function(str) {\n return caseInsensitive ? str.toLowerCase() : str;\n };\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) {\n this.pos += pattern.length;\n }\n return true\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) {\n return null\n }\n if (match && consume !== false) {\n this.pos += match[0].length;\n }\n return match\n }\n };\n StringStream.prototype.current = function() {\n return this.string.slice(this.start, this.pos)\n };\n StringStream.prototype.hideFirstChars = function(n, inner) {\n this.lineStart += n;\n try {\n return inner()\n } finally {\n this.lineStart -= n;\n }\n };\n StringStream.prototype.lookAhead = function(n) {\n var oracle = this.lineOracle;\n return oracle && oracle.lookAhead(n)\n };\n StringStream.prototype.baseToken = function() {\n var oracle = this.lineOracle;\n return oracle && oracle.baseToken(this.pos)\n };\n\n var SavedContext = function(state, lookAhead) {\n this.state = state;\n this.lookAhead = lookAhead;\n };\n\n var Context = function(doc, state, line, lookAhead) {\n this.state = state;\n this.doc = doc;\n this.line = line;\n this.maxLookAhead = lookAhead || 0;\n this.baseTokens = null;\n this.baseTokenPos = 1;\n };\n\n Context.prototype.lookAhead = function(n) {\n var line = this.doc.getLine(this.line + n);\n if (line != null && n > this.maxLookAhead) {\n this.maxLookAhead = n;\n }\n return line\n };\n\n Context.prototype.baseToken = function(n) {\n if (!this.baseTokens) {\n return null\n }\n while (this.baseTokens[this.baseTokenPos] <= n) {\n this.baseTokenPos += 2;\n }\n var type = this.baseTokens[this.baseTokenPos + 1];\n return {\n type: type && type.replace(/( |^)overlay .*/, \"\"),\n size: this.baseTokens[this.baseTokenPos] - n\n }\n };\n\n Context.prototype.nextLine = function() {\n this.line++;\n if (this.maxLookAhead > 0) {\n this.maxLookAhead--;\n }\n };\n\n Context.fromSaved = function(doc, saved, line) {\n if (saved instanceof SavedContext) {\n return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead)\n } else {\n return new Context(doc, copyState(doc.mode, saved), line)\n }\n };\n\n Context.prototype.save = function(copy) {\n var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;\n return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state\n };\n\n\n // Compute a style array (an array starting with a mode generation\n // -- for invalidation -- followed by pairs of end positions and\n // style strings), which is used to highlight the tokens on the\n // line.\n function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function(end, style) {\n return st.push(end, style);\n },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function(o) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function(end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end) {\n st.splice(i, 1, end, st[i + 1], i_end);\n }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) {\n return\n }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start + 1];\n st[start + 1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop(o);\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }\n\n function getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var context = getContextBefore(cm, lineNo(line));\n var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);\n var result = highlightLine(cm, line, context);\n if (resetState) {\n context.state = resetState;\n }\n line.stateAfter = context.save(!resetState);\n line.styles = result.styles;\n if (result.classes) {\n line.styleClasses = result.classes;\n } else if (line.styleClasses) {\n line.styleClasses = null;\n }\n if (updateFrontier === cm.doc.highlightFrontier) {\n cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier);\n }\n }\n return line.styles\n }\n\n function getContextBefore(cm, n, precise) {\n var doc = cm.doc, display = cm.display;\n if (!doc.mode.startState) {\n return new Context(doc, true, n)\n }\n var start = findStartLine(cm, n, precise);\n var saved = start > doc.first && getLine(doc, start - 1).stateAfter;\n var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);\n\n doc.iter(start, n, function(line) {\n processLine(cm, line.text, context);\n var pos = context.line;\n line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;\n context.nextLine();\n });\n if (precise) {\n doc.modeFrontier = context.line;\n }\n return context\n }\n\n // Lightweight form of highlight -- proceed over this line and\n // update state, but don't save a style array. Used for lines that\n // aren't currently visible.\n function processLine(cm, text, context, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize, context);\n stream.start = stream.pos = startAt || 0;\n if (text == \"\") {\n callBlankLine(mode, context.state);\n }\n while (!stream.eol()) {\n readToken(mode, stream, context.state);\n stream.start = stream.pos;\n }\n }\n\n function callBlankLine(mode, state) {\n if (mode.blankLine) {\n return mode.blankLine(state)\n }\n if (!mode.innerMode) {\n return\n }\n var inner = innerMode(mode, state);\n if (inner.mode.blankLine) {\n return inner.mode.blankLine(inner.state)\n }\n }\n\n function readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) {\n inner[0] = innerMode(mode, state).mode;\n }\n var style = mode.token(stream, state);\n if (stream.pos > stream.start) {\n return style\n }\n }\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\")\n }\n\n var Token = function(stream, type, state) {\n this.start = stream.start;\n this.end = stream.pos;\n this.string = stream.current();\n this.type = type || null;\n this.state = state;\n };\n\n // Utility for getTokenAt and getLineTokens\n function takeToken(cm, pos, precise, asArray) {\n var doc = cm.doc, mode = doc.mode, style;\n pos = clipPos(doc, pos);\n var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;\n if (asArray) {\n tokens = [];\n }\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, context.state);\n if (asArray) {\n tokens.push(new Token(stream, style, copyState(doc.mode, context.state)));\n }\n }\n return asArray ? tokens : new Token(stream, style, context.state)\n }\n\n function extractLineClasses(type, output) {\n if (type) {\n for (; ;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n if (!lineClass) {\n break\n }\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n if (output[prop] == null) {\n output[prop] = lineClass[2];\n } else if (!(new RegExp(\"(?:^|\\s)\" + lineClass[2] + \"(?:$|\\s)\")).test(output[prop])) {\n output[prop] += \" \" + lineClass[2];\n }\n }\n }\n return type\n }\n\n // Run the given mode's parser over a line, calling f for each token.\n function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n if (flattenSpans == null) {\n flattenSpans = cm.options.flattenSpans;\n }\n var curStart = 0, curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize, context), style;\n var inner = cm.options.addModeClass && [null];\n if (text == \"\") {\n extractLineClasses(callBlankLine(mode, context.state), lineClasses);\n }\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n if (forceToEnd) {\n processLine(cm, text, context, stream.pos);\n }\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);\n }\n if (inner) {\n var mName = inner[0].name;\n if (mName) {\n style = \"m-\" + (style ? mName + \" \" + style : mName);\n }\n }\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 5000);\n f(curStart, curStyle);\n }\n curStyle = style;\n }\n stream.start = stream.pos;\n }\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444\n // characters, and returns inaccurate measurements in nodes\n // starting around 5000 chars.\n var pos = Math.min(stream.pos, curStart + 5000);\n f(pos, curStyle);\n curStart = pos;\n }\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) {\n return doc.first\n }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier)) {\n return search\n }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }\n\n function retreatFrontier(doc, n) {\n doc.modeFrontier = Math.min(doc.modeFrontier, n);\n if (doc.highlightFrontier < n - 10) {\n return\n }\n var start = doc.first;\n for (var line = n - 1; line > start; line--) {\n var saved = getLine(doc, line).stateAfter;\n // change is on 3\n // state on line 1 looked ahead 2 -- so saw 3\n // test 1 + 2 < 3 should cover this\n if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {\n start = line + 1;\n break\n }\n }\n doc.highlightFrontier = Math.min(doc.highlightFrontier, start);\n }\n\n // LINE DATA STRUCTURE\n\n // Line objects. These hold state related to a line, including\n // highlighting info (the styles array).\n var Line = function(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n };\n\n Line.prototype.lineNo = function() {\n return lineNo(this)\n };\n eventMixin(Line);\n\n // Change the content (text, markers) of a line. Automatically\n // invalidates cached information and tries to re-estimate the\n // line's height.\n function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n if (line.styles) {\n line.styles = null;\n }\n if (line.order != null) {\n line.order = null;\n }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) {\n updateLineHeight(line, estHeight);\n }\n }\n\n // Detach a line from the document tree and its markers.\n function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }\n\n // Convert a style as returned by a mode (either null, or a string\n // containing one or more styles) to a CSS style. This is cached,\n // and also looks for line-wide styles.\n var styleToClassCache = {}, styleToClassCacheWithMode = {};\n\n function interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) {\n return null\n }\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] ||\n (cache[style] = style.replace(/\\S+/g, \"cm-$&\"))\n }\n\n // Render the DOM representation of the text of a line. Also builds\n // up a 'line map', which points at the DOM nodes that represent\n // specific stretches of text, and is used by the measuring code.\n // The returned object contains the DOM node, this map, and\n // information about line-wide styles that were set by the mode.\n function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {\n pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")\n };\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction))) {\n builder.addToken = buildTokenBadBidi(builder.addToken, order);\n }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass) {\n builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\");\n }\n if (line.styleClasses.textClass) {\n builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\");\n }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0) {\n builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure)));\n }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\"))) {\n builder.content.className = \"cm-tab-wrap-hack\";\n }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className) {\n builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\");\n }\n\n return builder\n }\n\n function defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token\n }\n\n // Build up the DOM representation for a single token, and add it to\n // the line map. Takes care to render special characters separately.\n function buildToken(builder, text, style, startStyle, endStyle, title, css) {\n if (!text) {\n return\n }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) {\n mustWrap = true;\n }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) {\n content.appendChild(elt(\"span\", [txt]));\n } else {\n content.appendChild(txt);\n }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) {\n break\n }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) {\n content.appendChild(elt(\"span\", [txt$1]));\n } else {\n content.appendChild(txt$1);\n }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css) {\n var fullStyle = style || \"\";\n if (startStyle) {\n fullStyle += startStyle;\n }\n if (endStyle) {\n fullStyle += endStyle;\n }\n var token = elt(\"span\", [content], fullStyle, css);\n if (title) {\n token.title = title;\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }\n\n // Change some spaces to NBSP to prevent the browser from collapsing\n // trailing spaces at the end of a line when rendering text (issue #1362).\n function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) {\n return text\n }\n var spaceBefore = trailingBefore, result = \"\";\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32)) {\n ch = \"\\u00a0\";\n }\n result += ch;\n spaceBefore = ch == \" \";\n }\n return result\n }\n\n // Work around nonsense dimensions being reported for stretches of\n // right-to-left text.\n function buildTokenBadBidi(inner, order) {\n return function(builder, text, style, startStyle, endStyle, title, css) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos, end = start + text.length;\n for (; ;) {\n // Find the part that overlaps with the start of this text\n var part = (void 0);\n for (var i = 0; i < order.length; i++) {\n part = order[i];\n if (part.to > start && part.from <= start) {\n break\n }\n }\n if (part.to >= end) {\n return inner(builder, text, style, startStyle, endStyle, title, css)\n }\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, title, css);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n }\n }\n\n function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n if (widget) {\n builder.map.push(builder.pos, builder.pos + size, widget);\n }\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget) {\n widget = builder.content.appendChild(document.createElement(\"span\"));\n }\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n builder.pos += size;\n builder.trailingSpace = false;\n }\n\n // Outputs a number of spans to make up a line, taking highlighting\n // and marked text into account.\n function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1 += 2) {\n builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1 + 1], builder.cm.options));\n }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, title, collapsed;\n for (; ;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = title = css = \"\";\n collapsed = null;\n nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) {\n spanStyle += \" \" + m.className;\n }\n if (m.css) {\n css = (css ? css + \";\" : \"\") + m.css;\n }\n if (m.startStyle && sp.from == pos) {\n spanStartStyle += \" \" + m.startStyle;\n }\n if (m.endStyle && sp.to == nextChange) {\n (endStyles || (endStyles = [])).push(m.endStyle, sp.to);\n }\n if (m.title && !title) {\n title = m.title;\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0)) {\n collapsed = sp;\n }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) {\n for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2) {\n if (endStyles[j$1 + 1] == nextChange) {\n spanEndStyle += \" \" + endStyles[j$1];\n }\n }\n }\n\n if (!collapsed || collapsed.from == pos) {\n for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2) {\n buildCollapsedSpan(builder, 0, foundBookmarks[j$2]);\n }\n }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) {\n return\n }\n if (collapsed.to == pos) {\n collapsed = false;\n }\n }\n }\n if (pos >= len) {\n break\n }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", title, css);\n }\n if (end >= upto) {\n text = text.slice(upto - pos);\n pos = upto;\n break\n }\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }\n\n\n // These objects are used to represent the visible (currently drawn)\n // part of the document. A LineView may correspond to multiple\n // logical lines, if those are connected by collapsed ranges.\n function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }\n\n // Create a range of LineView objects for the given lines.\n function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n }\n\n var operationGroup = null;\n\n function pushOperation(op) {\n if (operationGroup) {\n operationGroup.ops.push(op);\n } else {\n op.ownsGroup = operationGroup = {\n ops: [op],\n delayedCallbacks: []\n };\n }\n }\n\n function fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks, i = 0;\n do {\n for (; i < callbacks.length; i++) {\n callbacks[i].call(null);\n }\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n if (op.cursorActivityHandlers) {\n while (op.cursorActivityCalled < op.cursorActivityHandlers.length) {\n op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm);\n }\n }\n }\n } while (i < callbacks.length)\n }\n\n function finishOperation(op, endCb) {\n var group = op.ownsGroup;\n if (!group) {\n return\n }\n\n try {\n fireCallbacksForOps(group);\n } finally {\n operationGroup = null;\n endCb(group);\n }\n }\n\n var orphanDelayedCallbacks = null;\n\n // Often, we want to signal events at a point where we are in the\n // middle of some work, but don't want the handler to start calling\n // other methods on the editor, which might be in an inconsistent\n // state or simply not expect any other events to happen.\n // signalLater looks whether there are any handlers, and schedules\n // them to be executed when the last operation ends, or, if no\n // operation is active, when a timeout fires.\n function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) {\n return\n }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function(i) {\n list.push(function() {\n return arr[i].apply(null, args);\n });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop(i);\n }\n\n function fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n for (var i = 0; i < delayed.length; ++i) {\n delayed[i]();\n }\n }\n\n // When an aspect of a line changes, a string is added to\n // lineView.changes. This updates the relevant part of the line's\n // DOM structure.\n function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") {\n updateLineText(cm, lineView);\n } else if (type == \"gutter\") {\n updateLineGutter(cm, lineView, lineN, dims);\n } else if (type == \"class\") {\n updateLineClasses(cm, lineView);\n } else if (type == \"widget\") {\n updateLineWidgets(cm, lineView, dims);\n }\n }\n lineView.changes = null;\n }\n\n // Lines with gutter elements, widgets or a background class need to\n // be wrapped, and have the extra elements added to the wrapper div\n function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode) {\n lineView.text.parentNode.replaceChild(lineView.node, lineView.text);\n }\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) {\n lineView.node.style.zIndex = 2;\n }\n }\n return lineView.node\n }\n\n function updateLineBackground(cm, lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n if (cls) {\n cls += \" CodeMirror-linebackground\";\n }\n if (lineView.background) {\n if (cls) {\n lineView.background.className = cls;\n } else {\n lineView.background.parentNode.removeChild(lineView.background);\n lineView.background = null;\n }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n cm.display.input.setUneditable(lineView.background);\n }\n }\n\n // Wrapper around buildLineContent which will reuse the structure\n // in display.externalMeasured when possible.\n function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }\n\n // Redraw the line's text. Interacts with the background and text\n // classes because the mode may output tokens that influence these\n // classes.\n function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) {\n lineView.node = built.pre;\n }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }\n\n function updateLineClasses(cm, lineView) {\n updateLineBackground(cm, lineView);\n if (lineView.line.wrapClass) {\n ensureLineWrapped(lineView).className = lineView.line.wrapClass;\n } else if (lineView.node != lineView.text) {\n lineView.node.className = \"\";\n }\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n }\n\n function updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px; width: \" + (dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(lineView.gutterBackground);\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n var markers = lineView.line.gutterMarkers;\n if (cm.options.lineNumbers || markers) {\n var wrap$1 = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(gutterWrap);\n wrap$1.insertBefore(gutterWrap, lineView.text);\n if (lineView.line.gutterClass) {\n gutterWrap.className += \" \" + lineView.line.gutterClass;\n }\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"])) {\n lineView.lineNumber = gutterWrap.appendChild(\n elt(\"div\", lineNumberFor(cm.options, lineN),\n \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[\"CodeMirror-linenumbers\"]) + \"px; width: \" + (cm.display.lineNumInnerWidth) + \"px\")));\n }\n if (markers) {\n for (var k = 0; k < cm.options.gutters.length; ++k) {\n var id = cm.options.gutters[k], found = markers.hasOwnProperty(id) && markers[id];\n if (found) {\n gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[id]) + \"px; width: \" + (dims.gutterWidth[id]) + \"px\")));\n }\n }\n }\n }\n }\n\n function updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) {\n lineView.alignable = null;\n }\n for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {\n next = node.nextSibling;\n if (node.className == \"CodeMirror-linewidget\") {\n lineView.node.removeChild(node);\n }\n }\n insertLineWidgets(cm, lineView, dims);\n }\n\n // Build a line's DOM representation from scratch\n function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) {\n lineView.bgClass = built.bgClass;\n }\n if (built.textClass) {\n lineView.textClass = built.textClass;\n }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }\n\n // A lineView may contain multiple logical lines (when merged by\n // collapsed spans). The widgets for all of them need to be drawn.\n function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++) {\n insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false);\n }\n }\n }\n\n function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) {\n return\n }\n var wrap = ensureLineWrapped(lineView);\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\");\n if (!widget.handleMouseEvents) {\n node.setAttribute(\"cm-ignore-events\", \"true\");\n }\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n if (allowAbove && widget.above) {\n wrap.insertBefore(node, lineView.gutter || lineView.text);\n } else {\n wrap.appendChild(node);\n }\n signalLater(widget, \"redraw\");\n }\n }\n\n function positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n node.style.width = width + \"px\";\n }\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n if (!widget.noHScroll) {\n node.style.marginLeft = -dims.gutterTotalWidth + \"px\";\n }\n }\n }\n\n function widgetHeight(widget) {\n if (widget.height != null) {\n return widget.height\n }\n var cm = widget.doc.cm;\n if (!cm) {\n return 0\n }\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n if (widget.coverGutter) {\n parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\";\n }\n if (widget.noHScroll) {\n parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\";\n }\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n return widget.height = widget.node.parentNode.offsetHeight\n }\n\n // Return true when the given mouse event happened in a widget\n function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover)) {\n return true\n }\n }\n }\n\n // POSITION MEASUREMENT\n\n function paddingTop(display) {\n return display.lineSpace.offsetTop\n }\n\n function paddingVert(display) {\n return display.mover.offsetHeight - display.lineSpace.offsetHeight\n }\n\n function paddingH(display) {\n if (display.cachedPaddingH) {\n return display.cachedPaddingH\n }\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n if (!isNaN(data.left) && !isNaN(data.right)) {\n display.cachedPaddingH = data;\n }\n return data\n }\n\n function scrollGap(cm) {\n return scrollerGap - cm.display.nativeBarWidth\n }\n\n function displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth\n }\n\n function displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight\n }\n\n // Ensure the lineView.wrapping.heights array is populated. This is\n // an array of bottom offsets for the lines that make up a drawn\n // line. When lineWrapping is on, there might be more than one\n // height.\n function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2) {\n heights.push((cur.bottom + next.top) / 2 - rect.top);\n }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }\n\n // Find a line map (mapping character offsets to text nodes) and a\n // measurement cache for the given line number. (A line view might\n // contain multiple lines when collapsed ranges are present.)\n function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line) {\n return {map: lineView.measure.map, cache: lineView.measure.cache}\n }\n for (var i = 0; i < lineView.rest.length; i++) {\n if (lineView.rest[i] == line) {\n return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]}\n }\n }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++) {\n if (lineNo(lineView.rest[i$1]) > lineN) {\n return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true}\n }\n }\n }\n\n // Render a line into the hidden node display.externalMeasured. Used\n // when measurement is needed for a line that's not in the viewport.\n function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }\n\n // Get a {top, bottom, left, right} box (in line-local coordinates)\n // for a given character.\n function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)\n }\n\n // Find a line view that corresponds to the given line number.\n function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo) {\n return cm.display.view[findViewIndex(cm, lineN)]\n }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size) {\n return ext\n }\n }\n\n // Measurement can be split in two steps, the set-up work that\n // applies to the whole line, and the measurement of the actual\n // character. Functions like coordsChar, that need to do a lot of\n // measurements in a row, can thus ensure that the set-up work is\n // only done once.\n function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view) {\n view = updateExternalMeasurement(cm, line);\n }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }\n\n // Given a prepared measurement object, measures the position of an\n // actual character (or fetches it from the cache).\n function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) {\n ch = -1;\n }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect) {\n prepared.rect = prepared.view.text.getBoundingClientRect();\n }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) {\n prepared.cache[key] = found;\n }\n }\n return {\n left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom\n }\n }\n\n var nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\n function nodeAndOffsetInLineMap(map$$1, ch, bias) {\n var node, start, end, collapse, mStart, mEnd;\n // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n for (var i = 0; i < map$$1.length; i += 3) {\n mStart = map$$1[i];\n mEnd = map$$1[i + 1];\n if (ch < mStart) {\n start = 0;\n end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map$$1.length - 3 || ch == mEnd && map$$1[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n if (ch >= mEnd) {\n collapse = \"right\";\n }\n }\n if (start != null) {\n node = map$$1[i + 2];\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\")) {\n collapse = bias;\n }\n if (bias == \"left\" && start == 0) {\n while (i && map$$1[i - 2] == map$$1[i - 3] && map$$1[i - 1].insertLeft) {\n node = map$$1[(i -= 3) + 2];\n collapse = \"left\";\n }\n }\n if (bias == \"right\" && start == mEnd - mStart) {\n while (i < map$$1.length - 3 && map$$1[i + 3] == map$$1[i + 4] && !map$$1[i + 5].insertLeft) {\n node = map$$1[(i += 3) + 2];\n collapse = \"right\";\n }\n }\n break\n }\n }\n return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}\n }\n\n function getUsefulRect(rects, bias) {\n var rect = nullRect;\n if (bias == \"left\") {\n for (var i = 0; i < rects.length; i++) {\n if ((rect = rects[i]).left != rect.right) {\n break\n }\n }\n } else {\n for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {\n if ((rect = rects[i$1]).left != rect.right) {\n break\n }\n }\n }\n return rect\n }\n\n function measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n var rect;\n if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) {\n --start;\n }\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) {\n ++end;\n }\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart) {\n rect = node.parentNode.getBoundingClientRect();\n } else {\n rect = getUsefulRect(range(node, start, end).getClientRects(), bias);\n }\n if (rect.left || rect.right || start == 0) {\n break\n }\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n if (ie && ie_version < 11) {\n rect = maybeUpdateRectForZooming(cm.display.measure, rect);\n }\n } else { // If it is a widget, simply get the box for the whole widget.\n if (start > 0) {\n collapse = bias = \"right\";\n }\n var rects;\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1) {\n rect = rects[bias == \"right\" ? rects.length - 1 : 0];\n } else {\n rect = node.getBoundingClientRect();\n }\n }\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n if (rSpan) {\n rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom};\n } else {\n rect = nullRect;\n }\n }\n\n var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n var i = 0;\n for (; i < heights.length - 1; i++) {\n if (mid < heights[i]) {\n break\n }\n }\n var top = i ? heights[i - 1] : 0, bot = heights[i];\n var result = {\n left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top, bottom: bot\n };\n if (!rect.left && !rect.right) {\n result.bogus = true;\n }\n if (!cm.options.singleCursorHeightPerLine) {\n result.rtop = rtop;\n result.rbottom = rbot;\n }\n\n return result\n }\n\n // Work around problem with bounding client rects on ranges being\n // returned incorrectly when zoomed on IE10 and below.\n function maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null ||\n screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure)) {\n return rect\n }\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {\n left: rect.left * scaleX, right: rect.right * scaleX,\n top: rect.top * scaleY, bottom: rect.bottom * scaleY\n }\n }\n\n function clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++) {\n lineView.measure.caches[i] = {};\n }\n }\n }\n }\n\n function clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n for (var i = 0; i < cm.display.view.length; i++) {\n clearLineMeasurementCacheFor(cm.display.view[i]);\n }\n }\n\n function clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n if (!cm.options.lineWrapping) {\n cm.display.maxLineChanged = true;\n }\n cm.display.lineNumChars = null;\n }\n\n function pageScrollX() {\n // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206\n // which causes page_Offset and bounding client rects to use\n // different reference viewports and invalidate our calculations.\n if (chrome && android) {\n return -(document.body.getBoundingClientRect().left - parseInt(getComputedStyle(document.body).marginLeft))\n }\n return window.pageXOffset || (document.documentElement || document.body).scrollLeft\n }\n\n function pageScrollY() {\n if (chrome && android) {\n return -(document.body.getBoundingClientRect().top - parseInt(getComputedStyle(document.body).marginTop))\n }\n return window.pageYOffset || (document.documentElement || document.body).scrollTop\n }\n\n function widgetTopHeight(lineObj) {\n var height = 0;\n if (lineObj.widgets) {\n for (var i = 0; i < lineObj.widgets.length; ++i) {\n if (lineObj.widgets[i].above) {\n height += widgetHeight(lineObj.widgets[i]);\n }\n }\n }\n return height\n }\n\n // Converts a {top, bottom, left, right} box from line-local\n // coordinates into another coordinate system. Context may be one of\n // \"line\", \"div\" (display.lineDiv), \"local\"./null (editor), \"window\",\n // or \"page\".\n function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n if (!includeWidgets) {\n var height = widgetTopHeight(lineObj);\n rect.top += height;\n rect.bottom += height;\n }\n if (context == \"line\") {\n return rect\n }\n if (!context) {\n context = \"local\";\n }\n var yOff = heightAtLine(lineObj);\n if (context == \"local\") {\n yOff += paddingTop(cm.display);\n } else {\n yOff -= cm.display.viewOffset;\n }\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY());\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX());\n rect.left += xOff;\n rect.right += xOff;\n }\n rect.top += yOff;\n rect.bottom += yOff;\n return rect\n }\n\n // Coverts a box from \"div\" coords to another coordinate system.\n // Context may be \"window\", \"page\", \"div\", or \"local\"./null.\n function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") {\n return coords\n }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX();\n top -= pageScrollY();\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n }\n\n function charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) {\n lineObj = getLine(cm.doc, pos.line);\n }\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)\n }\n\n // Returns a box for a given cursor position, which may have an\n // 'other' property containing the position of the secondary cursor\n // on a bidi boundary.\n // A cursor Pos(line, char, \"before\") is on the same visual line as `char - 1`\n // and after `char - 1` in writing order of `char - 1`\n // A cursor Pos(line, char, \"after\") is on the same visual line as `char`\n // and before `char` in writing order of `char`\n // Examples (upper-case letters are RTL, lower-case are LTR):\n // Pos(0, 1, ...)\n // before after\n // ab a|b a|b\n // aB a|B aB|\n // Ab |Ab A|b\n // AB B|A B|A\n // Every position after the last character on a line is considered to stick\n // to the last character on the line.\n function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) {\n preparedMeasure = prepareMeasureForLine(cm, lineObj);\n }\n\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) {\n m.left = m.right;\n } else {\n m.right = m.left;\n }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) {\n return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\")\n }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) {\n val.other = getBidi(ch, other, sticky != \"before\");\n }\n return val\n }\n\n // Used to cheaply estimate the coordinates for a position. Used for\n // intermediate scroll updates.\n function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) {\n left = charWidth(cm.display) * pos.ch;\n }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n }\n\n // Positions returned by coordsChar contain some extra information.\n // xRel is the relative x position of the input coordinates compared\n // to the found position (so xRel > 0 means the coordinates are to\n // the right of the character position, for example). When outside\n // is true, that means the coordinates lie outside the line's\n // vertical range.\n function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n if (outside) {\n pos.outside = true;\n }\n return pos\n }\n\n // Compute the character position closest to the given coordinates.\n // Input must be lineSpace-local (\"div\" coordinate system).\n function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) {\n return PosWithInfo(doc.first, 0, null, true, -1)\n }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last) {\n return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, true, 1)\n }\n if (x < 0) {\n x = 0;\n }\n\n var lineObj = getLine(doc, lineN);\n for (; ;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 ? 1 : 0));\n if (!collapsed) {\n return found\n }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) {\n return rangeEnd\n }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }\n\n function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {\n y -= widgetTopHeight(lineObj);\n var end = lineObj.text.length;\n var begin = findFirst(function(ch) {\n return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y;\n }, end, 0);\n end = findFirst(function(ch) {\n return measureCharPrepared(cm, preparedMeasure, ch).top > y;\n }, begin, end);\n return {begin: begin, end: end}\n }\n\n function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {\n if (!preparedMeasure) {\n preparedMeasure = prepareMeasureForLine(cm, lineObj);\n }\n var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), \"line\").top;\n return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)\n }\n\n // Returns true if the given side of a box is after the given\n // coordinates, in top-to-bottom, left-to-right order.\n function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n }\n\n function coordsCharInner(cm, lineObj, lineNo$$1, x, y) {\n // Move y into line-local coordinate space\n y -= heightAtLine(lineObj);\n var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n // When directly calling `measureCharPrepared`, we have to adjust\n // for the widgets at this line.\n var widgetHeight$$1 = widgetTopHeight(lineObj);\n var begin = 0, end = lineObj.text.length, ltr = true;\n\n var order = getOrder(lineObj, cm.doc.direction);\n // If the line isn't plain left-to-right text, first figure out\n // which bidi section the coordinates fall into.\n if (order) {\n var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)\n (cm, lineObj, lineNo$$1, preparedMeasure, order, x, y);\n ltr = part.level != 1;\n // The awkward -1 offsets are needed because findFirst (called\n // on these below) will treat its first bound as inclusive,\n // second as exclusive, but we want to actually address the\n // characters in the part's range\n begin = ltr ? part.from : part.to - 1;\n end = ltr ? part.to : part.from - 1;\n }\n\n // A binary search to find the first character whose bounding box\n // starts after the coordinates. If we run across any whose box wrap\n // the coordinates, store that.\n var chAround = null, boxAround = null;\n var ch = findFirst(function(ch) {\n var box = measureCharPrepared(cm, preparedMeasure, ch);\n box.top += widgetHeight$$1;\n box.bottom += widgetHeight$$1;\n if (!boxIsAfter(box, x, y, false)) {\n return false\n }\n if (box.top <= y && box.left <= x) {\n chAround = ch;\n boxAround = box;\n }\n return true\n }, begin, end);\n\n var baseX, sticky, outside = false;\n // If a box around the coordinates was found, use that\n if (boxAround) {\n // Distinguish coordinates nearer to the left or right side of the box\n var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;\n ch = chAround + (atStart ? 0 : 1);\n sticky = atStart ? \"after\" : \"before\";\n baseX = atLeft ? boxAround.left : boxAround.right;\n } else {\n // (Adjust for extended bound, if necessary.)\n if (!ltr && (ch == end || ch == begin)) {\n ch++;\n }\n // To determine which side to associate with, get the box to the\n // left of the character and compare it's vertical position to the\n // coordinates\n sticky = ch == 0 ? \"after\" : ch == lineObj.text.length ? \"before\" :\n (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight$$1 <= y) == ltr ?\n \"after\" : \"before\";\n // Now get accurate coordinates for this place, in order to get a\n // base X position\n var coords = cursorCoords(cm, Pos(lineNo$$1, ch, sticky), \"line\", lineObj, preparedMeasure);\n baseX = coords.left;\n outside = y < coords.top || y >= coords.bottom;\n }\n\n ch = skipExtendingChars(lineObj.text, ch, 1);\n return PosWithInfo(lineNo$$1, ch, sticky, outside, x - baseX)\n }\n\n function coordsBidiPart(cm, lineObj, lineNo$$1, preparedMeasure, order, x, y) {\n // Bidi parts are sorted left-to-right, and in a non-line-wrapping\n // situation, we can take this ordering to correspond to the visual\n // ordering. This finds the first part whose end is after the given\n // coordinates.\n var index = findFirst(function(i) {\n var part = order[i], ltr = part.level != 1;\n return boxIsAfter(cursorCoords(cm, Pos(lineNo$$1, ltr ? part.to : part.from, ltr ? \"before\" : \"after\"),\n \"line\", lineObj, preparedMeasure), x, y, true)\n }, 0, order.length - 1);\n var part = order[index];\n // If this isn't the first part, the part's start is also after\n // the coordinates, and the coordinates aren't on the same line as\n // that start, move one part back.\n if (index > 0) {\n var ltr = part.level != 1;\n var start = cursorCoords(cm, Pos(lineNo$$1, ltr ? part.from : part.to, ltr ? \"after\" : \"before\"),\n \"line\", lineObj, preparedMeasure);\n if (boxIsAfter(start, x, y, true) && start.top > y) {\n part = order[index - 1];\n }\n }\n return part\n }\n\n function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {\n // In a wrapped line, rtl text on wrapping boundaries can do things\n // that don't correspond to the ordering in our `order` array at\n // all, so a binary search doesn't work, and we want to return a\n // part that only spans one line so that the binary search in\n // coordsCharInner is safe. As such, we first find the extent of the\n // wrapped line, and then do a flat search in which we discard any\n // spans that aren't on the line.\n var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);\n var begin = ref.begin;\n var end = ref.end;\n if (/\\s/.test(lineObj.text.charAt(end - 1))) {\n end--;\n }\n var part = null, closestDist = null;\n for (var i = 0; i < order.length; i++) {\n var p = order[i];\n if (p.from >= end || p.to <= begin) {\n continue\n }\n var ltr = p.level != 1;\n var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;\n // Weigh against spans ending before this, so that they are only\n // picked if nothing ends after\n var dist = endX < x ? x - endX + 1e9 : endX - x;\n if (!part || closestDist > dist) {\n part = p;\n closestDist = dist;\n }\n }\n if (!part) {\n part = order[order.length - 1];\n }\n // Clip the part to the wrapped line.\n if (part.from < begin) {\n part = {from: begin, to: part.to, level: part.level};\n }\n if (part.to > end) {\n part = {from: part.from, to: end, level: part.level};\n }\n return part\n }\n\n var measureText;\n\n // Compute the default text height.\n function textHeight(display) {\n if (display.cachedTextHeight != null) {\n return display.cachedTextHeight\n }\n if (measureText == null) {\n measureText = elt(\"pre\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) {\n display.cachedTextHeight = height;\n }\n removeChildren(display.measure);\n return height || 1\n }\n\n // Compute the default character width.\n function charWidth(display) {\n if (display.cachedCharWidth != null) {\n return display.cachedCharWidth\n }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor]);\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) {\n display.cachedCharWidth = width;\n }\n return width || 10\n }\n\n // Do a bulk-read of the DOM positions and sizes needed to draw the\n // view, so that we don't interleave reading and writing to the DOM.\n function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n left[cm.options.gutters[i]] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[cm.options.gutters[i]] = n.clientWidth;\n }\n return {\n fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth\n }\n }\n\n // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n // but using getBoundingClientRect to get a sub-pixel-accurate\n // result.\n function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n }\n\n // Returns a function that estimates the height of a line, to use as\n // first approximation until the line becomes visible (and is thus\n // properly measurable).\n function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function(line) {\n if (lineIsHidden(cm.doc, line)) {\n return 0\n }\n\n var widgetsHeight = 0;\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) {\n widgetsHeight += line.widgets[i].height;\n }\n }\n }\n\n if (wrapping) {\n return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th\n } else {\n return widgetsHeight + th\n }\n }\n }\n\n function estimateLineHeights(cm) {\n var doc = cm.doc, est = estimateHeight(cm);\n doc.iter(function(line) {\n var estHeight = est(line);\n if (estHeight != line.height) {\n updateLineHeight(line, estHeight);\n }\n });\n }\n\n // Given a mouse event, find the corresponding position. If liberal\n // is false, it checks whether a gutter or scrollbar was clicked,\n // and returns null if it was. forRect is used by rectangular\n // selections, and tries to estimate a character position even for\n // coordinates beyond the right of the text.\n function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") {\n return null\n }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try {\n x = e.clientX - space.left;\n y = e.clientY - space.top;\n } catch (e) {\n return null\n }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel == 1 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }\n\n // Find the view element corresponding to a given line. Return null\n // when the line isn't visible.\n function findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) {\n return null\n }\n n -= cm.display.viewFrom;\n if (n < 0) {\n return null\n }\n var view = cm.display.view;\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n if (n < 0) {\n return i\n }\n }\n }\n\n function updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n }\n\n function prepareSelection(cm, primary) {\n if (primary === void 0) primary = true;\n\n var doc = cm.doc, result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (!primary && i == doc.sel.primIndex) {\n continue\n }\n var range$$1 = doc.sel.ranges[i];\n if (range$$1.from().line >= cm.display.viewTo || range$$1.to().line < cm.display.viewFrom) {\n continue\n }\n var collapsed = range$$1.empty();\n if (collapsed || cm.options.showCursorWhenSelecting) {\n drawSelectionCursor(cm, range$$1.head, curFragment);\n }\n if (!collapsed) {\n drawSelectionRange(cm, range$$1, selFragment);\n }\n }\n return result\n }\n\n // Draws a cursor for the given range\n function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }\n\n function cmpCoords(a, b) {\n return a.top - b.top || a.left - b.left\n }\n\n // Draws the given range as a highlighted selection\n function drawSelectionRange(cm, range$$1, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) {\n top = 0;\n }\n top = Math.round(top);\n bottom = Math.round(bottom);\n 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\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function(from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) {\n add(leftSide, fromPos.bottom, null, toPos.top);\n }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) {\n start = fromPos;\n }\n if (cmpCoords(toPos, start) < 0) {\n start = toPos;\n }\n if (!end || cmpCoords(fromPos, end) < 0) {\n end = fromPos;\n }\n if (cmpCoords(toPos, end) < 0) {\n end = toPos;\n }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range$$1.from(), sTo = range$$1.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top) {\n add(leftSide, leftEnd.bottom, null, rightStart.top);\n }\n }\n\n output.appendChild(fragment);\n }\n\n // Cursor-blinking\n function restartBlink(cm) {\n if (!cm.state.focused) {\n return\n }\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n if (cm.options.cursorBlinkRate > 0) {\n display.blinker = setInterval(function() {\n return display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n },\n cm.options.cursorBlinkRate);\n } else if (cm.options.cursorBlinkRate < 0) {\n display.cursorDiv.style.visibility = \"hidden\";\n }\n }\n\n function ensureFocus(cm) {\n if (!cm.state.focused) {\n cm.display.input.focus();\n onFocus(cm);\n }\n }\n\n function delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function() {\n if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n onBlur(cm);\n }\n }, 100);\n }\n\n function onFocus(cm, e) {\n if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n }\n\n if (cm.options.readOnly == \"nocursor\") {\n return\n }\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm, e);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\");\n // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n if (webkit) {\n setTimeout(function() {\n return cm.display.input.reset(true);\n }, 20);\n } // Issue #1730\n }\n cm.display.input.receivedFocus();\n }\n restartBlink(cm);\n }\n\n function onBlur(cm, e) {\n if (cm.state.delayingBlurEvent) {\n return\n }\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm, e);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n clearInterval(cm.display.blinker);\n setTimeout(function() {\n if (!cm.state.focused) {\n cm.display.shift = false;\n }\n }, 150);\n }\n\n // Read the actual heights of the rendered lines, and update their\n // stored heights to match.\n function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], height = (void 0);\n if (cur.hidden) {\n continue\n }\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n }\n var diff = cur.line.height - height;\n if (height < 2) {\n height = textHeight(display);\n }\n if (diff > .005 || diff < -.005) {\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) {\n for (var j = 0; j < cur.rest.length; j++) {\n updateWidgetHeight(cur.rest[j]);\n }\n }\n }\n }\n }\n\n // Read and store the height of line widgets associated with the\n // given line.\n function updateWidgetHeight(line) {\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) {\n w.height = parent.offsetHeight;\n }\n }\n }\n }\n\n // Compute the lines that are visible in a given viewport (defaults\n // the the current scroll position). viewport may contain top,\n // height, and ensure (see op.scrollToPos) properties.\n function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }\n\n // Re-align line numbers and gutter marks to compensate for\n // horizontal scrolling.\n function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) {\n return\n }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) {\n if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter) {\n view[i].gutter.style.left = left;\n }\n if (view[i].gutterBackground) {\n view[i].gutterBackground.style.left = left;\n }\n }\n var align = view[i].alignable;\n if (align) {\n for (var j = 0; j < align.length; j++) {\n align[j].style.left = left;\n }\n }\n }\n }\n if (cm.options.fixedGutter) {\n display.gutters.style.left = (comp + gutterW) + \"px\";\n }\n }\n\n // Used to ensure that the line number gutter is still the right\n // size for the current document size. Returns true when an update\n // is needed.\n function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) {\n return false\n }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm);\n return true\n }\n return false\n }\n\n // SCROLLING THINGS INTO VIEW\n\n // If an editor sits on the top or bottom of the window, partially\n // scrolled out of view, this ensures that the cursor is visible.\n function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) {\n return\n }\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n if (rect.top + box.top < 0) {\n doScroll = true;\n } else if (rect.bottom + box.top > (window.innerHeight || document.documentElement.clientHeight)) {\n doScroll = false;\n }\n if (doScroll != null && !phantom) {\n 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;\"));\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }\n\n // Scroll a given position into view (immediately), verifying that\n // it actually became visible (as line heights are accurately\n // measured, the position of something may 'drift' during drawing).\n function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) {\n margin = 0;\n }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {\n left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin\n };\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) {\n changed = true;\n }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) {\n changed = true;\n }\n }\n if (!changed) {\n break\n }\n }\n return rect\n }\n\n // Scroll a given set of coordinates into view (immediately).\n function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n }\n }\n\n // Calculate a new scroll position needed to scroll the given\n // rectangle into view. Returns an object with scrollTop and\n // scrollLeft properties. When these are undefined, the\n // vertical/horizontal position does not need to be adjusted.\n function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) {\n rect.top = 0;\n }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) {\n rect.bottom = rect.top + screen;\n }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) {\n result.scrollTop = newTop;\n }\n }\n\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft;\n var screenw = displayWidth(cm) - (cm.options.fixedGutter ? display.gutters.offsetWidth : 0);\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) {\n rect.right = rect.left + screenw;\n }\n if (rect.left < 10) {\n result.scrollLeft = 0;\n } else if (rect.left < screenleft) {\n result.scrollLeft = Math.max(0, rect.left - (tooWide ? 0 : 10));\n } else if (rect.right > screenw + screenleft - 3) {\n result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw;\n }\n return result\n }\n\n // Store a relative adjustment to the scroll position in the current\n // operation (to be applied when the operation finishes).\n function addToScrollTop(cm, top) {\n if (top == null) {\n return\n }\n resolveScrollToPos(cm);\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }\n\n // Make sure that at the end of the operation the current cursor is\n // shown.\n function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }\n\n function scrollToCoords(cm, x, y) {\n if (x != null || y != null) {\n resolveScrollToPos(cm);\n }\n if (x != null) {\n cm.curOp.scrollLeft = x;\n }\n if (y != null) {\n cm.curOp.scrollTop = y;\n }\n }\n\n function scrollToRange(cm, range$$1) {\n resolveScrollToPos(cm);\n cm.curOp.scrollToPos = range$$1;\n }\n\n // When an operation has its scrollToPos property set, and another\n // scroll action is applied before the end of the operation, this\n // 'simulates' scrolling that position into view in a cheap way, so\n // that the effect of intermediate scroll commands is not ignored.\n function resolveScrollToPos(cm) {\n var range$$1 = cm.curOp.scrollToPos;\n if (range$$1) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range$$1.from), to = estimateCoords(cm, range$$1.to);\n scrollToCoordsRange(cm, from, to, range$$1.margin);\n }\n }\n\n function scrollToCoordsRange(cm, from, to, margin) {\n var sPos = calculateScrollPos(cm, {\n left: Math.min(from.left, to.left),\n top: Math.min(from.top, to.top) - margin,\n right: Math.max(from.right, to.right),\n bottom: Math.max(from.bottom, to.bottom) + margin\n });\n scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);\n }\n\n // Sync the scrollable area and scrollbars, ensure the viewport\n // covers the visible area.\n function updateScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) {\n return\n }\n if (!gecko) {\n updateDisplaySimple(cm, {top: val});\n }\n setScrollTop(cm, val, true);\n if (gecko) {\n updateDisplaySimple(cm);\n }\n startWorker(cm, 100);\n }\n\n function setScrollTop(cm, val, forceScroll) {\n val = Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val);\n if (cm.display.scroller.scrollTop == val && !forceScroll) {\n return\n }\n cm.doc.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n if (cm.display.scroller.scrollTop != val) {\n cm.display.scroller.scrollTop = val;\n }\n }\n\n // Sync scroller and scrollbar, ensure the gutter elements are\n // aligned.\n function setScrollLeft(cm, val, isScroller, forceScroll) {\n val = Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth);\n if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) {\n return\n }\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n if (cm.display.scroller.scrollLeft != val) {\n cm.display.scroller.scrollLeft = val;\n }\n cm.display.scrollbars.setScrollLeft(val);\n }\n\n // SCROLLBARS\n\n // Prepare DOM reads needed to update the scrollbars. Done in one\n // shot to minimize update/measure roundtrips.\n function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n }\n }\n\n var NativeScrollbars = function(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n vert.tabIndex = horiz.tabIndex = -1;\n place(vert);\n place(horiz);\n\n on(vert, \"scroll\", function() {\n if (vert.clientHeight) {\n scroll(vert.scrollTop, \"vertical\");\n }\n });\n on(horiz, \"scroll\", function() {\n if (horiz.clientWidth) {\n scroll(horiz.scrollLeft, \"horizontal\");\n }\n });\n\n this.checkedZeroWidth = false;\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n if (ie && ie_version < 8) {\n this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\";\n }\n };\n\n NativeScrollbars.prototype.update = function(measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n // A bug in IE8 can cause this value to be negative, so guard it.\n this.vert.firstChild.style.height =\n Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width =\n Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) {\n this.zeroWidthHack();\n }\n this.checkedZeroWidth = true;\n }\n\n return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}\n };\n\n NativeScrollbars.prototype.setScrollLeft = function(pos) {\n if (this.horiz.scrollLeft != pos) {\n this.horiz.scrollLeft = pos;\n }\n if (this.disableHoriz) {\n this.enableZeroWidthBar(this.horiz, this.disableHoriz, \"horiz\");\n }\n };\n\n NativeScrollbars.prototype.setScrollTop = function(pos) {\n if (this.vert.scrollTop != pos) {\n this.vert.scrollTop = pos;\n }\n if (this.disableVert) {\n this.enableZeroWidthBar(this.vert, this.disableVert, \"vert\");\n }\n };\n\n NativeScrollbars.prototype.zeroWidthHack = function() {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.pointerEvents = this.vert.style.pointerEvents = \"none\";\n this.disableHoriz = new Delayed;\n this.disableVert = new Delayed;\n };\n\n NativeScrollbars.prototype.enableZeroWidthBar = function(bar, delay, type) {\n bar.style.pointerEvents = \"auto\";\n\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // right corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt$$1 = type == \"vert\" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)\n : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);\n if (elt$$1 != bar) {\n bar.style.pointerEvents = \"none\";\n } else {\n delay.set(1000, maybeDisable);\n }\n }\n\n delay.set(1000, maybeDisable);\n };\n\n NativeScrollbars.prototype.clear = function() {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n };\n\n var NullScrollbars = function() {\n };\n\n NullScrollbars.prototype.update = function() {\n return {bottom: 0, right: 0}\n };\n NullScrollbars.prototype.setScrollLeft = function() {\n };\n NullScrollbars.prototype.setScrollTop = function() {\n };\n NullScrollbars.prototype.clear = function() {\n };\n\n function updateScrollbars(cm, measure) {\n if (!measure) {\n measure = measureForScrollbars(cm);\n }\n var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping) {\n updateHeightsInViewport(cm);\n }\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth;\n startHeight = cm.display.barHeight;\n }\n }\n\n // Re-synchronize the fake scrollbars with the actual size of the\n // content.\n function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else {\n d.scrollbarFiller.style.display = \"\";\n }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else {\n d.gutterFiller.style.display = \"\";\n }\n }\n\n var scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\n function initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n if (cm.display.scrollbars.addClass) {\n rmClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n }\n }\n\n cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function(node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n // Prevent clicks in the scrollbars from killing focus\n on(node, \"mousedown\", function() {\n if (cm.state.focused) {\n setTimeout(function() {\n return cm.display.input.focus();\n }, 0);\n }\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function(pos, axis) {\n if (axis == \"horizontal\") {\n setScrollLeft(cm, pos);\n } else {\n updateScrollTop(cm, pos);\n }\n }, cm);\n if (cm.display.scrollbars.addClass) {\n addClass(cm.display.wrapper, cm.display.scrollbars.addClass);\n }\n }\n\n // Operations are used to wrap a series of changes to the editor\n // state in such a way that each change won't have to update the\n // cursor and display (which would be awkward, slow, and\n // error-prone). Instead, display updates are batched and then all\n // combined and executed at once.\n\n var nextOpId = 0;\n\n // Start a new operation.\n function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: null, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId // Unique ID\n };\n pushOperation(cm.curOp);\n }\n\n // Finish an operation, updating the display and signalling delayed events\n function endOperation(cm) {\n var op = cm.curOp;\n if (op) {\n finishOperation(op, function(group) {\n for (var i = 0; i < group.ops.length; i++) {\n group.ops[i].cm.curOp = null;\n }\n endOperations(group);\n });\n }\n }\n\n // The DOM updates done when an operation finishes are batched so\n // that the minimum number of relayouts are required.\n function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n {\n endOperation_R1(ops[i]);\n }\n for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)\n {\n endOperation_W1(ops[i$1]);\n }\n for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM\n {\n endOperation_R2(ops[i$2]);\n }\n for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)\n {\n endOperation_W2(ops[i$3]);\n }\n for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM\n {\n endOperation_finish(ops[i$4]);\n }\n }\n\n function endOperation_R1(op) {\n var cm = op.cm, display = cm.display;\n maybeClipScrollbars(cm);\n if (op.updateMaxLine) {\n findMaxLine(cm);\n }\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate &&\n new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n }\n\n function endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n }\n\n function endOperation_R2(op) {\n var cm = op.cm, display = cm.display;\n if (op.updatedDisplay) {\n updateHeightsInViewport(cm);\n }\n\n op.barMeasure = measureForScrollbars(cm);\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth =\n Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged) {\n op.preparedSelection = display.input.prepareSelection();\n }\n }\n\n function endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n if (op.maxScrollLeft < cm.doc.scrollLeft) {\n setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true);\n }\n cm.display.maxLineChanged = false;\n }\n\n var takeFocus = op.focus && op.focus == activeElt();\n if (op.preparedSelection) {\n cm.display.input.showSelection(op.preparedSelection, takeFocus);\n }\n if (op.updatedDisplay || op.startHeight != cm.doc.height) {\n updateScrollbars(cm, op.barMeasure);\n }\n if (op.updatedDisplay) {\n setDocumentHeight(cm, op.barMeasure);\n }\n\n if (op.selectionChanged) {\n restartBlink(cm);\n }\n\n if (cm.state.focused && op.updateInput) {\n cm.display.input.reset(op.typing);\n }\n if (takeFocus) {\n ensureFocus(op.cm);\n }\n }\n\n function endOperation_finish(op) {\n var cm = op.cm, display = cm.display, doc = cm.doc;\n\n if (op.updatedDisplay) {\n postUpdateDisplay(cm, op.update);\n }\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos)) {\n display.wheelStartX = display.wheelStartY = null;\n }\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null) {\n setScrollTop(cm, op.scrollTop, op.forceScroll);\n }\n\n if (op.scrollLeft != null) {\n setScrollLeft(cm, op.scrollLeft, true, true);\n }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n maybeScrollWindow(cm, rect);\n }\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) {\n for (var i = 0; i < hidden.length; ++i) {\n if (!hidden[i].lines.length) {\n signal(hidden[i], \"hide\");\n }\n }\n }\n if (unhidden) {\n for (var i$1 = 0; i$1 < unhidden.length; ++i$1) {\n if (unhidden[i$1].lines.length) {\n signal(unhidden[i$1], \"unhide\");\n }\n }\n }\n\n if (display.wrapper.offsetHeight) {\n doc.scrollTop = cm.display.scroller.scrollTop;\n }\n\n // Fire change events, and delayed event handlers\n if (op.changeObjs) {\n signal(cm, \"changes\", cm, op.changeObjs);\n }\n if (op.update) {\n op.update.finish();\n }\n }\n\n // Run the given function in an operation\n function runInOp(cm, f) {\n if (cm.curOp) {\n return f()\n }\n startOperation(cm);\n try {\n return f()\n } finally {\n endOperation(cm);\n }\n }\n\n // Wraps a function in an operation. Returns the wrapped function.\n function operation(cm, f) {\n return function() {\n if (cm.curOp) {\n return f.apply(cm, arguments)\n }\n startOperation(cm);\n try {\n return f.apply(cm, arguments)\n } finally {\n endOperation(cm);\n }\n }\n }\n\n // Used to add methods to editor and doc instances, wrapping them in\n // operations.\n function methodOp(f) {\n return function() {\n if (this.curOp) {\n return f.apply(this, arguments)\n }\n startOperation(this);\n try {\n return f.apply(this, arguments)\n } finally {\n endOperation(this);\n }\n }\n }\n\n function docMethodOp(f) {\n return function() {\n var cm = this.cm;\n if (!cm || cm.curOp) {\n return f.apply(this, arguments)\n }\n startOperation(cm);\n try {\n return f.apply(this, arguments)\n } finally {\n endOperation(cm);\n }\n }\n }\n\n // Updates the display.view data structure for a given change to the\n // document. From and to are in pre-change coordinates. Lendiff is\n // the amount of lines added or subtracted by the change. This is\n // used for changes that span multiple lines, or change the way\n // lines are divided into visual lines. regLineChange (below)\n // registers single-line changes.\n function regChange(cm, from, to, lendiff) {\n if (from == null) {\n from = cm.doc.first;\n }\n if (to == null) {\n to = cm.doc.first + cm.doc.size;\n }\n if (!lendiff) {\n lendiff = 0;\n }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from)) {\n display.updateLineNumbers = from;\n }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo) {\n resetView(cm);\n }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN) {\n ext.lineN += lendiff;\n } else if (from < ext.lineN + ext.size) {\n display.externalMeasured = null;\n }\n }\n }\n\n // Register a change to a single line. Type must be one of \"text\",\n // \"gutter\", \"class\", \"widget\"\n function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size) {\n display.externalMeasured = null;\n }\n\n if (line < display.viewFrom || line >= display.viewTo) {\n return\n }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) {\n return\n }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) {\n arr.push(type);\n }\n }\n\n // Clear the view.\n function resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n }\n\n function viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size) {\n return {index: index, lineN: newN}\n }\n var n = cm.display.viewFrom;\n for (var i = 0; i < index; i++) {\n n += view[i].size;\n }\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) {\n return null\n }\n diff = (n + view[index].size) - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n oldN += diff;\n newN += diff;\n }\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) {\n return null\n }\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n return {index: index, lineN: newN}\n }\n\n // Force the view to cover a given range, adding empty view element\n // or clipping off existing ones as needed.\n function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from) {\n display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view);\n } else if (display.viewFrom < from) {\n display.view = display.view.slice(findViewIndex(cm, from));\n }\n display.viewFrom = from;\n if (display.viewTo < to) {\n display.view = display.view.concat(buildViewArray(cm, display.viewTo, to));\n } else if (display.viewTo > to) {\n display.view = display.view.slice(0, findViewIndex(cm, to));\n }\n }\n display.viewTo = to;\n }\n\n // Count the number of lines in the view whose DOM representation is\n // out of date (or nonexistent).\n function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) {\n ++dirty;\n }\n }\n return dirty\n }\n\n // HIGHLIGHT WORKER\n\n function startWorker(cm, time) {\n if (cm.doc.highlightFrontier < cm.display.viewTo) {\n cm.state.highlight.set(time, bind(highlightWorker, cm));\n }\n }\n\n function highlightWorker(cm) {\n var doc = cm.doc;\n if (doc.highlightFrontier >= cm.display.viewTo) {\n return\n }\n var end = +new Date + cm.options.workTime;\n var context = getContextBefore(cm, doc.highlightFrontier);\n var changedLines = [];\n\n doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function(line) {\n if (context.line >= cm.display.viewFrom) { // Visible\n var oldStyles = line.styles;\n var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;\n var highlighted = highlightLine(cm, line, context, true);\n if (resetState) {\n context.state = resetState;\n }\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses, newCls = highlighted.classes;\n if (newCls) {\n line.styleClasses = newCls;\n } else if (oldCls) {\n line.styleClasses = null;\n }\n var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n for (var i = 0; !ischange && i < oldStyles.length; ++i) {\n ischange = oldStyles[i] != line.styles[i];\n }\n if (ischange) {\n changedLines.push(context.line);\n }\n line.stateAfter = context.save();\n context.nextLine();\n } else {\n if (line.text.length <= cm.options.maxHighlightLength) {\n processLine(cm, line.text, context);\n }\n line.stateAfter = context.line % 5 == 0 ? context.save() : null;\n context.nextLine();\n }\n if (+new Date > end) {\n startWorker(cm, cm.options.workDelay);\n return true\n }\n });\n doc.highlightFrontier = context.line;\n doc.modeFrontier = Math.max(doc.modeFrontier, context.line);\n if (changedLines.length) {\n runInOp(cm, function() {\n for (var i = 0; i < changedLines.length; i++) {\n regLineChange(cm, changedLines[i], \"text\");\n }\n });\n }\n }\n\n // DISPLAY DRAWING\n\n var DisplayUpdate = function(cm, viewport, force) {\n var display = cm.display;\n\n this.viewport = viewport;\n // Store some values that we'll need later (but don't want to force a relayout for)\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n };\n\n DisplayUpdate.prototype.signal = function(emitter, type) {\n if (hasHandler(emitter, type)) {\n this.events.push(arguments);\n }\n };\n DisplayUpdate.prototype.finish = function() {\n for (var i = 0; i < this.events.length; i++) {\n signal.apply(null, this.events[i]);\n }\n };\n\n function maybeClipScrollbars(cm) {\n var display = cm.display;\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n }\n\n function selectionSnapshot(cm) {\n if (cm.hasFocus()) {\n return null\n }\n var active = activeElt();\n if (!active || !contains(cm.display.lineDiv, active)) {\n return null\n }\n var result = {activeElt: active};\n if (window.getSelection) {\n var sel = window.getSelection();\n if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {\n result.anchorNode = sel.anchorNode;\n result.anchorOffset = sel.anchorOffset;\n result.focusNode = sel.focusNode;\n result.focusOffset = sel.focusOffset;\n }\n }\n return result\n }\n\n function restoreSelection(snapshot) {\n if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt()) {\n return\n }\n snapshot.activeElt.focus();\n if (snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {\n var sel = window.getSelection(), range$$1 = document.createRange();\n range$$1.setEnd(snapshot.anchorNode, snapshot.anchorOffset);\n range$$1.collapse(false);\n sel.removeAllRanges();\n sel.addRange(range$$1);\n sel.extend(snapshot.focusNode, snapshot.focusOffset);\n }\n }\n\n // Does the actual updating of the line display. Bails out\n // (returning false) when there is nothing to be done and forced is\n // false.\n function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0) {\n return false\n }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) {\n from = Math.max(doc.first, display.viewFrom);\n }\n if (display.viewTo > to && display.viewTo - to < 20) {\n to = Math.min(end, display.viewTo);\n }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo)) {\n return false\n }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"none\";\n }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) {\n display.lineDiv.style.display = \"\";\n }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }\n\n function postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true; ; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null) {\n viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)};\n }\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo) {\n break\n }\n }\n if (!updateDisplayIfNeeded(cm, update)) {\n break\n }\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.force = false;\n }\n\n update.signal(cm, \"update\", cm);\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom;\n cm.display.reportedViewTo = cm.display.viewTo;\n }\n }\n\n function updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n }\n\n // Sync the actual display DOM structure with display.view, removing\n // nodes for lines that are no longer in view, and creating the ones\n // that are not there yet, and updating the ones that are out of\n // date.\n function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node) {\n node.style.display = \"none\";\n } else {\n node.parentNode.removeChild(node);\n }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) {\n cur = rm(cur);\n }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) {\n updateNumber = false;\n }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) {\n cur = rm(cur);\n }\n }\n\n function updateGutterSpace(cm) {\n var width = cm.display.gutters.offsetWidth;\n cm.display.sizer.style.marginLeft = width + \"px\";\n }\n\n function setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n }\n\n // Rebuild the gutter elements, ensure the margin to the left of the\n // code matches their width.\n function updateGutters(cm) {\n var gutters = cm.display.gutters, specs = cm.options.gutters;\n removeChildren(gutters);\n var i = 0;\n for (; i < specs.length; ++i) {\n var gutterClass = specs[i];\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + gutterClass));\n if (gutterClass == \"CodeMirror-linenumbers\") {\n cm.display.lineGutter = gElt;\n gElt.style.width = (cm.display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = i ? \"\" : \"none\";\n updateGutterSpace(cm);\n }\n\n // Make sure the gutters options contains the element\n // \"CodeMirror-linenumbers\" when the lineNumbers option is true.\n function setGuttersForLineNumbers(options) {\n var found = indexOf(options.gutters, \"CodeMirror-linenumbers\");\n if (found == -1 && options.lineNumbers) {\n options.gutters = options.gutters.concat([\"CodeMirror-linenumbers\"]);\n } else if (found > -1 && !options.lineNumbers) {\n options.gutters = options.gutters.slice(0);\n options.gutters.splice(found, 1);\n }\n }\n\n // Since the delta values reported on mouse wheel events are\n // unstandardized between browsers and even browser versions, and\n // generally horribly unpredictable, this code starts by measuring\n // the scroll effect that the first few mouse wheel events have,\n // and, from that, detects the way it can convert deltas to pixel\n // offsets afterwards.\n //\n // The reason we want to know the amount a wheel event will scroll\n // is that it gives us a chance to update the display before the\n // actual scrolling happens, reducing flickering.\n\n var wheelSamples = 0, wheelPixelsPerUnit = null;\n // Fill in a browser-detected starting value on browsers where we\n // know one. These don't have to be accurate -- the result of them\n // being wrong would just be a slight flicker on the first wheel\n // scroll (if it is large enough).\n if (ie) {\n wheelPixelsPerUnit = -.53;\n } else if (gecko) {\n wheelPixelsPerUnit = 15;\n } else if (chrome) {\n wheelPixelsPerUnit = -.7;\n } else if (safari) {\n wheelPixelsPerUnit = -1 / 3;\n }\n\n function wheelEventDelta(e) {\n var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) {\n dx = e.detail;\n }\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) {\n dy = e.detail;\n } else if (dy == null) {\n dy = e.wheelDelta;\n }\n return {x: dx, y: dy}\n }\n\n function wheelEventPixels(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta\n }\n\n function onScrollWheel(cm, e) {\n var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n\n var display = cm.display, scroll = display.scroller;\n // Quit if there's nothing to scroll here\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n if (!(dx && canScrollX || dy && canScrollY)) {\n return\n }\n\n // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer\n }\n }\n }\n }\n\n // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n if (dx && !gecko && !presto && wheelPixelsPerUnit != null) {\n if (dy && canScrollY) {\n updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * wheelPixelsPerUnit));\n }\n setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * wheelPixelsPerUnit));\n // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n if (!dy || (dy && canScrollY)) {\n e_preventDefault(e);\n }\n display.wheelStartX = null; // Abort measurement, if in progress\n return\n }\n\n // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n if (dy && wheelPixelsPerUnit != null) {\n var pixels = dy * wheelPixelsPerUnit;\n var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n if (pixels < 0) {\n top = Math.max(0, top + pixels - 50);\n } else {\n bot = Math.min(cm.doc.height, bot + pixels + 50);\n }\n updateDisplaySimple(cm, {top: top, bottom: bot});\n }\n\n if (wheelSamples < 20) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft;\n display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx;\n display.wheelDY = dy;\n setTimeout(function() {\n if (display.wheelStartX == null) {\n return\n }\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n (movedX && display.wheelDX && movedX / display.wheelDX);\n display.wheelStartX = display.wheelStartY = null;\n if (!sample) {\n return\n }\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx;\n display.wheelDY += dy;\n }\n }\n }\n\n // Selection objects are immutable. A new one is created every time\n // the selection changes. A selection is one or more non-overlapping\n // (and non-touching) ranges, sorted, and an integer that indicates\n // which one is the primary selection (the one that's scrolled into\n // view, that getCursor returns, etc).\n var Selection = function(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n };\n\n Selection.prototype.primary = function() {\n return this.ranges[this.primIndex]\n };\n\n Selection.prototype.equals = function(other) {\n if (other == this) {\n return true\n }\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) {\n return false\n }\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this.ranges[i], there = other.ranges[i];\n if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) {\n return false\n }\n }\n return true\n };\n\n Selection.prototype.deepCopy = function() {\n var out = [];\n for (var i = 0; i < this.ranges.length; i++) {\n out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head));\n }\n return new Selection(out, this.primIndex)\n };\n\n Selection.prototype.somethingSelected = function() {\n for (var i = 0; i < this.ranges.length; i++) {\n if (!this.ranges[i].empty()) {\n return true\n }\n }\n return false\n };\n\n Selection.prototype.contains = function(pos, end) {\n if (!end) {\n end = pos;\n }\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this.ranges[i];\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0) {\n return i\n }\n }\n return -1\n };\n\n var Range = function(anchor, head) {\n this.anchor = anchor;\n this.head = head;\n };\n\n Range.prototype.from = function() {\n return minPos(this.anchor, this.head)\n };\n Range.prototype.to = function() {\n return maxPos(this.anchor, this.head)\n };\n Range.prototype.empty = function() {\n return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch\n };\n\n // Take an unsorted, potentially overlapping set of ranges, and\n // build a selection out of it. 'Consumes' ranges array (modifying\n // it).\n function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function(a, b) {\n return cmp(a.from(), b.from());\n });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) {\n --primIndex;\n }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }\n\n function simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0)\n }\n\n // Compute the position of the end of a change (its 'to' property\n // refers to the pre-change end).\n function changeEnd(change) {\n if (!change.text) {\n return change.to\n }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }\n\n // Adjust a position to refer to the post-change position of the\n // same text, or the end of the change if the change covers it.\n function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) {\n return pos\n }\n if (cmp(pos, change.to) <= 0) {\n return changeEnd(change)\n }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) {\n ch += changeEnd(change).ch - change.to.ch;\n }\n return Pos(line, ch)\n }\n\n function computeSelAfterChange(doc, change) {\n var out = [];\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change),\n adjustForChange(range.head, change)));\n }\n return normalizeSelection(doc.cm, out, doc.sel.primIndex)\n }\n\n function offsetPos(pos, old, nw) {\n if (pos.line == old.line) {\n return Pos(nw.line, pos.ch - old.ch + nw.ch)\n } else {\n return Pos(nw.line + (pos.line - old.line), pos.ch)\n }\n }\n\n // Used by replaceSelections to allow moving the selection to the\n // start or around the replaced test. Hint may be \"start\" or \"around\".\n function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex)\n }\n\n // Used to get the editor into a consistent state again when options change.\n\n function loadMode(cm) {\n cm.doc.mode = getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n }\n\n function resetModeState(cm) {\n cm.doc.iter(function(line) {\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n if (line.styles) {\n line.styles = null;\n }\n });\n cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n if (cm.curOp) {\n regChange(cm);\n }\n }\n\n // DOCUMENT DATA STRUCTURE\n\n // By default, updates that start and end at the beginning of a line\n // are treated specially, in order to make the association of line\n // widgets and marker elements with the text behave more intuitive.\n function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }\n\n // Perform a change on the document data structure.\n function updateDoc(doc, change, markedSpans, estimateHeight$$1) {\n function spansFor(n) {\n return markedSpans ? markedSpans[n] : null\n }\n\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight$$1);\n signalLater(line, \"change\", line, change);\n }\n\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i) {\n result.push(new Line(text[i], spansFor(i), estimateHeight$$1));\n }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) {\n doc.remove(from.line, nlines);\n }\n if (added.length) {\n doc.insert(from.line, added);\n }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight$$1));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) {\n doc.remove(from.line + 1, nlines - 1);\n }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }\n\n // Call f for all linked documents.\n function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) {\n for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) {\n continue\n }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) {\n continue\n }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n }\n }\n }\n\n propagate(doc, null, true);\n }\n\n // Attach a document to an editor.\n function attachDoc(cm, doc) {\n if (doc.cm) {\n throw new Error(\"This document is already in use.\")\n }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n if (!cm.options.lineWrapping) {\n findMaxLine(cm);\n }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }\n\n function setDirectionClass(cm) {\n (cm.doc.direction == \"rtl\" ? addClass : rmClass)(cm.display.lineDiv, \"CodeMirror-rtl\");\n }\n\n function directionChanged(cm) {\n runInOp(cm, function() {\n setDirectionClass(cm);\n regChange(cm);\n });\n }\n\n function History(startGen) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = [];\n this.undone = [];\n this.undoDepth = Infinity;\n // Used to track when changes can be merged into a single undo\n // event\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null;\n // Used by the isClean() method\n this.generation = this.maxGeneration = startGen || 1;\n }\n\n // Create a history change event from an updateDoc-style change\n // object.\n function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function(doc) {\n return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n }, true);\n return histChange\n }\n\n // Pop all selection events off the end of a history array. Stop at\n // a change event.\n function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) {\n array.pop();\n } else {\n break\n }\n }\n }\n\n // Find the top change event in the history. Pop off selection\n // events that are in the way.\n function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }\n\n // Register a change in the history. Merges changes that are within\n // a single operation, or are close together with an origin that\n // allows merging (starting with \"+\") into a single event.\n function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges) {\n pushSelectionToHistory(doc.sel, hist.done);\n }\n cur = {\n changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation\n };\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) {\n hist.done.shift();\n }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) {\n signal(doc, \"historyAdded\");\n }\n }\n\n function selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" ||\n ch == \"+\" &&\n prev.ranges.length == sel.ranges.length &&\n prev.somethingSelected() == sel.somethingSelected() &&\n new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)\n }\n\n // Called whenever the selection changes, sets the new selection as\n // the pending selection in the history, and pushes the old pending\n // selection into the 'done' array when it was significantly\n // different (in number of selected ranges, emptiness, or time).\n function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel)))) {\n hist.done[hist.done.length - 1] = sel;\n } else {\n pushSelectionToHistory(sel, hist.done);\n }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false) {\n clearSelectionEvents(hist.undone);\n }\n }\n\n function pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n if (!(top && top.ranges && top.equals(sel))) {\n dest.push(sel);\n }\n }\n\n // Used to store marked span information in the history.\n function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function(line) {\n if (line.markedSpans) {\n (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans;\n }\n ++n;\n });\n }\n\n // When un/re-doing restores text containing marked spans, those\n // that have been explicitly cleared should not be restored.\n function removeClearedSpans(spans) {\n if (!spans) {\n return null\n }\n var out;\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) {\n if (!out) {\n out = spans.slice(0, i);\n }\n } else if (out) {\n out.push(spans[i]);\n }\n }\n return !out ? spans : out.length ? out : null\n }\n\n // Retrieve and filter the old marked spans stored in a change event.\n function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) {\n return null\n }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i) {\n nw.push(removeClearedSpans(found[i]));\n }\n return nw\n }\n\n // Used for un/re-doing changes from the history. Combines the\n // result of computing the existing spans with the set of spans that\n // existed in the history (so that deleting around a span and then\n // undoing brings back the span).\n function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n if (!old) {\n return stretched\n }\n if (!stretched) {\n return old\n }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i], stretchCur = stretched[i];\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n for (var k = 0; k < oldCur.length; ++k) {\n if (oldCur[k].marker == span.marker) {\n continue spans\n }\n }\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n return old\n }\n\n // Used both to provide a JSON-safe object in .getHistory, and, when\n // detaching a document, to split the history in two\n function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m = (void 0);\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) {\n for (var prop in change) {\n if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n }\n }\n }\n }\n }\n return copy\n }\n\n // The 'scroll' parameter given to many of these indicated whether\n // the new cursor position should be scrolled into view after\n // modifying the selection.\n\n // If shift is held or the extend flag is set, extends a range to\n // include a given position (and optionally a second position).\n // Otherwise, simply returns the range between the given positions.\n // Used for cursor motion and such.\n function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }\n\n // Extend the primary selection range, discard the rest.\n function extendSelection(doc, head, other, options, extend) {\n if (extend == null) {\n extend = doc.cm && (doc.cm.display.shift || doc.extend);\n }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }\n\n // Extend all selections (pos is an array of selections with length\n // equal the number of selections)\n function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend);\n }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }\n\n // Updates a single range in the selection.\n function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }\n\n // Reset the selection to a single range.\n function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }\n\n // Give beforeSelectionChange handlers a change to influence a\n // selection update.\n function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++) {\n this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head));\n }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) {\n signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj);\n }\n if (obj.ranges != sel.ranges) {\n return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1)\n } else {\n return sel\n }\n }\n\n function setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done, last = lst(done);\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n }\n\n // Set a new selection.\n function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n }\n\n function setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\")) {\n sel = filterSelectionChange(doc, sel, options);\n }\n\n var bias = options && options.bias ||\n (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm) {\n ensureCursorVisible(doc.cm);\n }\n }\n\n function setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) {\n return\n }\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n signalLater(doc, \"cursorActivity\", doc);\n }\n\n // Verify that the selection does not partially select any atomic\n // marked ranges.\n function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n }\n\n // Return a selection that does not partially select any atomic\n // ranges.\n function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) {\n out = sel.ranges.slice(0, i);\n }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }\n\n function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n if (line.markedSpans) {\n for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i], m = sp.marker;\n if ((sp.from == null || (m.inclusiveLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n (sp.to == null || (m.inclusiveRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n if (m.explicitlyCleared) {\n if (!line.markedSpans) {\n break\n } else {\n --i;\n continue\n }\n }\n }\n if (!m.atomic) {\n continue\n }\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);\n if (dir < 0 ? m.inclusiveRight : m.inclusiveLeft) {\n near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null);\n }\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0)) {\n return skipAtomicInner(doc, near, pos, dir, mayClear)\n }\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n if (dir < 0 ? m.inclusiveLeft : m.inclusiveRight) {\n far = movePos(doc, far, dir, far.line == pos.line ? line : null);\n }\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null\n }\n }\n }\n return pos\n }\n\n // Ensure a given position is not inside an atomic range.\n function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0)\n }\n return found\n }\n\n function movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) {\n return clipPos(doc, Pos(pos.line - 1))\n } else {\n return null\n }\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) {\n return Pos(pos.line + 1, 0)\n } else {\n return null\n }\n } else {\n return new Pos(pos.line, pos.ch + dir)\n }\n }\n\n function selectAll(cm) {\n cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);\n }\n\n // UPDATING\n\n // Allow \"beforeChange\" event handlers to influence a change\n function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function() {\n return obj.canceled = true;\n }\n };\n if (update) {\n obj.update = function(from, to, text, origin) {\n if (from) {\n obj.from = clipPos(doc, from);\n }\n if (to) {\n obj.to = clipPos(doc, to);\n }\n if (text) {\n obj.text = text;\n }\n if (origin !== undefined) {\n obj.origin = origin;\n }\n };\n }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) {\n signal(doc.cm, \"beforeChange\", doc.cm, obj);\n }\n\n if (obj.canceled) {\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }\n\n // Apply a change to a document, and add it to the document's\n // history, and propagating it to all linked documents.\n function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) {\n return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly)\n }\n if (doc.cm.state.suppressEdits) {\n return\n }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) {\n return\n }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i) {\n makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text, origin: change.origin});\n }\n } else {\n makeChangeInner(doc, change);\n }\n }\n\n function makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) {\n return\n }\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n\n linkedDocs(doc, function(doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n }\n\n // Revert a change stored in a document's history.\n function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !allowSelectionOnly) {\n return\n }\n\n var hist = doc.history, event, selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n var i = 0;\n for (; i < source.length; i++) {\n event = source[i];\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges) {\n break\n }\n }\n if (i == source.length) {\n return\n }\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (; ;) {\n event = source.pop();\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false});\n return\n }\n selAfter = event;\n } else if (suppress) {\n source.push(event);\n return\n } else {\n break\n }\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({changes: antiChanges, generation: hist.generation});\n hist.generation = event.generation || ++hist.maxGeneration;\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n var loop = function(i) {\n var change = event.changes[i];\n change.origin = type;\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return {}\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n if (!i && doc.cm) {\n doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)});\n }\n var rebased = [];\n\n // Propagate to the linked documents\n linkedDocs(doc, function(doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop(i$1);\n\n if (returned) return returned.v;\n }\n }\n\n // Sub-views need their line numbers shifted when text is added\n // above or below them in the parent document.\n function shiftDoc(doc, distance) {\n if (distance == 0) {\n return\n }\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function(range) {\n return new Range(\n Pos(range.anchor.line + distance, range.anchor.ch),\n Pos(range.head.line + distance, range.head.ch)\n );\n }), doc.sel.primIndex);\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++) {\n regLineChange(doc.cm, l, \"gutter\");\n }\n }\n }\n\n // More lower-level change function, handling only a single document\n // (not linked ones).\n function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp) {\n return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans)\n }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) {\n return\n }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {\n from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin\n };\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {\n from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin\n };\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) {\n selAfter = computeSelAfterChange(doc, change);\n }\n if (doc.cm) {\n makeChangeSingleDocInEditor(doc.cm, change, spans);\n } else {\n updateDoc(doc, change, spans);\n }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n }\n\n // Handle the interaction of a change to a document with the editor\n // that this document is part of.\n function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function(line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1) {\n signalCursorActivity(cm);\n }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function(line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) {\n cm.curOp.updateMaxLine = true;\n }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full) {\n regChange(cm);\n } else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change)) {\n regLineChange(cm, from.line, \"text\");\n } else {\n regChange(cm, from.line, to.line + 1, lendiff);\n }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) {\n signalLater(cm, \"change\", cm, obj);\n }\n if (changesHandler) {\n (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj);\n }\n }\n cm.display.selForContextMenu = null;\n }\n\n function replaceRange(doc, code, from, to, origin) {\n var assign;\n\n if (!to) {\n to = from;\n }\n if (cmp(to, from) < 0) {\n (assign = [to, from], from = assign[0], to = assign[1]);\n }\n if (typeof code == \"string\") {\n code = doc.splitLines(code);\n }\n makeChange(doc, {from: from, to: to, text: code, origin: origin});\n }\n\n // Rebasing/resetting history to deal with externally-sourced changes\n\n function rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n }\n\n // Tries to rebase an array of history events given a change in the\n // document. If the change touches the same lines as the event, the\n // event, and everything 'behind' it, is discarded. If the change is\n // before the event, the event's positions are updated. Uses a\n // copy-on-write scheme for the positions, to avoid having to\n // reallocate them all on every rebase, but also avoid problems with\n // shared position objects being unsafely updated.\n function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) {\n sub = array[i] = sub.deepCopy();\n sub.copied = true;\n }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }\n\n function rebaseHist(hist, change) {\n var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n }\n\n // Utility for applying a change to a line by handle or number,\n // returning the number and optionally registering the line as\n // changed.\n function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") {\n line = getLine(doc, clipLine(doc, handle));\n } else {\n no = lineNo(handle);\n }\n if (no == null) {\n return null\n }\n if (op(line, no) && doc.cm) {\n regLineChange(doc.cm, no, changeType);\n }\n return line\n }\n\n // The document is represented as a BTree consisting of leaves, with\n // chunk of lines in them, and branches, with up to ten leaves or\n // other branch nodes below them. The top node is always a branch\n // node, and is the document object itself (meaning it has\n // additional methods and properties).\n //\n // All nodes have parent links. The tree is used both to go from\n // line numbers to line objects, and to go from objects to numbers.\n // It also indexes by height, and is used to convert between height\n // and line object, and to find the total height of the document.\n //\n // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }\n\n LeafChunk.prototype = {\n chunkSize: function() {\n return this.lines.length\n },\n\n // Remove the n lines at offset 'at'.\n removeInner: function(at, n) {\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this.lines[i];\n this.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n this.lines.splice(at, n);\n },\n\n // Helper used to collapse a small branch into a single leaf.\n collapse: function(lines) {\n lines.push.apply(lines, this.lines);\n },\n\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function(at, lines, height) {\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n }\n },\n\n // Used to iterate over a part of the tree.\n iterN: function(at, n, op) {\n for (var e = at + n; at < e; ++at) {\n if (op(this.lines[at])) {\n return true\n }\n }\n }\n };\n\n function BranchChunk(children) {\n this.children = children;\n var size = 0, height = 0;\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize();\n height += ch.height;\n ch.parent = this;\n }\n this.size = size;\n this.height = height;\n this.parent = null;\n }\n\n BranchChunk.prototype = {\n chunkSize: function() {\n return this.size\n },\n\n removeInner: function(at, n) {\n this.size -= n;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var rm = Math.min(n, sz - at), oldHeight = child.height;\n child.removeInner(at, rm);\n this.height -= oldHeight - child.height;\n if (sz == rm) {\n this.children.splice(i--, 1);\n child.parent = null;\n }\n if ((n -= rm) == 0) {\n break\n }\n at = 0;\n } else {\n at -= sz;\n }\n }\n // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n if (this.size - n < 25 &&\n (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n\n collapse: function(lines) {\n for (var i = 0; i < this.children.length; ++i) {\n this.children[i].collapse(lines);\n }\n },\n\n insertInner: function(at, lines, height) {\n this.size += lines.length;\n this.height += height;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at <= sz) {\n child.insertInner(at, lines, height);\n if (child.lines && child.lines.length > 50) {\n // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n var remaining = child.lines.length % 25 + 25;\n for (var pos = remaining; pos < child.lines.length;) {\n var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n child.height -= leaf.height;\n this.children.splice(++i, 0, leaf);\n leaf.parent = this;\n }\n child.lines = child.lines.slice(0, remaining);\n this.maybeSpill();\n }\n break\n }\n at -= sz;\n }\n },\n\n // When a node has grown, check whether it should be split.\n maybeSpill: function() {\n if (this.children.length <= 10) {\n return\n }\n var me = this;\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n if (!me.parent) { // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n sibling.parent = me.parent;\n } while (me.children.length > 10)\n me.parent.maybeSpill();\n },\n\n iterN: function(at, n, op) {\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var used = Math.min(n, sz - at);\n if (child.iterN(at, used, op)) {\n return true\n }\n if ((n -= used) == 0) {\n break\n }\n at = 0;\n } else {\n at -= sz;\n }\n }\n }\n };\n\n // Line widgets are block elements displayed above or below a line.\n\n var LineWidget = function(doc, node, options) {\n if (options) {\n for (var opt in options) {\n if (options.hasOwnProperty(opt)) {\n this[opt] = options[opt];\n }\n }\n }\n this.doc = doc;\n this.node = node;\n };\n\n LineWidget.prototype.clear = function() {\n var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n if (no == null || !ws) {\n return\n }\n for (var i = 0; i < ws.length; ++i) {\n if (ws[i] == this) {\n ws.splice(i--, 1);\n }\n }\n if (!ws.length) {\n line.widgets = null;\n }\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n if (cm) {\n runInOp(cm, function() {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n signalLater(cm, \"lineWidgetCleared\", cm, this, no);\n }\n };\n\n LineWidget.prototype.changed = function() {\n var this$1 = this;\n\n var oldH = this.height, cm = this.doc.cm, line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n if (!diff) {\n return\n }\n if (!lineIsHidden(this.doc, line)) {\n updateLineHeight(line, line.height + diff);\n }\n if (cm) {\n runInOp(cm, function() {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n signalLater(cm, \"lineWidgetChanged\", cm, this$1, lineNo(line));\n });\n }\n };\n eventMixin(LineWidget);\n\n function adjustScrollWhenAboveVisible(cm, line, diff) {\n if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop)) {\n addToScrollTop(cm, diff);\n }\n }\n\n function addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n if (cm && widget.noHScroll) {\n cm.display.alignWidgets = true;\n }\n changeLine(doc, handle, \"widget\", function(line) {\n var widgets = line.widgets || (line.widgets = []);\n if (widget.insertAt == null) {\n widgets.push(widget);\n } else {\n widgets.splice(Math.min(widgets.length - 1, Math.max(0, widget.insertAt)), 0, widget);\n }\n widget.line = line;\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n if (aboveVisible) {\n addToScrollTop(cm, widget.height);\n }\n cm.curOp.forceUpdate = true;\n }\n return true\n });\n if (cm) {\n signalLater(cm, \"lineWidgetAdded\", cm, widget, typeof handle == \"number\" ? handle : lineNo(handle));\n }\n return widget\n }\n\n // TEXTMARKERS\n\n // Created with markText and setBookmark methods. A TextMarker is a\n // handle that can be used to clear or find a marked position in the\n // document. Line objects hold arrays (markedSpans) containing\n // {from, to, marker} object pointing to such marker objects, and\n // indicating that such a marker is present on that line. Multiple\n // lines may point to the same marker when it spans across lines.\n // The spans will have null for their from/to properties when the\n // marker continues beyond the start/end of the line. Markers have\n // links back to the lines they currently touch.\n\n // Collapsed markers have unique ids, in order to be able to order\n // them, which is needed for uniquely determining an outer marker\n // when they overlap (they may nest, but not partially overlap).\n var nextMarkerId = 0;\n\n var TextMarker = function(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n };\n\n // Clear the marker.\n TextMarker.prototype.clear = function() {\n if (this.explicitlyCleared) {\n return\n }\n var cm = this.doc.cm, withOp = cm && !cm.curOp;\n if (withOp) {\n startOperation(cm);\n }\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n if (found) {\n signalLater(this, \"clear\", found.from, found.to);\n }\n }\n var min = null, max = null;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (cm && !this.collapsed) {\n regLineChange(cm, lineNo(line), \"text\");\n } else if (cm) {\n if (span.to != null) {\n max = lineNo(line);\n }\n if (span.from != null) {\n min = lineNo(line);\n }\n }\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm) {\n updateLineHeight(line, textHeight(cm.display));\n }\n }\n if (cm && this.collapsed && !cm.options.lineWrapping) {\n for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {\n var visual = visualLine(this.lines[i$1]), len = lineLength(visual);\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n }\n }\n\n if (min != null && cm && this.collapsed) {\n regChange(cm, min, max + 1);\n }\n this.lines.length = 0;\n this.explicitlyCleared = true;\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n if (cm) {\n reCheckSelection(cm.doc);\n }\n }\n if (cm) {\n signalLater(cm, \"markerCleared\", cm, this, min, max);\n }\n if (withOp) {\n endOperation(cm);\n }\n if (this.parent) {\n this.parent.clear();\n }\n };\n\n // Find the position of the marker in the document. Returns a {from,\n // to} object by default. Side can be passed to get a specific side\n // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n // Pos objects returned contain a line object, rather than a line\n // number (used to prevent looking up the same line twice).\n TextMarker.prototype.find = function(side, lineObj) {\n if (side == null && this.type == \"bookmark\") {\n side = 1;\n }\n var from, to;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n if (side == -1) {\n return from\n }\n }\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n if (side == 1) {\n return to\n }\n }\n }\n return from && {from: from, to: to}\n };\n\n // Signals that the marker's widget changed, and surrounding layout\n // should be recomputed.\n TextMarker.prototype.changed = function() {\n var this$1 = this;\n\n var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n if (!pos || !cm) {\n return\n }\n runInOp(cm, function() {\n var line = pos.line, lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n cm.curOp.updateMaxLine = true;\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n if (dHeight) {\n updateLineHeight(line, line.height + dHeight);\n }\n }\n signalLater(cm, \"markerChanged\", cm, this$1);\n });\n };\n\n TextMarker.prototype.attachLine = function(line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1) {\n (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this);\n }\n }\n this.lines.push(line);\n };\n\n TextMarker.prototype.detachLine = function(line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp\n ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n };\n eventMixin(TextMarker);\n\n // Create a marker, wire it up to the right lines, and\n function markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) {\n return markTextShared(doc, from, to, options, type)\n }\n // Ensure we are in an operation.\n if (doc.cm && !doc.cm.curOp) {\n return operation(doc.cm, markText)(doc, from, to, options, type)\n }\n\n var marker = new TextMarker(doc, type), diff = cmp(from, to);\n if (options) {\n copyObj(options, marker, false);\n }\n // Don't connect empty markers unless clearWhenEmpty is false\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false) {\n return marker\n }\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = eltP(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n if (!options.handleMouseEvents) {\n marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\");\n }\n if (options.insertLeft) {\n marker.widgetNode.insertLeft = true;\n }\n }\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker)) {\n throw new Error(\"Inserting collapsed marker partially overlapping an existing one\")\n }\n seeCollapsedSpans();\n }\n\n if (marker.addToHistory) {\n addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN);\n }\n\n var curLine = from.line, cm = doc.cm, updateMaxLine;\n doc.iter(curLine, to.line + 1, function(line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine) {\n updateMaxLine = true;\n }\n if (marker.collapsed && curLine != from.line) {\n updateLineHeight(line, 0);\n }\n addMarkedSpan(line, new MarkedSpan(marker,\n curLine == from.line ? from.ch : null,\n curLine == to.line ? to.ch : null));\n ++curLine;\n });\n // lineIsHidden depends on the presence of the spans, so needs a second pass\n if (marker.collapsed) {\n doc.iter(from.line, to.line + 1, function(line) {\n if (lineIsHidden(doc, line)) {\n updateLineHeight(line, 0);\n }\n });\n }\n\n if (marker.clearOnEnter) {\n on(marker, \"beforeCursorEnter\", function() {\n return marker.clear();\n });\n }\n\n if (marker.readOnly) {\n seeReadOnlySpans();\n if (doc.history.done.length || doc.history.undone.length) {\n doc.clearHistory();\n }\n }\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n if (cm) {\n // Sync editor state\n if (updateMaxLine) {\n cm.curOp.updateMaxLine = true;\n }\n if (marker.collapsed) {\n regChange(cm, from.line, to.line + 1);\n } else if (marker.className || marker.title || marker.startStyle || marker.endStyle || marker.css) {\n for (var i = from.line; i <= to.line; i++) {\n regLineChange(cm, i, \"text\");\n }\n }\n if (marker.atomic) {\n reCheckSelection(cm.doc);\n }\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n return marker\n }\n\n // SHARED TEXTMARKERS\n\n // A shared marker spans multiple linked documents. It is\n // implemented as a meta-marker-object controlling multiple normal\n // markers.\n var SharedTextMarker = function(markers, primary) {\n this.markers = markers;\n this.primary = primary;\n for (var i = 0; i < markers.length; ++i) {\n markers[i].parent = this;\n }\n };\n\n SharedTextMarker.prototype.clear = function() {\n if (this.explicitlyCleared) {\n return\n }\n this.explicitlyCleared = true;\n for (var i = 0; i < this.markers.length; ++i) {\n this.markers[i].clear();\n }\n signalLater(this, \"clear\");\n };\n\n SharedTextMarker.prototype.find = function(side, lineObj) {\n return this.primary.find(side, lineObj)\n };\n eventMixin(SharedTextMarker);\n\n function markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function(doc) {\n if (widget) {\n options.widgetNode = widget.cloneNode(true);\n }\n markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n for (var i = 0; i < doc.linked.length; ++i) {\n if (doc.linked[i].isParent) {\n return\n }\n }\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary)\n }\n\n function findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function(m) {\n return m.parent;\n })\n }\n\n function copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], pos = marker.find();\n var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n if (cmp(mFrom, mTo)) {\n var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n }\n\n function detachSharedMarkers(markers) {\n var loop = function(i) {\n var marker = markers[i], linked = [marker.primary.doc];\n linkedDocs(marker.primary.doc, function(d) {\n return linked.push(d);\n });\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n };\n\n for (var i = 0; i < markers.length; i++) loop(i);\n }\n\n var nextDocId = 0;\n var Doc = function(text, mode, firstLine, lineSep, direction) {\n if (!(this instanceof Doc)) {\n return new Doc(text, mode, firstLine, lineSep, direction)\n }\n if (firstLine == null) {\n firstLine = 0;\n }\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.modeFrontier = this.highlightFrontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.direction = (direction == \"rtl\") ? \"rtl\" : \"ltr\";\n this.extend = false;\n\n if (typeof text == \"string\") {\n text = this.splitLines(text);\n }\n updateDoc(this, {from: start, to: start, text: text});\n setSelection(this, simpleSelection(start), sel_dontScroll);\n };\n\n Doc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function(from, to, op) {\n if (op) {\n this.iterN(from - this.first, to - from, op);\n } else {\n this.iterN(this.first, this.first + this.size, from);\n }\n },\n\n // Non-public interface for adding and removing lines.\n insert: function(at, lines) {\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n height += lines[i].height;\n }\n this.insertInner(at - this.first, lines, height);\n },\n remove: function(at, n) {\n this.removeInner(at - this.first, n);\n },\n\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n\n getValue: function(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n if (lineSep === false) {\n return lines\n }\n return lines.join(lineSep || this.lineSeparator())\n },\n setValue: docMethodOp(function(code) {\n var top = Pos(this.first, 0), last = this.first + this.size - 1;\n makeChange(this, {\n from: top, to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code), origin: \"setValue\", full: true\n }, true);\n if (this.cm) {\n scrollToCoords(this.cm, 0, 0);\n }\n setSelection(this, simpleSelection(top), sel_dontScroll);\n }),\n replaceRange: function(code, from, to, origin) {\n from = clipPos(this, from);\n to = to ? clipPos(this, to) : from;\n replaceRange(this, code, from, to, origin);\n },\n getRange: function(from, to, lineSep) {\n var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n if (lineSep === false) {\n return lines\n }\n return lines.join(lineSep || this.lineSeparator())\n },\n\n getLine: function(line) {\n var l = this.getLineHandle(line);\n return l && l.text\n },\n\n getLineHandle: function(line) {\n if (isLine(this, line)) {\n return getLine(this, line)\n }\n },\n getLineNumber: function(line) {\n return lineNo(line)\n },\n\n getLineHandleVisualStart: function(line) {\n if (typeof line == \"number\") {\n line = getLine(this, line);\n }\n return visualLine(line)\n },\n\n lineCount: function() {\n return this.size\n },\n firstLine: function() {\n return this.first\n },\n lastLine: function() {\n return this.first + this.size - 1\n },\n\n clipPos: function(pos) {\n return clipPos(this, pos)\n },\n\n getCursor: function(start) {\n var range$$1 = this.sel.primary(), pos;\n if (start == null || start == \"head\") {\n pos = range$$1.head;\n } else if (start == \"anchor\") {\n pos = range$$1.anchor;\n } else if (start == \"end\" || start == \"to\" || start === false) {\n pos = range$$1.to();\n } else {\n pos = range$$1.from();\n }\n return pos\n },\n listSelections: function() {\n return this.sel.ranges\n },\n somethingSelected: function() {\n return this.sel.somethingSelected()\n },\n\n setCursor: docMethodOp(function(line, ch, options) {\n setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function(anchor, head, options) {\n setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function(head, other, options) {\n extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function(heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function(f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function(ranges, primary, options) {\n if (!ranges.length) {\n return\n }\n var out = [];\n for (var i = 0; i < ranges.length; i++) {\n out[i] = new Range(clipPos(this, ranges[i].anchor),\n clipPos(this, ranges[i].head));\n }\n if (primary == null) {\n primary = Math.min(ranges.length - 1, this.sel.primIndex);\n }\n setSelection(this, normalizeSelection(this.cm, out, primary), options);\n }),\n addSelection: docMethodOp(function(anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);\n }),\n\n getSelection: function(lineSep) {\n var ranges = this.sel.ranges, lines;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n if (lineSep === false) {\n return lines\n } else {\n return lines.join(lineSep || this.lineSeparator())\n }\n },\n getSelections: function(lineSep) {\n var parts = [], ranges = this.sel.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n if (lineSep !== false) {\n sel = sel.join(lineSep || this.lineSeparator());\n }\n parts[i] = sel;\n }\n return parts\n },\n replaceSelection: function(code, collapse, origin) {\n var dup = [];\n for (var i = 0; i < this.sel.ranges.length; i++) {\n dup[i] = code;\n }\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function(code, collapse, origin) {\n var changes = [], sel = this.sel;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range$$1 = sel.ranges[i];\n changes[i] = {from: range$$1.from(), to: range$$1.to(), text: this.splitLines(code[i]), origin: origin};\n }\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n for (var i$1 = changes.length - 1; i$1 >= 0; i$1--) {\n makeChange(this, changes[i$1]);\n }\n if (newSel) {\n setSelectionReplaceHistory(this, newSel);\n } else if (this.cm) {\n ensureCursorVisible(this.cm);\n }\n }),\n undo: docMethodOp(function() {\n makeChangeFromHistory(this, \"undo\");\n }),\n redo: docMethodOp(function() {\n makeChangeFromHistory(this, \"redo\");\n }),\n undoSelection: docMethodOp(function() {\n makeChangeFromHistory(this, \"undo\", true);\n }),\n redoSelection: docMethodOp(function() {\n makeChangeFromHistory(this, \"redo\", true);\n }),\n\n setExtending: function(val) {\n this.extend = val;\n },\n getExtending: function() {\n return this.extend\n },\n\n historySize: function() {\n var hist = this.history, done = 0, undone = 0;\n for (var i = 0; i < hist.done.length; i++) {\n if (!hist.done[i].ranges) {\n ++done;\n }\n }\n for (var i$1 = 0; i$1 < hist.undone.length; i$1++) {\n if (!hist.undone[i$1].ranges) {\n ++undone;\n }\n }\n return {undo: done, redo: undone}\n },\n clearHistory: function() {\n this.history = new History(this.history.maxGeneration);\n },\n\n markClean: function() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function(forceSplit) {\n if (forceSplit) {\n this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null;\n }\n return this.history.generation\n },\n isClean: function(gen) {\n return this.history.generation == (gen || this.cleanGeneration)\n },\n\n getHistory: function() {\n return {\n done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)\n }\n },\n setHistory: function(histData) {\n var hist = this.history = new History(this.history.maxGeneration);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n\n setGutterMarker: docMethodOp(function(line, gutterID, value) {\n return changeLine(this, line, \"gutter\", function(line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n if (!value && isEmpty(markers)) {\n line.gutterMarkers = null;\n }\n return true\n })\n }),\n\n clearGutter: docMethodOp(function(gutterID) {\n var this$1 = this;\n\n this.iter(function(line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n changeLine(this$1, line, \"gutter\", function() {\n line.gutterMarkers[gutterID] = null;\n if (isEmpty(line.gutterMarkers)) {\n line.gutterMarkers = null;\n }\n return true\n });\n }\n });\n }),\n\n lineInfo: function(line) {\n var n;\n if (typeof line == \"number\") {\n if (!isLine(this, line)) {\n return null\n }\n n = line;\n line = getLine(this, line);\n if (!line) {\n return null\n }\n } else {\n n = lineNo(line);\n if (n == null) {\n return null\n }\n }\n return {\n line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n widgets: line.widgets\n }\n },\n\n addLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n if (!line[prop]) {\n line[prop] = cls;\n } else if (classTest(cls).test(line[prop])) {\n return false\n } else {\n line[prop] += \" \" + cls;\n }\n return true\n })\n }),\n removeLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function(line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n if (!cur) {\n return false\n } else if (cls == null) {\n line[prop] = null;\n } else {\n var found = cur.match(classTest(cls));\n if (!found) {\n return false\n }\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n return true\n })\n }),\n\n addLineWidget: docMethodOp(function(handle, node, options) {\n return addLineWidget(this, handle, node, options)\n }),\n removeLineWidget: function(widget) {\n widget.clear();\n },\n\n markText: function(from, to, options) {\n return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\")\n },\n setBookmark: function(pos, options) {\n var realOpts = {\n replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false, shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents\n };\n pos = clipPos(this, pos);\n return markText(this, pos, pos, realOpts, \"bookmark\")\n },\n findMarksAt: function(pos) {\n pos = clipPos(this, pos);\n var markers = [], spans = getLine(this, pos.line).markedSpans;\n if (spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if ((span.from == null || span.from <= pos.ch) &&\n (span.to == null || span.to >= pos.ch)) {\n markers.push(span.marker.parent || span.marker);\n }\n }\n }\n return markers\n },\n findMarks: function(from, to, filter) {\n from = clipPos(this, from);\n to = clipPos(this, to);\n var found = [], lineNo$$1 = from.line;\n this.iter(from.line, to.line + 1, function(line) {\n var spans = line.markedSpans;\n if (spans) {\n for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n if (!(span.to != null && lineNo$$1 == from.line && from.ch >= span.to ||\n span.from == null && lineNo$$1 != from.line ||\n span.from != null && lineNo$$1 == to.line && span.from >= to.ch) &&\n (!filter || filter(span.marker))) {\n found.push(span.marker.parent || span.marker);\n }\n }\n }\n ++lineNo$$1;\n });\n return found\n },\n getAllMarks: function() {\n var markers = [];\n this.iter(function(line) {\n var sps = line.markedSpans;\n if (sps) {\n for (var i = 0; i < sps.length; ++i) {\n if (sps[i].from != null) {\n markers.push(sps[i].marker);\n }\n }\n }\n });\n return markers\n },\n\n posFromIndex: function(off) {\n var ch, lineNo$$1 = this.first, sepSize = this.lineSeparator().length;\n this.iter(function(line) {\n var sz = line.text.length + sepSize;\n if (sz > off) {\n ch = off;\n return true\n }\n off -= sz;\n ++lineNo$$1;\n });\n return clipPos(this, Pos(lineNo$$1, ch))\n },\n indexFromPos: function(coords) {\n coords = clipPos(this, coords);\n var index = coords.ch;\n if (coords.line < this.first || coords.ch < 0) {\n return 0\n }\n var sepSize = this.lineSeparator().length;\n this.iter(this.first, coords.line, function(line) { // iter aborts when callback returns a truthy value\n index += line.text.length + sepSize;\n });\n return index\n },\n\n copy: function(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size),\n this.modeOption, this.first, this.lineSep, this.direction);\n doc.scrollTop = this.scrollTop;\n doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n return doc\n },\n\n linkedDoc: function(options) {\n if (!options) {\n options = {};\n }\n var from = this.first, to = this.first + this.size;\n if (options.from != null && options.from > from) {\n from = options.from;\n }\n if (options.to != null && options.to < to) {\n to = options.to;\n }\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);\n if (options.sharedHist) {\n copy.history = this.history\n ;\n }\n (this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy\n },\n unlinkDoc: function(other) {\n if (other instanceof CodeMirror) {\n other = other.doc;\n }\n if (this.linked) {\n for (var i = 0; i < this.linked.length; ++i) {\n var link = this.linked[i];\n if (link.doc != other) {\n continue\n }\n this.linked.splice(i, 1);\n other.unlinkDoc(this);\n detachSharedMarkers(findSharedMarkers(this));\n break\n }\n }\n // If the histories were shared, split them again\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function(doc) {\n return splitIds.push(doc.id);\n }, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function(f) {\n linkedDocs(this, f);\n },\n\n getMode: function() {\n return this.mode\n },\n getEditor: function() {\n return this.cm\n },\n\n splitLines: function(str) {\n if (this.lineSep) {\n return str.split(this.lineSep)\n }\n return splitLinesAuto(str)\n },\n lineSeparator: function() {\n return this.lineSep || \"\\n\"\n },\n\n setDirection: docMethodOp(function(dir) {\n if (dir != \"rtl\") {\n dir = \"ltr\";\n }\n if (dir == this.direction) {\n return\n }\n this.direction = dir;\n this.iter(function(line) {\n return line.order = null;\n });\n if (this.cm) {\n directionChanged(this.cm);\n }\n })\n });\n\n // Public alias.\n Doc.prototype.eachLine = Doc.prototype.iter;\n\n // Kludge to work around strange IE behavior where it'll sometimes\n // re-fire a series of drag-related events right after the drop (#1551)\n var lastDrop = 0;\n\n function onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) {\n return\n }\n e_preventDefault(e);\n if (ie) {\n lastDrop = +new Date;\n }\n var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n if (!pos || cm.isReadOnly()) {\n return\n }\n // Might be a file drop, in which case we simply extract the text\n // and insert it.\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length, text = Array(n), read = 0;\n var loadFile = function(file, i) {\n if (cm.options.allowDropFileTypes &&\n indexOf(cm.options.allowDropFileTypes, file.type) == -1) {\n return\n }\n\n var reader = new FileReader;\n reader.onload = operation(cm, function() {\n var content = reader.result;\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) {\n content = \"\";\n }\n text[i] = content;\n if (++read == n) {\n pos = clipPos(cm.doc, pos);\n var change = {\n from: pos, to: pos,\n text: cm.doc.splitLines(text.join(cm.doc.lineSeparator())),\n origin: \"paste\"\n };\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(pos, changeEnd(change)));\n }\n });\n reader.readAsText(file);\n };\n for (var i = 0; i < n; ++i) {\n loadFile(files[i], i);\n }\n } else { // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e);\n // Ensure the editor is re-focused\n setTimeout(function() {\n return cm.display.input.focus();\n }, 20);\n return\n }\n try {\n var text$1 = e.dataTransfer.getData(\"Text\");\n if (text$1) {\n var selected;\n if (cm.state.draggingText && !cm.state.draggingText.copy) {\n selected = cm.listSelections();\n }\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n if (selected) {\n for (var i$1 = 0; i$1 < selected.length; ++i$1) {\n replaceRange(cm.doc, \"\", selected[i$1].anchor, selected[i$1].head, \"drag\");\n }\n }\n cm.replaceSelection(text$1, \"around\", \"paste\");\n cm.display.input.focus();\n }\n } catch (e) {\n }\n }\n }\n\n function onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) {\n e_stop(e);\n return\n }\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) {\n return\n }\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n e.dataTransfer.effectAllowed = \"copyMove\";\n\n // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img);\n // Force a relayout, or Opera won't use our image for some obscure reason\n img._top = img.offsetTop;\n }\n e.dataTransfer.setDragImage(img, 0, 0);\n if (presto) {\n img.parentNode.removeChild(img);\n }\n }\n }\n\n function onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n if (!pos) {\n return\n }\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n }\n\n function clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n }\n\n // These must be handled carefully, because naively registering a\n // handler for each editor will cause the editors to never be\n // garbage collected.\n\n function forEachCodeMirror(f) {\n if (!document.getElementsByClassName) {\n return\n }\n var byClass = document.getElementsByClassName(\"CodeMirror\");\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n if (cm) {\n f(cm);\n }\n }\n }\n\n var globalsRegistered = false;\n\n function ensureGlobalHandlers() {\n if (globalsRegistered) {\n return\n }\n registerGlobalHandlers();\n globalsRegistered = true;\n }\n\n function registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function() {\n if (resizeTimer == null) {\n resizeTimer = setTimeout(function() {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100);\n }\n });\n // When the window loses focus, we want to show the editor as blurred\n on(window, \"blur\", function() {\n return forEachCodeMirror(onBlur);\n });\n }\n\n // Called when the window resizes\n function onResize(cm) {\n var d = cm.display;\n // Might be a text scaling operation, clear size caches.\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n }\n\n var keyNames = {\n 3: \"Pause\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n 19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n 36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n 46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n 106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 127: \"Delete\", 145: \"ScrollLock\",\n 173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n 221: \"]\", 222: \"'\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n 63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n };\n\n // Number keys\n for (var i = 0; i < 10; i++) {\n keyNames[i + 48] = keyNames[i + 96] = String(i);\n }\n // Alphabetic keys\n for (var i$1 = 65; i$1 <= 90; i$1++) {\n keyNames[i$1] = String.fromCharCode(i$1);\n }\n // Function keys\n for (var i$2 = 1; i$2 <= 12; i$2++) {\n keyNames[i$2 + 111] = keyNames[i$2 + 63235] = \"F\" + i$2;\n }\n\n var keyMap = {};\n\n keyMap.basic = {\n \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n };\n // Note that the save and find-related commands aren't defined by\n // default. User code or addons can define them. Unknown commands\n // are simply ignored.\n keyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n \"fallthrough\": \"basic\"\n };\n // Very basic readline/emacs-style bindings, which are standard on Mac.\n keyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n \"Alt-F\": \"goWordRight\", \"Alt-B\": \"goWordLeft\", \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\",\n \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\", \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\",\n \"Alt-D\": \"delWordAfter\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\", \"Ctrl-T\": \"transposeChars\",\n \"Ctrl-O\": \"openLine\"\n };\n keyMap.macDefault = {\n \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n \"fallthrough\": [\"basic\", \"emacsy\"]\n };\n keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n // KEYMAP DISPATCH\n\n function normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/);\n name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) {\n cmd = true;\n } else if (/^a(lt)?$/i.test(mod)) {\n alt = true;\n } else if (/^(c|ctrl|control)$/i.test(mod)) {\n ctrl = true;\n } else if (/^s(hift)?$/i.test(mod)) {\n shift = true;\n } else {\n throw new Error(\"Unrecognized modifier name: \" + mod)\n }\n }\n if (alt) {\n name = \"Alt-\" + name;\n }\n if (ctrl) {\n name = \"Ctrl-\" + name;\n }\n if (cmd) {\n name = \"Cmd-\" + name;\n }\n if (shift) {\n name = \"Shift-\" + name;\n }\n return name\n }\n\n // This is a kludge to keep keymaps mostly working as raw objects\n // (backwards compatibility) while at the same time support features\n // like normalization and multi-stroke key bindings. It compiles a\n // new normalized keymap, and then updates the old object to reflect\n // this.\n function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) {\n if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) {\n continue\n }\n if (value == \"...\") {\n delete keymap[keyname];\n continue\n }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) {\n copy[name] = val;\n } else if (prev != val) {\n throw new Error(\"Inconsistent bindings for \" + name)\n }\n }\n delete keymap[keyname];\n }\n }\n for (var prop in copy) {\n keymap[prop] = copy[prop];\n }\n return keymap\n }\n\n function lookupKey(key, map$$1, handle, context) {\n map$$1 = getKeyMap(map$$1);\n var found = map$$1.call ? map$$1.call(key, context) : map$$1[key];\n if (found === false) {\n return \"nothing\"\n }\n if (found === \"...\") {\n return \"multi\"\n }\n if (found != null && handle(found)) {\n return \"handled\"\n }\n\n if (map$$1.fallthrough) {\n if (Object.prototype.toString.call(map$$1.fallthrough) != \"[object Array]\") {\n return lookupKey(key, map$$1.fallthrough, handle, context)\n }\n for (var i = 0; i < map$$1.fallthrough.length; i++) {\n var result = lookupKey(key, map$$1.fallthrough[i], handle, context);\n if (result) {\n return result\n }\n }\n }\n }\n\n // Modifier key presses don't count as 'real' key presses for the\n // purpose of keymap fallthrough.\n function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n }\n\n function addModifierNames(name, event, noShift) {\n var base = name;\n if (event.altKey && base != \"Alt\") {\n name = \"Alt-\" + name;\n }\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") {\n name = \"Ctrl-\" + name;\n }\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Cmd\") {\n name = \"Cmd-\" + name;\n }\n if (!noShift && event.shiftKey && base != \"Shift\") {\n name = \"Shift-\" + name;\n }\n return name\n }\n\n // Look up the name of a key as indicated by an event object.\n function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) {\n return false\n }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) {\n return false\n }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) {\n name = event.code;\n }\n return addModifierNames(name, event, noShift)\n }\n\n function getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val\n }\n\n // Helper for deleting text near the selection(s), used to implement\n // backspace, delete, and similar functionality.\n function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function() {\n for (var i = kill.length - 1; i >= 0; i--) {\n replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\");\n }\n ensureCursorVisible(cm);\n });\n }\n\n function moveCharLogically(line, ch, dir) {\n var target = skipExtendingChars(line.text, ch + dir, dir);\n return target < 0 || target > line.text.length ? null : target\n }\n\n function moveLogically(line, start, dir) {\n var ch = moveCharLogically(line, start.ch, dir);\n return ch == null ? null : new Pos(start.line, ch, dir < 0 ? \"after\" : \"before\")\n }\n\n function endOfLine(visually, cm, lineObj, lineNo, dir) {\n if (visually) {\n var order = getOrder(lineObj, cm.doc.direction);\n if (order) {\n var part = dir < 0 ? lst(order) : order[0];\n var moveInStorageOrder = (dir < 0) == (part.level == 1);\n var sticky = moveInStorageOrder ? \"after\" : \"before\";\n var ch;\n // With a wrapped rtl chunk (possibly spanning multiple bidi parts),\n // it could be that the last bidi part is not on the last visual line,\n // since visual lines contain content order-consecutive chunks.\n // Thus, in rtl, we are looking for the first (content-order) character\n // in the rtl chunk that is on the last line (that is, the same line\n // as the last (content-order) character).\n if (part.level > 0 || cm.doc.direction == \"rtl\") {\n var prep = prepareMeasureForLine(cm, lineObj);\n ch = dir < 0 ? lineObj.text.length - 1 : 0;\n var targetTop = measureCharPrepared(cm, prep, ch).top;\n ch = findFirst(function(ch) {\n return measureCharPrepared(cm, prep, ch).top == targetTop;\n }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);\n if (sticky == \"before\") {\n ch = moveCharLogically(lineObj, ch, 1);\n }\n } else {\n ch = dir < 0 ? part.to : part.from;\n }\n return new Pos(lineNo, ch, sticky)\n }\n }\n return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? \"before\" : \"after\")\n }\n\n function moveVisually(cm, line, start, dir) {\n var bidi = getOrder(line, cm.doc.direction);\n if (!bidi) {\n return moveLogically(line, start, dir)\n }\n if (start.ch >= line.text.length) {\n start.ch = line.text.length;\n start.sticky = \"before\";\n } else if (start.ch <= 0) {\n start.ch = 0;\n start.sticky = \"after\";\n }\n var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];\n if (cm.doc.direction == \"ltr\" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {\n // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,\n // nothing interesting happens.\n return moveLogically(line, start, dir)\n }\n\n var mv = function(pos, dir) {\n return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir);\n };\n var prep;\n var getWrappedLineExtent = function(ch) {\n if (!cm.options.lineWrapping) {\n return {begin: 0, end: line.text.length}\n }\n prep = prep || prepareMeasureForLine(cm, line);\n return wrappedLineExtentChar(cm, line, prep, ch)\n };\n var wrappedLineExtent = getWrappedLineExtent(start.sticky == \"before\" ? mv(start, -1) : start.ch);\n\n if (cm.doc.direction == \"rtl\" || part.level == 1) {\n var moveInStorageOrder = (part.level == 1) == (dir < 0);\n var ch = mv(start, moveInStorageOrder ? 1 : -1);\n if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {\n // Case 2: We move within an rtl part or in an rtl editor on the same visual line\n var sticky = moveInStorageOrder ? \"before\" : \"after\";\n return new Pos(start.line, ch, sticky)\n }\n }\n\n // Case 3: Could not move within this bidi part in this visual line, so leave\n // the current bidi part\n\n var searchInVisualLine = function(partPos, dir, wrappedLineExtent) {\n var getRes = function(ch, moveInStorageOrder) {\n return moveInStorageOrder\n ? new Pos(start.line, mv(ch, 1), \"before\")\n : new Pos(start.line, ch, \"after\");\n };\n\n for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {\n var part = bidi[partPos];\n var moveInStorageOrder = (dir > 0) == (part.level != 1);\n var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);\n if (part.from <= ch && ch < part.to) {\n return getRes(ch, moveInStorageOrder)\n }\n ch = moveInStorageOrder ? part.from : mv(part.to, -1);\n if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) {\n return getRes(ch, moveInStorageOrder)\n }\n }\n };\n\n // Case 3a: Look for other bidi parts on the same visual line\n var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);\n if (res) {\n return res\n }\n\n // Case 3b: Look for other bidi parts on the next visual line\n var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);\n if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {\n res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));\n if (res) {\n return res\n }\n }\n\n // Case 4: Nowhere to move\n return null\n }\n\n // Commands are parameter-less actions that can be performed on an\n // editor, mostly used for keybindings.\n var commands = {\n selectAll: selectAll,\n singleSelection: function(cm) {\n return cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll);\n },\n killLine: function(cm) {\n return deleteNearSelection(cm, function(range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n if (range.head.ch == len && range.head.line < cm.lastLine()) {\n return {from: range.head, to: Pos(range.head.line + 1, 0)}\n } else {\n return {from: range.head, to: Pos(range.head.line, len)}\n }\n } else {\n return {from: range.from(), to: range.to()}\n }\n });\n },\n deleteLine: function(cm) {\n return deleteNearSelection(cm, function(range) {\n return ({\n from: Pos(range.from().line, 0),\n to: clipPos(cm.doc, Pos(range.to().line + 1, 0))\n });\n });\n },\n delLineLeft: function(cm) {\n return deleteNearSelection(cm, function(range) {\n return ({\n from: Pos(range.from().line, 0), to: range.from()\n });\n });\n },\n delWrappedLineLeft: function(cm) {\n return deleteNearSelection(cm, function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n return {from: leftPos, to: range.from()}\n });\n },\n delWrappedLineRight: function(cm) {\n return deleteNearSelection(cm, function(range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n return {from: range.from(), to: rightPos}\n });\n },\n undo: function(cm) {\n return cm.undo();\n },\n redo: function(cm) {\n return cm.redo();\n },\n undoSelection: function(cm) {\n return cm.undoSelection();\n },\n redoSelection: function(cm) {\n return cm.redoSelection();\n },\n goDocStart: function(cm) {\n return cm.extendSelection(Pos(cm.firstLine(), 0));\n },\n goDocEnd: function(cm) {\n return cm.extendSelection(Pos(cm.lastLine()));\n },\n goLineStart: function(cm) {\n return cm.extendSelectionsBy(function(range) {\n return lineStart(cm, range.head.line);\n },\n {origin: \"+move\", bias: 1}\n );\n },\n goLineStartSmart: function(cm) {\n return cm.extendSelectionsBy(function(range) {\n return lineStartSmart(cm, range.head);\n },\n {origin: \"+move\", bias: 1}\n );\n },\n goLineEnd: function(cm) {\n return cm.extendSelectionsBy(function(range) {\n return lineEnd(cm, range.head.line);\n },\n {origin: \"+move\", bias: -1}\n );\n },\n goLineRight: function(cm) {\n return cm.extendSelectionsBy(function(range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\")\n }, sel_move);\n },\n goLineLeft: function(cm) {\n return cm.extendSelectionsBy(function(range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: 0, top: top}, \"div\")\n }, sel_move);\n },\n goLineLeftSmart: function(cm) {\n return cm.extendSelectionsBy(function(range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) {\n return lineStartSmart(cm, range.head)\n }\n return pos\n }, sel_move);\n },\n goLineUp: function(cm) {\n return cm.moveV(-1, \"line\");\n },\n goLineDown: function(cm) {\n return cm.moveV(1, \"line\");\n },\n goPageUp: function(cm) {\n return cm.moveV(-1, \"page\");\n },\n goPageDown: function(cm) {\n return cm.moveV(1, \"page\");\n },\n goCharLeft: function(cm) {\n return cm.moveH(-1, \"char\");\n },\n goCharRight: function(cm) {\n return cm.moveH(1, \"char\");\n },\n goColumnLeft: function(cm) {\n return cm.moveH(-1, \"column\");\n },\n goColumnRight: function(cm) {\n return cm.moveH(1, \"column\");\n },\n goWordLeft: function(cm) {\n return cm.moveH(-1, \"word\");\n },\n goGroupRight: function(cm) {\n return cm.moveH(1, \"group\");\n },\n goGroupLeft: function(cm) {\n return cm.moveH(-1, \"group\");\n },\n goWordRight: function(cm) {\n return cm.moveH(1, \"word\");\n },\n delCharBefore: function(cm) {\n return cm.deleteH(-1, \"char\");\n },\n delCharAfter: function(cm) {\n return cm.deleteH(1, \"char\");\n },\n delWordBefore: function(cm) {\n return cm.deleteH(-1, \"word\");\n },\n delWordAfter: function(cm) {\n return cm.deleteH(1, \"word\");\n },\n delGroupBefore: function(cm) {\n return cm.deleteH(-1, \"group\");\n },\n delGroupAfter: function(cm) {\n return cm.deleteH(1, \"group\");\n },\n indentAuto: function(cm) {\n return cm.indentSelection(\"smart\");\n },\n indentMore: function(cm) {\n return cm.indentSelection(\"add\");\n },\n indentLess: function(cm) {\n return cm.indentSelection(\"subtract\");\n },\n insertTab: function(cm) {\n return cm.replaceSelection(\"\\t\");\n },\n insertSoftTab: function(cm) {\n var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(spaceStr(tabSize - col % tabSize));\n }\n cm.replaceSelections(spaces);\n },\n defaultTab: function(cm) {\n if (cm.somethingSelected()) {\n cm.indentSelection(\"add\");\n } else {\n cm.execCommand(\"insertTab\");\n }\n },\n // Swap the two chars left and right of each selection's head.\n // Move cursor behind the two swapped characters afterwards.\n //\n // Doesn't consider line feeds a character.\n // Doesn't scan more than one line above to find a character.\n // Doesn't do anything on an empty line.\n // Doesn't do anything with non-empty selections.\n transposeChars: function(cm) {\n return runInOp(cm, function() {\n var ranges = cm.listSelections(), newSel = [];\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) {\n continue\n }\n var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n if (line) {\n if (cur.ch == line.length) {\n cur = new Pos(cur.line, cur.ch - 1);\n }\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n if (prev) {\n cur = new Pos(cur.line, 1);\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n prev.charAt(prev.length - 1),\n Pos(cur.line - 1, prev.length - 1), cur, \"+transpose\");\n }\n }\n }\n newSel.push(new Range(cur, cur));\n }\n cm.setSelections(newSel);\n });\n },\n newlineAndIndent: function(cm) {\n return runInOp(cm, function() {\n var sels = cm.listSelections();\n for (var i = sels.length - 1; i >= 0; i--) {\n cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, \"+input\");\n }\n sels = cm.listSelections();\n for (var i$1 = 0; i$1 < sels.length; i$1++) {\n cm.indentLine(sels[i$1].from().line, null, true);\n }\n ensureCursorVisible(cm);\n });\n },\n openLine: function(cm) {\n return cm.replaceSelection(\"\\n\", \"start\");\n },\n toggleOverwrite: function(cm) {\n return cm.toggleOverwrite();\n }\n };\n\n\n function lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n if (visual != line) {\n lineN = lineNo(visual);\n }\n return endOfLine(true, cm, visual, lineN, 1)\n }\n\n function lineEnd(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLineEnd(line);\n if (visual != line) {\n lineN = lineNo(visual);\n }\n return endOfLine(true, cm, line, lineN, -1)\n }\n\n function lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line, cm.doc.direction);\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(0, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)\n }\n return start\n }\n\n // Run a handler that was bound to a key.\n function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) {\n return false\n }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) {\n cm.state.suppressEdits = true;\n }\n if (dropShift) {\n cm.display.shift = false;\n }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }\n\n function lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n if (result) {\n return result\n }\n }\n return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n || lookupKey(name, cm.options.keyMap, handle, cm)\n }\n\n // Note that, despite the name, this function is also used to check\n // for bound mouse clicks.\n\n var stopSeq = new Delayed;\n\n function dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n if (seq) {\n if (isModifierKey(name)) {\n return \"handled\"\n }\n if (/\\'$/.test(name)) {\n cm.state.keySeq = null;\n } else {\n stopSeq.set(50, function() {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n });\n }\n if (dispatchKeyInner(cm, seq + \" \" + name, e, handle)) {\n return true\n }\n }\n return dispatchKeyInner(cm, name, e, handle)\n }\n\n function dispatchKeyInner(cm, name, e, handle) {\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\") {\n cm.state.keySeq = name;\n }\n if (result == \"handled\") {\n signalLater(cm, \"keyHandled\", cm, name, e);\n }\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n return !!result\n }\n\n // Handle a key from the keydown event.\n function handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n if (!name) {\n return false\n }\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function(b) {\n return doHandleBinding(cm, b, true);\n })\n || dispatchKey(cm, name, e, function(b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion) {\n return doHandleBinding(cm, b)\n }\n })\n } else {\n return dispatchKey(cm, name, e, function(b) {\n return doHandleBinding(cm, b);\n })\n }\n }\n\n // Handle a key from the keypress event\n function handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e, function(b) {\n return doHandleBinding(cm, b, true);\n })\n }\n\n var lastStoppedKey = null;\n\n function onKeyDown(e) {\n var cm = this;\n cm.curOp.focus = activeElt();\n if (signalDOMEvent(cm, e)) {\n return\n }\n // IE does strange things with escape.\n if (ie && ie_version < 11 && e.keyCode == 27) {\n e.returnValue = false;\n }\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n if (presto) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey)) {\n cm.replaceSelection(\"\", null, \"cut\");\n }\n }\n\n // Turn mouse into crosshair when Alt is held on Mac.\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className)) {\n showCrossHair(cm);\n }\n }\n\n function showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n }\n\n function onKeyUp(e) {\n if (e.keyCode == 16) {\n this.doc.sel.shift = false;\n }\n signalDOMEvent(this, e);\n }\n\n function onKeyPress(e) {\n var cm = this;\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) {\n return\n }\n var keyCode = e.keyCode, charCode = e.charCode;\n if (presto && keyCode == lastStoppedKey) {\n lastStoppedKey = null;\n e_preventDefault(e);\n return\n }\n if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) {\n return\n }\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n // Some browsers fire keypress events for backspace\n if (ch == \"\\x08\") {\n return\n }\n if (handleCharBinding(cm, e, ch)) {\n return\n }\n cm.display.input.onKeyPress(e);\n }\n\n var DOUBLECLICK_DELAY = 400;\n\n var PastClick = function(time, pos, button) {\n this.time = time;\n this.pos = pos;\n this.button = button;\n };\n\n PastClick.prototype.compare = function(time, pos, button) {\n return this.time + DOUBLECLICK_DELAY > time &&\n cmp(pos, this.pos) == 0 && button == this.button\n };\n\n var lastClick, lastDoubleClick;\n\n function clickRepeat(pos, button) {\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {\n lastClick = lastDoubleClick = null;\n return \"triple\"\n } else if (lastClick && lastClick.compare(now, pos, button)) {\n lastDoubleClick = new PastClick(now, pos, button);\n lastClick = null;\n return \"double\"\n } else {\n lastClick = new PastClick(now, pos, button);\n lastDoubleClick = null;\n return \"single\"\n }\n }\n\n // A mouse down can be a single click, double click, triple click,\n // start of selection drag, start of text drag, new cursor\n // (ctrl-click), rectangle drag (alt-drag), or xwin\n // middle-click-paste. Or it might be a click on something we should\n // not interfere with, such as a scrollbar or widget.\n function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) {\n return\n }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function() {\n return display.scroller.draggable = true;\n }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) {\n return\n }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n window.focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText) {\n cm.state.selectingText(e);\n }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) {\n return\n }\n\n if (button == 1) {\n if (pos) {\n leftButtonDown(cm, pos, repeat, e);\n } else if (e_target(e) == display.scroller) {\n e_preventDefault(e);\n }\n } else if (button == 2) {\n if (pos) {\n extendSelection(cm.doc, pos);\n }\n setTimeout(function() {\n return display.input.focus();\n }, 20);\n } else if (button == 3) {\n if (captureRightClick) {\n cm.display.input.onContextMenu(e);\n } else {\n delayBlurEvent(cm);\n }\n }\n }\n\n function handleMappedButton(cm, button, pos, repeat, event) {\n var name = \"Click\";\n if (repeat == \"double\") {\n name = \"Double\" + name;\n } else if (repeat == \"triple\") {\n name = \"Triple\" + name;\n }\n name = (button == 1 ? \"Left\" : button == 2 ? \"Middle\" : \"Right\") + name;\n\n return dispatchKey(cm, addModifierNames(name, event), event, function(bound) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n }\n if (!bound) {\n return false\n }\n var done = false;\n try {\n if (cm.isReadOnly()) {\n cm.state.suppressEdits = true;\n }\n done = bound(cm, pos) != Pass;\n } finally {\n cm.state.suppressEdits = false;\n }\n return done\n })\n }\n\n function configureMouse(cm, repeat, event) {\n var option = cm.getOption(\"configureMouse\");\n var value = option ? option(cm, repeat, event) : {};\n if (value.unit == null) {\n var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;\n value.unit = rect ? \"rectangle\" : repeat == \"single\" ? \"char\" : repeat == \"double\" ? \"word\" : \"line\";\n }\n if (value.extend == null || cm.doc.extend) {\n value.extend = cm.doc.extend || event.shiftKey;\n }\n if (value.addNew == null) {\n value.addNew = mac ? event.metaKey : event.ctrlKey;\n }\n if (value.moveOnDrag == null) {\n value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey);\n }\n return value\n }\n\n function leftButtonDown(cm, pos, repeat, event) {\n if (ie) {\n setTimeout(bind(ensureFocus, cm), 0);\n } else {\n cm.curOp.focus = activeElt();\n }\n\n var behavior = configureMouse(cm, repeat, event);\n\n var sel = cm.doc.sel, contained;\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n repeat == \"single\" && (contained = sel.contains(pos)) > -1 &&\n (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&\n (cmp(contained.to(), pos) > 0 || pos.xRel < 0)) {\n leftButtonStartDrag(cm, event, pos, behavior);\n } else {\n leftButtonSelect(cm, event, pos, behavior);\n }\n }\n\n // Start a text drag. When it ends, see if any dragging actually\n // happen, and treat as a click if it didn't.\n function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function(e) {\n if (webkit) {\n display.scroller.draggable = false;\n }\n cm.state.draggingText = false;\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew) {\n extendSelection(cm.doc, pos, null, null, behavior.extend);\n }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if (webkit || ie && ie_version == 9) {\n setTimeout(function() {\n display.wrapper.ownerDocument.body.focus();\n display.input.focus();\n }, 20);\n } else {\n display.input.focus();\n }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function() {\n return moved = true;\n };\n // Let the drag handler handle this.\n if (webkit) {\n display.scroller.draggable = true;\n }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n // IE's approach to draggable\n if (display.scroller.dragDrop) {\n display.scroller.dragDrop();\n }\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n delayBlurEvent(cm);\n setTimeout(function() {\n return display.input.focus();\n }, 20);\n }\n\n function rangeForUnit(cm, pos, unit) {\n if (unit == \"char\") {\n return new Range(pos, pos)\n }\n if (unit == \"word\") {\n return cm.findWordAt(pos)\n }\n if (unit == \"line\") {\n return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)))\n }\n var result = unit(cm, pos);\n return new Range(result.from, result.to)\n }\n\n // Normal selection, as opposed to text dragging.\n function leftButtonSelect(cm, event, start, behavior) {\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1) {\n ourRange = ranges[ourIndex];\n } else {\n ourRange = new Range(start, start);\n }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) {\n ourRange = new Range(start, start);\n }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range$$1 = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend) {\n ourRange = extendRange(ourRange, range$$1.anchor, range$$1.head, behavior.extend);\n } else {\n ourRange = range$$1;\n }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) {\n return\n }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right) {\n ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos)));\n } else if (text.length > leftPos) {\n ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize))));\n }\n }\n if (!ranges.length) {\n ranges.push(new Range(start, start));\n }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range$$1 = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range$$1.anchor, anchor) > 0) {\n head = range$$1.head;\n anchor = minPos(oldRange.from(), range$$1.anchor);\n } else {\n head = range$$1.anchor;\n anchor = maxPos(oldRange.to(), range$$1.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) {\n return\n }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt();\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from) {\n setTimeout(operation(cm, function() {\n if (counter == curCount) {\n extend(e);\n }\n }), 150);\n }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) {\n setTimeout(operation(cm, function() {\n if (counter != curCount) {\n return\n }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50);\n }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n e_preventDefault(e);\n display.input.focus();\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function(e) {\n if (e.buttons === 0 || !e_button(e)) {\n done(e);\n } else {\n extend(e);\n }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }\n\n // Used when mouse-selecting to adjust the anchor to the proper side\n // of a bidi jump depending on the visual position of the head.\n function bidiSimplify(cm, range$$1) {\n var anchor = range$$1.anchor;\n var head = range$$1.head;\n var anchorLine = getLine(cm.doc, anchor.line);\n if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) {\n return range$$1\n }\n var order = getOrder(anchorLine);\n if (!order) {\n return range$$1\n }\n var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];\n if (part.from != anchor.ch && part.to != anchor.ch) {\n return range$$1\n }\n var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);\n if (boundary == 0 || boundary == order.length) {\n return range$$1\n }\n\n // Compute the relative visual position of the head compared to the\n // anchor (<0 is to the left, >0 to the right)\n var leftSide;\n if (head.line != anchor.line) {\n leftSide = (head.line - anchor.line) * (cm.doc.direction == \"ltr\" ? 1 : -1) > 0;\n } else {\n var headIndex = getBidiPartAt(order, head.ch, head.sticky);\n var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);\n if (headIndex == boundary - 1 || headIndex == boundary) {\n leftSide = dir < 0;\n } else {\n leftSide = dir > 0;\n }\n }\n\n var usePart = order[boundary + (leftSide ? -1 : 0)];\n var from = leftSide == (usePart.level == 1);\n var ch = from ? usePart.from : usePart.to, sticky = from ? \"after\" : \"before\";\n return anchor.ch == ch && anchor.sticky == sticky ? range$$1 : new Range(new Pos(anchor.line, ch, sticky), head)\n }\n\n\n // Determines whether an event happened in the gutter, and fires the\n // handlers for the corresponding event.\n function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try {\n mX = e.clientX;\n mY = e.clientY;\n } catch (e) {\n return false\n }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) {\n return false\n }\n if (prevent) {\n e_preventDefault(e);\n }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) {\n return e_defaultPrevented(e)\n }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.options.gutters.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.options.gutters[i];\n signal(cm, type, cm, line, gutter, e);\n return e_defaultPrevented(e)\n }\n }\n }\n\n function clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true)\n }\n\n // CONTEXT MENU HANDLING\n\n // To make the context menu work, we need to briefly unhide the\n // textarea (making it as unobtrusive as possible) to let the\n // right-click take effect on it.\n function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) {\n return\n }\n if (signalDOMEvent(cm, e, \"contextmenu\")) {\n return\n }\n if (!captureRightClick) {\n cm.display.input.onContextMenu(e);\n }\n }\n\n function contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) {\n return false\n }\n return gutterEvent(cm, e, \"gutterContextMenu\", false)\n }\n\n function themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n }\n\n var Init = {\n toString: function() {\n return \"CodeMirror.Init\"\n }\n };\n\n var defaults = {};\n var optionHandlers = {};\n\n function defineOptions(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n if (handle) {\n optionHandlers[name] =\n notOnInit ? function(cm, val, old) {\n if (old != Init) {\n handle(cm, val, old);\n }\n } : handle;\n }\n }\n\n CodeMirror.defineOption = option;\n\n // Passed to option handlers when there is no old value.\n CodeMirror.Init = Init;\n\n // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n option(\"value\", \"\", function(cm, val) {\n return cm.setValue(val);\n }, true);\n option(\"mode\", null, function(cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function(cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n\n option(\"lineSeparator\", null, function(cm, val) {\n cm.doc.lineSep = val;\n if (!val) {\n return\n }\n var newBreaks = [], lineNo = cm.doc.first;\n cm.doc.iter(function(line) {\n for (var pos = 0; ;) {\n var found = line.text.indexOf(val, pos);\n if (found == -1) {\n break\n }\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n lineNo++;\n });\n for (var i = newBreaks.length - 1; i >= 0; i--) {\n replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length));\n }\n });\n option(\"specialChars\", /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b-\\u200f\\u2028\\u2029\\ufeff]/g, function(cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n if (old != Init) {\n cm.refresh();\n }\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function(cm) {\n return cm.refresh();\n }, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function() {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\") // FIXME\n }, true);\n option(\"spellcheck\", false, function(cm, val) {\n return cm.getInputField().spellcheck = val;\n }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n\n option(\"theme\", \"default\", function(cm) {\n themeChanged(cm);\n guttersChanged(cm);\n }, true);\n option(\"keyMap\", \"default\", function(cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != Init && getKeyMap(old);\n if (prev && prev.detach) {\n prev.detach(cm, next);\n }\n if (next.attach) {\n next.attach(cm, prev || null);\n }\n });\n option(\"extraKeys\", null);\n option(\"configureMouse\", null);\n\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function(cm) {\n setGuttersForLineNumbers(cm.options);\n guttersChanged(cm);\n }, true);\n option(\"fixedGutter\", true, function(cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function(cm) {\n return updateScrollbars(cm);\n }, true);\n option(\"scrollbarStyle\", \"native\", function(cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function(cm) {\n setGuttersForLineNumbers(cm.options);\n guttersChanged(cm);\n }, true);\n option(\"firstLineNumber\", 1, guttersChanged, true);\n option(\"lineNumberFormatter\", function(integer) {\n return integer;\n }, guttersChanged, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n option(\"pasteLinesPerSelection\", true);\n option(\"selectionsMayTouch\", false);\n\n option(\"readOnly\", false, function(cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n }\n cm.display.input.readOnlyChanged(val);\n });\n option(\"disableInput\", false, function(cm, val) {\n if (!val) {\n cm.display.input.reset();\n }\n }, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function(cm, val) {\n return cm.doc.history.undoDepth = val;\n });\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function(cm) {\n return cm.refresh();\n }, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function(cm, val) {\n if (!val) {\n cm.display.input.resetPosition();\n }\n });\n\n option(\"tabindex\", null, function(cm, val) {\n return cm.display.input.getField().tabIndex = val || \"\";\n });\n option(\"autofocus\", null);\n option(\"direction\", \"ltr\", function(cm, val) {\n return cm.doc.setDirection(val);\n }, true);\n option(\"phrases\", null);\n }\n\n function guttersChanged(cm) {\n updateGutters(cm);\n regChange(cm);\n alignHorizontally(cm);\n }\n\n function dragDropChanged(cm, value, old) {\n var wasOn = old && old != Init;\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n }\n\n function wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function() {\n return updateScrollbars(cm);\n }, 100);\n }\n\n // A CodeMirror instance represents an editor. This is the object\n // that user code is usually dealing with.\n\n function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) {\n return new CodeMirror(place, options)\n }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n setGuttersForLineNumbers(options);\n\n var doc = options.value;\n if (typeof doc == \"string\") {\n doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction);\n } else if (options.mode) {\n doc.modeOption = options.mode;\n }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input);\n display.wrapper.CodeMirror = this;\n updateGutters(this);\n themeChanged(this);\n if (options.lineWrapping) {\n this.display.wrapper.className += \" CodeMirror-wrap\";\n }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: false, cutIncoming: false, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) {\n display.input.focus();\n }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) {\n setTimeout(function() {\n return this$1.display.input.reset(true);\n }, 20);\n }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus()) {\n setTimeout(bind(onFocus, this), 20);\n } else {\n onBlur(this);\n }\n\n for (var opt in optionHandlers) {\n if (optionHandlers.hasOwnProperty(opt)) {\n optionHandlers[opt](this, options[opt], Init);\n }\n }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) {\n options.finishInit(this);\n }\n for (var i = 0; i < initHooks.length; ++i) {\n initHooks[i](this);\n }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\") {\n display.lineDiv.style.textRendering = \"auto\";\n }\n }\n\n // The default configuration options.\n CodeMirror.defaults = defaults;\n // Functions to run when options are changed.\n CodeMirror.optionHandlers = optionHandlers;\n\n // Attach the necessary event handlers when initializing the editor\n function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11) {\n on(d.scroller, \"dblclick\", operation(cm, function(e) {\n if (signalDOMEvent(cm, e)) {\n return\n }\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) {\n return\n }\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n }));\n } else {\n on(d.scroller, \"dblclick\", function(e) {\n return signalDOMEvent(cm, e) || e_preventDefault(e);\n });\n }\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n on(d.scroller, \"contextmenu\", function(e) {\n return onContextMenu(cm, e);\n });\n\n // Used to suppress mouse event handling when a touch happens\n var touchFinished, prevTouch = {end: 0};\n\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function() {\n return d.activeTouch = null;\n }, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date;\n }\n }\n\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) {\n return false\n }\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1\n }\n\n function farAway(touch, other) {\n if (other.left == null) {\n return true\n }\n var dx = other.left - touch.left, dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20\n }\n\n on(d.scroller, \"touchstart\", function(e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {\n d.input.ensurePolled();\n clearTimeout(touchFinished);\n var now = +new Date;\n d.activeTouch = {\n start: now, moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null\n };\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function() {\n if (d.activeTouch) {\n d.activeTouch.moved = true;\n }\n });\n on(d.scroller, \"touchend\", function(e) {\n var touch = d.activeTouch;\n if (touch && !eventInWidget(d, e) && touch.left != null &&\n !touch.moved && new Date - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n {\n range = new Range(pos, pos);\n } else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n {\n range = cm.findWordAt(pos);\n } else // Triple tap\n {\n range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0)));\n }\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch);\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function() {\n if (d.scroller.clientHeight) {\n updateScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function(e) {\n return onScrollWheel(cm, e);\n });\n on(d.scroller, \"DOMMouseScroll\", function(e) {\n return onScrollWheel(cm, e);\n });\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function() {\n return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0;\n });\n\n d.dragFunctions = {\n enter: function(e) {\n if (!signalDOMEvent(cm, e)) {\n e_stop(e);\n }\n },\n over: function(e) {\n if (!signalDOMEvent(cm, e)) {\n onDragOver(cm, e);\n e_stop(e);\n }\n },\n start: function(e) {\n return onDragStart(cm, e);\n },\n drop: operation(cm, onDrop),\n leave: function(e) {\n if (!signalDOMEvent(cm, e)) {\n clearDragCursor(cm);\n }\n }\n };\n\n var inp = d.input.getField();\n on(inp, \"keyup\", function(e) {\n return onKeyUp.call(cm, e);\n });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", function(e) {\n return onFocus(cm, e);\n });\n on(inp, \"blur\", function(e) {\n return onBlur(cm, e);\n });\n }\n\n var initHooks = [];\n CodeMirror.defineInitHook = function(f) {\n return initHooks.push(f);\n };\n\n // Indent the given line. The how parameter can be \"smart\",\n // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n // (typically set to true for forced single-line indents), empty\n // lines are not indented, and places where the mode returns Pass\n // are left alone.\n function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) {\n how = \"add\";\n }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) {\n how = \"prev\";\n } else {\n state = getContextBefore(cm, n).state;\n }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) {\n line.stateAfter = null;\n }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) {\n return\n }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) {\n indentation = countColumn(getLine(doc, n - 1).text, null, tabSize);\n } else {\n indentation = 0;\n }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs) {\n for (var i = Math.floor(indentation / tabSize); i; --i) {\n pos += tabSize;\n indentString += \"\\t\";\n }\n }\n if (pos < indentation) {\n indentString += spaceStr(indentation - pos);\n }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n }\n\n // This will be set to a {lineWise: bool, text: [string]} object, so\n // that, when pasting, we know what kind of selections the copied\n // text was made out of.\n var lastCopied = null;\n\n function setLastCopied(newLastCopied) {\n lastCopied = newLastCopied;\n }\n\n function applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n if (!sel) {\n sel = doc.sel;\n }\n\n var paste = cm.state.pasteIncoming || origin == \"paste\";\n var textLines = splitLinesAuto(inserted), multiPaste = null;\n // When pasting N lines into N selections, insert one line per selection\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.text.length == 0) {\n multiPaste = [];\n for (var i = 0; i < lastCopied.text.length; i++) {\n multiPaste.push(doc.splitLines(lastCopied.text[i]));\n }\n }\n } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {\n multiPaste = map(textLines, function(l) {\n return [l];\n });\n }\n }\n\n var updateInput;\n // Normal behavior is to insert the new text into every selection\n for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {\n var range$$1 = sel.ranges[i$1];\n var from = range$$1.from(), to = range$$1.to();\n if (range$$1.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n {\n from = Pos(from.line, from.ch - deleted);\n } else if (cm.state.overwrite && !paste) // Handle overwrite\n {\n to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length));\n } else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == inserted) {\n from = to = Pos(from.line, 0);\n }\n }\n updateInput = cm.curOp.updateInput;\n var changeEvent = {\n from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming ? \"cut\" : \"+input\")\n };\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n if (inserted && !paste) {\n triggerElectric(cm, inserted);\n }\n\n ensureCursorVisible(cm);\n cm.curOp.updateInput = updateInput;\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = false;\n }\n\n function handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"Text\");\n if (pasted) {\n e.preventDefault();\n if (!cm.isReadOnly() && !cm.options.disableInput) {\n runInOp(cm, function() {\n return applyTextInput(cm, pasted, 0, null, \"paste\");\n });\n }\n return true\n }\n }\n\n function triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) {\n return\n }\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range$$1 = sel.ranges[i];\n if (range$$1.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range$$1.head.line)) {\n continue\n }\n var mode = cm.getModeAt(range$$1.head);\n var indented = false;\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++) {\n if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range$$1.head.line, \"smart\");\n break\n }\n }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range$$1.head.line).text.slice(0, range$$1.head.ch))) {\n indented = indentLine(cm, range$$1.head.line, \"smart\");\n }\n }\n if (indented) {\n signalLater(cm, \"electricInput\", cm, range$$1.head.line);\n }\n }\n }\n\n function copyableRanges(cm) {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n return {text: text, ranges: ranges}\n }\n\n function disableBrowserMagic(field, spellcheck) {\n field.setAttribute(\"autocorrect\", \"off\");\n field.setAttribute(\"autocapitalize\", \"off\");\n field.setAttribute(\"spellcheck\", !!spellcheck);\n }\n\n function hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n if (webkit) {\n te.style.width = \"1000px\";\n } else {\n te.setAttribute(\"wrap\", \"off\");\n }\n // If border: 0; -- iOS fails to open keyboard (issue #1287)\n if (ios) {\n te.style.border = \"1px solid black\";\n }\n disableBrowserMagic(te);\n return div\n }\n\n // The publicly visible API. Note that methodOp(f) means\n // 'wrap f in an operation, performed on its `this` parameter'.\n\n // This is not the complete set of editor methods. Most of the\n // methods defined on the Doc type are also injected into\n // CodeMirror.prototype, for backwards compatibility and\n // convenience.\n\n function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function() {\n window.focus();\n this.display.input.focus();\n },\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") {\n return\n }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option)) {\n operation(this, optionHandlers[option])(this, value, old);\n }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {\n return this.options[option]\n },\n getDoc: function() {\n return this.doc\n },\n\n addKeyMap: function(map$$1, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map$$1));\n },\n removeKeyMap: function(map$$1) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i) {\n if (maps[i] == map$$1 || maps[i].name == map$$1) {\n maps.splice(i, 1);\n return true\n }\n }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) {\n throw new Error(\"Overlays may not be stateful.\")\n }\n insertSorted(this.state.overlays,\n {\n mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0\n },\n function(overlay) {\n return overlay.priority;\n });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) {\n dir = this.options.smartIndent ? \"smart\" : \"prev\";\n } else {\n dir = dir ? \"add\" : \"subtract\";\n }\n }\n if (isLine(this.doc, n)) {\n indentLine(this, n, dir, aggressive);\n }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range$$1 = ranges[i];\n if (!range$$1.empty()) {\n var from = range$$1.from(), to = range$$1.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j) {\n indentLine(this, j, how);\n }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0) {\n replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll);\n }\n } else if (range$$1.head.line > end) {\n indentLine(this, range$$1.head.line, how, true);\n end = range$$1.head.line;\n if (i == this.doc.sel.primIndex) {\n ensureCursorVisible(this);\n }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) {\n type = styles[2];\n } else {\n for (; ;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) {\n after = mid;\n } else if (styles[mid * 2 + 1] < ch) {\n before = mid + 1;\n } else {\n type = styles[mid * 2 + 2];\n break\n }\n }\n }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) {\n return mode\n }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) {\n return found\n }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) {\n found.push(help[mode[type]]);\n }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) {\n found.push(val);\n }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1) {\n found.push(cur.val);\n }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1 : line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range$$1 = this.doc.sel.primary();\n if (start == null) {\n pos = range$$1.head;\n } else if (typeof start == \"object\") {\n pos = clipPos(this.doc, start);\n } else {\n pos = start ? range$$1.from() : range$$1.to();\n }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) {\n line = this.doc.first;\n } else if (line > last) {\n line = last;\n end = true;\n }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() {\n return textHeight(this.display)\n },\n defaultCharWidth: function() {\n return charWidth(this.display)\n },\n\n getViewport: function() {\n return {from: this.display.viewFrom, to: this.display.viewTo}\n },\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight) {\n top = pos.top - node.offsetHeight;\n } else if (pos.bottom + node.offsetHeight <= vspace) {\n top = pos.bottom;\n }\n if (left + node.offsetWidth > hspace) {\n left = hspace - node.offsetWidth;\n }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") {\n left = 0;\n } else if (horiz == \"middle\") {\n left = (display.sizer.clientWidth - node.offsetWidth) / 2;\n }\n node.style.left = left + \"px\";\n }\n if (scroll) {\n scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight});\n }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd)) {\n return commands[cmd].call(null, this)\n }\n },\n\n triggerElectric: methodOp(function(text) {\n triggerElectric(this, text);\n }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) {\n dir = -1;\n amount = -amount;\n }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) {\n break\n }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function(range$$1) {\n if (this$1.display.shift || this$1.doc.extend || range$$1.empty()) {\n return findPosH(this$1.doc, range$$1.head, dir, unit, this$1.options.rtlMoveVisually)\n } else {\n return dir < 0 ? range$$1.from() : range$$1.to()\n }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected()) {\n doc.replaceSelection(\"\", null, \"+delete\");\n } else {\n deleteNearSelection(this, function(range$$1) {\n var other = findPosH(doc, range$$1.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range$$1.head} : {from: range$$1.head, to: other}\n });\n }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) {\n dir = -1;\n amount = -amount;\n }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) {\n x = coords.left;\n } else {\n coords.left = x;\n }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) {\n break\n }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function(range$$1) {\n if (collapse) {\n return dir < 0 ? range$$1.from() : range$$1.to()\n }\n var headPos = cursorCoords(this$1, range$$1.head, \"div\");\n if (range$$1.goalColumn != null) {\n headPos.left = range$$1.goalColumn;\n }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range$$1 == doc.sel.primary()) {\n addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top);\n }\n return pos\n }, sel_move);\n if (goals.length) {\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n doc.sel.ranges[i].goalColumn = goals[i];\n }\n }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) {\n --start;\n } else {\n ++end;\n }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function(ch) {\n return isWordChar(ch, helper);\n }\n : /\\s/.test(startChar) ? function(ch) {\n return /\\s/.test(ch);\n }\n : function(ch) {\n return (!/\\s/.test(ch) && !isWordChar(ch));\n };\n while (start > 0 && check(line.charAt(start - 1))) {\n --start;\n }\n while (end < line.length && check(line.charAt(end))) {\n ++end;\n }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) {\n return\n }\n if (this.state.overwrite = !this.state.overwrite) {\n addClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n } else {\n rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\");\n }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() {\n return this.display.input.getField() == activeElt()\n },\n isReadOnly: function() {\n return !!(this.options.readOnly || this.doc.cantEdit)\n },\n\n scrollTo: methodOp(function(x, y) {\n scrollToCoords(this, x, y);\n }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {\n left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)\n }\n },\n\n scrollIntoView: methodOp(function(range$$1, margin) {\n if (range$$1 == null) {\n range$$1 = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) {\n margin = this.options.cursorScrollMargin;\n }\n } else if (typeof range$$1 == \"number\") {\n range$$1 = {from: Pos(range$$1, 0), to: null};\n } else if (range$$1.from == null) {\n range$$1 = {from: range$$1, to: null};\n }\n if (!range$$1.to) {\n range$$1.to = range$$1.from;\n }\n range$$1.margin = margin || 0;\n\n if (range$$1.from.line != null) {\n scrollToRange(this, range$$1);\n } else {\n scrollToCoordsRange(this, range$$1.from, range$$1.to, range$$1.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function(val) {\n return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val;\n };\n if (width != null) {\n this.display.wrapper.style.width = interpret(width);\n }\n if (height != null) {\n this.display.wrapper.style.height = interpret(height);\n }\n if (this.options.lineWrapping) {\n clearLineMeasurementCache(this);\n }\n var lineNo$$1 = this.display.viewFrom;\n this.doc.iter(lineNo$$1, this.display.viewTo, function(line) {\n if (line.widgets) {\n for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].noHScroll) {\n regLineChange(this$1, lineNo$$1, \"widget\");\n break\n }\n }\n }\n ++lineNo$$1;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f) {\n return runInOp(this, f)\n },\n startOperation: function() {\n return startOperation(this)\n },\n endOperation: function() {\n return endOperation(this)\n },\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5) {\n estimateLineHeights(this);\n }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function() {\n return this.display.input.getField()\n },\n getWrapperElement: function() {\n return this.display.wrapper\n },\n getScrollerElement: function() {\n return this.display.scroller\n },\n getGutterElement: function() {\n return this.display.gutters\n }\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) {\n helpers[type] = CodeMirror[type] = {_global: []};\n }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }\n\n // Used for horizontal relative motion. Dir is -1 or 1 (left or\n // right), unit can be \"char\", \"column\" (like char, but doesn't\n // cross line boundaries), \"word\" (across next word), or \"group\" (to\n // the start of next group of word or non-word-non-whitespace\n // chars). The visually param controls whether, in right-to-left\n // text, direction 1 means to move towards the next index in the\n // string, or towards the character to the right of the current\n // position. The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n\n function findNextLine() {\n var l = pos.line + dir;\n if (l < doc.first || l >= doc.first + doc.size) {\n return false\n }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n\n function moveOnce(boundToLine) {\n var next;\n if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine()) {\n pos = endOfLine(visually, doc.cm, lineObj, pos.line, dir);\n } else {\n return false\n }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true; ; first = false) {\n if (dir < 0 && !moveOnce(!first)) {\n break\n }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) {\n type = \"s\";\n }\n if (sawType && sawType != type) {\n if (dir < 0) {\n dir = 1;\n moveOnce();\n pos.sticky = \"after\";\n }\n break\n }\n\n if (type) {\n sawType = type;\n }\n if (dir > 0 && !moveOnce(!first)) {\n break\n }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) {\n result.hitSide = true;\n }\n return result\n }\n\n // For relative vertical movement. Dir may be -1 or 1. Unit can be\n // \"page\" or \"line\". The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, window.innerHeight || document.documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (; ;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) {\n break\n }\n if (dir < 0 ? y <= 0 : y >= doc.height) {\n target.hitSide = true;\n break\n }\n y += dir * 5;\n }\n return target\n }\n\n // CONTENTEDITABLE INPUT STYLE\n\n var ContentEditableInput = function(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.composing = null;\n this.gracePeriod = false;\n this.readDOMTimeout = null;\n };\n\n ContentEditableInput.prototype.init = function(display) {\n var this$1 = this;\n\n var input = this, cm = input.cm;\n var div = input.div = display.lineDiv;\n disableBrowserMagic(div, cm.options.spellcheck);\n\n on(div, \"paste\", function(e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) {\n return\n }\n // IE doesn't fire input events, so we schedule a read for the pasted content in this way\n if (ie_version <= 11) {\n setTimeout(operation(cm, function() {\n return this$1.updateFromDOM();\n }), 20);\n }\n });\n\n on(div, \"compositionstart\", function(e) {\n this$1.composing = {data: e.data, done: false};\n });\n on(div, \"compositionupdate\", function(e) {\n if (!this$1.composing) {\n this$1.composing = {data: e.data, done: false};\n }\n });\n on(div, \"compositionend\", function(e) {\n if (this$1.composing) {\n if (e.data != this$1.composing.data) {\n this$1.readFromDOMSoon();\n }\n this$1.composing.done = true;\n }\n });\n\n on(div, \"touchstart\", function() {\n return input.forceCompositionEnd();\n });\n\n on(div, \"input\", function() {\n if (!this$1.composing) {\n this$1.readFromDOMSoon();\n }\n });\n\n function onCopyCut(e) {\n if (signalDOMEvent(cm, e)) {\n return\n }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n if (e.type == \"cut\") {\n cm.replaceSelection(\"\", null, \"cut\");\n }\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.operation(function() {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n if (e.clipboardData) {\n e.clipboardData.clearData();\n var content = lastCopied.text.join(\"\\n\");\n // iOS exposes the clipboard API, but seems to discard content inserted into it\n e.clipboardData.setData(\"Text\", content);\n if (e.clipboardData.getData(\"Text\") == content) {\n e.preventDefault();\n return\n }\n }\n // Old-fashioned briefly-focus-a-textarea hack\n var kludge = hiddenTextarea(), te = kludge.firstChild;\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.text.join(\"\\n\");\n var hadFocus = document.activeElement;\n selectInput(te);\n setTimeout(function() {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n if (hadFocus == div) {\n input.showPrimarySelection();\n }\n }, 50);\n }\n\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n };\n\n ContentEditableInput.prototype.prepareSelection = function() {\n var result = prepareSelection(this.cm, false);\n result.focus = this.cm.state.focused;\n return result\n };\n\n ContentEditableInput.prototype.showSelection = function(info, takeFocus) {\n if (!info || !this.cm.display.view.length) {\n return\n }\n if (info.focus || takeFocus) {\n this.showPrimarySelection();\n }\n this.showMultipleSelections(info);\n };\n\n ContentEditableInput.prototype.getSelection = function() {\n return this.cm.display.wrapper.ownerDocument.getSelection()\n };\n\n ContentEditableInput.prototype.showPrimarySelection = function() {\n var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();\n var from = prim.from(), to = prim.to();\n\n if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {\n sel.removeAllRanges();\n return\n }\n\n var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n cmp(minPos(curAnchor, curFocus), from) == 0 &&\n cmp(maxPos(curAnchor, curFocus), to) == 0) {\n return\n }\n\n var view = cm.display.view;\n var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||\n {node: view[0].measure.map[2], offset: 0};\n var end = to.line < cm.display.viewTo && posToDOM(cm, to);\n if (!end) {\n var measure = view[view.length - 1].measure;\n var map$$1 = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {node: map$$1[map$$1.length - 1], offset: map$$1[map$$1.length - 2] - map$$1[map$$1.length - 3]};\n }\n\n if (!start || !end) {\n sel.removeAllRanges();\n return\n }\n\n var old = sel.rangeCount && sel.getRangeAt(0), rng;\n try {\n rng = range(start.node, start.offset, end.offset, end.node);\n } catch (e) {\n } // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n if (rng) {\n if (!gecko && cm.state.focused) {\n sel.collapse(start.node, start.offset);\n if (!rng.collapsed) {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n if (old && sel.anchorNode == null) {\n sel.addRange(old);\n } else if (gecko) {\n this.startGracePeriod();\n }\n }\n this.rememberSelection();\n };\n\n ContentEditableInput.prototype.startGracePeriod = function() {\n var this$1 = this;\n\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function() {\n this$1.gracePeriod = false;\n if (this$1.selectionChanged()) {\n this$1.cm.operation(function() {\n return this$1.cm.curOp.selectionChanged = true;\n });\n }\n }, 20);\n };\n\n ContentEditableInput.prototype.showMultipleSelections = function(info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n };\n\n ContentEditableInput.prototype.rememberSelection = function() {\n var sel = this.getSelection();\n this.lastAnchorNode = sel.anchorNode;\n this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode;\n this.lastFocusOffset = sel.focusOffset;\n };\n\n ContentEditableInput.prototype.selectionInEditor = function() {\n var sel = this.getSelection();\n if (!sel.rangeCount) {\n return false\n }\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node)\n };\n\n ContentEditableInput.prototype.focus = function() {\n if (this.cm.options.readOnly != \"nocursor\") {\n if (!this.selectionInEditor()) {\n this.showSelection(this.prepareSelection(), true);\n }\n this.div.focus();\n }\n };\n ContentEditableInput.prototype.blur = function() {\n this.div.blur();\n };\n ContentEditableInput.prototype.getField = function() {\n return this.div\n };\n\n ContentEditableInput.prototype.supportsTouch = function() {\n return true\n };\n\n ContentEditableInput.prototype.receivedFocus = function() {\n var input = this;\n if (this.selectionInEditor()) {\n this.pollSelection();\n } else {\n runInOp(this.cm, function() {\n return input.cm.curOp.selectionChanged = true;\n });\n }\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n\n this.polling.set(this.cm.options.pollInterval, poll);\n };\n\n ContentEditableInput.prototype.selectionChanged = function() {\n var sel = this.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset\n };\n\n ContentEditableInput.prototype.pollSelection = function() {\n if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) {\n return\n }\n var sel = this.getSelection(), cm = this.cm;\n // On Android Chrome (version 56, at least), backspacing into an\n // uneditable block element will put the cursor in that element,\n // and then, because it's not editable, hide the virtual keyboard.\n // Because Android doesn't allow us to actually detect backspace\n // presses in a sane way, this code checks for when that happens\n // and simulates a backspace press in this case.\n if (android && chrome && this.cm.options.gutters.length && isInGutter(sel.anchorNode)) {\n this.cm.triggerOnKeyDown({type: \"keydown\", keyCode: 8, preventDefault: Math.abs});\n this.blur();\n this.focus();\n return\n }\n if (this.composing) {\n return\n }\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (anchor && head) {\n runInOp(cm, function() {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n if (anchor.bad || head.bad) {\n cm.curOp.selectionChanged = true;\n }\n });\n }\n };\n\n ContentEditableInput.prototype.pollContent = function() {\n if (this.readDOMTimeout != null) {\n clearTimeout(this.readDOMTimeout);\n this.readDOMTimeout = null;\n }\n\n var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n var from = sel.from(), to = sel.to();\n if (from.ch == 0 && from.line > cm.firstLine()) {\n from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length);\n }\n if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine()) {\n to = Pos(to.line + 1, 0);\n }\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) {\n return false\n }\n\n var fromIndex, fromLine, fromNode;\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n fromLine = lineNo(display.view[0].line);\n fromNode = display.view[0].node;\n } else {\n fromLine = lineNo(display.view[fromIndex].line);\n fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n var toIndex = findViewIndex(cm, to.line);\n var toLine, toNode;\n if (toIndex == display.view.length - 1) {\n toLine = display.viewTo - 1;\n toNode = display.lineDiv.lastChild;\n } else {\n toLine = lineNo(display.view[toIndex + 1].line) - 1;\n toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n if (!fromNode) {\n return false\n }\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) {\n newText.pop();\n oldText.pop();\n toLine--;\n } else if (newText[0] == oldText[0]) {\n newText.shift();\n oldText.shift();\n fromLine++;\n } else {\n break\n }\n }\n\n var cutFront = 0, cutEnd = 0;\n var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront)) {\n ++cutFront;\n }\n var newBot = lst(newText), oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n oldBot.length - (oldText.length == 1 ? cutFront : 0));\n while (cutEnd < maxCutEnd &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n ++cutEnd;\n }\n // Try to move start of change to start of selection if ambiguous\n if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {\n while (cutFront && cutFront > from.ch &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n cutFront--;\n cutEnd++;\n }\n }\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\\u200b+/, \"\");\n newText[0] = newText[0].slice(cutFront).replace(/\\u200b+$/, \"\");\n\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n return true\n }\n };\n\n ContentEditableInput.prototype.ensurePolled = function() {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.reset = function() {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.forceCompositionEnd = function() {\n if (!this.composing) {\n return\n }\n clearTimeout(this.readDOMTimeout);\n this.composing = null;\n this.updateFromDOM();\n this.div.blur();\n this.div.focus();\n };\n ContentEditableInput.prototype.readFromDOMSoon = function() {\n var this$1 = this;\n\n if (this.readDOMTimeout != null) {\n return\n }\n this.readDOMTimeout = setTimeout(function() {\n this$1.readDOMTimeout = null;\n if (this$1.composing) {\n if (this$1.composing.done) {\n this$1.composing = null;\n } else {\n return\n }\n }\n this$1.updateFromDOM();\n }, 80);\n };\n\n ContentEditableInput.prototype.updateFromDOM = function() {\n var this$1 = this;\n\n if (this.cm.isReadOnly() || !this.pollContent()) {\n runInOp(this.cm, function() {\n return regChange(this$1.cm);\n });\n }\n };\n\n ContentEditableInput.prototype.setUneditable = function(node) {\n node.contentEditable = \"false\";\n };\n\n ContentEditableInput.prototype.onKeyPress = function(e) {\n if (e.charCode == 0 || this.composing) {\n return\n }\n e.preventDefault();\n if (!this.cm.isReadOnly()) {\n operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0);\n }\n };\n\n ContentEditableInput.prototype.readOnlyChanged = function(val) {\n this.div.contentEditable = String(val != \"nocursor\");\n };\n\n ContentEditableInput.prototype.onContextMenu = function() {\n };\n ContentEditableInput.prototype.resetPosition = function() {\n };\n\n ContentEditableInput.prototype.needsContentAttribute = true;\n\n function posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n if (!view || view.hidden) {\n return null\n }\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n\n var order = getOrder(line, cm.doc.direction), side = \"left\";\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result\n }\n\n function isInGutter(node) {\n for (var scan = node; scan; scan = scan.parentNode) {\n if (/CodeMirror-gutter-wrapper/.test(scan.className)) {\n return true\n }\n }\n return false\n }\n\n function badPos(pos, bad) {\n if (bad) {\n pos.bad = true;\n }\n return pos\n }\n\n function domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;\n\n function recognizeMarker(id) {\n return function(marker) {\n return marker.id == id;\n }\n }\n\n function close() {\n if (closing) {\n text += lineSep;\n if (extraLinebreak) {\n text += lineSep;\n }\n closing = extraLinebreak = false;\n }\n }\n\n function addText(str) {\n if (str) {\n close();\n text += str;\n }\n }\n\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n if (cmText) {\n addText(cmText);\n return\n }\n var markerID = node.getAttribute(\"cm-marker\"), range$$1;\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n if (found.length && (range$$1 = found[0].find(0))) {\n addText(getBetween(cm.doc, range$$1.from, range$$1.to).join(lineSep));\n }\n return\n }\n if (node.getAttribute(\"contenteditable\") == \"false\") {\n return\n }\n var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);\n if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) {\n return\n }\n\n if (isBlock) {\n close();\n }\n for (var i = 0; i < node.childNodes.length; i++) {\n walk(node.childNodes[i]);\n }\n\n if (/^(pre|p)$/i.test(node.nodeName)) {\n extraLinebreak = true;\n }\n if (isBlock) {\n closing = true;\n }\n } else if (node.nodeType == 3) {\n addText(node.nodeValue.replace(/\\u200b/g, \"\").replace(/\\u00a0/g, \" \"));\n }\n }\n\n for (; ;) {\n walk(from);\n if (from == to) {\n break\n }\n from = from.nextSibling;\n extraLinebreak = false;\n }\n return text\n }\n\n function domToPos(cm, node, offset) {\n var lineNode;\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n if (!lineNode) {\n return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true)\n }\n node = null;\n offset = 0;\n } else {\n for (lineNode = node; ; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) {\n return null\n }\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) {\n break\n }\n }\n }\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n if (lineView.node == lineNode) {\n return locateNodeInLineView(lineView, node, offset)\n }\n }\n }\n\n function locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild, bad = false;\n if (!node || !contains(wrapper, node)) {\n return badPos(Pos(lineNo(lineView.line), 0), true)\n }\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad)\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null, topNode = node;\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n if (offset) {\n offset = textNode.nodeValue.length;\n }\n }\n while (topNode.parentNode != wrapper) {\n topNode = topNode.parentNode;\n }\n var measure = lineView.measure, maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map$$1 = i < 0 ? measure.map : maps[i];\n for (var j = 0; j < map$$1.length; j += 3) {\n var curNode = map$$1[j + 2];\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map$$1[j] + offset;\n if (offset < 0 || curNode != textNode) {\n ch = map$$1[j + (offset ? 1 : 0)];\n }\n return Pos(line, ch)\n }\n }\n }\n }\n\n var found = find(textNode, topNode, offset);\n if (found) {\n return badPos(found, bad)\n }\n\n // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n if (found) {\n return badPos(Pos(found.line, found.ch - dist), bad)\n } else {\n dist += after.textContent.length;\n }\n }\n for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n if (found) {\n return badPos(Pos(found.line, found.ch + dist$1), bad)\n } else {\n dist$1 += before.textContent.length;\n }\n }\n }\n\n // TEXTAREA INPUT STYLE\n\n var TextareaInput = function(cm) {\n this.cm = cm;\n // See input.poll and input.reset\n this.prevInput = \"\";\n\n // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n this.pollingFast = false;\n // Self-resetting timeout for the poller\n this.polling = new Delayed();\n // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n this.hasSelection = false;\n this.composing = null;\n };\n\n TextareaInput.prototype.init = function(display) {\n var this$1 = this;\n\n var input = this, cm = this.cm;\n this.createField(display);\n var te = this.textarea;\n\n display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);\n\n // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n if (ios) {\n te.style.width = \"0px\";\n }\n\n on(te, \"input\", function() {\n if (ie && ie_version >= 9 && this$1.hasSelection) {\n this$1.hasSelection = null;\n }\n input.poll();\n });\n\n on(te, \"paste\", function(e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) {\n return\n }\n\n cm.state.pasteIncoming = true;\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) {\n return\n }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n if (e.type == \"cut\") {\n cm.state.cutIncoming = true;\n }\n }\n\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n\n on(display.scroller, \"paste\", function(e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) {\n return\n }\n cm.state.pasteIncoming = true;\n input.focus();\n });\n\n // Prevent normal selection in the editor (we handle our own)\n on(display.lineSpace, \"selectstart\", function(e) {\n if (!eventInWidget(display, e)) {\n e_preventDefault(e);\n }\n });\n\n on(te, \"compositionstart\", function() {\n var start = cm.getCursor(\"from\");\n if (input.composing) {\n input.composing.range.clear();\n }\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n };\n });\n on(te, \"compositionend\", function() {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n };\n\n TextareaInput.prototype.createField = function(_display) {\n // Wraps and hides input textarea\n this.wrapper = hiddenTextarea();\n // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n this.textarea = this.wrapper.firstChild;\n };\n\n TextareaInput.prototype.prepareSelection = function() {\n // Redraw the selection and/or cursor\n var cm = this.cm, display = cm.display, doc = cm.doc;\n var result = prepareSelection(cm);\n\n // Move the hidden textarea near the cursor to prevent scrolling artifacts\n if (cm.options.moveInputWithCursor) {\n var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result\n };\n\n TextareaInput.prototype.showSelection = function(drawn) {\n var cm = this.cm, display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n };\n\n // Reset the input to correspond to the selection (or to be empty,\n // when not typing and nothing is selected)\n TextareaInput.prototype.reset = function(typing) {\n if (this.contextMenuPending || this.composing) {\n return\n }\n var cm = this.cm;\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var content = cm.getSelection();\n this.textarea.value = content;\n if (cm.state.focused) {\n selectInput(this.textarea);\n }\n if (ie && ie_version >= 9) {\n this.hasSelection = content;\n }\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n if (ie && ie_version >= 9) {\n this.hasSelection = null;\n }\n }\n };\n\n TextareaInput.prototype.getField = function() {\n return this.textarea\n };\n\n TextareaInput.prototype.supportsTouch = function() {\n return false\n };\n\n TextareaInput.prototype.focus = function() {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt() != this.textarea)) {\n try {\n this.textarea.focus();\n } catch (e) {\n } // IE8 will throw if the textarea is display: none or not in DOM\n }\n };\n\n TextareaInput.prototype.blur = function() {\n this.textarea.blur();\n };\n\n TextareaInput.prototype.resetPosition = function() {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n };\n\n TextareaInput.prototype.receivedFocus = function() {\n this.slowPoll();\n };\n\n // Poll for input changes, using the normal rate of polling. This\n // runs as long as the editor is focused.\n TextareaInput.prototype.slowPoll = function() {\n var this$1 = this;\n\n if (this.pollingFast) {\n return\n }\n this.polling.set(this.cm.options.pollInterval, function() {\n this$1.poll();\n if (this$1.cm.state.focused) {\n this$1.slowPoll();\n }\n });\n };\n\n // When an event has just come in that is likely to add or change\n // something in the input textarea, we poll faster, to ensure that\n // the change appears on the screen quickly.\n TextareaInput.prototype.fastPoll = function() {\n var missed = false, input = this;\n input.pollingFast = true;\n\n function p() {\n var changed = input.poll();\n if (!changed && !missed) {\n missed = true;\n input.polling.set(60, p);\n } else {\n input.pollingFast = false;\n input.slowPoll();\n }\n }\n\n input.polling.set(20, p);\n };\n\n // Read input from the textarea, and update the document to match.\n // When something is selected, it is present in the textarea, and\n // selected (unless it is huge, in which case a placeholder is\n // used). When nothing is selected, the cursor sits after previously\n // seen text (can be empty), which is stored in prevInput (we must\n // not reset the textarea when typing, because that breaks IME).\n TextareaInput.prototype.poll = function() {\n var this$1 = this;\n\n var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n if (this.contextMenuPending || !cm.state.focused ||\n (hasSelection(input) && !prevInput && !this.composing) ||\n cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq) {\n return false\n }\n\n var text = input.value;\n // If nothing changed, bail.\n if (text == prevInput && !cm.somethingSelected()) {\n return false\n }\n // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n if (ie && ie_version >= 9 && this.hasSelection === text ||\n mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n if (first == 0x200b && !prevInput) {\n prevInput = \"\\u200b\";\n }\n if (first == 0x21da) {\n this.reset();\n return this.cm.execCommand(\"undo\")\n }\n }\n // Find the part of the input that is actually new\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) {\n ++same;\n }\n\n runInOp(cm, function() {\n applyTextInput(cm, text.slice(same), prevInput.length - same,\n null, this$1.composing ? \"*compose\" : null);\n\n // Don't leave long text in the textarea, since it makes further polling slow\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) {\n input.value = this$1.prevInput = \"\";\n } else {\n this$1.prevInput = text;\n }\n\n if (this$1.composing) {\n this$1.composing.range.clear();\n this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor(\"to\"),\n {className: \"CodeMirror-composing\"});\n }\n });\n return true\n };\n\n TextareaInput.prototype.ensurePolled = function() {\n if (this.pollingFast && this.poll()) {\n this.pollingFast = false;\n }\n };\n\n TextareaInput.prototype.onKeyPress = function() {\n if (ie && ie_version >= 9) {\n this.hasSelection = null;\n }\n this.fastPoll();\n };\n\n TextareaInput.prototype.onContextMenu = function(e) {\n var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) {\n return\n } // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1) {\n operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll);\n }\n\n var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n input.wrapper.style.cssText = \"position: absolute\";\n var wrapperBox = input.wrapper.getBoundingClientRect();\n te.style.cssText = \"position: absolute; width: 30px; height: 30px;\\n top: \" + (e.clientY - wrapperBox.top - 5) + \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px;\\n z-index: 1000; background: \" + (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") + \";\\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n var oldScrollY;\n if (webkit) {\n oldScrollY = window.scrollY;\n } // Work around Chrome issue (#2712)\n display.input.focus();\n if (webkit) {\n window.scrollTo(null, oldScrollY);\n }\n display.input.reset();\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) {\n te.value = input.prevInput = \" \";\n }\n input.contextMenuPending = true;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1;\n te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n\n function rehide() {\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS;\n te.style.cssText = oldCSS;\n if (ie && ie_version < 9) {\n display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos);\n }\n\n // Try to detect the user choosing select-all\n if (te.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) {\n prepareSelectAllHack();\n }\n var i = 0, poll = function() {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n te.selectionEnd > 0 && input.prevInput == \"\\u200b\") {\n operation(cm, selectAll)(cm);\n } else if (i++ < 10) {\n display.detectingSelectAll = setTimeout(poll, 500);\n } else {\n display.selForContextMenu = null;\n display.input.reset();\n }\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) {\n prepareSelectAllHack();\n }\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function() {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n };\n\n TextareaInput.prototype.readOnlyChanged = function(val) {\n if (!val) {\n this.reset();\n }\n this.textarea.disabled = val == \"nocursor\";\n };\n\n TextareaInput.prototype.setUneditable = function() {\n };\n\n TextareaInput.prototype.needsContentAttribute = false;\n\n function fromTextArea(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n if (!options.tabindex && textarea.tabIndex) {\n options.tabindex = textarea.tabIndex;\n }\n if (!options.placeholder && textarea.placeholder) {\n options.placeholder = textarea.placeholder;\n }\n // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n if (options.autofocus == null) {\n var hasFocus = activeElt();\n options.autofocus = hasFocus == textarea ||\n textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {\n textarea.value = cm.getValue();\n }\n\n var realSubmit;\n if (textarea.form) {\n on(textarea.form, \"submit\", save);\n // Deplorable hack to make the submit method do the right thing.\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form;\n realSubmit = form.submit;\n try {\n var wrappedSubmit = form.submit = function() {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch (e) {\n }\n }\n }\n\n options.finishInit = function(cm) {\n cm.save = save;\n cm.getTextArea = function() {\n return textarea;\n };\n cm.toTextArea = function() {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n if (typeof textarea.form.submit == \"function\") {\n textarea.form.submit = realSubmit;\n }\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror(function(node) {\n return textarea.parentNode.insertBefore(node, textarea.nextSibling);\n },\n options);\n return cm\n }\n\n function addLegacyProps(CodeMirror) {\n CodeMirror.off = off;\n CodeMirror.on = on;\n CodeMirror.wheelEventPixels = wheelEventPixels;\n CodeMirror.Doc = Doc;\n CodeMirror.splitLines = splitLinesAuto;\n CodeMirror.countColumn = countColumn;\n CodeMirror.findColumn = findColumn;\n CodeMirror.isWordChar = isWordCharBasic;\n CodeMirror.Pass = Pass;\n CodeMirror.signal = signal;\n CodeMirror.Line = Line;\n CodeMirror.changeEnd = changeEnd;\n CodeMirror.scrollbarModel = scrollbarModel;\n CodeMirror.Pos = Pos;\n CodeMirror.cmpPos = cmp;\n CodeMirror.modes = modes;\n CodeMirror.mimeModes = mimeModes;\n CodeMirror.resolveMode = resolveMode;\n CodeMirror.getMode = getMode;\n CodeMirror.modeExtensions = modeExtensions;\n CodeMirror.extendMode = extendMode;\n CodeMirror.copyState = copyState;\n CodeMirror.startState = startState;\n CodeMirror.innerMode = innerMode;\n CodeMirror.commands = commands;\n CodeMirror.keyMap = keyMap;\n CodeMirror.keyName = keyName;\n CodeMirror.isModifierKey = isModifierKey;\n CodeMirror.lookupKey = lookupKey;\n CodeMirror.normalizeKeyMap = normalizeKeyMap;\n CodeMirror.StringStream = StringStream;\n CodeMirror.SharedTextMarker = SharedTextMarker;\n CodeMirror.TextMarker = TextMarker;\n CodeMirror.LineWidget = LineWidget;\n CodeMirror.e_preventDefault = e_preventDefault;\n CodeMirror.e_stopPropagation = e_stopPropagation;\n CodeMirror.e_stop = e_stop;\n CodeMirror.addClass = addClass;\n CodeMirror.contains = contains;\n CodeMirror.rmClass = rmClass;\n CodeMirror.keyNames = keyNames;\n }\n\n // EDITOR CONSTRUCTOR\n\n defineOptions(CodeMirror);\n\n addEditorMethods(CodeMirror);\n\n // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n for (var prop in Doc.prototype) {\n if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0) {\n CodeMirror.prototype[prop] = (function(method) {\n return function() {\n return method.apply(this.doc, arguments)\n }\n })(Doc.prototype[prop]);\n }\n }\n\n eventMixin(Doc);\n CodeMirror.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n CodeMirror.defineMode = function(name/*, mode, …*/) {\n if (!CodeMirror.defaults.mode && name != \"null\") {\n CodeMirror.defaults.mode = name;\n }\n defineMode.apply(this, arguments);\n };\n\n CodeMirror.defineMIME = defineMIME;\n\n // Minimal default mode.\n CodeMirror.defineMode(\"null\", function() {\n return ({\n token: function(stream) {\n return stream.skipToEnd();\n }\n });\n });\n CodeMirror.defineMIME(\"text/plain\", \"null\");\n\n // EXTENSIONS\n\n CodeMirror.defineExtension = function(name, func) {\n CodeMirror.prototype[name] = func;\n };\n CodeMirror.defineDocExtension = function(name, func) {\n Doc.prototype[name] = func;\n };\n\n CodeMirror.fromTextArea = fromTextArea;\n\n addLegacyProps(CodeMirror);\n\n CodeMirror.version = \"5.41.0\";\n\n return CodeMirror;\n\n})));\n"],"names":["global","factory","this","userAgent","navigator","platform","gecko","test","ie_upto10","ie_11up","exec","edge","ie","ie_version","document","documentMode","webkit","qtwebkit","chrome","presto","safari","vendor","mac_geMountainLion","phantom","ios","android","mobile","mac","chromeOS","windows","presto_version","match","Number","flipCtrlCmd","captureRightClick","classTest","cls","RegExp","range","rmClass","node","current","className","after","slice","index","length","removeChildren","e","count","childNodes","removeChild","firstChild","removeChildrenAndAdd","parent","appendChild","elt","tag","content","style","createElement","cssText","createTextNode","i","eltP","setAttribute","contains","child","nodeType","parentNode","host","activeElt","activeElement","body","shadowRoot","addClass","joinClasses","a","b","as","split","createRange","start","end","endNode","r","setEnd","setStart","createTextRange","moveToElementText","collapse","moveEnd","moveStart","selectInput","select","bind","f","args","Array","prototype","call","arguments","apply","copyObj","obj","target","overwrite","prop","hasOwnProperty","countColumn","string","tabSize","startIndex","startValue","search","n","nextTab","indexOf","selectionStart","selectionEnd","value","_e","Delayed","id","array","set","ms","clearTimeout","setTimeout","Pass","toString","sel_dontScroll","scroll","sel_mouse","origin","sel_move","findColumn","goal","pos","col","skipped","Math","min","spaceStrs","spaceStr","push","lst","arr","map","out","nothing","createObj","base","props","inst","Object","create","nonASCIISingleCaseWordChar","isWordCharBasic","ch","toUpperCase","toLowerCase","isWordChar","helper","source","isEmpty","extendingChars","isExtendingChar","charCodeAt","skipExtendingChars","str","dir","charAt","findFirst","pred","from","to","midF","mid","ceil","floor","Display","place","doc","input","d","scrollbarFiller","gutterFiller","lineDiv","selectionDiv","cursorDiv","measure","lineMeasure","lineSpace","lines","mover","sizer","sizerWidth","heightForcer","gutters","lineGutter","scroller","wrapper","zIndex","paddingRight","draggable","viewFrom","viewTo","first","reportedViewFrom","reportedViewTo","view","renderedView","externalMeasured","viewOffset","lastWrapHeight","lastWrapWidth","updateLineNumbers","nativeBarWidth","barHeight","barWidth","scrollbarsClipped","lineNumWidth","lineNumInnerWidth","lineNumChars","alignWidgets","cachedCharWidth","cachedTextHeight","cachedPaddingH","maxLine","maxLineLength","maxLineChanged","wheelDX","wheelDY","wheelStartX","wheelStartY","shift","selForContextMenu","activeTouch","init","getLine","size","Error","chunk","children","sz","chunkSize","getBetween","line","iter","text","getLines","updateLineHeight","height","diff","lineNo","cur","no","lineAtHeight","h","outer","i$1","lh","isLine","l","lineNumberFor","options","String","lineNumberFormatter","firstLineNumber","Pos","sticky","cmp","equalCursorPos","copyPos","x","maxPos","minPos","clipLine","max","clipPos","last","linelen","clipToLen","clipPosArray","sawReadOnlySpans","sawCollapsedSpans","MarkedSpan","marker","getMarkedSpanFor","spans","span","removeMarkedSpan","stretchSpansOverChange","change","full","oldFirst","markedSpans","oldLast","startCh","endCh","isInsert","old","nw","inclusiveLeft","type","insertLeft","endsAfter","inclusiveRight","markedSpansBefore","startsBefore","markedSpansAfter","sameLine","offset","found","span$1","clearEmptySpans","newMarkers","gapMarkers","gap","i$2","i$3","clearWhenEmpty","splice","detachMarkedSpans","detachLine","attachMarkedSpans","attachLine","extraLeft","extraRight","compareCollapsedMarkers","lenDiff","aPos","find","bPos","fromCmp","toCmp","collapsedSpanAtSide","sps","sp","collapsed","collapsedSpanAtStart","collapsedSpanAtEnd","collapsedSpanAround","conflictingCollapsedRange","lineNo$$1","visualLine","merged","visualLineNo","lineN","vis","visualLineEndNo","lastLine","lineIsHidden","widgetNode","lineIsHiddenInner","heightAtLine","lineObj","p","lineLength","len","found$1","findMaxLine","cm","display","bidiOther","getBidiPartAt","order","bidiOrdering","bidiRE","isNeutral","isStrong","countsAsLeft","countsAsNum","BidiSpan","level","direction","outerType","code","types","prev","type$1","prev$1","type$2","i$4","type$3","replace","j","i$5","cur$1","type$4","i$6","end$1","before","replace$1","j$1","m","i$7","at","j$2","nstart","unshift","reverse","getOrder","noHandlers","on","emitter","addEventListener","attachEvent","map$$1","_handlers","concat","getHandlers","off","removeEventListener","detachEvent","signal","handlers","signalDOMEvent","override","preventDefault","defaultPrevented","e_defaultPrevented","codemirrorIgnore","signalCursorActivity","cursorActivity","curOp","cursorActivityHandlers","hasHandler","eventMixin","ctor","e_preventDefault","returnValue","e_stopPropagation","stopPropagation","cancelBubble","e_stop","e_target","srcElement","e_button","which","button","ctrlKey","zwspSupported","badBidiRects","dragAndDrop","div","zeroWidthElement","offsetHeight","offsetWidth","hasBadBidiRects","txt","r0","getBoundingClientRect","r1","left","right","splitLinesAuto","result","nl","rt","hasSelection","window","getSelection","te","range$$1","ownerDocument","selection","parentElement","compareEndPoints","hasCopyEvent","oncopy","badZoomedRects","modes","mimeModes","defineMode","name","mode","dependencies","resolveMode","spec","getMode","mfactory","modeObj","modeExtensions","exts","helperType","modeProps","prop$1","extendMode","properties","copyState","state","nstate","val","innerMode","info","startState","a1","a2","StringStream","lineOracle","lastColumnPos","lastColumnValue","lineStart","eol","sol","peek","undefined","next","eat","eatWhile","eatSpace","skipToEnd","skipTo","backUp","column","indentation","pattern","consume","caseInsensitive","cased","substr","hideFirstChars","inner","lookAhead","oracle","baseToken","SavedContext","Context","maxLookAhead","baseTokens","baseTokenPos","highlightLine","context","forceToEnd","st","modeGen","lineClasses","runMode","loop","o","overlay","overlays","i_end","opaque","styles","classes","bgClass","textClass","getLineStyles","updateFrontier","getContextBefore","resetState","maxHighlightLength","stateAfter","save","styleClasses","highlightFrontier","modeFrontier","precise","minindent","minline","lim","indented","findStartLine","saved","fromSaved","processLine","nextLine","startAt","stream","callBlankLine","readToken","blankLine","token","copy","Token","takeToken","asArray","tokens","extractLineClasses","output","lineClass","flattenSpans","curStart","curStyle","addModeClass","mName","Line","estimateHeight","cleanUpLine","styleToClassCache","styleToClassCacheWithMode","interpretTokenStyle","cache","buildLineContent","lineView","builder","pre","trailingSpace","splitSpaces","getOption","rest","addToken","buildToken","buildTokenBadBidi","insertLineContent","maps","caches","lastChild","querySelector","defaultSpecialCharPlaceholder","title","startStyle","endStyle","css","displayText","trailingBefore","spaceBefore","special","specialChars","mustWrap","createDocumentFragment","lastIndex","txt$1","tabWidth","specialCharPlaceholder","fullStyle","part","buildCollapsedSpan","ignoreWidget","widget","needsContentAttribute","setUneditable","allText","spanStyle","spanEndStyle","spanStartStyle","nextChange","Infinity","foundBookmarks","endStyles","upto","tokenText","LineView","visualLineContinued","hidden","buildViewArray","nextPos","operationGroup","orphanDelayedCallbacks","signalLater","list","delayedCallbacks","fireOrphanDelayed","delayed","updateLineForChanges","dims","changes","updateLineText","updateLineGutter","updateLineClasses","updateLineWidgets","ensureLineWrapped","replaceChild","getLineContent","ext","built","background","wrap","insertBefore","updateLineBackground","wrapClass","gutter","gutterBackground","gutterClass","fixedGutter","fixedPos","gutterTotalWidth","markers","gutterMarkers","lineNumbers","wrap$1","gutterWrap","lineNumber","gutterLeft","k","gutterWidth","alignable","nextSibling","insertLineWidgets","buildLineElement","insertLineWidgetsFor","allowAbove","widgets","ws","handleMouseEvents","positionLineWidget","above","noHScroll","width","wrapperWidth","coverGutter","paddingLeft","position","marginLeft","widgetHeight","parentStyle","clientWidth","eventInWidget","getAttribute","paddingTop","offsetTop","paddingVert","paddingH","getComputedStyle","currentStyle","data","parseInt","isNaN","scrollGap","displayWidth","displayHeight","clientHeight","mapFromLineView","measureChar","bias","measureCharPrepared","prepareMeasureForLine","findViewForLine","findViewIndex","getDimensions","forceUpdate","updateExternalMeasurement","rect","hasHeights","prepared","varHeight","key","wrapping","lineWrapping","curWidth","heights","rects","getClientRects","abs","bottom","top","ensureLineHeights","nodeAndOffsetInLineMap","coverStart","coverEnd","getUsefulRect","screen","logicalXDPI","deviceXDPI","normal","fromRange","hasBadZoomedRects","scaleX","scaleY","logicalYDPI","deviceYDPI","maybeUpdateRectForZooming","rSpan","charWidth","nullRect","rtop","rbot","bot","bogus","singleCursorHeightPerLine","rbottom","measureCharInner","measureText","mStart","mEnd","clearLineMeasurementCacheFor","clearLineMeasurementCache","externalMeasure","clearCaches","pageScrollX","pageXOffset","documentElement","scrollLeft","pageScrollY","marginTop","pageYOffset","scrollTop","widgetTopHeight","intoCoordSystem","includeWidgets","yOff","lOff","xOff","fromCoordSystem","coords","localBox","lineSpaceBox","charCoords","cursorCoords","preparedMeasure","get","getBidi","partPos","invert","other","estimateCoords","PosWithInfo","outside","xRel","coordsChar","y","coordsCharInner","rangeEnd","wrappedLineExtent","begin","wrappedLineExtentChar","boxIsAfter","box","widgetHeight$$1","ltr","coordsBidiPartWrapped","coordsBidiPart","baseX","chAround","boxAround","atLeft","atStart","_lineNo","ref","closestDist","endX","dist","textHeight","anchor","clientLeft","offsetLeft","compensateForHScroll","th","perLine","widgetsHeight","estimateLineHeights","est","estHeight","posFromMouse","liberal","forRect","space","clientX","clientY","colDiff","round","updateSelection","showSelection","prepareSelection","primary","curFragment","cursors","selFragment","sel","ranges","primIndex","empty","showCursorWhenSelecting","drawSelectionCursor","head","drawSelectionRange","cursor","cursorHeight","otherCursor","cmpCoords","fragment","padding","leftSide","rightSide","docLTR","add","drawForLine","fromArg","toArg","lineLen","wrapX","side","extent","iterateBidiSections","fromPos","toPos","openStart","openEnd","openRight","topLeft","topRight","botLeft","botRight","sFrom","sTo","fromLine","toLine","singleVLine","leftEnd","rightStart","restartBlink","focused","clearInterval","blinker","visibility","cursorBlinkRate","setInterval","ensureFocus","focus","onFocus","delayBlurEvent","delayingBlurEvent","onBlur","readOnly","reset","receivedFocus","updateHeightsInViewport","prevBottom","updateWidgetHeight","w","visibleLines","viewport","ensure","ensureFrom","ensureTo","alignHorizontally","comp","gutterW","align","maybeUpdateLineNumberWidth","innerW","updateGutterSpace","calculateScrollPos","snapMargin","screentop","docBottom","atTop","atBottom","newTop","screenleft","screenw","tooWide","addToScrollTop","resolveScrollToPos","ensureCursorVisible","getCursor","scrollToPos","margin","cursorScrollMargin","scrollToCoords","scrollToCoordsRange","sPos","updateScrollTop","updateDisplaySimple","setScrollTop","startWorker","forceScroll","scrollHeight","scrollbars","setScrollLeft","isScroller","scrollWidth","measureForScrollbars","docH","viewHeight","viewWidth","barLeft","docHeight","NativeScrollbars","vert","horiz","tabIndex","checkedZeroWidth","minHeight","minWidth","update","needsH","needsV","sWidth","totalHeight","totalWidth","zeroWidthHack","disableHoriz","enableZeroWidthBar","disableVert","pointerEvents","bar","delay","maybeDisable","elementFromPoint","clear","NullScrollbars","updateScrollbars","startWidth","startHeight","updateScrollbarsInner","sizes","paddingBottom","borderBottom","coverGutterNextToScrollbar","scrollbarModel","initScrollbars","scrollbarStyle","axis","nextOpId","startOperation","op","viewChanged","updateInput","typing","changeObjs","cursorActivityCalled","selectionChanged","updateMaxLine","ops","ownsGroup","endOperation","endCb","group","callbacks","fireCallbacksForOps","finishOperation","endOperation_R1","endOperation_W1","endOperation_R2","endOperation_W2","endOperation_finish","endOperations","marginBottom","borderRightWidth","maybeClipScrollbars","mustUpdate","DisplayUpdate","updatedDisplay","updateDisplayIfNeeded","barMeasure","adjustWidthTo","maxScrollLeft","preparedSelection","takeFocus","setDocumentHeight","postUpdateDisplay","limit","changed","endCoords","scrollPos","startTop","startLeft","scrollPosIntoView","doScroll","innerHeight","scrollNode","scrollIntoView","maybeScrollWindow","maybeHiddenMarkers","unhidden","maybeUnhiddenMarkers","finish","runInOp","operation","methodOp","docMethodOp","regChange","lendiff","resetView","cut","viewCuttingPoint","cut$1","cutTop","cutBot","regLineChange","oldN","newN","countDirtyView","dirty","time","highlight","highlightWorker","Date","workTime","changedLines","oldStyles","highlighted","oldCls","newCls","ischange","workDelay","force","visible","editorIsHidden","wrapperHeight","oldDisplayWidth","events","viewportMargin","different","adjustView","toUpdate","selSnapshot","hasFocus","active","anchorNode","extend","anchorOffset","focusNode","focusOffset","selectionSnapshot","updateNumbersFrom","container","rm","currentWheelTarget","updateNumber","patchDisplay","snapshot","removeAllRanges","addRange","restoreSelection","updateGutters","specs","gElt","setGuttersForLineNumbers","wheelSamples","wheelPixelsPerUnit","wheelEventDelta","dx","wheelDeltaX","dy","wheelDeltaY","detail","HORIZONTAL_AXIS","VERTICAL_AXIS","wheelDelta","wheelEventPixels","delta","onScrollWheel","canScrollX","canScrollY","pixels","movedX","movedY","sample","Selection","equals","here","there","deepCopy","Range","somethingSelected","normalizeSelection","mayTouch","selectionsMayTouch","prim","sort","inv","simpleSelection","changeEnd","adjustForChange","computeSelAfterChange","offsetPos","loadMode","modeOption","resetModeState","isWholeLineUpdate","wholeLineUpdateBefore","updateDoc","estimateHeight$$1","spansFor","updateLine","linesFor","firstLine","lastText","lastSpans","nlines","insert","remove","added","added$1","added$2","linkedDocs","sharedHistOnly","propagate","skip","sharedHist","linked","rel","shared","attachDoc","setDirectionClass","History","startGen","done","undone","undoDepth","lastModTime","lastSelTime","lastOp","lastSelOp","lastOrigin","lastSelOrigin","generation","maxGeneration","historyChangeFromChange","histChange","attachLocalSpans","clearSelectionEvents","pop","addChangeToHistory","selAfter","opId","hist","history","historyEventDelay","lastChangeEvent","pushSelectionToHistory","addSelectionToHistory","selectionEventCanBeMerged","clearRedo","dest","existing","removeClearedSpans","explicitlyCleared","mergeOldSpans","getOldSpans","stretched","oldCur","stretchCur","copyHistoryArray","newGroup","instantiateSel","event","newChanges","extendRange","posBefore","extendSelection","setSelection","extendSelections","heads","replaceOneSelection","setSimpleSelection","setSelectionReplaceHistory","setSelectionNoUndo","NaN","filterSelectionChange","setSelectionInner","skipAtomicInSelection","reCheckSelection","mayClear","newAnchor","skipAtomic","newHead","skipAtomicInner","oldPos","atomic","near","movePos","far","cantEdit","selectAll","filterChange","canceled","cancel","makeChange","ignoreReadOnly","suppressEdits","mark","parts","mk","newParts","dfrom","dto","removeReadOnlyRanges","makeChangeInner","makeChangeSingleDoc","rebased","rebaseHist","makeChangeFromHistory","allowSelectionOnly","suppress","antiChanges","filter","returned","v","shiftDoc","distance","removed","recomputeMaxLength","checkWidthStart","retreatFrontier","changesHandler","changeHandler","makeChangeSingleDocInEditor","replaceRange","assign","splitLines","rebaseHistSelSingle","rebaseHistArray","sub","ok","copied","changeLine","handle","changeType","LeafChunk","BranchChunk","removeInner","insertInner","iterN","oldHeight","remaining","leaf","maybeSpill","me","sibling","myIndex","used","LineWidget","opt","adjustScrollWhenAboveVisible","this$1","oldH","nextMarkerId","TextMarker","markText","cloneNode","isParent","SharedTextMarker","markTextShared","replacedWith","addToHistory","curLine","addMarkedSpan","clearOnEnter","clearHistory","withOp","visual","dHeight","findSharedMarkers","findMarks","detachSharedMarkers","subMarker","nextDocId","Doc","lineSep","cleanGeneration","constructor","getValue","join","lineSeparator","setValue","getRange","getLineHandle","getLineNumber","getLineHandleVisualStart","lineCount","listSelections","setCursor","extendSelectionsBy","setSelections","addSelection","getSelections","replaceSelection","dup","replaceSelections","newSel","hint","oldPrev","newPrev","computeReplacedSel","undo","redo","undoSelection","redoSelection","setExtending","getExtending","historySize","markClean","changeGeneration","forceSplit","isClean","gen","getHistory","setHistory","histData","setGutterMarker","gutterID","clearGutter","lineInfo","addLineClass","where","removeLineClass","addLineWidget","insertAt","aboveVisible","removeLineWidget","setBookmark","realOpts","findMarksAt","getAllMarks","posFromIndex","sepSize","indexFromPos","copyHistory","linkedDoc","mFrom","mTo","subMark","copySharedMarkers","unlinkDoc","CodeMirror","splitIds","iterLinkedDocs","getEditor","setDirection","eachLine","lastDrop","onDrop","clearDragCursor","files","dataTransfer","isReadOnly","FileReader","File","read","loadFile","file","allowDropFileTypes","reader","onload","readAsText","draggingText","text$1","getData","selected","dragCursor","forEachCodeMirror","getElementsByClassName","byClass","globalsRegistered","ensureGlobalHandlers","resizeTimer","onResize","setSize","keyNames","fromCharCode","keyMap","normalizeKeyName","alt","ctrl","cmd","mod","normalizeKeyMap","keymap","keyname","keys","lookupKey","getKeyMap","fallthrough","isModifierKey","keyCode","addModifierNames","noShift","altKey","metaKey","shiftKey","keyName","altGraphKey","deleteNearSelection","compute","kill","toKill","replaced","moveCharLogically","moveLogically","endOfLine","visually","prep","targetTop","basic","pcDefault","emacsy","macDefault","commands","singleSelection","killLine","deleteLine","delLineLeft","delWrappedLineLeft","delWrappedLineRight","rightPos","goDocStart","goDocEnd","goLineStart","goLineStartSmart","lineStartSmart","goLineEnd","visualLineEnd","lineEnd","goLineRight","goLineLeft","goLineLeftSmart","goLineUp","moveV","goLineDown","goPageUp","goPageDown","goCharLeft","moveH","goCharRight","goColumnLeft","goColumnRight","goWordLeft","goGroupRight","goGroupLeft","goWordRight","delCharBefore","deleteH","delCharAfter","delWordBefore","delWordAfter","delGroupBefore","delGroupAfter","indentAuto","indentSelection","indentMore","indentLess","insertTab","insertSoftTab","spaces","defaultTab","execCommand","transposeChars","newlineAndIndent","sels","indentLine","openLine","toggleOverwrite","firstNonWS","inWS","doHandleBinding","bound","dropShift","ensurePolled","prevShift","stopSeq","dispatchKey","seq","keySeq","dispatchKeyInner","keyMaps","extraKeys","lookupKeyForEditor","handleKeyBinding","motion","lastStoppedKey","onKeyDown","handled","up","showCrossHair","onKeyUp","onKeyPress","charCode","handleCharBinding","lastClick","lastDoubleClick","PastClick","onMouseDown","supportsTouch","clickInGutter","repeat","now","compare","clickRepeat","selectingText","handleMappedButton","contained","behavior","option","unit","addNew","moveOnDrag","configureMouse","dragDrop","moved","dragEnd","mouseMove","dragStart","e2","leftButtonStartDrag","ourRange","ourIndex","startSel","rangeForUnit","lastPos","extendTo","startCol","posCol","leftPos","oldRange","ranges$1","anchorLine","boundary","headIndex","usePart","bidiSimplify","editorSize","counter","curCount","move","buttons","leftButtonSelect","leftButtonDown","onContextMenu","findWordAt","gutterEvent","prevent","mX","mY","touches","lineBox","g","contextMenuInGutter","themeChanged","theme","Init","defaults","optionHandlers","guttersChanged","dragDropChanged","funcs","dragFunctions","toggle","enter","over","leave","drop","wrappingChanged","inputStyles","inputStyle","pasteIncoming","cutIncoming","autofocus","word","touchFinished","prevTouch","finishTouch","isMouseLikeTouchEvent","touch","radiusX","radiusY","farAway","pageX","pageY","frag","onDragOver","setData","effectAllowed","setDragImage","img","src","_top","onDragStart","inp","getField","registerEventHandlers","finishInit","initHooks","textRendering","how","aggressive","indent","curSpace","curSpaceString","indentUnit","indentString","indentWithTabs","pos$1","defineInitHook","lastCopied","setLastCopied","newLastCopied","applyTextInput","inserted","deleted","paste","textLines","multiPaste","pasteLinesPerSelection","lineWise","changeEvent","triggerElectric","handlePaste","pasted","clipboardData","disableInput","electricChars","smartIndent","getModeAt","electricInput","copyableRanges","lineRange","disableBrowserMagic","field","spellcheck","hiddenTextarea","border","findPosH","origDir","moveOnce","boundToLine","bidi","mv","getWrappedLineExtent","moveInStorageOrder","searchInVisualLine","getRes","res","nextCh","moveVisually","sawType","getHelper","hitSide","findPosV","pageSize","moveAmount","ContentEditableInput","lastAnchorNode","lastAnchorOffset","lastFocusNode","lastFocusOffset","polling","composing","gracePeriod","readDOMTimeout","posToDOM","badPos","bad","domToPos","lineNode","locateNodeInLineView","textNode","topNode","nodeValue","curNode","textContent","previousSibling","dist$1","onCopyCut","lineWiseCopyCut","clearData","kludge","hadFocus","showPrimarySelection","updateFromDOM","readFromDOMSoon","forceCompositionEnd","showMultipleSelections","curAnchor","curFocus","rng","rangeCount","getRangeAt","startGracePeriod","rememberSelection","selectionInEditor","commonAncestorContainer","blur","pollSelection","pollInterval","poll","scan","isInGutter","triggerOnKeyDown","pollContent","fromIndex","fromNode","toNode","toIndex","newText","closing","extraLinebreak","recognizeMarker","close","addText","walk","cmText","markerID","isBlock","nodeName","domTextBetween","oldText","cutFront","cutEnd","oldTop","maxCutFront","newBot","oldBot","maxCutEnd","chFrom","chTo","contentEditable","readOnlyChanged","resetPosition","TextareaInput","prevInput","pollingFast","createField","textarea","prepareCopyCut","fastPoll","_display","moveInputWithCursor","headPos","wrapOff","lineOff","teTop","teLeft","drawn","contextMenuPending","slowPoll","missed","same","resetSelectionOnContextMenu","oldCSS","oldWrapperCSS","oldScrollY","wrapperBox","scrollY","scrollTo","detectingSelectAll","prepareSelectAllHack","mouseup","rehide","extval","disabled","deflt","notOnInit","defineOption","newBreaks","refresh","getInputField","detach","attach","integer","defineOptions","helpers","setOption","getDoc","addKeyMap","removeKeyMap","addOverlay","score","priority","insertSorted","modeSpec","removeOverlay","newRanges","getTokenAt","getLineTokens","getTokenTypeAt","getHelpers","help","_global","getStateAfter","defaultTextHeight","defaultCharWidth","getViewport","addWidget","vspace","hspace","triggerOnKeyPress","triggerOnKeyUp","triggerOnMouseDown","amount","rtlMoveVisually","goalColumn","goals","startChar","check","getScrollInfo","scrollToRange","interpret","swapDoc","phrase","phraseText","phrases","getWrapperElement","getScrollerElement","getGutterElement","registerHelper","registerGlobalHelper","predicate","addEditorMethods","dontDelegate","method","defineMIME","mime","defineExtension","func","defineDocExtension","fromTextArea","tabindex","placeholder","realSubmit","form","leaveSubmitMethodAlone","submit","wrappedSubmit","getTextArea","toTextArea","cmpPos","addLegacyProps","version","exports","module","define","amd"],"mappings":"AAUC,IAASA,OAAQC,QAARD,OAIRE,OAJgBD,QAIT,eAKDE,UAAYC,UAAUD,UACtBE,SAAWD,UAAUC,SAErBC,MAAQ,aAAaC,KAAKJ,WAC1BK,UAAY,UAAUD,KAAKJ,WAC3BM,QAAU,wCAAwCC,KAAKP,WACvDQ,KAAO,cAAcD,KAAKP,WAC1BS,GAAKJ,WAAaC,SAAWE,KAC7BE,WAAaD,KAAOJ,UAAYM,SAASC,cAAgB,IAAMJ,MAAQF,SAAS,IAChFO,QAAUL,MAAQ,WAAWJ,KAAKJ,WAClCc,SAAWD,QAAU,eAAeT,KAAKJ,WACzCe,QAAUP,MAAQ,WAAWJ,KAAKJ,WAClCgB,OAAS,UAAUZ,KAAKJ,WACxBiB,OAAS,iBAAiBb,KAAKH,UAAUiB,QACzCC,mBAAqB,+BAA+Bf,KAAKJ,WACzDoB,QAAU,YAAYhB,KAAKJ,WAE3BqB,KAAOb,MAAQ,cAAcJ,KAAKJ,YAAc,cAAcI,KAAKJ,WACnEsB,QAAU,UAAUlB,KAAKJ,WAEzBuB,OAASF,KAAOC,SAAW,mDAAmDlB,KAAKJ,WACnFwB,IAAMH,KAAO,MAAMjB,KAAKF,UACxBuB,SAAW,WAAWrB,KAAKJ,WAC3B0B,QAAU,OAAOtB,KAAKF,UAEtByB,eAAiBX,QAAUhB,UAAU4B,MAAM,uBAC3CD,iBACAA,eAAiBE,OAAOF,eAAe,KAEvCA,gBAAkBA,gBAAkB,KACpCX,QAAS,EACTH,QAAS,OAGTiB,YAAcN,MAAQV,UAAYE,SAA6B,MAAlBW,gBAA0BA,eAAiB,QACxFI,kBAAoB5B,OAAUM,IAAMC,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,UAAYA,UACvBw6B,WAAWn6B,YAAcA,YACzBm6B,WAAWj6B,QAAUA,QACrBi6B,WAAW95B,eAAiBA,eAC5B85B,WAAWz5B,WAAaA,WACxBy5B,WAAWv5B,UAAYA,UACvBu5B,WAAWj5B,WAAaA,WACxBi5B,WAAWn5B,UAAYA,UACvBm5B,WAAWyE,SAAWA,SACtBzE,WAAWoC,OAASA,OACpBpC,WAAWwD,QAAUA,QACrBxD,WAAWiD,cAAgBA,cAC3BjD,WAAW8C,UAAYA,UACvB9C,WAAW0C,gBAAkBA,gBAC7B1C,WAAW94B,aAAeA,aAC1B84B,WAAWnF,iBAAmBA,iBAC9BmF,WAAWvF,WAAaA,WACxBuF,WAAW7F,WAAaA,WACxB6F,WAAWn9B,iBAAmBA,iBAC9Bm9B,WAAWj9B,kBAAoBA,kBAC/Bi9B,WAAW98B,OAASA,OACpB88B,WAAWvzC,SAAWA,SACtBuzC,WAAWh0C,SAAWA,SACtBg0C,WAAW31C,QAAUA,QACrB21C,WAAWkC,SAAWA,SAyD1Bod,CAAetf,YAEfA,WAAWuf,QAAU,SAEdvf,YAtgYY,iBAAZwf,SAA0C,oBAAXC,OAAyBA,OAAOD,QAAUz3D,UAC1D,mBAAX23D,QAAyBA,OAAOC,IAAMD,+CAAO33D,SAC/CD,OAAOk4C,WAAaj4C"} \ No newline at end of file +{"version":3,"file":"codemirror.min.js","sources":["../src/codemirror.js"],"sourcesContent":["/*eslint-disable*/\n// CodeMirror, copyright (c) by Marijn Haverbeke and others\n// Distributed under an MIT license: https://codemirror.net/5/LICENSE\n\n// This is CodeMirror (https://codemirror.net/5), a code editor\n// implemented in JavaScript on top of the browser's DOM.\n//\n// You can find some technical background for some of the code below\n// at http://marijnhaverbeke.nl/blog/#cm-internals .\n\n(function (global, factory) {\n typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :\n typeof define === 'function' && define.amd ? define(factory) :\n (global = global || self, global.CodeMirror = factory());\n}(this, (function () { 'use strict';\n\n // Kludges for bugs and behavior differences that can't be feature\n // detected are enabled based on userAgent etc sniffing.\n var userAgent = navigator.userAgent;\n var platform = navigator.platform;\n\n var gecko = /gecko\\/\\d/i.test(userAgent);\n var ie_upto10 = /MSIE \\d/.test(userAgent);\n var ie_11up = /Trident\\/(?:[7-9]|\\d{2,})\\..*rv:(\\d+)/.exec(userAgent);\n var edge = /Edge\\/(\\d+)/.exec(userAgent);\n var ie = ie_upto10 || ie_11up || edge;\n var ie_version = ie && (ie_upto10 ? document.documentMode || 6 : +(edge || ie_11up)[1]);\n var webkit = !edge && /WebKit\\//.test(userAgent);\n var qtwebkit = webkit && /Qt\\/\\d+\\.\\d+/.test(userAgent);\n var chrome = !edge && /Chrome\\/(\\d+)/.exec(userAgent);\n var chrome_version = chrome && +chrome[1];\n var presto = /Opera\\//.test(userAgent);\n var safari = /Apple Computer/.test(navigator.vendor);\n var mac_geMountainLion = /Mac OS X 1\\d\\D([8-9]|\\d\\d)\\D/.test(userAgent);\n var phantom = /PhantomJS/.test(userAgent);\n\n var ios = safari && (/Mobile\\/\\w+/.test(userAgent) || navigator.maxTouchPoints > 2);\n var android = /Android/.test(userAgent);\n // This is woefully incomplete. Suggestions for alternative methods welcome.\n var mobile = ios || android || /webOS|BlackBerry|Opera Mini|Opera Mobi|IEMobile/i.test(userAgent);\n var mac = ios || /Mac/.test(platform);\n var chromeOS = /\\bCrOS\\b/.test(userAgent);\n var windows = /win/i.test(platform);\n\n var presto_version = presto && userAgent.match(/Version\\/(\\d*\\.\\d*)/);\n if (presto_version) { presto_version = Number(presto_version[1]); }\n if (presto_version && presto_version >= 15) { presto = false; webkit = true; }\n // Some browsers use the wrong event properties to signal cmd/ctrl on OS X\n var flipCtrlCmd = mac && (qtwebkit || presto && (presto_version == null || presto_version < 12.11));\n var captureRightClick = gecko || (ie && ie_version >= 9);\n\n function classTest(cls) { return new RegExp(\"(^|\\\\s)\" + cls + \"(?:$|\\\\s)\\\\s*\") }\n\n var rmClass = function(node, cls) {\n var current = node.className;\n var match = classTest(cls).exec(current);\n if (match) {\n var after = current.slice(match.index + match[0].length);\n node.className = current.slice(0, match.index) + (after ? match[1] + after : \"\");\n }\n };\n\n function removeChildren(e) {\n for (var count = e.childNodes.length; count > 0; --count)\n { e.removeChild(e.firstChild); }\n return e\n }\n\n function removeChildrenAndAdd(parent, e) {\n return removeChildren(parent).appendChild(e)\n }\n\n function elt(tag, content, className, style) {\n var e = document.createElement(tag);\n if (className) { e.className = className; }\n if (style) { e.style.cssText = style; }\n if (typeof content == \"string\") { e.appendChild(document.createTextNode(content)); }\n else if (content) { for (var i = 0; i < content.length; ++i) { e.appendChild(content[i]); } }\n return e\n }\n // wrapper for elt, which removes the elt from the accessibility tree\n function eltP(tag, content, className, style) {\n var e = elt(tag, content, className, style);\n e.setAttribute(\"role\", \"presentation\");\n return e\n }\n\n var range;\n if (document.createRange) { range = function(node, start, end, endNode) {\n var r = document.createRange();\n r.setEnd(endNode || node, end);\n r.setStart(node, start);\n return r\n }; }\n else { range = function(node, start, end) {\n var r = document.body.createTextRange();\n try { r.moveToElementText(node.parentNode); }\n catch(e) { return r }\n r.collapse(true);\n r.moveEnd(\"character\", end);\n r.moveStart(\"character\", start);\n return r\n }; }\n\n function contains(parent, child) {\n if (child.nodeType == 3) // Android browser always returns false when child is a textnode\n { child = child.parentNode; }\n if (parent.contains)\n { return parent.contains(child) }\n do {\n if (child.nodeType == 11) { child = child.host; }\n if (child == parent) { return true }\n } while (child = child.parentNode)\n }\n\n function activeElt(rootNode) {\n // IE and Edge may throw an \"Unspecified Error\" when accessing document.activeElement.\n // IE < 10 will throw when accessed while the page is loading or in an iframe.\n // IE > 9 and Edge will throw when accessed in an iframe if document.body is unavailable.\n var doc = rootNode.ownerDocument || rootNode;\n var activeElement;\n try {\n activeElement = rootNode.activeElement;\n } catch(e) {\n activeElement = doc.body || null;\n }\n while (activeElement && activeElement.shadowRoot && activeElement.shadowRoot.activeElement)\n { activeElement = activeElement.shadowRoot.activeElement; }\n return activeElement\n }\n\n function addClass(node, cls) {\n var current = node.className;\n if (!classTest(cls).test(current)) { node.className += (current ? \" \" : \"\") + cls; }\n }\n function joinClasses(a, b) {\n var as = a.split(\" \");\n for (var i = 0; i < as.length; i++)\n { if (as[i] && !classTest(as[i]).test(b)) { b += \" \" + as[i]; } }\n return b\n }\n\n var selectInput = function(node) { node.select(); };\n if (ios) // Mobile Safari apparently has a bug where select() is broken.\n { selectInput = function(node) { node.selectionStart = 0; node.selectionEnd = node.value.length; }; }\n else if (ie) // Suppress mysterious IE10 errors\n { selectInput = function(node) { try { node.select(); } catch(_e) {} }; }\n\n function doc(cm) { return cm.display.wrapper.ownerDocument }\n\n function root(cm) {\n return rootNode(cm.display.wrapper)\n }\n\n function rootNode(element) {\n // Detect modern browsers (2017+).\n return element.getRootNode ? element.getRootNode() : element.ownerDocument\n }\n\n function win(cm) { return doc(cm).defaultView }\n\n function bind(f) {\n var args = Array.prototype.slice.call(arguments, 1);\n return function(){return f.apply(null, args)}\n }\n\n function copyObj(obj, target, overwrite) {\n if (!target) { target = {}; }\n for (var prop in obj)\n { if (obj.hasOwnProperty(prop) && (overwrite !== false || !target.hasOwnProperty(prop)))\n { target[prop] = obj[prop]; } }\n return target\n }\n\n // Counts the column offset in a string, taking tabs into account.\n // Used mostly to find indentation.\n function countColumn(string, end, tabSize, startIndex, startValue) {\n if (end == null) {\n end = string.search(/[^\\s\\u00a0]/);\n if (end == -1) { end = string.length; }\n }\n for (var i = startIndex || 0, n = startValue || 0;;) {\n var nextTab = string.indexOf(\"\\t\", i);\n if (nextTab < 0 || nextTab >= end)\n { return n + (end - i) }\n n += nextTab - i;\n n += tabSize - (n % tabSize);\n i = nextTab + 1;\n }\n }\n\n var Delayed = function() {\n this.id = null;\n this.f = null;\n this.time = 0;\n this.handler = bind(this.onTimeout, this);\n };\n Delayed.prototype.onTimeout = function (self) {\n self.id = 0;\n if (self.time <= +new Date) {\n self.f();\n } else {\n setTimeout(self.handler, self.time - +new Date);\n }\n };\n Delayed.prototype.set = function (ms, f) {\n this.f = f;\n var time = +new Date + ms;\n if (!this.id || time < this.time) {\n clearTimeout(this.id);\n this.id = setTimeout(this.handler, ms);\n this.time = time;\n }\n };\n\n function indexOf(array, elt) {\n for (var i = 0; i < array.length; ++i)\n { if (array[i] == elt) { return i } }\n return -1\n }\n\n // Number of pixels added to scroller and sizer to hide scrollbar\n var scrollerGap = 50;\n\n // Returned or thrown by various protocols to signal 'I'm not\n // handling this'.\n var Pass = {toString: function(){return \"CodeMirror.Pass\"}};\n\n // Reused option objects for setSelection & friends\n var sel_dontScroll = {scroll: false}, sel_mouse = {origin: \"*mouse\"}, sel_move = {origin: \"+move\"};\n\n // The inverse of countColumn -- find the offset that corresponds to\n // a particular column.\n function findColumn(string, goal, tabSize) {\n for (var pos = 0, col = 0;;) {\n var nextTab = string.indexOf(\"\\t\", pos);\n if (nextTab == -1) { nextTab = string.length; }\n var skipped = nextTab - pos;\n if (nextTab == string.length || col + skipped >= goal)\n { return pos + Math.min(skipped, goal - col) }\n col += nextTab - pos;\n col += tabSize - (col % tabSize);\n pos = nextTab + 1;\n if (col >= goal) { return pos }\n }\n }\n\n var spaceStrs = [\"\"];\n function spaceStr(n) {\n while (spaceStrs.length <= n)\n { spaceStrs.push(lst(spaceStrs) + \" \"); }\n return spaceStrs[n]\n }\n\n function lst(arr) { return arr[arr.length-1] }\n\n function map(array, f) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = f(array[i], i); }\n return out\n }\n\n function insertSorted(array, value, score) {\n var pos = 0, priority = score(value);\n while (pos < array.length && score(array[pos]) <= priority) { pos++; }\n array.splice(pos, 0, value);\n }\n\n function nothing() {}\n\n function createObj(base, props) {\n var inst;\n if (Object.create) {\n inst = Object.create(base);\n } else {\n nothing.prototype = base;\n inst = new nothing();\n }\n if (props) { copyObj(props, inst); }\n return inst\n }\n\n var nonASCIISingleCaseWordChar = /[\\u00df\\u0587\\u0590-\\u05f4\\u0600-\\u06ff\\u3040-\\u309f\\u30a0-\\u30ff\\u3400-\\u4db5\\u4e00-\\u9fcc\\uac00-\\ud7af]/;\n function isWordCharBasic(ch) {\n return /\\w/.test(ch) || ch > \"\\x80\" &&\n (ch.toUpperCase() != ch.toLowerCase() || nonASCIISingleCaseWordChar.test(ch))\n }\n function isWordChar(ch, helper) {\n if (!helper) { return isWordCharBasic(ch) }\n if (helper.source.indexOf(\"\\\\w\") > -1 && isWordCharBasic(ch)) { return true }\n return helper.test(ch)\n }\n\n function isEmpty(obj) {\n for (var n in obj) { if (obj.hasOwnProperty(n) && obj[n]) { return false } }\n return true\n }\n\n // Extending unicode characters. A series of a non-extending char +\n // any number of extending chars is treated as a single unit as far\n // as editing and measuring is concerned. This is not fully correct,\n // since some scripts/fonts/browsers also treat other configurations\n // of code points as a group.\n 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]/;\n function isExtendingChar(ch) { return ch.charCodeAt(0) >= 768 && extendingChars.test(ch) }\n\n // Returns a number from the range [`0`; `str.length`] unless `pos` is outside that range.\n function skipExtendingChars(str, pos, dir) {\n while ((dir < 0 ? pos > 0 : pos < str.length) && isExtendingChar(str.charAt(pos))) { pos += dir; }\n return pos\n }\n\n // Returns the value from the range [`from`; `to`] that satisfies\n // `pred` and is closest to `from`. Assumes that at least `to`\n // satisfies `pred`. Supports `from` being greater than `to`.\n function findFirst(pred, from, to) {\n // At any point we are certain `to` satisfies `pred`, don't know\n // whether `from` does.\n var dir = from > to ? -1 : 1;\n for (;;) {\n if (from == to) { return from }\n var midF = (from + to) / 2, mid = dir < 0 ? Math.ceil(midF) : Math.floor(midF);\n if (mid == from) { return pred(mid) ? from : to }\n if (pred(mid)) { to = mid; }\n else { from = mid + dir; }\n }\n }\n\n // BIDI HELPERS\n\n function iterateBidiSections(order, from, to, f) {\n if (!order) { return f(from, to, \"ltr\", 0) }\n var found = false;\n for (var i = 0; i < order.length; ++i) {\n var part = order[i];\n if (part.from < to && part.to > from || from == to && part.to == from) {\n f(Math.max(part.from, from), Math.min(part.to, to), part.level == 1 ? \"rtl\" : \"ltr\", i);\n found = true;\n }\n }\n if (!found) { f(from, to, \"ltr\"); }\n }\n\n var bidiOther = null;\n function getBidiPartAt(order, ch, sticky) {\n var found;\n bidiOther = null;\n for (var i = 0; i < order.length; ++i) {\n var cur = order[i];\n if (cur.from < ch && cur.to > ch) { return i }\n if (cur.to == ch) {\n if (cur.from != cur.to && sticky == \"before\") { found = i; }\n else { bidiOther = i; }\n }\n if (cur.from == ch) {\n if (cur.from != cur.to && sticky != \"before\") { found = i; }\n else { bidiOther = i; }\n }\n }\n return found != null ? found : bidiOther\n }\n\n // Bidirectional ordering algorithm\n // See http://unicode.org/reports/tr9/tr9-13.html for the algorithm\n // that this (partially) implements.\n\n // One-char codes used for character types:\n // L (L): Left-to-Right\n // R (R): Right-to-Left\n // r (AL): Right-to-Left Arabic\n // 1 (EN): European Number\n // + (ES): European Number Separator\n // % (ET): European Number Terminator\n // n (AN): Arabic Number\n // , (CS): Common Number Separator\n // m (NSM): Non-Spacing Mark\n // b (BN): Boundary Neutral\n // s (B): Paragraph Separator\n // t (S): Segment Separator\n // w (WS): Whitespace\n // N (ON): Other Neutrals\n\n // Returns null if characters are ordered as they appear\n // (left-to-right), or an array of sections ({from, to, level}\n // objects) in the order in which they occur visually.\n var bidiOrdering = (function() {\n // Character types for codepoints 0 to 0xff\n var lowTypes = \"bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLN\";\n // Character types for codepoints 0x600 to 0x6f9\n var arabicTypes = \"nnnnnnNNr%%r,rNNmmmmmmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmmmnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmnNmmmmmmrrmmNmmmmrr1111111111\";\n function charType(code) {\n if (code <= 0xf7) { return lowTypes.charAt(code) }\n else if (0x590 <= code && code <= 0x5f4) { return \"R\" }\n else if (0x600 <= code && code <= 0x6f9) { return arabicTypes.charAt(code - 0x600) }\n else if (0x6ee <= code && code <= 0x8ac) { return \"r\" }\n else if (0x2000 <= code && code <= 0x200b) { return \"w\" }\n else if (code == 0x200c) { return \"b\" }\n else { return \"L\" }\n }\n\n var bidiRE = /[\\u0590-\\u05f4\\u0600-\\u06ff\\u0700-\\u08ac]/;\n var isNeutral = /[stwN]/, isStrong = /[LRr]/, countsAsLeft = /[Lb1n]/, countsAsNum = /[1n]/;\n\n function BidiSpan(level, from, to) {\n this.level = level;\n this.from = from; this.to = to;\n }\n\n return function(str, direction) {\n var outerType = direction == \"ltr\" ? \"L\" : \"R\";\n\n if (str.length == 0 || direction == \"ltr\" && !bidiRE.test(str)) { return false }\n var len = str.length, types = [];\n for (var i = 0; i < len; ++i)\n { types.push(charType(str.charCodeAt(i))); }\n\n // W1. Examine each non-spacing mark (NSM) in the level run, and\n // change the type of the NSM to the type of the previous\n // character. If the NSM is at the start of the level run, it will\n // get the type of sor.\n for (var i$1 = 0, prev = outerType; i$1 < len; ++i$1) {\n var type = types[i$1];\n if (type == \"m\") { types[i$1] = prev; }\n else { prev = type; }\n }\n\n // W2. Search backwards from each instance of a European number\n // until the first strong type (R, L, AL, or sor) is found. If an\n // AL is found, change the type of the European number to Arabic\n // number.\n // W3. Change all ALs to R.\n for (var i$2 = 0, cur = outerType; i$2 < len; ++i$2) {\n var type$1 = types[i$2];\n if (type$1 == \"1\" && cur == \"r\") { types[i$2] = \"n\"; }\n else if (isStrong.test(type$1)) { cur = type$1; if (type$1 == \"r\") { types[i$2] = \"R\"; } }\n }\n\n // W4. A single European separator between two European numbers\n // changes to a European number. A single common separator between\n // two numbers of the same type changes to that type.\n for (var i$3 = 1, prev$1 = types[0]; i$3 < len - 1; ++i$3) {\n var type$2 = types[i$3];\n if (type$2 == \"+\" && prev$1 == \"1\" && types[i$3+1] == \"1\") { types[i$3] = \"1\"; }\n else if (type$2 == \",\" && prev$1 == types[i$3+1] &&\n (prev$1 == \"1\" || prev$1 == \"n\")) { types[i$3] = prev$1; }\n prev$1 = type$2;\n }\n\n // W5. A sequence of European terminators adjacent to European\n // numbers changes to all European numbers.\n // W6. Otherwise, separators and terminators change to Other\n // Neutral.\n for (var i$4 = 0; i$4 < len; ++i$4) {\n var type$3 = types[i$4];\n if (type$3 == \",\") { types[i$4] = \"N\"; }\n else if (type$3 == \"%\") {\n var end = (void 0);\n for (end = i$4 + 1; end < len && types[end] == \"%\"; ++end) {}\n var replace = (i$4 && types[i$4-1] == \"!\") || (end < len && types[end] == \"1\") ? \"1\" : \"N\";\n for (var j = i$4; j < end; ++j) { types[j] = replace; }\n i$4 = end - 1;\n }\n }\n\n // W7. Search backwards from each instance of a European number\n // until the first strong type (R, L, or sor) is found. If an L is\n // found, then change the type of the European number to L.\n for (var i$5 = 0, cur$1 = outerType; i$5 < len; ++i$5) {\n var type$4 = types[i$5];\n if (cur$1 == \"L\" && type$4 == \"1\") { types[i$5] = \"L\"; }\n else if (isStrong.test(type$4)) { cur$1 = type$4; }\n }\n\n // N1. A sequence of neutrals takes the direction of the\n // surrounding strong text if the text on both sides has the same\n // direction. European and Arabic numbers act as if they were R in\n // terms of their influence on neutrals. Start-of-level-run (sor)\n // and end-of-level-run (eor) are used at level run boundaries.\n // N2. Any remaining neutrals take the embedding direction.\n for (var i$6 = 0; i$6 < len; ++i$6) {\n if (isNeutral.test(types[i$6])) {\n var end$1 = (void 0);\n for (end$1 = i$6 + 1; end$1 < len && isNeutral.test(types[end$1]); ++end$1) {}\n var before = (i$6 ? types[i$6-1] : outerType) == \"L\";\n var after = (end$1 < len ? types[end$1] : outerType) == \"L\";\n var replace$1 = before == after ? (before ? \"L\" : \"R\") : outerType;\n for (var j$1 = i$6; j$1 < end$1; ++j$1) { types[j$1] = replace$1; }\n i$6 = end$1 - 1;\n }\n }\n\n // Here we depart from the documented algorithm, in order to avoid\n // building up an actual levels array. Since there are only three\n // levels (0, 1, 2) in an implementation that doesn't take\n // explicit embedding into account, we can build up the order on\n // the fly, without following the level-based algorithm.\n var order = [], m;\n for (var i$7 = 0; i$7 < len;) {\n if (countsAsLeft.test(types[i$7])) {\n var start = i$7;\n for (++i$7; i$7 < len && countsAsLeft.test(types[i$7]); ++i$7) {}\n order.push(new BidiSpan(0, start, i$7));\n } else {\n var pos = i$7, at = order.length, isRTL = direction == \"rtl\" ? 1 : 0;\n for (++i$7; i$7 < len && types[i$7] != \"L\"; ++i$7) {}\n for (var j$2 = pos; j$2 < i$7;) {\n if (countsAsNum.test(types[j$2])) {\n if (pos < j$2) { order.splice(at, 0, new BidiSpan(1, pos, j$2)); at += isRTL; }\n var nstart = j$2;\n for (++j$2; j$2 < i$7 && countsAsNum.test(types[j$2]); ++j$2) {}\n order.splice(at, 0, new BidiSpan(2, nstart, j$2));\n at += isRTL;\n pos = j$2;\n } else { ++j$2; }\n }\n if (pos < i$7) { order.splice(at, 0, new BidiSpan(1, pos, i$7)); }\n }\n }\n if (direction == \"ltr\") {\n if (order[0].level == 1 && (m = str.match(/^\\s+/))) {\n order[0].from = m[0].length;\n order.unshift(new BidiSpan(0, 0, m[0].length));\n }\n if (lst(order).level == 1 && (m = str.match(/\\s+$/))) {\n lst(order).to -= m[0].length;\n order.push(new BidiSpan(0, len - m[0].length, len));\n }\n }\n\n return direction == \"rtl\" ? order.reverse() : order\n }\n })();\n\n // Get the bidi ordering for the given line (and cache it). Returns\n // false for lines that are fully left-to-right, and an array of\n // BidiSpan objects otherwise.\n function getOrder(line, direction) {\n var order = line.order;\n if (order == null) { order = line.order = bidiOrdering(line.text, direction); }\n return order\n }\n\n // EVENT HANDLING\n\n // Lightweight event framework. on/off also work on DOM nodes,\n // registering native DOM handlers.\n\n var noHandlers = [];\n\n var on = function(emitter, type, f) {\n if (emitter.addEventListener) {\n emitter.addEventListener(type, f, false);\n } else if (emitter.attachEvent) {\n emitter.attachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers || (emitter._handlers = {});\n map[type] = (map[type] || noHandlers).concat(f);\n }\n };\n\n function getHandlers(emitter, type) {\n return emitter._handlers && emitter._handlers[type] || noHandlers\n }\n\n function off(emitter, type, f) {\n if (emitter.removeEventListener) {\n emitter.removeEventListener(type, f, false);\n } else if (emitter.detachEvent) {\n emitter.detachEvent(\"on\" + type, f);\n } else {\n var map = emitter._handlers, arr = map && map[type];\n if (arr) {\n var index = indexOf(arr, f);\n if (index > -1)\n { map[type] = arr.slice(0, index).concat(arr.slice(index + 1)); }\n }\n }\n }\n\n function signal(emitter, type /*, values...*/) {\n var handlers = getHandlers(emitter, type);\n if (!handlers.length) { return }\n var args = Array.prototype.slice.call(arguments, 2);\n for (var i = 0; i < handlers.length; ++i) { handlers[i].apply(null, args); }\n }\n\n // The DOM events that CodeMirror handles can be overridden by\n // registering a (non-DOM) handler on the editor for the event name,\n // and preventDefault-ing the event in that handler.\n function signalDOMEvent(cm, e, override) {\n if (typeof e == \"string\")\n { e = {type: e, preventDefault: function() { this.defaultPrevented = true; }}; }\n signal(cm, override || e.type, cm, e);\n return e_defaultPrevented(e) || e.codemirrorIgnore\n }\n\n function signalCursorActivity(cm) {\n var arr = cm._handlers && cm._handlers.cursorActivity;\n if (!arr) { return }\n var set = cm.curOp.cursorActivityHandlers || (cm.curOp.cursorActivityHandlers = []);\n for (var i = 0; i < arr.length; ++i) { if (indexOf(set, arr[i]) == -1)\n { set.push(arr[i]); } }\n }\n\n function hasHandler(emitter, type) {\n return getHandlers(emitter, type).length > 0\n }\n\n // Add on and off methods to a constructor's prototype, to make\n // registering events on such objects more convenient.\n function eventMixin(ctor) {\n ctor.prototype.on = function(type, f) {on(this, type, f);};\n ctor.prototype.off = function(type, f) {off(this, type, f);};\n }\n\n // Due to the fact that we still support jurassic IE versions, some\n // compatibility wrappers are needed.\n\n function e_preventDefault(e) {\n if (e.preventDefault) { e.preventDefault(); }\n else { e.returnValue = false; }\n }\n function e_stopPropagation(e) {\n if (e.stopPropagation) { e.stopPropagation(); }\n else { e.cancelBubble = true; }\n }\n function e_defaultPrevented(e) {\n return e.defaultPrevented != null ? e.defaultPrevented : e.returnValue == false\n }\n function e_stop(e) {e_preventDefault(e); e_stopPropagation(e);}\n\n function e_target(e) {return e.target || e.srcElement}\n function e_button(e) {\n var b = e.which;\n if (b == null) {\n if (e.button & 1) { b = 1; }\n else if (e.button & 2) { b = 3; }\n else if (e.button & 4) { b = 2; }\n }\n if (mac && e.ctrlKey && b == 1) { b = 3; }\n return b\n }\n\n // Detect drag-and-drop\n var dragAndDrop = function() {\n // There is *some* kind of drag-and-drop support in IE6-8, but I\n // couldn't get it to work yet.\n if (ie && ie_version < 9) { return false }\n var div = elt('div');\n return \"draggable\" in div || \"dragDrop\" in div\n }();\n\n var zwspSupported;\n function zeroWidthElement(measure) {\n if (zwspSupported == null) {\n var test = elt(\"span\", \"\\u200b\");\n removeChildrenAndAdd(measure, elt(\"span\", [test, document.createTextNode(\"x\")]));\n if (measure.firstChild.offsetHeight != 0)\n { zwspSupported = test.offsetWidth <= 1 && test.offsetHeight > 2 && !(ie && ie_version < 8); }\n }\n var node = zwspSupported ? elt(\"span\", \"\\u200b\") :\n elt(\"span\", \"\\u00a0\", null, \"display: inline-block; width: 1px; margin-right: -1px\");\n node.setAttribute(\"cm-text\", \"\");\n return node\n }\n\n // Feature-detect IE's crummy client rect reporting for bidi text\n var badBidiRects;\n function hasBadBidiRects(measure) {\n if (badBidiRects != null) { return badBidiRects }\n var txt = removeChildrenAndAdd(measure, document.createTextNode(\"A\\u062eA\"));\n var r0 = range(txt, 0, 1).getBoundingClientRect();\n var r1 = range(txt, 1, 2).getBoundingClientRect();\n removeChildren(measure);\n if (!r0 || r0.left == r0.right) { return false } // Safari returns null in some cases (#2780)\n return badBidiRects = (r1.right - r0.right < 3)\n }\n\n // See if \"\".split is the broken IE version, if so, provide an\n // alternative way to split lines.\n var splitLinesAuto = \"\\n\\nb\".split(/\\n/).length != 3 ? function (string) {\n var pos = 0, result = [], l = string.length;\n while (pos <= l) {\n var nl = string.indexOf(\"\\n\", pos);\n if (nl == -1) { nl = string.length; }\n var line = string.slice(pos, string.charAt(nl - 1) == \"\\r\" ? nl - 1 : nl);\n var rt = line.indexOf(\"\\r\");\n if (rt != -1) {\n result.push(line.slice(0, rt));\n pos += rt + 1;\n } else {\n result.push(line);\n pos = nl + 1;\n }\n }\n return result\n } : function (string) { return string.split(/\\r\\n?|\\n/); };\n\n var hasSelection = window.getSelection ? function (te) {\n try { return te.selectionStart != te.selectionEnd }\n catch(e) { return false }\n } : function (te) {\n var range;\n try {range = te.ownerDocument.selection.createRange();}\n catch(e) {}\n if (!range || range.parentElement() != te) { return false }\n return range.compareEndPoints(\"StartToEnd\", range) != 0\n };\n\n var hasCopyEvent = (function () {\n var e = elt(\"div\");\n if (\"oncopy\" in e) { return true }\n e.setAttribute(\"oncopy\", \"return;\");\n return typeof e.oncopy == \"function\"\n })();\n\n var badZoomedRects = null;\n function hasBadZoomedRects(measure) {\n if (badZoomedRects != null) { return badZoomedRects }\n var node = removeChildrenAndAdd(measure, elt(\"span\", \"x\"));\n var normal = node.getBoundingClientRect();\n var fromRange = range(node, 0, 1).getBoundingClientRect();\n return badZoomedRects = Math.abs(normal.left - fromRange.left) > 1\n }\n\n // Known modes, by name and by MIME\n var modes = {}, mimeModes = {};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n function defineMode(name, mode) {\n if (arguments.length > 2)\n { mode.dependencies = Array.prototype.slice.call(arguments, 2); }\n modes[name] = mode;\n }\n\n function defineMIME(mime, spec) {\n mimeModes[mime] = spec;\n }\n\n // Given a MIME type, a {name, ...options} config object, or a name\n // string, return a mode config object.\n function resolveMode(spec) {\n if (typeof spec == \"string\" && mimeModes.hasOwnProperty(spec)) {\n spec = mimeModes[spec];\n } else if (spec && typeof spec.name == \"string\" && mimeModes.hasOwnProperty(spec.name)) {\n var found = mimeModes[spec.name];\n if (typeof found == \"string\") { found = {name: found}; }\n spec = createObj(found, spec);\n spec.name = found.name;\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+xml$/.test(spec)) {\n return resolveMode(\"application/xml\")\n } else if (typeof spec == \"string\" && /^[\\w\\-]+\\/[\\w\\-]+\\+json$/.test(spec)) {\n return resolveMode(\"application/json\")\n }\n if (typeof spec == \"string\") { return {name: spec} }\n else { return spec || {name: \"null\"} }\n }\n\n // Given a mode spec (anything that resolveMode accepts), find and\n // initialize an actual mode object.\n function getMode(options, spec) {\n spec = resolveMode(spec);\n var mfactory = modes[spec.name];\n if (!mfactory) { return getMode(options, \"text/plain\") }\n var modeObj = mfactory(options, spec);\n if (modeExtensions.hasOwnProperty(spec.name)) {\n var exts = modeExtensions[spec.name];\n for (var prop in exts) {\n if (!exts.hasOwnProperty(prop)) { continue }\n if (modeObj.hasOwnProperty(prop)) { modeObj[\"_\" + prop] = modeObj[prop]; }\n modeObj[prop] = exts[prop];\n }\n }\n modeObj.name = spec.name;\n if (spec.helperType) { modeObj.helperType = spec.helperType; }\n if (spec.modeProps) { for (var prop$1 in spec.modeProps)\n { modeObj[prop$1] = spec.modeProps[prop$1]; } }\n\n return modeObj\n }\n\n // This can be used to attach properties to mode objects from\n // outside the actual mode definition.\n var modeExtensions = {};\n function extendMode(mode, properties) {\n var exts = modeExtensions.hasOwnProperty(mode) ? modeExtensions[mode] : (modeExtensions[mode] = {});\n copyObj(properties, exts);\n }\n\n function copyState(mode, state) {\n if (state === true) { return state }\n if (mode.copyState) { return mode.copyState(state) }\n var nstate = {};\n for (var n in state) {\n var val = state[n];\n if (val instanceof Array) { val = val.concat([]); }\n nstate[n] = val;\n }\n return nstate\n }\n\n // Given a mode and a state (for that mode), find the inner mode and\n // state at the position that the state refers to.\n function innerMode(mode, state) {\n var info;\n while (mode.innerMode) {\n info = mode.innerMode(state);\n if (!info || info.mode == mode) { break }\n state = info.state;\n mode = info.mode;\n }\n return info || {mode: mode, state: state}\n }\n\n function startState(mode, a1, a2) {\n return mode.startState ? mode.startState(a1, a2) : true\n }\n\n // STRING STREAM\n\n // Fed to the mode parsers, provides helper functions to make\n // parsers more succinct.\n\n var StringStream = function(string, tabSize, lineOracle) {\n this.pos = this.start = 0;\n this.string = string;\n this.tabSize = tabSize || 8;\n this.lastColumnPos = this.lastColumnValue = 0;\n this.lineStart = 0;\n this.lineOracle = lineOracle;\n };\n\n StringStream.prototype.eol = function () {return this.pos >= this.string.length};\n StringStream.prototype.sol = function () {return this.pos == this.lineStart};\n StringStream.prototype.peek = function () {return this.string.charAt(this.pos) || undefined};\n StringStream.prototype.next = function () {\n if (this.pos < this.string.length)\n { return this.string.charAt(this.pos++) }\n };\n StringStream.prototype.eat = function (match) {\n var ch = this.string.charAt(this.pos);\n var ok;\n if (typeof match == \"string\") { ok = ch == match; }\n else { ok = ch && (match.test ? match.test(ch) : match(ch)); }\n if (ok) {++this.pos; return ch}\n };\n StringStream.prototype.eatWhile = function (match) {\n var start = this.pos;\n while (this.eat(match)){}\n return this.pos > start\n };\n StringStream.prototype.eatSpace = function () {\n var start = this.pos;\n while (/[\\s\\u00a0]/.test(this.string.charAt(this.pos))) { ++this.pos; }\n return this.pos > start\n };\n StringStream.prototype.skipToEnd = function () {this.pos = this.string.length;};\n StringStream.prototype.skipTo = function (ch) {\n var found = this.string.indexOf(ch, this.pos);\n if (found > -1) {this.pos = found; return true}\n };\n StringStream.prototype.backUp = function (n) {this.pos -= n;};\n StringStream.prototype.column = function () {\n if (this.lastColumnPos < this.start) {\n this.lastColumnValue = countColumn(this.string, this.start, this.tabSize, this.lastColumnPos, this.lastColumnValue);\n this.lastColumnPos = this.start;\n }\n return this.lastColumnValue - (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.indentation = function () {\n return countColumn(this.string, null, this.tabSize) -\n (this.lineStart ? countColumn(this.string, this.lineStart, this.tabSize) : 0)\n };\n StringStream.prototype.match = function (pattern, consume, caseInsensitive) {\n if (typeof pattern == \"string\") {\n var cased = function (str) { return caseInsensitive ? str.toLowerCase() : str; };\n var substr = this.string.substr(this.pos, pattern.length);\n if (cased(substr) == cased(pattern)) {\n if (consume !== false) { this.pos += pattern.length; }\n return true\n }\n } else {\n var match = this.string.slice(this.pos).match(pattern);\n if (match && match.index > 0) { return null }\n if (match && consume !== false) { this.pos += match[0].length; }\n return match\n }\n };\n StringStream.prototype.current = function (){return this.string.slice(this.start, this.pos)};\n StringStream.prototype.hideFirstChars = function (n, inner) {\n this.lineStart += n;\n try { return inner() }\n finally { this.lineStart -= n; }\n };\n StringStream.prototype.lookAhead = function (n) {\n var oracle = this.lineOracle;\n return oracle && oracle.lookAhead(n)\n };\n StringStream.prototype.baseToken = function () {\n var oracle = this.lineOracle;\n return oracle && oracle.baseToken(this.pos)\n };\n\n // Find the line object corresponding to the given line number.\n function getLine(doc, n) {\n n -= doc.first;\n if (n < 0 || n >= doc.size) { throw new Error(\"There is no line \" + (n + doc.first) + \" in the document.\") }\n var chunk = doc;\n while (!chunk.lines) {\n for (var i = 0;; ++i) {\n var child = chunk.children[i], sz = child.chunkSize();\n if (n < sz) { chunk = child; break }\n n -= sz;\n }\n }\n return chunk.lines[n]\n }\n\n // Get the part of a document between two positions, as an array of\n // strings.\n function getBetween(doc, start, end) {\n var out = [], n = start.line;\n doc.iter(start.line, end.line + 1, function (line) {\n var text = line.text;\n if (n == end.line) { text = text.slice(0, end.ch); }\n if (n == start.line) { text = text.slice(start.ch); }\n out.push(text);\n ++n;\n });\n return out\n }\n // Get the lines between from and to, as array of strings.\n function getLines(doc, from, to) {\n var out = [];\n doc.iter(from, to, function (line) { out.push(line.text); }); // iter aborts when callback returns truthy value\n return out\n }\n\n // Update the height of a line, propagating the height change\n // upwards to parent nodes.\n function updateLineHeight(line, height) {\n var diff = height - line.height;\n if (diff) { for (var n = line; n; n = n.parent) { n.height += diff; } }\n }\n\n // Given a line object, find its line number by walking up through\n // its parent links.\n function lineNo(line) {\n if (line.parent == null) { return null }\n var cur = line.parent, no = indexOf(cur.lines, line);\n for (var chunk = cur.parent; chunk; cur = chunk, chunk = chunk.parent) {\n for (var i = 0;; ++i) {\n if (chunk.children[i] == cur) { break }\n no += chunk.children[i].chunkSize();\n }\n }\n return no + cur.first\n }\n\n // Find the line at the given vertical position, using the height\n // information in the document tree.\n function lineAtHeight(chunk, h) {\n var n = chunk.first;\n outer: do {\n for (var i$1 = 0; i$1 < chunk.children.length; ++i$1) {\n var child = chunk.children[i$1], ch = child.height;\n if (h < ch) { chunk = child; continue outer }\n h -= ch;\n n += child.chunkSize();\n }\n return n\n } while (!chunk.lines)\n var i = 0;\n for (; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i], lh = line.height;\n if (h < lh) { break }\n h -= lh;\n }\n return n + i\n }\n\n function isLine(doc, l) {return l >= doc.first && l < doc.first + doc.size}\n\n function lineNumberFor(options, i) {\n return String(options.lineNumberFormatter(i + options.firstLineNumber))\n }\n\n // A Pos instance represents a position within the text.\n function Pos(line, ch, sticky) {\n if ( sticky === void 0 ) sticky = null;\n\n if (!(this instanceof Pos)) { return new Pos(line, ch, sticky) }\n this.line = line;\n this.ch = ch;\n this.sticky = sticky;\n }\n\n // Compare two positions, return 0 if they are the same, a negative\n // number when a is less, and a positive number otherwise.\n function cmp(a, b) { return a.line - b.line || a.ch - b.ch }\n\n function equalCursorPos(a, b) { return a.sticky == b.sticky && cmp(a, b) == 0 }\n\n function copyPos(x) {return Pos(x.line, x.ch)}\n function maxPos(a, b) { return cmp(a, b) < 0 ? b : a }\n function minPos(a, b) { return cmp(a, b) < 0 ? a : b }\n\n // Most of the external API clips given positions to make sure they\n // actually exist within the document.\n function clipLine(doc, n) {return Math.max(doc.first, Math.min(n, doc.first + doc.size - 1))}\n function clipPos(doc, pos) {\n if (pos.line < doc.first) { return Pos(doc.first, 0) }\n var last = doc.first + doc.size - 1;\n if (pos.line > last) { return Pos(last, getLine(doc, last).text.length) }\n return clipToLen(pos, getLine(doc, pos.line).text.length)\n }\n function clipToLen(pos, linelen) {\n var ch = pos.ch;\n if (ch == null || ch > linelen) { return Pos(pos.line, linelen) }\n else if (ch < 0) { return Pos(pos.line, 0) }\n else { return pos }\n }\n function clipPosArray(doc, array) {\n var out = [];\n for (var i = 0; i < array.length; i++) { out[i] = clipPos(doc, array[i]); }\n return out\n }\n\n var SavedContext = function(state, lookAhead) {\n this.state = state;\n this.lookAhead = lookAhead;\n };\n\n var Context = function(doc, state, line, lookAhead) {\n this.state = state;\n this.doc = doc;\n this.line = line;\n this.maxLookAhead = lookAhead || 0;\n this.baseTokens = null;\n this.baseTokenPos = 1;\n };\n\n Context.prototype.lookAhead = function (n) {\n var line = this.doc.getLine(this.line + n);\n if (line != null && n > this.maxLookAhead) { this.maxLookAhead = n; }\n return line\n };\n\n Context.prototype.baseToken = function (n) {\n if (!this.baseTokens) { return null }\n while (this.baseTokens[this.baseTokenPos] <= n)\n { this.baseTokenPos += 2; }\n var type = this.baseTokens[this.baseTokenPos + 1];\n return {type: type && type.replace(/( |^)overlay .*/, \"\"),\n size: this.baseTokens[this.baseTokenPos] - n}\n };\n\n Context.prototype.nextLine = function () {\n this.line++;\n if (this.maxLookAhead > 0) { this.maxLookAhead--; }\n };\n\n Context.fromSaved = function (doc, saved, line) {\n if (saved instanceof SavedContext)\n { return new Context(doc, copyState(doc.mode, saved.state), line, saved.lookAhead) }\n else\n { return new Context(doc, copyState(doc.mode, saved), line) }\n };\n\n Context.prototype.save = function (copy) {\n var state = copy !== false ? copyState(this.doc.mode, this.state) : this.state;\n return this.maxLookAhead > 0 ? new SavedContext(state, this.maxLookAhead) : state\n };\n\n\n // Compute a style array (an array starting with a mode generation\n // -- for invalidation -- followed by pairs of end positions and\n // style strings), which is used to highlight the tokens on the\n // line.\n function highlightLine(cm, line, context, forceToEnd) {\n // A styles array always starts with a number identifying the\n // mode/overlays that it is based on (for easy invalidation).\n var st = [cm.state.modeGen], lineClasses = {};\n // Compute the base array of styles\n runMode(cm, line.text, cm.doc.mode, context, function (end, style) { return st.push(end, style); },\n lineClasses, forceToEnd);\n var state = context.state;\n\n // Run overlays, adjust style array.\n var loop = function ( o ) {\n context.baseTokens = st;\n var overlay = cm.state.overlays[o], i = 1, at = 0;\n context.state = true;\n runMode(cm, line.text, overlay.mode, context, function (end, style) {\n var start = i;\n // Ensure there's a token end at the current position, and that i points at it\n while (at < end) {\n var i_end = st[i];\n if (i_end > end)\n { st.splice(i, 1, end, st[i+1], i_end); }\n i += 2;\n at = Math.min(end, i_end);\n }\n if (!style) { return }\n if (overlay.opaque) {\n st.splice(start, i - start, end, \"overlay \" + style);\n i = start + 2;\n } else {\n for (; start < i; start += 2) {\n var cur = st[start+1];\n st[start+1] = (cur ? cur + \" \" : \"\") + \"overlay \" + style;\n }\n }\n }, lineClasses);\n context.state = state;\n context.baseTokens = null;\n context.baseTokenPos = 1;\n };\n\n for (var o = 0; o < cm.state.overlays.length; ++o) loop( o );\n\n return {styles: st, classes: lineClasses.bgClass || lineClasses.textClass ? lineClasses : null}\n }\n\n function getLineStyles(cm, line, updateFrontier) {\n if (!line.styles || line.styles[0] != cm.state.modeGen) {\n var context = getContextBefore(cm, lineNo(line));\n var resetState = line.text.length > cm.options.maxHighlightLength && copyState(cm.doc.mode, context.state);\n var result = highlightLine(cm, line, context);\n if (resetState) { context.state = resetState; }\n line.stateAfter = context.save(!resetState);\n line.styles = result.styles;\n if (result.classes) { line.styleClasses = result.classes; }\n else if (line.styleClasses) { line.styleClasses = null; }\n if (updateFrontier === cm.doc.highlightFrontier)\n { cm.doc.modeFrontier = Math.max(cm.doc.modeFrontier, ++cm.doc.highlightFrontier); }\n }\n return line.styles\n }\n\n function getContextBefore(cm, n, precise) {\n var doc = cm.doc, display = cm.display;\n if (!doc.mode.startState) { return new Context(doc, true, n) }\n var start = findStartLine(cm, n, precise);\n var saved = start > doc.first && getLine(doc, start - 1).stateAfter;\n var context = saved ? Context.fromSaved(doc, saved, start) : new Context(doc, startState(doc.mode), start);\n\n doc.iter(start, n, function (line) {\n processLine(cm, line.text, context);\n var pos = context.line;\n line.stateAfter = pos == n - 1 || pos % 5 == 0 || pos >= display.viewFrom && pos < display.viewTo ? context.save() : null;\n context.nextLine();\n });\n if (precise) { doc.modeFrontier = context.line; }\n return context\n }\n\n // Lightweight form of highlight -- proceed over this line and\n // update state, but don't save a style array. Used for lines that\n // aren't currently visible.\n function processLine(cm, text, context, startAt) {\n var mode = cm.doc.mode;\n var stream = new StringStream(text, cm.options.tabSize, context);\n stream.start = stream.pos = startAt || 0;\n if (text == \"\") { callBlankLine(mode, context.state); }\n while (!stream.eol()) {\n readToken(mode, stream, context.state);\n stream.start = stream.pos;\n }\n }\n\n function callBlankLine(mode, state) {\n if (mode.blankLine) { return mode.blankLine(state) }\n if (!mode.innerMode) { return }\n var inner = innerMode(mode, state);\n if (inner.mode.blankLine) { return inner.mode.blankLine(inner.state) }\n }\n\n function readToken(mode, stream, state, inner) {\n for (var i = 0; i < 10; i++) {\n if (inner) { inner[0] = innerMode(mode, state).mode; }\n var style = mode.token(stream, state);\n if (stream.pos > stream.start) { return style }\n }\n throw new Error(\"Mode \" + mode.name + \" failed to advance stream.\")\n }\n\n var Token = function(stream, type, state) {\n this.start = stream.start; this.end = stream.pos;\n this.string = stream.current();\n this.type = type || null;\n this.state = state;\n };\n\n // Utility for getTokenAt and getLineTokens\n function takeToken(cm, pos, precise, asArray) {\n var doc = cm.doc, mode = doc.mode, style;\n pos = clipPos(doc, pos);\n var line = getLine(doc, pos.line), context = getContextBefore(cm, pos.line, precise);\n var stream = new StringStream(line.text, cm.options.tabSize, context), tokens;\n if (asArray) { tokens = []; }\n while ((asArray || stream.pos < pos.ch) && !stream.eol()) {\n stream.start = stream.pos;\n style = readToken(mode, stream, context.state);\n if (asArray) { tokens.push(new Token(stream, style, copyState(doc.mode, context.state))); }\n }\n return asArray ? tokens : new Token(stream, style, context.state)\n }\n\n function extractLineClasses(type, output) {\n if (type) { for (;;) {\n var lineClass = type.match(/(?:^|\\s+)line-(background-)?(\\S+)/);\n if (!lineClass) { break }\n type = type.slice(0, lineClass.index) + type.slice(lineClass.index + lineClass[0].length);\n var prop = lineClass[1] ? \"bgClass\" : \"textClass\";\n if (output[prop] == null)\n { output[prop] = lineClass[2]; }\n else if (!(new RegExp(\"(?:^|\\\\s)\" + lineClass[2] + \"(?:$|\\\\s)\")).test(output[prop]))\n { output[prop] += \" \" + lineClass[2]; }\n } }\n return type\n }\n\n // Run the given mode's parser over a line, calling f for each token.\n function runMode(cm, text, mode, context, f, lineClasses, forceToEnd) {\n var flattenSpans = mode.flattenSpans;\n if (flattenSpans == null) { flattenSpans = cm.options.flattenSpans; }\n var curStart = 0, curStyle = null;\n var stream = new StringStream(text, cm.options.tabSize, context), style;\n var inner = cm.options.addModeClass && [null];\n if (text == \"\") { extractLineClasses(callBlankLine(mode, context.state), lineClasses); }\n while (!stream.eol()) {\n if (stream.pos > cm.options.maxHighlightLength) {\n flattenSpans = false;\n if (forceToEnd) { processLine(cm, text, context, stream.pos); }\n stream.pos = text.length;\n style = null;\n } else {\n style = extractLineClasses(readToken(mode, stream, context.state, inner), lineClasses);\n }\n if (inner) {\n var mName = inner[0].name;\n if (mName) { style = \"m-\" + (style ? mName + \" \" + style : mName); }\n }\n if (!flattenSpans || curStyle != style) {\n while (curStart < stream.start) {\n curStart = Math.min(stream.start, curStart + 5000);\n f(curStart, curStyle);\n }\n curStyle = style;\n }\n stream.start = stream.pos;\n }\n while (curStart < stream.pos) {\n // Webkit seems to refuse to render text nodes longer than 57444\n // characters, and returns inaccurate measurements in nodes\n // starting around 5000 chars.\n var pos = Math.min(stream.pos, curStart + 5000);\n f(pos, curStyle);\n curStart = pos;\n }\n }\n\n // Finds the line to start with when starting a parse. Tries to\n // find a line with a stateAfter, so that it can start with a\n // valid state. If that fails, it returns the line with the\n // smallest indentation, which tends to need the least context to\n // parse correctly.\n function findStartLine(cm, n, precise) {\n var minindent, minline, doc = cm.doc;\n var lim = precise ? -1 : n - (cm.doc.mode.innerMode ? 1000 : 100);\n for (var search = n; search > lim; --search) {\n if (search <= doc.first) { return doc.first }\n var line = getLine(doc, search - 1), after = line.stateAfter;\n if (after && (!precise || search + (after instanceof SavedContext ? after.lookAhead : 0) <= doc.modeFrontier))\n { return search }\n var indented = countColumn(line.text, null, cm.options.tabSize);\n if (minline == null || minindent > indented) {\n minline = search - 1;\n minindent = indented;\n }\n }\n return minline\n }\n\n function retreatFrontier(doc, n) {\n doc.modeFrontier = Math.min(doc.modeFrontier, n);\n if (doc.highlightFrontier < n - 10) { return }\n var start = doc.first;\n for (var line = n - 1; line > start; line--) {\n var saved = getLine(doc, line).stateAfter;\n // change is on 3\n // state on line 1 looked ahead 2 -- so saw 3\n // test 1 + 2 < 3 should cover this\n if (saved && (!(saved instanceof SavedContext) || line + saved.lookAhead < n)) {\n start = line + 1;\n break\n }\n }\n doc.highlightFrontier = Math.min(doc.highlightFrontier, start);\n }\n\n // Optimize some code when these features are not used.\n var sawReadOnlySpans = false, sawCollapsedSpans = false;\n\n function seeReadOnlySpans() {\n sawReadOnlySpans = true;\n }\n\n function seeCollapsedSpans() {\n sawCollapsedSpans = true;\n }\n\n // TEXTMARKER SPANS\n\n function MarkedSpan(marker, from, to) {\n this.marker = marker;\n this.from = from; this.to = to;\n }\n\n // Search an array of spans for a span matching the given marker.\n function getMarkedSpanFor(spans, marker) {\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.marker == marker) { return span }\n } }\n }\n\n // Remove a span from an array, returning undefined if no spans are\n // left (we don't store arrays for lines without spans).\n function removeMarkedSpan(spans, span) {\n var r;\n for (var i = 0; i < spans.length; ++i)\n { if (spans[i] != span) { (r || (r = [])).push(spans[i]); } }\n return r\n }\n\n // Add a span to a line.\n function addMarkedSpan(line, span, op) {\n var inThisOp = op && window.WeakSet && (op.markedSpans || (op.markedSpans = new WeakSet));\n if (inThisOp && line.markedSpans && inThisOp.has(line.markedSpans)) {\n line.markedSpans.push(span);\n } else {\n line.markedSpans = line.markedSpans ? line.markedSpans.concat([span]) : [span];\n if (inThisOp) { inThisOp.add(line.markedSpans); }\n }\n span.marker.attachLine(line);\n }\n\n // Used for the algorithm that adjusts markers for a change in the\n // document. These functions cut an array of spans at a given\n // character position, returning an array of remaining chunks (or\n // undefined if nothing remains).\n function markedSpansBefore(old, startCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= startCh : span.from < startCh);\n if (startsBefore || span.from == startCh && marker.type == \"bookmark\" && (!isInsert || !span.marker.insertLeft)) {\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= startCh : span.to > startCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, span.from, endsAfter ? null : span.to));\n }\n } }\n return nw\n }\n function markedSpansAfter(old, endCh, isInsert) {\n var nw;\n if (old) { for (var i = 0; i < old.length; ++i) {\n var span = old[i], marker = span.marker;\n var endsAfter = span.to == null || (marker.inclusiveRight ? span.to >= endCh : span.to > endCh);\n if (endsAfter || span.from == endCh && marker.type == \"bookmark\" && (!isInsert || span.marker.insertLeft)) {\n var startsBefore = span.from == null || (marker.inclusiveLeft ? span.from <= endCh : span.from < endCh)\n ;(nw || (nw = [])).push(new MarkedSpan(marker, startsBefore ? null : span.from - endCh,\n span.to == null ? null : span.to - endCh));\n }\n } }\n return nw\n }\n\n // Given a change object, compute the new set of marker spans that\n // cover the line in which the change took place. Removes spans\n // entirely within the change, reconnects spans belonging to the\n // same marker that appear on both sides of the change, and cuts off\n // spans partially within the change. Returns an array of span\n // arrays with one element for each line in (after) the change.\n function stretchSpansOverChange(doc, change) {\n if (change.full) { return null }\n var oldFirst = isLine(doc, change.from.line) && getLine(doc, change.from.line).markedSpans;\n var oldLast = isLine(doc, change.to.line) && getLine(doc, change.to.line).markedSpans;\n if (!oldFirst && !oldLast) { return null }\n\n var startCh = change.from.ch, endCh = change.to.ch, isInsert = cmp(change.from, change.to) == 0;\n // Get the spans that 'stick out' on both sides\n var first = markedSpansBefore(oldFirst, startCh, isInsert);\n var last = markedSpansAfter(oldLast, endCh, isInsert);\n\n // Next, merge those two ends\n var sameLine = change.text.length == 1, offset = lst(change.text).length + (sameLine ? startCh : 0);\n if (first) {\n // Fix up .to properties of first\n for (var i = 0; i < first.length; ++i) {\n var span = first[i];\n if (span.to == null) {\n var found = getMarkedSpanFor(last, span.marker);\n if (!found) { span.to = startCh; }\n else if (sameLine) { span.to = found.to == null ? null : found.to + offset; }\n }\n }\n }\n if (last) {\n // Fix up .from in last (or move them into first in case of sameLine)\n for (var i$1 = 0; i$1 < last.length; ++i$1) {\n var span$1 = last[i$1];\n if (span$1.to != null) { span$1.to += offset; }\n if (span$1.from == null) {\n var found$1 = getMarkedSpanFor(first, span$1.marker);\n if (!found$1) {\n span$1.from = offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n } else {\n span$1.from += offset;\n if (sameLine) { (first || (first = [])).push(span$1); }\n }\n }\n }\n // Make sure we didn't create any zero-length spans\n if (first) { first = clearEmptySpans(first); }\n if (last && last != first) { last = clearEmptySpans(last); }\n\n var newMarkers = [first];\n if (!sameLine) {\n // Fill gap with whole-line-spans\n var gap = change.text.length - 2, gapMarkers;\n if (gap > 0 && first)\n { for (var i$2 = 0; i$2 < first.length; ++i$2)\n { if (first[i$2].to == null)\n { (gapMarkers || (gapMarkers = [])).push(new MarkedSpan(first[i$2].marker, null, null)); } } }\n for (var i$3 = 0; i$3 < gap; ++i$3)\n { newMarkers.push(gapMarkers); }\n newMarkers.push(last);\n }\n return newMarkers\n }\n\n // Remove spans that are empty and don't have a clearWhenEmpty\n // option of false.\n function clearEmptySpans(spans) {\n for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if (span.from != null && span.from == span.to && span.marker.clearWhenEmpty !== false)\n { spans.splice(i--, 1); }\n }\n if (!spans.length) { return null }\n return spans\n }\n\n // Used to 'clip' out readOnly ranges when making a change.\n function removeReadOnlyRanges(doc, from, to) {\n var markers = null;\n doc.iter(from.line, to.line + 1, function (line) {\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var mark = line.markedSpans[i].marker;\n if (mark.readOnly && (!markers || indexOf(markers, mark) == -1))\n { (markers || (markers = [])).push(mark); }\n } }\n });\n if (!markers) { return null }\n var parts = [{from: from, to: to}];\n for (var i = 0; i < markers.length; ++i) {\n var mk = markers[i], m = mk.find(0);\n for (var j = 0; j < parts.length; ++j) {\n var p = parts[j];\n if (cmp(p.to, m.from) < 0 || cmp(p.from, m.to) > 0) { continue }\n var newParts = [j, 1], dfrom = cmp(p.from, m.from), dto = cmp(p.to, m.to);\n if (dfrom < 0 || !mk.inclusiveLeft && !dfrom)\n { newParts.push({from: p.from, to: m.from}); }\n if (dto > 0 || !mk.inclusiveRight && !dto)\n { newParts.push({from: m.to, to: p.to}); }\n parts.splice.apply(parts, newParts);\n j += newParts.length - 3;\n }\n }\n return parts\n }\n\n // Connect or disconnect spans from a line.\n function detachMarkedSpans(line) {\n var spans = line.markedSpans;\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.detachLine(line); }\n line.markedSpans = null;\n }\n function attachMarkedSpans(line, spans) {\n if (!spans) { return }\n for (var i = 0; i < spans.length; ++i)\n { spans[i].marker.attachLine(line); }\n line.markedSpans = spans;\n }\n\n // Helpers used when computing which overlapping collapsed span\n // counts as the larger one.\n function extraLeft(marker) { return marker.inclusiveLeft ? -1 : 0 }\n function extraRight(marker) { return marker.inclusiveRight ? 1 : 0 }\n\n // Returns a number indicating which of two overlapping collapsed\n // spans is larger (and thus includes the other). Falls back to\n // comparing ids when the spans cover exactly the same range.\n function compareCollapsedMarkers(a, b) {\n var lenDiff = a.lines.length - b.lines.length;\n if (lenDiff != 0) { return lenDiff }\n var aPos = a.find(), bPos = b.find();\n var fromCmp = cmp(aPos.from, bPos.from) || extraLeft(a) - extraLeft(b);\n if (fromCmp) { return -fromCmp }\n var toCmp = cmp(aPos.to, bPos.to) || extraRight(a) - extraRight(b);\n if (toCmp) { return toCmp }\n return b.id - a.id\n }\n\n // Find out whether a line ends or starts in a collapsed span. If\n // so, return the marker for that span.\n function collapsedSpanAtSide(line, start) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (sp.marker.collapsed && (start ? sp.from : sp.to) == null &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0))\n { found = sp.marker; }\n } }\n return found\n }\n function collapsedSpanAtStart(line) { return collapsedSpanAtSide(line, true) }\n function collapsedSpanAtEnd(line) { return collapsedSpanAtSide(line, false) }\n\n function collapsedSpanAround(line, ch) {\n var sps = sawCollapsedSpans && line.markedSpans, found;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (sp.marker.collapsed && (sp.from == null || sp.from < ch) && (sp.to == null || sp.to > ch) &&\n (!found || compareCollapsedMarkers(found, sp.marker) < 0)) { found = sp.marker; }\n } }\n return found\n }\n\n // Test whether there exists a collapsed span that partially\n // overlaps (covers the start or end, but not both) of a new span.\n // Such overlap is not allowed.\n function conflictingCollapsedRange(doc, lineNo, from, to, marker) {\n var line = getLine(doc, lineNo);\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i) {\n var sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n var found = sp.marker.find(0);\n var fromCmp = cmp(found.from, from) || extraLeft(sp.marker) - extraLeft(marker);\n var toCmp = cmp(found.to, to) || extraRight(sp.marker) - extraRight(marker);\n if (fromCmp >= 0 && toCmp <= 0 || fromCmp <= 0 && toCmp >= 0) { continue }\n if (fromCmp <= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.to, from) >= 0 : cmp(found.to, from) > 0) ||\n fromCmp >= 0 && (sp.marker.inclusiveRight && marker.inclusiveLeft ? cmp(found.from, to) <= 0 : cmp(found.from, to) < 0))\n { return true }\n } }\n }\n\n // A visual line is a line as drawn on the screen. Folding, for\n // example, can cause multiple logical lines to appear on the same\n // visual line. This finds the start of the visual line that the\n // given line is part of (usually that is the line itself).\n function visualLine(line) {\n var merged;\n while (merged = collapsedSpanAtStart(line))\n { line = merged.find(-1, true).line; }\n return line\n }\n\n function visualLineEnd(line) {\n var merged;\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return line\n }\n\n // Returns an array of logical lines that continue the visual line\n // started by the argument, or undefined if there are no such lines.\n function visualLineContinued(line) {\n var merged, lines;\n while (merged = collapsedSpanAtEnd(line)) {\n line = merged.find(1, true).line\n ;(lines || (lines = [])).push(line);\n }\n return lines\n }\n\n // Get the line number of the start of the visual line that the\n // given line number is part of.\n function visualLineNo(doc, lineN) {\n var line = getLine(doc, lineN), vis = visualLine(line);\n if (line == vis) { return lineN }\n return lineNo(vis)\n }\n\n // Get the line number of the start of the next visual line after\n // the given line.\n function visualLineEndNo(doc, lineN) {\n if (lineN > doc.lastLine()) { return lineN }\n var line = getLine(doc, lineN), merged;\n if (!lineIsHidden(doc, line)) { return lineN }\n while (merged = collapsedSpanAtEnd(line))\n { line = merged.find(1, true).line; }\n return lineNo(line) + 1\n }\n\n // Compute whether a line is hidden. Lines count as hidden when they\n // are part of a visual line that starts with another line, or when\n // they are entirely covered by collapsed, non-widget span.\n function lineIsHidden(doc, line) {\n var sps = sawCollapsedSpans && line.markedSpans;\n if (sps) { for (var sp = (void 0), i = 0; i < sps.length; ++i) {\n sp = sps[i];\n if (!sp.marker.collapsed) { continue }\n if (sp.from == null) { return true }\n if (sp.marker.widgetNode) { continue }\n if (sp.from == 0 && sp.marker.inclusiveLeft && lineIsHiddenInner(doc, line, sp))\n { return true }\n } }\n }\n function lineIsHiddenInner(doc, line, span) {\n if (span.to == null) {\n var end = span.marker.find(1, true);\n return lineIsHiddenInner(doc, end.line, getMarkedSpanFor(end.line.markedSpans, span.marker))\n }\n if (span.marker.inclusiveRight && span.to == line.text.length)\n { return true }\n for (var sp = (void 0), i = 0; i < line.markedSpans.length; ++i) {\n sp = line.markedSpans[i];\n if (sp.marker.collapsed && !sp.marker.widgetNode && sp.from == span.to &&\n (sp.to == null || sp.to != span.from) &&\n (sp.marker.inclusiveLeft || span.marker.inclusiveRight) &&\n lineIsHiddenInner(doc, line, sp)) { return true }\n }\n }\n\n // Find the height above the given line.\n function heightAtLine(lineObj) {\n lineObj = visualLine(lineObj);\n\n var h = 0, chunk = lineObj.parent;\n for (var i = 0; i < chunk.lines.length; ++i) {\n var line = chunk.lines[i];\n if (line == lineObj) { break }\n else { h += line.height; }\n }\n for (var p = chunk.parent; p; chunk = p, p = chunk.parent) {\n for (var i$1 = 0; i$1 < p.children.length; ++i$1) {\n var cur = p.children[i$1];\n if (cur == chunk) { break }\n else { h += cur.height; }\n }\n }\n return h\n }\n\n // Compute the character length of a line, taking into account\n // collapsed ranges (see markText) that might hide parts, and join\n // other lines onto it.\n function lineLength(line) {\n if (line.height == 0) { return 0 }\n var len = line.text.length, merged, cur = line;\n while (merged = collapsedSpanAtStart(cur)) {\n var found = merged.find(0, true);\n cur = found.from.line;\n len += found.from.ch - found.to.ch;\n }\n cur = line;\n while (merged = collapsedSpanAtEnd(cur)) {\n var found$1 = merged.find(0, true);\n len -= cur.text.length - found$1.from.ch;\n cur = found$1.to.line;\n len += cur.text.length - found$1.to.ch;\n }\n return len\n }\n\n // Find the longest line in the document.\n function findMaxLine(cm) {\n var d = cm.display, doc = cm.doc;\n d.maxLine = getLine(doc, doc.first);\n d.maxLineLength = lineLength(d.maxLine);\n d.maxLineChanged = true;\n doc.iter(function (line) {\n var len = lineLength(line);\n if (len > d.maxLineLength) {\n d.maxLineLength = len;\n d.maxLine = line;\n }\n });\n }\n\n // LINE DATA STRUCTURE\n\n // Line objects. These hold state related to a line, including\n // highlighting info (the styles array).\n var Line = function(text, markedSpans, estimateHeight) {\n this.text = text;\n attachMarkedSpans(this, markedSpans);\n this.height = estimateHeight ? estimateHeight(this) : 1;\n };\n\n Line.prototype.lineNo = function () { return lineNo(this) };\n eventMixin(Line);\n\n // Change the content (text, markers) of a line. Automatically\n // invalidates cached information and tries to re-estimate the\n // line's height.\n function updateLine(line, text, markedSpans, estimateHeight) {\n line.text = text;\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n if (line.order != null) { line.order = null; }\n detachMarkedSpans(line);\n attachMarkedSpans(line, markedSpans);\n var estHeight = estimateHeight ? estimateHeight(line) : 1;\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n }\n\n // Detach a line from the document tree and its markers.\n function cleanUpLine(line) {\n line.parent = null;\n detachMarkedSpans(line);\n }\n\n // Convert a style as returned by a mode (either null, or a string\n // containing one or more styles) to a CSS style. This is cached,\n // and also looks for line-wide styles.\n var styleToClassCache = {}, styleToClassCacheWithMode = {};\n function interpretTokenStyle(style, options) {\n if (!style || /^\\s*$/.test(style)) { return null }\n var cache = options.addModeClass ? styleToClassCacheWithMode : styleToClassCache;\n return cache[style] ||\n (cache[style] = style.replace(/\\S+/g, \"cm-$&\"))\n }\n\n // Render the DOM representation of the text of a line. Also builds\n // up a 'line map', which points at the DOM nodes that represent\n // specific stretches of text, and is used by the measuring code.\n // The returned object contains the DOM node, this map, and\n // information about line-wide styles that were set by the mode.\n function buildLineContent(cm, lineView) {\n // The padding-right forces the element to have a 'border', which\n // is needed on Webkit to be able to get line-level bounding\n // rectangles for it (in measureChar).\n var content = eltP(\"span\", null, null, webkit ? \"padding-right: .1px\" : null);\n var builder = {pre: eltP(\"pre\", [content], \"CodeMirror-line\"), content: content,\n col: 0, pos: 0, cm: cm,\n trailingSpace: false,\n splitSpaces: cm.getOption(\"lineWrapping\")};\n lineView.measure = {};\n\n // Iterate over the logical lines that make up this visual line.\n for (var i = 0; i <= (lineView.rest ? lineView.rest.length : 0); i++) {\n var line = i ? lineView.rest[i - 1] : lineView.line, order = (void 0);\n builder.pos = 0;\n builder.addToken = buildToken;\n // Optionally wire in some hacks into the token-rendering\n // algorithm, to deal with browser quirks.\n if (hasBadBidiRects(cm.display.measure) && (order = getOrder(line, cm.doc.direction)))\n { builder.addToken = buildTokenBadBidi(builder.addToken, order); }\n builder.map = [];\n var allowFrontierUpdate = lineView != cm.display.externalMeasured && lineNo(line);\n insertLineContent(line, builder, getLineStyles(cm, line, allowFrontierUpdate));\n if (line.styleClasses) {\n if (line.styleClasses.bgClass)\n { builder.bgClass = joinClasses(line.styleClasses.bgClass, builder.bgClass || \"\"); }\n if (line.styleClasses.textClass)\n { builder.textClass = joinClasses(line.styleClasses.textClass, builder.textClass || \"\"); }\n }\n\n // Ensure at least a single node is present, for measuring.\n if (builder.map.length == 0)\n { builder.map.push(0, 0, builder.content.appendChild(zeroWidthElement(cm.display.measure))); }\n\n // Store the map and a cache object for the current logical line\n if (i == 0) {\n lineView.measure.map = builder.map;\n lineView.measure.cache = {};\n } else {\n (lineView.measure.maps || (lineView.measure.maps = [])).push(builder.map)\n ;(lineView.measure.caches || (lineView.measure.caches = [])).push({});\n }\n }\n\n // See issue #2901\n if (webkit) {\n var last = builder.content.lastChild;\n if (/\\bcm-tab\\b/.test(last.className) || (last.querySelector && last.querySelector(\".cm-tab\")))\n { builder.content.className = \"cm-tab-wrap-hack\"; }\n }\n\n signal(cm, \"renderLine\", cm, lineView.line, builder.pre);\n if (builder.pre.className)\n { builder.textClass = joinClasses(builder.pre.className, builder.textClass || \"\"); }\n\n return builder\n }\n\n function defaultSpecialCharPlaceholder(ch) {\n var token = elt(\"span\", \"\\u2022\", \"cm-invalidchar\");\n token.title = \"\\\\u\" + ch.charCodeAt(0).toString(16);\n token.setAttribute(\"aria-label\", token.title);\n return token\n }\n\n // Build up the DOM representation for a single token, and add it to\n // the line map. Takes care to render special characters separately.\n function buildToken(builder, text, style, startStyle, endStyle, css, attributes) {\n if (!text) { return }\n var displayText = builder.splitSpaces ? splitSpaces(text, builder.trailingSpace) : text;\n var special = builder.cm.state.specialChars, mustWrap = false;\n var content;\n if (!special.test(text)) {\n builder.col += text.length;\n content = document.createTextNode(displayText);\n builder.map.push(builder.pos, builder.pos + text.length, content);\n if (ie && ie_version < 9) { mustWrap = true; }\n builder.pos += text.length;\n } else {\n content = document.createDocumentFragment();\n var pos = 0;\n while (true) {\n special.lastIndex = pos;\n var m = special.exec(text);\n var skipped = m ? m.index - pos : text.length - pos;\n if (skipped) {\n var txt = document.createTextNode(displayText.slice(pos, pos + skipped));\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt])); }\n else { content.appendChild(txt); }\n builder.map.push(builder.pos, builder.pos + skipped, txt);\n builder.col += skipped;\n builder.pos += skipped;\n }\n if (!m) { break }\n pos += skipped + 1;\n var txt$1 = (void 0);\n if (m[0] == \"\\t\") {\n var tabSize = builder.cm.options.tabSize, tabWidth = tabSize - builder.col % tabSize;\n txt$1 = content.appendChild(elt(\"span\", spaceStr(tabWidth), \"cm-tab\"));\n txt$1.setAttribute(\"role\", \"presentation\");\n txt$1.setAttribute(\"cm-text\", \"\\t\");\n builder.col += tabWidth;\n } else if (m[0] == \"\\r\" || m[0] == \"\\n\") {\n txt$1 = content.appendChild(elt(\"span\", m[0] == \"\\r\" ? \"\\u240d\" : \"\\u2424\", \"cm-invalidchar\"));\n txt$1.setAttribute(\"cm-text\", m[0]);\n builder.col += 1;\n } else {\n txt$1 = builder.cm.options.specialCharPlaceholder(m[0]);\n txt$1.setAttribute(\"cm-text\", m[0]);\n if (ie && ie_version < 9) { content.appendChild(elt(\"span\", [txt$1])); }\n else { content.appendChild(txt$1); }\n builder.col += 1;\n }\n builder.map.push(builder.pos, builder.pos + 1, txt$1);\n builder.pos++;\n }\n }\n builder.trailingSpace = displayText.charCodeAt(text.length - 1) == 32;\n if (style || startStyle || endStyle || mustWrap || css || attributes) {\n var fullStyle = style || \"\";\n if (startStyle) { fullStyle += startStyle; }\n if (endStyle) { fullStyle += endStyle; }\n var token = elt(\"span\", [content], fullStyle, css);\n if (attributes) {\n for (var attr in attributes) { if (attributes.hasOwnProperty(attr) && attr != \"style\" && attr != \"class\")\n { token.setAttribute(attr, attributes[attr]); } }\n }\n return builder.content.appendChild(token)\n }\n builder.content.appendChild(content);\n }\n\n // Change some spaces to NBSP to prevent the browser from collapsing\n // trailing spaces at the end of a line when rendering text (issue #1362).\n function splitSpaces(text, trailingBefore) {\n if (text.length > 1 && !/ /.test(text)) { return text }\n var spaceBefore = trailingBefore, result = \"\";\n for (var i = 0; i < text.length; i++) {\n var ch = text.charAt(i);\n if (ch == \" \" && spaceBefore && (i == text.length - 1 || text.charCodeAt(i + 1) == 32))\n { ch = \"\\u00a0\"; }\n result += ch;\n spaceBefore = ch == \" \";\n }\n return result\n }\n\n // Work around nonsense dimensions being reported for stretches of\n // right-to-left text.\n function buildTokenBadBidi(inner, order) {\n return function (builder, text, style, startStyle, endStyle, css, attributes) {\n style = style ? style + \" cm-force-border\" : \"cm-force-border\";\n var start = builder.pos, end = start + text.length;\n for (;;) {\n // Find the part that overlaps with the start of this text\n var part = (void 0);\n for (var i = 0; i < order.length; i++) {\n part = order[i];\n if (part.to > start && part.from <= start) { break }\n }\n if (part.to >= end) { return inner(builder, text, style, startStyle, endStyle, css, attributes) }\n inner(builder, text.slice(0, part.to - start), style, startStyle, null, css, attributes);\n startStyle = null;\n text = text.slice(part.to - start);\n start = part.to;\n }\n }\n }\n\n function buildCollapsedSpan(builder, size, marker, ignoreWidget) {\n var widget = !ignoreWidget && marker.widgetNode;\n if (widget) { builder.map.push(builder.pos, builder.pos + size, widget); }\n if (!ignoreWidget && builder.cm.display.input.needsContentAttribute) {\n if (!widget)\n { widget = builder.content.appendChild(document.createElement(\"span\")); }\n widget.setAttribute(\"cm-marker\", marker.id);\n }\n if (widget) {\n builder.cm.display.input.setUneditable(widget);\n builder.content.appendChild(widget);\n }\n builder.pos += size;\n builder.trailingSpace = false;\n }\n\n // Outputs a number of spans to make up a line, taking highlighting\n // and marked text into account.\n function insertLineContent(line, builder, styles) {\n var spans = line.markedSpans, allText = line.text, at = 0;\n if (!spans) {\n for (var i$1 = 1; i$1 < styles.length; i$1+=2)\n { builder.addToken(builder, allText.slice(at, at = styles[i$1]), interpretTokenStyle(styles[i$1+1], builder.cm.options)); }\n return\n }\n\n var len = allText.length, pos = 0, i = 1, text = \"\", style, css;\n var nextChange = 0, spanStyle, spanEndStyle, spanStartStyle, collapsed, attributes;\n for (;;) {\n if (nextChange == pos) { // Update current marker set\n spanStyle = spanEndStyle = spanStartStyle = css = \"\";\n attributes = null;\n collapsed = null; nextChange = Infinity;\n var foundBookmarks = [], endStyles = (void 0);\n for (var j = 0; j < spans.length; ++j) {\n var sp = spans[j], m = sp.marker;\n if (m.type == \"bookmark\" && sp.from == pos && m.widgetNode) {\n foundBookmarks.push(m);\n } else if (sp.from <= pos && (sp.to == null || sp.to > pos || m.collapsed && sp.to == pos && sp.from == pos)) {\n if (sp.to != null && sp.to != pos && nextChange > sp.to) {\n nextChange = sp.to;\n spanEndStyle = \"\";\n }\n if (m.className) { spanStyle += \" \" + m.className; }\n if (m.css) { css = (css ? css + \";\" : \"\") + m.css; }\n if (m.startStyle && sp.from == pos) { spanStartStyle += \" \" + m.startStyle; }\n if (m.endStyle && sp.to == nextChange) { (endStyles || (endStyles = [])).push(m.endStyle, sp.to); }\n // support for the old title property\n // https://github.com/codemirror/CodeMirror/pull/5673\n if (m.title) { (attributes || (attributes = {})).title = m.title; }\n if (m.attributes) {\n for (var attr in m.attributes)\n { (attributes || (attributes = {}))[attr] = m.attributes[attr]; }\n }\n if (m.collapsed && (!collapsed || compareCollapsedMarkers(collapsed.marker, m) < 0))\n { collapsed = sp; }\n } else if (sp.from > pos && nextChange > sp.from) {\n nextChange = sp.from;\n }\n }\n if (endStyles) { for (var j$1 = 0; j$1 < endStyles.length; j$1 += 2)\n { if (endStyles[j$1 + 1] == nextChange) { spanEndStyle += \" \" + endStyles[j$1]; } } }\n\n if (!collapsed || collapsed.from == pos) { for (var j$2 = 0; j$2 < foundBookmarks.length; ++j$2)\n { buildCollapsedSpan(builder, 0, foundBookmarks[j$2]); } }\n if (collapsed && (collapsed.from || 0) == pos) {\n buildCollapsedSpan(builder, (collapsed.to == null ? len + 1 : collapsed.to) - pos,\n collapsed.marker, collapsed.from == null);\n if (collapsed.to == null) { return }\n if (collapsed.to == pos) { collapsed = false; }\n }\n }\n if (pos >= len) { break }\n\n var upto = Math.min(len, nextChange);\n while (true) {\n if (text) {\n var end = pos + text.length;\n if (!collapsed) {\n var tokenText = end > upto ? text.slice(0, upto - pos) : text;\n builder.addToken(builder, tokenText, style ? style + spanStyle : spanStyle,\n spanStartStyle, pos + tokenText.length == nextChange ? spanEndStyle : \"\", css, attributes);\n }\n if (end >= upto) {text = text.slice(upto - pos); pos = upto; break}\n pos = end;\n spanStartStyle = \"\";\n }\n text = allText.slice(at, at = styles[i++]);\n style = interpretTokenStyle(styles[i++], builder.cm.options);\n }\n }\n }\n\n\n // These objects are used to represent the visible (currently drawn)\n // part of the document. A LineView may correspond to multiple\n // logical lines, if those are connected by collapsed ranges.\n function LineView(doc, line, lineN) {\n // The starting line\n this.line = line;\n // Continuing lines, if any\n this.rest = visualLineContinued(line);\n // Number of logical lines in this visual line\n this.size = this.rest ? lineNo(lst(this.rest)) - lineN + 1 : 1;\n this.node = this.text = null;\n this.hidden = lineIsHidden(doc, line);\n }\n\n // Create a range of LineView objects for the given lines.\n function buildViewArray(cm, from, to) {\n var array = [], nextPos;\n for (var pos = from; pos < to; pos = nextPos) {\n var view = new LineView(cm.doc, getLine(cm.doc, pos), pos);\n nextPos = pos + view.size;\n array.push(view);\n }\n return array\n }\n\n var operationGroup = null;\n\n function pushOperation(op) {\n if (operationGroup) {\n operationGroup.ops.push(op);\n } else {\n op.ownsGroup = operationGroup = {\n ops: [op],\n delayedCallbacks: []\n };\n }\n }\n\n function fireCallbacksForOps(group) {\n // Calls delayed callbacks and cursorActivity handlers until no\n // new ones appear\n var callbacks = group.delayedCallbacks, i = 0;\n do {\n for (; i < callbacks.length; i++)\n { callbacks[i].call(null); }\n for (var j = 0; j < group.ops.length; j++) {\n var op = group.ops[j];\n if (op.cursorActivityHandlers)\n { while (op.cursorActivityCalled < op.cursorActivityHandlers.length)\n { op.cursorActivityHandlers[op.cursorActivityCalled++].call(null, op.cm); } }\n }\n } while (i < callbacks.length)\n }\n\n function finishOperation(op, endCb) {\n var group = op.ownsGroup;\n if (!group) { return }\n\n try { fireCallbacksForOps(group); }\n finally {\n operationGroup = null;\n endCb(group);\n }\n }\n\n var orphanDelayedCallbacks = null;\n\n // Often, we want to signal events at a point where we are in the\n // middle of some work, but don't want the handler to start calling\n // other methods on the editor, which might be in an inconsistent\n // state or simply not expect any other events to happen.\n // signalLater looks whether there are any handlers, and schedules\n // them to be executed when the last operation ends, or, if no\n // operation is active, when a timeout fires.\n function signalLater(emitter, type /*, values...*/) {\n var arr = getHandlers(emitter, type);\n if (!arr.length) { return }\n var args = Array.prototype.slice.call(arguments, 2), list;\n if (operationGroup) {\n list = operationGroup.delayedCallbacks;\n } else if (orphanDelayedCallbacks) {\n list = orphanDelayedCallbacks;\n } else {\n list = orphanDelayedCallbacks = [];\n setTimeout(fireOrphanDelayed, 0);\n }\n var loop = function ( i ) {\n list.push(function () { return arr[i].apply(null, args); });\n };\n\n for (var i = 0; i < arr.length; ++i)\n loop( i );\n }\n\n function fireOrphanDelayed() {\n var delayed = orphanDelayedCallbacks;\n orphanDelayedCallbacks = null;\n for (var i = 0; i < delayed.length; ++i) { delayed[i](); }\n }\n\n // When an aspect of a line changes, a string is added to\n // lineView.changes. This updates the relevant part of the line's\n // DOM structure.\n function updateLineForChanges(cm, lineView, lineN, dims) {\n for (var j = 0; j < lineView.changes.length; j++) {\n var type = lineView.changes[j];\n if (type == \"text\") { updateLineText(cm, lineView); }\n else if (type == \"gutter\") { updateLineGutter(cm, lineView, lineN, dims); }\n else if (type == \"class\") { updateLineClasses(cm, lineView); }\n else if (type == \"widget\") { updateLineWidgets(cm, lineView, dims); }\n }\n lineView.changes = null;\n }\n\n // Lines with gutter elements, widgets or a background class need to\n // be wrapped, and have the extra elements added to the wrapper div\n function ensureLineWrapped(lineView) {\n if (lineView.node == lineView.text) {\n lineView.node = elt(\"div\", null, null, \"position: relative\");\n if (lineView.text.parentNode)\n { lineView.text.parentNode.replaceChild(lineView.node, lineView.text); }\n lineView.node.appendChild(lineView.text);\n if (ie && ie_version < 8) { lineView.node.style.zIndex = 2; }\n }\n return lineView.node\n }\n\n function updateLineBackground(cm, lineView) {\n var cls = lineView.bgClass ? lineView.bgClass + \" \" + (lineView.line.bgClass || \"\") : lineView.line.bgClass;\n if (cls) { cls += \" CodeMirror-linebackground\"; }\n if (lineView.background) {\n if (cls) { lineView.background.className = cls; }\n else { lineView.background.parentNode.removeChild(lineView.background); lineView.background = null; }\n } else if (cls) {\n var wrap = ensureLineWrapped(lineView);\n lineView.background = wrap.insertBefore(elt(\"div\", null, cls), wrap.firstChild);\n cm.display.input.setUneditable(lineView.background);\n }\n }\n\n // Wrapper around buildLineContent which will reuse the structure\n // in display.externalMeasured when possible.\n function getLineContent(cm, lineView) {\n var ext = cm.display.externalMeasured;\n if (ext && ext.line == lineView.line) {\n cm.display.externalMeasured = null;\n lineView.measure = ext.measure;\n return ext.built\n }\n return buildLineContent(cm, lineView)\n }\n\n // Redraw the line's text. Interacts with the background and text\n // classes because the mode may output tokens that influence these\n // classes.\n function updateLineText(cm, lineView) {\n var cls = lineView.text.className;\n var built = getLineContent(cm, lineView);\n if (lineView.text == lineView.node) { lineView.node = built.pre; }\n lineView.text.parentNode.replaceChild(built.pre, lineView.text);\n lineView.text = built.pre;\n if (built.bgClass != lineView.bgClass || built.textClass != lineView.textClass) {\n lineView.bgClass = built.bgClass;\n lineView.textClass = built.textClass;\n updateLineClasses(cm, lineView);\n } else if (cls) {\n lineView.text.className = cls;\n }\n }\n\n function updateLineClasses(cm, lineView) {\n updateLineBackground(cm, lineView);\n if (lineView.line.wrapClass)\n { ensureLineWrapped(lineView).className = lineView.line.wrapClass; }\n else if (lineView.node != lineView.text)\n { lineView.node.className = \"\"; }\n var textClass = lineView.textClass ? lineView.textClass + \" \" + (lineView.line.textClass || \"\") : lineView.line.textClass;\n lineView.text.className = textClass || \"\";\n }\n\n function updateLineGutter(cm, lineView, lineN, dims) {\n if (lineView.gutter) {\n lineView.node.removeChild(lineView.gutter);\n lineView.gutter = null;\n }\n if (lineView.gutterBackground) {\n lineView.node.removeChild(lineView.gutterBackground);\n lineView.gutterBackground = null;\n }\n if (lineView.line.gutterClass) {\n var wrap = ensureLineWrapped(lineView);\n lineView.gutterBackground = elt(\"div\", null, \"CodeMirror-gutter-background \" + lineView.line.gutterClass,\n (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px; width: \" + (dims.gutterTotalWidth) + \"px\"));\n cm.display.input.setUneditable(lineView.gutterBackground);\n wrap.insertBefore(lineView.gutterBackground, lineView.text);\n }\n var markers = lineView.line.gutterMarkers;\n if (cm.options.lineNumbers || markers) {\n var wrap$1 = ensureLineWrapped(lineView);\n var gutterWrap = lineView.gutter = elt(\"div\", null, \"CodeMirror-gutter-wrapper\", (\"left: \" + (cm.options.fixedGutter ? dims.fixedPos : -dims.gutterTotalWidth) + \"px\"));\n gutterWrap.setAttribute(\"aria-hidden\", \"true\");\n cm.display.input.setUneditable(gutterWrap);\n wrap$1.insertBefore(gutterWrap, lineView.text);\n if (lineView.line.gutterClass)\n { gutterWrap.className += \" \" + lineView.line.gutterClass; }\n if (cm.options.lineNumbers && (!markers || !markers[\"CodeMirror-linenumbers\"]))\n { lineView.lineNumber = gutterWrap.appendChild(\n elt(\"div\", lineNumberFor(cm.options, lineN),\n \"CodeMirror-linenumber CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[\"CodeMirror-linenumbers\"]) + \"px; width: \" + (cm.display.lineNumInnerWidth) + \"px\"))); }\n if (markers) { for (var k = 0; k < cm.display.gutterSpecs.length; ++k) {\n var id = cm.display.gutterSpecs[k].className, found = markers.hasOwnProperty(id) && markers[id];\n if (found)\n { gutterWrap.appendChild(elt(\"div\", [found], \"CodeMirror-gutter-elt\",\n (\"left: \" + (dims.gutterLeft[id]) + \"px; width: \" + (dims.gutterWidth[id]) + \"px\"))); }\n } }\n }\n }\n\n function updateLineWidgets(cm, lineView, dims) {\n if (lineView.alignable) { lineView.alignable = null; }\n var isWidget = classTest(\"CodeMirror-linewidget\");\n for (var node = lineView.node.firstChild, next = (void 0); node; node = next) {\n next = node.nextSibling;\n if (isWidget.test(node.className)) { lineView.node.removeChild(node); }\n }\n insertLineWidgets(cm, lineView, dims);\n }\n\n // Build a line's DOM representation from scratch\n function buildLineElement(cm, lineView, lineN, dims) {\n var built = getLineContent(cm, lineView);\n lineView.text = lineView.node = built.pre;\n if (built.bgClass) { lineView.bgClass = built.bgClass; }\n if (built.textClass) { lineView.textClass = built.textClass; }\n\n updateLineClasses(cm, lineView);\n updateLineGutter(cm, lineView, lineN, dims);\n insertLineWidgets(cm, lineView, dims);\n return lineView.node\n }\n\n // A lineView may contain multiple logical lines (when merged by\n // collapsed spans). The widgets for all of them need to be drawn.\n function insertLineWidgets(cm, lineView, dims) {\n insertLineWidgetsFor(cm, lineView.line, lineView, dims, true);\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { insertLineWidgetsFor(cm, lineView.rest[i], lineView, dims, false); } }\n }\n\n function insertLineWidgetsFor(cm, line, lineView, dims, allowAbove) {\n if (!line.widgets) { return }\n var wrap = ensureLineWrapped(lineView);\n for (var i = 0, ws = line.widgets; i < ws.length; ++i) {\n var widget = ws[i], node = elt(\"div\", [widget.node], \"CodeMirror-linewidget\" + (widget.className ? \" \" + widget.className : \"\"));\n if (!widget.handleMouseEvents) { node.setAttribute(\"cm-ignore-events\", \"true\"); }\n positionLineWidget(widget, node, lineView, dims);\n cm.display.input.setUneditable(node);\n if (allowAbove && widget.above)\n { wrap.insertBefore(node, lineView.gutter || lineView.text); }\n else\n { wrap.appendChild(node); }\n signalLater(widget, \"redraw\");\n }\n }\n\n function positionLineWidget(widget, node, lineView, dims) {\n if (widget.noHScroll) {\n (lineView.alignable || (lineView.alignable = [])).push(node);\n var width = dims.wrapperWidth;\n node.style.left = dims.fixedPos + \"px\";\n if (!widget.coverGutter) {\n width -= dims.gutterTotalWidth;\n node.style.paddingLeft = dims.gutterTotalWidth + \"px\";\n }\n node.style.width = width + \"px\";\n }\n if (widget.coverGutter) {\n node.style.zIndex = 5;\n node.style.position = \"relative\";\n if (!widget.noHScroll) { node.style.marginLeft = -dims.gutterTotalWidth + \"px\"; }\n }\n }\n\n function widgetHeight(widget) {\n if (widget.height != null) { return widget.height }\n var cm = widget.doc.cm;\n if (!cm) { return 0 }\n if (!contains(document.body, widget.node)) {\n var parentStyle = \"position: relative;\";\n if (widget.coverGutter)\n { parentStyle += \"margin-left: -\" + cm.display.gutters.offsetWidth + \"px;\"; }\n if (widget.noHScroll)\n { parentStyle += \"width: \" + cm.display.wrapper.clientWidth + \"px;\"; }\n removeChildrenAndAdd(cm.display.measure, elt(\"div\", [widget.node], null, parentStyle));\n }\n return widget.height = widget.node.parentNode.offsetHeight\n }\n\n // Return true when the given mouse event happened in a widget\n function eventInWidget(display, e) {\n for (var n = e_target(e); n != display.wrapper; n = n.parentNode) {\n if (!n || (n.nodeType == 1 && n.getAttribute(\"cm-ignore-events\") == \"true\") ||\n (n.parentNode == display.sizer && n != display.mover))\n { return true }\n }\n }\n\n // POSITION MEASUREMENT\n\n function paddingTop(display) {return display.lineSpace.offsetTop}\n function paddingVert(display) {return display.mover.offsetHeight - display.lineSpace.offsetHeight}\n function paddingH(display) {\n if (display.cachedPaddingH) { return display.cachedPaddingH }\n var e = removeChildrenAndAdd(display.measure, elt(\"pre\", \"x\", \"CodeMirror-line-like\"));\n var style = window.getComputedStyle ? window.getComputedStyle(e) : e.currentStyle;\n var data = {left: parseInt(style.paddingLeft), right: parseInt(style.paddingRight)};\n if (!isNaN(data.left) && !isNaN(data.right)) { display.cachedPaddingH = data; }\n return data\n }\n\n function scrollGap(cm) { return scrollerGap - cm.display.nativeBarWidth }\n function displayWidth(cm) {\n return cm.display.scroller.clientWidth - scrollGap(cm) - cm.display.barWidth\n }\n function displayHeight(cm) {\n return cm.display.scroller.clientHeight - scrollGap(cm) - cm.display.barHeight\n }\n\n // Ensure the lineView.wrapping.heights array is populated. This is\n // an array of bottom offsets for the lines that make up a drawn\n // line. When lineWrapping is on, there might be more than one\n // height.\n function ensureLineHeights(cm, lineView, rect) {\n var wrapping = cm.options.lineWrapping;\n var curWidth = wrapping && displayWidth(cm);\n if (!lineView.measure.heights || wrapping && lineView.measure.width != curWidth) {\n var heights = lineView.measure.heights = [];\n if (wrapping) {\n lineView.measure.width = curWidth;\n var rects = lineView.text.firstChild.getClientRects();\n for (var i = 0; i < rects.length - 1; i++) {\n var cur = rects[i], next = rects[i + 1];\n if (Math.abs(cur.bottom - next.bottom) > 2)\n { heights.push((cur.bottom + next.top) / 2 - rect.top); }\n }\n }\n heights.push(rect.bottom - rect.top);\n }\n }\n\n // Find a line map (mapping character offsets to text nodes) and a\n // measurement cache for the given line number. (A line view might\n // contain multiple lines when collapsed ranges are present.)\n function mapFromLineView(lineView, line, lineN) {\n if (lineView.line == line)\n { return {map: lineView.measure.map, cache: lineView.measure.cache} }\n if (lineView.rest) {\n for (var i = 0; i < lineView.rest.length; i++)\n { if (lineView.rest[i] == line)\n { return {map: lineView.measure.maps[i], cache: lineView.measure.caches[i]} } }\n for (var i$1 = 0; i$1 < lineView.rest.length; i$1++)\n { if (lineNo(lineView.rest[i$1]) > lineN)\n { return {map: lineView.measure.maps[i$1], cache: lineView.measure.caches[i$1], before: true} } }\n }\n }\n\n // Render a line into the hidden node display.externalMeasured. Used\n // when measurement is needed for a line that's not in the viewport.\n function updateExternalMeasurement(cm, line) {\n line = visualLine(line);\n var lineN = lineNo(line);\n var view = cm.display.externalMeasured = new LineView(cm.doc, line, lineN);\n view.lineN = lineN;\n var built = view.built = buildLineContent(cm, view);\n view.text = built.pre;\n removeChildrenAndAdd(cm.display.lineMeasure, built.pre);\n return view\n }\n\n // Get a {top, bottom, left, right} box (in line-local coordinates)\n // for a given character.\n function measureChar(cm, line, ch, bias) {\n return measureCharPrepared(cm, prepareMeasureForLine(cm, line), ch, bias)\n }\n\n // Find a line view that corresponds to the given line number.\n function findViewForLine(cm, lineN) {\n if (lineN >= cm.display.viewFrom && lineN < cm.display.viewTo)\n { return cm.display.view[findViewIndex(cm, lineN)] }\n var ext = cm.display.externalMeasured;\n if (ext && lineN >= ext.lineN && lineN < ext.lineN + ext.size)\n { return ext }\n }\n\n // Measurement can be split in two steps, the set-up work that\n // applies to the whole line, and the measurement of the actual\n // character. Functions like coordsChar, that need to do a lot of\n // measurements in a row, can thus ensure that the set-up work is\n // only done once.\n function prepareMeasureForLine(cm, line) {\n var lineN = lineNo(line);\n var view = findViewForLine(cm, lineN);\n if (view && !view.text) {\n view = null;\n } else if (view && view.changes) {\n updateLineForChanges(cm, view, lineN, getDimensions(cm));\n cm.curOp.forceUpdate = true;\n }\n if (!view)\n { view = updateExternalMeasurement(cm, line); }\n\n var info = mapFromLineView(view, line, lineN);\n return {\n line: line, view: view, rect: null,\n map: info.map, cache: info.cache, before: info.before,\n hasHeights: false\n }\n }\n\n // Given a prepared measurement object, measures the position of an\n // actual character (or fetches it from the cache).\n function measureCharPrepared(cm, prepared, ch, bias, varHeight) {\n if (prepared.before) { ch = -1; }\n var key = ch + (bias || \"\"), found;\n if (prepared.cache.hasOwnProperty(key)) {\n found = prepared.cache[key];\n } else {\n if (!prepared.rect)\n { prepared.rect = prepared.view.text.getBoundingClientRect(); }\n if (!prepared.hasHeights) {\n ensureLineHeights(cm, prepared.view, prepared.rect);\n prepared.hasHeights = true;\n }\n found = measureCharInner(cm, prepared, ch, bias);\n if (!found.bogus) { prepared.cache[key] = found; }\n }\n return {left: found.left, right: found.right,\n top: varHeight ? found.rtop : found.top,\n bottom: varHeight ? found.rbottom : found.bottom}\n }\n\n var nullRect = {left: 0, right: 0, top: 0, bottom: 0};\n\n function nodeAndOffsetInLineMap(map, ch, bias) {\n var node, start, end, collapse, mStart, mEnd;\n // First, search the line map for the text node corresponding to,\n // or closest to, the target character.\n for (var i = 0; i < map.length; i += 3) {\n mStart = map[i];\n mEnd = map[i + 1];\n if (ch < mStart) {\n start = 0; end = 1;\n collapse = \"left\";\n } else if (ch < mEnd) {\n start = ch - mStart;\n end = start + 1;\n } else if (i == map.length - 3 || ch == mEnd && map[i + 3] > ch) {\n end = mEnd - mStart;\n start = end - 1;\n if (ch >= mEnd) { collapse = \"right\"; }\n }\n if (start != null) {\n node = map[i + 2];\n if (mStart == mEnd && bias == (node.insertLeft ? \"left\" : \"right\"))\n { collapse = bias; }\n if (bias == \"left\" && start == 0)\n { while (i && map[i - 2] == map[i - 3] && map[i - 1].insertLeft) {\n node = map[(i -= 3) + 2];\n collapse = \"left\";\n } }\n if (bias == \"right\" && start == mEnd - mStart)\n { while (i < map.length - 3 && map[i + 3] == map[i + 4] && !map[i + 5].insertLeft) {\n node = map[(i += 3) + 2];\n collapse = \"right\";\n } }\n break\n }\n }\n return {node: node, start: start, end: end, collapse: collapse, coverStart: mStart, coverEnd: mEnd}\n }\n\n function getUsefulRect(rects, bias) {\n var rect = nullRect;\n if (bias == \"left\") { for (var i = 0; i < rects.length; i++) {\n if ((rect = rects[i]).left != rect.right) { break }\n } } else { for (var i$1 = rects.length - 1; i$1 >= 0; i$1--) {\n if ((rect = rects[i$1]).left != rect.right) { break }\n } }\n return rect\n }\n\n function measureCharInner(cm, prepared, ch, bias) {\n var place = nodeAndOffsetInLineMap(prepared.map, ch, bias);\n var node = place.node, start = place.start, end = place.end, collapse = place.collapse;\n\n var rect;\n if (node.nodeType == 3) { // If it is a text node, use a range to retrieve the coordinates.\n for (var i$1 = 0; i$1 < 4; i$1++) { // Retry a maximum of 4 times when nonsense rectangles are returned\n while (start && isExtendingChar(prepared.line.text.charAt(place.coverStart + start))) { --start; }\n while (place.coverStart + end < place.coverEnd && isExtendingChar(prepared.line.text.charAt(place.coverStart + end))) { ++end; }\n if (ie && ie_version < 9 && start == 0 && end == place.coverEnd - place.coverStart)\n { rect = node.parentNode.getBoundingClientRect(); }\n else\n { rect = getUsefulRect(range(node, start, end).getClientRects(), bias); }\n if (rect.left || rect.right || start == 0) { break }\n end = start;\n start = start - 1;\n collapse = \"right\";\n }\n if (ie && ie_version < 11) { rect = maybeUpdateRectForZooming(cm.display.measure, rect); }\n } else { // If it is a widget, simply get the box for the whole widget.\n if (start > 0) { collapse = bias = \"right\"; }\n var rects;\n if (cm.options.lineWrapping && (rects = node.getClientRects()).length > 1)\n { rect = rects[bias == \"right\" ? rects.length - 1 : 0]; }\n else\n { rect = node.getBoundingClientRect(); }\n }\n if (ie && ie_version < 9 && !start && (!rect || !rect.left && !rect.right)) {\n var rSpan = node.parentNode.getClientRects()[0];\n if (rSpan)\n { rect = {left: rSpan.left, right: rSpan.left + charWidth(cm.display), top: rSpan.top, bottom: rSpan.bottom}; }\n else\n { rect = nullRect; }\n }\n\n var rtop = rect.top - prepared.rect.top, rbot = rect.bottom - prepared.rect.top;\n var mid = (rtop + rbot) / 2;\n var heights = prepared.view.measure.heights;\n var i = 0;\n for (; i < heights.length - 1; i++)\n { if (mid < heights[i]) { break } }\n var top = i ? heights[i - 1] : 0, bot = heights[i];\n var result = {left: (collapse == \"right\" ? rect.right : rect.left) - prepared.rect.left,\n right: (collapse == \"left\" ? rect.left : rect.right) - prepared.rect.left,\n top: top, bottom: bot};\n if (!rect.left && !rect.right) { result.bogus = true; }\n if (!cm.options.singleCursorHeightPerLine) { result.rtop = rtop; result.rbottom = rbot; }\n\n return result\n }\n\n // Work around problem with bounding client rects on ranges being\n // returned incorrectly when zoomed on IE10 and below.\n function maybeUpdateRectForZooming(measure, rect) {\n if (!window.screen || screen.logicalXDPI == null ||\n screen.logicalXDPI == screen.deviceXDPI || !hasBadZoomedRects(measure))\n { return rect }\n var scaleX = screen.logicalXDPI / screen.deviceXDPI;\n var scaleY = screen.logicalYDPI / screen.deviceYDPI;\n return {left: rect.left * scaleX, right: rect.right * scaleX,\n top: rect.top * scaleY, bottom: rect.bottom * scaleY}\n }\n\n function clearLineMeasurementCacheFor(lineView) {\n if (lineView.measure) {\n lineView.measure.cache = {};\n lineView.measure.heights = null;\n if (lineView.rest) { for (var i = 0; i < lineView.rest.length; i++)\n { lineView.measure.caches[i] = {}; } }\n }\n }\n\n function clearLineMeasurementCache(cm) {\n cm.display.externalMeasure = null;\n removeChildren(cm.display.lineMeasure);\n for (var i = 0; i < cm.display.view.length; i++)\n { clearLineMeasurementCacheFor(cm.display.view[i]); }\n }\n\n function clearCaches(cm) {\n clearLineMeasurementCache(cm);\n cm.display.cachedCharWidth = cm.display.cachedTextHeight = cm.display.cachedPaddingH = null;\n if (!cm.options.lineWrapping) { cm.display.maxLineChanged = true; }\n cm.display.lineNumChars = null;\n }\n\n function pageScrollX(doc) {\n // Work around https://bugs.chromium.org/p/chromium/issues/detail?id=489206\n // which causes page_Offset and bounding client rects to use\n // different reference viewports and invalidate our calculations.\n if (chrome && android) { return -(doc.body.getBoundingClientRect().left - parseInt(getComputedStyle(doc.body).marginLeft)) }\n return doc.defaultView.pageXOffset || (doc.documentElement || doc.body).scrollLeft\n }\n function pageScrollY(doc) {\n if (chrome && android) { return -(doc.body.getBoundingClientRect().top - parseInt(getComputedStyle(doc.body).marginTop)) }\n return doc.defaultView.pageYOffset || (doc.documentElement || doc.body).scrollTop\n }\n\n function widgetTopHeight(lineObj) {\n var ref = visualLine(lineObj);\n var widgets = ref.widgets;\n var height = 0;\n if (widgets) { for (var i = 0; i < widgets.length; ++i) { if (widgets[i].above)\n { height += widgetHeight(widgets[i]); } } }\n return height\n }\n\n // Converts a {top, bottom, left, right} box from line-local\n // coordinates into another coordinate system. Context may be one of\n // \"line\", \"div\" (display.lineDiv), \"local\"./null (editor), \"window\",\n // or \"page\".\n function intoCoordSystem(cm, lineObj, rect, context, includeWidgets) {\n if (!includeWidgets) {\n var height = widgetTopHeight(lineObj);\n rect.top += height; rect.bottom += height;\n }\n if (context == \"line\") { return rect }\n if (!context) { context = \"local\"; }\n var yOff = heightAtLine(lineObj);\n if (context == \"local\") { yOff += paddingTop(cm.display); }\n else { yOff -= cm.display.viewOffset; }\n if (context == \"page\" || context == \"window\") {\n var lOff = cm.display.lineSpace.getBoundingClientRect();\n yOff += lOff.top + (context == \"window\" ? 0 : pageScrollY(doc(cm)));\n var xOff = lOff.left + (context == \"window\" ? 0 : pageScrollX(doc(cm)));\n rect.left += xOff; rect.right += xOff;\n }\n rect.top += yOff; rect.bottom += yOff;\n return rect\n }\n\n // Coverts a box from \"div\" coords to another coordinate system.\n // Context may be \"window\", \"page\", \"div\", or \"local\"./null.\n function fromCoordSystem(cm, coords, context) {\n if (context == \"div\") { return coords }\n var left = coords.left, top = coords.top;\n // First move into \"page\" coordinate system\n if (context == \"page\") {\n left -= pageScrollX(doc(cm));\n top -= pageScrollY(doc(cm));\n } else if (context == \"local\" || !context) {\n var localBox = cm.display.sizer.getBoundingClientRect();\n left += localBox.left;\n top += localBox.top;\n }\n\n var lineSpaceBox = cm.display.lineSpace.getBoundingClientRect();\n return {left: left - lineSpaceBox.left, top: top - lineSpaceBox.top}\n }\n\n function charCoords(cm, pos, context, lineObj, bias) {\n if (!lineObj) { lineObj = getLine(cm.doc, pos.line); }\n return intoCoordSystem(cm, lineObj, measureChar(cm, lineObj, pos.ch, bias), context)\n }\n\n // Returns a box for a given cursor position, which may have an\n // 'other' property containing the position of the secondary cursor\n // on a bidi boundary.\n // A cursor Pos(line, char, \"before\") is on the same visual line as `char - 1`\n // and after `char - 1` in writing order of `char - 1`\n // A cursor Pos(line, char, \"after\") is on the same visual line as `char`\n // and before `char` in writing order of `char`\n // Examples (upper-case letters are RTL, lower-case are LTR):\n // Pos(0, 1, ...)\n // before after\n // ab a|b a|b\n // aB a|B aB|\n // Ab |Ab A|b\n // AB B|A B|A\n // Every position after the last character on a line is considered to stick\n // to the last character on the line.\n function cursorCoords(cm, pos, context, lineObj, preparedMeasure, varHeight) {\n lineObj = lineObj || getLine(cm.doc, pos.line);\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n function get(ch, right) {\n var m = measureCharPrepared(cm, preparedMeasure, ch, right ? \"right\" : \"left\", varHeight);\n if (right) { m.left = m.right; } else { m.right = m.left; }\n return intoCoordSystem(cm, lineObj, m, context)\n }\n var order = getOrder(lineObj, cm.doc.direction), ch = pos.ch, sticky = pos.sticky;\n if (ch >= lineObj.text.length) {\n ch = lineObj.text.length;\n sticky = \"before\";\n } else if (ch <= 0) {\n ch = 0;\n sticky = \"after\";\n }\n if (!order) { return get(sticky == \"before\" ? ch - 1 : ch, sticky == \"before\") }\n\n function getBidi(ch, partPos, invert) {\n var part = order[partPos], right = part.level == 1;\n return get(invert ? ch - 1 : ch, right != invert)\n }\n var partPos = getBidiPartAt(order, ch, sticky);\n var other = bidiOther;\n var val = getBidi(ch, partPos, sticky == \"before\");\n if (other != null) { val.other = getBidi(ch, other, sticky != \"before\"); }\n return val\n }\n\n // Used to cheaply estimate the coordinates for a position. Used for\n // intermediate scroll updates.\n function estimateCoords(cm, pos) {\n var left = 0;\n pos = clipPos(cm.doc, pos);\n if (!cm.options.lineWrapping) { left = charWidth(cm.display) * pos.ch; }\n var lineObj = getLine(cm.doc, pos.line);\n var top = heightAtLine(lineObj) + paddingTop(cm.display);\n return {left: left, right: left, top: top, bottom: top + lineObj.height}\n }\n\n // Positions returned by coordsChar contain some extra information.\n // xRel is the relative x position of the input coordinates compared\n // to the found position (so xRel > 0 means the coordinates are to\n // the right of the character position, for example). When outside\n // is true, that means the coordinates lie outside the line's\n // vertical range.\n function PosWithInfo(line, ch, sticky, outside, xRel) {\n var pos = Pos(line, ch, sticky);\n pos.xRel = xRel;\n if (outside) { pos.outside = outside; }\n return pos\n }\n\n // Compute the character position closest to the given coordinates.\n // Input must be lineSpace-local (\"div\" coordinate system).\n function coordsChar(cm, x, y) {\n var doc = cm.doc;\n y += cm.display.viewOffset;\n if (y < 0) { return PosWithInfo(doc.first, 0, null, -1, -1) }\n var lineN = lineAtHeight(doc, y), last = doc.first + doc.size - 1;\n if (lineN > last)\n { return PosWithInfo(doc.first + doc.size - 1, getLine(doc, last).text.length, null, 1, 1) }\n if (x < 0) { x = 0; }\n\n var lineObj = getLine(doc, lineN);\n for (;;) {\n var found = coordsCharInner(cm, lineObj, lineN, x, y);\n var collapsed = collapsedSpanAround(lineObj, found.ch + (found.xRel > 0 || found.outside > 0 ? 1 : 0));\n if (!collapsed) { return found }\n var rangeEnd = collapsed.find(1);\n if (rangeEnd.line == lineN) { return rangeEnd }\n lineObj = getLine(doc, lineN = rangeEnd.line);\n }\n }\n\n function wrappedLineExtent(cm, lineObj, preparedMeasure, y) {\n y -= widgetTopHeight(lineObj);\n var end = lineObj.text.length;\n var begin = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch - 1).bottom <= y; }, end, 0);\n end = findFirst(function (ch) { return measureCharPrepared(cm, preparedMeasure, ch).top > y; }, begin, end);\n return {begin: begin, end: end}\n }\n\n function wrappedLineExtentChar(cm, lineObj, preparedMeasure, target) {\n if (!preparedMeasure) { preparedMeasure = prepareMeasureForLine(cm, lineObj); }\n var targetTop = intoCoordSystem(cm, lineObj, measureCharPrepared(cm, preparedMeasure, target), \"line\").top;\n return wrappedLineExtent(cm, lineObj, preparedMeasure, targetTop)\n }\n\n // Returns true if the given side of a box is after the given\n // coordinates, in top-to-bottom, left-to-right order.\n function boxIsAfter(box, x, y, left) {\n return box.bottom <= y ? false : box.top > y ? true : (left ? box.left : box.right) > x\n }\n\n function coordsCharInner(cm, lineObj, lineNo, x, y) {\n // Move y into line-local coordinate space\n y -= heightAtLine(lineObj);\n var preparedMeasure = prepareMeasureForLine(cm, lineObj);\n // When directly calling `measureCharPrepared`, we have to adjust\n // for the widgets at this line.\n var widgetHeight = widgetTopHeight(lineObj);\n var begin = 0, end = lineObj.text.length, ltr = true;\n\n var order = getOrder(lineObj, cm.doc.direction);\n // If the line isn't plain left-to-right text, first figure out\n // which bidi section the coordinates fall into.\n if (order) {\n var part = (cm.options.lineWrapping ? coordsBidiPartWrapped : coordsBidiPart)\n (cm, lineObj, lineNo, preparedMeasure, order, x, y);\n ltr = part.level != 1;\n // The awkward -1 offsets are needed because findFirst (called\n // on these below) will treat its first bound as inclusive,\n // second as exclusive, but we want to actually address the\n // characters in the part's range\n begin = ltr ? part.from : part.to - 1;\n end = ltr ? part.to : part.from - 1;\n }\n\n // A binary search to find the first character whose bounding box\n // starts after the coordinates. If we run across any whose box wrap\n // the coordinates, store that.\n var chAround = null, boxAround = null;\n var ch = findFirst(function (ch) {\n var box = measureCharPrepared(cm, preparedMeasure, ch);\n box.top += widgetHeight; box.bottom += widgetHeight;\n if (!boxIsAfter(box, x, y, false)) { return false }\n if (box.top <= y && box.left <= x) {\n chAround = ch;\n boxAround = box;\n }\n return true\n }, begin, end);\n\n var baseX, sticky, outside = false;\n // If a box around the coordinates was found, use that\n if (boxAround) {\n // Distinguish coordinates nearer to the left or right side of the box\n var atLeft = x - boxAround.left < boxAround.right - x, atStart = atLeft == ltr;\n ch = chAround + (atStart ? 0 : 1);\n sticky = atStart ? \"after\" : \"before\";\n baseX = atLeft ? boxAround.left : boxAround.right;\n } else {\n // (Adjust for extended bound, if necessary.)\n if (!ltr && (ch == end || ch == begin)) { ch++; }\n // To determine which side to associate with, get the box to the\n // left of the character and compare it's vertical position to the\n // coordinates\n sticky = ch == 0 ? \"after\" : ch == lineObj.text.length ? \"before\" :\n (measureCharPrepared(cm, preparedMeasure, ch - (ltr ? 1 : 0)).bottom + widgetHeight <= y) == ltr ?\n \"after\" : \"before\";\n // Now get accurate coordinates for this place, in order to get a\n // base X position\n var coords = cursorCoords(cm, Pos(lineNo, ch, sticky), \"line\", lineObj, preparedMeasure);\n baseX = coords.left;\n outside = y < coords.top ? -1 : y >= coords.bottom ? 1 : 0;\n }\n\n ch = skipExtendingChars(lineObj.text, ch, 1);\n return PosWithInfo(lineNo, ch, sticky, outside, x - baseX)\n }\n\n function coordsBidiPart(cm, lineObj, lineNo, preparedMeasure, order, x, y) {\n // Bidi parts are sorted left-to-right, and in a non-line-wrapping\n // situation, we can take this ordering to correspond to the visual\n // ordering. This finds the first part whose end is after the given\n // coordinates.\n var index = findFirst(function (i) {\n var part = order[i], ltr = part.level != 1;\n return boxIsAfter(cursorCoords(cm, Pos(lineNo, ltr ? part.to : part.from, ltr ? \"before\" : \"after\"),\n \"line\", lineObj, preparedMeasure), x, y, true)\n }, 0, order.length - 1);\n var part = order[index];\n // If this isn't the first part, the part's start is also after\n // the coordinates, and the coordinates aren't on the same line as\n // that start, move one part back.\n if (index > 0) {\n var ltr = part.level != 1;\n var start = cursorCoords(cm, Pos(lineNo, ltr ? part.from : part.to, ltr ? \"after\" : \"before\"),\n \"line\", lineObj, preparedMeasure);\n if (boxIsAfter(start, x, y, true) && start.top > y)\n { part = order[index - 1]; }\n }\n return part\n }\n\n function coordsBidiPartWrapped(cm, lineObj, _lineNo, preparedMeasure, order, x, y) {\n // In a wrapped line, rtl text on wrapping boundaries can do things\n // that don't correspond to the ordering in our `order` array at\n // all, so a binary search doesn't work, and we want to return a\n // part that only spans one line so that the binary search in\n // coordsCharInner is safe. As such, we first find the extent of the\n // wrapped line, and then do a flat search in which we discard any\n // spans that aren't on the line.\n var ref = wrappedLineExtent(cm, lineObj, preparedMeasure, y);\n var begin = ref.begin;\n var end = ref.end;\n if (/\\s/.test(lineObj.text.charAt(end - 1))) { end--; }\n var part = null, closestDist = null;\n for (var i = 0; i < order.length; i++) {\n var p = order[i];\n if (p.from >= end || p.to <= begin) { continue }\n var ltr = p.level != 1;\n var endX = measureCharPrepared(cm, preparedMeasure, ltr ? Math.min(end, p.to) - 1 : Math.max(begin, p.from)).right;\n // Weigh against spans ending before this, so that they are only\n // picked if nothing ends after\n var dist = endX < x ? x - endX + 1e9 : endX - x;\n if (!part || closestDist > dist) {\n part = p;\n closestDist = dist;\n }\n }\n if (!part) { part = order[order.length - 1]; }\n // Clip the part to the wrapped line.\n if (part.from < begin) { part = {from: begin, to: part.to, level: part.level}; }\n if (part.to > end) { part = {from: part.from, to: end, level: part.level}; }\n return part\n }\n\n var measureText;\n // Compute the default text height.\n function textHeight(display) {\n if (display.cachedTextHeight != null) { return display.cachedTextHeight }\n if (measureText == null) {\n measureText = elt(\"pre\", null, \"CodeMirror-line-like\");\n // Measure a bunch of lines, for browsers that compute\n // fractional heights.\n for (var i = 0; i < 49; ++i) {\n measureText.appendChild(document.createTextNode(\"x\"));\n measureText.appendChild(elt(\"br\"));\n }\n measureText.appendChild(document.createTextNode(\"x\"));\n }\n removeChildrenAndAdd(display.measure, measureText);\n var height = measureText.offsetHeight / 50;\n if (height > 3) { display.cachedTextHeight = height; }\n removeChildren(display.measure);\n return height || 1\n }\n\n // Compute the default character width.\n function charWidth(display) {\n if (display.cachedCharWidth != null) { return display.cachedCharWidth }\n var anchor = elt(\"span\", \"xxxxxxxxxx\");\n var pre = elt(\"pre\", [anchor], \"CodeMirror-line-like\");\n removeChildrenAndAdd(display.measure, pre);\n var rect = anchor.getBoundingClientRect(), width = (rect.right - rect.left) / 10;\n if (width > 2) { display.cachedCharWidth = width; }\n return width || 10\n }\n\n // Do a bulk-read of the DOM positions and sizes needed to draw the\n // view, so that we don't interleave reading and writing to the DOM.\n function getDimensions(cm) {\n var d = cm.display, left = {}, width = {};\n var gutterLeft = d.gutters.clientLeft;\n for (var n = d.gutters.firstChild, i = 0; n; n = n.nextSibling, ++i) {\n var id = cm.display.gutterSpecs[i].className;\n left[id] = n.offsetLeft + n.clientLeft + gutterLeft;\n width[id] = n.clientWidth;\n }\n return {fixedPos: compensateForHScroll(d),\n gutterTotalWidth: d.gutters.offsetWidth,\n gutterLeft: left,\n gutterWidth: width,\n wrapperWidth: d.wrapper.clientWidth}\n }\n\n // Computes display.scroller.scrollLeft + display.gutters.offsetWidth,\n // but using getBoundingClientRect to get a sub-pixel-accurate\n // result.\n function compensateForHScroll(display) {\n return display.scroller.getBoundingClientRect().left - display.sizer.getBoundingClientRect().left\n }\n\n // Returns a function that estimates the height of a line, to use as\n // first approximation until the line becomes visible (and is thus\n // properly measurable).\n function estimateHeight(cm) {\n var th = textHeight(cm.display), wrapping = cm.options.lineWrapping;\n var perLine = wrapping && Math.max(5, cm.display.scroller.clientWidth / charWidth(cm.display) - 3);\n return function (line) {\n if (lineIsHidden(cm.doc, line)) { return 0 }\n\n var widgetsHeight = 0;\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++) {\n if (line.widgets[i].height) { widgetsHeight += line.widgets[i].height; }\n } }\n\n if (wrapping)\n { return widgetsHeight + (Math.ceil(line.text.length / perLine) || 1) * th }\n else\n { return widgetsHeight + th }\n }\n }\n\n function estimateLineHeights(cm) {\n var doc = cm.doc, est = estimateHeight(cm);\n doc.iter(function (line) {\n var estHeight = est(line);\n if (estHeight != line.height) { updateLineHeight(line, estHeight); }\n });\n }\n\n // Given a mouse event, find the corresponding position. If liberal\n // is false, it checks whether a gutter or scrollbar was clicked,\n // and returns null if it was. forRect is used by rectangular\n // selections, and tries to estimate a character position even for\n // coordinates beyond the right of the text.\n function posFromMouse(cm, e, liberal, forRect) {\n var display = cm.display;\n if (!liberal && e_target(e).getAttribute(\"cm-not-content\") == \"true\") { return null }\n\n var x, y, space = display.lineSpace.getBoundingClientRect();\n // Fails unpredictably on IE[67] when mouse is dragged around quickly.\n try { x = e.clientX - space.left; y = e.clientY - space.top; }\n catch (e$1) { return null }\n var coords = coordsChar(cm, x, y), line;\n if (forRect && coords.xRel > 0 && (line = getLine(cm.doc, coords.line).text).length == coords.ch) {\n var colDiff = countColumn(line, line.length, cm.options.tabSize) - line.length;\n coords = Pos(coords.line, Math.max(0, Math.round((x - paddingH(cm.display).left) / charWidth(cm.display)) - colDiff));\n }\n return coords\n }\n\n // Find the view element corresponding to a given line. Return null\n // when the line isn't visible.\n function findViewIndex(cm, n) {\n if (n >= cm.display.viewTo) { return null }\n n -= cm.display.viewFrom;\n if (n < 0) { return null }\n var view = cm.display.view;\n for (var i = 0; i < view.length; i++) {\n n -= view[i].size;\n if (n < 0) { return i }\n }\n }\n\n // Updates the display.view data structure for a given change to the\n // document. From and to are in pre-change coordinates. Lendiff is\n // the amount of lines added or subtracted by the change. This is\n // used for changes that span multiple lines, or change the way\n // lines are divided into visual lines. regLineChange (below)\n // registers single-line changes.\n function regChange(cm, from, to, lendiff) {\n if (from == null) { from = cm.doc.first; }\n if (to == null) { to = cm.doc.first + cm.doc.size; }\n if (!lendiff) { lendiff = 0; }\n\n var display = cm.display;\n if (lendiff && to < display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers > from))\n { display.updateLineNumbers = from; }\n\n cm.curOp.viewChanged = true;\n\n if (from >= display.viewTo) { // Change after\n if (sawCollapsedSpans && visualLineNo(cm.doc, from) < display.viewTo)\n { resetView(cm); }\n } else if (to <= display.viewFrom) { // Change before\n if (sawCollapsedSpans && visualLineEndNo(cm.doc, to + lendiff) > display.viewFrom) {\n resetView(cm);\n } else {\n display.viewFrom += lendiff;\n display.viewTo += lendiff;\n }\n } else if (from <= display.viewFrom && to >= display.viewTo) { // Full overlap\n resetView(cm);\n } else if (from <= display.viewFrom) { // Top overlap\n var cut = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cut) {\n display.view = display.view.slice(cut.index);\n display.viewFrom = cut.lineN;\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n } else if (to >= display.viewTo) { // Bottom overlap\n var cut$1 = viewCuttingPoint(cm, from, from, -1);\n if (cut$1) {\n display.view = display.view.slice(0, cut$1.index);\n display.viewTo = cut$1.lineN;\n } else {\n resetView(cm);\n }\n } else { // Gap in the middle\n var cutTop = viewCuttingPoint(cm, from, from, -1);\n var cutBot = viewCuttingPoint(cm, to, to + lendiff, 1);\n if (cutTop && cutBot) {\n display.view = display.view.slice(0, cutTop.index)\n .concat(buildViewArray(cm, cutTop.lineN, cutBot.lineN))\n .concat(display.view.slice(cutBot.index));\n display.viewTo += lendiff;\n } else {\n resetView(cm);\n }\n }\n\n var ext = display.externalMeasured;\n if (ext) {\n if (to < ext.lineN)\n { ext.lineN += lendiff; }\n else if (from < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n }\n }\n\n // Register a change to a single line. Type must be one of \"text\",\n // \"gutter\", \"class\", \"widget\"\n function regLineChange(cm, line, type) {\n cm.curOp.viewChanged = true;\n var display = cm.display, ext = cm.display.externalMeasured;\n if (ext && line >= ext.lineN && line < ext.lineN + ext.size)\n { display.externalMeasured = null; }\n\n if (line < display.viewFrom || line >= display.viewTo) { return }\n var lineView = display.view[findViewIndex(cm, line)];\n if (lineView.node == null) { return }\n var arr = lineView.changes || (lineView.changes = []);\n if (indexOf(arr, type) == -1) { arr.push(type); }\n }\n\n // Clear the view.\n function resetView(cm) {\n cm.display.viewFrom = cm.display.viewTo = cm.doc.first;\n cm.display.view = [];\n cm.display.viewOffset = 0;\n }\n\n function viewCuttingPoint(cm, oldN, newN, dir) {\n var index = findViewIndex(cm, oldN), diff, view = cm.display.view;\n if (!sawCollapsedSpans || newN == cm.doc.first + cm.doc.size)\n { return {index: index, lineN: newN} }\n var n = cm.display.viewFrom;\n for (var i = 0; i < index; i++)\n { n += view[i].size; }\n if (n != oldN) {\n if (dir > 0) {\n if (index == view.length - 1) { return null }\n diff = (n + view[index].size) - oldN;\n index++;\n } else {\n diff = n - oldN;\n }\n oldN += diff; newN += diff;\n }\n while (visualLineNo(cm.doc, newN) != newN) {\n if (index == (dir < 0 ? 0 : view.length - 1)) { return null }\n newN += dir * view[index - (dir < 0 ? 1 : 0)].size;\n index += dir;\n }\n return {index: index, lineN: newN}\n }\n\n // Force the view to cover a given range, adding empty view element\n // or clipping off existing ones as needed.\n function adjustView(cm, from, to) {\n var display = cm.display, view = display.view;\n if (view.length == 0 || from >= display.viewTo || to <= display.viewFrom) {\n display.view = buildViewArray(cm, from, to);\n display.viewFrom = from;\n } else {\n if (display.viewFrom > from)\n { display.view = buildViewArray(cm, from, display.viewFrom).concat(display.view); }\n else if (display.viewFrom < from)\n { display.view = display.view.slice(findViewIndex(cm, from)); }\n display.viewFrom = from;\n if (display.viewTo < to)\n { display.view = display.view.concat(buildViewArray(cm, display.viewTo, to)); }\n else if (display.viewTo > to)\n { display.view = display.view.slice(0, findViewIndex(cm, to)); }\n }\n display.viewTo = to;\n }\n\n // Count the number of lines in the view whose DOM representation is\n // out of date (or nonexistent).\n function countDirtyView(cm) {\n var view = cm.display.view, dirty = 0;\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (!lineView.hidden && (!lineView.node || lineView.changes)) { ++dirty; }\n }\n return dirty\n }\n\n function updateSelection(cm) {\n cm.display.input.showSelection(cm.display.input.prepareSelection());\n }\n\n function prepareSelection(cm, primary) {\n if ( primary === void 0 ) primary = true;\n\n var doc = cm.doc, result = {};\n var curFragment = result.cursors = document.createDocumentFragment();\n var selFragment = result.selection = document.createDocumentFragment();\n\n var customCursor = cm.options.$customCursor;\n if (customCursor) { primary = true; }\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n if (!primary && i == doc.sel.primIndex) { continue }\n var range = doc.sel.ranges[i];\n if (range.from().line >= cm.display.viewTo || range.to().line < cm.display.viewFrom) { continue }\n var collapsed = range.empty();\n if (customCursor) {\n var head = customCursor(cm, range);\n if (head) { drawSelectionCursor(cm, head, curFragment); }\n } else if (collapsed || cm.options.showCursorWhenSelecting) {\n drawSelectionCursor(cm, range.head, curFragment);\n }\n if (!collapsed)\n { drawSelectionRange(cm, range, selFragment); }\n }\n return result\n }\n\n // Draws a cursor for the given range\n function drawSelectionCursor(cm, head, output) {\n var pos = cursorCoords(cm, head, \"div\", null, null, !cm.options.singleCursorHeightPerLine);\n\n var cursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor\"));\n cursor.style.left = pos.left + \"px\";\n cursor.style.top = pos.top + \"px\";\n cursor.style.height = Math.max(0, pos.bottom - pos.top) * cm.options.cursorHeight + \"px\";\n\n if (/\\bcm-fat-cursor\\b/.test(cm.getWrapperElement().className)) {\n var charPos = charCoords(cm, head, \"div\", null, null);\n var width = charPos.right - charPos.left;\n cursor.style.width = (width > 0 ? width : cm.defaultCharWidth()) + \"px\";\n }\n\n if (pos.other) {\n // Secondary cursor, shown when on a 'jump' in bi-directional text\n var otherCursor = output.appendChild(elt(\"div\", \"\\u00a0\", \"CodeMirror-cursor CodeMirror-secondarycursor\"));\n otherCursor.style.display = \"\";\n otherCursor.style.left = pos.other.left + \"px\";\n otherCursor.style.top = pos.other.top + \"px\";\n otherCursor.style.height = (pos.other.bottom - pos.other.top) * .85 + \"px\";\n }\n }\n\n function cmpCoords(a, b) { return a.top - b.top || a.left - b.left }\n\n // Draws the given range as a highlighted selection\n function drawSelectionRange(cm, range, output) {\n var display = cm.display, doc = cm.doc;\n var fragment = document.createDocumentFragment();\n var padding = paddingH(cm.display), leftSide = padding.left;\n var rightSide = Math.max(display.sizerWidth, displayWidth(cm) - display.sizer.offsetLeft) - padding.right;\n var docLTR = doc.direction == \"ltr\";\n\n function add(left, top, width, bottom) {\n if (top < 0) { top = 0; }\n top = Math.round(top);\n bottom = Math.round(bottom);\n 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\")));\n }\n\n function drawForLine(line, fromArg, toArg) {\n var lineObj = getLine(doc, line);\n var lineLen = lineObj.text.length;\n var start, end;\n function coords(ch, bias) {\n return charCoords(cm, Pos(line, ch), \"div\", lineObj, bias)\n }\n\n function wrapX(pos, dir, side) {\n var extent = wrappedLineExtentChar(cm, lineObj, null, pos);\n var prop = (dir == \"ltr\") == (side == \"after\") ? \"left\" : \"right\";\n var ch = side == \"after\" ? extent.begin : extent.end - (/\\s/.test(lineObj.text.charAt(extent.end - 1)) ? 2 : 1);\n return coords(ch, prop)[prop]\n }\n\n var order = getOrder(lineObj, doc.direction);\n iterateBidiSections(order, fromArg || 0, toArg == null ? lineLen : toArg, function (from, to, dir, i) {\n var ltr = dir == \"ltr\";\n var fromPos = coords(from, ltr ? \"left\" : \"right\");\n var toPos = coords(to - 1, ltr ? \"right\" : \"left\");\n\n var openStart = fromArg == null && from == 0, openEnd = toArg == null && to == lineLen;\n var first = i == 0, last = !order || i == order.length - 1;\n if (toPos.top - fromPos.top <= 3) { // Single line\n var openLeft = (docLTR ? openStart : openEnd) && first;\n var openRight = (docLTR ? openEnd : openStart) && last;\n var left = openLeft ? leftSide : (ltr ? fromPos : toPos).left;\n var right = openRight ? rightSide : (ltr ? toPos : fromPos).right;\n add(left, fromPos.top, right - left, fromPos.bottom);\n } else { // Multiple lines\n var topLeft, topRight, botLeft, botRight;\n if (ltr) {\n topLeft = docLTR && openStart && first ? leftSide : fromPos.left;\n topRight = docLTR ? rightSide : wrapX(from, dir, \"before\");\n botLeft = docLTR ? leftSide : wrapX(to, dir, \"after\");\n botRight = docLTR && openEnd && last ? rightSide : toPos.right;\n } else {\n topLeft = !docLTR ? leftSide : wrapX(from, dir, \"before\");\n topRight = !docLTR && openStart && first ? rightSide : fromPos.right;\n botLeft = !docLTR && openEnd && last ? leftSide : toPos.left;\n botRight = !docLTR ? rightSide : wrapX(to, dir, \"after\");\n }\n add(topLeft, fromPos.top, topRight - topLeft, fromPos.bottom);\n if (fromPos.bottom < toPos.top) { add(leftSide, fromPos.bottom, null, toPos.top); }\n add(botLeft, toPos.top, botRight - botLeft, toPos.bottom);\n }\n\n if (!start || cmpCoords(fromPos, start) < 0) { start = fromPos; }\n if (cmpCoords(toPos, start) < 0) { start = toPos; }\n if (!end || cmpCoords(fromPos, end) < 0) { end = fromPos; }\n if (cmpCoords(toPos, end) < 0) { end = toPos; }\n });\n return {start: start, end: end}\n }\n\n var sFrom = range.from(), sTo = range.to();\n if (sFrom.line == sTo.line) {\n drawForLine(sFrom.line, sFrom.ch, sTo.ch);\n } else {\n var fromLine = getLine(doc, sFrom.line), toLine = getLine(doc, sTo.line);\n var singleVLine = visualLine(fromLine) == visualLine(toLine);\n var leftEnd = drawForLine(sFrom.line, sFrom.ch, singleVLine ? fromLine.text.length + 1 : null).end;\n var rightStart = drawForLine(sTo.line, singleVLine ? 0 : null, sTo.ch).start;\n if (singleVLine) {\n if (leftEnd.top < rightStart.top - 2) {\n add(leftEnd.right, leftEnd.top, null, leftEnd.bottom);\n add(leftSide, rightStart.top, rightStart.left, rightStart.bottom);\n } else {\n add(leftEnd.right, leftEnd.top, rightStart.left - leftEnd.right, leftEnd.bottom);\n }\n }\n if (leftEnd.bottom < rightStart.top)\n { add(leftSide, leftEnd.bottom, null, rightStart.top); }\n }\n\n output.appendChild(fragment);\n }\n\n // Cursor-blinking\n function restartBlink(cm) {\n if (!cm.state.focused) { return }\n var display = cm.display;\n clearInterval(display.blinker);\n var on = true;\n display.cursorDiv.style.visibility = \"\";\n if (cm.options.cursorBlinkRate > 0)\n { display.blinker = setInterval(function () {\n if (!cm.hasFocus()) { onBlur(cm); }\n display.cursorDiv.style.visibility = (on = !on) ? \"\" : \"hidden\";\n }, cm.options.cursorBlinkRate); }\n else if (cm.options.cursorBlinkRate < 0)\n { display.cursorDiv.style.visibility = \"hidden\"; }\n }\n\n function ensureFocus(cm) {\n if (!cm.hasFocus()) {\n cm.display.input.focus();\n if (!cm.state.focused) { onFocus(cm); }\n }\n }\n\n function delayBlurEvent(cm) {\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { if (cm.state.delayingBlurEvent) {\n cm.state.delayingBlurEvent = false;\n if (cm.state.focused) { onBlur(cm); }\n } }, 100);\n }\n\n function onFocus(cm, e) {\n if (cm.state.delayingBlurEvent && !cm.state.draggingText) { cm.state.delayingBlurEvent = false; }\n\n if (cm.options.readOnly == \"nocursor\") { return }\n if (!cm.state.focused) {\n signal(cm, \"focus\", cm, e);\n cm.state.focused = true;\n addClass(cm.display.wrapper, \"CodeMirror-focused\");\n // This test prevents this from firing when a context\n // menu is closed (since the input reset would kill the\n // select-all detection hack)\n if (!cm.curOp && cm.display.selForContextMenu != cm.doc.sel) {\n cm.display.input.reset();\n if (webkit) { setTimeout(function () { return cm.display.input.reset(true); }, 20); } // Issue #1730\n }\n cm.display.input.receivedFocus();\n }\n restartBlink(cm);\n }\n function onBlur(cm, e) {\n if (cm.state.delayingBlurEvent) { return }\n\n if (cm.state.focused) {\n signal(cm, \"blur\", cm, e);\n cm.state.focused = false;\n rmClass(cm.display.wrapper, \"CodeMirror-focused\");\n }\n clearInterval(cm.display.blinker);\n setTimeout(function () { if (!cm.state.focused) { cm.display.shift = false; } }, 150);\n }\n\n // Read the actual heights of the rendered lines, and update their\n // stored heights to match.\n function updateHeightsInViewport(cm) {\n var display = cm.display;\n var prevBottom = display.lineDiv.offsetTop;\n var viewTop = Math.max(0, display.scroller.getBoundingClientRect().top);\n var oldHeight = display.lineDiv.getBoundingClientRect().top;\n var mustScroll = 0;\n for (var i = 0; i < display.view.length; i++) {\n var cur = display.view[i], wrapping = cm.options.lineWrapping;\n var height = (void 0), width = 0;\n if (cur.hidden) { continue }\n oldHeight += cur.line.height;\n if (ie && ie_version < 8) {\n var bot = cur.node.offsetTop + cur.node.offsetHeight;\n height = bot - prevBottom;\n prevBottom = bot;\n } else {\n var box = cur.node.getBoundingClientRect();\n height = box.bottom - box.top;\n // Check that lines don't extend past the right of the current\n // editor width\n if (!wrapping && cur.text.firstChild)\n { width = cur.text.firstChild.getBoundingClientRect().right - box.left - 1; }\n }\n var diff = cur.line.height - height;\n if (diff > .005 || diff < -.005) {\n if (oldHeight < viewTop) { mustScroll -= diff; }\n updateLineHeight(cur.line, height);\n updateWidgetHeight(cur.line);\n if (cur.rest) { for (var j = 0; j < cur.rest.length; j++)\n { updateWidgetHeight(cur.rest[j]); } }\n }\n if (width > cm.display.sizerWidth) {\n var chWidth = Math.ceil(width / charWidth(cm.display));\n if (chWidth > cm.display.maxLineLength) {\n cm.display.maxLineLength = chWidth;\n cm.display.maxLine = cur.line;\n cm.display.maxLineChanged = true;\n }\n }\n }\n if (Math.abs(mustScroll) > 2) { display.scroller.scrollTop += mustScroll; }\n }\n\n // Read and store the height of line widgets associated with the\n // given line.\n function updateWidgetHeight(line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; ++i) {\n var w = line.widgets[i], parent = w.node.parentNode;\n if (parent) { w.height = parent.offsetHeight; }\n } }\n }\n\n // Compute the lines that are visible in a given viewport (defaults\n // the the current scroll position). viewport may contain top,\n // height, and ensure (see op.scrollToPos) properties.\n function visibleLines(display, doc, viewport) {\n var top = viewport && viewport.top != null ? Math.max(0, viewport.top) : display.scroller.scrollTop;\n top = Math.floor(top - paddingTop(display));\n var bottom = viewport && viewport.bottom != null ? viewport.bottom : top + display.wrapper.clientHeight;\n\n var from = lineAtHeight(doc, top), to = lineAtHeight(doc, bottom);\n // Ensure is a {from: {line, ch}, to: {line, ch}} object, and\n // forces those lines into the viewport (if possible).\n if (viewport && viewport.ensure) {\n var ensureFrom = viewport.ensure.from.line, ensureTo = viewport.ensure.to.line;\n if (ensureFrom < from) {\n from = ensureFrom;\n to = lineAtHeight(doc, heightAtLine(getLine(doc, ensureFrom)) + display.wrapper.clientHeight);\n } else if (Math.min(ensureTo, doc.lastLine()) >= to) {\n from = lineAtHeight(doc, heightAtLine(getLine(doc, ensureTo)) - display.wrapper.clientHeight);\n to = ensureTo;\n }\n }\n return {from: from, to: Math.max(to, from + 1)}\n }\n\n // SCROLLING THINGS INTO VIEW\n\n // If an editor sits on the top or bottom of the window, partially\n // scrolled out of view, this ensures that the cursor is visible.\n function maybeScrollWindow(cm, rect) {\n if (signalDOMEvent(cm, \"scrollCursorIntoView\")) { return }\n\n var display = cm.display, box = display.sizer.getBoundingClientRect(), doScroll = null;\n var doc = display.wrapper.ownerDocument;\n if (rect.top + box.top < 0) { doScroll = true; }\n else if (rect.bottom + box.top > (doc.defaultView.innerHeight || doc.documentElement.clientHeight)) { doScroll = false; }\n if (doScroll != null && !phantom) {\n 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;\"));\n cm.display.lineSpace.appendChild(scrollNode);\n scrollNode.scrollIntoView(doScroll);\n cm.display.lineSpace.removeChild(scrollNode);\n }\n }\n\n // Scroll a given position into view (immediately), verifying that\n // it actually became visible (as line heights are accurately\n // measured, the position of something may 'drift' during drawing).\n function scrollPosIntoView(cm, pos, end, margin) {\n if (margin == null) { margin = 0; }\n var rect;\n if (!cm.options.lineWrapping && pos == end) {\n // Set pos and end to the cursor positions around the character pos sticks to\n // If pos.sticky == \"before\", that is around pos.ch - 1, otherwise around pos.ch\n // If pos == Pos(_, 0, \"before\"), pos and end are unchanged\n end = pos.sticky == \"before\" ? Pos(pos.line, pos.ch + 1, \"before\") : pos;\n pos = pos.ch ? Pos(pos.line, pos.sticky == \"before\" ? pos.ch - 1 : pos.ch, \"after\") : pos;\n }\n for (var limit = 0; limit < 5; limit++) {\n var changed = false;\n var coords = cursorCoords(cm, pos);\n var endCoords = !end || end == pos ? coords : cursorCoords(cm, end);\n rect = {left: Math.min(coords.left, endCoords.left),\n top: Math.min(coords.top, endCoords.top) - margin,\n right: Math.max(coords.left, endCoords.left),\n bottom: Math.max(coords.bottom, endCoords.bottom) + margin};\n var scrollPos = calculateScrollPos(cm, rect);\n var startTop = cm.doc.scrollTop, startLeft = cm.doc.scrollLeft;\n if (scrollPos.scrollTop != null) {\n updateScrollTop(cm, scrollPos.scrollTop);\n if (Math.abs(cm.doc.scrollTop - startTop) > 1) { changed = true; }\n }\n if (scrollPos.scrollLeft != null) {\n setScrollLeft(cm, scrollPos.scrollLeft);\n if (Math.abs(cm.doc.scrollLeft - startLeft) > 1) { changed = true; }\n }\n if (!changed) { break }\n }\n return rect\n }\n\n // Scroll a given set of coordinates into view (immediately).\n function scrollIntoView(cm, rect) {\n var scrollPos = calculateScrollPos(cm, rect);\n if (scrollPos.scrollTop != null) { updateScrollTop(cm, scrollPos.scrollTop); }\n if (scrollPos.scrollLeft != null) { setScrollLeft(cm, scrollPos.scrollLeft); }\n }\n\n // Calculate a new scroll position needed to scroll the given\n // rectangle into view. Returns an object with scrollTop and\n // scrollLeft properties. When these are undefined, the\n // vertical/horizontal position does not need to be adjusted.\n function calculateScrollPos(cm, rect) {\n var display = cm.display, snapMargin = textHeight(cm.display);\n if (rect.top < 0) { rect.top = 0; }\n var screentop = cm.curOp && cm.curOp.scrollTop != null ? cm.curOp.scrollTop : display.scroller.scrollTop;\n var screen = displayHeight(cm), result = {};\n if (rect.bottom - rect.top > screen) { rect.bottom = rect.top + screen; }\n var docBottom = cm.doc.height + paddingVert(display);\n var atTop = rect.top < snapMargin, atBottom = rect.bottom > docBottom - snapMargin;\n if (rect.top < screentop) {\n result.scrollTop = atTop ? 0 : rect.top;\n } else if (rect.bottom > screentop + screen) {\n var newTop = Math.min(rect.top, (atBottom ? docBottom : rect.bottom) - screen);\n if (newTop != screentop) { result.scrollTop = newTop; }\n }\n\n var gutterSpace = cm.options.fixedGutter ? 0 : display.gutters.offsetWidth;\n var screenleft = cm.curOp && cm.curOp.scrollLeft != null ? cm.curOp.scrollLeft : display.scroller.scrollLeft - gutterSpace;\n var screenw = displayWidth(cm) - display.gutters.offsetWidth;\n var tooWide = rect.right - rect.left > screenw;\n if (tooWide) { rect.right = rect.left + screenw; }\n if (rect.left < 10)\n { result.scrollLeft = 0; }\n else if (rect.left < screenleft)\n { result.scrollLeft = Math.max(0, rect.left + gutterSpace - (tooWide ? 0 : 10)); }\n else if (rect.right > screenw + screenleft - 3)\n { result.scrollLeft = rect.right + (tooWide ? 0 : 10) - screenw; }\n return result\n }\n\n // Store a relative adjustment to the scroll position in the current\n // operation (to be applied when the operation finishes).\n function addToScrollTop(cm, top) {\n if (top == null) { return }\n resolveScrollToPos(cm);\n cm.curOp.scrollTop = (cm.curOp.scrollTop == null ? cm.doc.scrollTop : cm.curOp.scrollTop) + top;\n }\n\n // Make sure that at the end of the operation the current cursor is\n // shown.\n function ensureCursorVisible(cm) {\n resolveScrollToPos(cm);\n var cur = cm.getCursor();\n cm.curOp.scrollToPos = {from: cur, to: cur, margin: cm.options.cursorScrollMargin};\n }\n\n function scrollToCoords(cm, x, y) {\n if (x != null || y != null) { resolveScrollToPos(cm); }\n if (x != null) { cm.curOp.scrollLeft = x; }\n if (y != null) { cm.curOp.scrollTop = y; }\n }\n\n function scrollToRange(cm, range) {\n resolveScrollToPos(cm);\n cm.curOp.scrollToPos = range;\n }\n\n // When an operation has its scrollToPos property set, and another\n // scroll action is applied before the end of the operation, this\n // 'simulates' scrolling that position into view in a cheap way, so\n // that the effect of intermediate scroll commands is not ignored.\n function resolveScrollToPos(cm) {\n var range = cm.curOp.scrollToPos;\n if (range) {\n cm.curOp.scrollToPos = null;\n var from = estimateCoords(cm, range.from), to = estimateCoords(cm, range.to);\n scrollToCoordsRange(cm, from, to, range.margin);\n }\n }\n\n function scrollToCoordsRange(cm, from, to, margin) {\n var sPos = calculateScrollPos(cm, {\n left: Math.min(from.left, to.left),\n top: Math.min(from.top, to.top) - margin,\n right: Math.max(from.right, to.right),\n bottom: Math.max(from.bottom, to.bottom) + margin\n });\n scrollToCoords(cm, sPos.scrollLeft, sPos.scrollTop);\n }\n\n // Sync the scrollable area and scrollbars, ensure the viewport\n // covers the visible area.\n function updateScrollTop(cm, val) {\n if (Math.abs(cm.doc.scrollTop - val) < 2) { return }\n if (!gecko) { updateDisplaySimple(cm, {top: val}); }\n setScrollTop(cm, val, true);\n if (gecko) { updateDisplaySimple(cm); }\n startWorker(cm, 100);\n }\n\n function setScrollTop(cm, val, forceScroll) {\n val = Math.max(0, Math.min(cm.display.scroller.scrollHeight - cm.display.scroller.clientHeight, val));\n if (cm.display.scroller.scrollTop == val && !forceScroll) { return }\n cm.doc.scrollTop = val;\n cm.display.scrollbars.setScrollTop(val);\n if (cm.display.scroller.scrollTop != val) { cm.display.scroller.scrollTop = val; }\n }\n\n // Sync scroller and scrollbar, ensure the gutter elements are\n // aligned.\n function setScrollLeft(cm, val, isScroller, forceScroll) {\n val = Math.max(0, Math.min(val, cm.display.scroller.scrollWidth - cm.display.scroller.clientWidth));\n if ((isScroller ? val == cm.doc.scrollLeft : Math.abs(cm.doc.scrollLeft - val) < 2) && !forceScroll) { return }\n cm.doc.scrollLeft = val;\n alignHorizontally(cm);\n if (cm.display.scroller.scrollLeft != val) { cm.display.scroller.scrollLeft = val; }\n cm.display.scrollbars.setScrollLeft(val);\n }\n\n // SCROLLBARS\n\n // Prepare DOM reads needed to update the scrollbars. Done in one\n // shot to minimize update/measure roundtrips.\n function measureForScrollbars(cm) {\n var d = cm.display, gutterW = d.gutters.offsetWidth;\n var docH = Math.round(cm.doc.height + paddingVert(cm.display));\n return {\n clientHeight: d.scroller.clientHeight,\n viewHeight: d.wrapper.clientHeight,\n scrollWidth: d.scroller.scrollWidth, clientWidth: d.scroller.clientWidth,\n viewWidth: d.wrapper.clientWidth,\n barLeft: cm.options.fixedGutter ? gutterW : 0,\n docHeight: docH,\n scrollHeight: docH + scrollGap(cm) + d.barHeight,\n nativeBarWidth: d.nativeBarWidth,\n gutterWidth: gutterW\n }\n }\n\n var NativeScrollbars = function(place, scroll, cm) {\n this.cm = cm;\n var vert = this.vert = elt(\"div\", [elt(\"div\", null, null, \"min-width: 1px\")], \"CodeMirror-vscrollbar\");\n var horiz = this.horiz = elt(\"div\", [elt(\"div\", null, null, \"height: 100%; min-height: 1px\")], \"CodeMirror-hscrollbar\");\n vert.tabIndex = horiz.tabIndex = -1;\n place(vert); place(horiz);\n\n on(vert, \"scroll\", function () {\n if (vert.clientHeight) { scroll(vert.scrollTop, \"vertical\"); }\n });\n on(horiz, \"scroll\", function () {\n if (horiz.clientWidth) { scroll(horiz.scrollLeft, \"horizontal\"); }\n });\n\n this.checkedZeroWidth = false;\n // Need to set a minimum width to see the scrollbar on IE7 (but must not set it on IE8).\n if (ie && ie_version < 8) { this.horiz.style.minHeight = this.vert.style.minWidth = \"18px\"; }\n };\n\n NativeScrollbars.prototype.update = function (measure) {\n var needsH = measure.scrollWidth > measure.clientWidth + 1;\n var needsV = measure.scrollHeight > measure.clientHeight + 1;\n var sWidth = measure.nativeBarWidth;\n\n if (needsV) {\n this.vert.style.display = \"block\";\n this.vert.style.bottom = needsH ? sWidth + \"px\" : \"0\";\n var totalHeight = measure.viewHeight - (needsH ? sWidth : 0);\n // A bug in IE8 can cause this value to be negative, so guard it.\n this.vert.firstChild.style.height =\n Math.max(0, measure.scrollHeight - measure.clientHeight + totalHeight) + \"px\";\n } else {\n this.vert.scrollTop = 0;\n this.vert.style.display = \"\";\n this.vert.firstChild.style.height = \"0\";\n }\n\n if (needsH) {\n this.horiz.style.display = \"block\";\n this.horiz.style.right = needsV ? sWidth + \"px\" : \"0\";\n this.horiz.style.left = measure.barLeft + \"px\";\n var totalWidth = measure.viewWidth - measure.barLeft - (needsV ? sWidth : 0);\n this.horiz.firstChild.style.width =\n Math.max(0, measure.scrollWidth - measure.clientWidth + totalWidth) + \"px\";\n } else {\n this.horiz.style.display = \"\";\n this.horiz.firstChild.style.width = \"0\";\n }\n\n if (!this.checkedZeroWidth && measure.clientHeight > 0) {\n if (sWidth == 0) { this.zeroWidthHack(); }\n this.checkedZeroWidth = true;\n }\n\n return {right: needsV ? sWidth : 0, bottom: needsH ? sWidth : 0}\n };\n\n NativeScrollbars.prototype.setScrollLeft = function (pos) {\n if (this.horiz.scrollLeft != pos) { this.horiz.scrollLeft = pos; }\n if (this.disableHoriz) { this.enableZeroWidthBar(this.horiz, this.disableHoriz, \"horiz\"); }\n };\n\n NativeScrollbars.prototype.setScrollTop = function (pos) {\n if (this.vert.scrollTop != pos) { this.vert.scrollTop = pos; }\n if (this.disableVert) { this.enableZeroWidthBar(this.vert, this.disableVert, \"vert\"); }\n };\n\n NativeScrollbars.prototype.zeroWidthHack = function () {\n var w = mac && !mac_geMountainLion ? \"12px\" : \"18px\";\n this.horiz.style.height = this.vert.style.width = w;\n this.horiz.style.visibility = this.vert.style.visibility = \"hidden\";\n this.disableHoriz = new Delayed;\n this.disableVert = new Delayed;\n };\n\n NativeScrollbars.prototype.enableZeroWidthBar = function (bar, delay, type) {\n bar.style.visibility = \"\";\n function maybeDisable() {\n // To find out whether the scrollbar is still visible, we\n // check whether the element under the pixel in the bottom\n // right corner of the scrollbar box is the scrollbar box\n // itself (when the bar is still visible) or its filler child\n // (when the bar is hidden). If it is still visible, we keep\n // it enabled, if it's hidden, we disable pointer events.\n var box = bar.getBoundingClientRect();\n var elt = type == \"vert\" ? document.elementFromPoint(box.right - 1, (box.top + box.bottom) / 2)\n : document.elementFromPoint((box.right + box.left) / 2, box.bottom - 1);\n if (elt != bar) { bar.style.visibility = \"hidden\"; }\n else { delay.set(1000, maybeDisable); }\n }\n delay.set(1000, maybeDisable);\n };\n\n NativeScrollbars.prototype.clear = function () {\n var parent = this.horiz.parentNode;\n parent.removeChild(this.horiz);\n parent.removeChild(this.vert);\n };\n\n var NullScrollbars = function () {};\n\n NullScrollbars.prototype.update = function () { return {bottom: 0, right: 0} };\n NullScrollbars.prototype.setScrollLeft = function () {};\n NullScrollbars.prototype.setScrollTop = function () {};\n NullScrollbars.prototype.clear = function () {};\n\n function updateScrollbars(cm, measure) {\n if (!measure) { measure = measureForScrollbars(cm); }\n var startWidth = cm.display.barWidth, startHeight = cm.display.barHeight;\n updateScrollbarsInner(cm, measure);\n for (var i = 0; i < 4 && startWidth != cm.display.barWidth || startHeight != cm.display.barHeight; i++) {\n if (startWidth != cm.display.barWidth && cm.options.lineWrapping)\n { updateHeightsInViewport(cm); }\n updateScrollbarsInner(cm, measureForScrollbars(cm));\n startWidth = cm.display.barWidth; startHeight = cm.display.barHeight;\n }\n }\n\n // Re-synchronize the fake scrollbars with the actual size of the\n // content.\n function updateScrollbarsInner(cm, measure) {\n var d = cm.display;\n var sizes = d.scrollbars.update(measure);\n\n d.sizer.style.paddingRight = (d.barWidth = sizes.right) + \"px\";\n d.sizer.style.paddingBottom = (d.barHeight = sizes.bottom) + \"px\";\n d.heightForcer.style.borderBottom = sizes.bottom + \"px solid transparent\";\n\n if (sizes.right && sizes.bottom) {\n d.scrollbarFiller.style.display = \"block\";\n d.scrollbarFiller.style.height = sizes.bottom + \"px\";\n d.scrollbarFiller.style.width = sizes.right + \"px\";\n } else { d.scrollbarFiller.style.display = \"\"; }\n if (sizes.bottom && cm.options.coverGutterNextToScrollbar && cm.options.fixedGutter) {\n d.gutterFiller.style.display = \"block\";\n d.gutterFiller.style.height = sizes.bottom + \"px\";\n d.gutterFiller.style.width = measure.gutterWidth + \"px\";\n } else { d.gutterFiller.style.display = \"\"; }\n }\n\n var scrollbarModel = {\"native\": NativeScrollbars, \"null\": NullScrollbars};\n\n function initScrollbars(cm) {\n if (cm.display.scrollbars) {\n cm.display.scrollbars.clear();\n if (cm.display.scrollbars.addClass)\n { rmClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n cm.display.scrollbars = new scrollbarModel[cm.options.scrollbarStyle](function (node) {\n cm.display.wrapper.insertBefore(node, cm.display.scrollbarFiller);\n // Prevent clicks in the scrollbars from killing focus\n on(node, \"mousedown\", function () {\n if (cm.state.focused) { setTimeout(function () { return cm.display.input.focus(); }, 0); }\n });\n node.setAttribute(\"cm-not-content\", \"true\");\n }, function (pos, axis) {\n if (axis == \"horizontal\") { setScrollLeft(cm, pos); }\n else { updateScrollTop(cm, pos); }\n }, cm);\n if (cm.display.scrollbars.addClass)\n { addClass(cm.display.wrapper, cm.display.scrollbars.addClass); }\n }\n\n // Operations are used to wrap a series of changes to the editor\n // state in such a way that each change won't have to update the\n // cursor and display (which would be awkward, slow, and\n // error-prone). Instead, display updates are batched and then all\n // combined and executed at once.\n\n var nextOpId = 0;\n // Start a new operation.\n function startOperation(cm) {\n cm.curOp = {\n cm: cm,\n viewChanged: false, // Flag that indicates that lines might need to be redrawn\n startHeight: cm.doc.height, // Used to detect need to update scrollbar\n forceUpdate: false, // Used to force a redraw\n updateInput: 0, // Whether to reset the input textarea\n typing: false, // Whether this reset should be careful to leave existing text (for compositing)\n changeObjs: null, // Accumulated changes, for firing change events\n cursorActivityHandlers: null, // Set of handlers to fire cursorActivity on\n cursorActivityCalled: 0, // Tracks which cursorActivity handlers have been called already\n selectionChanged: false, // Whether the selection needs to be redrawn\n updateMaxLine: false, // Set when the widest line needs to be determined anew\n scrollLeft: null, scrollTop: null, // Intermediate scroll position, not pushed to DOM yet\n scrollToPos: null, // Used to scroll to a specific position\n focus: false,\n id: ++nextOpId, // Unique ID\n markArrays: null // Used by addMarkedSpan\n };\n pushOperation(cm.curOp);\n }\n\n // Finish an operation, updating the display and signalling delayed events\n function endOperation(cm) {\n var op = cm.curOp;\n if (op) { finishOperation(op, function (group) {\n for (var i = 0; i < group.ops.length; i++)\n { group.ops[i].cm.curOp = null; }\n endOperations(group);\n }); }\n }\n\n // The DOM updates done when an operation finishes are batched so\n // that the minimum number of relayouts are required.\n function endOperations(group) {\n var ops = group.ops;\n for (var i = 0; i < ops.length; i++) // Read DOM\n { endOperation_R1(ops[i]); }\n for (var i$1 = 0; i$1 < ops.length; i$1++) // Write DOM (maybe)\n { endOperation_W1(ops[i$1]); }\n for (var i$2 = 0; i$2 < ops.length; i$2++) // Read DOM\n { endOperation_R2(ops[i$2]); }\n for (var i$3 = 0; i$3 < ops.length; i$3++) // Write DOM (maybe)\n { endOperation_W2(ops[i$3]); }\n for (var i$4 = 0; i$4 < ops.length; i$4++) // Read DOM\n { endOperation_finish(ops[i$4]); }\n }\n\n function endOperation_R1(op) {\n var cm = op.cm, display = cm.display;\n maybeClipScrollbars(cm);\n if (op.updateMaxLine) { findMaxLine(cm); }\n\n op.mustUpdate = op.viewChanged || op.forceUpdate || op.scrollTop != null ||\n op.scrollToPos && (op.scrollToPos.from.line < display.viewFrom ||\n op.scrollToPos.to.line >= display.viewTo) ||\n display.maxLineChanged && cm.options.lineWrapping;\n op.update = op.mustUpdate &&\n new DisplayUpdate(cm, op.mustUpdate && {top: op.scrollTop, ensure: op.scrollToPos}, op.forceUpdate);\n }\n\n function endOperation_W1(op) {\n op.updatedDisplay = op.mustUpdate && updateDisplayIfNeeded(op.cm, op.update);\n }\n\n function endOperation_R2(op) {\n var cm = op.cm, display = cm.display;\n if (op.updatedDisplay) { updateHeightsInViewport(cm); }\n\n op.barMeasure = measureForScrollbars(cm);\n\n // If the max line changed since it was last measured, measure it,\n // and ensure the document's width matches it.\n // updateDisplay_W2 will use these properties to do the actual resizing\n if (display.maxLineChanged && !cm.options.lineWrapping) {\n op.adjustWidthTo = measureChar(cm, display.maxLine, display.maxLine.text.length).left + 3;\n cm.display.sizerWidth = op.adjustWidthTo;\n op.barMeasure.scrollWidth =\n Math.max(display.scroller.clientWidth, display.sizer.offsetLeft + op.adjustWidthTo + scrollGap(cm) + cm.display.barWidth);\n op.maxScrollLeft = Math.max(0, display.sizer.offsetLeft + op.adjustWidthTo - displayWidth(cm));\n }\n\n if (op.updatedDisplay || op.selectionChanged)\n { op.preparedSelection = display.input.prepareSelection(); }\n }\n\n function endOperation_W2(op) {\n var cm = op.cm;\n\n if (op.adjustWidthTo != null) {\n cm.display.sizer.style.minWidth = op.adjustWidthTo + \"px\";\n if (op.maxScrollLeft < cm.doc.scrollLeft)\n { setScrollLeft(cm, Math.min(cm.display.scroller.scrollLeft, op.maxScrollLeft), true); }\n cm.display.maxLineChanged = false;\n }\n\n var takeFocus = op.focus && op.focus == activeElt(root(cm));\n if (op.preparedSelection)\n { cm.display.input.showSelection(op.preparedSelection, takeFocus); }\n if (op.updatedDisplay || op.startHeight != cm.doc.height)\n { updateScrollbars(cm, op.barMeasure); }\n if (op.updatedDisplay)\n { setDocumentHeight(cm, op.barMeasure); }\n\n if (op.selectionChanged) { restartBlink(cm); }\n\n if (cm.state.focused && op.updateInput)\n { cm.display.input.reset(op.typing); }\n if (takeFocus) { ensureFocus(op.cm); }\n }\n\n function endOperation_finish(op) {\n var cm = op.cm, display = cm.display, doc = cm.doc;\n\n if (op.updatedDisplay) { postUpdateDisplay(cm, op.update); }\n\n // Abort mouse wheel delta measurement, when scrolling explicitly\n if (display.wheelStartX != null && (op.scrollTop != null || op.scrollLeft != null || op.scrollToPos))\n { display.wheelStartX = display.wheelStartY = null; }\n\n // Propagate the scroll position to the actual DOM scroller\n if (op.scrollTop != null) { setScrollTop(cm, op.scrollTop, op.forceScroll); }\n\n if (op.scrollLeft != null) { setScrollLeft(cm, op.scrollLeft, true, true); }\n // If we need to scroll a specific position into view, do so.\n if (op.scrollToPos) {\n var rect = scrollPosIntoView(cm, clipPos(doc, op.scrollToPos.from),\n clipPos(doc, op.scrollToPos.to), op.scrollToPos.margin);\n maybeScrollWindow(cm, rect);\n }\n\n // Fire events for markers that are hidden/unidden by editing or\n // undoing\n var hidden = op.maybeHiddenMarkers, unhidden = op.maybeUnhiddenMarkers;\n if (hidden) { for (var i = 0; i < hidden.length; ++i)\n { if (!hidden[i].lines.length) { signal(hidden[i], \"hide\"); } } }\n if (unhidden) { for (var i$1 = 0; i$1 < unhidden.length; ++i$1)\n { if (unhidden[i$1].lines.length) { signal(unhidden[i$1], \"unhide\"); } } }\n\n if (display.wrapper.offsetHeight)\n { doc.scrollTop = cm.display.scroller.scrollTop; }\n\n // Fire change events, and delayed event handlers\n if (op.changeObjs)\n { signal(cm, \"changes\", cm, op.changeObjs); }\n if (op.update)\n { op.update.finish(); }\n }\n\n // Run the given function in an operation\n function runInOp(cm, f) {\n if (cm.curOp) { return f() }\n startOperation(cm);\n try { return f() }\n finally { endOperation(cm); }\n }\n // Wraps a function in an operation. Returns the wrapped function.\n function operation(cm, f) {\n return function() {\n if (cm.curOp) { return f.apply(cm, arguments) }\n startOperation(cm);\n try { return f.apply(cm, arguments) }\n finally { endOperation(cm); }\n }\n }\n // Used to add methods to editor and doc instances, wrapping them in\n // operations.\n function methodOp(f) {\n return function() {\n if (this.curOp) { return f.apply(this, arguments) }\n startOperation(this);\n try { return f.apply(this, arguments) }\n finally { endOperation(this); }\n }\n }\n function docMethodOp(f) {\n return function() {\n var cm = this.cm;\n if (!cm || cm.curOp) { return f.apply(this, arguments) }\n startOperation(cm);\n try { return f.apply(this, arguments) }\n finally { endOperation(cm); }\n }\n }\n\n // HIGHLIGHT WORKER\n\n function startWorker(cm, time) {\n if (cm.doc.highlightFrontier < cm.display.viewTo)\n { cm.state.highlight.set(time, bind(highlightWorker, cm)); }\n }\n\n function highlightWorker(cm) {\n var doc = cm.doc;\n if (doc.highlightFrontier >= cm.display.viewTo) { return }\n var end = +new Date + cm.options.workTime;\n var context = getContextBefore(cm, doc.highlightFrontier);\n var changedLines = [];\n\n doc.iter(context.line, Math.min(doc.first + doc.size, cm.display.viewTo + 500), function (line) {\n if (context.line >= cm.display.viewFrom) { // Visible\n var oldStyles = line.styles;\n var resetState = line.text.length > cm.options.maxHighlightLength ? copyState(doc.mode, context.state) : null;\n var highlighted = highlightLine(cm, line, context, true);\n if (resetState) { context.state = resetState; }\n line.styles = highlighted.styles;\n var oldCls = line.styleClasses, newCls = highlighted.classes;\n if (newCls) { line.styleClasses = newCls; }\n else if (oldCls) { line.styleClasses = null; }\n var ischange = !oldStyles || oldStyles.length != line.styles.length ||\n oldCls != newCls && (!oldCls || !newCls || oldCls.bgClass != newCls.bgClass || oldCls.textClass != newCls.textClass);\n for (var i = 0; !ischange && i < oldStyles.length; ++i) { ischange = oldStyles[i] != line.styles[i]; }\n if (ischange) { changedLines.push(context.line); }\n line.stateAfter = context.save();\n context.nextLine();\n } else {\n if (line.text.length <= cm.options.maxHighlightLength)\n { processLine(cm, line.text, context); }\n line.stateAfter = context.line % 5 == 0 ? context.save() : null;\n context.nextLine();\n }\n if (+new Date > end) {\n startWorker(cm, cm.options.workDelay);\n return true\n }\n });\n doc.highlightFrontier = context.line;\n doc.modeFrontier = Math.max(doc.modeFrontier, context.line);\n if (changedLines.length) { runInOp(cm, function () {\n for (var i = 0; i < changedLines.length; i++)\n { regLineChange(cm, changedLines[i], \"text\"); }\n }); }\n }\n\n // DISPLAY DRAWING\n\n var DisplayUpdate = function(cm, viewport, force) {\n var display = cm.display;\n\n this.viewport = viewport;\n // Store some values that we'll need later (but don't want to force a relayout for)\n this.visible = visibleLines(display, cm.doc, viewport);\n this.editorIsHidden = !display.wrapper.offsetWidth;\n this.wrapperHeight = display.wrapper.clientHeight;\n this.wrapperWidth = display.wrapper.clientWidth;\n this.oldDisplayWidth = displayWidth(cm);\n this.force = force;\n this.dims = getDimensions(cm);\n this.events = [];\n };\n\n DisplayUpdate.prototype.signal = function (emitter, type) {\n if (hasHandler(emitter, type))\n { this.events.push(arguments); }\n };\n DisplayUpdate.prototype.finish = function () {\n for (var i = 0; i < this.events.length; i++)\n { signal.apply(null, this.events[i]); }\n };\n\n function maybeClipScrollbars(cm) {\n var display = cm.display;\n if (!display.scrollbarsClipped && display.scroller.offsetWidth) {\n display.nativeBarWidth = display.scroller.offsetWidth - display.scroller.clientWidth;\n display.heightForcer.style.height = scrollGap(cm) + \"px\";\n display.sizer.style.marginBottom = -display.nativeBarWidth + \"px\";\n display.sizer.style.borderRightWidth = scrollGap(cm) + \"px\";\n display.scrollbarsClipped = true;\n }\n }\n\n function selectionSnapshot(cm) {\n if (cm.hasFocus()) { return null }\n var active = activeElt(root(cm));\n if (!active || !contains(cm.display.lineDiv, active)) { return null }\n var result = {activeElt: active};\n if (window.getSelection) {\n var sel = win(cm).getSelection();\n if (sel.anchorNode && sel.extend && contains(cm.display.lineDiv, sel.anchorNode)) {\n result.anchorNode = sel.anchorNode;\n result.anchorOffset = sel.anchorOffset;\n result.focusNode = sel.focusNode;\n result.focusOffset = sel.focusOffset;\n }\n }\n return result\n }\n\n function restoreSelection(snapshot) {\n if (!snapshot || !snapshot.activeElt || snapshot.activeElt == activeElt(rootNode(snapshot.activeElt))) { return }\n snapshot.activeElt.focus();\n if (!/^(INPUT|TEXTAREA)$/.test(snapshot.activeElt.nodeName) &&\n snapshot.anchorNode && contains(document.body, snapshot.anchorNode) && contains(document.body, snapshot.focusNode)) {\n var doc = snapshot.activeElt.ownerDocument;\n var sel = doc.defaultView.getSelection(), range = doc.createRange();\n range.setEnd(snapshot.anchorNode, snapshot.anchorOffset);\n range.collapse(false);\n sel.removeAllRanges();\n sel.addRange(range);\n sel.extend(snapshot.focusNode, snapshot.focusOffset);\n }\n }\n\n // Does the actual updating of the line display. Bails out\n // (returning false) when there is nothing to be done and forced is\n // false.\n function updateDisplayIfNeeded(cm, update) {\n var display = cm.display, doc = cm.doc;\n\n if (update.editorIsHidden) {\n resetView(cm);\n return false\n }\n\n // Bail out if the visible area is already rendered and nothing changed.\n if (!update.force &&\n update.visible.from >= display.viewFrom && update.visible.to <= display.viewTo &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo) &&\n display.renderedView == display.view && countDirtyView(cm) == 0)\n { return false }\n\n if (maybeUpdateLineNumberWidth(cm)) {\n resetView(cm);\n update.dims = getDimensions(cm);\n }\n\n // Compute a suitable new viewport (from & to)\n var end = doc.first + doc.size;\n var from = Math.max(update.visible.from - cm.options.viewportMargin, doc.first);\n var to = Math.min(end, update.visible.to + cm.options.viewportMargin);\n if (display.viewFrom < from && from - display.viewFrom < 20) { from = Math.max(doc.first, display.viewFrom); }\n if (display.viewTo > to && display.viewTo - to < 20) { to = Math.min(end, display.viewTo); }\n if (sawCollapsedSpans) {\n from = visualLineNo(cm.doc, from);\n to = visualLineEndNo(cm.doc, to);\n }\n\n var different = from != display.viewFrom || to != display.viewTo ||\n display.lastWrapHeight != update.wrapperHeight || display.lastWrapWidth != update.wrapperWidth;\n adjustView(cm, from, to);\n\n display.viewOffset = heightAtLine(getLine(cm.doc, display.viewFrom));\n // Position the mover div to align with the current scroll position\n cm.display.mover.style.top = display.viewOffset + \"px\";\n\n var toUpdate = countDirtyView(cm);\n if (!different && toUpdate == 0 && !update.force && display.renderedView == display.view &&\n (display.updateLineNumbers == null || display.updateLineNumbers >= display.viewTo))\n { return false }\n\n // For big changes, we hide the enclosing element during the\n // update, since that speeds up the operations on most browsers.\n var selSnapshot = selectionSnapshot(cm);\n if (toUpdate > 4) { display.lineDiv.style.display = \"none\"; }\n patchDisplay(cm, display.updateLineNumbers, update.dims);\n if (toUpdate > 4) { display.lineDiv.style.display = \"\"; }\n display.renderedView = display.view;\n // There might have been a widget with a focused element that got\n // hidden or updated, if so re-focus it.\n restoreSelection(selSnapshot);\n\n // Prevent selection and cursors from interfering with the scroll\n // width and height.\n removeChildren(display.cursorDiv);\n removeChildren(display.selectionDiv);\n display.gutters.style.height = display.sizer.style.minHeight = 0;\n\n if (different) {\n display.lastWrapHeight = update.wrapperHeight;\n display.lastWrapWidth = update.wrapperWidth;\n startWorker(cm, 400);\n }\n\n display.updateLineNumbers = null;\n\n return true\n }\n\n function postUpdateDisplay(cm, update) {\n var viewport = update.viewport;\n\n for (var first = true;; first = false) {\n if (!first || !cm.options.lineWrapping || update.oldDisplayWidth == displayWidth(cm)) {\n // Clip forced viewport to actual scrollable area.\n if (viewport && viewport.top != null)\n { viewport = {top: Math.min(cm.doc.height + paddingVert(cm.display) - displayHeight(cm), viewport.top)}; }\n // Updated line heights might result in the drawn area not\n // actually covering the viewport. Keep looping until it does.\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n if (update.visible.from >= cm.display.viewFrom && update.visible.to <= cm.display.viewTo)\n { break }\n } else if (first) {\n update.visible = visibleLines(cm.display, cm.doc, viewport);\n }\n if (!updateDisplayIfNeeded(cm, update)) { break }\n updateHeightsInViewport(cm);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.force = false;\n }\n\n update.signal(cm, \"update\", cm);\n if (cm.display.viewFrom != cm.display.reportedViewFrom || cm.display.viewTo != cm.display.reportedViewTo) {\n update.signal(cm, \"viewportChange\", cm, cm.display.viewFrom, cm.display.viewTo);\n cm.display.reportedViewFrom = cm.display.viewFrom; cm.display.reportedViewTo = cm.display.viewTo;\n }\n }\n\n function updateDisplaySimple(cm, viewport) {\n var update = new DisplayUpdate(cm, viewport);\n if (updateDisplayIfNeeded(cm, update)) {\n updateHeightsInViewport(cm);\n postUpdateDisplay(cm, update);\n var barMeasure = measureForScrollbars(cm);\n updateSelection(cm);\n updateScrollbars(cm, barMeasure);\n setDocumentHeight(cm, barMeasure);\n update.finish();\n }\n }\n\n // Sync the actual display DOM structure with display.view, removing\n // nodes for lines that are no longer in view, and creating the ones\n // that are not there yet, and updating the ones that are out of\n // date.\n function patchDisplay(cm, updateNumbersFrom, dims) {\n var display = cm.display, lineNumbers = cm.options.lineNumbers;\n var container = display.lineDiv, cur = container.firstChild;\n\n function rm(node) {\n var next = node.nextSibling;\n // Works around a throw-scroll bug in OS X Webkit\n if (webkit && mac && cm.display.currentWheelTarget == node)\n { node.style.display = \"none\"; }\n else\n { node.parentNode.removeChild(node); }\n return next\n }\n\n var view = display.view, lineN = display.viewFrom;\n // Loop over the elements in the view, syncing cur (the DOM nodes\n // in display.lineDiv) with the view as we go.\n for (var i = 0; i < view.length; i++) {\n var lineView = view[i];\n if (lineView.hidden) ; else if (!lineView.node || lineView.node.parentNode != container) { // Not drawn yet\n var node = buildLineElement(cm, lineView, lineN, dims);\n container.insertBefore(node, cur);\n } else { // Already drawn\n while (cur != lineView.node) { cur = rm(cur); }\n var updateNumber = lineNumbers && updateNumbersFrom != null &&\n updateNumbersFrom <= lineN && lineView.lineNumber;\n if (lineView.changes) {\n if (indexOf(lineView.changes, \"gutter\") > -1) { updateNumber = false; }\n updateLineForChanges(cm, lineView, lineN, dims);\n }\n if (updateNumber) {\n removeChildren(lineView.lineNumber);\n lineView.lineNumber.appendChild(document.createTextNode(lineNumberFor(cm.options, lineN)));\n }\n cur = lineView.node.nextSibling;\n }\n lineN += lineView.size;\n }\n while (cur) { cur = rm(cur); }\n }\n\n function updateGutterSpace(display) {\n var width = display.gutters.offsetWidth;\n display.sizer.style.marginLeft = width + \"px\";\n // Send an event to consumers responding to changes in gutter width.\n signalLater(display, \"gutterChanged\", display);\n }\n\n function setDocumentHeight(cm, measure) {\n cm.display.sizer.style.minHeight = measure.docHeight + \"px\";\n cm.display.heightForcer.style.top = measure.docHeight + \"px\";\n cm.display.gutters.style.height = (measure.docHeight + cm.display.barHeight + scrollGap(cm)) + \"px\";\n }\n\n // Re-align line numbers and gutter marks to compensate for\n // horizontal scrolling.\n function alignHorizontally(cm) {\n var display = cm.display, view = display.view;\n if (!display.alignWidgets && (!display.gutters.firstChild || !cm.options.fixedGutter)) { return }\n var comp = compensateForHScroll(display) - display.scroller.scrollLeft + cm.doc.scrollLeft;\n var gutterW = display.gutters.offsetWidth, left = comp + \"px\";\n for (var i = 0; i < view.length; i++) { if (!view[i].hidden) {\n if (cm.options.fixedGutter) {\n if (view[i].gutter)\n { view[i].gutter.style.left = left; }\n if (view[i].gutterBackground)\n { view[i].gutterBackground.style.left = left; }\n }\n var align = view[i].alignable;\n if (align) { for (var j = 0; j < align.length; j++)\n { align[j].style.left = left; } }\n } }\n if (cm.options.fixedGutter)\n { display.gutters.style.left = (comp + gutterW) + \"px\"; }\n }\n\n // Used to ensure that the line number gutter is still the right\n // size for the current document size. Returns true when an update\n // is needed.\n function maybeUpdateLineNumberWidth(cm) {\n if (!cm.options.lineNumbers) { return false }\n var doc = cm.doc, last = lineNumberFor(cm.options, doc.first + doc.size - 1), display = cm.display;\n if (last.length != display.lineNumChars) {\n var test = display.measure.appendChild(elt(\"div\", [elt(\"div\", last)],\n \"CodeMirror-linenumber CodeMirror-gutter-elt\"));\n var innerW = test.firstChild.offsetWidth, padding = test.offsetWidth - innerW;\n display.lineGutter.style.width = \"\";\n display.lineNumInnerWidth = Math.max(innerW, display.lineGutter.offsetWidth - padding) + 1;\n display.lineNumWidth = display.lineNumInnerWidth + padding;\n display.lineNumChars = display.lineNumInnerWidth ? last.length : -1;\n display.lineGutter.style.width = display.lineNumWidth + \"px\";\n updateGutterSpace(cm.display);\n return true\n }\n return false\n }\n\n function getGutters(gutters, lineNumbers) {\n var result = [], sawLineNumbers = false;\n for (var i = 0; i < gutters.length; i++) {\n var name = gutters[i], style = null;\n if (typeof name != \"string\") { style = name.style; name = name.className; }\n if (name == \"CodeMirror-linenumbers\") {\n if (!lineNumbers) { continue }\n else { sawLineNumbers = true; }\n }\n result.push({className: name, style: style});\n }\n if (lineNumbers && !sawLineNumbers) { result.push({className: \"CodeMirror-linenumbers\", style: null}); }\n return result\n }\n\n // Rebuild the gutter elements, ensure the margin to the left of the\n // code matches their width.\n function renderGutters(display) {\n var gutters = display.gutters, specs = display.gutterSpecs;\n removeChildren(gutters);\n display.lineGutter = null;\n for (var i = 0; i < specs.length; ++i) {\n var ref = specs[i];\n var className = ref.className;\n var style = ref.style;\n var gElt = gutters.appendChild(elt(\"div\", null, \"CodeMirror-gutter \" + className));\n if (style) { gElt.style.cssText = style; }\n if (className == \"CodeMirror-linenumbers\") {\n display.lineGutter = gElt;\n gElt.style.width = (display.lineNumWidth || 1) + \"px\";\n }\n }\n gutters.style.display = specs.length ? \"\" : \"none\";\n updateGutterSpace(display);\n }\n\n function updateGutters(cm) {\n renderGutters(cm.display);\n regChange(cm);\n alignHorizontally(cm);\n }\n\n // The display handles the DOM integration, both for input reading\n // and content drawing. It holds references to DOM nodes and\n // display-related state.\n\n function Display(place, doc, input, options) {\n var d = this;\n this.input = input;\n\n // Covers bottom-right square when both scrollbars are present.\n d.scrollbarFiller = elt(\"div\", null, \"CodeMirror-scrollbar-filler\");\n d.scrollbarFiller.setAttribute(\"cm-not-content\", \"true\");\n // Covers bottom of gutter when coverGutterNextToScrollbar is on\n // and h scrollbar is present.\n d.gutterFiller = elt(\"div\", null, \"CodeMirror-gutter-filler\");\n d.gutterFiller.setAttribute(\"cm-not-content\", \"true\");\n // Will contain the actual code, positioned to cover the viewport.\n d.lineDiv = eltP(\"div\", null, \"CodeMirror-code\");\n // Elements are added to these to represent selection and cursors.\n d.selectionDiv = elt(\"div\", null, null, \"position: relative; z-index: 1\");\n d.cursorDiv = elt(\"div\", null, \"CodeMirror-cursors\");\n // A visibility: hidden element used to find the size of things.\n d.measure = elt(\"div\", null, \"CodeMirror-measure\");\n // When lines outside of the viewport are measured, they are drawn in this.\n d.lineMeasure = elt(\"div\", null, \"CodeMirror-measure\");\n // Wraps everything that needs to exist inside the vertically-padded coordinate system\n d.lineSpace = eltP(\"div\", [d.measure, d.lineMeasure, d.selectionDiv, d.cursorDiv, d.lineDiv],\n null, \"position: relative; outline: none\");\n var lines = eltP(\"div\", [d.lineSpace], \"CodeMirror-lines\");\n // Moved around its parent to cover visible view.\n d.mover = elt(\"div\", [lines], null, \"position: relative\");\n // Set to the height of the document, allowing scrolling.\n d.sizer = elt(\"div\", [d.mover], \"CodeMirror-sizer\");\n d.sizerWidth = null;\n // Behavior of elts with overflow: auto and padding is\n // inconsistent across browsers. This is used to ensure the\n // scrollable area is big enough.\n d.heightForcer = elt(\"div\", null, null, \"position: absolute; height: \" + scrollerGap + \"px; width: 1px;\");\n // Will contain the gutters, if any.\n d.gutters = elt(\"div\", null, \"CodeMirror-gutters\");\n d.lineGutter = null;\n // Actual scrollable element.\n d.scroller = elt(\"div\", [d.sizer, d.heightForcer, d.gutters], \"CodeMirror-scroll\");\n d.scroller.setAttribute(\"tabIndex\", \"-1\");\n // The element in which the editor lives.\n d.wrapper = elt(\"div\", [d.scrollbarFiller, d.gutterFiller, d.scroller], \"CodeMirror\");\n // See #6982. FIXME remove when this has been fixed for a while in Chrome\n if (chrome && chrome_version >= 105) { d.wrapper.style.clipPath = \"inset(0px)\"; }\n\n // This attribute is respected by automatic translation systems such as Google Translate,\n // and may also be respected by tools used by human translators.\n d.wrapper.setAttribute('translate', 'no');\n\n // Work around IE7 z-index bug (not perfect, hence IE7 not really being supported)\n if (ie && ie_version < 8) { d.gutters.style.zIndex = -1; d.scroller.style.paddingRight = 0; }\n if (!webkit && !(gecko && mobile)) { d.scroller.draggable = true; }\n\n if (place) {\n if (place.appendChild) { place.appendChild(d.wrapper); }\n else { place(d.wrapper); }\n }\n\n // Current rendered range (may be bigger than the view window).\n d.viewFrom = d.viewTo = doc.first;\n d.reportedViewFrom = d.reportedViewTo = doc.first;\n // Information about the rendered lines.\n d.view = [];\n d.renderedView = null;\n // Holds info about a single rendered line when it was rendered\n // for measurement, while not in view.\n d.externalMeasured = null;\n // Empty space (in pixels) above the view\n d.viewOffset = 0;\n d.lastWrapHeight = d.lastWrapWidth = 0;\n d.updateLineNumbers = null;\n\n d.nativeBarWidth = d.barHeight = d.barWidth = 0;\n d.scrollbarsClipped = false;\n\n // Used to only resize the line number gutter when necessary (when\n // the amount of lines crosses a boundary that makes its width change)\n d.lineNumWidth = d.lineNumInnerWidth = d.lineNumChars = null;\n // Set to true when a non-horizontal-scrolling line widget is\n // added. As an optimization, line widget aligning is skipped when\n // this is false.\n d.alignWidgets = false;\n\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n\n // Tracks the maximum line length so that the horizontal scrollbar\n // can be kept static when scrolling.\n d.maxLine = null;\n d.maxLineLength = 0;\n d.maxLineChanged = false;\n\n // Used for measuring wheel scrolling granularity\n d.wheelDX = d.wheelDY = d.wheelStartX = d.wheelStartY = null;\n\n // True when shift is held down.\n d.shift = false;\n\n // Used to track whether anything happened since the context menu\n // was opened.\n d.selForContextMenu = null;\n\n d.activeTouch = null;\n\n d.gutterSpecs = getGutters(options.gutters, options.lineNumbers);\n renderGutters(d);\n\n input.init(d);\n }\n\n // Since the delta values reported on mouse wheel events are\n // unstandardized between browsers and even browser versions, and\n // generally horribly unpredictable, this code starts by measuring\n // the scroll effect that the first few mouse wheel events have,\n // and, from that, detects the way it can convert deltas to pixel\n // offsets afterwards.\n //\n // The reason we want to know the amount a wheel event will scroll\n // is that it gives us a chance to update the display before the\n // actual scrolling happens, reducing flickering.\n\n var wheelSamples = 0, wheelPixelsPerUnit = null;\n // Fill in a browser-detected starting value on browsers where we\n // know one. These don't have to be accurate -- the result of them\n // being wrong would just be a slight flicker on the first wheel\n // scroll (if it is large enough).\n if (ie) { wheelPixelsPerUnit = -.53; }\n else if (gecko) { wheelPixelsPerUnit = 15; }\n else if (chrome) { wheelPixelsPerUnit = -.7; }\n else if (safari) { wheelPixelsPerUnit = -1/3; }\n\n function wheelEventDelta(e) {\n var dx = e.wheelDeltaX, dy = e.wheelDeltaY;\n if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) { dx = e.detail; }\n if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) { dy = e.detail; }\n else if (dy == null) { dy = e.wheelDelta; }\n return {x: dx, y: dy}\n }\n function wheelEventPixels(e) {\n var delta = wheelEventDelta(e);\n delta.x *= wheelPixelsPerUnit;\n delta.y *= wheelPixelsPerUnit;\n return delta\n }\n\n function onScrollWheel(cm, e) {\n // On Chrome 102, viewport updates somehow stop wheel-based\n // scrolling. Turning off pointer events during the scroll seems\n // to avoid the issue.\n if (chrome && chrome_version == 102) {\n if (cm.display.chromeScrollHack == null) { cm.display.sizer.style.pointerEvents = \"none\"; }\n else { clearTimeout(cm.display.chromeScrollHack); }\n cm.display.chromeScrollHack = setTimeout(function () {\n cm.display.chromeScrollHack = null;\n cm.display.sizer.style.pointerEvents = \"\";\n }, 100);\n }\n var delta = wheelEventDelta(e), dx = delta.x, dy = delta.y;\n var pixelsPerUnit = wheelPixelsPerUnit;\n if (e.deltaMode === 0) {\n dx = e.deltaX;\n dy = e.deltaY;\n pixelsPerUnit = 1;\n }\n\n var display = cm.display, scroll = display.scroller;\n // Quit if there's nothing to scroll here\n var canScrollX = scroll.scrollWidth > scroll.clientWidth;\n var canScrollY = scroll.scrollHeight > scroll.clientHeight;\n if (!(dx && canScrollX || dy && canScrollY)) { return }\n\n // Webkit browsers on OS X abort momentum scrolls when the target\n // of the scroll event is removed from the scrollable element.\n // This hack (see related code in patchDisplay) makes sure the\n // element is kept around.\n if (dy && mac && webkit) {\n outer: for (var cur = e.target, view = display.view; cur != scroll; cur = cur.parentNode) {\n for (var i = 0; i < view.length; i++) {\n if (view[i].node == cur) {\n cm.display.currentWheelTarget = cur;\n break outer\n }\n }\n }\n }\n\n // On some browsers, horizontal scrolling will cause redraws to\n // happen before the gutter has been realigned, causing it to\n // wriggle around in a most unseemly way. When we have an\n // estimated pixels/delta value, we just handle horizontal\n // scrolling entirely here. It'll be slightly off from native, but\n // better than glitching out.\n if (dx && !gecko && !presto && pixelsPerUnit != null) {\n if (dy && canScrollY)\n { updateScrollTop(cm, Math.max(0, scroll.scrollTop + dy * pixelsPerUnit)); }\n setScrollLeft(cm, Math.max(0, scroll.scrollLeft + dx * pixelsPerUnit));\n // Only prevent default scrolling if vertical scrolling is\n // actually possible. Otherwise, it causes vertical scroll\n // jitter on OSX trackpads when deltaX is small and deltaY\n // is large (issue #3579)\n if (!dy || (dy && canScrollY))\n { e_preventDefault(e); }\n display.wheelStartX = null; // Abort measurement, if in progress\n return\n }\n\n // 'Project' the visible viewport to cover the area that is being\n // scrolled into view (if we know enough to estimate it).\n if (dy && pixelsPerUnit != null) {\n var pixels = dy * pixelsPerUnit;\n var top = cm.doc.scrollTop, bot = top + display.wrapper.clientHeight;\n if (pixels < 0) { top = Math.max(0, top + pixels - 50); }\n else { bot = Math.min(cm.doc.height, bot + pixels + 50); }\n updateDisplaySimple(cm, {top: top, bottom: bot});\n }\n\n if (wheelSamples < 20 && e.deltaMode !== 0) {\n if (display.wheelStartX == null) {\n display.wheelStartX = scroll.scrollLeft; display.wheelStartY = scroll.scrollTop;\n display.wheelDX = dx; display.wheelDY = dy;\n setTimeout(function () {\n if (display.wheelStartX == null) { return }\n var movedX = scroll.scrollLeft - display.wheelStartX;\n var movedY = scroll.scrollTop - display.wheelStartY;\n var sample = (movedY && display.wheelDY && movedY / display.wheelDY) ||\n (movedX && display.wheelDX && movedX / display.wheelDX);\n display.wheelStartX = display.wheelStartY = null;\n if (!sample) { return }\n wheelPixelsPerUnit = (wheelPixelsPerUnit * wheelSamples + sample) / (wheelSamples + 1);\n ++wheelSamples;\n }, 200);\n } else {\n display.wheelDX += dx; display.wheelDY += dy;\n }\n }\n }\n\n // Selection objects are immutable. A new one is created every time\n // the selection changes. A selection is one or more non-overlapping\n // (and non-touching) ranges, sorted, and an integer that indicates\n // which one is the primary selection (the one that's scrolled into\n // view, that getCursor returns, etc).\n var Selection = function(ranges, primIndex) {\n this.ranges = ranges;\n this.primIndex = primIndex;\n };\n\n Selection.prototype.primary = function () { return this.ranges[this.primIndex] };\n\n Selection.prototype.equals = function (other) {\n if (other == this) { return true }\n if (other.primIndex != this.primIndex || other.ranges.length != this.ranges.length) { return false }\n for (var i = 0; i < this.ranges.length; i++) {\n var here = this.ranges[i], there = other.ranges[i];\n if (!equalCursorPos(here.anchor, there.anchor) || !equalCursorPos(here.head, there.head)) { return false }\n }\n return true\n };\n\n Selection.prototype.deepCopy = function () {\n var out = [];\n for (var i = 0; i < this.ranges.length; i++)\n { out[i] = new Range(copyPos(this.ranges[i].anchor), copyPos(this.ranges[i].head)); }\n return new Selection(out, this.primIndex)\n };\n\n Selection.prototype.somethingSelected = function () {\n for (var i = 0; i < this.ranges.length; i++)\n { if (!this.ranges[i].empty()) { return true } }\n return false\n };\n\n Selection.prototype.contains = function (pos, end) {\n if (!end) { end = pos; }\n for (var i = 0; i < this.ranges.length; i++) {\n var range = this.ranges[i];\n if (cmp(end, range.from()) >= 0 && cmp(pos, range.to()) <= 0)\n { return i }\n }\n return -1\n };\n\n var Range = function(anchor, head) {\n this.anchor = anchor; this.head = head;\n };\n\n Range.prototype.from = function () { return minPos(this.anchor, this.head) };\n Range.prototype.to = function () { return maxPos(this.anchor, this.head) };\n Range.prototype.empty = function () { return this.head.line == this.anchor.line && this.head.ch == this.anchor.ch };\n\n // Take an unsorted, potentially overlapping set of ranges, and\n // build a selection out of it. 'Consumes' ranges array (modifying\n // it).\n function normalizeSelection(cm, ranges, primIndex) {\n var mayTouch = cm && cm.options.selectionsMayTouch;\n var prim = ranges[primIndex];\n ranges.sort(function (a, b) { return cmp(a.from(), b.from()); });\n primIndex = indexOf(ranges, prim);\n for (var i = 1; i < ranges.length; i++) {\n var cur = ranges[i], prev = ranges[i - 1];\n var diff = cmp(prev.to(), cur.from());\n if (mayTouch && !cur.empty() ? diff > 0 : diff >= 0) {\n var from = minPos(prev.from(), cur.from()), to = maxPos(prev.to(), cur.to());\n var inv = prev.empty() ? cur.from() == cur.head : prev.from() == prev.head;\n if (i <= primIndex) { --primIndex; }\n ranges.splice(--i, 2, new Range(inv ? to : from, inv ? from : to));\n }\n }\n return new Selection(ranges, primIndex)\n }\n\n function simpleSelection(anchor, head) {\n return new Selection([new Range(anchor, head || anchor)], 0)\n }\n\n // Compute the position of the end of a change (its 'to' property\n // refers to the pre-change end).\n function changeEnd(change) {\n if (!change.text) { return change.to }\n return Pos(change.from.line + change.text.length - 1,\n lst(change.text).length + (change.text.length == 1 ? change.from.ch : 0))\n }\n\n // Adjust a position to refer to the post-change position of the\n // same text, or the end of the change if the change covers it.\n function adjustForChange(pos, change) {\n if (cmp(pos, change.from) < 0) { return pos }\n if (cmp(pos, change.to) <= 0) { return changeEnd(change) }\n\n var line = pos.line + change.text.length - (change.to.line - change.from.line) - 1, ch = pos.ch;\n if (pos.line == change.to.line) { ch += changeEnd(change).ch - change.to.ch; }\n return Pos(line, ch)\n }\n\n function computeSelAfterChange(doc, change) {\n var out = [];\n for (var i = 0; i < doc.sel.ranges.length; i++) {\n var range = doc.sel.ranges[i];\n out.push(new Range(adjustForChange(range.anchor, change),\n adjustForChange(range.head, change)));\n }\n return normalizeSelection(doc.cm, out, doc.sel.primIndex)\n }\n\n function offsetPos(pos, old, nw) {\n if (pos.line == old.line)\n { return Pos(nw.line, pos.ch - old.ch + nw.ch) }\n else\n { return Pos(nw.line + (pos.line - old.line), pos.ch) }\n }\n\n // Used by replaceSelections to allow moving the selection to the\n // start or around the replaced test. Hint may be \"start\" or \"around\".\n function computeReplacedSel(doc, changes, hint) {\n var out = [];\n var oldPrev = Pos(doc.first, 0), newPrev = oldPrev;\n for (var i = 0; i < changes.length; i++) {\n var change = changes[i];\n var from = offsetPos(change.from, oldPrev, newPrev);\n var to = offsetPos(changeEnd(change), oldPrev, newPrev);\n oldPrev = change.to;\n newPrev = to;\n if (hint == \"around\") {\n var range = doc.sel.ranges[i], inv = cmp(range.head, range.anchor) < 0;\n out[i] = new Range(inv ? to : from, inv ? from : to);\n } else {\n out[i] = new Range(from, from);\n }\n }\n return new Selection(out, doc.sel.primIndex)\n }\n\n // Used to get the editor into a consistent state again when options change.\n\n function loadMode(cm) {\n cm.doc.mode = getMode(cm.options, cm.doc.modeOption);\n resetModeState(cm);\n }\n\n function resetModeState(cm) {\n cm.doc.iter(function (line) {\n if (line.stateAfter) { line.stateAfter = null; }\n if (line.styles) { line.styles = null; }\n });\n cm.doc.modeFrontier = cm.doc.highlightFrontier = cm.doc.first;\n startWorker(cm, 100);\n cm.state.modeGen++;\n if (cm.curOp) { regChange(cm); }\n }\n\n // DOCUMENT DATA STRUCTURE\n\n // By default, updates that start and end at the beginning of a line\n // are treated specially, in order to make the association of line\n // widgets and marker elements with the text behave more intuitive.\n function isWholeLineUpdate(doc, change) {\n return change.from.ch == 0 && change.to.ch == 0 && lst(change.text) == \"\" &&\n (!doc.cm || doc.cm.options.wholeLineUpdateBefore)\n }\n\n // Perform a change on the document data structure.\n function updateDoc(doc, change, markedSpans, estimateHeight) {\n function spansFor(n) {return markedSpans ? markedSpans[n] : null}\n function update(line, text, spans) {\n updateLine(line, text, spans, estimateHeight);\n signalLater(line, \"change\", line, change);\n }\n function linesFor(start, end) {\n var result = [];\n for (var i = start; i < end; ++i)\n { result.push(new Line(text[i], spansFor(i), estimateHeight)); }\n return result\n }\n\n var from = change.from, to = change.to, text = change.text;\n var firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);\n var lastText = lst(text), lastSpans = spansFor(text.length - 1), nlines = to.line - from.line;\n\n // Adjust the line structure\n if (change.full) {\n doc.insert(0, linesFor(0, text.length));\n doc.remove(text.length, doc.size - text.length);\n } else if (isWholeLineUpdate(doc, change)) {\n // This is a whole-line replace. Treated specially to make\n // sure line objects move the way they are supposed to.\n var added = linesFor(0, text.length - 1);\n update(lastLine, lastLine.text, lastSpans);\n if (nlines) { doc.remove(from.line, nlines); }\n if (added.length) { doc.insert(from.line, added); }\n } else if (firstLine == lastLine) {\n if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + lastText + firstLine.text.slice(to.ch), lastSpans);\n } else {\n var added$1 = linesFor(1, text.length - 1);\n added$1.push(new Line(lastText + firstLine.text.slice(to.ch), lastSpans, estimateHeight));\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n doc.insert(from.line + 1, added$1);\n }\n } else if (text.length == 1) {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0] + lastLine.text.slice(to.ch), spansFor(0));\n doc.remove(from.line + 1, nlines);\n } else {\n update(firstLine, firstLine.text.slice(0, from.ch) + text[0], spansFor(0));\n update(lastLine, lastText + lastLine.text.slice(to.ch), lastSpans);\n var added$2 = linesFor(1, text.length - 1);\n if (nlines > 1) { doc.remove(from.line + 1, nlines - 1); }\n doc.insert(from.line + 1, added$2);\n }\n\n signalLater(doc, \"change\", doc, change);\n }\n\n // Call f for all linked documents.\n function linkedDocs(doc, f, sharedHistOnly) {\n function propagate(doc, skip, sharedHist) {\n if (doc.linked) { for (var i = 0; i < doc.linked.length; ++i) {\n var rel = doc.linked[i];\n if (rel.doc == skip) { continue }\n var shared = sharedHist && rel.sharedHist;\n if (sharedHistOnly && !shared) { continue }\n f(rel.doc, shared);\n propagate(rel.doc, doc, shared);\n } }\n }\n propagate(doc, null, true);\n }\n\n // Attach a document to an editor.\n function attachDoc(cm, doc) {\n if (doc.cm) { throw new Error(\"This document is already in use.\") }\n cm.doc = doc;\n doc.cm = cm;\n estimateLineHeights(cm);\n loadMode(cm);\n setDirectionClass(cm);\n cm.options.direction = doc.direction;\n if (!cm.options.lineWrapping) { findMaxLine(cm); }\n cm.options.mode = doc.modeOption;\n regChange(cm);\n }\n\n function setDirectionClass(cm) {\n (cm.doc.direction == \"rtl\" ? addClass : rmClass)(cm.display.lineDiv, \"CodeMirror-rtl\");\n }\n\n function directionChanged(cm) {\n runInOp(cm, function () {\n setDirectionClass(cm);\n regChange(cm);\n });\n }\n\n function History(prev) {\n // Arrays of change events and selections. Doing something adds an\n // event to done and clears undo. Undoing moves events from done\n // to undone, redoing moves them in the other direction.\n this.done = []; this.undone = [];\n this.undoDepth = prev ? prev.undoDepth : Infinity;\n // Used to track when changes can be merged into a single undo\n // event\n this.lastModTime = this.lastSelTime = 0;\n this.lastOp = this.lastSelOp = null;\n this.lastOrigin = this.lastSelOrigin = null;\n // Used by the isClean() method\n this.generation = this.maxGeneration = prev ? prev.maxGeneration : 1;\n }\n\n // Create a history change event from an updateDoc-style change\n // object.\n function historyChangeFromChange(doc, change) {\n var histChange = {from: copyPos(change.from), to: changeEnd(change), text: getBetween(doc, change.from, change.to)};\n attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1);\n linkedDocs(doc, function (doc) { return attachLocalSpans(doc, histChange, change.from.line, change.to.line + 1); }, true);\n return histChange\n }\n\n // Pop all selection events off the end of a history array. Stop at\n // a change event.\n function clearSelectionEvents(array) {\n while (array.length) {\n var last = lst(array);\n if (last.ranges) { array.pop(); }\n else { break }\n }\n }\n\n // Find the top change event in the history. Pop off selection\n // events that are in the way.\n function lastChangeEvent(hist, force) {\n if (force) {\n clearSelectionEvents(hist.done);\n return lst(hist.done)\n } else if (hist.done.length && !lst(hist.done).ranges) {\n return lst(hist.done)\n } else if (hist.done.length > 1 && !hist.done[hist.done.length - 2].ranges) {\n hist.done.pop();\n return lst(hist.done)\n }\n }\n\n // Register a change in the history. Merges changes that are within\n // a single operation, or are close together with an origin that\n // allows merging (starting with \"+\") into a single event.\n function addChangeToHistory(doc, change, selAfter, opId) {\n var hist = doc.history;\n hist.undone.length = 0;\n var time = +new Date, cur;\n var last;\n\n if ((hist.lastOp == opId ||\n hist.lastOrigin == change.origin && change.origin &&\n ((change.origin.charAt(0) == \"+\" && hist.lastModTime > time - (doc.cm ? doc.cm.options.historyEventDelay : 500)) ||\n change.origin.charAt(0) == \"*\")) &&\n (cur = lastChangeEvent(hist, hist.lastOp == opId))) {\n // Merge this change into the last event\n last = lst(cur.changes);\n if (cmp(change.from, change.to) == 0 && cmp(change.from, last.to) == 0) {\n // Optimized case for simple insertion -- don't want to add\n // new changesets for every character typed\n last.to = changeEnd(change);\n } else {\n // Add new sub-event\n cur.changes.push(historyChangeFromChange(doc, change));\n }\n } else {\n // Can not be merged, start a new event.\n var before = lst(hist.done);\n if (!before || !before.ranges)\n { pushSelectionToHistory(doc.sel, hist.done); }\n cur = {changes: [historyChangeFromChange(doc, change)],\n generation: hist.generation};\n hist.done.push(cur);\n while (hist.done.length > hist.undoDepth) {\n hist.done.shift();\n if (!hist.done[0].ranges) { hist.done.shift(); }\n }\n }\n hist.done.push(selAfter);\n hist.generation = ++hist.maxGeneration;\n hist.lastModTime = hist.lastSelTime = time;\n hist.lastOp = hist.lastSelOp = opId;\n hist.lastOrigin = hist.lastSelOrigin = change.origin;\n\n if (!last) { signal(doc, \"historyAdded\"); }\n }\n\n function selectionEventCanBeMerged(doc, origin, prev, sel) {\n var ch = origin.charAt(0);\n return ch == \"*\" ||\n ch == \"+\" &&\n prev.ranges.length == sel.ranges.length &&\n prev.somethingSelected() == sel.somethingSelected() &&\n new Date - doc.history.lastSelTime <= (doc.cm ? doc.cm.options.historyEventDelay : 500)\n }\n\n // Called whenever the selection changes, sets the new selection as\n // the pending selection in the history, and pushes the old pending\n // selection into the 'done' array when it was significantly\n // different (in number of selected ranges, emptiness, or time).\n function addSelectionToHistory(doc, sel, opId, options) {\n var hist = doc.history, origin = options && options.origin;\n\n // A new event is started when the previous origin does not match\n // the current, or the origins don't allow matching. Origins\n // starting with * are always merged, those starting with + are\n // merged when similar and close together in time.\n if (opId == hist.lastSelOp ||\n (origin && hist.lastSelOrigin == origin &&\n (hist.lastModTime == hist.lastSelTime && hist.lastOrigin == origin ||\n selectionEventCanBeMerged(doc, origin, lst(hist.done), sel))))\n { hist.done[hist.done.length - 1] = sel; }\n else\n { pushSelectionToHistory(sel, hist.done); }\n\n hist.lastSelTime = +new Date;\n hist.lastSelOrigin = origin;\n hist.lastSelOp = opId;\n if (options && options.clearRedo !== false)\n { clearSelectionEvents(hist.undone); }\n }\n\n function pushSelectionToHistory(sel, dest) {\n var top = lst(dest);\n if (!(top && top.ranges && top.equals(sel)))\n { dest.push(sel); }\n }\n\n // Used to store marked span information in the history.\n function attachLocalSpans(doc, change, from, to) {\n var existing = change[\"spans_\" + doc.id], n = 0;\n doc.iter(Math.max(doc.first, from), Math.min(doc.first + doc.size, to), function (line) {\n if (line.markedSpans)\n { (existing || (existing = change[\"spans_\" + doc.id] = {}))[n] = line.markedSpans; }\n ++n;\n });\n }\n\n // When un/re-doing restores text containing marked spans, those\n // that have been explicitly cleared should not be restored.\n function removeClearedSpans(spans) {\n if (!spans) { return null }\n var out;\n for (var i = 0; i < spans.length; ++i) {\n if (spans[i].marker.explicitlyCleared) { if (!out) { out = spans.slice(0, i); } }\n else if (out) { out.push(spans[i]); }\n }\n return !out ? spans : out.length ? out : null\n }\n\n // Retrieve and filter the old marked spans stored in a change event.\n function getOldSpans(doc, change) {\n var found = change[\"spans_\" + doc.id];\n if (!found) { return null }\n var nw = [];\n for (var i = 0; i < change.text.length; ++i)\n { nw.push(removeClearedSpans(found[i])); }\n return nw\n }\n\n // Used for un/re-doing changes from the history. Combines the\n // result of computing the existing spans with the set of spans that\n // existed in the history (so that deleting around a span and then\n // undoing brings back the span).\n function mergeOldSpans(doc, change) {\n var old = getOldSpans(doc, change);\n var stretched = stretchSpansOverChange(doc, change);\n if (!old) { return stretched }\n if (!stretched) { return old }\n\n for (var i = 0; i < old.length; ++i) {\n var oldCur = old[i], stretchCur = stretched[i];\n if (oldCur && stretchCur) {\n spans: for (var j = 0; j < stretchCur.length; ++j) {\n var span = stretchCur[j];\n for (var k = 0; k < oldCur.length; ++k)\n { if (oldCur[k].marker == span.marker) { continue spans } }\n oldCur.push(span);\n }\n } else if (stretchCur) {\n old[i] = stretchCur;\n }\n }\n return old\n }\n\n // Used both to provide a JSON-safe object in .getHistory, and, when\n // detaching a document, to split the history in two\n function copyHistoryArray(events, newGroup, instantiateSel) {\n var copy = [];\n for (var i = 0; i < events.length; ++i) {\n var event = events[i];\n if (event.ranges) {\n copy.push(instantiateSel ? Selection.prototype.deepCopy.call(event) : event);\n continue\n }\n var changes = event.changes, newChanges = [];\n copy.push({changes: newChanges});\n for (var j = 0; j < changes.length; ++j) {\n var change = changes[j], m = (void 0);\n newChanges.push({from: change.from, to: change.to, text: change.text});\n if (newGroup) { for (var prop in change) { if (m = prop.match(/^spans_(\\d+)$/)) {\n if (indexOf(newGroup, Number(m[1])) > -1) {\n lst(newChanges)[prop] = change[prop];\n delete change[prop];\n }\n } } }\n }\n }\n return copy\n }\n\n // The 'scroll' parameter given to many of these indicated whether\n // the new cursor position should be scrolled into view after\n // modifying the selection.\n\n // If shift is held or the extend flag is set, extends a range to\n // include a given position (and optionally a second position).\n // Otherwise, simply returns the range between the given positions.\n // Used for cursor motion and such.\n function extendRange(range, head, other, extend) {\n if (extend) {\n var anchor = range.anchor;\n if (other) {\n var posBefore = cmp(head, anchor) < 0;\n if (posBefore != (cmp(other, anchor) < 0)) {\n anchor = head;\n head = other;\n } else if (posBefore != (cmp(head, other) < 0)) {\n head = other;\n }\n }\n return new Range(anchor, head)\n } else {\n return new Range(other || head, head)\n }\n }\n\n // Extend the primary selection range, discard the rest.\n function extendSelection(doc, head, other, options, extend) {\n if (extend == null) { extend = doc.cm && (doc.cm.display.shift || doc.extend); }\n setSelection(doc, new Selection([extendRange(doc.sel.primary(), head, other, extend)], 0), options);\n }\n\n // Extend all selections (pos is an array of selections with length\n // equal the number of selections)\n function extendSelections(doc, heads, options) {\n var out = [];\n var extend = doc.cm && (doc.cm.display.shift || doc.extend);\n for (var i = 0; i < doc.sel.ranges.length; i++)\n { out[i] = extendRange(doc.sel.ranges[i], heads[i], null, extend); }\n var newSel = normalizeSelection(doc.cm, out, doc.sel.primIndex);\n setSelection(doc, newSel, options);\n }\n\n // Updates a single range in the selection.\n function replaceOneSelection(doc, i, range, options) {\n var ranges = doc.sel.ranges.slice(0);\n ranges[i] = range;\n setSelection(doc, normalizeSelection(doc.cm, ranges, doc.sel.primIndex), options);\n }\n\n // Reset the selection to a single range.\n function setSimpleSelection(doc, anchor, head, options) {\n setSelection(doc, simpleSelection(anchor, head), options);\n }\n\n // Give beforeSelectionChange handlers a change to influence a\n // selection update.\n function filterSelectionChange(doc, sel, options) {\n var obj = {\n ranges: sel.ranges,\n update: function(ranges) {\n this.ranges = [];\n for (var i = 0; i < ranges.length; i++)\n { this.ranges[i] = new Range(clipPos(doc, ranges[i].anchor),\n clipPos(doc, ranges[i].head)); }\n },\n origin: options && options.origin\n };\n signal(doc, \"beforeSelectionChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeSelectionChange\", doc.cm, obj); }\n if (obj.ranges != sel.ranges) { return normalizeSelection(doc.cm, obj.ranges, obj.ranges.length - 1) }\n else { return sel }\n }\n\n function setSelectionReplaceHistory(doc, sel, options) {\n var done = doc.history.done, last = lst(done);\n if (last && last.ranges) {\n done[done.length - 1] = sel;\n setSelectionNoUndo(doc, sel, options);\n } else {\n setSelection(doc, sel, options);\n }\n }\n\n // Set a new selection.\n function setSelection(doc, sel, options) {\n setSelectionNoUndo(doc, sel, options);\n addSelectionToHistory(doc, doc.sel, doc.cm ? doc.cm.curOp.id : NaN, options);\n }\n\n function setSelectionNoUndo(doc, sel, options) {\n if (hasHandler(doc, \"beforeSelectionChange\") || doc.cm && hasHandler(doc.cm, \"beforeSelectionChange\"))\n { sel = filterSelectionChange(doc, sel, options); }\n\n var bias = options && options.bias ||\n (cmp(sel.primary().head, doc.sel.primary().head) < 0 ? -1 : 1);\n setSelectionInner(doc, skipAtomicInSelection(doc, sel, bias, true));\n\n if (!(options && options.scroll === false) && doc.cm && doc.cm.getOption(\"readOnly\") != \"nocursor\")\n { ensureCursorVisible(doc.cm); }\n }\n\n function setSelectionInner(doc, sel) {\n if (sel.equals(doc.sel)) { return }\n\n doc.sel = sel;\n\n if (doc.cm) {\n doc.cm.curOp.updateInput = 1;\n doc.cm.curOp.selectionChanged = true;\n signalCursorActivity(doc.cm);\n }\n signalLater(doc, \"cursorActivity\", doc);\n }\n\n // Verify that the selection does not partially select any atomic\n // marked ranges.\n function reCheckSelection(doc) {\n setSelectionInner(doc, skipAtomicInSelection(doc, doc.sel, null, false));\n }\n\n // Return a selection that does not partially select any atomic\n // ranges.\n function skipAtomicInSelection(doc, sel, bias, mayClear) {\n var out;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n var old = sel.ranges.length == doc.sel.ranges.length && doc.sel.ranges[i];\n var newAnchor = skipAtomic(doc, range.anchor, old && old.anchor, bias, mayClear);\n var newHead = range.head == range.anchor ? newAnchor : skipAtomic(doc, range.head, old && old.head, bias, mayClear);\n if (out || newAnchor != range.anchor || newHead != range.head) {\n if (!out) { out = sel.ranges.slice(0, i); }\n out[i] = new Range(newAnchor, newHead);\n }\n }\n return out ? normalizeSelection(doc.cm, out, sel.primIndex) : sel\n }\n\n function skipAtomicInner(doc, pos, oldPos, dir, mayClear) {\n var line = getLine(doc, pos.line);\n if (line.markedSpans) { for (var i = 0; i < line.markedSpans.length; ++i) {\n var sp = line.markedSpans[i], m = sp.marker;\n\n // Determine if we should prevent the cursor being placed to the left/right of an atomic marker\n // Historically this was determined using the inclusiveLeft/Right option, but the new way to control it\n // is with selectLeft/Right\n var preventCursorLeft = (\"selectLeft\" in m) ? !m.selectLeft : m.inclusiveLeft;\n var preventCursorRight = (\"selectRight\" in m) ? !m.selectRight : m.inclusiveRight;\n\n if ((sp.from == null || (preventCursorLeft ? sp.from <= pos.ch : sp.from < pos.ch)) &&\n (sp.to == null || (preventCursorRight ? sp.to >= pos.ch : sp.to > pos.ch))) {\n if (mayClear) {\n signal(m, \"beforeCursorEnter\");\n if (m.explicitlyCleared) {\n if (!line.markedSpans) { break }\n else {--i; continue}\n }\n }\n if (!m.atomic) { continue }\n\n if (oldPos) {\n var near = m.find(dir < 0 ? 1 : -1), diff = (void 0);\n if (dir < 0 ? preventCursorRight : preventCursorLeft)\n { near = movePos(doc, near, -dir, near && near.line == pos.line ? line : null); }\n if (near && near.line == pos.line && (diff = cmp(near, oldPos)) && (dir < 0 ? diff < 0 : diff > 0))\n { return skipAtomicInner(doc, near, pos, dir, mayClear) }\n }\n\n var far = m.find(dir < 0 ? -1 : 1);\n if (dir < 0 ? preventCursorLeft : preventCursorRight)\n { far = movePos(doc, far, dir, far.line == pos.line ? line : null); }\n return far ? skipAtomicInner(doc, far, pos, dir, mayClear) : null\n }\n } }\n return pos\n }\n\n // Ensure a given position is not inside an atomic range.\n function skipAtomic(doc, pos, oldPos, bias, mayClear) {\n var dir = bias || 1;\n var found = skipAtomicInner(doc, pos, oldPos, dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, dir, true)) ||\n skipAtomicInner(doc, pos, oldPos, -dir, mayClear) ||\n (!mayClear && skipAtomicInner(doc, pos, oldPos, -dir, true));\n if (!found) {\n doc.cantEdit = true;\n return Pos(doc.first, 0)\n }\n return found\n }\n\n function movePos(doc, pos, dir, line) {\n if (dir < 0 && pos.ch == 0) {\n if (pos.line > doc.first) { return clipPos(doc, Pos(pos.line - 1)) }\n else { return null }\n } else if (dir > 0 && pos.ch == (line || getLine(doc, pos.line)).text.length) {\n if (pos.line < doc.first + doc.size - 1) { return Pos(pos.line + 1, 0) }\n else { return null }\n } else {\n return new Pos(pos.line, pos.ch + dir)\n }\n }\n\n function selectAll(cm) {\n cm.setSelection(Pos(cm.firstLine(), 0), Pos(cm.lastLine()), sel_dontScroll);\n }\n\n // UPDATING\n\n // Allow \"beforeChange\" event handlers to influence a change\n function filterChange(doc, change, update) {\n var obj = {\n canceled: false,\n from: change.from,\n to: change.to,\n text: change.text,\n origin: change.origin,\n cancel: function () { return obj.canceled = true; }\n };\n if (update) { obj.update = function (from, to, text, origin) {\n if (from) { obj.from = clipPos(doc, from); }\n if (to) { obj.to = clipPos(doc, to); }\n if (text) { obj.text = text; }\n if (origin !== undefined) { obj.origin = origin; }\n }; }\n signal(doc, \"beforeChange\", doc, obj);\n if (doc.cm) { signal(doc.cm, \"beforeChange\", doc.cm, obj); }\n\n if (obj.canceled) {\n if (doc.cm) { doc.cm.curOp.updateInput = 2; }\n return null\n }\n return {from: obj.from, to: obj.to, text: obj.text, origin: obj.origin}\n }\n\n // Apply a change to a document, and add it to the document's\n // history, and propagating it to all linked documents.\n function makeChange(doc, change, ignoreReadOnly) {\n if (doc.cm) {\n if (!doc.cm.curOp) { return operation(doc.cm, makeChange)(doc, change, ignoreReadOnly) }\n if (doc.cm.state.suppressEdits) { return }\n }\n\n if (hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\")) {\n change = filterChange(doc, change, true);\n if (!change) { return }\n }\n\n // Possibly split or suppress the update based on the presence\n // of read-only spans in its range.\n var split = sawReadOnlySpans && !ignoreReadOnly && removeReadOnlyRanges(doc, change.from, change.to);\n if (split) {\n for (var i = split.length - 1; i >= 0; --i)\n { makeChangeInner(doc, {from: split[i].from, to: split[i].to, text: i ? [\"\"] : change.text, origin: change.origin}); }\n } else {\n makeChangeInner(doc, change);\n }\n }\n\n function makeChangeInner(doc, change) {\n if (change.text.length == 1 && change.text[0] == \"\" && cmp(change.from, change.to) == 0) { return }\n var selAfter = computeSelAfterChange(doc, change);\n addChangeToHistory(doc, change, selAfter, doc.cm ? doc.cm.curOp.id : NaN);\n\n makeChangeSingleDoc(doc, change, selAfter, stretchSpansOverChange(doc, change));\n var rebased = [];\n\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, stretchSpansOverChange(doc, change));\n });\n }\n\n // Revert a change stored in a document's history.\n function makeChangeFromHistory(doc, type, allowSelectionOnly) {\n var suppress = doc.cm && doc.cm.state.suppressEdits;\n if (suppress && !allowSelectionOnly) { return }\n\n var hist = doc.history, event, selAfter = doc.sel;\n var source = type == \"undo\" ? hist.done : hist.undone, dest = type == \"undo\" ? hist.undone : hist.done;\n\n // Verify that there is a useable event (so that ctrl-z won't\n // needlessly clear selection events)\n var i = 0;\n for (; i < source.length; i++) {\n event = source[i];\n if (allowSelectionOnly ? event.ranges && !event.equals(doc.sel) : !event.ranges)\n { break }\n }\n if (i == source.length) { return }\n hist.lastOrigin = hist.lastSelOrigin = null;\n\n for (;;) {\n event = source.pop();\n if (event.ranges) {\n pushSelectionToHistory(event, dest);\n if (allowSelectionOnly && !event.equals(doc.sel)) {\n setSelection(doc, event, {clearRedo: false});\n return\n }\n selAfter = event;\n } else if (suppress) {\n source.push(event);\n return\n } else { break }\n }\n\n // Build up a reverse change object to add to the opposite history\n // stack (redo when undoing, and vice versa).\n var antiChanges = [];\n pushSelectionToHistory(selAfter, dest);\n dest.push({changes: antiChanges, generation: hist.generation});\n hist.generation = event.generation || ++hist.maxGeneration;\n\n var filter = hasHandler(doc, \"beforeChange\") || doc.cm && hasHandler(doc.cm, \"beforeChange\");\n\n var loop = function ( i ) {\n var change = event.changes[i];\n change.origin = type;\n if (filter && !filterChange(doc, change, false)) {\n source.length = 0;\n return {}\n }\n\n antiChanges.push(historyChangeFromChange(doc, change));\n\n var after = i ? computeSelAfterChange(doc, change) : lst(source);\n makeChangeSingleDoc(doc, change, after, mergeOldSpans(doc, change));\n if (!i && doc.cm) { doc.cm.scrollIntoView({from: change.from, to: changeEnd(change)}); }\n var rebased = [];\n\n // Propagate to the linked documents\n linkedDocs(doc, function (doc, sharedHist) {\n if (!sharedHist && indexOf(rebased, doc.history) == -1) {\n rebaseHist(doc.history, change);\n rebased.push(doc.history);\n }\n makeChangeSingleDoc(doc, change, null, mergeOldSpans(doc, change));\n });\n };\n\n for (var i$1 = event.changes.length - 1; i$1 >= 0; --i$1) {\n var returned = loop( i$1 );\n\n if ( returned ) return returned.v;\n }\n }\n\n // Sub-views need their line numbers shifted when text is added\n // above or below them in the parent document.\n function shiftDoc(doc, distance) {\n if (distance == 0) { return }\n doc.first += distance;\n doc.sel = new Selection(map(doc.sel.ranges, function (range) { return new Range(\n Pos(range.anchor.line + distance, range.anchor.ch),\n Pos(range.head.line + distance, range.head.ch)\n ); }), doc.sel.primIndex);\n if (doc.cm) {\n regChange(doc.cm, doc.first, doc.first - distance, distance);\n for (var d = doc.cm.display, l = d.viewFrom; l < d.viewTo; l++)\n { regLineChange(doc.cm, l, \"gutter\"); }\n }\n }\n\n // More lower-level change function, handling only a single document\n // (not linked ones).\n function makeChangeSingleDoc(doc, change, selAfter, spans) {\n if (doc.cm && !doc.cm.curOp)\n { return operation(doc.cm, makeChangeSingleDoc)(doc, change, selAfter, spans) }\n\n if (change.to.line < doc.first) {\n shiftDoc(doc, change.text.length - 1 - (change.to.line - change.from.line));\n return\n }\n if (change.from.line > doc.lastLine()) { return }\n\n // Clip the change to the size of this doc\n if (change.from.line < doc.first) {\n var shift = change.text.length - 1 - (doc.first - change.from.line);\n shiftDoc(doc, shift);\n change = {from: Pos(doc.first, 0), to: Pos(change.to.line + shift, change.to.ch),\n text: [lst(change.text)], origin: change.origin};\n }\n var last = doc.lastLine();\n if (change.to.line > last) {\n change = {from: change.from, to: Pos(last, getLine(doc, last).text.length),\n text: [change.text[0]], origin: change.origin};\n }\n\n change.removed = getBetween(doc, change.from, change.to);\n\n if (!selAfter) { selAfter = computeSelAfterChange(doc, change); }\n if (doc.cm) { makeChangeSingleDocInEditor(doc.cm, change, spans); }\n else { updateDoc(doc, change, spans); }\n setSelectionNoUndo(doc, selAfter, sel_dontScroll);\n\n if (doc.cantEdit && skipAtomic(doc, Pos(doc.firstLine(), 0)))\n { doc.cantEdit = false; }\n }\n\n // Handle the interaction of a change to a document with the editor\n // that this document is part of.\n function makeChangeSingleDocInEditor(cm, change, spans) {\n var doc = cm.doc, display = cm.display, from = change.from, to = change.to;\n\n var recomputeMaxLength = false, checkWidthStart = from.line;\n if (!cm.options.lineWrapping) {\n checkWidthStart = lineNo(visualLine(getLine(doc, from.line)));\n doc.iter(checkWidthStart, to.line + 1, function (line) {\n if (line == display.maxLine) {\n recomputeMaxLength = true;\n return true\n }\n });\n }\n\n if (doc.sel.contains(change.from, change.to) > -1)\n { signalCursorActivity(cm); }\n\n updateDoc(doc, change, spans, estimateHeight(cm));\n\n if (!cm.options.lineWrapping) {\n doc.iter(checkWidthStart, from.line + change.text.length, function (line) {\n var len = lineLength(line);\n if (len > display.maxLineLength) {\n display.maxLine = line;\n display.maxLineLength = len;\n display.maxLineChanged = true;\n recomputeMaxLength = false;\n }\n });\n if (recomputeMaxLength) { cm.curOp.updateMaxLine = true; }\n }\n\n retreatFrontier(doc, from.line);\n startWorker(cm, 400);\n\n var lendiff = change.text.length - (to.line - from.line) - 1;\n // Remember that these lines changed, for updating the display\n if (change.full)\n { regChange(cm); }\n else if (from.line == to.line && change.text.length == 1 && !isWholeLineUpdate(cm.doc, change))\n { regLineChange(cm, from.line, \"text\"); }\n else\n { regChange(cm, from.line, to.line + 1, lendiff); }\n\n var changesHandler = hasHandler(cm, \"changes\"), changeHandler = hasHandler(cm, \"change\");\n if (changeHandler || changesHandler) {\n var obj = {\n from: from, to: to,\n text: change.text,\n removed: change.removed,\n origin: change.origin\n };\n if (changeHandler) { signalLater(cm, \"change\", cm, obj); }\n if (changesHandler) { (cm.curOp.changeObjs || (cm.curOp.changeObjs = [])).push(obj); }\n }\n cm.display.selForContextMenu = null;\n }\n\n function replaceRange(doc, code, from, to, origin) {\n var assign;\n\n if (!to) { to = from; }\n if (cmp(to, from) < 0) { (assign = [to, from], from = assign[0], to = assign[1]); }\n if (typeof code == \"string\") { code = doc.splitLines(code); }\n makeChange(doc, {from: from, to: to, text: code, origin: origin});\n }\n\n // Rebasing/resetting history to deal with externally-sourced changes\n\n function rebaseHistSelSingle(pos, from, to, diff) {\n if (to < pos.line) {\n pos.line += diff;\n } else if (from < pos.line) {\n pos.line = from;\n pos.ch = 0;\n }\n }\n\n // Tries to rebase an array of history events given a change in the\n // document. If the change touches the same lines as the event, the\n // event, and everything 'behind' it, is discarded. If the change is\n // before the event, the event's positions are updated. Uses a\n // copy-on-write scheme for the positions, to avoid having to\n // reallocate them all on every rebase, but also avoid problems with\n // shared position objects being unsafely updated.\n function rebaseHistArray(array, from, to, diff) {\n for (var i = 0; i < array.length; ++i) {\n var sub = array[i], ok = true;\n if (sub.ranges) {\n if (!sub.copied) { sub = array[i] = sub.deepCopy(); sub.copied = true; }\n for (var j = 0; j < sub.ranges.length; j++) {\n rebaseHistSelSingle(sub.ranges[j].anchor, from, to, diff);\n rebaseHistSelSingle(sub.ranges[j].head, from, to, diff);\n }\n continue\n }\n for (var j$1 = 0; j$1 < sub.changes.length; ++j$1) {\n var cur = sub.changes[j$1];\n if (to < cur.from.line) {\n cur.from = Pos(cur.from.line + diff, cur.from.ch);\n cur.to = Pos(cur.to.line + diff, cur.to.ch);\n } else if (from <= cur.to.line) {\n ok = false;\n break\n }\n }\n if (!ok) {\n array.splice(0, i + 1);\n i = 0;\n }\n }\n }\n\n function rebaseHist(hist, change) {\n var from = change.from.line, to = change.to.line, diff = change.text.length - (to - from) - 1;\n rebaseHistArray(hist.done, from, to, diff);\n rebaseHistArray(hist.undone, from, to, diff);\n }\n\n // Utility for applying a change to a line by handle or number,\n // returning the number and optionally registering the line as\n // changed.\n function changeLine(doc, handle, changeType, op) {\n var no = handle, line = handle;\n if (typeof handle == \"number\") { line = getLine(doc, clipLine(doc, handle)); }\n else { no = lineNo(handle); }\n if (no == null) { return null }\n if (op(line, no) && doc.cm) { regLineChange(doc.cm, no, changeType); }\n return line\n }\n\n // The document is represented as a BTree consisting of leaves, with\n // chunk of lines in them, and branches, with up to ten leaves or\n // other branch nodes below them. The top node is always a branch\n // node, and is the document object itself (meaning it has\n // additional methods and properties).\n //\n // All nodes have parent links. The tree is used both to go from\n // line numbers to line objects, and to go from objects to numbers.\n // It also indexes by height, and is used to convert between height\n // and line object, and to find the total height of the document.\n //\n // See also http://marijnhaverbeke.nl/blog/codemirror-line-tree.html\n\n function LeafChunk(lines) {\n this.lines = lines;\n this.parent = null;\n var height = 0;\n for (var i = 0; i < lines.length; ++i) {\n lines[i].parent = this;\n height += lines[i].height;\n }\n this.height = height;\n }\n\n LeafChunk.prototype = {\n chunkSize: function() { return this.lines.length },\n\n // Remove the n lines at offset 'at'.\n removeInner: function(at, n) {\n for (var i = at, e = at + n; i < e; ++i) {\n var line = this.lines[i];\n this.height -= line.height;\n cleanUpLine(line);\n signalLater(line, \"delete\");\n }\n this.lines.splice(at, n);\n },\n\n // Helper used to collapse a small branch into a single leaf.\n collapse: function(lines) {\n lines.push.apply(lines, this.lines);\n },\n\n // Insert the given array of lines at offset 'at', count them as\n // having the given height.\n insertInner: function(at, lines, height) {\n this.height += height;\n this.lines = this.lines.slice(0, at).concat(lines).concat(this.lines.slice(at));\n for (var i = 0; i < lines.length; ++i) { lines[i].parent = this; }\n },\n\n // Used to iterate over a part of the tree.\n iterN: function(at, n, op) {\n for (var e = at + n; at < e; ++at)\n { if (op(this.lines[at])) { return true } }\n }\n };\n\n function BranchChunk(children) {\n this.children = children;\n var size = 0, height = 0;\n for (var i = 0; i < children.length; ++i) {\n var ch = children[i];\n size += ch.chunkSize(); height += ch.height;\n ch.parent = this;\n }\n this.size = size;\n this.height = height;\n this.parent = null;\n }\n\n BranchChunk.prototype = {\n chunkSize: function() { return this.size },\n\n removeInner: function(at, n) {\n this.size -= n;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var rm = Math.min(n, sz - at), oldHeight = child.height;\n child.removeInner(at, rm);\n this.height -= oldHeight - child.height;\n if (sz == rm) { this.children.splice(i--, 1); child.parent = null; }\n if ((n -= rm) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n // If the result is smaller than 25 lines, ensure that it is a\n // single leaf node.\n if (this.size - n < 25 &&\n (this.children.length > 1 || !(this.children[0] instanceof LeafChunk))) {\n var lines = [];\n this.collapse(lines);\n this.children = [new LeafChunk(lines)];\n this.children[0].parent = this;\n }\n },\n\n collapse: function(lines) {\n for (var i = 0; i < this.children.length; ++i) { this.children[i].collapse(lines); }\n },\n\n insertInner: function(at, lines, height) {\n this.size += lines.length;\n this.height += height;\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at <= sz) {\n child.insertInner(at, lines, height);\n if (child.lines && child.lines.length > 50) {\n // To avoid memory thrashing when child.lines is huge (e.g. first view of a large file), it's never spliced.\n // Instead, small slices are taken. They're taken in order because sequential memory accesses are fastest.\n var remaining = child.lines.length % 25 + 25;\n for (var pos = remaining; pos < child.lines.length;) {\n var leaf = new LeafChunk(child.lines.slice(pos, pos += 25));\n child.height -= leaf.height;\n this.children.splice(++i, 0, leaf);\n leaf.parent = this;\n }\n child.lines = child.lines.slice(0, remaining);\n this.maybeSpill();\n }\n break\n }\n at -= sz;\n }\n },\n\n // When a node has grown, check whether it should be split.\n maybeSpill: function() {\n if (this.children.length <= 10) { return }\n var me = this;\n do {\n var spilled = me.children.splice(me.children.length - 5, 5);\n var sibling = new BranchChunk(spilled);\n if (!me.parent) { // Become the parent node\n var copy = new BranchChunk(me.children);\n copy.parent = me;\n me.children = [copy, sibling];\n me = copy;\n } else {\n me.size -= sibling.size;\n me.height -= sibling.height;\n var myIndex = indexOf(me.parent.children, me);\n me.parent.children.splice(myIndex + 1, 0, sibling);\n }\n sibling.parent = me.parent;\n } while (me.children.length > 10)\n me.parent.maybeSpill();\n },\n\n iterN: function(at, n, op) {\n for (var i = 0; i < this.children.length; ++i) {\n var child = this.children[i], sz = child.chunkSize();\n if (at < sz) {\n var used = Math.min(n, sz - at);\n if (child.iterN(at, used, op)) { return true }\n if ((n -= used) == 0) { break }\n at = 0;\n } else { at -= sz; }\n }\n }\n };\n\n // Line widgets are block elements displayed above or below a line.\n\n var LineWidget = function(doc, node, options) {\n if (options) { for (var opt in options) { if (options.hasOwnProperty(opt))\n { this[opt] = options[opt]; } } }\n this.doc = doc;\n this.node = node;\n };\n\n LineWidget.prototype.clear = function () {\n var cm = this.doc.cm, ws = this.line.widgets, line = this.line, no = lineNo(line);\n if (no == null || !ws) { return }\n for (var i = 0; i < ws.length; ++i) { if (ws[i] == this) { ws.splice(i--, 1); } }\n if (!ws.length) { line.widgets = null; }\n var height = widgetHeight(this);\n updateLineHeight(line, Math.max(0, line.height - height));\n if (cm) {\n runInOp(cm, function () {\n adjustScrollWhenAboveVisible(cm, line, -height);\n regLineChange(cm, no, \"widget\");\n });\n signalLater(cm, \"lineWidgetCleared\", cm, this, no);\n }\n };\n\n LineWidget.prototype.changed = function () {\n var this$1 = this;\n\n var oldH = this.height, cm = this.doc.cm, line = this.line;\n this.height = null;\n var diff = widgetHeight(this) - oldH;\n if (!diff) { return }\n if (!lineIsHidden(this.doc, line)) { updateLineHeight(line, line.height + diff); }\n if (cm) {\n runInOp(cm, function () {\n cm.curOp.forceUpdate = true;\n adjustScrollWhenAboveVisible(cm, line, diff);\n signalLater(cm, \"lineWidgetChanged\", cm, this$1, lineNo(line));\n });\n }\n };\n eventMixin(LineWidget);\n\n function adjustScrollWhenAboveVisible(cm, line, diff) {\n if (heightAtLine(line) < ((cm.curOp && cm.curOp.scrollTop) || cm.doc.scrollTop))\n { addToScrollTop(cm, diff); }\n }\n\n function addLineWidget(doc, handle, node, options) {\n var widget = new LineWidget(doc, node, options);\n var cm = doc.cm;\n if (cm && widget.noHScroll) { cm.display.alignWidgets = true; }\n changeLine(doc, handle, \"widget\", function (line) {\n var widgets = line.widgets || (line.widgets = []);\n if (widget.insertAt == null) { widgets.push(widget); }\n else { widgets.splice(Math.min(widgets.length, Math.max(0, widget.insertAt)), 0, widget); }\n widget.line = line;\n if (cm && !lineIsHidden(doc, line)) {\n var aboveVisible = heightAtLine(line) < doc.scrollTop;\n updateLineHeight(line, line.height + widgetHeight(widget));\n if (aboveVisible) { addToScrollTop(cm, widget.height); }\n cm.curOp.forceUpdate = true;\n }\n return true\n });\n if (cm) { signalLater(cm, \"lineWidgetAdded\", cm, widget, typeof handle == \"number\" ? handle : lineNo(handle)); }\n return widget\n }\n\n // TEXTMARKERS\n\n // Created with markText and setBookmark methods. A TextMarker is a\n // handle that can be used to clear or find a marked position in the\n // document. Line objects hold arrays (markedSpans) containing\n // {from, to, marker} object pointing to such marker objects, and\n // indicating that such a marker is present on that line. Multiple\n // lines may point to the same marker when it spans across lines.\n // The spans will have null for their from/to properties when the\n // marker continues beyond the start/end of the line. Markers have\n // links back to the lines they currently touch.\n\n // Collapsed markers have unique ids, in order to be able to order\n // them, which is needed for uniquely determining an outer marker\n // when they overlap (they may nest, but not partially overlap).\n var nextMarkerId = 0;\n\n var TextMarker = function(doc, type) {\n this.lines = [];\n this.type = type;\n this.doc = doc;\n this.id = ++nextMarkerId;\n };\n\n // Clear the marker.\n TextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) { return }\n var cm = this.doc.cm, withOp = cm && !cm.curOp;\n if (withOp) { startOperation(cm); }\n if (hasHandler(this, \"clear\")) {\n var found = this.find();\n if (found) { signalLater(this, \"clear\", found.from, found.to); }\n }\n var min = null, max = null;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (cm && !this.collapsed) { regLineChange(cm, lineNo(line), \"text\"); }\n else if (cm) {\n if (span.to != null) { max = lineNo(line); }\n if (span.from != null) { min = lineNo(line); }\n }\n line.markedSpans = removeMarkedSpan(line.markedSpans, span);\n if (span.from == null && this.collapsed && !lineIsHidden(this.doc, line) && cm)\n { updateLineHeight(line, textHeight(cm.display)); }\n }\n if (cm && this.collapsed && !cm.options.lineWrapping) { for (var i$1 = 0; i$1 < this.lines.length; ++i$1) {\n var visual = visualLine(this.lines[i$1]), len = lineLength(visual);\n if (len > cm.display.maxLineLength) {\n cm.display.maxLine = visual;\n cm.display.maxLineLength = len;\n cm.display.maxLineChanged = true;\n }\n } }\n\n if (min != null && cm && this.collapsed) { regChange(cm, min, max + 1); }\n this.lines.length = 0;\n this.explicitlyCleared = true;\n if (this.atomic && this.doc.cantEdit) {\n this.doc.cantEdit = false;\n if (cm) { reCheckSelection(cm.doc); }\n }\n if (cm) { signalLater(cm, \"markerCleared\", cm, this, min, max); }\n if (withOp) { endOperation(cm); }\n if (this.parent) { this.parent.clear(); }\n };\n\n // Find the position of the marker in the document. Returns a {from,\n // to} object by default. Side can be passed to get a specific side\n // -- 0 (both), -1 (left), or 1 (right). When lineObj is true, the\n // Pos objects returned contain a line object, rather than a line\n // number (used to prevent looking up the same line twice).\n TextMarker.prototype.find = function (side, lineObj) {\n if (side == null && this.type == \"bookmark\") { side = 1; }\n var from, to;\n for (var i = 0; i < this.lines.length; ++i) {\n var line = this.lines[i];\n var span = getMarkedSpanFor(line.markedSpans, this);\n if (span.from != null) {\n from = Pos(lineObj ? line : lineNo(line), span.from);\n if (side == -1) { return from }\n }\n if (span.to != null) {\n to = Pos(lineObj ? line : lineNo(line), span.to);\n if (side == 1) { return to }\n }\n }\n return from && {from: from, to: to}\n };\n\n // Signals that the marker's widget changed, and surrounding layout\n // should be recomputed.\n TextMarker.prototype.changed = function () {\n var this$1 = this;\n\n var pos = this.find(-1, true), widget = this, cm = this.doc.cm;\n if (!pos || !cm) { return }\n runInOp(cm, function () {\n var line = pos.line, lineN = lineNo(pos.line);\n var view = findViewForLine(cm, lineN);\n if (view) {\n clearLineMeasurementCacheFor(view);\n cm.curOp.selectionChanged = cm.curOp.forceUpdate = true;\n }\n cm.curOp.updateMaxLine = true;\n if (!lineIsHidden(widget.doc, line) && widget.height != null) {\n var oldHeight = widget.height;\n widget.height = null;\n var dHeight = widgetHeight(widget) - oldHeight;\n if (dHeight)\n { updateLineHeight(line, line.height + dHeight); }\n }\n signalLater(cm, \"markerChanged\", cm, this$1);\n });\n };\n\n TextMarker.prototype.attachLine = function (line) {\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp;\n if (!op.maybeHiddenMarkers || indexOf(op.maybeHiddenMarkers, this) == -1)\n { (op.maybeUnhiddenMarkers || (op.maybeUnhiddenMarkers = [])).push(this); }\n }\n this.lines.push(line);\n };\n\n TextMarker.prototype.detachLine = function (line) {\n this.lines.splice(indexOf(this.lines, line), 1);\n if (!this.lines.length && this.doc.cm) {\n var op = this.doc.cm.curOp\n ;(op.maybeHiddenMarkers || (op.maybeHiddenMarkers = [])).push(this);\n }\n };\n eventMixin(TextMarker);\n\n // Create a marker, wire it up to the right lines, and\n function markText(doc, from, to, options, type) {\n // Shared markers (across linked documents) are handled separately\n // (markTextShared will call out to this again, once per\n // document).\n if (options && options.shared) { return markTextShared(doc, from, to, options, type) }\n // Ensure we are in an operation.\n if (doc.cm && !doc.cm.curOp) { return operation(doc.cm, markText)(doc, from, to, options, type) }\n\n var marker = new TextMarker(doc, type), diff = cmp(from, to);\n if (options) { copyObj(options, marker, false); }\n // Don't connect empty markers unless clearWhenEmpty is false\n if (diff > 0 || diff == 0 && marker.clearWhenEmpty !== false)\n { return marker }\n if (marker.replacedWith) {\n // Showing up as a widget implies collapsed (widget replaces text)\n marker.collapsed = true;\n marker.widgetNode = eltP(\"span\", [marker.replacedWith], \"CodeMirror-widget\");\n if (!options.handleMouseEvents) { marker.widgetNode.setAttribute(\"cm-ignore-events\", \"true\"); }\n if (options.insertLeft) { marker.widgetNode.insertLeft = true; }\n }\n if (marker.collapsed) {\n if (conflictingCollapsedRange(doc, from.line, from, to, marker) ||\n from.line != to.line && conflictingCollapsedRange(doc, to.line, from, to, marker))\n { throw new Error(\"Inserting collapsed marker partially overlapping an existing one\") }\n seeCollapsedSpans();\n }\n\n if (marker.addToHistory)\n { addChangeToHistory(doc, {from: from, to: to, origin: \"markText\"}, doc.sel, NaN); }\n\n var curLine = from.line, cm = doc.cm, updateMaxLine;\n doc.iter(curLine, to.line + 1, function (line) {\n if (cm && marker.collapsed && !cm.options.lineWrapping && visualLine(line) == cm.display.maxLine)\n { updateMaxLine = true; }\n if (marker.collapsed && curLine != from.line) { updateLineHeight(line, 0); }\n addMarkedSpan(line, new MarkedSpan(marker,\n curLine == from.line ? from.ch : null,\n curLine == to.line ? to.ch : null), doc.cm && doc.cm.curOp);\n ++curLine;\n });\n // lineIsHidden depends on the presence of the spans, so needs a second pass\n if (marker.collapsed) { doc.iter(from.line, to.line + 1, function (line) {\n if (lineIsHidden(doc, line)) { updateLineHeight(line, 0); }\n }); }\n\n if (marker.clearOnEnter) { on(marker, \"beforeCursorEnter\", function () { return marker.clear(); }); }\n\n if (marker.readOnly) {\n seeReadOnlySpans();\n if (doc.history.done.length || doc.history.undone.length)\n { doc.clearHistory(); }\n }\n if (marker.collapsed) {\n marker.id = ++nextMarkerId;\n marker.atomic = true;\n }\n if (cm) {\n // Sync editor state\n if (updateMaxLine) { cm.curOp.updateMaxLine = true; }\n if (marker.collapsed)\n { regChange(cm, from.line, to.line + 1); }\n else if (marker.className || marker.startStyle || marker.endStyle || marker.css ||\n marker.attributes || marker.title)\n { for (var i = from.line; i <= to.line; i++) { regLineChange(cm, i, \"text\"); } }\n if (marker.atomic) { reCheckSelection(cm.doc); }\n signalLater(cm, \"markerAdded\", cm, marker);\n }\n return marker\n }\n\n // SHARED TEXTMARKERS\n\n // A shared marker spans multiple linked documents. It is\n // implemented as a meta-marker-object controlling multiple normal\n // markers.\n var SharedTextMarker = function(markers, primary) {\n this.markers = markers;\n this.primary = primary;\n for (var i = 0; i < markers.length; ++i)\n { markers[i].parent = this; }\n };\n\n SharedTextMarker.prototype.clear = function () {\n if (this.explicitlyCleared) { return }\n this.explicitlyCleared = true;\n for (var i = 0; i < this.markers.length; ++i)\n { this.markers[i].clear(); }\n signalLater(this, \"clear\");\n };\n\n SharedTextMarker.prototype.find = function (side, lineObj) {\n return this.primary.find(side, lineObj)\n };\n eventMixin(SharedTextMarker);\n\n function markTextShared(doc, from, to, options, type) {\n options = copyObj(options);\n options.shared = false;\n var markers = [markText(doc, from, to, options, type)], primary = markers[0];\n var widget = options.widgetNode;\n linkedDocs(doc, function (doc) {\n if (widget) { options.widgetNode = widget.cloneNode(true); }\n markers.push(markText(doc, clipPos(doc, from), clipPos(doc, to), options, type));\n for (var i = 0; i < doc.linked.length; ++i)\n { if (doc.linked[i].isParent) { return } }\n primary = lst(markers);\n });\n return new SharedTextMarker(markers, primary)\n }\n\n function findSharedMarkers(doc) {\n return doc.findMarks(Pos(doc.first, 0), doc.clipPos(Pos(doc.lastLine())), function (m) { return m.parent; })\n }\n\n function copySharedMarkers(doc, markers) {\n for (var i = 0; i < markers.length; i++) {\n var marker = markers[i], pos = marker.find();\n var mFrom = doc.clipPos(pos.from), mTo = doc.clipPos(pos.to);\n if (cmp(mFrom, mTo)) {\n var subMark = markText(doc, mFrom, mTo, marker.primary, marker.primary.type);\n marker.markers.push(subMark);\n subMark.parent = marker;\n }\n }\n }\n\n function detachSharedMarkers(markers) {\n var loop = function ( i ) {\n var marker = markers[i], linked = [marker.primary.doc];\n linkedDocs(marker.primary.doc, function (d) { return linked.push(d); });\n for (var j = 0; j < marker.markers.length; j++) {\n var subMarker = marker.markers[j];\n if (indexOf(linked, subMarker.doc) == -1) {\n subMarker.parent = null;\n marker.markers.splice(j--, 1);\n }\n }\n };\n\n for (var i = 0; i < markers.length; i++) loop( i );\n }\n\n var nextDocId = 0;\n var Doc = function(text, mode, firstLine, lineSep, direction) {\n if (!(this instanceof Doc)) { return new Doc(text, mode, firstLine, lineSep, direction) }\n if (firstLine == null) { firstLine = 0; }\n\n BranchChunk.call(this, [new LeafChunk([new Line(\"\", null)])]);\n this.first = firstLine;\n this.scrollTop = this.scrollLeft = 0;\n this.cantEdit = false;\n this.cleanGeneration = 1;\n this.modeFrontier = this.highlightFrontier = firstLine;\n var start = Pos(firstLine, 0);\n this.sel = simpleSelection(start);\n this.history = new History(null);\n this.id = ++nextDocId;\n this.modeOption = mode;\n this.lineSep = lineSep;\n this.direction = (direction == \"rtl\") ? \"rtl\" : \"ltr\";\n this.extend = false;\n\n if (typeof text == \"string\") { text = this.splitLines(text); }\n updateDoc(this, {from: start, to: start, text: text});\n setSelection(this, simpleSelection(start), sel_dontScroll);\n };\n\n Doc.prototype = createObj(BranchChunk.prototype, {\n constructor: Doc,\n // Iterate over the document. Supports two forms -- with only one\n // argument, it calls that for each line in the document. With\n // three, it iterates over the range given by the first two (with\n // the second being non-inclusive).\n iter: function(from, to, op) {\n if (op) { this.iterN(from - this.first, to - from, op); }\n else { this.iterN(this.first, this.first + this.size, from); }\n },\n\n // Non-public interface for adding and removing lines.\n insert: function(at, lines) {\n var height = 0;\n for (var i = 0; i < lines.length; ++i) { height += lines[i].height; }\n this.insertInner(at - this.first, lines, height);\n },\n remove: function(at, n) { this.removeInner(at - this.first, n); },\n\n // From here, the methods are part of the public interface. Most\n // are also available from CodeMirror (editor) instances.\n\n getValue: function(lineSep) {\n var lines = getLines(this, this.first, this.first + this.size);\n if (lineSep === false) { return lines }\n return lines.join(lineSep || this.lineSeparator())\n },\n setValue: docMethodOp(function(code) {\n var top = Pos(this.first, 0), last = this.first + this.size - 1;\n makeChange(this, {from: top, to: Pos(last, getLine(this, last).text.length),\n text: this.splitLines(code), origin: \"setValue\", full: true}, true);\n if (this.cm) { scrollToCoords(this.cm, 0, 0); }\n setSelection(this, simpleSelection(top), sel_dontScroll);\n }),\n replaceRange: function(code, from, to, origin) {\n from = clipPos(this, from);\n to = to ? clipPos(this, to) : from;\n replaceRange(this, code, from, to, origin);\n },\n getRange: function(from, to, lineSep) {\n var lines = getBetween(this, clipPos(this, from), clipPos(this, to));\n if (lineSep === false) { return lines }\n if (lineSep === '') { return lines.join('') }\n return lines.join(lineSep || this.lineSeparator())\n },\n\n getLine: function(line) {var l = this.getLineHandle(line); return l && l.text},\n\n getLineHandle: function(line) {if (isLine(this, line)) { return getLine(this, line) }},\n getLineNumber: function(line) {return lineNo(line)},\n\n getLineHandleVisualStart: function(line) {\n if (typeof line == \"number\") { line = getLine(this, line); }\n return visualLine(line)\n },\n\n lineCount: function() {return this.size},\n firstLine: function() {return this.first},\n lastLine: function() {return this.first + this.size - 1},\n\n clipPos: function(pos) {return clipPos(this, pos)},\n\n getCursor: function(start) {\n var range = this.sel.primary(), pos;\n if (start == null || start == \"head\") { pos = range.head; }\n else if (start == \"anchor\") { pos = range.anchor; }\n else if (start == \"end\" || start == \"to\" || start === false) { pos = range.to(); }\n else { pos = range.from(); }\n return pos\n },\n listSelections: function() { return this.sel.ranges },\n somethingSelected: function() {return this.sel.somethingSelected()},\n\n setCursor: docMethodOp(function(line, ch, options) {\n setSimpleSelection(this, clipPos(this, typeof line == \"number\" ? Pos(line, ch || 0) : line), null, options);\n }),\n setSelection: docMethodOp(function(anchor, head, options) {\n setSimpleSelection(this, clipPos(this, anchor), clipPos(this, head || anchor), options);\n }),\n extendSelection: docMethodOp(function(head, other, options) {\n extendSelection(this, clipPos(this, head), other && clipPos(this, other), options);\n }),\n extendSelections: docMethodOp(function(heads, options) {\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n extendSelectionsBy: docMethodOp(function(f, options) {\n var heads = map(this.sel.ranges, f);\n extendSelections(this, clipPosArray(this, heads), options);\n }),\n setSelections: docMethodOp(function(ranges, primary, options) {\n if (!ranges.length) { return }\n var out = [];\n for (var i = 0; i < ranges.length; i++)\n { out[i] = new Range(clipPos(this, ranges[i].anchor),\n clipPos(this, ranges[i].head || ranges[i].anchor)); }\n if (primary == null) { primary = Math.min(ranges.length - 1, this.sel.primIndex); }\n setSelection(this, normalizeSelection(this.cm, out, primary), options);\n }),\n addSelection: docMethodOp(function(anchor, head, options) {\n var ranges = this.sel.ranges.slice(0);\n ranges.push(new Range(clipPos(this, anchor), clipPos(this, head || anchor)));\n setSelection(this, normalizeSelection(this.cm, ranges, ranges.length - 1), options);\n }),\n\n getSelection: function(lineSep) {\n var ranges = this.sel.ranges, lines;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n lines = lines ? lines.concat(sel) : sel;\n }\n if (lineSep === false) { return lines }\n else { return lines.join(lineSep || this.lineSeparator()) }\n },\n getSelections: function(lineSep) {\n var parts = [], ranges = this.sel.ranges;\n for (var i = 0; i < ranges.length; i++) {\n var sel = getBetween(this, ranges[i].from(), ranges[i].to());\n if (lineSep !== false) { sel = sel.join(lineSep || this.lineSeparator()); }\n parts[i] = sel;\n }\n return parts\n },\n replaceSelection: function(code, collapse, origin) {\n var dup = [];\n for (var i = 0; i < this.sel.ranges.length; i++)\n { dup[i] = code; }\n this.replaceSelections(dup, collapse, origin || \"+input\");\n },\n replaceSelections: docMethodOp(function(code, collapse, origin) {\n var changes = [], sel = this.sel;\n for (var i = 0; i < sel.ranges.length; i++) {\n var range = sel.ranges[i];\n changes[i] = {from: range.from(), to: range.to(), text: this.splitLines(code[i]), origin: origin};\n }\n var newSel = collapse && collapse != \"end\" && computeReplacedSel(this, changes, collapse);\n for (var i$1 = changes.length - 1; i$1 >= 0; i$1--)\n { makeChange(this, changes[i$1]); }\n if (newSel) { setSelectionReplaceHistory(this, newSel); }\n else if (this.cm) { ensureCursorVisible(this.cm); }\n }),\n undo: docMethodOp(function() {makeChangeFromHistory(this, \"undo\");}),\n redo: docMethodOp(function() {makeChangeFromHistory(this, \"redo\");}),\n undoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"undo\", true);}),\n redoSelection: docMethodOp(function() {makeChangeFromHistory(this, \"redo\", true);}),\n\n setExtending: function(val) {this.extend = val;},\n getExtending: function() {return this.extend},\n\n historySize: function() {\n var hist = this.history, done = 0, undone = 0;\n for (var i = 0; i < hist.done.length; i++) { if (!hist.done[i].ranges) { ++done; } }\n for (var i$1 = 0; i$1 < hist.undone.length; i$1++) { if (!hist.undone[i$1].ranges) { ++undone; } }\n return {undo: done, redo: undone}\n },\n clearHistory: function() {\n var this$1 = this;\n\n this.history = new History(this.history);\n linkedDocs(this, function (doc) { return doc.history = this$1.history; }, true);\n },\n\n markClean: function() {\n this.cleanGeneration = this.changeGeneration(true);\n },\n changeGeneration: function(forceSplit) {\n if (forceSplit)\n { this.history.lastOp = this.history.lastSelOp = this.history.lastOrigin = null; }\n return this.history.generation\n },\n isClean: function (gen) {\n return this.history.generation == (gen || this.cleanGeneration)\n },\n\n getHistory: function() {\n return {done: copyHistoryArray(this.history.done),\n undone: copyHistoryArray(this.history.undone)}\n },\n setHistory: function(histData) {\n var hist = this.history = new History(this.history);\n hist.done = copyHistoryArray(histData.done.slice(0), null, true);\n hist.undone = copyHistoryArray(histData.undone.slice(0), null, true);\n },\n\n setGutterMarker: docMethodOp(function(line, gutterID, value) {\n return changeLine(this, line, \"gutter\", function (line) {\n var markers = line.gutterMarkers || (line.gutterMarkers = {});\n markers[gutterID] = value;\n if (!value && isEmpty(markers)) { line.gutterMarkers = null; }\n return true\n })\n }),\n\n clearGutter: docMethodOp(function(gutterID) {\n var this$1 = this;\n\n this.iter(function (line) {\n if (line.gutterMarkers && line.gutterMarkers[gutterID]) {\n changeLine(this$1, line, \"gutter\", function () {\n line.gutterMarkers[gutterID] = null;\n if (isEmpty(line.gutterMarkers)) { line.gutterMarkers = null; }\n return true\n });\n }\n });\n }),\n\n lineInfo: function(line) {\n var n;\n if (typeof line == \"number\") {\n if (!isLine(this, line)) { return null }\n n = line;\n line = getLine(this, line);\n if (!line) { return null }\n } else {\n n = lineNo(line);\n if (n == null) { return null }\n }\n return {line: n, handle: line, text: line.text, gutterMarkers: line.gutterMarkers,\n textClass: line.textClass, bgClass: line.bgClass, wrapClass: line.wrapClass,\n widgets: line.widgets}\n },\n\n addLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n if (!line[prop]) { line[prop] = cls; }\n else if (classTest(cls).test(line[prop])) { return false }\n else { line[prop] += \" \" + cls; }\n return true\n })\n }),\n removeLineClass: docMethodOp(function(handle, where, cls) {\n return changeLine(this, handle, where == \"gutter\" ? \"gutter\" : \"class\", function (line) {\n var prop = where == \"text\" ? \"textClass\"\n : where == \"background\" ? \"bgClass\"\n : where == \"gutter\" ? \"gutterClass\" : \"wrapClass\";\n var cur = line[prop];\n if (!cur) { return false }\n else if (cls == null) { line[prop] = null; }\n else {\n var found = cur.match(classTest(cls));\n if (!found) { return false }\n var end = found.index + found[0].length;\n line[prop] = cur.slice(0, found.index) + (!found.index || end == cur.length ? \"\" : \" \") + cur.slice(end) || null;\n }\n return true\n })\n }),\n\n addLineWidget: docMethodOp(function(handle, node, options) {\n return addLineWidget(this, handle, node, options)\n }),\n removeLineWidget: function(widget) { widget.clear(); },\n\n markText: function(from, to, options) {\n return markText(this, clipPos(this, from), clipPos(this, to), options, options && options.type || \"range\")\n },\n setBookmark: function(pos, options) {\n var realOpts = {replacedWith: options && (options.nodeType == null ? options.widget : options),\n insertLeft: options && options.insertLeft,\n clearWhenEmpty: false, shared: options && options.shared,\n handleMouseEvents: options && options.handleMouseEvents};\n pos = clipPos(this, pos);\n return markText(this, pos, pos, realOpts, \"bookmark\")\n },\n findMarksAt: function(pos) {\n pos = clipPos(this, pos);\n var markers = [], spans = getLine(this, pos.line).markedSpans;\n if (spans) { for (var i = 0; i < spans.length; ++i) {\n var span = spans[i];\n if ((span.from == null || span.from <= pos.ch) &&\n (span.to == null || span.to >= pos.ch))\n { markers.push(span.marker.parent || span.marker); }\n } }\n return markers\n },\n findMarks: function(from, to, filter) {\n from = clipPos(this, from); to = clipPos(this, to);\n var found = [], lineNo = from.line;\n this.iter(from.line, to.line + 1, function (line) {\n var spans = line.markedSpans;\n if (spans) { for (var i = 0; i < spans.length; i++) {\n var span = spans[i];\n if (!(span.to != null && lineNo == from.line && from.ch >= span.to ||\n span.from == null && lineNo != from.line ||\n span.from != null && lineNo == to.line && span.from >= to.ch) &&\n (!filter || filter(span.marker)))\n { found.push(span.marker.parent || span.marker); }\n } }\n ++lineNo;\n });\n return found\n },\n getAllMarks: function() {\n var markers = [];\n this.iter(function (line) {\n var sps = line.markedSpans;\n if (sps) { for (var i = 0; i < sps.length; ++i)\n { if (sps[i].from != null) { markers.push(sps[i].marker); } } }\n });\n return markers\n },\n\n posFromIndex: function(off) {\n var ch, lineNo = this.first, sepSize = this.lineSeparator().length;\n this.iter(function (line) {\n var sz = line.text.length + sepSize;\n if (sz > off) { ch = off; return true }\n off -= sz;\n ++lineNo;\n });\n return clipPos(this, Pos(lineNo, ch))\n },\n indexFromPos: function (coords) {\n coords = clipPos(this, coords);\n var index = coords.ch;\n if (coords.line < this.first || coords.ch < 0) { return 0 }\n var sepSize = this.lineSeparator().length;\n this.iter(this.first, coords.line, function (line) { // iter aborts when callback returns a truthy value\n index += line.text.length + sepSize;\n });\n return index\n },\n\n copy: function(copyHistory) {\n var doc = new Doc(getLines(this, this.first, this.first + this.size),\n this.modeOption, this.first, this.lineSep, this.direction);\n doc.scrollTop = this.scrollTop; doc.scrollLeft = this.scrollLeft;\n doc.sel = this.sel;\n doc.extend = false;\n if (copyHistory) {\n doc.history.undoDepth = this.history.undoDepth;\n doc.setHistory(this.getHistory());\n }\n return doc\n },\n\n linkedDoc: function(options) {\n if (!options) { options = {}; }\n var from = this.first, to = this.first + this.size;\n if (options.from != null && options.from > from) { from = options.from; }\n if (options.to != null && options.to < to) { to = options.to; }\n var copy = new Doc(getLines(this, from, to), options.mode || this.modeOption, from, this.lineSep, this.direction);\n if (options.sharedHist) { copy.history = this.history\n ; }(this.linked || (this.linked = [])).push({doc: copy, sharedHist: options.sharedHist});\n copy.linked = [{doc: this, isParent: true, sharedHist: options.sharedHist}];\n copySharedMarkers(copy, findSharedMarkers(this));\n return copy\n },\n unlinkDoc: function(other) {\n if (other instanceof CodeMirror) { other = other.doc; }\n if (this.linked) { for (var i = 0; i < this.linked.length; ++i) {\n var link = this.linked[i];\n if (link.doc != other) { continue }\n this.linked.splice(i, 1);\n other.unlinkDoc(this);\n detachSharedMarkers(findSharedMarkers(this));\n break\n } }\n // If the histories were shared, split them again\n if (other.history == this.history) {\n var splitIds = [other.id];\n linkedDocs(other, function (doc) { return splitIds.push(doc.id); }, true);\n other.history = new History(null);\n other.history.done = copyHistoryArray(this.history.done, splitIds);\n other.history.undone = copyHistoryArray(this.history.undone, splitIds);\n }\n },\n iterLinkedDocs: function(f) {linkedDocs(this, f);},\n\n getMode: function() {return this.mode},\n getEditor: function() {return this.cm},\n\n splitLines: function(str) {\n if (this.lineSep) { return str.split(this.lineSep) }\n return splitLinesAuto(str)\n },\n lineSeparator: function() { return this.lineSep || \"\\n\" },\n\n setDirection: docMethodOp(function (dir) {\n if (dir != \"rtl\") { dir = \"ltr\"; }\n if (dir == this.direction) { return }\n this.direction = dir;\n this.iter(function (line) { return line.order = null; });\n if (this.cm) { directionChanged(this.cm); }\n })\n });\n\n // Public alias.\n Doc.prototype.eachLine = Doc.prototype.iter;\n\n // Kludge to work around strange IE behavior where it'll sometimes\n // re-fire a series of drag-related events right after the drop (#1551)\n var lastDrop = 0;\n\n function onDrop(e) {\n var cm = this;\n clearDragCursor(cm);\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e))\n { return }\n e_preventDefault(e);\n if (ie) { lastDrop = +new Date; }\n var pos = posFromMouse(cm, e, true), files = e.dataTransfer.files;\n if (!pos || cm.isReadOnly()) { return }\n // Might be a file drop, in which case we simply extract the text\n // and insert it.\n if (files && files.length && window.FileReader && window.File) {\n var n = files.length, text = Array(n), read = 0;\n var markAsReadAndPasteIfAllFilesAreRead = function () {\n if (++read == n) {\n operation(cm, function () {\n pos = clipPos(cm.doc, pos);\n var change = {from: pos, to: pos,\n text: cm.doc.splitLines(\n text.filter(function (t) { return t != null; }).join(cm.doc.lineSeparator())),\n origin: \"paste\"};\n makeChange(cm.doc, change);\n setSelectionReplaceHistory(cm.doc, simpleSelection(clipPos(cm.doc, pos), clipPos(cm.doc, changeEnd(change))));\n })();\n }\n };\n var readTextFromFile = function (file, i) {\n if (cm.options.allowDropFileTypes &&\n indexOf(cm.options.allowDropFileTypes, file.type) == -1) {\n markAsReadAndPasteIfAllFilesAreRead();\n return\n }\n var reader = new FileReader;\n reader.onerror = function () { return markAsReadAndPasteIfAllFilesAreRead(); };\n reader.onload = function () {\n var content = reader.result;\n if (/[\\x00-\\x08\\x0e-\\x1f]{2}/.test(content)) {\n markAsReadAndPasteIfAllFilesAreRead();\n return\n }\n text[i] = content;\n markAsReadAndPasteIfAllFilesAreRead();\n };\n reader.readAsText(file);\n };\n for (var i = 0; i < files.length; i++) { readTextFromFile(files[i], i); }\n } else { // Normal drop\n // Don't do a replace if the drop happened inside of the selected text.\n if (cm.state.draggingText && cm.doc.sel.contains(pos) > -1) {\n cm.state.draggingText(e);\n // Ensure the editor is re-focused\n setTimeout(function () { return cm.display.input.focus(); }, 20);\n return\n }\n try {\n var text$1 = e.dataTransfer.getData(\"Text\");\n if (text$1) {\n var selected;\n if (cm.state.draggingText && !cm.state.draggingText.copy)\n { selected = cm.listSelections(); }\n setSelectionNoUndo(cm.doc, simpleSelection(pos, pos));\n if (selected) { for (var i$1 = 0; i$1 < selected.length; ++i$1)\n { replaceRange(cm.doc, \"\", selected[i$1].anchor, selected[i$1].head, \"drag\"); } }\n cm.replaceSelection(text$1, \"around\", \"paste\");\n cm.display.input.focus();\n }\n }\n catch(e$1){}\n }\n }\n\n function onDragStart(cm, e) {\n if (ie && (!cm.state.draggingText || +new Date - lastDrop < 100)) { e_stop(e); return }\n if (signalDOMEvent(cm, e) || eventInWidget(cm.display, e)) { return }\n\n e.dataTransfer.setData(\"Text\", cm.getSelection());\n e.dataTransfer.effectAllowed = \"copyMove\";\n\n // Use dummy image instead of default browsers image.\n // Recent Safari (~6.0.2) have a tendency to segfault when this happens, so we don't do it there.\n if (e.dataTransfer.setDragImage && !safari) {\n var img = elt(\"img\", null, null, \"position: fixed; left: 0; top: 0;\");\n img.src = \"data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==\";\n if (presto) {\n img.width = img.height = 1;\n cm.display.wrapper.appendChild(img);\n // Force a relayout, or Opera won't use our image for some obscure reason\n img._top = img.offsetTop;\n }\n e.dataTransfer.setDragImage(img, 0, 0);\n if (presto) { img.parentNode.removeChild(img); }\n }\n }\n\n function onDragOver(cm, e) {\n var pos = posFromMouse(cm, e);\n if (!pos) { return }\n var frag = document.createDocumentFragment();\n drawSelectionCursor(cm, pos, frag);\n if (!cm.display.dragCursor) {\n cm.display.dragCursor = elt(\"div\", null, \"CodeMirror-cursors CodeMirror-dragcursors\");\n cm.display.lineSpace.insertBefore(cm.display.dragCursor, cm.display.cursorDiv);\n }\n removeChildrenAndAdd(cm.display.dragCursor, frag);\n }\n\n function clearDragCursor(cm) {\n if (cm.display.dragCursor) {\n cm.display.lineSpace.removeChild(cm.display.dragCursor);\n cm.display.dragCursor = null;\n }\n }\n\n // These must be handled carefully, because naively registering a\n // handler for each editor will cause the editors to never be\n // garbage collected.\n\n function forEachCodeMirror(f) {\n if (!document.getElementsByClassName) { return }\n var byClass = document.getElementsByClassName(\"CodeMirror\"), editors = [];\n for (var i = 0; i < byClass.length; i++) {\n var cm = byClass[i].CodeMirror;\n if (cm) { editors.push(cm); }\n }\n if (editors.length) { editors[0].operation(function () {\n for (var i = 0; i < editors.length; i++) { f(editors[i]); }\n }); }\n }\n\n var globalsRegistered = false;\n function ensureGlobalHandlers() {\n if (globalsRegistered) { return }\n registerGlobalHandlers();\n globalsRegistered = true;\n }\n function registerGlobalHandlers() {\n // When the window resizes, we need to refresh active editors.\n var resizeTimer;\n on(window, \"resize\", function () {\n if (resizeTimer == null) { resizeTimer = setTimeout(function () {\n resizeTimer = null;\n forEachCodeMirror(onResize);\n }, 100); }\n });\n // When the window loses focus, we want to show the editor as blurred\n on(window, \"blur\", function () { return forEachCodeMirror(onBlur); });\n }\n // Called when the window resizes\n function onResize(cm) {\n var d = cm.display;\n // Might be a text scaling operation, clear size caches.\n d.cachedCharWidth = d.cachedTextHeight = d.cachedPaddingH = null;\n d.scrollbarsClipped = false;\n cm.setSize();\n }\n\n var keyNames = {\n 3: \"Pause\", 8: \"Backspace\", 9: \"Tab\", 13: \"Enter\", 16: \"Shift\", 17: \"Ctrl\", 18: \"Alt\",\n 19: \"Pause\", 20: \"CapsLock\", 27: \"Esc\", 32: \"Space\", 33: \"PageUp\", 34: \"PageDown\", 35: \"End\",\n 36: \"Home\", 37: \"Left\", 38: \"Up\", 39: \"Right\", 40: \"Down\", 44: \"PrintScrn\", 45: \"Insert\",\n 46: \"Delete\", 59: \";\", 61: \"=\", 91: \"Mod\", 92: \"Mod\", 93: \"Mod\",\n 106: \"*\", 107: \"=\", 109: \"-\", 110: \".\", 111: \"/\", 145: \"ScrollLock\",\n 173: \"-\", 186: \";\", 187: \"=\", 188: \",\", 189: \"-\", 190: \".\", 191: \"/\", 192: \"`\", 219: \"[\", 220: \"\\\\\",\n 221: \"]\", 222: \"'\", 224: \"Mod\", 63232: \"Up\", 63233: \"Down\", 63234: \"Left\", 63235: \"Right\", 63272: \"Delete\",\n 63273: \"Home\", 63275: \"End\", 63276: \"PageUp\", 63277: \"PageDown\", 63302: \"Insert\"\n };\n\n // Number keys\n for (var i = 0; i < 10; i++) { keyNames[i + 48] = keyNames[i + 96] = String(i); }\n // Alphabetic keys\n for (var i$1 = 65; i$1 <= 90; i$1++) { keyNames[i$1] = String.fromCharCode(i$1); }\n // Function keys\n for (var i$2 = 1; i$2 <= 12; i$2++) { keyNames[i$2 + 111] = keyNames[i$2 + 63235] = \"F\" + i$2; }\n\n var keyMap = {};\n\n keyMap.basic = {\n \"Left\": \"goCharLeft\", \"Right\": \"goCharRight\", \"Up\": \"goLineUp\", \"Down\": \"goLineDown\",\n \"End\": \"goLineEnd\", \"Home\": \"goLineStartSmart\", \"PageUp\": \"goPageUp\", \"PageDown\": \"goPageDown\",\n \"Delete\": \"delCharAfter\", \"Backspace\": \"delCharBefore\", \"Shift-Backspace\": \"delCharBefore\",\n \"Tab\": \"defaultTab\", \"Shift-Tab\": \"indentAuto\",\n \"Enter\": \"newlineAndIndent\", \"Insert\": \"toggleOverwrite\",\n \"Esc\": \"singleSelection\"\n };\n // Note that the save and find-related commands aren't defined by\n // default. User code or addons can define them. Unknown commands\n // are simply ignored.\n keyMap.pcDefault = {\n \"Ctrl-A\": \"selectAll\", \"Ctrl-D\": \"deleteLine\", \"Ctrl-Z\": \"undo\", \"Shift-Ctrl-Z\": \"redo\", \"Ctrl-Y\": \"redo\",\n \"Ctrl-Home\": \"goDocStart\", \"Ctrl-End\": \"goDocEnd\", \"Ctrl-Up\": \"goLineUp\", \"Ctrl-Down\": \"goLineDown\",\n \"Ctrl-Left\": \"goGroupLeft\", \"Ctrl-Right\": \"goGroupRight\", \"Alt-Left\": \"goLineStart\", \"Alt-Right\": \"goLineEnd\",\n \"Ctrl-Backspace\": \"delGroupBefore\", \"Ctrl-Delete\": \"delGroupAfter\", \"Ctrl-S\": \"save\", \"Ctrl-F\": \"find\",\n \"Ctrl-G\": \"findNext\", \"Shift-Ctrl-G\": \"findPrev\", \"Shift-Ctrl-F\": \"replace\", \"Shift-Ctrl-R\": \"replaceAll\",\n \"Ctrl-[\": \"indentLess\", \"Ctrl-]\": \"indentMore\",\n \"Ctrl-U\": \"undoSelection\", \"Shift-Ctrl-U\": \"redoSelection\", \"Alt-U\": \"redoSelection\",\n \"fallthrough\": \"basic\"\n };\n // Very basic readline/emacs-style bindings, which are standard on Mac.\n keyMap.emacsy = {\n \"Ctrl-F\": \"goCharRight\", \"Ctrl-B\": \"goCharLeft\", \"Ctrl-P\": \"goLineUp\", \"Ctrl-N\": \"goLineDown\",\n \"Ctrl-A\": \"goLineStart\", \"Ctrl-E\": \"goLineEnd\", \"Ctrl-V\": \"goPageDown\", \"Shift-Ctrl-V\": \"goPageUp\",\n \"Ctrl-D\": \"delCharAfter\", \"Ctrl-H\": \"delCharBefore\", \"Alt-Backspace\": \"delWordBefore\", \"Ctrl-K\": \"killLine\",\n \"Ctrl-T\": \"transposeChars\", \"Ctrl-O\": \"openLine\"\n };\n keyMap.macDefault = {\n \"Cmd-A\": \"selectAll\", \"Cmd-D\": \"deleteLine\", \"Cmd-Z\": \"undo\", \"Shift-Cmd-Z\": \"redo\", \"Cmd-Y\": \"redo\",\n \"Cmd-Home\": \"goDocStart\", \"Cmd-Up\": \"goDocStart\", \"Cmd-End\": \"goDocEnd\", \"Cmd-Down\": \"goDocEnd\", \"Alt-Left\": \"goGroupLeft\",\n \"Alt-Right\": \"goGroupRight\", \"Cmd-Left\": \"goLineLeft\", \"Cmd-Right\": \"goLineRight\", \"Alt-Backspace\": \"delGroupBefore\",\n \"Ctrl-Alt-Backspace\": \"delGroupAfter\", \"Alt-Delete\": \"delGroupAfter\", \"Cmd-S\": \"save\", \"Cmd-F\": \"find\",\n \"Cmd-G\": \"findNext\", \"Shift-Cmd-G\": \"findPrev\", \"Cmd-Alt-F\": \"replace\", \"Shift-Cmd-Alt-F\": \"replaceAll\",\n \"Cmd-[\": \"indentLess\", \"Cmd-]\": \"indentMore\", \"Cmd-Backspace\": \"delWrappedLineLeft\", \"Cmd-Delete\": \"delWrappedLineRight\",\n \"Cmd-U\": \"undoSelection\", \"Shift-Cmd-U\": \"redoSelection\", \"Ctrl-Up\": \"goDocStart\", \"Ctrl-Down\": \"goDocEnd\",\n \"fallthrough\": [\"basic\", \"emacsy\"]\n };\n keyMap[\"default\"] = mac ? keyMap.macDefault : keyMap.pcDefault;\n\n // KEYMAP DISPATCH\n\n function normalizeKeyName(name) {\n var parts = name.split(/-(?!$)/);\n name = parts[parts.length - 1];\n var alt, ctrl, shift, cmd;\n for (var i = 0; i < parts.length - 1; i++) {\n var mod = parts[i];\n if (/^(cmd|meta|m)$/i.test(mod)) { cmd = true; }\n else if (/^a(lt)?$/i.test(mod)) { alt = true; }\n else if (/^(c|ctrl|control)$/i.test(mod)) { ctrl = true; }\n else if (/^s(hift)?$/i.test(mod)) { shift = true; }\n else { throw new Error(\"Unrecognized modifier name: \" + mod) }\n }\n if (alt) { name = \"Alt-\" + name; }\n if (ctrl) { name = \"Ctrl-\" + name; }\n if (cmd) { name = \"Cmd-\" + name; }\n if (shift) { name = \"Shift-\" + name; }\n return name\n }\n\n // This is a kludge to keep keymaps mostly working as raw objects\n // (backwards compatibility) while at the same time support features\n // like normalization and multi-stroke key bindings. It compiles a\n // new normalized keymap, and then updates the old object to reflect\n // this.\n function normalizeKeyMap(keymap) {\n var copy = {};\n for (var keyname in keymap) { if (keymap.hasOwnProperty(keyname)) {\n var value = keymap[keyname];\n if (/^(name|fallthrough|(de|at)tach)$/.test(keyname)) { continue }\n if (value == \"...\") { delete keymap[keyname]; continue }\n\n var keys = map(keyname.split(\" \"), normalizeKeyName);\n for (var i = 0; i < keys.length; i++) {\n var val = (void 0), name = (void 0);\n if (i == keys.length - 1) {\n name = keys.join(\" \");\n val = value;\n } else {\n name = keys.slice(0, i + 1).join(\" \");\n val = \"...\";\n }\n var prev = copy[name];\n if (!prev) { copy[name] = val; }\n else if (prev != val) { throw new Error(\"Inconsistent bindings for \" + name) }\n }\n delete keymap[keyname];\n } }\n for (var prop in copy) { keymap[prop] = copy[prop]; }\n return keymap\n }\n\n function lookupKey(key, map, handle, context) {\n map = getKeyMap(map);\n var found = map.call ? map.call(key, context) : map[key];\n if (found === false) { return \"nothing\" }\n if (found === \"...\") { return \"multi\" }\n if (found != null && handle(found)) { return \"handled\" }\n\n if (map.fallthrough) {\n if (Object.prototype.toString.call(map.fallthrough) != \"[object Array]\")\n { return lookupKey(key, map.fallthrough, handle, context) }\n for (var i = 0; i < map.fallthrough.length; i++) {\n var result = lookupKey(key, map.fallthrough[i], handle, context);\n if (result) { return result }\n }\n }\n }\n\n // Modifier key presses don't count as 'real' key presses for the\n // purpose of keymap fallthrough.\n function isModifierKey(value) {\n var name = typeof value == \"string\" ? value : keyNames[value.keyCode];\n return name == \"Ctrl\" || name == \"Alt\" || name == \"Shift\" || name == \"Mod\"\n }\n\n function addModifierNames(name, event, noShift) {\n var base = name;\n if (event.altKey && base != \"Alt\") { name = \"Alt-\" + name; }\n if ((flipCtrlCmd ? event.metaKey : event.ctrlKey) && base != \"Ctrl\") { name = \"Ctrl-\" + name; }\n if ((flipCtrlCmd ? event.ctrlKey : event.metaKey) && base != \"Mod\") { name = \"Cmd-\" + name; }\n if (!noShift && event.shiftKey && base != \"Shift\") { name = \"Shift-\" + name; }\n return name\n }\n\n // Look up the name of a key as indicated by an event object.\n function keyName(event, noShift) {\n if (presto && event.keyCode == 34 && event[\"char\"]) { return false }\n var name = keyNames[event.keyCode];\n if (name == null || event.altGraphKey) { return false }\n // Ctrl-ScrollLock has keyCode 3, same as Ctrl-Pause,\n // so we'll use event.code when available (Chrome 48+, FF 38+, Safari 10.1+)\n if (event.keyCode == 3 && event.code) { name = event.code; }\n return addModifierNames(name, event, noShift)\n }\n\n function getKeyMap(val) {\n return typeof val == \"string\" ? keyMap[val] : val\n }\n\n // Helper for deleting text near the selection(s), used to implement\n // backspace, delete, and similar functionality.\n function deleteNearSelection(cm, compute) {\n var ranges = cm.doc.sel.ranges, kill = [];\n // Build up a set of ranges to kill first, merging overlapping\n // ranges.\n for (var i = 0; i < ranges.length; i++) {\n var toKill = compute(ranges[i]);\n while (kill.length && cmp(toKill.from, lst(kill).to) <= 0) {\n var replaced = kill.pop();\n if (cmp(replaced.from, toKill.from) < 0) {\n toKill.from = replaced.from;\n break\n }\n }\n kill.push(toKill);\n }\n // Next, remove those actual ranges.\n runInOp(cm, function () {\n for (var i = kill.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, \"\", kill[i].from, kill[i].to, \"+delete\"); }\n ensureCursorVisible(cm);\n });\n }\n\n function moveCharLogically(line, ch, dir) {\n var target = skipExtendingChars(line.text, ch + dir, dir);\n return target < 0 || target > line.text.length ? null : target\n }\n\n function moveLogically(line, start, dir) {\n var ch = moveCharLogically(line, start.ch, dir);\n return ch == null ? null : new Pos(start.line, ch, dir < 0 ? \"after\" : \"before\")\n }\n\n function endOfLine(visually, cm, lineObj, lineNo, dir) {\n if (visually) {\n if (cm.doc.direction == \"rtl\") { dir = -dir; }\n var order = getOrder(lineObj, cm.doc.direction);\n if (order) {\n var part = dir < 0 ? lst(order) : order[0];\n var moveInStorageOrder = (dir < 0) == (part.level == 1);\n var sticky = moveInStorageOrder ? \"after\" : \"before\";\n var ch;\n // With a wrapped rtl chunk (possibly spanning multiple bidi parts),\n // it could be that the last bidi part is not on the last visual line,\n // since visual lines contain content order-consecutive chunks.\n // Thus, in rtl, we are looking for the first (content-order) character\n // in the rtl chunk that is on the last line (that is, the same line\n // as the last (content-order) character).\n if (part.level > 0 || cm.doc.direction == \"rtl\") {\n var prep = prepareMeasureForLine(cm, lineObj);\n ch = dir < 0 ? lineObj.text.length - 1 : 0;\n var targetTop = measureCharPrepared(cm, prep, ch).top;\n ch = findFirst(function (ch) { return measureCharPrepared(cm, prep, ch).top == targetTop; }, (dir < 0) == (part.level == 1) ? part.from : part.to - 1, ch);\n if (sticky == \"before\") { ch = moveCharLogically(lineObj, ch, 1); }\n } else { ch = dir < 0 ? part.to : part.from; }\n return new Pos(lineNo, ch, sticky)\n }\n }\n return new Pos(lineNo, dir < 0 ? lineObj.text.length : 0, dir < 0 ? \"before\" : \"after\")\n }\n\n function moveVisually(cm, line, start, dir) {\n var bidi = getOrder(line, cm.doc.direction);\n if (!bidi) { return moveLogically(line, start, dir) }\n if (start.ch >= line.text.length) {\n start.ch = line.text.length;\n start.sticky = \"before\";\n } else if (start.ch <= 0) {\n start.ch = 0;\n start.sticky = \"after\";\n }\n var partPos = getBidiPartAt(bidi, start.ch, start.sticky), part = bidi[partPos];\n if (cm.doc.direction == \"ltr\" && part.level % 2 == 0 && (dir > 0 ? part.to > start.ch : part.from < start.ch)) {\n // Case 1: We move within an ltr part in an ltr editor. Even with wrapped lines,\n // nothing interesting happens.\n return moveLogically(line, start, dir)\n }\n\n var mv = function (pos, dir) { return moveCharLogically(line, pos instanceof Pos ? pos.ch : pos, dir); };\n var prep;\n var getWrappedLineExtent = function (ch) {\n if (!cm.options.lineWrapping) { return {begin: 0, end: line.text.length} }\n prep = prep || prepareMeasureForLine(cm, line);\n return wrappedLineExtentChar(cm, line, prep, ch)\n };\n var wrappedLineExtent = getWrappedLineExtent(start.sticky == \"before\" ? mv(start, -1) : start.ch);\n\n if (cm.doc.direction == \"rtl\" || part.level == 1) {\n var moveInStorageOrder = (part.level == 1) == (dir < 0);\n var ch = mv(start, moveInStorageOrder ? 1 : -1);\n if (ch != null && (!moveInStorageOrder ? ch >= part.from && ch >= wrappedLineExtent.begin : ch <= part.to && ch <= wrappedLineExtent.end)) {\n // Case 2: We move within an rtl part or in an rtl editor on the same visual line\n var sticky = moveInStorageOrder ? \"before\" : \"after\";\n return new Pos(start.line, ch, sticky)\n }\n }\n\n // Case 3: Could not move within this bidi part in this visual line, so leave\n // the current bidi part\n\n var searchInVisualLine = function (partPos, dir, wrappedLineExtent) {\n var getRes = function (ch, moveInStorageOrder) { return moveInStorageOrder\n ? new Pos(start.line, mv(ch, 1), \"before\")\n : new Pos(start.line, ch, \"after\"); };\n\n for (; partPos >= 0 && partPos < bidi.length; partPos += dir) {\n var part = bidi[partPos];\n var moveInStorageOrder = (dir > 0) == (part.level != 1);\n var ch = moveInStorageOrder ? wrappedLineExtent.begin : mv(wrappedLineExtent.end, -1);\n if (part.from <= ch && ch < part.to) { return getRes(ch, moveInStorageOrder) }\n ch = moveInStorageOrder ? part.from : mv(part.to, -1);\n if (wrappedLineExtent.begin <= ch && ch < wrappedLineExtent.end) { return getRes(ch, moveInStorageOrder) }\n }\n };\n\n // Case 3a: Look for other bidi parts on the same visual line\n var res = searchInVisualLine(partPos + dir, dir, wrappedLineExtent);\n if (res) { return res }\n\n // Case 3b: Look for other bidi parts on the next visual line\n var nextCh = dir > 0 ? wrappedLineExtent.end : mv(wrappedLineExtent.begin, -1);\n if (nextCh != null && !(dir > 0 && nextCh == line.text.length)) {\n res = searchInVisualLine(dir > 0 ? 0 : bidi.length - 1, dir, getWrappedLineExtent(nextCh));\n if (res) { return res }\n }\n\n // Case 4: Nowhere to move\n return null\n }\n\n // Commands are parameter-less actions that can be performed on an\n // editor, mostly used for keybindings.\n var commands = {\n selectAll: selectAll,\n singleSelection: function (cm) { return cm.setSelection(cm.getCursor(\"anchor\"), cm.getCursor(\"head\"), sel_dontScroll); },\n killLine: function (cm) { return deleteNearSelection(cm, function (range) {\n if (range.empty()) {\n var len = getLine(cm.doc, range.head.line).text.length;\n if (range.head.ch == len && range.head.line < cm.lastLine())\n { return {from: range.head, to: Pos(range.head.line + 1, 0)} }\n else\n { return {from: range.head, to: Pos(range.head.line, len)} }\n } else {\n return {from: range.from(), to: range.to()}\n }\n }); },\n deleteLine: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0),\n to: clipPos(cm.doc, Pos(range.to().line + 1, 0))\n }); }); },\n delLineLeft: function (cm) { return deleteNearSelection(cm, function (range) { return ({\n from: Pos(range.from().line, 0), to: range.from()\n }); }); },\n delWrappedLineLeft: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var leftPos = cm.coordsChar({left: 0, top: top}, \"div\");\n return {from: leftPos, to: range.from()}\n }); },\n delWrappedLineRight: function (cm) { return deleteNearSelection(cm, function (range) {\n var top = cm.charCoords(range.head, \"div\").top + 5;\n var rightPos = cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\");\n return {from: range.from(), to: rightPos }\n }); },\n undo: function (cm) { return cm.undo(); },\n redo: function (cm) { return cm.redo(); },\n undoSelection: function (cm) { return cm.undoSelection(); },\n redoSelection: function (cm) { return cm.redoSelection(); },\n goDocStart: function (cm) { return cm.extendSelection(Pos(cm.firstLine(), 0)); },\n goDocEnd: function (cm) { return cm.extendSelection(Pos(cm.lastLine())); },\n goLineStart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStart(cm, range.head.line); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineStartSmart: function (cm) { return cm.extendSelectionsBy(function (range) { return lineStartSmart(cm, range.head); },\n {origin: \"+move\", bias: 1}\n ); },\n goLineEnd: function (cm) { return cm.extendSelectionsBy(function (range) { return lineEnd(cm, range.head.line); },\n {origin: \"+move\", bias: -1}\n ); },\n goLineRight: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: cm.display.lineDiv.offsetWidth + 100, top: top}, \"div\")\n }, sel_move); },\n goLineLeft: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n return cm.coordsChar({left: 0, top: top}, \"div\")\n }, sel_move); },\n goLineLeftSmart: function (cm) { return cm.extendSelectionsBy(function (range) {\n var top = cm.cursorCoords(range.head, \"div\").top + 5;\n var pos = cm.coordsChar({left: 0, top: top}, \"div\");\n if (pos.ch < cm.getLine(pos.line).search(/\\S/)) { return lineStartSmart(cm, range.head) }\n return pos\n }, sel_move); },\n goLineUp: function (cm) { return cm.moveV(-1, \"line\"); },\n goLineDown: function (cm) { return cm.moveV(1, \"line\"); },\n goPageUp: function (cm) { return cm.moveV(-1, \"page\"); },\n goPageDown: function (cm) { return cm.moveV(1, \"page\"); },\n goCharLeft: function (cm) { return cm.moveH(-1, \"char\"); },\n goCharRight: function (cm) { return cm.moveH(1, \"char\"); },\n goColumnLeft: function (cm) { return cm.moveH(-1, \"column\"); },\n goColumnRight: function (cm) { return cm.moveH(1, \"column\"); },\n goWordLeft: function (cm) { return cm.moveH(-1, \"word\"); },\n goGroupRight: function (cm) { return cm.moveH(1, \"group\"); },\n goGroupLeft: function (cm) { return cm.moveH(-1, \"group\"); },\n goWordRight: function (cm) { return cm.moveH(1, \"word\"); },\n delCharBefore: function (cm) { return cm.deleteH(-1, \"codepoint\"); },\n delCharAfter: function (cm) { return cm.deleteH(1, \"char\"); },\n delWordBefore: function (cm) { return cm.deleteH(-1, \"word\"); },\n delWordAfter: function (cm) { return cm.deleteH(1, \"word\"); },\n delGroupBefore: function (cm) { return cm.deleteH(-1, \"group\"); },\n delGroupAfter: function (cm) { return cm.deleteH(1, \"group\"); },\n indentAuto: function (cm) { return cm.indentSelection(\"smart\"); },\n indentMore: function (cm) { return cm.indentSelection(\"add\"); },\n indentLess: function (cm) { return cm.indentSelection(\"subtract\"); },\n insertTab: function (cm) { return cm.replaceSelection(\"\\t\"); },\n insertSoftTab: function (cm) {\n var spaces = [], ranges = cm.listSelections(), tabSize = cm.options.tabSize;\n for (var i = 0; i < ranges.length; i++) {\n var pos = ranges[i].from();\n var col = countColumn(cm.getLine(pos.line), pos.ch, tabSize);\n spaces.push(spaceStr(tabSize - col % tabSize));\n }\n cm.replaceSelections(spaces);\n },\n defaultTab: function (cm) {\n if (cm.somethingSelected()) { cm.indentSelection(\"add\"); }\n else { cm.execCommand(\"insertTab\"); }\n },\n // Swap the two chars left and right of each selection's head.\n // Move cursor behind the two swapped characters afterwards.\n //\n // Doesn't consider line feeds a character.\n // Doesn't scan more than one line above to find a character.\n // Doesn't do anything on an empty line.\n // Doesn't do anything with non-empty selections.\n transposeChars: function (cm) { return runInOp(cm, function () {\n var ranges = cm.listSelections(), newSel = [];\n for (var i = 0; i < ranges.length; i++) {\n if (!ranges[i].empty()) { continue }\n var cur = ranges[i].head, line = getLine(cm.doc, cur.line).text;\n if (line) {\n if (cur.ch == line.length) { cur = new Pos(cur.line, cur.ch - 1); }\n if (cur.ch > 0) {\n cur = new Pos(cur.line, cur.ch + 1);\n cm.replaceRange(line.charAt(cur.ch - 1) + line.charAt(cur.ch - 2),\n Pos(cur.line, cur.ch - 2), cur, \"+transpose\");\n } else if (cur.line > cm.doc.first) {\n var prev = getLine(cm.doc, cur.line - 1).text;\n if (prev) {\n cur = new Pos(cur.line, 1);\n cm.replaceRange(line.charAt(0) + cm.doc.lineSeparator() +\n prev.charAt(prev.length - 1),\n Pos(cur.line - 1, prev.length - 1), cur, \"+transpose\");\n }\n }\n }\n newSel.push(new Range(cur, cur));\n }\n cm.setSelections(newSel);\n }); },\n newlineAndIndent: function (cm) { return runInOp(cm, function () {\n var sels = cm.listSelections();\n for (var i = sels.length - 1; i >= 0; i--)\n { cm.replaceRange(cm.doc.lineSeparator(), sels[i].anchor, sels[i].head, \"+input\"); }\n sels = cm.listSelections();\n for (var i$1 = 0; i$1 < sels.length; i$1++)\n { cm.indentLine(sels[i$1].from().line, null, true); }\n ensureCursorVisible(cm);\n }); },\n openLine: function (cm) { return cm.replaceSelection(\"\\n\", \"start\"); },\n toggleOverwrite: function (cm) { return cm.toggleOverwrite(); }\n };\n\n\n function lineStart(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLine(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, visual, lineN, 1)\n }\n function lineEnd(cm, lineN) {\n var line = getLine(cm.doc, lineN);\n var visual = visualLineEnd(line);\n if (visual != line) { lineN = lineNo(visual); }\n return endOfLine(true, cm, line, lineN, -1)\n }\n function lineStartSmart(cm, pos) {\n var start = lineStart(cm, pos.line);\n var line = getLine(cm.doc, start.line);\n var order = getOrder(line, cm.doc.direction);\n if (!order || order[0].level == 0) {\n var firstNonWS = Math.max(start.ch, line.text.search(/\\S/));\n var inWS = pos.line == start.line && pos.ch <= firstNonWS && pos.ch;\n return Pos(start.line, inWS ? 0 : firstNonWS, start.sticky)\n }\n return start\n }\n\n // Run a handler that was bound to a key.\n function doHandleBinding(cm, bound, dropShift) {\n if (typeof bound == \"string\") {\n bound = commands[bound];\n if (!bound) { return false }\n }\n // Ensure previous input has been read, so that the handler sees a\n // consistent view of the document\n cm.display.input.ensurePolled();\n var prevShift = cm.display.shift, done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n if (dropShift) { cm.display.shift = false; }\n done = bound(cm) != Pass;\n } finally {\n cm.display.shift = prevShift;\n cm.state.suppressEdits = false;\n }\n return done\n }\n\n function lookupKeyForEditor(cm, name, handle) {\n for (var i = 0; i < cm.state.keyMaps.length; i++) {\n var result = lookupKey(name, cm.state.keyMaps[i], handle, cm);\n if (result) { return result }\n }\n return (cm.options.extraKeys && lookupKey(name, cm.options.extraKeys, handle, cm))\n || lookupKey(name, cm.options.keyMap, handle, cm)\n }\n\n // Note that, despite the name, this function is also used to check\n // for bound mouse clicks.\n\n var stopSeq = new Delayed;\n\n function dispatchKey(cm, name, e, handle) {\n var seq = cm.state.keySeq;\n if (seq) {\n if (isModifierKey(name)) { return \"handled\" }\n if (/\\'$/.test(name))\n { cm.state.keySeq = null; }\n else\n { stopSeq.set(50, function () {\n if (cm.state.keySeq == seq) {\n cm.state.keySeq = null;\n cm.display.input.reset();\n }\n }); }\n if (dispatchKeyInner(cm, seq + \" \" + name, e, handle)) { return true }\n }\n return dispatchKeyInner(cm, name, e, handle)\n }\n\n function dispatchKeyInner(cm, name, e, handle) {\n var result = lookupKeyForEditor(cm, name, handle);\n\n if (result == \"multi\")\n { cm.state.keySeq = name; }\n if (result == \"handled\")\n { signalLater(cm, \"keyHandled\", cm, name, e); }\n\n if (result == \"handled\" || result == \"multi\") {\n e_preventDefault(e);\n restartBlink(cm);\n }\n\n return !!result\n }\n\n // Handle a key from the keydown event.\n function handleKeyBinding(cm, e) {\n var name = keyName(e, true);\n if (!name) { return false }\n\n if (e.shiftKey && !cm.state.keySeq) {\n // First try to resolve full name (including 'Shift-'). Failing\n // that, see if there is a cursor-motion command (starting with\n // 'go') bound to the keyname without 'Shift-'.\n return dispatchKey(cm, \"Shift-\" + name, e, function (b) { return doHandleBinding(cm, b, true); })\n || dispatchKey(cm, name, e, function (b) {\n if (typeof b == \"string\" ? /^go[A-Z]/.test(b) : b.motion)\n { return doHandleBinding(cm, b) }\n })\n } else {\n return dispatchKey(cm, name, e, function (b) { return doHandleBinding(cm, b); })\n }\n }\n\n // Handle a key from the keypress event\n function handleCharBinding(cm, e, ch) {\n return dispatchKey(cm, \"'\" + ch + \"'\", e, function (b) { return doHandleBinding(cm, b, true); })\n }\n\n var lastStoppedKey = null;\n function onKeyDown(e) {\n var cm = this;\n if (e.target && e.target != cm.display.input.getField()) { return }\n cm.curOp.focus = activeElt(root(cm));\n if (signalDOMEvent(cm, e)) { return }\n // IE does strange things with escape.\n if (ie && ie_version < 11 && e.keyCode == 27) { e.returnValue = false; }\n var code = e.keyCode;\n cm.display.shift = code == 16 || e.shiftKey;\n var handled = handleKeyBinding(cm, e);\n if (presto) {\n lastStoppedKey = handled ? code : null;\n // Opera has no cut event... we try to at least catch the key combo\n if (!handled && code == 88 && !hasCopyEvent && (mac ? e.metaKey : e.ctrlKey))\n { cm.replaceSelection(\"\", null, \"cut\"); }\n }\n if (gecko && !mac && !handled && code == 46 && e.shiftKey && !e.ctrlKey && document.execCommand)\n { document.execCommand(\"cut\"); }\n\n // Turn mouse into crosshair when Alt is held on Mac.\n if (code == 18 && !/\\bCodeMirror-crosshair\\b/.test(cm.display.lineDiv.className))\n { showCrossHair(cm); }\n }\n\n function showCrossHair(cm) {\n var lineDiv = cm.display.lineDiv;\n addClass(lineDiv, \"CodeMirror-crosshair\");\n\n function up(e) {\n if (e.keyCode == 18 || !e.altKey) {\n rmClass(lineDiv, \"CodeMirror-crosshair\");\n off(document, \"keyup\", up);\n off(document, \"mouseover\", up);\n }\n }\n on(document, \"keyup\", up);\n on(document, \"mouseover\", up);\n }\n\n function onKeyUp(e) {\n if (e.keyCode == 16) { this.doc.sel.shift = false; }\n signalDOMEvent(this, e);\n }\n\n function onKeyPress(e) {\n var cm = this;\n if (e.target && e.target != cm.display.input.getField()) { return }\n if (eventInWidget(cm.display, e) || signalDOMEvent(cm, e) || e.ctrlKey && !e.altKey || mac && e.metaKey) { return }\n var keyCode = e.keyCode, charCode = e.charCode;\n if (presto && keyCode == lastStoppedKey) {lastStoppedKey = null; e_preventDefault(e); return}\n if ((presto && (!e.which || e.which < 10)) && handleKeyBinding(cm, e)) { return }\n var ch = String.fromCharCode(charCode == null ? keyCode : charCode);\n // Some browsers fire keypress events for backspace\n if (ch == \"\\x08\") { return }\n if (handleCharBinding(cm, e, ch)) { return }\n cm.display.input.onKeyPress(e);\n }\n\n var DOUBLECLICK_DELAY = 400;\n\n var PastClick = function(time, pos, button) {\n this.time = time;\n this.pos = pos;\n this.button = button;\n };\n\n PastClick.prototype.compare = function (time, pos, button) {\n return this.time + DOUBLECLICK_DELAY > time &&\n cmp(pos, this.pos) == 0 && button == this.button\n };\n\n var lastClick, lastDoubleClick;\n function clickRepeat(pos, button) {\n var now = +new Date;\n if (lastDoubleClick && lastDoubleClick.compare(now, pos, button)) {\n lastClick = lastDoubleClick = null;\n return \"triple\"\n } else if (lastClick && lastClick.compare(now, pos, button)) {\n lastDoubleClick = new PastClick(now, pos, button);\n lastClick = null;\n return \"double\"\n } else {\n lastClick = new PastClick(now, pos, button);\n lastDoubleClick = null;\n return \"single\"\n }\n }\n\n // A mouse down can be a single click, double click, triple click,\n // start of selection drag, start of text drag, new cursor\n // (ctrl-click), rectangle drag (alt-drag), or xwin\n // middle-click-paste. Or it might be a click on something we should\n // not interfere with, such as a scrollbar or widget.\n function onMouseDown(e) {\n var cm = this, display = cm.display;\n if (signalDOMEvent(cm, e) || display.activeTouch && display.input.supportsTouch()) { return }\n display.input.ensurePolled();\n display.shift = e.shiftKey;\n\n if (eventInWidget(display, e)) {\n if (!webkit) {\n // Briefly turn off draggability, to allow widgets to do\n // normal dragging things.\n display.scroller.draggable = false;\n setTimeout(function () { return display.scroller.draggable = true; }, 100);\n }\n return\n }\n if (clickInGutter(cm, e)) { return }\n var pos = posFromMouse(cm, e), button = e_button(e), repeat = pos ? clickRepeat(pos, button) : \"single\";\n win(cm).focus();\n\n // #3261: make sure, that we're not starting a second selection\n if (button == 1 && cm.state.selectingText)\n { cm.state.selectingText(e); }\n\n if (pos && handleMappedButton(cm, button, pos, repeat, e)) { return }\n\n if (button == 1) {\n if (pos) { leftButtonDown(cm, pos, repeat, e); }\n else if (e_target(e) == display.scroller) { e_preventDefault(e); }\n } else if (button == 2) {\n if (pos) { extendSelection(cm.doc, pos); }\n setTimeout(function () { return display.input.focus(); }, 20);\n } else if (button == 3) {\n if (captureRightClick) { cm.display.input.onContextMenu(e); }\n else { delayBlurEvent(cm); }\n }\n }\n\n function handleMappedButton(cm, button, pos, repeat, event) {\n var name = \"Click\";\n if (repeat == \"double\") { name = \"Double\" + name; }\n else if (repeat == \"triple\") { name = \"Triple\" + name; }\n name = (button == 1 ? \"Left\" : button == 2 ? \"Middle\" : \"Right\") + name;\n\n return dispatchKey(cm, addModifierNames(name, event), event, function (bound) {\n if (typeof bound == \"string\") { bound = commands[bound]; }\n if (!bound) { return false }\n var done = false;\n try {\n if (cm.isReadOnly()) { cm.state.suppressEdits = true; }\n done = bound(cm, pos) != Pass;\n } finally {\n cm.state.suppressEdits = false;\n }\n return done\n })\n }\n\n function configureMouse(cm, repeat, event) {\n var option = cm.getOption(\"configureMouse\");\n var value = option ? option(cm, repeat, event) : {};\n if (value.unit == null) {\n var rect = chromeOS ? event.shiftKey && event.metaKey : event.altKey;\n value.unit = rect ? \"rectangle\" : repeat == \"single\" ? \"char\" : repeat == \"double\" ? \"word\" : \"line\";\n }\n if (value.extend == null || cm.doc.extend) { value.extend = cm.doc.extend || event.shiftKey; }\n if (value.addNew == null) { value.addNew = mac ? event.metaKey : event.ctrlKey; }\n if (value.moveOnDrag == null) { value.moveOnDrag = !(mac ? event.altKey : event.ctrlKey); }\n return value\n }\n\n function leftButtonDown(cm, pos, repeat, event) {\n if (ie) { setTimeout(bind(ensureFocus, cm), 0); }\n else { cm.curOp.focus = activeElt(root(cm)); }\n\n var behavior = configureMouse(cm, repeat, event);\n\n var sel = cm.doc.sel, contained;\n if (cm.options.dragDrop && dragAndDrop && !cm.isReadOnly() &&\n repeat == \"single\" && (contained = sel.contains(pos)) > -1 &&\n (cmp((contained = sel.ranges[contained]).from(), pos) < 0 || pos.xRel > 0) &&\n (cmp(contained.to(), pos) > 0 || pos.xRel < 0))\n { leftButtonStartDrag(cm, event, pos, behavior); }\n else\n { leftButtonSelect(cm, event, pos, behavior); }\n }\n\n // Start a text drag. When it ends, see if any dragging actually\n // happen, and treat as a click if it didn't.\n function leftButtonStartDrag(cm, event, pos, behavior) {\n var display = cm.display, moved = false;\n var dragEnd = operation(cm, function (e) {\n if (webkit) { display.scroller.draggable = false; }\n cm.state.draggingText = false;\n if (cm.state.delayingBlurEvent) {\n if (cm.hasFocus()) { cm.state.delayingBlurEvent = false; }\n else { delayBlurEvent(cm); }\n }\n off(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n off(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n off(display.scroller, \"dragstart\", dragStart);\n off(display.scroller, \"drop\", dragEnd);\n if (!moved) {\n e_preventDefault(e);\n if (!behavior.addNew)\n { extendSelection(cm.doc, pos, null, null, behavior.extend); }\n // Work around unexplainable focus problem in IE9 (#2127) and Chrome (#3081)\n if ((webkit && !safari) || ie && ie_version == 9)\n { setTimeout(function () {display.wrapper.ownerDocument.body.focus({preventScroll: true}); display.input.focus();}, 20); }\n else\n { display.input.focus(); }\n }\n });\n var mouseMove = function(e2) {\n moved = moved || Math.abs(event.clientX - e2.clientX) + Math.abs(event.clientY - e2.clientY) >= 10;\n };\n var dragStart = function () { return moved = true; };\n // Let the drag handler handle this.\n if (webkit) { display.scroller.draggable = true; }\n cm.state.draggingText = dragEnd;\n dragEnd.copy = !behavior.moveOnDrag;\n on(display.wrapper.ownerDocument, \"mouseup\", dragEnd);\n on(display.wrapper.ownerDocument, \"mousemove\", mouseMove);\n on(display.scroller, \"dragstart\", dragStart);\n on(display.scroller, \"drop\", dragEnd);\n\n cm.state.delayingBlurEvent = true;\n setTimeout(function () { return display.input.focus(); }, 20);\n // IE's approach to draggable\n if (display.scroller.dragDrop) { display.scroller.dragDrop(); }\n }\n\n function rangeForUnit(cm, pos, unit) {\n if (unit == \"char\") { return new Range(pos, pos) }\n if (unit == \"word\") { return cm.findWordAt(pos) }\n if (unit == \"line\") { return new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))) }\n var result = unit(cm, pos);\n return new Range(result.from, result.to)\n }\n\n // Normal selection, as opposed to text dragging.\n function leftButtonSelect(cm, event, start, behavior) {\n if (ie) { delayBlurEvent(cm); }\n var display = cm.display, doc = cm.doc;\n e_preventDefault(event);\n\n var ourRange, ourIndex, startSel = doc.sel, ranges = startSel.ranges;\n if (behavior.addNew && !behavior.extend) {\n ourIndex = doc.sel.contains(start);\n if (ourIndex > -1)\n { ourRange = ranges[ourIndex]; }\n else\n { ourRange = new Range(start, start); }\n } else {\n ourRange = doc.sel.primary();\n ourIndex = doc.sel.primIndex;\n }\n\n if (behavior.unit == \"rectangle\") {\n if (!behavior.addNew) { ourRange = new Range(start, start); }\n start = posFromMouse(cm, event, true, true);\n ourIndex = -1;\n } else {\n var range = rangeForUnit(cm, start, behavior.unit);\n if (behavior.extend)\n { ourRange = extendRange(ourRange, range.anchor, range.head, behavior.extend); }\n else\n { ourRange = range; }\n }\n\n if (!behavior.addNew) {\n ourIndex = 0;\n setSelection(doc, new Selection([ourRange], 0), sel_mouse);\n startSel = doc.sel;\n } else if (ourIndex == -1) {\n ourIndex = ranges.length;\n setSelection(doc, normalizeSelection(cm, ranges.concat([ourRange]), ourIndex),\n {scroll: false, origin: \"*mouse\"});\n } else if (ranges.length > 1 && ranges[ourIndex].empty() && behavior.unit == \"char\" && !behavior.extend) {\n setSelection(doc, normalizeSelection(cm, ranges.slice(0, ourIndex).concat(ranges.slice(ourIndex + 1)), 0),\n {scroll: false, origin: \"*mouse\"});\n startSel = doc.sel;\n } else {\n replaceOneSelection(doc, ourIndex, ourRange, sel_mouse);\n }\n\n var lastPos = start;\n function extendTo(pos) {\n if (cmp(lastPos, pos) == 0) { return }\n lastPos = pos;\n\n if (behavior.unit == \"rectangle\") {\n var ranges = [], tabSize = cm.options.tabSize;\n var startCol = countColumn(getLine(doc, start.line).text, start.ch, tabSize);\n var posCol = countColumn(getLine(doc, pos.line).text, pos.ch, tabSize);\n var left = Math.min(startCol, posCol), right = Math.max(startCol, posCol);\n for (var line = Math.min(start.line, pos.line), end = Math.min(cm.lastLine(), Math.max(start.line, pos.line));\n line <= end; line++) {\n var text = getLine(doc, line).text, leftPos = findColumn(text, left, tabSize);\n if (left == right)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, leftPos))); }\n else if (text.length > leftPos)\n { ranges.push(new Range(Pos(line, leftPos), Pos(line, findColumn(text, right, tabSize)))); }\n }\n if (!ranges.length) { ranges.push(new Range(start, start)); }\n setSelection(doc, normalizeSelection(cm, startSel.ranges.slice(0, ourIndex).concat(ranges), ourIndex),\n {origin: \"*mouse\", scroll: false});\n cm.scrollIntoView(pos);\n } else {\n var oldRange = ourRange;\n var range = rangeForUnit(cm, pos, behavior.unit);\n var anchor = oldRange.anchor, head;\n if (cmp(range.anchor, anchor) > 0) {\n head = range.head;\n anchor = minPos(oldRange.from(), range.anchor);\n } else {\n head = range.anchor;\n anchor = maxPos(oldRange.to(), range.head);\n }\n var ranges$1 = startSel.ranges.slice(0);\n ranges$1[ourIndex] = bidiSimplify(cm, new Range(clipPos(doc, anchor), head));\n setSelection(doc, normalizeSelection(cm, ranges$1, ourIndex), sel_mouse);\n }\n }\n\n var editorSize = display.wrapper.getBoundingClientRect();\n // Used to ensure timeout re-tries don't fire when another extend\n // happened in the meantime (clearTimeout isn't reliable -- at\n // least on Chrome, the timeouts still happen even when cleared,\n // if the clear happens after their scheduled firing time).\n var counter = 0;\n\n function extend(e) {\n var curCount = ++counter;\n var cur = posFromMouse(cm, e, true, behavior.unit == \"rectangle\");\n if (!cur) { return }\n if (cmp(cur, lastPos) != 0) {\n cm.curOp.focus = activeElt(root(cm));\n extendTo(cur);\n var visible = visibleLines(display, doc);\n if (cur.line >= visible.to || cur.line < visible.from)\n { setTimeout(operation(cm, function () {if (counter == curCount) { extend(e); }}), 150); }\n } else {\n var outside = e.clientY < editorSize.top ? -20 : e.clientY > editorSize.bottom ? 20 : 0;\n if (outside) { setTimeout(operation(cm, function () {\n if (counter != curCount) { return }\n display.scroller.scrollTop += outside;\n extend(e);\n }), 50); }\n }\n }\n\n function done(e) {\n cm.state.selectingText = false;\n counter = Infinity;\n // If e is null or undefined we interpret this as someone trying\n // to explicitly cancel the selection rather than the user\n // letting go of the mouse button.\n if (e) {\n e_preventDefault(e);\n display.input.focus();\n }\n off(display.wrapper.ownerDocument, \"mousemove\", move);\n off(display.wrapper.ownerDocument, \"mouseup\", up);\n doc.history.lastSelOrigin = null;\n }\n\n var move = operation(cm, function (e) {\n if (e.buttons === 0 || !e_button(e)) { done(e); }\n else { extend(e); }\n });\n var up = operation(cm, done);\n cm.state.selectingText = up;\n on(display.wrapper.ownerDocument, \"mousemove\", move);\n on(display.wrapper.ownerDocument, \"mouseup\", up);\n }\n\n // Used when mouse-selecting to adjust the anchor to the proper side\n // of a bidi jump depending on the visual position of the head.\n function bidiSimplify(cm, range) {\n var anchor = range.anchor;\n var head = range.head;\n var anchorLine = getLine(cm.doc, anchor.line);\n if (cmp(anchor, head) == 0 && anchor.sticky == head.sticky) { return range }\n var order = getOrder(anchorLine);\n if (!order) { return range }\n var index = getBidiPartAt(order, anchor.ch, anchor.sticky), part = order[index];\n if (part.from != anchor.ch && part.to != anchor.ch) { return range }\n var boundary = index + ((part.from == anchor.ch) == (part.level != 1) ? 0 : 1);\n if (boundary == 0 || boundary == order.length) { return range }\n\n // Compute the relative visual position of the head compared to the\n // anchor (<0 is to the left, >0 to the right)\n var leftSide;\n if (head.line != anchor.line) {\n leftSide = (head.line - anchor.line) * (cm.doc.direction == \"ltr\" ? 1 : -1) > 0;\n } else {\n var headIndex = getBidiPartAt(order, head.ch, head.sticky);\n var dir = headIndex - index || (head.ch - anchor.ch) * (part.level == 1 ? -1 : 1);\n if (headIndex == boundary - 1 || headIndex == boundary)\n { leftSide = dir < 0; }\n else\n { leftSide = dir > 0; }\n }\n\n var usePart = order[boundary + (leftSide ? -1 : 0)];\n var from = leftSide == (usePart.level == 1);\n var ch = from ? usePart.from : usePart.to, sticky = from ? \"after\" : \"before\";\n return anchor.ch == ch && anchor.sticky == sticky ? range : new Range(new Pos(anchor.line, ch, sticky), head)\n }\n\n\n // Determines whether an event happened in the gutter, and fires the\n // handlers for the corresponding event.\n function gutterEvent(cm, e, type, prevent) {\n var mX, mY;\n if (e.touches) {\n mX = e.touches[0].clientX;\n mY = e.touches[0].clientY;\n } else {\n try { mX = e.clientX; mY = e.clientY; }\n catch(e$1) { return false }\n }\n if (mX >= Math.floor(cm.display.gutters.getBoundingClientRect().right)) { return false }\n if (prevent) { e_preventDefault(e); }\n\n var display = cm.display;\n var lineBox = display.lineDiv.getBoundingClientRect();\n\n if (mY > lineBox.bottom || !hasHandler(cm, type)) { return e_defaultPrevented(e) }\n mY -= lineBox.top - display.viewOffset;\n\n for (var i = 0; i < cm.display.gutterSpecs.length; ++i) {\n var g = display.gutters.childNodes[i];\n if (g && g.getBoundingClientRect().right >= mX) {\n var line = lineAtHeight(cm.doc, mY);\n var gutter = cm.display.gutterSpecs[i];\n signal(cm, type, cm, line, gutter.className, e);\n return e_defaultPrevented(e)\n }\n }\n }\n\n function clickInGutter(cm, e) {\n return gutterEvent(cm, e, \"gutterClick\", true)\n }\n\n // CONTEXT MENU HANDLING\n\n // To make the context menu work, we need to briefly unhide the\n // textarea (making it as unobtrusive as possible) to let the\n // right-click take effect on it.\n function onContextMenu(cm, e) {\n if (eventInWidget(cm.display, e) || contextMenuInGutter(cm, e)) { return }\n if (signalDOMEvent(cm, e, \"contextmenu\")) { return }\n if (!captureRightClick) { cm.display.input.onContextMenu(e); }\n }\n\n function contextMenuInGutter(cm, e) {\n if (!hasHandler(cm, \"gutterContextMenu\")) { return false }\n return gutterEvent(cm, e, \"gutterContextMenu\", false)\n }\n\n function themeChanged(cm) {\n cm.display.wrapper.className = cm.display.wrapper.className.replace(/\\s*cm-s-\\S+/g, \"\") +\n cm.options.theme.replace(/(^|\\s)\\s*/g, \" cm-s-\");\n clearCaches(cm);\n }\n\n var Init = {toString: function(){return \"CodeMirror.Init\"}};\n\n var defaults = {};\n var optionHandlers = {};\n\n function defineOptions(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n function option(name, deflt, handle, notOnInit) {\n CodeMirror.defaults[name] = deflt;\n if (handle) { optionHandlers[name] =\n notOnInit ? function (cm, val, old) {if (old != Init) { handle(cm, val, old); }} : handle; }\n }\n\n CodeMirror.defineOption = option;\n\n // Passed to option handlers when there is no old value.\n CodeMirror.Init = Init;\n\n // These two are, on init, called from the constructor because they\n // have to be initialized before the editor can start at all.\n option(\"value\", \"\", function (cm, val) { return cm.setValue(val); }, true);\n option(\"mode\", null, function (cm, val) {\n cm.doc.modeOption = val;\n loadMode(cm);\n }, true);\n\n option(\"indentUnit\", 2, loadMode, true);\n option(\"indentWithTabs\", false);\n option(\"smartIndent\", true);\n option(\"tabSize\", 4, function (cm) {\n resetModeState(cm);\n clearCaches(cm);\n regChange(cm);\n }, true);\n\n option(\"lineSeparator\", null, function (cm, val) {\n cm.doc.lineSep = val;\n if (!val) { return }\n var newBreaks = [], lineNo = cm.doc.first;\n cm.doc.iter(function (line) {\n for (var pos = 0;;) {\n var found = line.text.indexOf(val, pos);\n if (found == -1) { break }\n pos = found + val.length;\n newBreaks.push(Pos(lineNo, found));\n }\n lineNo++;\n });\n for (var i = newBreaks.length - 1; i >= 0; i--)\n { replaceRange(cm.doc, val, newBreaks[i], Pos(newBreaks[i].line, newBreaks[i].ch + val.length)); }\n });\n option(\"specialChars\", /[\\u0000-\\u001f\\u007f-\\u009f\\u00ad\\u061c\\u200b\\u200e\\u200f\\u2028\\u2029\\u202d\\u202e\\u2066\\u2067\\u2069\\ufeff\\ufff9-\\ufffc]/g, function (cm, val, old) {\n cm.state.specialChars = new RegExp(val.source + (val.test(\"\\t\") ? \"\" : \"|\\t\"), \"g\");\n if (old != Init) { cm.refresh(); }\n });\n option(\"specialCharPlaceholder\", defaultSpecialCharPlaceholder, function (cm) { return cm.refresh(); }, true);\n option(\"electricChars\", true);\n option(\"inputStyle\", mobile ? \"contenteditable\" : \"textarea\", function () {\n throw new Error(\"inputStyle can not (yet) be changed in a running editor\") // FIXME\n }, true);\n option(\"spellcheck\", false, function (cm, val) { return cm.getInputField().spellcheck = val; }, true);\n option(\"autocorrect\", false, function (cm, val) { return cm.getInputField().autocorrect = val; }, true);\n option(\"autocapitalize\", false, function (cm, val) { return cm.getInputField().autocapitalize = val; }, true);\n option(\"rtlMoveVisually\", !windows);\n option(\"wholeLineUpdateBefore\", true);\n\n option(\"theme\", \"default\", function (cm) {\n themeChanged(cm);\n updateGutters(cm);\n }, true);\n option(\"keyMap\", \"default\", function (cm, val, old) {\n var next = getKeyMap(val);\n var prev = old != Init && getKeyMap(old);\n if (prev && prev.detach) { prev.detach(cm, next); }\n if (next.attach) { next.attach(cm, prev || null); }\n });\n option(\"extraKeys\", null);\n option(\"configureMouse\", null);\n\n option(\"lineWrapping\", false, wrappingChanged, true);\n option(\"gutters\", [], function (cm, val) {\n cm.display.gutterSpecs = getGutters(val, cm.options.lineNumbers);\n updateGutters(cm);\n }, true);\n option(\"fixedGutter\", true, function (cm, val) {\n cm.display.gutters.style.left = val ? compensateForHScroll(cm.display) + \"px\" : \"0\";\n cm.refresh();\n }, true);\n option(\"coverGutterNextToScrollbar\", false, function (cm) { return updateScrollbars(cm); }, true);\n option(\"scrollbarStyle\", \"native\", function (cm) {\n initScrollbars(cm);\n updateScrollbars(cm);\n cm.display.scrollbars.setScrollTop(cm.doc.scrollTop);\n cm.display.scrollbars.setScrollLeft(cm.doc.scrollLeft);\n }, true);\n option(\"lineNumbers\", false, function (cm, val) {\n cm.display.gutterSpecs = getGutters(cm.options.gutters, val);\n updateGutters(cm);\n }, true);\n option(\"firstLineNumber\", 1, updateGutters, true);\n option(\"lineNumberFormatter\", function (integer) { return integer; }, updateGutters, true);\n option(\"showCursorWhenSelecting\", false, updateSelection, true);\n\n option(\"resetSelectionOnContextMenu\", true);\n option(\"lineWiseCopyCut\", true);\n option(\"pasteLinesPerSelection\", true);\n option(\"selectionsMayTouch\", false);\n\n option(\"readOnly\", false, function (cm, val) {\n if (val == \"nocursor\") {\n onBlur(cm);\n cm.display.input.blur();\n }\n cm.display.input.readOnlyChanged(val);\n });\n\n option(\"screenReaderLabel\", null, function (cm, val) {\n val = (val === '') ? null : val;\n cm.display.input.screenReaderLabelChanged(val);\n });\n\n option(\"disableInput\", false, function (cm, val) {if (!val) { cm.display.input.reset(); }}, true);\n option(\"dragDrop\", true, dragDropChanged);\n option(\"allowDropFileTypes\", null);\n\n option(\"cursorBlinkRate\", 530);\n option(\"cursorScrollMargin\", 0);\n option(\"cursorHeight\", 1, updateSelection, true);\n option(\"singleCursorHeightPerLine\", true, updateSelection, true);\n option(\"workTime\", 100);\n option(\"workDelay\", 100);\n option(\"flattenSpans\", true, resetModeState, true);\n option(\"addModeClass\", false, resetModeState, true);\n option(\"pollInterval\", 100);\n option(\"undoDepth\", 200, function (cm, val) { return cm.doc.history.undoDepth = val; });\n option(\"historyEventDelay\", 1250);\n option(\"viewportMargin\", 10, function (cm) { return cm.refresh(); }, true);\n option(\"maxHighlightLength\", 10000, resetModeState, true);\n option(\"moveInputWithCursor\", true, function (cm, val) {\n if (!val) { cm.display.input.resetPosition(); }\n });\n\n option(\"tabindex\", null, function (cm, val) { return cm.display.input.getField().tabIndex = val || \"\"; });\n option(\"autofocus\", null);\n option(\"direction\", \"ltr\", function (cm, val) { return cm.doc.setDirection(val); }, true);\n option(\"phrases\", null);\n }\n\n function dragDropChanged(cm, value, old) {\n var wasOn = old && old != Init;\n if (!value != !wasOn) {\n var funcs = cm.display.dragFunctions;\n var toggle = value ? on : off;\n toggle(cm.display.scroller, \"dragstart\", funcs.start);\n toggle(cm.display.scroller, \"dragenter\", funcs.enter);\n toggle(cm.display.scroller, \"dragover\", funcs.over);\n toggle(cm.display.scroller, \"dragleave\", funcs.leave);\n toggle(cm.display.scroller, \"drop\", funcs.drop);\n }\n }\n\n function wrappingChanged(cm) {\n if (cm.options.lineWrapping) {\n addClass(cm.display.wrapper, \"CodeMirror-wrap\");\n cm.display.sizer.style.minWidth = \"\";\n cm.display.sizerWidth = null;\n } else {\n rmClass(cm.display.wrapper, \"CodeMirror-wrap\");\n findMaxLine(cm);\n }\n estimateLineHeights(cm);\n regChange(cm);\n clearCaches(cm);\n setTimeout(function () { return updateScrollbars(cm); }, 100);\n }\n\n // A CodeMirror instance represents an editor. This is the object\n // that user code is usually dealing with.\n\n function CodeMirror(place, options) {\n var this$1 = this;\n\n if (!(this instanceof CodeMirror)) { return new CodeMirror(place, options) }\n\n this.options = options = options ? copyObj(options) : {};\n // Determine effective options based on given values and defaults.\n copyObj(defaults, options, false);\n\n var doc = options.value;\n if (typeof doc == \"string\") { doc = new Doc(doc, options.mode, null, options.lineSeparator, options.direction); }\n else if (options.mode) { doc.modeOption = options.mode; }\n this.doc = doc;\n\n var input = new CodeMirror.inputStyles[options.inputStyle](this);\n var display = this.display = new Display(place, doc, input, options);\n display.wrapper.CodeMirror = this;\n themeChanged(this);\n if (options.lineWrapping)\n { this.display.wrapper.className += \" CodeMirror-wrap\"; }\n initScrollbars(this);\n\n this.state = {\n keyMaps: [], // stores maps added by addKeyMap\n overlays: [], // highlighting overlays, as added by addOverlay\n modeGen: 0, // bumped when mode/overlay changes, used to invalidate highlighting info\n overwrite: false,\n delayingBlurEvent: false,\n focused: false,\n suppressEdits: false, // used to disable editing during key handlers when in readOnly mode\n pasteIncoming: -1, cutIncoming: -1, // help recognize paste/cut edits in input.poll\n selectingText: false,\n draggingText: false,\n highlight: new Delayed(), // stores highlight worker timeout\n keySeq: null, // Unfinished key sequence\n specialChars: null\n };\n\n if (options.autofocus && !mobile) { display.input.focus(); }\n\n // Override magic textarea content restore that IE sometimes does\n // on our hidden textarea on reload\n if (ie && ie_version < 11) { setTimeout(function () { return this$1.display.input.reset(true); }, 20); }\n\n registerEventHandlers(this);\n ensureGlobalHandlers();\n\n startOperation(this);\n this.curOp.forceUpdate = true;\n attachDoc(this, doc);\n\n if ((options.autofocus && !mobile) || this.hasFocus())\n { setTimeout(function () {\n if (this$1.hasFocus() && !this$1.state.focused) { onFocus(this$1); }\n }, 20); }\n else\n { onBlur(this); }\n\n for (var opt in optionHandlers) { if (optionHandlers.hasOwnProperty(opt))\n { optionHandlers[opt](this, options[opt], Init); } }\n maybeUpdateLineNumberWidth(this);\n if (options.finishInit) { options.finishInit(this); }\n for (var i = 0; i < initHooks.length; ++i) { initHooks[i](this); }\n endOperation(this);\n // Suppress optimizelegibility in Webkit, since it breaks text\n // measuring on line wrapping boundaries.\n if (webkit && options.lineWrapping &&\n getComputedStyle(display.lineDiv).textRendering == \"optimizelegibility\")\n { display.lineDiv.style.textRendering = \"auto\"; }\n }\n\n // The default configuration options.\n CodeMirror.defaults = defaults;\n // Functions to run when options are changed.\n CodeMirror.optionHandlers = optionHandlers;\n\n // Attach the necessary event handlers when initializing the editor\n function registerEventHandlers(cm) {\n var d = cm.display;\n on(d.scroller, \"mousedown\", operation(cm, onMouseDown));\n // Older IE's will not fire a second mousedown for a double click\n if (ie && ie_version < 11)\n { on(d.scroller, \"dblclick\", operation(cm, function (e) {\n if (signalDOMEvent(cm, e)) { return }\n var pos = posFromMouse(cm, e);\n if (!pos || clickInGutter(cm, e) || eventInWidget(cm.display, e)) { return }\n e_preventDefault(e);\n var word = cm.findWordAt(pos);\n extendSelection(cm.doc, word.anchor, word.head);\n })); }\n else\n { on(d.scroller, \"dblclick\", function (e) { return signalDOMEvent(cm, e) || e_preventDefault(e); }); }\n // Some browsers fire contextmenu *after* opening the menu, at\n // which point we can't mess with it anymore. Context menu is\n // handled in onMouseDown for these browsers.\n on(d.scroller, \"contextmenu\", function (e) { return onContextMenu(cm, e); });\n on(d.input.getField(), \"contextmenu\", function (e) {\n if (!d.scroller.contains(e.target)) { onContextMenu(cm, e); }\n });\n\n // Used to suppress mouse event handling when a touch happens\n var touchFinished, prevTouch = {end: 0};\n function finishTouch() {\n if (d.activeTouch) {\n touchFinished = setTimeout(function () { return d.activeTouch = null; }, 1000);\n prevTouch = d.activeTouch;\n prevTouch.end = +new Date;\n }\n }\n function isMouseLikeTouchEvent(e) {\n if (e.touches.length != 1) { return false }\n var touch = e.touches[0];\n return touch.radiusX <= 1 && touch.radiusY <= 1\n }\n function farAway(touch, other) {\n if (other.left == null) { return true }\n var dx = other.left - touch.left, dy = other.top - touch.top;\n return dx * dx + dy * dy > 20 * 20\n }\n on(d.scroller, \"touchstart\", function (e) {\n if (!signalDOMEvent(cm, e) && !isMouseLikeTouchEvent(e) && !clickInGutter(cm, e)) {\n d.input.ensurePolled();\n clearTimeout(touchFinished);\n var now = +new Date;\n d.activeTouch = {start: now, moved: false,\n prev: now - prevTouch.end <= 300 ? prevTouch : null};\n if (e.touches.length == 1) {\n d.activeTouch.left = e.touches[0].pageX;\n d.activeTouch.top = e.touches[0].pageY;\n }\n }\n });\n on(d.scroller, \"touchmove\", function () {\n if (d.activeTouch) { d.activeTouch.moved = true; }\n });\n on(d.scroller, \"touchend\", function (e) {\n var touch = d.activeTouch;\n if (touch && !eventInWidget(d, e) && touch.left != null &&\n !touch.moved && new Date - touch.start < 300) {\n var pos = cm.coordsChar(d.activeTouch, \"page\"), range;\n if (!touch.prev || farAway(touch, touch.prev)) // Single tap\n { range = new Range(pos, pos); }\n else if (!touch.prev.prev || farAway(touch, touch.prev.prev)) // Double tap\n { range = cm.findWordAt(pos); }\n else // Triple tap\n { range = new Range(Pos(pos.line, 0), clipPos(cm.doc, Pos(pos.line + 1, 0))); }\n cm.setSelection(range.anchor, range.head);\n cm.focus();\n e_preventDefault(e);\n }\n finishTouch();\n });\n on(d.scroller, \"touchcancel\", finishTouch);\n\n // Sync scrolling between fake scrollbars and real scrollable\n // area, ensure viewport is updated when scrolling.\n on(d.scroller, \"scroll\", function () {\n if (d.scroller.clientHeight) {\n updateScrollTop(cm, d.scroller.scrollTop);\n setScrollLeft(cm, d.scroller.scrollLeft, true);\n signal(cm, \"scroll\", cm);\n }\n });\n\n // Listen to wheel events in order to try and update the viewport on time.\n on(d.scroller, \"mousewheel\", function (e) { return onScrollWheel(cm, e); });\n on(d.scroller, \"DOMMouseScroll\", function (e) { return onScrollWheel(cm, e); });\n\n // Prevent wrapper from ever scrolling\n on(d.wrapper, \"scroll\", function () { return d.wrapper.scrollTop = d.wrapper.scrollLeft = 0; });\n\n d.dragFunctions = {\n enter: function (e) {if (!signalDOMEvent(cm, e)) { e_stop(e); }},\n over: function (e) {if (!signalDOMEvent(cm, e)) { onDragOver(cm, e); e_stop(e); }},\n start: function (e) { return onDragStart(cm, e); },\n drop: operation(cm, onDrop),\n leave: function (e) {if (!signalDOMEvent(cm, e)) { clearDragCursor(cm); }}\n };\n\n var inp = d.input.getField();\n on(inp, \"keyup\", function (e) { return onKeyUp.call(cm, e); });\n on(inp, \"keydown\", operation(cm, onKeyDown));\n on(inp, \"keypress\", operation(cm, onKeyPress));\n on(inp, \"focus\", function (e) { return onFocus(cm, e); });\n on(inp, \"blur\", function (e) { return onBlur(cm, e); });\n }\n\n var initHooks = [];\n CodeMirror.defineInitHook = function (f) { return initHooks.push(f); };\n\n // Indent the given line. The how parameter can be \"smart\",\n // \"add\"/null, \"subtract\", or \"prev\". When aggressive is false\n // (typically set to true for forced single-line indents), empty\n // lines are not indented, and places where the mode returns Pass\n // are left alone.\n function indentLine(cm, n, how, aggressive) {\n var doc = cm.doc, state;\n if (how == null) { how = \"add\"; }\n if (how == \"smart\") {\n // Fall back to \"prev\" when the mode doesn't have an indentation\n // method.\n if (!doc.mode.indent) { how = \"prev\"; }\n else { state = getContextBefore(cm, n).state; }\n }\n\n var tabSize = cm.options.tabSize;\n var line = getLine(doc, n), curSpace = countColumn(line.text, null, tabSize);\n if (line.stateAfter) { line.stateAfter = null; }\n var curSpaceString = line.text.match(/^\\s*/)[0], indentation;\n if (!aggressive && !/\\S/.test(line.text)) {\n indentation = 0;\n how = \"not\";\n } else if (how == \"smart\") {\n indentation = doc.mode.indent(state, line.text.slice(curSpaceString.length), line.text);\n if (indentation == Pass || indentation > 150) {\n if (!aggressive) { return }\n how = \"prev\";\n }\n }\n if (how == \"prev\") {\n if (n > doc.first) { indentation = countColumn(getLine(doc, n-1).text, null, tabSize); }\n else { indentation = 0; }\n } else if (how == \"add\") {\n indentation = curSpace + cm.options.indentUnit;\n } else if (how == \"subtract\") {\n indentation = curSpace - cm.options.indentUnit;\n } else if (typeof how == \"number\") {\n indentation = curSpace + how;\n }\n indentation = Math.max(0, indentation);\n\n var indentString = \"\", pos = 0;\n if (cm.options.indentWithTabs)\n { for (var i = Math.floor(indentation / tabSize); i; --i) {pos += tabSize; indentString += \"\\t\";} }\n if (pos < indentation) { indentString += spaceStr(indentation - pos); }\n\n if (indentString != curSpaceString) {\n replaceRange(doc, indentString, Pos(n, 0), Pos(n, curSpaceString.length), \"+input\");\n line.stateAfter = null;\n return true\n } else {\n // Ensure that, if the cursor was in the whitespace at the start\n // of the line, it is moved to the end of that space.\n for (var i$1 = 0; i$1 < doc.sel.ranges.length; i$1++) {\n var range = doc.sel.ranges[i$1];\n if (range.head.line == n && range.head.ch < curSpaceString.length) {\n var pos$1 = Pos(n, curSpaceString.length);\n replaceOneSelection(doc, i$1, new Range(pos$1, pos$1));\n break\n }\n }\n }\n }\n\n // This will be set to a {lineWise: bool, text: [string]} object, so\n // that, when pasting, we know what kind of selections the copied\n // text was made out of.\n var lastCopied = null;\n\n function setLastCopied(newLastCopied) {\n lastCopied = newLastCopied;\n }\n\n function applyTextInput(cm, inserted, deleted, sel, origin) {\n var doc = cm.doc;\n cm.display.shift = false;\n if (!sel) { sel = doc.sel; }\n\n var recent = +new Date - 200;\n var paste = origin == \"paste\" || cm.state.pasteIncoming > recent;\n var textLines = splitLinesAuto(inserted), multiPaste = null;\n // When pasting N lines into N selections, insert one line per selection\n if (paste && sel.ranges.length > 1) {\n if (lastCopied && lastCopied.text.join(\"\\n\") == inserted) {\n if (sel.ranges.length % lastCopied.text.length == 0) {\n multiPaste = [];\n for (var i = 0; i < lastCopied.text.length; i++)\n { multiPaste.push(doc.splitLines(lastCopied.text[i])); }\n }\n } else if (textLines.length == sel.ranges.length && cm.options.pasteLinesPerSelection) {\n multiPaste = map(textLines, function (l) { return [l]; });\n }\n }\n\n var updateInput = cm.curOp.updateInput;\n // Normal behavior is to insert the new text into every selection\n for (var i$1 = sel.ranges.length - 1; i$1 >= 0; i$1--) {\n var range = sel.ranges[i$1];\n var from = range.from(), to = range.to();\n if (range.empty()) {\n if (deleted && deleted > 0) // Handle deletion\n { from = Pos(from.line, from.ch - deleted); }\n else if (cm.state.overwrite && !paste) // Handle overwrite\n { to = Pos(to.line, Math.min(getLine(doc, to.line).text.length, to.ch + lst(textLines).length)); }\n else if (paste && lastCopied && lastCopied.lineWise && lastCopied.text.join(\"\\n\") == textLines.join(\"\\n\"))\n { from = to = Pos(from.line, 0); }\n }\n var changeEvent = {from: from, to: to, text: multiPaste ? multiPaste[i$1 % multiPaste.length] : textLines,\n origin: origin || (paste ? \"paste\" : cm.state.cutIncoming > recent ? \"cut\" : \"+input\")};\n makeChange(cm.doc, changeEvent);\n signalLater(cm, \"inputRead\", cm, changeEvent);\n }\n if (inserted && !paste)\n { triggerElectric(cm, inserted); }\n\n ensureCursorVisible(cm);\n if (cm.curOp.updateInput < 2) { cm.curOp.updateInput = updateInput; }\n cm.curOp.typing = true;\n cm.state.pasteIncoming = cm.state.cutIncoming = -1;\n }\n\n function handlePaste(e, cm) {\n var pasted = e.clipboardData && e.clipboardData.getData(\"Text\");\n if (pasted) {\n e.preventDefault();\n if (!cm.isReadOnly() && !cm.options.disableInput && cm.hasFocus())\n { runInOp(cm, function () { return applyTextInput(cm, pasted, 0, null, \"paste\"); }); }\n return true\n }\n }\n\n function triggerElectric(cm, inserted) {\n // When an 'electric' character is inserted, immediately trigger a reindent\n if (!cm.options.electricChars || !cm.options.smartIndent) { return }\n var sel = cm.doc.sel;\n\n for (var i = sel.ranges.length - 1; i >= 0; i--) {\n var range = sel.ranges[i];\n if (range.head.ch > 100 || (i && sel.ranges[i - 1].head.line == range.head.line)) { continue }\n var mode = cm.getModeAt(range.head);\n var indented = false;\n if (mode.electricChars) {\n for (var j = 0; j < mode.electricChars.length; j++)\n { if (inserted.indexOf(mode.electricChars.charAt(j)) > -1) {\n indented = indentLine(cm, range.head.line, \"smart\");\n break\n } }\n } else if (mode.electricInput) {\n if (mode.electricInput.test(getLine(cm.doc, range.head.line).text.slice(0, range.head.ch)))\n { indented = indentLine(cm, range.head.line, \"smart\"); }\n }\n if (indented) { signalLater(cm, \"electricInput\", cm, range.head.line); }\n }\n }\n\n function copyableRanges(cm) {\n var text = [], ranges = [];\n for (var i = 0; i < cm.doc.sel.ranges.length; i++) {\n var line = cm.doc.sel.ranges[i].head.line;\n var lineRange = {anchor: Pos(line, 0), head: Pos(line + 1, 0)};\n ranges.push(lineRange);\n text.push(cm.getRange(lineRange.anchor, lineRange.head));\n }\n return {text: text, ranges: ranges}\n }\n\n function disableBrowserMagic(field, spellcheck, autocorrect, autocapitalize) {\n field.setAttribute(\"autocorrect\", autocorrect ? \"on\" : \"off\");\n field.setAttribute(\"autocapitalize\", autocapitalize ? \"on\" : \"off\");\n field.setAttribute(\"spellcheck\", !!spellcheck);\n }\n\n function hiddenTextarea() {\n var te = elt(\"textarea\", null, null, \"position: absolute; bottom: -1em; padding: 0; width: 1px; height: 1em; min-height: 1em; outline: none\");\n var div = elt(\"div\", [te], null, \"overflow: hidden; position: relative; width: 3px; height: 0px;\");\n // The textarea is kept positioned near the cursor to prevent the\n // fact that it'll be scrolled into view on input from scrolling\n // our fake cursor out of view. On webkit, when wrap=off, paste is\n // very slow. So make the area wide instead.\n if (webkit) { te.style.width = \"1000px\"; }\n else { te.setAttribute(\"wrap\", \"off\"); }\n // If border: 0; -- iOS fails to open keyboard (issue #1287)\n if (ios) { te.style.border = \"1px solid black\"; }\n return div\n }\n\n // The publicly visible API. Note that methodOp(f) means\n // 'wrap f in an operation, performed on its `this` parameter'.\n\n // This is not the complete set of editor methods. Most of the\n // methods defined on the Doc type are also injected into\n // CodeMirror.prototype, for backwards compatibility and\n // convenience.\n\n function addEditorMethods(CodeMirror) {\n var optionHandlers = CodeMirror.optionHandlers;\n\n var helpers = CodeMirror.helpers = {};\n\n CodeMirror.prototype = {\n constructor: CodeMirror,\n focus: function(){win(this).focus(); this.display.input.focus();},\n\n setOption: function(option, value) {\n var options = this.options, old = options[option];\n if (options[option] == value && option != \"mode\") { return }\n options[option] = value;\n if (optionHandlers.hasOwnProperty(option))\n { operation(this, optionHandlers[option])(this, value, old); }\n signal(this, \"optionChange\", this, option);\n },\n\n getOption: function(option) {return this.options[option]},\n getDoc: function() {return this.doc},\n\n addKeyMap: function(map, bottom) {\n this.state.keyMaps[bottom ? \"push\" : \"unshift\"](getKeyMap(map));\n },\n removeKeyMap: function(map) {\n var maps = this.state.keyMaps;\n for (var i = 0; i < maps.length; ++i)\n { if (maps[i] == map || maps[i].name == map) {\n maps.splice(i, 1);\n return true\n } }\n },\n\n addOverlay: methodOp(function(spec, options) {\n var mode = spec.token ? spec : CodeMirror.getMode(this.options, spec);\n if (mode.startState) { throw new Error(\"Overlays may not be stateful.\") }\n insertSorted(this.state.overlays,\n {mode: mode, modeSpec: spec, opaque: options && options.opaque,\n priority: (options && options.priority) || 0},\n function (overlay) { return overlay.priority; });\n this.state.modeGen++;\n regChange(this);\n }),\n removeOverlay: methodOp(function(spec) {\n var overlays = this.state.overlays;\n for (var i = 0; i < overlays.length; ++i) {\n var cur = overlays[i].modeSpec;\n if (cur == spec || typeof spec == \"string\" && cur.name == spec) {\n overlays.splice(i, 1);\n this.state.modeGen++;\n regChange(this);\n return\n }\n }\n }),\n\n indentLine: methodOp(function(n, dir, aggressive) {\n if (typeof dir != \"string\" && typeof dir != \"number\") {\n if (dir == null) { dir = this.options.smartIndent ? \"smart\" : \"prev\"; }\n else { dir = dir ? \"add\" : \"subtract\"; }\n }\n if (isLine(this.doc, n)) { indentLine(this, n, dir, aggressive); }\n }),\n indentSelection: methodOp(function(how) {\n var ranges = this.doc.sel.ranges, end = -1;\n for (var i = 0; i < ranges.length; i++) {\n var range = ranges[i];\n if (!range.empty()) {\n var from = range.from(), to = range.to();\n var start = Math.max(end, from.line);\n end = Math.min(this.lastLine(), to.line - (to.ch ? 0 : 1)) + 1;\n for (var j = start; j < end; ++j)\n { indentLine(this, j, how); }\n var newRanges = this.doc.sel.ranges;\n if (from.ch == 0 && ranges.length == newRanges.length && newRanges[i].from().ch > 0)\n { replaceOneSelection(this.doc, i, new Range(from, newRanges[i].to()), sel_dontScroll); }\n } else if (range.head.line > end) {\n indentLine(this, range.head.line, how, true);\n end = range.head.line;\n if (i == this.doc.sel.primIndex) { ensureCursorVisible(this); }\n }\n }\n }),\n\n // Fetch the parser token for a given character. Useful for hacks\n // that want to inspect the mode state (say, for completion).\n getTokenAt: function(pos, precise) {\n return takeToken(this, pos, precise)\n },\n\n getLineTokens: function(line, precise) {\n return takeToken(this, Pos(line), precise, true)\n },\n\n getTokenTypeAt: function(pos) {\n pos = clipPos(this.doc, pos);\n var styles = getLineStyles(this, getLine(this.doc, pos.line));\n var before = 0, after = (styles.length - 1) / 2, ch = pos.ch;\n var type;\n if (ch == 0) { type = styles[2]; }\n else { for (;;) {\n var mid = (before + after) >> 1;\n if ((mid ? styles[mid * 2 - 1] : 0) >= ch) { after = mid; }\n else if (styles[mid * 2 + 1] < ch) { before = mid + 1; }\n else { type = styles[mid * 2 + 2]; break }\n } }\n var cut = type ? type.indexOf(\"overlay \") : -1;\n return cut < 0 ? type : cut == 0 ? null : type.slice(0, cut - 1)\n },\n\n getModeAt: function(pos) {\n var mode = this.doc.mode;\n if (!mode.innerMode) { return mode }\n return CodeMirror.innerMode(mode, this.getTokenAt(pos).state).mode\n },\n\n getHelper: function(pos, type) {\n return this.getHelpers(pos, type)[0]\n },\n\n getHelpers: function(pos, type) {\n var found = [];\n if (!helpers.hasOwnProperty(type)) { return found }\n var help = helpers[type], mode = this.getModeAt(pos);\n if (typeof mode[type] == \"string\") {\n if (help[mode[type]]) { found.push(help[mode[type]]); }\n } else if (mode[type]) {\n for (var i = 0; i < mode[type].length; i++) {\n var val = help[mode[type][i]];\n if (val) { found.push(val); }\n }\n } else if (mode.helperType && help[mode.helperType]) {\n found.push(help[mode.helperType]);\n } else if (help[mode.name]) {\n found.push(help[mode.name]);\n }\n for (var i$1 = 0; i$1 < help._global.length; i$1++) {\n var cur = help._global[i$1];\n if (cur.pred(mode, this) && indexOf(found, cur.val) == -1)\n { found.push(cur.val); }\n }\n return found\n },\n\n getStateAfter: function(line, precise) {\n var doc = this.doc;\n line = clipLine(doc, line == null ? doc.first + doc.size - 1: line);\n return getContextBefore(this, line + 1, precise).state\n },\n\n cursorCoords: function(start, mode) {\n var pos, range = this.doc.sel.primary();\n if (start == null) { pos = range.head; }\n else if (typeof start == \"object\") { pos = clipPos(this.doc, start); }\n else { pos = start ? range.from() : range.to(); }\n return cursorCoords(this, pos, mode || \"page\")\n },\n\n charCoords: function(pos, mode) {\n return charCoords(this, clipPos(this.doc, pos), mode || \"page\")\n },\n\n coordsChar: function(coords, mode) {\n coords = fromCoordSystem(this, coords, mode || \"page\");\n return coordsChar(this, coords.left, coords.top)\n },\n\n lineAtHeight: function(height, mode) {\n height = fromCoordSystem(this, {top: height, left: 0}, mode || \"page\").top;\n return lineAtHeight(this.doc, height + this.display.viewOffset)\n },\n heightAtLine: function(line, mode, includeWidgets) {\n var end = false, lineObj;\n if (typeof line == \"number\") {\n var last = this.doc.first + this.doc.size - 1;\n if (line < this.doc.first) { line = this.doc.first; }\n else if (line > last) { line = last; end = true; }\n lineObj = getLine(this.doc, line);\n } else {\n lineObj = line;\n }\n return intoCoordSystem(this, lineObj, {top: 0, left: 0}, mode || \"page\", includeWidgets || end).top +\n (end ? this.doc.height - heightAtLine(lineObj) : 0)\n },\n\n defaultTextHeight: function() { return textHeight(this.display) },\n defaultCharWidth: function() { return charWidth(this.display) },\n\n getViewport: function() { return {from: this.display.viewFrom, to: this.display.viewTo}},\n\n addWidget: function(pos, node, scroll, vert, horiz) {\n var display = this.display;\n pos = cursorCoords(this, clipPos(this.doc, pos));\n var top = pos.bottom, left = pos.left;\n node.style.position = \"absolute\";\n node.setAttribute(\"cm-ignore-events\", \"true\");\n this.display.input.setUneditable(node);\n display.sizer.appendChild(node);\n if (vert == \"over\") {\n top = pos.top;\n } else if (vert == \"above\" || vert == \"near\") {\n var vspace = Math.max(display.wrapper.clientHeight, this.doc.height),\n hspace = Math.max(display.sizer.clientWidth, display.lineSpace.clientWidth);\n // Default to positioning above (if specified and possible); otherwise default to positioning below\n if ((vert == 'above' || pos.bottom + node.offsetHeight > vspace) && pos.top > node.offsetHeight)\n { top = pos.top - node.offsetHeight; }\n else if (pos.bottom + node.offsetHeight <= vspace)\n { top = pos.bottom; }\n if (left + node.offsetWidth > hspace)\n { left = hspace - node.offsetWidth; }\n }\n node.style.top = top + \"px\";\n node.style.left = node.style.right = \"\";\n if (horiz == \"right\") {\n left = display.sizer.clientWidth - node.offsetWidth;\n node.style.right = \"0px\";\n } else {\n if (horiz == \"left\") { left = 0; }\n else if (horiz == \"middle\") { left = (display.sizer.clientWidth - node.offsetWidth) / 2; }\n node.style.left = left + \"px\";\n }\n if (scroll)\n { scrollIntoView(this, {left: left, top: top, right: left + node.offsetWidth, bottom: top + node.offsetHeight}); }\n },\n\n triggerOnKeyDown: methodOp(onKeyDown),\n triggerOnKeyPress: methodOp(onKeyPress),\n triggerOnKeyUp: onKeyUp,\n triggerOnMouseDown: methodOp(onMouseDown),\n\n execCommand: function(cmd) {\n if (commands.hasOwnProperty(cmd))\n { return commands[cmd].call(null, this) }\n },\n\n triggerElectric: methodOp(function(text) { triggerElectric(this, text); }),\n\n findPosH: function(from, amount, unit, visually) {\n var dir = 1;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n cur = findPosH(this.doc, cur, dir, unit, visually);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveH: methodOp(function(dir, unit) {\n var this$1 = this;\n\n this.extendSelectionsBy(function (range) {\n if (this$1.display.shift || this$1.doc.extend || range.empty())\n { return findPosH(this$1.doc, range.head, dir, unit, this$1.options.rtlMoveVisually) }\n else\n { return dir < 0 ? range.from() : range.to() }\n }, sel_move);\n }),\n\n deleteH: methodOp(function(dir, unit) {\n var sel = this.doc.sel, doc = this.doc;\n if (sel.somethingSelected())\n { doc.replaceSelection(\"\", null, \"+delete\"); }\n else\n { deleteNearSelection(this, function (range) {\n var other = findPosH(doc, range.head, dir, unit, false);\n return dir < 0 ? {from: other, to: range.head} : {from: range.head, to: other}\n }); }\n }),\n\n findPosV: function(from, amount, unit, goalColumn) {\n var dir = 1, x = goalColumn;\n if (amount < 0) { dir = -1; amount = -amount; }\n var cur = clipPos(this.doc, from);\n for (var i = 0; i < amount; ++i) {\n var coords = cursorCoords(this, cur, \"div\");\n if (x == null) { x = coords.left; }\n else { coords.left = x; }\n cur = findPosV(this, coords, dir, unit);\n if (cur.hitSide) { break }\n }\n return cur\n },\n\n moveV: methodOp(function(dir, unit) {\n var this$1 = this;\n\n var doc = this.doc, goals = [];\n var collapse = !this.display.shift && !doc.extend && doc.sel.somethingSelected();\n doc.extendSelectionsBy(function (range) {\n if (collapse)\n { return dir < 0 ? range.from() : range.to() }\n var headPos = cursorCoords(this$1, range.head, \"div\");\n if (range.goalColumn != null) { headPos.left = range.goalColumn; }\n goals.push(headPos.left);\n var pos = findPosV(this$1, headPos, dir, unit);\n if (unit == \"page\" && range == doc.sel.primary())\n { addToScrollTop(this$1, charCoords(this$1, pos, \"div\").top - headPos.top); }\n return pos\n }, sel_move);\n if (goals.length) { for (var i = 0; i < doc.sel.ranges.length; i++)\n { doc.sel.ranges[i].goalColumn = goals[i]; } }\n }),\n\n // Find the word at the given position (as returned by coordsChar).\n findWordAt: function(pos) {\n var doc = this.doc, line = getLine(doc, pos.line).text;\n var start = pos.ch, end = pos.ch;\n if (line) {\n var helper = this.getHelper(pos, \"wordChars\");\n if ((pos.sticky == \"before\" || end == line.length) && start) { --start; } else { ++end; }\n var startChar = line.charAt(start);\n var check = isWordChar(startChar, helper)\n ? function (ch) { return isWordChar(ch, helper); }\n : /\\s/.test(startChar) ? function (ch) { return /\\s/.test(ch); }\n : function (ch) { return (!/\\s/.test(ch) && !isWordChar(ch)); };\n while (start > 0 && check(line.charAt(start - 1))) { --start; }\n while (end < line.length && check(line.charAt(end))) { ++end; }\n }\n return new Range(Pos(pos.line, start), Pos(pos.line, end))\n },\n\n toggleOverwrite: function(value) {\n if (value != null && value == this.state.overwrite) { return }\n if (this.state.overwrite = !this.state.overwrite)\n { addClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n else\n { rmClass(this.display.cursorDiv, \"CodeMirror-overwrite\"); }\n\n signal(this, \"overwriteToggle\", this, this.state.overwrite);\n },\n hasFocus: function() { return this.display.input.getField() == activeElt(root(this)) },\n isReadOnly: function() { return !!(this.options.readOnly || this.doc.cantEdit) },\n\n scrollTo: methodOp(function (x, y) { scrollToCoords(this, x, y); }),\n getScrollInfo: function() {\n var scroller = this.display.scroller;\n return {left: scroller.scrollLeft, top: scroller.scrollTop,\n height: scroller.scrollHeight - scrollGap(this) - this.display.barHeight,\n width: scroller.scrollWidth - scrollGap(this) - this.display.barWidth,\n clientHeight: displayHeight(this), clientWidth: displayWidth(this)}\n },\n\n scrollIntoView: methodOp(function(range, margin) {\n if (range == null) {\n range = {from: this.doc.sel.primary().head, to: null};\n if (margin == null) { margin = this.options.cursorScrollMargin; }\n } else if (typeof range == \"number\") {\n range = {from: Pos(range, 0), to: null};\n } else if (range.from == null) {\n range = {from: range, to: null};\n }\n if (!range.to) { range.to = range.from; }\n range.margin = margin || 0;\n\n if (range.from.line != null) {\n scrollToRange(this, range);\n } else {\n scrollToCoordsRange(this, range.from, range.to, range.margin);\n }\n }),\n\n setSize: methodOp(function(width, height) {\n var this$1 = this;\n\n var interpret = function (val) { return typeof val == \"number\" || /^\\d+$/.test(String(val)) ? val + \"px\" : val; };\n if (width != null) { this.display.wrapper.style.width = interpret(width); }\n if (height != null) { this.display.wrapper.style.height = interpret(height); }\n if (this.options.lineWrapping) { clearLineMeasurementCache(this); }\n var lineNo = this.display.viewFrom;\n this.doc.iter(lineNo, this.display.viewTo, function (line) {\n if (line.widgets) { for (var i = 0; i < line.widgets.length; i++)\n { if (line.widgets[i].noHScroll) { regLineChange(this$1, lineNo, \"widget\"); break } } }\n ++lineNo;\n });\n this.curOp.forceUpdate = true;\n signal(this, \"refresh\", this);\n }),\n\n operation: function(f){return runInOp(this, f)},\n startOperation: function(){return startOperation(this)},\n endOperation: function(){return endOperation(this)},\n\n refresh: methodOp(function() {\n var oldHeight = this.display.cachedTextHeight;\n regChange(this);\n this.curOp.forceUpdate = true;\n clearCaches(this);\n scrollToCoords(this, this.doc.scrollLeft, this.doc.scrollTop);\n updateGutterSpace(this.display);\n if (oldHeight == null || Math.abs(oldHeight - textHeight(this.display)) > .5 || this.options.lineWrapping)\n { estimateLineHeights(this); }\n signal(this, \"refresh\", this);\n }),\n\n swapDoc: methodOp(function(doc) {\n var old = this.doc;\n old.cm = null;\n // Cancel the current text selection if any (#5821)\n if (this.state.selectingText) { this.state.selectingText(); }\n attachDoc(this, doc);\n clearCaches(this);\n this.display.input.reset();\n scrollToCoords(this, doc.scrollLeft, doc.scrollTop);\n this.curOp.forceScroll = true;\n signalLater(this, \"swapDoc\", this, old);\n return old\n }),\n\n phrase: function(phraseText) {\n var phrases = this.options.phrases;\n return phrases && Object.prototype.hasOwnProperty.call(phrases, phraseText) ? phrases[phraseText] : phraseText\n },\n\n getInputField: function(){return this.display.input.getField()},\n getWrapperElement: function(){return this.display.wrapper},\n getScrollerElement: function(){return this.display.scroller},\n getGutterElement: function(){return this.display.gutters}\n };\n eventMixin(CodeMirror);\n\n CodeMirror.registerHelper = function(type, name, value) {\n if (!helpers.hasOwnProperty(type)) { helpers[type] = CodeMirror[type] = {_global: []}; }\n helpers[type][name] = value;\n };\n CodeMirror.registerGlobalHelper = function(type, name, predicate, value) {\n CodeMirror.registerHelper(type, name, value);\n helpers[type]._global.push({pred: predicate, val: value});\n };\n }\n\n // Used for horizontal relative motion. Dir is -1 or 1 (left or\n // right), unit can be \"codepoint\", \"char\", \"column\" (like char, but\n // doesn't cross line boundaries), \"word\" (across next word), or\n // \"group\" (to the start of next group of word or\n // non-word-non-whitespace chars). The visually param controls\n // whether, in right-to-left text, direction 1 means to move towards\n // the next index in the string, or towards the character to the right\n // of the current position. The resulting position will have a\n // hitSide=true property if it reached the end of the document.\n function findPosH(doc, pos, dir, unit, visually) {\n var oldPos = pos;\n var origDir = dir;\n var lineObj = getLine(doc, pos.line);\n var lineDir = visually && doc.direction == \"rtl\" ? -dir : dir;\n function findNextLine() {\n var l = pos.line + lineDir;\n if (l < doc.first || l >= doc.first + doc.size) { return false }\n pos = new Pos(l, pos.ch, pos.sticky);\n return lineObj = getLine(doc, l)\n }\n function moveOnce(boundToLine) {\n var next;\n if (unit == \"codepoint\") {\n var ch = lineObj.text.charCodeAt(pos.ch + (dir > 0 ? 0 : -1));\n if (isNaN(ch)) {\n next = null;\n } else {\n var astral = dir > 0 ? ch >= 0xD800 && ch < 0xDC00 : ch >= 0xDC00 && ch < 0xDFFF;\n next = new Pos(pos.line, Math.max(0, Math.min(lineObj.text.length, pos.ch + dir * (astral ? 2 : 1))), -dir);\n }\n } else if (visually) {\n next = moveVisually(doc.cm, lineObj, pos, dir);\n } else {\n next = moveLogically(lineObj, pos, dir);\n }\n if (next == null) {\n if (!boundToLine && findNextLine())\n { pos = endOfLine(visually, doc.cm, lineObj, pos.line, lineDir); }\n else\n { return false }\n } else {\n pos = next;\n }\n return true\n }\n\n if (unit == \"char\" || unit == \"codepoint\") {\n moveOnce();\n } else if (unit == \"column\") {\n moveOnce(true);\n } else if (unit == \"word\" || unit == \"group\") {\n var sawType = null, group = unit == \"group\";\n var helper = doc.cm && doc.cm.getHelper(pos, \"wordChars\");\n for (var first = true;; first = false) {\n if (dir < 0 && !moveOnce(!first)) { break }\n var cur = lineObj.text.charAt(pos.ch) || \"\\n\";\n var type = isWordChar(cur, helper) ? \"w\"\n : group && cur == \"\\n\" ? \"n\"\n : !group || /\\s/.test(cur) ? null\n : \"p\";\n if (group && !first && !type) { type = \"s\"; }\n if (sawType && sawType != type) {\n if (dir < 0) {dir = 1; moveOnce(); pos.sticky = \"after\";}\n break\n }\n\n if (type) { sawType = type; }\n if (dir > 0 && !moveOnce(!first)) { break }\n }\n }\n var result = skipAtomic(doc, pos, oldPos, origDir, true);\n if (equalCursorPos(oldPos, result)) { result.hitSide = true; }\n return result\n }\n\n // For relative vertical movement. Dir may be -1 or 1. Unit can be\n // \"page\" or \"line\". The resulting position will have a hitSide=true\n // property if it reached the end of the document.\n function findPosV(cm, pos, dir, unit) {\n var doc = cm.doc, x = pos.left, y;\n if (unit == \"page\") {\n var pageSize = Math.min(cm.display.wrapper.clientHeight, win(cm).innerHeight || doc(cm).documentElement.clientHeight);\n var moveAmount = Math.max(pageSize - .5 * textHeight(cm.display), 3);\n y = (dir > 0 ? pos.bottom : pos.top) + dir * moveAmount;\n\n } else if (unit == \"line\") {\n y = dir > 0 ? pos.bottom + 3 : pos.top - 3;\n }\n var target;\n for (;;) {\n target = coordsChar(cm, x, y);\n if (!target.outside) { break }\n if (dir < 0 ? y <= 0 : y >= doc.height) { target.hitSide = true; break }\n y += dir * 5;\n }\n return target\n }\n\n // CONTENTEDITABLE INPUT STYLE\n\n var ContentEditableInput = function(cm) {\n this.cm = cm;\n this.lastAnchorNode = this.lastAnchorOffset = this.lastFocusNode = this.lastFocusOffset = null;\n this.polling = new Delayed();\n this.composing = null;\n this.gracePeriod = false;\n this.readDOMTimeout = null;\n };\n\n ContentEditableInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = input.cm;\n var div = input.div = display.lineDiv;\n div.contentEditable = true;\n disableBrowserMagic(div, cm.options.spellcheck, cm.options.autocorrect, cm.options.autocapitalize);\n\n function belongsToInput(e) {\n for (var t = e.target; t; t = t.parentNode) {\n if (t == div) { return true }\n if (/\\bCodeMirror-(?:line)?widget\\b/.test(t.className)) { break }\n }\n return false\n }\n\n on(div, \"paste\", function (e) {\n if (!belongsToInput(e) || signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n // IE doesn't fire input events, so we schedule a read for the pasted content in this way\n if (ie_version <= 11) { setTimeout(operation(cm, function () { return this$1.updateFromDOM(); }), 20); }\n });\n\n on(div, \"compositionstart\", function (e) {\n this$1.composing = {data: e.data, done: false};\n });\n on(div, \"compositionupdate\", function (e) {\n if (!this$1.composing) { this$1.composing = {data: e.data, done: false}; }\n });\n on(div, \"compositionend\", function (e) {\n if (this$1.composing) {\n if (e.data != this$1.composing.data) { this$1.readFromDOMSoon(); }\n this$1.composing.done = true;\n }\n });\n\n on(div, \"touchstart\", function () { return input.forceCompositionEnd(); });\n\n on(div, \"input\", function () {\n if (!this$1.composing) { this$1.readFromDOMSoon(); }\n });\n\n function onCopyCut(e) {\n if (!belongsToInput(e) || signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n if (e.type == \"cut\") { cm.replaceSelection(\"\", null, \"cut\"); }\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.operation(function () {\n cm.setSelections(ranges.ranges, 0, sel_dontScroll);\n cm.replaceSelection(\"\", null, \"cut\");\n });\n }\n }\n if (e.clipboardData) {\n e.clipboardData.clearData();\n var content = lastCopied.text.join(\"\\n\");\n // iOS exposes the clipboard API, but seems to discard content inserted into it\n e.clipboardData.setData(\"Text\", content);\n if (e.clipboardData.getData(\"Text\") == content) {\n e.preventDefault();\n return\n }\n }\n // Old-fashioned briefly-focus-a-textarea hack\n var kludge = hiddenTextarea(), te = kludge.firstChild;\n disableBrowserMagic(te);\n cm.display.lineSpace.insertBefore(kludge, cm.display.lineSpace.firstChild);\n te.value = lastCopied.text.join(\"\\n\");\n var hadFocus = activeElt(rootNode(div));\n selectInput(te);\n setTimeout(function () {\n cm.display.lineSpace.removeChild(kludge);\n hadFocus.focus();\n if (hadFocus == div) { input.showPrimarySelection(); }\n }, 50);\n }\n on(div, \"copy\", onCopyCut);\n on(div, \"cut\", onCopyCut);\n };\n\n ContentEditableInput.prototype.screenReaderLabelChanged = function (label) {\n // Label for screenreaders, accessibility\n if(label) {\n this.div.setAttribute('aria-label', label);\n } else {\n this.div.removeAttribute('aria-label');\n }\n };\n\n ContentEditableInput.prototype.prepareSelection = function () {\n var result = prepareSelection(this.cm, false);\n result.focus = activeElt(rootNode(this.div)) == this.div;\n return result\n };\n\n ContentEditableInput.prototype.showSelection = function (info, takeFocus) {\n if (!info || !this.cm.display.view.length) { return }\n if (info.focus || takeFocus) { this.showPrimarySelection(); }\n this.showMultipleSelections(info);\n };\n\n ContentEditableInput.prototype.getSelection = function () {\n return this.cm.display.wrapper.ownerDocument.getSelection()\n };\n\n ContentEditableInput.prototype.showPrimarySelection = function () {\n var sel = this.getSelection(), cm = this.cm, prim = cm.doc.sel.primary();\n var from = prim.from(), to = prim.to();\n\n if (cm.display.viewTo == cm.display.viewFrom || from.line >= cm.display.viewTo || to.line < cm.display.viewFrom) {\n sel.removeAllRanges();\n return\n }\n\n var curAnchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var curFocus = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (curAnchor && !curAnchor.bad && curFocus && !curFocus.bad &&\n cmp(minPos(curAnchor, curFocus), from) == 0 &&\n cmp(maxPos(curAnchor, curFocus), to) == 0)\n { return }\n\n var view = cm.display.view;\n var start = (from.line >= cm.display.viewFrom && posToDOM(cm, from)) ||\n {node: view[0].measure.map[2], offset: 0};\n var end = to.line < cm.display.viewTo && posToDOM(cm, to);\n if (!end) {\n var measure = view[view.length - 1].measure;\n var map = measure.maps ? measure.maps[measure.maps.length - 1] : measure.map;\n end = {node: map[map.length - 1], offset: map[map.length - 2] - map[map.length - 3]};\n }\n\n if (!start || !end) {\n sel.removeAllRanges();\n return\n }\n\n var old = sel.rangeCount && sel.getRangeAt(0), rng;\n try { rng = range(start.node, start.offset, end.offset, end.node); }\n catch(e) {} // Our model of the DOM might be outdated, in which case the range we try to set can be impossible\n if (rng) {\n if (!gecko && cm.state.focused) {\n sel.collapse(start.node, start.offset);\n if (!rng.collapsed) {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n } else {\n sel.removeAllRanges();\n sel.addRange(rng);\n }\n if (old && sel.anchorNode == null) { sel.addRange(old); }\n else if (gecko) { this.startGracePeriod(); }\n }\n this.rememberSelection();\n };\n\n ContentEditableInput.prototype.startGracePeriod = function () {\n var this$1 = this;\n\n clearTimeout(this.gracePeriod);\n this.gracePeriod = setTimeout(function () {\n this$1.gracePeriod = false;\n if (this$1.selectionChanged())\n { this$1.cm.operation(function () { return this$1.cm.curOp.selectionChanged = true; }); }\n }, 20);\n };\n\n ContentEditableInput.prototype.showMultipleSelections = function (info) {\n removeChildrenAndAdd(this.cm.display.cursorDiv, info.cursors);\n removeChildrenAndAdd(this.cm.display.selectionDiv, info.selection);\n };\n\n ContentEditableInput.prototype.rememberSelection = function () {\n var sel = this.getSelection();\n this.lastAnchorNode = sel.anchorNode; this.lastAnchorOffset = sel.anchorOffset;\n this.lastFocusNode = sel.focusNode; this.lastFocusOffset = sel.focusOffset;\n };\n\n ContentEditableInput.prototype.selectionInEditor = function () {\n var sel = this.getSelection();\n if (!sel.rangeCount) { return false }\n var node = sel.getRangeAt(0).commonAncestorContainer;\n return contains(this.div, node)\n };\n\n ContentEditableInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\") {\n if (!this.selectionInEditor() || activeElt(rootNode(this.div)) != this.div)\n { this.showSelection(this.prepareSelection(), true); }\n this.div.focus();\n }\n };\n ContentEditableInput.prototype.blur = function () { this.div.blur(); };\n ContentEditableInput.prototype.getField = function () { return this.div };\n\n ContentEditableInput.prototype.supportsTouch = function () { return true };\n\n ContentEditableInput.prototype.receivedFocus = function () {\n var this$1 = this;\n\n var input = this;\n if (this.selectionInEditor())\n { setTimeout(function () { return this$1.pollSelection(); }, 20); }\n else\n { runInOp(this.cm, function () { return input.cm.curOp.selectionChanged = true; }); }\n\n function poll() {\n if (input.cm.state.focused) {\n input.pollSelection();\n input.polling.set(input.cm.options.pollInterval, poll);\n }\n }\n this.polling.set(this.cm.options.pollInterval, poll);\n };\n\n ContentEditableInput.prototype.selectionChanged = function () {\n var sel = this.getSelection();\n return sel.anchorNode != this.lastAnchorNode || sel.anchorOffset != this.lastAnchorOffset ||\n sel.focusNode != this.lastFocusNode || sel.focusOffset != this.lastFocusOffset\n };\n\n ContentEditableInput.prototype.pollSelection = function () {\n if (this.readDOMTimeout != null || this.gracePeriod || !this.selectionChanged()) { return }\n var sel = this.getSelection(), cm = this.cm;\n // On Android Chrome (version 56, at least), backspacing into an\n // uneditable block element will put the cursor in that element,\n // and then, because it's not editable, hide the virtual keyboard.\n // Because Android doesn't allow us to actually detect backspace\n // presses in a sane way, this code checks for when that happens\n // and simulates a backspace press in this case.\n if (android && chrome && this.cm.display.gutterSpecs.length && isInGutter(sel.anchorNode)) {\n this.cm.triggerOnKeyDown({type: \"keydown\", keyCode: 8, preventDefault: Math.abs});\n this.blur();\n this.focus();\n return\n }\n if (this.composing) { return }\n this.rememberSelection();\n var anchor = domToPos(cm, sel.anchorNode, sel.anchorOffset);\n var head = domToPos(cm, sel.focusNode, sel.focusOffset);\n if (anchor && head) { runInOp(cm, function () {\n setSelection(cm.doc, simpleSelection(anchor, head), sel_dontScroll);\n if (anchor.bad || head.bad) { cm.curOp.selectionChanged = true; }\n }); }\n };\n\n ContentEditableInput.prototype.pollContent = function () {\n if (this.readDOMTimeout != null) {\n clearTimeout(this.readDOMTimeout);\n this.readDOMTimeout = null;\n }\n\n var cm = this.cm, display = cm.display, sel = cm.doc.sel.primary();\n var from = sel.from(), to = sel.to();\n if (from.ch == 0 && from.line > cm.firstLine())\n { from = Pos(from.line - 1, getLine(cm.doc, from.line - 1).length); }\n if (to.ch == getLine(cm.doc, to.line).text.length && to.line < cm.lastLine())\n { to = Pos(to.line + 1, 0); }\n if (from.line < display.viewFrom || to.line > display.viewTo - 1) { return false }\n\n var fromIndex, fromLine, fromNode;\n if (from.line == display.viewFrom || (fromIndex = findViewIndex(cm, from.line)) == 0) {\n fromLine = lineNo(display.view[0].line);\n fromNode = display.view[0].node;\n } else {\n fromLine = lineNo(display.view[fromIndex].line);\n fromNode = display.view[fromIndex - 1].node.nextSibling;\n }\n var toIndex = findViewIndex(cm, to.line);\n var toLine, toNode;\n if (toIndex == display.view.length - 1) {\n toLine = display.viewTo - 1;\n toNode = display.lineDiv.lastChild;\n } else {\n toLine = lineNo(display.view[toIndex + 1].line) - 1;\n toNode = display.view[toIndex + 1].node.previousSibling;\n }\n\n if (!fromNode) { return false }\n var newText = cm.doc.splitLines(domTextBetween(cm, fromNode, toNode, fromLine, toLine));\n var oldText = getBetween(cm.doc, Pos(fromLine, 0), Pos(toLine, getLine(cm.doc, toLine).text.length));\n while (newText.length > 1 && oldText.length > 1) {\n if (lst(newText) == lst(oldText)) { newText.pop(); oldText.pop(); toLine--; }\n else if (newText[0] == oldText[0]) { newText.shift(); oldText.shift(); fromLine++; }\n else { break }\n }\n\n var cutFront = 0, cutEnd = 0;\n var newTop = newText[0], oldTop = oldText[0], maxCutFront = Math.min(newTop.length, oldTop.length);\n while (cutFront < maxCutFront && newTop.charCodeAt(cutFront) == oldTop.charCodeAt(cutFront))\n { ++cutFront; }\n var newBot = lst(newText), oldBot = lst(oldText);\n var maxCutEnd = Math.min(newBot.length - (newText.length == 1 ? cutFront : 0),\n oldBot.length - (oldText.length == 1 ? cutFront : 0));\n while (cutEnd < maxCutEnd &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1))\n { ++cutEnd; }\n // Try to move start of change to start of selection if ambiguous\n if (newText.length == 1 && oldText.length == 1 && fromLine == from.line) {\n while (cutFront && cutFront > from.ch &&\n newBot.charCodeAt(newBot.length - cutEnd - 1) == oldBot.charCodeAt(oldBot.length - cutEnd - 1)) {\n cutFront--;\n cutEnd++;\n }\n }\n\n newText[newText.length - 1] = newBot.slice(0, newBot.length - cutEnd).replace(/^\\u200b+/, \"\");\n newText[0] = newText[0].slice(cutFront).replace(/\\u200b+$/, \"\");\n\n var chFrom = Pos(fromLine, cutFront);\n var chTo = Pos(toLine, oldText.length ? lst(oldText).length - cutEnd : 0);\n if (newText.length > 1 || newText[0] || cmp(chFrom, chTo)) {\n replaceRange(cm.doc, newText, chFrom, chTo, \"+input\");\n return true\n }\n };\n\n ContentEditableInput.prototype.ensurePolled = function () {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.reset = function () {\n this.forceCompositionEnd();\n };\n ContentEditableInput.prototype.forceCompositionEnd = function () {\n if (!this.composing) { return }\n clearTimeout(this.readDOMTimeout);\n this.composing = null;\n this.updateFromDOM();\n this.div.blur();\n this.div.focus();\n };\n ContentEditableInput.prototype.readFromDOMSoon = function () {\n var this$1 = this;\n\n if (this.readDOMTimeout != null) { return }\n this.readDOMTimeout = setTimeout(function () {\n this$1.readDOMTimeout = null;\n if (this$1.composing) {\n if (this$1.composing.done) { this$1.composing = null; }\n else { return }\n }\n this$1.updateFromDOM();\n }, 80);\n };\n\n ContentEditableInput.prototype.updateFromDOM = function () {\n var this$1 = this;\n\n if (this.cm.isReadOnly() || !this.pollContent())\n { runInOp(this.cm, function () { return regChange(this$1.cm); }); }\n };\n\n ContentEditableInput.prototype.setUneditable = function (node) {\n node.contentEditable = \"false\";\n };\n\n ContentEditableInput.prototype.onKeyPress = function (e) {\n if (e.charCode == 0 || this.composing) { return }\n e.preventDefault();\n if (!this.cm.isReadOnly())\n { operation(this.cm, applyTextInput)(this.cm, String.fromCharCode(e.charCode == null ? e.keyCode : e.charCode), 0); }\n };\n\n ContentEditableInput.prototype.readOnlyChanged = function (val) {\n this.div.contentEditable = String(val != \"nocursor\");\n };\n\n ContentEditableInput.prototype.onContextMenu = function () {};\n ContentEditableInput.prototype.resetPosition = function () {};\n\n ContentEditableInput.prototype.needsContentAttribute = true;\n\n function posToDOM(cm, pos) {\n var view = findViewForLine(cm, pos.line);\n if (!view || view.hidden) { return null }\n var line = getLine(cm.doc, pos.line);\n var info = mapFromLineView(view, line, pos.line);\n\n var order = getOrder(line, cm.doc.direction), side = \"left\";\n if (order) {\n var partPos = getBidiPartAt(order, pos.ch);\n side = partPos % 2 ? \"right\" : \"left\";\n }\n var result = nodeAndOffsetInLineMap(info.map, pos.ch, side);\n result.offset = result.collapse == \"right\" ? result.end : result.start;\n return result\n }\n\n function isInGutter(node) {\n for (var scan = node; scan; scan = scan.parentNode)\n { if (/CodeMirror-gutter-wrapper/.test(scan.className)) { return true } }\n return false\n }\n\n function badPos(pos, bad) { if (bad) { pos.bad = true; } return pos }\n\n function domTextBetween(cm, from, to, fromLine, toLine) {\n var text = \"\", closing = false, lineSep = cm.doc.lineSeparator(), extraLinebreak = false;\n function recognizeMarker(id) { return function (marker) { return marker.id == id; } }\n function close() {\n if (closing) {\n text += lineSep;\n if (extraLinebreak) { text += lineSep; }\n closing = extraLinebreak = false;\n }\n }\n function addText(str) {\n if (str) {\n close();\n text += str;\n }\n }\n function walk(node) {\n if (node.nodeType == 1) {\n var cmText = node.getAttribute(\"cm-text\");\n if (cmText) {\n addText(cmText);\n return\n }\n var markerID = node.getAttribute(\"cm-marker\"), range;\n if (markerID) {\n var found = cm.findMarks(Pos(fromLine, 0), Pos(toLine + 1, 0), recognizeMarker(+markerID));\n if (found.length && (range = found[0].find(0)))\n { addText(getBetween(cm.doc, range.from, range.to).join(lineSep)); }\n return\n }\n if (node.getAttribute(\"contenteditable\") == \"false\") { return }\n var isBlock = /^(pre|div|p|li|table|br)$/i.test(node.nodeName);\n if (!/^br$/i.test(node.nodeName) && node.textContent.length == 0) { return }\n\n if (isBlock) { close(); }\n for (var i = 0; i < node.childNodes.length; i++)\n { walk(node.childNodes[i]); }\n\n if (/^(pre|p)$/i.test(node.nodeName)) { extraLinebreak = true; }\n if (isBlock) { closing = true; }\n } else if (node.nodeType == 3) {\n addText(node.nodeValue.replace(/\\u200b/g, \"\").replace(/\\u00a0/g, \" \"));\n }\n }\n for (;;) {\n walk(from);\n if (from == to) { break }\n from = from.nextSibling;\n extraLinebreak = false;\n }\n return text\n }\n\n function domToPos(cm, node, offset) {\n var lineNode;\n if (node == cm.display.lineDiv) {\n lineNode = cm.display.lineDiv.childNodes[offset];\n if (!lineNode) { return badPos(cm.clipPos(Pos(cm.display.viewTo - 1)), true) }\n node = null; offset = 0;\n } else {\n for (lineNode = node;; lineNode = lineNode.parentNode) {\n if (!lineNode || lineNode == cm.display.lineDiv) { return null }\n if (lineNode.parentNode && lineNode.parentNode == cm.display.lineDiv) { break }\n }\n }\n for (var i = 0; i < cm.display.view.length; i++) {\n var lineView = cm.display.view[i];\n if (lineView.node == lineNode)\n { return locateNodeInLineView(lineView, node, offset) }\n }\n }\n\n function locateNodeInLineView(lineView, node, offset) {\n var wrapper = lineView.text.firstChild, bad = false;\n if (!node || !contains(wrapper, node)) { return badPos(Pos(lineNo(lineView.line), 0), true) }\n if (node == wrapper) {\n bad = true;\n node = wrapper.childNodes[offset];\n offset = 0;\n if (!node) {\n var line = lineView.rest ? lst(lineView.rest) : lineView.line;\n return badPos(Pos(lineNo(line), line.text.length), bad)\n }\n }\n\n var textNode = node.nodeType == 3 ? node : null, topNode = node;\n if (!textNode && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {\n textNode = node.firstChild;\n if (offset) { offset = textNode.nodeValue.length; }\n }\n while (topNode.parentNode != wrapper) { topNode = topNode.parentNode; }\n var measure = lineView.measure, maps = measure.maps;\n\n function find(textNode, topNode, offset) {\n for (var i = -1; i < (maps ? maps.length : 0); i++) {\n var map = i < 0 ? measure.map : maps[i];\n for (var j = 0; j < map.length; j += 3) {\n var curNode = map[j + 2];\n if (curNode == textNode || curNode == topNode) {\n var line = lineNo(i < 0 ? lineView.line : lineView.rest[i]);\n var ch = map[j] + offset;\n if (offset < 0 || curNode != textNode) { ch = map[j + (offset ? 1 : 0)]; }\n return Pos(line, ch)\n }\n }\n }\n }\n var found = find(textNode, topNode, offset);\n if (found) { return badPos(found, bad) }\n\n // FIXME this is all really shaky. might handle the few cases it needs to handle, but likely to cause problems\n for (var after = topNode.nextSibling, dist = textNode ? textNode.nodeValue.length - offset : 0; after; after = after.nextSibling) {\n found = find(after, after.firstChild, 0);\n if (found)\n { return badPos(Pos(found.line, found.ch - dist), bad) }\n else\n { dist += after.textContent.length; }\n }\n for (var before = topNode.previousSibling, dist$1 = offset; before; before = before.previousSibling) {\n found = find(before, before.firstChild, -1);\n if (found)\n { return badPos(Pos(found.line, found.ch + dist$1), bad) }\n else\n { dist$1 += before.textContent.length; }\n }\n }\n\n // TEXTAREA INPUT STYLE\n\n var TextareaInput = function(cm) {\n this.cm = cm;\n // See input.poll and input.reset\n this.prevInput = \"\";\n\n // Flag that indicates whether we expect input to appear real soon\n // now (after some event like 'keypress' or 'input') and are\n // polling intensively.\n this.pollingFast = false;\n // Self-resetting timeout for the poller\n this.polling = new Delayed();\n // Used to work around IE issue with selection being forgotten when focus moves away from textarea\n this.hasSelection = false;\n this.composing = null;\n this.resetting = false;\n };\n\n TextareaInput.prototype.init = function (display) {\n var this$1 = this;\n\n var input = this, cm = this.cm;\n this.createField(display);\n var te = this.textarea;\n\n display.wrapper.insertBefore(this.wrapper, display.wrapper.firstChild);\n\n // Needed to hide big blue blinking cursor on Mobile Safari (doesn't seem to work in iOS 8 anymore)\n if (ios) { te.style.width = \"0px\"; }\n\n on(te, \"input\", function () {\n if (ie && ie_version >= 9 && this$1.hasSelection) { this$1.hasSelection = null; }\n input.poll();\n });\n\n on(te, \"paste\", function (e) {\n if (signalDOMEvent(cm, e) || handlePaste(e, cm)) { return }\n\n cm.state.pasteIncoming = +new Date;\n input.fastPoll();\n });\n\n function prepareCopyCut(e) {\n if (signalDOMEvent(cm, e)) { return }\n if (cm.somethingSelected()) {\n setLastCopied({lineWise: false, text: cm.getSelections()});\n } else if (!cm.options.lineWiseCopyCut) {\n return\n } else {\n var ranges = copyableRanges(cm);\n setLastCopied({lineWise: true, text: ranges.text});\n if (e.type == \"cut\") {\n cm.setSelections(ranges.ranges, null, sel_dontScroll);\n } else {\n input.prevInput = \"\";\n te.value = ranges.text.join(\"\\n\");\n selectInput(te);\n }\n }\n if (e.type == \"cut\") { cm.state.cutIncoming = +new Date; }\n }\n on(te, \"cut\", prepareCopyCut);\n on(te, \"copy\", prepareCopyCut);\n\n on(display.scroller, \"paste\", function (e) {\n if (eventInWidget(display, e) || signalDOMEvent(cm, e)) { return }\n if (!te.dispatchEvent) {\n cm.state.pasteIncoming = +new Date;\n input.focus();\n return\n }\n\n // Pass the `paste` event to the textarea so it's handled by its event listener.\n var event = new Event(\"paste\");\n event.clipboardData = e.clipboardData;\n te.dispatchEvent(event);\n });\n\n // Prevent normal selection in the editor (we handle our own)\n on(display.lineSpace, \"selectstart\", function (e) {\n if (!eventInWidget(display, e)) { e_preventDefault(e); }\n });\n\n on(te, \"compositionstart\", function () {\n var start = cm.getCursor(\"from\");\n if (input.composing) { input.composing.range.clear(); }\n input.composing = {\n start: start,\n range: cm.markText(start, cm.getCursor(\"to\"), {className: \"CodeMirror-composing\"})\n };\n });\n on(te, \"compositionend\", function () {\n if (input.composing) {\n input.poll();\n input.composing.range.clear();\n input.composing = null;\n }\n });\n };\n\n TextareaInput.prototype.createField = function (_display) {\n // Wraps and hides input textarea\n this.wrapper = hiddenTextarea();\n // The semihidden textarea that is focused when the editor is\n // focused, and receives input.\n this.textarea = this.wrapper.firstChild;\n var opts = this.cm.options;\n disableBrowserMagic(this.textarea, opts.spellcheck, opts.autocorrect, opts.autocapitalize);\n };\n\n TextareaInput.prototype.screenReaderLabelChanged = function (label) {\n // Label for screenreaders, accessibility\n if(label) {\n this.textarea.setAttribute('aria-label', label);\n } else {\n this.textarea.removeAttribute('aria-label');\n }\n };\n\n TextareaInput.prototype.prepareSelection = function () {\n // Redraw the selection and/or cursor\n var cm = this.cm, display = cm.display, doc = cm.doc;\n var result = prepareSelection(cm);\n\n // Move the hidden textarea near the cursor to prevent scrolling artifacts\n if (cm.options.moveInputWithCursor) {\n var headPos = cursorCoords(cm, doc.sel.primary().head, \"div\");\n var wrapOff = display.wrapper.getBoundingClientRect(), lineOff = display.lineDiv.getBoundingClientRect();\n result.teTop = Math.max(0, Math.min(display.wrapper.clientHeight - 10,\n headPos.top + lineOff.top - wrapOff.top));\n result.teLeft = Math.max(0, Math.min(display.wrapper.clientWidth - 10,\n headPos.left + lineOff.left - wrapOff.left));\n }\n\n return result\n };\n\n TextareaInput.prototype.showSelection = function (drawn) {\n var cm = this.cm, display = cm.display;\n removeChildrenAndAdd(display.cursorDiv, drawn.cursors);\n removeChildrenAndAdd(display.selectionDiv, drawn.selection);\n if (drawn.teTop != null) {\n this.wrapper.style.top = drawn.teTop + \"px\";\n this.wrapper.style.left = drawn.teLeft + \"px\";\n }\n };\n\n // Reset the input to correspond to the selection (or to be empty,\n // when not typing and nothing is selected)\n TextareaInput.prototype.reset = function (typing) {\n if (this.contextMenuPending || this.composing && typing) { return }\n var cm = this.cm;\n this.resetting = true;\n if (cm.somethingSelected()) {\n this.prevInput = \"\";\n var content = cm.getSelection();\n this.textarea.value = content;\n if (cm.state.focused) { selectInput(this.textarea); }\n if (ie && ie_version >= 9) { this.hasSelection = content; }\n } else if (!typing) {\n this.prevInput = this.textarea.value = \"\";\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n }\n this.resetting = false;\n };\n\n TextareaInput.prototype.getField = function () { return this.textarea };\n\n TextareaInput.prototype.supportsTouch = function () { return false };\n\n TextareaInput.prototype.focus = function () {\n if (this.cm.options.readOnly != \"nocursor\" && (!mobile || activeElt(rootNode(this.textarea)) != this.textarea)) {\n try { this.textarea.focus(); }\n catch (e) {} // IE8 will throw if the textarea is display: none or not in DOM\n }\n };\n\n TextareaInput.prototype.blur = function () { this.textarea.blur(); };\n\n TextareaInput.prototype.resetPosition = function () {\n this.wrapper.style.top = this.wrapper.style.left = 0;\n };\n\n TextareaInput.prototype.receivedFocus = function () { this.slowPoll(); };\n\n // Poll for input changes, using the normal rate of polling. This\n // runs as long as the editor is focused.\n TextareaInput.prototype.slowPoll = function () {\n var this$1 = this;\n\n if (this.pollingFast) { return }\n this.polling.set(this.cm.options.pollInterval, function () {\n this$1.poll();\n if (this$1.cm.state.focused) { this$1.slowPoll(); }\n });\n };\n\n // When an event has just come in that is likely to add or change\n // something in the input textarea, we poll faster, to ensure that\n // the change appears on the screen quickly.\n TextareaInput.prototype.fastPoll = function () {\n var missed = false, input = this;\n input.pollingFast = true;\n function p() {\n var changed = input.poll();\n if (!changed && !missed) {missed = true; input.polling.set(60, p);}\n else {input.pollingFast = false; input.slowPoll();}\n }\n input.polling.set(20, p);\n };\n\n // Read input from the textarea, and update the document to match.\n // When something is selected, it is present in the textarea, and\n // selected (unless it is huge, in which case a placeholder is\n // used). When nothing is selected, the cursor sits after previously\n // seen text (can be empty), which is stored in prevInput (we must\n // not reset the textarea when typing, because that breaks IME).\n TextareaInput.prototype.poll = function () {\n var this$1 = this;\n\n var cm = this.cm, input = this.textarea, prevInput = this.prevInput;\n // Since this is called a *lot*, try to bail out as cheaply as\n // possible when it is clear that nothing happened. hasSelection\n // will be the case when there is a lot of text in the textarea,\n // in which case reading its value would be expensive.\n if (this.contextMenuPending || this.resetting || !cm.state.focused ||\n (hasSelection(input) && !prevInput && !this.composing) ||\n cm.isReadOnly() || cm.options.disableInput || cm.state.keySeq)\n { return false }\n\n var text = input.value;\n // If nothing changed, bail.\n if (text == prevInput && !cm.somethingSelected()) { return false }\n // Work around nonsensical selection resetting in IE9/10, and\n // inexplicable appearance of private area unicode characters on\n // some key combos in Mac (#2689).\n if (ie && ie_version >= 9 && this.hasSelection === text ||\n mac && /[\\uf700-\\uf7ff]/.test(text)) {\n cm.display.input.reset();\n return false\n }\n\n if (cm.doc.sel == cm.display.selForContextMenu) {\n var first = text.charCodeAt(0);\n if (first == 0x200b && !prevInput) { prevInput = \"\\u200b\"; }\n if (first == 0x21da) { this.reset(); return this.cm.execCommand(\"undo\") }\n }\n // Find the part of the input that is actually new\n var same = 0, l = Math.min(prevInput.length, text.length);\n while (same < l && prevInput.charCodeAt(same) == text.charCodeAt(same)) { ++same; }\n\n runInOp(cm, function () {\n applyTextInput(cm, text.slice(same), prevInput.length - same,\n null, this$1.composing ? \"*compose\" : null);\n\n // Don't leave long text in the textarea, since it makes further polling slow\n if (text.length > 1000 || text.indexOf(\"\\n\") > -1) { input.value = this$1.prevInput = \"\"; }\n else { this$1.prevInput = text; }\n\n if (this$1.composing) {\n this$1.composing.range.clear();\n this$1.composing.range = cm.markText(this$1.composing.start, cm.getCursor(\"to\"),\n {className: \"CodeMirror-composing\"});\n }\n });\n return true\n };\n\n TextareaInput.prototype.ensurePolled = function () {\n if (this.pollingFast && this.poll()) { this.pollingFast = false; }\n };\n\n TextareaInput.prototype.onKeyPress = function () {\n if (ie && ie_version >= 9) { this.hasSelection = null; }\n this.fastPoll();\n };\n\n TextareaInput.prototype.onContextMenu = function (e) {\n var input = this, cm = input.cm, display = cm.display, te = input.textarea;\n if (input.contextMenuPending) { input.contextMenuPending(); }\n var pos = posFromMouse(cm, e), scrollPos = display.scroller.scrollTop;\n if (!pos || presto) { return } // Opera is difficult.\n\n // Reset the current text selection only if the click is done outside of the selection\n // and 'resetSelectionOnContextMenu' option is true.\n var reset = cm.options.resetSelectionOnContextMenu;\n if (reset && cm.doc.sel.contains(pos) == -1)\n { operation(cm, setSelection)(cm.doc, simpleSelection(pos), sel_dontScroll); }\n\n var oldCSS = te.style.cssText, oldWrapperCSS = input.wrapper.style.cssText;\n var wrapperBox = input.wrapper.offsetParent.getBoundingClientRect();\n input.wrapper.style.cssText = \"position: static\";\n te.style.cssText = \"position: absolute; width: 30px; height: 30px;\\n top: \" + (e.clientY - wrapperBox.top - 5) + \"px; left: \" + (e.clientX - wrapperBox.left - 5) + \"px;\\n z-index: 1000; background: \" + (ie ? \"rgba(255, 255, 255, .05)\" : \"transparent\") + \";\\n outline: none; border-width: 0; outline: none; overflow: hidden; opacity: .05; filter: alpha(opacity=5);\";\n var oldScrollY;\n if (webkit) { oldScrollY = te.ownerDocument.defaultView.scrollY; } // Work around Chrome issue (#2712)\n display.input.focus();\n if (webkit) { te.ownerDocument.defaultView.scrollTo(null, oldScrollY); }\n display.input.reset();\n // Adds \"Select all\" to context menu in FF\n if (!cm.somethingSelected()) { te.value = input.prevInput = \" \"; }\n input.contextMenuPending = rehide;\n display.selForContextMenu = cm.doc.sel;\n clearTimeout(display.detectingSelectAll);\n\n // Select-all will be greyed out if there's nothing to select, so\n // this adds a zero-width space so that we can later check whether\n // it got selected.\n function prepareSelectAllHack() {\n if (te.selectionStart != null) {\n var selected = cm.somethingSelected();\n var extval = \"\\u200b\" + (selected ? te.value : \"\");\n te.value = \"\\u21da\"; // Used to catch context-menu undo\n te.value = extval;\n input.prevInput = selected ? \"\" : \"\\u200b\";\n te.selectionStart = 1; te.selectionEnd = extval.length;\n // Re-set this, in case some other handler touched the\n // selection in the meantime.\n display.selForContextMenu = cm.doc.sel;\n }\n }\n function rehide() {\n if (input.contextMenuPending != rehide) { return }\n input.contextMenuPending = false;\n input.wrapper.style.cssText = oldWrapperCSS;\n te.style.cssText = oldCSS;\n if (ie && ie_version < 9) { display.scrollbars.setScrollTop(display.scroller.scrollTop = scrollPos); }\n\n // Try to detect the user choosing select-all\n if (te.selectionStart != null) {\n if (!ie || (ie && ie_version < 9)) { prepareSelectAllHack(); }\n var i = 0, poll = function () {\n if (display.selForContextMenu == cm.doc.sel && te.selectionStart == 0 &&\n te.selectionEnd > 0 && input.prevInput == \"\\u200b\") {\n operation(cm, selectAll)(cm);\n } else if (i++ < 10) {\n display.detectingSelectAll = setTimeout(poll, 500);\n } else {\n display.selForContextMenu = null;\n display.input.reset();\n }\n };\n display.detectingSelectAll = setTimeout(poll, 200);\n }\n }\n\n if (ie && ie_version >= 9) { prepareSelectAllHack(); }\n if (captureRightClick) {\n e_stop(e);\n var mouseup = function () {\n off(window, \"mouseup\", mouseup);\n setTimeout(rehide, 20);\n };\n on(window, \"mouseup\", mouseup);\n } else {\n setTimeout(rehide, 50);\n }\n };\n\n TextareaInput.prototype.readOnlyChanged = function (val) {\n if (!val) { this.reset(); }\n this.textarea.disabled = val == \"nocursor\";\n this.textarea.readOnly = !!val;\n };\n\n TextareaInput.prototype.setUneditable = function () {};\n\n TextareaInput.prototype.needsContentAttribute = false;\n\n function fromTextArea(textarea, options) {\n options = options ? copyObj(options) : {};\n options.value = textarea.value;\n if (!options.tabindex && textarea.tabIndex)\n { options.tabindex = textarea.tabIndex; }\n if (!options.placeholder && textarea.placeholder)\n { options.placeholder = textarea.placeholder; }\n // Set autofocus to true if this textarea is focused, or if it has\n // autofocus and no other element is focused.\n if (options.autofocus == null) {\n var hasFocus = activeElt(rootNode(textarea));\n options.autofocus = hasFocus == textarea ||\n textarea.getAttribute(\"autofocus\") != null && hasFocus == document.body;\n }\n\n function save() {textarea.value = cm.getValue();}\n\n var realSubmit;\n if (textarea.form) {\n on(textarea.form, \"submit\", save);\n // Deplorable hack to make the submit method do the right thing.\n if (!options.leaveSubmitMethodAlone) {\n var form = textarea.form;\n realSubmit = form.submit;\n try {\n var wrappedSubmit = form.submit = function () {\n save();\n form.submit = realSubmit;\n form.submit();\n form.submit = wrappedSubmit;\n };\n } catch(e) {}\n }\n }\n\n options.finishInit = function (cm) {\n cm.save = save;\n cm.getTextArea = function () { return textarea; };\n cm.toTextArea = function () {\n cm.toTextArea = isNaN; // Prevent this from being ran twice\n save();\n textarea.parentNode.removeChild(cm.getWrapperElement());\n textarea.style.display = \"\";\n if (textarea.form) {\n off(textarea.form, \"submit\", save);\n if (!options.leaveSubmitMethodAlone && typeof textarea.form.submit == \"function\")\n { textarea.form.submit = realSubmit; }\n }\n };\n };\n\n textarea.style.display = \"none\";\n var cm = CodeMirror(function (node) { return textarea.parentNode.insertBefore(node, textarea.nextSibling); },\n options);\n return cm\n }\n\n function addLegacyProps(CodeMirror) {\n CodeMirror.off = off;\n CodeMirror.on = on;\n CodeMirror.wheelEventPixels = wheelEventPixels;\n CodeMirror.Doc = Doc;\n CodeMirror.splitLines = splitLinesAuto;\n CodeMirror.countColumn = countColumn;\n CodeMirror.findColumn = findColumn;\n CodeMirror.isWordChar = isWordCharBasic;\n CodeMirror.Pass = Pass;\n CodeMirror.signal = signal;\n CodeMirror.Line = Line;\n CodeMirror.changeEnd = changeEnd;\n CodeMirror.scrollbarModel = scrollbarModel;\n CodeMirror.Pos = Pos;\n CodeMirror.cmpPos = cmp;\n CodeMirror.modes = modes;\n CodeMirror.mimeModes = mimeModes;\n CodeMirror.resolveMode = resolveMode;\n CodeMirror.getMode = getMode;\n CodeMirror.modeExtensions = modeExtensions;\n CodeMirror.extendMode = extendMode;\n CodeMirror.copyState = copyState;\n CodeMirror.startState = startState;\n CodeMirror.innerMode = innerMode;\n CodeMirror.commands = commands;\n CodeMirror.keyMap = keyMap;\n CodeMirror.keyName = keyName;\n CodeMirror.isModifierKey = isModifierKey;\n CodeMirror.lookupKey = lookupKey;\n CodeMirror.normalizeKeyMap = normalizeKeyMap;\n CodeMirror.StringStream = StringStream;\n CodeMirror.SharedTextMarker = SharedTextMarker;\n CodeMirror.TextMarker = TextMarker;\n CodeMirror.LineWidget = LineWidget;\n CodeMirror.e_preventDefault = e_preventDefault;\n CodeMirror.e_stopPropagation = e_stopPropagation;\n CodeMirror.e_stop = e_stop;\n CodeMirror.addClass = addClass;\n CodeMirror.contains = contains;\n CodeMirror.rmClass = rmClass;\n CodeMirror.keyNames = keyNames;\n }\n\n // EDITOR CONSTRUCTOR\n\n defineOptions(CodeMirror);\n\n addEditorMethods(CodeMirror);\n\n // Set up methods on CodeMirror's prototype to redirect to the editor's document.\n var dontDelegate = \"iter insert remove copy getEditor constructor\".split(\" \");\n for (var prop in Doc.prototype) { if (Doc.prototype.hasOwnProperty(prop) && indexOf(dontDelegate, prop) < 0)\n { CodeMirror.prototype[prop] = (function(method) {\n return function() {return method.apply(this.doc, arguments)}\n })(Doc.prototype[prop]); } }\n\n eventMixin(Doc);\n CodeMirror.inputStyles = {\"textarea\": TextareaInput, \"contenteditable\": ContentEditableInput};\n\n // Extra arguments are stored as the mode's dependencies, which is\n // used by (legacy) mechanisms like loadmode.js to automatically\n // load a mode. (Preferred mechanism is the require/define calls.)\n CodeMirror.defineMode = function(name/*, mode, …*/) {\n if (!CodeMirror.defaults.mode && name != \"null\") { CodeMirror.defaults.mode = name; }\n defineMode.apply(this, arguments);\n };\n\n CodeMirror.defineMIME = defineMIME;\n\n // Minimal default mode.\n CodeMirror.defineMode(\"null\", function () { return ({token: function (stream) { return stream.skipToEnd(); }}); });\n CodeMirror.defineMIME(\"text/plain\", \"null\");\n\n // EXTENSIONS\n\n CodeMirror.defineExtension = function (name, func) {\n CodeMirror.prototype[name] = func;\n };\n CodeMirror.defineDocExtension = function (name, func) {\n Doc.prototype[name] = func;\n };\n\n CodeMirror.fromTextArea = fromTextArea;\n\n addLegacyProps(CodeMirror);\n\n CodeMirror.version = \"5.65.16\";\n\n return CodeMirror;\n\n})));"],"names":["global","factory","this","userAgent","navigator","platform","gecko","test","ie_upto10","ie_11up","exec","edge","ie","ie_version","document","documentMode","webkit","qtwebkit","chrome","chrome_version","presto","safari","vendor","mac_geMountainLion","phantom","ios","maxTouchPoints","android","mobile","mac","chromeOS","windows","presto_version","match","Number","flipCtrlCmd","captureRightClick","classTest","cls","RegExp","range","rmClass","node","current","className","after","slice","index","length","removeChildren","e","count","childNodes","removeChild","firstChild","removeChildrenAndAdd","parent","appendChild","elt","tag","content","style","createElement","cssText","createTextNode","i","eltP","setAttribute","contains","child","nodeType","parentNode","host","activeElt","rootNode","activeElement","doc","ownerDocument","body","shadowRoot","addClass","joinClasses","a","b","as","split","createRange","start","end","endNode","r","setEnd","setStart","createTextRange","moveToElementText","collapse","moveEnd","moveStart","selectInput","select","cm","display","wrapper","root","element","getRootNode","win","defaultView","bind","f","args","Array","prototype","call","arguments","apply","copyObj","obj","target","overwrite","prop","hasOwnProperty","countColumn","string","tabSize","startIndex","startValue","search","n","nextTab","indexOf","selectionStart","selectionEnd","value","_e","Delayed","id","time","handler","onTimeout","array","self","Date","setTimeout","set","ms","clearTimeout","Pass","toString","sel_dontScroll","scroll","sel_mouse","origin","sel_move","findColumn","goal","pos","col","skipped","Math","min","spaceStrs","spaceStr","push","lst","arr","map","out","nothing","createObj","base","props","inst","Object","create","nonASCIISingleCaseWordChar","isWordCharBasic","ch","toUpperCase","toLowerCase","isWordChar","helper","source","isEmpty","extendingChars","isExtendingChar","charCodeAt","skipExtendingChars","str","dir","charAt","findFirst","pred","from","to","midF","mid","ceil","floor","bidiOther","getBidiPartAt","order","sticky","found","cur","bidiOrdering","bidiRE","isNeutral","isStrong","countsAsLeft","countsAsNum","BidiSpan","level","direction","outerType","code","len","types","i$1","prev","type","i$2","type$1","i$3","prev$1","type$2","i$4","type$3","replace","j","i$5","cur$1","type$4","i$6","end$1","before","replace$1","j$1","m","i$7","at","isRTL","j$2","splice","nstart","unshift","reverse","getOrder","line","text","noHandlers","on","emitter","addEventListener","attachEvent","_handlers","concat","getHandlers","off","removeEventListener","detachEvent","signal","handlers","signalDOMEvent","override","preventDefault","defaultPrevented","e_defaultPrevented","codemirrorIgnore","signalCursorActivity","cursorActivity","curOp","cursorActivityHandlers","hasHandler","eventMixin","ctor","e_preventDefault","returnValue","e_stopPropagation","stopPropagation","cancelBubble","e_stop","e_target","srcElement","e_button","which","button","ctrlKey","zwspSupported","badBidiRects","dragAndDrop","div","zeroWidthElement","measure","offsetHeight","offsetWidth","hasBadBidiRects","txt","r0","getBoundingClientRect","r1","left","right","splitLinesAuto","result","l","nl","rt","hasSelection","window","getSelection","te","selection","parentElement","compareEndPoints","hasCopyEvent","oncopy","badZoomedRects","modes","mimeModes","defineMode","name","mode","dependencies","resolveMode","spec","getMode","options","mfactory","modeObj","modeExtensions","exts","helperType","modeProps","prop$1","extendMode","properties","copyState","state","nstate","val","innerMode","info","startState","a1","a2","StringStream","lineOracle","lastColumnPos","lastColumnValue","lineStart","getLine","first","size","Error","chunk","lines","children","sz","chunkSize","getBetween","iter","getLines","updateLineHeight","height","diff","lineNo","no","lineAtHeight","h","outer","lh","isLine","lineNumberFor","String","lineNumberFormatter","firstLineNumber","Pos","cmp","equalCursorPos","copyPos","x","maxPos","minPos","clipLine","max","clipPos","last","linelen","clipToLen","clipPosArray","eol","sol","peek","undefined","next","eat","eatWhile","eatSpace","skipToEnd","skipTo","backUp","column","indentation","pattern","consume","caseInsensitive","cased","substr","hideFirstChars","inner","lookAhead","oracle","baseToken","SavedContext","Context","maxLookAhead","baseTokens","baseTokenPos","highlightLine","context","forceToEnd","st","modeGen","lineClasses","runMode","loop","o","overlay","overlays","i_end","opaque","styles","classes","bgClass","textClass","getLineStyles","updateFrontier","getContextBefore","resetState","maxHighlightLength","stateAfter","save","styleClasses","highlightFrontier","modeFrontier","precise","minindent","minline","lim","indented","findStartLine","saved","fromSaved","processLine","viewFrom","viewTo","nextLine","startAt","stream","callBlankLine","readToken","blankLine","token","copy","Token","takeToken","asArray","tokens","extractLineClasses","output","lineClass","flattenSpans","curStart","curStyle","addModeClass","mName","sawReadOnlySpans","sawCollapsedSpans","MarkedSpan","marker","getMarkedSpanFor","spans","span","removeMarkedSpan","stretchSpansOverChange","change","full","oldFirst","markedSpans","oldLast","startCh","endCh","isInsert","old","nw","inclusiveLeft","insertLeft","endsAfter","inclusiveRight","markedSpansBefore","startsBefore","markedSpansAfter","sameLine","offset","span$1","clearEmptySpans","newMarkers","gapMarkers","gap","clearWhenEmpty","detachMarkedSpans","detachLine","attachMarkedSpans","attachLine","extraLeft","extraRight","compareCollapsedMarkers","lenDiff","aPos","find","bPos","fromCmp","toCmp","collapsedSpanAtSide","sps","sp","collapsed","collapsedSpanAtStart","collapsedSpanAtEnd","collapsedSpanAround","conflictingCollapsedRange","visualLine","merged","visualLineNo","lineN","vis","visualLineEndNo","lastLine","lineIsHidden","widgetNode","lineIsHiddenInner","heightAtLine","lineObj","p","lineLength","found$1","findMaxLine","d","maxLine","maxLineLength","maxLineChanged","Line","estimateHeight","cleanUpLine","styleToClassCache","styleToClassCacheWithMode","interpretTokenStyle","cache","buildLineContent","lineView","builder","pre","trailingSpace","splitSpaces","getOption","rest","addToken","buildToken","buildTokenBadBidi","insertLineContent","externalMeasured","maps","caches","lastChild","querySelector","defaultSpecialCharPlaceholder","title","startStyle","endStyle","css","attributes","displayText","trailingBefore","spaceBefore","special","specialChars","mustWrap","createDocumentFragment","lastIndex","txt$1","tabWidth","specialCharPlaceholder","fullStyle","attr","part","buildCollapsedSpan","ignoreWidget","widget","input","needsContentAttribute","setUneditable","allText","spanStyle","spanEndStyle","spanStartStyle","nextChange","Infinity","foundBookmarks","endStyles","upto","tokenText","LineView","visualLineContinued","hidden","buildViewArray","nextPos","view","operationGroup","orphanDelayedCallbacks","signalLater","list","delayedCallbacks","fireOrphanDelayed","delayed","updateLineForChanges","dims","changes","updateLineText","updateLineGutter","updateLineClasses","updateLineWidgets","ensureLineWrapped","replaceChild","zIndex","getLineContent","ext","built","background","wrap","insertBefore","updateLineBackground","wrapClass","gutter","gutterBackground","gutterClass","fixedGutter","fixedPos","gutterTotalWidth","markers","gutterMarkers","lineNumbers","wrap$1","gutterWrap","lineNumber","gutterLeft","lineNumInnerWidth","k","gutterSpecs","gutterWidth","alignable","isWidget","nextSibling","insertLineWidgets","buildLineElement","insertLineWidgetsFor","allowAbove","widgets","ws","handleMouseEvents","positionLineWidget","above","noHScroll","width","wrapperWidth","coverGutter","paddingLeft","position","marginLeft","widgetHeight","parentStyle","gutters","clientWidth","eventInWidget","getAttribute","sizer","mover","paddingTop","lineSpace","offsetTop","paddingVert","paddingH","cachedPaddingH","getComputedStyle","currentStyle","data","parseInt","paddingRight","isNaN","scrollGap","nativeBarWidth","displayWidth","scroller","barWidth","displayHeight","clientHeight","barHeight","mapFromLineView","measureChar","bias","measureCharPrepared","prepareMeasureForLine","findViewForLine","findViewIndex","getDimensions","forceUpdate","lineMeasure","updateExternalMeasurement","rect","hasHeights","prepared","varHeight","key","wrapping","lineWrapping","curWidth","heights","rects","getClientRects","abs","bottom","top","ensureLineHeights","place","nodeAndOffsetInLineMap","coverStart","coverEnd","getUsefulRect","screen","logicalXDPI","deviceXDPI","normal","fromRange","hasBadZoomedRects","scaleX","scaleY","logicalYDPI","deviceYDPI","maybeUpdateRectForZooming","rSpan","charWidth","nullRect","rtop","rbot","bot","bogus","singleCursorHeightPerLine","rbottom","measureCharInner","measureText","mStart","mEnd","clearLineMeasurementCacheFor","clearLineMeasurementCache","externalMeasure","clearCaches","cachedCharWidth","cachedTextHeight","lineNumChars","pageScrollX","pageXOffset","documentElement","scrollLeft","pageScrollY","marginTop","pageYOffset","scrollTop","widgetTopHeight","intoCoordSystem","includeWidgets","yOff","viewOffset","lOff","xOff","fromCoordSystem","coords","localBox","lineSpaceBox","charCoords","cursorCoords","preparedMeasure","get","getBidi","partPos","invert","other","estimateCoords","PosWithInfo","outside","xRel","coordsChar","y","coordsCharInner","rangeEnd","wrappedLineExtent","begin","wrappedLineExtentChar","boxIsAfter","box","ltr","coordsBidiPartWrapped","coordsBidiPart","baseX","chAround","boxAround","atLeft","atStart","_lineNo","ref","closestDist","endX","dist","textHeight","anchor","clientLeft","offsetLeft","compensateForHScroll","th","perLine","widgetsHeight","estimateLineHeights","est","estHeight","posFromMouse","liberal","forRect","space","clientX","clientY","e$1","colDiff","round","regChange","lendiff","updateLineNumbers","viewChanged","resetView","cut","viewCuttingPoint","cut$1","cutTop","cutBot","regLineChange","oldN","newN","countDirtyView","dirty","updateSelection","showSelection","prepareSelection","primary","curFragment","cursors","selFragment","customCursor","$customCursor","sel","ranges","primIndex","empty","head","drawSelectionCursor","showCursorWhenSelecting","drawSelectionRange","cursor","cursorHeight","getWrapperElement","charPos","defaultCharWidth","otherCursor","cmpCoords","fragment","padding","leftSide","rightSide","sizerWidth","docLTR","add","drawForLine","fromArg","toArg","lineLen","wrapX","side","extent","iterateBidiSections","fromPos","toPos","openStart","openEnd","openRight","topLeft","topRight","botLeft","botRight","sFrom","sTo","fromLine","toLine","singleVLine","leftEnd","rightStart","restartBlink","focused","clearInterval","blinker","cursorDiv","visibility","cursorBlinkRate","setInterval","hasFocus","onBlur","ensureFocus","focus","onFocus","delayBlurEvent","delayingBlurEvent","draggingText","readOnly","selForContextMenu","reset","receivedFocus","shift","updateHeightsInViewport","prevBottom","lineDiv","viewTop","oldHeight","mustScroll","updateWidgetHeight","chWidth","w","visibleLines","viewport","ensure","ensureFrom","ensureTo","calculateScrollPos","snapMargin","screentop","docBottom","atTop","atBottom","newTop","gutterSpace","screenleft","screenw","tooWide","addToScrollTop","resolveScrollToPos","ensureCursorVisible","getCursor","scrollToPos","margin","cursorScrollMargin","scrollToCoords","scrollToCoordsRange","sPos","updateScrollTop","updateDisplaySimple","setScrollTop","startWorker","forceScroll","scrollHeight","scrollbars","setScrollLeft","isScroller","scrollWidth","alignHorizontally","measureForScrollbars","gutterW","docH","viewHeight","viewWidth","barLeft","docHeight","NativeScrollbars","vert","horiz","tabIndex","checkedZeroWidth","minHeight","minWidth","update","needsH","needsV","sWidth","totalHeight","totalWidth","zeroWidthHack","disableHoriz","enableZeroWidthBar","disableVert","bar","delay","maybeDisable","elementFromPoint","clear","NullScrollbars","updateScrollbars","startWidth","startHeight","updateScrollbarsInner","sizes","paddingBottom","heightForcer","borderBottom","scrollbarFiller","coverGutterNextToScrollbar","gutterFiller","scrollbarModel","initScrollbars","scrollbarStyle","axis","nextOpId","startOperation","op","updateInput","typing","changeObjs","cursorActivityCalled","selectionChanged","updateMaxLine","markArrays","ops","ownsGroup","endOperation","endCb","group","callbacks","fireCallbacksForOps","finishOperation","endOperation_R1","endOperation_W1","endOperation_R2","endOperation_W2","endOperation_finish","endOperations","scrollbarsClipped","marginBottom","borderRightWidth","maybeClipScrollbars","mustUpdate","DisplayUpdate","updatedDisplay","updateDisplayIfNeeded","barMeasure","adjustWidthTo","maxScrollLeft","preparedSelection","takeFocus","setDocumentHeight","postUpdateDisplay","wheelStartX","wheelStartY","limit","changed","endCoords","scrollPos","startTop","startLeft","scrollPosIntoView","doScroll","innerHeight","scrollNode","scrollIntoView","maybeScrollWindow","maybeHiddenMarkers","unhidden","maybeUnhiddenMarkers","finish","runInOp","operation","methodOp","docMethodOp","highlight","highlightWorker","workTime","changedLines","oldStyles","highlighted","oldCls","newCls","ischange","workDelay","force","visible","editorIsHidden","wrapperHeight","oldDisplayWidth","events","renderedView","maybeUpdateLineNumberWidth","viewportMargin","different","lastWrapHeight","lastWrapWidth","adjustView","toUpdate","selSnapshot","active","anchorNode","extend","anchorOffset","focusNode","focusOffset","selectionSnapshot","updateNumbersFrom","container","rm","currentWheelTarget","updateNumber","patchDisplay","snapshot","nodeName","removeAllRanges","addRange","restoreSelection","selectionDiv","reportedViewFrom","reportedViewTo","updateGutterSpace","alignWidgets","comp","align","innerW","lineGutter","lineNumWidth","getGutters","sawLineNumbers","renderGutters","specs","gElt","updateGutters","Display","clipPath","draggable","wheelDX","wheelDY","activeTouch","init","wheelSamples","wheelPixelsPerUnit","wheelEventDelta","dx","wheelDeltaX","dy","wheelDeltaY","detail","HORIZONTAL_AXIS","VERTICAL_AXIS","wheelDelta","wheelEventPixels","delta","onScrollWheel","chromeScrollHack","pointerEvents","pixelsPerUnit","deltaMode","deltaX","deltaY","canScrollX","canScrollY","pixels","movedX","movedY","sample","Selection","equals","here","there","deepCopy","Range","somethingSelected","normalizeSelection","mayTouch","selectionsMayTouch","prim","sort","inv","simpleSelection","changeEnd","adjustForChange","computeSelAfterChange","offsetPos","loadMode","modeOption","resetModeState","isWholeLineUpdate","wholeLineUpdateBefore","updateDoc","spansFor","updateLine","linesFor","firstLine","lastText","lastSpans","nlines","insert","remove","added","added$1","added$2","linkedDocs","sharedHistOnly","propagate","skip","sharedHist","linked","rel","shared","attachDoc","setDirectionClass","History","done","undone","undoDepth","lastModTime","lastSelTime","lastOp","lastSelOp","lastOrigin","lastSelOrigin","generation","maxGeneration","historyChangeFromChange","histChange","attachLocalSpans","clearSelectionEvents","pop","addChangeToHistory","selAfter","opId","hist","history","historyEventDelay","lastChangeEvent","pushSelectionToHistory","addSelectionToHistory","selectionEventCanBeMerged","clearRedo","dest","existing","removeClearedSpans","explicitlyCleared","mergeOldSpans","getOldSpans","stretched","oldCur","stretchCur","copyHistoryArray","newGroup","instantiateSel","event","newChanges","extendRange","posBefore","extendSelection","setSelection","extendSelections","heads","replaceOneSelection","setSimpleSelection","setSelectionReplaceHistory","setSelectionNoUndo","NaN","filterSelectionChange","setSelectionInner","skipAtomicInSelection","reCheckSelection","mayClear","newAnchor","skipAtomic","newHead","skipAtomicInner","oldPos","preventCursorLeft","selectLeft","preventCursorRight","selectRight","atomic","near","movePos","far","cantEdit","selectAll","filterChange","canceled","cancel","makeChange","ignoreReadOnly","suppressEdits","mark","parts","mk","newParts","dfrom","dto","removeReadOnlyRanges","makeChangeInner","makeChangeSingleDoc","rebased","rebaseHist","makeChangeFromHistory","allowSelectionOnly","suppress","antiChanges","filter","returned","v","shiftDoc","distance","removed","recomputeMaxLength","checkWidthStart","retreatFrontier","changesHandler","changeHandler","makeChangeSingleDocInEditor","replaceRange","assign","splitLines","rebaseHistSelSingle","rebaseHistArray","sub","ok","copied","changeLine","handle","changeType","LeafChunk","BranchChunk","removeInner","insertInner","iterN","remaining","leaf","maybeSpill","me","sibling","myIndex","used","LineWidget","opt","adjustScrollWhenAboveVisible","this$1","oldH","nextMarkerId","TextMarker","markText","cloneNode","isParent","SharedTextMarker","markTextShared","replacedWith","addToHistory","curLine","inThisOp","WeakSet","has","addMarkedSpan","clearOnEnter","clearHistory","withOp","visual","dHeight","findSharedMarkers","findMarks","detachSharedMarkers","subMarker","nextDocId","Doc","lineSep","cleanGeneration","constructor","getValue","join","lineSeparator","setValue","getRange","getLineHandle","getLineNumber","getLineHandleVisualStart","lineCount","listSelections","setCursor","extendSelectionsBy","setSelections","addSelection","getSelections","replaceSelection","dup","replaceSelections","newSel","hint","oldPrev","newPrev","computeReplacedSel","undo","redo","undoSelection","redoSelection","setExtending","getExtending","historySize","markClean","changeGeneration","forceSplit","isClean","gen","getHistory","setHistory","histData","setGutterMarker","gutterID","clearGutter","lineInfo","addLineClass","where","removeLineClass","addLineWidget","insertAt","aboveVisible","removeLineWidget","setBookmark","realOpts","findMarksAt","getAllMarks","posFromIndex","sepSize","indexFromPos","copyHistory","linkedDoc","mFrom","mTo","subMark","copySharedMarkers","unlinkDoc","CodeMirror","splitIds","iterLinkedDocs","getEditor","setDirection","eachLine","lastDrop","onDrop","clearDragCursor","files","dataTransfer","isReadOnly","FileReader","File","read","markAsReadAndPasteIfAllFilesAreRead","t","readTextFromFile","file","allowDropFileTypes","reader","onerror","onload","readAsText","text$1","getData","selected","dragCursor","forEachCodeMirror","getElementsByClassName","byClass","editors","globalsRegistered","ensureGlobalHandlers","resizeTimer","onResize","setSize","keyNames","fromCharCode","keyMap","normalizeKeyName","alt","ctrl","cmd","mod","normalizeKeyMap","keymap","keyname","keys","lookupKey","getKeyMap","fallthrough","isModifierKey","keyCode","addModifierNames","noShift","altKey","metaKey","shiftKey","keyName","altGraphKey","deleteNearSelection","compute","kill","toKill","replaced","moveCharLogically","moveLogically","endOfLine","visually","prep","targetTop","basic","pcDefault","emacsy","macDefault","commands","singleSelection","killLine","deleteLine","delLineLeft","delWrappedLineLeft","delWrappedLineRight","rightPos","goDocStart","goDocEnd","goLineStart","goLineStartSmart","lineStartSmart","goLineEnd","visualLineEnd","lineEnd","goLineRight","goLineLeft","goLineLeftSmart","goLineUp","moveV","goLineDown","goPageUp","goPageDown","goCharLeft","moveH","goCharRight","goColumnLeft","goColumnRight","goWordLeft","goGroupRight","goGroupLeft","goWordRight","delCharBefore","deleteH","delCharAfter","delWordBefore","delWordAfter","delGroupBefore","delGroupAfter","indentAuto","indentSelection","indentMore","indentLess","insertTab","insertSoftTab","spaces","defaultTab","execCommand","transposeChars","newlineAndIndent","sels","indentLine","openLine","toggleOverwrite","firstNonWS","inWS","doHandleBinding","bound","dropShift","ensurePolled","prevShift","stopSeq","dispatchKey","seq","keySeq","dispatchKeyInner","keyMaps","extraKeys","lookupKeyForEditor","handleKeyBinding","motion","lastStoppedKey","onKeyDown","getField","handled","up","showCrossHair","onKeyUp","onKeyPress","charCode","handleCharBinding","lastClick","lastDoubleClick","PastClick","onMouseDown","supportsTouch","clickInGutter","repeat","now","compare","clickRepeat","selectingText","handleMappedButton","contained","behavior","option","unit","addNew","moveOnDrag","configureMouse","dragDrop","moved","dragEnd","mouseMove","dragStart","preventScroll","e2","leftButtonStartDrag","ourRange","ourIndex","startSel","rangeForUnit","lastPos","extendTo","startCol","posCol","leftPos","oldRange","ranges$1","anchorLine","boundary","headIndex","usePart","bidiSimplify","editorSize","counter","curCount","move","buttons","leftButtonSelect","leftButtonDown","onContextMenu","findWordAt","gutterEvent","prevent","mX","mY","touches","lineBox","g","contextMenuInGutter","themeChanged","theme","Init","defaults","optionHandlers","dragDropChanged","funcs","dragFunctions","toggle","enter","over","leave","drop","wrappingChanged","inputStyles","inputStyle","pasteIncoming","cutIncoming","autofocus","word","touchFinished","prevTouch","finishTouch","isMouseLikeTouchEvent","touch","radiusX","radiusY","farAway","pageX","pageY","frag","onDragOver","setData","effectAllowed","setDragImage","img","src","_top","onDragStart","inp","registerEventHandlers","finishInit","initHooks","textRendering","how","aggressive","indent","curSpace","curSpaceString","indentUnit","indentString","indentWithTabs","pos$1","defineInitHook","lastCopied","setLastCopied","newLastCopied","applyTextInput","inserted","deleted","recent","paste","textLines","multiPaste","pasteLinesPerSelection","lineWise","changeEvent","triggerElectric","handlePaste","pasted","clipboardData","disableInput","electricChars","smartIndent","getModeAt","electricInput","copyableRanges","lineRange","disableBrowserMagic","field","spellcheck","autocorrect","autocapitalize","hiddenTextarea","border","findPosH","origDir","lineDir","moveOnce","boundToLine","astral","bidi","mv","getWrappedLineExtent","moveInStorageOrder","searchInVisualLine","getRes","res","nextCh","moveVisually","sawType","getHelper","hitSide","findPosV","pageSize","moveAmount","ContentEditableInput","lastAnchorNode","lastAnchorOffset","lastFocusNode","lastFocusOffset","polling","composing","gracePeriod","readDOMTimeout","posToDOM","badPos","bad","domToPos","lineNode","locateNodeInLineView","textNode","topNode","nodeValue","curNode","textContent","previousSibling","dist$1","belongsToInput","onCopyCut","lineWiseCopyCut","clearData","kludge","hadFocus","showPrimarySelection","contentEditable","updateFromDOM","readFromDOMSoon","forceCompositionEnd","screenReaderLabelChanged","label","removeAttribute","showMultipleSelections","curAnchor","curFocus","rng","rangeCount","getRangeAt","startGracePeriod","rememberSelection","selectionInEditor","commonAncestorContainer","blur","pollSelection","pollInterval","poll","scan","isInGutter","triggerOnKeyDown","pollContent","fromIndex","fromNode","toNode","toIndex","newText","closing","extraLinebreak","recognizeMarker","close","addText","walk","cmText","markerID","isBlock","domTextBetween","oldText","cutFront","cutEnd","oldTop","maxCutFront","newBot","oldBot","maxCutEnd","chFrom","chTo","readOnlyChanged","resetPosition","TextareaInput","prevInput","pollingFast","resetting","createField","textarea","prepareCopyCut","fastPoll","dispatchEvent","Event","_display","opts","moveInputWithCursor","headPos","wrapOff","lineOff","teTop","teLeft","drawn","contextMenuPending","slowPoll","missed","same","resetSelectionOnContextMenu","oldScrollY","oldCSS","oldWrapperCSS","wrapperBox","offsetParent","scrollY","scrollTo","rehide","detectingSelectAll","prepareSelectAllHack","mouseup","extval","disabled","deflt","notOnInit","defineOption","newBreaks","refresh","getInputField","detach","attach","integer","defineOptions","helpers","setOption","getDoc","addKeyMap","removeKeyMap","addOverlay","score","priority","insertSorted","modeSpec","removeOverlay","newRanges","getTokenAt","getLineTokens","getTokenTypeAt","getHelpers","help","_global","getStateAfter","defaultTextHeight","getViewport","addWidget","vspace","hspace","triggerOnKeyPress","triggerOnKeyUp","triggerOnMouseDown","amount","rtlMoveVisually","goalColumn","goals","startChar","check","getScrollInfo","scrollToRange","interpret","swapDoc","phrase","phraseText","phrases","getScrollerElement","getGutterElement","registerHelper","registerGlobalHelper","predicate","addEditorMethods","dontDelegate","method","defineMIME","mime","defineExtension","func","defineDocExtension","fromTextArea","tabindex","placeholder","realSubmit","form","leaveSubmitMethodAlone","submit","wrappedSubmit","getTextArea","toTextArea","cmpPos","addLegacyProps","version","exports","module","define","amd"],"mappings":"AAUC,IAAUA,OAAQC,QAARD,OAITE,OAJiBD,QAIV,eAIDE,UAAYC,UAAUD,UACtBE,SAAWD,UAAUC,SAErBC,MAAQ,aAAaC,KAAKJ,WAC1BK,UAAY,UAAUD,KAAKJ,WAC3BM,QAAU,wCAAwCC,KAAKP,WACvDQ,KAAO,cAAcD,KAAKP,WAC1BS,GAAKJ,WAAaC,SAAWE,KAC7BE,WAAaD,KAAOJ,UAAYM,SAASC,cAAgB,IAAMJ,MAAQF,SAAS,IAChFO,QAAUL,MAAQ,WAAWJ,KAAKJ,WAClCc,SAAWD,QAAU,eAAeT,KAAKJ,WACzCe,QAAUP,MAAQ,gBAAgBD,KAAKP,WACvCgB,eAAiBD,SAAWA,OAAO,GACnCE,OAAS,UAAUb,KAAKJ,WACxBkB,OAAS,iBAAiBd,KAAKH,UAAUkB,QACzCC,mBAAqB,+BAA+BhB,KAAKJ,WACzDqB,QAAU,YAAYjB,KAAKJ,WAE3BsB,IAAMJ,SAAW,cAAcd,KAAKJ,YAAcC,UAAUsB,eAAiB,GAC7EC,QAAU,UAAUpB,KAAKJ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B,KAAOA,KAClBg4B,WAAWjQ,UAAYA,UACvBiQ,WAAW5a,eAAiBA,eAC5B4a,WAAW/iC,IAAMA,IACjB+iC,WAAWmgB,OAASjjD,IACpB8iC,WAAW1mC,MAAQA,MACnB0mC,WAAWzmC,UAAYA,UACvBymC,WAAWpmC,YAAcA,YACzBomC,WAAWlmC,QAAUA,QACrBkmC,WAAW9lC,eAAiBA,eAC5B8lC,WAAWzlC,WAAaA,WACxBylC,WAAWvlC,UAAYA,UACvBulC,WAAWjlC,WAAaA,WACxBilC,WAAWnlC,UAAYA,UACvBmlC,WAAW4E,SAAWA,SACtB5E,WAAWuC,OAASA,OACpBvC,WAAW2D,QAAUA,QACrB3D,WAAWoD,cAAgBA,cAC3BpD,WAAWiD,UAAYA,UACvBjD,WAAW6C,gBAAkBA,gBAC7B7C,WAAW9kC,aAAeA,aAC1B8kC,WAAWtF,iBAAmBA,iBAC9BsF,WAAW1F,WAAaA,WACxB0F,WAAWhG,WAAaA,WACxBgG,WAAWppC,iBAAmBA,iBAC9BopC,WAAWlpC,kBAAoBA,kBAC/BkpC,WAAW/oC,OAASA,OACpB+oC,WAAWx1C,SAAWA,SACtBw1C,WAAWp2C,SAAWA,SACtBo2C,WAAW/3C,QAAUA,QACrB+3C,WAAWqC,SAAWA,SA4C1B+d,CAAepgB,YAEfA,WAAWqgB,QAAU,UAEdrgB,YA/oTY,iBAAZsgB,SAA0C,oBAAXC,OAAyBA,OAAOD,QAAU76D,UAC1D,mBAAX+6D,QAAyBA,OAAOC,IAAMD,+CAAO/6D,UAC/CD,OAASA,QAAU6I,MAAa2xC,WAAav6C"} \ No newline at end of file diff --git a/amd/build/jquery.dataTables.min.js b/amd/build/jquery.dataTables.min.js index 36c34f5a..be1d7f99 100644 --- a/amd/build/jquery.dataTables.min.js +++ b/amd/build/jquery.dataTables.min.js @@ -1,3 +1,3 @@ -(function(window,document,undefined$1){var factory;factory=function($){var DataTable=function(oInit){function _fnAddColumn(oSettings,nTh){var oDefaults=DataTable.defaults.columns,iCol=oSettings.aoColumns.length,oCol=$.extend({},DataTable.models.oColumn,oDefaults,{sSortingClass:oSettings.oClasses.sSortable,sSortingClassJUI:oSettings.oClasses.sSortJUI,nTh:nTh||document.createElement("th"),sTitle:oDefaults.sTitle?oDefaults.sTitle:nTh?nTh.innerHTML:"",aDataSort:oDefaults.aDataSort?oDefaults.aDataSort:[iCol],mData:oDefaults.mData?oDefaults.oDefaults:iCol});if(oSettings.aoColumns.push(oCol),oSettings.aoPreSearchCols[iCol]===undefined$1||null===oSettings.aoPreSearchCols[iCol])oSettings.aoPreSearchCols[iCol]=$.extend({},DataTable.models.oSearch);else{var oPre=oSettings.aoPreSearchCols[iCol];oPre.bRegex===undefined$1&&(oPre.bRegex=!0),oPre.bSmart===undefined$1&&(oPre.bSmart=!0),oPre.bCaseInsensitive===undefined$1&&(oPre.bCaseInsensitive=!0)}_fnColumnOptions(oSettings,iCol,null)}function _fnColumnOptions(oSettings,iCol,oOptions){var oCol=oSettings.aoColumns[iCol];oOptions!==undefined$1&&null!==oOptions&&(oOptions.mDataProp&&!oOptions.mData&&(oOptions.mData=oOptions.mDataProp),oOptions.sType!==undefined$1&&(oCol.sType=oOptions.sType,oCol._bAutoType=!1),$.extend(oCol,oOptions),_fnMap(oCol,oOptions,"sWidth","sWidthOrig"),oOptions.iDataSort!==undefined$1&&(oCol.aDataSort=[oOptions.iDataSort]),_fnMap(oCol,oOptions,"aDataSort"));var mRender=oCol.mRender?_fnGetObjectDataFn(oCol.mRender):null,mData=_fnGetObjectDataFn(oCol.mData);oCol.fnGetData=function(oData,sSpecific){var innerData=mData(oData,sSpecific);return oCol.mRender&&sSpecific&&""!==sSpecific?mRender(innerData,sSpecific,oData):innerData},oCol.fnSetData=_fnSetObjectDataFn(oCol.mData),oSettings.oFeatures.bSort||(oCol.bSortable=!1),!oCol.bSortable||-1==$.inArray("asc",oCol.asSorting)&&-1==$.inArray("desc",oCol.asSorting)?(oCol.sSortingClass=oSettings.oClasses.sSortableNone,oCol.sSortingClassJUI=""):-1==$.inArray("asc",oCol.asSorting)&&-1==$.inArray("desc",oCol.asSorting)?(oCol.sSortingClass=oSettings.oClasses.sSortable,oCol.sSortingClassJUI=oSettings.oClasses.sSortJUI):-1!=$.inArray("asc",oCol.asSorting)&&-1==$.inArray("desc",oCol.asSorting)?(oCol.sSortingClass=oSettings.oClasses.sSortableAsc,oCol.sSortingClassJUI=oSettings.oClasses.sSortJUIAscAllowed):-1==$.inArray("asc",oCol.asSorting)&&-1!=$.inArray("desc",oCol.asSorting)&&(oCol.sSortingClass=oSettings.oClasses.sSortableDesc,oCol.sSortingClassJUI=oSettings.oClasses.sSortJUIDescAllowed)}function _fnAdjustColumnSizing(oSettings){if(!1===oSettings.oFeatures.bAutoWidth)return!1;_fnCalculateColumnWidths(oSettings);for(var i=0,iLen=oSettings.aoColumns.length;i=0;i--){var aTargets=aoColDefs[i].aTargets;for($.isArray(aTargets)||_fnLog(oSettings,1,"aTargets must be an array of targets, not a "+typeof aTargets),j=0,jLen=aTargets.length;j=0){for(;oSettings.aoColumns.length<=aTargets[j];)_fnAddColumn(oSettings);fn(aTargets[j],aoColDefs[i])}else if("number"==typeof aTargets[j]&&aTargets[j]<0)fn(oSettings.aoColumns.length+aTargets[j],aoColDefs[i]);else if("string"==typeof aTargets[j])for(k=0,kLen=oSettings.aoColumns.length;kiTarget&&a[i]--;-1!=iTargetIndex&&a.splice(iTargetIndex,1)}function _fnRender(oSettings,iRow,iCol){var oCol=oSettings.aoColumns[iCol];return oCol.fnRender({iDataRow:iRow,iDataColumn:iCol,oSettings:oSettings,aData:oSettings.aoData[iRow]._aData,mDataProp:oCol.mData},_fnGetCellData(oSettings,iRow,iCol,"display"))}function _fnCreateTr(oSettings,iRow){var nTd,oData=oSettings.aoData[iRow];if(null===oData.nTr){oData.nTr=document.createElement("tr"),oData.nTr._DT_RowIndex=iRow,oData._aData.DT_RowId&&(oData.nTr.id=oData._aData.DT_RowId),oData._aData.DT_RowClass&&(oData.nTr.className=oData._aData.DT_RowClass);for(var i=0,iLen=oSettings.aoColumns.length;i=0;j--)oSettings.aoColumns[j].bVisible||bIncludeHidden||aoLocal[i].splice(j,1);aApplied.push([])}for(i=0,iLen=aoLocal.length;i=oSettings.fnRecordsDisplay()?0:oSettings.iInitDisplayStart,oSettings.iInitDisplayStart=-1,_fnCalculateEnd(oSettings)),oSettings.bDeferLoading)oSettings.bDeferLoading=!1,oSettings.iDraw++;else if(oSettings.oFeatures.bServerSide){if(!oSettings.bDestroying&&!_fnAjaxUpdate(oSettings))return}else oSettings.iDraw++;if(0!==oSettings.aiDisplay.length){var iStart=oSettings._iDisplayStart,iEnd=oSettings._iDisplayEnd;oSettings.oFeatures.bServerSide&&(iStart=0,iEnd=oSettings.aoData.length);for(var j=iStart;j")[0];oSettings.nTable.parentNode.insertBefore(nHolding,oSettings.nTable),oSettings.nTableWrapper=$('
')[0],oSettings.nTableReinsertBefore=oSettings.nTable.nextSibling;for(var nTmp,iPushFeature,cOption,nNewNode,cNext,sAttr,j,nInsertNode=oSettings.nTableWrapper,aDom=oSettings.sDom.split(""),i=0;i")[0],"'"==(cNext=aDom[i+1])||'"'==cNext){for(sAttr="",j=2;aDom[i+j]!=cNext;)sAttr+=aDom[i+j],j++;if("H"==sAttr?sAttr=oSettings.oClasses.sJUIHeader:"F"==sAttr&&(sAttr=oSettings.oClasses.sJUIFooter),-1!=sAttr.indexOf(".")){var aSplit=sAttr.split(".");nNewNode.id=aSplit[0].substr(1,aSplit[0].length-1),nNewNode.className=aSplit[1]}else"#"==sAttr.charAt(0)?nNewNode.id=sAttr.substr(1,sAttr.length-1):nNewNode.className=sAttr;i+=j}nInsertNode.appendChild(nNewNode),nInsertNode=nNewNode}else if(">"==cOption)nInsertNode=nInsertNode.parentNode;else if("l"==cOption&&oSettings.oFeatures.bPaginate&&oSettings.oFeatures.bLengthChange)nTmp=_fnFeatureHtmlLength(oSettings),iPushFeature=1;else if("f"==cOption&&oSettings.oFeatures.bFilter)nTmp=_fnFeatureHtmlFilter(oSettings),iPushFeature=1;else if("r"==cOption&&oSettings.oFeatures.bProcessing)nTmp=_fnFeatureHtmlProcessing(oSettings),iPushFeature=1;else if("t"==cOption)nTmp=_fnFeatureHtmlTable(oSettings),iPushFeature=1;else if("i"==cOption&&oSettings.oFeatures.bInfo)nTmp=_fnFeatureHtmlInfo(oSettings),iPushFeature=1;else if("p"==cOption&&oSettings.oFeatures.bPaginate)nTmp=_fnFeatureHtmlPaginate(oSettings),iPushFeature=1;else if(0!==DataTable.ext.aoFeatures.length)for(var aoFeatures=DataTable.ext.aoFeatures,k=0,kLen=aoFeatures.length;k'):""===sSearchStr?'':sSearchStr+' ';var nFilter=document.createElement("div");nFilter.className=oSettings.oClasses.sFilter,nFilter.innerHTML="",oSettings.aanFeatures.f||(nFilter.id=oSettings.sTableId+"_filter");var jqFilter=$('input[type="text"]',nFilter);return nFilter._DT_Input=jqFilter[0],jqFilter.val(oPreviousSearch.sSearch.replace('"',""")),jqFilter.bind("keyup.DT",(function(e){for(var n=oSettings.aanFeatures.f,val=""===this.value?"":this.value,i=0,iLen=n.length;i=0;i--){var sData=_fnDataToSearch(_fnGetCellData(oSettings,oSettings.aiDisplay[i],iColumn,"filter"),oSettings.aoColumns[iColumn].sType);rpSearch.test(sData)||oSettings.aiDisplay.splice(i,1)}}function _fnFilter(oSettings,sInput,iForce,bRegex,bSmart,bCaseInsensitive){var i,rpSearch=_fnFilterCreateSearch(sInput,bRegex,bSmart,bCaseInsensitive),oPrevSearch=oSettings.oPreviousSearch;if(iForce||(iForce=0),0!==DataTable.ext.afnFiltering.length&&(iForce=1),sInput.length<=0)oSettings.aiDisplay.splice(0,oSettings.aiDisplay.length),oSettings.aiDisplay=oSettings.aiDisplayMaster.slice();else if(oSettings.aiDisplay.length==oSettings.aiDisplayMaster.length||oPrevSearch.sSearch.length>sInput.length||1==iForce||0!==sInput.indexOf(oPrevSearch.sSearch))for(oSettings.aiDisplay.splice(0,oSettings.aiDisplay.length),_fnBuildSearchArray(oSettings,1),i=0;i").html(sSearch).text()),sSearch.replace(/[\n\r]/g," ")}function _fnFilterCreateSearch(sSearch,bRegex,bSmart,bCaseInsensitive){var sRegExpString;return bSmart?(sRegExpString="^(?=.*?"+(bRegex?sSearch.split(" "):_fnEscapeRegex(sSearch).split(" ")).join(")(?=.*?")+").*$",new RegExp(sRegExpString,bCaseInsensitive?"i":"")):(sSearch=bRegex?sSearch:_fnEscapeRegex(sSearch),new RegExp(sSearch,bCaseInsensitive?"i":""))}function _fnDataToSearch(sData,sType){return"function"==typeof DataTable.ext.ofnSearch[sType]?DataTable.ext.ofnSearch[sType](sData):null===sData?"":"html"==sType?sData.replace(/[\r\n]/g," ").replace(/<.*?>/g,""):"string"==typeof sData?sData.replace(/[\r\n]/g," "):sData}function _fnEscapeRegex(sVal){var reReplace=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^","-"].join("|\\")+")","g");return sVal.replace(reReplace,"\\$1")}function _fnFeatureHtmlInfo(oSettings){var nInfo=document.createElement("div");return nInfo.className=oSettings.oClasses.sInfo,oSettings.aanFeatures.i||(oSettings.aoDrawCallback.push({fn:_fnUpdateInfo,sName:"information"}),nInfo.id=oSettings.sTableId+"_info"),oSettings.nTable.setAttribute("aria-describedby",oSettings.sTableId+"_info"),nInfo}function _fnUpdateInfo(oSettings){if(oSettings.oFeatures.bInfo&&0!==oSettings.aanFeatures.i.length){var sOut,oLang=oSettings.oLanguage,iStart=oSettings._iDisplayStart+1,iEnd=oSettings.fnDisplayEnd(),iMax=oSettings.fnRecordsTotal(),iTotal=oSettings.fnRecordsDisplay();sOut=0===iTotal?oLang.sInfoEmpty:oLang.sInfo,iTotal!=iMax&&(sOut+=" "+oLang.sInfoFiltered),sOut=_fnInfoMacros(oSettings,sOut+=oLang.sInfoPostFix),null!==oLang.fnInfoCallback&&(sOut=oLang.fnInfoCallback.call(oSettings.oInstance,oSettings,iStart,iEnd,iMax,iTotal,sOut));for(var n=oSettings.aanFeatures.i,i=0,iLen=n.length;i',aLengthMenu=oSettings.aLengthMenu;if(2==aLengthMenu.length&&"object"==typeof aLengthMenu[0]&&"object"==typeof aLengthMenu[1])for(i=0,iLen=aLengthMenu[0].length;i'+aLengthMenu[1][i]+"";else for(i=0,iLen=aLengthMenu.length;i'+aLengthMenu[i]+"";sStdMenu+="";var nLength=document.createElement("div");return oSettings.aanFeatures.l||(nLength.id=oSettings.sTableId+"_length"),nLength.className=oSettings.oClasses.sLength,nLength.innerHTML="",$('select option[value="'+oSettings._iDisplayLength+'"]',nLength).attr("selected",!0),$("select",nLength).bind("change.DT",(function(e){var iVal=$(this).val(),n=oSettings.aanFeatures.l;for(i=0,iLen=n.length;ioSettings.aiDisplay.length||-1==oSettings._iDisplayLength?oSettings._iDisplayEnd=oSettings.aiDisplay.length:oSettings._iDisplayEnd=oSettings._iDisplayStart+oSettings._iDisplayLength}function _fnFeatureHtmlPaginate(oSettings){if(oSettings.oScroll.bInfinite)return null;var nPaginate=document.createElement("div");return nPaginate.className=oSettings.oClasses.sPaging+oSettings.sPaginationType,DataTable.ext.oPagination[oSettings.sPaginationType].fnInit(oSettings,nPaginate,(function(oSettings){_fnCalculateEnd(oSettings),_fnDraw(oSettings)})),oSettings.aanFeatures.p||oSettings.aoDrawCallback.push({fn:function(oSettings){DataTable.ext.oPagination[oSettings.sPaginationType].fnUpdate(oSettings,(function(oSettings){_fnCalculateEnd(oSettings),_fnDraw(oSettings)}))},sName:"pagination"}),nPaginate}function _fnPageChange(oSettings,mAction){var iOldStart=oSettings._iDisplayStart;if("number"==typeof mAction)oSettings._iDisplayStart=mAction*oSettings._iDisplayLength,oSettings._iDisplayStart>oSettings.fnRecordsDisplay()&&(oSettings._iDisplayStart=0);else if("first"==mAction)oSettings._iDisplayStart=0;else if("previous"==mAction)oSettings._iDisplayStart=oSettings._iDisplayLength>=0?oSettings._iDisplayStart-oSettings._iDisplayLength:0,oSettings._iDisplayStart<0&&(oSettings._iDisplayStart=0);else if("next"==mAction)oSettings._iDisplayLength>=0?oSettings._iDisplayStart+oSettings._iDisplayLength=0){var iPages=parseInt((oSettings.fnRecordsDisplay()-1)/oSettings._iDisplayLength,10)+1;oSettings._iDisplayStart=(iPages-1)*oSettings._iDisplayLength}else oSettings._iDisplayStart=0;else _fnLog(oSettings,0,"Unknown paging action: "+mAction);return $(oSettings.oInstance).trigger("page",oSettings),iOldStart!=oSettings._iDisplayStart}function _fnFeatureHtmlProcessing(oSettings){var nProcessing=document.createElement("div");return oSettings.aanFeatures.r||(nProcessing.id=oSettings.sTableId+"_processing"),nProcessing.innerHTML=oSettings.oLanguage.sProcessing,nProcessing.className=oSettings.oClasses.sProcessing,oSettings.nTable.parentNode.insertBefore(nProcessing,oSettings.nTable),nProcessing}function _fnProcessingDisplay(oSettings,bShow){if(oSettings.oFeatures.bProcessing)for(var an=oSettings.aanFeatures.r,i=0,iLen=an.length;i0&&("top"===(nCaption=nCaption[0])._captionSide?nScrollHeadTable.appendChild(nCaption):"bottom"===nCaption._captionSide&&nTfoot&&nScrollFootTable.appendChild(nCaption)),""!==oSettings.oScroll.sX&&(nScrollHead.style.width=_fnStringToCss(oSettings.oScroll.sX),nScrollBody.style.width=_fnStringToCss(oSettings.oScroll.sX),null!==nTfoot&&(nScrollFoot.style.width=_fnStringToCss(oSettings.oScroll.sX)),$(nScrollBody).scroll((function(e){nScrollHead.scrollLeft=this.scrollLeft,null!==nTfoot&&(nScrollFoot.scrollLeft=this.scrollLeft)}))),""!==oSettings.oScroll.sY&&(nScrollBody.style.height=_fnStringToCss(oSettings.oScroll.sY)),oSettings.aoDrawCallback.push({fn:_fnScrollDraw,sName:"scrolling"}),oSettings.oScroll.bInfinite&&$(nScrollBody).scroll((function(){oSettings.bDrawing||0===$(this).scrollTop()||$(this).scrollTop()+$(this).height()>$(oSettings.nTable).height()-oSettings.oScroll.iLoadGap&&oSettings.fnDisplayEnd()nScrollBody.offsetHeight||"scroll"==$(nScrollBody).css("overflow-y"))&&(o.nTable.style.width=_fnStringToCss($(o.nTable).outerWidth()-o.oScroll.iBarWidth))):""!==o.oScroll.sXInner?o.nTable.style.width=_fnStringToCss(o.oScroll.sXInner):iSanityWidth==$(nScrollBody).width()&&$(nScrollBody).height()<$(o.nTable).height()?(o.nTable.style.width=_fnStringToCss(iSanityWidth-o.oScroll.iBarWidth),$(o.nTable).outerWidth()>iSanityWidth-o.oScroll.iBarWidth&&(o.nTable.style.width=_fnStringToCss(iSanityWidth))):o.nTable.style.width=_fnStringToCss(iSanityWidth),iSanityWidth=$(o.nTable).outerWidth(),_fnApplyToChildren(zeroOut,anHeadSizers),_fnApplyToChildren((function(nSizer){aApplied.push(_fnStringToCss($(nSizer).width()))}),anHeadSizers),_fnApplyToChildren((function(nToSize,i){nToSize.style.width=aApplied[i]}),anHeadToSize),$(anHeadSizers).height(0),null!==o.nTFoot&&(_fnApplyToChildren(zeroOut,anFootSizers),_fnApplyToChildren((function(nSizer){aAppliedFooter.push(_fnStringToCss($(nSizer).width()))}),anFootSizers),_fnApplyToChildren((function(nToSize,i){nToSize.style.width=aAppliedFooter[i]}),anFootToSize),$(anFootSizers).height(0)),_fnApplyToChildren((function(nSizer,i){nSizer.innerHTML="",nSizer.style.width=aApplied[i]}),anHeadSizers),null!==o.nTFoot&&_fnApplyToChildren((function(nSizer,i){nSizer.innerHTML="",nSizer.style.width=aAppliedFooter[i]}),anFootSizers),$(o.nTable).outerWidth()nScrollBody.offsetHeight||"scroll"==$(nScrollBody).css("overflow-y")?iSanityWidth+o.oScroll.iBarWidth:iSanityWidth;ie67&&(nScrollBody.scrollHeight>nScrollBody.offsetHeight||"scroll"==$(nScrollBody).css("overflow-y"))&&(o.nTable.style.width=_fnStringToCss(iCorrection-o.oScroll.iBarWidth)),nScrollBody.style.width=_fnStringToCss(iCorrection),o.nScrollHead.style.width=_fnStringToCss(iCorrection),null!==o.nTFoot&&(o.nScrollFoot.style.width=_fnStringToCss(iCorrection)),""===o.oScroll.sX?_fnLog(o,1,"The table cannot fit into the current element which will cause column misalignment. The table has been drawn at its minimum possible width."):""!==o.oScroll.sXInner&&_fnLog(o,1,"The table cannot fit into the current element which will cause column misalignment. Increase the sScrollXInner value or remove it to allow automatic calculation")}else nScrollBody.style.width=_fnStringToCss("100%"),o.nScrollHead.style.width=_fnStringToCss("100%"),null!==o.nTFoot&&(o.nScrollFoot.style.width=_fnStringToCss("100%"));if(""===o.oScroll.sY&&ie67&&(nScrollBody.style.height=_fnStringToCss(o.nTable.offsetHeight+o.oScroll.iBarWidth)),""!==o.oScroll.sY&&o.oScroll.bCollapse){nScrollBody.style.height=_fnStringToCss(o.oScroll.sY);var iExtra=""!==o.oScroll.sX&&o.nTable.offsetWidth>nScrollBody.offsetWidth?o.oScroll.iBarWidth:0;o.nTable.offsetHeightnScrollBody.clientHeight||"scroll"==$(nScrollBody).css("overflow-y");nScrollHeadInner.style.paddingRight=bScrolling?o.oScroll.iBarWidth+"px":"0px",null!==o.nTFoot&&(nScrollFootTable.style.width=_fnStringToCss(iOuterWidth),nScrollFootInner.style.width=_fnStringToCss(iOuterWidth),nScrollFootInner.style.paddingRight=bScrolling?o.oScroll.iBarWidth+"px":"0px"),$(nScrollBody).scroll(),(o.bSorted||o.bFiltered)&&(nScrollBody.scrollTop=0)}function _fnApplyToChildren(fn,an1,an2){for(var nNode1,nNode2,index=0,i=0,iLen=an1.length;itd",nCalcTmp));var nThs=_fnGetUniqueThs(oSettings,nTheadClone);for(iCorrector=0,i=0;i0&&(oSettings.aoColumns[i].sWidth=_fnStringToCss(iWidth)),iCorrector++);var cssWidth=$(nCalcTmp).css("width");oSettings.nTable.style.width=-1!==cssWidth.indexOf("%")?cssWidth:_fnStringToCss($(nCalcTmp).outerWidth()),nCalcTmp.parentNode.removeChild(nCalcTmp)}widthAttr&&(oSettings.nTable.style.width=_fnStringToCss(widthAttr))}function _fnScrollingWidthAdjust(oSettings,n){""===oSettings.oScroll.sX&&""!==oSettings.oScroll.sY?($(n).width(),n.style.width=_fnStringToCss($(n).outerWidth()-oSettings.oScroll.iBarWidth)):""!==oSettings.oScroll.sX&&(n.style.width=_fnStringToCss($(n).outerWidth()))}function _fnGetWidestNode(oSettings,iCol){var iMaxIndex=_fnGetMaxLenString(oSettings,iCol);if(iMaxIndex<0)return null;if(null===oSettings.aoData[iMaxIndex].nTr){var n=document.createElement("td");return n.innerHTML=_fnGetCellData(oSettings,iMaxIndex,iCol,""),n}return _fnGetTdNodes(oSettings,iMaxIndex)[iCol]}function _fnGetMaxLenString(oSettings,iCol){for(var iMax=-1,iMaxIndex=-1,i=0;i/g,"")).length>iMax&&(iMax=s.length,iMaxIndex=i)}return iMaxIndex}function _fnStringToCss(s){if(null===s)return"0px";if("number"==typeof s)return s<0?"0px":s+"px";var c=s.charCodeAt(s.length-1);return c<48||c>57?s:s+"px"}function _fnScrollBarWidth(){var inner=document.createElement("p"),style=inner.style;style.width="100%",style.height="200px",style.padding="0px";var outer=document.createElement("div");(style=outer.style).position="absolute",style.top="0px",style.left="0px",style.visibility="hidden",style.width="200px",style.height="150px",style.padding="0px",style.overflow="hidden",outer.appendChild(inner),document.body.appendChild(outer);var w1=inner.offsetWidth;outer.style.overflow="scroll";var w2=inner.offsetWidth;return w1==w2&&(w2=outer.clientWidth),document.body.removeChild(outer),w1-w2}function _fnSort(oSettings,bApplyClasses){var i,iLen,j,jLen,k,kLen,sDataType,nTh,aaSort=[],aiOrig=[],oSort=DataTable.ext.oSort,aoData=oSettings.aoData,aoColumns=oSettings.aoColumns,oAria=oSettings.oLanguage.oAria;if(!oSettings.oFeatures.bServerSide&&(0!==oSettings.aaSorting.length||null!==oSettings.aaSortingFixed)){for(aaSort=null!==oSettings.aaSortingFixed?oSettings.aaSortingFixed.concat(oSettings.aaSorting):oSettings.aaSorting.slice(),i=0;i/g,"");if((nTh=aoColumns[i].nTh).removeAttribute("aria-sort"),nTh.removeAttribute("aria-label"),aoColumns[i].bSortable)if(aaSort.length>0&&aaSort[0][0]==i){nTh.setAttribute("aria-sort","asc"==aaSort[0][1]?"ascending":"descending");var nextSort=aoColumns[i].asSorting[aaSort[0][2]+1]?aoColumns[i].asSorting[aaSort[0][2]+1]:aoColumns[i].asSorting[0];nTh.setAttribute("aria-label",sTitle+("asc"==nextSort?oAria.sSortAscending:oAria.sSortDescending))}else nTh.setAttribute("aria-label",sTitle+("asc"==aoColumns[i].asSorting[0]?oAria.sSortAscending:oAria.sSortDescending));else nTh.setAttribute("aria-label",sTitle)}oSettings.bSorted=!0,$(oSettings.oInstance).trigger("sort",oSettings),oSettings.oFeatures.bFilter?_fnFilterComplete(oSettings,oSettings.oPreviousSearch,1):(oSettings.aiDisplay=oSettings.aiDisplayMaster.slice(),oSettings._iDisplayStart=0,_fnCalculateEnd(oSettings),_fnDraw(oSettings))}function _fnSortAttachListener(oSettings,nNode,iDataIndex,fnCallback){_fnBindAction(nNode,{},(function(e){if(!1!==oSettings.aoColumns[iDataIndex].bSortable){var fnInnerSorting=function(){var iColumn,iNextSort;if(e.shiftKey){for(var bFound=!1,i=0;i0&&-1==sCurrentClass.indexOf(sNewClass)&&(nTds[i].className=sCurrentClass+" "+sNewClass)}}function _fnSaveState(oSettings){if(oSettings.oFeatures.bStateSave&&!oSettings.bDestroying){var i,iLen,bInfinite=oSettings.oScroll.bInfinite,oState={iCreate:(new Date).getTime(),iStart:bInfinite?0:oSettings._iDisplayStart,iEnd:bInfinite?oSettings._iDisplayLength:oSettings._iDisplayEnd,iLength:oSettings._iDisplayLength,aaSorting:$.extend(!0,[],oSettings.aaSorting),oSearch:$.extend(!0,{},oSettings.oPreviousSearch),aoSearchCols:$.extend(!0,[],oSettings.aoPreSearchCols),abVisCols:[]};for(i=0,iLen=oSettings.aoColumns.length;i4096){for(var i=0,iLen=aCookies.length;i4096;){if(0===aOldCookies.length)return;var old=aOldCookies.pop();document.cookie=old.name+"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path="+aParts.join("/")+"/"}}document.cookie=sFullCookie}function _fnReadCookie(sName){for(var aParts=window.location.pathname.split("/"),sNameEQ=sName+"_"+aParts[aParts.length-1].replace(/[\/:]/g,"").toLowerCase()+"=",sCookieContents=document.cookie.split(";"),i=0;i=0;i--)aRet.push(aoStore[i].fn.apply(oSettings.oInstance,aArgs));return null!==sTrigger&&$(oSettings.oInstance).trigger(sTrigger,aArgs),aRet}var _fnJsonString=window.JSON?JSON.stringify:function(o){var sType=typeof o;if("object"!==sType||null===o)return"string"===sType&&(o='"'+o+'"'),o+"";var sProp,mValue,json=[],bArr=$.isArray(o);for(sProp in o)"string"==(sType=typeof(mValue=o[sProp]))?mValue='"'+mValue+'"':"object"===sType&&null!==mValue&&(mValue=_fnJsonString(mValue)),json.push((bArr?"":'"'+sProp+'":')+mValue);return(bArr?"[":"{")+json+(bArr?"]":"}")};function _fnBrowserDetect(oSettings){var n=$('
')[0];document.body.appendChild(n),oSettings.oBrowser.bScrollOversize=100===$("#DT_BrowserTest",n)[0].offsetWidth,document.body.removeChild(n)}function _fnExternApiFunc(sFunc){return function(){var aArgs=[_fnSettingsFromNode(this[DataTable.ext.iApiIndex])].concat(Array.prototype.slice.call(arguments));return DataTable.ext.oApi[sFunc].apply(this,aArgs)}}for(var sFunc in this.$=function(sSelector,oOpts){var i,iLen,tr,a=[],oSettings=_fnSettingsFromNode(this[DataTable.ext.iApiIndex]),aoData=oSettings.aoData,aiDisplay=oSettings.aiDisplay,aiDisplayMaster=oSettings.aiDisplayMaster;if(oOpts||(oOpts={}),"current"==(oOpts=$.extend({},{filter:"none",order:"current",page:"all"},oOpts)).page)for(i=oSettings._iDisplayStart,iLen=oSettings.fnDisplayEnd();i=oSettings.fnRecordsDisplay()&&(oSettings._iDisplayStart-=oSettings._iDisplayLength,oSettings._iDisplayStart<0&&(oSettings._iDisplayStart=0)),(bRedraw===undefined$1||bRedraw)&&(_fnCalculateEnd(oSettings),_fnDraw(oSettings)),oData},this.fnDestroy=function(bRemove){var i,iLen,oSettings=_fnSettingsFromNode(this[DataTable.ext.iApiIndex]),nOrig=oSettings.nTableWrapper.parentNode,nBody=oSettings.nTBody;if(bRemove=bRemove!==undefined$1&&bRemove,oSettings.bDestroying=!0,_fnCallbackFire(oSettings,"aoDestroyCallback","destroy",[oSettings]),!bRemove)for(i=0,iLen=oSettings.aoColumns.length;itr>td."+oSettings.oClasses.sRowEmpty,oSettings.nTable).parent().remove(),oSettings.nTable!=oSettings.nTHead.parentNode&&($(oSettings.nTable).children("thead").remove(),oSettings.nTable.appendChild(oSettings.nTHead)),oSettings.nTFoot&&oSettings.nTable!=oSettings.nTFoot.parentNode&&($(oSettings.nTable).children("tfoot").remove(),oSettings.nTable.appendChild(oSettings.nTFoot)),oSettings.nTable.parentNode.removeChild(oSettings.nTable),$(oSettings.nTableWrapper).remove(),oSettings.aaSorting=[],oSettings.aaSortingFixed=[],_fnSortingClasses(oSettings),$(_fnGetTrNodes(oSettings)).removeClass(oSettings.asStripeClasses.join(" ")),$("th, td",oSettings.nTHead).removeClass([oSettings.oClasses.sSortable,oSettings.oClasses.sSortableAsc,oSettings.oClasses.sSortableDesc,oSettings.oClasses.sSortableNone].join(" ")),oSettings.bJUI&&($("th span."+oSettings.oClasses.sSortIcon+", td span."+oSettings.oClasses.sSortIcon,oSettings.nTHead).remove(),$("th, td",oSettings.nTHead).each((function(){var jqWrapper=$("div."+oSettings.oClasses.sSortJUIWrapper,this),kids=jqWrapper.contents();$(this).append(kids),jqWrapper.remove()}))),!bRemove&&oSettings.nTableReinsertBefore?nOrig.insertBefore(oSettings.nTable,oSettings.nTableReinsertBefore):bRemove||nOrig.appendChild(oSettings.nTable),i=0,iLen=oSettings.aoData.length;i=_fnVisbleColumns(oSettings)))for(i=iCol;it<"F"ip>')):$.extend(oSettings.oClasses,DataTable.ext.oStdClasses),$(this).addClass(oSettings.oClasses.sTable),""===oSettings.oScroll.sX&&""===oSettings.oScroll.sY||(oSettings.oScroll.iBarWidth=_fnScrollBarWidth()),oSettings.iInitDisplayStart===undefined$1&&(oSettings.iInitDisplayStart=oInit.iDisplayStart,oSettings._iDisplayStart=oInit.iDisplayStart),oInit.bStateSave&&(oSettings.oFeatures.bStateSave=!0,_fnLoadState(oSettings,oInit),_fnCallbackReg(oSettings,"aoDrawCallback",_fnSaveState,"state_save")),null!==oInit.iDeferLoading){oSettings.bDeferLoading=!0;var tmp=$.isArray(oInit.iDeferLoading);oSettings._iRecordsDisplay=tmp?oInit.iDeferLoading[0]:oInit.iDeferLoading,oSettings._iRecordsTotal=tmp?oInit.iDeferLoading[1]:oInit.iDeferLoading}if(null!==oInit.aaData&&(bUsePassedData=!0),""!==oInit.oLanguage.sUrl?(oSettings.oLanguage.sUrl=oInit.oLanguage.sUrl,$.getJSON(oSettings.oLanguage.sUrl,null,(function(json){_fnLanguageCompat(json),$.extend(!0,oSettings.oLanguage,oInit.oLanguage,json),_fnInitialise(oSettings)})),bInitHandedOff=!0):$.extend(!0,oSettings.oLanguage,oInit.oLanguage),null===oInit.asStripeClasses&&(oSettings.asStripeClasses=[oSettings.oClasses.sStripeOdd,oSettings.oClasses.sStripeEven]),iLen=oSettings.asStripeClasses.length,oSettings.asDestroyStripes=[],iLen){var bStripeRemove=!1,anRows=$(this).children("tbody").children("tr:lt("+iLen+")");for(i=0;i=oSettings.aoColumns.length&&(oSettings.aaSorting[i][0]=0);var oColumn=oSettings.aoColumns[oSettings.aaSorting[i][0]];for(oSettings.aaSorting[i][2]===undefined$1&&(oSettings.aaSorting[i][2]=0),oInit.aaSorting===undefined$1&&oSettings.saved_aaSorting===undefined$1&&(oSettings.aaSorting[i][1]=oColumn.asSorting[0]),j=0,jLen=oColumn.asSorting.length;j0&&(""!==oSettings.oScroll.sX||""!==oSettings.oScroll.sY)&&(tfoot=[document.createElement("tfoot")],this.appendChild(tfoot[0])),tfoot.length>0&&(oSettings.nTFoot=tfoot[0],_fnDetectHeader(oSettings.aoFooter,oSettings.nTFoot)),bUsePassedData)for(i=0;i=parseInt(sThat,10)},DataTable.fnIsDataTable=function(nTable){for(var o=DataTable.settings,i=0;i':''+oLang.sPrevious+''+oLang.sNext+"";$(nPaging).append(sAppend);var els=$("a",nPaging),nPrevious=els[0],nNext=els[1];oSettings.oApi._fnBindAction(nPrevious,{action:"previous"},fnClickHandler),oSettings.oApi._fnBindAction(nNext,{action:"next"},fnClickHandler),oSettings.aanFeatures.p||(nPaging.id=oSettings.sTableId+"_paginate",nPrevious.id=oSettings.sTableId+"_previous",nNext.id=oSettings.sTableId+"_next",nPrevious.setAttribute("aria-controls",oSettings.sTableId),nNext.setAttribute("aria-controls",oSettings.sTableId))},fnUpdate:function(oSettings,fnCallbackDraw){if(oSettings.aanFeatures.p)for(var nNode,oClasses=oSettings.oClasses,an=oSettings.aanFeatures.p,i=0,iLen=an.length;i'+oLang.sFirst+''+oLang.sPrevious+''+oLang.sNext+''+oLang.sLast+"");var els=$("a",nPaging),nFirst=els[0],nPrev=els[1],nNext=els[2],nLast=els[3];oSettings.oApi._fnBindAction(nFirst,{action:"first"},fnClickHandler),oSettings.oApi._fnBindAction(nPrev,{action:"previous"},fnClickHandler),oSettings.oApi._fnBindAction(nNext,{action:"next"},fnClickHandler),oSettings.oApi._fnBindAction(nLast,{action:"last"},fnClickHandler),oSettings.aanFeatures.p||(nPaging.id=oSettings.sTableId+"_paginate",nFirst.id=oSettings.sTableId+"_first",nPrev.id=oSettings.sTableId+"_previous",nNext.id=oSettings.sTableId+"_next",nLast.id=oSettings.sTableId+"_last")},fnUpdate:function(oSettings,fnCallbackDraw){if(oSettings.aanFeatures.p){var iStartButton,iEndButton,i,iLen,anButtons,anStatic,nNode,iPageCount=DataTable.ext.oPagination.iFullNumbersShowPages,iPageCountHalf=Math.floor(iPageCount/2),iPages=Math.ceil(oSettings.fnRecordsDisplay()/oSettings._iDisplayLength),iCurrentPage=Math.ceil(oSettings._iDisplayStart/oSettings._iDisplayLength)+1,sList="",oClasses=oSettings.oClasses,an=oSettings.aanFeatures.p,fnBind=function(j){oSettings.oApi._fnBindAction(this,{page:j+iStartButton-1},(function(e){oSettings.oApi._fnPageChange(oSettings,e.data.page),fnCallbackDraw(oSettings),e.preventDefault()}))};for(-1===oSettings._iDisplayLength?(iStartButton=1,iEndButton=1,iCurrentPage=1):iPages=iPages-iPageCountHalf?(iStartButton=iPages-iPageCount+1,iEndButton=iPages):iEndButton=(iStartButton=iCurrentPage-Math.ceil(iPageCount/2)+1)+iPageCount-1,i=iStartButton;i<=iEndButton;i++)sList+=iCurrentPage!==i?''+oSettings.fnFormatNumber(i)+"":''+oSettings.fnFormatNumber(i)+"";for(i=0,iLen=an.length;iy?1:0},"string-desc":function(x,y){return xy?-1:0},"html-pre":function(a){return a.replace(/<.*?>/g,"").toLowerCase()},"html-asc":function(x,y){return xy?1:0},"html-desc":function(x,y){return xy?-1:0},"date-pre":function(a){var x=Date.parse(a);return(isNaN(x)||""===x)&&(x=Date.parse("01/01/1970 00:00:00")),x},"date-asc":function(x,y){return x-y},"date-desc":function(x,y){return y-x},"numeric-pre":function(a){return"-"==a||""===a?0:1*a},"numeric-asc":function(x,y){return x-y},"numeric-desc":function(x,y){return y-x}}),$.extend(DataTable.ext.aTypes,[function(sData){if("number"==typeof sData)return"numeric";if("string"!=typeof sData)return null;var Char,bDecimal=!1;if(Char=sData.charAt(0),-1=="0123456789-".indexOf(Char))return null;for(var i=1;i")?"html":null}]),$.fn.DataTable=DataTable,$.fn.dataTable=DataTable,$.fn.dataTableSettings=DataTable.settings,$.fn.dataTableExt=DataTable.ext},"function"==typeof define&&define.amd?define("block_configurable_reports/jquery.dataTables",["jquery"],factory):jQuery&&!jQuery.fn.dataTable&&factory(jQuery)})(window,document); +!function(factory){if("function"==typeof define&&define.amd)define("block_configurable_reports/jquery.dataTables",["jquery"],(function($){return factory($,window,document)}));else if("object"==typeof exports){var jq=require("jquery");if("undefined"!=typeof window)return factory(jq,window,window.document);module.exports=function(root,$){return root||(root=window),$||($=jq(root)),factory($,root,root.document)}}else window.DataTable=factory(jQuery,window,document)}((function($,window,document,undefined$1){var _ext,_Api,_api_register,_api_registerPlural,DataTable=function(selector,options){if(DataTable.factory(selector,options))return DataTable;if(this instanceof DataTable)return $(selector).DataTable(options);options=selector,this.$=function(sSelector,oOpts){return this.api(!0).$(sSelector,oOpts)},this._=function(sSelector,oOpts){return this.api(!0).rows(sSelector,oOpts).data()},this.api=function(traditional){return new _Api(traditional?_fnSettingsFromNode(this[_ext.iApiIndex]):this)},this.fnAddData=function(data,redraw){var api=this.api(!0),rows=Array.isArray(data)&&(Array.isArray(data[0])||$.isPlainObject(data[0]))?api.rows.add(data):api.row.add(data);return(redraw===undefined$1||redraw)&&api.draw(),rows.flatten().toArray()},this.fnAdjustColumnSizing=function(bRedraw){var api=this.api(!0).columns.adjust(),settings=api.settings()[0],scroll=settings.oScroll;bRedraw===undefined$1||bRedraw?api.draw(!1):""===scroll.sX&&""===scroll.sY||_fnScrollDraw(settings)},this.fnClearTable=function(bRedraw){var api=this.api(!0).clear();(bRedraw===undefined$1||bRedraw)&&api.draw()},this.fnClose=function(nTr){this.api(!0).row(nTr).child.hide()},this.fnDeleteRow=function(target,callback,redraw){var api=this.api(!0),rows=api.rows(target),settings=rows.settings()[0],data=settings.aoData[rows[0][0]];return rows.remove(),callback&&callback.call(this,settings,data),(redraw===undefined$1||redraw)&&api.draw(),data},this.fnDestroy=function(remove){this.api(!0).destroy(remove)},this.fnDraw=function(complete){this.api(!0).draw(complete)},this.fnFilter=function(sInput,iColumn,bRegex,bSmart,bShowGlobal,bCaseInsensitive){var api=this.api(!0);null===iColumn||iColumn===undefined$1?api.search(sInput,bRegex,bSmart,bCaseInsensitive):api.column(iColumn).search(sInput,bRegex,bSmart,bCaseInsensitive),api.draw()},this.fnGetData=function(src,col){var api=this.api(!0);if(src!==undefined$1){var type=src.nodeName?src.nodeName.toLowerCase():"";return col!==undefined$1||"td"==type||"th"==type?api.cell(src,col).data():api.row(src).data()||null}return api.data().toArray()},this.fnGetNodes=function(iRow){var api=this.api(!0);return iRow!==undefined$1?api.row(iRow).node():api.rows().nodes().flatten().toArray()},this.fnGetPosition=function(node){var api=this.api(!0),nodeName=node.nodeName.toUpperCase();if("TR"==nodeName)return api.row(node).index();if("TD"==nodeName||"TH"==nodeName){var cell=api.cell(node).index();return[cell.row,cell.columnVisible,cell.column]}return null},this.fnIsOpen=function(nTr){return this.api(!0).row(nTr).child.isShown()},this.fnOpen=function(nTr,mHtml,sClass){return this.api(!0).row(nTr).child(mHtml,sClass).show().child()[0]},this.fnPageChange=function(mAction,bRedraw){var api=this.api(!0).page(mAction);(bRedraw===undefined$1||bRedraw)&&api.draw(!1)},this.fnSetColumnVis=function(iCol,bShow,bRedraw){var api=this.api(!0).column(iCol).visible(bShow);(bRedraw===undefined$1||bRedraw)&&api.columns.adjust().draw()},this.fnSettings=function(){return _fnSettingsFromNode(this[_ext.iApiIndex])},this.fnSort=function(aaSort){this.api(!0).order(aaSort).draw()},this.fnSortListener=function(nNode,iColumn,fnCallback){this.api(!0).order.listener(nNode,iColumn,fnCallback)},this.fnUpdate=function(mData,mRow,iColumn,bRedraw,bAction){var api=this.api(!0);return iColumn===undefined$1||null===iColumn?api.row(mRow).data(mData):api.cell(mRow,iColumn).data(mData),(bAction===undefined$1||bAction)&&api.columns.adjust(),(bRedraw===undefined$1||bRedraw)&&api.draw(),0},this.fnVersionCheck=_ext.fnVersionCheck;var _that=this,emptyInit=options===undefined$1,len=this.length;for(var fn in emptyInit&&(options={}),this.oApi=this.internal=_ext.internal,DataTable.ext.internal)fn&&(this[fn]=_fnExternApiFunc(fn));return this.each((function(){var iLen,oInit=len>1?_fnExtend({},options,!0):options,i=0,sId=this.getAttribute("id"),bInitHandedOff=!1,defaults=DataTable.defaults,$this=$(this);if("table"==this.nodeName.toLowerCase()){_fnCompatOpts(defaults),_fnCompatCols(defaults.column),_fnCamelToHungarian(defaults,defaults,!0),_fnCamelToHungarian(defaults.column,defaults.column,!0),_fnCamelToHungarian(defaults,$.extend(oInit,$this.data()),!0);var allSettings=DataTable.settings;for(i=0,iLen=allSettings.length;i").appendTo($this)),oSettings.nTHead=thead[0];var tbody=$this.children("tbody");0===tbody.length&&(tbody=$("").insertAfter(thead)),oSettings.nTBody=tbody[0];var tfoot=$this.children("tfoot");if(0===tfoot.length&&captions.length>0&&(""!==oSettings.oScroll.sX||""!==oSettings.oScroll.sY)&&(tfoot=$("").appendTo($this)),0===tfoot.length||0===tfoot.children().length?$this.addClass(oClasses.sNoFooter):tfoot.length>0&&(oSettings.nTFoot=tfoot[0],_fnDetectHeader(oSettings.aoFooter,oSettings.nTFoot)),oInit.aaData)for(i=0;i/g,_re_date=/^\d{2,4}[\.\/\-]\d{1,2}[\.\/\-]\d{1,2}([T ]{1}\d{1,2}[:\.]\d{2}([\.:]\d{2})?)?$/,_re_escape_regex=new RegExp("(\\"+["/",".","*","+","?","|","(",")","[","]","{","}","\\","$","^","-"].join("|\\")+")","g"),_re_formatted_numeric=/['\u00A0,$£€¥%\u2009\u202F\u20BD\u20a9\u20BArfkɃΞ]/gi,_empty=function(d){return!d||!0===d||"-"===d},_intVal=function(s){var integer=parseInt(s,10);return!isNaN(integer)&&isFinite(s)?integer:null},_numToDecimal=function(num,decimalPoint){return _re_dic[decimalPoint]||(_re_dic[decimalPoint]=new RegExp(_fnEscapeRegex(decimalPoint),"g")),"string"==typeof num&&"."!==decimalPoint?num.replace(/\./g,"").replace(_re_dic[decimalPoint],"."):num},_isNumber=function(d,decimalPoint,formatted){var type=typeof d,strType="string"===type;return"number"===type||"bigint"===type||(!!_empty(d)||(decimalPoint&&strType&&(d=_numToDecimal(d,decimalPoint)),formatted&&strType&&(d=d.replace(_re_formatted_numeric,"")),!isNaN(parseFloat(d))&&isFinite(d)))},_htmlNumeric=function(d,decimalPoint,formatted){if(_empty(d))return!0;var html=function(d){return _empty(d)||"string"==typeof d}(d);return html&&!!_isNumber(_stripHtml(d),decimalPoint,formatted)||null},_pluck=function(a,prop,prop2){var out=[],i=0,ien=a.length;if(prop2!==undefined$1)for(;i").css({position:"fixed",top:0,left:-1*$(window).scrollLeft(),height:1,width:1,overflow:"hidden"}).append($("
").css({position:"absolute",top:1,left:1,width:100,overflow:"scroll"}).append($("
").css({width:"100%",height:10}))).appendTo("body"),outer=n.children(),inner=outer.children();browser.barWidth=outer[0].offsetWidth-outer[0].clientWidth,browser.bScrollOversize=100===inner[0].offsetWidth&&100!==outer[0].clientWidth,browser.bScrollbarLeft=1!==Math.round(inner.offset().left),browser.bBounding=!!n[0].getBoundingClientRect().width,n.remove()}$.extend(settings.oBrowser,DataTable.__browser),settings.oScroll.iBarWidth=DataTable.__browser.barWidth}function _fnReduce(that,fn,init,start,end,inc){var value,i=start,isSet=!1;for(init!==undefined$1&&(value=init,isSet=!0);i!==end;)that.hasOwnProperty(i)&&(value=isSet?fn(value,that[i],i,that):that[i],isSet=!0,i+=inc);return value}function _fnAddColumn(oSettings,nTh){var oDefaults=DataTable.defaults.column,iCol=oSettings.aoColumns.length,oCol=$.extend({},DataTable.models.oColumn,oDefaults,{nTh:nTh||document.createElement("th"),sTitle:oDefaults.sTitle?oDefaults.sTitle:nTh?nTh.innerHTML:"",aDataSort:oDefaults.aDataSort?oDefaults.aDataSort:[iCol],mData:oDefaults.mData?oDefaults.mData:iCol,idx:iCol});oSettings.aoColumns.push(oCol);var searchCols=oSettings.aoPreSearchCols;searchCols[iCol]=$.extend({},DataTable.models.oSearch,searchCols[iCol]),_fnColumnOptions(oSettings,iCol,$(nTh).data())}function _fnColumnOptions(oSettings,iCol,oOptions){var oCol=oSettings.aoColumns[iCol],oClasses=oSettings.oClasses,th=$(oCol.nTh);if(!oCol.sWidthOrig){oCol.sWidthOrig=th.attr("width")||null;var t=(th.attr("style")||"").match(/width:\s*(\d+[pxem%]+)/);t&&(oCol.sWidthOrig=t[1])}if(oOptions!==undefined$1&&null!==oOptions){_fnCompatCols(oOptions),_fnCamelToHungarian(DataTable.defaults.column,oOptions,!0),oOptions.mDataProp===undefined$1||oOptions.mData||(oOptions.mData=oOptions.mDataProp),oOptions.sType&&(oCol._sManualType=oOptions.sType),oOptions.className&&!oOptions.sClass&&(oOptions.sClass=oOptions.className),oOptions.sClass&&th.addClass(oOptions.sClass);var origClass=oCol.sClass;$.extend(oCol,oOptions),_fnMap(oCol,oOptions,"sWidth","sWidthOrig"),origClass!==oCol.sClass&&(oCol.sClass=origClass+" "+oCol.sClass),oOptions.iDataSort!==undefined$1&&(oCol.aDataSort=[oOptions.iDataSort]),_fnMap(oCol,oOptions,"aDataSort"),oCol.ariaTitle||(oCol.ariaTitle=th.attr("aria-label"))}var mDataSrc=oCol.mData,mData=_fnGetObjectDataFn(mDataSrc),mRender=oCol.mRender?_fnGetObjectDataFn(oCol.mRender):null,attrTest=function(src){return"string"==typeof src&&-1!==src.indexOf("@")};oCol._bAttrSrc=$.isPlainObject(mDataSrc)&&(attrTest(mDataSrc.sort)||attrTest(mDataSrc.type)||attrTest(mDataSrc.filter)),oCol._setter=null,oCol.fnGetData=function(rowData,type,meta){var innerData=mData(rowData,type,undefined$1,meta);return mRender&&type?mRender(innerData,type,rowData,meta):innerData},oCol.fnSetData=function(rowData,val,meta){return _fnSetObjectDataFn(mDataSrc)(rowData,val,meta)},"number"==typeof mDataSrc||oCol._isArrayHost||(oSettings._rowReadObject=!0),oSettings.oFeatures.bSort||(oCol.bSortable=!1,th.addClass(oClasses.sSortableNone));var bAsc=-1!==$.inArray("asc",oCol.asSorting),bDesc=-1!==$.inArray("desc",oCol.asSorting);oCol.bSortable&&(bAsc||bDesc)?bAsc&&!bDesc?(oCol.sSortingClass=oClasses.sSortableAsc,oCol.sSortingClassJUI=oClasses.sSortJUIAscAllowed):!bAsc&&bDesc?(oCol.sSortingClass=oClasses.sSortableDesc,oCol.sSortingClassJUI=oClasses.sSortJUIDescAllowed):(oCol.sSortingClass=oClasses.sSortable,oCol.sSortingClassJUI=oClasses.sSortJUI):(oCol.sSortingClass=oClasses.sSortableNone,oCol.sSortingClassJUI="")}function _fnAdjustColumnSizing(settings){if(!1!==settings.oFeatures.bAutoWidth){var columns=settings.aoColumns;_fnCalculateColumnWidths(settings);for(var i=0,iLen=columns.length;i=0;i--){var aTargets=(def=aoColDefs[i]).target!==undefined$1?def.target:def.targets!==undefined$1?def.targets:def.aTargets;for(Array.isArray(aTargets)||(aTargets=[aTargets]),j=0,jLen=aTargets.length;j=0){for(;columns.length<=aTargets[j];)_fnAddColumn(oSettings);fn(aTargets[j],def)}else if("number"==typeof aTargets[j]&&aTargets[j]<0)fn(columns.length+aTargets[j],def);else if("string"==typeof aTargets[j])for(k=0,kLen=columns.length;kiTarget&&a[i]--;-1!=iTargetIndex&&splice===undefined$1&&a.splice(iTargetIndex,1)}function _fnInvalidate(settings,rowIdx,src,colIdx){var i,ien,row=settings.aoData[rowIdx],cellWrite=function(cell,col){for(;cell.childNodes.length;)cell.removeChild(cell.firstChild);cell.innerHTML=_fnGetCellData(settings,rowIdx,col,"display")};if("dom"!==src&&(src&&"auto"!==src||"dom"!==row.src)){var cells=row.anCells;if(cells)if(colIdx!==undefined$1)cellWrite(cells[colIdx],colIdx);else for(i=0,ien=cells.length;i").appendTo(thead)),i=0,ien=columns.length;i=0;j--)oSettings.aoColumns[j].bVisible||bIncludeHidden||aoLocal[i].splice(j,1);aApplied.push([])}for(i=0,iLen=aoLocal.length;i=oSettings.fnRecordsDisplay()?0:iInitDisplayStart,oSettings.iInitDisplayStart=-1)}(oSettings);var aPreDraw=_fnCallbackFire(oSettings,"aoPreDrawCallback","preDraw",[oSettings]);if(-1===$.inArray(!1,aPreDraw)){var anRows=[],iRowCount=0,asStripeClasses=oSettings.asStripeClasses,iStripes=asStripeClasses.length,oLang=oSettings.oLanguage,bServerSide="ssp"==_fnDataSource(oSettings),aiDisplay=oSettings.aiDisplay,iDisplayStart=oSettings._iDisplayStart,iDisplayEnd=oSettings.fnDisplayEnd();if(oSettings.bDrawing=!0,oSettings.bDeferLoading)oSettings.bDeferLoading=!1,oSettings.iDraw++,_fnProcessingDisplay(oSettings,!1);else if(bServerSide){if(!oSettings.bDestroying&&!ajaxComplete)return void _fnAjaxUpdate(oSettings)}else oSettings.iDraw++;if(0!==aiDisplay.length)for(var iStart=bServerSide?0:iDisplayStart,iEnd=bServerSide?oSettings.aoData.length:iDisplayEnd,j=iStart;j",{class:iStripes?asStripeClasses[0]:""}).append($("",{valign:"top",colSpan:_fnVisbleColumns(oSettings),class:oSettings.oClasses.sRowEmpty}).html(sZero))[0]}_fnCallbackFire(oSettings,"aoHeaderCallback","header",[$(oSettings.nTHead).children("tr")[0],_fnGetDataMaster(oSettings),iDisplayStart,iDisplayEnd,aiDisplay]),_fnCallbackFire(oSettings,"aoFooterCallback","footer",[$(oSettings.nTFoot).children("tr")[0],_fnGetDataMaster(oSettings),iDisplayStart,iDisplayEnd,aiDisplay]);var body=$(oSettings.nTBody);body.children().detach(),body.append($(anRows)),_fnCallbackFire(oSettings,"aoDrawCallback","draw",[oSettings]),oSettings.bSorted=!1,oSettings.bFiltered=!1,oSettings.bDrawing=!1}else _fnProcessingDisplay(oSettings,!1)}function _fnReDraw(settings,holdPosition){var features=settings.oFeatures,sort=features.bSort,filter=features.bFilter;sort&&_fnSort(settings),filter?_fnFilterComplete(settings,settings.oPreviousSearch):settings.aiDisplay=settings.aiDisplayMaster.slice(),!0!==holdPosition&&(settings._iDisplayStart=0),settings._drawHold=holdPosition,_fnDraw(settings),settings._drawHold=!1}function _fnAddOptionsHtml(oSettings){var classes=oSettings.oClasses,table=$(oSettings.nTable),holding=$("
").insertBefore(table),features=oSettings.oFeatures,insert=$("
",{id:oSettings.sTableId+"_wrapper",class:classes.sWrapper+(oSettings.nTFoot?"":" "+classes.sNoFooter)});oSettings.nHolding=holding[0],oSettings.nTableWrapper=insert[0],oSettings.nTableReinsertBefore=oSettings.nTable.nextSibling;for(var featureNode,cOption,nNewNode,cNext,sAttr,j,aDom=oSettings.sDom.split(""),i=0;i")[0],"'"==(cNext=aDom[i+1])||'"'==cNext){for(sAttr="",j=2;aDom[i+j]!=cNext;)sAttr+=aDom[i+j],j++;if("H"==sAttr?sAttr=classes.sJUIHeader:"F"==sAttr&&(sAttr=classes.sJUIFooter),-1!=sAttr.indexOf(".")){var aSplit=sAttr.split(".");nNewNode.id=aSplit[0].substr(1,aSplit[0].length-1),nNewNode.className=aSplit[1]}else"#"==sAttr.charAt(0)?nNewNode.id=sAttr.substr(1,sAttr.length-1):nNewNode.className=sAttr;i+=j}insert.append(nNewNode),insert=$(nNewNode)}else if(">"==cOption)insert=insert.parent();else if("l"==cOption&&features.bPaginate&&features.bLengthChange)featureNode=_fnFeatureHtmlLength(oSettings);else if("f"==cOption&&features.bFilter)featureNode=_fnFeatureHtmlFilter(oSettings);else if("r"==cOption&&features.bProcessing)featureNode=_fnFeatureHtmlProcessing(oSettings);else if("t"==cOption)featureNode=_fnFeatureHtmlTable(oSettings);else if("i"==cOption&&features.bInfo)featureNode=_fnFeatureHtmlInfo(oSettings);else if("p"==cOption&&features.bPaginate)featureNode=_fnFeatureHtmlPaginate(oSettings);else if(0!==DataTable.ext.feature.length)for(var aoFeatures=DataTable.ext.feature,k=0,kLen=aoFeatures.length;k',str=language.sSearch;str=str.match(/_INPUT_/)?str.replace("_INPUT_",input):str+input;var filter=$("
",{id:features.f?null:tableId+"_filter",class:classes.sFilter}).append($("
").addClass(classes.sLength);return settings.aanFeatures.l||(div[0].id=tableId+"_length"),div.children().append(settings.oLanguage.sLengthMenu.replace("_MENU_",select[0].outerHTML)),$("select",div).val(settings._iDisplayLength).on("change.DT",(function(e){_fnLengthChange(settings,$(this).val()),_fnDraw(settings)})),$(settings.nTable).on("length.dt.DT",(function(e,s,len){settings===s&&$("select",div).val(len)})),div[0]}function _fnFeatureHtmlPaginate(settings){var type=settings.sPaginationType,plugin=DataTable.ext.pager[type],modern="function"==typeof plugin,redraw=function(settings){_fnDraw(settings)},node=$("
").addClass(settings.oClasses.sPaging+type)[0],features=settings.aanFeatures;return modern||plugin.fnInit(settings,node,redraw),features.p||(node.id=settings.sTableId+"_paginate",settings.aoDrawCallback.push({fn:function(settings){if(modern){var i,ien,start=settings._iDisplayStart,len=settings._iDisplayLength,visRecords=settings.fnRecordsDisplay(),all=-1===len,page=all?0:Math.ceil(start/len),pages=all?1:Math.ceil(visRecords/len),buttons=plugin(page,pages);for(i=0,ien=features.p.length;irecords&&(start=0):"first"==action?start=0:"previous"==action?(start=len>=0?start-len:0)<0&&(start=0):"next"==action?start+len",{id:settings.aanFeatures.r?null:settings.sTableId+"_processing",class:settings.oClasses.sProcessing,role:"status"}).html(settings.oLanguage.sProcessing).append("
").insertBefore(settings.nTable)[0]}function _fnProcessingDisplay(settings,show){settings.oFeatures.bProcessing&&$(settings.aanFeatures.r).css("display",show?"block":"none"),_fnCallbackFire(settings,null,"processing",[settings,show])}function _fnFeatureHtmlTable(settings){var table=$(settings.nTable),scroll=settings.oScroll;if(""===scroll.sX&&""===scroll.sY)return settings.nTable;var scrollX=scroll.sX,scrollY=scroll.sY,classes=settings.oClasses,caption=table.children("caption"),captionSide=caption.length?caption[0]._captionSide:null,headerClone=$(table[0].cloneNode(!1)),footerClone=$(table[0].cloneNode(!1)),footer=table.children("tfoot"),_div="
",size=function(s){return s?_fnStringToCss(s):null};footer.length||(footer=null);var scroller=$(_div,{class:classes.sScrollWrapper}).append($(_div,{class:classes.sScrollHead}).css({overflow:"hidden",position:"relative",border:0,width:scrollX?size(scrollX):"100%"}).append($(_div,{class:classes.sScrollHeadInner}).css({"box-sizing":"content-box",width:scroll.sXInner||"100%"}).append(headerClone.removeAttr("id").css("margin-left",0).append("top"===captionSide?caption:null).append(table.children("thead"))))).append($(_div,{class:classes.sScrollBody}).css({position:"relative",overflow:"auto",width:size(scrollX)}).append(table));footer&&scroller.append($(_div,{class:classes.sScrollFoot}).css({overflow:"hidden",border:0,width:scrollX?size(scrollX):"100%"}).append($(_div,{class:classes.sScrollFootInner}).append(footerClone.removeAttr("id").css("margin-left",0).append("bottom"===captionSide?caption:null).append(table.children("tfoot")))));var children=scroller.children(),scrollHead=children[0],scrollBody=children[1],scrollFoot=footer?children[2]:null;return scrollX&&$(scrollBody).on("scroll.DT",(function(e){var scrollLeft=this.scrollLeft;scrollHead.scrollLeft=scrollLeft,footer&&(scrollFoot.scrollLeft=scrollLeft)})),$(scrollBody).css("max-height",scrollY),scroll.bCollapse||$(scrollBody).css("height",scrollY),settings.nScrollHead=scrollHead,settings.nScrollBody=scrollBody,settings.nScrollFoot=scrollFoot,settings.aoDrawCallback.push({fn:_fnScrollDraw,sName:"scrolling"}),scroller[0]}function _fnScrollDraw(settings){var headerTrgEls,footerTrgEls,headerSrcEls,footerSrcEls,headerCopy,footerCopy,idx,correction,sanityWidth,scroll=settings.oScroll,scrollX=scroll.sX,scrollXInner=scroll.sXInner,scrollY=scroll.sY,barWidth=scroll.iBarWidth,divHeader=$(settings.nScrollHead),divHeaderStyle=divHeader[0].style,divHeaderInner=divHeader.children("div"),divHeaderInnerStyle=divHeaderInner[0].style,divHeaderTable=divHeaderInner.children("table"),divBodyEl=settings.nScrollBody,divBody=$(divBodyEl),divBodyStyle=divBodyEl.style,divFooterInner=$(settings.nScrollFoot).children("div"),divFooterTable=divFooterInner.children("table"),header=$(settings.nTHead),table=$(settings.nTable),tableEl=table[0],tableStyle=tableEl.style,footer=settings.nTFoot?$(settings.nTFoot):null,browser=settings.oBrowser,ie67=browser.bScrollOversize,headerWidths=(_pluck(settings.aoColumns,"nTh"),[]),footerWidths=[],headerContent=[],footerContent=[],zeroOut=function(nSizer){var style=nSizer.style;style.paddingTop="0",style.paddingBottom="0",style.borderTopWidth="0",style.borderBottomWidth="0",style.height=0},scrollBarVis=divBodyEl.scrollHeight>divBodyEl.clientHeight;if(settings.scrollBarVis!==scrollBarVis&&settings.scrollBarVis!==undefined$1)return settings.scrollBarVis=scrollBarVis,void _fnAdjustColumnSizing(settings);settings.scrollBarVis=scrollBarVis,table.children("thead, tfoot").remove(),footer&&(footerCopy=footer.clone().prependTo(table),footerTrgEls=footer.find("tr"),footerSrcEls=footerCopy.find("tr"),footerCopy.find("[id]").removeAttr("id")),headerCopy=header.clone().prependTo(table),headerTrgEls=header.find("tr"),headerSrcEls=headerCopy.find("tr"),headerCopy.find("th, td").removeAttr("tabindex"),headerCopy.find("[id]").removeAttr("id"),scrollX||(divBodyStyle.width="100%",divHeader[0].style.width="100%"),$.each(_fnGetUniqueThs(settings,headerCopy),(function(i,el){idx=_fnVisibleToColumnIndex(settings,i),el.style.width=settings.aoColumns[idx].sWidth})),footer&&_fnApplyToChildren((function(n){n.style.width=""}),footerSrcEls),sanityWidth=table.outerWidth(),""===scrollX?(tableStyle.width="100%",ie67&&(table.find("tbody").height()>divBodyEl.offsetHeight||"scroll"==divBody.css("overflow-y"))&&(tableStyle.width=_fnStringToCss(table.outerWidth()-barWidth)),sanityWidth=table.outerWidth()):""!==scrollXInner&&(tableStyle.width=_fnStringToCss(scrollXInner),sanityWidth=table.outerWidth()),_fnApplyToChildren(zeroOut,headerSrcEls),_fnApplyToChildren((function(nSizer){var style=window.getComputedStyle?window.getComputedStyle(nSizer).width:_fnStringToCss($(nSizer).width());headerContent.push(nSizer.innerHTML),headerWidths.push(style)}),headerSrcEls),_fnApplyToChildren((function(nToSize,i){nToSize.style.width=headerWidths[i]}),headerTrgEls),$(headerSrcEls).css("height",0),footer&&(_fnApplyToChildren(zeroOut,footerSrcEls),_fnApplyToChildren((function(nSizer){footerContent.push(nSizer.innerHTML),footerWidths.push(_fnStringToCss($(nSizer).css("width")))}),footerSrcEls),_fnApplyToChildren((function(nToSize,i){nToSize.style.width=footerWidths[i]}),footerTrgEls),$(footerSrcEls).height(0)),_fnApplyToChildren((function(nSizer,i){nSizer.innerHTML='
'+headerContent[i]+"
",nSizer.childNodes[0].style.height="0",nSizer.childNodes[0].style.overflow="hidden",nSizer.style.width=headerWidths[i]}),headerSrcEls),footer&&_fnApplyToChildren((function(nSizer,i){nSizer.innerHTML='
'+footerContent[i]+"
",nSizer.childNodes[0].style.height="0",nSizer.childNodes[0].style.overflow="hidden",nSizer.style.width=footerWidths[i]}),footerSrcEls),Math.round(table.outerWidth())divBodyEl.offsetHeight||"scroll"==divBody.css("overflow-y")?sanityWidth+barWidth:sanityWidth,ie67&&(divBodyEl.scrollHeight>divBodyEl.offsetHeight||"scroll"==divBody.css("overflow-y"))&&(tableStyle.width=_fnStringToCss(correction-barWidth)),""!==scrollX&&""===scrollXInner||_fnLog(settings,1,"Possible column misalignment",6)):correction="100%",divBodyStyle.width=_fnStringToCss(correction),divHeaderStyle.width=_fnStringToCss(correction),footer&&(settings.nScrollFoot.style.width=_fnStringToCss(correction)),scrollY||ie67&&(divBodyStyle.height=_fnStringToCss(tableEl.offsetHeight+barWidth));var iOuterWidth=table.outerWidth();divHeaderTable[0].style.width=_fnStringToCss(iOuterWidth),divHeaderInnerStyle.width=_fnStringToCss(iOuterWidth);var bScrolling=table.height()>divBodyEl.clientHeight||"scroll"==divBody.css("overflow-y"),padding="padding"+(browser.bScrollbarLeft?"Left":"Right");divHeaderInnerStyle[padding]=bScrolling?barWidth+"px":"0px",footer&&(divFooterTable[0].style.width=_fnStringToCss(iOuterWidth),divFooterInner[0].style.width=_fnStringToCss(iOuterWidth),divFooterInner[0].style[padding]=bScrolling?barWidth+"px":"0px"),table.children("colgroup").insertBefore(table.children("thead")),divBody.trigger("scroll"),!settings.bSorted&&!settings.bFiltered||settings._drawHold||(divBodyEl.scrollTop=0)}function _fnApplyToChildren(fn,an1,an2){for(var nNode1,nNode2,index=0,i=0,iLen=an1.length;i/g;function _fnCalculateColumnWidths(oSettings){var i,column,columnIdx,table=oSettings.nTable,columns=oSettings.aoColumns,scroll=oSettings.oScroll,scrollY=scroll.sY,scrollX=scroll.sX,scrollXInner=scroll.sXInner,columnCount=columns.length,visibleColumns=_fnGetColumns(oSettings,"bVisible"),headerCells=$("th",oSettings.nTHead),tableWidthAttr=table.getAttribute("width"),tableContainer=table.parentNode,userInputs=!1,browser=oSettings.oBrowser,ie67=browser.bScrollOversize,styleWidth=table.style.width;styleWidth&&-1!==styleWidth.indexOf("%")&&(tableWidthAttr=styleWidth);var sizes=_fnConvertToWidth(_pluck(columns,"sWidthOrig"),tableContainer);for(i=0;i").appendTo(tmpTable.find("tbody"));for(tmpTable.find("thead, tfoot").remove(),tmpTable.append($(oSettings.nTHead).clone()).append($(oSettings.nTFoot).clone()),tmpTable.find("tfoot th, tfoot td").css("width",""),headerCells=_fnGetUniqueThs(oSettings,tmpTable.find("thead")[0]),i=0;i").css({width:column.sWidthOrig,margin:0,padding:0,border:0,height:1}));if(oSettings.aoData.length)for(i=0;i").css(scrollX||scrollY?{position:"absolute",top:0,left:0,height:1,right:0,overflow:"hidden"}:{}).append(tmpTable).appendTo(tableContainer);scrollX&&scrollXInner?tmpTable.width(scrollXInner):scrollX?(tmpTable.css("width","auto"),tmpTable.removeAttr("width"),tmpTable.width()").css("width",_fnStringToCss(widths[i])).appendTo(parent||document.body)):els.push(null);for(i=0;i").html(_fnGetCellData(settings,idx,colIdx,"display"))[0]}function _fnGetMaxLenString(settings,colIdx){for(var s,max=-1,maxIdx=-1,i=0,ien=settings.aoData.length;imax&&(max=s.length,maxIdx=i);return maxIdx}function _fnStringToCss(s){return null===s?"0px":"number"==typeof s?s<0?"0px":s+"px":s.match(/\d$/)?s+"px":s}function _fnSortFlatten(settings){var i,k,kLen,aDataSort,iCol,sType,srcCol,aSort=[],aoColumns=settings.aoColumns,fixed=settings.aaSortingFixed,fixedObj=$.isPlainObject(fixed),nestedSort=[],add=function(a){a.length&&!Array.isArray(a[0])?nestedSort.push(a):$.merge(nestedSort,a)};for(Array.isArray(fixed)&&add(fixed),fixedObj&&fixed.pre&&add(fixed.pre),add(settings.aaSorting),fixedObj&&fixed.post&&add(fixed.post),i=0;iy?1:0))return"asc"===sort.dir?test:-test;return(x=aiOrig[a])<(y=aiOrig[b])?-1:x>y?1:0})):displayMaster.sort((function(a,b){var x,y,k,test,sort,len=aSort.length,dataA=aoData[a]._aSortData,dataB=aoData[b]._aSortData;for(k=0;ky?1:0}))}oSettings.bSorted=!0}function _fnSortAria(settings){for(var label,nextSort,columns=settings.aoColumns,aSort=_fnSortFlatten(settings),oAria=settings.oLanguage.oAria,i=0,iLen=columns.length;i/g,""),th=col.nTh;th.removeAttribute("aria-sort"),col.bSortable?(aSort.length>0&&aSort[0].col==i?(th.setAttribute("aria-sort","asc"==aSort[0].dir?"ascending":"descending"),nextSort=asSorting[aSort[0].index+1]||asSorting[0]):nextSort=asSorting[0],label=sTitle+("asc"===nextSort?oAria.sSortAscending:oAria.sSortDescending)):label=sTitle,th.setAttribute("aria-label",label)}}function _fnSortListener(settings,colIdx,append,callback){var nextSortIdx,col=settings.aoColumns[colIdx],sorting=settings.aaSorting,asSorting=col.asSorting,next=function(a,overflow){var idx=a._idx;return idx===undefined$1&&(idx=$.inArray(a[1],asSorting)),idx+10&&s.time<+new Date-1e3*duration)return settings._bLoadingState=!1,void callback();if(s.columns&&columns.length!==s.columns.length)return settings._bLoadingState=!1,void callback();if(settings.oLoadedState=$.extend(!0,{},s),s.length!==undefined$1&&(api?api.page.len(s.length):settings._iDisplayLength=s.length),s.start!==undefined$1&&(null===api?(settings._iDisplayStart=s.start,settings.iInitDisplayStart=s.start):_fnPageChange(settings,s.start/settings._iDisplayLength)),s.order!==undefined$1&&(settings.aaSorting=[],$.each(s.order,(function(i,col){settings.aaSorting.push(col[0]>=columns.length?[0,col[1]]:col)}))),s.search!==undefined$1&&$.extend(settings.oPreviousSearch,_fnSearchToHung(s.search)),s.columns){for(i=0,ien=s.columns.length;i=end&&(start=end-len),start-=start%len,(-1===len||start<0)&&(start=0),settings._iDisplayStart=start}function _fnRenderer(settings,type){var renderer=settings.renderer,host=DataTable.ext.renderer[type];return $.isPlainObject(renderer)&&renderer[type]?host[renderer[type]]||host._:"string"==typeof renderer&&host[renderer]||host._}function _fnDataSource(settings){return settings.oFeatures.bServerSide?"ssp":settings.ajax||settings.sAjaxSource?"ajax":"dom"}var __apiStruct=[],__arrayProto=Array.prototype;_Api=function(context,data){if(!(this instanceof _Api))return new _Api(context,data);var settings=[],ctxSettings=function(o){var a=function(mixed){var idx,jq,settings=DataTable.settings,tables=$.map(settings,(function(el,i){return el.nTable}));return mixed?mixed.nTable&&mixed.oApi?[mixed]:mixed.nodeName&&"table"===mixed.nodeName.toLowerCase()?-1!==(idx=$.inArray(mixed,tables))?[settings[idx]]:null:mixed&&"function"==typeof mixed.settings?mixed.settings().toArray():("string"==typeof mixed?jq=$(mixed):mixed instanceof $&&(jq=mixed),jq?jq.map((function(i){return-1!==(idx=$.inArray(this,tables))?settings[idx]:null})).toArray():void 0):[]}(o);a&&settings.push.apply(settings,a)};if(Array.isArray(context))for(var i=0,ien=context.length;iidx?new _Api(ctx[idx],this[idx]):null},filter:function(fn){var a=[];if(__arrayProto.filter)a=__arrayProto.filter.call(this,fn,this);else for(var i=0,ien=this.length;i0)return ctx[0].json})),_api_register("ajax.params()",(function(){var ctx=this.context;if(ctx.length>0)return ctx[0].oAjaxData})),_api_register("ajax.reload()",(function(callback,resetPaging){return this.iterator("table",(function(settings){__reload(settings,!1===resetPaging,callback)}))})),_api_register("ajax.url()",(function(url){var ctx=this.context;return url===undefined$1?0===ctx.length?undefined$1:(ctx=ctx[0]).ajax?$.isPlainObject(ctx.ajax)?ctx.ajax.url:ctx.ajax:ctx.sAjaxSource:this.iterator("table",(function(settings){$.isPlainObject(settings.ajax)?settings.ajax.url=url:settings.ajax=url}))})),_api_register("ajax.url().load()",(function(callback,resetPaging){return this.iterator("table",(function(ctx){__reload(ctx,!1===resetPaging,callback)}))}));var _selector_run=function(type,selector,selectFn,settings,opts){var res,a,i,ien,j,jen,out=[],selectorType=typeof selector;for(selector&&"string"!==selectorType&&"function"!==selectorType&&selector.length!==undefined$1||(selector=[selector]),i=0,ien=selector.length;i0)return inst[0]=inst[i],inst[0].length=1,inst.length=1,inst.context=[inst.context[i]],inst;return inst.length=0,inst},_selector_row_indexes=function(settings,opts){var tmp,a=[],displayFiltered=settings.aiDisplay,displayMaster=settings.aiDisplayMaster,search=opts.search,order=opts.order,page=opts.page;if("ssp"==_fnDataSource(settings))return"removed"===search?[]:_range(0,displayMaster.length);if("current"==page)for(i=settings._iDisplayStart,ien=settings.fnDisplayEnd();i=0&&"applied"==search)&&a.push(i);return a};_api_register("rows()",(function(selector,opts){selector===undefined$1?selector="":$.isPlainObject(selector)&&(opts=selector,selector=""),opts=_selector_opts(opts);var inst=this.iterator("table",(function(settings){return function(settings,selector,opts){var rows;return _selector_run("row",selector,(function(sel){var selInt=_intVal(sel),aoData=settings.aoData;if(null!==selInt&&!opts)return[selInt];if(rows||(rows=_selector_row_indexes(settings,opts)),null!==selInt&&-1!==$.inArray(selInt,rows))return[selInt];if(null===sel||sel===undefined$1||""===sel)return rows;if("function"==typeof sel)return $.map(rows,(function(idx){var row=aoData[idx];return sel(idx,row._aData,row.nTr)?idx:null}));if(sel.nodeName){var rowIdx=sel._DT_RowIndex,cellIdx=sel._DT_CellIndex;if(rowIdx!==undefined$1)return aoData[rowIdx]&&aoData[rowIdx].nTr===sel?[rowIdx]:[];if(cellIdx)return aoData[cellIdx.row]&&aoData[cellIdx.row].nTr===sel.parentNode?[cellIdx.row]:[];var host=$(sel).closest("*[data-dt-row]");return host.length?[host.data("dt-row")]:[]}if("string"==typeof sel&&"#"===sel.charAt(0)){var rowObj=settings.aIds[sel.replace(/^#/,"")];if(rowObj!==undefined$1)return[rowObj.idx]}var nodes=_removeEmpty(_pluck_order(settings.aoData,rows,"nTr"));return $(nodes).filter(sel).map((function(){return this._DT_RowIndex})).toArray()}),settings,opts)}(settings,selector,opts)}),1);return inst.selector.rows=selector,inst.selector.opts=opts,inst})),_api_register("rows().nodes()",(function(){return this.iterator("row",(function(settings,row){return settings.aoData[row].nTr||undefined$1}),1)})),_api_register("rows().data()",(function(){return this.iterator(!0,"rows",(function(settings,rows){return _pluck_order(settings.aoData,rows,"_aData")}),1)})),_api_registerPlural("rows().cache()","row().cache()",(function(type){return this.iterator("row",(function(settings,row){var r=settings.aoData[row];return"search"===type?r._aFilterData:r._aSortData}),1)})),_api_registerPlural("rows().invalidate()","row().invalidate()",(function(src){return this.iterator("row",(function(settings,row){_fnInvalidate(settings,row,src)}))})),_api_registerPlural("rows().indexes()","row().index()",(function(){return this.iterator("row",(function(settings,row){return row}),1)})),_api_registerPlural("rows().ids()","row().id()",(function(hash){for(var a=[],context=this.context,i=0,ien=context.length;i0&&settings._iRecordsDisplay--,_fnLengthOverflow(settings);var id=settings.rowIdFn(rowData._aData);id!==undefined$1&&delete settings.aIds[id]})),this.iterator("table",(function(settings){for(var i=0,ien=settings.aoData.length;i0&&(api.on("draw.dt.DT_details",(function(e,ctx){settings===ctx&&api.rows({page:"current"}).eq(0).each((function(idx){var row=data[idx];row._detailsShow&&row._details.insertAfter(row.nTr)}))})),api.on("column-sizing.dt.DT_details",(function(e,ctx,idx,vis){if(settings===ctx)for(var row,visible=_fnVisbleColumns(ctx),i=0,ien=data.length;i").addClass(k);$("td",created).addClass(k).html(r)[0].colSpan=_fnVisbleColumns(ctx),rows.push(created[0])}};addRow(data,klass),row._details&&row._details.detach(),row._details=$(rows),row._detailsShow&&row._details.insertAfter(row.nTr)}(ctx[0],ctx[0].aoData[this[0]],data,klass),this)})),_api_register(["row().child.show()","row().child().show()"],(function(show){return __details_display(this,!0),this})),_api_register(["row().child.hide()","row().child().hide()"],(function(){return __details_display(this,!1),this})),_api_register(["row().child.remove()","row().child().remove()"],(function(){return __details_remove(this),this})),_api_register("row().child.isShown()",(function(){var ctx=this.context;return ctx.length&&this.length&&ctx[0].aoData[this[0]]._detailsShow||!1}));var __re_column_selector=/^([^:]+):(name|visIdx|visible)$/,__columnData=function(settings,column,r1,r2,rows){for(var a=[],row=0,ien=rows.length;row=0?selInt:columns.length+selInt];if("function"==typeof s){var rows=_selector_row_indexes(settings,opts);return $.map(columns,(function(col,idx){return s(idx,__columnData(settings,idx,0,0,rows),nodes[idx])?idx:null}))}var match="string"==typeof s?s.match(__re_column_selector):"";if(match)switch(match[2]){case"visIdx":case"visible":var idx=parseInt(match[1],10);if(idx<0){var visColumns=$.map(columns,(function(col,i){return col.bVisible?i:null}));return[visColumns[visColumns.length+idx]]}return[_fnVisibleToColumnIndex(settings,idx)];case"name":return $.map(names,(function(name,i){return name===match[1]?i:null}));default:return[]}if(s.nodeName&&s._DT_CellIndex)return[s._DT_CellIndex.column];var jqResult=$(nodes).filter(s).map((function(){return $.inArray(this,nodes)})).toArray();if(jqResult.length||!s.nodeName)return jqResult;var host=$(s).closest("*[data-dt-column]");return host.length?[host.data("dt-column")]:[]}),settings,opts)}(settings,selector,opts)}),1);return inst.selector.cols=selector,inst.selector.opts=opts,inst})),_api_registerPlural("columns().header()","column().header()",(function(selector,opts){return this.iterator("column",(function(settings,column){return settings.aoColumns[column].nTh}),1)})),_api_registerPlural("columns().footer()","column().footer()",(function(selector,opts){return this.iterator("column",(function(settings,column){return settings.aoColumns[column].nTf}),1)})),_api_registerPlural("columns().data()","column().data()",(function(){return this.iterator("column-rows",__columnData,1)})),_api_registerPlural("columns().dataSrc()","column().dataSrc()",(function(){return this.iterator("column",(function(settings,column){return settings.aoColumns[column].mData}),1)})),_api_registerPlural("columns().cache()","column().cache()",(function(type){return this.iterator("column-rows",(function(settings,column,i,j,rows){return _pluck_order(settings.aoData,rows,"search"===type?"_aFilterData":"_aSortData",column)}),1)})),_api_registerPlural("columns().nodes()","column().nodes()",(function(){return this.iterator("column-rows",(function(settings,column,i,j,rows){return _pluck_order(settings.aoData,rows,"anCells",column)}),1)})),_api_registerPlural("columns().visible()","column().visible()",(function(vis,calc){var that=this,ret=this.iterator("column",(function(settings,column){if(vis===undefined$1)return settings.aoColumns[column].bVisible;!function(settings,column,vis){var cells,i,ien,tr,cols=settings.aoColumns,col=cols[column],data=settings.aoData;if(vis===undefined$1)return col.bVisible;if(col.bVisible!==vis){if(vis){var insertBefore=$.inArray(!0,_pluck(cols,"bVisible"),column+1);for(i=0,ien=data.length;iiThat;return!0},DataTable.isDataTable=DataTable.fnIsDataTable=function(table){var t=$(table).get(0),is=!1;return table instanceof DataTable.Api||($.each(DataTable.settings,(function(i,o){var head=o.nScrollHead?$("table",o.nScrollHead)[0]:null,foot=o.nScrollFoot?$("table",o.nScrollFoot)[0]:null;o.nTable!==t&&head!==t&&foot!==t||(is=!0)})),is)},DataTable.tables=DataTable.fnTables=function(visible){var api=!1;$.isPlainObject(visible)&&(api=visible.api,visible=visible.visible);var a=$.map(DataTable.settings,(function(o){if(!visible||visible&&$(o.nTable).is(":visible"))return o.nTable}));return api?new _Api(a):a},DataTable.camelToHungarian=_fnCamelToHungarian,_api_register("$()",(function(selector,opts){var rows=this.rows(opts).nodes(),jqRows=$(rows);return $([].concat(jqRows.filter(selector).toArray(),jqRows.find(selector).toArray()))})),$.each(["on","one","off"],(function(i,key){_api_register(key+"()",(function(){var args=Array.prototype.slice.call(arguments);args[0]=$.map(args[0].split(/\s/),(function(e){return e.match(/\.dt\b/)?e:e+".dt"})).join(" ");var inst=$(this.tables().nodes());return inst[key].apply(inst,args),this}))})),_api_register("clear()",(function(){return this.iterator("table",(function(settings){_fnClearTable(settings)}))})),_api_register("settings()",(function(){return new _Api(this.context,this.context)})),_api_register("init()",(function(){var ctx=this.context;return ctx.length?ctx[0].oInit:null})),_api_register("data()",(function(){return this.iterator("table",(function(settings){return _pluck(settings.aoData,"_aData")})).flatten()})),_api_register("destroy()",(function(remove){return remove=remove||!1,this.iterator("table",(function(settings){var ien,classes=settings.oClasses,table=settings.nTable,tbody=settings.nTBody,thead=settings.nTHead,tfoot=settings.nTFoot,jqTable=$(table),jqTbody=$(tbody),jqWrapper=$(settings.nTableWrapper),rows=$.map(settings.aoData,(function(r){return r.nTr}));settings.bDestroying=!0,_fnCallbackFire(settings,"aoDestroyCallback","destroy",[settings]),remove||new _Api(settings).columns().visible(!0),jqWrapper.off(".DT").find(":not(tbody *)").off(".DT"),$(window).off(".DT-"+settings.sInstance),table!=thead.parentNode&&(jqTable.children("thead").detach(),jqTable.append(thead)),tfoot&&table!=tfoot.parentNode&&(jqTable.children("tfoot").detach(),jqTable.append(tfoot)),settings.aaSorting=[],settings.aaSortingFixed=[],_fnSortingClasses(settings),$(rows).removeClass(settings.asStripeClasses.join(" ")),$("th, td",thead).removeClass(classes.sSortable+" "+classes.sSortableAsc+" "+classes.sSortableDesc+" "+classes.sSortableNone),jqTbody.children().detach(),jqTbody.append(rows);var orig=settings.nTableWrapper.parentNode,removedMethod=remove?"remove":"detach";jqTable[removedMethod](),jqWrapper[removedMethod](),!remove&&orig&&(orig.insertBefore(table,settings.nTableReinsertBefore),jqTable.css("width",settings.sDestroyWidth).removeClass(classes.sTable),(ien=settings.asDestroyStripes.length)&&jqTbody.children().each((function(i){$(this).addClass(settings.asDestroyStripes[i%ien])})));var idx=$.inArray(settings,DataTable.settings);-1!==idx&&DataTable.settings.splice(idx,1)}))})),$.each(["column","row","cell"],(function(i,type){_api_register(type+"s().every()",(function(fn){var opts=this.selector.opts,api=this;return this.iterator(type,(function(settings,arg1,arg2,arg3,arg4){fn.call(api[type](arg1,"cell"===type?arg2:opts,"cell"===type?opts:undefined$1),arg1,arg2,arg3,arg4)}))}))})),_api_register("i18n()",(function(token,def,plural){var ctx=this.context[0],resolved=_fnGetObjectDataFn(token)(ctx.oLanguage);return resolved===undefined$1&&(resolved=def),plural!==undefined$1&&$.isPlainObject(resolved)&&(resolved=resolved[plural]!==undefined$1?resolved[plural]:resolved._),"string"==typeof resolved?resolved.replace("%d",plural):resolved})),DataTable.version="1.13.7",DataTable.settings=[],DataTable.models={},DataTable.models.oSearch={bCaseInsensitive:!0,sSearch:"",bRegex:!1,bSmart:!0,return:!1},DataTable.models.oRow={nTr:null,anCells:null,_aData:[],_aSortData:null,_aFilterData:null,_sFilterRow:null,_sRowStripe:"",src:null,idx:-1},DataTable.models.oColumn={idx:null,aDataSort:null,asSorting:null,bSearchable:null,bSortable:null,bVisible:null,_sManualType:null,_bAttrSrc:!1,fnCreatedCell:null,fnGetData:null,fnSetData:null,mData:null,mRender:null,nTh:null,nTf:null,sClass:null,sContentPadding:null,sDefaultContent:null,sName:null,sSortDataType:"std",sSortingClass:null,sSortingClassJUI:null,sTitle:null,sType:null,sWidth:null,sWidthOrig:null},DataTable.defaults={aaData:null,aaSorting:[[0,"asc"]],aaSortingFixed:[],ajax:null,aLengthMenu:[10,25,50,100],aoColumns:null,aoColumnDefs:null,aoSearchCols:[],asStripeClasses:null,bAutoWidth:!0,bDeferRender:!1,bDestroy:!1,bFilter:!0,bInfo:!0,bLengthChange:!0,bPaginate:!0,bProcessing:!1,bRetrieve:!1,bScrollCollapse:!1,bServerSide:!1,bSort:!0,bSortMulti:!0,bSortCellsTop:!1,bSortClasses:!0,bStateSave:!1,fnCreatedRow:null,fnDrawCallback:null,fnFooterCallback:null,fnFormatNumber:function(toFormat){return toFormat.toString().replace(/\B(?=(\d{3})+(?!\d))/g,this.oLanguage.sThousands)},fnHeaderCallback:null,fnInfoCallback:null,fnInitComplete:null,fnPreDrawCallback:null,fnRowCallback:null,fnServerData:null,fnServerParams:null,fnStateLoadCallback:function(settings){try{return JSON.parse((-1===settings.iStateDuration?sessionStorage:localStorage).getItem("DataTables_"+settings.sInstance+"_"+location.pathname))}catch(e){return{}}},fnStateLoadParams:null,fnStateLoaded:null,fnStateSaveCallback:function(settings,data){try{(-1===settings.iStateDuration?sessionStorage:localStorage).setItem("DataTables_"+settings.sInstance+"_"+location.pathname,JSON.stringify(data))}catch(e){}},fnStateSaveParams:null,iStateDuration:7200,iDeferLoading:null,iDisplayLength:10,iDisplayStart:0,iTabIndex:0,oClasses:{},oLanguage:{oAria:{sSortAscending:": activate to sort column ascending",sSortDescending:": activate to sort column descending"},oPaginate:{sFirst:"First",sLast:"Last",sNext:"Next",sPrevious:"Previous"},sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)",sInfoPostFix:"",sDecimal:"",sThousands:",",sLengthMenu:"Show _MENU_ entries",sLoadingRecords:"Loading...",sProcessing:"",sSearch:"Search:",sSearchPlaceholder:"",sUrl:"",sZeroRecords:"No matching records found"},oSearch:$.extend({},DataTable.models.oSearch),sAjaxDataProp:"data",sAjaxSource:null,sDom:"lfrtip",searchDelay:null,sPaginationType:"simple_numbers",sScrollX:"",sScrollXInner:"",sScrollY:"",sServerMethod:"GET",renderer:null,rowId:"DT_RowId"},_fnHungarianMap(DataTable.defaults),DataTable.defaults.column={aDataSort:null,iDataSort:-1,asSorting:["asc","desc"],bSearchable:!0,bSortable:!0,bVisible:!0,fnCreatedCell:null,mData:null,mRender:null,sCellType:"td",sClass:"",sContentPadding:"",sDefaultContent:null,sName:"",sSortDataType:"std",sTitle:null,sType:null,sWidth:null},_fnHungarianMap(DataTable.defaults.column),DataTable.models.oSettings={oFeatures:{bAutoWidth:null,bDeferRender:null,bFilter:null,bInfo:null,bLengthChange:null,bPaginate:null,bProcessing:null,bServerSide:null,bSort:null,bSortMulti:null,bSortClasses:null,bStateSave:null},oScroll:{bCollapse:null,iBarWidth:0,sX:null,sXInner:null,sY:null},oLanguage:{fnInfoCallback:null},oBrowser:{bScrollOversize:!1,bScrollbarLeft:!1,bBounding:!1,barWidth:0},ajax:null,aanFeatures:[],aoData:[],aiDisplay:[],aiDisplayMaster:[],aIds:{},aoColumns:[],aoHeader:[],aoFooter:[],oPreviousSearch:{},aoPreSearchCols:[],aaSorting:null,aaSortingFixed:[],asStripeClasses:null,asDestroyStripes:[],sDestroyWidth:0,aoRowCallback:[],aoHeaderCallback:[],aoFooterCallback:[],aoDrawCallback:[],aoRowCreatedCallback:[],aoPreDrawCallback:[],aoInitComplete:[],aoStateSaveParams:[],aoStateLoadParams:[],aoStateLoaded:[],sTableId:"",nTable:null,nTHead:null,nTFoot:null,nTBody:null,nTableWrapper:null,bDeferLoading:!1,bInitialised:!1,aoOpenRows:[],sDom:null,searchDelay:null,sPaginationType:"two_button",iStateDuration:0,aoStateSave:[],aoStateLoad:[],oSavedState:null,oLoadedState:null,sAjaxSource:null,sAjaxDataProp:null,jqXHR:null,json:undefined$1,oAjaxData:undefined$1,fnServerData:null,aoServerParams:[],sServerMethod:null,fnFormatNumber:null,aLengthMenu:null,iDraw:0,bDrawing:!1,iDrawError:-1,_iDisplayLength:10,_iDisplayStart:0,_iRecordsTotal:0,_iRecordsDisplay:0,oClasses:{},bFiltered:!1,bSorted:!1,bSortCellsTop:null,oInit:null,aoDestroyCallback:[],fnRecordsTotal:function(){return"ssp"==_fnDataSource(this)?1*this._iRecordsTotal:this.aiDisplayMaster.length},fnRecordsDisplay:function(){return"ssp"==_fnDataSource(this)?1*this._iRecordsDisplay:this.aiDisplay.length},fnDisplayEnd:function(){var len=this._iDisplayLength,start=this._iDisplayStart,calc=start+len,records=this.aiDisplay.length,features=this.oFeatures,paginate=features.bPaginate;return features.bServerSide?!1===paginate||-1===len?start+records:Math.min(start+len,this._iRecordsDisplay):!paginate||calc>records||-1===len?records:calc},oInstance:null,sInstance:null,iTabIndex:0,nScrollHead:null,nScrollFoot:null,aLastSort:[],oPlugins:{},rowIdFn:null,rowId:null},DataTable.ext=_ext={buttons:{},classes:{},builder:"-source-",errMode:"alert",feature:[],search:[],selector:{cell:[],column:[],row:[]},internal:{},legacy:{ajax:null},pager:{},renderer:{pageButton:{},header:{}},order:{},type:{detect:[],search:{},order:{}},_unique:0,fnVersionCheck:DataTable.fnVersionCheck,iApiIndex:0,oJUIClasses:{},sVersion:DataTable.version},$.extend(_ext,{afnFiltering:_ext.search,aTypes:_ext.type.detect,ofnSearch:_ext.type.search,oSort:_ext.type.order,afnSortData:_ext.order,aoFeatures:_ext.feature,oApi:_ext.internal,oStdClasses:_ext.classes,oPagination:_ext.pager}),$.extend(DataTable.ext.classes,{sTable:"dataTable",sNoFooter:"no-footer",sPageButton:"paginate_button",sPageButtonActive:"current",sPageButtonDisabled:"disabled",sStripeOdd:"odd",sStripeEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_desc_disabled",sSortableDesc:"sorting_asc_disabled",sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sFilterInput:"",sLengthSelect:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sHeaderTH:"",sFooterTH:"",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sSortJUIWrapper:"",sSortIcon:"",sJUIHeader:"",sJUIFooter:""});var extPagination=DataTable.ext.pager;function _numbers(page,pages){var numbers=[],buttons=extPagination.numbers_length,half=Math.floor(buttons/2);return pages<=buttons?numbers=_range(0,pages):page<=half?((numbers=_range(0,buttons-2)).push("ellipsis"),numbers.push(pages-1)):page>=pages-1-half?((numbers=_range(pages-(buttons-2),pages)).splice(0,0,"ellipsis"),numbers.splice(0,0,0)):((numbers=_range(page-half+2,page+half-1)).push("ellipsis"),numbers.push(pages-1),numbers.splice(0,0,"ellipsis"),numbers.splice(0,0,0)),numbers.DT_el="span",numbers}$.extend(extPagination,{simple:function(page,pages){return["previous","next"]},full:function(page,pages){return["first","previous","next","last"]},numbers:function(page,pages){return[_numbers(page,pages)]},simple_numbers:function(page,pages){return["previous",_numbers(page,pages),"next"]},full_numbers:function(page,pages){return["first","previous",_numbers(page,pages),"next","last"]},first_last_numbers:function(page,pages){return["first",_numbers(page,pages),"last"]},_numbers:_numbers,numbers_length:7}),$.extend(!0,DataTable.ext.renderer,{pageButton:{_:function(settings,host,idx,buttons,page,pages){var btnDisplay,btnClass,activeEl,classes=settings.oClasses,lang=settings.oLanguage.oPaginate,aria=settings.oLanguage.oAria.paginate||{},attach=function(container,buttons){var i,ien,button,disabledClass=classes.sPageButtonDisabled,clickHandler=function(e){_fnPageChange(settings,e.data.action,!0)};for(i=0,ien=buttons.length;i").appendTo(container);attach(inner,button)}else{var disabled=!1;switch(btnDisplay=null,btnClass=button,button){case"ellipsis":container.append('');break;case"first":btnDisplay=lang.sFirst,0===page&&(disabled=!0);break;case"previous":btnDisplay=lang.sPrevious,0===page&&(disabled=!0);break;case"next":btnDisplay=lang.sNext,0!==pages&&page!==pages-1||(disabled=!0);break;case"last":btnDisplay=lang.sLast,0!==pages&&page!==pages-1||(disabled=!0);break;default:btnDisplay=settings.fnFormatNumber(button+1),btnClass=page===button?classes.sPageButtonActive:""}if(null!==btnDisplay){var tag=settings.oInit.pagingTag||"a";disabled&&(btnClass+=" "+disabledClass),_fnBindAction($("<"+tag+">",{class:classes.sPageButton+" "+btnClass,"aria-controls":settings.sTableId,"aria-disabled":disabled?"true":null,"aria-label":aria[button],role:"link","aria-current":btnClass===classes.sPageButtonActive?"page":null,"data-dt-idx":button,tabindex:disabled?-1:settings.iTabIndex,id:0===idx&&"string"==typeof button?settings.sTableId+"_"+button:null}).html(btnDisplay).appendTo(container),{action:button},clickHandler)}}};try{activeEl=$(host).find(document.activeElement).data("dt-idx")}catch(e){}attach($(host).empty(),buttons),activeEl!==undefined$1&&$(host).find("[data-dt-idx="+activeEl+"]").trigger("focus")}}}),$.extend(DataTable.ext.type.detect,[function(d,settings){var decimal=settings.oLanguage.sDecimal;return _isNumber(d,decimal)?"num"+decimal:null},function(d,settings){if(d&&!(d instanceof Date)&&!_re_date.test(d))return null;var parsed=Date.parse(d);return null!==parsed&&!isNaN(parsed)||_empty(d)?"date":null},function(d,settings){var decimal=settings.oLanguage.sDecimal;return _isNumber(d,decimal,!0)?"num-fmt"+decimal:null},function(d,settings){var decimal=settings.oLanguage.sDecimal;return _htmlNumeric(d,decimal)?"html-num"+decimal:null},function(d,settings){var decimal=settings.oLanguage.sDecimal;return _htmlNumeric(d,decimal,!0)?"html-num-fmt"+decimal:null},function(d,settings){return _empty(d)||"string"==typeof d&&-1!==d.indexOf("<")?"html":null}]),$.extend(DataTable.ext.type.search,{html:function(data){return _empty(data)?data:"string"==typeof data?data.replace(_re_new_lines," ").replace(_re_html,""):""},string:function(data){return _empty(data)?data:"string"==typeof data?data.replace(_re_new_lines," "):data}});var __numericReplace=function(d,decimalPlace,re1,re2){if(0!==d&&(!d||"-"===d))return-1/0;var type=typeof d;return"number"===type||"bigint"===type?d:(decimalPlace&&(d=_numToDecimal(d,decimalPlace)),d.replace&&(re1&&(d=d.replace(re1,"")),re2&&(d=d.replace(re2,""))),1*d)};function _addNumericSort(decimalPlace){$.each({num:function(d){return __numericReplace(d,decimalPlace)},"num-fmt":function(d){return __numericReplace(d,decimalPlace,_re_formatted_numeric)},"html-num":function(d){return __numericReplace(d,decimalPlace,_re_html)},"html-num-fmt":function(d){return __numericReplace(d,decimalPlace,_re_html,_re_formatted_numeric)}},(function(key,fn){_ext.type.order[key+decimalPlace+"-pre"]=fn,key.match(/^html\-/)&&(_ext.type.search[key+decimalPlace]=_ext.type.search.html)}))}$.extend(_ext.type.order,{"date-pre":function(d){var ts=Date.parse(d);return isNaN(ts)?-1/0:ts},"html-pre":function(a){return _empty(a)?"":a.replace?a.replace(/<.*?>/g,"").toLowerCase():a+""},"string-pre":function(a){return _empty(a)?"":"string"==typeof a?a.toLowerCase():a.toString?a.toString():""},"string-asc":function(x,y){return xy?1:0},"string-desc":function(x,y){return xy?-1:0}}),_addNumericSort(""),$.extend(!0,DataTable.ext.renderer,{header:{_:function(settings,cell,column,classes){$(settings.nTable).on("order.dt.DT",(function(e,ctx,sorting,columns){if(settings===ctx){var colIdx=column.idx;cell.removeClass(classes.sSortAsc+" "+classes.sSortDesc).addClass("asc"==columns[colIdx]?classes.sSortAsc:"desc"==columns[colIdx]?classes.sSortDesc:column.sSortingClass)}}))},jqueryui:function(settings,cell,column,classes){$("
").addClass(classes.sSortJUIWrapper).append(cell.contents()).append($("").addClass(classes.sSortIcon+" "+column.sSortingClassJUI)).appendTo(cell),$(settings.nTable).on("order.dt.DT",(function(e,ctx,sorting,columns){if(settings===ctx){var colIdx=column.idx;cell.removeClass(classes.sSortAsc+" "+classes.sSortDesc).addClass("asc"==columns[colIdx]?classes.sSortAsc:"desc"==columns[colIdx]?classes.sSortDesc:column.sSortingClass),cell.find("span."+classes.sSortIcon).removeClass(classes.sSortJUIAsc+" "+classes.sSortJUIDesc+" "+classes.sSortJUI+" "+classes.sSortJUIAscAllowed+" "+classes.sSortJUIDescAllowed).addClass("asc"==columns[colIdx]?classes.sSortJUIAsc:"desc"==columns[colIdx]?classes.sSortJUIDesc:column.sSortingClassJUI)}}))}}});var __htmlEscapeEntities=function(d){return Array.isArray(d)&&(d=d.join(",")),"string"==typeof d?d.replace(/&/g,"&").replace(//g,">").replace(/"/g,"""):d};function __mld(dt,momentFn,luxonFn,dateFn,arg1){return window.moment?dt[momentFn](arg1):window.luxon?dt[luxonFn](arg1):dateFn?dt[dateFn](arg1):dt}var __mlWarning=!1;function __mldObj(d,format,locale){var dt;if(window.moment){if(!(dt=window.moment.utc(d,format,locale,!0)).isValid())return null}else if(window.luxon){if(!(dt=format&&"string"==typeof d?window.luxon.DateTime.fromFormat(d,format):window.luxon.DateTime.fromISO(d)).isValid)return null;dt.setLocale(locale)}else format?(__mlWarning||alert("DataTables warning: Formatted date without Moment.js or Luxon - https://datatables.net/tn/17"),__mlWarning=!0):dt=new Date(d);return dt}function __mlHelper(localeString){return function(from,to,locale,def){0===arguments.length?(locale="en",to=null,from=null):1===arguments.length?(locale="en",to=from,from=null):2===arguments.length&&(locale=to,to=from,from=null);var typeName="datetime-"+to;return DataTable.ext.type.order[typeName]||(DataTable.ext.type.detect.unshift((function(d){return d===typeName&&typeName})),DataTable.ext.type.order[typeName+"-asc"]=function(a,b){var x=a.valueOf(),y=b.valueOf();return x===y?0:xy?-1:1}),function(d,type){if(null===d||d===undefined$1)if("--now"===def){var local=new Date;d=new Date(Date.UTC(local.getFullYear(),local.getMonth(),local.getDate(),local.getHours(),local.getMinutes(),local.getSeconds()))}else d="";if("type"===type)return typeName;if(""===d)return"sort"!==type?"":__mldObj("0000-01-01 00:00:00",null,locale);if(null!==to&&from===to&&"sort"!==type&&"type"!==type&&!(d instanceof Date))return d;var dt=__mldObj(d,from,locale);if(null===dt)return d;if("sort"===type)return dt;var formatted=null===to?__mld(dt,"toDate","toJSDate","")[localeString]():__mld(dt,"format","toFormat","toISOString",to);return"display"===type?__htmlEscapeEntities(formatted):formatted}}}var __thousands=",",__decimal=".";if(window.Intl!==undefined$1)try{for(var num=(new Intl.NumberFormat).formatToParts(100000.1),i=0;i */function(window, document, undefined) {\n\n (function(factory) {\n \"use strict\";\n\n // Define as an AMD module if possible\n if (typeof define === 'function' && define.amd) {\n define(['jquery'], factory);\n }\n /* Define using browser globals otherwise\n\t * Prevent multiple instantiations if the script is loaded twice\n\t */\n else if (jQuery && !jQuery.fn.dataTable) {\n factory(jQuery);\n }\n }\n (/** @lends */function($) {\n \"use strict\";\n /**\n * DataTables is a plug-in for the jQuery Javascript library. It is a\n * highly flexible tool, based upon the foundations of progressive\n * enhancement, which will add advanced interaction controls to any\n * HTML table. For a full list of features please refer to\n * DataTables.net.\n *\n * Note that the DataTable object is not a global variable but is\n * aliased to jQuery.fn.DataTable and jQuery.fn.dataTable through which\n * it may be accessed.\n *\n * @class\n * @param {object} [oInit={}] Configuration object for DataTables. Options\n * are defined by {@link DataTable.defaults}\n * @requires jQuery 1.3+\n *\n * @example\n * // Basic initialisation\n * $(document).ready( function {\n * $('#example').dataTable();\n * } );\n *\n * @example\n * // Initialisation with configuration options - in this case, disable\n * // pagination and sorting.\n * $(document).ready( function {\n * $('#example').dataTable( {\n * \"bPaginate\": false,\n * \"bSort\": false\n * } );\n * } );\n */\n var DataTable = function(oInit) {\n\n\n /**\n * Add a column to the list used for the table with default values\n * @param {object} oSettings dataTables settings object\n * @param {node} nTh The th element for this column\n * @memberof DataTable#oApi\n */\n function _fnAddColumn(oSettings, nTh) {\n var oDefaults = DataTable.defaults.columns;\n var iCol = oSettings.aoColumns.length;\n var oCol = $.extend({}, DataTable.models.oColumn, oDefaults, {\n \"sSortingClass\": oSettings.oClasses.sSortable,\n \"sSortingClassJUI\": oSettings.oClasses.sSortJUI,\n \"nTh\": nTh ? nTh : document.createElement('th'),\n \"sTitle\": oDefaults.sTitle ? oDefaults.sTitle : nTh ? nTh.innerHTML : '',\n \"aDataSort\": oDefaults.aDataSort ? oDefaults.aDataSort : [iCol],\n \"mData\": oDefaults.mData ? oDefaults.oDefaults : iCol\n });\n oSettings.aoColumns.push(oCol);\n\n /* Add a column specific filter */\n if (oSettings.aoPreSearchCols[iCol] === undefined || oSettings.aoPreSearchCols[iCol] === null) {\n oSettings.aoPreSearchCols[iCol] = $.extend({}, DataTable.models.oSearch);\n } else {\n var oPre = oSettings.aoPreSearchCols[iCol];\n\n /* Don't require that the user must specify bRegex, bSmart or bCaseInsensitive */\n if (oPre.bRegex === undefined) {\n oPre.bRegex = true;\n }\n\n if (oPre.bSmart === undefined) {\n oPre.bSmart = true;\n }\n\n if (oPre.bCaseInsensitive === undefined) {\n oPre.bCaseInsensitive = true;\n }\n }\n\n /* Use the column options function to initialise classes etc */\n _fnColumnOptions(oSettings, iCol, null);\n }\n\n\n /**\n * Apply options for a column\n * @param {object} oSettings dataTables settings object\n * @param {int} iCol column index to consider\n * @param {object} oOptions object with sType, bVisible and bSearchable etc\n * @memberof DataTable#oApi\n */\n function _fnColumnOptions(oSettings, iCol, oOptions) {\n var oCol = oSettings.aoColumns[iCol];\n\n /* User specified column options */\n if (oOptions !== undefined && oOptions !== null) {\n /* Backwards compatibility for mDataProp */\n if (oOptions.mDataProp && !oOptions.mData) {\n oOptions.mData = oOptions.mDataProp;\n }\n\n if (oOptions.sType !== undefined) {\n oCol.sType = oOptions.sType;\n oCol._bAutoType = false;\n }\n\n $.extend(oCol, oOptions);\n _fnMap(oCol, oOptions, \"sWidth\", \"sWidthOrig\");\n\n /* iDataSort to be applied (backwards compatibility), but aDataSort will take\n\t\t\t\t * priority if defined\n\t\t\t\t */\n if (oOptions.iDataSort !== undefined) {\n oCol.aDataSort = [oOptions.iDataSort];\n }\n _fnMap(oCol, oOptions, \"aDataSort\");\n }\n\n /* Cache the data get and set functions for speed */\n var mRender = oCol.mRender ? _fnGetObjectDataFn(oCol.mRender) : null;\n var mData = _fnGetObjectDataFn(oCol.mData);\n\n oCol.fnGetData = function(oData, sSpecific) {\n var innerData = mData(oData, sSpecific);\n\n if (oCol.mRender && (sSpecific && sSpecific !== '')) {\n return mRender(innerData, sSpecific, oData);\n }\n return innerData;\n };\n oCol.fnSetData = _fnSetObjectDataFn(oCol.mData);\n\n /* Feature sorting overrides column specific when off */\n if (!oSettings.oFeatures.bSort) {\n oCol.bSortable = false;\n }\n\n /* Check that the class assignment is correct for sorting */\n if (!oCol.bSortable ||\n ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1)) {\n oCol.sSortingClass = oSettings.oClasses.sSortableNone;\n oCol.sSortingClassJUI = \"\";\n } else if ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) == -1) {\n oCol.sSortingClass = oSettings.oClasses.sSortable;\n oCol.sSortingClassJUI = oSettings.oClasses.sSortJUI;\n } else if ($.inArray('asc', oCol.asSorting) != -1 && $.inArray('desc', oCol.asSorting) == -1) {\n oCol.sSortingClass = oSettings.oClasses.sSortableAsc;\n oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIAscAllowed;\n } else if ($.inArray('asc', oCol.asSorting) == -1 && $.inArray('desc', oCol.asSorting) != -1) {\n oCol.sSortingClass = oSettings.oClasses.sSortableDesc;\n oCol.sSortingClassJUI = oSettings.oClasses.sSortJUIDescAllowed;\n }\n }\n\n\n /**\n * Adjust the table column widths for new data. Note: you would probably want to\n * do a redraw after calling this function!\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnAdjustColumnSizing(oSettings) {\n /* Not interested in doing column width calculation if auto-width is disabled */\n if (oSettings.oFeatures.bAutoWidth === false) {\n return false;\n }\n\n _fnCalculateColumnWidths(oSettings);\n for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n oSettings.aoColumns[i].nTh.style.width = oSettings.aoColumns[i].sWidth;\n }\n }\n\n\n /**\n * Covert the index of a visible column to the index in the data array (take account\n * of hidden columns)\n * @param {object} oSettings dataTables settings object\n * @param {int} iMatch Visible column index to lookup\n * @returns {int} i the data index\n * @memberof DataTable#oApi\n */\n function _fnVisibleToColumnIndex(oSettings, iMatch) {\n var aiVis = _fnGetColumns(oSettings, 'bVisible');\n\n return typeof aiVis[iMatch] === 'number' ?\n aiVis[iMatch] :\n null;\n }\n\n\n /**\n * Covert the index of an index in the data array and convert it to the visible\n * column index (take account of hidden columns)\n * @param {int} iMatch Column index to lookup\n * @param {object} oSettings dataTables settings object\n * @returns {int} i the data index\n * @memberof DataTable#oApi\n */\n function _fnColumnIndexToVisible(oSettings, iMatch) {\n var aiVis = _fnGetColumns(oSettings, 'bVisible');\n var iPos = $.inArray(iMatch, aiVis);\n\n return iPos !== -1 ? iPos : null;\n }\n\n\n /**\n * Get the number of visible columns\n * @param {object} oSettings dataTables settings object\n * @returns {int} i the number of visible columns\n * @memberof DataTable#oApi\n */\n function _fnVisbleColumns(oSettings) {\n return _fnGetColumns(oSettings, 'bVisible').length;\n }\n\n\n /**\n * Get an array of column indexes that match a given property\n * @param {object} oSettings dataTables settings object\n * @param {string} sParam Parameter in aoColumns to look for - typically\n * bVisible or bSearchable\n * @returns {array} Array of indexes with matched properties\n * @memberof DataTable#oApi\n */\n function _fnGetColumns(oSettings, sParam) {\n var a = [];\n\n $.map(oSettings.aoColumns, function(val, i) {\n if (val[sParam]) {\n a.push(i);\n }\n });\n\n return a;\n }\n\n\n /**\n * Get the sort type based on an input string\n * @param {string} sData data we wish to know the type of\n * @returns {string} type (defaults to 'string' if no type can be detected)\n * @memberof DataTable#oApi\n */\n function _fnDetectType(sData) {\n var aTypes = DataTable.ext.aTypes;\n var iLen = aTypes.length;\n\n for (var i = 0; i < iLen; i++) {\n var sType = aTypes[i](sData);\n if (sType !== null) {\n return sType;\n }\n }\n\n return 'string';\n }\n\n\n /**\n * Figure out how to reorder a display list\n * @param {object} oSettings dataTables settings object\n * @returns array {int} aiReturn index list for reordering\n * @memberof DataTable#oApi\n */\n function _fnReOrderIndex(oSettings, sColumns) {\n var aColumns = sColumns.split(',');\n var aiReturn = [];\n\n for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n for (var j = 0; j < iLen; j++) {\n if (oSettings.aoColumns[i].sName == aColumns[j]) {\n aiReturn.push(j);\n break;\n }\n }\n }\n\n return aiReturn;\n }\n\n\n /**\n * Get the column ordering that DataTables expects\n * @param {object} oSettings dataTables settings object\n * @returns {string} comma separated list of names\n * @memberof DataTable#oApi\n */\n function _fnColumnOrdering(oSettings) {\n var sNames = '';\n for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n sNames += oSettings.aoColumns[i].sName + ',';\n }\n if (sNames.length == iLen) {\n return \"\";\n }\n return sNames.slice(0, -1);\n }\n\n\n /**\n * Take the column definitions and static columns arrays and calculate how\n * they relate to column indexes. The callback function will then apply the\n * definition found for a column to a suitable configuration object.\n * @param {object} oSettings dataTables settings object\n * @param {array} aoColDefs The aoColumnDefs array that is to be applied\n * @param {array} aoCols The aoColumns array that defines columns individually\n * @param {function} fn Callback function - takes two parameters, the calculated\n * column index and the definition for that column.\n * @memberof DataTable#oApi\n */\n function _fnApplyColumnDefs(oSettings, aoColDefs, aoCols, fn) {\n var i, iLen, j, jLen, k, kLen;\n\n // Column definitions with aTargets\n if (aoColDefs) {\n /* Loop over the definitions array - loop in reverse so first instance has priority */\n for (i = aoColDefs.length - 1; i >= 0; i--) {\n /* Each definition can target multiple columns, as it is an array */\n var aTargets = aoColDefs[i].aTargets;\n if (!$.isArray(aTargets)) {\n _fnLog(oSettings, 1, 'aTargets must be an array of targets, not a ' + (typeof aTargets));\n }\n\n for (j = 0, jLen = aTargets.length; j < jLen; j++) {\n if (typeof aTargets[j] === 'number' && aTargets[j] >= 0) {\n /* Add columns that we don't yet know about */\n while (oSettings.aoColumns.length <= aTargets[j]) {\n _fnAddColumn(oSettings);\n }\n\n /* Integer, basic index */\n fn(aTargets[j], aoColDefs[i]);\n } else if (typeof aTargets[j] === 'number' && aTargets[j] < 0) {\n /* Negative integer, right to left column counting */\n fn(oSettings.aoColumns.length + aTargets[j], aoColDefs[i]);\n } else if (typeof aTargets[j] === 'string') {\n /* Class name matching on TH element */\n for (k = 0, kLen = oSettings.aoColumns.length; k < kLen; k++) {\n if (aTargets[j] == \"_all\" ||\n $(oSettings.aoColumns[k].nTh).hasClass(aTargets[j])) {\n fn(k, aoColDefs[i]);\n }\n }\n }\n }\n }\n }\n\n // Statically defined columns array\n if (aoCols) {\n for (i = 0, iLen = aoCols.length; i < iLen; i++) {\n fn(i, aoCols[i]);\n }\n }\n }\n\n /**\n * Add a data array to the table, creating DOM node etc. This is the parallel to\n * _fnGatherData, but for adding rows from a Javascript source, rather than a\n * DOM source.\n * @param {object} oSettings dataTables settings object\n * @param {array} aData data array to be added\n * @returns {int} >=0 if successful (index of new aoData entry), -1 if failed\n * @memberof DataTable#oApi\n */\n function _fnAddData(oSettings, aDataSupplied) {\n var oCol;\n\n /* Take an independent copy of the data source so we can bash it about as we wish */\n var aDataIn = ($.isArray(aDataSupplied)) ?\n aDataSupplied.slice() :\n $.extend(true, {}, aDataSupplied);\n\n /* Create the object for storing information about this new row */\n var iRow = oSettings.aoData.length;\n var oData = $.extend(true, {}, DataTable.models.oRow);\n oData._aData = aDataIn;\n oSettings.aoData.push(oData);\n\n /* Create the cells */\n var nTd, sThisType;\n for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n oCol = oSettings.aoColumns[i];\n\n /* Use rendered data for filtering / sorting */\n if (typeof oCol.fnRender === 'function' && oCol.bUseRendered && oCol.mData !== null) {\n _fnSetCellData(oSettings, iRow, i, _fnRender(oSettings, iRow, i));\n } else {\n _fnSetCellData(oSettings, iRow, i, _fnGetCellData(oSettings, iRow, i));\n }\n\n /* See if we should auto-detect the column type */\n if (oCol._bAutoType && oCol.sType != 'string') {\n /* Attempt to auto detect the type - same as _fnGatherData() */\n var sVarType = _fnGetCellData(oSettings, iRow, i, 'type');\n if (sVarType !== null && sVarType !== '') {\n sThisType = _fnDetectType(sVarType);\n if (oCol.sType === null) {\n oCol.sType = sThisType;\n } else if (oCol.sType != sThisType && oCol.sType != \"html\") {\n /* String is always the 'fallback' option */\n oCol.sType = 'string';\n }\n }\n }\n }\n\n /* Add to the display array */\n oSettings.aiDisplayMaster.push(iRow);\n\n /* Create the DOM information */\n if (!oSettings.oFeatures.bDeferRender) {\n _fnCreateTr(oSettings, iRow);\n }\n\n return iRow;\n }\n\n\n /**\n * Read in the data from the target table from the DOM\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnGatherData(oSettings) {\n var iLoop, i, iLen, j, jLen, jInner,\n nTds, nTrs, nTd, nTr, aLocalData, iThisIndex,\n iRow, iRows, iColumn, iColumns, sNodeName,\n oCol, oData;\n\n /*\n\t\t\t * Process by row first\n\t\t\t * Add the data object for the whole table - storing the tr node. Note - no point in getting\n\t\t\t * DOM based data if we are going to go and replace it with Ajax source data.\n\t\t\t */\n if (oSettings.bDeferLoading || oSettings.sAjaxSource === null) {\n nTr = oSettings.nTBody.firstChild;\n while (nTr) {\n if (nTr.nodeName.toUpperCase() == \"TR\") {\n iThisIndex = oSettings.aoData.length;\n nTr._DT_RowIndex = iThisIndex;\n oSettings.aoData.push($.extend(true, {}, DataTable.models.oRow, {\n \"nTr\": nTr\n }));\n\n oSettings.aiDisplayMaster.push(iThisIndex);\n nTd = nTr.firstChild;\n jInner = 0;\n while (nTd) {\n sNodeName = nTd.nodeName.toUpperCase();\n if (sNodeName == \"TD\" || sNodeName == \"TH\") {\n _fnSetCellData(oSettings, iThisIndex, jInner, $.trim(nTd.innerHTML));\n jInner++;\n }\n nTd = nTd.nextSibling;\n }\n }\n nTr = nTr.nextSibling;\n }\n }\n\n /* Gather in the TD elements of the Table - note that this is basically the same as\n\t\t\t * fnGetTdNodes, but that function takes account of hidden columns, which we haven't yet\n\t\t\t * setup!\n\t\t\t */\n nTrs = _fnGetTrNodes(oSettings);\n nTds = [];\n for (i = 0, iLen = nTrs.length; i < iLen; i++) {\n nTd = nTrs[i].firstChild;\n while (nTd) {\n sNodeName = nTd.nodeName.toUpperCase();\n if (sNodeName == \"TD\" || sNodeName == \"TH\") {\n nTds.push(nTd);\n }\n nTd = nTd.nextSibling;\n }\n }\n\n /* Now process by column */\n for (iColumn = 0, iColumns = oSettings.aoColumns.length; iColumn < iColumns; iColumn++) {\n oCol = oSettings.aoColumns[iColumn];\n\n /* Get the title of the column - unless there is a user set one */\n if (oCol.sTitle === null) {\n oCol.sTitle = oCol.nTh.innerHTML;\n }\n\n var\n bAutoType = oCol._bAutoType,\n bRender = typeof oCol.fnRender === 'function',\n bClass = oCol.sClass !== null,\n bVisible = oCol.bVisible,\n nCell, sThisType, sRendered, sValType;\n\n /* A single loop to rule them all (and be more efficient) */\n if (bAutoType || bRender || bClass || !bVisible) {\n for (iRow = 0, iRows = oSettings.aoData.length; iRow < iRows; iRow++) {\n oData = oSettings.aoData[iRow];\n nCell = nTds[(iRow * iColumns) + iColumn];\n\n /* Type detection */\n if (bAutoType && oCol.sType != 'string') {\n sValType = _fnGetCellData(oSettings, iRow, iColumn, 'type');\n if (sValType !== '') {\n sThisType = _fnDetectType(sValType);\n if (oCol.sType === null) {\n oCol.sType = sThisType;\n } else if (oCol.sType != sThisType &&\n oCol.sType != \"html\") {\n /* String is always the 'fallback' option */\n oCol.sType = 'string';\n }\n }\n }\n\n if (oCol.mRender) {\n // mRender has been defined, so we need to get the value and set it\n nCell.innerHTML = _fnGetCellData(oSettings, iRow, iColumn, 'display');\n } else if (oCol.mData !== iColumn) {\n // If mData is not the same as the column number, then we need to\n // get the dev set value. If it is the column, no point in wasting\n // time setting the value that is already there!\n nCell.innerHTML = _fnGetCellData(oSettings, iRow, iColumn, 'display');\n }\n\n /* Rendering */\n if (bRender) {\n sRendered = _fnRender(oSettings, iRow, iColumn);\n nCell.innerHTML = sRendered;\n if (oCol.bUseRendered) {\n /* Use the rendered data for filtering / sorting */\n _fnSetCellData(oSettings, iRow, iColumn, sRendered);\n }\n }\n\n /* Classes */\n if (bClass) {\n nCell.className += ' ' + oCol.sClass;\n }\n\n /* Column visibility */\n if (!bVisible) {\n oData._anHidden[iColumn] = nCell;\n nCell.parentNode.removeChild(nCell);\n } else {\n oData._anHidden[iColumn] = null;\n }\n\n if (oCol.fnCreatedCell) {\n oCol.fnCreatedCell.call(oSettings.oInstance,\n nCell, _fnGetCellData(oSettings, iRow, iColumn, 'display'), oData._aData, iRow, iColumn\n );\n }\n }\n }\n }\n\n /* Row created callbacks */\n if (oSettings.aoRowCreatedCallback.length !== 0) {\n for (i = 0, iLen = oSettings.aoData.length; i < iLen; i++) {\n oData = oSettings.aoData[i];\n _fnCallbackFire(oSettings, 'aoRowCreatedCallback', null, [oData.nTr, oData._aData, i]);\n }\n }\n }\n\n\n /**\n * Take a TR element and convert it to an index in aoData\n * @param {object} oSettings dataTables settings object\n * @param {node} n the TR element to find\n * @returns {int} index if the node is found, null if not\n * @memberof DataTable#oApi\n */\n function _fnNodeToDataIndex(oSettings, n) {\n return (n._DT_RowIndex !== undefined) ? n._DT_RowIndex : null;\n }\n\n\n /**\n * Take a TD element and convert it into a column data index (not the visible index)\n * @param {object} oSettings dataTables settings object\n * @param {int} iRow The row number the TD/TH can be found in\n * @param {node} n The TD/TH element to find\n * @returns {int} index if the node is found, -1 if not\n * @memberof DataTable#oApi\n */\n function _fnNodeToColumnIndex(oSettings, iRow, n) {\n var anCells = _fnGetTdNodes(oSettings, iRow);\n\n for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n if (anCells[i] === n) {\n return i;\n }\n }\n return -1;\n }\n\n\n /**\n * Get an array of data for a given row from the internal data cache\n * @param {object} oSettings dataTables settings object\n * @param {int} iRow aoData row id\n * @param {string} sSpecific data get type ('type' 'filter' 'sort')\n * @param {array} aiColumns Array of column indexes to get data from\n * @returns {array} Data array\n * @memberof DataTable#oApi\n */\n function _fnGetRowData(oSettings, iRow, sSpecific, aiColumns) {\n var out = [];\n for (var i = 0, iLen = aiColumns.length; i < iLen; i++) {\n out.push(_fnGetCellData(oSettings, iRow, aiColumns[i], sSpecific));\n }\n return out;\n }\n\n\n /**\n * Get the data for a given cell from the internal cache, taking into account data mapping\n * @param {object} oSettings dataTables settings object\n * @param {int} iRow aoData row id\n * @param {int} iCol Column index\n * @param {string} sSpecific data get type ('display', 'type' 'filter' 'sort')\n * @returns {*} Cell data\n * @memberof DataTable#oApi\n */\n function _fnGetCellData(oSettings, iRow, iCol, sSpecific) {\n var sData;\n var oCol = oSettings.aoColumns[iCol];\n var oData = oSettings.aoData[iRow]._aData;\n\n if ((sData = oCol.fnGetData(oData, sSpecific)) === undefined) {\n if (oSettings.iDrawError != oSettings.iDraw && oCol.sDefaultContent === null) {\n _fnLog(oSettings, 0, \"Requested unknown parameter \" +\n (typeof oCol.mData == 'function' ? '{mData function}' : \"'\" + oCol.mData + \"'\") +\n \" from the data source for row \" + iRow);\n oSettings.iDrawError = oSettings.iDraw;\n }\n return oCol.sDefaultContent;\n }\n\n /* When the data source is null, we can use default column data */\n if (sData === null && oCol.sDefaultContent !== null) {\n sData = oCol.sDefaultContent;\n } else if (typeof sData === 'function') {\n /* If the data source is a function, then we run it and use the return */\n return sData();\n }\n\n if (sSpecific == 'display' && sData === null) {\n return '';\n }\n return sData;\n }\n\n\n /**\n * Set the value for a specific cell, into the internal data cache\n * @param {object} oSettings dataTables settings object\n * @param {int} iRow aoData row id\n * @param {int} iCol Column index\n * @param {*} val Value to set\n * @memberof DataTable#oApi\n */\n function _fnSetCellData(oSettings, iRow, iCol, val) {\n var oCol = oSettings.aoColumns[iCol];\n var oData = oSettings.aoData[iRow]._aData;\n\n oCol.fnSetData(oData, val);\n }\n\n\n // Private variable that is used to match array syntax in the data property object\n var __reArray = /\\[.*?\\]$/;\n\n /**\n * Return a function that can be used to get data from a source object, taking\n * into account the ability to use nested objects as a source\n * @param {string|int|function} mSource The data source for the object\n * @returns {function} Data get function\n * @memberof DataTable#oApi\n */\n function _fnGetObjectDataFn(mSource) {\n if (mSource === null) {\n /* Give an empty string for rendering / sorting etc */\n return function(data, type) {\n return null;\n };\n } else if (typeof mSource === 'function') {\n return function(data, type, extra) {\n return mSource(data, type, extra);\n };\n } else if (typeof mSource === 'string' && (mSource.indexOf('.') !== -1 || mSource.indexOf('[') !== -1)) {\n /* If there is a . in the source string then the data source is in a\n\t\t\t\t * nested object so we loop over the data for each level to get the next\n\t\t\t\t * level down. On each loop we test for undefined, and if found immediately\n\t\t\t\t * return. This allows entire objects to be missing and sDefaultContent to\n\t\t\t\t * be used if defined, rather than throwing an error\n\t\t\t\t */\n var fetchData = function(data, type, src) {\n var a = src.split('.');\n var arrayNotation, out, innerSrc;\n\n if (src !== \"\") {\n for (var i = 0, iLen = a.length; i < iLen; i++) {\n // Check if we are dealing with an array notation request\n arrayNotation = a[i].match(__reArray);\n\n if (arrayNotation) {\n a[i] = a[i].replace(__reArray, '');\n\n // Condition allows simply [] to be passed in\n if (a[i] !== \"\") {\n data = data[a[i]];\n }\n out = [];\n\n // Get the remainder of the nested object to get\n a.splice(0, i + 1);\n innerSrc = a.join('.');\n\n // Traverse each entry in the array getting the properties requested\n for (var j = 0, jLen = data.length; j < jLen; j++) {\n out.push(fetchData(data[j], type, innerSrc));\n }\n\n // If a string is given in between the array notation indicators, that\n // is used to join the strings together, otherwise an array is returned\n var join = arrayNotation[0].substring(1, arrayNotation[0].length - 1);\n data = (join === \"\") ? out : out.join(join);\n\n // The inner call to fetchData has already traversed through the remainder\n // of the source requested, so we exit from the loop\n break;\n }\n\n if (data === null || data[a[i]] === undefined) {\n return undefined;\n }\n data = data[a[i]];\n }\n }\n\n return data;\n };\n\n return function(data, type) {\n return fetchData(data, type, mSource);\n };\n } else {\n /* Array or flat object mapping */\n return function(data, type) {\n return data[mSource];\n };\n }\n }\n\n\n /**\n * Return a function that can be used to set data from a source object, taking\n * into account the ability to use nested objects as a source\n * @param {string|int|function} mSource The data source for the object\n * @returns {function} Data set function\n * @memberof DataTable#oApi\n */\n function _fnSetObjectDataFn(mSource) {\n if (mSource === null) {\n /* Nothing to do when the data source is null */\n return function(data, val) {\n };\n } else if (typeof mSource === 'function') {\n return function(data, val) {\n mSource(data, 'set', val);\n };\n } else if (typeof mSource === 'string' && (mSource.indexOf('.') !== -1 || mSource.indexOf('[') !== -1)) {\n /* Like the get, we need to get data from a nested object */\n var setData = function(data, val, src) {\n var a = src.split('.'), b;\n var arrayNotation, o, innerSrc;\n\n for (var i = 0, iLen = a.length - 1; i < iLen; i++) {\n // Check if we are dealing with an array notation request\n arrayNotation = a[i].match(__reArray);\n\n if (arrayNotation) {\n a[i] = a[i].replace(__reArray, '');\n data[a[i]] = [];\n\n // Get the remainder of the nested object to set so we can recurse\n b = a.slice();\n b.splice(0, i + 1);\n innerSrc = b.join('.');\n\n // Traverse each entry in the array setting the properties requested\n for (var j = 0, jLen = val.length; j < jLen; j++) {\n o = {};\n setData(o, val[j], innerSrc);\n data[a[i]].push(o);\n }\n\n // The inner call to setData has already traversed through the remainder\n // of the source and has set the data, thus we can exit here\n return;\n }\n\n // If the nested object doesn't currently exist - since we are\n // trying to set the value - create it\n if (data[a[i]] === null || data[a[i]] === undefined) {\n data[a[i]] = {};\n }\n data = data[a[i]];\n }\n\n // If array notation is used, we just want to strip it and use the property name\n // and assign the value. If it isn't used, then we get the result we want anyway\n data[a[a.length - 1].replace(__reArray, '')] = val;\n };\n\n return function(data, val) {\n return setData(data, val, mSource);\n };\n } else {\n /* Array or flat object mapping */\n return function(data, val) {\n data[mSource] = val;\n };\n }\n }\n\n\n /**\n * Return an array with the full table data\n * @param {object} oSettings dataTables settings object\n * @returns array {array} aData Master data array\n * @memberof DataTable#oApi\n */\n function _fnGetDataMaster(oSettings) {\n var aData = [];\n var iLen = oSettings.aoData.length;\n for (var i = 0; i < iLen; i++) {\n aData.push(oSettings.aoData[i]._aData);\n }\n return aData;\n }\n\n\n /**\n * Nuke the table\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnClearTable(oSettings) {\n oSettings.aoData.splice(0, oSettings.aoData.length);\n oSettings.aiDisplayMaster.splice(0, oSettings.aiDisplayMaster.length);\n oSettings.aiDisplay.splice(0, oSettings.aiDisplay.length);\n _fnCalculateEnd(oSettings);\n }\n\n\n /**\n * Take an array of integers (index array) and remove a target integer (value - not\n * the key!)\n * @param {array} a Index array to target\n * @param {int} iTarget value to find\n * @memberof DataTable#oApi\n */\n function _fnDeleteIndex(a, iTarget) {\n var iTargetIndex = -1;\n\n for (var i = 0, iLen = a.length; i < iLen; i++) {\n if (a[i] == iTarget) {\n iTargetIndex = i;\n } else if (a[i] > iTarget) {\n a[i]--;\n }\n }\n\n if (iTargetIndex != -1) {\n a.splice(iTargetIndex, 1);\n }\n }\n\n\n /**\n * Call the developer defined fnRender function for a given cell (row/column) with\n * the required parameters and return the result.\n * @param {object} oSettings dataTables settings object\n * @param {int} iRow aoData index for the row\n * @param {int} iCol aoColumns index for the column\n * @returns {*} Return of the developer's fnRender function\n * @memberof DataTable#oApi\n */\n function _fnRender(oSettings, iRow, iCol) {\n var oCol = oSettings.aoColumns[iCol];\n\n return oCol.fnRender({\n \"iDataRow\": iRow,\n \"iDataColumn\": iCol,\n \"oSettings\": oSettings,\n \"aData\": oSettings.aoData[iRow]._aData,\n \"mDataProp\": oCol.mData\n }, _fnGetCellData(oSettings, iRow, iCol, 'display'));\n }\n\n /**\n * Create a new TR element (and it's TD children) for a row\n * @param {object} oSettings dataTables settings object\n * @param {int} iRow Row to consider\n * @memberof DataTable#oApi\n */\n function _fnCreateTr(oSettings, iRow) {\n var oData = oSettings.aoData[iRow];\n var nTd;\n\n if (oData.nTr === null) {\n oData.nTr = document.createElement('tr');\n\n /* Use a private property on the node to allow reserve mapping from the node\n\t\t\t\t * to the aoData array for fast look up\n\t\t\t\t */\n oData.nTr._DT_RowIndex = iRow;\n\n /* Special parameters can be given by the data source to be used on the row */\n if (oData._aData.DT_RowId) {\n oData.nTr.id = oData._aData.DT_RowId;\n }\n\n if (oData._aData.DT_RowClass) {\n oData.nTr.className = oData._aData.DT_RowClass;\n }\n\n /* Process each column */\n for (var i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n var oCol = oSettings.aoColumns[i];\n nTd = document.createElement(oCol.sCellType);\n\n /* Render if needed - if bUseRendered is true then we already have the rendered\n\t\t\t\t\t * value in the data source - so can just use that\n\t\t\t\t\t */\n nTd.innerHTML = (typeof oCol.fnRender === 'function' && (!oCol.bUseRendered || oCol.mData === null)) ?\n _fnRender(oSettings, iRow, i) :\n _fnGetCellData(oSettings, iRow, i, 'display');\n\n /* Add user defined class */\n if (oCol.sClass !== null) {\n nTd.className = oCol.sClass;\n }\n\n if (oCol.bVisible) {\n oData.nTr.appendChild(nTd);\n oData._anHidden[i] = null;\n } else {\n oData._anHidden[i] = nTd;\n }\n\n if (oCol.fnCreatedCell) {\n oCol.fnCreatedCell.call(oSettings.oInstance,\n nTd, _fnGetCellData(oSettings, iRow, i, 'display'), oData._aData, iRow, i\n );\n }\n }\n\n _fnCallbackFire(oSettings, 'aoRowCreatedCallback', null, [oData.nTr, oData._aData, iRow]);\n }\n }\n\n\n /**\n * Create the HTML header for the table\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnBuildHead(oSettings) {\n var i, nTh, iLen, j, jLen;\n var iThs = $('th, td', oSettings.nTHead).length;\n var iCorrector = 0;\n var jqChildren;\n\n /* If there is a header in place - then use it - otherwise it's going to get nuked... */\n if (iThs !== 0) {\n /* We've got a thead from the DOM, so remove hidden columns and apply width to vis cols */\n for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n nTh = oSettings.aoColumns[i].nTh;\n nTh.setAttribute('role', 'columnheader');\n if (oSettings.aoColumns[i].bSortable) {\n nTh.setAttribute('tabindex', oSettings.iTabIndex);\n nTh.setAttribute('aria-controls', oSettings.sTableId);\n }\n\n if (oSettings.aoColumns[i].sClass !== null) {\n $(nTh).addClass(oSettings.aoColumns[i].sClass);\n }\n\n /* Set the title of the column if it is user defined (not what was auto detected) */\n if (oSettings.aoColumns[i].sTitle != nTh.innerHTML) {\n nTh.innerHTML = oSettings.aoColumns[i].sTitle;\n }\n }\n } else {\n /* We don't have a header in the DOM - so we are going to have to create one */\n var nTr = document.createElement(\"tr\");\n\n for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n nTh = oSettings.aoColumns[i].nTh;\n nTh.innerHTML = oSettings.aoColumns[i].sTitle;\n nTh.setAttribute('tabindex', '0');\n\n if (oSettings.aoColumns[i].sClass !== null) {\n $(nTh).addClass(oSettings.aoColumns[i].sClass);\n }\n\n nTr.appendChild(nTh);\n }\n $(oSettings.nTHead).html('')[0].appendChild(nTr);\n _fnDetectHeader(oSettings.aoHeader, oSettings.nTHead);\n }\n\n /* ARIA role for the rows */\n $(oSettings.nTHead).children('tr').attr('role', 'row');\n\n /* Add the extra markup needed by jQuery UI's themes */\n if (oSettings.bJUI) {\n for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n nTh = oSettings.aoColumns[i].nTh;\n\n var nDiv = document.createElement('div');\n nDiv.className = oSettings.oClasses.sSortJUIWrapper;\n $(nTh).contents().appendTo(nDiv);\n\n var nSpan = document.createElement('span');\n nSpan.className = oSettings.oClasses.sSortIcon;\n nDiv.appendChild(nSpan);\n nTh.appendChild(nDiv);\n }\n }\n\n if (oSettings.oFeatures.bSort) {\n for (i = 0; i < oSettings.aoColumns.length; i++) {\n if (oSettings.aoColumns[i].bSortable !== false) {\n _fnSortAttachListener(oSettings, oSettings.aoColumns[i].nTh, i);\n } else {\n $(oSettings.aoColumns[i].nTh).addClass(oSettings.oClasses.sSortableNone);\n }\n }\n }\n\n /* Deal with the footer - add classes if required */\n if (oSettings.oClasses.sFooterTH !== \"\") {\n $(oSettings.nTFoot).children('tr').children('th').addClass(oSettings.oClasses.sFooterTH);\n }\n\n /* Cache the footer elements */\n if (oSettings.nTFoot !== null) {\n var anCells = _fnGetUniqueThs(oSettings, null, oSettings.aoFooter);\n for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n if (anCells[i]) {\n oSettings.aoColumns[i].nTf = anCells[i];\n if (oSettings.aoColumns[i].sClass) {\n $(anCells[i]).addClass(oSettings.aoColumns[i].sClass);\n }\n }\n }\n }\n }\n\n\n /**\n * Draw the header (or footer) element based on the column visibility states. The\n * methodology here is to use the layout array from _fnDetectHeader, modified for\n * the instantaneous column visibility, to construct the new layout. The grid is\n * traversed over cell at a time in a rows x columns grid fashion, although each\n * cell insert can cover multiple elements in the grid - which is tracks using the\n * aApplied array. Cell inserts in the grid will only occur where there isn't\n * already a cell in that position.\n * @param {object} oSettings dataTables settings object\n * @param array {objects} aoSource Layout array from _fnDetectHeader\n * @param {boolean} [bIncludeHidden=false] If true then include the hidden columns in the calc,\n * @memberof DataTable#oApi\n */\n function _fnDrawHead(oSettings, aoSource, bIncludeHidden) {\n var i, iLen, j, jLen, k, kLen, n, nLocalTr;\n var aoLocal = [];\n var aApplied = [];\n var iColumns = oSettings.aoColumns.length;\n var iRowspan, iColspan;\n\n if (bIncludeHidden === undefined) {\n bIncludeHidden = false;\n }\n\n /* Make a copy of the master layout array, but without the visible columns in it */\n for (i = 0, iLen = aoSource.length; i < iLen; i++) {\n aoLocal[i] = aoSource[i].slice();\n aoLocal[i].nTr = aoSource[i].nTr;\n\n /* Remove any columns which are currently hidden */\n for (j = iColumns - 1; j >= 0; j--) {\n if (!oSettings.aoColumns[j].bVisible && !bIncludeHidden) {\n aoLocal[i].splice(j, 1);\n }\n }\n\n /* Prep the applied array - it needs an element for each row */\n aApplied.push([]);\n }\n\n for (i = 0, iLen = aoLocal.length; i < iLen; i++) {\n nLocalTr = aoLocal[i].nTr;\n\n /* All cells are going to be replaced, so empty out the row */\n if (nLocalTr) {\n while ((n = nLocalTr.firstChild)) {\n nLocalTr.removeChild(n);\n }\n }\n\n for (j = 0, jLen = aoLocal[i].length; j < jLen; j++) {\n iRowspan = 1;\n iColspan = 1;\n\n /* Check to see if there is already a cell (row/colspan) covering our target\n\t\t\t\t\t * insert point. If there is, then there is nothing to do.\n\t\t\t\t\t */\n if (aApplied[i][j] === undefined) {\n nLocalTr.appendChild(aoLocal[i][j].cell);\n aApplied[i][j] = 1;\n\n /* Expand the cell to cover as many rows as needed */\n while (aoLocal[i + iRowspan] !== undefined &&\n aoLocal[i][j].cell == aoLocal[i + iRowspan][j].cell) {\n aApplied[i + iRowspan][j] = 1;\n iRowspan++;\n }\n\n /* Expand the cell to cover as many columns as needed */\n while (aoLocal[i][j + iColspan] !== undefined &&\n aoLocal[i][j].cell == aoLocal[i][j + iColspan].cell) {\n /* Must update the applied array over the rows for the columns */\n for (k = 0; k < iRowspan; k++) {\n aApplied[i + k][j + iColspan] = 1;\n }\n iColspan++;\n }\n\n /* Do the actual expansion in the DOM */\n aoLocal[i][j].cell.rowSpan = iRowspan;\n aoLocal[i][j].cell.colSpan = iColspan;\n }\n }\n }\n }\n\n\n /**\n * Insert the required TR nodes into the table for display\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnDraw(oSettings) {\n /* Provide a pre-callback function which can be used to cancel the draw is false is returned */\n var aPreDraw = _fnCallbackFire(oSettings, 'aoPreDrawCallback', 'preDraw', [oSettings]);\n if ($.inArray(false, aPreDraw) !== -1) {\n _fnProcessingDisplay(oSettings, false);\n return;\n }\n\n var i, iLen, n;\n var anRows = [];\n var iRowCount = 0;\n var iStripes = oSettings.asStripeClasses.length;\n var iOpenRows = oSettings.aoOpenRows.length;\n\n oSettings.bDrawing = true;\n\n /* Check and see if we have an initial draw position from state saving */\n if (oSettings.iInitDisplayStart !== undefined && oSettings.iInitDisplayStart != -1) {\n if (oSettings.oFeatures.bServerSide) {\n oSettings._iDisplayStart = oSettings.iInitDisplayStart;\n } else {\n oSettings._iDisplayStart = (oSettings.iInitDisplayStart >= oSettings.fnRecordsDisplay()) ?\n 0 : oSettings.iInitDisplayStart;\n }\n oSettings.iInitDisplayStart = -1;\n _fnCalculateEnd(oSettings);\n }\n\n /* Server-side processing draw intercept */\n if (oSettings.bDeferLoading) {\n oSettings.bDeferLoading = false;\n oSettings.iDraw++;\n } else if (!oSettings.oFeatures.bServerSide) {\n oSettings.iDraw++;\n } else if (!oSettings.bDestroying && !_fnAjaxUpdate(oSettings)) {\n return;\n }\n\n if (oSettings.aiDisplay.length !== 0) {\n var iStart = oSettings._iDisplayStart;\n var iEnd = oSettings._iDisplayEnd;\n\n if (oSettings.oFeatures.bServerSide) {\n iStart = 0;\n iEnd = oSettings.aoData.length;\n }\n\n for (var j = iStart; j < iEnd; j++) {\n var aoData = oSettings.aoData[oSettings.aiDisplay[j]];\n if (aoData.nTr === null) {\n _fnCreateTr(oSettings, oSettings.aiDisplay[j]);\n }\n\n var nRow = aoData.nTr;\n\n /* Remove the old striping classes and then add the new one */\n if (iStripes !== 0) {\n var sStripe = oSettings.asStripeClasses[iRowCount % iStripes];\n if (aoData._sRowStripe != sStripe) {\n $(nRow).removeClass(aoData._sRowStripe).addClass(sStripe);\n aoData._sRowStripe = sStripe;\n }\n }\n\n /* Row callback functions - might want to manipulate the row */\n _fnCallbackFire(oSettings, 'aoRowCallback', null,\n [nRow, oSettings.aoData[oSettings.aiDisplay[j]]._aData, iRowCount, j]);\n\n anRows.push(nRow);\n iRowCount++;\n\n /* If there is an open row - and it is attached to this parent - attach it on redraw */\n if (iOpenRows !== 0) {\n for (var k = 0; k < iOpenRows; k++) {\n if (nRow == oSettings.aoOpenRows[k].nParent) {\n anRows.push(oSettings.aoOpenRows[k].nTr);\n break;\n }\n }\n }\n }\n } else {\n /* Table is empty - create a row with an empty message in it */\n anRows[0] = document.createElement('tr');\n\n if (oSettings.asStripeClasses[0]) {\n anRows[0].className = oSettings.asStripeClasses[0];\n }\n\n var oLang = oSettings.oLanguage;\n var sZero = oLang.sZeroRecords;\n if (oSettings.iDraw == 1 && oSettings.sAjaxSource !== null && !oSettings.oFeatures.bServerSide) {\n sZero = oLang.sLoadingRecords;\n } else if (oLang.sEmptyTable && oSettings.fnRecordsTotal() === 0) {\n sZero = oLang.sEmptyTable;\n }\n\n var nTd = document.createElement('td');\n nTd.setAttribute('valign', \"top\");\n nTd.colSpan = _fnVisbleColumns(oSettings);\n nTd.className = oSettings.oClasses.sRowEmpty;\n nTd.innerHTML = _fnInfoMacros(oSettings, sZero);\n\n anRows[iRowCount].appendChild(nTd);\n }\n\n /* Header and footer callbacks */\n _fnCallbackFire(oSettings, 'aoHeaderCallback', 'header', [$(oSettings.nTHead).children('tr')[0],\n _fnGetDataMaster(oSettings), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay]);\n\n _fnCallbackFire(oSettings, 'aoFooterCallback', 'footer', [$(oSettings.nTFoot).children('tr')[0],\n _fnGetDataMaster(oSettings), oSettings._iDisplayStart, oSettings.fnDisplayEnd(), oSettings.aiDisplay]);\n\n /*\n\t\t\t * Need to remove any old row from the display - note we can't just empty the tbody using\n\t\t\t * $().html('') since this will unbind the jQuery event handlers (even although the node\n\t\t\t * still exists!) - equally we can't use innerHTML, since IE throws an exception.\n\t\t\t */\n var\n nAddFrag = document.createDocumentFragment(),\n nRemoveFrag = document.createDocumentFragment(),\n nBodyPar, nTrs;\n\n if (oSettings.nTBody) {\n nBodyPar = oSettings.nTBody.parentNode;\n nRemoveFrag.appendChild(oSettings.nTBody);\n\n /* When doing infinite scrolling, only remove child rows when sorting, filtering or start\n\t\t\t\t * up. When not infinite scroll, always do it.\n\t\t\t\t */\n if (!oSettings.oScroll.bInfinite || !oSettings._bInitComplete ||\n oSettings.bSorted || oSettings.bFiltered) {\n while ((n = oSettings.nTBody.firstChild)) {\n oSettings.nTBody.removeChild(n);\n }\n }\n\n /* Put the draw table into the dom */\n for (i = 0, iLen = anRows.length; i < iLen; i++) {\n nAddFrag.appendChild(anRows[i]);\n }\n\n oSettings.nTBody.appendChild(nAddFrag);\n if (nBodyPar !== null) {\n nBodyPar.appendChild(oSettings.nTBody);\n }\n }\n\n /* Call all required callback functions for the end of a draw */\n _fnCallbackFire(oSettings, 'aoDrawCallback', 'draw', [oSettings]);\n\n /* Draw is complete, sorting and filtering must be as well */\n oSettings.bSorted = false;\n oSettings.bFiltered = false;\n oSettings.bDrawing = false;\n\n if (oSettings.oFeatures.bServerSide) {\n _fnProcessingDisplay(oSettings, false);\n if (!oSettings._bInitComplete) {\n _fnInitComplete(oSettings);\n }\n }\n }\n\n\n /**\n * Redraw the table - taking account of the various features which are enabled\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnReDraw(oSettings) {\n if (oSettings.oFeatures.bSort) {\n /* Sorting will refilter and draw for us */\n _fnSort(oSettings, oSettings.oPreviousSearch);\n } else if (oSettings.oFeatures.bFilter) {\n /* Filtering will redraw for us */\n _fnFilterComplete(oSettings, oSettings.oPreviousSearch);\n } else {\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n }\n }\n\n\n /**\n * Add the options to the page HTML for the table\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnAddOptionsHtml(oSettings) {\n /*\n\t\t\t * Create a temporary, empty, div which we can later on replace with what we have generated\n\t\t\t * we do it this way to rendering the 'options' html offline - speed :-)\n\t\t\t */\n var nHolding = $('
')[0];\n oSettings.nTable.parentNode.insertBefore(nHolding, oSettings.nTable);\n\n /*\n\t\t\t * All DataTables are wrapped in a div\n\t\t\t */\n oSettings.nTableWrapper = $('
')[0];\n oSettings.nTableReinsertBefore = oSettings.nTable.nextSibling;\n\n /* Track where we want to insert the option */\n var nInsertNode = oSettings.nTableWrapper;\n\n /* Loop over the user set positioning and place the elements as needed */\n var aDom = oSettings.sDom.split('');\n var nTmp, iPushFeature, cOption, nNewNode, cNext, sAttr, j;\n for (var i = 0; i < aDom.length; i++) {\n iPushFeature = 0;\n cOption = aDom[i];\n\n if (cOption == '<') {\n /* New container div */\n nNewNode = $('
')[0];\n\n /* Check to see if we should append an id and/or a class name to the container */\n cNext = aDom[i + 1];\n if (cNext == \"'\" || cNext == '\"') {\n sAttr = \"\";\n j = 2;\n while (aDom[i + j] != cNext) {\n sAttr += aDom[i + j];\n j++;\n }\n\n /* Replace jQuery UI constants */\n if (sAttr == \"H\") {\n sAttr = oSettings.oClasses.sJUIHeader;\n } else if (sAttr == \"F\") {\n sAttr = oSettings.oClasses.sJUIFooter;\n }\n\n /* The attribute can be in the format of \"#id.class\", \"#id\" or \"class\" This logic\n\t\t\t\t\t\t * breaks the string into parts and applies them as needed\n\t\t\t\t\t\t */\n if (sAttr.indexOf('.') != -1) {\n var aSplit = sAttr.split('.');\n nNewNode.id = aSplit[0].substr(1, aSplit[0].length - 1);\n nNewNode.className = aSplit[1];\n } else if (sAttr.charAt(0) == \"#\") {\n nNewNode.id = sAttr.substr(1, sAttr.length - 1);\n } else {\n nNewNode.className = sAttr;\n }\n\n i += j; /* Move along the position array */\n }\n\n nInsertNode.appendChild(nNewNode);\n nInsertNode = nNewNode;\n } else if (cOption == '>') {\n /* End container div */\n nInsertNode = nInsertNode.parentNode;\n } else if (cOption == 'l' && oSettings.oFeatures.bPaginate && oSettings.oFeatures.bLengthChange) {\n /* Length */\n nTmp = _fnFeatureHtmlLength(oSettings);\n iPushFeature = 1;\n } else if (cOption == 'f' && oSettings.oFeatures.bFilter) {\n /* Filter */\n nTmp = _fnFeatureHtmlFilter(oSettings);\n iPushFeature = 1;\n } else if (cOption == 'r' && oSettings.oFeatures.bProcessing) {\n /* pRocessing */\n nTmp = _fnFeatureHtmlProcessing(oSettings);\n iPushFeature = 1;\n } else if (cOption == 't') {\n /* Table */\n nTmp = _fnFeatureHtmlTable(oSettings);\n iPushFeature = 1;\n } else if (cOption == 'i' && oSettings.oFeatures.bInfo) {\n /* Info */\n nTmp = _fnFeatureHtmlInfo(oSettings);\n iPushFeature = 1;\n } else if (cOption == 'p' && oSettings.oFeatures.bPaginate) {\n /* Pagination */\n nTmp = _fnFeatureHtmlPaginate(oSettings);\n iPushFeature = 1;\n } else if (DataTable.ext.aoFeatures.length !== 0) {\n /* Plug-in features */\n var aoFeatures = DataTable.ext.aoFeatures;\n for (var k = 0, kLen = aoFeatures.length; k < kLen; k++) {\n if (cOption == aoFeatures[k].cFeature) {\n nTmp = aoFeatures[k].fnInit(oSettings);\n if (nTmp) {\n iPushFeature = 1;\n }\n break;\n }\n }\n }\n\n /* Add to the 2D features array */\n if (iPushFeature == 1 && nTmp !== null) {\n if (typeof oSettings.aanFeatures[cOption] !== 'object') {\n oSettings.aanFeatures[cOption] = [];\n }\n oSettings.aanFeatures[cOption].push(nTmp);\n nInsertNode.appendChild(nTmp);\n }\n }\n\n /* Built our DOM structure - replace the holding div with what we want */\n nHolding.parentNode.replaceChild(oSettings.nTableWrapper, nHolding);\n }\n\n\n /**\n * Use the DOM source to create up an array of header cells. The idea here is to\n * create a layout grid (array) of rows x columns, which contains a reference\n * to the cell that that point in the grid (regardless of col/rowspan), such that\n * any column / row could be removed and the new grid constructed\n * @param array {object} aLayout Array to store the calculated layout in\n * @param {node} nThead The header/footer element for the table\n * @memberof DataTable#oApi\n */\n function _fnDetectHeader(aLayout, nThead) {\n var nTrs = $(nThead).children('tr');\n var nTr, nCell;\n var i, k, l, iLen, jLen, iColShifted, iColumn, iColspan, iRowspan;\n var bUnique;\n var fnShiftCol = function(a, i, j) {\n var k = a[i];\n while (k[j]) {\n j++;\n }\n return j;\n };\n\n aLayout.splice(0, aLayout.length);\n\n /* We know how many rows there are in the layout - so prep it */\n for (i = 0, iLen = nTrs.length; i < iLen; i++) {\n aLayout.push([]);\n }\n\n /* Calculate a layout array */\n for (i = 0, iLen = nTrs.length; i < iLen; i++) {\n nTr = nTrs[i];\n iColumn = 0;\n\n /* For every cell in the row... */\n nCell = nTr.firstChild;\n while (nCell) {\n if (nCell.nodeName.toUpperCase() == \"TD\" ||\n nCell.nodeName.toUpperCase() == \"TH\") {\n /* Get the col and rowspan attributes from the DOM and sanitise them */\n iColspan = nCell.getAttribute('colspan') * 1;\n iRowspan = nCell.getAttribute('rowspan') * 1;\n iColspan = (!iColspan || iColspan === 0 || iColspan === 1) ? 1 : iColspan;\n iRowspan = (!iRowspan || iRowspan === 0 || iRowspan === 1) ? 1 : iRowspan;\n\n /* There might be colspan cells already in this row, so shift our target\n\t\t\t\t\t\t * accordingly\n\t\t\t\t\t\t */\n iColShifted = fnShiftCol(aLayout, i, iColumn);\n\n /* Cache calculation for unique columns */\n bUnique = iColspan === 1 ? true : false;\n\n /* If there is col / rowspan, copy the information into the layout grid */\n for (l = 0; l < iColspan; l++) {\n for (k = 0; k < iRowspan; k++) {\n aLayout[i + k][iColShifted + l] = {\n \"cell\": nCell,\n \"unique\": bUnique\n };\n aLayout[i + k].nTr = nTr;\n }\n }\n }\n nCell = nCell.nextSibling;\n }\n }\n }\n\n\n /**\n * Get an array of unique th elements, one for each column\n * @param {object} oSettings dataTables settings object\n * @param {node} nHeader automatically detect the layout from this node - optional\n * @param {array} aLayout thead/tfoot layout from _fnDetectHeader - optional\n * @returns array {node} aReturn list of unique th's\n * @memberof DataTable#oApi\n */\n function _fnGetUniqueThs(oSettings, nHeader, aLayout) {\n var aReturn = [];\n if (!aLayout) {\n aLayout = oSettings.aoHeader;\n if (nHeader) {\n aLayout = [];\n _fnDetectHeader(aLayout, nHeader);\n }\n }\n\n for (var i = 0, iLen = aLayout.length; i < iLen; i++) {\n for (var j = 0, jLen = aLayout[i].length; j < jLen; j++) {\n if (aLayout[i][j].unique &&\n (!aReturn[j] || !oSettings.bSortCellsTop)) {\n aReturn[j] = aLayout[i][j].cell;\n }\n }\n }\n\n return aReturn;\n }\n\n\n /**\n * Update the table using an Ajax call\n * @param {object} oSettings dataTables settings object\n * @returns {boolean} Block the table drawing or not\n * @memberof DataTable#oApi\n */\n function _fnAjaxUpdate(oSettings) {\n if (oSettings.bAjaxDataGet) {\n oSettings.iDraw++;\n _fnProcessingDisplay(oSettings, true);\n var iColumns = oSettings.aoColumns.length;\n var aoData = _fnAjaxParameters(oSettings);\n _fnServerParams(oSettings, aoData);\n\n oSettings.fnServerData.call(oSettings.oInstance, oSettings.sAjaxSource, aoData,\n function(json) {\n _fnAjaxUpdateDraw(oSettings, json);\n }, oSettings);\n return false;\n } else {\n return true;\n }\n }\n\n\n /**\n * Build up the parameters in an object needed for a server-side processing request\n * @param {object} oSettings dataTables settings object\n * @returns {bool} block the table drawing or not\n * @memberof DataTable#oApi\n */\n function _fnAjaxParameters(oSettings) {\n var iColumns = oSettings.aoColumns.length;\n var aoData = [], mDataProp, aaSort, aDataSort;\n var i, j;\n\n aoData.push({\"name\": \"sEcho\", \"value\": oSettings.iDraw});\n aoData.push({\"name\": \"iColumns\", \"value\": iColumns});\n aoData.push({\"name\": \"sColumns\", \"value\": _fnColumnOrdering(oSettings)});\n aoData.push({\"name\": \"iDisplayStart\", \"value\": oSettings._iDisplayStart});\n aoData.push({\n \"name\": \"iDisplayLength\", \"value\": oSettings.oFeatures.bPaginate !== false ?\n oSettings._iDisplayLength : -1\n });\n\n for (i = 0; i < iColumns; i++) {\n mDataProp = oSettings.aoColumns[i].mData;\n aoData.push({\"name\": \"mDataProp_\" + i, \"value\": typeof (mDataProp) === \"function\" ? 'function' : mDataProp});\n }\n\n /* Filtering */\n if (oSettings.oFeatures.bFilter !== false) {\n aoData.push({\"name\": \"sSearch\", \"value\": oSettings.oPreviousSearch.sSearch});\n aoData.push({\"name\": \"bRegex\", \"value\": oSettings.oPreviousSearch.bRegex});\n for (i = 0; i < iColumns; i++) {\n aoData.push({\"name\": \"sSearch_\" + i, \"value\": oSettings.aoPreSearchCols[i].sSearch});\n aoData.push({\"name\": \"bRegex_\" + i, \"value\": oSettings.aoPreSearchCols[i].bRegex});\n aoData.push({\"name\": \"bSearchable_\" + i, \"value\": oSettings.aoColumns[i].bSearchable});\n }\n }\n\n /* Sorting */\n if (oSettings.oFeatures.bSort !== false) {\n var iCounter = 0;\n\n aaSort = (oSettings.aaSortingFixed !== null) ?\n oSettings.aaSortingFixed.concat(oSettings.aaSorting) :\n oSettings.aaSorting.slice();\n\n for (i = 0; i < aaSort.length; i++) {\n aDataSort = oSettings.aoColumns[aaSort[i][0]].aDataSort;\n\n for (j = 0; j < aDataSort.length; j++) {\n aoData.push({\"name\": \"iSortCol_\" + iCounter, \"value\": aDataSort[j]});\n aoData.push({\"name\": \"sSortDir_\" + iCounter, \"value\": aaSort[i][1]});\n iCounter++;\n }\n }\n aoData.push({\"name\": \"iSortingCols\", \"value\": iCounter});\n\n for (i = 0; i < iColumns; i++) {\n aoData.push({\"name\": \"bSortable_\" + i, \"value\": oSettings.aoColumns[i].bSortable});\n }\n }\n\n return aoData;\n }\n\n\n /**\n * Add Ajax parameters from plug-ins\n * @param {object} oSettings dataTables settings object\n * @param array {objects} aoData name/value pairs to send to the server\n * @memberof DataTable#oApi\n */\n function _fnServerParams(oSettings, aoData) {\n _fnCallbackFire(oSettings, 'aoServerParams', 'serverParams', [aoData]);\n }\n\n\n /**\n * Data the data from the server (nuking the old) and redraw the table\n * @param {object} oSettings dataTables settings object\n * @param {object} json json data return from the server.\n * @param {string} json.sEcho Tracking flag for DataTables to match requests\n * @param {int} json.iTotalRecords Number of records in the data set, not accounting for filtering\n * @param {int} json.iTotalDisplayRecords Number of records in the data set, accounting for filtering\n * @param {array} json.aaData The data to display on this page\n * @param {string} [json.sColumns] Column ordering (sName, comma separated)\n * @memberof DataTable#oApi\n */\n function _fnAjaxUpdateDraw(oSettings, json) {\n if (json.sEcho !== undefined) {\n /* Protect against old returns over-writing a new one. Possible when you get\n\t\t\t\t * very fast interaction, and later queries are completed much faster\n\t\t\t\t */\n if (json.sEcho * 1 < oSettings.iDraw) {\n return;\n } else {\n oSettings.iDraw = json.sEcho * 1;\n }\n }\n\n if (!oSettings.oScroll.bInfinite ||\n (oSettings.oScroll.bInfinite && (oSettings.bSorted || oSettings.bFiltered))) {\n _fnClearTable(oSettings);\n }\n oSettings._iRecordsTotal = parseInt(json.iTotalRecords, 10);\n oSettings._iRecordsDisplay = parseInt(json.iTotalDisplayRecords, 10);\n\n /* Determine if reordering is required */\n var sOrdering = _fnColumnOrdering(oSettings);\n var bReOrder = (json.sColumns !== undefined && sOrdering !== \"\" && json.sColumns != sOrdering);\n var aiIndex;\n if (bReOrder) {\n aiIndex = _fnReOrderIndex(oSettings, json.sColumns);\n }\n\n var aData = _fnGetObjectDataFn(oSettings.sAjaxDataProp)(json);\n for (var i = 0, iLen = aData.length; i < iLen; i++) {\n if (bReOrder) {\n /* If we need to re-order, then create a new array with the correct order and add it */\n var aDataSorted = [];\n for (var j = 0, jLen = oSettings.aoColumns.length; j < jLen; j++) {\n aDataSorted.push(aData[i][aiIndex[j]]);\n }\n _fnAddData(oSettings, aDataSorted);\n } else {\n /* No re-order required, sever got it \"right\" - just straight add */\n _fnAddData(oSettings, aData[i]);\n }\n }\n oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n\n oSettings.bAjaxDataGet = false;\n _fnDraw(oSettings);\n oSettings.bAjaxDataGet = true;\n _fnProcessingDisplay(oSettings, false);\n }\n\n\n /**\n * Generate the node required for filtering text\n * @returns {node} Filter control element\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnFeatureHtmlFilter(oSettings) {\n var oPreviousSearch = oSettings.oPreviousSearch;\n\n var sSearchStr = oSettings.oLanguage.sSearch;\n sSearchStr = (sSearchStr.indexOf('_INPUT_') !== -1) ?\n sSearchStr.replace('_INPUT_', '') :\n sSearchStr === \"\" ? '' : sSearchStr + ' ';\n\n var nFilter = document.createElement('div');\n nFilter.className = oSettings.oClasses.sFilter;\n nFilter.innerHTML = '';\n if (!oSettings.aanFeatures.f) {\n nFilter.id = oSettings.sTableId + '_filter';\n }\n\n var jqFilter = $('input[type=\"text\"]', nFilter);\n\n // Store a reference to the input element, so other input elements could be\n // added to the filter wrapper if needed (submit button for example)\n nFilter._DT_Input = jqFilter[0];\n\n jqFilter.val(oPreviousSearch.sSearch.replace('\"', '"'));\n jqFilter.bind('keyup.DT', function(e) {\n /* Update all other filter input elements for the new display */\n var n = oSettings.aanFeatures.f;\n var val = this.value === \"\" ? \"\" : this.value; // mental IE8 fix :-(\n\n for (var i = 0, iLen = n.length; i < iLen; i++) {\n if (n[i] != $(this).parents('div.dataTables_filter')[0]) {\n $(n[i]._DT_Input).val(val);\n }\n }\n\n /* Now do the filter */\n if (val != oPreviousSearch.sSearch) {\n _fnFilterComplete(oSettings, {\n \"sSearch\": val,\n \"bRegex\": oPreviousSearch.bRegex,\n \"bSmart\": oPreviousSearch.bSmart,\n \"bCaseInsensitive\": oPreviousSearch.bCaseInsensitive\n });\n }\n });\n\n jqFilter\n .attr('aria-controls', oSettings.sTableId)\n .bind('keypress.DT', function(e) {\n /* Prevent form submission */\n if (e.keyCode == 13) {\n return false;\n }\n }\n );\n\n return nFilter;\n }\n\n\n /**\n * Filter the table using both the global filter and column based filtering\n * @param {object} oSettings dataTables settings object\n * @param {object} oSearch search information\n * @param {int} [iForce] force a research of the master array (1) or not (undefined or 0)\n * @memberof DataTable#oApi\n */\n function _fnFilterComplete(oSettings, oInput, iForce) {\n var oPrevSearch = oSettings.oPreviousSearch;\n var aoPrevSearch = oSettings.aoPreSearchCols;\n var fnSaveFilter = function(oFilter) {\n /* Save the filtering values */\n oPrevSearch.sSearch = oFilter.sSearch;\n oPrevSearch.bRegex = oFilter.bRegex;\n oPrevSearch.bSmart = oFilter.bSmart;\n oPrevSearch.bCaseInsensitive = oFilter.bCaseInsensitive;\n };\n\n /* In server-side processing all filtering is done by the server, so no point hanging around here */\n if (!oSettings.oFeatures.bServerSide) {\n /* Global filter */\n _fnFilter(oSettings, oInput.sSearch, iForce, oInput.bRegex, oInput.bSmart, oInput.bCaseInsensitive);\n fnSaveFilter(oInput);\n\n /* Now do the individual column filter */\n for (var i = 0; i < oSettings.aoPreSearchCols.length; i++) {\n _fnFilterColumn(oSettings, aoPrevSearch[i].sSearch, i, aoPrevSearch[i].bRegex,\n aoPrevSearch[i].bSmart, aoPrevSearch[i].bCaseInsensitive);\n }\n\n /* Custom filtering */\n _fnFilterCustom(oSettings);\n } else {\n fnSaveFilter(oInput);\n }\n\n /* Tell the draw function we have been filtering */\n oSettings.bFiltered = true;\n $(oSettings.oInstance).trigger('filter', oSettings);\n\n /* Redraw the table */\n oSettings._iDisplayStart = 0;\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n\n /* Rebuild search array 'offline' */\n _fnBuildSearchArray(oSettings, 0);\n }\n\n\n /**\n * Apply custom filtering functions\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnFilterCustom(oSettings) {\n var afnFilters = DataTable.ext.afnFiltering;\n var aiFilterColumns = _fnGetColumns(oSettings, 'bSearchable');\n\n for (var i = 0, iLen = afnFilters.length; i < iLen; i++) {\n var iCorrector = 0;\n for (var j = 0, jLen = oSettings.aiDisplay.length; j < jLen; j++) {\n var iDisIndex = oSettings.aiDisplay[j - iCorrector];\n var bTest = afnFilters[i](\n oSettings,\n _fnGetRowData(oSettings, iDisIndex, 'filter', aiFilterColumns),\n iDisIndex\n );\n\n /* Check if we should use this row based on the filtering function */\n if (!bTest) {\n oSettings.aiDisplay.splice(j - iCorrector, 1);\n iCorrector++;\n }\n }\n }\n }\n\n\n /**\n * Filter the table on a per-column basis\n * @param {object} oSettings dataTables settings object\n * @param {string} sInput string to filter on\n * @param {int} iColumn column to filter\n * @param {bool} bRegex treat search string as a regular expression or not\n * @param {bool} bSmart use smart filtering or not\n * @param {bool} bCaseInsensitive Do case insenstive matching or not\n * @memberof DataTable#oApi\n */\n function _fnFilterColumn(oSettings, sInput, iColumn, bRegex, bSmart, bCaseInsensitive) {\n if (sInput === \"\") {\n return;\n }\n\n var iIndexCorrector = 0;\n var rpSearch = _fnFilterCreateSearch(sInput, bRegex, bSmart, bCaseInsensitive);\n\n for (var i = oSettings.aiDisplay.length - 1; i >= 0; i--) {\n var sData = _fnDataToSearch(_fnGetCellData(oSettings, oSettings.aiDisplay[i], iColumn, 'filter'),\n oSettings.aoColumns[iColumn].sType);\n if (!rpSearch.test(sData)) {\n oSettings.aiDisplay.splice(i, 1);\n iIndexCorrector++;\n }\n }\n }\n\n\n /**\n * Filter the data table based on user input and draw the table\n * @param {object} oSettings dataTables settings object\n * @param {string} sInput string to filter on\n * @param {int} iForce optional - force a research of the master array (1) or not (undefined or 0)\n * @param {bool} bRegex treat as a regular expression or not\n * @param {bool} bSmart perform smart filtering or not\n * @param {bool} bCaseInsensitive Do case insenstive matching or not\n * @memberof DataTable#oApi\n */\n function _fnFilter(oSettings, sInput, iForce, bRegex, bSmart, bCaseInsensitive) {\n var i;\n var rpSearch = _fnFilterCreateSearch(sInput, bRegex, bSmart, bCaseInsensitive);\n var oPrevSearch = oSettings.oPreviousSearch;\n\n /* Check if we are forcing or not - optional parameter */\n if (!iForce) {\n iForce = 0;\n }\n\n /* Need to take account of custom filtering functions - always filter */\n if (DataTable.ext.afnFiltering.length !== 0) {\n iForce = 1;\n }\n\n /*\n\t\t\t * If the input is blank - we want the full data set\n\t\t\t */\n if (sInput.length <= 0) {\n oSettings.aiDisplay.splice(0, oSettings.aiDisplay.length);\n oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n } else {\n /*\n\t\t\t\t * We are starting a new search or the new search string is smaller\n\t\t\t\t * then the old one (i.e. delete). Search from the master array\n\t\t\t \t */\n if (oSettings.aiDisplay.length == oSettings.aiDisplayMaster.length ||\n oPrevSearch.sSearch.length > sInput.length || iForce == 1 ||\n sInput.indexOf(oPrevSearch.sSearch) !== 0) {\n /* Nuke the old display array - we are going to rebuild it */\n oSettings.aiDisplay.splice(0, oSettings.aiDisplay.length);\n\n /* Force a rebuild of the search array */\n _fnBuildSearchArray(oSettings, 1);\n\n /* Search through all records to populate the search array\n\t\t\t\t\t * The the oSettings.aiDisplayMaster and asDataSearch arrays have 1 to 1\n\t\t\t\t\t * mapping\n\t\t\t\t\t */\n for (i = 0; i < oSettings.aiDisplayMaster.length; i++) {\n if (rpSearch.test(oSettings.asDataSearch[i])) {\n oSettings.aiDisplay.push(oSettings.aiDisplayMaster[i]);\n }\n }\n } else {\n /* Using old search array - refine it - do it this way for speed\n\t\t\t \t * Don't have to search the whole master array again\n\t\t\t\t\t */\n var iIndexCorrector = 0;\n\n /* Search the current results */\n for (i = 0; i < oSettings.asDataSearch.length; i++) {\n if (!rpSearch.test(oSettings.asDataSearch[i])) {\n oSettings.aiDisplay.splice(i - iIndexCorrector, 1);\n iIndexCorrector++;\n }\n }\n }\n }\n }\n\n\n /**\n * Create an array which can be quickly search through\n * @param {object} oSettings dataTables settings object\n * @param {int} iMaster use the master data array - optional\n * @memberof DataTable#oApi\n */\n function _fnBuildSearchArray(oSettings, iMaster) {\n if (!oSettings.oFeatures.bServerSide) {\n /* Clear out the old data */\n oSettings.asDataSearch = [];\n\n var aiFilterColumns = _fnGetColumns(oSettings, 'bSearchable');\n var aiIndex = (iMaster === 1) ?\n oSettings.aiDisplayMaster :\n oSettings.aiDisplay;\n\n for (var i = 0, iLen = aiIndex.length; i < iLen; i++) {\n oSettings.asDataSearch[i] = _fnBuildSearchRow(\n oSettings,\n _fnGetRowData(oSettings, aiIndex[i], 'filter', aiFilterColumns)\n );\n }\n }\n }\n\n\n /**\n * Create a searchable string from a single data row\n * @param {object} oSettings dataTables settings object\n * @param {array} aData Row data array to use for the data to search\n * @memberof DataTable#oApi\n */\n function _fnBuildSearchRow(oSettings, aData) {\n var sSearch = aData.join(' ');\n\n /* If it looks like there is an HTML entity in the string, attempt to decode it */\n if (sSearch.indexOf('&') !== -1) {\n sSearch = $('
').html(sSearch).text();\n }\n\n // Strip newline characters\n return sSearch.replace(/[\\n\\r]/g, \" \");\n }\n\n /**\n * Build a regular expression object suitable for searching a table\n * @param {string} sSearch string to search for\n * @param {bool} bRegex treat as a regular expression or not\n * @param {bool} bSmart perform smart filtering or not\n * @param {bool} bCaseInsensitive Do case insensitive matching or not\n * @returns {RegExp} constructed object\n * @memberof DataTable#oApi\n */\n function _fnFilterCreateSearch(sSearch, bRegex, bSmart, bCaseInsensitive) {\n var asSearch, sRegExpString;\n\n if (bSmart) {\n /* Generate the regular expression to use. Something along the lines of:\n\t\t\t\t * ^(?=.*?\\bone\\b)(?=.*?\\btwo\\b)(?=.*?\\bthree\\b).*$\n\t\t\t\t */\n asSearch = bRegex ? sSearch.split(' ') : _fnEscapeRegex(sSearch).split(' ');\n sRegExpString = '^(?=.*?' + asSearch.join(')(?=.*?') + ').*$';\n return new RegExp(sRegExpString, bCaseInsensitive ? \"i\" : \"\");\n } else {\n sSearch = bRegex ? sSearch : _fnEscapeRegex(sSearch);\n return new RegExp(sSearch, bCaseInsensitive ? \"i\" : \"\");\n }\n }\n\n\n /**\n * Convert raw data into something that the user can search on\n * @param {string} sData data to be modified\n * @param {string} sType data type\n * @returns {string} search string\n * @memberof DataTable#oApi\n */\n function _fnDataToSearch(sData, sType) {\n if (typeof DataTable.ext.ofnSearch[sType] === \"function\") {\n return DataTable.ext.ofnSearch[sType](sData);\n } else if (sData === null) {\n return '';\n } else if (sType == \"html\") {\n return sData.replace(/[\\r\\n]/g, \" \").replace(/<.*?>/g, \"\");\n } else if (typeof sData === \"string\") {\n return sData.replace(/[\\r\\n]/g, \" \");\n }\n return sData;\n }\n\n\n /**\n * scape a string such that it can be used in a regular expression\n * @param {string} sVal string to escape\n * @returns {string} escaped string\n * @memberof DataTable#oApi\n */\n function _fnEscapeRegex(sVal) {\n var acEscape = ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\\\', '$', '^', '-'];\n var reReplace = new RegExp('(\\\\' + acEscape.join('|\\\\') + ')', 'g');\n return sVal.replace(reReplace, '\\\\$1');\n }\n\n\n /**\n * Generate the node required for the info display\n * @param {object} oSettings dataTables settings object\n * @returns {node} Information element\n * @memberof DataTable#oApi\n */\n function _fnFeatureHtmlInfo(oSettings) {\n var nInfo = document.createElement('div');\n nInfo.className = oSettings.oClasses.sInfo;\n\n /* Actions that are to be taken once only for this feature */\n if (!oSettings.aanFeatures.i) {\n /* Add draw callback */\n oSettings.aoDrawCallback.push({\n \"fn\": _fnUpdateInfo,\n \"sName\": \"information\"\n });\n\n /* Add id */\n nInfo.id = oSettings.sTableId + '_info';\n }\n oSettings.nTable.setAttribute('aria-describedby', oSettings.sTableId + '_info');\n\n return nInfo;\n }\n\n\n /**\n * Update the information elements in the display\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnUpdateInfo(oSettings) {\n /* Show information about the table */\n if (!oSettings.oFeatures.bInfo || oSettings.aanFeatures.i.length === 0) {\n return;\n }\n\n var\n oLang = oSettings.oLanguage,\n iStart = oSettings._iDisplayStart + 1,\n iEnd = oSettings.fnDisplayEnd(),\n iMax = oSettings.fnRecordsTotal(),\n iTotal = oSettings.fnRecordsDisplay(),\n sOut;\n\n if (iTotal === 0) {\n /* Empty record set */\n sOut = oLang.sInfoEmpty;\n } else {\n /* Normal record set */\n sOut = oLang.sInfo;\n }\n\n if (iTotal != iMax) {\n /* Record set after filtering */\n sOut += ' ' + oLang.sInfoFiltered;\n }\n\n // Convert the macros\n sOut += oLang.sInfoPostFix;\n sOut = _fnInfoMacros(oSettings, sOut);\n\n if (oLang.fnInfoCallback !== null) {\n sOut = oLang.fnInfoCallback.call(oSettings.oInstance,\n oSettings, iStart, iEnd, iMax, iTotal, sOut);\n }\n\n var n = oSettings.aanFeatures.i;\n for (var i = 0, iLen = n.length; i < iLen; i++) {\n $(n[i]).html(sOut);\n }\n }\n\n\n function _fnInfoMacros(oSettings, str) {\n var\n iStart = oSettings._iDisplayStart + 1,\n sStart = oSettings.fnFormatNumber(iStart),\n iEnd = oSettings.fnDisplayEnd(),\n sEnd = oSettings.fnFormatNumber(iEnd),\n iTotal = oSettings.fnRecordsDisplay(),\n sTotal = oSettings.fnFormatNumber(iTotal),\n iMax = oSettings.fnRecordsTotal(),\n sMax = oSettings.fnFormatNumber(iMax);\n\n // When infinite scrolling, we are always starting at 1. _iDisplayStart is used only\n // internally\n if (oSettings.oScroll.bInfinite) {\n sStart = oSettings.fnFormatNumber(1);\n }\n\n return str.replace(/_START_/g, sStart).replace(/_END_/g, sEnd).replace(/_TOTAL_/g, sTotal).replace(/_MAX_/g, sMax);\n }\n\n\n /**\n * Draw the table for the first time, adding all required features\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnInitialise(oSettings) {\n var i, iLen, iAjaxStart = oSettings.iInitDisplayStart;\n\n /* Ensure that the table data is fully initialised */\n if (oSettings.bInitialised === false) {\n setTimeout(function() {\n _fnInitialise(oSettings);\n }, 200);\n return;\n }\n\n /* Show the display HTML options */\n _fnAddOptionsHtml(oSettings);\n\n /* Build and draw the header / footer for the table */\n _fnBuildHead(oSettings);\n _fnDrawHead(oSettings, oSettings.aoHeader);\n if (oSettings.nTFoot) {\n _fnDrawHead(oSettings, oSettings.aoFooter);\n }\n\n /* Okay to show that something is going on now */\n _fnProcessingDisplay(oSettings, true);\n\n /* Calculate sizes for columns */\n if (oSettings.oFeatures.bAutoWidth) {\n _fnCalculateColumnWidths(oSettings);\n }\n\n for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n if (oSettings.aoColumns[i].sWidth !== null) {\n oSettings.aoColumns[i].nTh.style.width = _fnStringToCss(oSettings.aoColumns[i].sWidth);\n }\n }\n\n /* If there is default sorting required - let's do it. The sort function will do the\n\t\t\t * drawing for us. Otherwise we draw the table regardless of the Ajax source - this allows\n\t\t\t * the table to look initialised for Ajax sourcing data (show 'loading' message possibly)\n\t\t\t */\n if (oSettings.oFeatures.bSort) {\n _fnSort(oSettings);\n } else if (oSettings.oFeatures.bFilter) {\n _fnFilterComplete(oSettings, oSettings.oPreviousSearch);\n } else {\n oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n }\n\n /* if there is an ajax source load the data */\n if (oSettings.sAjaxSource !== null && !oSettings.oFeatures.bServerSide) {\n var aoData = [];\n _fnServerParams(oSettings, aoData);\n oSettings.fnServerData.call(oSettings.oInstance, oSettings.sAjaxSource, aoData, function(json) {\n var aData = (oSettings.sAjaxDataProp !== \"\") ?\n _fnGetObjectDataFn(oSettings.sAjaxDataProp)(json) : json;\n\n /* Got the data - add it to the table */\n for (i = 0; i < aData.length; i++) {\n _fnAddData(oSettings, aData[i]);\n }\n\n /* Reset the init display for cookie saving. We've already done a filter, and\n\t\t\t\t\t * therefore cleared it before. So we need to make it appear 'fresh'\n\t\t\t\t\t */\n oSettings.iInitDisplayStart = iAjaxStart;\n\n if (oSettings.oFeatures.bSort) {\n _fnSort(oSettings);\n } else {\n oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n }\n\n _fnProcessingDisplay(oSettings, false);\n _fnInitComplete(oSettings, json);\n }, oSettings);\n return;\n }\n\n /* Server-side processing initialisation complete is done at the end of _fnDraw */\n if (!oSettings.oFeatures.bServerSide) {\n _fnProcessingDisplay(oSettings, false);\n _fnInitComplete(oSettings);\n }\n }\n\n\n /**\n * Draw the table for the first time, adding all required features\n * @param {object} oSettings dataTables settings object\n * @param {object} [json] JSON from the server that completed the table, if using Ajax source\n * with client-side processing (optional)\n * @memberof DataTable#oApi\n */\n function _fnInitComplete(oSettings, json) {\n oSettings._bInitComplete = true;\n _fnCallbackFire(oSettings, 'aoInitComplete', 'init', [oSettings, json]);\n }\n\n\n /**\n * Language compatibility - when certain options are given, and others aren't, we\n * need to duplicate the values over, in order to provide backwards compatibility\n * with older language files.\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnLanguageCompat(oLanguage) {\n var oDefaults = DataTable.defaults.oLanguage;\n\n /* Backwards compatibility - if there is no sEmptyTable given, then use the same as\n\t\t\t * sZeroRecords - assuming that is given.\n\t\t\t */\n if (!oLanguage.sEmptyTable && oLanguage.sZeroRecords &&\n oDefaults.sEmptyTable === \"No data available in table\") {\n _fnMap(oLanguage, oLanguage, 'sZeroRecords', 'sEmptyTable');\n }\n\n /* Likewise with loading records */\n if (!oLanguage.sLoadingRecords && oLanguage.sZeroRecords &&\n oDefaults.sLoadingRecords === \"Loading...\") {\n _fnMap(oLanguage, oLanguage, 'sZeroRecords', 'sLoadingRecords');\n }\n }\n\n\n /**\n * Generate the node required for user display length changing\n * @param {object} oSettings dataTables settings object\n * @returns {node} Display length feature node\n * @memberof DataTable#oApi\n */\n function _fnFeatureHtmlLength(oSettings) {\n if (oSettings.oScroll.bInfinite) {\n return null;\n }\n\n /* This can be overruled by not using the _MENU_ var/macro in the language variable */\n var sName = 'name=\"' + oSettings.sTableId + '_length\"';\n var sStdMenu = '';\n\n var nLength = document.createElement('div');\n if (!oSettings.aanFeatures.l) {\n nLength.id = oSettings.sTableId + '_length';\n }\n nLength.className = oSettings.oClasses.sLength;\n nLength.innerHTML = '';\n\n /*\n\t\t\t * Set the length to the current display length - thanks to Andrea Pavlovic for this fix,\n\t\t\t * and Stefan Skopnik for fixing the fix!\n\t\t\t */\n $('select option[value=\"' + oSettings._iDisplayLength + '\"]', nLength).attr(\"selected\", true);\n\n $('select', nLength).bind('change.DT', function(e) {\n var iVal = $(this).val();\n\n /* Update all other length options for the new display */\n var n = oSettings.aanFeatures.l;\n for (i = 0, iLen = n.length; i < iLen; i++) {\n if (n[i] != this.parentNode) {\n $('select', n[i]).val(iVal);\n }\n }\n\n /* Redraw the table */\n oSettings._iDisplayLength = parseInt(iVal, 10);\n _fnCalculateEnd(oSettings);\n\n /* If we have space to show extra rows (backing up from the end point - then do so */\n if (oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay()) {\n oSettings._iDisplayStart = oSettings.fnDisplayEnd() - oSettings._iDisplayLength;\n if (oSettings._iDisplayStart < 0) {\n oSettings._iDisplayStart = 0;\n }\n }\n\n if (oSettings._iDisplayLength == -1) {\n oSettings._iDisplayStart = 0;\n }\n\n _fnDraw(oSettings);\n });\n\n\n $('select', nLength).attr('aria-controls', oSettings.sTableId);\n\n return nLength;\n }\n\n\n /**\n * Recalculate the end point based on the start point\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnCalculateEnd(oSettings) {\n if (oSettings.oFeatures.bPaginate === false) {\n oSettings._iDisplayEnd = oSettings.aiDisplay.length;\n } else {\n /* Set the end point of the display - based on how many elements there are\n\t\t\t\t * still to display\n\t\t\t\t */\n if (oSettings._iDisplayStart + oSettings._iDisplayLength > oSettings.aiDisplay.length ||\n oSettings._iDisplayLength == -1) {\n oSettings._iDisplayEnd = oSettings.aiDisplay.length;\n } else {\n oSettings._iDisplayEnd = oSettings._iDisplayStart + oSettings._iDisplayLength;\n }\n }\n }\n\n\n /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *\n\t\t * Note that most of the paging logic is done in\n\t\t * DataTable.ext.oPagination\n\t\t */\n\n /**\n * Generate the node required for default pagination\n * @param {object} oSettings dataTables settings object\n * @returns {node} Pagination feature node\n * @memberof DataTable#oApi\n */\n function _fnFeatureHtmlPaginate(oSettings) {\n if (oSettings.oScroll.bInfinite) {\n return null;\n }\n\n var nPaginate = document.createElement('div');\n nPaginate.className = oSettings.oClasses.sPaging + oSettings.sPaginationType;\n\n DataTable.ext.oPagination[oSettings.sPaginationType].fnInit(oSettings, nPaginate,\n function(oSettings) {\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n }\n );\n\n /* Add a draw callback for the pagination on first instance, to update the paging display */\n if (!oSettings.aanFeatures.p) {\n oSettings.aoDrawCallback.push({\n \"fn\": function(oSettings) {\n DataTable.ext.oPagination[oSettings.sPaginationType].fnUpdate(oSettings, function(oSettings) {\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n });\n },\n \"sName\": \"pagination\"\n });\n }\n return nPaginate;\n }\n\n\n /**\n * Alter the display settings to change the page\n * @param {object} oSettings dataTables settings object\n * @param {string|int} mAction Paging action to take: \"first\", \"previous\", \"next\" or \"last\"\n * or page number to jump to (integer)\n * @returns {bool} true page has changed, false - no change (no effect) eg 'first' on page 1\n * @memberof DataTable#oApi\n */\n function _fnPageChange(oSettings, mAction) {\n var iOldStart = oSettings._iDisplayStart;\n\n if (typeof mAction === \"number\") {\n oSettings._iDisplayStart = mAction * oSettings._iDisplayLength;\n if (oSettings._iDisplayStart > oSettings.fnRecordsDisplay()) {\n oSettings._iDisplayStart = 0;\n }\n } else if (mAction == \"first\") {\n oSettings._iDisplayStart = 0;\n } else if (mAction == \"previous\") {\n oSettings._iDisplayStart = oSettings._iDisplayLength >= 0 ?\n oSettings._iDisplayStart - oSettings._iDisplayLength :\n 0;\n\n /* Correct for under-run */\n if (oSettings._iDisplayStart < 0) {\n oSettings._iDisplayStart = 0;\n }\n } else if (mAction == \"next\") {\n if (oSettings._iDisplayLength >= 0) {\n /* Make sure we are not over running the display array */\n if (oSettings._iDisplayStart + oSettings._iDisplayLength < oSettings.fnRecordsDisplay()) {\n oSettings._iDisplayStart += oSettings._iDisplayLength;\n }\n } else {\n oSettings._iDisplayStart = 0;\n }\n } else if (mAction == \"last\") {\n if (oSettings._iDisplayLength >= 0) {\n var iPages = parseInt((oSettings.fnRecordsDisplay() - 1) / oSettings._iDisplayLength, 10) + 1;\n oSettings._iDisplayStart = (iPages - 1) * oSettings._iDisplayLength;\n } else {\n oSettings._iDisplayStart = 0;\n }\n } else {\n _fnLog(oSettings, 0, \"Unknown paging action: \" + mAction);\n }\n $(oSettings.oInstance).trigger('page', oSettings);\n\n return iOldStart != oSettings._iDisplayStart;\n }\n\n\n /**\n * Generate the node required for the processing node\n * @param {object} oSettings dataTables settings object\n * @returns {node} Processing element\n * @memberof DataTable#oApi\n */\n function _fnFeatureHtmlProcessing(oSettings) {\n var nProcessing = document.createElement('div');\n\n if (!oSettings.aanFeatures.r) {\n nProcessing.id = oSettings.sTableId + '_processing';\n }\n nProcessing.innerHTML = oSettings.oLanguage.sProcessing;\n nProcessing.className = oSettings.oClasses.sProcessing;\n oSettings.nTable.parentNode.insertBefore(nProcessing, oSettings.nTable);\n\n return nProcessing;\n }\n\n\n /**\n * Display or hide the processing indicator\n * @param {object} oSettings dataTables settings object\n * @param {bool} bShow Show the processing indicator (true) or not (false)\n * @memberof DataTable#oApi\n */\n function _fnProcessingDisplay(oSettings, bShow) {\n if (oSettings.oFeatures.bProcessing) {\n var an = oSettings.aanFeatures.r;\n for (var i = 0, iLen = an.length; i < iLen; i++) {\n an[i].style.visibility = bShow ? \"visible\" : \"hidden\";\n }\n }\n\n $(oSettings.oInstance).trigger('processing', [oSettings, bShow]);\n }\n\n /**\n * Add any control elements for the table - specifically scrolling\n * @param {object} oSettings dataTables settings object\n * @returns {node} Node to add to the DOM\n * @memberof DataTable#oApi\n */\n function _fnFeatureHtmlTable(oSettings) {\n /* Check if scrolling is enabled or not - if not then leave the DOM unaltered */\n if (oSettings.oScroll.sX === \"\" && oSettings.oScroll.sY === \"\") {\n return oSettings.nTable;\n }\n\n /*\n\t\t\t * The HTML structure that we want to generate in this function is:\n\t\t\t * div - nScroller\n\t\t\t * div - nScrollHead\n\t\t\t * div - nScrollHeadInner\n\t\t\t * table - nScrollHeadTable\n\t\t\t * thead - nThead\n\t\t\t * div - nScrollBody\n\t\t\t * table - oSettings.nTable\n\t\t\t * thead - nTheadSize\n\t\t\t * tbody - nTbody\n\t\t\t * div - nScrollFoot\n\t\t\t * div - nScrollFootInner\n\t\t\t * table - nScrollFootTable\n\t\t\t * tfoot - nTfoot\n\t\t\t */\n var\n nScroller = document.createElement('div'),\n nScrollHead = document.createElement('div'),\n nScrollHeadInner = document.createElement('div'),\n nScrollBody = document.createElement('div'),\n nScrollFoot = document.createElement('div'),\n nScrollFootInner = document.createElement('div'),\n nScrollHeadTable = oSettings.nTable.cloneNode(false),\n nScrollFootTable = oSettings.nTable.cloneNode(false),\n nThead = oSettings.nTable.getElementsByTagName('thead')[0],\n nTfoot = oSettings.nTable.getElementsByTagName('tfoot').length === 0 ? null :\n oSettings.nTable.getElementsByTagName('tfoot')[0],\n oClasses = oSettings.oClasses;\n\n nScrollHead.appendChild(nScrollHeadInner);\n nScrollFoot.appendChild(nScrollFootInner);\n nScrollBody.appendChild(oSettings.nTable);\n nScroller.appendChild(nScrollHead);\n nScroller.appendChild(nScrollBody);\n nScrollHeadInner.appendChild(nScrollHeadTable);\n nScrollHeadTable.appendChild(nThead);\n if (nTfoot !== null) {\n nScroller.appendChild(nScrollFoot);\n nScrollFootInner.appendChild(nScrollFootTable);\n nScrollFootTable.appendChild(nTfoot);\n }\n\n nScroller.className = oClasses.sScrollWrapper;\n nScrollHead.className = oClasses.sScrollHead;\n nScrollHeadInner.className = oClasses.sScrollHeadInner;\n nScrollBody.className = oClasses.sScrollBody;\n nScrollFoot.className = oClasses.sScrollFoot;\n nScrollFootInner.className = oClasses.sScrollFootInner;\n\n if (oSettings.oScroll.bAutoCss) {\n nScrollHead.style.overflow = \"hidden\";\n nScrollHead.style.position = \"relative\";\n nScrollFoot.style.overflow = \"hidden\";\n nScrollBody.style.overflow = \"auto\";\n }\n\n nScrollHead.style.border = \"0\";\n nScrollHead.style.width = \"100%\";\n nScrollFoot.style.border = \"0\";\n nScrollHeadInner.style.width = oSettings.oScroll.sXInner !== \"\" ?\n oSettings.oScroll.sXInner : \"100%\"; /* will be overwritten */\n\n /* Modify attributes to respect the clones */\n nScrollHeadTable.removeAttribute('id');\n nScrollHeadTable.style.marginLeft = \"0\";\n oSettings.nTable.style.marginLeft = \"0\";\n if (nTfoot !== null) {\n nScrollFootTable.removeAttribute('id');\n nScrollFootTable.style.marginLeft = \"0\";\n }\n\n /* Move caption elements from the body to the header, footer or leave where it is\n\t\t\t * depending on the configuration. Note that the DTD says there can be only one caption */\n var nCaption = $(oSettings.nTable).children('caption');\n if (nCaption.length > 0) {\n nCaption = nCaption[0];\n if (nCaption._captionSide === \"top\") {\n nScrollHeadTable.appendChild(nCaption);\n } else if (nCaption._captionSide === \"bottom\" && nTfoot) {\n nScrollFootTable.appendChild(nCaption);\n }\n }\n\n /*\n\t\t\t * Sizing\n\t\t\t */\n /* When x-scrolling add the width and a scroller to move the header with the body */\n if (oSettings.oScroll.sX !== \"\") {\n nScrollHead.style.width = _fnStringToCss(oSettings.oScroll.sX);\n nScrollBody.style.width = _fnStringToCss(oSettings.oScroll.sX);\n\n if (nTfoot !== null) {\n nScrollFoot.style.width = _fnStringToCss(oSettings.oScroll.sX);\n }\n\n /* When the body is scrolled, then we also want to scroll the headers */\n $(nScrollBody).scroll(function(e) {\n nScrollHead.scrollLeft = this.scrollLeft;\n\n if (nTfoot !== null) {\n nScrollFoot.scrollLeft = this.scrollLeft;\n }\n });\n }\n\n /* When yscrolling, add the height */\n if (oSettings.oScroll.sY !== \"\") {\n nScrollBody.style.height = _fnStringToCss(oSettings.oScroll.sY);\n }\n\n /* Redraw - align columns across the tables */\n oSettings.aoDrawCallback.push({\n \"fn\": _fnScrollDraw,\n \"sName\": \"scrolling\"\n });\n\n /* Infinite scrolling event handlers */\n if (oSettings.oScroll.bInfinite) {\n $(nScrollBody).scroll(function() {\n /* Use a blocker to stop scrolling from loading more data while other data is still loading */\n if (!oSettings.bDrawing && $(this).scrollTop() !== 0) {\n /* Check if we should load the next data set */\n if ($(this).scrollTop() + $(this).height() >\n $(oSettings.nTable).height() - oSettings.oScroll.iLoadGap) {\n /* Only do the redraw if we have to - we might be at the end of the data */\n if (oSettings.fnDisplayEnd() < oSettings.fnRecordsDisplay()) {\n _fnPageChange(oSettings, 'next');\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n }\n }\n }\n });\n }\n\n oSettings.nScrollHead = nScrollHead;\n oSettings.nScrollFoot = nScrollFoot;\n\n return nScroller;\n }\n\n\n /**\n * Update the various tables for resizing. It's a bit of a pig this function, but\n * basically the idea to:\n * 1. Re-create the table inside the scrolling div\n * 2. Take live measurements from the DOM\n * 3. Apply the measurements\n * 4. Clean up\n * @param {object} o dataTables settings object\n * @returns {node} Node to add to the DOM\n * @memberof DataTable#oApi\n */\n function _fnScrollDraw(o) {\n var\n nScrollHeadInner = o.nScrollHead.getElementsByTagName('div')[0],\n nScrollHeadTable = nScrollHeadInner.getElementsByTagName('table')[0],\n nScrollBody = o.nTable.parentNode,\n i, iLen, j, jLen, anHeadToSize, anHeadSizers, anFootSizers, anFootToSize, oStyle, iVis,\n nTheadSize, nTfootSize,\n iWidth, aApplied = [], aAppliedFooter = [], iSanityWidth,\n nScrollFootInner = (o.nTFoot !== null) ? o.nScrollFoot.getElementsByTagName('div')[0] : null,\n nScrollFootTable = (o.nTFoot !== null) ? nScrollFootInner.getElementsByTagName('table')[0] : null,\n ie67 = o.oBrowser.bScrollOversize,\n zeroOut = function(nSizer) {\n oStyle = nSizer.style;\n oStyle.paddingTop = \"0\";\n oStyle.paddingBottom = \"0\";\n oStyle.borderTopWidth = \"0\";\n oStyle.borderBottomWidth = \"0\";\n oStyle.height = 0;\n };\n\n /*\n\t\t\t * 1. Re-create the table inside the scrolling div\n\t\t\t */\n\n /* Remove the old minimised thead and tfoot elements in the inner table */\n $(o.nTable).children('thead, tfoot').remove();\n\n /* Clone the current header and footer elements and then place it into the inner table */\n nTheadSize = $(o.nTHead).clone()[0];\n o.nTable.insertBefore(nTheadSize, o.nTable.childNodes[0]);\n anHeadToSize = o.nTHead.getElementsByTagName('tr');\n anHeadSizers = nTheadSize.getElementsByTagName('tr');\n\n if (o.nTFoot !== null) {\n nTfootSize = $(o.nTFoot).clone()[0];\n o.nTable.insertBefore(nTfootSize, o.nTable.childNodes[1]);\n anFootToSize = o.nTFoot.getElementsByTagName('tr');\n anFootSizers = nTfootSize.getElementsByTagName('tr');\n }\n\n /*\n\t\t\t * 2. Take live measurements from the DOM - do not alter the DOM itself!\n\t\t\t */\n\n /* Remove old sizing and apply the calculated column widths\n\t\t\t * Get the unique column headers in the newly created (cloned) header. We want to apply the\n\t\t\t * calculated sizes to this header\n\t\t\t */\n if (o.oScroll.sX === \"\") {\n nScrollBody.style.width = '100%';\n nScrollHeadInner.parentNode.style.width = '100%';\n }\n\n var nThs = _fnGetUniqueThs(o, nTheadSize);\n for (i = 0, iLen = nThs.length; i < iLen; i++) {\n iVis = _fnVisibleToColumnIndex(o, i);\n nThs[i].style.width = o.aoColumns[iVis].sWidth;\n }\n\n if (o.nTFoot !== null) {\n _fnApplyToChildren(function(n) {\n n.style.width = \"\";\n }, anFootSizers);\n }\n\n // If scroll collapse is enabled, when we put the headers back into the body for sizing, we\n // will end up forcing the scrollbar to appear, making our measurements wrong for when we\n // then hide it (end of this function), so add the header height to the body scroller.\n if (o.oScroll.bCollapse && o.oScroll.sY !== \"\") {\n nScrollBody.style.height = (nScrollBody.offsetHeight + o.nTHead.offsetHeight) + \"px\";\n }\n\n /* Size the table as a whole */\n iSanityWidth = $(o.nTable).outerWidth();\n if (o.oScroll.sX === \"\") {\n /* No x scrolling */\n o.nTable.style.width = \"100%\";\n\n /* I know this is rubbish - but IE7 will make the width of the table when 100% include\n\t\t\t\t * the scrollbar - which is shouldn't. When there is a scrollbar we need to take this\n\t\t\t\t * into account.\n\t\t\t\t */\n if (ie67 && ($('tbody', nScrollBody).height() > nScrollBody.offsetHeight ||\n $(nScrollBody).css('overflow-y') == \"scroll\")) {\n o.nTable.style.width = _fnStringToCss($(o.nTable).outerWidth() - o.oScroll.iBarWidth);\n }\n } else {\n if (o.oScroll.sXInner !== \"\") {\n /* x scroll inner has been given - use it */\n o.nTable.style.width = _fnStringToCss(o.oScroll.sXInner);\n } else if (iSanityWidth == $(nScrollBody).width() &&\n $(nScrollBody).height() < $(o.nTable).height()) {\n /* There is y-scrolling - try to take account of the y scroll bar */\n o.nTable.style.width = _fnStringToCss(iSanityWidth - o.oScroll.iBarWidth);\n if ($(o.nTable).outerWidth() > iSanityWidth - o.oScroll.iBarWidth) {\n /* Not possible to take account of it */\n o.nTable.style.width = _fnStringToCss(iSanityWidth);\n }\n } else {\n /* All else fails */\n o.nTable.style.width = _fnStringToCss(iSanityWidth);\n }\n }\n\n /* Recalculate the sanity width - now that we've applied the required width, before it was\n\t\t\t * a temporary variable. This is required because the column width calculation is done\n\t\t\t * before this table DOM is created.\n\t\t\t */\n iSanityWidth = $(o.nTable).outerWidth();\n\n /* We want the hidden header to have zero height, so remove padding and borders. Then\n\t\t\t * set the width based on the real headers\n\t\t\t */\n\n // Apply all styles in one pass. Invalidates layout only once because we don't read any\n // DOM properties.\n _fnApplyToChildren(zeroOut, anHeadSizers);\n\n // Read all widths in next pass. Forces layout only once because we do not change\n // any DOM properties.\n _fnApplyToChildren(function(nSizer) {\n aApplied.push(_fnStringToCss($(nSizer).width()));\n }, anHeadSizers);\n\n // Apply all widths in final pass. Invalidates layout only once because we do not\n // read any DOM properties.\n _fnApplyToChildren(function(nToSize, i) {\n nToSize.style.width = aApplied[i];\n }, anHeadToSize);\n\n $(anHeadSizers).height(0);\n\n /* Same again with the footer if we have one */\n if (o.nTFoot !== null) {\n _fnApplyToChildren(zeroOut, anFootSizers);\n\n _fnApplyToChildren(function(nSizer) {\n aAppliedFooter.push(_fnStringToCss($(nSizer).width()));\n }, anFootSizers);\n\n _fnApplyToChildren(function(nToSize, i) {\n nToSize.style.width = aAppliedFooter[i];\n }, anFootToSize);\n\n $(anFootSizers).height(0);\n }\n\n /*\n\t\t\t * 3. Apply the measurements\n\t\t\t */\n\n /* \"Hide\" the header and footer that we used for the sizing. We want to also fix their width\n\t\t\t * to what they currently are\n\t\t\t */\n _fnApplyToChildren(function(nSizer, i) {\n nSizer.innerHTML = \"\";\n nSizer.style.width = aApplied[i];\n }, anHeadSizers);\n\n if (o.nTFoot !== null) {\n _fnApplyToChildren(function(nSizer, i) {\n nSizer.innerHTML = \"\";\n nSizer.style.width = aAppliedFooter[i];\n }, anFootSizers);\n }\n\n /* Sanity check that the table is of a sensible width. If not then we are going to get\n\t\t\t * misalignment - try to prevent this by not allowing the table to shrink below its min width\n\t\t\t */\n if ($(o.nTable).outerWidth() < iSanityWidth) {\n /* The min width depends upon if we have a vertical scrollbar visible or not */\n var iCorrection = ((nScrollBody.scrollHeight > nScrollBody.offsetHeight ||\n $(nScrollBody).css('overflow-y') == \"scroll\")) ?\n iSanityWidth + o.oScroll.iBarWidth : iSanityWidth;\n\n /* IE6/7 are a law unto themselves... */\n if (ie67 && (nScrollBody.scrollHeight >\n nScrollBody.offsetHeight || $(nScrollBody).css('overflow-y') == \"scroll\")) {\n o.nTable.style.width = _fnStringToCss(iCorrection - o.oScroll.iBarWidth);\n }\n\n /* Apply the calculated minimum width to the table wrappers */\n nScrollBody.style.width = _fnStringToCss(iCorrection);\n o.nScrollHead.style.width = _fnStringToCss(iCorrection);\n\n if (o.nTFoot !== null) {\n o.nScrollFoot.style.width = _fnStringToCss(iCorrection);\n }\n\n /* And give the user a warning that we've stopped the table getting too small */\n if (o.oScroll.sX === \"\") {\n _fnLog(o, 1, \"The table cannot fit into the current element which will cause column\" +\n \" misalignment. The table has been drawn at its minimum possible width.\");\n } else if (o.oScroll.sXInner !== \"\") {\n _fnLog(o, 1, \"The table cannot fit into the current element which will cause column\" +\n \" misalignment. Increase the sScrollXInner value or remove it to allow automatic\" +\n \" calculation\");\n }\n } else {\n nScrollBody.style.width = _fnStringToCss('100%');\n o.nScrollHead.style.width = _fnStringToCss('100%');\n\n if (o.nTFoot !== null) {\n o.nScrollFoot.style.width = _fnStringToCss('100%');\n }\n }\n\n\n /*\n\t\t\t * 4. Clean up\n\t\t\t */\n if (o.oScroll.sY === \"\") {\n /* IE7< puts a vertical scrollbar in place (when it shouldn't be) due to subtracting\n\t\t\t\t * the scrollbar height from the visible display, rather than adding it on. We need to\n\t\t\t\t * set the height in order to sort this. Don't want to do it in any other browsers.\n\t\t\t\t */\n if (ie67) {\n nScrollBody.style.height = _fnStringToCss(o.nTable.offsetHeight + o.oScroll.iBarWidth);\n }\n }\n\n if (o.oScroll.sY !== \"\" && o.oScroll.bCollapse) {\n nScrollBody.style.height = _fnStringToCss(o.oScroll.sY);\n\n var iExtra = (o.oScroll.sX !== \"\" && o.nTable.offsetWidth > nScrollBody.offsetWidth) ?\n o.oScroll.iBarWidth : 0;\n if (o.nTable.offsetHeight < nScrollBody.offsetHeight) {\n nScrollBody.style.height = _fnStringToCss(o.nTable.offsetHeight + iExtra);\n }\n }\n\n /* Finally set the width's of the header and footer tables */\n var iOuterWidth = $(o.nTable).outerWidth();\n nScrollHeadTable.style.width = _fnStringToCss(iOuterWidth);\n nScrollHeadInner.style.width = _fnStringToCss(iOuterWidth);\n\n // Figure out if there are scrollbar present - if so then we need a the header and footer to\n // provide a bit more space to allow \"overflow\" scrolling (i.e. past the scrollbar)\n var bScrolling = $(o.nTable).height() > nScrollBody.clientHeight || $(nScrollBody).css('overflow-y') == \"scroll\";\n nScrollHeadInner.style.paddingRight = bScrolling ? o.oScroll.iBarWidth + \"px\" : \"0px\";\n\n if (o.nTFoot !== null) {\n nScrollFootTable.style.width = _fnStringToCss(iOuterWidth);\n nScrollFootInner.style.width = _fnStringToCss(iOuterWidth);\n nScrollFootInner.style.paddingRight = bScrolling ? o.oScroll.iBarWidth + \"px\" : \"0px\";\n }\n\n /* Adjust the position of the header in case we loose the y-scrollbar */\n $(nScrollBody).scroll();\n\n /* If sorting or filtering has occurred, jump the scrolling back to the top */\n if (o.bSorted || o.bFiltered) {\n nScrollBody.scrollTop = 0;\n }\n }\n\n\n /**\n * Apply a given function to the display child nodes of an element array (typically\n * TD children of TR rows\n * @param {function} fn Method to apply to the objects\n * @param array {nodes} an1 List of elements to look through for display children\n * @param array {nodes} an2 Another list (identical structure to the first) - optional\n * @memberof DataTable#oApi\n */\n function _fnApplyToChildren(fn, an1, an2) {\n var index = 0, i = 0, iLen = an1.length;\n var nNode1, nNode2;\n\n while (i < iLen) {\n nNode1 = an1[i].firstChild;\n nNode2 = an2 ? an2[i].firstChild : null;\n while (nNode1) {\n if (nNode1.nodeType === 1) {\n if (an2) {\n fn(nNode1, nNode2, index);\n } else {\n fn(nNode1, index);\n }\n index++;\n }\n nNode1 = nNode1.nextSibling;\n nNode2 = an2 ? nNode2.nextSibling : null;\n }\n i++;\n }\n }\n\n /**\n * Convert a CSS unit width to pixels (e.g. 2em)\n * @param {string} sWidth width to be converted\n * @param {node} nParent parent to get the with for (required for relative widths) - optional\n * @returns {int} iWidth width in pixels\n * @memberof DataTable#oApi\n */\n function _fnConvertToWidth(sWidth, nParent) {\n if (!sWidth || sWidth === null || sWidth === '') {\n return 0;\n }\n\n if (!nParent) {\n nParent = document.body;\n }\n\n var iWidth;\n var nTmp = document.createElement(\"div\");\n nTmp.style.width = _fnStringToCss(sWidth);\n\n nParent.appendChild(nTmp);\n iWidth = nTmp.offsetWidth;\n nParent.removeChild(nTmp);\n\n return (iWidth);\n }\n\n\n /**\n * Calculate the width of columns for the table\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnCalculateColumnWidths(oSettings) {\n var iTableWidth = oSettings.nTable.offsetWidth;\n var iUserInputs = 0;\n var iTmpWidth;\n var iVisibleColumns = 0;\n var iColums = oSettings.aoColumns.length;\n var i, iIndex, iCorrector, iWidth;\n var oHeaders = $('th', oSettings.nTHead);\n var widthAttr = oSettings.nTable.getAttribute('width');\n var nWrapper = oSettings.nTable.parentNode;\n\n /* Convert any user input sizes into pixel sizes */\n for (i = 0; i < iColums; i++) {\n if (oSettings.aoColumns[i].bVisible) {\n iVisibleColumns++;\n\n if (oSettings.aoColumns[i].sWidth !== null) {\n iTmpWidth = _fnConvertToWidth(oSettings.aoColumns[i].sWidthOrig,\n nWrapper);\n if (iTmpWidth !== null) {\n oSettings.aoColumns[i].sWidth = _fnStringToCss(iTmpWidth);\n }\n\n iUserInputs++;\n }\n }\n }\n\n /* If the number of columns in the DOM equals the number that we have to process in\n\t\t\t * DataTables, then we can use the offsets that are created by the web-browser. No custom\n\t\t\t * sizes can be set in order for this to happen, nor scrolling used\n\t\t\t */\n if (iColums == oHeaders.length && iUserInputs === 0 && iVisibleColumns == iColums &&\n oSettings.oScroll.sX === \"\" && oSettings.oScroll.sY === \"\") {\n for (i = 0; i < oSettings.aoColumns.length; i++) {\n iTmpWidth = $(oHeaders[i]).width();\n if (iTmpWidth !== null) {\n oSettings.aoColumns[i].sWidth = _fnStringToCss(iTmpWidth);\n }\n }\n } else {\n /* Otherwise we are going to have to do some calculations to get the width of each column.\n\t\t\t\t * Construct a 1 row table with the widest node in the data, and any user defined widths,\n\t\t\t\t * then insert it into the DOM and allow the browser to do all the hard work of\n\t\t\t\t * calculating table widths.\n\t\t\t\t */\n var\n nCalcTmp = oSettings.nTable.cloneNode(false),\n nTheadClone = oSettings.nTHead.cloneNode(true),\n nBody = document.createElement('tbody'),\n nTr = document.createElement('tr'),\n nDivSizing;\n\n nCalcTmp.removeAttribute(\"id\");\n nCalcTmp.appendChild(nTheadClone);\n if (oSettings.nTFoot !== null) {\n nCalcTmp.appendChild(oSettings.nTFoot.cloneNode(true));\n _fnApplyToChildren(function(n) {\n n.style.width = \"\";\n }, nCalcTmp.getElementsByTagName('tr'));\n }\n\n nCalcTmp.appendChild(nBody);\n nBody.appendChild(nTr);\n\n /* Remove any sizing that was previously applied by the styles */\n var jqColSizing = $('thead th', nCalcTmp);\n if (jqColSizing.length === 0) {\n jqColSizing = $('tbody tr:eq(0)>td', nCalcTmp);\n }\n\n /* Apply custom sizing to the cloned header */\n var nThs = _fnGetUniqueThs(oSettings, nTheadClone);\n iCorrector = 0;\n for (i = 0; i < iColums; i++) {\n var oColumn = oSettings.aoColumns[i];\n if (oColumn.bVisible && oColumn.sWidthOrig !== null && oColumn.sWidthOrig !== \"\") {\n nThs[i - iCorrector].style.width = _fnStringToCss(oColumn.sWidthOrig);\n } else if (oColumn.bVisible) {\n nThs[i - iCorrector].style.width = \"\";\n } else {\n iCorrector++;\n }\n }\n\n /* Find the biggest td for each column and put it into the table */\n for (i = 0; i < iColums; i++) {\n if (oSettings.aoColumns[i].bVisible) {\n var nTd = _fnGetWidestNode(oSettings, i);\n if (nTd !== null) {\n nTd = nTd.cloneNode(true);\n if (oSettings.aoColumns[i].sContentPadding !== \"\") {\n nTd.innerHTML += oSettings.aoColumns[i].sContentPadding;\n }\n nTr.appendChild(nTd);\n }\n }\n }\n\n /* Build the table and 'display' it */\n nWrapper.appendChild(nCalcTmp);\n\n /* When scrolling (X or Y) we want to set the width of the table as appropriate. However,\n\t\t\t\t * when not scrolling leave the table width as it is. This results in slightly different,\n\t\t\t\t * but I think correct behaviour\n\t\t\t\t */\n if (oSettings.oScroll.sX !== \"\" && oSettings.oScroll.sXInner !== \"\") {\n nCalcTmp.style.width = _fnStringToCss(oSettings.oScroll.sXInner);\n } else if (oSettings.oScroll.sX !== \"\") {\n nCalcTmp.style.width = \"\";\n if ($(nCalcTmp).width() < nWrapper.offsetWidth) {\n nCalcTmp.style.width = _fnStringToCss(nWrapper.offsetWidth);\n }\n } else if (oSettings.oScroll.sY !== \"\") {\n nCalcTmp.style.width = _fnStringToCss(nWrapper.offsetWidth);\n } else if (widthAttr) {\n nCalcTmp.style.width = _fnStringToCss(widthAttr);\n }\n nCalcTmp.style.visibility = \"hidden\";\n\n /* Scrolling considerations */\n _fnScrollingWidthAdjust(oSettings, nCalcTmp);\n\n /* Read the width's calculated by the browser and store them for use by the caller. We\n\t\t\t\t * first of all try to use the elements in the body, but it is possible that there are\n\t\t\t\t * no elements there, under which circumstances we use the header elements\n\t\t\t\t */\n var oNodes = $(\"tbody tr:eq(0)\", nCalcTmp).children();\n if (oNodes.length === 0) {\n oNodes = _fnGetUniqueThs(oSettings, $('thead', nCalcTmp)[0]);\n }\n\n /* Browsers need a bit of a hand when a width is assigned to any columns when\n\t\t\t\t * x-scrolling as they tend to collapse the table to the min-width, even if\n\t\t\t\t * we sent the column widths. So we need to keep track of what the table width\n\t\t\t\t * should be by summing the user given values, and the automatic values\n\t\t\t\t */\n if (oSettings.oScroll.sX !== \"\") {\n var iTotal = 0;\n iCorrector = 0;\n for (i = 0; i < oSettings.aoColumns.length; i++) {\n if (oSettings.aoColumns[i].bVisible) {\n if (oSettings.aoColumns[i].sWidthOrig === null) {\n iTotal += $(oNodes[iCorrector]).outerWidth();\n } else {\n iTotal += parseInt(oSettings.aoColumns[i].sWidth.replace('px', ''), 10) +\n ($(oNodes[iCorrector]).outerWidth() - $(oNodes[iCorrector]).width());\n }\n iCorrector++;\n }\n }\n\n nCalcTmp.style.width = _fnStringToCss(iTotal);\n oSettings.nTable.style.width = _fnStringToCss(iTotal);\n }\n\n iCorrector = 0;\n for (i = 0; i < oSettings.aoColumns.length; i++) {\n if (oSettings.aoColumns[i].bVisible) {\n iWidth = $(oNodes[iCorrector]).width();\n if (iWidth !== null && iWidth > 0) {\n oSettings.aoColumns[i].sWidth = _fnStringToCss(iWidth);\n }\n iCorrector++;\n }\n }\n\n var cssWidth = $(nCalcTmp).css('width');\n oSettings.nTable.style.width = (cssWidth.indexOf('%') !== -1) ?\n cssWidth : _fnStringToCss($(nCalcTmp).outerWidth());\n nCalcTmp.parentNode.removeChild(nCalcTmp);\n }\n\n if (widthAttr) {\n oSettings.nTable.style.width = _fnStringToCss(widthAttr);\n }\n }\n\n\n /**\n * Adjust a table's width to take account of scrolling\n * @param {object} oSettings dataTables settings object\n * @param {node} n table node\n * @memberof DataTable#oApi\n */\n function _fnScrollingWidthAdjust(oSettings, n) {\n if (oSettings.oScroll.sX === \"\" && oSettings.oScroll.sY !== \"\") {\n /* When y-scrolling only, we want to remove the width of the scroll bar so the table\n\t\t\t\t * + scroll bar will fit into the area avaialble.\n\t\t\t\t */\n var iOrigWidth = $(n).width();\n n.style.width = _fnStringToCss($(n).outerWidth() - oSettings.oScroll.iBarWidth);\n } else if (oSettings.oScroll.sX !== \"\") {\n /* When x-scrolling both ways, fix the table at it's current size, without adjusting */\n n.style.width = _fnStringToCss($(n).outerWidth());\n }\n }\n\n\n /**\n * Get the widest node\n * @param {object} oSettings dataTables settings object\n * @param {int} iCol column of interest\n * @returns {node} widest table node\n * @memberof DataTable#oApi\n */\n function _fnGetWidestNode(oSettings, iCol) {\n var iMaxIndex = _fnGetMaxLenString(oSettings, iCol);\n if (iMaxIndex < 0) {\n return null;\n }\n\n if (oSettings.aoData[iMaxIndex].nTr === null) {\n var n = document.createElement('td');\n n.innerHTML = _fnGetCellData(oSettings, iMaxIndex, iCol, '');\n return n;\n }\n return _fnGetTdNodes(oSettings, iMaxIndex)[iCol];\n }\n\n\n /**\n * Get the maximum strlen for each data column\n * @param {object} oSettings dataTables settings object\n * @param {int} iCol column of interest\n * @returns {string} max string length for each column\n * @memberof DataTable#oApi\n */\n function _fnGetMaxLenString(oSettings, iCol) {\n var iMax = -1;\n var iMaxIndex = -1;\n\n for (var i = 0; i < oSettings.aoData.length; i++) {\n var s = _fnGetCellData(oSettings, i, iCol, 'display') + \"\";\n s = s.replace(/<.*?>/g, \"\");\n if (s.length > iMax) {\n iMax = s.length;\n iMaxIndex = i;\n }\n }\n\n return iMaxIndex;\n }\n\n\n /**\n * Append a CSS unit (only if required) to a string\n * @param {array} aArray1 first array\n * @param {array} aArray2 second array\n * @returns {int} 0 if match, 1 if length is different, 2 if no match\n * @memberof DataTable#oApi\n */\n function _fnStringToCss(s) {\n if (s === null) {\n return \"0px\";\n }\n\n if (typeof s == 'number') {\n if (s < 0) {\n return \"0px\";\n }\n return s + \"px\";\n }\n\n /* Check if the last character is not 0-9 */\n var c = s.charCodeAt(s.length - 1);\n if (c < 0x30 || c > 0x39) {\n return s;\n }\n return s + \"px\";\n }\n\n\n /**\n * Get the width of a scroll bar in this browser being used\n * @returns {int} width in pixels\n * @memberof DataTable#oApi\n */\n function _fnScrollBarWidth() {\n var inner = document.createElement('p');\n var style = inner.style;\n style.width = \"100%\";\n style.height = \"200px\";\n style.padding = \"0px\";\n\n var outer = document.createElement('div');\n style = outer.style;\n style.position = \"absolute\";\n style.top = \"0px\";\n style.left = \"0px\";\n style.visibility = \"hidden\";\n style.width = \"200px\";\n style.height = \"150px\";\n style.padding = \"0px\";\n style.overflow = \"hidden\";\n outer.appendChild(inner);\n\n document.body.appendChild(outer);\n var w1 = inner.offsetWidth;\n outer.style.overflow = 'scroll';\n var w2 = inner.offsetWidth;\n if (w1 == w2) {\n w2 = outer.clientWidth;\n }\n\n document.body.removeChild(outer);\n return (w1 - w2);\n }\n\n /**\n * Change the order of the table\n * @param {object} oSettings dataTables settings object\n * @param {bool} bApplyClasses optional - should we apply classes or not\n * @memberof DataTable#oApi\n */\n function _fnSort(oSettings, bApplyClasses) {\n var\n i, iLen, j, jLen, k, kLen,\n sDataType, nTh,\n aaSort = [],\n aiOrig = [],\n oSort = DataTable.ext.oSort,\n aoData = oSettings.aoData,\n aoColumns = oSettings.aoColumns,\n oAria = oSettings.oLanguage.oAria;\n\n /* No sorting required if server-side or no sorting array */\n if (!oSettings.oFeatures.bServerSide &&\n (oSettings.aaSorting.length !== 0 || oSettings.aaSortingFixed !== null)) {\n aaSort = (oSettings.aaSortingFixed !== null) ?\n oSettings.aaSortingFixed.concat(oSettings.aaSorting) :\n oSettings.aaSorting.slice();\n\n /* If there is a sorting data type, and a function belonging to it, then we need to\n\t\t\t\t * get the data from the developer's function and apply it for this column\n\t\t\t\t */\n for (i = 0; i < aaSort.length; i++) {\n var iColumn = aaSort[i][0];\n var iVisColumn = _fnColumnIndexToVisible(oSettings, iColumn);\n sDataType = oSettings.aoColumns[iColumn].sSortDataType;\n if (DataTable.ext.afnSortData[sDataType]) {\n var aData = DataTable.ext.afnSortData[sDataType].call(\n oSettings.oInstance, oSettings, iColumn, iVisColumn\n );\n if (aData.length === aoData.length) {\n for (j = 0, jLen = aoData.length; j < jLen; j++) {\n _fnSetCellData(oSettings, j, iColumn, aData[j]);\n }\n } else {\n _fnLog(oSettings, 0, \"Returned data sort array (col \" + iColumn + \") is the wrong length\");\n }\n }\n }\n\n /* Create a value - key array of the current row positions such that we can use their\n\t\t\t\t * current position during the sort, if values match, in order to perform stable sorting\n\t\t\t\t */\n for (i = 0, iLen = oSettings.aiDisplayMaster.length; i < iLen; i++) {\n aiOrig[oSettings.aiDisplayMaster[i]] = i;\n }\n\n /* Build an internal data array which is specific to the sort, so we can get and prep\n\t\t\t\t * the data to be sorted only once, rather than needing to do it every time the sorting\n\t\t\t\t * function runs. This make the sorting function a very simple comparison\n\t\t\t\t */\n var iSortLen = aaSort.length;\n var fnSortFormat, aDataSort;\n for (i = 0, iLen = aoData.length; i < iLen; i++) {\n for (j = 0; j < iSortLen; j++) {\n aDataSort = aoColumns[aaSort[j][0]].aDataSort;\n\n for (k = 0, kLen = aDataSort.length; k < kLen; k++) {\n sDataType = aoColumns[aDataSort[k]].sType;\n fnSortFormat = oSort[(sDataType ? sDataType : 'string') + \"-pre\"];\n\n aoData[i]._aSortData[aDataSort[k]] = fnSortFormat ?\n fnSortFormat(_fnGetCellData(oSettings, i, aDataSort[k], 'sort')) :\n _fnGetCellData(oSettings, i, aDataSort[k], 'sort');\n }\n }\n }\n\n /* Do the sort - here we want multi-column sorting based on a given data source (column)\n\t\t\t\t * and sorting function (from oSort) in a certain direction. It's reasonably complex to\n\t\t\t\t * follow on it's own, but this is what we want (example two column sorting):\n\t\t\t\t * fnLocalSorting = function(a,b){\n\t\t\t\t * \tvar iTest;\n\t\t\t\t * \tiTest = oSort['string-asc']('data11', 'data12');\n\t\t\t\t * \tif (iTest !== 0)\n\t\t\t\t * \t\treturn iTest;\n\t\t\t\t * iTest = oSort['numeric-desc']('data21', 'data22');\n\t\t\t\t * if (iTest !== 0)\n\t\t\t\t * \t\treturn iTest;\n\t\t\t\t * \treturn oSort['numeric-asc']( aiOrig[a], aiOrig[b] );\n\t\t\t\t * }\n\t\t\t\t * Basically we have a test for each sorting column, if the data in that column is equal,\n\t\t\t\t * test the next column. If all columns match, then we use a numeric sort on the row\n\t\t\t\t * positions in the original data array to provide a stable sort.\n\t\t\t\t */\n oSettings.aiDisplayMaster.sort(function(a, b) {\n var k, l, lLen, iTest, aDataSort, sDataType;\n for (k = 0; k < iSortLen; k++) {\n aDataSort = aoColumns[aaSort[k][0]].aDataSort;\n\n for (l = 0, lLen = aDataSort.length; l < lLen; l++) {\n sDataType = aoColumns[aDataSort[l]].sType;\n\n iTest = oSort[(sDataType ? sDataType : 'string') + \"-\" + aaSort[k][1]](\n aoData[a]._aSortData[aDataSort[l]],\n aoData[b]._aSortData[aDataSort[l]]\n );\n\n if (iTest !== 0) {\n return iTest;\n }\n }\n }\n\n return oSort['numeric-asc'](aiOrig[a], aiOrig[b]);\n });\n }\n\n /* Alter the sorting classes to take account of the changes */\n if ((bApplyClasses === undefined || bApplyClasses) && !oSettings.oFeatures.bDeferRender) {\n _fnSortingClasses(oSettings);\n }\n\n for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n var sTitle = aoColumns[i].sTitle.replace(/<.*?>/g, \"\");\n nTh = aoColumns[i].nTh;\n nTh.removeAttribute('aria-sort');\n nTh.removeAttribute('aria-label');\n\n /* In ARIA only the first sorting column can be marked as sorting - no multi-sort option */\n if (aoColumns[i].bSortable) {\n if (aaSort.length > 0 && aaSort[0][0] == i) {\n nTh.setAttribute('aria-sort', aaSort[0][1] == \"asc\" ? \"ascending\" : \"descending\");\n\n var nextSort = (aoColumns[i].asSorting[aaSort[0][2] + 1]) ?\n aoColumns[i].asSorting[aaSort[0][2] + 1] : aoColumns[i].asSorting[0];\n nTh.setAttribute('aria-label', sTitle +\n (nextSort == \"asc\" ? oAria.sSortAscending : oAria.sSortDescending));\n } else {\n nTh.setAttribute('aria-label', sTitle +\n (aoColumns[i].asSorting[0] == \"asc\" ? oAria.sSortAscending : oAria.sSortDescending));\n }\n } else {\n nTh.setAttribute('aria-label', sTitle);\n }\n }\n\n /* Tell the draw function that we have sorted the data */\n oSettings.bSorted = true;\n $(oSettings.oInstance).trigger('sort', oSettings);\n\n /* Copy the master data into the draw array and re-draw */\n if (oSettings.oFeatures.bFilter) {\n /* _fnFilter() will redraw the table for us */\n _fnFilterComplete(oSettings, oSettings.oPreviousSearch, 1);\n } else {\n oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n oSettings._iDisplayStart = 0; /* reset display back to page 0 */\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n }\n }\n\n\n /**\n * Attach a sort handler (click) to a node\n * @param {object} oSettings dataTables settings object\n * @param {node} nNode node to attach the handler to\n * @param {int} iDataIndex column sorting index\n * @param {function} [fnCallback] callback function\n * @memberof DataTable#oApi\n */\n function _fnSortAttachListener(oSettings, nNode, iDataIndex, fnCallback) {\n _fnBindAction(nNode, {}, function(e) {\n /* If the column is not sortable - don't to anything */\n if (oSettings.aoColumns[iDataIndex].bSortable === false) {\n return;\n }\n\n /*\n\t\t\t\t * This is a little bit odd I admit... I declare a temporary function inside the scope of\n\t\t\t\t * _fnBuildHead and the click handler in order that the code presented here can be used\n\t\t\t\t * twice - once for when bProcessing is enabled, and another time for when it is\n\t\t\t\t * disabled, as we need to perform slightly different actions.\n\t\t\t\t * Basically the issue here is that the Javascript engine in modern browsers don't\n\t\t\t\t * appear to allow the rendering engine to update the display while it is still executing\n\t\t\t\t * it's thread (well - it does but only after long intervals). This means that the\n\t\t\t\t * 'processing' display doesn't appear for a table sort. To break the js thread up a bit\n\t\t\t\t * I force an execution break by using setTimeout - but this breaks the expected\n\t\t\t\t * thread continuation for the end-developer's point of view (their code would execute\n\t\t\t\t * too early), so we only do it when we absolutely have to.\n\t\t\t\t */\n var fnInnerSorting = function() {\n var iColumn, iNextSort;\n\n /* If the shift key is pressed then we are multiple column sorting */\n if (e.shiftKey) {\n /* Are we already doing some kind of sort on this column? */\n var bFound = false;\n for (var i = 0; i < oSettings.aaSorting.length; i++) {\n if (oSettings.aaSorting[i][0] == iDataIndex) {\n bFound = true;\n iColumn = oSettings.aaSorting[i][0];\n iNextSort = oSettings.aaSorting[i][2] + 1;\n\n if (!oSettings.aoColumns[iColumn].asSorting[iNextSort]) {\n /* Reached the end of the sorting options, remove from multi-col sort */\n oSettings.aaSorting.splice(i, 1);\n } else {\n /* Move onto next sorting direction */\n oSettings.aaSorting[i][1] = oSettings.aoColumns[iColumn].asSorting[iNextSort];\n oSettings.aaSorting[i][2] = iNextSort;\n }\n break;\n }\n }\n\n /* No sort yet - add it in */\n if (bFound === false) {\n oSettings.aaSorting.push([iDataIndex,\n oSettings.aoColumns[iDataIndex].asSorting[0], 0]);\n }\n } else {\n /* If no shift key then single column sort */\n if (oSettings.aaSorting.length == 1 && oSettings.aaSorting[0][0] == iDataIndex) {\n iColumn = oSettings.aaSorting[0][0];\n iNextSort = oSettings.aaSorting[0][2] + 1;\n if (!oSettings.aoColumns[iColumn].asSorting[iNextSort]) {\n iNextSort = 0;\n }\n oSettings.aaSorting[0][1] = oSettings.aoColumns[iColumn].asSorting[iNextSort];\n oSettings.aaSorting[0][2] = iNextSort;\n } else {\n oSettings.aaSorting.splice(0, oSettings.aaSorting.length);\n oSettings.aaSorting.push([iDataIndex,\n oSettings.aoColumns[iDataIndex].asSorting[0], 0]);\n }\n }\n\n /* Run the sort */\n _fnSort(oSettings);\n }; /* /fnInnerSorting */\n\n if (!oSettings.oFeatures.bProcessing) {\n fnInnerSorting();\n } else {\n _fnProcessingDisplay(oSettings, true);\n setTimeout(function() {\n fnInnerSorting();\n if (!oSettings.oFeatures.bServerSide) {\n _fnProcessingDisplay(oSettings, false);\n }\n }, 0);\n }\n\n /* Call the user specified callback function - used for async user interaction */\n if (typeof fnCallback == 'function') {\n fnCallback(oSettings);\n }\n });\n }\n\n\n /**\n * Set the sorting classes on the header, Note: it is safe to call this function\n * when bSort and bSortClasses are false\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnSortingClasses(oSettings) {\n var i, iLen, j, jLen, iFound;\n var aaSort, sClass;\n var iColumns = oSettings.aoColumns.length;\n var oClasses = oSettings.oClasses;\n\n for (i = 0; i < iColumns; i++) {\n if (oSettings.aoColumns[i].bSortable) {\n $(oSettings.aoColumns[i].nTh).removeClass(oClasses.sSortAsc + \" \" + oClasses.sSortDesc +\n \" \" + oSettings.aoColumns[i].sSortingClass);\n }\n }\n\n if (oSettings.aaSortingFixed !== null) {\n aaSort = oSettings.aaSortingFixed.concat(oSettings.aaSorting);\n } else {\n aaSort = oSettings.aaSorting.slice();\n }\n\n /* Apply the required classes to the header */\n for (i = 0; i < oSettings.aoColumns.length; i++) {\n if (oSettings.aoColumns[i].bSortable) {\n sClass = oSettings.aoColumns[i].sSortingClass;\n iFound = -1;\n for (j = 0; j < aaSort.length; j++) {\n if (aaSort[j][0] == i) {\n sClass = (aaSort[j][1] == \"asc\") ?\n oClasses.sSortAsc : oClasses.sSortDesc;\n iFound = j;\n break;\n }\n }\n $(oSettings.aoColumns[i].nTh).addClass(sClass);\n\n if (oSettings.bJUI) {\n /* jQuery UI uses extra markup */\n var jqSpan = $(\"span.\" + oClasses.sSortIcon, oSettings.aoColumns[i].nTh);\n jqSpan.removeClass(oClasses.sSortJUIAsc + \" \" + oClasses.sSortJUIDesc + \" \" +\n oClasses.sSortJUI + \" \" + oClasses.sSortJUIAscAllowed + \" \" + oClasses.sSortJUIDescAllowed);\n\n var sSpanClass;\n if (iFound == -1) {\n sSpanClass = oSettings.aoColumns[i].sSortingClassJUI;\n } else if (aaSort[iFound][1] == \"asc\") {\n sSpanClass = oClasses.sSortJUIAsc;\n } else {\n sSpanClass = oClasses.sSortJUIDesc;\n }\n\n jqSpan.addClass(sSpanClass);\n }\n } else {\n /* No sorting on this column, so add the base class. This will have been assigned by\n\t\t\t\t\t * _fnAddColumn\n\t\t\t\t\t */\n $(oSettings.aoColumns[i].nTh).addClass(oSettings.aoColumns[i].sSortingClass);\n }\n }\n\n /*\n\t\t\t * Apply the required classes to the table body\n\t\t\t * Note that this is given as a feature switch since it can significantly slow down a sort\n\t\t\t * on large data sets (adding and removing of classes is always slow at the best of times..)\n\t\t\t * Further to this, note that this code is admittedly fairly ugly. It could be made a lot\n\t\t\t * simpler using jQuery selectors and add/removeClass, but that is significantly slower\n\t\t\t * (on the order of 5 times slower) - hence the direct DOM manipulation here.\n\t\t\t * Note that for deferred drawing we do use jQuery - the reason being that taking the first\n\t\t\t * row found to see if the whole column needs processed can miss classes since the first\n\t\t\t * column might be new.\n\t\t\t */\n sClass = oClasses.sSortColumn;\n\n if (oSettings.oFeatures.bSort && oSettings.oFeatures.bSortClasses) {\n var nTds = _fnGetTdNodes(oSettings);\n\n /* Determine what the sorting class for each column should be */\n var iClass, iTargetCol;\n var asClasses = [];\n for (i = 0; i < iColumns; i++) {\n asClasses.push(\"\");\n }\n for (i = 0, iClass = 1; i < aaSort.length; i++) {\n iTargetCol = parseInt(aaSort[i][0], 10);\n asClasses[iTargetCol] = sClass + iClass;\n\n if (iClass < 3) {\n iClass++;\n }\n }\n\n /* Make changes to the classes for each cell as needed */\n var reClass = new RegExp(sClass + \"[123]\");\n var sTmpClass, sCurrentClass, sNewClass;\n for (i = 0, iLen = nTds.length; i < iLen; i++) {\n /* Determine which column we're looking at */\n iTargetCol = i % iColumns;\n\n /* What is the full list of classes now */\n sCurrentClass = nTds[i].className;\n /* What sorting class should be applied? */\n sNewClass = asClasses[iTargetCol];\n /* What would the new full list be if we did a replacement? */\n sTmpClass = sCurrentClass.replace(reClass, sNewClass);\n\n if (sTmpClass != sCurrentClass) {\n /* We changed something */\n nTds[i].className = $.trim(sTmpClass);\n } else if (sNewClass.length > 0 && sCurrentClass.indexOf(sNewClass) == -1) {\n /* We need to add a class */\n nTds[i].className = sCurrentClass + \" \" + sNewClass;\n }\n }\n }\n }\n\n\n /**\n * Save the state of a table in a cookie such that the page can be reloaded\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnSaveState(oSettings) {\n if (!oSettings.oFeatures.bStateSave || oSettings.bDestroying) {\n return;\n }\n\n /* Store the interesting variables */\n var i, iLen, bInfinite = oSettings.oScroll.bInfinite;\n var oState = {\n \"iCreate\": new Date().getTime(),\n \"iStart\": (bInfinite ? 0 : oSettings._iDisplayStart),\n \"iEnd\": (bInfinite ? oSettings._iDisplayLength : oSettings._iDisplayEnd),\n \"iLength\": oSettings._iDisplayLength,\n \"aaSorting\": $.extend(true, [], oSettings.aaSorting),\n \"oSearch\": $.extend(true, {}, oSettings.oPreviousSearch),\n \"aoSearchCols\": $.extend(true, [], oSettings.aoPreSearchCols),\n \"abVisCols\": []\n };\n\n for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n oState.abVisCols.push(oSettings.aoColumns[i].bVisible);\n }\n\n _fnCallbackFire(oSettings, \"aoStateSaveParams\", 'stateSaveParams', [oSettings, oState]);\n\n oSettings.fnStateSave.call(oSettings.oInstance, oSettings, oState);\n }\n\n\n /**\n * Attempt to load a saved table state from a cookie\n * @param {object} oSettings dataTables settings object\n * @param {object} oInit DataTables init object so we can override settings\n * @memberof DataTable#oApi\n */\n function _fnLoadState(oSettings, oInit) {\n if (!oSettings.oFeatures.bStateSave) {\n return;\n }\n\n var oData = oSettings.fnStateLoad.call(oSettings.oInstance, oSettings);\n if (!oData) {\n return;\n }\n\n /* Allow custom and plug-in manipulation functions to alter the saved data set and\n\t\t\t * cancelling of loading by returning false\n\t\t\t */\n var abStateLoad = _fnCallbackFire(oSettings, 'aoStateLoadParams', 'stateLoadParams', [oSettings, oData]);\n if ($.inArray(false, abStateLoad) !== -1) {\n return;\n }\n\n /* Store the saved state so it might be accessed at any time */\n oSettings.oLoadedState = $.extend(true, {}, oData);\n\n /* Restore key features */\n oSettings._iDisplayStart = oData.iStart;\n oSettings.iInitDisplayStart = oData.iStart;\n oSettings._iDisplayEnd = oData.iEnd;\n oSettings._iDisplayLength = oData.iLength;\n oSettings.aaSorting = oData.aaSorting.slice();\n oSettings.saved_aaSorting = oData.aaSorting.slice();\n\n /* Search filtering */\n $.extend(oSettings.oPreviousSearch, oData.oSearch);\n $.extend(true, oSettings.aoPreSearchCols, oData.aoSearchCols);\n\n /* Column visibility state\n\t\t\t * Pass back visibility settings to the init handler, but to do not here override\n\t\t\t * the init object that the user might have passed in\n\t\t\t */\n oInit.saved_aoColumns = [];\n for (var i = 0; i < oData.abVisCols.length; i++) {\n oInit.saved_aoColumns[i] = {};\n oInit.saved_aoColumns[i].bVisible = oData.abVisCols[i];\n }\n\n _fnCallbackFire(oSettings, 'aoStateLoaded', 'stateLoaded', [oSettings, oData]);\n }\n\n\n /**\n * Create a new cookie with a value to store the state of a table\n * @param {string} sName name of the cookie to create\n * @param {string} sValue the value the cookie should take\n * @param {int} iSecs duration of the cookie\n * @param {string} sBaseName sName is made up of the base + file name - this is the base\n * @param {function} fnCallback User definable function to modify the cookie\n * @memberof DataTable#oApi\n */\n function _fnCreateCookie(sName, sValue, iSecs, sBaseName, fnCallback) {\n var date = new Date();\n date.setTime(date.getTime() + (iSecs * 1000));\n\n /*\n\t\t\t * Shocking but true - it would appear IE has major issues with having the path not having\n\t\t\t * a trailing slash on it. We need the cookie to be available based on the path, so we\n\t\t\t * have to append the file name to the cookie name. Appalling. Thanks to vex for adding the\n\t\t\t * patch to use at least some of the path\n\t\t\t */\n var aParts = window.location.pathname.split('/');\n var sNameFile = sName + '_' + aParts.pop().replace(/[\\/:]/g, \"\").toLowerCase();\n var sFullCookie, oData;\n\n if (fnCallback !== null) {\n oData = (typeof $.parseJSON === 'function') ?\n $.parseJSON(sValue) : eval('(' + sValue + ')');\n sFullCookie = fnCallback(sNameFile, oData, date.toGMTString(),\n aParts.join('/') + \"/\");\n } else {\n sFullCookie = sNameFile + \"=\" + encodeURIComponent(sValue) +\n \"; expires=\" + date.toGMTString() + \"; path=\" + aParts.join('/') + \"/\";\n }\n\n /* Are we going to go over the cookie limit of 4KiB? If so, try to delete a cookies\n\t\t\t * belonging to DataTables.\n\t\t\t */\n var\n aCookies = document.cookie.split(';'),\n iNewCookieLen = sFullCookie.split(';')[0].length,\n aOldCookies = [];\n\n if (iNewCookieLen + document.cookie.length + 10 > 4096) /* Magic 10 for padding */\n {\n for (var i = 0, iLen = aCookies.length; i < iLen; i++) {\n if (aCookies[i].indexOf(sBaseName) != -1) {\n /* It's a DataTables cookie, so eval it and check the time stamp */\n var aSplitCookie = aCookies[i].split('=');\n try {\n oData = eval('(' + decodeURIComponent(aSplitCookie[1]) + ')');\n\n if (oData && oData.iCreate) {\n aOldCookies.push({\n \"name\": aSplitCookie[0],\n \"time\": oData.iCreate\n });\n }\n } catch (e) {\n }\n }\n }\n\n // Make sure we delete the oldest ones first\n aOldCookies.sort(function(a, b) {\n return b.time - a.time;\n });\n\n // Eliminate as many old DataTables cookies as we need to\n while (iNewCookieLen + document.cookie.length + 10 > 4096) {\n if (aOldCookies.length === 0) {\n // Deleted all DT cookies and still not enough space. Can't state save\n return;\n }\n\n var old = aOldCookies.pop();\n document.cookie = old.name + \"=; expires=Thu, 01-Jan-1970 00:00:01 GMT; path=\" +\n aParts.join('/') + \"/\";\n }\n }\n\n document.cookie = sFullCookie;\n }\n\n\n /**\n * Read an old cookie to get a cookie with an old table state\n * @param {string} sName name of the cookie to read\n * @returns {string} contents of the cookie - or null if no cookie with that name found\n * @memberof DataTable#oApi\n */\n function _fnReadCookie(sName) {\n var\n aParts = window.location.pathname.split('/'),\n sNameEQ = sName + '_' + aParts[aParts.length - 1].replace(/[\\/:]/g, \"\").toLowerCase() + '=',\n sCookieContents = document.cookie.split(';');\n\n for (var i = 0; i < sCookieContents.length; i++) {\n var c = sCookieContents[i];\n\n while (c.charAt(0) == ' ') {\n c = c.substring(1, c.length);\n }\n\n if (c.indexOf(sNameEQ) === 0) {\n return decodeURIComponent(c.substring(sNameEQ.length, c.length));\n }\n }\n return null;\n }\n\n\n /**\n * Return the settings object for a particular table\n * @param {node} nTable table we are using as a dataTable\n * @returns {object} Settings object - or null if not found\n * @memberof DataTable#oApi\n */\n function _fnSettingsFromNode(nTable) {\n for (var i = 0; i < DataTable.settings.length; i++) {\n if (DataTable.settings[i].nTable === nTable) {\n return DataTable.settings[i];\n }\n }\n\n return null;\n }\n\n\n /**\n * Return an array with the TR nodes for the table\n * @param {object} oSettings dataTables settings object\n * @returns {array} TR array\n * @memberof DataTable#oApi\n */\n function _fnGetTrNodes(oSettings) {\n var aNodes = [];\n var aoData = oSettings.aoData;\n for (var i = 0, iLen = aoData.length; i < iLen; i++) {\n if (aoData[i].nTr !== null) {\n aNodes.push(aoData[i].nTr);\n }\n }\n return aNodes;\n }\n\n\n /**\n * Return an flat array with all TD nodes for the table, or row\n * @param {object} oSettings dataTables settings object\n * @param {int} [iIndividualRow] aoData index to get the nodes for - optional\n * if not given then the return array will contain all nodes for the table\n * @returns {array} TD array\n * @memberof DataTable#oApi\n */\n function _fnGetTdNodes(oSettings, iIndividualRow) {\n var anReturn = [];\n var iCorrector;\n var anTds, nTd;\n var iRow, iRows = oSettings.aoData.length,\n iColumn, iColumns, oData, sNodeName, iStart = 0, iEnd = iRows;\n\n /* Allow the collection to be limited to just one row */\n if (iIndividualRow !== undefined) {\n iStart = iIndividualRow;\n iEnd = iIndividualRow + 1;\n }\n\n for (iRow = iStart; iRow < iEnd; iRow++) {\n oData = oSettings.aoData[iRow];\n if (oData.nTr !== null) {\n /* get the TD child nodes - taking into account text etc nodes */\n anTds = [];\n nTd = oData.nTr.firstChild;\n while (nTd) {\n sNodeName = nTd.nodeName.toLowerCase();\n if (sNodeName == 'td' || sNodeName == 'th') {\n anTds.push(nTd);\n }\n nTd = nTd.nextSibling;\n }\n\n iCorrector = 0;\n for (iColumn = 0, iColumns = oSettings.aoColumns.length; iColumn < iColumns; iColumn++) {\n if (oSettings.aoColumns[iColumn].bVisible) {\n anReturn.push(anTds[iColumn - iCorrector]);\n } else {\n anReturn.push(oData._anHidden[iColumn]);\n iCorrector++;\n }\n }\n }\n }\n\n return anReturn;\n }\n\n\n /**\n * Log an error message\n * @param {object} oSettings dataTables settings object\n * @param {int} iLevel log error messages, or display them to the user\n * @param {string} sMesg error message\n * @memberof DataTable#oApi\n */\n function _fnLog(oSettings, iLevel, sMesg) {\n var sAlert = (oSettings === null) ?\n \"DataTables warning: \" + sMesg :\n \"DataTables warning (table id = '\" + oSettings.sTableId + \"'): \" + sMesg;\n\n if (iLevel === 0) {\n if (DataTable.ext.sErrMode == 'alert') {\n alert(sAlert);\n } else {\n throw new Error(sAlert);\n }\n return;\n } else if (window.console && console.log) {\n console.log(sAlert);\n }\n }\n\n\n /**\n * See if a property is defined on one object, if so assign it to the other object\n * @param {object} oRet target object\n * @param {object} oSrc source object\n * @param {string} sName property\n * @param {string} [sMappedName] name to map too - optional, sName used if not given\n * @memberof DataTable#oApi\n */\n function _fnMap(oRet, oSrc, sName, sMappedName) {\n if (sMappedName === undefined) {\n sMappedName = sName;\n }\n if (oSrc[sName] !== undefined) {\n oRet[sMappedName] = oSrc[sName];\n }\n }\n\n\n /**\n * Extend objects - very similar to jQuery.extend, but deep copy objects, and shallow\n * copy arrays. The reason we need to do this, is that we don't want to deep copy array\n * init values (such as aaSorting) since the dev wouldn't be able to override them, but\n * we do want to deep copy arrays.\n * @param {object} oOut Object to extend\n * @param {object} oExtender Object from which the properties will be applied to oOut\n * @returns {object} oOut Reference, just for convenience - oOut === the return.\n * @memberof DataTable#oApi\n * @todo This doesn't take account of arrays inside the deep copied objects.\n */\n function _fnExtend(oOut, oExtender) {\n var val;\n\n for (var prop in oExtender) {\n if (oExtender.hasOwnProperty(prop)) {\n val = oExtender[prop];\n\n if (typeof oInit[prop] === 'object' && val !== null && $.isArray(val) === false) {\n $.extend(true, oOut[prop], val);\n } else {\n oOut[prop] = val;\n }\n }\n }\n\n return oOut;\n }\n\n\n /**\n * Bind an event handers to allow a click or return key to activate the callback.\n * This is good for accessibility since a return on the keyboard will have the\n * same effect as a click, if the element has focus.\n * @param {element} n Element to bind the action to\n * @param {object} oData Data object to pass to the triggered function\n * @param {function} fn Callback function for when the event is triggered\n * @memberof DataTable#oApi\n */\n function _fnBindAction(n, oData, fn) {\n $(n)\n .bind('click.DT', oData, function(e) {\n n.blur(); // Remove focus outline for mouse users\n fn(e);\n })\n .bind('keypress.DT', oData, function(e) {\n if (e.which === 13) {\n fn(e);\n }\n })\n .bind('selectstart.DT', function() {\n /* Take the brutal approach to cancelling text selection */\n return false;\n });\n }\n\n\n /**\n * Register a callback function. Easily allows a callback function to be added to\n * an array store of callback functions that can then all be called together.\n * @param {object} oSettings dataTables settings object\n * @param {string} sStore Name of the array storage for the callbacks in oSettings\n * @param {function} fn Function to be called back\n * @param {string} sName Identifying name for the callback (i.e. a label)\n * @memberof DataTable#oApi\n */\n function _fnCallbackReg(oSettings, sStore, fn, sName) {\n if (fn) {\n oSettings[sStore].push({\n \"fn\": fn,\n \"sName\": sName\n });\n }\n }\n\n\n /**\n * Fire callback functions and trigger events. Note that the loop over the callback\n * array store is done backwards! Further note that you do not want to fire off triggers\n * in time sensitive applications (for example cell creation) as its slow.\n * @param {object} oSettings dataTables settings object\n * @param {string} sStore Name of the array storage for the callbacks in oSettings\n * @param {string} sTrigger Name of the jQuery custom event to trigger. If null no trigger\n * is fired\n * @param {array} aArgs Array of arguments to pass to the callback function / trigger\n * @memberof DataTable#oApi\n */\n function _fnCallbackFire(oSettings, sStore, sTrigger, aArgs) {\n var aoStore = oSettings[sStore];\n var aRet = [];\n\n for (var i = aoStore.length - 1; i >= 0; i--) {\n aRet.push(aoStore[i].fn.apply(oSettings.oInstance, aArgs));\n }\n\n if (sTrigger !== null) {\n $(oSettings.oInstance).trigger(sTrigger, aArgs);\n }\n\n return aRet;\n }\n\n\n /**\n * JSON stringify. If JSON.stringify it provided by the browser, json2.js or any other\n * library, then we use that as it is fast, safe and accurate. If the function isn't\n * available then we need to built it ourselves - the inspiration for this function comes\n * from Craig Buckler ( http://www.sitepoint.com/javascript-json-serialization/ ). It is\n * not perfect and absolutely should not be used as a replacement to json2.js - but it does\n * do what we need, without requiring a dependency for DataTables.\n * @param {object} o JSON object to be converted\n * @returns {string} JSON string\n * @memberof DataTable#oApi\n */\n var _fnJsonString = (window.JSON) ? JSON.stringify : function(o) {\n /* Not an object or array */\n var sType = typeof o;\n if (sType !== \"object\" || o === null) {\n // simple data type\n if (sType === \"string\") {\n o = '\"' + o + '\"';\n }\n return o + \"\";\n }\n\n /* If object or array, need to recurse over it */\n var\n sProp, mValue,\n json = [],\n bArr = $.isArray(o);\n\n for (sProp in o) {\n mValue = o[sProp];\n sType = typeof mValue;\n\n if (sType === \"string\") {\n mValue = '\"' + mValue + '\"';\n } else if (sType === \"object\" && mValue !== null) {\n mValue = _fnJsonString(mValue);\n }\n\n json.push((bArr ? \"\" : '\"' + sProp + '\":') + mValue);\n }\n\n return (bArr ? \"[\" : \"{\") + json + (bArr ? \"]\" : \"}\");\n };\n\n\n /**\n * From some browsers (specifically IE6/7) we need special handling to work around browser\n * bugs - this function is used to detect when these workarounds are needed.\n * @param {object} oSettings dataTables settings object\n * @memberof DataTable#oApi\n */\n function _fnBrowserDetect(oSettings) {\n /* IE6/7 will oversize a width 100% element inside a scrolling element, to include the\n\t\t\t * width of the scrollbar, while other browsers ensure the inner element is contained\n\t\t\t * without forcing scrolling\n\t\t\t */\n var n = $(\n '
' +\n '
' +\n '
' +\n '
' +\n '
')[0];\n\n document.body.appendChild(n);\n oSettings.oBrowser.bScrollOversize = $('#DT_BrowserTest', n)[0].offsetWidth === 100 ? true : false;\n document.body.removeChild(n);\n }\n\n\n /**\n * Perform a jQuery selector action on the table's TR elements (from the tbody) and\n * return the resulting jQuery object.\n * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on\n * @param {object} [oOpts] Optional parameters for modifying the rows to be included\n * @param {string} [oOpts.filter=none] Select TR elements that meet the current filter\n * criterion (\"applied\") or all TR elements (i.e. no filter).\n * @param {string} [oOpts.order=current] Order of the TR elements in the processed array.\n * Can be either 'current', whereby the current sorting of the table is used, or\n * 'original' whereby the original order the data was read into the table is used.\n * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page\n * (\"current\") or not (\"all\"). If 'current' is given, then order is assumed to be\n * 'current' and filter is 'applied', regardless of what they might be given as.\n * @returns {object} jQuery object, filtered by the given selector.\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Highlight every second row\n * oTable.$('tr:odd').css('backgroundColor', 'blue');\n * } );\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Filter to rows with 'Webkit' in them, add a background colour and then\n * // remove the filter, thus highlighting the 'Webkit' rows only.\n * oTable.fnFilter('Webkit');\n * oTable.$('tr', {\"filter\": \"applied\"}).css('backgroundColor', 'blue');\n * oTable.fnFilter('');\n * } );\n */\n this.$ = function(sSelector, oOpts) {\n var i, iLen, a = [], tr;\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n var aoData = oSettings.aoData;\n var aiDisplay = oSettings.aiDisplay;\n var aiDisplayMaster = oSettings.aiDisplayMaster;\n\n if (!oOpts) {\n oOpts = {};\n }\n\n oOpts = $.extend({}, {\n \"filter\": \"none\", // applied\n \"order\": \"current\", // \"original\"\n \"page\": \"all\" // current\n }, oOpts);\n\n // Current page implies that order=current and fitler=applied, since it is fairly\n // senseless otherwise\n if (oOpts.page == 'current') {\n for (i = oSettings._iDisplayStart, iLen = oSettings.fnDisplayEnd(); i < iLen; i++) {\n tr = aoData[aiDisplay[i]].nTr;\n if (tr) {\n a.push(tr);\n }\n }\n } else if (oOpts.order == \"current\" && oOpts.filter == \"none\") {\n for (i = 0, iLen = aiDisplayMaster.length; i < iLen; i++) {\n tr = aoData[aiDisplayMaster[i]].nTr;\n if (tr) {\n a.push(tr);\n }\n }\n } else if (oOpts.order == \"current\" && oOpts.filter == \"applied\") {\n for (i = 0, iLen = aiDisplay.length; i < iLen; i++) {\n tr = aoData[aiDisplay[i]].nTr;\n if (tr) {\n a.push(tr);\n }\n }\n } else if (oOpts.order == \"original\" && oOpts.filter == \"none\") {\n for (i = 0, iLen = aoData.length; i < iLen; i++) {\n tr = aoData[i].nTr;\n if (tr) {\n a.push(tr);\n }\n }\n } else if (oOpts.order == \"original\" && oOpts.filter == \"applied\") {\n for (i = 0, iLen = aoData.length; i < iLen; i++) {\n tr = aoData[i].nTr;\n if ($.inArray(i, aiDisplay) !== -1 && tr) {\n a.push(tr);\n }\n }\n } else {\n _fnLog(oSettings, 1, \"Unknown selection options\");\n }\n\n /* We need to filter on the TR elements and also 'find' in their descendants\n\t\t\t * to make the selector act like it would in a full table - so we need\n\t\t\t * to build both results and then combine them together\n\t\t\t */\n var jqA = $(a);\n var jqTRs = jqA.filter(sSelector);\n var jqDescendants = jqA.find(sSelector);\n\n return $([].concat($.makeArray(jqTRs), $.makeArray(jqDescendants)));\n };\n\n\n /**\n * Almost identical to $ in operation, but in this case returns the data for the matched\n * rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes\n * rather than any descendants, so the data can be obtained for the row/cell. If matching\n * rows are found, the data returned is the original data array/object that was used to\n * create the row (or a generated array if from a DOM source).\n *\n * This method is often useful in-combination with $ where both functions are given the\n * same parameters and the array indexes will match identically.\n * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on\n * @param {object} [oOpts] Optional parameters for modifying the rows to be included\n * @param {string} [oOpts.filter=none] Select elements that meet the current filter\n * criterion (\"applied\") or all elements (i.e. no filter).\n * @param {string} [oOpts.order=current] Order of the data in the processed array.\n * Can be either 'current', whereby the current sorting of the table is used, or\n * 'original' whereby the original order the data was read into the table is used.\n * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page\n * (\"current\") or not (\"all\"). If 'current' is given, then order is assumed to be\n * 'current' and filter is 'applied', regardless of what they might be given as.\n * @returns {array} Data for the matched elements. If any elements, as a result of the\n * selector, were not TR, TD or TH elements in the DataTable, they will have a null\n * entry in the array.\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Get the data from the first row in the table\n * var data = oTable._('tr:first');\n *\n * // Do something useful with the data\n * alert( \"First cell is: \"+data[0] );\n * } );\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Filter to 'Webkit' and get all data for\n * oTable.fnFilter('Webkit');\n * var data = oTable._('tr', {\"filter\": \"applied\"});\n *\n * // Do something with the data\n * alert( data.length+\" rows matched the filter\" );\n * } );\n */\n this._ = function(sSelector, oOpts) {\n var aOut = [];\n var i, iLen, iIndex;\n var aTrs = this.$(sSelector, oOpts);\n\n for (i = 0, iLen = aTrs.length; i < iLen; i++) {\n aOut.push(this.fnGetData(aTrs[i]));\n }\n\n return aOut;\n };\n\n\n /**\n * Add a single new row or multiple rows of data to the table. Please note\n * that this is suitable for client-side processing only - if you are using\n * server-side processing (i.e. \"bServerSide\": true), then to add data, you\n * must add it to the data source, i.e. the server-side, through an Ajax call.\n * @param {array|object} mData The data to be added to the table. This can be:\n *
    \n *
  • 1D array of data - add a single row with the data provided
  • \n *
  • 2D array of arrays - add multiple rows in a single call
  • \n *
  • object - data object when using mData
  • \n *
  • array of objects - multiple data objects when using mData
  • \n *
\n * @param {bool} [bRedraw=true] redraw the table or not\n * @returns {array} An array of integers, representing the list of indexes in\n * aoData ({@link DataTable.models.oSettings}) that have been added to\n * the table.\n * @dtopt API\n *\n * @example\n * // Global var for counter\n * var giCount = 2;\n *\n * $(document).ready(function() {\n * $('#example').dataTable();\n * } );\n *\n * function fnClickAddRow() {\n * $('#example').dataTable().fnAddData( [\n * giCount+\".1\",\n * giCount+\".2\",\n * giCount+\".3\",\n * giCount+\".4\" ]\n * );\n *\n * giCount++;\n * }\n */\n this.fnAddData = function(mData, bRedraw) {\n if (mData.length === 0) {\n return [];\n }\n\n var aiReturn = [];\n var iTest;\n\n /* Find settings from table node */\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n\n /* Check if we want to add multiple rows or not */\n if (typeof mData[0] === \"object\" && mData[0] !== null) {\n for (var i = 0; i < mData.length; i++) {\n iTest = _fnAddData(oSettings, mData[i]);\n if (iTest == -1) {\n return aiReturn;\n }\n aiReturn.push(iTest);\n }\n } else {\n iTest = _fnAddData(oSettings, mData);\n if (iTest == -1) {\n return aiReturn;\n }\n aiReturn.push(iTest);\n }\n\n oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n\n if (bRedraw === undefined || bRedraw) {\n _fnReDraw(oSettings);\n }\n return aiReturn;\n };\n\n\n /**\n * This function will make DataTables recalculate the column sizes, based on the data\n * contained in the table and the sizes applied to the columns (in the DOM, CSS or\n * through the sWidth parameter). This can be useful when the width of the table's\n * parent element changes (for example a window resize).\n * @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable( {\n * \"sScrollY\": \"200px\",\n * \"bPaginate\": false\n * } );\n *\n * $(window).bind('resize', function () {\n * oTable.fnAdjustColumnSizing();\n * } );\n * } );\n */\n this.fnAdjustColumnSizing = function(bRedraw) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n _fnAdjustColumnSizing(oSettings);\n\n if (bRedraw === undefined || bRedraw) {\n this.fnDraw(false);\n } else if (oSettings.oScroll.sX !== \"\" || oSettings.oScroll.sY !== \"\") {\n /* If not redrawing, but scrolling, we want to apply the new column sizes anyway */\n this.oApi._fnScrollDraw(oSettings);\n }\n };\n\n\n /**\n * Quickly and simply clear a table\n * @param {bool} [bRedraw=true] redraw the table or not\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...)\n * oTable.fnClearTable();\n * } );\n */\n this.fnClearTable = function(bRedraw) {\n /* Find settings from table node */\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n _fnClearTable(oSettings);\n\n if (bRedraw === undefined || bRedraw) {\n _fnDraw(oSettings);\n }\n };\n\n\n /**\n * The exact opposite of 'opening' a row, this function will close any rows which\n * are currently 'open'.\n * @param {node} nTr the table row to 'close'\n * @returns {int} 0 on success, or 1 if failed (can't find the row)\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable;\n *\n * // 'open' an information row when a row is clicked on\n * $('#example tbody tr').click( function () {\n * if ( oTable.fnIsOpen(this) ) {\n * oTable.fnClose( this );\n * } else {\n * oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n * }\n * } );\n *\n * oTable = $('#example').dataTable();\n * } );\n */\n this.fnClose = function(nTr) {\n /* Find settings from table node */\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n\n for (var i = 0; i < oSettings.aoOpenRows.length; i++) {\n if (oSettings.aoOpenRows[i].nParent == nTr) {\n var nTrParent = oSettings.aoOpenRows[i].nTr.parentNode;\n if (nTrParent) {\n /* Remove it if it is currently on display */\n nTrParent.removeChild(oSettings.aoOpenRows[i].nTr);\n }\n oSettings.aoOpenRows.splice(i, 1);\n return 0;\n }\n }\n return 1;\n };\n\n\n /**\n * Remove a row for the table\n * @param {mixed} mTarget The index of the row from aoData to be deleted, or\n * the TR element you want to delete\n * @param {function|null} [fnCallBack] Callback function\n * @param {bool} [bRedraw=true] Redraw the table or not\n * @returns {array} The row that was deleted\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Immediately remove the first row\n * oTable.fnDeleteRow( 0 );\n * } );\n */\n this.fnDeleteRow = function(mTarget, fnCallBack, bRedraw) {\n /* Find settings from table node */\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n var i, iLen, iAODataIndex;\n\n iAODataIndex = (typeof mTarget === 'object') ?\n _fnNodeToDataIndex(oSettings, mTarget) : mTarget;\n\n /* Return the data array from this row */\n var oData = oSettings.aoData.splice(iAODataIndex, 1);\n\n /* Update the _DT_RowIndex parameter */\n for (i = 0, iLen = oSettings.aoData.length; i < iLen; i++) {\n if (oSettings.aoData[i].nTr !== null) {\n oSettings.aoData[i].nTr._DT_RowIndex = i;\n }\n }\n\n /* Remove the target row from the search array */\n var iDisplayIndex = $.inArray(iAODataIndex, oSettings.aiDisplay);\n oSettings.asDataSearch.splice(iDisplayIndex, 1);\n\n /* Delete from the display arrays */\n _fnDeleteIndex(oSettings.aiDisplayMaster, iAODataIndex);\n _fnDeleteIndex(oSettings.aiDisplay, iAODataIndex);\n\n /* If there is a user callback function - call it */\n if (typeof fnCallBack === \"function\") {\n fnCallBack.call(this, oSettings, oData);\n }\n\n /* Check for an 'overflow' they case for displaying the table */\n if (oSettings._iDisplayStart >= oSettings.fnRecordsDisplay()) {\n oSettings._iDisplayStart -= oSettings._iDisplayLength;\n if (oSettings._iDisplayStart < 0) {\n oSettings._iDisplayStart = 0;\n }\n }\n\n if (bRedraw === undefined || bRedraw) {\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n }\n\n return oData;\n };\n\n\n /**\n * Restore the table to it's original state in the DOM by removing all of DataTables\n * enhancements, alterations to the DOM structure of the table and event listeners.\n * @param {boolean} [bRemove=false] Completely remove the table from the DOM\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * // This example is fairly pointless in reality, but shows how fnDestroy can be used\n * var oTable = $('#example').dataTable();\n * oTable.fnDestroy();\n * } );\n */\n this.fnDestroy = function(bRemove) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n var nOrig = oSettings.nTableWrapper.parentNode;\n var nBody = oSettings.nTBody;\n var i, iLen;\n\n bRemove = (bRemove === undefined) ? false : bRemove;\n\n /* Flag to note that the table is currently being destroyed - no action should be taken */\n oSettings.bDestroying = true;\n\n /* Fire off the destroy callbacks for plug-ins etc */\n _fnCallbackFire(oSettings, \"aoDestroyCallback\", \"destroy\", [oSettings]);\n\n /* If the table is not being removed, restore the hidden columns */\n if (!bRemove) {\n for (i = 0, iLen = oSettings.aoColumns.length; i < iLen; i++) {\n if (oSettings.aoColumns[i].bVisible === false) {\n this.fnSetColumnVis(i, true);\n }\n }\n }\n\n /* Blitz all DT events */\n $(oSettings.nTableWrapper).find('*').andSelf().unbind('.DT');\n\n /* If there is an 'empty' indicator row, remove it */\n $('tbody>tr>td.' + oSettings.oClasses.sRowEmpty, oSettings.nTable).parent().remove();\n\n /* When scrolling we had to break the table up - restore it */\n if (oSettings.nTable != oSettings.nTHead.parentNode) {\n $(oSettings.nTable).children('thead').remove();\n oSettings.nTable.appendChild(oSettings.nTHead);\n }\n\n if (oSettings.nTFoot && oSettings.nTable != oSettings.nTFoot.parentNode) {\n $(oSettings.nTable).children('tfoot').remove();\n oSettings.nTable.appendChild(oSettings.nTFoot);\n }\n\n /* Remove the DataTables generated nodes, events and classes */\n oSettings.nTable.parentNode.removeChild(oSettings.nTable);\n $(oSettings.nTableWrapper).remove();\n\n oSettings.aaSorting = [];\n oSettings.aaSortingFixed = [];\n _fnSortingClasses(oSettings);\n\n $(_fnGetTrNodes(oSettings)).removeClass(oSettings.asStripeClasses.join(' '));\n\n $('th, td', oSettings.nTHead).removeClass([\n oSettings.oClasses.sSortable,\n oSettings.oClasses.sSortableAsc,\n oSettings.oClasses.sSortableDesc,\n oSettings.oClasses.sSortableNone].join(' ')\n );\n if (oSettings.bJUI) {\n $('th span.' + oSettings.oClasses.sSortIcon\n + ', td span.' + oSettings.oClasses.sSortIcon, oSettings.nTHead).remove();\n\n $('th, td', oSettings.nTHead).each(function() {\n var jqWrapper = $('div.' + oSettings.oClasses.sSortJUIWrapper, this);\n var kids = jqWrapper.contents();\n $(this).append(kids);\n jqWrapper.remove();\n });\n }\n\n /* Add the TR elements back into the table in their original order */\n if (!bRemove && oSettings.nTableReinsertBefore) {\n nOrig.insertBefore(oSettings.nTable, oSettings.nTableReinsertBefore);\n } else if (!bRemove) {\n nOrig.appendChild(oSettings.nTable);\n }\n\n for (i = 0, iLen = oSettings.aoData.length; i < iLen; i++) {\n if (oSettings.aoData[i].nTr !== null) {\n nBody.appendChild(oSettings.aoData[i].nTr);\n }\n }\n\n /* Restore the width of the original table */\n if (oSettings.oFeatures.bAutoWidth === true) {\n oSettings.nTable.style.width = _fnStringToCss(oSettings.sDestroyWidth);\n }\n\n /* If the were originally stripe classes - then we add them back here. Note\n\t\t\t * this is not fool proof (for example if not all rows had stripe classes - but\n\t\t\t * it's a good effort without getting carried away\n\t\t\t */\n iLen = oSettings.asDestroyStripes.length;\n if (iLen) {\n var anRows = $(nBody).children('tr');\n for (i = 0; i < iLen; i++) {\n anRows.filter(':nth-child(' + iLen + 'n + ' + i + ')').addClass(oSettings.asDestroyStripes[i]);\n }\n }\n\n /* Remove the settings object from the settings array */\n for (i = 0, iLen = DataTable.settings.length; i < iLen; i++) {\n if (DataTable.settings[i] == oSettings) {\n DataTable.settings.splice(i, 1);\n }\n }\n\n /* End it all */\n oSettings = null;\n oInit = null;\n };\n\n\n /**\n * Redraw the table\n * @param {bool} [bComplete=true] Re-filter and resort (if enabled) the table before the draw.\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Re-draw the table - you wouldn't want to do it here, but it's an example :-)\n * oTable.fnDraw();\n * } );\n */\n this.fnDraw = function(bComplete) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n if (bComplete === false) {\n _fnCalculateEnd(oSettings);\n _fnDraw(oSettings);\n } else {\n _fnReDraw(oSettings);\n }\n };\n\n\n /**\n * Filter the input based on data\n * @param {string} sInput String to filter the table on\n * @param {int|null} [iColumn] Column to limit filtering to\n * @param {bool} [bRegex=false] Treat as regular expression or not\n * @param {bool} [bSmart=true] Perform smart filtering or not\n * @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es)\n * @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false)\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Sometime later - filter...\n * oTable.fnFilter( 'test string' );\n * } );\n */\n this.fnFilter = function(sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n\n if (!oSettings.oFeatures.bFilter) {\n return;\n }\n\n if (bRegex === undefined || bRegex === null) {\n bRegex = false;\n }\n\n if (bSmart === undefined || bSmart === null) {\n bSmart = true;\n }\n\n if (bShowGlobal === undefined || bShowGlobal === null) {\n bShowGlobal = true;\n }\n\n if (bCaseInsensitive === undefined || bCaseInsensitive === null) {\n bCaseInsensitive = true;\n }\n\n if (iColumn === undefined || iColumn === null) {\n /* Global filter */\n _fnFilterComplete(oSettings, {\n \"sSearch\": sInput + \"\",\n \"bRegex\": bRegex,\n \"bSmart\": bSmart,\n \"bCaseInsensitive\": bCaseInsensitive\n }, 1);\n\n if (bShowGlobal && oSettings.aanFeatures.f) {\n var n = oSettings.aanFeatures.f;\n for (var i = 0, iLen = n.length; i < iLen; i++) {\n // IE9 throws an 'unknown error' if document.activeElement is used\n // inside an iframe or frame...\n try {\n if (n[i]._DT_Input != document.activeElement) {\n $(n[i]._DT_Input).val(sInput);\n }\n } catch (e) {\n $(n[i]._DT_Input).val(sInput);\n }\n }\n }\n } else {\n /* Single column filter */\n $.extend(oSettings.aoPreSearchCols[iColumn], {\n \"sSearch\": sInput + \"\",\n \"bRegex\": bRegex,\n \"bSmart\": bSmart,\n \"bCaseInsensitive\": bCaseInsensitive\n });\n _fnFilterComplete(oSettings, oSettings.oPreviousSearch, 1);\n }\n };\n\n\n /**\n * Get the data for the whole table, an individual row or an individual cell based on the\n * provided parameters.\n * @param {int|node} [mRow] A TR row node, TD/TH cell node or an integer. If given as\n * a TR node then the data source for the whole row will be returned. If given as a\n * TD/TH cell node then iCol will be automatically calculated and the data for the\n * cell returned. If given as an integer, then this is treated as the aoData internal\n * data index for the row (see fnGetPosition) and the data for that row used.\n * @param {int} [iCol] Optional column index that you want the data of.\n * @returns {array|object|string} If mRow is undefined, then the data for all rows is\n * returned. If mRow is defined, just data for that row, and is iCol is\n * defined, only data for the designated cell is returned.\n * @dtopt API\n *\n * @example\n * // Row data\n * $(document).ready(function() {\n * oTable = $('#example').dataTable();\n *\n * oTable.$('tr').click( function () {\n * var data = oTable.fnGetData( this );\n * // ... do something with the array / object of data for the row\n * } );\n * } );\n *\n * @example\n * // Individual cell data\n * $(document).ready(function() {\n * oTable = $('#example').dataTable();\n *\n * oTable.$('td').click( function () {\n * var sData = oTable.fnGetData( this );\n * alert( 'The cell clicked on had the value of '+sData );\n * } );\n * } );\n */\n this.fnGetData = function(mRow, iCol) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n\n if (mRow !== undefined) {\n var iRow = mRow;\n if (typeof mRow === 'object') {\n var sNode = mRow.nodeName.toLowerCase();\n if (sNode === \"tr\") {\n iRow = _fnNodeToDataIndex(oSettings, mRow);\n } else if (sNode === \"td\") {\n iRow = _fnNodeToDataIndex(oSettings, mRow.parentNode);\n iCol = _fnNodeToColumnIndex(oSettings, iRow, mRow);\n }\n }\n\n if (iCol !== undefined) {\n return _fnGetCellData(oSettings, iRow, iCol, '');\n }\n return (oSettings.aoData[iRow] !== undefined) ?\n oSettings.aoData[iRow]._aData : null;\n }\n return _fnGetDataMaster(oSettings);\n };\n\n\n /**\n * Get an array of the TR nodes that are used in the table's body. Note that you will\n * typically want to use the '$' API method in preference to this as it is more\n * flexible.\n * @param {int} [iRow] Optional row index for the TR element you want\n * @returns {array|node} If iRow is undefined, returns an array of all TR elements\n * in the table's body, or iRow is defined, just the TR element requested.\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Get the nodes from the table\n * var nNodes = oTable.fnGetNodes( );\n * } );\n */\n this.fnGetNodes = function(iRow) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n\n if (iRow !== undefined) {\n return (oSettings.aoData[iRow] !== undefined) ?\n oSettings.aoData[iRow].nTr : null;\n }\n return _fnGetTrNodes(oSettings);\n };\n\n\n /**\n * Get the array indexes of a particular cell from it's DOM element\n * and column index including hidden columns\n * @param {node} nNode this can either be a TR, TD or TH in the table's body\n * @returns {int} If nNode is given as a TR, then a single index is returned, or\n * if given as a cell, an array of [row index, column index (visible),\n * column index (all)] is given.\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * $('#example tbody td').click( function () {\n * // Get the position of the current data from the node\n * var aPos = oTable.fnGetPosition( this );\n *\n * // Get the data array for this row\n * var aData = oTable.fnGetData( aPos[0] );\n *\n * // Update the data array and return the value\n * aData[ aPos[1] ] = 'clicked';\n * this.innerHTML = 'clicked';\n * } );\n *\n * // Init DataTables\n * oTable = $('#example').dataTable();\n * } );\n */\n this.fnGetPosition = function(nNode) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n var sNodeName = nNode.nodeName.toUpperCase();\n\n if (sNodeName == \"TR\") {\n return _fnNodeToDataIndex(oSettings, nNode);\n } else if (sNodeName == \"TD\" || sNodeName == \"TH\") {\n var iDataIndex = _fnNodeToDataIndex(oSettings, nNode.parentNode);\n var iColumnIndex = _fnNodeToColumnIndex(oSettings, iDataIndex, nNode);\n return [iDataIndex, _fnColumnIndexToVisible(oSettings, iColumnIndex), iColumnIndex];\n }\n return null;\n };\n\n\n /**\n * Check to see if a row is 'open' or not.\n * @param {node} nTr the table row to check\n * @returns {boolean} true if the row is currently open, false otherwise\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable;\n *\n * // 'open' an information row when a row is clicked on\n * $('#example tbody tr').click( function () {\n * if ( oTable.fnIsOpen(this) ) {\n * oTable.fnClose( this );\n * } else {\n * oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n * }\n * } );\n *\n * oTable = $('#example').dataTable();\n * } );\n */\n this.fnIsOpen = function(nTr) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n var aoOpenRows = oSettings.aoOpenRows;\n\n for (var i = 0; i < oSettings.aoOpenRows.length; i++) {\n if (oSettings.aoOpenRows[i].nParent == nTr) {\n return true;\n }\n }\n return false;\n };\n\n\n /**\n * This function will place a new row directly after a row which is currently\n * on display on the page, with the HTML contents that is passed into the\n * function. This can be used, for example, to ask for confirmation that a\n * particular record should be deleted.\n * @param {node} nTr The table row to 'open'\n * @param {string|node|jQuery} mHtml The HTML to put into the row\n * @param {string} sClass Class to give the new TD cell\n * @returns {node} The row opened. Note that if the table row passed in as the\n * first parameter, is not found in the table, this method will silently\n * return.\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable;\n *\n * // 'open' an information row when a row is clicked on\n * $('#example tbody tr').click( function () {\n * if ( oTable.fnIsOpen(this) ) {\n * oTable.fnClose( this );\n * } else {\n * oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n * }\n * } );\n *\n * oTable = $('#example').dataTable();\n * } );\n */\n this.fnOpen = function(nTr, mHtml, sClass) {\n /* Find settings from table node */\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n\n /* Check that the row given is in the table */\n var nTableRows = _fnGetTrNodes(oSettings);\n if ($.inArray(nTr, nTableRows) === -1) {\n return;\n }\n\n /* the old open one if there is one */\n this.fnClose(nTr);\n\n var nNewRow = document.createElement(\"tr\");\n var nNewCell = document.createElement(\"td\");\n nNewRow.appendChild(nNewCell);\n nNewCell.className = sClass;\n nNewCell.colSpan = _fnVisbleColumns(oSettings);\n\n if (typeof mHtml === \"string\") {\n nNewCell.innerHTML = mHtml;\n } else {\n $(nNewCell).html(mHtml);\n }\n\n /* If the nTr isn't on the page at the moment - then we don't insert at the moment */\n var nTrs = $('tr', oSettings.nTBody);\n if ($.inArray(nTr, nTrs) != -1) {\n $(nNewRow).insertAfter(nTr);\n }\n\n oSettings.aoOpenRows.push({\n \"nTr\": nNewRow,\n \"nParent\": nTr\n });\n\n return nNewRow;\n };\n\n\n /**\n * Change the pagination - provides the internal logic for pagination in a simple API\n * function. With this function you can have a DataTables table go to the next,\n * previous, first or last pages.\n * @param {string|int} mAction Paging action to take: \"first\", \"previous\", \"next\" or \"last\"\n * or page number to jump to (integer), note that page 0 is the first page.\n * @param {bool} [bRedraw=true] Redraw the table or not\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n * oTable.fnPageChange( 'next' );\n * } );\n */\n this.fnPageChange = function(mAction, bRedraw) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n _fnPageChange(oSettings, mAction);\n _fnCalculateEnd(oSettings);\n\n if (bRedraw === undefined || bRedraw) {\n _fnDraw(oSettings);\n }\n };\n\n\n /**\n * Show a particular column\n * @param {int} iCol The column whose display should be changed\n * @param {bool} bShow Show (true) or hide (false) the column\n * @param {bool} [bRedraw=true] Redraw the table or not\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Hide the second column after initialisation\n * oTable.fnSetColumnVis( 1, false );\n * } );\n */\n this.fnSetColumnVis = function(iCol, bShow, bRedraw) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n var i, iLen;\n var aoColumns = oSettings.aoColumns;\n var aoData = oSettings.aoData;\n var nTd, bAppend, iBefore;\n\n /* No point in doing anything if we are requesting what is already true */\n if (aoColumns[iCol].bVisible == bShow) {\n return;\n }\n\n /* Show the column */\n if (bShow) {\n var iInsert = 0;\n for (i = 0; i < iCol; i++) {\n if (aoColumns[i].bVisible) {\n iInsert++;\n }\n }\n\n /* Need to decide if we should use appendChild or insertBefore */\n bAppend = (iInsert >= _fnVisbleColumns(oSettings));\n\n /* Which coloumn should we be inserting before? */\n if (!bAppend) {\n for (i = iCol; i < aoColumns.length; i++) {\n if (aoColumns[i].bVisible) {\n iBefore = i;\n break;\n }\n }\n }\n\n for (i = 0, iLen = aoData.length; i < iLen; i++) {\n if (aoData[i].nTr !== null) {\n if (bAppend) {\n aoData[i].nTr.appendChild(\n aoData[i]._anHidden[iCol]\n );\n } else {\n aoData[i].nTr.insertBefore(\n aoData[i]._anHidden[iCol],\n _fnGetTdNodes(oSettings, i)[iBefore]);\n }\n }\n }\n } else {\n /* Remove a column from display */\n for (i = 0, iLen = aoData.length; i < iLen; i++) {\n if (aoData[i].nTr !== null) {\n nTd = _fnGetTdNodes(oSettings, i)[iCol];\n aoData[i]._anHidden[iCol] = nTd;\n nTd.parentNode.removeChild(nTd);\n }\n }\n }\n\n /* Clear to set the visible flag */\n aoColumns[iCol].bVisible = bShow;\n\n /* Redraw the header and footer based on the new column visibility */\n _fnDrawHead(oSettings, oSettings.aoHeader);\n if (oSettings.nTFoot) {\n _fnDrawHead(oSettings, oSettings.aoFooter);\n }\n\n /* If there are any 'open' rows, then we need to alter the colspan for this col change */\n for (i = 0, iLen = oSettings.aoOpenRows.length; i < iLen; i++) {\n oSettings.aoOpenRows[i].nTr.colSpan = _fnVisbleColumns(oSettings);\n }\n\n /* Do a redraw incase anything depending on the table columns needs it\n\t\t\t * (built-in: scrolling)\n\t\t\t */\n if (bRedraw === undefined || bRedraw) {\n _fnAdjustColumnSizing(oSettings);\n _fnDraw(oSettings);\n }\n\n _fnSaveState(oSettings);\n };\n\n\n /**\n * Get the settings for a particular table for external manipulation\n * @returns {object} DataTables settings object. See\n * {@link DataTable.models.oSettings}\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n * var oSettings = oTable.fnSettings();\n *\n * // Show an example parameter from the settings\n * alert( oSettings._iDisplayStart );\n * } );\n */\n this.fnSettings = function() {\n return _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n };\n\n\n /**\n * Sort the table by a particular column\n * @param {int} iCol the data index to sort on. Note that this will not match the\n * 'display index' if you have hidden data entries\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Sort immediately with columns 0 and 1\n * oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );\n * } );\n */\n this.fnSort = function(aaSort) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n oSettings.aaSorting = aaSort;\n _fnSort(oSettings);\n };\n\n\n /**\n * Attach a sort listener to an element for a given column\n * @param {node} nNode the element to attach the sort listener to\n * @param {int} iColumn the column that a click on this node will sort on\n * @param {function} [fnCallback] callback function when sort is run\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Sort on column 1, when 'sorter' is clicked on\n * oTable.fnSortListener( document.getElementById('sorter'), 1 );\n * } );\n */\n this.fnSortListener = function(nNode, iColumn, fnCallback) {\n _fnSortAttachListener(_fnSettingsFromNode(this[DataTable.ext.iApiIndex]), nNode, iColumn,\n fnCallback);\n };\n\n\n /**\n * Update a table cell or row - this method will accept either a single value to\n * update the cell with, an array of values with one element for each column or\n * an object in the same format as the original data source. The function is\n * self-referencing in order to make the multi column updates easier.\n * @param {object|array|string} mData Data to update the cell/row with\n * @param {node|int} mRow TR element you want to update or the aoData index\n * @param {int} [iColumn] The column to update (not used of mData is an array or object)\n * @param {bool} [bRedraw=true] Redraw the table or not\n * @param {bool} [bAction=true] Perform pre-draw actions or not\n * @returns {int} 0 on success, 1 on error\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n * oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell\n * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], 1, 0 ); // Row\n * } );\n */\n this.fnUpdate = function(mData, mRow, iColumn, bRedraw, bAction) {\n var oSettings = _fnSettingsFromNode(this[DataTable.ext.iApiIndex]);\n var i, iLen, sDisplay;\n var iRow = (typeof mRow === 'object') ?\n _fnNodeToDataIndex(oSettings, mRow) : mRow;\n\n if ($.isArray(mData) && iColumn === undefined) {\n /* Array update - update the whole row */\n oSettings.aoData[iRow]._aData = mData.slice();\n\n /* Flag to the function that we are recursing */\n for (i = 0; i < oSettings.aoColumns.length; i++) {\n this.fnUpdate(_fnGetCellData(oSettings, iRow, i), iRow, i, false, false);\n }\n } else if ($.isPlainObject(mData) && iColumn === undefined) {\n /* Object update - update the whole row - assume the developer gets the object right */\n oSettings.aoData[iRow]._aData = $.extend(true, {}, mData);\n\n for (i = 0; i < oSettings.aoColumns.length; i++) {\n this.fnUpdate(_fnGetCellData(oSettings, iRow, i), iRow, i, false, false);\n }\n } else {\n /* Individual cell update */\n _fnSetCellData(oSettings, iRow, iColumn, mData);\n sDisplay = _fnGetCellData(oSettings, iRow, iColumn, 'display');\n\n var oCol = oSettings.aoColumns[iColumn];\n if (oCol.fnRender !== null) {\n sDisplay = _fnRender(oSettings, iRow, iColumn);\n if (oCol.bUseRendered) {\n _fnSetCellData(oSettings, iRow, iColumn, sDisplay);\n }\n }\n\n if (oSettings.aoData[iRow].nTr !== null) {\n /* Do the actual HTML update */\n _fnGetTdNodes(oSettings, iRow)[iColumn].innerHTML = sDisplay;\n }\n }\n\n /* Modify the search index for this row (strictly this is likely not needed, since fnReDraw\n\t\t\t * will rebuild the search array - however, the redraw might be disabled by the user)\n\t\t\t */\n var iDisplayIndex = $.inArray(iRow, oSettings.aiDisplay);\n oSettings.asDataSearch[iDisplayIndex] = _fnBuildSearchRow(\n oSettings,\n _fnGetRowData(oSettings, iRow, 'filter', _fnGetColumns(oSettings, 'bSearchable'))\n );\n\n /* Perform pre-draw actions */\n if (bAction === undefined || bAction) {\n _fnAdjustColumnSizing(oSettings);\n }\n\n /* Redraw the table */\n if (bRedraw === undefined || bRedraw) {\n _fnReDraw(oSettings);\n }\n return 0;\n };\n\n\n /**\n * Provide a common method for plug-ins to check the version of DataTables being used, in order\n * to ensure compatibility.\n * @param {string} sVersion Version string to check for, in the format \"X.Y.Z\". Note that the\n * formats \"X\" and \"X.Y\" are also acceptable.\n * @returns {boolean} true if this version of DataTables is greater or equal to the required\n * version, or false if this version of DataTales is not suitable\n * @method\n * @dtopt API\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n * alert( oTable.fnVersionCheck( '1.9.0' ) );\n * } );\n */\n this.fnVersionCheck = DataTable.ext.fnVersionCheck;\n\n\n /*\n\t\t * This is really a good bit rubbish this method of exposing the internal methods\n\t\t * publicly... - To be fixed in 2.0 using methods on the prototype\n\t\t */\n\n\n /**\n * Create a wrapper function for exporting an internal functions to an external API.\n * @param {string} sFunc API function name\n * @returns {function} wrapped function\n * @memberof DataTable#oApi\n */\n function _fnExternApiFunc(sFunc) {\n return function() {\n var aArgs = [_fnSettingsFromNode(this[DataTable.ext.iApiIndex])].concat(\n Array.prototype.slice.call(arguments));\n return DataTable.ext.oApi[sFunc].apply(this, aArgs);\n };\n }\n\n\n /**\n * Reference to internal functions for use by plug-in developers. Note that these\n * methods are references to internal functions and are considered to be private.\n * If you use these methods, be aware that they are liable to change between versions\n * (check the upgrade notes).\n * @namespace\n */\n this.oApi = {\n \"_fnExternApiFunc\": _fnExternApiFunc,\n \"_fnInitialise\": _fnInitialise,\n \"_fnInitComplete\": _fnInitComplete,\n \"_fnLanguageCompat\": _fnLanguageCompat,\n \"_fnAddColumn\": _fnAddColumn,\n \"_fnColumnOptions\": _fnColumnOptions,\n \"_fnAddData\": _fnAddData,\n \"_fnCreateTr\": _fnCreateTr,\n \"_fnGatherData\": _fnGatherData,\n \"_fnBuildHead\": _fnBuildHead,\n \"_fnDrawHead\": _fnDrawHead,\n \"_fnDraw\": _fnDraw,\n \"_fnReDraw\": _fnReDraw,\n \"_fnAjaxUpdate\": _fnAjaxUpdate,\n \"_fnAjaxParameters\": _fnAjaxParameters,\n \"_fnAjaxUpdateDraw\": _fnAjaxUpdateDraw,\n \"_fnServerParams\": _fnServerParams,\n \"_fnAddOptionsHtml\": _fnAddOptionsHtml,\n \"_fnFeatureHtmlTable\": _fnFeatureHtmlTable,\n \"_fnScrollDraw\": _fnScrollDraw,\n \"_fnAdjustColumnSizing\": _fnAdjustColumnSizing,\n \"_fnFeatureHtmlFilter\": _fnFeatureHtmlFilter,\n \"_fnFilterComplete\": _fnFilterComplete,\n \"_fnFilterCustom\": _fnFilterCustom,\n \"_fnFilterColumn\": _fnFilterColumn,\n \"_fnFilter\": _fnFilter,\n \"_fnBuildSearchArray\": _fnBuildSearchArray,\n \"_fnBuildSearchRow\": _fnBuildSearchRow,\n \"_fnFilterCreateSearch\": _fnFilterCreateSearch,\n \"_fnDataToSearch\": _fnDataToSearch,\n \"_fnSort\": _fnSort,\n \"_fnSortAttachListener\": _fnSortAttachListener,\n \"_fnSortingClasses\": _fnSortingClasses,\n \"_fnFeatureHtmlPaginate\": _fnFeatureHtmlPaginate,\n \"_fnPageChange\": _fnPageChange,\n \"_fnFeatureHtmlInfo\": _fnFeatureHtmlInfo,\n \"_fnUpdateInfo\": _fnUpdateInfo,\n \"_fnFeatureHtmlLength\": _fnFeatureHtmlLength,\n \"_fnFeatureHtmlProcessing\": _fnFeatureHtmlProcessing,\n \"_fnProcessingDisplay\": _fnProcessingDisplay,\n \"_fnVisibleToColumnIndex\": _fnVisibleToColumnIndex,\n \"_fnColumnIndexToVisible\": _fnColumnIndexToVisible,\n \"_fnNodeToDataIndex\": _fnNodeToDataIndex,\n \"_fnVisbleColumns\": _fnVisbleColumns,\n \"_fnCalculateEnd\": _fnCalculateEnd,\n \"_fnConvertToWidth\": _fnConvertToWidth,\n \"_fnCalculateColumnWidths\": _fnCalculateColumnWidths,\n \"_fnScrollingWidthAdjust\": _fnScrollingWidthAdjust,\n \"_fnGetWidestNode\": _fnGetWidestNode,\n \"_fnGetMaxLenString\": _fnGetMaxLenString,\n \"_fnStringToCss\": _fnStringToCss,\n \"_fnDetectType\": _fnDetectType,\n \"_fnSettingsFromNode\": _fnSettingsFromNode,\n \"_fnGetDataMaster\": _fnGetDataMaster,\n \"_fnGetTrNodes\": _fnGetTrNodes,\n \"_fnGetTdNodes\": _fnGetTdNodes,\n \"_fnEscapeRegex\": _fnEscapeRegex,\n \"_fnDeleteIndex\": _fnDeleteIndex,\n \"_fnReOrderIndex\": _fnReOrderIndex,\n \"_fnColumnOrdering\": _fnColumnOrdering,\n \"_fnLog\": _fnLog,\n \"_fnClearTable\": _fnClearTable,\n \"_fnSaveState\": _fnSaveState,\n \"_fnLoadState\": _fnLoadState,\n \"_fnCreateCookie\": _fnCreateCookie,\n \"_fnReadCookie\": _fnReadCookie,\n \"_fnDetectHeader\": _fnDetectHeader,\n \"_fnGetUniqueThs\": _fnGetUniqueThs,\n \"_fnScrollBarWidth\": _fnScrollBarWidth,\n \"_fnApplyToChildren\": _fnApplyToChildren,\n \"_fnMap\": _fnMap,\n \"_fnGetRowData\": _fnGetRowData,\n \"_fnGetCellData\": _fnGetCellData,\n \"_fnSetCellData\": _fnSetCellData,\n \"_fnGetObjectDataFn\": _fnGetObjectDataFn,\n \"_fnSetObjectDataFn\": _fnSetObjectDataFn,\n \"_fnApplyColumnDefs\": _fnApplyColumnDefs,\n \"_fnBindAction\": _fnBindAction,\n \"_fnExtend\": _fnExtend,\n \"_fnCallbackReg\": _fnCallbackReg,\n \"_fnCallbackFire\": _fnCallbackFire,\n \"_fnJsonString\": _fnJsonString,\n \"_fnRender\": _fnRender,\n \"_fnNodeToColumnIndex\": _fnNodeToColumnIndex,\n \"_fnInfoMacros\": _fnInfoMacros,\n \"_fnBrowserDetect\": _fnBrowserDetect,\n \"_fnGetColumns\": _fnGetColumns\n };\n\n $.extend(DataTable.ext.oApi, this.oApi);\n\n for (var sFunc in DataTable.ext.oApi) {\n if (sFunc) {\n this[sFunc] = _fnExternApiFunc(sFunc);\n }\n }\n\n\n var _that = this;\n this.each(function() {\n var i = 0, iLen, j, jLen, k, kLen;\n var sId = this.getAttribute('id');\n var bInitHandedOff = false;\n var bUsePassedData = false;\n\n\n /* Sanity check */\n if (this.nodeName.toLowerCase() != 'table') {\n _fnLog(null, 0, \"Attempted to initialise DataTables on a node which is not a \" +\n \"table: \" + this.nodeName);\n return;\n }\n\n /* Check to see if we are re-initialising a table */\n for (i = 0, iLen = DataTable.settings.length; i < iLen; i++) {\n /* Base check on table node */\n if (DataTable.settings[i].nTable == this) {\n if (oInit === undefined || oInit.bRetrieve) {\n return DataTable.settings[i].oInstance;\n } else if (oInit.bDestroy) {\n DataTable.settings[i].oInstance.fnDestroy();\n break;\n } else {\n _fnLog(DataTable.settings[i], 0, \"Cannot reinitialise DataTable.\\n\\n\" +\n \"To retrieve the DataTables object for this table, pass no arguments or see \" +\n \"the docs for bRetrieve and bDestroy\");\n return;\n }\n }\n\n /* If the element we are initialising has the same ID as a table which was previously\n\t\t\t\t * initialised, but the table nodes don't match (from before) then we destroy the old\n\t\t\t\t * instance by simply deleting it. This is under the assumption that the table has been\n\t\t\t\t * destroyed by other methods. Anyone using non-id selectors will need to do this manually\n\t\t\t\t */\n if (DataTable.settings[i].sTableId == this.id) {\n DataTable.settings.splice(i, 1);\n break;\n }\n }\n\n /* Ensure the table has an ID - required for accessibility */\n if (sId === null || sId === \"\") {\n sId = \"DataTables_Table_\" + (DataTable.ext._oExternConfig.iNextUnique++);\n this.id = sId;\n }\n\n /* Create the settings object for this table and set some of the default parameters */\n var oSettings = $.extend(true, {}, DataTable.models.oSettings, {\n \"nTable\": this,\n \"oApi\": _that.oApi,\n \"oInit\": oInit,\n \"sDestroyWidth\": $(this).width(),\n \"sInstance\": sId,\n \"sTableId\": sId\n });\n DataTable.settings.push(oSettings);\n\n // Need to add the instance after the instance after the settings object has been added\n // to the settings array, so we can self reference the table instance if more than one\n oSettings.oInstance = (_that.length === 1) ? _that : $(this).dataTable();\n\n /* Setting up the initialisation object */\n if (!oInit) {\n oInit = {};\n }\n\n // Backwards compatibility, before we apply all the defaults\n if (oInit.oLanguage) {\n _fnLanguageCompat(oInit.oLanguage);\n }\n\n oInit = _fnExtend($.extend(true, {}, DataTable.defaults), oInit);\n\n // Map the initialisation options onto the settings object\n _fnMap(oSettings.oFeatures, oInit, \"bPaginate\");\n _fnMap(oSettings.oFeatures, oInit, \"bLengthChange\");\n _fnMap(oSettings.oFeatures, oInit, \"bFilter\");\n _fnMap(oSettings.oFeatures, oInit, \"bSort\");\n _fnMap(oSettings.oFeatures, oInit, \"bInfo\");\n _fnMap(oSettings.oFeatures, oInit, \"bProcessing\");\n _fnMap(oSettings.oFeatures, oInit, \"bAutoWidth\");\n _fnMap(oSettings.oFeatures, oInit, \"bSortClasses\");\n _fnMap(oSettings.oFeatures, oInit, \"bServerSide\");\n _fnMap(oSettings.oFeatures, oInit, \"bDeferRender\");\n _fnMap(oSettings.oScroll, oInit, \"sScrollX\", \"sX\");\n _fnMap(oSettings.oScroll, oInit, \"sScrollXInner\", \"sXInner\");\n _fnMap(oSettings.oScroll, oInit, \"sScrollY\", \"sY\");\n _fnMap(oSettings.oScroll, oInit, \"bScrollCollapse\", \"bCollapse\");\n _fnMap(oSettings.oScroll, oInit, \"bScrollInfinite\", \"bInfinite\");\n _fnMap(oSettings.oScroll, oInit, \"iScrollLoadGap\", \"iLoadGap\");\n _fnMap(oSettings.oScroll, oInit, \"bScrollAutoCss\", \"bAutoCss\");\n _fnMap(oSettings, oInit, \"asStripeClasses\");\n _fnMap(oSettings, oInit, \"asStripClasses\", \"asStripeClasses\"); // legacy\n _fnMap(oSettings, oInit, \"fnServerData\");\n _fnMap(oSettings, oInit, \"fnFormatNumber\");\n _fnMap(oSettings, oInit, \"sServerMethod\");\n _fnMap(oSettings, oInit, \"aaSorting\");\n _fnMap(oSettings, oInit, \"aaSortingFixed\");\n _fnMap(oSettings, oInit, \"aLengthMenu\");\n _fnMap(oSettings, oInit, \"sPaginationType\");\n _fnMap(oSettings, oInit, \"sAjaxSource\");\n _fnMap(oSettings, oInit, \"sAjaxDataProp\");\n _fnMap(oSettings, oInit, \"iCookieDuration\");\n _fnMap(oSettings, oInit, \"sCookiePrefix\");\n _fnMap(oSettings, oInit, \"sDom\");\n _fnMap(oSettings, oInit, \"bSortCellsTop\");\n _fnMap(oSettings, oInit, \"iTabIndex\");\n _fnMap(oSettings, oInit, \"oSearch\", \"oPreviousSearch\");\n _fnMap(oSettings, oInit, \"aoSearchCols\", \"aoPreSearchCols\");\n _fnMap(oSettings, oInit, \"iDisplayLength\", \"_iDisplayLength\");\n _fnMap(oSettings, oInit, \"bJQueryUI\", \"bJUI\");\n _fnMap(oSettings, oInit, \"fnCookieCallback\");\n _fnMap(oSettings, oInit, \"fnStateLoad\");\n _fnMap(oSettings, oInit, \"fnStateSave\");\n _fnMap(oSettings.oLanguage, oInit, \"fnInfoCallback\");\n\n /* Callback functions which are array driven */\n _fnCallbackReg(oSettings, 'aoDrawCallback', oInit.fnDrawCallback, 'user');\n _fnCallbackReg(oSettings, 'aoServerParams', oInit.fnServerParams, 'user');\n _fnCallbackReg(oSettings, 'aoStateSaveParams', oInit.fnStateSaveParams, 'user');\n _fnCallbackReg(oSettings, 'aoStateLoadParams', oInit.fnStateLoadParams, 'user');\n _fnCallbackReg(oSettings, 'aoStateLoaded', oInit.fnStateLoaded, 'user');\n _fnCallbackReg(oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user');\n _fnCallbackReg(oSettings, 'aoRowCreatedCallback', oInit.fnCreatedRow, 'user');\n _fnCallbackReg(oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user');\n _fnCallbackReg(oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user');\n _fnCallbackReg(oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user');\n _fnCallbackReg(oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user');\n\n if (oSettings.oFeatures.bServerSide && oSettings.oFeatures.bSort &&\n oSettings.oFeatures.bSortClasses) {\n /* Enable sort classes for server-side processing. Safe to do it here, since server-side\n\t\t\t\t * processing must be enabled by the developer\n\t\t\t\t */\n _fnCallbackReg(oSettings, 'aoDrawCallback', _fnSortingClasses, 'server_side_sort_classes');\n } else if (oSettings.oFeatures.bDeferRender) {\n _fnCallbackReg(oSettings, 'aoDrawCallback', _fnSortingClasses, 'defer_sort_classes');\n }\n\n if (oInit.bJQueryUI) {\n /* Use the JUI classes object for display. You could clone the oStdClasses object if\n\t\t\t\t * you want to have multiple tables with multiple independent classes\n\t\t\t\t */\n $.extend(oSettings.oClasses, DataTable.ext.oJUIClasses);\n\n if (oInit.sDom === DataTable.defaults.sDom && DataTable.defaults.sDom === \"lfrtip\") {\n /* Set the DOM to use a layout suitable for jQuery UI's theming */\n oSettings.sDom = '<\"H\"lfr>t<\"F\"ip>';\n }\n } else {\n $.extend(oSettings.oClasses, DataTable.ext.oStdClasses);\n }\n $(this).addClass(oSettings.oClasses.sTable);\n\n /* Calculate the scroll bar width and cache it for use later on */\n if (oSettings.oScroll.sX !== \"\" || oSettings.oScroll.sY !== \"\") {\n oSettings.oScroll.iBarWidth = _fnScrollBarWidth();\n }\n\n if (oSettings.iInitDisplayStart === undefined) {\n /* Display start point, taking into account the save saving */\n oSettings.iInitDisplayStart = oInit.iDisplayStart;\n oSettings._iDisplayStart = oInit.iDisplayStart;\n }\n\n /* Must be done after everything which can be overridden by a cookie! */\n if (oInit.bStateSave) {\n oSettings.oFeatures.bStateSave = true;\n _fnLoadState(oSettings, oInit);\n _fnCallbackReg(oSettings, 'aoDrawCallback', _fnSaveState, 'state_save');\n }\n\n if (oInit.iDeferLoading !== null) {\n oSettings.bDeferLoading = true;\n var tmp = $.isArray(oInit.iDeferLoading);\n oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading;\n oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading;\n }\n\n if (oInit.aaData !== null) {\n bUsePassedData = true;\n }\n\n /* Language definitions */\n if (oInit.oLanguage.sUrl !== \"\") {\n /* Get the language definitions from a file - because this Ajax call makes the language\n\t\t\t\t * get async to the remainder of this function we use bInitHandedOff to indicate that\n\t\t\t\t * _fnInitialise will be fired by the returned Ajax handler, rather than the constructor\n\t\t\t\t */\n oSettings.oLanguage.sUrl = oInit.oLanguage.sUrl;\n $.getJSON(oSettings.oLanguage.sUrl, null, function(json) {\n _fnLanguageCompat(json);\n $.extend(true, oSettings.oLanguage, oInit.oLanguage, json);\n _fnInitialise(oSettings);\n });\n bInitHandedOff = true;\n } else {\n $.extend(true, oSettings.oLanguage, oInit.oLanguage);\n }\n\n\n /*\n\t\t\t * Stripes\n\t\t\t */\n if (oInit.asStripeClasses === null) {\n oSettings.asStripeClasses = [\n oSettings.oClasses.sStripeOdd,\n oSettings.oClasses.sStripeEven\n ];\n }\n\n /* Remove row stripe classes if they are already on the table row */\n iLen = oSettings.asStripeClasses.length;\n oSettings.asDestroyStripes = [];\n if (iLen) {\n var bStripeRemove = false;\n var anRows = $(this).children('tbody').children('tr:lt(' + iLen + ')');\n for (i = 0; i < iLen; i++) {\n if (anRows.hasClass(oSettings.asStripeClasses[i])) {\n bStripeRemove = true;\n\n /* Store the classes which we are about to remove so they can be re-added on destroy */\n oSettings.asDestroyStripes.push(oSettings.asStripeClasses[i]);\n }\n }\n\n if (bStripeRemove) {\n anRows.removeClass(oSettings.asStripeClasses.join(' '));\n }\n }\n\n /*\n\t\t\t * Columns\n\t\t\t * See if we should load columns automatically or use defined ones\n\t\t\t */\n var anThs = [];\n var aoColumnsInit;\n var nThead = this.getElementsByTagName('thead');\n if (nThead.length !== 0) {\n _fnDetectHeader(oSettings.aoHeader, nThead[0]);\n anThs = _fnGetUniqueThs(oSettings);\n }\n\n /* If not given a column array, generate one with nulls */\n if (oInit.aoColumns === null) {\n aoColumnsInit = [];\n for (i = 0, iLen = anThs.length; i < iLen; i++) {\n aoColumnsInit.push(null);\n }\n } else {\n aoColumnsInit = oInit.aoColumns;\n }\n\n /* Add the columns */\n for (i = 0, iLen = aoColumnsInit.length; i < iLen; i++) {\n /* Short cut - use the loop to check if we have column visibility state to restore */\n if (oInit.saved_aoColumns !== undefined && oInit.saved_aoColumns.length == iLen) {\n if (aoColumnsInit[i] === null) {\n aoColumnsInit[i] = {};\n }\n aoColumnsInit[i].bVisible = oInit.saved_aoColumns[i].bVisible;\n }\n\n _fnAddColumn(oSettings, anThs ? anThs[i] : null);\n }\n\n /* Apply the column definitions */\n _fnApplyColumnDefs(oSettings, oInit.aoColumnDefs, aoColumnsInit, function(iCol, oDef) {\n _fnColumnOptions(oSettings, iCol, oDef);\n });\n\n\n /*\n\t\t\t * Sorting\n\t\t\t * Check the aaSorting array\n\t\t\t */\n for (i = 0, iLen = oSettings.aaSorting.length; i < iLen; i++) {\n if (oSettings.aaSorting[i][0] >= oSettings.aoColumns.length) {\n oSettings.aaSorting[i][0] = 0;\n }\n var oColumn = oSettings.aoColumns[oSettings.aaSorting[i][0]];\n\n /* Add a default sorting index */\n if (oSettings.aaSorting[i][2] === undefined) {\n oSettings.aaSorting[i][2] = 0;\n }\n\n /* If aaSorting is not defined, then we use the first indicator in asSorting */\n if (oInit.aaSorting === undefined && oSettings.saved_aaSorting === undefined) {\n oSettings.aaSorting[i][1] = oColumn.asSorting[0];\n }\n\n /* Set the current sorting index based on aoColumns.asSorting */\n for (j = 0, jLen = oColumn.asSorting.length; j < jLen; j++) {\n if (oSettings.aaSorting[i][1] == oColumn.asSorting[j]) {\n oSettings.aaSorting[i][2] = j;\n break;\n }\n }\n }\n\n /* Do a first pass on the sorting classes (allows any size changes to be taken into\n\t\t\t * account, and also will apply sorting disabled classes if disabled\n\t\t\t */\n _fnSortingClasses(oSettings);\n\n\n /*\n\t\t\t * Final init\n\t\t\t * Cache the header, body and footer as required, creating them if needed\n\t\t\t */\n\n /* Browser support detection */\n _fnBrowserDetect(oSettings);\n\n // Work around for Webkit bug 83867 - store the caption-side before removing from doc\n var captions = $(this).children('caption').each(function() {\n this._captionSide = $(this).css('caption-side');\n });\n\n var thead = $(this).children('thead');\n if (thead.length === 0) {\n thead = [document.createElement('thead')];\n this.appendChild(thead[0]);\n }\n oSettings.nTHead = thead[0];\n\n var tbody = $(this).children('tbody');\n if (tbody.length === 0) {\n tbody = [document.createElement('tbody')];\n this.appendChild(tbody[0]);\n }\n oSettings.nTBody = tbody[0];\n oSettings.nTBody.setAttribute(\"role\", \"alert\");\n oSettings.nTBody.setAttribute(\"aria-live\", \"polite\");\n oSettings.nTBody.setAttribute(\"aria-relevant\", \"all\");\n\n var tfoot = $(this).children('tfoot');\n if (tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== \"\" || oSettings.oScroll.sY !== \"\")) {\n // If we are a scrolling table, and no footer has been given, then we need to create\n // a tfoot element for the caption element to be appended to\n tfoot = [document.createElement('tfoot')];\n this.appendChild(tfoot[0]);\n }\n\n if (tfoot.length > 0) {\n oSettings.nTFoot = tfoot[0];\n _fnDetectHeader(oSettings.aoFooter, oSettings.nTFoot);\n }\n\n /* Check if there is data passing into the constructor */\n if (bUsePassedData) {\n for (i = 0; i < oInit.aaData.length; i++) {\n _fnAddData(oSettings, oInit.aaData[i]);\n }\n } else {\n /* Grab the data from the page */\n _fnGatherData(oSettings);\n }\n\n /* Copy the data index array */\n oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n\n /* Initialisation complete - table can be drawn */\n oSettings.bInitialised = true;\n\n /* Check if we need to initialise the table (it might not have been handed off to the\n\t\t\t * language processor)\n\t\t\t */\n if (bInitHandedOff === false) {\n _fnInitialise(oSettings);\n }\n });\n _that = null;\n return this;\n };\n\n\n /**\n * Provide a common method for plug-ins to check the version of DataTables being used, in order\n * to ensure compatibility.\n * @param {string} sVersion Version string to check for, in the format \"X.Y.Z\". Note that the\n * formats \"X\" and \"X.Y\" are also acceptable.\n * @returns {boolean} true if this version of DataTables is greater or equal to the required\n * version, or false if this version of DataTales is not suitable\n * @static\n * @dtopt API-Static\n *\n * @example\n * alert( $.fn.dataTable.fnVersionCheck( '1.9.0' ) );\n */\n DataTable.fnVersionCheck = function(sVersion) {\n /* This is cheap, but effective */\n var fnZPad = function(Zpad, count) {\n while (Zpad.length < count) {\n Zpad += '0';\n }\n return Zpad;\n };\n var aThis = DataTable.ext.sVersion.split('.');\n var aThat = sVersion.split('.');\n var sThis = '', sThat = '';\n\n for (var i = 0, iLen = aThat.length; i < iLen; i++) {\n sThis += fnZPad(aThis[i], 3);\n sThat += fnZPad(aThat[i], 3);\n }\n\n return parseInt(sThis, 10) >= parseInt(sThat, 10);\n };\n\n\n /**\n * Check if a TABLE node is a DataTable table already or not.\n * @param {node} nTable The TABLE node to check if it is a DataTable or not (note that other\n * node types can be passed in, but will always return false).\n * @returns {boolean} true the table given is a DataTable, or false otherwise\n * @static\n * @dtopt API-Static\n *\n * @example\n * var ex = document.getElementById('example');\n * if ( ! $.fn.DataTable.fnIsDataTable( ex ) ) {\n * $(ex).dataTable();\n * }\n */\n DataTable.fnIsDataTable = function(nTable) {\n var o = DataTable.settings;\n\n for (var i = 0; i < o.length; i++) {\n if (o[i].nTable === nTable || o[i].nScrollHead === nTable || o[i].nScrollFoot === nTable) {\n return true;\n }\n }\n\n return false;\n };\n\n\n /**\n * Get all DataTable tables that have been initialised - optionally you can select to\n * get only currently visible tables.\n * @param {boolean} [bVisible=false] Flag to indicate if you want all (default) or\n * visible tables only.\n * @returns {array} Array of TABLE nodes (not DataTable instances) which are DataTables\n * @static\n * @dtopt API-Static\n *\n * @example\n * var table = $.fn.dataTable.fnTables(true);\n * if ( table.length > 0 ) {\n * $(table).dataTable().fnAdjustColumnSizing();\n * }\n */\n DataTable.fnTables = function(bVisible) {\n var out = [];\n\n jQuery.each(DataTable.settings, function(i, o) {\n if (!bVisible || (bVisible === true && $(o.nTable).is(':visible'))) {\n out.push(o.nTable);\n }\n });\n\n return out;\n };\n\n\n /**\n * Version string for plug-ins to check compatibility. Allowed format is\n * a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and\n * e are optional\n * @member\n * @type string\n * @default Version number\n */\n DataTable.version = \"1.9.4\";\n\n /**\n * Private data store, containing all of the settings objects that are created for the\n * tables on a given page.\n *\n * Note that the DataTable.settings object is aliased to jQuery.fn.dataTableExt\n * through which it may be accessed and manipulated, or jQuery.fn.dataTable.settings.\n * @member\n * @type array\n * @default []\n * @private\n */\n DataTable.settings = [];\n\n /**\n * Object models container, for the various models that DataTables has available\n * to it. These models define the objects that are used to hold the active state\n * and configuration of the table.\n * @namespace\n */\n DataTable.models = {};\n\n\n /**\n * DataTables extension options and plug-ins. This namespace acts as a collection \"area\"\n * for plug-ins that can be used to extend the default DataTables behaviour - indeed many\n * of the build in methods use this method to provide their own capabilities (sorting methods\n * for example).\n *\n * Note that this namespace is aliased to jQuery.fn.dataTableExt so it can be readily accessed\n * and modified by plug-ins.\n * @namespace\n */\n DataTable.models.ext = {\n /**\n * Plug-in filtering functions - this method of filtering is complimentary to the default\n * type based filtering, and a lot more comprehensive as it allows you complete control\n * over the filtering logic. Each element in this array is a function (parameters\n * described below) that is called for every row in the table, and your logic decides if\n * it should be included in the filtered data set or not.\n *
    \n *
  • \n * Function input parameters:\n *
      \n *
    • {object} DataTables settings object: see {@link DataTable.models.oSettings}.
    • \n *
    • {array|object} Data for the row to be processed (same as the original format\n * that was passed in as the data source, or an array from a DOM data source
    • \n *
    • {int} Row index in aoData ({@link DataTable.models.oSettings.aoData}), which can\n * be useful to retrieve the TR element if you need DOM interaction.
    • \n *
    \n *
  • \n *
  • \n * Function return:\n *
      \n *
    • {boolean} Include the row in the filtered result set (true) or not (false)
    • \n *
    \n * \n *
\n * @type array\n * @default []\n *\n * @example\n * // The following example shows custom filtering being applied to the fourth column (i.e.\n * // the aData[3] index) based on two input values from the end-user, matching the data in\n * // a certain range.\n * $.fn.dataTableExt.afnFiltering.push(\n * function( oSettings, aData, iDataIndex ) {\n * var iMin = document.getElementById('min').value * 1;\n * var iMax = document.getElementById('max').value * 1;\n * var iVersion = aData[3] == \"-\" ? 0 : aData[3]*1;\n * if ( iMin == \"\" && iMax == \"\" ) {\n * return true;\n * }\n * else if ( iMin == \"\" && iVersion < iMax ) {\n * return true;\n * }\n * else if ( iMin < iVersion && \"\" == iMax ) {\n * return true;\n * }\n * else if ( iMin < iVersion && iVersion < iMax ) {\n * return true;\n * }\n * return false;\n * }\n * );\n */\n \"afnFiltering\": [],\n\n\n /**\n * Plug-in sorting functions - this method of sorting is complimentary to the default type\n * based sorting that DataTables does automatically, allowing much greater control over the\n * the data that is being used to sort a column. This is useful if you want to do sorting\n * based on live data (for example the contents of an 'input' element) rather than just the\n * static string that DataTables knows of. The way these plug-ins work is that you create\n * an array of the values you wish to be sorted for the column in question and then return\n * that array. Which pre-sorting function is run here depends on the sSortDataType parameter\n * that is used for the column (if any). This is the corollary of ofnSearch for sort\n * data.\n *
    \n *
  • \n * Function input parameters:\n *
      \n *
    • {object} DataTables settings object: see {@link DataTable.models.oSettings}.
    • \n *
    • {int} Target column index
    • \n *
    \n *
  • \n *
  • \n * Function return:\n *
      \n *
    • {array} Data for the column to be sorted upon
    • \n *
    \n * \n *
\n *\n * Note that as of v1.9, it is typically preferable to use mData to prepare data for\n * the different uses that DataTables can put the data to. Specifically mData when\n * used as a function will give you a 'type' (sorting, filtering etc) that you can use to\n * prepare the data as required for the different types. As such, this method is deprecated.\n * @type array\n * @default []\n * @deprecated\n *\n * @example\n * // Updating the cached sorting information with user entered values in HTML input elements\n * jQuery.fn.dataTableExt.afnSortData['dom-text'] = function ( oSettings, iColumn )\n * {\n * var aData = [];\n * $( 'td:eq('+iColumn+') input', oSettings.oApi._fnGetTrNodes(oSettings) ).each( function () {\n * aData.push( this.value );\n * } );\n * return aData;\n * }\n */\n \"afnSortData\": [],\n\n\n /**\n * Feature plug-ins - This is an array of objects which describe the feature plug-ins that are\n * available to DataTables. These feature plug-ins are accessible through the sDom initialisation\n * option. As such, each feature plug-in must describe a function that is used to initialise\n * itself (fnInit), a character so the feature can be enabled by sDom (cFeature) and the name\n * of the feature (sFeature). Thus the objects attached to this method must provide:\n *
    \n *
  • {function} fnInit Initialisation of the plug-in\n *
      \n *
    • \n * Function input parameters:\n *
        \n *
      • {object} DataTables settings object: see {@link DataTable.models.oSettings}.
      • \n *
      \n *
    • \n *
    • \n * Function return:\n *
        \n *
      • {node|null} The element which contains your feature. Note that the return\n * may also be void if your plug-in does not require to inject any DOM elements\n * into DataTables control (sDom) - for example this might be useful when\n * developing a plug-in which allows table control via keyboard entry.
      • \n *
      \n * \n *
    \n *
  • \n *
  • {character} cFeature Character that will be matched in sDom - case sensitive
  • \n *
  • {string} sFeature Feature name
  • \n *
\n * @type array\n * @default []\n *\n * @example\n * // How TableTools initialises itself.\n * $.fn.dataTableExt.aoFeatures.push( {\n * \"fnInit\": function( oSettings ) {\n * return new TableTools( { \"oDTSettings\": oSettings } );\n * },\n * \"cFeature\": \"T\",\n * \"sFeature\": \"TableTools\"\n * } );\n */\n \"aoFeatures\": [],\n\n\n /**\n * Type detection plug-in functions - DataTables utilises types to define how sorting and\n * filtering behave, and types can be either be defined by the developer (sType for the\n * column) or they can be automatically detected by the methods in this array. The functions\n * defined in the array are quite simple, taking a single parameter (the data to analyse)\n * and returning the type if it is a known type, or null otherwise.\n *
    \n *
  • \n * Function input parameters:\n *
      \n *
    • {*} Data from the column cell to be analysed
    • \n *
    \n *
  • \n *
  • \n * Function return:\n *
      \n *
    • {string|null} Data type detected, or null if unknown (and thus pass it\n * on to the other type detection functions.
    • \n *
    \n * \n *
\n * @type array\n * @default []\n *\n * @example\n * // Currency type detection plug-in:\n * jQuery.fn.dataTableExt.aTypes.push(\n * function ( sData ) {\n * var sValidChars = \"0123456789.-\";\n * var Char;\n *\n * // Check the numeric part\n * for ( i=1 ; iafnSortData for filtering data.\n *
    \n *
  • \n * Function input parameters:\n *
      \n *
    • {*} Data from the column cell to be prepared for filtering
    • \n *
    \n *
  • \n *
  • \n * Function return:\n *
      \n *
    • {string|null} Formatted string that will be used for the filtering.
    • \n *
    \n * \n *
\n *\n * Note that as of v1.9, it is typically preferable to use mData to prepare data for\n * the different uses that DataTables can put the data to. Specifically mData when\n * used as a function will give you a 'type' (sorting, filtering etc) that you can use to\n * prepare the data as required for the different types. As such, this method is deprecated.\n * @type object\n * @default {}\n * @deprecated\n *\n * @example\n * $.fn.dataTableExt.ofnSearch['title-numeric'] = function ( sData ) {\n * return sData.replace(/\\n/g,\" \").replace( /<.*?>/g, \"\" );\n * }\n */\n \"ofnSearch\": {},\n\n\n /**\n * Container for all private functions in DataTables so they can be exposed externally\n * @type object\n * @default {}\n */\n \"oApi\": {},\n\n\n /**\n * Storage for the various classes that DataTables uses\n * @type object\n * @default {}\n */\n \"oStdClasses\": {},\n\n\n /**\n * Storage for the various classes that DataTables uses - jQuery UI suitable\n * @type object\n * @default {}\n */\n \"oJUIClasses\": {},\n\n\n /**\n * Pagination plug-in methods - The style and controls of the pagination can significantly\n * impact on how the end user interacts with the data in your table, and DataTables allows\n * the addition of pagination controls by extending this object, which can then be enabled\n * through the sPaginationType initialisation parameter. Each pagination type that\n * is added is an object (the property name of which is what sPaginationType refers\n * to) that has two properties, both methods that are used by DataTables to update the\n * control's state.\n *
    \n *
  • \n * fnInit - Initialisation of the paging controls. Called only during initialisation\n * of the table. It is expected that this function will add the required DOM elements\n * to the page for the paging controls to work. The element pointer\n * 'oSettings.aanFeatures.p' array is provided by DataTables to contain the paging\n * controls (note that this is a 2D array to allow for multiple instances of each\n * DataTables DOM element). It is suggested that you add the controls to this element\n * as children\n *
      \n *
    • \n * Function input parameters:\n *
        \n *
      • {object} DataTables settings object: see {@link DataTable.models.oSettings}.
      • \n *
      • {node} Container into which the pagination controls must be inserted
      • \n *
      • {function} Draw callback function - whenever the controls cause a page\n * change, this method must be called to redraw the table.
      • \n *
      \n *
    • \n *
    • \n * Function return:\n *
        \n *
      • No return required
      • \n *
      \n * \n *
    \n * \n *
  • \n * fnInit - This function is called whenever the paging status of the table changes and is\n * typically used to update classes and/or text of the paging controls to reflex the new\n * status.\n *
      \n *
    • \n * Function input parameters:\n *
        \n *
      • {object} DataTables settings object: see {@link DataTable.models.oSettings}.
      • \n *
      • {function} Draw callback function - in case you need to redraw the table again\n * or attach new event listeners
      • \n *
      \n *
    • \n *
    • \n * Function return:\n *
        \n *
      • No return required
      • \n *
      \n * \n *
    \n * \n *
\n * @type object\n * @default {}\n *\n * @example\n * $.fn.dataTableExt.oPagination.four_button = {\n * \"fnInit\": function ( oSettings, nPaging, fnCallbackDraw ) {\n * nFirst = document.createElement( 'span' );\n * nPrevious = document.createElement( 'span' );\n * nNext = document.createElement( 'span' );\n * nLast = document.createElement( 'span' );\n *\n * nFirst.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sFirst ) );\n * nPrevious.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sPrevious ) );\n * nNext.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sNext ) );\n * nLast.appendChild( document.createTextNode( oSettings.oLanguage.oPaginate.sLast ) );\n *\n * nFirst.className = \"paginate_button first\";\n * nPrevious.className = \"paginate_button previous\";\n * nNext.className=\"paginate_button next\";\n * nLast.className = \"paginate_button last\";\n *\n * nPaging.appendChild( nFirst );\n * nPaging.appendChild( nPrevious );\n * nPaging.appendChild( nNext );\n * nPaging.appendChild( nLast );\n *\n * $(nFirst).click( function () {\n * oSettings.oApi._fnPageChange( oSettings, \"first\" );\n * fnCallbackDraw( oSettings );\n * } );\n *\n * $(nPrevious).click( function() {\n * oSettings.oApi._fnPageChange( oSettings, \"previous\" );\n * fnCallbackDraw( oSettings );\n * } );\n *\n * $(nNext).click( function() {\n * oSettings.oApi._fnPageChange( oSettings, \"next\" );\n * fnCallbackDraw( oSettings );\n * } );\n *\n * $(nLast).click( function() {\n * oSettings.oApi._fnPageChange( oSettings, \"last\" );\n * fnCallbackDraw( oSettings );\n * } );\n *\n * $(nFirst).bind( 'selectstart', function () { return false; } );\n * $(nPrevious).bind( 'selectstart', function () { return false; } );\n * $(nNext).bind( 'selectstart', function () { return false; } );\n * $(nLast).bind( 'selectstart', function () { return false; } );\n * },\n *\n * \"fnUpdate\": function ( oSettings, fnCallbackDraw ) {\n * if ( !oSettings.aanFeatures.p ) {\n * return;\n * }\n *\n * // Loop over each instance of the pager\n * var an = oSettings.aanFeatures.p;\n * for ( var i=0, iLen=an.length ; i\n *
  • \n * Function input parameters:\n *
      \n *
    • {*} Data to compare to the second parameter
    • \n *
    • {*} Data to compare to the first parameter
    • \n *
    \n *
  • \n *
  • \n * Function return:\n *
      \n *
    • {int} Sorting match: <0 if first parameter should be sorted lower than\n * the second parameter, ===0 if the two parameters are equal and >0 if\n * the first parameter should be sorted height than the second parameter.
    • \n *
    \n * \n * \n * @type object\n * @default {}\n *\n * @example\n * // Case-sensitive string sorting, with no pre-formatting method\n * $.extend( $.fn.dataTableExt.oSort, {\n * \"string-case-asc\": function(x,y) {\n * return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n * },\n * \"string-case-desc\": function(x,y) {\n * return ((x < y) ? 1 : ((x > y) ? -1 : 0));\n * }\n * } );\n *\n * @example\n * // Case-insensitive string sorting, with pre-formatting\n * $.extend( $.fn.dataTableExt.oSort, {\n * \"string-pre\": function(x) {\n * return x.toLowerCase();\n * },\n * \"string-asc\": function(x,y) {\n * return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n * },\n * \"string-desc\": function(x,y) {\n * return ((x < y) ? 1 : ((x > y) ? -1 : 0));\n * }\n * } );\n */\n \"oSort\": {},\n\n\n /**\n * Version string for plug-ins to check compatibility. Allowed format is\n * a.b.c.d.e where: a:int, b:int, c:int, d:string(dev|beta), e:int. d and\n * e are optional\n * @type string\n * @default Version number\n */\n \"sVersion\": DataTable.version,\n\n\n /**\n * How should DataTables report an error. Can take the value 'alert' or 'throw'\n * @type string\n * @default alert\n */\n \"sErrMode\": \"alert\",\n\n\n /**\n * Store information for DataTables to access globally about other instances\n * @namespace\n * @private\n */\n \"_oExternConfig\": {\n /* int:iNextUnique - next unique number for an instance */\n \"iNextUnique\": 0\n }\n };\n\n\n /**\n * Template object for the way in which DataTables holds information about\n * search information for the global filter and individual column filters.\n * @namespace\n */\n DataTable.models.oSearch = {\n /**\n * Flag to indicate if the filtering should be case insensitive or not\n * @type boolean\n * @default true\n */\n \"bCaseInsensitive\": true,\n\n /**\n * Applied search term\n * @type string\n * @default Empty string\n */\n \"sSearch\": \"\",\n\n /**\n * Flag to indicate if the search term should be interpreted as a\n * regular expression (true) or not (false) and therefore and special\n * regex characters escaped.\n * @type boolean\n * @default false\n */\n \"bRegex\": false,\n\n /**\n * Flag to indicate if DataTables is to use its smart filtering or not.\n * @type boolean\n * @default true\n */\n \"bSmart\": true\n };\n\n\n /**\n * Template object for the way in which DataTables holds information about\n * each individual row. This is the object format used for the settings\n * aoData array.\n * @namespace\n */\n DataTable.models.oRow = {\n /**\n * TR element for the row\n * @type node\n * @default null\n */\n \"nTr\": null,\n\n /**\n * Data object from the original data source for the row. This is either\n * an array if using the traditional form of DataTables, or an object if\n * using mData options. The exact type will depend on the passed in\n * data from the data source, or will be an array if using DOM a data\n * source.\n * @type array|object\n * @default []\n */\n \"_aData\": [],\n\n /**\n * Sorting data cache - this array is ostensibly the same length as the\n * number of columns (although each index is generated only as it is\n * needed), and holds the data that is used for sorting each column in the\n * row. We do this cache generation at the start of the sort in order that\n * the formatting of the sort data need be done only once for each cell\n * per sort. This array should not be read from or written to by anything\n * other than the master sorting methods.\n * @type array\n * @default []\n * @private\n */\n \"_aSortData\": [],\n\n /**\n * Array of TD elements that are cached for hidden rows, so they can be\n * reinserted into the table if a column is made visible again (or to act\n * as a store if a column is made hidden). Only hidden columns have a\n * reference in the array. For non-hidden columns the value is either\n * undefined or null.\n * @type array nodes\n * @default []\n * @private\n */\n \"_anHidden\": [],\n\n /**\n * Cache of the class name that DataTables has applied to the row, so we\n * can quickly look at this variable rather than needing to do a DOM check\n * on className for the nTr property.\n * @type string\n * @default Empty string\n * @private\n */\n \"_sRowStripe\": \"\"\n };\n\n\n /**\n * Template object for the column information object in DataTables. This object\n * is held in the settings aoColumns array and contains all the information that\n * DataTables needs about each individual column.\n *\n * Note that this object is related to {@link DataTable.defaults.columns}\n * but this one is the internal data store for DataTables's cache of columns.\n * It should NOT be manipulated outside of DataTables. Any configuration should\n * be done through the initialisation options.\n * @namespace\n */\n DataTable.models.oColumn = {\n /**\n * A list of the columns that sorting should occur on when this column\n * is sorted. That this property is an array allows multi-column sorting\n * to be defined for a column (for example first name / last name columns\n * would benefit from this). The values are integers pointing to the\n * columns to be sorted on (typically it will be a single integer pointing\n * at itself, but that doesn't need to be the case).\n * @type array\n */\n \"aDataSort\": null,\n\n /**\n * Define the sorting directions that are applied to the column, in sequence\n * as the column is repeatedly sorted upon - i.e. the first value is used\n * as the sorting direction when the column if first sorted (clicked on).\n * Sort it again (click again) and it will move on to the next index.\n * Repeat until loop.\n * @type array\n */\n \"asSorting\": null,\n\n /**\n * Flag to indicate if the column is searchable, and thus should be included\n * in the filtering or not.\n * @type boolean\n */\n \"bSearchable\": null,\n\n /**\n * Flag to indicate if the column is sortable or not.\n * @type boolean\n */\n \"bSortable\": null,\n\n /**\n * Deprecated When using fnRender, you have two options for what\n * to do with the data, and this property serves as the switch. Firstly, you\n * can have the sorting and filtering use the rendered value (true - default),\n * or you can have the sorting and filtering us the original value (false).\n *\n * Please note that this option has now been deprecated and will be removed\n * in the next version of DataTables. Please use mRender / mData rather than\n * fnRender.\n * @type boolean\n * @deprecated\n */\n \"bUseRendered\": null,\n\n /**\n * Flag to indicate if the column is currently visible in the table or not\n * @type boolean\n */\n \"bVisible\": null,\n\n /**\n * Flag to indicate to the type detection method if the automatic type\n * detection should be used, or if a column type (sType) has been specified\n * @type boolean\n * @default true\n * @private\n */\n \"_bAutoType\": true,\n\n /**\n * Developer definable function that is called whenever a cell is created (Ajax source,\n * etc) or processed for input (DOM source). This can be used as a compliment to mRender\n * allowing you to modify the DOM element (add background colour for example) when the\n * element is available.\n * @type function\n * @param {element} nTd The TD node that has been created\n * @param {*} sData The Data for the cell\n * @param {array|object} oData The data for the whole row\n * @param {int} iRow The row index for the aoData data store\n * @default null\n */\n \"fnCreatedCell\": null,\n\n /**\n * Function to get data from a cell in a column. You should never\n * access data directly through _aData internally in DataTables - always use\n * the method attached to this property. It allows mData to function as\n * required. This function is automatically assigned by the column\n * initialisation method\n * @type function\n * @param {array|object} oData The data array/object for the array\n * (i.e. aoData[]._aData)\n * @param {string} sSpecific The specific data type you want to get -\n * 'display', 'type' 'filter' 'sort'\n * @returns {*} The data for the cell from the given row's data\n * @default null\n */\n \"fnGetData\": null,\n\n /**\n * Deprecated Custom display function that will be called for the\n * display of each cell in this column.\n *\n * Please note that this option has now been deprecated and will be removed\n * in the next version of DataTables. Please use mRender / mData rather than\n * fnRender.\n * @type function\n * @param {object} o Object with the following parameters:\n * @param {int} o.iDataRow The row in aoData\n * @param {int} o.iDataColumn The column in question\n * @param {array} o.aData The data for the row in question\n * @param {object} o.oSettings The settings object for this DataTables instance\n * @returns {string} The string you which to use in the display\n * @default null\n * @deprecated\n */\n \"fnRender\": null,\n\n /**\n * Function to set data for a cell in the column. You should never\n * set the data directly to _aData internally in DataTables - always use\n * this method. It allows mData to function as required. This function\n * is automatically assigned by the column initialisation method\n * @type function\n * @param {array|object} oData The data array/object for the array\n * (i.e. aoData[]._aData)\n * @param {*} sValue Value to set\n * @default null\n */\n \"fnSetData\": null,\n\n /**\n * Property to read the value for the cells in the column from the data\n * source array / object. If null, then the default content is used, if a\n * function is given then the return from the function is used.\n * @type function|int|string|null\n * @default null\n */\n \"mData\": null,\n\n /**\n * Partner property to mData which is used (only when defined) to get\n * the data - i.e. it is basically the same as mData, but without the\n * 'set' option, and also the data fed to it is the result from mData.\n * This is the rendering method to match the data method of mData.\n * @type function|int|string|null\n * @default null\n */\n \"mRender\": null,\n\n /**\n * Unique header TH/TD element for this column - this is what the sorting\n * listener is attached to (if sorting is enabled.)\n * @type node\n * @default null\n */\n \"nTh\": null,\n\n /**\n * Unique footer TH/TD element for this column (if there is one). Not used\n * in DataTables as such, but can be used for plug-ins to reference the\n * footer for each column.\n * @type node\n * @default null\n */\n \"nTf\": null,\n\n /**\n * The class to apply to all TD elements in the table's TBODY for the column\n * @type string\n * @default null\n */\n \"sClass\": null,\n\n /**\n * When DataTables calculates the column widths to assign to each column,\n * it finds the longest string in each column and then constructs a\n * temporary table and reads the widths from that. The problem with this\n * is that \"mmm\" is much wider then \"iiii\", but the latter is a longer\n * string - thus the calculation can go wrong (doing it properly and putting\n * it into an DOM object and measuring that is horribly(!) slow). Thus as\n * a \"work around\" we provide this option. It will append its value to the\n * text that is found to be the longest string for the column - i.e. padding.\n * @type string\n */\n \"sContentPadding\": null,\n\n /**\n * Allows a default value to be given for a column's data, and will be used\n * whenever a null data source is encountered (this can be because mData\n * is set to null, or because the data source itself is null).\n * @type string\n * @default null\n */\n \"sDefaultContent\": null,\n\n /**\n * Name for the column, allowing reference to the column by name as well as\n * by index (needs a lookup to work by name).\n * @type string\n */\n \"sName\": null,\n\n /**\n * Custom sorting data type - defines which of the available plug-ins in\n * afnSortData the custom sorting will use - if any is defined.\n * @type string\n * @default std\n */\n \"sSortDataType\": 'std',\n\n /**\n * Class to be applied to the header element when sorting on this column\n * @type string\n * @default null\n */\n \"sSortingClass\": null,\n\n /**\n * Class to be applied to the header element when sorting on this column -\n * when jQuery UI theming is used.\n * @type string\n * @default null\n */\n \"sSortingClassJUI\": null,\n\n /**\n * Title of the column - what is seen in the TH element (nTh).\n * @type string\n */\n \"sTitle\": null,\n\n /**\n * Column sorting and filtering type\n * @type string\n * @default null\n */\n \"sType\": null,\n\n /**\n * Width of the column\n * @type string\n * @default null\n */\n \"sWidth\": null,\n\n /**\n * Width of the column when it was first \"encountered\"\n * @type string\n * @default null\n */\n \"sWidthOrig\": null\n };\n\n\n /**\n * Initialisation options that can be given to DataTables at initialisation\n * time.\n * @namespace\n */\n DataTable.defaults = {\n /**\n * An array of data to use for the table, passed in at initialisation which\n * will be used in preference to any data which is already in the DOM. This is\n * particularly useful for constructing tables purely in Javascript, for\n * example with a custom Ajax call.\n * @type array\n * @default null\n * @dtopt Option\n *\n * @example\n * // Using a 2D array data source\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"aaData\": [\n * ['Trident', 'Internet Explorer 4.0', 'Win 95+', 4, 'X'],\n * ['Trident', 'Internet Explorer 5.0', 'Win 95+', 5, 'C'],\n * ],\n * \"aoColumns\": [\n * { \"sTitle\": \"Engine\" },\n * { \"sTitle\": \"Browser\" },\n * { \"sTitle\": \"Platform\" },\n * { \"sTitle\": \"Version\" },\n * { \"sTitle\": \"Grade\" }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using an array of objects as a data source (mData)\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"aaData\": [\n * {\n * \"engine\": \"Trident\",\n * \"browser\": \"Internet Explorer 4.0\",\n * \"platform\": \"Win 95+\",\n * \"version\": 4,\n * \"grade\": \"X\"\n * },\n * {\n * \"engine\": \"Trident\",\n * \"browser\": \"Internet Explorer 5.0\",\n * \"platform\": \"Win 95+\",\n * \"version\": 5,\n * \"grade\": \"C\"\n * }\n * ],\n * \"aoColumns\": [\n * { \"sTitle\": \"Engine\", \"mData\": \"engine\" },\n * { \"sTitle\": \"Browser\", \"mData\": \"browser\" },\n * { \"sTitle\": \"Platform\", \"mData\": \"platform\" },\n * { \"sTitle\": \"Version\", \"mData\": \"version\" },\n * { \"sTitle\": \"Grade\", \"mData\": \"grade\" }\n * ]\n * } );\n * } );\n */\n \"aaData\": null,\n\n\n /**\n * If sorting is enabled, then DataTables will perform a first pass sort on\n * initialisation. You can define which column(s) the sort is performed upon,\n * and the sorting direction, with this variable. The aaSorting array should\n * contain an array for each column to be sorted initially containing the\n * column's index and a direction string ('asc' or 'desc').\n * @type array\n * @default [[0,'asc']]\n * @dtopt Option\n *\n * @example\n * // Sort by 3rd column first, and then 4th column\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aaSorting\": [[2,'asc'], [3,'desc']]\n * } );\n * } );\n *\n * // No initial sorting\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aaSorting\": []\n * } );\n * } );\n */\n \"aaSorting\": [[0, 'asc']],\n\n\n /**\n * This parameter is basically identical to the aaSorting parameter, but\n * cannot be overridden by user interaction with the table. What this means\n * is that you could have a column (visible or hidden) which the sorting will\n * always be forced on first - any sorting after that (from the user) will\n * then be performed as required. This can be useful for grouping rows\n * together.\n * @type array\n * @default null\n * @dtopt Option\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aaSortingFixed\": [[0,'asc']]\n * } );\n * } )\n */\n \"aaSortingFixed\": null,\n\n\n /**\n * This parameter allows you to readily specify the entries in the length drop\n * down menu that DataTables shows when pagination is enabled. It can be\n * either a 1D array of options which will be used for both the displayed\n * option and the value, or a 2D array which will use the array in the first\n * position as the value, and the array in the second position as the\n * displayed options (useful for language strings such as 'All').\n * @type array\n * @default [ 10, 25, 50, 100 ]\n * @dtopt Option\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aLengthMenu\": [[10, 25, 50, -1], [10, 25, 50, \"All\"]]\n * } );\n * } );\n *\n * @example\n * // Setting the default display length as well as length menu\n * // This is likely to be wanted if you remove the '10' option which\n * // is the iDisplayLength default.\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"iDisplayLength\": 25,\n * \"aLengthMenu\": [[25, 50, 100, -1], [25, 50, 100, \"All\"]]\n * } );\n * } );\n */\n \"aLengthMenu\": [10, 25, 50, 100],\n\n\n /**\n * The aoColumns option in the initialisation parameter allows you to define\n * details about the way individual columns behave. For a full list of\n * column options that can be set, please see\n * {@link DataTable.defaults.columns}. Note that if you use aoColumns to\n * define your columns, you must have an entry in the array for every single\n * column that you have in your table (these can be null if you don't which\n * to specify any options).\n * @member\n */\n \"aoColumns\": null,\n\n /**\n * Very similar to aoColumns, aoColumnDefs allows you to target a specific\n * column, multiple columns, or all columns, using the aTargets property of\n * each object in the array. This allows great flexibility when creating\n * tables, as the aoColumnDefs arrays can be of any length, targeting the\n * columns you specifically want. aoColumnDefs may use any of the column\n * options available: {@link DataTable.defaults.columns}, but it _must_\n * have aTargets defined in each object in the array. Values in the aTargets\n * array may be:\n *
      \n *
    • a string - class name will be matched on the TH for the column
    • \n *
    • 0 or a positive integer - column index counting from the left
    • \n *
    • a negative integer - column index counting from the right
    • \n *
    • the string \"_all\" - all columns (i.e. assign a default)
    • \n *
    \n * @member\n */\n \"aoColumnDefs\": null,\n\n\n /**\n * Basically the same as oSearch, this parameter defines the individual column\n * filtering state at initialisation time. The array must be of the same size\n * as the number of columns, and each element be an object with the parameters\n * \"sSearch\" and \"bEscapeRegex\" (the latter is optional). 'null' is also\n * accepted and the default will be used.\n * @type array\n * @default []\n * @dtopt Option\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoSearchCols\": [\n * null,\n * { \"sSearch\": \"My filter\" },\n * null,\n * { \"sSearch\": \"^[0-9]\", \"bEscapeRegex\": false }\n * ]\n * } );\n * } )\n */\n \"aoSearchCols\": [],\n\n\n /**\n * An array of CSS classes that should be applied to displayed rows. This\n * array may be of any length, and DataTables will apply each class\n * sequentially, looping when required.\n * @type array\n * @default null Will take the values determined by the oClasses.sStripe*\n * options\n * @dtopt Option\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"asStripeClasses\": [ 'strip1', 'strip2', 'strip3' ]\n * } );\n * } )\n */\n \"asStripeClasses\": null,\n\n\n /**\n * Enable or disable automatic column width calculation. This can be disabled\n * as an optimisation (it takes some time to calculate the widths) if the\n * tables widths are passed in using aoColumns.\n * @type boolean\n * @default true\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bAutoWidth\": false\n * } );\n * } );\n */\n \"bAutoWidth\": true,\n\n\n /**\n * Deferred rendering can provide DataTables with a huge speed boost when you\n * are using an Ajax or JS data source for the table. This option, when set to\n * true, will cause DataTables to defer the creation of the table elements for\n * each row until they are needed for a draw - saving a significant amount of\n * time.\n * @type boolean\n * @default false\n * @dtopt Features\n *\n * @example\n * $(document).ready( function() {\n * var oTable = $('#example').dataTable( {\n * \"sAjaxSource\": \"sources/arrays.txt\",\n * \"bDeferRender\": true\n * } );\n * } );\n */\n \"bDeferRender\": false,\n\n\n /**\n * Replace a DataTable which matches the given selector and replace it with\n * one which has the properties of the new initialisation object passed. If no\n * table matches the selector, then the new DataTable will be constructed as\n * per normal.\n * @type boolean\n * @default false\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sScrollY\": \"200px\",\n * \"bPaginate\": false\n * } );\n *\n * // Some time later....\n * $('#example').dataTable( {\n * \"bFilter\": false,\n * \"bDestroy\": true\n * } );\n * } );\n */\n \"bDestroy\": false,\n\n\n /**\n * Enable or disable filtering of data. Filtering in DataTables is \"smart\" in\n * that it allows the end user to input multiple words (space separated) and\n * will match a row containing those words, even if not in the order that was\n * specified (this allow matching across multiple columns). Note that if you\n * wish to use filtering in DataTables this must remain 'true' - to remove the\n * default filtering input box and retain filtering abilities, please use\n * {@link DataTable.defaults.sDom}.\n * @type boolean\n * @default true\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bFilter\": false\n * } );\n * } );\n */\n \"bFilter\": true,\n\n\n /**\n * Enable or disable the table information display. This shows information\n * about the data that is currently visible on the page, including information\n * about filtered data if that action is being performed.\n * @type boolean\n * @default true\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bInfo\": false\n * } );\n * } );\n */\n \"bInfo\": true,\n\n\n /**\n * Enable jQuery UI ThemeRoller support (required as ThemeRoller requires some\n * slightly different and additional mark-up from what DataTables has\n * traditionally used).\n * @type boolean\n * @default false\n * @dtopt Features\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bJQueryUI\": true\n * } );\n * } );\n */\n \"bJQueryUI\": false,\n\n\n /**\n * Allows the end user to select the size of a formatted page from a select\n * menu (sizes are 10, 25, 50 and 100). Requires pagination (bPaginate).\n * @type boolean\n * @default true\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bLengthChange\": false\n * } );\n * } );\n */\n \"bLengthChange\": true,\n\n\n /**\n * Enable or disable pagination.\n * @type boolean\n * @default true\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bPaginate\": false\n * } );\n * } );\n */\n \"bPaginate\": true,\n\n\n /**\n * Enable or disable the display of a 'processing' indicator when the table is\n * being processed (e.g. a sort). This is particularly useful for tables with\n * large amounts of data where it can take a noticeable amount of time to sort\n * the entries.\n * @type boolean\n * @default false\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bProcessing\": true\n * } );\n * } );\n */\n \"bProcessing\": false,\n\n\n /**\n * Retrieve the DataTables object for the given selector. Note that if the\n * table has already been initialised, this parameter will cause DataTables\n * to simply return the object that has already been set up - it will not take\n * account of any changes you might have made to the initialisation object\n * passed to DataTables (setting this parameter to true is an acknowledgement\n * that you understand this). bDestroy can be used to reinitialise a table if\n * you need.\n * @type boolean\n * @default false\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * initTable();\n * tableActions();\n * } );\n *\n * function initTable ()\n * {\n * return $('#example').dataTable( {\n * \"sScrollY\": \"200px\",\n * \"bPaginate\": false,\n * \"bRetrieve\": true\n * } );\n * }\n *\n * function tableActions ()\n * {\n * var oTable = initTable();\n * // perform API operations with oTable\n * }\n */\n \"bRetrieve\": false,\n\n\n /**\n * Indicate if DataTables should be allowed to set the padding / margin\n * etc for the scrolling header elements or not. Typically you will want\n * this.\n * @type boolean\n * @default true\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bScrollAutoCss\": false,\n * \"sScrollY\": \"200px\"\n * } );\n * } );\n */\n \"bScrollAutoCss\": true,\n\n\n /**\n * When vertical (y) scrolling is enabled, DataTables will force the height of\n * the table's viewport to the given height at all times (useful for layout).\n * However, this can look odd when filtering data down to a small data set,\n * and the footer is left \"floating\" further down. This parameter (when\n * enabled) will cause DataTables to collapse the table's viewport down when\n * the result set will fit within the given Y height.\n * @type boolean\n * @default false\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sScrollY\": \"200\",\n * \"bScrollCollapse\": true\n * } );\n * } );\n */\n \"bScrollCollapse\": false,\n\n\n /**\n * Enable infinite scrolling for DataTables (to be used in combination with\n * sScrollY). Infinite scrolling means that DataTables will continually load\n * data as a user scrolls through a table, which is very useful for large\n * dataset. This cannot be used with pagination, which is automatically\n * disabled. Note - the Scroller extra for DataTables is recommended in\n * in preference to this option.\n * @type boolean\n * @default false\n * @dtopt Features\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bScrollInfinite\": true,\n * \"bScrollCollapse\": true,\n * \"sScrollY\": \"200px\"\n * } );\n * } );\n */\n \"bScrollInfinite\": false,\n\n\n /**\n * Configure DataTables to use server-side processing. Note that the\n * sAjaxSource parameter must also be given in order to give DataTables a\n * source to obtain the required data for each draw.\n * @type boolean\n * @default false\n * @dtopt Features\n * @dtopt Server-side\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bServerSide\": true,\n * \"sAjaxSource\": \"xhr.php\"\n * } );\n * } );\n */\n \"bServerSide\": false,\n\n\n /**\n * Enable or disable sorting of columns. Sorting of individual columns can be\n * disabled by the \"bSortable\" option for each column.\n * @type boolean\n * @default true\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bSort\": false\n * } );\n * } );\n */\n \"bSort\": true,\n\n\n /**\n * Allows control over whether DataTables should use the top (true) unique\n * cell that is found for a single column, or the bottom (false - default).\n * This is useful when using complex headers.\n * @type boolean\n * @default false\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bSortCellsTop\": true\n * } );\n * } );\n */\n \"bSortCellsTop\": false,\n\n\n /**\n * Enable or disable the addition of the classes 'sorting_1', 'sorting_2' and\n * 'sorting_3' to the columns which are currently being sorted on. This is\n * presented as a feature switch as it can increase processing time (while\n * classes are removed and added) so for large data sets you might want to\n * turn this off.\n * @type boolean\n * @default true\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bSortClasses\": false\n * } );\n * } );\n */\n \"bSortClasses\": true,\n\n\n /**\n * Enable or disable state saving. When enabled a cookie will be used to save\n * table display information such as pagination information, display length,\n * filtering and sorting. As such when the end user reloads the page the\n * display display will match what thy had previously set up.\n * @type boolean\n * @default false\n * @dtopt Features\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"bStateSave\": true\n * } );\n * } );\n */\n \"bStateSave\": false,\n\n\n /**\n * Customise the cookie and / or the parameters being stored when using\n * DataTables with state saving enabled. This function is called whenever\n * the cookie is modified, and it expects a fully formed cookie string to be\n * returned. Note that the data object passed in is a Javascript object which\n * must be converted to a string (JSON.stringify for example).\n * @type function\n * @param {string} sName Name of the cookie defined by DataTables\n * @param {object} oData Data to be stored in the cookie\n * @param {string} sExpires Cookie expires string\n * @param {string} sPath Path of the cookie to set\n * @returns {string} Cookie formatted string (which should be encoded by\n * using encodeURIComponent())\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function () {\n * $('#example').dataTable( {\n * \"fnCookieCallback\": function (sName, oData, sExpires, sPath) {\n * // Customise oData or sName or whatever else here\n * return sName + \"=\"+JSON.stringify(oData)+\"; expires=\" + sExpires +\"; path=\" + sPath;\n * }\n * } );\n * } );\n */\n \"fnCookieCallback\": null,\n\n\n /**\n * This function is called when a TR element is created (and all TD child\n * elements have been inserted), or registered if using a DOM source, allowing\n * manipulation of the TR element (adding classes etc).\n * @type function\n * @param {node} nRow \"TR\" element for the current row\n * @param {array} aData Raw data array for this row\n * @param {int} iDataIndex The index of this row in aoData\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"fnCreatedRow\": function( nRow, aData, iDataIndex ) {\n * // Bold the grade for all 'A' grade browsers\n * if ( aData[4] == \"A\" )\n * {\n * $('td:eq(4)', nRow).html( 'A' );\n * }\n * }\n * } );\n * } );\n */\n \"fnCreatedRow\": null,\n\n\n /**\n * This function is called on every 'draw' event, and allows you to\n * dynamically modify any aspect you want about the created DOM.\n * @type function\n * @param {object} oSettings DataTables settings object\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"fnDrawCallback\": function( oSettings ) {\n * alert( 'DataTables has redrawn the table' );\n * }\n * } );\n * } );\n */\n \"fnDrawCallback\": null,\n\n\n /**\n * Identical to fnHeaderCallback() but for the table footer this function\n * allows you to modify the table footer on every 'draw' even.\n * @type function\n * @param {node} nFoot \"TR\" element for the footer\n * @param {array} aData Full table data (as derived from the original HTML)\n * @param {int} iStart Index for the current display starting point in the\n * display array\n * @param {int} iEnd Index for the current display ending point in the\n * display array\n * @param {array int} aiDisplay Index array to translate the visual position\n * to the full data array\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"fnFooterCallback\": function( nFoot, aData, iStart, iEnd, aiDisplay ) {\n * nFoot.getElementsByTagName('th')[0].innerHTML = \"Starting index is \"+iStart;\n * }\n * } );\n * } )\n */\n \"fnFooterCallback\": null,\n\n\n /**\n * When rendering large numbers in the information element for the table\n * (i.e. \"Showing 1 to 10 of 57 entries\") DataTables will render large numbers\n * to have a comma separator for the 'thousands' units (e.g. 1 million is\n * rendered as \"1,000,000\") to help readability for the end user. This\n * function will override the default method DataTables uses.\n * @type function\n * @member\n * @param {int} iIn number to be formatted\n * @returns {string} formatted string for DataTables to show the number\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"fnFormatNumber\": function ( iIn ) {\n * if ( iIn < 1000 ) {\n * return iIn;\n * } else {\n * var\n * s=(iIn+\"\"),\n * a=s.split(\"\"), out=\"\",\n * iLen=s.length;\n *\n * for ( var i=0 ; i<iLen ; i++ ) {\n * if ( i%3 === 0 && i !== 0 ) {\n * out = \"'\"+out;\n * }\n * out = a[iLen-i-1]+out;\n * }\n * }\n * return out;\n * };\n * } );\n * } );\n */\n \"fnFormatNumber\": function(iIn) {\n if (iIn < 1000) {\n // A small optimisation for what is likely to be the majority of use cases\n return iIn;\n }\n\n var s = (iIn + \"\"), a = s.split(\"\"), out = \"\", iLen = s.length;\n\n for (var i = 0; i < iLen; i++) {\n if (i % 3 === 0 && i !== 0) {\n out = this.oLanguage.sInfoThousands + out;\n }\n out = a[iLen - i - 1] + out;\n }\n return out;\n },\n\n\n /**\n * This function is called on every 'draw' event, and allows you to\n * dynamically modify the header row. This can be used to calculate and\n * display useful information about the table.\n * @type function\n * @param {node} nHead \"TR\" element for the header\n * @param {array} aData Full table data (as derived from the original HTML)\n * @param {int} iStart Index for the current display starting point in the\n * display array\n * @param {int} iEnd Index for the current display ending point in the\n * display array\n * @param {array int} aiDisplay Index array to translate the visual position\n * to the full data array\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"fnHeaderCallback\": function( nHead, aData, iStart, iEnd, aiDisplay ) {\n * nHead.getElementsByTagName('th')[0].innerHTML = \"Displaying \"+(iEnd-iStart)+\" records\";\n * }\n * } );\n * } )\n */\n \"fnHeaderCallback\": null,\n\n\n /**\n * The information element can be used to convey information about the current\n * state of the table. Although the internationalisation options presented by\n * DataTables are quite capable of dealing with most customisations, there may\n * be times where you wish to customise the string further. This callback\n * allows you to do exactly that.\n * @type function\n * @param {object} oSettings DataTables settings object\n * @param {int} iStart Starting position in data for the draw\n * @param {int} iEnd End position in data for the draw\n * @param {int} iMax Total number of rows in the table (regardless of\n * filtering)\n * @param {int} iTotal Total number of rows in the data set, after filtering\n * @param {string} sPre The string that DataTables has formatted using it's\n * own rules\n * @returns {string} The string to be displayed in the information element.\n * @dtopt Callbacks\n *\n * @example\n * $('#example').dataTable( {\n * \"fnInfoCallback\": function( oSettings, iStart, iEnd, iMax, iTotal, sPre ) {\n * return iStart +\" to \"+ iEnd;\n * }\n * } );\n */\n \"fnInfoCallback\": null,\n\n\n /**\n * Called when the table has been initialised. Normally DataTables will\n * initialise sequentially and there will be no need for this function,\n * however, this does not hold true when using external language information\n * since that is obtained using an async XHR call.\n * @type function\n * @param {object} oSettings DataTables settings object\n * @param {object} json The JSON object request from the server - only\n * present if client-side Ajax sourced data is used\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"fnInitComplete\": function(oSettings, json) {\n * alert( 'DataTables has finished its initialisation.' );\n * }\n * } );\n * } )\n */\n \"fnInitComplete\": null,\n\n\n /**\n * Called at the very start of each table draw and can be used to cancel the\n * draw by returning false, any other return (including undefined) results in\n * the full draw occurring).\n * @type function\n * @param {object} oSettings DataTables settings object\n * @returns {boolean} False will cancel the draw, anything else (including no\n * return) will allow it to complete.\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"fnPreDrawCallback\": function( oSettings ) {\n * if ( $('#test').val() == 1 ) {\n * return false;\n * }\n * }\n * } );\n * } );\n */\n \"fnPreDrawCallback\": null,\n\n\n /**\n * This function allows you to 'post process' each row after it have been\n * generated for each table draw, but before it is rendered on screen. This\n * function might be used for setting the row class name etc.\n * @type function\n * @param {node} nRow \"TR\" element for the current row\n * @param {array} aData Raw data array for this row\n * @param {int} iDisplayIndex The display index for the current table draw\n * @param {int} iDisplayIndexFull The index of the data in the full list of\n * rows (after filtering)\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"fnRowCallback\": function( nRow, aData, iDisplayIndex, iDisplayIndexFull ) {\n * // Bold the grade for all 'A' grade browsers\n * if ( aData[4] == \"A\" )\n * {\n * $('td:eq(4)', nRow).html( 'A' );\n * }\n * }\n * } );\n * } );\n */\n \"fnRowCallback\": null,\n\n\n /**\n * This parameter allows you to override the default function which obtains\n * the data from the server ($.getJSON) so something more suitable for your\n * application. For example you could use POST data, or pull information from\n * a Gears or AIR database.\n * @type function\n * @member\n * @param {string} sSource HTTP source to obtain the data from (sAjaxSource)\n * @param {array} aoData A key/value pair object containing the data to send\n * to the server\n * @param {function} fnCallback to be called on completion of the data get\n * process that will draw the data on the page.\n * @param {object} oSettings DataTables settings object\n * @dtopt Callbacks\n * @dtopt Server-side\n *\n * @example\n * // POST data to server\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bProcessing\": true,\n * \"bServerSide\": true,\n * \"sAjaxSource\": \"xhr.php\",\n * \"fnServerData\": function ( sSource, aoData, fnCallback, oSettings ) {\n * oSettings.jqXHR = $.ajax( {\n * \"dataType\": 'json',\n * \"type\": \"POST\",\n * \"url\": sSource,\n * \"data\": aoData,\n * \"success\": fnCallback\n * } );\n * }\n * } );\n * } );\n */\n \"fnServerData\": function(sUrl, aoData, fnCallback, oSettings) {\n oSettings.jqXHR = $.ajax({\n \"url\": sUrl,\n \"data\": aoData,\n \"success\": function(json) {\n if (json.sError) {\n oSettings.oApi._fnLog(oSettings, 0, json.sError);\n }\n\n $(oSettings.oInstance).trigger('xhr', [oSettings, json]);\n fnCallback(json);\n },\n \"dataType\": \"json\",\n \"cache\": false,\n \"type\": oSettings.sServerMethod,\n \"error\": function(xhr, error, thrown) {\n if (error == \"parsererror\") {\n oSettings.oApi._fnLog(oSettings, 0, \"DataTables warning: JSON data from \" +\n \"server could not be parsed. This is caused by a JSON formatting error.\");\n }\n }\n });\n },\n\n\n /**\n * It is often useful to send extra data to the server when making an Ajax\n * request - for example custom filtering information, and this callback\n * function makes it trivial to send extra information to the server. The\n * passed in parameter is the data set that has been constructed by\n * DataTables, and you can add to this or modify it as you require.\n * @type function\n * @param {array} aoData Data array (array of objects which are name/value\n * pairs) that has been constructed by DataTables and will be sent to the\n * server. In the case of Ajax sourced data with server-side processing\n * this will be an empty array, for server-side processing there will be a\n * significant number of parameters!\n * @returns {undefined} Ensure that you modify the aoData array passed in,\n * as this is passed by reference.\n * @dtopt Callbacks\n * @dtopt Server-side\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bProcessing\": true,\n * \"bServerSide\": true,\n * \"sAjaxSource\": \"scripts/server_processing.php\",\n * \"fnServerParams\": function ( aoData ) {\n * aoData.push( { \"name\": \"more_data\", \"value\": \"my_value\" } );\n * }\n * } );\n * } );\n */\n \"fnServerParams\": null,\n\n\n /**\n * Load the table state. With this function you can define from where, and how, the\n * state of a table is loaded. By default DataTables will load from its state saving\n * cookie, but you might wish to use local storage (HTML5) or a server-side database.\n * @type function\n * @member\n * @param {object} oSettings DataTables settings object\n * @return {object} The DataTables state object to be loaded\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bStateSave\": true,\n * \"fnStateLoad\": function (oSettings) {\n * var o;\n *\n * // Send an Ajax request to the server to get the data. Note that\n * // this is a synchronous request.\n * $.ajax( {\n * \"url\": \"/state_load\",\n * \"async\": false,\n * \"dataType\": \"json\",\n * \"success\": function (json) {\n * o = json;\n * }\n * } );\n *\n * return o;\n * }\n * } );\n * } );\n */\n \"fnStateLoad\": function(oSettings) {\n var sData = this.oApi._fnReadCookie(oSettings.sCookiePrefix + oSettings.sInstance);\n var oData;\n\n try {\n oData = (typeof $.parseJSON === 'function') ?\n $.parseJSON(sData) : eval('(' + sData + ')');\n } catch (e) {\n oData = null;\n }\n\n return oData;\n },\n\n\n /**\n * Callback which allows modification of the saved state prior to loading that state.\n * This callback is called when the table is loading state from the stored data, but\n * prior to the settings object being modified by the saved state. Note that for\n * plug-in authors, you should use the 'stateLoadParams' event to load parameters for\n * a plug-in.\n * @type function\n * @param {object} oSettings DataTables settings object\n * @param {object} oData The state object that is to be loaded\n * @dtopt Callbacks\n *\n * @example\n * // Remove a saved filter, so filtering is never loaded\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bStateSave\": true,\n * \"fnStateLoadParams\": function (oSettings, oData) {\n * oData.oSearch.sSearch = \"\";\n * }\n * } );\n * } );\n *\n * @example\n * // Disallow state loading by returning false\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bStateSave\": true,\n * \"fnStateLoadParams\": function (oSettings, oData) {\n * return false;\n * }\n * } );\n * } );\n */\n \"fnStateLoadParams\": null,\n\n\n /**\n * Callback that is called when the state has been loaded from the state saving method\n * and the DataTables settings object has been modified as a result of the loaded state.\n * @type function\n * @param {object} oSettings DataTables settings object\n * @param {object} oData The state object that was loaded\n * @dtopt Callbacks\n *\n * @example\n * // Show an alert with the filtering value that was saved\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bStateSave\": true,\n * \"fnStateLoaded\": function (oSettings, oData) {\n * alert( 'Saved filter was: '+oData.oSearch.sSearch );\n * }\n * } );\n * } );\n */\n \"fnStateLoaded\": null,\n\n\n /**\n * Save the table state. This function allows you to define where and how the state\n * information for the table is stored - by default it will use a cookie, but you\n * might want to use local storage (HTML5) or a server-side database.\n * @type function\n * @member\n * @param {object} oSettings DataTables settings object\n * @param {object} oData The state object to be saved\n * @dtopt Callbacks\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bStateSave\": true,\n * \"fnStateSave\": function (oSettings, oData) {\n * // Send an Ajax request to the server with the state object\n * $.ajax( {\n * \"url\": \"/state_save\",\n * \"data\": oData,\n * \"dataType\": \"json\",\n * \"method\": \"POST\"\n * \"success\": function () {}\n * } );\n * }\n * } );\n * } );\n */\n \"fnStateSave\": function(oSettings, oData) {\n this.oApi._fnCreateCookie(\n oSettings.sCookiePrefix + oSettings.sInstance,\n this.oApi._fnJsonString(oData),\n oSettings.iCookieDuration,\n oSettings.sCookiePrefix,\n oSettings.fnCookieCallback\n );\n },\n\n\n /**\n * Callback which allows modification of the state to be saved. Called when the table\n * has changed state a new state save is required. This method allows modification of\n * the state saving object prior to actually doing the save, including addition or\n * other state properties or modification. Note that for plug-in authors, you should\n * use the 'stateSaveParams' event to save parameters for a plug-in.\n * @type function\n * @param {object} oSettings DataTables settings object\n * @param {object} oData The state object to be saved\n * @dtopt Callbacks\n *\n * @example\n * // Remove a saved filter, so filtering is never saved\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bStateSave\": true,\n * \"fnStateSaveParams\": function (oSettings, oData) {\n * oData.oSearch.sSearch = \"\";\n * }\n * } );\n * } );\n */\n \"fnStateSaveParams\": null,\n\n\n /**\n * Duration of the cookie which is used for storing session information. This\n * value is given in seconds.\n * @type int\n * @default 7200 (2 hours)\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"iCookieDuration\": 60*60*24; // 1 day\n * } );\n * } )\n */\n \"iCookieDuration\": 7200,\n\n\n /**\n * When enabled DataTables will not make a request to the server for the first\n * page draw - rather it will use the data already on the page (no sorting etc\n * will be applied to it), thus saving on an XHR at load time. iDeferLoading\n * is used to indicate that deferred loading is required, but it is also used\n * to tell DataTables how many records there are in the full table (allowing\n * the information element and pagination to be displayed correctly). In the case\n * where a filtering is applied to the table on initial load, this can be\n * indicated by giving the parameter as an array, where the first element is\n * the number of records available after filtering and the second element is the\n * number of records without filtering (allowing the table information element\n * to be shown correctly).\n * @type int | array\n * @default null\n * @dtopt Options\n *\n * @example\n * // 57 records available in the table, no filtering applied\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bServerSide\": true,\n * \"sAjaxSource\": \"scripts/server_processing.php\",\n * \"iDeferLoading\": 57\n * } );\n * } );\n *\n * @example\n * // 57 records after filtering, 100 without filtering (an initial filter applied)\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bServerSide\": true,\n * \"sAjaxSource\": \"scripts/server_processing.php\",\n * \"iDeferLoading\": [ 57, 100 ],\n * \"oSearch\": {\n * \"sSearch\": \"my_filter\"\n * }\n * } );\n * } );\n */\n \"iDeferLoading\": null,\n\n\n /**\n * Number of rows to display on a single page when using pagination. If\n * feature enabled (bLengthChange) then the end user will be able to override\n * this to a custom setting using a pop-up menu.\n * @type int\n * @default 10\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"iDisplayLength\": 50\n * } );\n * } )\n */\n \"iDisplayLength\": 10,\n\n\n /**\n * Define the starting point for data display when using DataTables with\n * pagination. Note that this parameter is the number of records, rather than\n * the page number, so if you have 10 records per page and want to start on\n * the third page, it should be \"20\".\n * @type int\n * @default 0\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"iDisplayStart\": 20\n * } );\n * } )\n */\n \"iDisplayStart\": 0,\n\n\n /**\n * The scroll gap is the amount of scrolling that is left to go before\n * DataTables will load the next 'page' of data automatically. You typically\n * want a gap which is big enough that the scrolling will be smooth for the\n * user, while not so large that it will load more data than need.\n * @type int\n * @default 100\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bScrollInfinite\": true,\n * \"bScrollCollapse\": true,\n * \"sScrollY\": \"200px\",\n * \"iScrollLoadGap\": 50\n * } );\n * } );\n */\n \"iScrollLoadGap\": 100,\n\n\n /**\n * By default DataTables allows keyboard navigation of the table (sorting, paging,\n * and filtering) by adding a tabindex attribute to the required elements. This\n * allows you to tab through the controls and press the enter key to activate them.\n * The tabindex is default 0, meaning that the tab follows the flow of the document.\n * You can overrule this using this parameter if you wish. Use a value of -1 to\n * disable built-in keyboard navigation.\n * @type int\n * @default 0\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"iTabIndex\": 1\n * } );\n * } );\n */\n \"iTabIndex\": 0,\n\n\n /**\n * All strings that DataTables uses in the user interface that it creates\n * are defined in this object, allowing you to modified them individually or\n * completely replace them all as required.\n * @namespace\n */\n \"oLanguage\": {\n /**\n * Strings that are used for WAI-ARIA labels and controls only (these are not\n * actually visible on the page, but will be read by screenreaders, and thus\n * must be internationalised as well).\n * @namespace\n */\n \"oAria\": {\n /**\n * ARIA label that is added to the table headers when the column may be\n * sorted ascending by activing the column (click or return when focused).\n * Note that the column header is prefixed to this string.\n * @type string\n * @default : activate to sort column ascending\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"oAria\": {\n * \"sSortAscending\": \" - click/return to sort ascending\"\n * }\n * }\n * } );\n * } );\n */\n \"sSortAscending\": \": activate to sort column ascending\",\n\n /**\n * ARIA label that is added to the table headers when the column may be\n * sorted descending by activing the column (click or return when focused).\n * Note that the column header is prefixed to this string.\n * @type string\n * @default : activate to sort column ascending\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"oAria\": {\n * \"sSortDescending\": \" - click/return to sort descending\"\n * }\n * }\n * } );\n * } );\n */\n \"sSortDescending\": \": activate to sort column descending\"\n },\n\n /**\n * Pagination string used by DataTables for the two built-in pagination\n * control types (\"two_button\" and \"full_numbers\")\n * @namespace\n */\n \"oPaginate\": {\n /**\n * Text to use when using the 'full_numbers' type of pagination for the\n * button to take the user to the first page.\n * @type string\n * @default First\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"oPaginate\": {\n * \"sFirst\": \"First page\"\n * }\n * }\n * } );\n * } );\n */\n \"sFirst\": \"First\",\n\n\n /**\n * Text to use when using the 'full_numbers' type of pagination for the\n * button to take the user to the last page.\n * @type string\n * @default Last\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"oPaginate\": {\n * \"sLast\": \"Last page\"\n * }\n * }\n * } );\n * } );\n */\n \"sLast\": \"Last\",\n\n\n /**\n * Text to use for the 'next' pagination button (to take the user to the\n * next page).\n * @type string\n * @default Next\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"oPaginate\": {\n * \"sNext\": \"Next page\"\n * }\n * }\n * } );\n * } );\n */\n \"sNext\": \"Next\",\n\n\n /**\n * Text to use for the 'previous' pagination button (to take the user to\n * the previous page).\n * @type string\n * @default Previous\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"oPaginate\": {\n * \"sPrevious\": \"Previous page\"\n * }\n * }\n * } );\n * } );\n */\n \"sPrevious\": \"Previous\"\n },\n\n /**\n * This string is shown in preference to sZeroRecords when the table is\n * empty of data (regardless of filtering). Note that this is an optional\n * parameter - if it is not given, the value of sZeroRecords will be used\n * instead (either the default or given value).\n * @type string\n * @default No data available in table\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sEmptyTable\": \"No data available in table\"\n * }\n * } );\n * } );\n */\n \"sEmptyTable\": \"No data available in table\",\n\n\n /**\n * This string gives information to the end user about the information that\n * is current on display on the page. The _START_, _END_ and _TOTAL_\n * variables are all dynamically replaced as the table display updates, and\n * can be freely moved or removed as the language requirements change.\n * @type string\n * @default Showing _START_ to _END_ of _TOTAL_ entries\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sInfo\": \"Got a total of _TOTAL_ entries to show (_START_ to _END_)\"\n * }\n * } );\n * } );\n */\n \"sInfo\": \"Showing _START_ to _END_ of _TOTAL_ entries\",\n\n\n /**\n * Display information string for when the table is empty. Typically the\n * format of this string should match sInfo.\n * @type string\n * @default Showing 0 to 0 of 0 entries\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sInfoEmpty\": \"No entries to show\"\n * }\n * } );\n * } );\n */\n \"sInfoEmpty\": \"Showing 0 to 0 of 0 entries\",\n\n\n /**\n * When a user filters the information in a table, this string is appended\n * to the information (sInfo) to give an idea of how strong the filtering\n * is. The variable _MAX_ is dynamically updated.\n * @type string\n * @default (filtered from _MAX_ total entries)\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sInfoFiltered\": \" - filtering from _MAX_ records\"\n * }\n * } );\n * } );\n */\n \"sInfoFiltered\": \"(filtered from _MAX_ total entries)\",\n\n\n /**\n * If can be useful to append extra information to the info string at times,\n * and this variable does exactly that. This information will be appended to\n * the sInfo (sInfoEmpty and sInfoFiltered in whatever combination they are\n * being used) at all times.\n * @type string\n * @default Empty string\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sInfoPostFix\": \"All records shown are derived from real information.\"\n * }\n * } );\n * } );\n */\n \"sInfoPostFix\": \"\",\n\n\n /**\n * DataTables has a build in number formatter (fnFormatNumber) which is used\n * to format large numbers that are used in the table information. By\n * default a comma is used, but this can be trivially changed to any\n * character you wish with this parameter.\n * @type string\n * @default ,\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sInfoThousands\": \"'\"\n * }\n * } );\n * } );\n */\n \"sInfoThousands\": \",\",\n\n\n /**\n * Detail the action that will be taken when the drop down menu for the\n * pagination length option is changed. The '_MENU_' variable is replaced\n * with a default select list of 10, 25, 50 and 100, and can be replaced\n * with a custom select box if required.\n * @type string\n * @default Show _MENU_ entries\n * @dtopt Language\n *\n * @example\n * // Language change only\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sLengthMenu\": \"Display _MENU_ records\"\n * }\n * } );\n * } );\n *\n * @example\n * // Language and options change\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sLengthMenu\": 'Display records'\n * }\n * } );\n * } );\n */\n \"sLengthMenu\": \"Show _MENU_ entries\",\n\n\n /**\n * When using Ajax sourced data and during the first draw when DataTables is\n * gathering the data, this message is shown in an empty row in the table to\n * indicate to the end user the the data is being loaded. Note that this\n * parameter is not used when loading data by server-side processing, just\n * Ajax sourced data with client-side processing.\n * @type string\n * @default Loading...\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sLoadingRecords\": \"Please wait - loading...\"\n * }\n * } );\n * } );\n */\n \"sLoadingRecords\": \"Loading...\",\n\n\n /**\n * Text which is displayed when the table is processing a user action\n * (usually a sort command or similar).\n * @type string\n * @default Processing...\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sProcessing\": \"DataTables is currently busy\"\n * }\n * } );\n * } );\n */\n \"sProcessing\": \"Processing...\",\n\n\n /**\n * Details the actions that will be taken when the user types into the\n * filtering input text box. The variable \"_INPUT_\", if used in the string,\n * is replaced with the HTML text box for the filtering input allowing\n * control over where it appears in the string. If \"_INPUT_\" is not given\n * then the input box is appended to the string automatically.\n * @type string\n * @default Search:\n * @dtopt Language\n *\n * @example\n * // Input text box will be appended at the end automatically\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sSearch\": \"Filter records:\"\n * }\n * } );\n * } );\n *\n * @example\n * // Specify where the filter should appear\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sSearch\": \"Apply filter _INPUT_ to table\"\n * }\n * } );\n * } );\n */\n \"sSearch\": \"Search:\",\n\n\n /**\n * All of the language information can be stored in a file on the\n * server-side, which DataTables will look up if this parameter is passed.\n * It must store the URL of the language file, which is in a JSON format,\n * and the object has the same properties as the oLanguage object in the\n * initialiser object (i.e. the above parameters). Please refer to one of\n * the example language files to see how this works in action.\n * @type string\n * @default Empty string - i.e. disabled\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sUrl\": \"http://www.sprymedia.co.uk/dataTables/lang.txt\"\n * }\n * } );\n * } );\n */\n \"sUrl\": \"\",\n\n\n /**\n * Text shown inside the table records when the is no information to be\n * displayed after filtering. sEmptyTable is shown when there is simply no\n * information in the table at all (regardless of filtering).\n * @type string\n * @default No matching records found\n * @dtopt Language\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oLanguage\": {\n * \"sZeroRecords\": \"No records to display\"\n * }\n * } );\n * } );\n */\n \"sZeroRecords\": \"No matching records found\"\n },\n\n\n /**\n * This parameter allows you to have define the global filtering state at\n * initialisation time. As an object the \"sSearch\" parameter must be\n * defined, but all other parameters are optional. When \"bRegex\" is true,\n * the search string will be treated as a regular expression, when false\n * (default) it will be treated as a straight string. When \"bSmart\"\n * DataTables will use it's smart filtering methods (to word match at\n * any point in the data), when false this will not be done.\n * @namespace\n * @extends DataTable.models.oSearch\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"oSearch\": {\"sSearch\": \"Initial search\"}\n * } );\n * } )\n */\n \"oSearch\": $.extend({}, DataTable.models.oSearch),\n\n\n /**\n * By default DataTables will look for the property 'aaData' when obtaining\n * data from an Ajax source or for server-side processing - this parameter\n * allows that property to be changed. You can use Javascript dotted object\n * notation to get a data source for multiple levels of nesting.\n * @type string\n * @default aaData\n * @dtopt Options\n * @dtopt Server-side\n *\n * @example\n * // Get data from { \"data\": [...] }\n * $(document).ready( function() {\n * var oTable = $('#example').dataTable( {\n * \"sAjaxSource\": \"sources/data.txt\",\n * \"sAjaxDataProp\": \"data\"\n * } );\n * } );\n *\n * @example\n * // Get data from { \"data\": { \"inner\": [...] } }\n * $(document).ready( function() {\n * var oTable = $('#example').dataTable( {\n * \"sAjaxSource\": \"sources/data.txt\",\n * \"sAjaxDataProp\": \"data.inner\"\n * } );\n * } );\n */\n \"sAjaxDataProp\": \"aaData\",\n\n\n /**\n * You can instruct DataTables to load data from an external source using this\n * parameter (use aData if you want to pass data in you already have). Simply\n * provide a url a JSON object can be obtained from. This object must include\n * the parameter 'aaData' which is the data source for the table.\n * @type string\n * @default null\n * @dtopt Options\n * @dtopt Server-side\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sAjaxSource\": \"http://www.sprymedia.co.uk/dataTables/json.php\"\n * } );\n * } )\n */\n \"sAjaxSource\": null,\n\n\n /**\n * This parameter can be used to override the default prefix that DataTables\n * assigns to a cookie when state saving is enabled.\n * @type string\n * @default SpryMedia_DataTables_\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sCookiePrefix\": \"my_datatable_\",\n * } );\n * } );\n */\n \"sCookiePrefix\": \"SpryMedia_DataTables_\",\n\n\n /**\n * This initialisation variable allows you to specify exactly where in the\n * DOM you want DataTables to inject the various controls it adds to the page\n * (for example you might want the pagination controls at the top of the\n * table). DIV elements (with or without a custom class) can also be added to\n * aid styling. The follow syntax is used:\n *
      \n *
    • The following options are allowed:\n *
        \n *
      • 'l' - Length changing'f' - Filtering input
      • \n *
      • 't' - The table!
      • \n *
      • 'i' - Information
      • \n *
      • 'p' - Pagination
      • \n *
      • 'r' - pRocessing
      • \n *
      \n *
    • \n *
    • The following constants are allowed:\n *
        \n *
      • 'H' - jQueryUI theme \"header\" classes ('fg-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix')
      • \n *
      • 'F' - jQueryUI theme \"footer\" classes ('fg-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix')
      • \n *
      \n *
    • \n *
    • The following syntax is expected:\n *
        \n *
      • '<' and '>' - div elements
      • \n *
      • '<\"class\" and '>' - div with a class
      • \n *
      • '<\"#id\" and '>' - div with an ID
      • \n *
      \n *
    • \n *
    • Examples:\n *
        \n *
      • '<\"wrapper\"flipt>'
      • \n *
      • '<lf<t>ip>'
      • \n *
      \n *
    • \n *
    \n * @type string\n * @default lfrtip (when bJQueryUI is false) or\n * <\"H\"lfr>t<\"F\"ip> (when bJQueryUI is true)\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sDom\": '<\"top\"i>rt<\"bottom\"flp><\"clear\">'\n * } );\n * } );\n */\n \"sDom\": \"lfrtip\",\n\n\n /**\n * DataTables features two different built-in pagination interaction methods\n * ('two_button' or 'full_numbers') which present different page controls to\n * the end user. Further methods can be added using the API (see below).\n * @type string\n * @default two_button\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sPaginationType\": \"full_numbers\"\n * } );\n * } )\n */\n \"sPaginationType\": \"two_button\",\n\n\n /**\n * Enable horizontal scrolling. When a table is too wide to fit into a certain\n * layout, or you have a large number of columns in the table, you can enable\n * x-scrolling to show the table in a viewport, which can be scrolled. This\n * property can be any CSS unit, or a number (in which case it will be treated\n * as a pixel measurement).\n * @type string\n * @default blank string - i.e. disabled\n * @dtopt Features\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sScrollX\": \"100%\",\n * \"bScrollCollapse\": true\n * } );\n * } );\n */\n \"sScrollX\": \"\",\n\n\n /**\n * This property can be used to force a DataTable to use more width than it\n * might otherwise do when x-scrolling is enabled. For example if you have a\n * table which requires to be well spaced, this parameter is useful for\n * \"over-sizing\" the table, and thus forcing scrolling. This property can by\n * any CSS unit, or a number (in which case it will be treated as a pixel\n * measurement).\n * @type string\n * @default blank string - i.e. disabled\n * @dtopt Options\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sScrollX\": \"100%\",\n * \"sScrollXInner\": \"110%\"\n * } );\n * } );\n */\n \"sScrollXInner\": \"\",\n\n\n /**\n * Enable vertical scrolling. Vertical scrolling will constrain the DataTable\n * to the given height, and enable scrolling for any data which overflows the\n * current viewport. This can be used as an alternative to paging to display\n * a lot of data in a small area (although paging and scrolling can both be\n * enabled at the same time). This property can be any CSS unit, or a number\n * (in which case it will be treated as a pixel measurement).\n * @type string\n * @default blank string - i.e. disabled\n * @dtopt Features\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"sScrollY\": \"200px\",\n * \"bPaginate\": false\n * } );\n * } );\n */\n \"sScrollY\": \"\",\n\n\n /**\n * Set the HTTP method that is used to make the Ajax call for server-side\n * processing or Ajax sourced data.\n * @type string\n * @default GET\n * @dtopt Options\n * @dtopt Server-side\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"bServerSide\": true,\n * \"sAjaxSource\": \"scripts/post.php\",\n * \"sServerMethod\": \"POST\"\n * } );\n * } );\n */\n \"sServerMethod\": \"GET\"\n };\n\n\n /**\n * Column options that can be given to DataTables at initialisation time.\n * @namespace\n */\n DataTable.defaults.columns = {\n /**\n * Allows a column's sorting to take multiple columns into account when\n * doing a sort. For example first name / last name columns make sense to\n * do a multi-column sort over the two columns.\n * @type array\n * @default null Takes the value of the column index automatically\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"aDataSort\": [ 0, 1 ], \"aTargets\": [ 0 ] },\n * { \"aDataSort\": [ 1, 0 ], \"aTargets\": [ 1 ] },\n * { \"aDataSort\": [ 2, 3, 4 ], \"aTargets\": [ 2 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"aDataSort\": [ 0, 1 ] },\n * { \"aDataSort\": [ 1, 0 ] },\n * { \"aDataSort\": [ 2, 3, 4 ] },\n * null,\n * null\n * ]\n * } );\n * } );\n */\n \"aDataSort\": null,\n\n\n /**\n * You can control the default sorting direction, and even alter the behaviour\n * of the sort handler (i.e. only allow ascending sorting etc) using this\n * parameter.\n * @type array\n * @default [ 'asc', 'desc' ]\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"asSorting\": [ \"asc\" ], \"aTargets\": [ 1 ] },\n * { \"asSorting\": [ \"desc\", \"asc\", \"asc\" ], \"aTargets\": [ 2 ] },\n * { \"asSorting\": [ \"desc\" ], \"aTargets\": [ 3 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * null,\n * { \"asSorting\": [ \"asc\" ] },\n * { \"asSorting\": [ \"desc\", \"asc\", \"asc\" ] },\n * { \"asSorting\": [ \"desc\" ] },\n * null\n * ]\n * } );\n * } );\n */\n \"asSorting\": ['asc', 'desc'],\n\n\n /**\n * Enable or disable filtering on the data in this column.\n * @type boolean\n * @default true\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"bSearchable\": false, \"aTargets\": [ 0 ] }\n * ] } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"bSearchable\": false },\n * null,\n * null,\n * null,\n * null\n * ] } );\n * } );\n */\n \"bSearchable\": true,\n\n\n /**\n * Enable or disable sorting on this column.\n * @type boolean\n * @default true\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"bSortable\": false, \"aTargets\": [ 0 ] }\n * ] } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"bSortable\": false },\n * null,\n * null,\n * null,\n * null\n * ] } );\n * } );\n */\n \"bSortable\": true,\n\n\n /**\n * Deprecated When using fnRender() for a column, you may wish\n * to use the original data (before rendering) for sorting and filtering\n * (the default is to used the rendered data that the user can see). This\n * may be useful for dates etc.\n *\n * Please note that this option has now been deprecated and will be removed\n * in the next version of DataTables. Please use mRender / mData rather than\n * fnRender.\n * @type boolean\n * @default true\n * @dtopt Columns\n * @deprecated\n */\n \"bUseRendered\": true,\n\n\n /**\n * Enable or disable the display of this column.\n * @type boolean\n * @default true\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"bVisible\": false, \"aTargets\": [ 0 ] }\n * ] } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"bVisible\": false },\n * null,\n * null,\n * null,\n * null\n * ] } );\n * } );\n */\n \"bVisible\": true,\n\n\n /**\n * Developer definable function that is called whenever a cell is created (Ajax source,\n * etc) or processed for input (DOM source). This can be used as a compliment to mRender\n * allowing you to modify the DOM element (add background colour for example) when the\n * element is available.\n * @type function\n * @param {element} nTd The TD node that has been created\n * @param {*} sData The Data for the cell\n * @param {array|object} oData The data for the whole row\n * @param {int} iRow The row index for the aoData data store\n * @param {int} iCol The column index for aoColumns\n * @dtopt Columns\n *\n * @example\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [ {\n * \"aTargets\": [3],\n * \"fnCreatedCell\": function (nTd, sData, oData, iRow, iCol) {\n * if ( sData == \"1.7\" ) {\n * $(nTd).css('color', 'blue')\n * }\n * }\n * } ]\n * });\n * } );\n */\n \"fnCreatedCell\": null,\n\n\n /**\n * Deprecated Custom display function that will be called for the\n * display of each cell in this column.\n *\n * Please note that this option has now been deprecated and will be removed\n * in the next version of DataTables. Please use mRender / mData rather than\n * fnRender.\n * @type function\n * @param {object} o Object with the following parameters:\n * @param {int} o.iDataRow The row in aoData\n * @param {int} o.iDataColumn The column in question\n * @param {array} o.aData The data for the row in question\n * @param {object} o.oSettings The settings object for this DataTables instance\n * @param {object} o.mDataProp The data property used for this column\n * @param {*} val The current cell value\n * @returns {string} The string you which to use in the display\n * @dtopt Columns\n * @deprecated\n */\n \"fnRender\": null,\n\n\n /**\n * The column index (starting from 0!) that you wish a sort to be performed\n * upon when this column is selected for sorting. This can be used for sorting\n * on hidden columns for example.\n * @type int\n * @default -1 Use automatically calculated column index\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"iDataSort\": 1, \"aTargets\": [ 0 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"iDataSort\": 1 },\n * null,\n * null,\n * null,\n * null\n * ]\n * } );\n * } );\n */\n \"iDataSort\": -1,\n\n\n /**\n * This parameter has been replaced by mData in DataTables to ensure naming\n * consistency. mDataProp can still be used, as there is backwards compatibility\n * in DataTables for this option, but it is strongly recommended that you use\n * mData in preference to mDataProp.\n * @name DataTable.defaults.columns.mDataProp\n */\n\n\n /**\n * This property can be used to read data from any JSON data source property,\n * including deeply nested objects / properties. mData can be given in a\n * number of different ways which effect its behaviour:\n *
      \n *
    • integer - treated as an array index for the data source. This is the\n * default that DataTables uses (incrementally increased for each column).
    • \n *
    • string - read an object property from the data source. Note that you can\n * use Javascript dotted notation to read deep properties / arrays from the\n * data source.
    • \n *
    • null - the sDefaultContent option will be used for the cell (null\n * by default, so you will need to specify the default content you want -\n * typically an empty string). This can be useful on generated columns such\n * as edit / delete action columns.
    • \n *
    • function - the function given will be executed whenever DataTables\n * needs to set or get the data for a cell in the column. The function\n * takes three parameters:\n *
        \n *
      • {array|object} The data source for the row
      • \n *
      • {string} The type call data requested - this will be 'set' when\n * setting data or 'filter', 'display', 'type', 'sort' or undefined when\n * gathering data. Note that when undefined is given for the type\n * DataTables expects to get the raw data for the object back
      • \n *
      • {*} Data to set when the second parameter is 'set'.
      • \n *
      \n * The return value from the function is not required when 'set' is the type\n * of call, but otherwise the return is what will be used for the data\n * requested.
    • \n *
    \n *\n * Note that prior to DataTables 1.9.2 mData was called mDataProp. The name change\n * reflects the flexibility of this property and is consistent with the naming of\n * mRender. If 'mDataProp' is given, then it will still be used by DataTables, as\n * it automatically maps the old name to the new if required.\n * @type string|int|function|null\n * @default null Use automatically calculated column index\n * @dtopt Columns\n *\n * @example\n * // Read table data from objects\n * $(document).ready( function() {\n * var oTable = $('#example').dataTable( {\n * \"sAjaxSource\": \"sources/deep.txt\",\n * \"aoColumns\": [\n * { \"mData\": \"engine\" },\n * { \"mData\": \"browser\" },\n * { \"mData\": \"platform.inner\" },\n * { \"mData\": \"platform.details.0\" },\n * { \"mData\": \"platform.details.1\" }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using mData as a function to provide different information for\n * // sorting, filtering and display. In this case, currency (price)\n * $(document).ready( function() {\n * var oTable = $('#example').dataTable( {\n * \"aoColumnDefs\": [ {\n * \"aTargets\": [ 0 ],\n * \"mData\": function ( source, type, val ) {\n * if (type === 'set') {\n * source.price = val;\n * // Store the computed dislay and filter values for efficiency\n * source.price_display = val==\"\" ? \"\" : \"$\"+numberFormat(val);\n * source.price_filter = val==\"\" ? \"\" : \"$\"+numberFormat(val)+\" \"+val;\n * return;\n * }\n * else if (type === 'display') {\n * return source.price_display;\n * }\n * else if (type === 'filter') {\n * return source.price_filter;\n * }\n * // 'sort', 'type' and undefined all just use the integer\n * return source.price;\n * }\n * } ]\n * } );\n * } );\n */\n \"mData\": null,\n\n\n /**\n * This property is the rendering partner to mData and it is suggested that\n * when you want to manipulate data for display (including filtering, sorting etc)\n * but not altering the underlying data for the table, use this property. mData\n * can actually do everything this property can and more, but this parameter is\n * easier to use since there is no 'set' option. Like mData is can be given\n * in a number of different ways to effect its behaviour, with the addition of\n * supporting array syntax for easy outputting of arrays (including arrays of\n * objects):\n *
      \n *
    • integer - treated as an array index for the data source. This is the\n * default that DataTables uses (incrementally increased for each column).
    • \n *
    • string - read an object property from the data source. Note that you can\n * use Javascript dotted notation to read deep properties / arrays from the\n * data source and also array brackets to indicate that the data reader should\n * loop over the data source array. When characters are given between the array\n * brackets, these characters are used to join the data source array together.\n * For example: \"accounts[, ].name\" would result in a comma separated list with\n * the 'name' value from the 'accounts' array of objects.
    • \n *
    • function - the function given will be executed whenever DataTables\n * needs to set or get the data for a cell in the column. The function\n * takes three parameters:\n *
        \n *
      • {array|object} The data source for the row (based on mData)
      • \n *
      • {string} The type call data requested - this will be 'filter', 'display',\n * 'type' or 'sort'.
      • \n *
      • {array|object} The full data source for the row (not based on mData)
      • \n *
      \n * The return value from the function is what will be used for the data\n * requested.
    • \n *
    \n * @type string|int|function|null\n * @default null Use mData\n * @dtopt Columns\n *\n * @example\n * // Create a comma separated list from an array of objects\n * $(document).ready( function() {\n * var oTable = $('#example').dataTable( {\n * \"sAjaxSource\": \"sources/deep.txt\",\n * \"aoColumns\": [\n * { \"mData\": \"engine\" },\n * { \"mData\": \"browser\" },\n * {\n * \"mData\": \"platform\",\n * \"mRender\": \"[, ].name\"\n * }\n * ]\n * } );\n * } );\n *\n * @example\n * // Use as a function to create a link from the data source\n * $(document).ready( function() {\n * var oTable = $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * {\n * \"aTargets\": [ 0 ],\n * \"mData\": \"download_link\",\n * \"mRender\": function ( data, type, full ) {\n * return 'Download';\n * }\n * ]\n * } );\n * } );\n */\n \"mRender\": null,\n\n\n /**\n * Change the cell type created for the column - either TD cells or TH cells. This\n * can be useful as TH cells have semantic meaning in the table body, allowing them\n * to act as a header for a row (you may wish to add scope='row' to the TH elements).\n * @type string\n * @default td\n * @dtopt Columns\n *\n * @example\n * // Make the first column use TH cells\n * $(document).ready( function() {\n * var oTable = $('#example').dataTable( {\n * \"aoColumnDefs\": [ {\n * \"aTargets\": [ 0 ],\n * \"sCellType\": \"th\"\n * } ]\n * } );\n * } );\n */\n \"sCellType\": \"td\",\n\n\n /**\n * Class to give to each cell in this column.\n * @type string\n * @default Empty string\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"sClass\": \"my_class\", \"aTargets\": [ 0 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"sClass\": \"my_class\" },\n * null,\n * null,\n * null,\n * null\n * ]\n * } );\n * } );\n */\n \"sClass\": \"\",\n\n /**\n * When DataTables calculates the column widths to assign to each column,\n * it finds the longest string in each column and then constructs a\n * temporary table and reads the widths from that. The problem with this\n * is that \"mmm\" is much wider then \"iiii\", but the latter is a longer\n * string - thus the calculation can go wrong (doing it properly and putting\n * it into an DOM object and measuring that is horribly(!) slow). Thus as\n * a \"work around\" we provide this option. It will append its value to the\n * text that is found to be the longest string for the column - i.e. padding.\n * Generally you shouldn't need this, and it is not documented on the\n * general DataTables.net documentation\n * @type string\n * @default Empty string\n * @dtopt Columns\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * null,\n * null,\n * null,\n * {\n * \"sContentPadding\": \"mmm\"\n * }\n * ]\n * } );\n * } );\n */\n \"sContentPadding\": \"\",\n\n\n /**\n * Allows a default value to be given for a column's data, and will be used\n * whenever a null data source is encountered (this can be because mData\n * is set to null, or because the data source itself is null).\n * @type string\n * @default null\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * {\n * \"mData\": null,\n * \"sDefaultContent\": \"Edit\",\n * \"aTargets\": [ -1 ]\n * }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * null,\n * null,\n * null,\n * {\n * \"mData\": null,\n * \"sDefaultContent\": \"Edit\"\n * }\n * ]\n * } );\n * } );\n */\n \"sDefaultContent\": null,\n\n\n /**\n * This parameter is only used in DataTables' server-side processing. It can\n * be exceptionally useful to know what columns are being displayed on the\n * client side, and to map these to database fields. When defined, the names\n * also allow DataTables to reorder information from the server if it comes\n * back in an unexpected order (i.e. if you switch your columns around on the\n * client-side, your server-side code does not also need updating).\n * @type string\n * @default Empty string\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"sName\": \"engine\", \"aTargets\": [ 0 ] },\n * { \"sName\": \"browser\", \"aTargets\": [ 1 ] },\n * { \"sName\": \"platform\", \"aTargets\": [ 2 ] },\n * { \"sName\": \"version\", \"aTargets\": [ 3 ] },\n * { \"sName\": \"grade\", \"aTargets\": [ 4 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"sName\": \"engine\" },\n * { \"sName\": \"browser\" },\n * { \"sName\": \"platform\" },\n * { \"sName\": \"version\" },\n * { \"sName\": \"grade\" }\n * ]\n * } );\n * } );\n */\n \"sName\": \"\",\n\n\n /**\n * Defines a data source type for the sorting which can be used to read\n * real-time information from the table (updating the internally cached\n * version) prior to sorting. This allows sorting to occur on user editable\n * elements such as form inputs.\n * @type string\n * @default std\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"sSortDataType\": \"dom-text\", \"aTargets\": [ 2, 3 ] },\n * { \"sType\": \"numeric\", \"aTargets\": [ 3 ] },\n * { \"sSortDataType\": \"dom-select\", \"aTargets\": [ 4 ] },\n * { \"sSortDataType\": \"dom-checkbox\", \"aTargets\": [ 5 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * null,\n * null,\n * { \"sSortDataType\": \"dom-text\" },\n * { \"sSortDataType\": \"dom-text\", \"sType\": \"numeric\" },\n * { \"sSortDataType\": \"dom-select\" },\n * { \"sSortDataType\": \"dom-checkbox\" }\n * ]\n * } );\n * } );\n */\n \"sSortDataType\": \"std\",\n\n\n /**\n * The title of this column.\n * @type string\n * @default null Derived from the 'TH' value for this column in the\n * original HTML table.\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"sTitle\": \"My column title\", \"aTargets\": [ 0 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"sTitle\": \"My column title\" },\n * null,\n * null,\n * null,\n * null\n * ]\n * } );\n * } );\n */\n \"sTitle\": null,\n\n\n /**\n * The type allows you to specify how the data for this column will be sorted.\n * Four types (string, numeric, date and html (which will strip HTML tags\n * before sorting)) are currently available. Note that only date formats\n * understood by Javascript's Date() object will be accepted as type date. For\n * example: \"Mar 26, 2008 5:03 PM\". May take the values: 'string', 'numeric',\n * 'date' or 'html' (by default). Further types can be adding through\n * plug-ins.\n * @type string\n * @default null Auto-detected from raw data\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"sType\": \"html\", \"aTargets\": [ 0 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"sType\": \"html\" },\n * null,\n * null,\n * null,\n * null\n * ]\n * } );\n * } );\n */\n \"sType\": null,\n\n\n /**\n * Defining the width of the column, this parameter may take any CSS value\n * (3em, 20px etc). DataTables apples 'smart' widths to columns which have not\n * been given a specific width through this interface ensuring that the table\n * remains readable.\n * @type string\n * @default null Automatic\n * @dtopt Columns\n *\n * @example\n * // Using aoColumnDefs\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumnDefs\": [\n * { \"sWidth\": \"20%\", \"aTargets\": [ 0 ] }\n * ]\n * } );\n * } );\n *\n * @example\n * // Using aoColumns\n * $(document).ready( function() {\n * $('#example').dataTable( {\n * \"aoColumns\": [\n * { \"sWidth\": \"20%\" },\n * null,\n * null,\n * null,\n * null\n * ]\n * } );\n * } );\n */\n \"sWidth\": null\n };\n\n\n /**\n * DataTables settings object - this holds all the information needed for a\n * given table, including configuration, data and current application of the\n * table options. DataTables does not have a single instance for each DataTable\n * with the settings attached to that instance, but rather instances of the\n * DataTable \"class\" are created on-the-fly as needed (typically by a\n * $().dataTable() call) and the settings object is then applied to that\n * instance.\n *\n * Note that this object is related to {@link DataTable.defaults} but this\n * one is the internal data store for DataTables's cache of columns. It should\n * NOT be manipulated outside of DataTables. Any configuration should be done\n * through the initialisation options.\n * @namespace\n * @todo Really should attach the settings object to individual instances so we\n * don't need to create new instances on each $().dataTable() call (if the\n * table already exists). It would also save passing oSettings around and\n * into every single function. However, this is a very significant\n * architecture change for DataTables and will almost certainly break\n * backwards compatibility with older installations. This is something that\n * will be done in 2.0.\n */\n DataTable.models.oSettings = {\n /**\n * Primary features of DataTables and their enablement state.\n * @namespace\n */\n \"oFeatures\": {\n\n /**\n * Flag to say if DataTables should automatically try to calculate the\n * optimum table and columns widths (true) or not (false).\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bAutoWidth\": null,\n\n /**\n * Delay the creation of TR and TD elements until they are actually\n * needed by a driven page draw. This can give a significant speed\n * increase for Ajax source and Javascript source data, but makes no\n * difference at all fro DOM and server-side processing tables.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bDeferRender\": null,\n\n /**\n * Enable filtering on the table or not. Note that if this is disabled\n * then there is no filtering at all on the table, including fnFilter.\n * To just remove the filtering input use sDom and remove the 'f' option.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bFilter\": null,\n\n /**\n * Table information element (the 'Showing x of y records' div) enable\n * flag.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bInfo\": null,\n\n /**\n * Present a user control allowing the end user to change the page size\n * when pagination is enabled.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bLengthChange\": null,\n\n /**\n * Pagination enabled or not. Note that if this is disabled then length\n * changing must also be disabled.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bPaginate\": null,\n\n /**\n * Processing indicator enable flag whenever DataTables is enacting a\n * user request - typically an Ajax request for server-side processing.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bProcessing\": null,\n\n /**\n * Server-side processing enabled flag - when enabled DataTables will\n * get all data from the server for every draw - there is no filtering,\n * sorting or paging done on the client-side.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bServerSide\": null,\n\n /**\n * Sorting enablement flag.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bSort\": null,\n\n /**\n * Apply a class to the columns which are being sorted to provide a\n * visual highlight or not. This can slow things down when enabled since\n * there is a lot of DOM interaction.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bSortClasses\": null,\n\n /**\n * State saving enablement flag.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bStateSave\": null\n },\n\n\n /**\n * Scrolling settings for a table.\n * @namespace\n */\n \"oScroll\": {\n /**\n * Indicate if DataTables should be allowed to set the padding / margin\n * etc for the scrolling header elements or not. Typically you will want\n * this.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bAutoCss\": null,\n\n /**\n * When the table is shorter in height than sScrollY, collapse the\n * table container down to the height of the table (when true).\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bCollapse\": null,\n\n /**\n * Infinite scrolling enablement flag. Now deprecated in favour of\n * using the Scroller plug-in.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bInfinite\": null,\n\n /**\n * Width of the scrollbar for the web-browser's platform. Calculated\n * during table initialisation.\n * @type int\n * @default 0\n */\n \"iBarWidth\": 0,\n\n /**\n * Space (in pixels) between the bottom of the scrolling container and\n * the bottom of the scrolling viewport before the next page is loaded\n * when using infinite scrolling.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type int\n */\n \"iLoadGap\": null,\n\n /**\n * Viewport width for horizontal scrolling. Horizontal scrolling is\n * disabled if an empty string.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n */\n \"sX\": null,\n\n /**\n * Width to expand the table to when using x-scrolling. Typically you\n * should not need to use this.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n * @deprecated\n */\n \"sXInner\": null,\n\n /**\n * Viewport height for vertical scrolling. Vertical scrolling is disabled\n * if an empty string.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n */\n \"sY\": null\n },\n\n /**\n * Language information for the table.\n * @namespace\n * @extends DataTable.defaults.oLanguage\n */\n \"oLanguage\": {\n /**\n * Information callback function. See\n * {@link DataTable.defaults.fnInfoCallback}\n * @type function\n * @default null\n */\n \"fnInfoCallback\": null\n },\n\n /**\n * Browser support parameters\n * @namespace\n */\n \"oBrowser\": {\n /**\n * Indicate if the browser incorrectly calculates width:100% inside a\n * scrolling element (IE6/7)\n * @type boolean\n * @default false\n */\n \"bScrollOversize\": false\n },\n\n /**\n * Array referencing the nodes which are used for the features. The\n * parameters of this object match what is allowed by sDom - i.e.\n *
      \n *
    • 'l' - Length changing
    • \n *
    • 'f' - Filtering input
    • \n *
    • 't' - The table!
    • \n *
    • 'i' - Information
    • \n *
    • 'p' - Pagination
    • \n *
    • 'r' - pRocessing
    • \n *
    \n * @type array\n * @default []\n */\n \"aanFeatures\": [],\n\n /**\n * Store data information - see {@link DataTable.models.oRow} for detailed\n * information.\n * @type array\n * @default []\n */\n \"aoData\": [],\n\n /**\n * Array of indexes which are in the current display (after filtering etc)\n * @type array\n * @default []\n */\n \"aiDisplay\": [],\n\n /**\n * Array of indexes for display - no filtering\n * @type array\n * @default []\n */\n \"aiDisplayMaster\": [],\n\n /**\n * Store information about each column that is in use\n * @type array\n * @default []\n */\n \"aoColumns\": [],\n\n /**\n * Store information about the table's header\n * @type array\n * @default []\n */\n \"aoHeader\": [],\n\n /**\n * Store information about the table's footer\n * @type array\n * @default []\n */\n \"aoFooter\": [],\n\n /**\n * Search data array for regular expression searching\n * @type array\n * @default []\n */\n \"asDataSearch\": [],\n\n /**\n * Store the applied global search information in case we want to force a\n * research or compare the old search to a new one.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @namespace\n * @extends DataTable.models.oSearch\n */\n \"oPreviousSearch\": {},\n\n /**\n * Store the applied search for each column - see\n * {@link DataTable.models.oSearch} for the format that is used for the\n * filtering information for each column.\n * @type array\n * @default []\n */\n \"aoPreSearchCols\": [],\n\n /**\n * Sorting that is applied to the table. Note that the inner arrays are\n * used in the following manner:\n *
      \n *
    • Index 0 - column number
    • \n *
    • Index 1 - current sorting direction
    • \n *
    • Index 2 - index of asSorting for this column
    • \n *
    \n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type array\n * @todo These inner arrays should really be objects\n */\n \"aaSorting\": null,\n\n /**\n * Sorting that is always applied to the table (i.e. prefixed in front of\n * aaSorting).\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type array|null\n * @default null\n */\n \"aaSortingFixed\": null,\n\n /**\n * Classes to use for the striping of a table.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type array\n * @default []\n */\n \"asStripeClasses\": null,\n\n /**\n * If restoring a table - we should restore its striping classes as well\n * @type array\n * @default []\n */\n \"asDestroyStripes\": [],\n\n /**\n * If restoring a table - we should restore its width\n * @type int\n * @default 0\n */\n \"sDestroyWidth\": 0,\n\n /**\n * Callback functions array for every time a row is inserted (i.e. on a draw).\n * @type array\n * @default []\n */\n \"aoRowCallback\": [],\n\n /**\n * Callback functions for the header on each draw.\n * @type array\n * @default []\n */\n \"aoHeaderCallback\": [],\n\n /**\n * Callback function for the footer on each draw.\n * @type array\n * @default []\n */\n \"aoFooterCallback\": [],\n\n /**\n * Array of callback functions for draw callback functions\n * @type array\n * @default []\n */\n \"aoDrawCallback\": [],\n\n /**\n * Array of callback functions for row created function\n * @type array\n * @default []\n */\n \"aoRowCreatedCallback\": [],\n\n /**\n * Callback functions for just before the table is redrawn. A return of\n * false will be used to cancel the draw.\n * @type array\n * @default []\n */\n \"aoPreDrawCallback\": [],\n\n /**\n * Callback functions for when the table has been initialised.\n * @type array\n * @default []\n */\n \"aoInitComplete\": [],\n\n\n /**\n * Callbacks for modifying the settings to be stored for state saving, prior to\n * saving state.\n * @type array\n * @default []\n */\n \"aoStateSaveParams\": [],\n\n /**\n * Callbacks for modifying the settings that have been stored for state saving\n * prior to using the stored values to restore the state.\n * @type array\n * @default []\n */\n \"aoStateLoadParams\": [],\n\n /**\n * Callbacks for operating on the settings object once the saved state has been\n * loaded\n * @type array\n * @default []\n */\n \"aoStateLoaded\": [],\n\n /**\n * Cache the table ID for quick access\n * @type string\n * @default Empty string\n */\n \"sTableId\": \"\",\n\n /**\n * The TABLE node for the main table\n * @type node\n * @default null\n */\n \"nTable\": null,\n\n /**\n * Permanent ref to the thead element\n * @type node\n * @default null\n */\n \"nTHead\": null,\n\n /**\n * Permanent ref to the tfoot element - if it exists\n * @type node\n * @default null\n */\n \"nTFoot\": null,\n\n /**\n * Permanent ref to the tbody element\n * @type node\n * @default null\n */\n \"nTBody\": null,\n\n /**\n * Cache the wrapper node (contains all DataTables controlled elements)\n * @type node\n * @default null\n */\n \"nTableWrapper\": null,\n\n /**\n * Indicate if when using server-side processing the loading of data\n * should be deferred until the second draw.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n * @default false\n */\n \"bDeferLoading\": false,\n\n /**\n * Indicate if all required information has been read in\n * @type boolean\n * @default false\n */\n \"bInitialised\": false,\n\n /**\n * Information about open rows. Each object in the array has the parameters\n * 'nTr' and 'nParent'\n * @type array\n * @default []\n */\n \"aoOpenRows\": [],\n\n /**\n * Dictate the positioning of DataTables' control elements - see\n * {@link DataTable.model.oInit.sDom}.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n * @default null\n */\n \"sDom\": null,\n\n /**\n * Which type of pagination should be used.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n * @default two_button\n */\n \"sPaginationType\": \"two_button\",\n\n /**\n * The cookie duration (for bStateSave) in seconds.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type int\n * @default 0\n */\n \"iCookieDuration\": 0,\n\n /**\n * The cookie name prefix.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n * @default Empty string\n */\n \"sCookiePrefix\": \"\",\n\n /**\n * Callback function for cookie creation.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type function\n * @default null\n */\n \"fnCookieCallback\": null,\n\n /**\n * Array of callback functions for state saving. Each array element is an\n * object with the following parameters:\n *
      \n *
    • function:fn - function to call. Takes two parameters, oSettings\n * and the JSON string to save that has been thus far created. Returns\n * a JSON string to be inserted into a json object\n * (i.e. '\"param\": [ 0, 1, 2]')
    • \n *
    • string:sName - name of callback
    • \n *
    \n * @type array\n * @default []\n */\n \"aoStateSave\": [],\n\n /**\n * Array of callback functions for state loading. Each array element is an\n * object with the following parameters:\n *
      \n *
    • function:fn - function to call. Takes two parameters, oSettings\n * and the object stored. May return false to cancel state loading
    • \n *
    • string:sName - name of callback
    • \n *
    \n * @type array\n * @default []\n */\n \"aoStateLoad\": [],\n\n /**\n * State that was loaded from the cookie. Useful for back reference\n * @type object\n * @default null\n */\n \"oLoadedState\": null,\n\n /**\n * Source url for AJAX data for the table.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n * @default null\n */\n \"sAjaxSource\": null,\n\n /**\n * Property from a given object from which to read the table data from. This\n * can be an empty string (when not server-side processing), in which case\n * it is assumed an an array is given directly.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n */\n \"sAjaxDataProp\": null,\n\n /**\n * Note if draw should be blocked while getting data\n * @type boolean\n * @default true\n */\n \"bAjaxDataGet\": true,\n\n /**\n * The last jQuery XHR object that was used for server-side data gathering.\n * This can be used for working with the XHR information in one of the\n * callbacks\n * @type object\n * @default null\n */\n \"jqXHR\": null,\n\n /**\n * Function to get the server-side data.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type function\n */\n \"fnServerData\": null,\n\n /**\n * Functions which are called prior to sending an Ajax request so extra\n * parameters can easily be sent to the server\n * @type array\n * @default []\n */\n \"aoServerParams\": [],\n\n /**\n * Send the XHR HTTP method - GET or POST (could be PUT or DELETE if\n * required).\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type string\n */\n \"sServerMethod\": null,\n\n /**\n * Format numbers for display.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type function\n */\n \"fnFormatNumber\": null,\n\n /**\n * List of options that can be used for the user selectable length menu.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type array\n * @default []\n */\n \"aLengthMenu\": null,\n\n /**\n * Counter for the draws that the table does. Also used as a tracker for\n * server-side processing\n * @type int\n * @default 0\n */\n \"iDraw\": 0,\n\n /**\n * Indicate if a redraw is being done - useful for Ajax\n * @type boolean\n * @default false\n */\n \"bDrawing\": false,\n\n /**\n * Draw index (iDraw) of the last error when parsing the returned data\n * @type int\n * @default -1\n */\n \"iDrawError\": -1,\n\n /**\n * Paging display length\n * @type int\n * @default 10\n */\n \"_iDisplayLength\": 10,\n\n /**\n * Paging start point - aiDisplay index\n * @type int\n * @default 0\n */\n \"_iDisplayStart\": 0,\n\n /**\n * Paging end point - aiDisplay index. Use fnDisplayEnd rather than\n * this property to get the end point\n * @type int\n * @default 10\n * @private\n */\n \"_iDisplayEnd\": 10,\n\n /**\n * Server-side processing - number of records in the result set\n * (i.e. before filtering), Use fnRecordsTotal rather than\n * this property to get the value of the number of records, regardless of\n * the server-side processing setting.\n * @type int\n * @default 0\n * @private\n */\n \"_iRecordsTotal\": 0,\n\n /**\n * Server-side processing - number of records in the current display set\n * (i.e. after filtering). Use fnRecordsDisplay rather than\n * this property to get the value of the number of records, regardless of\n * the server-side processing setting.\n * @type boolean\n * @default 0\n * @private\n */\n \"_iRecordsDisplay\": 0,\n\n /**\n * Flag to indicate if jQuery UI marking and classes should be used.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bJUI\": null,\n\n /**\n * The classes to use for the table\n * @type object\n * @default {}\n */\n \"oClasses\": {},\n\n /**\n * Flag attached to the settings object so you can check in the draw\n * callback if filtering has been done in the draw. Deprecated in favour of\n * events.\n * @type boolean\n * @default false\n * @deprecated\n */\n \"bFiltered\": false,\n\n /**\n * Flag attached to the settings object so you can check in the draw\n * callback if sorting has been done in the draw. Deprecated in favour of\n * events.\n * @type boolean\n * @default false\n * @deprecated\n */\n \"bSorted\": false,\n\n /**\n * Indicate that if multiple rows are in the header and there is more than\n * one unique cell per column, if the top one (true) or bottom one (false)\n * should be used for sorting / title by DataTables.\n * Note that this parameter will be set by the initialisation routine. To\n * set a default use {@link DataTable.defaults}.\n * @type boolean\n */\n \"bSortCellsTop\": null,\n\n /**\n * Initialisation object that is used for the table\n * @type object\n * @default null\n */\n \"oInit\": null,\n\n /**\n * Destroy callback functions - for plug-ins to attach themselves to the\n * destroy so they can clean up markup and events.\n * @type array\n * @default []\n */\n \"aoDestroyCallback\": [],\n\n\n /**\n * Get the number of records in the current record set, before filtering\n * @type function\n */\n \"fnRecordsTotal\": function() {\n if (this.oFeatures.bServerSide) {\n return parseInt(this._iRecordsTotal, 10);\n } else {\n return this.aiDisplayMaster.length;\n }\n },\n\n /**\n * Get the number of records in the current record set, after filtering\n * @type function\n */\n \"fnRecordsDisplay\": function() {\n if (this.oFeatures.bServerSide) {\n return parseInt(this._iRecordsDisplay, 10);\n } else {\n return this.aiDisplay.length;\n }\n },\n\n /**\n * Set the display end point - aiDisplay index\n * @type function\n * @todo Should do away with _iDisplayEnd and calculate it on-the-fly here\n */\n \"fnDisplayEnd\": function() {\n if (this.oFeatures.bServerSide) {\n if (this.oFeatures.bPaginate === false || this._iDisplayLength == -1) {\n return this._iDisplayStart + this.aiDisplay.length;\n } else {\n return Math.min(this._iDisplayStart + this._iDisplayLength,\n this._iRecordsDisplay);\n }\n } else {\n return this._iDisplayEnd;\n }\n },\n\n /**\n * The DataTables object for this table\n * @type object\n * @default null\n */\n \"oInstance\": null,\n\n /**\n * Unique identifier for each instance of the DataTables object. If there\n * is an ID on the table node, then it takes that value, otherwise an\n * incrementing internal counter is used.\n * @type string\n * @default null\n */\n \"sInstance\": null,\n\n /**\n * tabindex attribute value that is added to DataTables control elements, allowing\n * keyboard navigation of the table and its controls.\n */\n \"iTabIndex\": 0,\n\n /**\n * DIV container for the footer scrolling table if scrolling\n */\n \"nScrollHead\": null,\n\n /**\n * DIV container for the footer scrolling table if scrolling\n */\n \"nScrollFoot\": null\n };\n\n /**\n * Extension object for DataTables that is used to provide all extension options.\n *\n * Note that the DataTable.ext object is available through\n * jQuery.fn.dataTable.ext where it may be accessed and manipulated. It is\n * also aliased to jQuery.fn.dataTableExt for historic reasons.\n * @namespace\n * @extends DataTable.models.ext\n */\n DataTable.ext = $.extend(true, {}, DataTable.models.ext);\n\n $.extend(DataTable.ext.oStdClasses, {\n \"sTable\": \"dataTable\",\n\n /* Two buttons buttons */\n \"sPagePrevEnabled\": \"paginate_enabled_previous\",\n \"sPagePrevDisabled\": \"paginate_disabled_previous\",\n \"sPageNextEnabled\": \"paginate_enabled_next\",\n \"sPageNextDisabled\": \"paginate_disabled_next\",\n \"sPageJUINext\": \"\",\n \"sPageJUIPrev\": \"\",\n\n /* Full numbers paging buttons */\n \"sPageButton\": \"paginate_button\",\n \"sPageButtonActive\": \"paginate_active\",\n \"sPageButtonStaticDisabled\": \"paginate_button paginate_button_disabled\",\n \"sPageFirst\": \"first\",\n \"sPagePrevious\": \"previous\",\n \"sPageNext\": \"next\",\n \"sPageLast\": \"last\",\n\n /* Striping classes */\n \"sStripeOdd\": \"odd\",\n \"sStripeEven\": \"even\",\n\n /* Empty row */\n \"sRowEmpty\": \"dataTables_empty\",\n\n /* Features */\n \"sWrapper\": \"dataTables_wrapper\",\n \"sFilter\": \"dataTables_filter\",\n \"sInfo\": \"dataTables_info\",\n \"sPaging\": \"dataTables_paginate paging_\", /* Note that the type is postfixed */\n \"sLength\": \"dataTables_length\",\n \"sProcessing\": \"dataTables_processing\",\n\n /* Sorting */\n \"sSortAsc\": \"sorting_asc\",\n \"sSortDesc\": \"sorting_desc\",\n \"sSortable\": \"sorting\", /* Sortable in both directions */\n \"sSortableAsc\": \"sorting_asc_disabled\",\n \"sSortableDesc\": \"sorting_desc_disabled\",\n \"sSortableNone\": \"sorting_disabled\",\n \"sSortColumn\": \"sorting_\", /* Note that an int is postfixed for the sorting order */\n \"sSortJUIAsc\": \"\",\n \"sSortJUIDesc\": \"\",\n \"sSortJUI\": \"\",\n \"sSortJUIAscAllowed\": \"\",\n \"sSortJUIDescAllowed\": \"\",\n \"sSortJUIWrapper\": \"\",\n \"sSortIcon\": \"\",\n\n /* Scrolling */\n \"sScrollWrapper\": \"dataTables_scroll\",\n \"sScrollHead\": \"dataTables_scrollHead\",\n \"sScrollHeadInner\": \"dataTables_scrollHeadInner\",\n \"sScrollBody\": \"dataTables_scrollBody\",\n \"sScrollFoot\": \"dataTables_scrollFoot\",\n \"sScrollFootInner\": \"dataTables_scrollFootInner\",\n\n /* Misc */\n \"sFooterTH\": \"\",\n \"sJUIHeader\": \"\",\n \"sJUIFooter\": \"\"\n });\n\n\n $.extend(DataTable.ext.oJUIClasses, DataTable.ext.oStdClasses, {\n /* Two buttons buttons */\n \"sPagePrevEnabled\": \"fg-button ui-button ui-state-default ui-corner-left\",\n \"sPagePrevDisabled\": \"fg-button ui-button ui-state-default ui-corner-left ui-state-disabled\",\n \"sPageNextEnabled\": \"fg-button ui-button ui-state-default ui-corner-right\",\n \"sPageNextDisabled\": \"fg-button ui-button ui-state-default ui-corner-right ui-state-disabled\",\n \"sPageJUINext\": \"ui-icon ui-icon-circle-arrow-e\",\n \"sPageJUIPrev\": \"ui-icon ui-icon-circle-arrow-w\",\n\n /* Full numbers paging buttons */\n \"sPageButton\": \"fg-button ui-button ui-state-default\",\n \"sPageButtonActive\": \"fg-button ui-button ui-state-default ui-state-disabled\",\n \"sPageButtonStaticDisabled\": \"fg-button ui-button ui-state-default ui-state-disabled\",\n \"sPageFirst\": \"first ui-corner-tl ui-corner-bl\",\n \"sPageLast\": \"last ui-corner-tr ui-corner-br\",\n\n /* Features */\n \"sPaging\": \"dataTables_paginate fg-buttonset ui-buttonset fg-buttonset-multi \" +\n \"ui-buttonset-multi paging_\", /* Note that the type is postfixed */\n\n /* Sorting */\n \"sSortAsc\": \"ui-state-default\",\n \"sSortDesc\": \"ui-state-default\",\n \"sSortable\": \"ui-state-default\",\n \"sSortableAsc\": \"ui-state-default\",\n \"sSortableDesc\": \"ui-state-default\",\n \"sSortableNone\": \"ui-state-default\",\n \"sSortJUIAsc\": \"css_right ui-icon ui-icon-triangle-1-n\",\n \"sSortJUIDesc\": \"css_right ui-icon ui-icon-triangle-1-s\",\n \"sSortJUI\": \"css_right ui-icon ui-icon-carat-2-n-s\",\n \"sSortJUIAscAllowed\": \"css_right ui-icon ui-icon-carat-1-n\",\n \"sSortJUIDescAllowed\": \"css_right ui-icon ui-icon-carat-1-s\",\n \"sSortJUIWrapper\": \"DataTables_sort_wrapper\",\n \"sSortIcon\": \"DataTables_sort_icon\",\n\n /* Scrolling */\n \"sScrollHead\": \"dataTables_scrollHead ui-state-default\",\n \"sScrollFoot\": \"dataTables_scrollFoot ui-state-default\",\n\n /* Misc */\n \"sFooterTH\": \"ui-state-default\",\n \"sJUIHeader\": \"fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix\",\n \"sJUIFooter\": \"fg-toolbar ui-toolbar ui-widget-header ui-corner-bl ui-corner-br ui-helper-clearfix\"\n });\n\n /*\n\t * Variable: oPagination\n\t * Purpose:\n\t * Scope: jQuery.fn.dataTableExt\n\t */\n $.extend(DataTable.ext.oPagination, {\n /*\n\t\t * Variable: two_button\n\t\t * Purpose: Standard two button (forward/back) pagination\n\t\t * Scope: jQuery.fn.dataTableExt.oPagination\n\t\t */\n \"two_button\": {\n /*\n\t\t\t * Function: oPagination.two_button.fnInit\n\t\t\t * Purpose: Initialise dom elements required for pagination with forward/back buttons only\n\t\t\t * Returns: -\n\t\t\t * Inputs: object:oSettings - dataTables settings object\n\t\t\t * node:nPaging - the DIV which contains this pagination control\n\t\t\t * function:fnCallbackDraw - draw function which must be called on update\n\t\t\t */\n \"fnInit\": function(oSettings, nPaging, fnCallbackDraw) {\n var oLang = oSettings.oLanguage.oPaginate;\n var oClasses = oSettings.oClasses;\n var fnClickHandler = function(e) {\n if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) {\n fnCallbackDraw(oSettings);\n }\n };\n\n var sAppend = (!oSettings.bJUI) ?\n '' + oLang.sPrevious + '' +\n '' + oLang.sNext + ''\n :\n '' +\n '';\n $(nPaging).append(sAppend);\n\n var els = $('a', nPaging);\n var nPrevious = els[0],\n nNext = els[1];\n\n oSettings.oApi._fnBindAction(nPrevious, {action: \"previous\"}, fnClickHandler);\n oSettings.oApi._fnBindAction(nNext, {action: \"next\"}, fnClickHandler);\n\n /* ID the first elements only */\n if (!oSettings.aanFeatures.p) {\n nPaging.id = oSettings.sTableId + '_paginate';\n nPrevious.id = oSettings.sTableId + '_previous';\n nNext.id = oSettings.sTableId + '_next';\n\n nPrevious.setAttribute('aria-controls', oSettings.sTableId);\n nNext.setAttribute('aria-controls', oSettings.sTableId);\n }\n },\n\n /*\n\t\t\t * Function: oPagination.two_button.fnUpdate\n\t\t\t * Purpose: Update the two button pagination at the end of the draw\n\t\t\t * Returns: -\n\t\t\t * Inputs: object:oSettings - dataTables settings object\n\t\t\t * function:fnCallbackDraw - draw function to call on page change\n\t\t\t */\n \"fnUpdate\": function(oSettings, fnCallbackDraw) {\n if (!oSettings.aanFeatures.p) {\n return;\n }\n\n var oClasses = oSettings.oClasses;\n var an = oSettings.aanFeatures.p;\n var nNode;\n\n /* Loop over each instance of the pager */\n for (var i = 0, iLen = an.length; i < iLen; i++) {\n nNode = an[i].firstChild;\n if (nNode) {\n /* Previous page */\n nNode.className = (oSettings._iDisplayStart === 0) ?\n oClasses.sPagePrevDisabled : oClasses.sPagePrevEnabled;\n\n /* Next page */\n nNode = nNode.nextSibling;\n nNode.className = (oSettings.fnDisplayEnd() == oSettings.fnRecordsDisplay()) ?\n oClasses.sPageNextDisabled : oClasses.sPageNextEnabled;\n }\n }\n }\n },\n\n\n /*\n\t\t * Variable: iFullNumbersShowPages\n\t\t * Purpose: Change the number of pages which can be seen\n\t\t * Scope: jQuery.fn.dataTableExt.oPagination\n\t\t */\n \"iFullNumbersShowPages\": 5,\n\n /*\n\t\t * Variable: full_numbers\n\t\t * Purpose: Full numbers pagination\n\t\t * Scope: jQuery.fn.dataTableExt.oPagination\n\t\t */\n \"full_numbers\": {\n /*\n\t\t\t * Function: oPagination.full_numbers.fnInit\n\t\t\t * Purpose: Initialise dom elements required for pagination with a list of the pages\n\t\t\t * Returns: -\n\t\t\t * Inputs: object:oSettings - dataTables settings object\n\t\t\t * node:nPaging - the DIV which contains this pagination control\n\t\t\t * function:fnCallbackDraw - draw function which must be called on update\n\t\t\t */\n \"fnInit\": function(oSettings, nPaging, fnCallbackDraw) {\n var oLang = oSettings.oLanguage.oPaginate;\n var oClasses = oSettings.oClasses;\n var fnClickHandler = function(e) {\n if (oSettings.oApi._fnPageChange(oSettings, e.data.action)) {\n fnCallbackDraw(oSettings);\n }\n };\n\n $(nPaging).append(\n '' + oLang.sFirst + '' +\n '' + oLang.sPrevious + '' +\n '' +\n '' + oLang.sNext + '' +\n '' + oLang.sLast + ''\n );\n var els = $('a', nPaging);\n var nFirst = els[0],\n nPrev = els[1],\n nNext = els[2],\n nLast = els[3];\n\n oSettings.oApi._fnBindAction(nFirst, {action: \"first\"}, fnClickHandler);\n oSettings.oApi._fnBindAction(nPrev, {action: \"previous\"}, fnClickHandler);\n oSettings.oApi._fnBindAction(nNext, {action: \"next\"}, fnClickHandler);\n oSettings.oApi._fnBindAction(nLast, {action: \"last\"}, fnClickHandler);\n\n /* ID the first elements only */\n if (!oSettings.aanFeatures.p) {\n nPaging.id = oSettings.sTableId + '_paginate';\n nFirst.id = oSettings.sTableId + '_first';\n nPrev.id = oSettings.sTableId + '_previous';\n nNext.id = oSettings.sTableId + '_next';\n nLast.id = oSettings.sTableId + '_last';\n }\n },\n\n /*\n\t\t\t * Function: oPagination.full_numbers.fnUpdate\n\t\t\t * Purpose: Update the list of page buttons shows\n\t\t\t * Returns: -\n\t\t\t * Inputs: object:oSettings - dataTables settings object\n\t\t\t * function:fnCallbackDraw - draw function to call on page change\n\t\t\t */\n \"fnUpdate\": function(oSettings, fnCallbackDraw) {\n if (!oSettings.aanFeatures.p) {\n return;\n }\n\n var iPageCount = DataTable.ext.oPagination.iFullNumbersShowPages;\n var iPageCountHalf = Math.floor(iPageCount / 2);\n var iPages = Math.ceil((oSettings.fnRecordsDisplay()) / oSettings._iDisplayLength);\n var iCurrentPage = Math.ceil(oSettings._iDisplayStart / oSettings._iDisplayLength) + 1;\n var sList = \"\";\n var iStartButton, iEndButton, i, iLen;\n var oClasses = oSettings.oClasses;\n var anButtons, anStatic, nPaginateList, nNode;\n var an = oSettings.aanFeatures.p;\n var fnBind = function(j) {\n oSettings.oApi._fnBindAction(this, {\"page\": j + iStartButton - 1}, function(e) {\n /* Use the information in the element to jump to the required page */\n oSettings.oApi._fnPageChange(oSettings, e.data.page);\n fnCallbackDraw(oSettings);\n e.preventDefault();\n });\n };\n\n /* Pages calculation */\n if (oSettings._iDisplayLength === -1) {\n iStartButton = 1;\n iEndButton = 1;\n iCurrentPage = 1;\n } else if (iPages < iPageCount) {\n iStartButton = 1;\n iEndButton = iPages;\n } else if (iCurrentPage <= iPageCountHalf) {\n iStartButton = 1;\n iEndButton = iPageCount;\n } else if (iCurrentPage >= (iPages - iPageCountHalf)) {\n iStartButton = iPages - iPageCount + 1;\n iEndButton = iPages;\n } else {\n iStartButton = iCurrentPage - Math.ceil(iPageCount / 2) + 1;\n iEndButton = iStartButton + iPageCount - 1;\n }\n\n\n /* Build the dynamic list */\n for (i = iStartButton; i <= iEndButton; i++) {\n sList += (iCurrentPage !== i) ?\n '' + oSettings.fnFormatNumber(i) + '' :\n '' + oSettings.fnFormatNumber(i) + '';\n }\n\n /* Loop over each instance of the pager */\n for (i = 0, iLen = an.length; i < iLen; i++) {\n nNode = an[i];\n if (!nNode.hasChildNodes()) {\n continue;\n }\n\n /* Build up the dynamic list first - html and listeners */\n $('span:eq(0)', nNode)\n .html(sList)\n .children('a').each(fnBind);\n\n /* Update the permanent button's classes */\n anButtons = nNode.getElementsByTagName('a');\n anStatic = [\n anButtons[0], anButtons[1],\n anButtons[anButtons.length - 2], anButtons[anButtons.length - 1]\n ];\n\n $(anStatic).removeClass(oClasses.sPageButton + \" \" + oClasses.sPageButtonActive + \" \" + oClasses.sPageButtonStaticDisabled);\n $([anStatic[0], anStatic[1]]).addClass(\n (iCurrentPage == 1) ?\n oClasses.sPageButtonStaticDisabled :\n oClasses.sPageButton\n );\n $([anStatic[2], anStatic[3]]).addClass(\n (iPages === 0 || iCurrentPage === iPages || oSettings._iDisplayLength === -1) ?\n oClasses.sPageButtonStaticDisabled :\n oClasses.sPageButton\n );\n }\n }\n }\n });\n\n $.extend(DataTable.ext.oSort, {\n /*\n\t\t * text sorting\n\t\t */\n \"string-pre\": function(a) {\n if (typeof a != 'string') {\n a = (a !== null && a.toString) ? a.toString() : '';\n }\n return a.toLowerCase();\n },\n\n \"string-asc\": function(x, y) {\n return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n },\n\n \"string-desc\": function(x, y) {\n return ((x < y) ? 1 : ((x > y) ? -1 : 0));\n },\n\n\n /*\n\t\t * html sorting (ignore html tags)\n\t\t */\n \"html-pre\": function(a) {\n return a.replace(/<.*?>/g, \"\").toLowerCase();\n },\n\n \"html-asc\": function(x, y) {\n return ((x < y) ? -1 : ((x > y) ? 1 : 0));\n },\n\n \"html-desc\": function(x, y) {\n return ((x < y) ? 1 : ((x > y) ? -1 : 0));\n },\n\n\n /*\n\t\t * date sorting\n\t\t */\n \"date-pre\": function(a) {\n var x = Date.parse(a);\n\n if (isNaN(x) || x === \"\") {\n x = Date.parse(\"01/01/1970 00:00:00\");\n }\n return x;\n },\n\n \"date-asc\": function(x, y) {\n return x - y;\n },\n\n \"date-desc\": function(x, y) {\n return y - x;\n },\n\n\n /*\n\t\t * numerical sorting\n\t\t */\n \"numeric-pre\": function(a) {\n return (a == \"-\" || a === \"\") ? 0 : a * 1;\n },\n\n \"numeric-asc\": function(x, y) {\n return x - y;\n },\n\n \"numeric-desc\": function(x, y) {\n return y - x;\n }\n });\n\n\n $.extend(DataTable.ext.aTypes, [\n /*\n\t\t * Function: -\n\t\t * Purpose: Check to see if a string is numeric\n\t\t * Returns: string:'numeric' or null\n\t\t * Inputs: mixed:sText - string to check\n\t\t */\n function(sData) {\n /* Allow zero length strings as a number */\n if (typeof sData === 'number') {\n return 'numeric';\n } else if (typeof sData !== 'string') {\n return null;\n }\n\n var sValidFirstChars = \"0123456789-\";\n var sValidChars = \"0123456789.\";\n var Char;\n var bDecimal = false;\n\n /* Check for a valid first char (no period and allow negatives) */\n Char = sData.charAt(0);\n if (sValidFirstChars.indexOf(Char) == -1) {\n return null;\n }\n\n /* Check all the other characters are valid */\n for (var i = 1; i < sData.length; i++) {\n Char = sData.charAt(i);\n if (sValidChars.indexOf(Char) == -1) {\n return null;\n }\n\n /* Only allowed one decimal place... */\n if (Char == \".\") {\n if (bDecimal) {\n return null;\n }\n bDecimal = true;\n }\n }\n\n return 'numeric';\n },\n\n /*\n\t\t * Function: -\n\t\t * Purpose: Check to see if a string is actually a formatted date\n\t\t * Returns: string:'date' or null\n\t\t * Inputs: string:sText - string to check\n\t\t */\n function(sData) {\n var iParse = Date.parse(sData);\n if ((iParse !== null && !isNaN(iParse)) || (typeof sData === 'string' && sData.length === 0)) {\n return 'date';\n }\n return null;\n },\n\n /*\n\t\t * Function: -\n\t\t * Purpose: Check to see if a string should be treated as an HTML string\n\t\t * Returns: string:'html' or null\n\t\t * Inputs: string:sText - string to check\n\t\t */\n function(sData) {\n if (typeof sData === 'string' && sData.indexOf('<') != -1 && sData.indexOf('>') != -1) {\n return 'html';\n }\n return null;\n }\n ]);\n\n\n // jQuery aliases\n $.fn.DataTable = DataTable;\n $.fn.dataTable = DataTable;\n $.fn.dataTableSettings = DataTable.settings;\n $.fn.dataTableExt = DataTable.ext;\n\n\n // Information about events fired by DataTables - for documentation.\n /**\n * Draw event, fired whenever the table is redrawn on the page, at the same point as\n * fnDrawCallback. This may be useful for binding events or performing calculations when\n * the table is altered at all.\n * @name DataTable#draw\n * @event\n * @param {event} e jQuery event object\n * @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n */\n\n /**\n * Filter event, fired when the filtering applied to the table (using the build in global\n * global filter, or column filters) is altered.\n * @name DataTable#filter\n * @event\n * @param {event} e jQuery event object\n * @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n */\n\n /**\n * Page change event, fired when the paging of the table is altered.\n * @name DataTable#page\n * @event\n * @param {event} e jQuery event object\n * @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n */\n\n /**\n * Sort event, fired when the sorting applied to the table is altered.\n * @name DataTable#sort\n * @event\n * @param {event} e jQuery event object\n * @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n */\n\n /**\n * DataTables initialisation complete event, fired when the table is fully drawn,\n * including Ajax data loaded, if Ajax data is required.\n * @name DataTable#init\n * @event\n * @param {event} e jQuery event object\n * @param {object} oSettings DataTables settings object\n * @param {object} json The JSON object request from the server - only\n * present if client-side Ajax sourced data is used
  • \n */\n\n /**\n * State save event, fired when the table has changed state a new state save is required.\n * This method allows modification of the state saving object prior to actually doing the\n * save, including addition or other state properties (for plug-ins) or modification\n * of a DataTables core property.\n * @name DataTable#stateSaveParams\n * @event\n * @param {event} e jQuery event object\n * @param {object} oSettings DataTables settings object\n * @param {object} json The state information to be saved\n */\n\n /**\n * State load event, fired when the table is loading state from the stored data, but\n * prior to the settings object being modified by the saved state - allowing modification\n * of the saved state is required or loading of state for a plug-in.\n * @name DataTable#stateLoadParams\n * @event\n * @param {event} e jQuery event object\n * @param {object} oSettings DataTables settings object\n * @param {object} json The saved state information\n */\n\n /**\n * State loaded event, fired when state has been loaded from stored data and the settings\n * object has been modified by the loaded data.\n * @name DataTable#stateLoaded\n * @event\n * @param {event} e jQuery event object\n * @param {object} oSettings DataTables settings object\n * @param {object} json The saved state information\n */\n\n /**\n * Processing event, fired when DataTables is doing some kind of processing (be it,\n * sort, filter or anything else). Can be used to indicate to the end user that\n * there is something happening, or that something has finished.\n * @name DataTable#processing\n * @event\n * @param {event} e jQuery event object\n * @param {object} oSettings DataTables settings object\n * @param {boolean} bShow Flag for if DataTables is doing processing or not\n */\n\n /**\n * Ajax (XHR) event, fired whenever an Ajax request is completed from a request to\n * made to the server for new data (note that this trigger is called in fnServerData,\n * if you override fnServerData and which to use this event, you need to trigger it in\n * you success function).\n * @name DataTable#xhr\n * @event\n * @param {event} e jQuery event object\n * @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n * @param {object} json JSON returned from the server\n */\n\n /**\n * Destroy event, fired when the DataTable is destroyed by calling fnDestroy or passing\n * the bDestroy:true parameter in the initialisation object. This can be used to remove\n * bound events, added DOM nodes, etc.\n * @name DataTable#destroy\n * @event\n * @param {event} e jQuery event object\n * @param {object} o DataTables settings object {@link DataTable.models.oSettings}\n */\n }));\n\n}(window, document));\n\n"],"names":["window","document","undefined","factory","$","DataTable","oInit","_fnAddColumn","oSettings","nTh","oDefaults","defaults","columns","iCol","aoColumns","length","oCol","extend","models","oColumn","oClasses","sSortable","sSortJUI","createElement","sTitle","innerHTML","aDataSort","mData","push","aoPreSearchCols","oSearch","oPre","bRegex","bSmart","bCaseInsensitive","_fnColumnOptions","oOptions","mDataProp","sType","_bAutoType","_fnMap","iDataSort","mRender","_fnGetObjectDataFn","fnGetData","oData","sSpecific","innerData","fnSetData","_fnSetObjectDataFn","oFeatures","bSort","bSortable","inArray","asSorting","sSortingClass","sSortableNone","sSortingClassJUI","sSortableAsc","sSortJUIAscAllowed","sSortableDesc","sSortJUIDescAllowed","_fnAdjustColumnSizing","bAutoWidth","_fnCalculateColumnWidths","i","iLen","style","width","sWidth","_fnVisibleToColumnIndex","iMatch","aiVis","_fnGetColumns","_fnColumnIndexToVisible","iPos","_fnVisbleColumns","sParam","a","map","val","_fnDetectType","sData","aTypes","ext","_fnReOrderIndex","sColumns","aColumns","split","aiReturn","j","sName","_fnColumnOrdering","sNames","slice","_fnApplyColumnDefs","aoColDefs","aoCols","fn","jLen","k","kLen","aTargets","isArray","_fnLog","hasClass","_fnAddData","aDataSupplied","sThisType","aDataIn","iRow","aoData","oRow","_aData","fnRender","bUseRendered","_fnSetCellData","_fnRender","_fnGetCellData","sVarType","aiDisplayMaster","bDeferRender","_fnCreateTr","_fnGatherData","jInner","nTds","nTrs","nTd","nTr","iThisIndex","iRows","iColumn","iColumns","sNodeName","bDeferLoading","sAjaxSource","nTBody","firstChild","nodeName","toUpperCase","_DT_RowIndex","trim","nextSibling","_fnGetTrNodes","nCell","sRendered","sValType","bAutoType","bRender","bClass","sClass","bVisible","className","_anHidden","parentNode","removeChild","fnCreatedCell","call","oInstance","aoRowCreatedCallback","_fnCallbackFire","_fnNodeToDataIndex","n","_fnNodeToColumnIndex","anCells","_fnGetTdNodes","_fnGetRowData","aiColumns","out","iDrawError","iDraw","sDefaultContent","__reArray","mSource","data","type","extra","indexOf","fetchData","src","arrayNotation","innerSrc","match","replace","splice","join","substring","setData","b","o","_fnGetDataMaster","aData","_fnClearTable","aiDisplay","_fnCalculateEnd","_fnDeleteIndex","iTarget","iTargetIndex","DT_RowId","id","DT_RowClass","sCellType","appendChild","_fnBuildHead","nTHead","setAttribute","iTabIndex","sTableId","addClass","html","_fnDetectHeader","aoHeader","children","attr","bJUI","nDiv","sSortJUIWrapper","contents","appendTo","nSpan","sSortIcon","_fnSortAttachListener","sFooterTH","nTFoot","_fnGetUniqueThs","aoFooter","nTf","_fnDrawHead","aoSource","bIncludeHidden","nLocalTr","iRowspan","iColspan","aoLocal","aApplied","cell","rowSpan","colSpan","_fnDraw","aPreDraw","anRows","iRowCount","iStripes","asStripeClasses","iOpenRows","aoOpenRows","bDrawing","iInitDisplayStart","bServerSide","_iDisplayStart","fnRecordsDisplay","bDestroying","_fnAjaxUpdate","iStart","iEnd","_iDisplayEnd","nRow","sStripe","_sRowStripe","removeClass","nParent","oLang","oLanguage","sZero","sZeroRecords","sEmptyTable","fnRecordsTotal","sLoadingRecords","sRowEmpty","_fnInfoMacros","fnDisplayEnd","nBodyPar","nAddFrag","createDocumentFragment","nRemoveFrag","oScroll","bInfinite","_bInitComplete","bSorted","bFiltered","_fnProcessingDisplay","_fnInitComplete","_fnReDraw","_fnSort","oPreviousSearch","bFilter","_fnFilterComplete","_fnAddOptionsHtml","nHolding","nTable","insertBefore","nTableWrapper","sWrapper","nTableReinsertBefore","nTmp","iPushFeature","cOption","nNewNode","cNext","sAttr","nInsertNode","aDom","sDom","sJUIHeader","sJUIFooter","aSplit","substr","charAt","bPaginate","bLengthChange","_fnFeatureHtmlLength","_fnFeatureHtmlFilter","bProcessing","_fnFeatureHtmlProcessing","_fnFeatureHtmlTable","bInfo","_fnFeatureHtmlInfo","_fnFeatureHtmlPaginate","aoFeatures","cFeature","fnInit","aanFeatures","replaceChild","aLayout","nThead","l","iColShifted","bUnique","fnShiftCol","getAttribute","nHeader","aReturn","unique","bSortCellsTop","bAjaxDataGet","_fnAjaxParameters","_fnServerParams","fnServerData","json","_fnAjaxUpdateDraw","aaSort","_iDisplayLength","sSearch","bSearchable","iCounter","aaSortingFixed","concat","aaSorting","sEcho","_iRecordsTotal","parseInt","iTotalRecords","_iRecordsDisplay","iTotalDisplayRecords","aiIndex","sOrdering","bReOrder","sAjaxDataProp","aDataSorted","sSearchStr","nFilter","sFilter","f","jqFilter","_DT_Input","bind","e","this","value","parents","keyCode","oInput","iForce","oPrevSearch","aoPrevSearch","fnSaveFilter","oFilter","_fnFilter","_fnFilterColumn","_fnFilterCustom","trigger","_fnBuildSearchArray","afnFilters","afnFiltering","aiFilterColumns","iCorrector","iDisIndex","sInput","rpSearch","_fnFilterCreateSearch","_fnDataToSearch","test","asDataSearch","iIndexCorrector","iMaster","_fnBuildSearchRow","text","sRegExpString","_fnEscapeRegex","RegExp","ofnSearch","sVal","reReplace","nInfo","sInfo","aoDrawCallback","_fnUpdateInfo","sOut","iMax","iTotal","sInfoEmpty","sInfoFiltered","sInfoPostFix","fnInfoCallback","str","sStart","fnFormatNumber","sEnd","sTotal","sMax","_fnInitialise","iAjaxStart","bInitialised","_fnStringToCss","setTimeout","_fnLanguageCompat","sStdMenu","aLengthMenu","nLength","sLength","sLengthMenu","iVal","nPaginate","sPaging","sPaginationType","oPagination","p","fnUpdate","_fnPageChange","mAction","iOldStart","iPages","nProcessing","r","sProcessing","bShow","an","visibility","sX","sY","nScroller","nScrollHead","nScrollHeadInner","nScrollBody","nScrollFoot","nScrollFootInner","nScrollHeadTable","cloneNode","nScrollFootTable","getElementsByTagName","nTfoot","sScrollWrapper","sScrollHead","sScrollHeadInner","sScrollBody","sScrollFoot","sScrollFootInner","bAutoCss","overflow","position","border","sXInner","removeAttribute","marginLeft","nCaption","_captionSide","scroll","scrollLeft","height","_fnScrollDraw","scrollTop","iLoadGap","anHeadToSize","anHeadSizers","anFootSizers","anFootToSize","oStyle","iVis","nTheadSize","nTfootSize","iSanityWidth","aAppliedFooter","ie67","oBrowser","bScrollOversize","zeroOut","nSizer","paddingTop","paddingBottom","borderTopWidth","borderBottomWidth","remove","clone","childNodes","nThs","_fnApplyToChildren","bCollapse","offsetHeight","outerWidth","css","iBarWidth","nToSize","iCorrection","scrollHeight","iExtra","offsetWidth","iOuterWidth","bScrolling","clientHeight","paddingRight","an1","an2","nNode1","nNode2","index","nodeType","_fnConvertToWidth","iWidth","body","iTmpWidth","iUserInputs","iVisibleColumns","iColums","oHeaders","widthAttr","nWrapper","sWidthOrig","nCalcTmp","nTheadClone","nBody","jqColSizing","_fnGetWidestNode","sContentPadding","_fnScrollingWidthAdjust","oNodes","cssWidth","iMaxIndex","_fnGetMaxLenString","s","c","charCodeAt","_fnScrollBarWidth","inner","padding","outer","top","left","w1","w2","clientWidth","bApplyClasses","sDataType","aiOrig","oSort","oAria","iVisColumn","sSortDataType","afnSortData","fnSortFormat","iSortLen","_aSortData","sort","lLen","iTest","_fnSortingClasses","nextSort","sSortAscending","sSortDescending","nNode","iDataIndex","fnCallback","_fnBindAction","fnInnerSorting","iNextSort","shiftKey","bFound","iFound","sSortAsc","sSortDesc","sSpanClass","jqSpan","sSortJUIAsc","sSortJUIDesc","sSortColumn","bSortClasses","iClass","iTargetCol","asClasses","sTmpClass","sCurrentClass","sNewClass","reClass","_fnSaveState","bStateSave","oState","Date","getTime","abVisCols","fnStateSave","_fnLoadState","fnStateLoad","abStateLoad","oLoadedState","iLength","saved_aaSorting","aoSearchCols","saved_aoColumns","_fnCreateCookie","sValue","iSecs","sBaseName","date","setTime","aParts","location","pathname","sNameFile","pop","toLowerCase","sFullCookie","parseJSON","eval","toGMTString","encodeURIComponent","aCookies","cookie","iNewCookieLen","aOldCookies","aSplitCookie","decodeURIComponent","iCreate","time","old","name","_fnReadCookie","sNameEQ","sCookieContents","_fnSettingsFromNode","settings","aNodes","iIndividualRow","anTds","anReturn","iLevel","sMesg","sAlert","console","log","sErrMode","Error","alert","oRet","oSrc","sMappedName","_fnExtend","oOut","oExtender","prop","hasOwnProperty","blur","which","_fnCallbackReg","sStore","sTrigger","aArgs","aoStore","aRet","apply","_fnJsonString","JSON","stringify","sProp","mValue","bArr","_fnBrowserDetect","_fnExternApiFunc","sFunc","iApiIndex","Array","prototype","arguments","oApi","sSelector","oOpts","tr","page","order","filter","jqA","jqTRs","jqDescendants","find","makeArray","_","aOut","aTrs","fnAddData","bRedraw","fnAdjustColumnSizing","fnDraw","fnClearTable","fnClose","nTrParent","fnDeleteRow","mTarget","fnCallBack","iAODataIndex","iDisplayIndex","fnDestroy","bRemove","nOrig","fnSetColumnVis","andSelf","unbind","parent","each","jqWrapper","kids","append","sDestroyWidth","asDestroyStripes","bComplete","fnFilter","bShowGlobal","activeElement","mRow","sNode","fnGetNodes","fnGetPosition","iColumnIndex","fnIsOpen","fnOpen","mHtml","nTableRows","nNewRow","nNewCell","insertAfter","fnPageChange","bAppend","iBefore","iInsert","fnSettings","fnSort","fnSortListener","bAction","sDisplay","isPlainObject","fnVersionCheck","_that","sId","bInitHandedOff","bUsePassedData","bRetrieve","bDestroy","_oExternConfig","iNextUnique","dataTable","fnDrawCallback","fnServerParams","fnStateSaveParams","fnStateLoadParams","fnStateLoaded","fnRowCallback","fnCreatedRow","fnHeaderCallback","fnFooterCallback","fnInitComplete","fnPreDrawCallback","bJQueryUI","oJUIClasses","oStdClasses","sTable","iDisplayStart","iDeferLoading","tmp","aaData","sUrl","getJSON","sStripeOdd","sStripeEven","bStripeRemove","aoColumnsInit","anThs","aoColumnDefs","oDef","captions","thead","tbody","tfoot","sVersion","fnZPad","Zpad","count","aThis","aThat","sThis","sThat","fnIsDataTable","fnTables","jQuery","is","version","iIn","sInfoThousands","jqXHR","ajax","sError","sServerMethod","xhr","error","thrown","sCookiePrefix","sInstance","iCookieDuration","fnCookieCallback","Math","min","nPaging","fnCallbackDraw","oPaginate","fnClickHandler","action","sAppend","sPagePrevDisabled","sPageJUIPrev","sPageNextDisabled","sPageJUINext","sPrevious","sNext","els","nPrevious","nNext","sPagePrevEnabled","sPageNextEnabled","sPageButton","sPageFirst","sFirst","sPagePrevious","sPageNext","sPageLast","sLast","nFirst","nPrev","nLast","iStartButton","iEndButton","anButtons","anStatic","iPageCount","iFullNumbersShowPages","iPageCountHalf","floor","ceil","iCurrentPage","sList","fnBind","preventDefault","sPageButtonActive","hasChildNodes","sPageButtonStaticDisabled","toString","x","y","parse","isNaN","Char","bDecimal","iParse","dataTableSettings","dataTableExt","define","amd"],"mappings":"CA0BuB,SAASA,OAAQC,SAAUC,iBAEpCC,QAAAA,QAca,SAASC,OAkCxBC,UAAY,SAASC,gBASZC,aAAaC,UAAWC,SACzBC,UAAYL,UAAUM,SAASC,QAC/BC,KAAOL,UAAUM,UAAUC,OAC3BC,KAAOZ,EAAEa,OAAO,GAAIZ,UAAUa,OAAOC,QAAST,UAAW,eACxCF,UAAUY,SAASC,2BAChBb,UAAUY,SAASE,aAChCb,KAAYR,SAASsB,cAAc,aAChCb,UAAUc,OAASd,UAAUc,OAASf,IAAMA,IAAIgB,UAAY,aACzDf,UAAUgB,UAAYhB,UAAUgB,UAAY,CAACb,YACjDH,UAAUiB,MAAQjB,UAAUA,UAAYG,UAErDL,UAAUM,UAAUc,KAAKZ,MAGrBR,UAAUqB,gBAAgBhB,QAAUX,aAAiD,OAApCM,UAAUqB,gBAAgBhB,MAC3EL,UAAUqB,gBAAgBhB,MAAQT,EAAEa,OAAO,GAAIZ,UAAUa,OAAOY,aAC7D,KACCC,KAAOvB,UAAUqB,gBAAgBhB,MAGjCkB,KAAKC,SAAW9B,cAChB6B,KAAKC,QAAS,GAGdD,KAAKE,SAAW/B,cAChB6B,KAAKE,QAAS,GAGdF,KAAKG,mBAAqBhC,cAC1B6B,KAAKG,kBAAmB,GAKhCC,iBAAiB3B,UAAWK,KAAM,eAW7BsB,iBAAiB3B,UAAWK,KAAMuB,cACnCpB,KAAOR,UAAUM,UAAUD,MAG3BuB,WAAalC,aAA0B,OAAbkC,WAEtBA,SAASC,YAAcD,SAAST,QAChCS,SAAST,MAAQS,SAASC,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WA,OAAOvsB,GAAG4pB,WAC1B3vB,QAAQsyB,SAbG,CAo2VrBzyB,OAAQC"} \ No newline at end of file +{"version":3,"file":"jquery.dataTables.min.js","sources":["../src/jquery.dataTables.js"],"sourcesContent":["/*eslint-disable*/\n/*! DataTables 1.13.7\n * ©2008-2023 SpryMedia Ltd - datatables.net/license\n */\n\n/**\n * @summary DataTables\n * @description Paginate, search and order HTML tables\n * @version 1.13.7\n * @author SpryMedia Ltd\n * @contact www.datatables.net\n * @copyright SpryMedia Ltd.\n *\n * This source file is free software, available under the following license:\n * MIT license - https://datatables.net/license\n *\n * This source file is distributed in the hope that it will be useful, but\n * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details.\n *\n * For details please refer to: https://www.datatables.net\n */\n\n/*jslint evil: true, undef: true, browser: true */\n/*globals $,require,jQuery,define,_selector_run,_selector_opts,_selector_first,_selector_row_indexes,_ext,_Api,_api_register,_api_registerPlural,_re_new_lines,_re_html,_re_formatted_numeric,_re_escape_regex,_empty,_intVal,_numToDecimal,_isNumber,_isHtml,_htmlNumeric,_pluck,_pluck_order,_range,_stripHtml,_unique,_fnBuildAjax,_fnAjaxUpdate,_fnAjaxParameters,_fnAjaxUpdateDraw,_fnAjaxDataSrc,_fnAddColumn,_fnColumnOptions,_fnAdjustColumnSizing,_fnVisibleToColumnIndex,_fnColumnIndexToVisible,_fnVisbleColumns,_fnGetColumns,_fnColumnTypes,_fnApplyColumnDefs,_fnHungarianMap,_fnCamelToHungarian,_fnLanguageCompat,_fnBrowserDetect,_fnAddData,_fnAddTr,_fnNodeToDataIndex,_fnNodeToColumnIndex,_fnGetCellData,_fnSetCellData,_fnSplitObjNotation,_fnGetObjectDataFn,_fnSetObjectDataFn,_fnGetDataMaster,_fnClearTable,_fnDeleteIndex,_fnInvalidate,_fnGetRowElements,_fnCreateTr,_fnBuildHead,_fnDrawHead,_fnDraw,_fnReDraw,_fnAddOptionsHtml,_fnDetectHeader,_fnGetUniqueThs,_fnFeatureHtmlFilter,_fnFilterComplete,_fnFilterCustom,_fnFilterColumn,_fnFilter,_fnFilterCreateSearch,_fnEscapeRegex,_fnFilterData,_fnFeatureHtmlInfo,_fnUpdateInfo,_fnInfoMacros,_fnInitialise,_fnInitComplete,_fnLengthChange,_fnFeatureHtmlLength,_fnFeatureHtmlPaginate,_fnPageChange,_fnFeatureHtmlProcessing,_fnProcessingDisplay,_fnFeatureHtmlTable,_fnScrollDraw,_fnApplyToChildren,_fnCalculateColumnWidths,_fnThrottle,_fnConvertToWidth,_fnGetWidestNode,_fnGetMaxLenString,_fnStringToCss,_fnSortFlatten,_fnSort,_fnSortAria,_fnSortListener,_fnSortAttachListener,_fnSortingClasses,_fnSortData,_fnSaveState,_fnLoadState,_fnSettingsFromNode,_fnLog,_fnMap,_fnBindAction,_fnCallbackReg,_fnCallbackFire,_fnLengthOverflow,_fnRenderer,_fnDataSource,_fnRowAttributes*/\n\n(function(factory) {\n \"use strict\";\n\n if (typeof define === 'function' && define.amd) {\n // AMD\n define(['jquery'], function($) {\n return factory($, window, document);\n });\n } else if (typeof exports === 'object') {\n // CommonJS\n // jQuery's factory checks for a global window - if it isn't present then it\n // returns a factory function that expects the window object\n var jq = require('jquery');\n\n if (typeof window === 'undefined') {\n module.exports = function(root, $) {\n if (!root) {\n // CommonJS environments without a window global must pass a\n // root. This will give an error otherwise\n root = window;\n }\n\n if (!$) {\n $ = jq(root);\n }\n\n return factory($, root, root.document);\n };\n } else {\n return factory(jq, window, window.document);\n }\n } else {\n // Browser\n window.DataTable = factory(jQuery, window, document);\n }\n}\n(function($, window, document, undefined) {\n \"use strict\";\n\n\n var DataTable = function(selector, options) {\n // Check if called with a window or jQuery object for DOM less applications\n // This is for backwards compatibility\n if (DataTable.factory(selector, options)) {\n return DataTable;\n }\n\n // When creating with `new`, create a new DataTable, returning the API instance\n if (this instanceof DataTable) {\n return $(selector).DataTable(options);\n } else {\n // Argument switching\n options = selector;\n }\n\n /**\n * Perform a jQuery selector action on the table's TR elements (from the tbody) and\n * return the resulting jQuery object.\n * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on\n * @param {object} [oOpts] Optional parameters for modifying the rows to be included\n * @param {string} [oOpts.filter=none] Select TR elements that meet the current filter\n * criterion (\"applied\") or all TR elements (i.e. no filter).\n * @param {string} [oOpts.order=current] Order of the TR elements in the processed array.\n * Can be either 'current', whereby the current sorting of the table is used, or\n * 'original' whereby the original order the data was read into the table is used.\n * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page\n * (\"current\") or not (\"all\"). If 'current' is given, then order is assumed to be\n * 'current' and filter is 'applied', regardless of what they might be given as.\n * @returns {object} jQuery object, filtered by the given selector.\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Highlight every second row\n * oTable.$('tr:odd').css('backgroundColor', 'blue');\n * } );\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Filter to rows with 'Webkit' in them, add a background colour and then\n * // remove the filter, thus highlighting the 'Webkit' rows only.\n * oTable.fnFilter('Webkit');\n * oTable.$('tr', {\"search\": \"applied\"}).css('backgroundColor', 'blue');\n * oTable.fnFilter('');\n * } );\n */\n this.$ = function(sSelector, oOpts) {\n return this.api(true).$(sSelector, oOpts);\n };\n\n\n /**\n * Almost identical to $ in operation, but in this case returns the data for the matched\n * rows - as such, the jQuery selector used should match TR row nodes or TD/TH cell nodes\n * rather than any descendants, so the data can be obtained for the row/cell. If matching\n * rows are found, the data returned is the original data array/object that was used to\n * create the row (or a generated array if from a DOM source).\n *\n * This method is often useful in-combination with $ where both functions are given the\n * same parameters and the array indexes will match identically.\n * @param {string|node|jQuery} sSelector jQuery selector or node collection to act on\n * @param {object} [oOpts] Optional parameters for modifying the rows to be included\n * @param {string} [oOpts.filter=none] Select elements that meet the current filter\n * criterion (\"applied\") or all elements (i.e. no filter).\n * @param {string} [oOpts.order=current] Order of the data in the processed array.\n * Can be either 'current', whereby the current sorting of the table is used, or\n * 'original' whereby the original order the data was read into the table is used.\n * @param {string} [oOpts.page=all] Limit the selection to the currently displayed page\n * (\"current\") or not (\"all\"). If 'current' is given, then order is assumed to be\n * 'current' and filter is 'applied', regardless of what they might be given as.\n * @returns {array} Data for the matched elements. If any elements, as a result of the\n * selector, were not TR, TD or TH elements in the DataTable, they will have a null\n * entry in the array.\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Get the data from the first row in the table\n * var data = oTable._('tr:first');\n *\n * // Do something useful with the data\n * alert( \"First cell is: \"+data[0] );\n * } );\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Filter to 'Webkit' and get all data for\n * oTable.fnFilter('Webkit');\n * var data = oTable._('tr', {\"search\": \"applied\"});\n *\n * // Do something with the data\n * alert( data.length+\" rows matched the search\" );\n * } );\n */\n this._ = function(sSelector, oOpts) {\n return this.api(true).rows(sSelector, oOpts).data();\n };\n\n\n /**\n * Create a DataTables Api instance, with the currently selected tables for\n * the Api's context.\n * @param {boolean} [traditional=false] Set the API instance's context to be\n * only the table referred to by the `DataTable.ext.iApiIndex` option, as was\n * used in the API presented by DataTables 1.9- (i.e. the traditional mode),\n * or if all tables captured in the jQuery object should be used.\n * @return {DataTables.Api}\n */\n this.api = function(traditional) {\n return traditional ?\n new _Api(\n _fnSettingsFromNode(this[_ext.iApiIndex])\n ) :\n new _Api(this);\n };\n\n\n /**\n * Add a single new row or multiple rows of data to the table. Please note\n * that this is suitable for client-side processing only - if you are using\n * server-side processing (i.e. \"bServerSide\": true), then to add data, you\n * must add it to the data source, i.e. the server-side, through an Ajax call.\n * @param {array|object} data The data to be added to the table. This can be:\n *
      \n *
    • 1D array of data - add a single row with the data provided
    • \n *
    • 2D array of arrays - add multiple rows in a single call
    • \n *
    • object - data object when using mData
    • \n *
    • array of objects - multiple data objects when using mData
    • \n *
    \n * @param {bool} [redraw=true] redraw the table or not\n * @returns {array} An array of integers, representing the list of indexes in\n * aoData ({@link DataTable.models.oSettings}) that have been added to\n * the table.\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * // Global var for counter\n * var giCount = 2;\n *\n * $(document).ready(function() {\n * $('#example').dataTable();\n * } );\n *\n * function fnClickAddRow() {\n * $('#example').dataTable().fnAddData( [\n * giCount+\".1\",\n * giCount+\".2\",\n * giCount+\".3\",\n * giCount+\".4\" ]\n * );\n *\n * giCount++;\n * }\n */\n this.fnAddData = function(data, redraw) {\n var api = this.api(true);\n\n /* Check if we want to add multiple rows or not */\n var rows = Array.isArray(data) && (Array.isArray(data[0]) || $.isPlainObject(data[0])) ?\n api.rows.add(data) :\n api.row.add(data);\n\n if (redraw === undefined || redraw) {\n api.draw();\n }\n\n return rows.flatten().toArray();\n };\n\n\n /**\n * This function will make DataTables recalculate the column sizes, based on the data\n * contained in the table and the sizes applied to the columns (in the DOM, CSS or\n * through the sWidth parameter). This can be useful when the width of the table's\n * parent element changes (for example a window resize).\n * @param {boolean} [bRedraw=true] Redraw the table or not, you will typically want to\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable( {\n * \"sScrollY\": \"200px\",\n * \"bPaginate\": false\n * } );\n *\n * $(window).on('resize', function () {\n * oTable.fnAdjustColumnSizing();\n * } );\n * } );\n */\n this.fnAdjustColumnSizing = function(bRedraw) {\n var api = this.api(true).columns.adjust();\n var settings = api.settings()[0];\n var scroll = settings.oScroll;\n\n if (bRedraw === undefined || bRedraw) {\n api.draw(false);\n } else if (scroll.sX !== \"\" || scroll.sY !== \"\") {\n /* If not redrawing, but scrolling, we want to apply the new column sizes anyway */\n _fnScrollDraw(settings);\n }\n };\n\n\n /**\n * Quickly and simply clear a table\n * @param {bool} [bRedraw=true] redraw the table or not\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Immediately 'nuke' the current rows (perhaps waiting for an Ajax callback...)\n * oTable.fnClearTable();\n * } );\n */\n this.fnClearTable = function(bRedraw) {\n var api = this.api(true).clear();\n\n if (bRedraw === undefined || bRedraw) {\n api.draw();\n }\n };\n\n\n /**\n * The exact opposite of 'opening' a row, this function will close any rows which\n * are currently 'open'.\n * @param {node} nTr the table row to 'close'\n * @returns {int} 0 on success, or 1 if failed (can't find the row)\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable;\n *\n * // 'open' an information row when a row is clicked on\n * $('#example tbody tr').click( function () {\n * if ( oTable.fnIsOpen(this) ) {\n * oTable.fnClose( this );\n * } else {\n * oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n * }\n * } );\n *\n * oTable = $('#example').dataTable();\n * } );\n */\n this.fnClose = function(nTr) {\n this.api(true).row(nTr).child.hide();\n };\n\n\n /**\n * Remove a row for the table\n * @param {mixed} target The index of the row from aoData to be deleted, or\n * the TR element you want to delete\n * @param {function|null} [callBack] Callback function\n * @param {bool} [redraw=true] Redraw the table or not\n * @returns {array} The row that was deleted\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Immediately remove the first row\n * oTable.fnDeleteRow( 0 );\n * } );\n */\n this.fnDeleteRow = function(target, callback, redraw) {\n var api = this.api(true);\n var rows = api.rows(target);\n var settings = rows.settings()[0];\n var data = settings.aoData[rows[0][0]];\n\n rows.remove();\n\n if (callback) {\n callback.call(this, settings, data);\n }\n\n if (redraw === undefined || redraw) {\n api.draw();\n }\n\n return data;\n };\n\n\n /**\n * Restore the table to it's original state in the DOM by removing all of DataTables\n * enhancements, alterations to the DOM structure of the table and event listeners.\n * @param {boolean} [remove=false] Completely remove the table from the DOM\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * // This example is fairly pointless in reality, but shows how fnDestroy can be used\n * var oTable = $('#example').dataTable();\n * oTable.fnDestroy();\n * } );\n */\n this.fnDestroy = function(remove) {\n this.api(true).destroy(remove);\n };\n\n\n /**\n * Redraw the table\n * @param {bool} [complete=true] Re-filter and resort (if enabled) the table before the draw.\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Re-draw the table - you wouldn't want to do it here, but it's an example :-)\n * oTable.fnDraw();\n * } );\n */\n this.fnDraw = function(complete) {\n // Note that this isn't an exact match to the old call to _fnDraw - it takes\n // into account the new data, but can hold position.\n this.api(true).draw(complete);\n };\n\n\n /**\n * Filter the input based on data\n * @param {string} sInput String to filter the table on\n * @param {int|null} [iColumn] Column to limit filtering to\n * @param {bool} [bRegex=false] Treat as regular expression or not\n * @param {bool} [bSmart=true] Perform smart filtering or not\n * @param {bool} [bShowGlobal=true] Show the input global filter in it's input box(es)\n * @param {bool} [bCaseInsensitive=true] Do case-insensitive matching (true) or not (false)\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Sometime later - filter...\n * oTable.fnFilter( 'test string' );\n * } );\n */\n this.fnFilter = function(sInput, iColumn, bRegex, bSmart, bShowGlobal, bCaseInsensitive) {\n var api = this.api(true);\n\n if (iColumn === null || iColumn === undefined) {\n api.search(sInput, bRegex, bSmart, bCaseInsensitive);\n } else {\n api.column(iColumn).search(sInput, bRegex, bSmart, bCaseInsensitive);\n }\n\n api.draw();\n };\n\n\n /**\n * Get the data for the whole table, an individual row or an individual cell based on the\n * provided parameters.\n * @param {int|node} [src] A TR row node, TD/TH cell node or an integer. If given as\n * a TR node then the data source for the whole row will be returned. If given as a\n * TD/TH cell node then iCol will be automatically calculated and the data for the\n * cell returned. If given as an integer, then this is treated as the aoData internal\n * data index for the row (see fnGetPosition) and the data for that row used.\n * @param {int} [col] Optional column index that you want the data of.\n * @returns {array|object|string} If mRow is undefined, then the data for all rows is\n * returned. If mRow is defined, just data for that row, and is iCol is\n * defined, only data for the designated cell is returned.\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * // Row data\n * $(document).ready(function() {\n * oTable = $('#example').dataTable();\n *\n * oTable.$('tr').click( function () {\n * var data = oTable.fnGetData( this );\n * // ... do something with the array / object of data for the row\n * } );\n * } );\n *\n * @example\n * // Individual cell data\n * $(document).ready(function() {\n * oTable = $('#example').dataTable();\n *\n * oTable.$('td').click( function () {\n * var sData = oTable.fnGetData( this );\n * alert( 'The cell clicked on had the value of '+sData );\n * } );\n * } );\n */\n this.fnGetData = function(src, col) {\n var api = this.api(true);\n\n if (src !== undefined) {\n var type = src.nodeName ? src.nodeName.toLowerCase() : '';\n\n return col !== undefined || type == 'td' || type == 'th' ?\n api.cell(src, col).data() :\n api.row(src).data() || null;\n }\n\n return api.data().toArray();\n };\n\n\n /**\n * Get an array of the TR nodes that are used in the table's body. Note that you will\n * typically want to use the '$' API method in preference to this as it is more\n * flexible.\n * @param {int} [iRow] Optional row index for the TR element you want\n * @returns {array|node} If iRow is undefined, returns an array of all TR elements\n * in the table's body, or iRow is defined, just the TR element requested.\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Get the nodes from the table\n * var nNodes = oTable.fnGetNodes( );\n * } );\n */\n this.fnGetNodes = function(iRow) {\n var api = this.api(true);\n\n return iRow !== undefined ?\n api.row(iRow).node() :\n api.rows().nodes().flatten().toArray();\n };\n\n\n /**\n * Get the array indexes of a particular cell from it's DOM element\n * and column index including hidden columns\n * @param {node} node this can either be a TR, TD or TH in the table's body\n * @returns {int} If nNode is given as a TR, then a single index is returned, or\n * if given as a cell, an array of [row index, column index (visible),\n * column index (all)] is given.\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * $('#example tbody td').click( function () {\n * // Get the position of the current data from the node\n * var aPos = oTable.fnGetPosition( this );\n *\n * // Get the data array for this row\n * var aData = oTable.fnGetData( aPos[0] );\n *\n * // Update the data array and return the value\n * aData[ aPos[1] ] = 'clicked';\n * this.innerHTML = 'clicked';\n * } );\n *\n * // Init DataTables\n * oTable = $('#example').dataTable();\n * } );\n */\n this.fnGetPosition = function(node) {\n var api = this.api(true);\n var nodeName = node.nodeName.toUpperCase();\n\n if (nodeName == 'TR') {\n return api.row(node).index();\n } else if (nodeName == 'TD' || nodeName == 'TH') {\n var cell = api.cell(node).index();\n\n return [\n cell.row,\n cell.columnVisible,\n cell.column\n ];\n }\n return null;\n };\n\n\n /**\n * Check to see if a row is 'open' or not.\n * @param {node} nTr the table row to check\n * @returns {boolean} true if the row is currently open, false otherwise\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable;\n *\n * // 'open' an information row when a row is clicked on\n * $('#example tbody tr').click( function () {\n * if ( oTable.fnIsOpen(this) ) {\n * oTable.fnClose( this );\n * } else {\n * oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n * }\n * } );\n *\n * oTable = $('#example').dataTable();\n * } );\n */\n this.fnIsOpen = function(nTr) {\n return this.api(true).row(nTr).child.isShown();\n };\n\n\n /**\n * This function will place a new row directly after a row which is currently\n * on display on the page, with the HTML contents that is passed into the\n * function. This can be used, for example, to ask for confirmation that a\n * particular record should be deleted.\n * @param {node} nTr The table row to 'open'\n * @param {string|node|jQuery} mHtml The HTML to put into the row\n * @param {string} sClass Class to give the new TD cell\n * @returns {node} The row opened. Note that if the table row passed in as the\n * first parameter, is not found in the table, this method will silently\n * return.\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable;\n *\n * // 'open' an information row when a row is clicked on\n * $('#example tbody tr').click( function () {\n * if ( oTable.fnIsOpen(this) ) {\n * oTable.fnClose( this );\n * } else {\n * oTable.fnOpen( this, \"Temporary row opened\", \"info_row\" );\n * }\n * } );\n *\n * oTable = $('#example').dataTable();\n * } );\n */\n this.fnOpen = function(nTr, mHtml, sClass) {\n return this.api(true)\n .row(nTr)\n .child(mHtml, sClass)\n .show()\n .child()[0];\n };\n\n\n /**\n * Change the pagination - provides the internal logic for pagination in a simple API\n * function. With this function you can have a DataTables table go to the next,\n * previous, first or last pages.\n * @param {string|int} mAction Paging action to take: \"first\", \"previous\", \"next\" or \"last\"\n * or page number to jump to (integer), note that page 0 is the first page.\n * @param {bool} [bRedraw=true] Redraw the table or not\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n * oTable.fnPageChange( 'next' );\n * } );\n */\n this.fnPageChange = function(mAction, bRedraw) {\n var api = this.api(true).page(mAction);\n\n if (bRedraw === undefined || bRedraw) {\n api.draw(false);\n }\n };\n\n\n /**\n * Show a particular column\n * @param {int} iCol The column whose display should be changed\n * @param {bool} bShow Show (true) or hide (false) the column\n * @param {bool} [bRedraw=true] Redraw the table or not\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Hide the second column after initialisation\n * oTable.fnSetColumnVis( 1, false );\n * } );\n */\n this.fnSetColumnVis = function(iCol, bShow, bRedraw) {\n var api = this.api(true).column(iCol).visible(bShow);\n\n if (bRedraw === undefined || bRedraw) {\n api.columns.adjust().draw();\n }\n };\n\n\n /**\n * Get the settings for a particular table for external manipulation\n * @returns {object} DataTables settings object. See\n * {@link DataTable.models.oSettings}\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n * var oSettings = oTable.fnSettings();\n *\n * // Show an example parameter from the settings\n * alert( oSettings._iDisplayStart );\n * } );\n */\n this.fnSettings = function() {\n return _fnSettingsFromNode(this[_ext.iApiIndex]);\n };\n\n\n /**\n * Sort the table by a particular column\n * @param {int} iCol the data index to sort on. Note that this will not match the\n * 'display index' if you have hidden data entries\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Sort immediately with columns 0 and 1\n * oTable.fnSort( [ [0,'asc'], [1,'asc'] ] );\n * } );\n */\n this.fnSort = function(aaSort) {\n this.api(true).order(aaSort).draw();\n };\n\n\n /**\n * Attach a sort listener to an element for a given column\n * @param {node} nNode the element to attach the sort listener to\n * @param {int} iColumn the column that a click on this node will sort on\n * @param {function} [fnCallback] callback function when sort is run\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n *\n * // Sort on column 1, when 'sorter' is clicked on\n * oTable.fnSortListener( document.getElementById('sorter'), 1 );\n * } );\n */\n this.fnSortListener = function(nNode, iColumn, fnCallback) {\n this.api(true).order.listener(nNode, iColumn, fnCallback);\n };\n\n\n /**\n * Update a table cell or row - this method will accept either a single value to\n * update the cell with, an array of values with one element for each column or\n * an object in the same format as the original data source. The function is\n * self-referencing in order to make the multi column updates easier.\n * @param {object|array|string} mData Data to update the cell/row with\n * @param {node|int} mRow TR element you want to update or the aoData index\n * @param {int} [iColumn] The column to update, give as null or undefined to\n * update a whole row.\n * @param {bool} [bRedraw=true] Redraw the table or not\n * @param {bool} [bAction=true] Perform pre-draw actions or not\n * @returns {int} 0 on success, 1 on error\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n * oTable.fnUpdate( 'Example update', 0, 0 ); // Single cell\n * oTable.fnUpdate( ['a', 'b', 'c', 'd', 'e'], $('tbody tr')[0] ); // Row\n * } );\n */\n this.fnUpdate = function(mData, mRow, iColumn, bRedraw, bAction) {\n var api = this.api(true);\n\n if (iColumn === undefined || iColumn === null) {\n api.row(mRow).data(mData);\n } else {\n api.cell(mRow, iColumn).data(mData);\n }\n\n if (bAction === undefined || bAction) {\n api.columns.adjust();\n }\n\n if (bRedraw === undefined || bRedraw) {\n api.draw();\n }\n return 0;\n };\n\n\n /**\n * Provide a common method for plug-ins to check the version of DataTables being used, in order\n * to ensure compatibility.\n * @param {string} sVersion Version string to check for, in the format \"X.Y.Z\". Note that the\n * formats \"X\" and \"X.Y\" are also acceptable.\n * @returns {boolean} true if this version of DataTables is greater or equal to the required\n * version, or false if this version of DataTales is not suitable\n * @method\n * @dtopt API\n * @deprecated Since v1.10\n *\n * @example\n * $(document).ready(function() {\n * var oTable = $('#example').dataTable();\n * alert( oTable.fnVersionCheck( '1.9.0' ) );\n * } );\n */\n this.fnVersionCheck = _ext.fnVersionCheck;\n\n\n var _that = this;\n var emptyInit = options === undefined;\n var len = this.length;\n\n if (emptyInit) {\n options = {};\n }\n\n this.oApi = this.internal = _ext.internal;\n\n // Extend with old style plug-in API methods\n for (var fn in DataTable.ext.internal) {\n if (fn) {\n this[fn] = _fnExternApiFunc(fn);\n }\n }\n\n this.each(function() {\n // For each initialisation we want to give it a clean initialisation\n // object that can be bashed around\n var o = {};\n var oInit = len > 1 ? // optimisation for single table case\n _fnExtend(o, options, true) :\n options;\n\n /*global oInit,_that,emptyInit*/\n var i = 0, iLen, j, jLen, k, kLen;\n var sId = this.getAttribute('id');\n var bInitHandedOff = false;\n var defaults = DataTable.defaults;\n var $this = $(this);\n\n\n /* Sanity check */\n if (this.nodeName.toLowerCase() != 'table') {\n _fnLog(null, 0, 'Non-table node initialisation (' + this.nodeName + ')', 2);\n return;\n }\n\n /* Backwards compatibility for the defaults */\n _fnCompatOpts(defaults);\n _fnCompatCols(defaults.column);\n\n /* Convert the camel-case defaults to Hungarian */\n _fnCamelToHungarian(defaults, defaults, true);\n _fnCamelToHungarian(defaults.column, defaults.column, true);\n\n /* Setting up the initialisation object */\n _fnCamelToHungarian(defaults, $.extend(oInit, $this.data()), true);\n\n\n /* Check to see if we are re-initialising a table */\n var allSettings = DataTable.settings;\n for (i = 0, iLen = allSettings.length; i < iLen; i++) {\n var s = allSettings[i];\n\n /* Base check on table node */\n if (\n s.nTable == this ||\n (s.nTHead && s.nTHead.parentNode == this) ||\n (s.nTFoot && s.nTFoot.parentNode == this)\n ) {\n var bRetrieve = oInit.bRetrieve !== undefined ? oInit.bRetrieve : defaults.bRetrieve;\n var bDestroy = oInit.bDestroy !== undefined ? oInit.bDestroy : defaults.bDestroy;\n\n if (emptyInit || bRetrieve) {\n return s.oInstance;\n } else if (bDestroy) {\n s.oInstance.fnDestroy();\n break;\n } else {\n _fnLog(s, 0, 'Cannot reinitialise DataTable', 3);\n return;\n }\n }\n\n /* If the element we are initialising has the same ID as a table which was previously\n\t\t\t\t * initialised, but the table nodes don't match (from before) then we destroy the old\n\t\t\t\t * instance by simply deleting it. This is under the assumption that the table has been\n\t\t\t\t * destroyed by other methods. Anyone using non-id selectors will need to do this manually\n\t\t\t\t */\n if (s.sTableId == this.id) {\n allSettings.splice(i, 1);\n break;\n }\n }\n\n /* Ensure the table has an ID - required for accessibility */\n if (sId === null || sId === \"\") {\n sId = \"DataTables_Table_\" + (DataTable.ext._unique++);\n this.id = sId;\n }\n\n /* Create the settings object for this table and set some of the default parameters */\n var oSettings = $.extend(true, {}, DataTable.models.oSettings, {\n \"sDestroyWidth\": $this[0].style.width,\n \"sInstance\": sId,\n \"sTableId\": sId\n });\n oSettings.nTable = this;\n oSettings.oApi = _that.internal;\n oSettings.oInit = oInit;\n\n allSettings.push(oSettings);\n\n // Need to add the instance after the instance after the settings object has been added\n // to the settings array, so we can self reference the table instance if more than one\n oSettings.oInstance = (_that.length === 1) ? _that : $this.dataTable();\n\n // Backwards compatibility, before we apply all the defaults\n _fnCompatOpts(oInit);\n _fnLanguageCompat(oInit.oLanguage);\n\n // If the length menu is given, but the init display length is not, use the length menu\n if (oInit.aLengthMenu && !oInit.iDisplayLength) {\n oInit.iDisplayLength = Array.isArray(oInit.aLengthMenu[0]) ?\n oInit.aLengthMenu[0][0] : oInit.aLengthMenu[0];\n }\n\n // Apply the defaults and init options to make a single init object will all\n // options defined from defaults and instance options.\n oInit = _fnExtend($.extend(true, {}, defaults), oInit);\n\n\n // Map the initialisation options onto the settings object\n _fnMap(oSettings.oFeatures, oInit, [\n \"bPaginate\",\n \"bLengthChange\",\n \"bFilter\",\n \"bSort\",\n \"bSortMulti\",\n \"bInfo\",\n \"bProcessing\",\n \"bAutoWidth\",\n \"bSortClasses\",\n \"bServerSide\",\n \"bDeferRender\"\n ]);\n _fnMap(oSettings, oInit, [\n \"asStripeClasses\",\n \"ajax\",\n \"fnServerData\",\n \"fnFormatNumber\",\n \"sServerMethod\",\n \"aaSorting\",\n \"aaSortingFixed\",\n \"aLengthMenu\",\n \"sPaginationType\",\n \"sAjaxSource\",\n \"sAjaxDataProp\",\n \"iStateDuration\",\n \"sDom\",\n \"bSortCellsTop\",\n \"iTabIndex\",\n \"fnStateLoadCallback\",\n \"fnStateSaveCallback\",\n \"renderer\",\n \"searchDelay\",\n \"rowId\",\n [\"iCookieDuration\", \"iStateDuration\"], // backwards compat\n [\"oSearch\", \"oPreviousSearch\"],\n [\"aoSearchCols\", \"aoPreSearchCols\"],\n [\"iDisplayLength\", \"_iDisplayLength\"]\n ]);\n _fnMap(oSettings.oScroll, oInit, [\n [\"sScrollX\", \"sX\"],\n [\"sScrollXInner\", \"sXInner\"],\n [\"sScrollY\", \"sY\"],\n [\"bScrollCollapse\", \"bCollapse\"]\n ]);\n _fnMap(oSettings.oLanguage, oInit, \"fnInfoCallback\");\n\n /* Callback functions which are array driven */\n _fnCallbackReg(oSettings, 'aoDrawCallback', oInit.fnDrawCallback, 'user');\n _fnCallbackReg(oSettings, 'aoServerParams', oInit.fnServerParams, 'user');\n _fnCallbackReg(oSettings, 'aoStateSaveParams', oInit.fnStateSaveParams, 'user');\n _fnCallbackReg(oSettings, 'aoStateLoadParams', oInit.fnStateLoadParams, 'user');\n _fnCallbackReg(oSettings, 'aoStateLoaded', oInit.fnStateLoaded, 'user');\n _fnCallbackReg(oSettings, 'aoRowCallback', oInit.fnRowCallback, 'user');\n _fnCallbackReg(oSettings, 'aoRowCreatedCallback', oInit.fnCreatedRow, 'user');\n _fnCallbackReg(oSettings, 'aoHeaderCallback', oInit.fnHeaderCallback, 'user');\n _fnCallbackReg(oSettings, 'aoFooterCallback', oInit.fnFooterCallback, 'user');\n _fnCallbackReg(oSettings, 'aoInitComplete', oInit.fnInitComplete, 'user');\n _fnCallbackReg(oSettings, 'aoPreDrawCallback', oInit.fnPreDrawCallback, 'user');\n\n oSettings.rowIdFn = _fnGetObjectDataFn(oInit.rowId);\n\n /* Browser support detection */\n _fnBrowserDetect(oSettings);\n\n var oClasses = oSettings.oClasses;\n\n $.extend(oClasses, DataTable.ext.classes, oInit.oClasses);\n $this.addClass(oClasses.sTable);\n\n\n if (oSettings.iInitDisplayStart === undefined) {\n /* Display start point, taking into account the save saving */\n oSettings.iInitDisplayStart = oInit.iDisplayStart;\n oSettings._iDisplayStart = oInit.iDisplayStart;\n }\n\n if (oInit.iDeferLoading !== null) {\n oSettings.bDeferLoading = true;\n var tmp = Array.isArray(oInit.iDeferLoading);\n oSettings._iRecordsDisplay = tmp ? oInit.iDeferLoading[0] : oInit.iDeferLoading;\n oSettings._iRecordsTotal = tmp ? oInit.iDeferLoading[1] : oInit.iDeferLoading;\n }\n\n /* Language definitions */\n var oLanguage = oSettings.oLanguage;\n $.extend(true, oLanguage, oInit.oLanguage);\n\n if (oLanguage.sUrl) {\n /* Get the language definitions from a file - because this Ajax call makes the language\n\t\t\t\t * get async to the remainder of this function we use bInitHandedOff to indicate that\n\t\t\t\t * _fnInitialise will be fired by the returned Ajax handler, rather than the constructor\n\t\t\t\t */\n $.ajax({\n dataType: 'json',\n url: oLanguage.sUrl,\n success: function(json) {\n _fnCamelToHungarian(defaults.oLanguage, json);\n _fnLanguageCompat(json);\n $.extend(true, oLanguage, json, oSettings.oInit.oLanguage);\n\n _fnCallbackFire(oSettings, null, 'i18n', [oSettings]);\n _fnInitialise(oSettings);\n },\n error: function() {\n // Error occurred loading language file, continue on as best we can\n _fnInitialise(oSettings);\n }\n });\n bInitHandedOff = true;\n } else {\n _fnCallbackFire(oSettings, null, 'i18n', [oSettings]);\n }\n\n /*\n\t\t\t * Stripes\n\t\t\t */\n if (oInit.asStripeClasses === null) {\n oSettings.asStripeClasses = [\n oClasses.sStripeOdd,\n oClasses.sStripeEven\n ];\n }\n\n /* Remove row stripe classes if they are already on the table row */\n var stripeClasses = oSettings.asStripeClasses;\n var rowOne = $this.children('tbody').find('tr').eq(0);\n if ($.inArray(true, $.map(stripeClasses, function(el, i) {\n return rowOne.hasClass(el);\n })) !== -1) {\n $('tbody tr', this).removeClass(stripeClasses.join(' '));\n oSettings.asDestroyStripes = stripeClasses.slice();\n }\n\n /*\n\t\t\t * Columns\n\t\t\t * See if we should load columns automatically or use defined ones\n\t\t\t */\n var anThs = [];\n var aoColumnsInit;\n var nThead = this.getElementsByTagName('thead');\n if (nThead.length !== 0) {\n _fnDetectHeader(oSettings.aoHeader, nThead[0]);\n anThs = _fnGetUniqueThs(oSettings);\n }\n\n /* If not given a column array, generate one with nulls */\n if (oInit.aoColumns === null) {\n aoColumnsInit = [];\n for (i = 0, iLen = anThs.length; i < iLen; i++) {\n aoColumnsInit.push(null);\n }\n } else {\n aoColumnsInit = oInit.aoColumns;\n }\n\n /* Add the columns */\n for (i = 0, iLen = aoColumnsInit.length; i < iLen; i++) {\n _fnAddColumn(oSettings, anThs ? anThs[i] : null);\n }\n\n /* Apply the column definitions */\n _fnApplyColumnDefs(oSettings, oInit.aoColumnDefs, aoColumnsInit, function(iCol, oDef) {\n _fnColumnOptions(oSettings, iCol, oDef);\n });\n\n /* HTML5 attribute detection - build an mData object automatically if the\n\t\t\t * attributes are found\n\t\t\t */\n if (rowOne.length) {\n var a = function(cell, name) {\n return cell.getAttribute('data-' + name) !== null ? name : null;\n };\n\n $(rowOne[0]).children('th, td').each(function(i, cell) {\n var col = oSettings.aoColumns[i];\n\n if (!col) {\n _fnLog(oSettings, 0, 'Incorrect column count', 18);\n }\n\n if (col.mData === i) {\n var sort = a(cell, 'sort') || a(cell, 'order');\n var filter = a(cell, 'filter') || a(cell, 'search');\n\n if (sort !== null || filter !== null) {\n col.mData = {\n _: i + '.display',\n sort: sort !== null ? i + '.@data-' + sort : undefined,\n type: sort !== null ? i + '.@data-' + sort : undefined,\n filter: filter !== null ? i + '.@data-' + filter : undefined\n };\n col._isArrayHost = true;\n\n _fnColumnOptions(oSettings, i);\n }\n }\n });\n }\n\n var features = oSettings.oFeatures;\n var loadedInit = function() {\n /*\n\t\t\t\t * Sorting\n\t\t\t\t * @todo For modularisation (1.11) this needs to do into a sort start up handler\n\t\t\t\t */\n\n // If aaSorting is not defined, then we use the first indicator in asSorting\n // in case that has been altered, so the default sort reflects that option\n if (oInit.aaSorting === undefined) {\n var sorting = oSettings.aaSorting;\n for (i = 0, iLen = sorting.length; i < iLen; i++) {\n sorting[i][1] = oSettings.aoColumns[i].asSorting[0];\n }\n }\n\n /* Do a first pass on the sorting classes (allows any size changes to be taken into\n\t\t\t\t * account, and also will apply sorting disabled classes if disabled\n\t\t\t\t */\n _fnSortingClasses(oSettings);\n\n if (features.bSort) {\n _fnCallbackReg(oSettings, 'aoDrawCallback', function() {\n if (oSettings.bSorted) {\n var aSort = _fnSortFlatten(oSettings);\n var sortedColumns = {};\n\n $.each(aSort, function(i, val) {\n sortedColumns[val.src] = val.dir;\n });\n\n _fnCallbackFire(oSettings, null, 'order', [oSettings, aSort, sortedColumns]);\n _fnSortAria(oSettings);\n }\n });\n }\n\n _fnCallbackReg(oSettings, 'aoDrawCallback', function() {\n if (oSettings.bSorted || _fnDataSource(oSettings) === 'ssp' || features.bDeferRender) {\n _fnSortingClasses(oSettings);\n }\n }, 'sc');\n\n\n /*\n\t\t\t\t * Final init\n\t\t\t\t * Cache the header, body and footer as required, creating them if needed\n\t\t\t\t */\n\n // Work around for Webkit bug 83867 - store the caption-side before removing from doc\n var captions = $this.children('caption').each(function() {\n this._captionSide = $(this).css('caption-side');\n });\n\n var thead = $this.children('thead');\n if (thead.length === 0) {\n thead = $('').appendTo($this);\n }\n oSettings.nTHead = thead[0];\n\n var tbody = $this.children('tbody');\n if (tbody.length === 0) {\n tbody = $('').insertAfter(thead);\n }\n oSettings.nTBody = tbody[0];\n\n var tfoot = $this.children('tfoot');\n if (tfoot.length === 0 && captions.length > 0 && (oSettings.oScroll.sX !== \"\" || oSettings.oScroll.sY !== \"\")) {\n // If we are a scrolling table, and no footer has been given, then we need to create\n // a tfoot element for the caption element to be appended to\n tfoot = $('').appendTo($this);\n }\n\n if (tfoot.length === 0 || tfoot.children().length === 0) {\n $this.addClass(oClasses.sNoFooter);\n } else if (tfoot.length > 0) {\n oSettings.nTFoot = tfoot[0];\n _fnDetectHeader(oSettings.aoFooter, oSettings.nTFoot);\n }\n\n /* Check if there is data passing into the constructor */\n if (oInit.aaData) {\n for (i = 0; i < oInit.aaData.length; i++) {\n _fnAddData(oSettings, oInit.aaData[i]);\n }\n } else if (oSettings.bDeferLoading || _fnDataSource(oSettings) == 'dom') {\n /* Grab the data from the page - only do this when deferred loading or no Ajax\n\t\t\t\t\t * source since there is no point in reading the DOM data if we are then going\n\t\t\t\t\t * to replace it with Ajax data\n\t\t\t\t\t */\n _fnAddTr(oSettings, $(oSettings.nTBody).children('tr'));\n }\n\n /* Copy the data index array */\n oSettings.aiDisplay = oSettings.aiDisplayMaster.slice();\n\n /* Initialisation complete - table can be drawn */\n oSettings.bInitialised = true;\n\n /* Check if we need to initialise the table (it might not have been handed off to the\n\t\t\t\t * language processor)\n\t\t\t\t */\n if (bInitHandedOff === false) {\n _fnInitialise(oSettings);\n }\n };\n\n /* Must be done after everything which can be overridden by the state saving! */\n _fnCallbackReg(oSettings, 'aoDrawCallback', _fnSaveState, 'state_save');\n\n if (oInit.bStateSave) {\n features.bStateSave = true;\n _fnLoadState(oSettings, oInit, loadedInit);\n } else {\n loadedInit();\n }\n\n });\n _that = null;\n return this;\n };\n\n\n /*\n\t * It is useful to have variables which are scoped locally so only the\n\t * DataTables functions can access them and they don't leak into global space.\n\t * At the same time these functions are often useful over multiple files in the\n\t * core and API, so we list, or at least document, all variables which are used\n\t * by DataTables as private variables here. This also ensures that there is no\n\t * clashing of variable names and that they can easily referenced for reuse.\n\t */\n\n\n // Defined else where\n // _selector_run\n // _selector_opts\n // _selector_first\n // _selector_row_indexes\n\n var _ext; // DataTable.ext\n var _Api; // DataTable.Api\n var _api_register; // DataTable.Api.register\n var _api_registerPlural; // DataTable.Api.registerPlural\n\n var _re_dic = {};\n var _re_new_lines = /[\\r\\n\\u2028]/g;\n var _re_html = /<.*?>/g;\n\n // This is not strict ISO8601 - Date.parse() is quite lax, although\n // implementations differ between browsers.\n var _re_date = /^\\d{2,4}[\\.\\/\\-]\\d{1,2}[\\.\\/\\-]\\d{1,2}([T ]{1}\\d{1,2}[:\\.]\\d{2}([\\.:]\\d{2})?)?$/;\n\n // Escape regular expression special characters\n var _re_escape_regex = new RegExp('(\\\\' + ['/', '.', '*', '+', '?', '|', '(', ')', '[', ']', '{', '}', '\\\\', '$', '^', '-'].join('|\\\\') + ')', 'g');\n\n // https://en.wikipedia.org/wiki/Foreign_exchange_market\n // - \\u20BD - Russian ruble.\n // - \\u20a9 - South Korean Won\n // - \\u20BA - Turkish Lira\n // - \\u20B9 - Indian Rupee\n // - R - Brazil (R$) and South Africa\n // - fr - Swiss Franc\n // - kr - Swedish krona, Norwegian krone and Danish krone\n // - \\u2009 is thin space and \\u202F is narrow no-break space, both used in many\n // - Ƀ - Bitcoin\n // - Ξ - Ethereum\n // standards as thousands separators.\n var _re_formatted_numeric = /['\\u00A0,$£€¥%\\u2009\\u202F\\u20BD\\u20a9\\u20BArfkɃΞ]/gi;\n\n\n var _empty = function(d) {\n return !d || d === true || d === '-' ? true : false;\n };\n\n\n var _intVal = function(s) {\n var integer = parseInt(s, 10);\n return !isNaN(integer) && isFinite(s) ? integer : null;\n };\n\n // Convert from a formatted number with characters other than `.` as the\n // decimal place, to a Javascript number\n var _numToDecimal = function(num, decimalPoint) {\n // Cache created regular expressions for speed as this function is called often\n if (!_re_dic[decimalPoint]) {\n _re_dic[decimalPoint] = new RegExp(_fnEscapeRegex(decimalPoint), 'g');\n }\n return typeof num === 'string' && decimalPoint !== '.' ?\n num.replace(/\\./g, '').replace(_re_dic[decimalPoint], '.') :\n num;\n };\n\n\n var _isNumber = function(d, decimalPoint, formatted) {\n var type = typeof d;\n var strType = type === 'string';\n\n if (type === 'number' || type === 'bigint') {\n return true;\n }\n\n // If empty return immediately so there must be a number if it is a\n // formatted string (this stops the string \"k\", or \"kr\", etc being detected\n // as a formatted number for currency\n if (_empty(d)) {\n return true;\n }\n\n if (decimalPoint && strType) {\n d = _numToDecimal(d, decimalPoint);\n }\n\n if (formatted && strType) {\n d = d.replace(_re_formatted_numeric, '');\n }\n\n return !isNaN(parseFloat(d)) && isFinite(d);\n };\n\n\n // A string without HTML in it can be considered to be HTML still\n var _isHtml = function(d) {\n return _empty(d) || typeof d === 'string';\n };\n\n\n var _htmlNumeric = function(d, decimalPoint, formatted) {\n if (_empty(d)) {\n return true;\n }\n\n var html = _isHtml(d);\n return !html ?\n null :\n _isNumber(_stripHtml(d), decimalPoint, formatted) ?\n true :\n null;\n };\n\n\n var _pluck = function(a, prop, prop2) {\n var out = [];\n var i = 0, ien = a.length;\n\n // Could have the test in the loop for slightly smaller code, but speed\n // is essential here\n if (prop2 !== undefined) {\n for (; i < ien; i++) {\n if (a[i] && a[i][prop]) {\n out.push(a[i][prop][prop2]);\n }\n }\n } else {\n for (; i < ien; i++) {\n if (a[i]) {\n out.push(a[i][prop]);\n }\n }\n }\n\n return out;\n };\n\n\n // Basically the same as _pluck, but rather than looping over `a` we use `order`\n // as the indexes to pick from `a`\n var _pluck_order = function(a, order, prop, prop2) {\n var out = [];\n var i = 0, ien = order.length;\n\n // Could have the test in the loop for slightly smaller code, but speed\n // is essential here\n if (prop2 !== undefined) {\n for (; i < ien; i++) {\n if (a[order[i]][prop]) {\n out.push(a[order[i]][prop][prop2]);\n }\n }\n } else {\n for (; i < ien; i++) {\n out.push(a[order[i]][prop]);\n }\n }\n\n return out;\n };\n\n\n var _range = function(len, start) {\n var out = [];\n var end;\n\n if (start === undefined) {\n start = 0;\n end = len;\n } else {\n end = start;\n start = len;\n }\n\n for (var i = start; i < end; i++) {\n out.push(i);\n }\n\n return out;\n };\n\n\n var _removeEmpty = function(a) {\n var out = [];\n\n for (var i = 0, ien = a.length; i < ien; i++) {\n if (a[i]) { // careful - will remove all falsy values!\n out.push(a[i]);\n }\n }\n\n return out;\n };\n\n\n var _stripHtml = function(d) {\n return d\n .replace(_re_html, '') // Complete tags\n .replace(/