diff --git a/.eslintrc.json b/.eslintrc.json new file mode 100644 index 000000000..ba2df59b8 --- /dev/null +++ b/.eslintrc.json @@ -0,0 +1,19 @@ +{ + "env": { + "browser": true, + "es2021": true + }, + "extends": ["eslint:recommended", "prettier"], + "overrides": [ + ], + "parserOptions": { + "ecmaVersion": "latest", + "sourceType": "module" + }, + "rules": { + }, + "globals": { + "browser" :"readonly", + "chrome" :"readonly" + } +} diff --git a/.gitignore b/.gitignore index a45900830..41c1322ad 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ build/ node_modules package-lock.json +injection_script.js diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..93e0977e7 --- /dev/null +++ b/.prettierrc @@ -0,0 +1,3 @@ +{ + "singleQuote": true + } diff --git a/PRIVACY.md b/PRIVACY.md index fbef2ffdb..090447e19 100644 --- a/PRIVACY.md +++ b/PRIVACY.md @@ -1,11 +1,5 @@ # FastForward Privacy Policy -## Auto-updating - -In order to provide up-to-date bypasses, FastForward sends a request to Github every hour, and if a new commit is found, it will download the latest "injection script." - -For this, [Github's privacy policy](https://help.github.com/en/github/site-policy/github-privacy-statement) applies. - ## Crowd Bypass When Crowd Bypass (Options > "Give and take the destinations of unbypassable shorteners.") is enabled, ocassionally the extension will send requests to our server: diff --git a/bypasssites.md b/bypasssites.md deleted file mode 100644 index 5e655d4a3..000000000 --- a/bypasssites.md +++ /dev/null @@ -1,533 +0,0 @@ -# Bypassed Sites - -If a mv3 bypass has been created for the site, add a C next to the website name. -If the site no longer exists or is shown to be harmful, add an X next to the website name. -Sites in brackets are those which require Regex to be implemented correctly; these sites have their raw regex implemented. - -This is a crude and outdated version of the bypass list, please check Bypassed.md for an updated list. This is kept purely for development purposes. - -https://earnme.club C -https://usanewstoday.club C -https://syosetu.org/?mode=url_jump&url= C -https://ur.ly X -https://urly.mobi X -https://akoam.net X -https://akoam.to C -(/https://sourceforge.net/projects/.+/files/.+/download/) C -https://bc.vc C -https://bcvc.live X -https://shortly.xyz/r/ C -https://shortly.xyz/link C -https://uploaded.net X -https://mylinks.xyz X -https://mylinks.zone X -https://mylink1.biz X -https://shortmoz.link C -https://skinnycat.org X -https://safelink.polrec.site X -https://gamesmega.net C -https://hokiciki.org X -https://wadooo.com -https://gotravelgo.space X -https://pantauterus.mode X -https://liputannubi.net X -https://lnk.news -https://uiz.io/go -https://uiz.app/go -https://moon7.xyz/go X -https://tlkm.id -https://prox77.com/analyze/ X -https://agdd5br.com/analyze/ -https://sfile.mobi C -https://sfile.xyz X -https://apkmos.com C -https://gixen.com/home_1.php -https://linkduit.net X -https://tik.lat C -https://acortalo.live X -https://acortalo.xyz X -https://acortalo.org X -https://apkpsp.com -https://ipeenk.id X -https://zt-protect.com X -https://nofil.net X -https://onnime.net X -https://biozkop21.my.id X -https://4shared.com -https://cheatsquad.gg -https://safe.anirocksite.com X -https://my-code4you.blogspot.com -https://jemerik.com X -https://busyfinance.site X -https://behealth-id.xyz X -https://pirateproxy.wtf C -https://fouadmods.com -https://akwam.org -https://old.akwam.co -https://post.techtutors.site X -https://an1.com -https://online-fix.me/ext/ -https://pahe.in -https://pahe.ph -https://pahe.me -https://boost.ink -https://linksunlocked.com X -https://samehadaku.vip X -https://playhindi.com -https://daominhha.com/download/ -https://bluemediafiles.com/url-generator.php?url= X -https://pcgamestorrents.org/url-generator.php?url= -https://retrosping.net/linkfilter?url= X -https://mydramalist.com/redirect?q= C -(/https:\/\/crackedappsstore\.com\/(?:\\.|[^\\])*\/\?download.*/gm) -https://downloadr.in -https://njiirx.com X -https://healthykk.com X -https://linkasm.com X -https://dxdrive.com -https://getwallpapers.com -https://sammobile.com -https://ydfile.com -https://mobilemodsapk.com -https://dlandroid.com -https://download.modsofapk.com -https://punchsubs.net X -https://zedge.net -https://fex.net -https://k2s.cc -https://muhammadyoga.me X -https://u.to -https://skiplink.io X -https://uploadfree.info X -https://freeupload.info X -https://fstore.biz X -https://thesimsresource.com/downloads/details/id/ -https://firefaucet.win/l/ -https://sfirmware.com/downloads-file/ -https://apkily.com/getapp$ -https://androidtop.net/?do=downloads&id= -https://emulator.games/download.php -(/https://curseforge.com/./download/[0-9]/) -https://racaty.com X -https://longfiles.com -https://filepuma.com -https://portableapps.com -https://indishare.org -https://datei.to X -https://keisekai.fun X -https://solvetube.site -https://lkc21.net -https://layarkacaxxi.org X -https://fastforward.team C -https://acortame.xyz X -https://linkvertise.com C -https://linkvertise.net C -https://link-to.net C -https://filefactory.com -https://file-upload.com -https://asdfiles.com -https://mega4up.com -https://up-load.io -https://cosmobox.org -https://rockfile.co X -https://devdrive.cloud -https://srt.am C -https://complete2unlock.com C -https://won.pe X -https://gotoo.loncat.in X -https://idnation.net -https://mazika2day.com -https://ux9.de -https://softpedia.com -https://rapidcrypt.net X -https://rom.io X -https://show.co -https://vcrypt.net X -https://1link.club -https://bomurl.com X -https://4snip.pw/out/ X -https://4snip.pw/decode/ X -https://flare.icu/out/ X -https://flare.icu/decode/ X -https://elsfile.org X -https://goou.in X -https://manualsbooks.com -https://ryn.cc -https://connect-trojan.net X -https://binbox.io X -https://lnk2.cc -https://ouo.press -https://ouo.info X -https://za.gl -https://za.uy X -https://drivehub.link X -https://oxy.si -https://healthyteeth.tips -https://oxy.cloud -https://daunshorte.teknologilink.com X -https://imgtaxi.com -https://imgkoc.buzz X -https://anonym.ninja C -https://do2unlock.com X -https://boostme.gg X -https://driverays.com X -https://bioskopgo.com X -https://01nonton.com -https://thetecnostar.com -https://curimovie.com X -https://akltu.com X -https://cinema21.tv/ X -https://wikitrik.com -https://linkerload.com -https://dawnstation.com X -https://hokiwikiped.net X -https://spaste.com/s/ -https://spaste.com/site/ -https://get-click2.blogspot.com -https://informations-library.blogspot.com -https://media-blue.blogspot.com -https://akashirohige.blogspot.com -https://aibouanimelink.blogspot.com -https://wwwfotografgotlin.blogspot.com -https://casperqu.blogspot.com -https://safelinksencrypter.blogspot.com -https://business.ominfoupdate.com X -https://insurance.5ggyan.com -https://majidzhacker.com -https://citgratis.com -https://tekloggers.com -https://pro-bangla.com -https://ph.apps2app.com -https://ph.samapkstore.com -https://blog.hulblog.com X -https://blog.omgmusik.com X -https://blog.omglyrics.com X -https://pastikan.me X -https://belajar-bersama2.me X -https://ph.tpaste.net -https://ph.ontools.net -https://blog.infolanjutan.xyz X -https://jkoding.xyz X -https://safe.onbatch.my X -https://anonimfiles.my X -https://google-playss.sdetectives.id X -https://jackofnine.site X -https://getlink.animesanka.club X -https://hello.tribuntekno.com X -https://ytsubme.com C -https://shortlink.in X -https://safe.doramaku.me X -https://confile.net X -https://linkshrtn.com X -https://xtiny.link X -https://shrtn.link X -https://linkpoi.in X -https://linkpoi.cc X -https://linkpoi.me -https://spacetica.com -https://linegee.net -https://moon7.xyz X -(/new\.lewd\.ninja\/external\/game\/([0-9]+)\/([a-z0-9]{64})/) -https://xxx.lewd.ninja X -https://fc-lc.com -https://lompat.in X -https://st.flashsubs.web.id -https://short-url.link -https://uploadrar.com -https://uploadrar.net -https://kuliahmatematika.my.id X -https://shortconnect.com -https://elil.cc -https://transmediakreatif.com X -https://go.indonesia-publisher.id -https://ciustekno.me -(/mirrorace\.(com|org)\/m\/[a-zA-Z0-9]+\/[0-9]+/) -https://gsu.st X -https://pucuktranslation.pw X -https://mangalist.org -(/(terbit|movies)21\.[a-z]+/) -https://onepieceex.net C -https://elanovia.com -https://redir.animenine.net -https://download.id/thank-you\/ -https://squidssh.com/li/go.php -https://goodssh.com/li/go.php -https://l.ndoqp.com X -https://elnurtech.com X -https://jo2win.com -https://lin-ks.net X -(/stayonline\.pro\/l\/(.*)\//) -https://xlink.cc X -https://1shortlink.com -https://multiup.org -https://multiup.eu -https://mispuani.xyz X -https://dl.blackmod.net X -https://bladesalvador.com -https://invistaiptv.com X -https://bebasdownloadfilm.com X -https://dl.sharemydrive.xyz X -https://dl.indexmovie.biz X -https://midiavip.com -https://1ink.cc -https://cuturl.cc -https://intifada1453.team -https://ahref.co -https://mi-globe.com/download/ -https://cpmlink.net -https://subsvip.com X -https://shon.xyz -https://likn.xyz X -https://sloomp.space X -https://brpaper.com C -https://boo.tw X -https://kora4top.com -https://forexlap.com -https://forex-articles.com -https://forexmab.com -https://fx4vip.com -https://soft8ware.com -(/flarefiles\.com\/drive\/[A-Za-z0-9]+\/genLink\.php/) -https://mboost.me -https://go.geghost.com -https://shorte-st.online X -https://apunkasoftware.net -https://disingkat.in X -https://dl.filedownload.club X -https://shirosafe.web.id X -https://techoow.com X -https://histotechs.com X -https://filesupload.org X -https://nexusmods.com -https://myotto.online X -https://disiniaja.site X -https://gsmusbdrivers.com -https://filehorse.com -https://cshort.org -https://otewe.net -https://vexfile.com -https://catcut.net -https://imgdrive.net -https://theartistunion.com X -https://boomx5.com X -https://cloudgallery.net -https://tricxbd.com X -https://customercareal.com X -https://eduinstruct.net -https://medific.net X -https://newswala.net X -https://iloadit11.info -https://sorewa.net -https://lefturl.com -https://askquds.com X -https://goo-2o.com -https://palsweet.live X -https://pluslive.live X -https://go.akwam.in X -https://worldofmods.com -https://linkconfig.com -https://suanoticia.online X -https://crxne.de/crxneunlock/crxne/download/ X -https://shre.su -https://easylinkref.com -https://subdowns.com -https://katfile.com -https://jk-chat.com X -https://shorten.sh X -https://urapk.com -https://expertvn.com -https://mediafile.cloud -https://mlwbd.pw X -https://uploadking.net -https://5play.ru -https://daunshorte.kertashitam.com -https://swatchseries.to/freecale.html?r= X -https://tl.gd -https://apkmodo.com X -https://multifilemirror.com X -https://welcome.indihome.co.id X -https://techrfour.com -https://gaminplay.com -https://dl.helow.id X -https://dl.ocanoke.com X -https://tudofinanceiro.club X -https://apkhubs.com -https://favpng.com -https://sh.st -https://maukredit.online X -https://ay.link X -https://shtms.co X -https://aylink.co X -https://forex1pro.com C -https://sub4unlock.com -https://oracle.com -https://genlink.cc -https://psarips.com/exit/ X -https://psarips.net/exit/ X -https://psarips.org/exit/ X -https://psarips.eu/exit/ X -https://psarips.in/exit/ X -https://psarips.one/exit/ X -https://psarips.xyz/exit/ X -https://psarips.uk/exit/ X -https://psa.one/exit/ X -https://psa.pm/exit/ -https://rekonise.com C -https://jwfinancas.club X -https://saver.id -https://androiddownload.net -https://links.shortenbuddy.com C -https://anon.to -https://dl-protect1.co X -https://linkdoni.soft98.ir X -https://nbyts.online -https://tecknity.com -https://url.rizaldi.web.id -https://1bit.space -https://1bitspace.com -https://gethatch.com -https://gcloud.live X -https://pnd.money -https://5mod-file.ru -https://kazanclilink.com X -https://moddingunited.xyz -https://majorgeeks.com -https://droidfilehost.com -https://kooi.xyz X -https://usdb.animux.de -https://thegamesdownload.net -https://thefileslocker.com -https://adshort.live -https://educationmedianews.com X -https://rexoxer.net X -https://gplinks.co -https://adbull.me -https://tinyurl.is X -https://tinyurl.so -https://textovisia.com X -https://shortclicks.xyz X -https://work.ink X -https://sub2unlock.com -https://cutin.it -https://olamovies.cyou -https://noon.khsm.io X -https://linkspy.cc -https://mflixpo.xyz X -https://themflix.xyz X -https://dereferer.me -https://indiainfo4u.in -https://intercelestial.com -https://stfly.me X -https://altblogger.net -https://chooyomi.com -https://maxurlz.com -https://megadb.net -(/enxf\.net\/resources\/[a-zA-Z-\.\d]+\/download/) -https://fmoviesdl.com/links/ -https://duit.cc -https://animestc.xyz -https://egao.in -https://benameiran.com -https://hairstyless.my.id X -https://theepochtimes.com -https://apkdone.com -https://wizardsubs.com X -https://zonangopi.com X -https://conan.id X -https://pusatfilm21.biz -https://myonime.com X -https://animersindo.net X -https://animebukatsu.net -https://kordramas.co X -https://koreaku.co X -https://tech2learners.com -https://channelmyanmar.org -https://ad4msan.com X -https://oppa.kdramaindo.tv X -https://mkvking.com -https://oploverz.in X -https://neonime.moe X -https://mmsubs.com -https://bakadame.com -https://drivenime.com -https://katmoviehd.nl X -https://hienzo.com -https://animebatch.id -https://koenime.com -https://masteredutech.com X -https://codecomets.com X -https://bakacan.id X -https://securitystickers.info -https://dl.ccbluex.net X -https://adshnk.com -https://adshrink.it X -https://techynroll.com -https://threadbolts.com X -https://techitease.com X -https://meostream.com/links/ -https://metroupdate.biz X -https://kangapip.com -https://clickscoin.com -https://dogeclick.net -https://sl.mcmfaucets.xyz X -https://short.mcmcryptos.xyz -https://dutchycorp.space -https://noweconomy.live -https://exev.io -https://yoshare.net -https://blog2share.com -https://downloadfreecourse.com/generate-link/ -https://mynewsmedia.co -https://100count.net -https://dl.freetutsdownload.net -https://newforex.online -https://world-trips.net -https://go.akwam.cc X -https://go.akwam.cx X -https://go.akwam.net X -https://go.akwam.im X -https://allkeyshop.com -(/sharemods\.com\/([a-z0-9]{12})\//) -https://uprot.net -https://apkadmin.com -https://mirrored.to/files/ -https://tei.ai -https://filedm.com C -https://bowfile.com -https://acorta-link.com X -https://clk.asia -https://informaxonline.com -https://cb.run C -https://cb.click C -https://thizissam.in -https://letsboost.net -https://Viid.su -https://AdFoc.us -https://adcoinfly.com X -https://semawur.com -https://bercara.com X -https://in11.site X -https://movienear.me X -https://lewat.club -https://tautan.pro X -https://droidtamvan.me X -https://gubukbisnis.me X -https://onlinecorp.me X -https://liveshootv.com X -https://modebaca.com -https://haipedia.com -https://sekilastekno.com -https://miuiku.com -https://shrink.world X -https://link.mymastah.xyz X -https://sportif.id -https://cararoot.id X -https://healthinsider.online X -https://atv.pw X -https://adlink.pw X -https://safe.mirrordown.com -https://kabarviral.blog X -https://123l.pw X -https://123link X -https://linksht.com -https://icutlink.com diff --git a/package.json b/package.json index 5efd2a065..1c06b373e 100644 --- a/package.json +++ b/package.json @@ -3,5 +3,13 @@ "adm-zip": "^0.5.9", "es-main": "^1.2.0" }, - "type": "module" + "type": "module", + "devDependencies": { + "eslint": "^8.36.0", + "eslint-config-prettier": "^8.8.0", + "prettier": "^2.8.7" + }, + "scripts": { + "lint": "eslint" + } } diff --git a/platform_spec/chromium/manifest.json b/platform_spec/chromium/manifest.json index da679cc1e..647cb97c0 100644 --- a/platform_spec/chromium/manifest.json +++ b/platform_spec/chromium/manifest.json @@ -1,5 +1,5 @@ { - "manifest_version": 2, + "manifest_version": 3, "icons": { "48": "icon/48.png", "128": "icon/128.png", @@ -17,29 +17,17 @@ "permissions": [ "alarms", "storage", - "webRequest", - "webRequestBlocking", - "" + "webNavigation" ], "options_ui": { "page": "html/options.html", "open_in_tab": true }, - "browser_action": { - "default_icon": { - "48": "icon/48.png", - "128": "icon/128.png", - "150": "icon/150.png", - "176": "icon/176.png", - "512": "icon/512.png" - }, - "default_popup": "html/popup.html" - }, "background": { - "scripts": [ - "background.js" - ] + "service_worker": "background.js" + }, + "action": {}, "content_scripts": [ { "matches": [ @@ -51,13 +39,19 @@ "run_at": "document_start" } ], - "web_accessible_resources": [ + + "web_accessible_resources": [{ + "resources": [ "html/before-navigate.html", "html/blocked.html", "html/crowd-bypassed.html", "html/firstrun.html", "html/firstrun-noscript.html", "html/options.html", - "icon/48.png" - ] + "icon/48.png", + "injection_script.js", + "bypasses/*", + "helpers/*"], + "matches": [""] +}] } diff --git a/scripts/build.js b/scripts/build.js index d6a03d9d0..3443132a6 100644 --- a/scripts/build.js +++ b/scripts/build.js @@ -6,7 +6,7 @@ * nover = Creates a package without version number * ver = Creates a package with version number as specified in version.txt */ -import { createRequire } from "module"; +import { createRequire } from 'module'; const require = createRequire(import.meta.url); const fs = require('fs'); @@ -14,146 +14,193 @@ const path = require('path'); let working_directory = process.cwd(); -function set_working_directory (cwd) { - - if (fs.existsSync(path.join(cwd, 'LICENSE'))) { - working_directory = cwd; - } else - set_working_directory(path.join(cwd, '..')); +function set_working_directory(cwd) { + if (fs.existsSync(path.join(cwd, 'LICENSE'))) { + working_directory = cwd; + } else set_working_directory(path.join(cwd, '..')); } set_working_directory(working_directory); const distribution = `${working_directory}/build/dist`; const args = process.argv; args.shift(); -args.shift() +args.shift(); // skip first 2, they are: node and build.js if (!args.length) { - console.error('[FastForward.build] No build type passed defaulting to all, usage: node scripts/build.js {firefox|chromium|all} {none|nover|ver}'); - args[0] = 'all'; + console.error( + '[FastForward.build] No build type passed defaulting to all, usage: node scripts/build.js {firefox|chromium|all} {none|nover|ver}' + ); + args[0] = 'all'; } const [build_type, versioning] = args; -console.log(`[FastForward.build] ${build_type} (${versioning ? versioning : 'dev'}): Creating package...`); +console.log( + `[FastForward.build] ${build_type} (${ + versioning ? versioning : 'dev' + }): Creating package...` +); const builds = []; import ff_builder from './build_js/firefox.js'; import chrm_builder from './build_js/chromium.js'; const builders = { - firefox: ff_builder, - chromium: chrm_builder + firefox: ff_builder, + chromium: chrm_builder, }; if (fs.existsSync(`${working_directory}/build`)) - fs.rmSync(`${working_directory}/build`, {recursive: true}); - -fs.mkdirSync(distribution, {recursive: true}); - -function copyFolderRecursiveSync( source, target ) { - let files = []; - - // Check if folder needs to be created or integrated - const targetFolder = path.join( target, path.basename( source ) ); - if ( !fs.existsSync( targetFolder ) ) { - fs.mkdirSync( targetFolder ); - } - - // Copy - if ( fs.lstatSync( source ).isDirectory() ) { - files = fs.readdirSync( source ); - files.forEach( function ( file ) { - var curSource = path.join( source, file ); - if ( fs.lstatSync( curSource ).isDirectory() ) { - copyFolderRecursiveSync( curSource, targetFolder ); - } else { - fs.copyFileSync( curSource, `${targetFolder}/${file}` ); - } - } ); - } + fs.rmSync(`${working_directory}/build`, { recursive: true }); + +fs.mkdirSync(distribution, { recursive: true }); + +function copyFolderRecursiveSync(source, target) { + let files = []; + + // Check if folder needs to be created or integrated + const targetFolder = path.join(target, path.basename(source)); + if (!fs.existsSync(targetFolder)) { + fs.mkdirSync(targetFolder); + } + + // Copy + if (fs.lstatSync(source).isDirectory()) { + files = fs.readdirSync(source); + files.forEach(function (file) { + var curSource = path.join(source, file); + if (fs.lstatSync(curSource).isDirectory()) { + copyFolderRecursiveSync(curSource, targetFolder); + } else { + fs.copyFileSync(curSource, `${targetFolder}/${file}`); + } + }); + } } async function run_build(type, commit_number) { - const destination = `${working_directory}/build/FastForward.${type}`; - - fs.mkdirSync(destination, {recursive: true}); - - console.log(`[FastForward.build.${type}] copying files to ${destination}`); - console.log(`[FastForward.build.${type}] copying html directory to ${destination}`); - copyFolderRecursiveSync(`${working_directory}/src/html`, destination); - console.log(`[FastForward.build.${type}] copying _locales directory to ${destination}`); - copyFolderRecursiveSync(`${working_directory}/src/_locales`, destination); - console.log(`[FastForward.build.${type}] copying icon directory to ${destination}`); - copyFolderRecursiveSync(`${working_directory}/src/icon`, destination); - console.log(`[FastForward.build.${type}] copying icon_disabled directory to ${destination}`); - copyFolderRecursiveSync(`${working_directory}/src/icon_disabled`, destination); - console.log(`[FastForward.build.${type}] copying js files to ${destination}`); - const js_files = fs.readdirSync(`${working_directory}/src/js`); - for (const _f of js_files) { - if (versioning && ['injection_script.js', 'rules.json'].includes(_f)) - continue; // dont copy, no need to remove later on - - fs.copyFileSync(`${working_directory}/src/js/${_f}`, `${destination}/${_f}`); - } - console.log(`[FastForward.build.${type}] copying PRIVACY.md to ${destination}`); - fs.copyFileSync(`${working_directory}/PRIVACY.md`, `${destination}/PRIVACY.md`); - - console.log(`[FastForward.build.${type}] copying jszip.min.js to ${destination}`); - fs.copyFileSync(`${working_directory}/src/external/jszip.min.js`, `${destination}/jszip.min.js`); - - console.log(`[FastForward.build.${type}] copying manifest to ${destination}`); - fs.copyFileSync(`${working_directory}/platform_spec/${type}/manifest.json`, `${destination}/manifest.json`); - - console.log(`[FastForward.build.${type}] copying bypass files to ${destination}`) - copyFolderRecursiveSync(`${working_directory}/src/bypasses`, destination); - - console.log(`[FastForward.build.${type}] copying helper files to ${destination}`) - copyFolderRecursiveSync(`${working_directory}/src/helpers`, destination); - - console.log(`[FastForward.build.${type}] creating the manifest`); - const manifest_contents = require(`${destination}/manifest.json`); - let version; - if (!versioning) - version = `0.${commit_number}.0` - else if ('nover' === versioning) - version = `0.${commit_number}`; - else - version = fs.readFileSync(`${working_directory}/src/version.txt`, {encoding: 'utf-8'}); - - // replace windows OR linux style new lines if they are there - manifest_contents.version = version.replace(/\r\n/g, '').replace(/\n/g, ''); - fs.writeFileSync(`${destination}/manifest.json`, JSON.stringify(manifest_contents, null, 4)); - - await builders[type]({versioning, destination, commit_number, version: manifest_contents.version}); + const destination = `${working_directory}/build/FastForward.${type}`; + + fs.mkdirSync(destination, { recursive: true }); + + console.log(`[FastForward.build.${type}] copying files to ${destination}`); + console.log( + `[FastForward.build.${type}] copying html directory to ${destination}` + ); + copyFolderRecursiveSync(`${working_directory}/src/html`, destination); + console.log( + `[FastForward.build.${type}] copying _locales directory to ${destination}` + ); + copyFolderRecursiveSync(`${working_directory}/src/_locales`, destination); + console.log( + `[FastForward.build.${type}] copying icon directory to ${destination}` + ); + copyFolderRecursiveSync(`${working_directory}/src/icon`, destination); + console.log( + `[FastForward.build.${type}] copying icon_disabled directory to ${destination}` + ); + copyFolderRecursiveSync( + `${working_directory}/src/icon_disabled`, + destination + ); + console.log(`[FastForward.build.${type}] copying js files to ${destination}`); + const js_files = fs.readdirSync(`${working_directory}/src/js`); + for (const _f of js_files) { + fs.copyFileSync( + `${working_directory}/src/js/${_f}`, + `${destination}/${_f}` + ); + } + console.log( + `[FastForward.build.${type}] copying PRIVACY.md to ${destination}` + ); + fs.copyFileSync( + `${working_directory}/PRIVACY.md`, + `${destination}/PRIVACY.md` + ); + + console.log( + `[FastForward.build.${type}] copying jszip.min.js to ${destination}` + ); + fs.copyFileSync( + `${working_directory}/src/external/jszip.min.js`, + `${destination}/jszip.min.js` + ); + + console.log(`[FastForward.build.${type}] copying manifest to ${destination}`); + fs.copyFileSync( + `${working_directory}/platform_spec/${type}/manifest.json`, + `${destination}/manifest.json` + ); + + console.log( + `[FastForward.build.${type}] copying bypass files to ${destination}` + ); + copyFolderRecursiveSync(`${working_directory}/src/bypasses`, destination); + + console.log( + `[FastForward.build.${type}] copying helper files to ${destination}` + ); + copyFolderRecursiveSync(`${working_directory}/src/helpers`, destination); + + console.log(`[FastForward.build.${type}] creating the manifest`); + const manifest_contents = require(`${destination}/manifest.json`); + let version; + if (!versioning) version = `0.${commit_number}.0`; + else if ('nover' === versioning) version = `0.${commit_number}`; + else + version = fs.readFileSync(`${working_directory}/src/version.txt`, { + encoding: 'utf-8', + }); + + // replace windows OR linux style new lines if they are there + manifest_contents.version = version.replace(/\r\n/g, '').replace(/\n/g, ''); + fs.writeFileSync( + `${destination}/manifest.json`, + JSON.stringify(manifest_contents, null, 4) + ); + + await builders[type]({ + versioning, + destination, + commit_number, + version: manifest_contents.version, + }); } if ('all' === build_type) { - builds.push('firefox', 'chromium'); + builds.push('firefox', 'chromium'); } else { - builds.push(build_type); + builds.push(build_type); } -const { - exec -} = require('child_process'); +const { exec } = require('child_process'); exec(`git rev-list HEAD --count`, async (error, stdout, stderr) => { - const bypasses = {}; + const bypasses = {}; - for (const _ of fs.readdirSync(`${working_directory}/src/bypasses`)) { - if (_ === 'BypassDefinition.js') continue; + for (const _ of fs.readdirSync(`${working_directory}/src/bypasses`)) { + if (_ === 'BypassDefinition.js') continue; - const bypass = await import(`file:///${working_directory}/src/bypasses/${_}`); - bypass.matches.map(match => { bypasses[match] = `bypasses/${_}`}); - } + const bypass = await import( + `file:///${working_directory}/src/bypasses/${_}` + ); + bypass.matches.map((match) => { + bypasses[match] = `bypasses/${_}`; + }); + } - fs.writeFileSync(`${working_directory}/src/js/injection_script.js`, `const bypasses = ${JSON.stringify(bypasses)}; + fs.writeFileSync( + `${working_directory}/src/js/injection_script.js`, + `const bypasses = ${JSON.stringify(bypasses)}; + const script_src = new URL(document.currentScript.src) + const ext_base_URL = script_src.searchParams.get("ext_base_URL") -if (bypasses.hasOwnProperty(location.host)) { +if (location.host in bypasses) { const bypass_url = bypasses[location.host]; - import(\`\${window.x8675309bp}\${bypass_url}\`).then(({default: bypass}) => { - import(\`\${window.x8675309bp}helpers/dom.js\`).then(({default: helpers}) => { + + import(\`\${ext_base_URL}\${bypass_url}\`).then(({default: bypass}) => { + import(\`\${ext_base_URL}helpers/dom.js\`).then(({default: helpers}) => { const bps = new bypass; bps.set_helpers(helpers); console.log('ensure_dom: %r', bps.ensure_dom); @@ -176,8 +223,7 @@ if (bypasses.hasOwnProperty(location.host)) { } }); }); -}`) - for (const _ of builds) - await run_build(_, stdout.replace('\n', '')); -}) - +}` + ); + for (const _ of builds) await run_build(_, stdout.replace('\n', '')); +}); diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index 158edb735..f81730b98 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -17,18 +17,6 @@ "changelog": { "message": "Changelog" }, - "update": { - "message": "Check for updates" - }, - "updating": { - "message": "Downloading bypass definitions..." - }, - "updateYes": { - "message": "Successfully downloaded bypass definitions." - }, - "updateNo": { - "message": "Bypass definitions are up-to-date." - }, "faq": { "message": "Frequently Asked Questions (FAQ)" }, @@ -84,19 +72,10 @@ "message": "You're almost at your destination." }, "beforeNavigateDestination": { - "message": "Your destination is %" - }, - "beforeNavigateUnsafe": { - "message": "However, if you navigate now, they will detect FastForward." - }, - "beforeNavigateUnsafeTimer": { - "message": "You will no longer be detected in % seconds." - }, - "beforeNavigateUnsafeTimerSingular": { - "message": "You will no longer be detected in 1 second." + "message": "Your destination is $1" }, "beforeNavigateTimer": { - "message": "You will be redirected automatically in % seconds." + "message": "You will be redirected automatically in $1 seconds." }, "beforeNavigateTimerSingular": { "message": "You will be redirected automatically in 1 second." @@ -105,7 +84,7 @@ "message": "Do you want to be redirected instantly or in x seconds?" }, "beforeNavigateInstant": { - "message": "You are being navigated to %" + "message": "You are being navigated to $1" }, "infoLinkvertise": { "message": "FastForward requires you to complete the captcha before we can bypass this site for you. after you do this, we can skip the annoying steps!" @@ -126,16 +105,16 @@ "message": "You might not have to wait!" }, "crowdBypassedInfo": { - "message": "Other FastForward users have already waited for you and reported that this leads to %" + "message": "Other FastForward users have already waited for you and reported that this leads to $1" }, "crowdBypassedTimer": { - "message": "This will be opened in a new tab in % seconds." + "message": "This will be opened in a new tab in $1 seconds." }, "crowdBypassedTimerSingular": { "message": "This will be opened in a new tab in 1 second." }, "crowdCloseTimer": { - "message": "This tab will close in % seconds." + "message": "This tab will close in $1 seconds." }, "crowdCloseTimerSingular": { "message": "This tab will close in 1 second." @@ -143,9 +122,6 @@ "cancel": { "message": "Cancel." }, - "crowdBypassedIgnore": { - "message": "Was this not correct?" - }, "crowdBypassedOptions": { "message": "Do you want this to be opened in a new tab instantly or in x seconds?" }, @@ -154,5 +130,24 @@ }, "blockedSubtitle": { "message": "Don't want FastForward to prevent bad actors from getting your IP?" + }, + "optionsWhitelistSave":{ + "message": "Save Whitelist" + }, + "optionsWhitelist": { + "message": "Whitelist" + }, + "optionsWhitelistDescription": { + "message": "A list of sites formatted as domain.tld or subdomain.domain.tld separated with a newline that will not be bypassed by FastForward. You can use * as a wildcard." + }, + "tempDisableCrowdBypassButton": { + "message": "Temporarily disable crowd bypass" + }, + "tempDisableCrowdBypassDesc": { + "message": "Was this not correct?" + }, + "crowdBypassTempDisabled":{ + "message":"Crowd bypass has been temporarily disabled" } + } diff --git a/src/bypasses/fastforward.js b/src/bypasses/fastforward.js deleted file mode 100644 index 3e783deb3..000000000 --- a/src/bypasses/fastforward.js +++ /dev/null @@ -1,21 +0,0 @@ -import BypassDefinition from './BypassDefinition.js' - -export default class Fastforward extends BypassDefinition { - constructor() { - super() - // custom bypass required bases can be set here - } - - execute() { - window.fastForwardInstalled = true - window.fastForwardInternalVersion = "FAST_FORWARD_INTERNAL_VERSION" - window.fastForwardExternalVersion = "FAST_FORWARD_EXTERNAL_VERSION" - window.fastForwardInjectionVersion = "FAST_FORWARD_INJECTION_VERSION" - - if (['/bypassed', '/navigate'].includes(location.pathname)) { - location.assign(`https://universal-bypass.org${location.pathname}${location.search}`) - } - } -} - -export const matches = ['fastforward.team'] diff --git a/src/helpers/dom.js b/src/helpers/dom.js index 657946d8b..950643763 100644 --- a/src/helpers/dom.js +++ b/src/helpers/dom.js @@ -1,336 +1,292 @@ //Constants needed for bypassing export const ODP = (t, p, o) => { - try { - Object.defineProperty(t, p, o) - } catch (e) { - console.trace("[FastForward] Couldn't define", p) - } -} -export const setTimeout = window.setTimeout -export const setInterval = window.setInterval -export const URL = window.URL + try { + Object.defineProperty(t, p, o); + } catch (e) { + console.trace("[FastForward] Couldn't define", p); + } +}; +export const setTimeout = window.setTimeout; +export const setInterval = window.setInterval; +export const URL = window.URL; export const docSetAttribute = document.documentElement.setAttribute.bind( - document.documentElement -) -let navigated = false + document.documentElement +); +let navigated = false; //Functions used in bypassing -export function insertInfoBox(text) { - let infobox_container = document.querySelector('div#ffibv1') - - if (!infobox_container) { - infobox_container = document.createElement('div') - infobox_container.setAttribute('id', 'ffibv1') - infobox_container.setAttribute( - 'style', - ` - z-index: 99999999; position: fixed; bottom: 0; line-height:normal; - right: 0; padding: 20px; color:#111; font-size:21px; - font-family:-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol; - max-width:500px; display: flex; flex-direction: column-reverse; - ` - ) - - document.body.appendChild(infobox_container) - } - const div = document.createElement('div') - div.style = - 'margin-left:20px; margin-bottom: 20px;background:#eee;border-radius:10px;padding:20px;box-shadow:#111 0px 5px 40px;cursor:pointer' - div.innerHTML = `` - div.setAttribute('tabindex', '-1') - div.setAttribute('aria-hidden', 'true') - const span = div.querySelector('span') - span.textContent = text - div.onclick = () => infobox_container.removeChild(div) - infobox_container.appendChild(div) - setTimeout(() => infobox_container.removeChild(div), 7000) -} +import { insertInfoBox } from './infobox.js'; export function transparentProperty(name, valFunc) { - let real - ODP(window, name, { - set: _ => real = _, - get: () => valFunc(real) - }) + let real; + ODP(window, name, { + set: (_) => (real = _), + get: () => valFunc(real), + }); } export function unsafelyAssignWithReferer(target, referer) { - location.href = `https://fastforward.team/navigate?target=${encodeURIComponent(target)}&referer=${encodeURIComponent(referer)}` + location.href = `https://fastforward.team/navigate?target=${encodeURIComponent( + target + )}&referer=${encodeURIComponent(referer)}`; } export function finish() { - bypassed = true - docSetAttribute("{{channel.stop_watching}}", "") + bypassed = true; + docSetAttribute('{{channel.stop_watching}}', ''); } export function countIt(func) { - docSetAttribute("{{channel.count_it}}", "") - setTimeout(func, 10) + docSetAttribute('{{channel.count_it}}', ''); + setTimeout(func, 10); } export function keepLooking(func) { - bypassed = false - if (typeof func == 'function') { - func() - } + bypassed = false; + if (typeof func == 'function') { + func(); + } } export function persistHash(here) { - ensureDomLoaded(() => { - document.querySelectorAll("form[action]").forEach(e => e.action += "#" + here) - document.querySelectorAll("a[href]").forEach(e => e.href += "#" + here) - }) + ensureDomLoaded(() => { + document + .querySelectorAll('form[action]') + .forEach((e) => (e.action += '#' + here)); + document.querySelectorAll('a[href]').forEach((e) => (e.href += '#' + here)); + }); } export function decodeURIEncodedMod(s) { - try { - return decodeURIComponent(s.replace(/\%2D/g, "-").replace(/\%5F/g, "_").replace(/\%2E/g, ".").replace(/\%21/g, "!").replace(/\%7E/g, "~").replace(/\%2A/g, "*").replace(/\%27/g, "'").replace(/\%28/g, "(").replace(/\%29/g, ")")) - } catch (e) { - return null - } + try { + return decodeURIComponent( + s + .replace(/\%2D/g, '-') + .replace(/\%5F/g, '_') + .replace(/\%2E/g, '.') + .replace(/\%21/g, '!') + .replace(/\%7E/g, '~') + .replace(/\%2A/g, '*') + .replace(/\%27/g, "'") + .replace(/\%28/g, '(') + .replace(/\%29/g, ')') + ); + } catch (e) { + return null; + } } export function ensureDomLoaded(func) { - if (['interactive', 'complete'].indexOf(document.readyState)) { - func() - } else { - let triggered = false - document.addEventListener('DOMContentLoaded', () => { - if (!triggered) { - triggered = true - setTimeout(func, 1) - } - }) - } + if (['interactive', 'complete'].indexOf(document.readyState)) { + func(); + } else { + let triggered = false; + document.addEventListener('DOMContentLoaded', () => { + if (!triggered) { + triggered = true; + setTimeout(func, 1); + } + }); + } } export function ifElement(query, func, extraFunc) { - ensureDomLoaded(() => { - let e = document.querySelector(query) - if (e) { - func(e) - } else if (extraFunc) { - extraFunc() - } - }) -} - -export function awaitElement(elem, func) { - ensureDomLoaded(() => { - let time = setInterval(() => { - let element = document.querySelector(elem) - if (element) { - func(element) - clearInterval(time) - } - }, 10) - setInterval(() => { - clearInterval(time) - }, 30000) - }) -} - -export function crowdDomain(domain) { - if (crowdBypassCheckbox.checked && domain) { - docSetAttribute('{{channel.crowd_domain}}', domain) - } -} - -export function crowdPath(path) { - if (crowdBypassCheckbox.checked && path) { - docSetAttribute('{{channel.crowd_path}}', path) + ensureDomLoaded(() => { + let e = document.querySelector(query); + if (e) { + func(e); + } else if (extraFunc) { + extraFunc(); } + }); } -export function crowdReferer(query) { - if (query) { - docSetAttribute('{{channel.crowd_referer}}', query) - } +export function awaitElement(elem, func) { + ensureDomLoaded(() => { + let time = setInterval(() => { + let element = document.querySelector(elem); + if (element) { + func(element); + clearInterval(time); + } + }, 10); + setInterval(() => { + clearInterval(time); + }, 30000); + }); } -export function crowdBypass(func, available) { - if (!func) { - func = () => { - } - } - if (crowdBypassCheckbox.checked) { - docSetAttribute('{{channel.crowd_query}}', '') - let youSee = setInterval(() => { - if (document.documentElement.getAttribute('{{channel.crowd_queried}}')) { - document.documentElement.removeAttribute('{{channel.crowd_queried}}') - insertInfoBox('{{msg.crowdWait}}') - func() - } - }, 20) - } else if (available) { - func() - } else { - insertInfoBox('{{msg.crowdDisabled}}') - } +/*example: www.fastforward.team/hmm?s=53, domain=fastforward.team path=hmm?s=53 +Include subdomain if it's not www. */ +export function crowdQuery(domain, path) { + var data = { + domain: domain, + path: path, + }; + //ff + first 10 characters of SHA256 of fastforward to prevent collisions + document.dispatchEvent( + new CustomEvent('ff53054c0e13_crowdQuery', { detail: data }) + ); } - -export function crowdContribute(target, func) { - if (typeof func != 'function') { - func = () => { - } - } - if (crowdBypassCheckbox.checked && isGoodLink(target)) { - docSetAttribute('{{channel.crowd_contribute}}', target) - setTimeout(func, 10) - } else { - func() - } +//target must be a fully qualified URL with protocol +export function crowdContribute(domain, path, target) { + var data = { + domain: domain, + path: path, + target: target, + }; + document.dispatchEvent( + new CustomEvent('ff53054c0e13_crowdContribute', { detail: data }) + ); } -export function contributeAndNavigate(target) { - if (!navigated && isGoodLink(target)) { - crowdContribute(target, () => unsafelyNavigate(target)) - } -} +export function unsafelyNavigate(target, referer = null, crowd = false) { + //The background script will intercept the request and redirect to html/before-navigate.html or to the target depending on the user's settings. + if (navigated) { + return; + } + let url; + if (crowd) { + url = `https://fastforward.team/bypassed?crowd=true&target=${encodeURIComponent( + target + )}`; + } else { + url = `https://fastforward.team/bypassed?target=${encodeURIComponent( + target + )}`; + } -export function unsafelyNavigate(target, referer = null) { - //The background script will intercept the request and redirect to html/before-navigate.html or to the target depending on the user's settings. - if (navigated) { - return - } - let url = `https://fastforward.team/bypassed?target=${encodeURIComponent( - target - )}` - if (referer) url += `&referer=${encodeURIComponent(referer)}` + if (referer) url += `&referer=${encodeURIComponent(referer)}`; - switch ( - target //All values here have been tested using "Take me to destinations after 0 seconds." - ) { - case (/(krnl\.place|hugegames\.io)/.exec(target) || {}).input: - url += '&safe_in=15' - break - case (/(bowfile\.com)/.exec(target) || {}).input: - url += '&safe_in=20' - break - case (/(flux\.li)/.exec(target) || {}).input: - url += '&safe_in=25' - break - } - unsafelyAssign(url) + switch ( + target //All values here have been tested using "Take me to destinations after 0 seconds." + ) { + case (/(krnl\.place|hugegames\.io)/.exec(target) || {}).input: + url += '&safe_in=15'; + break; + case (/(bowfile\.com)/.exec(target) || {}).input: + url += '&safe_in=20'; + break; + case (/(flux\.li)/.exec(target) || {}).input: + url += '&safe_in=25'; + break; + } + unsafelyAssign(url); } export function parseTarget(target) { - return target instanceof HTMLAnchorElement ? target.href : target + return target instanceof HTMLAnchorElement ? target.href : target; } export function safelyNavigate(target, drophash) { - target = parseTarget(target) - if (!isGoodLink(target)) return false + target = parseTarget(target); + if (!isGoodLink(target)) return false; - // bypassed=true - let url = new URL(target) - if (!drophash && (!url || !url.hash)) target += location.hash + // bypassed=true + let url = new URL(target); + if (!drophash && (!url || !url.hash)) target += location.hash; - unsafelyNavigate(target) - return true + unsafelyNavigate(target); + return true; } export function unsafelyAssign(target) { - navigated = true - window.onbeforeunload = null - location.assign(target) + navigated = true; + window.onbeforeunload = null; + location.assign(target); } export function safelyAssign(target) { - target = parseTarget(target) - if (navigated || !isGoodLink(target)) return false - bypassed = true - let url = new URL(target) - if (!url || !url.hash) target += location.hash - unsafelyAssign(target) - return true + target = parseTarget(target); + if (navigated || !isGoodLink(target)) return false; + bypassed = true; + let url = new URL(target); + if (!url || !url.hash) target += location.hash; + unsafelyAssign(target); + return true; } export function isGoodLink(link) { + if ( + typeof link !== 'string' || + link.split('#')[0] === location.href.split('#')[0] + ) { + return false; + } + try { + let u = new URL(decodeURI(link).trim().toLocaleLowerCase()); + //check if host is a private/internal ip + if ( + u.hostname === 'localhost' || + u.hostname === '[::1]' || + /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/.test(u.hostname) + ) { + return false; + } + const parts = u.hostname.split('.'); if ( - typeof link !== 'string' || - link.split('#')[0] === location.href.split('#')[0] + parts[0] === '10' || + (parts[0] === '172' && + parseInt(parts[1], 10) >= 16 && + parseInt(parts[1], 10) <= 31) || + (parts[0] === '192' && parts[1] === '168') ) { - return false + return false; } - try { - let u = new URL(decodeURI(link).trim().toLocaleLowerCase()) - //check if host is a private/internal ip - if ( - u.hostname === 'localhost' || - u.hostname === '[::1]' || - /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/.test(u.hostname) - ) { - return false - } - const parts = u.hostname.split('.') - if ( - parts[0] === '10' || - (parts[0] === '172' && - parseInt(parts[1], 10) >= 16 && - parseInt(parts[1], 10) <= 31) || - (parts[0] === '192' && parts[1] === '168') - ) { - return false - } - // Check if protocol is safe - let safeProtocols = [ - 'http:', - 'https:', - 'mailto:', - 'irc:', - 'telnet:', - 'tel:', - 'svn:' - ] - if (!safeProtocols.includes(u.protocol)) { - return false - } - } catch (e) { - return false + // Check if protocol is safe + let safeProtocols = [ + 'http:', + 'https:', + 'mailto:', + 'irc:', + 'telnet:', + 'tel:', + 'svn:', + ]; + if (!safeProtocols.includes(u.protocol)) { + return false; } - return true + } catch (e) { + return false; + } + return true; } export async function bypassRequests(execution_method) { - const rawOpen = XMLHttpRequest.prototype.open - XMLHttpRequest.prototype.open = function () { - this.addEventListener('load', execution_method) - rawOpen.apply(this, arguments) - } + const rawOpen = XMLHttpRequest.prototype.open; + XMLHttpRequest.prototype.open = function () { + this.addEventListener('load', execution_method); + rawOpen.apply(this, arguments); + }; - const rawFetch = window.fetch - window.fetch = async (requestInfo, init) => { - const result = await rawFetch(requestInfo, init) - execution_method(result) - return Promise.resolve(result) - } + const rawFetch = window.fetch; + window.fetch = async (requestInfo, init) => { + const result = await rawFetch(requestInfo, init); + execution_method(result); + return Promise.resolve(result); + }; } export default { - insertInfoBox, - ensureDomLoaded, - awaitElement, - crowdDomain, - crowdPath, - crowdReferer, - crowdBypass, - crowdContribute, - contributeAndNavigate, - unsafelyNavigate, - parseTarget, - safelyNavigate, - unsafelyAssign, - safelyAssign, - isGoodLink, - bypassRequests, - ifElement, - transparentProperty, - unsafelyAssignWithReferer, - finish, - countIt, - keepLooking, - persistHash, - decodeURIEncodedMod, - ODP, - URL -} + insertInfoBox, + ensureDomLoaded, + awaitElement, + crowdQuery, + crowdContribute, + unsafelyNavigate, + parseTarget, + safelyNavigate, + unsafelyAssign, + safelyAssign, + isGoodLink, + bypassRequests, + ifElement, + transparentProperty, + unsafelyAssignWithReferer, + finish, + countIt, + keepLooking, + persistHash, + decodeURIEncodedMod, + ODP, + URL, +}; diff --git a/src/helpers/infobox.js b/src/helpers/infobox.js new file mode 100644 index 000000000..969f7ff78 --- /dev/null +++ b/src/helpers/infobox.js @@ -0,0 +1,32 @@ +export function insertInfoBox(text) { + let infobox_container = document.querySelector('div#ffibv1'); + + if (!infobox_container) { + infobox_container = document.createElement('div'); + infobox_container.setAttribute('id', 'ffibv1'); + infobox_container.setAttribute( + 'style', + ` + z-index: 99999999; position: fixed; bottom: 0; line-height:normal; + right: 0; padding: 20px; color:#111; font-size:21px; + font-family:-apple-system,BlinkMacSystemFont,segoe ui,Roboto,helvetica neue,Arial,sans-serif,apple color emoji,segoe ui emoji,segoe ui symbol; + max-width:500px; display: flex; flex-direction: column-reverse; + ` + ); + + document.body.appendChild(infobox_container); + } + const div = document.createElement('div'); + div.style = + 'margin-left:20px; margin-bottom: 20px;background:#eee;border-radius:10px;padding:20px;box-shadow:#111 0px 5px 40px;cursor:pointer'; + div.innerHTML = ``; + div.setAttribute('tabindex', '-1'); + div.setAttribute('aria-hidden', 'true'); + const span = div.querySelector('span'); + span.textContent = text; + div.onclick = () => infobox_container.removeChild(div); + infobox_container.appendChild(div); + setTimeout(() => infobox_container.removeChild(div), 7000); +} + +export default insertInfoBox(); diff --git a/src/html/ace/README.md b/src/html/ace/README.md deleted file mode 100644 index 2e3a1868d..000000000 --- a/src/html/ace/README.md +++ /dev/null @@ -1 +0,0 @@ -All files in this folder are from the [src-min folder in ajaxorg/ace-builds as of a4103cb0a672a4fec9a16fc344f3116b51d6bcda](https://github.com/ajaxorg/ace-builds/tree/a4103cb0a672a4fec9a16fc344f3116b51d6bcda/src) diff --git a/src/html/ace/ace.js b/src/html/ace/ace.js deleted file mode 100644 index 08dbd3d4b..000000000 --- a/src/html/ace/ace.js +++ /dev/null @@ -1,17 +0,0 @@ -(function(){function o(n){var i=e;n&&(e[n]||(e[n]={}),i=e[n]);if(!i.define||!i.define.packaged)t.original=i.define,i.define=t,i.define.packaged=!0;if(!i.require||!i.require.packaged)r.original=i.require,i.require=r,i.require.packaged=!0}var ACE_NAMESPACE="",e=function(){return this}();!e&&typeof window!="undefined"&&(e=window);if(!ACE_NAMESPACE&&typeof requirejs!="undefined")return;var t=function(e,n,r){if(typeof e!="string"){t.original?t.original.apply(this,arguments):(console.error("dropping module because define wasn't a string."),console.trace());return}arguments.length==2&&(r=n),t.modules[e]||(t.payloads[e]=r,t.modules[e]=null)};t.modules={},t.payloads={};var n=function(e,t,n){if(typeof t=="string"){var i=s(e,t);if(i!=undefined)return n&&n(),i}else if(Object.prototype.toString.call(t)==="[object Array]"){var o=[];for(var u=0,a=t.length;u=0?parseFloat((s.match(/(?:MSIE |Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]):parseFloat((s.match(/(?:Trident\/[0-9]+[\.0-9]+;.*rv:)([0-9]+[\.0-9]+)/)||[])[1]),t.isOldIE=t.isIE&&t.isIE<9,t.isGecko=t.isMozilla=s.match(/ Gecko\/\d+/),t.isOpera=typeof opera=="object"&&Object.prototype.toString.call(window.opera)=="[object Opera]",t.isWebKit=parseFloat(s.split("WebKit/")[1])||undefined,t.isChrome=parseFloat(s.split(" Chrome/")[1])||undefined,t.isEdge=parseFloat(s.split(" Edge/")[1])||undefined,t.isAIR=s.indexOf("AdobeAIR")>=0,t.isAndroid=s.indexOf("Android")>=0,t.isChromeOS=s.indexOf(" CrOS ")>=0,t.isIOS=/iPad|iPhone|iPod/.test(s)&&!window.MSStream,t.isIOS&&(t.isMac=!0),t.isMobile=t.isIOS||t.isAndroid}),define("ace/lib/dom",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("./useragent"),i="http://www.w3.org/1999/xhtml";t.buildDom=function o(e,t,n){if(typeof e=="string"&&e){var r=document.createTextNode(e);return t&&t.appendChild(r),r}if(!Array.isArray(e))return e&&e.appendChild&&t&&t.appendChild(e),e;if(typeof e[0]!="string"||!e[0]){var i=[];for(var s=0;s=1.5:!0;if(typeof document!="undefined"){var s=document.createElement("div");t.HI_DPI&&s.style.transform!==undefined&&(t.HAS_CSS_TRANSFORMS=!0),!r.isEdge&&typeof s.style.animationName!="undefined"&&(t.HAS_CSS_ANIMATION=!0),s=null}t.HAS_CSS_TRANSFORMS?t.translate=function(e,t,n){e.style.transform="translate("+Math.round(t)+"px, "+Math.round(n)+"px)"}:t.translate=function(e,t,n){e.style.top=Math.round(n)+"px",e.style.left=Math.round(t)+"px"}}),define("ace/lib/oop",["require","exports","module"],function(e,t,n){"use strict";t.inherits=function(e,t){e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}})},t.mixin=function(e,t){for(var n in t)e[n]=t[n];return e},t.implement=function(e,n){t.mixin(e,n)}}),define("ace/lib/keys",["require","exports","module","ace/lib/oop"],function(e,t,n){"use strict";var r=e("./oop"),i=function(){var e={MODIFIER_KEYS:{16:"Shift",17:"Ctrl",18:"Alt",224:"Meta",91:"MetaLeft",92:"MetaRight",93:"ContextMenu"},KEY_MODS:{ctrl:1,alt:2,option:2,shift:4,"super":8,meta:8,command:8,cmd:8,control:1},FUNCTION_KEYS:{8:"Backspace",9:"Tab",13:"Return",19:"Pause",27:"Esc",32:"Space",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"Left",38:"Up",39:"Right",40:"Down",44:"Print",45:"Insert",46:"Delete",96:"Numpad0",97:"Numpad1",98:"Numpad2",99:"Numpad3",100:"Numpad4",101:"Numpad5",102:"Numpad6",103:"Numpad7",104:"Numpad8",105:"Numpad9","-13":"NumpadEnter",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"Numlock",145:"Scrolllock"},PRINTABLE_KEYS:{32:" ",48:"0",49:"1",50:"2",51:"3",52:"4",53:"5",54:"6",55:"7",56:"8",57:"9",59:";",61:"=",65:"a",66:"b",67:"c",68:"d",69:"e",70:"f",71:"g",72:"h",73:"i",74:"j",75:"k",76:"l",77:"m",78:"n",79:"o",80:"p",81:"q",82:"r",83:"s",84:"t",85:"u",86:"v",87:"w",88:"x",89:"y",90:"z",107:"+",109:"-",110:".",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'",111:"/",106:"*"}},t,n;for(n in e.FUNCTION_KEYS)t=e.FUNCTION_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);for(n in e.PRINTABLE_KEYS)t=e.PRINTABLE_KEYS[n].toLowerCase(),e[t]=parseInt(n,10);return r.mixin(e,e.MODIFIER_KEYS),r.mixin(e,e.PRINTABLE_KEYS),r.mixin(e,e.FUNCTION_KEYS),e.enter=e["return"],e.escape=e.esc,e.del=e["delete"],e[173]="-",function(){var t=["cmd","ctrl","alt","shift"];for(var n=Math.pow(2,t.length);n--;)e.KEY_MODS[n]=t.filter(function(t){return n&e.KEY_MODS[t]}).join("-")+"-"}(),e.KEY_MODS[0]="",e.KEY_MODS[-1]="input-",e}();r.mixin(t,i),t.keyCodeToString=function(e){var t=i[e];return typeof t!="string"&&(t=String.fromCharCode(e)),t.toLowerCase()}}),define("ace/lib/event",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function a(){u=!1;try{document.createComment("").addEventListener("test",function(){},{get passive(){u={passive:!1}}})}catch(e){}}function f(){return u==undefined&&a(),u}function l(e,t,n){this.elem=e,this.type=t,this.callback=n}function d(e,t,n){var u=p(t);if(!i.isMac&&s){t.getModifierState&&(t.getModifierState("OS")||t.getModifierState("Win"))&&(u|=8);if(s.altGr){if((3&u)==3)return;s.altGr=0}if(n===18||n===17){var a="location"in t?t.location:t.keyLocation;if(n===17&&a===1)s[n]==1&&(o=t.timeStamp);else if(n===18&&u===3&&a===2){var f=t.timeStamp-o;f<50&&(s.altGr=!0)}}}n in r.MODIFIER_KEYS&&(n=-1);if(!u&&n===13){var a="location"in t?t.location:t.keyLocation;if(a===3){e(t,u,-n);if(t.defaultPrevented)return}}if(i.isChromeOS&&u&8){e(t,u,n);if(t.defaultPrevented)return;u&=-9}return!!u||n in r.FUNCTION_KEYS||n in r.PRINTABLE_KEYS?e(t,u,n):!1}function v(){s=Object.create(null)}var r=e("./keys"),i=e("./useragent"),s=null,o=0,u;l.prototype.destroy=function(){h(this.elem,this.type,this.callback),this.elem=this.type=this.callback=undefined};var c=t.addListener=function(e,t,n,r){e.addEventListener(t,n,f()),r&&r.$toDestroy.push(new l(e,t,n))},h=t.removeListener=function(e,t,n){e.removeEventListener(t,n,f())};t.stopEvent=function(e){return t.stopPropagation(e),t.preventDefault(e),!1},t.stopPropagation=function(e){e.stopPropagation&&e.stopPropagation()},t.preventDefault=function(e){e.preventDefault&&e.preventDefault()},t.getButton=function(e){return e.type=="dblclick"?0:e.type=="contextmenu"||i.isMac&&e.ctrlKey&&!e.altKey&&!e.shiftKey?2:e.button},t.capture=function(e,t,n){function i(e){t&&t(e),n&&n(e),h(r,"mousemove",t),h(r,"mouseup",i),h(r,"dragstart",i)}var r=e&&e.ownerDocument||document;return c(r,"mousemove",t),c(r,"mouseup",i),c(r,"dragstart",i),i},t.addMouseWheelListener=function(e,t,n){"onmousewheel"in e?c(e,"mousewheel",function(e){var n=8;e.wheelDeltaX!==undefined?(e.wheelX=-e.wheelDeltaX/n,e.wheelY=-e.wheelDeltaY/n):(e.wheelX=0,e.wheelY=-e.wheelDelta/n),t(e)},n):"onwheel"in e?c(e,"wheel",function(e){var n=.35;switch(e.deltaMode){case e.DOM_DELTA_PIXEL:e.wheelX=e.deltaX*n||0,e.wheelY=e.deltaY*n||0;break;case e.DOM_DELTA_LINE:case e.DOM_DELTA_PAGE:e.wheelX=(e.deltaX||0)*5,e.wheelY=(e.deltaY||0)*5}t(e)},n):c(e,"DOMMouseScroll",function(e){e.axis&&e.axis==e.HORIZONTAL_AXIS?(e.wheelX=(e.detail||0)*5,e.wheelY=0):(e.wheelX=0,e.wheelY=(e.detail||0)*5),t(e)},n)},t.addMultiMouseDownListener=function(e,n,r,s,o){function p(e){t.getButton(e)!==0?u=0:e.detail>1?(u++,u>4&&(u=1)):u=1;if(i.isIE){var o=Math.abs(e.clientX-a)>5||Math.abs(e.clientY-f)>5;if(!l||o)u=1;l&&clearTimeout(l),l=setTimeout(function(){l=null},n[u-1]||600),u==1&&(a=e.clientX,f=e.clientY)}e._clicks=u,r[s]("mousedown",e);if(u>4)u=0;else if(u>1)return r[s](h[u],e)}var u=0,a,f,l,h={2:"dblclick",3:"tripleclick",4:"quadclick"};Array.isArray(e)||(e=[e]),e.forEach(function(e){c(e,"mousedown",p,o)})};var p=function(e){return 0|(e.ctrlKey?1:0)|(e.altKey?2:0)|(e.shiftKey?4:0)|(e.metaKey?8:0)};t.getModifierString=function(e){return r.KEY_MODS[p(e)]},t.addCommandKeyListener=function(e,n,r){if(i.isOldGecko||i.isOpera&&!("KeyboardEvent"in window)){var o=null;c(e,"keydown",function(e){o=e.keyCode},r),c(e,"keypress",function(e){return d(n,e,o)},r)}else{var u=null;c(e,"keydown",function(e){s[e.keyCode]=(s[e.keyCode]||0)+1;var t=d(n,e,e.keyCode);return u=e.defaultPrevented,t},r),c(e,"keypress",function(e){u&&(e.ctrlKey||e.altKey||e.shiftKey||e.metaKey)&&(t.stopEvent(e),u=null)},r),c(e,"keyup",function(e){s[e.keyCode]=null},r),s||(v(),c(window,"focus",v))}};if(typeof window=="object"&&window.postMessage&&!i.isOldIE){var m=1;t.nextTick=function(e,n){n=n||window;var r="zero-timeout-message-"+m++,i=function(s){s.data==r&&(t.stopPropagation(s),h(n,"message",i),e())};c(n,"message",i),n.postMessage(r,"*")}}t.$idleBlocked=!1,t.onIdle=function(e,n){return setTimeout(function r(){t.$idleBlocked?setTimeout(r,100):e()},n)},t.$idleBlockId=null,t.blockIdle=function(e){t.$idleBlockId&&clearTimeout(t.$idleBlockId),t.$idleBlocked=!0,t.$idleBlockId=setTimeout(function(){t.$idleBlocked=!1},e||100)},t.nextFrame=typeof window=="object"&&(window.requestAnimationFrame||window.mozRequestAnimationFrame||window.webkitRequestAnimationFrame||window.msRequestAnimationFrame||window.oRequestAnimationFrame),t.nextFrame?t.nextFrame=t.nextFrame.bind(window):t.nextFrame=function(e){setTimeout(e,17)}}),define("ace/range",["require","exports","module"],function(e,t,n){"use strict";var r=function(e,t){return e.row-t.row||e.column-t.column},i=function(e,t,n,r){this.start={row:e,column:t},this.end={row:n,column:r}};(function(){this.isEqual=function(e){return this.start.row===e.start.row&&this.end.row===e.end.row&&this.start.column===e.start.column&&this.end.column===e.end.column},this.toString=function(){return"Range: ["+this.start.row+"/"+this.start.column+"] -> ["+this.end.row+"/"+this.end.column+"]"},this.contains=function(e,t){return this.compare(e,t)==0},this.compareRange=function(e){var t,n=e.end,r=e.start;return t=this.compare(n.row,n.column),t==1?(t=this.compare(r.row,r.column),t==1?2:t==0?1:0):t==-1?-2:(t=this.compare(r.row,r.column),t==-1?-1:t==1?42:0)},this.comparePoint=function(e){return this.compare(e.row,e.column)},this.containsRange=function(e){return this.comparePoint(e.start)==0&&this.comparePoint(e.end)==0},this.intersects=function(e){var t=this.compareRange(e);return t==-1||t==0||t==1},this.isEnd=function(e,t){return this.end.row==e&&this.end.column==t},this.isStart=function(e,t){return this.start.row==e&&this.start.column==t},this.setStart=function(e,t){typeof e=="object"?(this.start.column=e.column,this.start.row=e.row):(this.start.row=e,this.start.column=t)},this.setEnd=function(e,t){typeof e=="object"?(this.end.column=e.column,this.end.row=e.row):(this.end.row=e,this.end.column=t)},this.inside=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)||this.isStart(e,t)?!1:!0:!1},this.insideStart=function(e,t){return this.compare(e,t)==0?this.isEnd(e,t)?!1:!0:!1},this.insideEnd=function(e,t){return this.compare(e,t)==0?this.isStart(e,t)?!1:!0:!1},this.compare=function(e,t){return!this.isMultiLine()&&e===this.start.row?tthis.end.column?1:0:ethis.end.row?1:this.start.row===e?t>=this.start.column?0:-1:this.end.row===e?t<=this.end.column?0:1:0},this.compareStart=function(e,t){return this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.compareEnd=function(e,t){return this.end.row==e&&this.end.column==t?1:this.compare(e,t)},this.compareInside=function(e,t){return this.end.row==e&&this.end.column==t?1:this.start.row==e&&this.start.column==t?-1:this.compare(e,t)},this.clipRows=function(e,t){if(this.end.row>t)var n={row:t+1,column:0};else if(this.end.rowt)var r={row:t+1,column:0};else if(this.start.row0){t&1&&(n+=e);if(t>>=1)e+=e}return n};var r=/^\s\s*/,i=/\s\s*$/;t.stringTrimLeft=function(e){return e.replace(r,"")},t.stringTrimRight=function(e){return e.replace(i,"")},t.copyObject=function(e){var t={};for(var n in e)t[n]=e[n];return t},t.copyArray=function(e){var t=[];for(var n=0,r=e.length;nDate.now()-50?!0:r=!1},cancel:function(){r=Date.now()}}}),define("ace/keyboard/textinput",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/lib/dom","ace/lib/lang","ace/clipboard","ace/lib/keys"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("../lib/dom"),o=e("../lib/lang"),u=e("../clipboard"),a=i.isChrome<18,f=i.isIE,l=i.isChrome>63,c=400,h=e("../lib/keys"),p=h.KEY_MODS,d=i.isIOS,v=d?/\s/:/\n/,m=i.isMobile,g=function(e,t){function X(){x=!0,n.blur(),n.focus(),x=!1}function $(e){e.keyCode==27&&n.value.lengthC&&T[s]=="\n")o=h.end;else if(rC&&T.slice(0,s).split("\n").length>2)o=h.down;else if(s>C&&T[s-1]==" ")o=h.right,u=p.option;else if(s>C||s==C&&C!=N&&r==s)o=h.right;r!==s&&(u|=p.shift);if(o){var a=t.onCommandKey({},u,o);if(!a&&t.commands){o=h.keyCodeToString(o);var f=t.commands.findKeyCommand(u,o);f&&t.execCommand(f)}N=r,C=s,O("")}};document.addEventListener("selectionchange",s),t.on("destroy",function(){document.removeEventListener("selectionchange",s)})}var n=s.createElement("textarea");n.className="ace_text-input",n.setAttribute("wrap","off"),n.setAttribute("autocorrect","off"),n.setAttribute("autocapitalize","off"),n.setAttribute("spellcheck",!1),n.style.opacity="0",e.insertBefore(n,e.firstChild);var g=!1,y=!1,b=!1,w=!1,E="";m||(n.style.fontSize="1px");var S=!1,x=!1,T="",N=0,C=0,k=0;try{var L=document.activeElement===n}catch(A){}r.addListener(n,"blur",function(e){if(x)return;t.onBlur(e),L=!1},t),r.addListener(n,"focus",function(e){if(x)return;L=!0;if(i.isEdge)try{if(!document.hasFocus())return}catch(e){}t.onFocus(e),i.isEdge?setTimeout(O):O()},t),this.$focusScroll=!1,this.focus=function(){if(E||l||this.$focusScroll=="browser")return n.focus({preventScroll:!0});var e=n.style.top;n.style.position="fixed",n.style.top="0px";try{var t=n.getBoundingClientRect().top!=0}catch(r){return}var i=[];if(t){var s=n.parentElement;while(s&&s.nodeType==1)i.push(s),s.setAttribute("ace_nocontext",!0),!s.parentElement&&s.getRootNode?s=s.getRootNode().host:s=s.parentElement}n.focus({preventScroll:!0}),t&&i.forEach(function(e){e.removeAttribute("ace_nocontext")}),setTimeout(function(){n.style.position="",n.style.top=="0px"&&(n.style.top=e)},0)},this.blur=function(){n.blur()},this.isFocused=function(){return L},t.on("beforeEndOperation",function(){var e=t.curOp,r=e&&e.command&&e.command.name;if(r=="insertstring")return;var i=r&&(e.docChanged||e.selectionChanged);b&&i&&(T=n.value="",W()),O()});var O=d?function(e){if(!L||g&&!e||w)return;e||(e="");var r="\n ab"+e+"cde fg\n";r!=n.value&&(n.value=T=r);var i=4,s=4+(e.length||(t.selection.isEmpty()?0:1));(N!=i||C!=s)&&n.setSelectionRange(i,s),N=i,C=s}:function(){if(b||w)return;if(!L&&!P)return;b=!0;var e=0,r=0,i="";if(t.session){var s=t.selection,o=s.getRange(),u=s.cursor.row;e=o.start.column,r=o.end.column,i=t.session.getLine(u);if(o.start.row!=u){var a=t.session.getLine(u-1);e=o.start.rowu+1?f.length:r,r+=i.length+1,i=i+"\n"+f}else m&&u>0&&(i="\n"+i,r+=1,e+=1);i.length>c&&(e=T.length&&e.value===T&&T&&e.selectionEnd!==C},_=function(e){if(b)return;g?g=!1:M(n)?(t.selectAll(),O()):m&&n.selectionStart!=N&&O()},D=null;this.setInputHandler=function(e){D=e},this.getInputHandler=function(){return D};var P=!1,H=function(e,r){P&&(P=!1);if(y)return O(),e&&t.onPaste(e),y=!1,"";var s=n.selectionStart,o=n.selectionEnd,u=N,a=T.length-C,f=e,l=e.length-s,c=e.length-o,h=0;while(u>0&&T[h]==e[h])h++,u--;f=f.slice(h),h=1;while(a>0&&T.length-h>N-1&&T[T.length-h]==e[e.length-h])h++,a--;l-=h-1,c-=h-1;var p=f.length-h+1;p<0&&(u=-p,p=0),f=f.slice(0,p);if(!r&&!f&&!l&&!u&&!a&&!c)return"";w=!0;var d=!1;return i.isAndroid&&f==". "&&(f=" ",d=!0),f&&!u&&!a&&!l&&!c||S?t.onTextInput(f):t.onTextInput(f,{extendLeft:u,extendRight:a,restoreStart:l,restoreEnd:c}),w=!1,T=e,N=s,C=o,k=c,d?"\n":f},B=function(e){if(b)return z();if(e&&e.inputType){if(e.inputType=="historyUndo")return t.execCommand("undo");if(e.inputType=="historyRedo")return t.execCommand("redo")}var r=n.value,i=H(r,!0);(r.length>c+100||v.test(i)||m&&N<1&&N==C)&&O()},j=function(e,t,n){var r=e.clipboardData||window.clipboardData;if(!r||a)return;var i=f||n?"Text":"text/plain";try{return t?r.setData(i,t)!==!1:r.getData(i)}catch(e){if(!n)return j(e,t,!0)}},F=function(e,i){var s=t.getCopyText();if(!s)return r.preventDefault(e);j(e,s)?(d&&(O(s),g=s,setTimeout(function(){g=!1},10)),i?t.onCut():t.onCopy(),r.preventDefault(e)):(g=!0,n.value=s,n.select(),setTimeout(function(){g=!1,O(),i?t.onCut():t.onCopy()}))},I=function(e){F(e,!0)},q=function(e){F(e,!1)},R=function(e){var s=j(e);if(u.pasteCancelled())return;typeof s=="string"?(s&&t.onPaste(s,e),i.isIE&&setTimeout(O),r.preventDefault(e)):(n.value="",y=!0)};r.addCommandKeyListener(n,t.onCommandKey.bind(t),t),r.addListener(n,"select",_,t),r.addListener(n,"input",B,t),r.addListener(n,"cut",I,t),r.addListener(n,"copy",q,t),r.addListener(n,"paste",R,t),(!("oncut"in n)||!("oncopy"in n)||!("onpaste"in n))&&r.addListener(e,"keydown",function(e){if(i.isMac&&!e.metaKey||!e.ctrlKey)return;switch(e.keyCode){case 67:q(e);break;case 86:R(e);break;case 88:I(e)}},t);var U=function(e){if(b||!t.onCompositionStart||t.$readOnly)return;b={};if(S)return;e.data&&(b.useTextareaForIME=!1),setTimeout(z,0),t._signal("compositionStart"),t.on("mousedown",X);var r=t.getSelectionRange();r.end.row=r.start.row,r.end.column=r.start.column,b.markerRange=r,b.selectionStart=N,t.onCompositionStart(b),b.useTextareaForIME?(T=n.value="",N=0,C=0):(n.msGetInputContext&&(b.context=n.msGetInputContext()),n.getInputContext&&(b.context=n.getInputContext()))},z=function(){if(!b||!t.onCompositionUpdate||t.$readOnly)return;if(S)return X();if(b.useTextareaForIME)t.onCompositionUpdate(n.value);else{var e=n.value;H(e),b.markerRange&&(b.context&&(b.markerRange.start.column=b.selectionStart=b.context.compositionStartOffset),b.markerRange.end.column=b.markerRange.start.column+C-b.selectionStart+k)}},W=function(e){if(!t.onCompositionEnd||t.$readOnly)return;b=!1,t.onCompositionEnd(),t.off("mousedown",X),e&&B()},V=o.delayedCall(z,50).schedule.bind(null,null);r.addListener(n,"compositionstart",U,t),r.addListener(n,"compositionupdate",z,t),r.addListener(n,"keyup",$,t),r.addListener(n,"keydown",V,t),r.addListener(n,"compositionend",W,t),this.getElement=function(){return n},this.setCommandMode=function(e){S=e,n.readOnly=!1},this.setReadOnly=function(e){S||(n.readOnly=e)},this.setCopyWithEmptySelection=function(e){},this.onContextMenu=function(e){P=!0,O(),t._emit("nativecontextmenu",{target:t,domEvent:e}),this.moveToMouse(e,!0)},this.moveToMouse=function(e,o){E||(E=n.style.cssText),n.style.cssText=(o?"z-index:100000;":"")+(i.isIE?"opacity:0.1;":"")+"text-indent: -"+(N+C)*t.renderer.characterWidth*.5+"px;";var u=t.container.getBoundingClientRect(),a=s.computedStyle(t.container),f=u.top+(parseInt(a.borderTopWidth)||0),l=u.left+(parseInt(u.borderLeftWidth)||0),c=u.bottom-f-n.clientHeight-2,h=function(e){s.translate(n,e.clientX-l-2,Math.min(e.clientY-f-2,c))};h(e);if(e.type!="mousedown")return;t.renderer.$isMousePressed=!0,clearTimeout(J),i.isWin&&r.capture(t.container,h,K)},this.onContextMenuClose=K;var J,Q=function(e){t.textInput.onContextMenu(e),K()};r.addListener(n,"mouseup",Q,t),r.addListener(n,"mousedown",function(e){e.preventDefault(),K()},t),r.addListener(t.renderer.scroller,"contextmenu",Q,t),r.addListener(n,"contextmenu",Q,t),d&&G(e,t,n)};t.TextInput=g,t.$setUserAgentForTests=function(e,t){m=e,d=t}}),define("ace/mouse/default_handlers",["require","exports","module","ace/lib/useragent"],function(e,t,n){"use strict";function o(e){e.$clickSelection=null;var t=e.editor;t.setDefaultHandler("mousedown",this.onMouseDown.bind(e)),t.setDefaultHandler("dblclick",this.onDoubleClick.bind(e)),t.setDefaultHandler("tripleclick",this.onTripleClick.bind(e)),t.setDefaultHandler("quadclick",this.onQuadClick.bind(e)),t.setDefaultHandler("mousewheel",this.onMouseWheel.bind(e));var n=["select","startSelect","selectEnd","selectAllEnd","selectByWordsEnd","selectByLinesEnd","dragWait","dragWaitEnd","focusWait"];n.forEach(function(t){e[t]=this[t]},this),e.selectByLines=this.extendSelectionBy.bind(e,"getLineRange"),e.selectByWords=this.extendSelectionBy.bind(e,"getWordRange")}function u(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}function a(e,t){if(e.start.row==e.end.row)var n=2*t.column-e.start.column-e.end.column;else if(e.start.row==e.end.row-1&&!e.start.column&&!e.end.column)var n=t.column-4;else var n=2*t.row-e.start.row-e.end.row;return n<0?{cursor:e.start,anchor:e.end}:{cursor:e.end,anchor:e.start}}var r=e("../lib/useragent"),i=0,s=550;(function(){this.onMouseDown=function(e){var t=e.inSelection(),n=e.getDocumentPosition();this.mousedownEvent=e;var i=this.editor,s=e.getButton();if(s!==0){var o=i.getSelectionRange(),u=o.isEmpty();(u||s==1)&&i.selection.moveToPosition(n),s==2&&(i.textInput.onContextMenu(e.domEvent),r.isMozilla||e.preventDefault());return}this.mousedownEvent.time=Date.now();if(t&&!i.isFocused()){i.focus();if(this.$focusTimeout&&!this.$clickSelection&&!i.inMultiSelectMode){this.setState("focusWait"),this.captureMouse(e);return}}return this.captureMouse(e),this.startSelect(n,e.domEvent._clicks>1),e.preventDefault()},this.startSelect=function(e,t){e=e||this.editor.renderer.screenToTextCoordinates(this.x,this.y);var n=this.editor;if(!this.mousedownEvent)return;this.mousedownEvent.getShiftKey()?n.selection.selectToPosition(e):t||n.selection.moveToPosition(e),t||this.select(),n.renderer.scroller.setCapture&&n.renderer.scroller.setCapture(),n.setStyle("ace_selecting"),this.setState("select")},this.select=function(){var e,t=this.editor,n=t.renderer.screenToTextCoordinates(this.x,this.y);if(this.$clickSelection){var r=this.$clickSelection.comparePoint(n);if(r==-1)e=this.$clickSelection.end;else if(r==1)e=this.$clickSelection.start;else{var i=a(this.$clickSelection,n);n=i.cursor,e=i.anchor}t.selection.setSelectionAnchor(e.row,e.column)}t.selection.selectToPosition(n),t.renderer.scrollCursorIntoView()},this.extendSelectionBy=function(e){var t,n=this.editor,r=n.renderer.screenToTextCoordinates(this.x,this.y),i=n.selection[e](r.row,r.column);if(this.$clickSelection){var s=this.$clickSelection.comparePoint(i.start),o=this.$clickSelection.comparePoint(i.end);if(s==-1&&o<=0){t=this.$clickSelection.end;if(i.end.row!=r.row||i.end.column!=r.column)r=i.start}else if(o==1&&s>=0){t=this.$clickSelection.start;if(i.start.row!=r.row||i.start.column!=r.column)r=i.end}else if(s==-1&&o==1)r=i.end,t=i.start;else{var u=a(this.$clickSelection,r);r=u.cursor,t=u.anchor}n.selection.setSelectionAnchor(t.row,t.column)}n.selection.selectToPosition(r),n.renderer.scrollCursorIntoView()},this.selectEnd=this.selectAllEnd=this.selectByWordsEnd=this.selectByLinesEnd=function(){this.$clickSelection=null,this.editor.unsetStyle("ace_selecting"),this.editor.renderer.scroller.releaseCapture&&this.editor.renderer.scroller.releaseCapture()},this.focusWait=function(){var e=u(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y),t=Date.now();(e>i||t-this.mousedownEvent.time>this.$focusTimeout)&&this.startSelect(this.mousedownEvent.getDocumentPosition())},this.onDoubleClick=function(e){var t=e.getDocumentPosition(),n=this.editor,r=n.session,i=r.getBracketRange(t);i?(i.isEmpty()&&(i.start.column--,i.end.column++),this.setState("select")):(i=n.selection.getWordRange(t.row,t.column),this.setState("selectByWords")),this.$clickSelection=i,this.select()},this.onTripleClick=function(e){var t=e.getDocumentPosition(),n=this.editor;this.setState("selectByLines");var r=n.getSelectionRange();r.isMultiLine()&&r.contains(t.row,t.column)?(this.$clickSelection=n.selection.getLineRange(r.start.row),this.$clickSelection.end=n.selection.getLineRange(r.end.row).end):this.$clickSelection=n.selection.getLineRange(t.row),this.select()},this.onQuadClick=function(e){var t=this.editor;t.selectAll(),this.$clickSelection=t.getSelectionRange(),this.setState("selectAll")},this.onMouseWheel=function(e){if(e.getAccelKey())return;e.getShiftKey()&&e.wheelY&&!e.wheelX&&(e.wheelX=e.wheelY,e.wheelY=0);var t=this.editor;this.$lastScroll||(this.$lastScroll={t:0,vx:0,vy:0,allowed:0});var n=this.$lastScroll,r=e.domEvent.timeStamp,i=r-n.t,o=i?e.wheelX/i:n.vx,u=i?e.wheelY/i:n.vy;i=1&&t.renderer.isScrollableBy(e.wheelX*e.speed,0)&&(f=!0),a<=1&&t.renderer.isScrollableBy(0,e.wheelY*e.speed)&&(f=!0);if(f)n.allowed=r;else if(r-n.allowedt.session.documentToScreenRow(l.row,l.column))return c()}if(f==s)return;f=s.text.join("
"),i.setHtml(f),i.show(),t._signal("showGutterTooltip",i),t.on("mousewheel",c);if(e.$tooltipFollowsMouse)h(u);else{var p=u.domEvent.target,d=p.getBoundingClientRect(),v=i.getElement().style;v.left=d.right+"px",v.top=d.bottom+"px"}}function c(){o&&(o=clearTimeout(o)),f&&(i.hide(),f=null,t._signal("hideGutterTooltip",i),t.off("mousewheel",c))}function h(e){i.setPosition(e.x,e.y)}var t=e.editor,n=t.renderer.$gutterLayer,i=new a(t.container);e.editor.setDefaultHandler("guttermousedown",function(r){if(!t.isFocused()||r.getButton()!=0)return;var i=n.getRegion(r);if(i=="foldWidgets")return;var s=r.getDocumentPosition().row,o=t.session.selection;if(r.getShiftKey())o.selectTo(s,0);else{if(r.domEvent.detail==2)return t.selectAll(),r.preventDefault();e.$clickSelection=t.selection.getLineRange(s)}return e.setState("selectByLines"),e.captureMouse(r),r.preventDefault()});var o,u,f;e.editor.setDefaultHandler("guttermousemove",function(t){var n=t.domEvent.target||t.domEvent.srcElement;if(r.hasCssClass(n,"ace_fold-widget"))return c();f&&e.$tooltipFollowsMouse&&h(t),u=t;if(o)return;o=setTimeout(function(){o=null,u&&!e.isMousePressed?l():c()},50)}),s.addListener(t.renderer.$gutter,"mouseout",function(e){u=null;if(!f||o)return;o=setTimeout(function(){o=null,c()},50)},t),t.on("changeSession",c)}function a(e){o.call(this,e)}var r=e("../lib/dom"),i=e("../lib/oop"),s=e("../lib/event"),o=e("../tooltip").Tooltip;i.inherits(a,o),function(){this.setPosition=function(e,t){var n=window.innerWidth||document.documentElement.clientWidth,r=window.innerHeight||document.documentElement.clientHeight,i=this.getWidth(),s=this.getHeight();e+=15,t+=15,e+i>n&&(e-=e+i-n),t+s>r&&(t-=20+s),o.prototype.setPosition.call(this,e,t)}}.call(a.prototype),t.GutterHandler=u}),define("ace/mouse/mouse_event",["require","exports","module","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=t.MouseEvent=function(e,t){this.domEvent=e,this.editor=t,this.x=this.clientX=e.clientX,this.y=this.clientY=e.clientY,this.$pos=null,this.$inSelection=null,this.propagationStopped=!1,this.defaultPrevented=!1};(function(){this.stopPropagation=function(){r.stopPropagation(this.domEvent),this.propagationStopped=!0},this.preventDefault=function(){r.preventDefault(this.domEvent),this.defaultPrevented=!0},this.stop=function(){this.stopPropagation(),this.preventDefault()},this.getDocumentPosition=function(){return this.$pos?this.$pos:(this.$pos=this.editor.renderer.screenToTextCoordinates(this.clientX,this.clientY),this.$pos)},this.inSelection=function(){if(this.$inSelection!==null)return this.$inSelection;var e=this.editor,t=e.getSelectionRange();if(t.isEmpty())this.$inSelection=!1;else{var n=this.getDocumentPosition();this.$inSelection=t.contains(n.row,n.column)}return this.$inSelection},this.getButton=function(){return r.getButton(this.domEvent)},this.getShiftKey=function(){return this.domEvent.shiftKey},this.getAccelKey=i.isMac?function(){return this.domEvent.metaKey}:function(){return this.domEvent.ctrlKey}}).call(s.prototype)}),define("ace/mouse/dragdrop_handler",["require","exports","module","ace/lib/dom","ace/lib/event","ace/lib/useragent"],function(e,t,n){"use strict";function f(e){function T(e,n){var r=Date.now(),i=!n||e.row!=n.row,s=!n||e.column!=n.column;if(!S||i||s)t.moveCursorToPosition(e),S=r,x={x:p,y:d};else{var o=l(x.x,x.y,p,d);o>a?S=null:r-S>=u&&(t.renderer.scrollCursorIntoView(),S=null)}}function N(e,n){var r=Date.now(),i=t.renderer.layerConfig.lineHeight,s=t.renderer.layerConfig.characterWidth,u=t.renderer.scroller.getBoundingClientRect(),a={x:{left:p-u.left,right:u.right-p},y:{top:d-u.top,bottom:u.bottom-d}},f=Math.min(a.x.left,a.x.right),l=Math.min(a.y.top,a.y.bottom),c={row:e.row,column:e.column};f/s<=2&&(c.column+=a.x.left=o&&t.renderer.scrollCursorIntoView(c):E=r:E=null}function C(){var e=g;g=t.renderer.screenToTextCoordinates(p,d),T(g,e),N(g,e)}function k(){m=t.selection.toOrientedRange(),h=t.session.addMarker(m,"ace_selection",t.getSelectionStyle()),t.clearSelection(),t.isFocused()&&t.renderer.$cursorLayer.setBlinking(!1),clearInterval(v),C(),v=setInterval(C,20),y=0,i.addListener(document,"mousemove",O)}function L(){clearInterval(v),t.session.removeMarker(h),h=null,t.selection.fromOrientedRange(m),t.isFocused()&&!w&&t.$resetCursorStyle(),m=null,g=null,y=0,E=null,S=null,i.removeListener(document,"mousemove",O)}function O(){A==null&&(A=setTimeout(function(){A!=null&&h&&L()},20))}function M(e){var t=e.types;return!t||Array.prototype.some.call(t,function(e){return e=="text/plain"||e=="Text"})}function _(e){var t=["copy","copymove","all","uninitialized"],n=["move","copymove","linkmove","all","uninitialized"],r=s.isMac?e.altKey:e.ctrlKey,i="uninitialized";try{i=e.dataTransfer.effectAllowed.toLowerCase()}catch(e){}var o="none";return r&&t.indexOf(i)>=0?o="copy":n.indexOf(i)>=0?o="move":t.indexOf(i)>=0&&(o="copy"),o}var t=e.editor,n=r.createElement("img");n.src="data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==",s.isOpera&&(n.style.cssText="width:1px;height:1px;position:fixed;top:0;left:0;z-index:2147483647;opacity:0;");var f=["dragWait","dragWaitEnd","startDrag","dragReadyEnd","onMouseDrag"];f.forEach(function(t){e[t]=this[t]},this),t.on("mousedown",this.onMouseDown.bind(e));var c=t.container,h,p,d,v,m,g,y=0,b,w,E,S,x;this.onDragStart=function(e){if(this.cancelDrag||!c.draggable){var r=this;return setTimeout(function(){r.startSelect(),r.captureMouse(e)},0),e.preventDefault()}m=t.getSelectionRange();var i=e.dataTransfer;i.effectAllowed=t.getReadOnly()?"copy":"copyMove",s.isOpera&&(t.container.appendChild(n),n.scrollTop=0),i.setDragImage&&i.setDragImage(n,0,0),s.isOpera&&t.container.removeChild(n),i.clearData(),i.setData("Text",t.session.getTextRange()),w=!0,this.setState("drag")},this.onDragEnd=function(e){c.draggable=!1,w=!1,this.setState(null);if(!t.getReadOnly()){var n=e.dataTransfer.dropEffect;!b&&n=="move"&&t.session.remove(t.getSelectionRange()),t.$resetCursorStyle()}this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle("")},this.onDragEnter=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||k(),y++,e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragOver=function(e){if(t.getReadOnly()||!M(e.dataTransfer))return;return p=e.clientX,d=e.clientY,h||(k(),y++),A!==null&&(A=null),e.dataTransfer.dropEffect=b=_(e),i.preventDefault(e)},this.onDragLeave=function(e){y--;if(y<=0&&h)return L(),b=null,i.preventDefault(e)},this.onDrop=function(e){if(!g)return;var n=e.dataTransfer;if(w)switch(b){case"move":m.contains(g.row,g.column)?m={start:g,end:g}:m=t.moveText(m,g);break;case"copy":m=t.moveText(m,g,!0)}else{var r=n.getData("Text");m={start:g,end:t.session.insert(g,r)},t.focus(),b=null}return L(),i.preventDefault(e)},i.addListener(c,"dragstart",this.onDragStart.bind(e),t),i.addListener(c,"dragend",this.onDragEnd.bind(e),t),i.addListener(c,"dragenter",this.onDragEnter.bind(e),t),i.addListener(c,"dragover",this.onDragOver.bind(e),t),i.addListener(c,"dragleave",this.onDragLeave.bind(e),t),i.addListener(c,"drop",this.onDrop.bind(e),t);var A=null}function l(e,t,n,r){return Math.sqrt(Math.pow(n-e,2)+Math.pow(r-t,2))}var r=e("../lib/dom"),i=e("../lib/event"),s=e("../lib/useragent"),o=200,u=200,a=5;(function(){this.dragWait=function(){var e=Date.now()-this.mousedownEvent.time;e>this.editor.getDragDelay()&&this.startDrag()},this.dragWaitEnd=function(){var e=this.editor.container;e.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()),this.selectEnd()},this.dragReadyEnd=function(e){this.editor.$resetCursorStyle(),this.editor.unsetStyle("ace_dragging"),this.editor.renderer.setCursorStyle(""),this.dragWaitEnd()},this.startDrag=function(){this.cancelDrag=!1;var e=this.editor,t=e.container;t.draggable=!0,e.renderer.$cursorLayer.setBlinking(!1),e.setStyle("ace_dragging");var n=s.isWin?"default":"move";e.renderer.setCursorStyle(n),this.setState("dragReady")},this.onMouseDrag=function(e){var t=this.editor.container;if(s.isIE&&this.state=="dragReady"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>3&&t.dragDrop()}if(this.state==="dragWait"){var n=l(this.mousedownEvent.x,this.mousedownEvent.y,this.x,this.y);n>0&&(t.draggable=!1,this.startSelect(this.mousedownEvent.getDocumentPosition()))}},this.onMouseDown=function(e){if(!this.$dragEnabled)return;this.mousedownEvent=e;var t=this.editor,n=e.inSelection(),r=e.getButton(),i=e.domEvent.detail||1;if(i===1&&r===0&&n){if(e.editor.inMultiSelectMode&&(e.getAccelKey()||e.getShiftKey()))return;this.mousedownEvent.time=Date.now();var o=e.domEvent.target||e.domEvent.srcElement;"unselectable"in o&&(o.unselectable="on");if(t.getDragDelay()){if(s.isWebKit){this.cancelDrag=!0;var u=t.container;u.draggable=!0}this.setState("dragWait")}else this.startDrag();this.captureMouse(e,this.onMouseDrag.bind(this)),e.defaultPrevented=!0}}}).call(f.prototype),t.DragdropHandler=f}),define("ace/mouse/touch_handler",["require","exports","module","ace/mouse/mouse_event","ace/lib/event","ace/lib/dom"],function(e,t,n){"use strict";var r=e("./mouse_event").MouseEvent,i=e("../lib/event"),s=e("../lib/dom");t.addTouchListeners=function(e,t){function b(){var e=window.navigator&&window.navigator.clipboard,r=!1,i=function(){var n=t.getCopyText(),i=t.session.getUndoManager().hasUndo();y.replaceChild(s.buildDom(r?["span",!n&&["span",{"class":"ace_mobile-button",action:"selectall"},"Select All"],n&&["span",{"class":"ace_mobile-button",action:"copy"},"Copy"],n&&["span",{"class":"ace_mobile-button",action:"cut"},"Cut"],e&&["span",{"class":"ace_mobile-button",action:"paste"},"Paste"],i&&["span",{"class":"ace_mobile-button",action:"undo"},"Undo"],["span",{"class":"ace_mobile-button",action:"find"},"Find"],["span",{"class":"ace_mobile-button",action:"openCommandPallete"},"Pallete"]]:["span"]),y.firstChild)},o=function(n){var s=n.target.getAttribute("action");if(s=="more"||!r)return r=!r,i();if(s=="paste")e.readText().then(function(e){t.execCommand(s,e)});else if(s){if(s=="cut"||s=="copy")e?e.writeText(t.getCopyText()):document.execCommand("copy");t.execCommand(s)}y.firstChild.style.display="none",r=!1,s!="openCommandPallete"&&t.focus()};y=s.buildDom(["div",{"class":"ace_mobile-menu",ontouchstart:function(e){n="menu",e.stopPropagation(),e.preventDefault(),t.textInput.focus()},ontouchend:function(e){e.stopPropagation(),e.preventDefault(),o(e)},onclick:o},["span"],["span",{"class":"ace_mobile-button",action:"more"},"..."]],t.container)}function w(){y||b();var e=t.selection.cursor,n=t.renderer.textToScreenCoordinates(e.row,e.column),r=t.renderer.textToScreenCoordinates(0,0).pageX,i=t.renderer.scrollLeft,s=t.container.getBoundingClientRect();y.style.top=n.pageY-s.top-3+"px",n.pageX-s.left=2?t.selection.getLineRange(p.row):t.session.getBracketRange(p);e&&!e.isEmpty()?t.selection.setRange(e):t.selection.selectWord(),n="wait"}function T(){h+=60,c=setInterval(function(){h--<=0&&(clearInterval(c),c=null),Math.abs(v)<.01&&(v=0),Math.abs(m)<.01&&(m=0),h<20&&(v=.9*v),h<20&&(m=.9*m);var e=t.session.getScrollTop();t.renderer.scrollBy(10*v,10*m),e==t.session.getScrollTop()&&(h=0)},10)}var n="scroll",o,u,a,f,l,c,h=0,p,d=0,v=0,m=0,g,y;i.addListener(e,"contextmenu",function(e){if(!g)return;var n=t.textInput.getElement();n.focus()},t),i.addListener(e,"touchstart",function(e){var i=e.touches;if(l||i.length>1){clearTimeout(l),l=null,a=-1,n="zoom";return}g=t.$mouseHandler.isMousePressed=!0;var s=t.renderer.layerConfig.lineHeight,c=t.renderer.layerConfig.lineHeight,y=e.timeStamp;f=y;var b=i[0],w=b.clientX,E=b.clientY;Math.abs(o-w)+Math.abs(u-E)>s&&(a=-1),o=e.clientX=w,u=e.clientY=E,v=m=0;var T=new r(e,t);p=T.getDocumentPosition();if(y-a<500&&i.length==1&&!h)d++,e.preventDefault(),e.button=0,x();else{d=0;var N=t.selection.cursor,C=t.selection.isEmpty()?N:t.selection.anchor,k=t.renderer.$cursorLayer.getPixelPosition(N,!0),L=t.renderer.$cursorLayer.getPixelPosition(C,!0),A=t.renderer.scroller.getBoundingClientRect(),O=t.renderer.layerConfig.offset,M=t.renderer.scrollLeft,_=function(e,t){return e/=c,t=t/s-.75,e*e+t*t};if(e.clientXP?"cursor":"anchor"),P<3.5?n="anchor":D<3.5?n="cursor":n="scroll",l=setTimeout(S,450)}a=y},t),i.addListener(e,"touchend",function(e){g=t.$mouseHandler.isMousePressed=!1,c&&clearInterval(c),n=="zoom"?(n="",h=0):l?(t.selection.moveToPosition(p),h=0,w()):n=="scroll"?(T(),E()):w(),clearTimeout(l),l=null},t),i.addListener(e,"touchmove",function(e){l&&(clearTimeout(l),l=null);var i=e.touches;if(i.length>1||n=="zoom")return;var s=i[0],a=o-s.clientX,c=u-s.clientY;if(n=="wait"){if(!(a*a+c*c>4))return e.preventDefault();n="cursor"}o=s.clientX,u=s.clientY,e.clientX=s.clientX,e.clientY=s.clientY;var h=e.timeStamp,p=h-f;f=h;if(n=="scroll"){var d=new r(e,t);d.speed=1,d.wheelX=a,d.wheelY=c,10*Math.abs(a)1&&(i=n[n.length-2]);var o=a[t+"Path"];return o==null?o=a.basePath:r=="/"&&(t=r=""),o&&o.slice(-1)!="/"&&(o+="/"),o+t+r+i+this.get("suffix")},t.setModuleUrl=function(e,t){return a.$moduleUrls[e]=t},t.$loading={},t.loadModule=function(n,r){var i,o;Array.isArray(n)&&(o=n[0],n=n[1]);try{i=e(n)}catch(u){}if(i&&!t.$loading[n])return r&&r(i);t.$loading[n]||(t.$loading[n]=[]),t.$loading[n].push(r);if(t.$loading[n].length>1)return;var a=function(){e([n],function(e){t._emit("load.module",{name:n,module:e});var r=t.$loading[n];t.$loading[n]=null,r.forEach(function(t){t&&t(e)})})};if(!t.get("packaged"))return a();s.loadScript(t.moduleUrl(n,o),a),f()};var f=function(){!a.basePath&&!a.workerPath&&!a.modePath&&!a.themePath&&!Object.keys(a.$moduleUrls).length&&(console.error("Unable to infer path to ace from script src,","use ace.config.set('basePath', 'path') to enable dynamic loading of modes and themes","or with webpack use ace/webpack-resolver"),f=function(){})};t.init=l,t.version="1.4.12"}),define("ace/mouse/mouse_handler",["require","exports","module","ace/lib/event","ace/lib/useragent","ace/mouse/default_handlers","ace/mouse/default_gutter_handler","ace/mouse/mouse_event","ace/mouse/dragdrop_handler","ace/mouse/touch_handler","ace/config"],function(e,t,n){"use strict";var r=e("../lib/event"),i=e("../lib/useragent"),s=e("./default_handlers").DefaultHandlers,o=e("./default_gutter_handler").GutterHandler,u=e("./mouse_event").MouseEvent,a=e("./dragdrop_handler").DragdropHandler,f=e("./touch_handler").addTouchListeners,l=e("../config"),c=function(e){var t=this;this.editor=e,new s(this),new o(this),new a(this);var n=function(t){var n=!document.hasFocus||!document.hasFocus()||!e.isFocused()&&document.activeElement==(e.textInput&&e.textInput.getElement());n&&window.focus(),e.focus()},u=e.renderer.getMouseEventTarget();r.addListener(u,"click",this.onMouseEvent.bind(this,"click"),e),r.addListener(u,"mousemove",this.onMouseMove.bind(this,"mousemove"),e),r.addMultiMouseDownListener([u,e.renderer.scrollBarV&&e.renderer.scrollBarV.inner,e.renderer.scrollBarH&&e.renderer.scrollBarH.inner,e.textInput&&e.textInput.getElement()].filter(Boolean),[400,300,250],this,"onMouseEvent",e),r.addMouseWheelListener(e.container,this.onMouseWheel.bind(this,"mousewheel"),e),f(e.container,e);var l=e.renderer.$gutter;r.addListener(l,"mousedown",this.onMouseEvent.bind(this,"guttermousedown"),e),r.addListener(l,"click",this.onMouseEvent.bind(this,"gutterclick"),e),r.addListener(l,"dblclick",this.onMouseEvent.bind(this,"gutterdblclick"),e),r.addListener(l,"mousemove",this.onMouseEvent.bind(this,"guttermousemove"),e),r.addListener(u,"mousedown",n,e),r.addListener(l,"mousedown",n,e),i.isIE&&e.renderer.scrollBarV&&(r.addListener(e.renderer.scrollBarV.element,"mousedown",n,e),r.addListener(e.renderer.scrollBarH.element,"mousedown",n,e)),e.on("mousemove",function(n){if(t.state||t.$dragDelay||!t.$dragEnabled)return;var r=e.renderer.screenToTextCoordinates(n.x,n.y),i=e.session.selection.getRange(),s=e.renderer;!i.isEmpty()&&i.insideStart(r.row,r.column)?s.setCursorStyle("default"):s.setCursorStyle("")},e)};(function(){this.onMouseEvent=function(e,t){this.editor._emit(e,new u(t,this.editor))},this.onMouseMove=function(e,t){var n=this.editor._eventRegistry&&this.editor._eventRegistry.mousemove;if(!n||!n.length)return;this.editor._emit(e,new u(t,this.editor))},this.onMouseWheel=function(e,t){var n=new u(t,this.editor);n.speed=this.$scrollSpeed*2,n.wheelX=t.wheelX,n.wheelY=t.wheelY,this.editor._emit(e,n)},this.setState=function(e){this.state=e},this.captureMouse=function(e,t){this.x=e.x,this.y=e.y,this.isMousePressed=!0;var n=this.editor,s=this.editor.renderer;s.$isMousePressed=!0;var o=this,a=function(e){if(!e)return;if(i.isWebKit&&!e.which&&o.releaseMouse)return o.releaseMouse();o.x=e.clientX,o.y=e.clientY,t&&t(e),o.mouseEvent=new u(e,o.editor),o.$mouseMoved=!0},f=function(e){n.off("beforeEndOperation",c),clearInterval(h),l(),o[o.state+"End"]&&o[o.state+"End"](e),o.state="",o.isMousePressed=s.$isMousePressed=!1,s.$keepTextAreaAtCursor&&s.$moveTextAreaToCursor(),o.$onCaptureMouseMove=o.releaseMouse=null,e&&o.onMouseEvent("mouseup",e),n.endOperation()},l=function(){o[o.state]&&o[o.state](),o.$mouseMoved=!1};if(i.isOldIE&&e.domEvent.type=="dblclick")return setTimeout(function(){f(e)});var c=function(e){if(!o.releaseMouse)return;n.curOp.command.name&&n.curOp.selectionChanged&&(o[o.state+"End"]&&o[o.state+"End"](),o.state="",o.releaseMouse())};n.on("beforeEndOperation",c),n.startOperation({command:{name:"mouse"}}),o.$onCaptureMouseMove=a,o.releaseMouse=r.capture(this.editor.container,a,f);var h=setInterval(l,20)},this.releaseMouse=null,this.cancelContextMenu=function(){var e=function(t){if(t&&t.domEvent&&t.domEvent.type!="contextmenu")return;this.editor.off("nativecontextmenu",e),t&&t.domEvent&&r.stopEvent(t.domEvent)}.bind(this);setTimeout(e,10),this.editor.on("nativecontextmenu",e)},this.destroy=function(){this.releaseMouse&&this.releaseMouse()}}).call(c.prototype),l.defineOptions(c.prototype,"mouseHandler",{scrollSpeed:{initialValue:2},dragDelay:{initialValue:i.isMac?150:0},dragEnabled:{initialValue:!0},focusTimeout:{initialValue:0},tooltipFollowsMouse:{initialValue:!0}}),t.MouseHandler=c}),define("ace/mouse/fold_handler",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";function i(e){e.on("click",function(t){var n=t.getDocumentPosition(),i=e.session,s=i.getFoldAt(n.row,n.column,1);s&&(t.getAccelKey()?i.removeFold(s):i.expandFold(s),t.stop());var o=t.domEvent&&t.domEvent.target;o&&r.hasCssClass(o,"ace_inline_button")&&r.hasCssClass(o,"ace_toggle_wrap")&&(i.setOption("wrap",!i.getUseWrapMode()),e.renderer.scrollCursorIntoView())}),e.on("gutterclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session;i.foldWidgets&&i.foldWidgets[r]&&e.session.onFoldWidgetClick(r,t),e.isFocused()||e.focus(),t.stop()}}),e.on("gutterdblclick",function(t){var n=e.renderer.$gutterLayer.getRegion(t);if(n=="foldWidgets"){var r=t.getDocumentPosition().row,i=e.session,s=i.getParentFoldRangeData(r,!0),o=s.range||s.firstRange;if(o){r=o.start.row;var u=i.getFoldAt(r,i.getLine(r).length,1);u?i.removeFold(u):(i.addFold("...",o),e.renderer.scrollCursorIntoView({row:o.start.row,column:0}))}t.stop()}})}var r=e("../lib/dom");t.FoldHandler=i}),define("ace/keyboard/keybinding",["require","exports","module","ace/lib/keys","ace/lib/event"],function(e,t,n){"use strict";var r=e("../lib/keys"),i=e("../lib/event"),s=function(e){this.$editor=e,this.$data={editor:e},this.$handlers=[],this.setDefaultHandler(e.commands)};(function(){this.setDefaultHandler=function(e){this.removeKeyboardHandler(this.$defaultHandler),this.$defaultHandler=e,this.addKeyboardHandler(e,0)},this.setKeyboardHandler=function(e){var t=this.$handlers;if(t[t.length-1]==e)return;while(t[t.length-1]&&t[t.length-1]!=this.$defaultHandler)this.removeKeyboardHandler(t[t.length-1]);this.addKeyboardHandler(e,1)},this.addKeyboardHandler=function(e,t){if(!e)return;typeof e=="function"&&!e.handleKeyboard&&(e.handleKeyboard=e);var n=this.$handlers.indexOf(e);n!=-1&&this.$handlers.splice(n,1),t==undefined?this.$handlers.push(e):this.$handlers.splice(t,0,e),n==-1&&e.attach&&e.attach(this.$editor)},this.removeKeyboardHandler=function(e){var t=this.$handlers.indexOf(e);return t==-1?!1:(this.$handlers.splice(t,1),e.detach&&e.detach(this.$editor),!0)},this.getKeyboardHandler=function(){return this.$handlers[this.$handlers.length-1]},this.getStatusText=function(){var e=this.$data,t=e.editor;return this.$handlers.map(function(n){return n.getStatusText&&n.getStatusText(t,e)||""}).filter(Boolean).join(" ")},this.$callKeyboardHandlers=function(e,t,n,r){var s,o=!1,u=this.$editor.commands;for(var a=this.$handlers.length;a--;){s=this.$handlers[a].handleKeyboard(this.$data,e,t,n,r);if(!s||!s.command)continue;s.command=="null"?o=!0:o=u.exec(s.command,this.$editor,s.args,r),o&&r&&e!=-1&&s.passEvent!=1&&s.command.passEvent!=1&&i.stopEvent(r);if(o)break}return!o&&e==-1&&(s={command:"insertstring"},o=u.exec("insertstring",this.$editor,t)),o&&this.$editor._signal&&this.$editor._signal("keyboardActivity",s),o},this.onCommandKey=function(e,t,n){var i=r.keyCodeToString(n);return this.$callKeyboardHandlers(t,i,n,e)},this.onTextInput=function(e){return this.$callKeyboardHandlers(-1,e)}}).call(s.prototype),t.KeyBinding=s}),define("ace/lib/bidiutil",["require","exports","module"],function(e,t,n){"use strict";function F(e,t,n,r){var i=s?d:p,c=null,h=null,v=null,m=0,g=null,y=null,b=-1,w=null,E=null,T=[];if(!r)for(w=0,r=[];w0)if(g==16){for(w=b;w-1){for(w=b;w=0;C--){if(r[C]!=N)break;t[C]=s}}}function I(e,t,n){if(o=e){u=i+1;while(u=e)u++;for(a=i,l=u-1;a=t.length||(o=n[r-1])!=b&&o!=w||(c=t[r+1])!=b&&c!=w)return E;return u&&(c=w),c==o?c:E;case k:o=r>0?n[r-1]:S;if(o==b&&r+10&&n[r-1]==b)return b;if(u)return E;p=r+1,h=t.length;while(p=1425&&d<=2303||d==64286;o=t[p];if(v&&(o==y||o==T))return y}if(r<1||(o=t[r-1])==S)return E;return n[r-1];case S:return u=!1,f=!0,s;case x:return l=!0,E;case O:case M:case D:case P:case _:u=!1;case H:return E}}function R(e){var t=e.charCodeAt(0),n=t>>8;return n==0?t>191?g:B[t]:n==5?/[\u0591-\u05f4]/.test(e)?y:g:n==6?/[\u0610-\u061a\u064b-\u065f\u06d6-\u06e4\u06e7-\u06ed]/.test(e)?A:/[\u0660-\u0669\u066b-\u066c]/.test(e)?w:t==1642?L:/[\u06f0-\u06f9]/.test(e)?b:T:n==32&&t<=8287?j[t&255]:n==254?t>=65136?T:E:E}function U(e){return e>="\u064b"&&e<="\u0655"}var r=["\u0621","\u0641"],i=["\u063a","\u064a"],s=0,o=0,u=!1,a=!1,f=!1,l=!1,c=!1,h=!1,p=[[0,3,0,1,0,0,0],[0,3,0,1,2,2,0],[0,3,0,17,2,0,1],[0,3,5,5,4,1,0],[0,3,21,21,4,0,1],[0,3,5,5,4,2,0]],d=[[2,0,1,1,0,1,0],[2,0,1,1,0,2,0],[2,0,2,1,3,2,0],[2,0,2,33,3,1,1]],v=0,m=1,g=0,y=1,b=2,w=3,E=4,S=5,x=6,T=7,N=8,C=9,k=10,L=11,A=12,O=13,M=14,_=15,D=16,P=17,H=18,B=[H,H,H,H,H,H,H,H,H,x,S,x,N,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,S,S,S,x,N,E,E,L,L,L,E,E,E,E,E,k,C,k,C,C,b,b,b,b,b,b,b,b,b,b,C,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,E,E,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,g,E,E,E,E,H,H,H,H,H,H,S,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,H,C,E,L,L,L,L,E,E,E,E,g,E,E,H,E,E,L,L,b,b,E,g,E,E,E,b,g,E,E,E,E,E],j=[N,N,N,N,N,N,N,N,N,N,N,H,H,H,g,y,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N,S,O,M,_,D,P,C,L,L,L,L,L,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,C,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,E,N];t.L=g,t.R=y,t.EN=b,t.ON_R=3,t.AN=4,t.R_H=5,t.B=6,t.RLE=7,t.DOT="\u00b7",t.doBidiReorder=function(e,n,r){if(e.length<2)return{};var i=e.split(""),o=new Array(i.length),u=new Array(i.length),a=[];s=r?m:v,F(i,a,i.length,n);for(var f=0;fT&&n[f]0&&i[f-1]==="\u0644"&&/\u0622|\u0623|\u0625|\u0627/.test(i[f])&&(a[f-1]=a[f]=t.R_H,f++);i[i.length-1]===t.DOT&&(a[i.length-1]=t.B),i[0]==="\u202b"&&(a[0]=t.RLE);for(var f=0;f=0&&(e=this.session.$docRowCache[n])}return e},this.getSplitIndex=function(){var e=0,t=this.session.$screenRowCache;if(t.length){var n,r=this.session.$getRowCacheIndex(t,this.currentRow);while(this.currentRow-e>0){n=this.session.$getRowCacheIndex(t,this.currentRow-e-1);if(n!==r)break;r=n,e++}}else e=this.currentRow;return e},this.updateRowLine=function(e,t){e===undefined&&(e=this.getDocumentRow());var n=e===this.session.getLength()-1,s=n?this.EOF:this.EOL;this.wrapIndent=0,this.line=this.session.getLine(e),this.isRtlDir=this.$isRtl||this.line.charAt(0)===this.RLE;if(this.session.$useWrapMode){var o=this.session.$wrapData[e];o&&(t===undefined&&(t=this.getSplitIndex()),t>0&&o.length?(this.wrapIndent=o.indent,this.wrapOffset=this.wrapIndent*this.charWidths[r.L],this.line=tt?this.session.getOverwrite()?e:e-1:t,i=r.getVisualFromLogicalIdx(n,this.bidiMap),s=this.bidiMap.bidiLevels,o=0;!this.session.getOverwrite()&&e<=t&&s[i]%2!==0&&i++;for(var u=0;ut&&s[i]%2===0&&(o+=this.charWidths[s[i]]),this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset),this.isRtlDir&&(o+=this.rtlLineOffset),o},this.getSelections=function(e,t){var n=this.bidiMap,r=n.bidiLevels,i,s=[],o=0,u=Math.min(e,t)-this.wrapIndent,a=Math.max(e,t)-this.wrapIndent,f=!1,l=!1,c=0;this.wrapIndent&&(o+=this.isRtlDir?-1*this.wrapOffset:this.wrapOffset);for(var h,p=0;p=u&&hn+s/2){n+=s;if(r===i.length-1){s=0;break}s=this.charWidths[i[++r]]}return r>0&&i[r-1]%2!==0&&i[r]%2===0?(e0&&i[r-1]%2===0&&i[r]%2!==0?t=1+(e>n?this.bidiMap.logicalFromVisual[r]:this.bidiMap.logicalFromVisual[r-1]):this.isRtlDir&&r===i.length-1&&s===0&&i[r-1]%2===0||!this.isRtlDir&&r===0&&i[r]%2!==0?t=1+this.bidiMap.logicalFromVisual[r]:(r>0&&i[r-1]%2!==0&&s!==0&&r--,t=this.bidiMap.logicalFromVisual[r]),t===0&&this.isRtlDir&&t++,t+this.wrapIndent}}).call(o.prototype),t.BidiHandler=o}),define("ace/selection",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/range"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/lang"),s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=function(e){this.session=e,this.doc=e.getDocument(),this.clearSelection(),this.cursor=this.lead=this.doc.createAnchor(0,0),this.anchor=this.doc.createAnchor(0,0),this.$silent=!1;var t=this;this.cursor.on("change",function(e){t.$cursorChanged=!0,t.$silent||t._emit("changeCursor"),!t.$isEmpty&&!t.$silent&&t._emit("changeSelection"),!t.$keepDesiredColumnOnChange&&e.old.column!=e.value.column&&(t.$desiredColumn=null)}),this.anchor.on("change",function(){t.$anchorChanged=!0,!t.$isEmpty&&!t.$silent&&t._emit("changeSelection")})};(function(){r.implement(this,s),this.isEmpty=function(){return this.$isEmpty||this.anchor.row==this.lead.row&&this.anchor.column==this.lead.column},this.isMultiLine=function(){return!this.$isEmpty&&this.anchor.row!=this.cursor.row},this.getCursor=function(){return this.lead.getPosition()},this.setSelectionAnchor=function(e,t){this.$isEmpty=!1,this.anchor.setPosition(e,t)},this.getAnchor=this.getSelectionAnchor=function(){return this.$isEmpty?this.getSelectionLead():this.anchor.getPosition()},this.getSelectionLead=function(){return this.lead.getPosition()},this.isBackwards=function(){var e=this.anchor,t=this.lead;return e.row>t.row||e.row==t.row&&e.column>t.column},this.getRange=function(){var e=this.anchor,t=this.lead;return this.$isEmpty?o.fromPoints(t,t):this.isBackwards()?o.fromPoints(t,e):o.fromPoints(e,t)},this.clearSelection=function(){this.$isEmpty||(this.$isEmpty=!0,this._emit("changeSelection"))},this.selectAll=function(){this.$setSelection(0,0,Number.MAX_VALUE,Number.MAX_VALUE)},this.setRange=this.setSelectionRange=function(e,t){var n=t?e.end:e.start,r=t?e.start:e.end;this.$setSelection(n.row,n.column,r.row,r.column)},this.$setSelection=function(e,t,n,r){if(this.$silent)return;var i=this.$isEmpty,s=this.inMultiSelectMode;this.$silent=!0,this.$cursorChanged=this.$anchorChanged=!1,this.anchor.setPosition(e,t),this.cursor.setPosition(n,r),this.$isEmpty=!o.comparePoints(this.anchor,this.cursor),this.$silent=!1,this.$cursorChanged&&this._emit("changeCursor"),(this.$cursorChanged||this.$anchorChanged||i!=this.$isEmpty||s)&&this._emit("changeSelection")},this.$moveSelection=function(e){var t=this.lead;this.$isEmpty&&this.setSelectionAnchor(t.row,t.column),e.call(this)},this.selectTo=function(e,t){this.$moveSelection(function(){this.moveCursorTo(e,t)})},this.selectToPosition=function(e){this.$moveSelection(function(){this.moveCursorToPosition(e)})},this.moveTo=function(e,t){this.clearSelection(),this.moveCursorTo(e,t)},this.moveToPosition=function(e){this.clearSelection(),this.moveCursorToPosition(e)},this.selectUp=function(){this.$moveSelection(this.moveCursorUp)},this.selectDown=function(){this.$moveSelection(this.moveCursorDown)},this.selectRight=function(){this.$moveSelection(this.moveCursorRight)},this.selectLeft=function(){this.$moveSelection(this.moveCursorLeft)},this.selectLineStart=function(){this.$moveSelection(this.moveCursorLineStart)},this.selectLineEnd=function(){this.$moveSelection(this.moveCursorLineEnd)},this.selectFileEnd=function(){this.$moveSelection(this.moveCursorFileEnd)},this.selectFileStart=function(){this.$moveSelection(this.moveCursorFileStart)},this.selectWordRight=function(){this.$moveSelection(this.moveCursorWordRight)},this.selectWordLeft=function(){this.$moveSelection(this.moveCursorWordLeft)},this.getWordRange=function(e,t){if(typeof t=="undefined"){var n=e||this.lead;e=n.row,t=n.column}return this.session.getWordRange(e,t)},this.selectWord=function(){this.setSelectionRange(this.getWordRange())},this.selectAWord=function(){var e=this.getCursor(),t=this.session.getAWordRange(e.row,e.column);this.setSelectionRange(t)},this.getLineRange=function(e,t){var n=typeof e=="number"?e:this.lead.row,r,i=this.session.getFoldLine(n);return i?(n=i.start.row,r=i.end.row):r=n,t===!0?new o(n,0,r,this.session.getLine(r).length):new o(n,0,r+1,0)},this.selectLine=function(){this.setSelectionRange(this.getLineRange())},this.moveCursorUp=function(){this.moveCursorBy(-1,0)},this.moveCursorDown=function(){this.moveCursorBy(1,0)},this.wouldMoveIntoSoftTab=function(e,t,n){var r=e.column,i=e.column+t;return n<0&&(r=e.column-t,i=e.column),this.session.isTabStop(e)&&this.doc.getLine(e.row).slice(r,i).split(" ").length-1==t},this.moveCursorLeft=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,-1))this.moveCursorTo(t.start.row,t.start.column);else if(e.column===0)e.row>0&&this.moveCursorTo(e.row-1,this.doc.getLine(e.row-1).length);else{var n=this.session.getTabSize();this.wouldMoveIntoSoftTab(e,n,-1)&&!this.session.getNavigateWithinSoftTabs()?this.moveCursorBy(0,-n):this.moveCursorBy(0,-1)}},this.moveCursorRight=function(){var e=this.lead.getPosition(),t;if(t=this.session.getFoldAt(e.row,e.column,1))this.moveCursorTo(t.end.row,t.end.column);else if(this.lead.column==this.doc.getLine(this.lead.row).length)this.lead.row0&&(t.column=r)}}this.moveCursorTo(t.row,t.column)},this.moveCursorFileEnd=function(){var e=this.doc.getLength()-1,t=this.doc.getLine(e).length;this.moveCursorTo(e,t)},this.moveCursorFileStart=function(){this.moveCursorTo(0,0)},this.moveCursorLongWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t);this.session.nonTokenRe.lastIndex=0,this.session.tokenRe.lastIndex=0;var i=this.session.getFoldAt(e,t,1);if(i){this.moveCursorTo(i.end.row,i.end.column);return}this.session.nonTokenRe.exec(r)&&(t+=this.session.nonTokenRe.lastIndex,this.session.nonTokenRe.lastIndex=0,r=n.substring(t));if(t>=n.length){this.moveCursorTo(e,n.length),this.moveCursorRight(),e0&&this.moveCursorWordLeft();return}this.session.tokenRe.exec(s)&&(t-=this.session.tokenRe.lastIndex,this.session.tokenRe.lastIndex=0),this.moveCursorTo(e,t)},this.$shortWordEndIndex=function(e){var t=0,n,r=/\s/,i=this.session.tokenRe;i.lastIndex=0;if(this.session.tokenRe.exec(e))t=this.session.tokenRe.lastIndex;else{while((n=e[t])&&r.test(n))t++;if(t<1){i.lastIndex=0;while((n=e[t])&&!i.test(n)){i.lastIndex=0,t++;if(r.test(n)){if(t>2){t--;break}while((n=e[t])&&r.test(n))t++;if(t>2)break}}}}return i.lastIndex=0,t},this.moveCursorShortWordRight=function(){var e=this.lead.row,t=this.lead.column,n=this.doc.getLine(e),r=n.substring(t),i=this.session.getFoldAt(e,t,1);if(i)return this.moveCursorTo(i.end.row,i.end.column);if(t==n.length){var s=this.doc.getLength();do e++,r=this.doc.getLine(e);while(e0&&/^\s*$/.test(r));t=r.length,/\s+$/.test(r)||(r="")}var s=i.stringReverse(r),o=this.$shortWordEndIndex(s);return this.moveCursorTo(e,t-o)},this.moveCursorWordRight=function(){this.session.$selectLongWords?this.moveCursorLongWordRight():this.moveCursorShortWordRight()},this.moveCursorWordLeft=function(){this.session.$selectLongWords?this.moveCursorLongWordLeft():this.moveCursorShortWordLeft()},this.moveCursorBy=function(e,t){var n=this.session.documentToScreenPosition(this.lead.row,this.lead.column),r;t===0&&(e!==0&&(this.session.$bidiHandler.isBidiRow(n.row,this.lead.row)?(r=this.session.$bidiHandler.getPosLeft(n.column),n.column=Math.round(r/this.session.$bidiHandler.charWidths[0])):r=n.column*this.session.$bidiHandler.charWidths[0]),this.$desiredColumn?n.column=this.$desiredColumn:this.$desiredColumn=n.column);if(e!=0&&this.session.lineWidgets&&this.session.lineWidgets[this.lead.row]){var i=this.session.lineWidgets[this.lead.row];e<0?e-=i.rowsAbove||0:e>0&&(e+=i.rowCount-(i.rowsAbove||0))}var s=this.session.screenToDocumentPosition(n.row+e,n.column,r);e!==0&&t===0&&s.row===this.lead.row&&s.column===this.lead.column,this.moveCursorTo(s.row,s.column+t,t===0)},this.moveCursorToPosition=function(e){this.moveCursorTo(e.row,e.column)},this.moveCursorTo=function(e,t,n){var r=this.session.getFoldAt(e,t,1);r&&(e=r.start.row,t=r.start.column),this.$keepDesiredColumnOnChange=!0;var i=this.session.getLine(e);/[\uDC00-\uDFFF]/.test(i.charAt(t))&&i.charAt(t-1)&&(this.lead.row==e&&this.lead.column==t+1?t-=1:t+=1),this.lead.setPosition(e,t),this.$keepDesiredColumnOnChange=!1,n||(this.$desiredColumn=null)},this.moveCursorToScreen=function(e,t,n){var r=this.session.screenToDocumentPosition(e,t);this.moveCursorTo(r.row,r.column,n)},this.detach=function(){this.lead.detach(),this.anchor.detach(),this.session=this.doc=null},this.fromOrientedRange=function(e){this.setSelectionRange(e,e.cursor==e.start),this.$desiredColumn=e.desiredColumn||this.$desiredColumn},this.toOrientedRange=function(e){var t=this.getRange();return e?(e.start.column=t.start.column,e.start.row=t.start.row,e.end.column=t.end.column,e.end.row=t.end.row):e=t,e.cursor=this.isBackwards()?e.start:e.end,e.desiredColumn=this.$desiredColumn,e},this.getRangeOfMovements=function(e){var t=this.getCursor();try{e(this);var n=this.getCursor();return o.fromPoints(t,n)}catch(r){return o.fromPoints(t,t)}finally{this.moveCursorToPosition(t)}},this.toJSON=function(){if(this.rangeCount)var e=this.ranges.map(function(e){var t=e.clone();return t.isBackwards=e.cursor==e.start,t});else{var e=this.getRange();e.isBackwards=this.isBackwards()}return e},this.fromJSON=function(e){if(e.start==undefined){if(this.rangeList&&e.length>1){this.toSingleRange(e[0]);for(var t=e.length;t--;){var n=o.fromPoints(e[t].start,e[t].end);e[t].isBackwards&&(n.cursor=n.start),this.addRange(n,!0)}return}e=e[0]}this.rangeList&&this.toSingleRange(e),this.setSelectionRange(e,e.isBackwards)},this.isEqual=function(e){if((e.length||this.rangeCount)&&e.length!=this.rangeCount)return!1;if(!e.length||!this.ranges)return this.getRange().isEqual(e);for(var t=this.ranges.length;t--;)if(!this.ranges[t].isEqual(e[t]))return!1;return!0}}).call(u.prototype),t.Selection=u}),define("ace/tokenizer",["require","exports","module","ace/config"],function(e,t,n){"use strict";var r=e("./config"),i=2e3,s=function(e){this.states=e,this.regExps={},this.matchMappings={};for(var t in this.states){var n=this.states[t],r=[],i=0,s=this.matchMappings[t]={defaultToken:"text"},o="g",u=[];for(var a=0;a1?f.onMatch=this.$applyToken:f.onMatch=f.token),c>1&&(/\\\d/.test(f.regex)?l=f.regex.replace(/\\([0-9]+)/g,function(e,t){return"\\"+(parseInt(t,10)+i+1)}):(c=1,l=this.removeCapturingGroups(f.regex)),!f.splitRegex&&typeof f.token!="string"&&u.push(f)),s[i]=a,i+=c,r.push(l),f.onMatch||(f.onMatch=null)}r.length||(s[0]=0,r.push("$")),u.forEach(function(e){e.splitRegex=this.createSplitterRegexp(e.regex,o)},this),this.regExps[t]=new RegExp("("+r.join(")|(")+")|($)",o)}};(function(){this.$setMaxTokenCount=function(e){i=e|0},this.$applyToken=function(e){var t=this.splitRegex.exec(e).slice(1),n=this.token.apply(this,t);if(typeof n=="string")return[{type:n,value:e}];var r=[];for(var i=0,s=n.length;il){var g=e.substring(l,m-v.length);h.type==p?h.value+=g:(h.type&&f.push(h),h={type:p,value:g})}for(var y=0;yi){c>2*e.length&&this.reportError("infinite loop with in ace tokenizer",{startState:t,line:e});while(l1&&n[0]!==r&&n.unshift("#tmp",r),{tokens:f,state:n.length?n:r}},this.reportError=r.reportError}).call(s.prototype),t.Tokenizer=s}),define("ace/mode/text_highlight_rules",["require","exports","module","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../lib/lang"),i=function(){this.$rules={start:[{token:"empty_line",regex:"^$"},{defaultToken:"text"}]}};(function(){this.addRules=function(e,t){if(!t){for(var n in e)this.$rules[n]=e[n];return}for(var n in e){var r=e[n];for(var i=0;i=this.$rowTokens.length){this.$row+=1,e||(e=this.$session.getLength());if(this.$row>=e)return this.$row=e-1,null;this.$rowTokens=this.$session.getTokens(this.$row),this.$tokenIndex=0}return this.$rowTokens[this.$tokenIndex]},this.getCurrentToken=function(){return this.$rowTokens[this.$tokenIndex]},this.getCurrentTokenRow=function(){return this.$row},this.getCurrentTokenColumn=function(){var e=this.$rowTokens,t=this.$tokenIndex,n=e[t].start;if(n!==undefined)return n;n=0;while(t>0)t-=1,n+=e[t].value.length;return n},this.getCurrentTokenPosition=function(){return{row:this.$row,column:this.getCurrentTokenColumn()}},this.getCurrentTokenRange=function(){var e=this.$rowTokens[this.$tokenIndex],t=this.getCurrentTokenColumn();return new r(this.$row,t,this.$row,t+e.value.length)}}).call(i.prototype),t.TokenIterator=i}),define("ace/mode/behaviour/cstyle",["require","exports","module","ace/lib/oop","ace/mode/behaviour","ace/token_iterator","ace/lib/lang"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../behaviour").Behaviour,s=e("../../token_iterator").TokenIterator,o=e("../../lib/lang"),u=["text","paren.rparen","rparen","paren","punctuation.operator"],a=["text","paren.rparen","rparen","paren","punctuation.operator","comment"],f,l={},c={'"':'"',"'":"'"},h=function(e){var t=-1;e.multiSelect&&(t=e.selection.index,l.rangeCount!=e.multiSelect.rangeCount&&(l={rangeCount:e.multiSelect.rangeCount}));if(l[t])return f=l[t];f=l[t]={autoInsertedBrackets:0,autoInsertedRow:-1,autoInsertedLineEnd:"",maybeInsertedBrackets:0,maybeInsertedRow:-1,maybeInsertedLineStart:"",maybeInsertedLineEnd:""}},p=function(e,t,n,r){var i=e.end.row-e.start.row;return{text:n+t+r,selection:[0,e.start.column+1,i,e.end.column+(i?0:1)]}},d=function(e){this.add("braces","insertion",function(t,n,r,i,s){var u=r.getCursorPosition(),a=i.doc.getLine(u.row);if(s=="{"){h(r);var l=r.getSelectionRange(),c=i.doc.getTextRange(l);if(c!==""&&c!=="{"&&r.getWrapBehavioursEnabled())return p(l,c,"{","}");if(d.isSaneInsertion(r,i))return/[\]\}\)]/.test(a[u.column])||r.inMultiSelectMode||e&&e.braces?(d.recordAutoInsert(r,i,"}"),{text:"{}",selection:[1,1]}):(d.recordMaybeInsert(r,i,"{"),{text:"{",selection:[1,1]})}else if(s=="}"){h(r);var v=a.substring(u.column,u.column+1);if(v=="}"){var m=i.$findOpeningBracket("}",{column:u.column+1,row:u.row});if(m!==null&&d.isAutoInsertedClosing(u,a,s))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}else{if(s=="\n"||s=="\r\n"){h(r);var g="";d.isMaybeInsertedClosing(u,a)&&(g=o.stringRepeat("}",f.maybeInsertedBrackets),d.clearMaybeInsertedClosing());var v=a.substring(u.column,u.column+1);if(v==="}"){var y=i.findMatchingBracket({row:u.row,column:u.column+1},"}");if(!y)return null;var b=this.$getIndent(i.getLine(y.row))}else{if(!g){d.clearMaybeInsertedClosing();return}var b=this.$getIndent(a)}var w=b+i.getTabString();return{text:"\n"+w+"\n"+b+g,selection:[1,w.length,1,w.length]}}d.clearMaybeInsertedClosing()}}),this.add("braces","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="{"){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.end.column,i.end.column+1);if(u=="}")return i.end.column++,i;f.maybeInsertedBrackets--}}),this.add("parens","insertion",function(e,t,n,r,i){if(i=="("){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"(",")");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,")"),{text:"()",selection:[1,1]}}else if(i==")"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f==")"){var l=r.$findOpeningBracket(")",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("parens","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="("){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u==")")return i.end.column++,i}}),this.add("brackets","insertion",function(e,t,n,r,i){if(i=="["){h(n);var s=n.getSelectionRange(),o=r.doc.getTextRange(s);if(o!==""&&n.getWrapBehavioursEnabled())return p(s,o,"[","]");if(d.isSaneInsertion(n,r))return d.recordAutoInsert(n,r,"]"),{text:"[]",selection:[1,1]}}else if(i=="]"){h(n);var u=n.getCursorPosition(),a=r.doc.getLine(u.row),f=a.substring(u.column,u.column+1);if(f=="]"){var l=r.$findOpeningBracket("]",{column:u.column+1,row:u.row});if(l!==null&&d.isAutoInsertedClosing(u,a,i))return d.popAutoInsertedClosing(),{text:"",selection:[1,1]}}}}),this.add("brackets","deletion",function(e,t,n,r,i){var s=r.doc.getTextRange(i);if(!i.isMultiLine()&&s=="["){h(n);var o=r.doc.getLine(i.start.row),u=o.substring(i.start.column+1,i.start.column+2);if(u=="]")return i.end.column++,i}}),this.add("string_dquotes","insertion",function(e,t,n,r,i){var s=r.$mode.$quotes||c;if(i.length==1&&s[i]){if(this.lineCommentStart&&this.lineCommentStart.indexOf(i)!=-1)return;h(n);var o=i,u=n.getSelectionRange(),a=r.doc.getTextRange(u);if(a!==""&&(a.length!=1||!s[a])&&n.getWrapBehavioursEnabled())return p(u,a,o,o);if(!a){var f=n.getCursorPosition(),l=r.doc.getLine(f.row),d=l.substring(f.column-1,f.column),v=l.substring(f.column,f.column+1),m=r.getTokenAt(f.row,f.column),g=r.getTokenAt(f.row,f.column+1);if(d=="\\"&&m&&/escape/.test(m.type))return null;var y=m&&/string|escape/.test(m.type),b=!g||/string|escape/.test(g.type),w;if(v==o)w=y!==b,w&&/string\.end/.test(g.type)&&(w=!1);else{if(y&&!b)return null;if(y&&b)return null;var E=r.$mode.tokenRe;E.lastIndex=0;var S=E.test(d);E.lastIndex=0;var x=E.test(d);if(S||x)return null;if(v&&!/[\s;,.})\]\\]/.test(v))return null;var T=l[f.column-2];if(!(d!=o||T!=o&&!E.test(T)))return null;w=!0}return{text:w?o+o:"",selection:[1,1]}}}}),this.add("string_dquotes","deletion",function(e,t,n,r,i){var s=r.$mode.$quotes||c,o=r.doc.getTextRange(i);if(!i.isMultiLine()&&s.hasOwnProperty(o)){h(n);var u=r.doc.getLine(i.start.row),a=u.substring(i.start.column+1,i.start.column+2);if(a==o)return i.end.column++,i}})};d.isSaneInsertion=function(e,t){var n=e.getCursorPosition(),r=new s(t,n.row,n.column);if(!this.$matchTokenType(r.getCurrentToken()||"text",u)){if(/[)}\]]/.test(e.session.getLine(n.row)[n.column]))return!0;var i=new s(t,n.row,n.column+1);if(!this.$matchTokenType(i.getCurrentToken()||"text",u))return!1}return r.stepForward(),r.getCurrentTokenRow()!==n.row||this.$matchTokenType(r.getCurrentToken()||"text",a)},d.$matchTokenType=function(e,t){return t.indexOf(e.type||e)>-1},d.recordAutoInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isAutoInsertedClosing(r,i,f.autoInsertedLineEnd[0])||(f.autoInsertedBrackets=0),f.autoInsertedRow=r.row,f.autoInsertedLineEnd=n+i.substr(r.column),f.autoInsertedBrackets++},d.recordMaybeInsert=function(e,t,n){var r=e.getCursorPosition(),i=t.doc.getLine(r.row);this.isMaybeInsertedClosing(r,i)||(f.maybeInsertedBrackets=0),f.maybeInsertedRow=r.row,f.maybeInsertedLineStart=i.substr(0,r.column)+n,f.maybeInsertedLineEnd=i.substr(r.column),f.maybeInsertedBrackets++},d.isAutoInsertedClosing=function(e,t,n){return f.autoInsertedBrackets>0&&e.row===f.autoInsertedRow&&n===f.autoInsertedLineEnd[0]&&t.substr(e.column)===f.autoInsertedLineEnd},d.isMaybeInsertedClosing=function(e,t){return f.maybeInsertedBrackets>0&&e.row===f.maybeInsertedRow&&t.substr(e.column)===f.maybeInsertedLineEnd&&t.substr(0,e.column)==f.maybeInsertedLineStart},d.popAutoInsertedClosing=function(){f.autoInsertedLineEnd=f.autoInsertedLineEnd.substr(1),f.autoInsertedBrackets--},d.clearMaybeInsertedClosing=function(){f&&(f.maybeInsertedBrackets=0,f.maybeInsertedRow=-1)},r.inherits(d,i),t.CstyleBehaviour=d}),define("ace/unicode",["require","exports","module"],function(e,t,n){"use strict";var r=[48,9,8,25,5,0,2,25,48,0,11,0,5,0,6,22,2,30,2,457,5,11,15,4,8,0,2,0,18,116,2,1,3,3,9,0,2,2,2,0,2,19,2,82,2,138,2,4,3,155,12,37,3,0,8,38,10,44,2,0,2,1,2,1,2,0,9,26,6,2,30,10,7,61,2,9,5,101,2,7,3,9,2,18,3,0,17,58,3,100,15,53,5,0,6,45,211,57,3,18,2,5,3,11,3,9,2,1,7,6,2,2,2,7,3,1,3,21,2,6,2,0,4,3,3,8,3,1,3,3,9,0,5,1,2,4,3,11,16,2,2,5,5,1,3,21,2,6,2,1,2,1,2,1,3,0,2,4,5,1,3,2,4,0,8,3,2,0,8,15,12,2,2,8,2,2,2,21,2,6,2,1,2,4,3,9,2,2,2,2,3,0,16,3,3,9,18,2,2,7,3,1,3,21,2,6,2,1,2,4,3,8,3,1,3,2,9,1,5,1,2,4,3,9,2,0,17,1,2,5,4,2,2,3,4,1,2,0,2,1,4,1,4,2,4,11,5,4,4,2,2,3,3,0,7,0,15,9,18,2,2,7,2,2,2,22,2,9,2,4,4,7,2,2,2,3,8,1,2,1,7,3,3,9,19,1,2,7,2,2,2,22,2,9,2,4,3,8,2,2,2,3,8,1,8,0,2,3,3,9,19,1,2,7,2,2,2,22,2,15,4,7,2,2,2,3,10,0,9,3,3,9,11,5,3,1,2,17,4,23,2,8,2,0,3,6,4,0,5,5,2,0,2,7,19,1,14,57,6,14,2,9,40,1,2,0,3,1,2,0,3,0,7,3,2,6,2,2,2,0,2,0,3,1,2,12,2,2,3,4,2,0,2,5,3,9,3,1,35,0,24,1,7,9,12,0,2,0,2,0,5,9,2,35,5,19,2,5,5,7,2,35,10,0,58,73,7,77,3,37,11,42,2,0,4,328,2,3,3,6,2,0,2,3,3,40,2,3,3,32,2,3,3,6,2,0,2,3,3,14,2,56,2,3,3,66,5,0,33,15,17,84,13,619,3,16,2,25,6,74,22,12,2,6,12,20,12,19,13,12,2,2,2,1,13,51,3,29,4,0,5,1,3,9,34,2,3,9,7,87,9,42,6,69,11,28,4,11,5,11,11,39,3,4,12,43,5,25,7,10,38,27,5,62,2,28,3,10,7,9,14,0,89,75,5,9,18,8,13,42,4,11,71,55,9,9,4,48,83,2,2,30,14,230,23,280,3,5,3,37,3,5,3,7,2,0,2,0,2,0,2,30,3,52,2,6,2,0,4,2,2,6,4,3,3,5,5,12,6,2,2,6,67,1,20,0,29,0,14,0,17,4,60,12,5,0,4,11,18,0,5,0,3,9,2,0,4,4,7,0,2,0,2,0,2,3,2,10,3,3,6,4,5,0,53,1,2684,46,2,46,2,132,7,6,15,37,11,53,10,0,17,22,10,6,2,6,2,6,2,6,2,6,2,6,2,6,2,6,2,31,48,0,470,1,36,5,2,4,6,1,5,85,3,1,3,2,2,89,2,3,6,40,4,93,18,23,57,15,513,6581,75,20939,53,1164,68,45,3,268,4,27,21,31,3,13,13,1,2,24,9,69,11,1,38,8,3,102,3,1,111,44,25,51,13,68,12,9,7,23,4,0,5,45,3,35,13,28,4,64,15,10,39,54,10,13,3,9,7,22,4,1,5,66,25,2,227,42,2,1,3,9,7,11171,13,22,5,48,8453,301,3,61,3,105,39,6,13,4,6,11,2,12,2,4,2,0,2,1,2,1,2,107,34,362,19,63,3,53,41,11,5,15,17,6,13,1,25,2,33,4,2,134,20,9,8,25,5,0,2,25,12,88,4,5,3,5,3,5,3,2],i=0,s=[];for(var o=0;o2?r%f!=f-1:r%f==0}}var E=Infinity;w(function(e,t){var n=e.search(/\S/);n!==-1?(ne.length&&(E=e.length)}),u==Infinity&&(u=E,s=!1,o=!1),l&&u%f!=0&&(u=Math.floor(u/f)*f),w(o?m:v)},this.toggleBlockComment=function(e,t,n,r){var i=this.blockComment;if(!i)return;!i.start&&i[0]&&(i=i[0]);var s=new f(t,r.row,r.column),o=s.getCurrentToken(),u=t.selection,a=t.selection.toOrientedRange(),c,h;if(o&&/comment/.test(o.type)){var p,d;while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.start);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;p=new l(m,g,m,g+i.start.length);break}o=s.stepBackward()}var s=new f(t,r.row,r.column),o=s.getCurrentToken();while(o&&/comment/.test(o.type)){var v=o.value.indexOf(i.end);if(v!=-1){var m=s.getCurrentTokenRow(),g=s.getCurrentTokenColumn()+v;d=new l(m,g,m,g+i.end.length);break}o=s.stepForward()}d&&t.remove(d),p&&(t.remove(p),c=p.start.row,h=-i.start.length)}else h=i.start.length,c=n.start.row,t.insert(n.end,i.end),t.insert(n.start,i.start);a.start.row==c&&(a.start.column+=h),a.end.row==c&&(a.end.column+=h),t.selection.fromOrientedRange(a)},this.getNextLineIndent=function(e,t,n){return this.$getIndent(t)},this.checkOutdent=function(e,t,n){return!1},this.autoOutdent=function(e,t,n){},this.$getIndent=function(e){return e.match(/^\s*/)[0]},this.createWorker=function(e){return null},this.createModeDelegates=function(e){this.$embeds=[],this.$modes={};for(var t in e)if(e[t]){var n=e[t],i=n.prototype.$id,s=r.$modes[i];s||(r.$modes[i]=s=new n),r.$modes[t]||(r.$modes[t]=s),this.$embeds.push(t),this.$modes[t]=s}var o=["toggleBlockComment","toggleCommentLines","getNextLineIndent","checkOutdent","autoOutdent","transformAction","getCompletions"];for(var t=0;t=0&&t.row=0&&t.column<=e[t.row].length}function s(e,t){t.action!="insert"&&t.action!="remove"&&r(t,"delta.action must be 'insert' or 'remove'"),t.lines instanceof Array||r(t,"delta.lines must be an Array"),(!t.start||!t.end)&&r(t,"delta.start/end must be an present");var n=t.start;i(e,t.start)||r(t,"delta.start must be contained in document");var s=t.end;t.action=="remove"&&!i(e,s)&&r(t,"delta.end must contained in document for 'remove' actions");var o=s.row-n.row,u=s.column-(o==0?n.column:0);(o!=t.lines.length-1||t.lines[o].length!=u)&&r(t,"delta.range must match delta lines")}t.applyDelta=function(e,t,n){var r=t.start.row,i=t.start.column,s=e[r]||"";switch(t.action){case"insert":var o=t.lines;if(o.length===1)e[r]=s.substring(0,i)+t.lines[0]+s.substring(i);else{var u=[r,1].concat(t.lines);e.splice.apply(e,u),e[r]=s.substring(0,i)+e[r],e[r+t.lines.length-1]+=s.substring(i)}break;case"remove":var a=t.end.column,f=t.end.row;r===f?e[r]=s.substring(0,i)+s.substring(a):e.splice(r,f-r+1,s.substring(0,i)+e[f].substring(a))}}}),define("ace/anchor",["require","exports","module","ace/lib/oop","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/event_emitter").EventEmitter,s=t.Anchor=function(e,t,n){this.$onChange=this.onChange.bind(this),this.attach(e),typeof n=="undefined"?this.setPosition(t.row,t.column):this.setPosition(t,n)};(function(){function e(e,t,n){var r=n?e.column<=t.column:e.columnthis.row)return;var n=t(e,{row:this.row,column:this.column},this.$insertRight);this.setPosition(n.row,n.column,!0)},this.setPosition=function(e,t,n){var r;n?r={row:e,column:t}:r=this.$clipPositionToDocument(e,t);if(this.row==r.row&&this.column==r.column)return;var i={row:this.row,column:this.column};this.row=r.row,this.column=r.column,this._signal("change",{old:i,value:r})},this.detach=function(){this.document.off("change",this.$onChange)},this.attach=function(e){this.document=e||this.document,this.document.on("change",this.$onChange)},this.$clipPositionToDocument=function(e,t){var n={};return e>=this.document.getLength()?(n.row=Math.max(0,this.document.getLength()-1),n.column=this.document.getLine(n.row).length):e<0?(n.row=0,n.column=0):(n.row=e,n.column=Math.min(this.document.getLine(n.row).length,Math.max(0,t))),t<0&&(n.column=0),n}}).call(s.prototype)}),define("ace/document",["require","exports","module","ace/lib/oop","ace/apply_delta","ace/lib/event_emitter","ace/range","ace/anchor"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./apply_delta").applyDelta,s=e("./lib/event_emitter").EventEmitter,o=e("./range").Range,u=e("./anchor").Anchor,a=function(e){this.$lines=[""],e.length===0?this.$lines=[""]:Array.isArray(e)?this.insertMergedLines({row:0,column:0},e):this.insert({row:0,column:0},e)};(function(){r.implement(this,s),this.setValue=function(e){var t=this.getLength()-1;this.remove(new o(0,0,t,this.getLine(t).length)),this.insert({row:0,column:0},e)},this.getValue=function(){return this.getAllLines().join(this.getNewLineCharacter())},this.createAnchor=function(e,t){return new u(this,e,t)},"aaa".split(/a/).length===0?this.$split=function(e){return e.replace(/\r\n|\r/g,"\n").split("\n")}:this.$split=function(e){return e.split(/\r\n|\r|\n/)},this.$detectNewLine=function(e){var t=e.match(/^.*?(\r\n|\r|\n)/m);this.$autoNewLine=t?t[1]:"\n",this._signal("changeNewLineMode")},this.getNewLineCharacter=function(){switch(this.$newLineMode){case"windows":return"\r\n";case"unix":return"\n";default:return this.$autoNewLine||"\n"}},this.$autoNewLine="",this.$newLineMode="auto",this.setNewLineMode=function(e){if(this.$newLineMode===e)return;this.$newLineMode=e,this._signal("changeNewLineMode")},this.getNewLineMode=function(){return this.$newLineMode},this.isNewLine=function(e){return e=="\r\n"||e=="\r"||e=="\n"},this.getLine=function(e){return this.$lines[e]||""},this.getLines=function(e,t){return this.$lines.slice(e,t+1)},this.getAllLines=function(){return this.getLines(0,this.getLength())},this.getLength=function(){return this.$lines.length},this.getTextRange=function(e){return this.getLinesForRange(e).join(this.getNewLineCharacter())},this.getLinesForRange=function(e){var t;if(e.start.row===e.end.row)t=[this.getLine(e.start.row).substring(e.start.column,e.end.column)];else{t=this.getLines(e.start.row,e.end.row),t[0]=(t[0]||"").substring(e.start.column);var n=t.length-1;e.end.row-e.start.row==n&&(t[n]=t[n].substring(0,e.end.column))}return t},this.insertLines=function(e,t){return console.warn("Use of document.insertLines is deprecated. Use the insertFullLines method instead."),this.insertFullLines(e,t)},this.removeLines=function(e,t){return console.warn("Use of document.removeLines is deprecated. Use the removeFullLines method instead."),this.removeFullLines(e,t)},this.insertNewLine=function(e){return console.warn("Use of document.insertNewLine is deprecated. Use insertMergedLines(position, ['', '']) instead."),this.insertMergedLines(e,["",""])},this.insert=function(e,t){return this.getLength()<=1&&this.$detectNewLine(t),this.insertMergedLines(e,this.$split(t))},this.insertInLine=function(e,t){var n=this.clippedPos(e.row,e.column),r=this.pos(e.row,e.column+t.length);return this.applyDelta({start:n,end:r,action:"insert",lines:[t]},!0),this.clonePos(r)},this.clippedPos=function(e,t){var n=this.getLength();e===undefined?e=n:e<0?e=0:e>=n&&(e=n-1,t=undefined);var r=this.getLine(e);return t==undefined&&(t=r.length),t=Math.min(Math.max(t,0),r.length),{row:e,column:t}},this.clonePos=function(e){return{row:e.row,column:e.column}},this.pos=function(e,t){return{row:e,column:t}},this.$clipPosition=function(e){var t=this.getLength();return e.row>=t?(e.row=Math.max(0,t-1),e.column=this.getLine(t-1).length):(e.row=Math.max(0,e.row),e.column=Math.min(Math.max(e.column,0),this.getLine(e.row).length)),e},this.insertFullLines=function(e,t){e=Math.min(Math.max(e,0),this.getLength());var n=0;e0,r=t=0&&this.applyDelta({start:this.pos(e,this.getLine(e).length),end:this.pos(e+1,0),action:"remove",lines:["",""]})},this.replace=function(e,t){e instanceof o||(e=o.fromPoints(e.start,e.end));if(t.length===0&&e.isEmpty())return e.start;if(t==this.getTextRange(e))return e.end;this.remove(e);var n;return t?n=this.insert(e.start,t):n=e.start,n},this.applyDeltas=function(e){for(var t=0;t=0;t--)this.revertDelta(e[t])},this.applyDelta=function(e,t){var n=e.action=="insert";if(n?e.lines.length<=1&&!e.lines[0]:!o.comparePoints(e.start,e.end))return;n&&e.lines.length>2e4?this.$splitAndapplyLargeDelta(e,2e4):(i(this.$lines,e,t),this._signal("change",e))},this.$safeApplyDelta=function(e){var t=this.$lines.length;(e.action=="remove"&&e.start.row20){n.running=setTimeout(n.$worker,20);break}}n.currentLine=t,r==-1&&(r=t),s<=r&&n.fireUpdateEvent(s,r)}};(function(){r.implement(this,i),this.setTokenizer=function(e){this.tokenizer=e,this.lines=[],this.states=[],this.start(0)},this.setDocument=function(e){this.doc=e,this.lines=[],this.states=[],this.stop()},this.fireUpdateEvent=function(e,t){var n={first:e,last:t};this._signal("update",{data:n})},this.start=function(e){this.currentLine=Math.min(e||0,this.currentLine,this.doc.getLength()),this.lines.splice(this.currentLine,this.lines.length),this.states.splice(this.currentLine,this.states.length),this.stop(),this.running=setTimeout(this.$worker,700)},this.scheduleStart=function(){this.running||(this.running=setTimeout(this.$worker,700))},this.$updateOnChange=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.lines[t]=null;else if(e.action=="remove")this.lines.splice(t,n+1,null),this.states.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.lines.splice.apply(this.lines,r),this.states.splice.apply(this.states,r)}this.currentLine=Math.min(t,this.currentLine,this.doc.getLength()),this.stop()},this.stop=function(){this.running&&clearTimeout(this.running),this.running=!1},this.getTokens=function(e){return this.lines[e]||this.$tokenizeRow(e)},this.getState=function(e){return this.currentLine==e&&this.$tokenizeRow(e),this.states[e]||"start"},this.$tokenizeRow=function(e){var t=this.doc.getLine(e),n=this.states[e-1],r=this.tokenizer.getLineTokens(t,n,e);return this.states[e]+""!=r.state+""?(this.states[e]=r.state,this.lines[e+1]=null,this.currentLine>e+1&&(this.currentLine=e+1)):this.currentLine==e&&(this.currentLine=e+1),this.lines[e]=r.tokens}}).call(s.prototype),t.BackgroundTokenizer=s}),define("ace/search_highlight",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(e,t,n){this.setRegexp(e),this.clazz=t,this.type=n||"text"};(function(){this.MAX_RANGES=500,this.setRegexp=function(e){if(this.regExp+""==e+"")return;this.regExp=e,this.cache=[]},this.update=function(e,t,n,i){if(!this.regExp)return;var o=i.firstRow,u=i.lastRow;for(var a=o;a<=u;a++){var f=this.cache[a];f==null&&(f=r.getMatchOffsets(n.getLine(a),this.regExp),f.length>this.MAX_RANGES&&(f=f.slice(0,this.MAX_RANGES)),f=f.map(function(e){return new s(a,e.offset,a,e.offset+e.length)}),this.cache[a]=f.length?f:"");for(var l=f.length;l--;)t.drawSingleLineMarker(e,f[l].toScreenRange(n),this.clazz,i)}}}).call(o.prototype),t.SearchHighlight=o}),define("ace/edit_session/fold_line",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){this.foldData=e,Array.isArray(t)?this.folds=t:t=this.folds=[t];var n=t[t.length-1];this.range=new r(t[0].start.row,t[0].start.column,n.end.row,n.end.column),this.start=this.range.start,this.end=this.range.end,this.folds.forEach(function(e){e.setFoldLine(this)},this)}var r=e("../range").Range;(function(){this.shiftRow=function(e){this.start.row+=e,this.end.row+=e,this.folds.forEach(function(t){t.start.row+=e,t.end.row+=e})},this.addFold=function(e){if(e.sameRow){if(e.start.rowthis.endRow)throw new Error("Can't add a fold to this FoldLine as it has no connection");this.folds.push(e),this.folds.sort(function(e,t){return-e.range.compareEnd(t.start.row,t.start.column)}),this.range.compareEnd(e.start.row,e.start.column)>0?(this.end.row=e.end.row,this.end.column=e.end.column):this.range.compareStart(e.end.row,e.end.column)<0&&(this.start.row=e.start.row,this.start.column=e.start.column)}else if(e.start.row==this.end.row)this.folds.push(e),this.end.row=e.end.row,this.end.column=e.end.column;else{if(e.end.row!=this.start.row)throw new Error("Trying to add fold to FoldRow that doesn't have a matching row");this.folds.unshift(e),this.start.row=e.start.row,this.start.column=e.start.column}e.foldLine=this},this.containsRow=function(e){return e>=this.start.row&&e<=this.end.row},this.walk=function(e,t,n){var r=0,i=this.folds,s,o,u,a=!0;t==null&&(t=this.end.row,n=this.end.column);for(var f=0;f0)continue;var a=i(e,o.start);return u===0?t&&a!==0?-s-2:s:a>0||a===0&&!t?s:-s-1}return-s-1},this.add=function(e){var t=!e.isEmpty(),n=this.pointIndex(e.start,t);n<0&&(n=-n-1);var r=this.pointIndex(e.end,t,n);return r<0?r=-r-1:r++,this.ranges.splice(n,r-n,e)},this.addList=function(e){var t=[];for(var n=e.length;n--;)t.push.apply(t,this.add(e[n]));return t},this.substractPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges.splice(t,1)},this.merge=function(){var e=[],t=this.ranges;t=t.sort(function(e,t){return i(e.start,t.start)});var n=t[0],r;for(var s=1;s=0},this.containsPoint=function(e){return this.pointIndex(e)>=0},this.rangeAtPoint=function(e){var t=this.pointIndex(e);if(t>=0)return this.ranges[t]},this.clipRows=function(e,t){var n=this.ranges;if(n[0].start.row>t||n[n.length-1].start.row=r)break}if(e.action=="insert"){var f=i-r,l=-t.column+n.column;for(;or)break;a.start.row==r&&a.start.column>=t.column&&(a.start.column==t.column&&this.$bias<=0||(a.start.column+=l,a.start.row+=f));if(a.end.row==r&&a.end.column>=t.column){if(a.end.column==t.column&&this.$bias<0)continue;a.end.column==t.column&&l>0&&oa.start.column&&a.end.column==s[o+1].start.column&&(a.end.column-=l),a.end.column+=l,a.end.row+=f}}}else{var f=r-i,l=t.column-n.column;for(;oi)break;if(a.end.rowt.column)a.end.column=t.column,a.end.row=t.row}else a.end.column+=l,a.end.row+=f;else a.end.row>i&&(a.end.row+=f);if(a.start.rowt.column)a.start.column=t.column,a.start.row=t.row}else a.start.column+=l,a.start.row+=f;else a.start.row>i&&(a.start.row+=f)}}if(f!=0&&o=e)return i;if(i.end.row>e)return null}return null},this.getNextFoldLine=function(e,t){var n=this.$foldData,r=0;t&&(r=n.indexOf(t)),r==-1&&(r=0);for(r;r=e)return i}return null},this.getFoldedRowCount=function(e,t){var n=this.$foldData,r=t-e+1;for(var i=0;i=t){u=e?r-=t-u:r=0);break}o>=e&&(u>=e?r-=o-u:r-=o-e+1)}return r},this.$addFoldLine=function(e){return this.$foldData.push(e),this.$foldData.sort(function(e,t){return e.start.row-t.start.row}),e},this.addFold=function(e,t){var n=this.$foldData,r=!1,o;e instanceof s?o=e:(o=new s(t,e),o.collapseChildren=t.collapseChildren),this.$clipRangeToDocument(o.range);var u=o.start.row,a=o.start.column,f=o.end.row,l=o.end.column,c=this.getFoldAt(u,a,1),h=this.getFoldAt(f,l,-1);if(c&&h==c)return c.addSubFold(o);c&&!c.range.isStart(u,a)&&this.removeFold(c),h&&!h.range.isEnd(f,l)&&this.removeFold(h);var p=this.getFoldsInRange(o.range);p.length>0&&(this.removeFolds(p),o.collapseChildren||p.forEach(function(e){o.addSubFold(e)}));for(var d=0;d0&&this.foldAll(e.start.row+1,e.end.row,e.collapseChildren-1),e.subFolds=[]},this.expandFolds=function(e){e.forEach(function(e){this.expandFold(e)},this)},this.unfold=function(e,t){var n,i;e==null?(n=new r(0,0,this.getLength(),0),t==null&&(t=!0)):typeof e=="number"?n=new r(e,0,e,this.getLine(e).length):"row"in e?n=r.fromPoints(e,e):n=e,i=this.getFoldsInRangeList(n),t!=0?this.removeFolds(i):this.expandFolds(i);if(i.length)return i},this.isRowFolded=function(e,t){return!!this.getFoldLine(e,t)},this.getRowFoldEnd=function(e,t){var n=this.getFoldLine(e,t);return n?n.end.row:e},this.getRowFoldStart=function(e,t){var n=this.getFoldLine(e,t);return n?n.start.row:e},this.getFoldDisplayLine=function(e,t,n,r,i){r==null&&(r=e.start.row),i==null&&(i=0),t==null&&(t=e.end.row),n==null&&(n=this.getLine(t).length);var s=this.doc,o="";return e.walk(function(e,t,n,u){if(tl)break}while(s&&a.test(s.type));s=i.stepBackward()}else s=i.getCurrentToken();return f.end.row=i.getCurrentTokenRow(),f.end.column=i.getCurrentTokenColumn()+s.value.length-2,f}},this.foldAll=function(e,t,n,r){n==undefined&&(n=1e5);var i=this.foldWidgets;if(!i)return;t=t||this.getLength(),e=e||0;for(var s=e;s=e&&(s=o.end.row,o.collapseChildren=n,this.addFold("...",o))}},this.foldToLevel=function(e){this.foldAll();while(e-->0)this.unfold(null,!1)},this.foldAllComments=function(){var e=this;this.foldAll(null,null,null,function(t){var n=e.getTokens(t);for(var r=0;r=0){var s=n[r];s==null&&(s=n[r]=this.getFoldWidget(r));if(s=="start"){var o=this.getFoldWidgetRange(r);i||(i=o);if(o&&o.end.row>=e)break}r--}return{range:r!==-1&&o,firstRange:i}},this.onFoldWidgetClick=function(e,t){t=t.domEvent;var n={children:t.shiftKey,all:t.ctrlKey||t.metaKey,siblings:t.altKey},r=this.$toggleFoldWidget(e,n);if(!r){var i=t.target||t.srcElement;i&&/ace_fold-widget/.test(i.className)&&(i.className+=" ace_invalid")}},this.$toggleFoldWidget=function(e,t){if(!this.getFoldWidget)return;var n=this.getFoldWidget(e),r=this.getLine(e),i=n==="end"?-1:1,s=this.getFoldAt(e,i===-1?0:r.length,i);if(s)return t.children||t.all?this.removeFold(s):this.expandFold(s),s;var o=this.getFoldWidgetRange(e,!0);if(o&&!o.isMultiLine()){s=this.getFoldAt(o.start.row,o.start.column,1);if(s&&o.isEqual(s.range))return this.removeFold(s),s}if(t.siblings){var u=this.getParentFoldRangeData(e);if(u.range)var a=u.range.start.row+1,f=u.range.end.row;this.foldAll(a,f,t.all?1e4:0)}else t.children?(f=o?o.end.row:this.getLength(),this.foldAll(e+1,f,t.all?1e4:0)):o&&(t.all&&(o.collapseChildren=1e4),this.addFold("...",o));return o},this.toggleFoldWidget=function(e){var t=this.selection.getCursor().row;t=this.getRowFoldStart(t);var n=this.$toggleFoldWidget(t,{});if(n)return;var r=this.getParentFoldRangeData(t,!0);n=r.range||r.firstRange;if(n){t=n.start.row;var i=this.getFoldAt(t,this.getLine(t).length,1);i?this.removeFold(i):this.addFold("...",n)}},this.updateFoldWidgets=function(e){var t=e.start.row,n=e.end.row-t;if(n===0)this.foldWidgets[t]=null;else if(e.action=="remove")this.foldWidgets.splice(t,n+1,null);else{var r=Array(n+1);r.unshift(t,1),this.foldWidgets.splice.apply(this.foldWidgets,r)}},this.tokenizerUpdateFoldWidgets=function(e){var t=e.data;t.first!=t.last&&this.foldWidgets.length>t.first&&this.foldWidgets.splice(t.first,this.foldWidgets.length)}}var r=e("../range").Range,i=e("./fold_line").FoldLine,s=e("./fold").Fold,o=e("../token_iterator").TokenIterator;t.Folding=u}),define("ace/edit_session/bracket_match",["require","exports","module","ace/token_iterator","ace/range"],function(e,t,n){"use strict";function s(){this.findMatchingBracket=function(e,t){if(e.column==0)return null;var n=t||this.getLine(e.row).charAt(e.column-1);if(n=="")return null;var r=n.match(/([\(\[\{])|([\)\]\}])/);return r?r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e):null},this.getBracketRange=function(e){var t=this.getLine(e.row),n=!0,r,s=t.charAt(e.column-1),o=s&&s.match(/([\(\[\{])|([\)\]\}])/);o||(s=t.charAt(e.column),e={row:e.row,column:e.column+1},o=s&&s.match(/([\(\[\{])|([\)\]\}])/),n=!1);if(!o)return null;if(o[1]){var u=this.$findClosingBracket(o[1],e);if(!u)return null;r=i.fromPoints(e,u),n||(r.end.column++,r.start.column--),r.cursor=r.end}else{var u=this.$findOpeningBracket(o[2],e);if(!u)return null;r=i.fromPoints(u,e),n||(r.start.column++,r.end.column--),r.cursor=r.start}return r},this.getMatchingBracketRanges=function(e){var t=this.getLine(e.row),n=t.charAt(e.column-1),r=n&&n.match(/([\(\[\{])|([\)\]\}])/);r||(n=t.charAt(e.column),e={row:e.row,column:e.column+1},r=n&&n.match(/([\(\[\{])|([\)\]\}])/));if(!r)return null;var s=new i(e.row,e.column-1,e.row,e.column),o=r[1]?this.$findClosingBracket(r[1],e):this.$findOpeningBracket(r[2],e);if(!o)return[s];var u=new i(o.row,o.column,o.row,o.column+1);return[s,u]},this.$brackets={")":"(","(":")","]":"[","[":"]","{":"}","}":"{","<":">",">":"<"},this.$findOpeningBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("rparen",".paren").replace(/\b(?:end)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn()-2,f=u.value;for(;;){while(a>=0){var l=f.charAt(a);if(l==i){s-=1;if(s==0)return{row:o.getCurrentTokenRow(),column:a+o.getCurrentTokenColumn()}}else l==e&&(s+=1);a-=1}do u=o.stepBackward();while(u&&!n.test(u.type));if(u==null)break;f=u.value,a=f.length-1}return null},this.$findClosingBracket=function(e,t,n){var i=this.$brackets[e],s=1,o=new r(this,t.row,t.column),u=o.getCurrentToken();u||(u=o.stepForward());if(!u)return;n||(n=new RegExp("(\\.?"+u.type.replace(".","\\.").replace("lparen",".paren").replace(/\b(?:start|begin)\b/,"(?:start|begin|end)")+")+"));var a=t.column-o.getCurrentTokenColumn();for(;;){var f=u.value,l=f.length;while(a=4352&&e<=4447||e>=4515&&e<=4519||e>=4602&&e<=4607||e>=9001&&e<=9002||e>=11904&&e<=11929||e>=11931&&e<=12019||e>=12032&&e<=12245||e>=12272&&e<=12283||e>=12288&&e<=12350||e>=12353&&e<=12438||e>=12441&&e<=12543||e>=12549&&e<=12589||e>=12593&&e<=12686||e>=12688&&e<=12730||e>=12736&&e<=12771||e>=12784&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=13054||e>=13056&&e<=19903||e>=19968&&e<=42124||e>=42128&&e<=42182||e>=43360&&e<=43388||e>=44032&&e<=55203||e>=55216&&e<=55238||e>=55243&&e<=55291||e>=63744&&e<=64255||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=65281&&e<=65376||e>=65504&&e<=65510}r.implement(this,u),this.setDocument=function(e){this.doc&&this.doc.removeListener("change",this.$onChange),this.doc=e,e.on("change",this.$onChange),this.bgTokenizer&&this.bgTokenizer.setDocument(this.getDocument()),this.resetCaches()},this.getDocument=function(){return this.doc},this.$resetRowCache=function(e){if(!e){this.$docRowCache=[],this.$screenRowCache=[];return}var t=this.$docRowCache.length,n=this.$getRowCacheIndex(this.$docRowCache,e)+1;t>n&&(this.$docRowCache.splice(n,t),this.$screenRowCache.splice(n,t))},this.$getRowCacheIndex=function(e,t){var n=0,r=e.length-1;while(n<=r){var i=n+r>>1,s=e[i];if(t>s)n=i+1;else{if(!(t=t)break}return r=n[s],r?(r.index=s,r.start=i-r.value.length,r):null},this.setUndoManager=function(e){this.$undoManager=e,this.$informUndoManager&&this.$informUndoManager.cancel();if(e){var t=this;e.addSession(this),this.$syncInformUndoManager=function(){t.$informUndoManager.cancel(),t.mergeUndoDeltas=!1},this.$informUndoManager=i.delayedCall(this.$syncInformUndoManager)}else this.$syncInformUndoManager=function(){}},this.markUndoGroup=function(){this.$syncInformUndoManager&&this.$syncInformUndoManager()},this.$defaultUndoManager={undo:function(){},redo:function(){},hasUndo:function(){},hasRedo:function(){},reset:function(){},add:function(){},addSelection:function(){},startNewGroup:function(){},addSession:function(){}},this.getUndoManager=function(){return this.$undoManager||this.$defaultUndoManager},this.getTabString=function(){return this.getUseSoftTabs()?i.stringRepeat(" ",this.getTabSize()):" "},this.setUseSoftTabs=function(e){this.setOption("useSoftTabs",e)},this.getUseSoftTabs=function(){return this.$useSoftTabs&&!this.$mode.$indentWithTabs},this.setTabSize=function(e){this.setOption("tabSize",e)},this.getTabSize=function(){return this.$tabSize},this.isTabStop=function(e){return this.$useSoftTabs&&e.column%this.$tabSize===0},this.setNavigateWithinSoftTabs=function(e){this.setOption("navigateWithinSoftTabs",e)},this.getNavigateWithinSoftTabs=function(){return this.$navigateWithinSoftTabs},this.$overwrite=!1,this.setOverwrite=function(e){this.setOption("overwrite",e)},this.getOverwrite=function(){return this.$overwrite},this.toggleOverwrite=function(){this.setOverwrite(!this.$overwrite)},this.addGutterDecoration=function(e,t){this.$decorations[e]||(this.$decorations[e]=""),this.$decorations[e]+=" "+t,this._signal("changeBreakpoint",{})},this.removeGutterDecoration=function(e,t){this.$decorations[e]=(this.$decorations[e]||"").replace(" "+t,""),this._signal("changeBreakpoint",{})},this.getBreakpoints=function(){return this.$breakpoints},this.setBreakpoints=function(e){this.$breakpoints=[];for(var t=0;t0&&(r=!!n.charAt(t-1).match(this.tokenRe)),r||(r=!!n.charAt(t).match(this.tokenRe));if(r)var i=this.tokenRe;else if(/^\s+$/.test(n.slice(t-1,t+1)))var i=/\s/;else var i=this.nonTokenRe;var s=t;if(s>0){do s--;while(s>=0&&n.charAt(s).match(i));s++}var o=t;while(oe&&(e=t.screenWidth)}),this.lineWidgetWidth=e},this.$computeWidth=function(e){if(this.$modified||e){this.$modified=!1;if(this.$useWrapMode)return this.screenWidth=this.$wrapLimit;var t=this.doc.getAllLines(),n=this.$rowLengthCache,r=0,i=0,s=this.$foldData[i],o=s?s.start.row:Infinity,u=t.length;for(var a=0;ao){a=s.end.row+1;if(a>=u)break;s=this.$foldData[i++],o=s?s.start.row:Infinity}n[a]==null&&(n[a]=this.$getStringScreenWidth(t[a])[0]),n[a]>r&&(r=n[a])}this.screenWidth=r}},this.getLine=function(e){return this.doc.getLine(e)},this.getLines=function(e,t){return this.doc.getLines(e,t)},this.getLength=function(){return this.doc.getLength()},this.getTextRange=function(e){return this.doc.getTextRange(e||this.selection.getRange())},this.insert=function(e,t){return this.doc.insert(e,t)},this.remove=function(e){return this.doc.remove(e)},this.removeFullLines=function(e,t){return this.doc.removeFullLines(e,t)},this.undoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;for(var n=e.length-1;n!=-1;n--){var r=e[n];r.action=="insert"||r.action=="remove"?this.doc.revertDelta(r):r.folds&&this.addFolds(r.folds)}!t&&this.$undoSelect&&(e.selectionBefore?this.selection.fromJSON(e.selectionBefore):this.selection.setRange(this.$getUndoSelection(e,!0))),this.$fromUndo=!1},this.redoChanges=function(e,t){if(!e.length)return;this.$fromUndo=!0;for(var n=0;ne.end.column&&(s.start.column+=u),s.end.row==e.end.row&&s.end.column>e.end.column&&(s.end.column+=u)),o&&s.start.row>=e.end.row&&(s.start.row+=o,s.end.row+=o)}s.end=this.insert(s.start,r);if(i.length){var a=e.start,f=s.start,o=f.row-a.row,u=f.column-a.column;this.addFolds(i.map(function(e){return e=e.clone(),e.start.row==a.row&&(e.start.column+=u),e.end.row==a.row&&(e.end.column+=u),e.start.row+=o,e.end.row+=o,e}))}return s},this.indentRows=function(e,t,n){n=n.replace(/\t/g,this.getTabString());for(var r=e;r<=t;r++)this.doc.insertInLine({row:r,column:0},n)},this.outdentRows=function(e){var t=e.collapseRows(),n=new l(0,0,0,0),r=this.getTabSize();for(var i=t.start.row;i<=t.end.row;++i){var s=this.getLine(i);n.start.row=i,n.end.row=i;for(var o=0;o0){var r=this.getRowFoldEnd(t+n);if(r>this.doc.getLength()-1)return 0;var i=r-t}else{e=this.$clipRowToDocument(e),t=this.$clipRowToDocument(t);var i=t-e+1}var s=new l(e,0,t,Number.MAX_VALUE),o=this.getFoldsInRange(s).map(function(e){return e=e.clone(),e.start.row+=i,e.end.row+=i,e}),u=n==0?this.doc.getLines(e,t):this.doc.removeFullLines(e,t);return this.doc.insertFullLines(e+i,u),o.length&&this.addFolds(o),i},this.moveLinesUp=function(e,t){return this.$moveLines(e,t,-1)},this.moveLinesDown=function(e,t){return this.$moveLines(e,t,1)},this.duplicateLines=function(e,t){return this.$moveLines(e,t,0)},this.$clipRowToDocument=function(e){return Math.max(0,Math.min(e,this.doc.getLength()-1))},this.$clipColumnToRow=function(e,t){return t<0?0:Math.min(this.doc.getLine(e).length,t)},this.$clipPositionToDocument=function(e,t){t=Math.max(0,t);if(e<0)e=0,t=0;else{var n=this.doc.getLength();e>=n?(e=n-1,t=this.doc.getLine(n-1).length):t=Math.min(this.doc.getLine(e).length,t)}return{row:e,column:t}},this.$clipRangeToDocument=function(e){e.start.row<0?(e.start.row=0,e.start.column=0):e.start.column=this.$clipColumnToRow(e.start.row,e.start.column);var t=this.doc.getLength()-1;return e.end.row>t?(e.end.row=t,e.end.column=this.doc.getLine(t).length):e.end.column=this.$clipColumnToRow(e.end.row,e.end.column),e},this.$wrapLimit=80,this.$useWrapMode=!1,this.$wrapLimitRange={min:null,max:null},this.setUseWrapMode=function(e){if(e!=this.$useWrapMode){this.$useWrapMode=e,this.$modified=!0,this.$resetRowCache(0);if(e){var t=this.getLength();this.$wrapData=Array(t),this.$updateWrapData(0,t-1)}this._signal("changeWrapMode")}},this.getUseWrapMode=function(){return this.$useWrapMode},this.setWrapLimitRange=function(e,t){if(this.$wrapLimitRange.min!==e||this.$wrapLimitRange.max!==t)this.$wrapLimitRange={min:e,max:t},this.$modified=!0,this.$bidiHandler.markAsDirty(),this.$useWrapMode&&this._signal("changeWrapMode")},this.adjustWrapLimit=function(e,t){var n=this.$wrapLimitRange;n.max<0&&(n={min:t,max:t});var r=this.$constrainWrapLimit(e,n.min,n.max);return r!=this.$wrapLimit&&r>1?(this.$wrapLimit=r,this.$modified=!0,this.$useWrapMode&&(this.$updateWrapData(0,this.getLength()-1),this.$resetRowCache(0),this._signal("changeWrapLimit")),!0):!1},this.$constrainWrapLimit=function(e,t,n){return t&&(e=Math.max(t,e)),n&&(e=Math.min(n,e)),e},this.getWrapLimit=function(){return this.$wrapLimit},this.setWrapLimit=function(e){this.setWrapLimitRange(e,e)},this.getWrapLimitRange=function(){return{min:this.$wrapLimitRange.min,max:this.$wrapLimitRange.max}},this.$updateInternalDataOnChange=function(e){var t=this.$useWrapMode,n=e.action,r=e.start,i=e.end,s=r.row,o=i.row,u=o-s,a=null;this.$updating=!0;if(u!=0)if(n==="remove"){this[t?"$wrapData":"$rowLengthCache"].splice(s,u);var f=this.$foldData;a=this.getFoldsInRange(e),this.removeFolds(a);var l=this.getFoldLine(i.row),c=0;if(l){l.addRemoveChars(i.row,i.column,r.column-i.column),l.shiftRow(-u);var h=this.getFoldLine(s);h&&h!==l&&(h.merge(l),l=h),c=f.indexOf(l)+1}for(c;c=i.row&&l.shiftRow(-u)}o=s}else{var p=Array(u);p.unshift(s,0);var d=t?this.$wrapData:this.$rowLengthCache;d.splice.apply(d,p);var f=this.$foldData,l=this.getFoldLine(s),c=0;if(l){var v=l.range.compareInside(r.row,r.column);v==0?(l=l.split(r.row,r.column),l&&(l.shiftRow(u),l.addRemoveChars(o,0,i.column-r.column))):v==-1&&(l.addRemoveChars(s,0,i.column-r.column),l.shiftRow(u)),c=f.indexOf(l)+1}for(c;c=s&&l.shiftRow(u)}}else{u=Math.abs(e.start.column-e.end.column),n==="remove"&&(a=this.getFoldsInRange(e),this.removeFolds(a),u=-u);var l=this.getFoldLine(s);l&&l.addRemoveChars(s,r.column,u)}return t&&this.$wrapData.length!=this.doc.getLength()&&console.error("doc.getLength() and $wrapData.length have to be the same!"),this.$updating=!1,t?this.$updateWrapData(s,o):this.$updateRowLengthCache(s,o),a},this.$updateRowLengthCache=function(e,t,n){this.$rowLengthCache[e]=null,this.$rowLengthCache[t]=null},this.$updateWrapData=function(e,t){var r=this.doc.getAllLines(),i=this.getTabSize(),o=this.$wrapData,u=this.$wrapLimit,a,f,l=e;t=Math.min(t,r.length-1);while(l<=t)f=this.getFoldLine(l,f),f?(a=[],f.walk(function(e,t,i,o){var u;if(e!=null){u=this.$getDisplayTokens(e,a.length),u[0]=n;for(var f=1;fr-b){var w=f+r-b;if(e[w-1]>=c&&e[w]>=c){y(w);continue}if(e[w]==n||e[w]==s){for(w;w!=f-1;w--)if(e[w]==n)break;if(w>f){y(w);continue}w=f+r;for(w;w>2)),f-1);while(w>E&&e[w]E&&e[w]E&&e[w]==a)w--}else while(w>E&&e[w]E){y(++w);continue}w=f+r,e[w]==t&&w--,y(w-b)}return o},this.$getDisplayTokens=function(n,r){var i=[],s;r=r||0;for(var o=0;o39&&u<48||u>57&&u<64?i.push(a):u>=4352&&m(u)?i.push(e,t):i.push(e)}return i},this.$getStringScreenWidth=function(e,t,n){if(t==0)return[0,0];t==null&&(t=Infinity),n=n||0;var r,i;for(i=0;i=4352&&m(r)?n+=2:n+=1;if(n>t)break}return[n,i]},this.lineWidgets=null,this.getRowLength=function(e){var t=1;return this.lineWidgets&&(t+=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0),!this.$useWrapMode||!this.$wrapData[e]?t:this.$wrapData[e].length+t},this.getRowLineCount=function(e){return!this.$useWrapMode||!this.$wrapData[e]?1:this.$wrapData[e].length+1},this.getRowWrapIndent=function(e){if(this.$useWrapMode){var t=this.screenToDocumentPosition(e,Number.MAX_VALUE),n=this.$wrapData[t.row];return n.length&&n[0]=0)var u=f[l],i=this.$docRowCache[l],h=e>f[c-1];else var h=!c;var p=this.getLength()-1,d=this.getNextFoldLine(i),v=d?d.start.row:Infinity;while(u<=e){a=this.getRowLength(i);if(u+a>e||i>=p)break;u+=a,i++,i>v&&(i=d.end.row+1,d=this.getNextFoldLine(i,d),v=d?d.start.row:Infinity),h&&(this.$docRowCache.push(i),this.$screenRowCache.push(u))}if(d&&d.start.row<=i)r=this.getFoldDisplayLine(d),i=d.start.row;else{if(u+a<=e||i>p)return{row:p,column:this.getLine(p).length};r=this.getLine(i),d=null}var m=0,g=Math.floor(e-u);if(this.$useWrapMode){var y=this.$wrapData[i];y&&(o=y[g],g>0&&y.length&&(m=y.indent,s=y[g-1]||y[y.length-1],r=r.substring(s)))}return n!==undefined&&this.$bidiHandler.isBidiRow(u+g,i,g)&&(t=this.$bidiHandler.offsetToCol(n)),s+=this.$getStringScreenWidth(r,t-m)[1],this.$useWrapMode&&s>=o&&(s=o-1),d?d.idxToPosition(s):{row:i,column:s}},this.documentToScreenPosition=function(e,t){if(typeof t=="undefined")var n=this.$clipPositionToDocument(e.row,e.column);else n=this.$clipPositionToDocument(e,t);e=n.row,t=n.column;var r=0,i=null,s=null;s=this.getFoldAt(e,t,1),s&&(e=s.start.row,t=s.start.column);var o,u=0,a=this.$docRowCache,f=this.$getRowCacheIndex(a,e),l=a.length;if(l&&f>=0)var u=a[f],r=this.$screenRowCache[f],c=e>a[l-1];else var c=!l;var h=this.getNextFoldLine(u),p=h?h.start.row:Infinity;while(u=p){o=h.end.row+1;if(o>e)break;h=this.getNextFoldLine(o,h),p=h?h.start.row:Infinity}else o=u+1;r+=this.getRowLength(u),u=o,c&&(this.$docRowCache.push(u),this.$screenRowCache.push(r))}var d="";h&&u>=p?(d=this.getFoldDisplayLine(h,e,t),i=h.start.row):(d=this.getLine(e).substring(0,t),i=e);var v=0;if(this.$useWrapMode){var m=this.$wrapData[i];if(m){var g=0;while(d.length>=m[g])r++,g++;d=d.substring(m[g-1]||0,d.length),v=g>0?m.indent:0}}return this.lineWidgets&&this.lineWidgets[u]&&this.lineWidgets[u].rowsAbove&&(r+=this.lineWidgets[u].rowsAbove),{row:r,column:v+this.$getStringScreenWidth(d)[0]}},this.documentToScreenColumn=function(e,t){return this.documentToScreenPosition(e,t).column},this.documentToScreenRow=function(e,t){return this.documentToScreenPosition(e,t).row},this.getScreenLength=function(){var e=0,t=null;if(!this.$useWrapMode){e=this.getLength();var n=this.$foldData;for(var r=0;ro&&(s=t.end.row+1,t=this.$foldData[r++],o=t?t.start.row:Infinity)}}return this.lineWidgets&&(e+=this.$getWidgetScreenLength()),e},this.$setFontMetrics=function(e){if(!this.$enableVarChar)return;this.$getStringScreenWidth=function(t,n,r){if(n===0)return[0,0];n||(n=Infinity),r=r||0;var i,s;for(s=0;sn)break}return[r,s]}},this.destroy=function(){this.bgTokenizer&&(this.bgTokenizer.setDocument(null),this.bgTokenizer=null),this.$stopWorker(),this.removeAllListeners(),this.selection.detach()},this.isFullWidth=m}.call(d.prototype),e("./edit_session/folding").Folding.call(d.prototype),e("./edit_session/bracket_match").BracketMatch.call(d.prototype),o.defineOptions(d.prototype,"session",{wrap:{set:function(e){!e||e=="off"?e=!1:e=="free"?e=!0:e=="printMargin"?e=-1:typeof e=="string"&&(e=parseInt(e,10)||!1);if(this.$wrap==e)return;this.$wrap=e;if(!e)this.setUseWrapMode(!1);else{var t=typeof e=="number"?e:null;this.setWrapLimitRange(t,t),this.setUseWrapMode(!0)}},get:function(){return this.getUseWrapMode()?this.$wrap==-1?"printMargin":this.getWrapLimitRange().min?this.$wrap:"free":"off"},handlesSet:!0},wrapMethod:{set:function(e){e=e=="auto"?this.$mode.type!="text":e!="text",e!=this.$wrapAsCode&&(this.$wrapAsCode=e,this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0)))},initialValue:"auto"},indentedSoftWrap:{set:function(){this.$useWrapMode&&(this.$useWrapMode=!1,this.setUseWrapMode(!0))},initialValue:!0},firstLineNumber:{set:function(){this._signal("changeBreakpoint")},initialValue:1},useWorker:{set:function(e){this.$useWorker=e,this.$stopWorker(),e&&this.$startWorker()},initialValue:!0},useSoftTabs:{initialValue:!0},tabSize:{set:function(e){e=parseInt(e),e>0&&this.$tabSize!==e&&(this.$modified=!0,this.$rowLengthCache=[],this.$tabSize=e,this._signal("changeTabSize"))},initialValue:4,handlesSet:!0},navigateWithinSoftTabs:{initialValue:!1},foldStyle:{set:function(e){this.setFoldStyle(e)},handlesSet:!0},overwrite:{set:function(e){this._signal("changeOverwrite")},initialValue:!1},newLineMode:{set:function(e){this.doc.setNewLineMode(e)},get:function(){return this.doc.getNewLineMode()},handlesSet:!0},mode:{set:function(e){this.setMode(e)},get:function(){return this.$modeId},handlesSet:!0}}),t.EditSession=d}),define("ace/search",["require","exports","module","ace/lib/lang","ace/lib/oop","ace/range"],function(e,t,n){"use strict";function u(e,t){function n(e){return/\w/.test(e)||t.regExp?"\\b":""}return n(e[0])+e+n(e[e.length-1])}var r=e("./lib/lang"),i=e("./lib/oop"),s=e("./range").Range,o=function(){this.$options={}};(function(){this.set=function(e){return i.mixin(this.$options,e),this},this.getOptions=function(){return r.copyObject(this.$options)},this.setOptions=function(e){this.$options=e},this.find=function(e){var t=this.$options,n=this.$matchIterator(e,t);if(!n)return!1;var r=null;return n.forEach(function(e,n,i,o){return r=new s(e,n,i,o),n==o&&t.start&&t.start.start&&t.skipCurrent!=0&&r.isEqual(t.start)?(r=null,!1):!0}),r},this.findAll=function(e){var t=this.$options;if(!t.needle)return[];this.$assembleRegExp(t);var n=t.range,i=n?e.getLines(n.start.row,n.end.row):e.doc.getAllLines(),o=[],u=t.re;if(t.$isMultiLine){var a=u.length,f=i.length-a,l;e:for(var c=u.offset||0;c<=f;c++){for(var h=0;hv)continue;o.push(l=new s(c,v,c+a-1,m)),a>2&&(c=c+a-2)}}else for(var g=0;gE&&o[h].end.row==n.end.row)h--;o=o.slice(g,h+1);for(g=0,h=o.length;g=u;n--)if(c(n,Number.MAX_VALUE,e))return;if(t.wrap==0)return;for(n=a,u=o.row;n>=u;n--)if(c(n,Number.MAX_VALUE,e))return};else var f=function(e){var n=o.row;if(c(n,o.column,e))return;for(n+=1;n<=a;n++)if(c(n,0,e))return;if(t.wrap==0)return;for(n=u,a=o.row;n<=a;n++)if(c(n,0,e))return};if(t.$isMultiLine)var l=n.length,c=function(t,i,s){var o=r?t-l+1:t;if(o<0)return;var u=e.getLine(o),a=u.search(n[0]);if(!r&&ai)return;if(s(o,a,o+l-1,c))return!0};else if(r)var c=function(t,r,i){var s=e.getLine(t),o=[],u,a=0;n.lastIndex=0;while(u=n.exec(s)){var f=u[0].length;a=u.index;if(!f){if(a>=s.length)break;n.lastIndex=a+=1}if(u.index+f>r)break;o.push(u.index,f)}for(var l=o.length-1;l>=0;l-=2){var c=o[l-1],f=o[l];if(i(t,c,t,c+f))return!0}};else var c=function(t,r,i){var s=e.getLine(t),o,u;n.lastIndex=r;while(u=n.exec(s)){var a=u[0].length;o=u.index;if(i(t,o,t,o+a))return!0;if(!a){n.lastIndex=o+=1;if(o>=s.length)return!1}}};return{forEach:f}}}).call(o.prototype),t.Search=o}),define("ace/keyboard/hash_handler",["require","exports","module","ace/lib/keys","ace/lib/useragent"],function(e,t,n){"use strict";function o(e,t){this.platform=t||(i.isMac?"mac":"win"),this.commands={},this.commandKeyBinding={},this.addCommands(e),this.$singleCommand=!0}function u(e,t){o.call(this,e,t),this.$singleCommand=!1}var r=e("../lib/keys"),i=e("../lib/useragent"),s=r.KEY_MODS;u.prototype=o.prototype,function(){function e(e){return typeof e=="object"&&e.bindKey&&e.bindKey.position||(e.isDefault?-100:0)}this.addCommand=function(e){this.commands[e.name]&&this.removeCommand(e),this.commands[e.name]=e,e.bindKey&&this._buildKeyHash(e)},this.removeCommand=function(e,t){var n=e&&(typeof e=="string"?e:e.name);e=this.commands[n],t||delete this.commands[n];var r=this.commandKeyBinding;for(var i in r){var s=r[i];if(s==e)delete r[i];else if(Array.isArray(s)){var o=s.indexOf(e);o!=-1&&(s.splice(o,1),s.length==1&&(r[i]=s[0]))}}},this.bindKey=function(e,t,n){typeof e=="object"&&e&&(n==undefined&&(n=e.position),e=e[this.platform]);if(!e)return;if(typeof t=="function")return this.addCommand({exec:t,bindKey:e,name:t.name||e});e.split("|").forEach(function(e){var r="";if(e.indexOf(" ")!=-1){var i=e.split(/\s+/);e=i.pop(),i.forEach(function(e){var t=this.parseKeys(e),n=s[t.hashId]+t.key;r+=(r?" ":"")+n,this._addCommandToBinding(r,"chainKeys")},this),r+=" "}var o=this.parseKeys(e),u=s[o.hashId]+o.key;this._addCommandToBinding(r+u,t,n)},this)},this._addCommandToBinding=function(t,n,r){var i=this.commandKeyBinding,s;if(!n)delete i[t];else if(!i[t]||this.$singleCommand)i[t]=n;else{Array.isArray(i[t])?(s=i[t].indexOf(n))!=-1&&i[t].splice(s,1):i[t]=[i[t]],typeof r!="number"&&(r=e(n));var o=i[t];for(s=0;sr)break}o.splice(s,0,n)}},this.addCommands=function(e){e&&Object.keys(e).forEach(function(t){var n=e[t];if(!n)return;if(typeof n=="string")return this.bindKey(n,t);typeof n=="function"&&(n={exec:n});if(typeof n!="object")return;n.name||(n.name=t),this.addCommand(n)},this)},this.removeCommands=function(e){Object.keys(e).forEach(function(t){this.removeCommand(e[t])},this)},this.bindKeys=function(e){Object.keys(e).forEach(function(t){this.bindKey(t,e[t])},this)},this._buildKeyHash=function(e){this.bindKey(e.bindKey,e)},this.parseKeys=function(e){var t=e.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(e){return e}),n=t.pop(),i=r[n];if(r.FUNCTION_KEYS[i])n=r.FUNCTION_KEYS[i].toLowerCase();else{if(!t.length)return{key:n,hashId:-1};if(t.length==1&&t[0]=="shift")return{key:n.toUpperCase(),hashId:-1}}var s=0;for(var o=t.length;o--;){var u=r.KEY_MODS[t[o]];if(u==null)return typeof console!="undefined"&&console.error("invalid modifier "+t[o]+" in "+e),!1;s|=u}return{key:n,hashId:s}},this.findKeyCommand=function(t,n){var r=s[t]+n;return this.commandKeyBinding[r]},this.handleKeyboard=function(e,t,n,r){if(r<0)return;var i=s[t]+n,o=this.commandKeyBinding[i];e.$keyChain&&(e.$keyChain+=" "+i,o=this.commandKeyBinding[e.$keyChain]||o);if(o)if(o=="chainKeys"||o[o.length-1]=="chainKeys")return e.$keyChain=e.$keyChain||i,{command:"null"};if(e.$keyChain)if(!!t&&t!=4||n.length!=1){if(t==-1||r>0)e.$keyChain=""}else e.$keyChain=e.$keyChain.slice(0,-i.length-1);return{command:o}},this.getStatusText=function(e,t){return t.$keyChain||""}}.call(o.prototype),t.HashHandler=o,t.MultiHashHandler=u}),define("ace/commands/command_manager",["require","exports","module","ace/lib/oop","ace/keyboard/hash_handler","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../keyboard/hash_handler").MultiHashHandler,s=e("../lib/event_emitter").EventEmitter,o=function(e,t){i.call(this,t,e),this.byName=this.commands,this.setDefaultHandler("exec",function(e){return e.command.exec(e.editor,e.args||{})})};r.inherits(o,i),function(){r.implement(this,s),this.exec=function(e,t,n){if(Array.isArray(e)){for(var r=e.length;r--;)if(this.exec(e[r],t,n))return!0;return!1}typeof e=="string"&&(e=this.commands[e]);if(!e)return!1;if(t&&t.$readOnly&&!e.readOnly)return!1;if(this.$checkCommandState!=0&&e.isAvailable&&!e.isAvailable(t))return!1;var i={editor:t,command:e,args:n};return i.returnValue=this._emit("exec",i),this._signal("afterExec",i),i.returnValue===!1?!1:!0},this.toggleRecording=function(e){if(this.$inReplay)return;return e&&e._emit("changeStatus"),this.recording?(this.macro.pop(),this.off("exec",this.$addCommandToMacro),this.macro.length||(this.macro=this.oldMacro),this.recording=!1):(this.$addCommandToMacro||(this.$addCommandToMacro=function(e){this.macro.push([e.command,e.args])}.bind(this)),this.oldMacro=this.macro,this.macro=[],this.on("exec",this.$addCommandToMacro),this.recording=!0)},this.replay=function(e){if(this.$inReplay||!this.macro)return;if(this.recording)return this.toggleRecording(e);try{this.$inReplay=!0,this.macro.forEach(function(t){typeof t=="string"?this.exec(t,e):this.exec(t[0],e,t[1])},this)}finally{this.$inReplay=!1}},this.trimMacro=function(e){return e.map(function(e){return typeof e[0]!="string"&&(e[0]=e[0].name),e[1]||(e=e[0]),e})}}.call(o.prototype),t.CommandManager=o}),define("ace/commands/default_commands",["require","exports","module","ace/lib/lang","ace/config","ace/range"],function(e,t,n){"use strict";function o(e,t){return{win:e,mac:t}}var r=e("../lib/lang"),i=e("../config"),s=e("../range").Range;t.commands=[{name:"showSettingsMenu",bindKey:o("Ctrl-,","Command-,"),exec:function(e){i.loadModule("ace/ext/settings_menu",function(t){t.init(e),e.showSettingsMenu()})},readOnly:!0},{name:"goToNextError",bindKey:o("Alt-E","F4"),exec:function(e){i.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,1)})},scrollIntoView:"animate",readOnly:!0},{name:"goToPreviousError",bindKey:o("Alt-Shift-E","Shift-F4"),exec:function(e){i.loadModule("./ext/error_marker",function(t){t.showErrorMarker(e,-1)})},scrollIntoView:"animate",readOnly:!0},{name:"selectall",description:"Select all",bindKey:o("Ctrl-A","Command-A"),exec:function(e){e.selectAll()},readOnly:!0},{name:"centerselection",description:"Center selection",bindKey:o(null,"Ctrl-L"),exec:function(e){e.centerSelection()},readOnly:!0},{name:"gotoline",description:"Go to line...",bindKey:o("Ctrl-L","Command-L"),exec:function(e,t){typeof t=="number"&&!isNaN(t)&&e.gotoLine(t),e.prompt({$type:"gotoLine"})},readOnly:!0},{name:"fold",bindKey:o("Alt-L|Ctrl-F1","Command-Alt-L|Command-F1"),exec:function(e){e.session.toggleFold(!1)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"unfold",bindKey:o("Alt-Shift-L|Ctrl-Shift-F1","Command-Alt-Shift-L|Command-Shift-F1"),exec:function(e){e.session.toggleFold(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleFoldWidget",bindKey:o("F2","F2"),exec:function(e){e.session.toggleFoldWidget()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"toggleParentFoldWidget",bindKey:o("Alt-F2","Alt-F2"),exec:function(e){e.session.toggleFoldWidget(!0)},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"foldall",description:"Fold all",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAll()},scrollIntoView:"center",readOnly:!0},{name:"foldAllComments",description:"Fold all comments",bindKey:o(null,"Ctrl-Command-Option-0"),exec:function(e){e.session.foldAllComments()},scrollIntoView:"center",readOnly:!0},{name:"foldOther",description:"Fold other",bindKey:o("Alt-0","Command-Option-0"),exec:function(e){e.session.foldAll(),e.session.unfold(e.selection.getAllRanges())},scrollIntoView:"center",readOnly:!0},{name:"unfoldall",description:"Unfold all",bindKey:o("Alt-Shift-0","Command-Option-Shift-0"),exec:function(e){e.session.unfold()},scrollIntoView:"center",readOnly:!0},{name:"findnext",description:"Find next",bindKey:o("Ctrl-K","Command-G"),exec:function(e){e.findNext()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"findprevious",description:"Find previous",bindKey:o("Ctrl-Shift-K","Command-Shift-G"),exec:function(e){e.findPrevious()},multiSelectAction:"forEach",scrollIntoView:"center",readOnly:!0},{name:"selectOrFindNext",description:"Select or find next",bindKey:o("Alt-K","Ctrl-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findNext()},readOnly:!0},{name:"selectOrFindPrevious",description:"Select or find previous",bindKey:o("Alt-Shift-K","Ctrl-Shift-G"),exec:function(e){e.selection.isEmpty()?e.selection.selectWord():e.findPrevious()},readOnly:!0},{name:"find",description:"Find",bindKey:o("Ctrl-F","Command-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e)})},readOnly:!0},{name:"overwrite",description:"Overwrite",bindKey:"Insert",exec:function(e){e.toggleOverwrite()},readOnly:!0},{name:"selecttostart",description:"Select to start",bindKey:o("Ctrl-Shift-Home","Command-Shift-Home|Command-Shift-Up"),exec:function(e){e.getSelection().selectFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotostart",description:"Go to start",bindKey:o("Ctrl-Home","Command-Home|Command-Up"),exec:function(e){e.navigateFileStart()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectup",description:"Select up",bindKey:o("Shift-Up","Shift-Up|Ctrl-Shift-P"),exec:function(e){e.getSelection().selectUp()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golineup",description:"Go line up",bindKey:o("Up","Up|Ctrl-P"),exec:function(e,t){e.navigateUp(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttoend",description:"Select to end",bindKey:o("Ctrl-Shift-End","Command-Shift-End|Command-Shift-Down"),exec:function(e){e.getSelection().selectFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"gotoend",description:"Go to end",bindKey:o("Ctrl-End","Command-End|Command-Down"),exec:function(e){e.navigateFileEnd()},multiSelectAction:"forEach",readOnly:!0,scrollIntoView:"animate",aceCommandGroup:"fileJump"},{name:"selectdown",description:"Select down",bindKey:o("Shift-Down","Shift-Down|Ctrl-Shift-N"),exec:function(e){e.getSelection().selectDown()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"golinedown",description:"Go line down",bindKey:o("Down","Down|Ctrl-N"),exec:function(e,t){e.navigateDown(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordleft",description:"Select word left",bindKey:o("Ctrl-Shift-Left","Option-Shift-Left"),exec:function(e){e.getSelection().selectWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordleft",description:"Go to word left",bindKey:o("Ctrl-Left","Option-Left"),exec:function(e){e.navigateWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolinestart",description:"Select to line start",bindKey:o("Alt-Shift-Left","Command-Shift-Left|Ctrl-Shift-A"),exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolinestart",description:"Go to line start",bindKey:o("Alt-Left|Home","Command-Left|Home|Ctrl-A"),exec:function(e){e.navigateLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectleft",description:"Select left",bindKey:o("Shift-Left","Shift-Left|Ctrl-Shift-B"),exec:function(e){e.getSelection().selectLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoleft",description:"Go to left",bindKey:o("Left","Left|Ctrl-B"),exec:function(e,t){e.navigateLeft(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectwordright",description:"Select word right",bindKey:o("Ctrl-Shift-Right","Option-Shift-Right"),exec:function(e){e.getSelection().selectWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotowordright",description:"Go to word right",bindKey:o("Ctrl-Right","Option-Right"),exec:function(e){e.navigateWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selecttolineend",description:"Select to line end",bindKey:o("Alt-Shift-Right","Command-Shift-Right|Shift-End|Ctrl-Shift-E"),exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotolineend",description:"Go to line end",bindKey:o("Alt-Right|End","Command-Right|End|Ctrl-E"),exec:function(e){e.navigateLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectright",description:"Select right",bindKey:o("Shift-Right","Shift-Right"),exec:function(e){e.getSelection().selectRight()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"gotoright",description:"Go to right",bindKey:o("Right","Right|Ctrl-F"),exec:function(e,t){e.navigateRight(t.times)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectpagedown",description:"Select page down",bindKey:"Shift-PageDown",exec:function(e){e.selectPageDown()},readOnly:!0},{name:"pagedown",description:"Page down",bindKey:o(null,"Option-PageDown"),exec:function(e){e.scrollPageDown()},readOnly:!0},{name:"gotopagedown",description:"Go to page down",bindKey:o("PageDown","PageDown|Ctrl-V"),exec:function(e){e.gotoPageDown()},readOnly:!0},{name:"selectpageup",description:"Select page up",bindKey:"Shift-PageUp",exec:function(e){e.selectPageUp()},readOnly:!0},{name:"pageup",description:"Page up",bindKey:o(null,"Option-PageUp"),exec:function(e){e.scrollPageUp()},readOnly:!0},{name:"gotopageup",description:"Go to page up",bindKey:"PageUp",exec:function(e){e.gotoPageUp()},readOnly:!0},{name:"scrollup",description:"Scroll up",bindKey:o("Ctrl-Up",null),exec:function(e){e.renderer.scrollBy(0,-2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"scrolldown",description:"Scroll down",bindKey:o("Ctrl-Down",null),exec:function(e){e.renderer.scrollBy(0,2*e.renderer.layerConfig.lineHeight)},readOnly:!0},{name:"selectlinestart",description:"Select line start",bindKey:"Shift-Home",exec:function(e){e.getSelection().selectLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"selectlineend",description:"Select line end",bindKey:"Shift-End",exec:function(e){e.getSelection().selectLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"togglerecording",description:"Toggle recording",bindKey:o("Ctrl-Alt-E","Command-Option-E"),exec:function(e){e.commands.toggleRecording(e)},readOnly:!0},{name:"replaymacro",description:"Replay macro",bindKey:o("Ctrl-Shift-E","Command-Shift-E"),exec:function(e){e.commands.replay(e)},readOnly:!0},{name:"jumptomatching",description:"Jump to matching",bindKey:o("Ctrl-\\|Ctrl-P","Command-\\"),exec:function(e){e.jumpToMatching()},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"selecttomatching",description:"Select to matching",bindKey:o("Ctrl-Shift-\\|Ctrl-Shift-P","Command-Shift-\\"),exec:function(e){e.jumpToMatching(!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"expandToMatching",description:"Expand to matching",bindKey:o("Ctrl-Shift-M","Ctrl-Shift-M"),exec:function(e){e.jumpToMatching(!0,!0)},multiSelectAction:"forEach",scrollIntoView:"animate",readOnly:!0},{name:"passKeysToBrowser",description:"Pass keys to browser",bindKey:o(null,null),exec:function(){},passEvent:!0,readOnly:!0},{name:"copy",description:"Copy",exec:function(e){},readOnly:!0},{name:"cut",description:"Cut",exec:function(e){var t=e.$copyWithEmptySelection&&e.selection.isEmpty(),n=t?e.selection.getLineRange():e.selection.getRange();e._emit("cut",n),n.isEmpty()||e.session.remove(n),e.clearSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"paste",description:"Paste",exec:function(e,t){e.$handlePaste(t)},scrollIntoView:"cursor"},{name:"removeline",description:"Remove line",bindKey:o("Ctrl-D","Command-D"),exec:function(e){e.removeLines()},scrollIntoView:"cursor",multiSelectAction:"forEachLine"},{name:"duplicateSelection",description:"Duplicate selection",bindKey:o("Ctrl-Shift-D","Command-Shift-D"),exec:function(e){e.duplicateSelection()},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"sortlines",description:"Sort lines",bindKey:o("Ctrl-Alt-S","Command-Alt-S"),exec:function(e){e.sortLines()},scrollIntoView:"selection",multiSelectAction:"forEachLine"},{name:"togglecomment",description:"Toggle comment",bindKey:o("Ctrl-/","Command-/"),exec:function(e){e.toggleCommentLines()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"toggleBlockComment",description:"Toggle block comment",bindKey:o("Ctrl-Shift-/","Command-Shift-/"),exec:function(e){e.toggleBlockComment()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"modifyNumberUp",description:"Modify number up",bindKey:o("Ctrl-Shift-Up","Alt-Shift-Up"),exec:function(e){e.modifyNumber(1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"modifyNumberDown",description:"Modify number down",bindKey:o("Ctrl-Shift-Down","Alt-Shift-Down"),exec:function(e){e.modifyNumber(-1)},scrollIntoView:"cursor",multiSelectAction:"forEach"},{name:"replace",description:"Replace",bindKey:o("Ctrl-H","Command-Option-F"),exec:function(e){i.loadModule("ace/ext/searchbox",function(t){t.Search(e,!0)})}},{name:"undo",description:"Undo",bindKey:o("Ctrl-Z","Command-Z"),exec:function(e){e.undo()}},{name:"redo",description:"Redo",bindKey:o("Ctrl-Shift-Z|Ctrl-Y","Command-Shift-Z|Command-Y"),exec:function(e){e.redo()}},{name:"copylinesup",description:"Copy lines up",bindKey:o("Alt-Shift-Up","Command-Option-Up"),exec:function(e){e.copyLinesUp()},scrollIntoView:"cursor"},{name:"movelinesup",description:"Move lines up",bindKey:o("Alt-Up","Option-Up"),exec:function(e){e.moveLinesUp()},scrollIntoView:"cursor"},{name:"copylinesdown",description:"Copy lines down",bindKey:o("Alt-Shift-Down","Command-Option-Down"),exec:function(e){e.copyLinesDown()},scrollIntoView:"cursor"},{name:"movelinesdown",description:"Move lines down",bindKey:o("Alt-Down","Option-Down"),exec:function(e){e.moveLinesDown()},scrollIntoView:"cursor"},{name:"del",description:"Delete",bindKey:o("Delete","Delete|Ctrl-D|Shift-Delete"),exec:function(e){e.remove("right")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"backspace",description:"Backspace",bindKey:o("Shift-Backspace|Backspace","Ctrl-Backspace|Shift-Backspace|Backspace|Ctrl-H"),exec:function(e){e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"cut_or_delete",description:"Cut or delete",bindKey:o("Shift-Delete",null),exec:function(e){if(!e.selection.isEmpty())return!1;e.remove("left")},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestart",description:"Remove to line start",bindKey:o("Alt-Backspace","Command-Backspace"),exec:function(e){e.removeToLineStart()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineend",description:"Remove to line end",bindKey:o("Alt-Delete","Ctrl-K|Command-Delete"),exec:function(e){e.removeToLineEnd()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolinestarthard",description:"Remove to line start hard",bindKey:o("Ctrl-Shift-Backspace",null),exec:function(e){var t=e.selection.getRange();t.start.column=0,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removetolineendhard",description:"Remove to line end hard",bindKey:o("Ctrl-Shift-Delete",null),exec:function(e){var t=e.selection.getRange();t.end.column=Number.MAX_VALUE,e.session.remove(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordleft",description:"Remove word left",bindKey:o("Ctrl-Backspace","Alt-Backspace|Ctrl-Alt-Backspace"),exec:function(e){e.removeWordLeft()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"removewordright",description:"Remove word right",bindKey:o("Ctrl-Delete","Alt-Delete"),exec:function(e){e.removeWordRight()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"outdent",description:"Outdent",bindKey:o("Shift-Tab","Shift-Tab"),exec:function(e){e.blockOutdent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"indent",description:"Indent",bindKey:o("Tab","Tab"),exec:function(e){e.indent()},multiSelectAction:"forEach",scrollIntoView:"selectionPart"},{name:"blockoutdent",description:"Block outdent",bindKey:o("Ctrl-[","Ctrl-["),exec:function(e){e.blockOutdent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"blockindent",description:"Block indent",bindKey:o("Ctrl-]","Ctrl-]"),exec:function(e){e.blockIndent()},multiSelectAction:"forEachLine",scrollIntoView:"selectionPart"},{name:"insertstring",description:"Insert string",exec:function(e,t){e.insert(t)},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"inserttext",description:"Insert text",exec:function(e,t){e.insert(r.stringRepeat(t.text||"",t.times||1))},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"splitline",description:"Split line",bindKey:o(null,"Ctrl-O"),exec:function(e){e.splitLine()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"transposeletters",description:"Transpose letters",bindKey:o("Alt-Shift-X","Ctrl-T"),exec:function(e){e.transposeLetters()},multiSelectAction:function(e){e.transposeSelections(1)},scrollIntoView:"cursor"},{name:"touppercase",description:"To uppercase",bindKey:o("Ctrl-U","Ctrl-U"),exec:function(e){e.toUpperCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"tolowercase",description:"To lowercase",bindKey:o("Ctrl-Shift-U","Ctrl-Shift-U"),exec:function(e){e.toLowerCase()},multiSelectAction:"forEach",scrollIntoView:"cursor"},{name:"autoindent",description:"Auto Indent",bindKey:o(null,null),exec:function(e){e.autoIndent()},multiSelectAction:"forEachLine",scrollIntoView:"animate"},{name:"expandtoline",description:"Expand to line",bindKey:o("Ctrl-Shift-L","Command-Shift-L"),exec:function(e){var t=e.selection.getRange();t.start.column=t.end.column=0,t.end.row++,e.selection.setRange(t,!1)},multiSelectAction:"forEach",scrollIntoView:"cursor",readOnly:!0},{name:"joinlines",description:"Join lines",bindKey:o(null,null),exec:function(e){var t=e.selection.isBackwards(),n=t?e.selection.getSelectionLead():e.selection.getSelectionAnchor(),i=t?e.selection.getSelectionAnchor():e.selection.getSelectionLead(),o=e.session.doc.getLine(n.row).length,u=e.session.doc.getTextRange(e.selection.getRange()),a=u.replace(/\n\s*/," ").length,f=e.session.doc.getLine(n.row);for(var l=n.row+1;l<=i.row+1;l++){var c=r.stringTrimLeft(r.stringTrimRight(e.session.doc.getLine(l)));c.length!==0&&(c=" "+c),f+=c}i.row+10?(e.selection.moveCursorTo(n.row,n.column),e.selection.selectTo(n.row,n.column+a)):(o=e.session.doc.getLine(n.row).length>o?o+1:o,e.selection.moveCursorTo(n.row,o))},multiSelectAction:"forEach",readOnly:!0},{name:"invertSelection",description:"Invert selection",bindKey:o(null,null),exec:function(e){var t=e.session.doc.getLength()-1,n=e.session.doc.getLine(t).length,r=e.selection.rangeList.ranges,i=[];r.length<1&&(r=[e.selection.getRange()]);for(var o=0;o=i.lastRow||r.end.row<=i.firstRow)&&this.renderer.scrollSelectionIntoView(this.selection.anchor,this.selection.lead);break;default:}n=="animate"&&this.renderer.animateScrolling(this.curOp.scrollTop)}var s=this.selection.toJSON();this.curOp.selectionAfter=s,this.$lastSel=this.selection.toJSON(),this.session.getUndoManager().addSelection(s),this.prevOp=this.curOp,this.curOp=null}},this.$mergeableCommands=["backspace","del","insertstring"],this.$historyTracker=function(e){if(!this.$mergeUndoDeltas)return;var t=this.prevOp,n=this.$mergeableCommands,r=t.command&&e.command.name==t.command.name;if(e.command.name=="insertstring"){var i=e.args;this.mergeNextCommand===undefined&&(this.mergeNextCommand=!0),r=r&&this.mergeNextCommand&&(!/\s/.test(i)||/\s/.test(t.args)),this.mergeNextCommand=!0}else r=r&&n.indexOf(e.command.name)!==-1;this.$mergeUndoDeltas!="always"&&Date.now()-this.sequenceStartTime>2e3&&(r=!1),r?this.session.mergeUndoDeltas=!0:n.indexOf(e.command.name)!==-1&&(this.sequenceStartTime=Date.now())},this.setKeyboardHandler=function(e,t){if(e&&typeof e=="string"&&e!="ace"){this.$keybindingId=e;var n=this;g.loadModule(["keybinding",e],function(r){n.$keybindingId==e&&n.keyBinding.setKeyboardHandler(r&&r.handler),t&&t()})}else this.$keybindingId=null,this.keyBinding.setKeyboardHandler(e),t&&t()},this.getKeyboardHandler=function(){return this.keyBinding.getKeyboardHandler()},this.setSession=function(e){if(this.session==e)return;this.curOp&&this.endOperation(),this.curOp={};var t=this.session;if(t){this.session.off("change",this.$onDocumentChange),this.session.off("changeMode",this.$onChangeMode),this.session.off("tokenizerUpdate",this.$onTokenizerUpdate),this.session.off("changeTabSize",this.$onChangeTabSize),this.session.off("changeWrapLimit",this.$onChangeWrapLimit),this.session.off("changeWrapMode",this.$onChangeWrapMode),this.session.off("changeFold",this.$onChangeFold),this.session.off("changeFrontMarker",this.$onChangeFrontMarker),this.session.off("changeBackMarker",this.$onChangeBackMarker),this.session.off("changeBreakpoint",this.$onChangeBreakpoint),this.session.off("changeAnnotation",this.$onChangeAnnotation),this.session.off("changeOverwrite",this.$onCursorChange),this.session.off("changeScrollTop",this.$onScrollTopChange),this.session.off("changeScrollLeft",this.$onScrollLeftChange);var n=this.session.getSelection();n.off("changeCursor",this.$onCursorChange),n.off("changeSelection",this.$onSelectionChange)}this.session=e,e?(this.$onDocumentChange=this.onDocumentChange.bind(this),e.on("change",this.$onDocumentChange),this.renderer.setSession(e),this.$onChangeMode=this.onChangeMode.bind(this),e.on("changeMode",this.$onChangeMode),this.$onTokenizerUpdate=this.onTokenizerUpdate.bind(this),e.on("tokenizerUpdate",this.$onTokenizerUpdate),this.$onChangeTabSize=this.renderer.onChangeTabSize.bind(this.renderer),e.on("changeTabSize",this.$onChangeTabSize),this.$onChangeWrapLimit=this.onChangeWrapLimit.bind(this),e.on("changeWrapLimit",this.$onChangeWrapLimit),this.$onChangeWrapMode=this.onChangeWrapMode.bind(this),e.on("changeWrapMode",this.$onChangeWrapMode),this.$onChangeFold=this.onChangeFold.bind(this),e.on("changeFold",this.$onChangeFold),this.$onChangeFrontMarker=this.onChangeFrontMarker.bind(this),this.session.on("changeFrontMarker",this.$onChangeFrontMarker),this.$onChangeBackMarker=this.onChangeBackMarker.bind(this),this.session.on("changeBackMarker",this.$onChangeBackMarker),this.$onChangeBreakpoint=this.onChangeBreakpoint.bind(this),this.session.on("changeBreakpoint",this.$onChangeBreakpoint),this.$onChangeAnnotation=this.onChangeAnnotation.bind(this),this.session.on("changeAnnotation",this.$onChangeAnnotation),this.$onCursorChange=this.onCursorChange.bind(this),this.session.on("changeOverwrite",this.$onCursorChange),this.$onScrollTopChange=this.onScrollTopChange.bind(this),this.session.on("changeScrollTop",this.$onScrollTopChange),this.$onScrollLeftChange=this.onScrollLeftChange.bind(this),this.session.on("changeScrollLeft",this.$onScrollLeftChange),this.selection=e.getSelection(),this.selection.on("changeCursor",this.$onCursorChange),this.$onSelectionChange=this.onSelectionChange.bind(this),this.selection.on("changeSelection",this.$onSelectionChange),this.onChangeMode(),this.onCursorChange(),this.onScrollTopChange(),this.onScrollLeftChange(),this.onSelectionChange(),this.onChangeFrontMarker(),this.onChangeBackMarker(),this.onChangeBreakpoint(),this.onChangeAnnotation(),this.session.getUseWrapMode()&&this.renderer.adjustWrapLimit(),this.renderer.updateFull()):(this.selection=null,this.renderer.setSession(e)),this._signal("changeSession",{session:e,oldSession:t}),this.curOp=null,t&&t._signal("changeEditor",{oldEditor:this}),e&&e._signal("changeEditor",{editor:this}),e&&e.bgTokenizer&&e.bgTokenizer.scheduleStart()},this.getSession=function(){return this.session},this.setValue=function(e,t){return this.session.doc.setValue(e),t?t==1?this.navigateFileEnd():t==-1&&this.navigateFileStart():this.selectAll(),e},this.getValue=function(){return this.session.getValue()},this.getSelection=function(){return this.selection},this.resize=function(e){this.renderer.onResize(e)},this.setTheme=function(e,t){this.renderer.setTheme(e,t)},this.getTheme=function(){return this.renderer.getTheme()},this.setStyle=function(e){this.renderer.setStyle(e)},this.unsetStyle=function(e){this.renderer.unsetStyle(e)},this.getFontSize=function(){return this.getOption("fontSize")||i.computedStyle(this.container).fontSize},this.setFontSize=function(e){this.setOption("fontSize",e)},this.$highlightBrackets=function(){if(this.$highlightPending)return;var e=this;this.$highlightPending=!0,setTimeout(function(){e.$highlightPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;t.$bracketHighlight&&(t.$bracketHighlight.markerIds.forEach(function(e){t.removeMarker(e)}),t.$bracketHighlight=null);var n=t.getMatchingBracketRanges(e.getCursorPosition());!n&&t.$mode.getMatching&&(n=t.$mode.getMatching(e.session));if(!n)return;var r="ace_bracket";Array.isArray(n)?n.length==1&&(r="ace_error_bracket"):n=[n],n.length==2&&(p.comparePoints(n[0].end,n[1].start)==0?n=[p.fromPoints(n[0].start,n[1].end)]:p.comparePoints(n[0].start,n[1].end)==0&&(n=[p.fromPoints(n[1].start,n[0].end)])),t.$bracketHighlight={ranges:n,markerIds:n.map(function(e){return t.addMarker(e,r,"text")})}},50)},this.$highlightTags=function(){if(this.$highlightTagPending)return;var e=this;this.$highlightTagPending=!0,setTimeout(function(){e.$highlightTagPending=!1;var t=e.session;if(!t||!t.bgTokenizer)return;var n=e.getCursorPosition(),r=new y(e.session,n.row,n.column),i=r.getCurrentToken();if(!i||!/\b(?:tag-open|tag-name)/.test(i.type)){t.removeMarker(t.$tagHighlight),t.$tagHighlight=null;return}if(i.type.indexOf("tag-open")!==-1){i=r.stepForward();if(!i)return}var s=i.value,o=i.value,u=0,a=r.stepBackward();if(a.value==="<"){do a=i,i=r.stepForward(),i&&(i.type.indexOf("tag-name")!==-1?(o=i.value,s===o&&(a.value==="<"?u++:a.value===""&&u--);while(i&&u>=0)}else{do{i=a,a=r.stepBackward();if(i)if(i.type.indexOf("tag-name")!==-1)s===i.value&&(a.value==="<"?u++:a.value===""){var f=0,l=a;while(l){if(l.type.indexOf("tag-name")!==-1&&l.value===s){u--;break}if(l.value==="<")break;l=r.stepBackward(),f++}for(var c=0;c1)&&(t=!1)}if(e.$highlightLineMarker&&!t)e.removeMarker(e.$highlightLineMarker.id),e.$highlightLineMarker=null;else if(!e.$highlightLineMarker&&t){var n=new p(t.row,t.column,t.row,Infinity);n.id=e.addMarker(n,"ace_active-line","screenLine"),e.$highlightLineMarker=n}else t&&(e.$highlightLineMarker.start.row=t.row,e.$highlightLineMarker.end.row=t.row,e.$highlightLineMarker.start.column=t.column,e._signal("changeBackMarker"))},this.onSelectionChange=function(e){var t=this.session;t.$selectionMarker&&t.removeMarker(t.$selectionMarker),t.$selectionMarker=null;if(!this.selection.isEmpty()){var n=this.selection.getRange(),r=this.getSelectionStyle();t.$selectionMarker=t.addMarker(n,"ace_selection",r)}else this.$updateHighlightActiveLine();var i=this.$highlightSelectedWord&&this.$getSelectionHighLightRegexp();this.session.highlight(i),this._signal("changeSelection")},this.$getSelectionHighLightRegexp=function(){var e=this.session,t=this.getSelectionRange();if(t.isEmpty()||t.isMultiLine())return;var n=t.start.column,r=t.end.column,i=e.getLine(t.start.row),s=i.substring(n,r);if(s.length>5e3||!/[\w\d]/.test(s))return;var o=this.$search.$assembleRegExp({wholeWord:!0,caseSensitive:!0,needle:s}),u=i.substring(n-1,r+1);if(!o.test(u))return;return o},this.onChangeFrontMarker=function(){this.renderer.updateFrontMarkers()},this.onChangeBackMarker=function(){this.renderer.updateBackMarkers()},this.onChangeBreakpoint=function(){this.renderer.updateBreakpoints()},this.onChangeAnnotation=function(){this.renderer.setAnnotations(this.session.getAnnotations())},this.onChangeMode=function(e){this.renderer.updateText(),this._emit("changeMode",e)},this.onChangeWrapLimit=function(){this.renderer.updateFull()},this.onChangeWrapMode=function(){this.renderer.onResize(!0)},this.onChangeFold=function(){this.$updateHighlightActiveLine(),this.renderer.updateFull()},this.getSelectedText=function(){return this.session.getTextRange(this.getSelectionRange())},this.getCopyText=function(){var e=this.getSelectedText(),t=this.session.doc.getNewLineCharacter(),n=!1;if(!e&&this.$copyWithEmptySelection){n=!0;var r=this.selection.getAllRanges();for(var i=0;iu.search(/\S|$/)){var a=u.substr(i.column).search(/\S|$/);n.doc.removeInLine(i.row,i.column,i.column+a)}}this.clearSelection();var f=i.column,l=n.getState(i.row),u=n.getLine(i.row),c=r.checkOutdent(l,u,e);n.insert(i,e),s&&s.selection&&(s.selection.length==2?this.selection.setSelectionRange(new p(i.row,f+s.selection[0],i.row,f+s.selection[1])):this.selection.setSelectionRange(new p(i.row+s.selection[0],s.selection[1],i.row+s.selection[2],s.selection[3])));if(this.$enableAutoIndent){if(n.getDocument().isNewLine(e)){var h=r.getNextLineIndent(l,u.slice(0,i.column),n.getTabString());n.insert({row:i.row+1,column:0},h)}c&&r.autoOutdent(l,n,i.row)}},this.autoIndent=function(){var e=this.session,t=e.getMode(),n,r;if(this.selection.isEmpty())n=0,r=e.doc.getLength()-1;else{var i=this.getSelectionRange();n=i.start.row,r=i.end.row}var s="",o="",u="",a,f,l,c=e.getTabString();for(var h=n;h<=r;h++)h>0&&(s=e.getState(h-1),o=e.getLine(h-1),u=t.getNextLineIndent(s,o,c)),a=e.getLine(h),f=t.$getIndent(a),u!==f&&(f.length>0&&(l=new p(h,0,h,f.length),e.remove(l)),u.length>0&&e.insert({row:h,column:0},u)),t.autoOutdent(s,e,h)},this.onTextInput=function(e,t){if(!t)return this.keyBinding.onTextInput(e);this.startOperation({command:{name:"insertstring"}});var n=this.applyComposition.bind(this,e,t);this.selection.rangeCount?this.forEachSelection(n):n(),this.endOperation()},this.applyComposition=function(e,t){if(t.extendLeft||t.extendRight){var n=this.selection.getRange();n.start.column-=t.extendLeft,n.end.column+=t.extendRight,n.start.column<0&&(n.start.row--,n.start.column+=this.session.getLine(n.start.row).length+1),this.selection.setRange(n),!e&&!n.isEmpty()&&this.remove()}(e||!this.selection.isEmpty())&&this.insert(e,!0);if(t.restoreStart||t.restoreEnd){var n=this.selection.getRange();n.start.column-=t.restoreStart,n.end.column-=t.restoreEnd,this.selection.setRange(n)}},this.onCommandKey=function(e,t,n){return this.keyBinding.onCommandKey(e,t,n)},this.setOverwrite=function(e){this.session.setOverwrite(e)},this.getOverwrite=function(){return this.session.getOverwrite()},this.toggleOverwrite=function(){this.session.toggleOverwrite()},this.setScrollSpeed=function(e){this.setOption("scrollSpeed",e)},this.getScrollSpeed=function(){return this.getOption("scrollSpeed")},this.setDragDelay=function(e){this.setOption("dragDelay",e)},this.getDragDelay=function(){return this.getOption("dragDelay")},this.setSelectionStyle=function(e){this.setOption("selectionStyle",e)},this.getSelectionStyle=function(){return this.getOption("selectionStyle")},this.setHighlightActiveLine=function(e){this.setOption("highlightActiveLine",e)},this.getHighlightActiveLine=function(){return this.getOption("highlightActiveLine")},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.setHighlightSelectedWord=function(e){this.setOption("highlightSelectedWord",e)},this.getHighlightSelectedWord=function(){return this.$highlightSelectedWord},this.setAnimatedScroll=function(e){this.renderer.setAnimatedScroll(e)},this.getAnimatedScroll=function(){return this.renderer.getAnimatedScroll()},this.setShowInvisibles=function(e){this.renderer.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.renderer.getShowInvisibles()},this.setDisplayIndentGuides=function(e){this.renderer.setDisplayIndentGuides(e)},this.getDisplayIndentGuides=function(){return this.renderer.getDisplayIndentGuides()},this.setShowPrintMargin=function(e){this.renderer.setShowPrintMargin(e)},this.getShowPrintMargin=function(){return this.renderer.getShowPrintMargin()},this.setPrintMarginColumn=function(e){this.renderer.setPrintMarginColumn(e)},this.getPrintMarginColumn=function(){return this.renderer.getPrintMarginColumn()},this.setReadOnly=function(e){this.setOption("readOnly",e)},this.getReadOnly=function(){return this.getOption("readOnly")},this.setBehavioursEnabled=function(e){this.setOption("behavioursEnabled",e)},this.getBehavioursEnabled=function(){return this.getOption("behavioursEnabled")},this.setWrapBehavioursEnabled=function(e){this.setOption("wrapBehavioursEnabled",e)},this.getWrapBehavioursEnabled=function(){return this.getOption("wrapBehavioursEnabled")},this.setShowFoldWidgets=function(e){this.setOption("showFoldWidgets",e)},this.getShowFoldWidgets=function(){return this.getOption("showFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.remove=function(e){this.selection.isEmpty()&&(e=="left"?this.selection.selectLeft():this.selection.selectRight());var t=this.getSelectionRange();if(this.getBehavioursEnabled()){var n=this.session,r=n.getState(t.start.row),i=n.getMode().transformAction(r,"deletion",this,n,t);if(t.end.column===0){var s=n.getTextRange(t);if(s[s.length-1]=="\n"){var o=n.getLine(t.end.row);/^\s+$/.test(o)&&(t.end.column=o.length)}}i&&(t=i)}this.session.remove(t),this.clearSelection()},this.removeWordRight=function(){this.selection.isEmpty()&&this.selection.selectWordRight(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeWordLeft=function(){this.selection.isEmpty()&&this.selection.selectWordLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineStart=function(){this.selection.isEmpty()&&this.selection.selectLineStart(),this.selection.isEmpty()&&this.selection.selectLeft(),this.session.remove(this.getSelectionRange()),this.clearSelection()},this.removeToLineEnd=function(){this.selection.isEmpty()&&this.selection.selectLineEnd();var e=this.getSelectionRange();e.start.column==e.end.column&&e.start.row==e.end.row&&(e.end.column=0,e.end.row++),this.session.remove(e),this.clearSelection()},this.splitLine=function(){this.selection.isEmpty()||(this.session.remove(this.getSelectionRange()),this.clearSelection());var e=this.getCursorPosition();this.insert("\n"),this.moveCursorToPosition(e)},this.transposeLetters=function(){if(!this.selection.isEmpty())return;var e=this.getCursorPosition(),t=e.column;if(t===0)return;var n=this.session.getLine(e.row),r,i;tt.toLowerCase()?1:0});var i=new p(0,0,0,0);for(var r=e.first;r<=e.last;r++){var s=t.getLine(r);i.start.row=r,i.end.row=r,i.end.column=s.length,t.replace(i,n[r-e.first])}},this.toggleCommentLines=function(){var e=this.session.getState(this.getCursorPosition().row),t=this.$getSelectedRows();this.session.getMode().toggleCommentLines(e,this.session,t.first,t.last)},this.toggleBlockComment=function(){var e=this.getCursorPosition(),t=this.session.getState(e.row),n=this.getSelectionRange();this.session.getMode().toggleBlockComment(t,this.session,n,e)},this.getNumberAt=function(e,t){var n=/[\-]?[0-9]+(?:\.[0-9]+)?/g;n.lastIndex=0;var r=this.session.getLine(e);while(n.lastIndex=t){var s={value:i[0],start:i.index,end:i.index+i[0].length};return s}}return null},this.modifyNumber=function(e){var t=this.selection.getCursor().row,n=this.selection.getCursor().column,r=new p(t,n-1,t,n),i=this.session.getTextRange(r);if(!isNaN(parseFloat(i))&&isFinite(i)){var s=this.getNumberAt(t,n);if(s){var o=s.value.indexOf(".")>=0?s.start+s.value.indexOf(".")+1:s.end,u=s.start+s.value.length-o,a=parseFloat(s.value);a*=Math.pow(10,u),o!==s.end&&n=u&&o<=a&&(n=t,f.selection.clearSelection(),f.moveCursorTo(e,u+r),f.selection.selectTo(e,a+r)),u=a});var l=this.$toggleWordPairs,c;for(var h=0;hp+1)break;p=d.last}l--,u=this.session.$moveLines(h,p,t?0:e),t&&e==-1&&(c=l+1);while(c<=l)o[c].moveBy(u,0),c++;t||(u=0),a+=u}i.fromOrientedRange(i.ranges[0]),i.rangeList.attach(this.session),this.inVirtualSelectionMode=!1}},this.$getSelectedRows=function(e){return e=(e||this.getSelectionRange()).collapseRows(),{first:this.session.getRowFoldStart(e.start.row),last:this.session.getRowFoldEnd(e.end.row)}},this.onCompositionStart=function(e){this.renderer.showComposition(e)},this.onCompositionUpdate=function(e){this.renderer.setCompositionText(e)},this.onCompositionEnd=function(){this.renderer.hideComposition()},this.getFirstVisibleRow=function(){return this.renderer.getFirstVisibleRow()},this.getLastVisibleRow=function(){return this.renderer.getLastVisibleRow()},this.isRowVisible=function(e){return e>=this.getFirstVisibleRow()&&e<=this.getLastVisibleRow()},this.isRowFullyVisible=function(e){return e>=this.renderer.getFirstFullyVisibleRow()&&e<=this.renderer.getLastFullyVisibleRow()},this.$getVisibleRowCount=function(){return this.renderer.getScrollBottomRow()-this.renderer.getScrollTopRow()+1},this.$moveByPage=function(e,t){var n=this.renderer,r=this.renderer.layerConfig,i=e*Math.floor(r.height/r.lineHeight);t===!0?this.selection.$moveSelection(function(){this.moveCursorBy(i,0)}):t===!1&&(this.selection.moveCursorBy(i,0),this.selection.clearSelection());var s=n.scrollTop;n.scrollBy(0,i*r.lineHeight),t!=null&&n.scrollCursorIntoView(null,.5),n.animateScrolling(s)},this.selectPageDown=function(){this.$moveByPage(1,!0)},this.selectPageUp=function(){this.$moveByPage(-1,!0)},this.gotoPageDown=function(){this.$moveByPage(1,!1)},this.gotoPageUp=function(){this.$moveByPage(-1,!1)},this.scrollPageDown=function(){this.$moveByPage(1)},this.scrollPageUp=function(){this.$moveByPage(-1)},this.scrollToRow=function(e){this.renderer.scrollToRow(e)},this.scrollToLine=function(e,t,n,r){this.renderer.scrollToLine(e,t,n,r)},this.centerSelection=function(){var e=this.getSelectionRange(),t={row:Math.floor(e.start.row+(e.end.row-e.start.row)/2),column:Math.floor(e.start.column+(e.end.column-e.start.column)/2)};this.renderer.alignCursor(t,.5)},this.getCursorPosition=function(){return this.selection.getCursor()},this.getCursorPositionScreen=function(){return this.session.documentToScreenPosition(this.getCursorPosition())},this.getSelectionRange=function(){return this.selection.getRange()},this.selectAll=function(){this.selection.selectAll()},this.clearSelection=function(){this.selection.clearSelection()},this.moveCursorTo=function(e,t){this.selection.moveCursorTo(e,t)},this.moveCursorToPosition=function(e){this.selection.moveCursorToPosition(e)},this.jumpToMatching=function(e,t){var n=this.getCursorPosition(),r=new y(this.session,n.row,n.column),i=r.getCurrentToken(),s=i||r.stepForward();if(!s)return;var o,u=!1,a={},f=n.column-s.start,l,c={")":"(","(":"(","]":"[","[":"[","{":"{","}":"{"};do{if(s.value.match(/[{}()\[\]]/g))for(;f=0;--s)this.$tryReplace(n[s],e)&&r++;return this.selection.setSelectionRange(i),r},this.$tryReplace=function(e,t){var n=this.session.getTextRange(e);return t=this.$search.replace(n,t),t!==null?(e.end=this.session.replace(e,t),e):null},this.getLastSearchOptions=function(){return this.$search.getOptions()},this.find=function(e,t,n){t||(t={}),typeof e=="string"||e instanceof RegExp?t.needle=e:typeof e=="object"&&r.mixin(t,e);var i=this.selection.getRange();t.needle==null&&(e=this.session.getTextRange(i)||this.$search.$options.needle,e||(i=this.session.getWordRange(i.start.row,i.start.column),e=this.session.getTextRange(i)),this.$search.set({needle:e})),this.$search.set(t),t.start||this.$search.set({start:i});var s=this.$search.find(this.session);if(t.preventScroll)return s;if(s)return this.revealRange(s,n),s;t.backwards?i.start=i.end:i.end=i.start,this.selection.setRange(i)},this.findNext=function(e,t){this.find({skipCurrent:!0,backwards:!1},e,t)},this.findPrevious=function(e,t){this.find(e,{skipCurrent:!0,backwards:!0},t)},this.revealRange=function(e,t){this.session.unfold(e),this.selection.setSelectionRange(e);var n=this.renderer.scrollTop;this.renderer.scrollSelectionIntoView(e.start,e.end,.5),t!==!1&&this.renderer.animateScrolling(n)},this.undo=function(){this.session.getUndoManager().undo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.redo=function(){this.session.getUndoManager().redo(this.session),this.renderer.scrollCursorIntoView(null,.5)},this.destroy=function(){this.$toDestroy&&(this.$toDestroy.forEach(function(e){e.destroy()}),this.$toDestroy=null),this.$mouseHandler&&this.$mouseHandler.destroy(),this.renderer.destroy(),this._signal("destroy",this),this.session&&this.session.destroy(),this._$emitInputEvent&&this._$emitInputEvent.cancel(),this.removeAllListeners()},this.setAutoScrollEditorIntoView=function(e){if(!e)return;var t,n=this,r=!1;this.$scrollAnchor||(this.$scrollAnchor=document.createElement("div"));var i=this.$scrollAnchor;i.style.cssText="position:absolute",this.container.insertBefore(i,this.container.firstChild);var s=this.on("changeSelection",function(){r=!0}),o=this.renderer.on("beforeRender",function(){r&&(t=n.renderer.container.getBoundingClientRect())}),u=this.renderer.on("afterRender",function(){if(r&&t&&(n.isFocused()||n.searchBox&&n.searchBox.isFocused())){var e=n.renderer,s=e.$cursorLayer.$pixelPos,o=e.layerConfig,u=s.top-o.offset;s.top>=0&&u+t.top<0?r=!0:s.topwindow.innerHeight?r=!1:r=null,r!=null&&(i.style.top=u+"px",i.style.left=s.left+"px",i.style.height=o.lineHeight+"px",i.scrollIntoView(r)),r=t=null}});this.setAutoScrollEditorIntoView=function(e){if(e)return;delete this.setAutoScrollEditorIntoView,this.off("changeSelection",s),this.renderer.off("afterRender",u),this.renderer.off("beforeRender",o)}},this.$resetCursorStyle=function(){var e=this.$cursorStyle||"ace",t=this.renderer.$cursorLayer;if(!t)return;t.setSmoothBlinking(/smooth/.test(e)),t.isBlinking=!this.$readOnly&&e!="wide",i.setCssClass(t.element,"ace_slim-cursors",/slim/.test(e))},this.prompt=function(e,t,n){var r=this;g.loadModule("./ext/prompt",function(i){i.prompt(r,e,t,n)})}}.call(w.prototype),g.defineOptions(w.prototype,"editor",{selectionStyle:{set:function(e){this.onSelectionChange(),this._signal("changeSelectionStyle",{data:e})},initialValue:"line"},highlightActiveLine:{set:function(){this.$updateHighlightActiveLine()},initialValue:!0},highlightSelectedWord:{set:function(e){this.$onSelectionChange()},initialValue:!0},readOnly:{set:function(e){this.textInput.setReadOnly(e),this.$resetCursorStyle()},initialValue:!1},copyWithEmptySelection:{set:function(e){this.textInput.setCopyWithEmptySelection(e)},initialValue:!1},cursorStyle:{set:function(e){this.$resetCursorStyle()},values:["ace","slim","smooth","wide"],initialValue:"ace"},mergeUndoDeltas:{values:[!1,!0,"always"],initialValue:!0},behavioursEnabled:{initialValue:!0},wrapBehavioursEnabled:{initialValue:!0},enableAutoIndent:{initialValue:!0},autoScrollEditorIntoView:{set:function(e){this.setAutoScrollEditorIntoView(e)}},keyboardHandler:{set:function(e){this.setKeyboardHandler(e)},get:function(){return this.$keybindingId},handlesSet:!0},value:{set:function(e){this.session.setValue(e)},get:function(){return this.getValue()},handlesSet:!0,hidden:!0},session:{set:function(e){this.setSession(e)},get:function(){return this.session},handlesSet:!0,hidden:!0},showLineNumbers:{set:function(e){this.renderer.$gutterLayer.setShowLineNumbers(e),this.renderer.$loop.schedule(this.renderer.CHANGE_GUTTER),e&&this.$relativeLineNumbers?E.attach(this):E.detach(this)},initialValue:!0},relativeLineNumbers:{set:function(e){this.$showLineNumbers&&e?E.attach(this):E.detach(this)}},placeholder:{set:function(e){this.$updatePlaceholder||(this.$updatePlaceholder=function(){var e=this.session&&(this.renderer.$composition||this.getValue());if(e&&this.renderer.placeholderNode)this.renderer.off("afterRender",this.$updatePlaceholder),i.removeCssClass(this.container,"ace_hasPlaceholder"),this.renderer.placeholderNode.remove(),this.renderer.placeholderNode=null;else if(!e&&!this.renderer.placeholderNode){this.renderer.on("afterRender",this.$updatePlaceholder),i.addCssClass(this.container,"ace_hasPlaceholder");var t=i.createElement("div");t.className="ace_placeholder",t.textContent=this.$placeholder||"",this.renderer.placeholderNode=t,this.renderer.content.appendChild(this.renderer.placeholderNode)}else!e&&this.renderer.placeholderNode&&(this.renderer.placeholderNode.textContent=this.$placeholder||"")}.bind(this),this.on("input",this.$updatePlaceholder)),this.$updatePlaceholder()}},hScrollBarAlwaysVisible:"renderer",vScrollBarAlwaysVisible:"renderer",highlightGutterLine:"renderer",animatedScroll:"renderer",showInvisibles:"renderer",showPrintMargin:"renderer",printMarginColumn:"renderer",printMargin:"renderer",fadeFoldWidgets:"renderer",showFoldWidgets:"renderer",displayIndentGuides:"renderer",showGutter:"renderer",fontSize:"renderer",fontFamily:"renderer",maxLines:"renderer",minLines:"renderer",scrollPastEnd:"renderer",fixedWidthGutter:"renderer",theme:"renderer",hasCssTransforms:"renderer",maxPixelHeight:"renderer",useTextareaForIME:"renderer",scrollSpeed:"$mouseHandler",dragDelay:"$mouseHandler",dragEnabled:"$mouseHandler",focusTimeout:"$mouseHandler",tooltipFollowsMouse:"$mouseHandler",firstLineNumber:"session",overwrite:"session",newLineMode:"session",useWorker:"session",useSoftTabs:"session",navigateWithinSoftTabs:"session",tabSize:"session",wrap:"session",indentedSoftWrap:"session",foldStyle:"session",mode:"session"});var E={getText:function(e,t){return(Math.abs(e.selection.lead.row-t)||t+1+(t<9?"\u00b7":""))+""},getWidth:function(e,t,n){return Math.max(t.toString().length,(n.lastRow+1).toString().length,2)*n.characterWidth},update:function(e,t){t.renderer.$loop.schedule(t.renderer.CHANGE_GUTTER)},attach:function(e){e.renderer.$gutterLayer.$renderer=this,e.on("changeSelection",this.update),this.update(null,e)},detach:function(e){e.renderer.$gutterLayer.$renderer==this&&(e.renderer.$gutterLayer.$renderer=null),e.off("changeSelection",this.update),this.update(null,e)}};t.Editor=w}),define("ace/undomanager",["require","exports","module","ace/range"],function(e,t,n){"use strict";function i(e,t){for(var n=t;n--;){var r=e[n];if(r&&!r[0].ignore){while(n0){a.row+=i,a.column+=a.row==r.row?s:0;continue}!t&&l<=0&&(a.row=n.row,a.column=n.column,l===0&&(a.bias=1))}}function f(e){return{row:e.row,column:e.column}}function l(e){return{start:f(e.start),end:f(e.end),action:e.action,lines:e.lines.slice()}}function c(e){e=e||this;if(Array.isArray(e))return e.map(c).join("\n");var t="";e.action?(t=e.action=="insert"?"+":"-",t+="["+e.lines+"]"):e.value&&(Array.isArray(e.value)?t=e.value.map(h).join("\n"):t=h(e.value)),e.start&&(t+=h(e));if(e.id||e.rev)t+=" ("+(e.id||e.rev)+")";return t}function h(e){return e.start.row+":"+e.start.column+"=>"+e.end.row+":"+e.end.column}function p(e,t){var n=e.action=="insert",r=t.action=="insert";if(n&&r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.start,e.start)<=0))return null;m(e,t,1)}else if(n&&!r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.end,e.start)<=0))return null;m(e,t,-1)}else if(!n&&r)if(o(t.start,e.start)>=0)m(t,e,1);else{if(!(o(t.start,e.start)<=0))return null;m(e,t,1)}else if(!n&&!r)if(o(t.start,e.start)>=0)m(t,e,1);else{if(!(o(t.end,e.start)<=0))return null;m(e,t,-1)}return[t,e]}function d(e,t){for(var n=e.length;n--;)for(var r=0;r=0?m(e,t,-1):o(e.start,t.start)<=0?m(t,e,1):(m(e,s.fromPoints(t.start,e.start),-1),m(t,e,1));else if(!n&&r)o(t.start,e.end)>=0?m(t,e,-1):o(t.start,e.start)<=0?m(e,t,1):(m(t,s.fromPoints(e.start,t.start),-1),m(e,t,1));else if(!n&&!r)if(o(t.start,e.end)>=0)m(t,e,-1);else{if(!(o(t.end,e.start)<=0)){var i,u;return o(e.start,t.start)<0&&(i=e,e=y(e,t.start)),o(e.end,t.end)>0&&(u=y(e,t.end)),g(t.end,e.start,e.end,-1),u&&!i&&(e.lines=u.lines,e.start=u.start,e.end=u.end,u=e),[t,i,u].filter(Boolean)}m(e,t,-1)}return[t,e]}function m(e,t,n){g(e.start,t.start,t.end,n),g(e.end,t.start,t.end,n)}function g(e,t,n,r){e.row==(r==1?t:n).row&&(e.column+=r*(n.column-t.column)),e.row+=r*(n.row-t.row)}function y(e,t){var n=e.lines,r=e.end;e.end=f(t);var i=e.end.row-e.start.row,s=n.splice(i,n.length),o=i?t.column:t.column-e.start.column;n.push(s[0].substring(0,o)),s[0]=s[0].substr(o);var u={start:f(t),end:r,lines:s,action:e.action};return u}function b(e,t){t=l(t);for(var n=e.length;n--;){var r=e[n];for(var i=0;i0},this.canRedo=function(){return this.$redoStack.length>0},this.bookmark=function(e){e==undefined&&(e=this.$rev),this.mark=e},this.isAtBookmark=function(){return this.$rev===this.mark},this.toJSON=function(){},this.fromJSON=function(){},this.hasUndo=this.canUndo,this.hasRedo=this.canRedo,this.isClean=this.isAtBookmark,this.markClean=this.bookmark,this.$prettyPrint=function(e){return e?c(e):c(this.$undoStack)+"\n---\n"+c(this.$redoStack)}}).call(r.prototype);var s=e("./range").Range,o=s.comparePoints,u=s.comparePoints;t.UndoManager=r}),define("ace/layer/lines",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=function(e,t){this.element=e,this.canvasHeight=t||5e5,this.element.style.height=this.canvasHeight*2+"px",this.cells=[],this.cellCache=[],this.$offsetCoefficient=0};(function(){this.moveContainer=function(e){r.translate(this.element,0,-(e.firstRowScreen*e.lineHeight%this.canvasHeight)-e.offset*this.$offsetCoefficient)},this.pageChanged=function(e,t){return Math.floor(e.firstRowScreen*e.lineHeight/this.canvasHeight)!==Math.floor(t.firstRowScreen*t.lineHeight/this.canvasHeight)},this.computeLineTop=function(e,t,n){var r=t.firstRowScreen*t.lineHeight,i=Math.floor(r/this.canvasHeight),s=n.documentToScreenRow(e,0)*t.lineHeight;return s-i*this.canvasHeight},this.computeLineHeight=function(e,t,n){return t.lineHeight*n.getRowLineCount(e)},this.getLength=function(){return this.cells.length},this.get=function(e){return this.cells[e]},this.shift=function(){this.$cacheCell(this.cells.shift())},this.pop=function(){this.$cacheCell(this.cells.pop())},this.push=function(e){if(Array.isArray(e)){this.cells.push.apply(this.cells,e);var t=r.createFragment(this.element);for(var n=0;ns&&(a=i.end.row+1,i=t.getNextFoldLine(a,i),s=i?i.start.row:Infinity);if(a>r){while(this.$lines.getLength()>u+1)this.$lines.pop();break}o=this.$lines.get(++u),o?o.row=a:(o=this.$lines.createCell(a,e,this.session,f),this.$lines.push(o)),this.$renderCell(o,e,i,a),a++}this._signal("afterRender"),this.$updateGutterWidth(e)},this.$updateGutterWidth=function(e){var t=this.session,n=t.gutterRenderer||this.$renderer,r=t.$firstLineNumber,i=this.$lines.last()?this.$lines.last().text:"";if(this.$fixedWidth||t.$useWrapMode)i=t.getLength()+r-1;var s=n?n.getWidth(t,i,e):i.toString().length*e.characterWidth,o=this.$padding||this.$computePadding();s+=o.left+o.right,s!==this.gutterWidth&&!isNaN(s)&&(this.gutterWidth=s,this.element.parentNode.style.width=this.element.style.width=Math.ceil(this.gutterWidth)+"px",this._signal("changeGutterWidth",s))},this.$updateCursorRow=function(){if(!this.$highlightGutterLine)return;var e=this.session.selection.getCursor();if(this.$cursorRow===e.row)return;this.$cursorRow=e.row},this.updateLineHighlight=function(){if(!this.$highlightGutterLine)return;var e=this.session.selection.cursor.row;this.$cursorRow=e;if(this.$cursorCell&&this.$cursorCell.row==e)return;this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ",""));var t=this.$lines.cells;this.$cursorCell=null;for(var n=0;n=this.$cursorRow){if(r.row>this.$cursorRow){var i=this.session.getFoldLine(this.$cursorRow);if(!(n>0&&i&&i.start.row==t[n-1].row))break;r=t[n-1]}r.element.className="ace_gutter-active-line "+r.element.className,this.$cursorCell=r;break}}},this.scrollLines=function(e){var t=this.config;this.config=e,this.$updateCursorRow();if(this.$lines.pageChanged(t,e))return this.update(e);this.$lines.moveContainer(e);var n=Math.min(e.lastRow+e.gutterOffset,this.session.getLength()-1),r=this.oldLastRow;this.oldLastRow=n;if(!t||r0;i--)this.$lines.shift();if(r>n)for(var i=this.session.getFoldedRowCount(n+1,r);i>0;i--)this.$lines.pop();e.firstRowr&&this.$lines.push(this.$renderLines(e,r+1,n)),this.updateLineHighlight(),this._signal("afterRender"),this.$updateGutterWidth(e)},this.$renderLines=function(e,t,n){var r=[],i=t,s=this.session.getNextFoldLine(i),o=s?s.start.row:Infinity;for(;;){i>o&&(i=s.end.row+1,s=this.session.getNextFoldLine(i,s),o=s?s.start.row:Infinity);if(i>n)break;var u=this.$lines.createCell(i,e,this.session,f);this.$renderCell(u,e,s,i),r.push(u),i++}return r},this.$renderCell=function(e,t,n,i){var s=e.element,o=this.session,u=s.childNodes[0],a=s.childNodes[1],f=o.$firstLineNumber,l=o.$breakpoints,c=o.$decorations,h=o.gutterRenderer||this.$renderer,p=this.$showFoldWidgets&&o.foldWidgets,d=n?n.start.row:Number.MAX_VALUE,v="ace_gutter-cell ";this.$highlightGutterLine&&(i==this.$cursorRow||n&&i=d&&this.$cursorRow<=n.end.row)&&(v+="ace_gutter-active-line ",this.$cursorCell!=e&&(this.$cursorCell&&(this.$cursorCell.element.className=this.$cursorCell.element.className.replace("ace_gutter-active-line ","")),this.$cursorCell=e)),l[i]&&(v+=l[i]),c[i]&&(v+=c[i]),this.$annotations[i]&&(v+=this.$annotations[i].className),s.className!=v&&(s.className=v);if(p){var m=p[i];m==null&&(m=p[i]=o.getFoldWidget(i))}if(m){var v="ace_fold-widget ace_"+m;m=="start"&&i==d&&in.right-t.right)return"foldWidgets"}}).call(a.prototype),t.Gutter=a}),define("ace/layer/marker",["require","exports","module","ace/range","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../range").Range,i=e("../lib/dom"),s=function(e){this.element=i.createElement("div"),this.element.className="ace_layer ace_marker-layer",e.appendChild(this.element)};(function(){function e(e,t,n,r){return(e?1:0)|(t?2:0)|(n?4:0)|(r?8:0)}this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setMarkers=function(e){this.markers=e},this.elt=function(e,t){var n=this.i!=-1&&this.element.childNodes[this.i];n?this.i++:(n=document.createElement("div"),this.element.appendChild(n),this.i=-1),n.style.cssText=t,n.className=e},this.update=function(e){if(!e)return;this.config=e,this.i=0;var t;for(var n in this.markers){var r=this.markers[n];if(!r.range){r.update(t,this,this.session,e);continue}var i=r.range.clipRows(e.firstRow,e.lastRow);if(i.isEmpty())continue;i=i.toScreenRange(this.session);if(r.renderer){var s=this.$getTop(i.start.row,e),o=this.$padding+i.start.column*e.characterWidth;r.renderer(t,i,o,s,e)}else r.type=="fullLine"?this.drawFullLineMarker(t,i,r.clazz,e):r.type=="screenLine"?this.drawScreenLineMarker(t,i,r.clazz,e):i.isMultiLine()?r.type=="text"?this.drawTextMarker(t,i,r.clazz,e):this.drawMultiLineMarker(t,i,r.clazz,e):this.drawSingleLineMarker(t,i,r.clazz+" ace_start"+" ace_br15",e)}if(this.i!=-1)while(this.ip,l==f),s,l==f?0:1,o)},this.drawMultiLineMarker=function(e,t,n,r,i){var s=this.$padding,o=r.lineHeight,u=this.$getTop(t.start.row,r),a=s+t.start.column*r.characterWidth;i=i||"";if(this.session.$bidiHandler.isBidiRow(t.start.row)){var f=t.clone();f.end.row=f.start.row,f.end.column=this.session.getLine(f.start.row).length,this.drawBidiSingleLineMarker(e,f,n+" ace_br1 ace_start",r,null,i)}else this.elt(n+" ace_br1 ace_start","height:"+o+"px;"+"right:0;"+"top:"+u+"px;left:"+a+"px;"+(i||""));if(this.session.$bidiHandler.isBidiRow(t.end.row)){var f=t.clone();f.start.row=f.end.row,f.start.column=0,this.drawBidiSingleLineMarker(e,f,n+" ace_br12",r,null,i)}else{u=this.$getTop(t.end.row,r);var l=t.end.column*r.characterWidth;this.elt(n+" ace_br12","height:"+o+"px;"+"width:"+l+"px;"+"top:"+u+"px;"+"left:"+s+"px;"+(i||""))}o=(t.end.row-t.start.row-1)*r.lineHeight;if(o<=0)return;u=this.$getTop(t.start.row+1,r);var c=(t.start.column?1:0)|(t.end.column?0:8);this.elt(n+(c?" ace_br"+c:""),"height:"+o+"px;"+"right:0;"+"top:"+u+"px;"+"left:"+s+"px;"+(i||""))},this.drawSingleLineMarker=function(e,t,n,r,i,s){if(this.session.$bidiHandler.isBidiRow(t.start.row))return this.drawBidiSingleLineMarker(e,t,n,r,i,s);var o=r.lineHeight,u=(t.end.column+(i||0)-t.start.column)*r.characterWidth,a=this.$getTop(t.start.row,r),f=this.$padding+t.start.column*r.characterWidth;this.elt(n,"height:"+o+"px;"+"width:"+u+"px;"+"top:"+a+"px;"+"left:"+f+"px;"+(s||""))},this.drawBidiSingleLineMarker=function(e,t,n,r,i,s){var o=r.lineHeight,u=this.$getTop(t.start.row,r),a=this.$padding,f=this.session.$bidiHandler.getSelections(t.start.column,t.end.column);f.forEach(function(e){this.elt(n,"height:"+o+"px;"+"width:"+e.width+(i||0)+"px;"+"top:"+u+"px;"+"left:"+(a+e.left)+"px;"+(s||""))},this)},this.drawFullLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;t.start.row!=t.end.row&&(o+=this.$getTop(t.end.row,r)-s),this.elt(n,"height:"+o+"px;"+"top:"+s+"px;"+"left:0;right:0;"+(i||""))},this.drawScreenLineMarker=function(e,t,n,r,i){var s=this.$getTop(t.start.row,r),o=r.lineHeight;this.elt(n,"height:"+o+"px;"+"top:"+s+"px;"+"left:0;right:0;"+(i||""))}}).call(s.prototype),t.Marker=s}),define("ace/layer/text",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/layer/lines","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("./lines").Lines,u=e("../lib/event_emitter").EventEmitter,a=function(e){this.dom=i,this.element=this.dom.createElement("div"),this.element.className="ace_layer ace_text-layer",e.appendChild(this.element),this.$updateEolChar=this.$updateEolChar.bind(this),this.$lines=new o(this.element)};(function(){r.implement(this,u),this.EOF_CHAR="\u00b6",this.EOL_CHAR_LF="\u00ac",this.EOL_CHAR_CRLF="\u00a4",this.EOL_CHAR=this.EOL_CHAR_LF,this.TAB_CHAR="\u2014",this.SPACE_CHAR="\u00b7",this.$padding=0,this.MAX_LINE_LENGTH=1e4,this.$updateEolChar=function(){var e=this.session.doc,t=e.getNewLineCharacter()=="\n"&&e.getNewLineMode()!="windows",n=t?this.EOL_CHAR_LF:this.EOL_CHAR_CRLF;if(this.EOL_CHAR!=n)return this.EOL_CHAR=n,!0},this.setPadding=function(e){this.$padding=e,this.element.style.margin="0 "+e+"px"},this.getLineHeight=function(){return this.$fontMetrics.$characterSize.height||0},this.getCharacterWidth=function(){return this.$fontMetrics.$characterSize.width||0},this.$setFontMetrics=function(e){this.$fontMetrics=e,this.$fontMetrics.on("changeCharacterSize",function(e){this._signal("changeCharacterSize",e)}.bind(this)),this.$pollSizeChanges()},this.checkForSizeChanges=function(){this.$fontMetrics.checkForSizeChanges()},this.$pollSizeChanges=function(){return this.$pollSizeChangesTimer=this.$fontMetrics.$pollSizeChanges()},this.setSession=function(e){this.session=e,e&&this.$computeTabString()},this.showInvisibles=!1,this.showSpaces=!1,this.showTabs=!1,this.showEOL=!1,this.setShowInvisibles=function(e){return this.showInvisibles==e?!1:(this.showInvisibles=e,typeof e=="string"?(this.showSpaces=/tab/i.test(e),this.showTabs=/space/i.test(e),this.showEOL=/eol/i.test(e)):this.showSpaces=this.showTabs=this.showEOL=e,this.$computeTabString(),!0)},this.displayIndentGuides=!0,this.setDisplayIndentGuides=function(e){return this.displayIndentGuides==e?!1:(this.displayIndentGuides=e,this.$computeTabString(),!0)},this.$tabStrings=[],this.onChangeTabSize=this.$computeTabString=function(){var e=this.session.getTabSize();this.tabSize=e;var t=this.$tabStrings=[0];for(var n=1;nl&&(u=a.end.row+1,a=this.session.getNextFoldLine(u,a),l=a?a.start.row:Infinity);if(u>i)break;var c=s[o++];if(c){this.dom.removeChildren(c),this.$renderLine(c,u,u==l?a:!1),f&&(c.style.top=this.$lines.computeLineTop(u,e,this.session)+"px");var h=e.lineHeight*this.session.getRowLength(u)+"px";c.style.height!=h&&(f=!0,c.style.height=h)}u++}if(f)while(o0;i--)this.$lines.shift();if(t.lastRow>e.lastRow)for(var i=this.session.getFoldedRowCount(e.lastRow+1,t.lastRow);i>0;i--)this.$lines.pop();e.firstRowt.lastRow&&this.$lines.push(this.$renderLinesFragment(e,t.lastRow+1,e.lastRow))},this.$renderLinesFragment=function(e,t,n){var r=[],s=t,o=this.session.getNextFoldLine(s),u=o?o.start.row:Infinity;for(;;){s>u&&(s=o.end.row+1,o=this.session.getNextFoldLine(s,o),u=o?o.start.row:Infinity);if(s>n)break;var a=this.$lines.createCell(s,e,this.session),f=a.element;this.dom.removeChildren(f),i.setStyle(f.style,"height",this.$lines.computeLineHeight(s,e,this.session)+"px"),i.setStyle(f.style,"top",this.$lines.computeLineTop(s,e,this.session)+"px"),this.$renderLine(f,s,s==u?o:!1),this.$useLineGroups()?f.className="ace_line_group":f.className="ace_line",r.push(a),s++}return r},this.update=function(e){this.$lines.moveContainer(e),this.config=e;var t=e.firstRow,n=e.lastRow,r=this.$lines;while(r.getLength())r.pop();r.push(this.$renderLinesFragment(e,t,n))},this.$textToken={text:!0,rparen:!0,lparen:!0},this.$renderToken=function(e,t,n,r){var i=this,o=/(\t)|( +)|([\x00-\x1f\x80-\xa0\xad\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\uFEFF\uFFF9-\uFFFC]+)|(\u3000)|([\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3001-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]|[\uD800-\uDBFF][\uDC00-\uDFFF])/g,u=this.dom.createFragment(this.element),a,f=0;while(a=o.exec(r)){var l=a[1],c=a[2],h=a[3],p=a[4],d=a[5];if(!i.showSpaces&&c)continue;var v=f!=a.index?r.slice(f,a.index):"";f=a.index+a[0].length,v&&u.appendChild(this.dom.createTextNode(v,this.element));if(l){var m=i.session.getScreenTabSize(t+a.index);u.appendChild(i.$tabStrings[m].cloneNode(!0)),t+=m-1}else if(c)if(i.showSpaces){var g=this.dom.createElement("span");g.className="ace_invisible ace_invisible_space",g.textContent=s.stringRepeat(i.SPACE_CHAR,c.length),u.appendChild(g)}else u.appendChild(this.com.createTextNode(c,this.element));else if(h){var g=this.dom.createElement("span");g.className="ace_invisible ace_invisible_space ace_invalid",g.textContent=s.stringRepeat(i.SPACE_CHAR,h.length),u.appendChild(g)}else if(p){t+=1;var g=this.dom.createElement("span");g.style.width=i.config.characterWidth*2+"px",g.className=i.showSpaces?"ace_cjk ace_invisible ace_invisible_space":"ace_cjk",g.textContent=i.showSpaces?i.SPACE_CHAR:p,u.appendChild(g)}else if(d){t+=1;var g=this.dom.createElement("span");g.style.width=i.config.characterWidth*2+"px",g.className="ace_cjk",g.textContent=d,u.appendChild(g)}}u.appendChild(this.dom.createTextNode(f?r.slice(f):r,this.element));if(!this.$textToken[n.type]){var y="ace_"+n.type.replace(/\./g," ace_"),g=this.dom.createElement("span");n.type=="fold"&&(g.style.width=n.value.length*this.config.characterWidth+"px"),g.className=y,g.appendChild(u),e.appendChild(g)}else e.appendChild(u);return t+r.length},this.renderIndentGuide=function(e,t,n){var r=t.search(this.$indentGuideRe);if(r<=0||r>=n)return t;if(t[0]==" "){r-=r%this.tabSize;var i=r/this.tabSize;for(var s=0;s=o)u=this.$renderToken(a,u,l,c.substring(0,o-r)),c=c.substring(o-r),r=o,a=this.$createLineElement(),e.appendChild(a),a.appendChild(this.dom.createTextNode(s.stringRepeat("\u00a0",n.indent),this.element)),i++,u=0,o=n[i]||Number.MAX_VALUE;c.length!=0&&(r+=c.length,u=this.$renderToken(a,u,l,c))}}n[n.length-1]>this.MAX_LINE_LENGTH&&this.$renderOverflowMessage(a,u,null,"",!0)},this.$renderSimpleLine=function(e,t){var n=0,r=t[0],i=r.value;this.displayIndentGuides&&(i=this.renderIndentGuide(e,i)),i&&(n=this.$renderToken(e,n,r,i));for(var s=1;sthis.MAX_LINE_LENGTH)return this.$renderOverflowMessage(e,n,r,i);n=this.$renderToken(e,n,r,i)}},this.$renderOverflowMessage=function(e,t,n,r,i){n&&this.$renderToken(e,t,n,r.slice(0,this.MAX_LINE_LENGTH-t));var s=this.dom.createElement("span");s.className="ace_inline_button ace_keyword ace_toggle_wrap",s.textContent=i?"":"",e.appendChild(s)},this.$renderLine=function(e,t,n){!n&&n!=0&&(n=this.session.getFoldLine(t));if(n)var r=this.$getFoldLineTokens(t,n);else var r=this.session.getTokens(t);var i=e;if(r.length){var s=this.session.getRowSplitData(t);if(s&&s.length){this.$renderWrappedLine(e,r,s);var i=e.lastChild}else{var i=e;this.$useLineGroups()&&(i=this.$createLineElement(),e.appendChild(i)),this.$renderSimpleLine(i,r)}}else this.$useLineGroups()&&(i=this.$createLineElement(),e.appendChild(i));if(this.showEOL&&i){n&&(t=n.end.row);var o=this.dom.createElement("span");o.className="ace_invisible ace_invisible_eol",o.textContent=t==this.session.getLength()-1?this.EOF_CHAR:this.EOL_CHAR,i.appendChild(o)}},this.$getFoldLineTokens=function(e,t){function i(e,t,n){var i=0,s=0;while(s+e[i].value.lengthn-t&&(o=o.substring(0,n-t)),r.push({type:e[i].type,value:o}),s=t+o.length,i+=1}while(sn?r.push({type:e[i].type,value:o.substring(0,n-s)}):r.push(e[i]),s+=o.length,i+=1}}var n=this.session,r=[],s=n.getTokens(e);return t.walk(function(e,t,o,u,a){e!=null?r.push({type:"fold",value:e}):(a&&(s=n.getTokens(t)),s.length&&i(s,u,o))},t.end.row,this.session.getLine(t.end.row).length),r},this.$useLineGroups=function(){return this.session.getUseWrapMode()},this.destroy=function(){}}).call(a.prototype),t.Text=a}),define("ace/layer/cursor",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";var r=e("../lib/dom"),i=function(e){this.element=r.createElement("div"),this.element.className="ace_layer ace_cursor-layer",e.appendChild(this.element),this.isVisible=!1,this.isBlinking=!0,this.blinkInterval=1e3,this.smoothBlinking=!1,this.cursors=[],this.cursor=this.addCursor(),r.addCssClass(this.element,"ace_hidden-cursors"),this.$updateCursors=this.$updateOpacity.bind(this)};(function(){this.$updateOpacity=function(e){var t=this.cursors;for(var n=t.length;n--;)r.setStyle(t[n].style,"opacity",e?"":"0")},this.$startCssAnimation=function(){var e=this.cursors;for(var t=e.length;t--;)e[t].style.animationDuration=this.blinkInterval+"ms";setTimeout(function(){r.addCssClass(this.element,"ace_animate-blinking")}.bind(this))},this.$stopCssAnimation=function(){r.removeCssClass(this.element,"ace_animate-blinking")},this.$padding=0,this.setPadding=function(e){this.$padding=e},this.setSession=function(e){this.session=e},this.setBlinking=function(e){e!=this.isBlinking&&(this.isBlinking=e,this.restartTimer())},this.setBlinkInterval=function(e){e!=this.blinkInterval&&(this.blinkInterval=e,this.restartTimer())},this.setSmoothBlinking=function(e){e!=this.smoothBlinking&&(this.smoothBlinking=e,r.setCssClass(this.element,"ace_smooth-blinking",e),this.$updateCursors(!0),this.restartTimer())},this.addCursor=function(){var e=r.createElement("div");return e.className="ace_cursor",this.element.appendChild(e),this.cursors.push(e),e},this.removeCursor=function(){if(this.cursors.length>1){var e=this.cursors.pop();return e.parentNode.removeChild(e),e}},this.hideCursor=function(){this.isVisible=!1,r.addCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.showCursor=function(){this.isVisible=!0,r.removeCssClass(this.element,"ace_hidden-cursors"),this.restartTimer()},this.restartTimer=function(){var e=this.$updateCursors;clearInterval(this.intervalId),clearTimeout(this.timeoutId),this.$stopCssAnimation(),this.smoothBlinking&&r.removeCssClass(this.element,"ace_smooth-blinking"),e(!0);if(!this.isBlinking||!this.blinkInterval||!this.isVisible){this.$stopCssAnimation();return}this.smoothBlinking&&setTimeout(function(){r.addCssClass(this.element,"ace_smooth-blinking")}.bind(this));if(r.HAS_CSS_ANIMATION)this.$startCssAnimation();else{var t=function(){this.timeoutId=setTimeout(function(){e(!1)},.6*this.blinkInterval)}.bind(this);this.intervalId=setInterval(function(){e(!0),t()},this.blinkInterval),t()}},this.getPixelPosition=function(e,t){if(!this.config||!this.session)return{left:0,top:0};e||(e=this.session.selection.getCursor());var n=this.session.documentToScreenPosition(e),r=this.$padding+(this.session.$bidiHandler.isBidiRow(n.row,e.row)?this.session.$bidiHandler.getPosLeft(n.column):n.column*this.config.characterWidth),i=(n.row-(t?this.config.firstRowScreen:0))*this.config.lineHeight;return{left:r,top:i}},this.isCursorInView=function(e,t){return e.top>=0&&e.tope.height+e.offset||o.top<0)&&n>1)continue;var u=this.cursors[i++]||this.addCursor(),a=u.style;this.drawCursor?this.drawCursor(u,o,e,t[n],this.session):this.isCursorInView(o,e)?(r.setStyle(a,"display","block"),r.translate(u,o.left,o.top),r.setStyle(a,"width",Math.round(e.characterWidth)+"px"),r.setStyle(a,"height",e.lineHeight+"px")):r.setStyle(a,"display","none")}while(this.cursors.length>i)this.removeCursor();var f=this.session.getOverwrite();this.$setOverwrite(f),this.$pixelPos=o,this.restartTimer()},this.drawCursor=null,this.$setOverwrite=function(e){e!=this.overwrite&&(this.overwrite=e,e?r.addCssClass(this.element,"ace_overwrite-cursors"):r.removeCssClass(this.element,"ace_overwrite-cursors"))},this.destroy=function(){clearInterval(this.intervalId),clearTimeout(this.timeoutId)}}).call(i.prototype),t.Cursor=i}),define("ace/scrollbar",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/event","ace/lib/event_emitter"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./lib/event"),o=e("./lib/event_emitter").EventEmitter,u=32768,a=function(e){this.element=i.createElement("div"),this.element.className="ace_scrollbar ace_scrollbar"+this.classSuffix,this.inner=i.createElement("div"),this.inner.className="ace_scrollbar-inner",this.inner.textContent="\u00a0",this.element.appendChild(this.inner),e.appendChild(this.element),this.setVisible(!1),this.skipEvent=!1,s.addListener(this.element,"scroll",this.onScroll.bind(this)),s.addListener(this.element,"mousedown",s.preventDefault)};(function(){r.implement(this,o),this.setVisible=function(e){this.element.style.display=e?"":"none",this.isVisible=e,this.coeff=1}}).call(a.prototype);var f=function(e,t){a.call(this,e),this.scrollTop=0,this.scrollHeight=0,t.$scrollbarWidth=this.width=i.scrollbarWidth(e.ownerDocument),this.inner.style.width=this.element.style.width=(this.width||15)+5+"px",this.$minWidth=0};r.inherits(f,a),function(){this.classSuffix="-v",this.onScroll=function(){if(!this.skipEvent){this.scrollTop=this.element.scrollTop;if(this.coeff!=1){var e=this.element.clientHeight/this.scrollHeight;this.scrollTop=this.scrollTop*(1-e)/(this.coeff-e)}this._emit("scroll",{data:this.scrollTop})}this.skipEvent=!1},this.getWidth=function(){return Math.max(this.isVisible?this.width:0,this.$minWidth||0)},this.setHeight=function(e){this.element.style.height=e+"px"},this.setInnerHeight=this.setScrollHeight=function(e){this.scrollHeight=e,e>u?(this.coeff=u/e,e=u):this.coeff!=1&&(this.coeff=1),this.inner.style.height=e+"px"},this.setScrollTop=function(e){this.scrollTop!=e&&(this.skipEvent=!0,this.scrollTop=e,this.element.scrollTop=e*this.coeff)}}.call(f.prototype);var l=function(e,t){a.call(this,e),this.scrollLeft=0,this.height=t.$scrollbarWidth,this.inner.style.height=this.element.style.height=(this.height||15)+5+"px"};r.inherits(l,a),function(){this.classSuffix="-h",this.onScroll=function(){this.skipEvent||(this.scrollLeft=this.element.scrollLeft,this._emit("scroll",{data:this.scrollLeft})),this.skipEvent=!1},this.getHeight=function(){return this.isVisible?this.height:0},this.setWidth=function(e){this.element.style.width=e+"px"},this.setInnerWidth=function(e){this.inner.style.width=e+"px"},this.setScrollWidth=function(e){this.inner.style.width=e+"px"},this.setScrollLeft=function(e){this.scrollLeft!=e&&(this.skipEvent=!0,this.scrollLeft=this.element.scrollLeft=e)}}.call(l.prototype),t.ScrollBar=f,t.ScrollBarV=f,t.ScrollBarH=l,t.VScrollBar=f,t.HScrollBar=l}),define("ace/renderloop",["require","exports","module","ace/lib/event"],function(e,t,n){"use strict";var r=e("./lib/event"),i=function(e,t){this.onRender=e,this.pending=!1,this.changes=0,this.$recursionLimit=2,this.window=t||window;var n=this;this._flush=function(e){n.pending=!1;var t=n.changes;t&&(r.blockIdle(100),n.changes=0,n.onRender(t));if(n.changes){if(n.$recursionLimit--<0)return;n.schedule()}else n.$recursionLimit=2}};(function(){this.schedule=function(e){this.changes=this.changes|e,this.changes&&!this.pending&&(r.nextFrame(this._flush),this.pending=!0)},this.clear=function(e){var t=this.changes;return this.changes=0,t}}).call(i.prototype),t.RenderLoop=i}),define("ace/layer/font_metrics",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/lib/lang","ace/lib/event","ace/lib/useragent","ace/lib/event_emitter"],function(e,t,n){var r=e("../lib/oop"),i=e("../lib/dom"),s=e("../lib/lang"),o=e("../lib/event"),u=e("../lib/useragent"),a=e("../lib/event_emitter").EventEmitter,f=256,l=typeof ResizeObserver=="function",c=200,h=t.FontMetrics=function(e){this.el=i.createElement("div"),this.$setMeasureNodeStyles(this.el.style,!0),this.$main=i.createElement("div"),this.$setMeasureNodeStyles(this.$main.style),this.$measureNode=i.createElement("div"),this.$setMeasureNodeStyles(this.$measureNode.style),this.el.appendChild(this.$main),this.el.appendChild(this.$measureNode),e.appendChild(this.el),this.$measureNode.textContent=s.stringRepeat("X",f),this.$characterSize={width:0,height:0},l?this.$addObserver():this.checkForSizeChanges()};(function(){r.implement(this,a),this.$characterSize={width:0,height:0},this.$setMeasureNodeStyles=function(e,t){e.width=e.height="auto",e.left=e.top="0px",e.visibility="hidden",e.position="absolute",e.whiteSpace="pre",u.isIE<8?e["font-family"]="inherit":e.font="inherit",e.overflow=t?"hidden":"visible"},this.checkForSizeChanges=function(e){e===undefined&&(e=this.$measureSizes());if(e&&(this.$characterSize.width!==e.width||this.$characterSize.height!==e.height)){this.$measureNode.style.fontWeight="bold";var t=this.$measureSizes();this.$measureNode.style.fontWeight="",this.$characterSize=e,this.charSizes=Object.create(null),this.allowBoldFonts=t&&t.width===e.width&&t.height===e.height,this._emit("changeCharacterSize",{data:e})}},this.$addObserver=function(){var e=this;this.$observer=new window.ResizeObserver(function(t){e.checkForSizeChanges()}),this.$observer.observe(this.$measureNode)},this.$pollSizeChanges=function(){if(this.$pollSizeChangesTimer||this.$observer)return this.$pollSizeChangesTimer;var e=this;return this.$pollSizeChangesTimer=o.onIdle(function t(){e.checkForSizeChanges(),o.onIdle(t,500)},500)},this.setPolling=function(e){e?this.$pollSizeChanges():this.$pollSizeChangesTimer&&(clearInterval(this.$pollSizeChangesTimer),this.$pollSizeChangesTimer=0)},this.$measureSizes=function(e){var t={height:(e||this.$measureNode).clientHeight,width:(e||this.$measureNode).clientWidth/f};return t.width===0||t.height===0?null:t},this.$measureCharWidth=function(e){this.$main.textContent=s.stringRepeat(e,f);var t=this.$main.getBoundingClientRect();return t.width/f},this.getCharacterWidth=function(e){var t=this.charSizes[e];return t===undefined&&(t=this.charSizes[e]=this.$measureCharWidth(e)/this.$characterSize.width),t},this.destroy=function(){clearInterval(this.$pollSizeChangesTimer),this.$observer&&this.$observer.disconnect(),this.el&&this.el.parentNode&&this.el.parentNode.removeChild(this.el)},this.$getZoom=function e(t){return!t||!t.parentElement?1:(window.getComputedStyle(t).zoom||1)*e(t.parentElement)},this.$initTransformMeasureNodes=function(){var e=function(e,t){return["div",{style:"position: absolute;top:"+e+"px;left:"+t+"px;"}]};this.els=i.buildDom([e(0,0),e(c,0),e(0,c),e(c,c)],this.el)},this.transformCoordinates=function(e,t){function r(e,t,n){var r=e[1]*t[0]-e[0]*t[1];return[(-t[1]*n[0]+t[0]*n[1])/r,(+e[1]*n[0]-e[0]*n[1])/r]}function i(e,t){return[e[0]-t[0],e[1]-t[1]]}function s(e,t){return[e[0]+t[0],e[1]+t[1]]}function o(e,t){return[e*t[0],e*t[1]]}function u(e){var t=e.getBoundingClientRect();return[t.left,t.top]}if(e){var n=this.$getZoom(this.el);e=o(1/n,e)}this.els||this.$initTransformMeasureNodes();var a=u(this.els[0]),f=u(this.els[1]),l=u(this.els[2]),h=u(this.els[3]),p=r(i(h,f),i(h,l),i(s(f,l),s(h,a))),d=o(1+p[0],i(f,a)),v=o(1+p[1],i(l,a));if(t){var m=t,g=p[0]*m[0]/c+p[1]*m[1]/c+1,y=s(o(m[0],d),o(m[1],v));return s(o(1/g/c,y),a)}var b=i(e,a),w=r(i(d,o(p[0],b)),i(v,o(p[1],b)),b);return o(c,w)}}).call(h.prototype)}),define("ace/virtual_renderer",["require","exports","module","ace/lib/oop","ace/lib/dom","ace/config","ace/layer/gutter","ace/layer/marker","ace/layer/text","ace/layer/cursor","ace/scrollbar","ace/scrollbar","ace/renderloop","ace/layer/font_metrics","ace/lib/event_emitter","ace/lib/useragent"],function(e,t,n){"use strict";var r=e("./lib/oop"),i=e("./lib/dom"),s=e("./config"),o=e("./layer/gutter").Gutter,u=e("./layer/marker").Marker,a=e("./layer/text").Text,f=e("./layer/cursor").Cursor,l=e("./scrollbar").HScrollBar,c=e("./scrollbar").VScrollBar,h=e("./renderloop").RenderLoop,p=e("./layer/font_metrics").FontMetrics,d=e("./lib/event_emitter").EventEmitter,v='.ace_br1 {border-top-left-radius : 3px;}.ace_br2 {border-top-right-radius : 3px;}.ace_br3 {border-top-left-radius : 3px; border-top-right-radius: 3px;}.ace_br4 {border-bottom-right-radius: 3px;}.ace_br5 {border-top-left-radius : 3px; border-bottom-right-radius: 3px;}.ace_br6 {border-top-right-radius : 3px; border-bottom-right-radius: 3px;}.ace_br7 {border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px;}.ace_br8 {border-bottom-left-radius : 3px;}.ace_br9 {border-top-left-radius : 3px; border-bottom-left-radius: 3px;}.ace_br10{border-top-right-radius : 3px; border-bottom-left-radius: 3px;}.ace_br11{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br12{border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br13{border-top-left-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br14{border-top-right-radius : 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_br15{border-top-left-radius : 3px; border-top-right-radius: 3px; border-bottom-right-radius: 3px; border-bottom-left-radius: 3px;}.ace_editor {position: relative;overflow: hidden;padding: 0;font: 12px/normal \'Monaco\', \'Menlo\', \'Ubuntu Mono\', \'Consolas\', \'source-code-pro\', monospace;direction: ltr;text-align: left;-webkit-tap-highlight-color: rgba(0, 0, 0, 0);}.ace_scroller {position: absolute;overflow: hidden;top: 0;bottom: 0;background-color: inherit;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;cursor: text;}.ace_content {position: absolute;box-sizing: border-box;min-width: 100%;contain: style size layout;font-variant-ligatures: no-common-ligatures;}.ace_dragging .ace_scroller:before{position: absolute;top: 0;left: 0;right: 0;bottom: 0;content: \'\';background: rgba(250, 250, 250, 0.01);z-index: 1000;}.ace_dragging.ace_dark .ace_scroller:before{background: rgba(0, 0, 0, 0.01);}.ace_selecting, .ace_selecting * {cursor: text !important;}.ace_gutter {position: absolute;overflow : hidden;width: auto;top: 0;bottom: 0;left: 0;cursor: default;z-index: 4;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;contain: style size layout;}.ace_gutter-active-line {position: absolute;left: 0;right: 0;}.ace_scroller.ace_scroll-left {box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;}.ace_gutter-cell {position: absolute;top: 0;left: 0;right: 0;padding-left: 19px;padding-right: 6px;background-repeat: no-repeat;}.ace_gutter-cell.ace_error {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAABOFBMVEX/////////QRswFAb/Ui4wFAYwFAYwFAaWGAfDRymzOSH/PxswFAb/SiUwFAYwFAbUPRvjQiDllog5HhHdRybsTi3/Tyv9Tir+Syj/UC3////XurebMBIwFAb/RSHbPx/gUzfdwL3kzMivKBAwFAbbvbnhPx66NhowFAYwFAaZJg8wFAaxKBDZurf/RB6mMxb/SCMwFAYwFAbxQB3+RB4wFAb/Qhy4Oh+4QifbNRcwFAYwFAYwFAb/QRzdNhgwFAYwFAbav7v/Uy7oaE68MBK5LxLewr/r2NXewLswFAaxJw4wFAbkPRy2PyYwFAaxKhLm1tMwFAazPiQwFAaUGAb/QBrfOx3bvrv/VC/maE4wFAbRPBq6MRO8Qynew8Dp2tjfwb0wFAbx6eju5+by6uns4uH9/f36+vr/GkHjAAAAYnRSTlMAGt+64rnWu/bo8eAA4InH3+DwoN7j4eLi4xP99Nfg4+b+/u9B/eDs1MD1mO7+4PHg2MXa347g7vDizMLN4eG+Pv7i5evs/v79yu7S3/DV7/498Yv24eH+4ufQ3Ozu/v7+y13sRqwAAADLSURBVHjaZc/XDsFgGIBhtDrshlitmk2IrbHFqL2pvXf/+78DPokj7+Fz9qpU/9UXJIlhmPaTaQ6QPaz0mm+5gwkgovcV6GZzd5JtCQwgsxoHOvJO15kleRLAnMgHFIESUEPmawB9ngmelTtipwwfASilxOLyiV5UVUyVAfbG0cCPHig+GBkzAENHS0AstVF6bacZIOzgLmxsHbt2OecNgJC83JERmePUYq8ARGkJx6XtFsdddBQgZE2nPR6CICZhawjA4Fb/chv+399kfR+MMMDGOQAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: 2px center;}.ace_gutter-cell.ace_warning {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAAmVBMVEX///8AAAD///8AAAAAAABPSzb/5sAAAAB/blH/73z/ulkAAAAAAAD85pkAAAAAAAACAgP/vGz/rkDerGbGrV7/pkQICAf////e0IsAAAD/oED/qTvhrnUAAAD/yHD/njcAAADuv2r/nz//oTj/p064oGf/zHAAAAA9Nir/tFIAAAD/tlTiuWf/tkIAAACynXEAAAAAAAAtIRW7zBpBAAAAM3RSTlMAABR1m7RXO8Ln31Z36zT+neXe5OzooRDfn+TZ4p3h2hTf4t3k3ucyrN1K5+Xaks52Sfs9CXgrAAAAjklEQVR42o3PbQ+CIBQFYEwboPhSYgoYunIqqLn6/z8uYdH8Vmdnu9vz4WwXgN/xTPRD2+sgOcZjsge/whXZgUaYYvT8QnuJaUrjrHUQreGczuEafQCO/SJTufTbroWsPgsllVhq3wJEk2jUSzX3CUEDJC84707djRc5MTAQxoLgupWRwW6UB5fS++NV8AbOZgnsC7BpEAAAAABJRU5ErkJggg==");background-position: 2px center;}.ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAAJ0Uk5TAAB2k804AAAAPklEQVQY02NgIB68QuO3tiLznjAwpKTgNyDbMegwisCHZUETUZV0ZqOquBpXj2rtnpSJT1AEnnRmL2OgGgAAIKkRQap2htgAAAAASUVORK5CYII=");background-position: 2px center;}.ace_dark .ace_gutter-cell.ace_info {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQBAMAAADt3eJSAAAAJFBMVEUAAAChoaGAgIAqKiq+vr6tra1ZWVmUlJSbm5s8PDxubm56enrdgzg3AAAAAXRSTlMAQObYZgAAAClJREFUeNpjYMAPdsMYHegyJZFQBlsUlMFVCWUYKkAZMxZAGdxlDMQBAG+TBP4B6RyJAAAAAElFTkSuQmCC");}.ace_scrollbar {contain: strict;position: absolute;right: 0;bottom: 0;z-index: 6;}.ace_scrollbar-inner {position: absolute;cursor: text;left: 0;top: 0;}.ace_scrollbar-v{overflow-x: hidden;overflow-y: scroll;top: 0;}.ace_scrollbar-h {overflow-x: scroll;overflow-y: hidden;left: 0;}.ace_print-margin {position: absolute;height: 100%;}.ace_text-input {position: absolute;z-index: 0;width: 0.5em;height: 1em;opacity: 0;background: transparent;-moz-appearance: none;appearance: none;border: none;resize: none;outline: none;overflow: hidden;font: inherit;padding: 0 1px;margin: 0 -1px;contain: strict;-ms-user-select: text;-moz-user-select: text;-webkit-user-select: text;user-select: text;white-space: pre!important;}.ace_text-input.ace_composition {background: transparent;color: inherit;z-index: 1000;opacity: 1;}.ace_composition_placeholder { color: transparent }.ace_composition_marker { border-bottom: 1px solid;position: absolute;border-radius: 0;margin-top: 1px;}[ace_nocontext=true] {transform: none!important;filter: none!important;clip-path: none!important;mask : none!important;contain: none!important;perspective: none!important;mix-blend-mode: initial!important;z-index: auto;}.ace_layer {z-index: 1;position: absolute;overflow: hidden;word-wrap: normal;white-space: pre;height: 100%;width: 100%;box-sizing: border-box;pointer-events: none;}.ace_gutter-layer {position: relative;width: auto;text-align: right;pointer-events: auto;height: 1000000px;contain: style size layout;}.ace_text-layer {font: inherit !important;position: absolute;height: 1000000px;width: 1000000px;contain: style size layout;}.ace_text-layer > .ace_line, .ace_text-layer > .ace_line_group {contain: style size layout;position: absolute;top: 0;left: 0;right: 0;}.ace_hidpi .ace_text-layer,.ace_hidpi .ace_gutter-layer,.ace_hidpi .ace_content,.ace_hidpi .ace_gutter {contain: strict;will-change: transform;}.ace_hidpi .ace_text-layer > .ace_line, .ace_hidpi .ace_text-layer > .ace_line_group {contain: strict;}.ace_cjk {display: inline-block;text-align: center;}.ace_cursor-layer {z-index: 4;}.ace_cursor {z-index: 4;position: absolute;box-sizing: border-box;border-left: 2px solid;transform: translatez(0);}.ace_multiselect .ace_cursor {border-left-width: 1px;}.ace_slim-cursors .ace_cursor {border-left-width: 1px;}.ace_overwrite-cursors .ace_cursor {border-left-width: 0;border-bottom: 1px solid;}.ace_hidden-cursors .ace_cursor {opacity: 0.2;}.ace_hasPlaceholder .ace_hidden-cursors .ace_cursor {opacity: 0;}.ace_smooth-blinking .ace_cursor {transition: opacity 0.18s;}.ace_animate-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: step-end;animation-name: blink-ace-animate;animation-iteration-count: infinite;}.ace_animate-blinking.ace_smooth-blinking .ace_cursor {animation-duration: 1000ms;animation-timing-function: ease-in-out;animation-name: blink-ace-animate-smooth;}@keyframes blink-ace-animate {from, to { opacity: 1; }60% { opacity: 0; }}@keyframes blink-ace-animate-smooth {from, to { opacity: 1; }45% { opacity: 1; }60% { opacity: 0; }85% { opacity: 0; }}.ace_marker-layer .ace_step, .ace_marker-layer .ace_stack {position: absolute;z-index: 3;}.ace_marker-layer .ace_selection {position: absolute;z-index: 5;}.ace_marker-layer .ace_bracket {position: absolute;z-index: 6;}.ace_marker-layer .ace_error_bracket {position: absolute;border-bottom: 1px solid #DE5555;border-radius: 0;}.ace_marker-layer .ace_active-line {position: absolute;z-index: 2;}.ace_marker-layer .ace_selected-word {position: absolute;z-index: 4;box-sizing: border-box;}.ace_line .ace_fold {box-sizing: border-box;display: inline-block;height: 11px;margin-top: -2px;vertical-align: middle;background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACJJREFUeNpi+P//fxgTAwPDBxDxD078RSX+YeEyDFMCIMAAI3INmXiwf2YAAAAASUVORK5CYII=");background-repeat: no-repeat, repeat-x;background-position: center center, top left;color: transparent;border: 1px solid black;border-radius: 2px;cursor: pointer;pointer-events: auto;}.ace_dark .ace_fold {}.ace_fold:hover{background-image:url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABEAAAAJCAYAAADU6McMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJpJREFUeNpi/P//PwOlgAXGYGRklAVSokD8GmjwY1wasKljQpYACtpCFeADcHVQfQyMQAwzwAZI3wJKvCLkfKBaMSClBlR7BOQikCFGQEErIH0VqkabiGCAqwUadAzZJRxQr/0gwiXIal8zQQPnNVTgJ1TdawL0T5gBIP1MUJNhBv2HKoQHHjqNrA4WO4zY0glyNKLT2KIfIMAAQsdgGiXvgnYAAAAASUVORK5CYII="),url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAA3CAYAAADNNiA5AAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAACBJREFUeNpi+P//fz4TAwPDZxDxD5X4i5fLMEwJgAADAEPVDbjNw87ZAAAAAElFTkSuQmCC");}.ace_tooltip {background-color: #FFF;background-image: linear-gradient(to bottom, transparent, rgba(0, 0, 0, 0.1));border: 1px solid gray;border-radius: 1px;box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);color: black;max-width: 100%;padding: 3px 4px;position: fixed;z-index: 999999;box-sizing: border-box;cursor: default;white-space: pre;word-wrap: break-word;line-height: normal;font-style: normal;font-weight: normal;letter-spacing: normal;pointer-events: none;}.ace_folding-enabled > .ace_gutter-cell {padding-right: 13px;}.ace_fold-widget {box-sizing: border-box;margin: 0 -12px 0 1px;display: none;width: 11px;vertical-align: top;background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42mWKsQ0AMAzC8ixLlrzQjzmBiEjp0A6WwBCSPgKAXoLkqSot7nN3yMwR7pZ32NzpKkVoDBUxKAAAAABJRU5ErkJggg==");background-repeat: no-repeat;background-position: center;border-radius: 3px;border: 1px solid transparent;cursor: pointer;}.ace_folding-enabled .ace_fold-widget {display: inline-block; }.ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAANElEQVR42m3HwQkAMAhD0YzsRchFKI7sAikeWkrxwScEB0nh5e7KTPWimZki4tYfVbX+MNl4pyZXejUO1QAAAABJRU5ErkJggg==");}.ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAGCAYAAAAG5SQMAAAAOUlEQVR42jXKwQkAMAgDwKwqKD4EwQ26sSOkVWjgIIHAzPiCgaqiqnJHZnKICBERHN194O5b9vbLuAVRL+l0YWnZAAAAAElFTkSuQmCCXA==");}.ace_fold-widget:hover {border: 1px solid rgba(0, 0, 0, 0.3);background-color: rgba(255, 255, 255, 0.2);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);}.ace_fold-widget:active {border: 1px solid rgba(0, 0, 0, 0.4);background-color: rgba(0, 0, 0, 0.05);box-shadow: 0 1px 1px rgba(255, 255, 255, 0.8);}.ace_dark .ace_fold-widget {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");}.ace_dark .ace_fold-widget.ace_end {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget.ace_closed {background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");}.ace_dark .ace_fold-widget:hover {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);background-color: rgba(255, 255, 255, 0.1);}.ace_dark .ace_fold-widget:active {box-shadow: 0 1px 1px rgba(255, 255, 255, 0.2);}.ace_inline_button {border: 1px solid lightgray;display: inline-block;margin: -1px 8px;padding: 0 5px;pointer-events: auto;cursor: pointer;}.ace_inline_button:hover {border-color: gray;background: rgba(200,200,200,0.2);display: inline-block;pointer-events: auto;}.ace_fold-widget.ace_invalid {background-color: #FFB4B4;border-color: #DE5555;}.ace_fade-fold-widgets .ace_fold-widget {transition: opacity 0.4s ease 0.05s;opacity: 0;}.ace_fade-fold-widgets:hover .ace_fold-widget {transition: opacity 0.05s ease 0.05s;opacity:1;}.ace_underline {text-decoration: underline;}.ace_bold {font-weight: bold;}.ace_nobold .ace_bold {font-weight: normal;}.ace_italic {font-style: italic;}.ace_error-marker {background-color: rgba(255, 0, 0,0.2);position: absolute;z-index: 9;}.ace_highlight-marker {background-color: rgba(255, 255, 0,0.2);position: absolute;z-index: 8;}.ace_mobile-menu {position: absolute;line-height: 1.5;border-radius: 4px;-ms-user-select: none;-moz-user-select: none;-webkit-user-select: none;user-select: none;background: white;box-shadow: 1px 3px 2px grey;border: 1px solid #dcdcdc;color: black;}.ace_dark > .ace_mobile-menu {background: #333;color: #ccc;box-shadow: 1px 3px 2px grey;border: 1px solid #444;}.ace_mobile-button {padding: 2px;cursor: pointer;overflow: hidden;}.ace_mobile-button:hover {background-color: #eee;opacity:1;}.ace_mobile-button:active {background-color: #ddd;}.ace_placeholder {font-family: arial;transform: scale(0.9);transform-origin: left;white-space: pre;opacity: 0.7;margin: 0 10px;}',m=e("./lib/useragent"),g=m.isIE;i.importCssString(v,"ace_editor.css");var y=function(e,t){var n=this;this.container=e||i.createElement("div"),i.addCssClass(this.container,"ace_editor"),i.HI_DPI&&i.addCssClass(this.container,"ace_hidpi"),this.setTheme(t),this.$gutter=i.createElement("div"),this.$gutter.className="ace_gutter",this.container.appendChild(this.$gutter),this.$gutter.setAttribute("aria-hidden",!0),this.scroller=i.createElement("div"),this.scroller.className="ace_scroller",this.container.appendChild(this.scroller),this.content=i.createElement("div"),this.content.className="ace_content",this.scroller.appendChild(this.content),this.$gutterLayer=new o(this.$gutter),this.$gutterLayer.on("changeGutterWidth",this.onGutterResize.bind(this)),this.$markerBack=new u(this.content);var r=this.$textLayer=new a(this.content);this.canvas=r.element,this.$markerFront=new u(this.content),this.$cursorLayer=new f(this.content),this.$horizScroll=!1,this.$vScroll=!1,this.scrollBar=this.scrollBarV=new c(this.container,this),this.scrollBarH=new l(this.container,this),this.scrollBarV.on("scroll",function(e){n.$scrollAnimation||n.session.setScrollTop(e.data-n.scrollMargin.top)}),this.scrollBarH.on("scroll",function(e){n.$scrollAnimation||n.session.setScrollLeft(e.data-n.scrollMargin.left)}),this.scrollTop=0,this.scrollLeft=0,this.cursorPos={row:0,column:0},this.$fontMetrics=new p(this.container),this.$textLayer.$setFontMetrics(this.$fontMetrics),this.$textLayer.on("changeCharacterSize",function(e){n.updateCharacterSize(),n.onResize(!0,n.gutterWidth,n.$size.width,n.$size.height),n._signal("changeCharacterSize",e)}),this.$size={width:0,height:0,scrollerHeight:0,scrollerWidth:0,$dirty:!0},this.layerConfig={width:1,padding:0,firstRow:0,firstRowScreen:0,lastRow:0,lineHeight:0,characterWidth:0,minHeight:1,maxHeight:1,offset:0,height:1,gutterOffset:1},this.scrollMargin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.margin={left:0,right:0,top:0,bottom:0,v:0,h:0},this.$keepTextAreaAtCursor=!m.isIOS,this.$loop=new h(this.$renderChanges.bind(this),this.container.ownerDocument.defaultView),this.$loop.schedule(this.CHANGE_FULL),this.updateCharacterSize(),this.setPadding(4),s.resetOptions(this),s._signal("renderer",this)};(function(){this.CHANGE_CURSOR=1,this.CHANGE_MARKER=2,this.CHANGE_GUTTER=4,this.CHANGE_SCROLL=8,this.CHANGE_LINES=16,this.CHANGE_TEXT=32,this.CHANGE_SIZE=64,this.CHANGE_MARKER_BACK=128,this.CHANGE_MARKER_FRONT=256,this.CHANGE_FULL=512,this.CHANGE_H_SCROLL=1024,r.implement(this,d),this.updateCharacterSize=function(){this.$textLayer.allowBoldFonts!=this.$allowBoldFonts&&(this.$allowBoldFonts=this.$textLayer.allowBoldFonts,this.setStyle("ace_nobold",!this.$allowBoldFonts)),this.layerConfig.characterWidth=this.characterWidth=this.$textLayer.getCharacterWidth(),this.layerConfig.lineHeight=this.lineHeight=this.$textLayer.getLineHeight(),this.$updatePrintMargin(),i.setStyle(this.scroller.style,"line-height",this.lineHeight+"px")},this.setSession=function(e){this.session&&this.session.doc.off("changeNewLineMode",this.onChangeNewLineMode),this.session=e,e&&this.scrollMargin.top&&e.getScrollTop()<=0&&e.setScrollTop(-this.scrollMargin.top),this.$cursorLayer.setSession(e),this.$markerBack.setSession(e),this.$markerFront.setSession(e),this.$gutterLayer.setSession(e),this.$textLayer.setSession(e);if(!e)return;this.$loop.schedule(this.CHANGE_FULL),this.session.$setFontMetrics(this.$fontMetrics),this.scrollBarH.scrollLeft=this.scrollBarV.scrollTop=null,this.onChangeNewLineMode=this.onChangeNewLineMode.bind(this),this.onChangeNewLineMode(),this.session.doc.on("changeNewLineMode",this.onChangeNewLineMode)},this.updateLines=function(e,t,n){t===undefined&&(t=Infinity),this.$changedLines?(this.$changedLines.firstRow>e&&(this.$changedLines.firstRow=e),this.$changedLines.lastRowthis.layerConfig.lastRow)return;this.$loop.schedule(this.CHANGE_LINES)},this.onChangeNewLineMode=function(){this.$loop.schedule(this.CHANGE_TEXT),this.$textLayer.$updateEolChar(),this.session.$bidiHandler.setEolChar(this.$textLayer.EOL_CHAR)},this.onChangeTabSize=function(){this.$loop.schedule(this.CHANGE_TEXT|this.CHANGE_MARKER),this.$textLayer.onChangeTabSize()},this.updateText=function(){this.$loop.schedule(this.CHANGE_TEXT)},this.updateFull=function(e){e?this.$renderChanges(this.CHANGE_FULL,!0):this.$loop.schedule(this.CHANGE_FULL)},this.updateFontSize=function(){this.$textLayer.checkForSizeChanges()},this.$changes=0,this.$updateSizeAsync=function(){this.$loop.pending?this.$size.$dirty=!0:this.onResize()},this.onResize=function(e,t,n,r){if(this.resizing>2)return;this.resizing>0?this.resizing++:this.resizing=e?1:0;var i=this.container;r||(r=i.clientHeight||i.scrollHeight),n||(n=i.clientWidth||i.scrollWidth);var s=this.$updateCachedSize(e,t,n,r);if(!this.$size.scrollerHeight||!n&&!r)return this.resizing=0;e&&(this.$gutterLayer.$padding=null),e?this.$renderChanges(s|this.$changes,!0):this.$loop.schedule(s|this.$changes),this.resizing&&(this.resizing=0),this.scrollBarV.scrollLeft=this.scrollBarV.scrollTop=null},this.$updateCachedSize=function(e,t,n,r){r-=this.$extraHeight||0;var s=0,o=this.$size,u={width:o.width,height:o.height,scrollerHeight:o.scrollerHeight,scrollerWidth:o.scrollerWidth};r&&(e||o.height!=r)&&(o.height=r,s|=this.CHANGE_SIZE,o.scrollerHeight=o.height,this.$horizScroll&&(o.scrollerHeight-=this.scrollBarH.getHeight()),this.scrollBarV.element.style.bottom=this.scrollBarH.getHeight()+"px",s|=this.CHANGE_SCROLL);if(n&&(e||o.width!=n)){s|=this.CHANGE_SIZE,o.width=n,t==null&&(t=this.$showGutter?this.$gutter.offsetWidth:0),this.gutterWidth=t,i.setStyle(this.scrollBarH.element.style,"left",t+"px"),i.setStyle(this.scroller.style,"left",t+this.margin.left+"px"),o.scrollerWidth=Math.max(0,n-t-this.scrollBarV.getWidth()-this.margin.h),i.setStyle(this.$gutter.style,"left",this.margin.left+"px");var a=this.scrollBarV.getWidth()+"px";i.setStyle(this.scrollBarH.element.style,"right",a),i.setStyle(this.scroller.style,"right",a),i.setStyle(this.scroller.style,"bottom",this.scrollBarH.getHeight());if(this.session&&this.session.getUseWrapMode()&&this.adjustWrapLimit()||e)s|=this.CHANGE_FULL}return o.$dirty=!n||!r,s&&this._signal("resize",u),s},this.onGutterResize=function(e){var t=this.$showGutter?e:0;t!=this.gutterWidth&&(this.$changes|=this.$updateCachedSize(!0,t,this.$size.width,this.$size.height)),this.session.getUseWrapMode()&&this.adjustWrapLimit()?this.$loop.schedule(this.CHANGE_FULL):this.$size.$dirty?this.$loop.schedule(this.CHANGE_FULL):this.$computeLayerConfig()},this.adjustWrapLimit=function(){var e=this.$size.scrollerWidth-this.$padding*2,t=Math.floor(e/this.characterWidth);return this.session.adjustWrapLimit(t,this.$showPrintMargin&&this.$printMarginColumn)},this.setAnimatedScroll=function(e){this.setOption("animatedScroll",e)},this.getAnimatedScroll=function(){return this.$animatedScroll},this.setShowInvisibles=function(e){this.setOption("showInvisibles",e),this.session.$bidiHandler.setShowInvisibles(e)},this.getShowInvisibles=function(){return this.getOption("showInvisibles")},this.getDisplayIndentGuides=function(){return this.getOption("displayIndentGuides")},this.setDisplayIndentGuides=function(e){this.setOption("displayIndentGuides",e)},this.setShowPrintMargin=function(e){this.setOption("showPrintMargin",e)},this.getShowPrintMargin=function(){return this.getOption("showPrintMargin")},this.setPrintMarginColumn=function(e){this.setOption("printMarginColumn",e)},this.getPrintMarginColumn=function(){return this.getOption("printMarginColumn")},this.getShowGutter=function(){return this.getOption("showGutter")},this.setShowGutter=function(e){return this.setOption("showGutter",e)},this.getFadeFoldWidgets=function(){return this.getOption("fadeFoldWidgets")},this.setFadeFoldWidgets=function(e){this.setOption("fadeFoldWidgets",e)},this.setHighlightGutterLine=function(e){this.setOption("highlightGutterLine",e)},this.getHighlightGutterLine=function(){return this.getOption("highlightGutterLine")},this.$updatePrintMargin=function(){if(!this.$showPrintMargin&&!this.$printMarginEl)return;if(!this.$printMarginEl){var e=i.createElement("div");e.className="ace_layer ace_print-margin-layer",this.$printMarginEl=i.createElement("div"),this.$printMarginEl.className="ace_print-margin",e.appendChild(this.$printMarginEl),this.content.insertBefore(e,this.content.firstChild)}var t=this.$printMarginEl.style;t.left=Math.round(this.characterWidth*this.$printMarginColumn+this.$padding)+"px",t.visibility=this.$showPrintMargin?"visible":"hidden",this.session&&this.session.$wrap==-1&&this.adjustWrapLimit()},this.getContainerElement=function(){return this.container},this.getMouseEventTarget=function(){return this.scroller},this.getTextAreaContainer=function(){return this.container},this.$moveTextAreaToCursor=function(){if(this.$isMousePressed)return;var e=this.textarea.style,t=this.$composition;if(!this.$keepTextAreaAtCursor&&!t){i.translate(this.textarea,-100,0);return}var n=this.$cursorLayer.$pixelPos;if(!n)return;t&&t.markerRange&&(n=this.$cursorLayer.getPixelPosition(t.markerRange.start,!0));var r=this.layerConfig,s=n.top,o=n.left;s-=r.offset;var u=t&&t.useTextareaForIME?this.lineHeight:g?0:1;if(s<0||s>r.height-u){i.translate(this.textarea,0,0);return}var a=1,f=this.$size.height-u;if(!t)s+=this.lineHeight;else if(t.useTextareaForIME){var l=this.textarea.value;a=this.characterWidth*this.session.$getStringScreenWidth(l)[0]}else s+=this.lineHeight+2;o-=this.scrollLeft,o>this.$size.scrollerWidth-a&&(o=this.$size.scrollerWidth-a),o+=this.gutterWidth+this.margin.left,i.setStyle(e,"height",u+"px"),i.setStyle(e,"width",a+"px"),i.translate(this.textarea,Math.min(o,this.$size.scrollerWidth-a),Math.min(s,f))},this.getFirstVisibleRow=function(){return this.layerConfig.firstRow},this.getFirstFullyVisibleRow=function(){return this.layerConfig.firstRow+(this.layerConfig.offset===0?0:1)},this.getLastFullyVisibleRow=function(){var e=this.layerConfig,t=e.lastRow,n=this.session.documentToScreenRow(t,0)*e.lineHeight;return n-this.session.getScrollTop()>e.height-e.lineHeight?t-1:t},this.getLastVisibleRow=function(){return this.layerConfig.lastRow},this.$padding=null,this.setPadding=function(e){this.$padding=e,this.$textLayer.setPadding(e),this.$cursorLayer.setPadding(e),this.$markerFront.setPadding(e),this.$markerBack.setPadding(e),this.$loop.schedule(this.CHANGE_FULL),this.$updatePrintMargin()},this.setScrollMargin=function(e,t,n,r){var i=this.scrollMargin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,i.top&&this.scrollTop<=0&&this.session&&this.session.setScrollTop(-i.top),this.updateFull()},this.setMargin=function(e,t,n,r){var i=this.margin;i.top=e|0,i.bottom=t|0,i.right=r|0,i.left=n|0,i.v=i.top+i.bottom,i.h=i.left+i.right,this.$updateCachedSize(!0,this.gutterWidth,this.$size.width,this.$size.height),this.updateFull()},this.getHScrollBarAlwaysVisible=function(){return this.$hScrollBarAlwaysVisible},this.setHScrollBarAlwaysVisible=function(e){this.setOption("hScrollBarAlwaysVisible",e)},this.getVScrollBarAlwaysVisible=function(){return this.$vScrollBarAlwaysVisible},this.setVScrollBarAlwaysVisible=function(e){this.setOption("vScrollBarAlwaysVisible",e)},this.$updateScrollBarV=function(){var e=this.layerConfig.maxHeight,t=this.$size.scrollerHeight;!this.$maxLines&&this.$scrollPastEnd&&(e-=(t-this.lineHeight)*this.$scrollPastEnd,this.scrollTop>e-t&&(e=this.scrollTop+t,this.scrollBarV.scrollTop=null)),this.scrollBarV.setScrollHeight(e+this.scrollMargin.v),this.scrollBarV.setScrollTop(this.scrollTop+this.scrollMargin.top)},this.$updateScrollBarH=function(){this.scrollBarH.setScrollWidth(this.layerConfig.width+2*this.$padding+this.scrollMargin.h),this.scrollBarH.setScrollLeft(this.scrollLeft+this.scrollMargin.left)},this.$frozen=!1,this.freeze=function(){this.$frozen=!0},this.unfreeze=function(){this.$frozen=!1},this.$renderChanges=function(e,t){this.$changes&&(e|=this.$changes,this.$changes=0);if(!this.session||!this.container.offsetWidth||this.$frozen||!e&&!t){this.$changes|=e;return}if(this.$size.$dirty)return this.$changes|=e,this.onResize(!0);this.lineHeight||this.$textLayer.checkForSizeChanges(),this._signal("beforeRender",e),this.session&&this.session.$bidiHandler&&this.session.$bidiHandler.updateCharacterWidths(this.$fontMetrics);var n=this.layerConfig;if(e&this.CHANGE_FULL||e&this.CHANGE_SIZE||e&this.CHANGE_TEXT||e&this.CHANGE_LINES||e&this.CHANGE_SCROLL||e&this.CHANGE_H_SCROLL){e|=this.$computeLayerConfig()|this.$loop.clear();if(n.firstRow!=this.layerConfig.firstRow&&n.firstRowScreen==this.layerConfig.firstRowScreen){var r=this.scrollTop+(n.firstRow-this.layerConfig.firstRow)*this.lineHeight;r>0&&(this.scrollTop=r,e|=this.CHANGE_SCROLL,e|=this.$computeLayerConfig()|this.$loop.clear())}n=this.layerConfig,this.$updateScrollBarV(),e&this.CHANGE_H_SCROLL&&this.$updateScrollBarH(),i.translate(this.content,-this.scrollLeft,-n.offset);var s=n.width+2*this.$padding+"px",o=n.minHeight+"px";i.setStyle(this.content.style,"width",s),i.setStyle(this.content.style,"height",o)}e&this.CHANGE_H_SCROLL&&(i.translate(this.content,-this.scrollLeft,-n.offset),this.scroller.className=this.scrollLeft<=0?"ace_scroller":"ace_scroller ace_scroll-left");if(e&this.CHANGE_FULL){this.$changedLines=null,this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}if(e&this.CHANGE_SCROLL){this.$changedLines=null,e&this.CHANGE_TEXT||e&this.CHANGE_LINES?this.$textLayer.update(n):this.$textLayer.scrollLines(n),this.$showGutter&&(e&this.CHANGE_GUTTER||e&this.CHANGE_LINES?this.$gutterLayer.update(n):this.$gutterLayer.scrollLines(n)),this.$markerBack.update(n),this.$markerFront.update(n),this.$cursorLayer.update(n),this.$moveTextAreaToCursor(),this._signal("afterRender",e);return}e&this.CHANGE_TEXT?(this.$changedLines=null,this.$textLayer.update(n),this.$showGutter&&this.$gutterLayer.update(n)):e&this.CHANGE_LINES?(this.$updateLines()||e&this.CHANGE_GUTTER&&this.$showGutter)&&this.$gutterLayer.update(n):e&this.CHANGE_TEXT||e&this.CHANGE_GUTTER?this.$showGutter&&this.$gutterLayer.update(n):e&this.CHANGE_CURSOR&&this.$highlightGutterLine&&this.$gutterLayer.updateLineHighlight(n),e&this.CHANGE_CURSOR&&(this.$cursorLayer.update(n),this.$moveTextAreaToCursor()),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_FRONT)&&this.$markerFront.update(n),e&(this.CHANGE_MARKER|this.CHANGE_MARKER_BACK)&&this.$markerBack.update(n),this._signal("afterRender",e)},this.$autosize=function(){var e=this.session.getScreenLength()*this.lineHeight,t=this.$maxLines*this.lineHeight,n=Math.min(t,Math.max((this.$minLines||1)*this.lineHeight,e))+this.scrollMargin.v+(this.$extraHeight||0);this.$horizScroll&&(n+=this.scrollBarH.getHeight()),this.$maxPixelHeight&&n>this.$maxPixelHeight&&(n=this.$maxPixelHeight);var r=n<=2*this.lineHeight,i=!r&&e>t;if(n!=this.desiredHeight||this.$size.height!=this.desiredHeight||i!=this.$vScroll){i!=this.$vScroll&&(this.$vScroll=i,this.scrollBarV.setVisible(i));var s=this.container.clientWidth;this.container.style.height=n+"px",this.$updateCachedSize(!0,this.$gutterWidth,s,n),this.desiredHeight=n,this._signal("autosize")}},this.$computeLayerConfig=function(){var e=this.session,t=this.$size,n=t.height<=2*this.lineHeight,r=this.session.getScreenLength(),i=r*this.lineHeight,s=this.$getLongestLine(),o=!n&&(this.$hScrollBarAlwaysVisible||t.scrollerWidth-s-2*this.$padding<0),u=this.$horizScroll!==o;u&&(this.$horizScroll=o,this.scrollBarH.setVisible(o));var a=this.$vScroll;this.$maxLines&&this.lineHeight>1&&this.$autosize();var f=t.scrollerHeight+this.lineHeight,l=!this.$maxLines&&this.$scrollPastEnd?(t.scrollerHeight-this.lineHeight)*this.$scrollPastEnd:0;i+=l;var c=this.scrollMargin;this.session.setScrollTop(Math.max(-c.top,Math.min(this.scrollTop,i-t.scrollerHeight+c.bottom))),this.session.setScrollLeft(Math.max(-c.left,Math.min(this.scrollLeft,s+2*this.$padding-t.scrollerWidth+c.right)));var h=!n&&(this.$vScrollBarAlwaysVisible||t.scrollerHeight-i+l<0||this.scrollTop>c.top),p=a!==h;p&&(this.$vScroll=h,this.scrollBarV.setVisible(h));var d=this.scrollTop%this.lineHeight,v=Math.ceil(f/this.lineHeight)-1,m=Math.max(0,Math.round((this.scrollTop-d)/this.lineHeight)),g=m+v,y,b,w=this.lineHeight;m=e.screenToDocumentRow(m,0);var E=e.getFoldLine(m);E&&(m=E.start.row),y=e.documentToScreenRow(m,0),b=e.getRowLength(m)*w,g=Math.min(e.screenToDocumentRow(g,0),e.getLength()-1),f=t.scrollerHeight+e.getRowLength(g)*w+b,d=this.scrollTop-y*w;var S=0;if(this.layerConfig.width!=s||u)S=this.CHANGE_H_SCROLL;if(u||p)S|=this.$updateCachedSize(!0,this.gutterWidth,t.width,t.height),this._signal("scrollbarVisibilityChanged"),p&&(s=this.$getLongestLine());return this.layerConfig={width:s,padding:this.$padding,firstRow:m,firstRowScreen:y,lastRow:g,lineHeight:w,characterWidth:this.characterWidth,minHeight:f,maxHeight:i,offset:d,gutterOffset:w?Math.max(0,Math.ceil((d+t.height-t.scrollerHeight)/w)):0,height:this.$size.scrollerHeight},this.session.$bidiHandler&&this.session.$bidiHandler.setContentWidth(s-this.$padding),S},this.$updateLines=function(){if(!this.$changedLines)return;var e=this.$changedLines.firstRow,t=this.$changedLines.lastRow;this.$changedLines=null;var n=this.layerConfig;if(e>n.lastRow+1)return;if(tthis.$textLayer.MAX_LINE_LENGTH&&(e=this.$textLayer.MAX_LINE_LENGTH+30),Math.max(this.$size.scrollerWidth-2*this.$padding,Math.round(e*this.characterWidth))},this.updateFrontMarkers=function(){this.$markerFront.setMarkers(this.session.getMarkers(!0)),this.$loop.schedule(this.CHANGE_MARKER_FRONT)},this.updateBackMarkers=function(){this.$markerBack.setMarkers(this.session.getMarkers()),this.$loop.schedule(this.CHANGE_MARKER_BACK)},this.addGutterDecoration=function(e,t){this.$gutterLayer.addGutterDecoration(e,t)},this.removeGutterDecoration=function(e,t){this.$gutterLayer.removeGutterDecoration(e,t)},this.updateBreakpoints=function(e){this.$loop.schedule(this.CHANGE_GUTTER)},this.setAnnotations=function(e){this.$gutterLayer.setAnnotations(e),this.$loop.schedule(this.CHANGE_GUTTER)},this.updateCursor=function(){this.$loop.schedule(this.CHANGE_CURSOR)},this.hideCursor=function(){this.$cursorLayer.hideCursor()},this.showCursor=function(){this.$cursorLayer.showCursor()},this.scrollSelectionIntoView=function(e,t,n){this.scrollCursorIntoView(e,n),this.scrollCursorIntoView(t,n)},this.scrollCursorIntoView=function(e,t,n){if(this.$size.scrollerHeight===0)return;var r=this.$cursorLayer.getPixelPosition(e),i=r.left,s=r.top,o=n&&n.top||0,u=n&&n.bottom||0,a=this.$scrollAnimation?this.session.getScrollTop():this.scrollTop;a+o>s?(t&&a+o>s+this.lineHeight&&(s-=t*this.$size.scrollerHeight),s===0&&(s=-this.scrollMargin.top),this.session.setScrollTop(s)):a+this.$size.scrollerHeight-ui?(i=1-this.scrollMargin.top)return!0;if(t>0&&this.session.getScrollTop()+this.$size.scrollerHeight-this.layerConfig.maxHeight<-1+this.scrollMargin.bottom)return!0;if(e<0&&this.session.getScrollLeft()>=1-this.scrollMargin.left)return!0;if(e>0&&this.session.getScrollLeft()+this.$size.scrollerWidth-this.layerConfig.width<-1+this.scrollMargin.right)return!0},this.pixelToScreenCoordinates=function(e,t){var n;if(this.$hasCssTransforms){n={top:0,left:0};var r=this.$fontMetrics.transformCoordinates([e,t]);e=r[1]-this.gutterWidth-this.margin.left,t=r[0]}else n=this.scroller.getBoundingClientRect();var i=e+this.scrollLeft-n.left-this.$padding,s=i/this.characterWidth,o=Math.floor((t+this.scrollTop-n.top)/this.lineHeight),u=this.$blockCursor?Math.floor(s):Math.round(s);return{row:o,column:u,side:s-u>0?1:-1,offsetX:i}},this.screenToTextCoordinates=function(e,t){var n;if(this.$hasCssTransforms){n={top:0,left:0};var r=this.$fontMetrics.transformCoordinates([e,t]);e=r[1]-this.gutterWidth-this.margin.left,t=r[0]}else n=this.scroller.getBoundingClientRect();var i=e+this.scrollLeft-n.left-this.$padding,s=i/this.characterWidth,o=this.$blockCursor?Math.floor(s):Math.round(s),u=Math.floor((t+this.scrollTop-n.top)/this.lineHeight);return this.session.screenToDocumentPosition(u,Math.max(o,0),i)},this.textToScreenCoordinates=function(e,t){var n=this.scroller.getBoundingClientRect(),r=this.session.documentToScreenPosition(e,t),i=this.$padding+(this.session.$bidiHandler.isBidiRow(r.row,e)?this.session.$bidiHandler.getPosLeft(r.column):Math.round(r.column*this.characterWidth)),s=r.row*this.lineHeight;return{pageX:n.left+i-this.scrollLeft,pageY:n.top+s-this.scrollTop}},this.visualizeFocus=function(){i.addCssClass(this.container,"ace_focus")},this.visualizeBlur=function(){i.removeCssClass(this.container,"ace_focus")},this.showComposition=function(e){this.$composition=e,e.cssText||(e.cssText=this.textarea.style.cssText),e.useTextareaForIME==undefined&&(e.useTextareaForIME=this.$useTextareaForIME),this.$useTextareaForIME?(i.addCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText="",this.$moveTextAreaToCursor(),this.$cursorLayer.element.style.display="none"):e.markerId=this.session.addMarker(e.markerRange,"ace_composition_marker","text")},this.setCompositionText=function(e){var t=this.session.selection.cursor;this.addToken(e,"composition_placeholder",t.row,t.column),this.$moveTextAreaToCursor()},this.hideComposition=function(){if(!this.$composition)return;this.$composition.markerId&&this.session.removeMarker(this.$composition.markerId),i.removeCssClass(this.textarea,"ace_composition"),this.textarea.style.cssText=this.$composition.cssText;var e=this.session.selection.cursor;this.removeExtraToken(e.row,e.column),this.$composition=null,this.$cursorLayer.element.style.display=""},this.addToken=function(e,t,n,r){var i=this.session;i.bgTokenizer.lines[n]=null;var s={type:t,value:e},o=i.getTokens(n);if(r==null)o.push(s);else{var u=0;for(var a=0;a50&&e.length>this.$doc.getLength()>>1?this.call("setValue",[this.$doc.getValue()]):this.emit("change",{data:e})}}).call(f.prototype);var l=function(e,t,n){var r=null,i=!1,u=Object.create(s),a=[],l=new f({messageBuffer:a,terminate:function(){},postMessage:function(e){a.push(e);if(!r)return;i?setTimeout(c):c()}});l.setEmitSync=function(e){i=e};var c=function(){var e=a.shift();e.command?r[e.command].apply(r,e.args):e.event&&u._signal(e.event,e.data)};return u.postMessage=function(e){l.onMessage({data:e})},u.callback=function(e,t){this.postMessage({type:"call",id:t,data:e})},u.emit=function(e,t){this.postMessage({type:"event",name:e,data:t})},o.loadModule(["worker",t],function(e){r=new e[n](u);while(a.length)c()}),l};t.UIWorkerClient=l,t.WorkerClient=f,t.createWorker=a}),define("ace/placeholder",["require","exports","module","ace/range","ace/lib/event_emitter","ace/lib/oop"],function(e,t,n){"use strict";var r=e("./range").Range,i=e("./lib/event_emitter").EventEmitter,s=e("./lib/oop"),o=function(e,t,n,r,i,s){var o=this;this.length=t,this.session=e,this.doc=e.getDocument(),this.mainClass=i,this.othersClass=s,this.$onUpdate=this.onUpdate.bind(this),this.doc.on("change",this.$onUpdate),this.$others=r,this.$onCursorChange=function(){setTimeout(function(){o.onCursorChange()})},this.$pos=n;var u=e.getUndoManager().$undoStack||e.getUndoManager().$undostack||{length:-1};this.$undoStackDepth=u.length,this.setup(),e.selection.on("changeCursor",this.$onCursorChange)};(function(){s.implement(this,i),this.setup=function(){var e=this,t=this.doc,n=this.session;this.selectionBefore=n.selection.toJSON(),n.selection.inMultiSelectMode&&n.selection.toSingleRange(),this.pos=t.createAnchor(this.$pos.row,this.$pos.column);var i=this.pos;i.$insertRight=!0,i.detach(),i.markerId=n.addMarker(new r(i.row,i.column,i.row,i.column+this.length),this.mainClass,null,!1),this.others=[],this.$others.forEach(function(n){var r=t.createAnchor(n.row,n.column);r.$insertRight=!0,r.detach(),e.others.push(r)}),n.setUndoSelect(!1)},this.showOtherMarkers=function(){if(this.othersActive)return;var e=this.session,t=this;this.othersActive=!0,this.others.forEach(function(n){n.markerId=e.addMarker(new r(n.row,n.column,n.row,n.column+t.length),t.othersClass,null,!1)})},this.hideOtherMarkers=function(){if(!this.othersActive)return;this.othersActive=!1;for(var e=0;e=this.pos.column&&t.start.column<=this.pos.column+this.length+1,s=t.start.column-this.pos.column;this.updateAnchors(e),i&&(this.length+=n);if(i&&!this.session.$fromUndo)if(e.action==="insert")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};this.doc.insertMergedLines(a,e.lines)}else if(e.action==="remove")for(var o=this.others.length-1;o>=0;o--){var u=this.others[o],a={row:u.row,column:u.column+s};this.doc.remove(new r(a.row,a.column,a.row,a.column-n))}this.$updating=!1,this.updateMarkers()},this.updateAnchors=function(e){this.pos.onChange(e);for(var t=this.others.length;t--;)this.others[t].onChange(e);this.updateMarkers()},this.updateMarkers=function(){if(this.$updating)return;var e=this,t=this.session,n=function(n,i){t.removeMarker(n.markerId),n.markerId=t.addMarker(new r(n.row,n.column,n.row,n.column+e.length),i,null,!1)};n(this.pos,this.mainClass);for(var i=this.others.length;i--;)n(this.others[i],this.othersClass)},this.onCursorChange=function(e){if(this.$updating||!this.session)return;var t=this.session.selection.getCursor();t.row===this.pos.row&&t.column>=this.pos.column&&t.column<=this.pos.column+this.length?(this.showOtherMarkers(),this._emit("cursorEnter",e)):(this.hideOtherMarkers(),this._emit("cursorLeave",e))},this.detach=function(){this.session.removeMarker(this.pos&&this.pos.markerId),this.hideOtherMarkers(),this.doc.off("change",this.$onUpdate),this.session.selection.off("changeCursor",this.$onCursorChange),this.session.setUndoSelect(!0),this.session=null},this.cancel=function(){if(this.$undoStackDepth===-1)return;var e=this.session.getUndoManager(),t=(e.$undoStack||e.$undostack).length-this.$undoStackDepth;for(var n=0;n1?e.multiSelect.joinSelections():e.multiSelect.splitIntoLines()},bindKey:{win:"Ctrl-Alt-L",mac:"Ctrl-Alt-L"},readOnly:!0},{name:"splitSelectionIntoLines",description:"Split into lines",exec:function(e){e.multiSelect.splitIntoLines()},readOnly:!0},{name:"alignCursors",description:"Align cursors",exec:function(e){e.alignCursors()},bindKey:{win:"Ctrl-Alt-A",mac:"Ctrl-Alt-A"},scrollIntoView:"cursor"},{name:"findAll",description:"Find all",exec:function(e){e.findAll()},bindKey:{win:"Ctrl-Alt-K",mac:"Ctrl-Alt-G"},scrollIntoView:"cursor",readOnly:!0}],t.multiSelectCommands=[{name:"singleSelection",description:"Single selection",bindKey:"esc",exec:function(e){e.exitMultiSelectMode()},scrollIntoView:"cursor",readOnly:!0,isAvailable:function(e){return e&&e.inMultiSelectMode}}];var r=e("../keyboard/hash_handler").HashHandler;t.keyboardHandler=new r(t.multiSelectCommands)}),define("ace/multi_select",["require","exports","module","ace/range_list","ace/range","ace/selection","ace/mouse/multi_select_handler","ace/lib/event","ace/lib/lang","ace/commands/multi_select_commands","ace/search","ace/edit_session","ace/editor","ace/config"],function(e,t,n){function h(e,t,n){return c.$options.wrap=!0,c.$options.needle=t,c.$options.backwards=n==-1,c.find(e)}function v(e,t){return e.row==t.row&&e.column==t.column}function m(e){if(e.$multiselectOnSessionChange)return;e.$onAddRange=e.$onAddRange.bind(e),e.$onRemoveRange=e.$onRemoveRange.bind(e),e.$onMultiSelect=e.$onMultiSelect.bind(e),e.$onSingleSelect=e.$onSingleSelect.bind(e),e.$multiselectOnSessionChange=t.onSessionChange.bind(e),e.$checkMultiselectChange=e.$checkMultiselectChange.bind(e),e.$multiselectOnSessionChange(e),e.on("changeSession",e.$multiselectOnSessionChange),e.on("mousedown",o),e.commands.addCommands(f.defaultCommands),g(e)}function g(e){function r(t){n&&(e.renderer.setMouseCursor(""),n=!1)}if(!e.textInput)return;var t=e.textInput.getElement(),n=!1;u.addListener(t,"keydown",function(t){var i=t.keyCode==18&&!(t.ctrlKey||t.shiftKey||t.metaKey);e.$blockSelectEnabled&&i?n||(e.renderer.setMouseCursor("crosshair"),n=!0):n&&r()},e),u.addListener(t,"keyup",r,e),u.addListener(t,"blur",r,e)}var r=e("./range_list").RangeList,i=e("./range").Range,s=e("./selection").Selection,o=e("./mouse/multi_select_handler").onMouseDown,u=e("./lib/event"),a=e("./lib/lang"),f=e("./commands/multi_select_commands");t.commands=f.defaultCommands.concat(f.multiSelectCommands);var l=e("./search").Search,c=new l,p=e("./edit_session").EditSession;(function(){this.getSelectionMarkers=function(){return this.$selectionMarkers}}).call(p.prototype),function(){this.ranges=null,this.rangeList=null,this.addRange=function(e,t){if(!e)return;if(!this.inMultiSelectMode&&this.rangeCount===0){var n=this.toOrientedRange();this.rangeList.add(n),this.rangeList.add(e);if(this.rangeList.ranges.length!=2)return this.rangeList.removeAll(),t||this.fromOrientedRange(e);this.rangeList.removeAll(),this.rangeList.add(n),this.$onAddRange(n)}e.cursor||(e.cursor=e.end);var r=this.rangeList.add(e);return this.$onAddRange(e),r.length&&this.$onRemoveRange(r),this.rangeCount>1&&!this.inMultiSelectMode&&(this._signal("multiSelect"),this.inMultiSelectMode=!0,this.session.$undoSelect=!1,this.rangeList.attach(this.session)),t||this.fromOrientedRange(e)},this.toSingleRange=function(e){e=e||this.ranges[0];var t=this.rangeList.removeAll();t.length&&this.$onRemoveRange(t),e&&this.fromOrientedRange(e)},this.substractPoint=function(e){var t=this.rangeList.substractPoint(e);if(t)return this.$onRemoveRange(t),t[0]},this.mergeOverlappingRanges=function(){var e=this.rangeList.merge();e.length&&this.$onRemoveRange(e)},this.$onAddRange=function(e){this.rangeCount=this.rangeList.ranges.length,this.ranges.unshift(e),this._signal("addRange",{range:e})},this.$onRemoveRange=function(e){this.rangeCount=this.rangeList.ranges.length;if(this.rangeCount==1&&this.inMultiSelectMode){var t=this.rangeList.ranges.pop();e.push(t),this.rangeCount=0}for(var n=e.length;n--;){var r=this.ranges.indexOf(e[n]);this.ranges.splice(r,1)}this._signal("removeRange",{ranges:e}),this.rangeCount===0&&this.inMultiSelectMode&&(this.inMultiSelectMode=!1,this._signal("singleSelect"),this.session.$undoSelect=!0,this.rangeList.detach(this.session)),t=t||this.ranges[0],t&&!t.isEqual(this.getRange())&&this.fromOrientedRange(t)},this.$initRangeList=function(){if(this.rangeList)return;this.rangeList=new r,this.ranges=[],this.rangeCount=0},this.getAllRanges=function(){return this.rangeCount?this.rangeList.ranges.concat():[this.getRange()]},this.splitIntoLines=function(){var e=this.ranges.length?this.ranges:[this.getRange()],t=[];for(var n=0;n1){var e=this.rangeList.ranges,t=e[e.length-1],n=i.fromPoints(e[0].start,t.end);this.toSingleRange(),this.setSelectionRange(n,t.cursor==t.start)}else{var r=this.session.documentToScreenPosition(this.cursor),s=this.session.documentToScreenPosition(this.anchor),o=this.rectangularRangeBlock(r,s);o.forEach(this.addRange,this)}},this.rectangularRangeBlock=function(e,t,n){var r=[],s=e.column0)g--;if(g>0){var y=0;while(r[y].isEmpty())y++}for(var b=g;b>=y;b--)r[b].isEmpty()&&r.splice(b,1)}return r}}.call(s.prototype);var d=e("./editor").Editor;(function(){this.updateSelectionMarkers=function(){this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.addSelectionMarker=function(e){e.cursor||(e.cursor=e.end);var t=this.getSelectionStyle();return e.marker=this.session.addMarker(e,"ace_selection",t),this.session.$selectionMarkers.push(e),this.session.selectionMarkerCount=this.session.$selectionMarkers.length,e},this.removeSelectionMarker=function(e){if(!e.marker)return;this.session.removeMarker(e.marker);var t=this.session.$selectionMarkers.indexOf(e);t!=-1&&this.session.$selectionMarkers.splice(t,1),this.session.selectionMarkerCount=this.session.$selectionMarkers.length},this.removeSelectionMarkers=function(e){var t=this.session.$selectionMarkers;for(var n=e.length;n--;){var r=e[n];if(!r.marker)continue;this.session.removeMarker(r.marker);var i=t.indexOf(r);i!=-1&&t.splice(i,1)}this.session.selectionMarkerCount=t.length},this.$onAddRange=function(e){this.addSelectionMarker(e.range),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onRemoveRange=function(e){this.removeSelectionMarkers(e.ranges),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onMultiSelect=function(e){if(this.inMultiSelectMode)return;this.inMultiSelectMode=!0,this.setStyle("ace_multiselect"),this.keyBinding.addKeyboardHandler(f.keyboardHandler),this.commands.setDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers()},this.$onSingleSelect=function(e){if(this.session.multiSelect.inVirtualMode)return;this.inMultiSelectMode=!1,this.unsetStyle("ace_multiselect"),this.keyBinding.removeKeyboardHandler(f.keyboardHandler),this.commands.removeDefaultHandler("exec",this.$onMultiSelectExec),this.renderer.updateCursor(),this.renderer.updateBackMarkers(),this._emit("changeSelection")},this.$onMultiSelectExec=function(e){var t=e.command,n=e.editor;if(!n.multiSelect)return;if(!t.multiSelectAction){var r=t.exec(n,e.args||{});n.multiSelect.addRange(n.multiSelect.toOrientedRange()),n.multiSelect.mergeOverlappingRanges()}else t.multiSelectAction=="forEach"?r=n.forEachSelection(t,e.args):t.multiSelectAction=="forEachLine"?r=n.forEachSelection(t,e.args,!0):t.multiSelectAction=="single"?(n.exitMultiSelectMode(),r=t.exec(n,e.args||{})):r=t.multiSelectAction(n,e.args||{});return r},this.forEachSelection=function(e,t,n){if(this.inVirtualSelectionMode)return;var r=n&&n.keepOrder,i=n==1||n&&n.$byLines,o=this.session,u=this.selection,a=u.rangeList,f=(r?u:a).ranges,l;if(!f.length)return e.exec?e.exec(this,t||{}):e(this,t||{});var c=u._eventRegistry;u._eventRegistry={};var h=new s(o);this.inVirtualSelectionMode=!0;for(var p=f.length;p--;){if(i)while(p>0&&f[p].start.row==f[p-1].end.row)p--;h.fromOrientedRange(f[p]),h.index=p,this.selection=o.selection=h;var d=e.exec?e.exec(this,t||{}):e(this,t||{});!l&&d!==undefined&&(l=d),h.toOrientedRange(f[p])}h.detach(),this.selection=o.selection=u,this.inVirtualSelectionMode=!1,u._eventRegistry=c,u.mergeOverlappingRanges(),u.ranges[0]&&u.fromOrientedRange(u.ranges[0]);var v=this.renderer.$scrollAnimation;return this.onCursorChange(),this.onSelectionChange(),v&&v.from==v.to&&this.renderer.animateScrolling(v.from),l},this.exitMultiSelectMode=function(){if(!this.inMultiSelectMode||this.inVirtualSelectionMode)return;this.multiSelect.toSingleRange()},this.getSelectedText=function(){var e="";if(this.inMultiSelectMode&&!this.inVirtualSelectionMode){var t=this.multiSelect.rangeList.ranges,n=[];for(var r=0;r0);u<0&&(u=0),f>=c&&(f=c-1)}var p=this.session.removeFullLines(u,f);p=this.$reAlignText(p,l),this.session.insert({row:u,column:0},p.join("\n")+"\n"),l||(o.start.column=0,o.end.column=p[p.length-1].length),this.selection.setRange(o)}else{s.forEach(function(e){t.substractPoint(e.cursor)});var d=0,v=Infinity,m=n.map(function(t){var n=t.cursor,r=e.getLine(n.row),i=r.substr(n.column).search(/\S/g);return i==-1&&(i=0),n.column>d&&(d=n.column),io?e.insert(r,a.stringRepeat(" ",s-o)):e.remove(new i(r.row,r.column,r.row,r.column-s+o)),t.start.column=t.end.column=d,t.start.row=t.end.row=r.row,t.cursor=t.end}),t.fromOrientedRange(n[0]),this.renderer.updateCursor(),this.renderer.updateBackMarkers()}},this.$reAlignText=function(e,t){function u(e){return a.stringRepeat(" ",e)}function f(e){return e[2]?u(i)+e[2]+u(s-e[2].length+o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function l(e){return e[2]?u(i+s-e[2].length)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}function c(e){return e[2]?u(i)+e[2]+u(o)+e[4].replace(/^([=:])\s+/,"$1 "):e[0]}var n=!0,r=!0,i,s,o;return e.map(function(e){var t=e.match(/(\s*)(.*?)(\s*)([=:].*)/);return t?i==null?(i=t[1].length,s=t[2].length,o=t[3].length,t):(i+s+o!=t[1].length+t[2].length+t[3].length&&(r=!1),i!=t[1].length&&(n=!1),i>t[1].length&&(i=t[1].length),st[3].length&&(o=t[3].length),t):[e]}).map(t?f:n?r?l:f:c)}}).call(d.prototype),t.onSessionChange=function(e){var t=e.session;t&&!t.multiSelect&&(t.$selectionMarkers=[],t.selection.$initRangeList(),t.multiSelect=t.selection),this.multiSelect=t&&t.multiSelect;var n=e.oldSession;n&&(n.multiSelect.off("addRange",this.$onAddRange),n.multiSelect.off("removeRange",this.$onRemoveRange),n.multiSelect.off("multiSelect",this.$onMultiSelect),n.multiSelect.off("singleSelect",this.$onSingleSelect),n.multiSelect.lead.off("change",this.$checkMultiselectChange),n.multiSelect.anchor.off("change",this.$checkMultiselectChange)),t&&(t.multiSelect.on("addRange",this.$onAddRange),t.multiSelect.on("removeRange",this.$onRemoveRange),t.multiSelect.on("multiSelect",this.$onMultiSelect),t.multiSelect.on("singleSelect",this.$onSingleSelect),t.multiSelect.lead.on("change",this.$checkMultiselectChange),t.multiSelect.anchor.on("change",this.$checkMultiselectChange)),t&&this.inMultiSelectMode!=t.selection.inMultiSelectMode&&(t.selection.inMultiSelectMode?this.$onMultiSelect():this.$onSingleSelect())},t.MultiSelect=m,e("./config").defineOptions(d.prototype,"editor",{enableMultiselect:{set:function(e){m(this),e?(this.on("changeSession",this.$multiselectOnSessionChange),this.on("mousedown",o)):(this.off("changeSession",this.$multiselectOnSessionChange),this.off("mousedown",o))},value:!0},enableBlockSelect:{set:function(e){this.$blockSelectEnabled=e},value:!0}})}),define("ace/mode/folding/fold_mode",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../../range").Range,i=t.FoldMode=function(){};(function(){this.foldingStartMarker=null,this.foldingStopMarker=null,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);return this.foldingStartMarker.test(r)?"start":t=="markbeginend"&&this.foldingStopMarker&&this.foldingStopMarker.test(r)?"end":""},this.getFoldWidgetRange=function(e,t,n){return null},this.indentationBlock=function(e,t,n){var i=/\S/,s=e.getLine(t),o=s.search(i);if(o==-1)return;var u=n||s.length,a=e.getLength(),f=t,l=t;while(++tf){var p=e.getLine(l).length;return new r(f,u,l,p)}},this.openingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i+1},u=e.$findClosingBracket(t,o,s);if(!u)return;var a=e.foldWidgets[u.row];return a==null&&(a=e.getFoldWidget(u.row)),a=="start"&&u.row>o.row&&(u.row--,u.column=e.getLine(u.row).length),r.fromPoints(o,u)},this.closingBracketBlock=function(e,t,n,i,s){var o={row:n,column:i},u=e.$findOpeningBracket(t,o);if(!u)return;return u.column++,o.column--,r.fromPoints(u,o)}}).call(i.prototype)}),define("ace/theme/textmate",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";t.isDark=!1,t.cssClass="ace-tm",t.cssText='.ace-tm .ace_gutter {background: #f0f0f0;color: #333;}.ace-tm .ace_print-margin {width: 1px;background: #e8e8e8;}.ace-tm .ace_fold {background-color: #6B72E6;}.ace-tm {background-color: #FFFFFF;color: black;}.ace-tm .ace_cursor {color: black;}.ace-tm .ace_invisible {color: rgb(191, 191, 191);}.ace-tm .ace_storage,.ace-tm .ace_keyword {color: blue;}.ace-tm .ace_constant {color: rgb(197, 6, 11);}.ace-tm .ace_constant.ace_buildin {color: rgb(88, 72, 246);}.ace-tm .ace_constant.ace_language {color: rgb(88, 92, 246);}.ace-tm .ace_constant.ace_library {color: rgb(6, 150, 14);}.ace-tm .ace_invalid {background-color: rgba(255, 0, 0, 0.1);color: red;}.ace-tm .ace_support.ace_function {color: rgb(60, 76, 114);}.ace-tm .ace_support.ace_constant {color: rgb(6, 150, 14);}.ace-tm .ace_support.ace_type,.ace-tm .ace_support.ace_class {color: rgb(109, 121, 222);}.ace-tm .ace_keyword.ace_operator {color: rgb(104, 118, 135);}.ace-tm .ace_string {color: rgb(3, 106, 7);}.ace-tm .ace_comment {color: rgb(76, 136, 107);}.ace-tm .ace_comment.ace_doc {color: rgb(0, 102, 255);}.ace-tm .ace_comment.ace_doc.ace_tag {color: rgb(128, 159, 191);}.ace-tm .ace_constant.ace_numeric {color: rgb(0, 0, 205);}.ace-tm .ace_variable {color: rgb(49, 132, 149);}.ace-tm .ace_xml-pe {color: rgb(104, 104, 91);}.ace-tm .ace_entity.ace_name.ace_function {color: #0000A2;}.ace-tm .ace_heading {color: rgb(12, 7, 255);}.ace-tm .ace_list {color:rgb(185, 6, 144);}.ace-tm .ace_meta.ace_tag {color:rgb(0, 22, 142);}.ace-tm .ace_string.ace_regex {color: rgb(255, 0, 0)}.ace-tm .ace_marker-layer .ace_selection {background: rgb(181, 213, 255);}.ace-tm.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px white;}.ace-tm .ace_marker-layer .ace_step {background: rgb(252, 255, 0);}.ace-tm .ace_marker-layer .ace_stack {background: rgb(164, 229, 101);}.ace-tm .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid rgb(192, 192, 192);}.ace-tm .ace_marker-layer .ace_active-line {background: rgba(0, 0, 0, 0.07);}.ace-tm .ace_gutter-active-line {background-color : #dcdcdc;}.ace-tm .ace_marker-layer .ace_selected-word {background: rgb(250, 250, 255);border: 1px solid rgb(200, 200, 250);}.ace-tm .ace_indent-guide {background: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAE0lEQVQImWP4////f4bLly//BwAmVgd1/w11/gAAAABJRU5ErkJggg==") right repeat-y;}',t.$id="ace/theme/textmate";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}),define("ace/line_widgets",["require","exports","module","ace/lib/dom"],function(e,t,n){"use strict";function i(e){this.session=e,this.session.widgetManager=this,this.session.getRowLength=this.getRowLength,this.session.$getWidgetScreenLength=this.$getWidgetScreenLength,this.updateOnChange=this.updateOnChange.bind(this),this.renderWidgets=this.renderWidgets.bind(this),this.measureWidgets=this.measureWidgets.bind(this),this.session._changedWidgets=[],this.$onChangeEditor=this.$onChangeEditor.bind(this),this.session.on("change",this.updateOnChange),this.session.on("changeFold",this.updateOnFold),this.session.on("changeEditor",this.$onChangeEditor)}var r=e("./lib/dom");(function(){this.getRowLength=function(e){var t;return this.lineWidgets?t=this.lineWidgets[e]&&this.lineWidgets[e].rowCount||0:t=0,!this.$useWrapMode||!this.$wrapData[e]?1+t:this.$wrapData[e].length+1+t},this.$getWidgetScreenLength=function(){var e=0;return this.lineWidgets.forEach(function(t){t&&t.rowCount&&!t.hidden&&(e+=t.rowCount)}),e},this.$onChangeEditor=function(e){this.attach(e.editor)},this.attach=function(e){e&&e.widgetManager&&e.widgetManager!=this&&e.widgetManager.detach();if(this.editor==e)return;this.detach(),this.editor=e,e&&(e.widgetManager=this,e.renderer.on("beforeRender",this.measureWidgets),e.renderer.on("afterRender",this.renderWidgets))},this.detach=function(e){var t=this.editor;if(!t)return;this.editor=null,t.widgetManager=null,t.renderer.off("beforeRender",this.measureWidgets),t.renderer.off("afterRender",this.renderWidgets);var n=this.session.lineWidgets;n&&n.forEach(function(e){e&&e.el&&e.el.parentNode&&(e._inDocument=!1,e.el.parentNode.removeChild(e.el))})},this.updateOnFold=function(e,t){var n=t.lineWidgets;if(!n||!e.action)return;var r=e.data,i=r.start.row,s=r.end.row,o=e.action=="add";for(var u=i+1;ut[n].column&&n++,s.unshift(n,0),t.splice.apply(t,s),this.$updateRows()}},this.$updateRows=function(){var e=this.session.lineWidgets;if(!e)return;var t=!0;e.forEach(function(e,n){if(e){t=!1,e.row=n;while(e.$oldWidget)e.$oldWidget.row=n,e=e.$oldWidget}}),t&&(this.session.lineWidgets=null)},this.$registerLineWidget=function(e){this.session.lineWidgets||(this.session.lineWidgets=new Array(this.session.getLength()));var t=this.session.lineWidgets[e.row];return t&&(e.$oldWidget=t,t.el&&t.el.parentNode&&(t.el.parentNode.removeChild(t.el),t._inDocument=!1)),this.session.lineWidgets[e.row]=e,e},this.addLineWidget=function(e){this.$registerLineWidget(e),e.session=this.session;if(!this.editor)return e;var t=this.editor.renderer;e.html&&!e.el&&(e.el=r.createElement("div"),e.el.innerHTML=e.html),e.el&&(r.addCssClass(e.el,"ace_lineWidgetContainer"),e.el.style.position="absolute",e.el.style.zIndex=5,t.container.appendChild(e.el),e._inDocument=!0,e.coverGutter||(e.el.style.zIndex=3),e.pixelHeight==null&&(e.pixelHeight=e.el.offsetHeight)),e.rowCount==null&&(e.rowCount=e.pixelHeight/t.layerConfig.lineHeight);var n=this.session.getFoldAt(e.row,0);e.$fold=n;if(n){var i=this.session.lineWidgets;e.row==n.end.row&&!i[n.start.row]?i[n.start.row]=e:e.hidden=!0}return this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows(),this.renderWidgets(null,t),this.onWidgetChanged(e),e},this.removeLineWidget=function(e){e._inDocument=!1,e.session=null,e.el&&e.el.parentNode&&e.el.parentNode.removeChild(e.el);if(e.editor&&e.editor.destroy)try{e.editor.destroy()}catch(t){}if(this.session.lineWidgets){var n=this.session.lineWidgets[e.row];if(n==e)this.session.lineWidgets[e.row]=e.$oldWidget,e.$oldWidget&&this.onWidgetChanged(e.$oldWidget);else while(n){if(n.$oldWidget==e){n.$oldWidget=e.$oldWidget;break}n=n.$oldWidget}}this.session._emit("changeFold",{data:{start:{row:e.row}}}),this.$updateRows()},this.getWidgetsAtRow=function(e){var t=this.session.lineWidgets,n=t&&t[e],r=[];while(n)r.push(n),n=n.$oldWidget;return r},this.onWidgetChanged=function(e){this.session._changedWidgets.push(e),this.editor&&this.editor.renderer.updateFull()},this.measureWidgets=function(e,t){var n=this.session._changedWidgets,r=t.layerConfig;if(!n||!n.length)return;var i=Infinity;for(var s=0;s0&&!r[i])i--;this.firstRow=n.firstRow,this.lastRow=n.lastRow,t.$cursorLayer.config=n;for(var o=i;o<=s;o++){var u=r[o];if(!u||!u.el)continue;if(u.hidden){u.el.style.top=-100-(u.pixelHeight||0)+"px";continue}u._inDocument||(u._inDocument=!0,t.container.appendChild(u.el));var a=t.$cursorLayer.getPixelPosition({row:o,column:0},!0).top;u.coverLine||(a+=n.lineHeight*this.session.getRowLineCount(u.row)),u.el.style.top=a-n.offset+"px";var f=u.coverGutter?0:t.gutterWidth;u.fixedWidth||(f-=t.scrollLeft),u.el.style.left=f+"px",u.fullWidth&&u.screenWidth&&(u.el.style.minWidth=n.width+2*n.padding+"px"),u.fixedWidth?u.el.style.right=t.scrollBar.getWidth()+"px":u.el.style.right=""}}}).call(i.prototype),t.LineWidgets=i}),define("ace/ext/error_marker",["require","exports","module","ace/line_widgets","ace/lib/dom","ace/range"],function(e,t,n){"use strict";function o(e,t,n){var r=0,i=e.length-1;while(r<=i){var s=r+i>>1,o=n(t,e[s]);if(o>0)r=s+1;else{if(!(o<0))return s;i=s-1}}return-(r+1)}function u(e,t,n){var r=e.getAnnotations().sort(s.comparePoints);if(!r.length)return;var i=o(r,{row:t,column:-1},s.comparePoints);i<0&&(i=-i-1),i>=r.length?i=n>0?0:r.length-1:i===0&&n<0&&(i=r.length-1);var u=r[i];if(!u||!n)return;if(u.row===t){do u=r[i+=n];while(u&&u.row===t);if(!u)return r.slice()}var a=[];t=u.row;do a[n<0?"unshift":"push"](u),u=r[i+=n];while(u&&u.row==t);return a.length&&a}var r=e("../line_widgets").LineWidgets,i=e("../lib/dom"),s=e("../range").Range;t.showErrorMarker=function(e,t){var n=e.session;n.widgetManager||(n.widgetManager=new r(n),n.widgetManager.attach(e));var s=e.getCursorPosition(),o=s.row,a=n.widgetManager.getWidgetsAtRow(o).filter(function(e){return e.type=="errorMarker"})[0];a?a.destroy():o-=t;var f=u(n,o,t),l;if(f){var c=f[0];s.column=(c.pos&&typeof c.column!="number"?c.pos.sc:c.column)||0,s.row=c.row,l=e.renderer.$gutterLayer.$annotations[s.row]}else{if(a)return;l={text:["Looks good!"],className:"ace_ok"}}e.session.unfold(s.row),e.selection.moveToPosition(s);var h={row:s.row,fixedWidth:!0,coverGutter:!0,el:i.createElement("div"),type:"errorMarker"},p=h.el.appendChild(i.createElement("div")),d=h.el.appendChild(i.createElement("div"));d.className="error_widget_arrow "+l.className;var v=e.renderer.$cursorLayer.getPixelPosition(s).left;d.style.left=v+e.renderer.gutterWidth-5+"px",h.el.className="error_widget_wrapper",p.className="error_widget "+l.className,p.innerHTML=l.text.join("
"),p.appendChild(i.createElement("div"));var m=function(e,t,n){if(t===0&&(n==="esc"||n==="return"))return h.destroy(),{command:"null"}};h.destroy=function(){if(e.$mouseHandler.isMousePressed)return;e.keyBinding.removeKeyboardHandler(m),n.widgetManager.removeLineWidget(h),e.off("changeSelection",h.destroy),e.off("changeSession",h.destroy),e.off("mouseup",h.destroy),e.off("change",h.destroy)},e.keyBinding.addKeyboardHandler(m),e.on("changeSelection",h.destroy),e.on("changeSession",h.destroy),e.on("mouseup",h.destroy),e.on("change",h.destroy),e.session.widgetManager.addLineWidget(h),h.el.onmousedown=e.focus.bind(e),e.renderer.scrollCursorIntoView(null,.5,{bottom:h.el.offsetHeight})},i.importCssString(" .error_widget_wrapper { background: inherit; color: inherit; border:none } .error_widget { border-top: solid 2px; border-bottom: solid 2px; margin: 5px 0; padding: 10px 40px; white-space: pre-wrap; } .error_widget.ace_error, .error_widget_arrow.ace_error{ border-color: #ff5a5a } .error_widget.ace_warning, .error_widget_arrow.ace_warning{ border-color: #F1D817 } .error_widget.ace_info, .error_widget_arrow.ace_info{ border-color: #5a5a5a } .error_widget.ace_ok, .error_widget_arrow.ace_ok{ border-color: #5aaa5a } .error_widget_arrow { position: absolute; border: solid 5px; border-top-color: transparent!important; border-right-color: transparent!important; border-left-color: transparent!important; top: -5px; }","")}),define("ace/ace",["require","exports","module","ace/lib/fixoldbrowsers","ace/lib/dom","ace/lib/event","ace/range","ace/editor","ace/edit_session","ace/undomanager","ace/virtual_renderer","ace/worker/worker_client","ace/keyboard/hash_handler","ace/placeholder","ace/multi_select","ace/mode/folding/fold_mode","ace/theme/textmate","ace/ext/error_marker","ace/config"],function(e,t,n){"use strict";e("./lib/fixoldbrowsers");var r=e("./lib/dom"),i=e("./lib/event"),s=e("./range").Range,o=e("./editor").Editor,u=e("./edit_session").EditSession,a=e("./undomanager").UndoManager,f=e("./virtual_renderer").VirtualRenderer;e("./worker/worker_client"),e("./keyboard/hash_handler"),e("./placeholder"),e("./multi_select"),e("./mode/folding/fold_mode"),e("./theme/textmate"),e("./ext/error_marker"),t.config=e("./config"),t.require=e,typeof define=="function"&&(t.define=define),t.edit=function(e,n){if(typeof e=="string"){var s=e;e=document.getElementById(s);if(!e)throw new Error("ace.edit can't find div #"+s)}if(e&&e.env&&e.env.editor instanceof o)return e.env.editor;var u="";if(e&&/input|textarea/i.test(e.tagName)){var a=e;u=a.value,e=r.createElement("pre"),a.parentNode.replaceChild(e,a)}else e&&(u=e.textContent,e.innerHTML="");var l=t.createEditSession(u),c=new o(new f(e),l,n),h={document:l,editor:c,onResize:c.resize.bind(c,null)};return a&&(h.textarea=a),i.addListener(window,"resize",h.onResize),c.on("destroy",function(){i.removeListener(window,"resize",h.onResize),h.editor.container.env=null}),c.container.env=c.env=h,c},t.createEditSession=function(e,t){var n=new u(e,t);return n.setUndoManager(new a),n},t.Range=s,t.Editor=o,t.EditSession=u,t.UndoManager=a,t.VirtualRenderer=f,t.version=t.config.version}); (function() { - window.require(["ace/ace"], function(a) { - if (a) { - a.config.init(true); - a.define = window.define; - } - if (!window.ace) - window.ace = a; - for (var key in a) if (a.hasOwnProperty(key)) - window.ace[key] = a[key]; - window.ace["default"] = window.ace; - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = window.ace; - } - }); - })(); - diff --git a/src/html/ace/mode-javascript.js b/src/html/ace/mode-javascript.js deleted file mode 100644 index f5b49e11a..000000000 --- a/src/html/ace/mode-javascript.js +++ /dev/null @@ -1,8 +0,0 @@ -define("ace/mode/doc_comment_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text_highlight_rules").TextHighlightRules,s=function(){this.$rules={start:[{token:"comment.doc.tag",regex:"@[\\w\\d_]+"},s.getTagRule(),{defaultToken:"comment.doc",caseInsensitive:!0}]}};r.inherits(s,i),s.getTagRule=function(e){return{token:"comment.doc.tag.storage.type",regex:"\\b(?:TODO|FIXME|XXX|HACK)\\b"}},s.getStartRule=function(e){return{token:"comment.doc",regex:"\\/\\*(?=\\*)",next:e}},s.getEndRule=function(e){return{token:"comment.doc",regex:"\\*\\/",next:e}},t.DocCommentHighlightRules=s}),define("ace/mode/javascript_highlight_rules",["require","exports","module","ace/lib/oop","ace/mode/doc_comment_highlight_rules","ace/mode/text_highlight_rules"],function(e,t,n){"use strict";function a(){var e=o.replace("\\d","\\d\\-"),t={onMatch:function(e,t,n){var r=e.charAt(1)=="/"?2:1;if(r==1)t!=this.nextState?n.unshift(this.next,this.nextState,0):n.unshift(this.next),n[2]++;else if(r==2&&t==this.nextState){n[1]--;if(!n[1]||n[1]<0)n.shift(),n.shift()}return[{type:"meta.tag.punctuation."+(r==1?"":"end-")+"tag-open.xml",value:e.slice(0,r)},{type:"meta.tag.tag-name.xml",value:e.substr(r)}]},regex:"",onMatch:function(e,t,n){return t==n[0]&&n.shift(),e.length==2&&(n[0]==this.nextState&&n[1]--,(!n[1]||n[1]<0)&&n.splice(0,2)),this.next=n[0]||"start",[{type:this.token,value:e}]},nextState:"jsx"},n,f("jsxAttributes"),{token:"entity.other.attribute-name.xml",regex:e},{token:"keyword.operator.attribute-equals.xml",regex:"="},{token:"text.tag-whitespace.xml",regex:"\\s+"},{token:"string.attribute-value.xml",regex:"'",stateName:"jsx_attr_q",push:[{token:"string.attribute-value.xml",regex:"'",next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},{token:"string.attribute-value.xml",regex:'"',stateName:"jsx_attr_qq",push:[{token:"string.attribute-value.xml",regex:'"',next:"pop"},{include:"reference"},{defaultToken:"string.attribute-value.xml"}]},t],this.$rules.reference=[{token:"constant.language.escape.reference.xml",regex:"(?:&#[0-9]+;)|(?:&#x[0-9a-fA-F]+;)|(?:&[a-zA-Z0-9_:\\.-]+;)"}]}function f(e){return[{token:"comment",regex:/\/\*/,next:[i.getTagRule(),{token:"comment",regex:"\\*\\/",next:e||"pop"},{defaultToken:"comment",caseInsensitive:!0}]},{token:"comment",regex:"\\/\\/",next:[i.getTagRule(),{token:"comment",regex:"$|^",next:e||"pop"},{defaultToken:"comment",caseInsensitive:!0}]}]}var r=e("../lib/oop"),i=e("./doc_comment_highlight_rules").DocCommentHighlightRules,s=e("./text_highlight_rules").TextHighlightRules,o="[a-zA-Z\\$_\u00a1-\uffff][a-zA-Z\\d\\$_\u00a1-\uffff]*",u=function(e){var t=this.createKeywordMapper({"variable.language":"Array|Boolean|Date|Function|Iterator|Number|Object|RegExp|String|Proxy|Namespace|QName|XML|XMLList|ArrayBuffer|Float32Array|Float64Array|Int16Array|Int32Array|Int8Array|Uint16Array|Uint32Array|Uint8Array|Uint8ClampedArray|Error|EvalError|InternalError|RangeError|ReferenceError|StopIteration|SyntaxError|TypeError|URIError|decodeURI|decodeURIComponent|encodeURI|encodeURIComponent|eval|isFinite|isNaN|parseFloat|parseInt|JSON|Math|this|arguments|prototype|window|document",keyword:"const|yield|import|get|set|async|await|break|case|catch|continue|default|delete|do|else|finally|for|function|if|in|of|instanceof|new|return|switch|throw|try|typeof|let|var|while|with|debugger|__parent__|__count__|escape|unescape|with|__proto__|class|enum|extends|super|export|implements|private|public|interface|package|protected|static","storage.type":"const|let|var|function","constant.language":"null|Infinity|NaN|undefined","support.function":"alert","constant.language.boolean":"true|false"},"identifier"),n="case|do|else|finally|in|instanceof|return|throw|try|typeof|yield|void",r="\\\\(?:x[0-9a-fA-F]{2}|u[0-9a-fA-F]{4}|u{[0-9a-fA-F]{1,6}}|[0-2][0-7]{0,2}|3[0-7][0-7]?|[4-7][0-7]?|.)";this.$rules={no_regex:[i.getStartRule("doc-start"),f("no_regex"),{token:"string",regex:"'(?=.)",next:"qstring"},{token:"string",regex:'"(?=.)',next:"qqstring"},{token:"constant.numeric",regex:/0(?:[xX][0-9a-fA-F]+|[oO][0-7]+|[bB][01]+)\b/},{token:"constant.numeric",regex:/(?:\d\d*(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+\b)?/},{token:["storage.type","punctuation.operator","support.function","punctuation.operator","entity.name.function","text","keyword.operator"],regex:"("+o+")(\\.)(prototype)(\\.)("+o+")(\\s*)(=)",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","keyword.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\s*)(=)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","entity.name.function","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(\\s+)(\\w+)(\\s*)(\\()",next:"function_arguments"},{token:["storage.type","text","entity.name.function","text","paren.lparen"],regex:"(function)(\\s+)("+o+")(\\s*)(\\()",next:"function_arguments"},{token:["entity.name.function","text","punctuation.operator","text","storage.type","text","paren.lparen"],regex:"("+o+")(\\s*)(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:["text","text","storage.type","text","paren.lparen"],regex:"(:)(\\s*)(function)(\\s*)(\\()",next:"function_arguments"},{token:"keyword",regex:"from(?=\\s*('|\"))"},{token:"keyword",regex:"(?:"+n+")\\b",next:"start"},{token:["support.constant"],regex:/that\b/},{token:["storage.type","punctuation.operator","support.function.firebug"],regex:/(console)(\.)(warn|info|log|error|time|trace|timeEnd|assert)\b/},{token:t,regex:o},{token:"punctuation.operator",regex:/[.](?![.])/,next:"property"},{token:"storage.type",regex:/=>/,next:"start"},{token:"keyword.operator",regex:/--|\+\+|\.{3}|===|==|=|!=|!==|<+=?|>+=?|!|&&|\|\||\?:|[!$%&*+\-~\/^]=?/,next:"start"},{token:"punctuation.operator",regex:/[?:,;.]/,next:"start"},{token:"paren.lparen",regex:/[\[({]/,next:"start"},{token:"paren.rparen",regex:/[\])}]/},{token:"comment",regex:/^#!.*$/}],property:[{token:"text",regex:"\\s+"},{token:["storage.type","punctuation.operator","entity.name.function","text","keyword.operator","text","storage.type","text","entity.name.function","text","paren.lparen"],regex:"("+o+")(\\.)("+o+")(\\s*)(=)(\\s*)(function)(?:(\\s+)(\\w+))?(\\s*)(\\()",next:"function_arguments"},{token:"punctuation.operator",regex:/[.](?![.])/},{token:"support.function",regex:/(s(?:h(?:ift|ow(?:Mod(?:elessDialog|alDialog)|Help))|croll(?:X|By(?:Pages|Lines)?|Y|To)?|t(?:op|rike)|i(?:n|zeToContent|debar|gnText)|ort|u(?:p|b(?:str(?:ing)?)?)|pli(?:ce|t)|e(?:nd|t(?:Re(?:sizable|questHeader)|M(?:i(?:nutes|lliseconds)|onth)|Seconds|Ho(?:tKeys|urs)|Year|Cursor|Time(?:out)?|Interval|ZOptions|Date|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Date|FullYear)|FullYear|Active)|arch)|qrt|lice|avePreferences|mall)|h(?:ome|andleEvent)|navigate|c(?:har(?:CodeAt|At)|o(?:s|n(?:cat|textual|firm)|mpile)|eil|lear(?:Timeout|Interval)?|a(?:ptureEvents|ll)|reate(?:StyleSheet|Popup|EventObject))|t(?:o(?:GMTString|S(?:tring|ource)|U(?:TCString|pperCase)|Lo(?:caleString|werCase))|est|a(?:n|int(?:Enabled)?))|i(?:s(?:NaN|Finite)|ndexOf|talics)|d(?:isableExternalCapture|ump|etachEvent)|u(?:n(?:shift|taint|escape|watch)|pdateCommands)|j(?:oin|avaEnabled)|p(?:o(?:p|w)|ush|lugins.refresh|a(?:ddings|rse(?:Int|Float)?)|r(?:int|ompt|eference))|e(?:scape|nableExternalCapture|val|lementFromPoint|x(?:p|ec(?:Script|Command)?))|valueOf|UTC|queryCommand(?:State|Indeterm|Enabled|Value)|f(?:i(?:nd|le(?:ModifiedDate|Size|CreatedDate|UpdatedDate)|xed)|o(?:nt(?:size|color)|rward)|loor|romCharCode)|watch|l(?:ink|o(?:ad|g)|astIndexOf)|a(?:sin|nchor|cos|t(?:tachEvent|ob|an(?:2)?)|pply|lert|b(?:s|ort))|r(?:ou(?:nd|teEvents)|e(?:size(?:By|To)|calc|turnValue|place|verse|l(?:oad|ease(?:Capture|Events)))|andom)|g(?:o|et(?:ResponseHeader|M(?:i(?:nutes|lliseconds)|onth)|Se(?:conds|lection)|Hours|Year|Time(?:zoneOffset)?|Da(?:y|te)|UTC(?:M(?:i(?:nutes|lliseconds)|onth)|Seconds|Hours|Da(?:y|te)|FullYear)|FullYear|A(?:ttention|llResponseHeaders)))|m(?:in|ove(?:B(?:y|elow)|To(?:Absolute)?|Above)|ergeAttributes|a(?:tch|rgins|x))|b(?:toa|ig|o(?:ld|rderWidths)|link|ack))\b(?=\()/},{token:"support.function.dom",regex:/(s(?:ub(?:stringData|mit)|plitText|e(?:t(?:NamedItem|Attribute(?:Node)?)|lect))|has(?:ChildNodes|Feature)|namedItem|c(?:l(?:ick|o(?:se|neNode))|reate(?:C(?:omment|DATASection|aption)|T(?:Head|extNode|Foot)|DocumentFragment|ProcessingInstruction|E(?:ntityReference|lement)|Attribute))|tabIndex|i(?:nsert(?:Row|Before|Cell|Data)|tem)|open|delete(?:Row|C(?:ell|aption)|T(?:Head|Foot)|Data)|focus|write(?:ln)?|a(?:dd|ppend(?:Child|Data))|re(?:set|place(?:Child|Data)|move(?:NamedItem|Child|Attribute(?:Node)?)?)|get(?:NamedItem|Element(?:sBy(?:Name|TagName|ClassName)|ById)|Attribute(?:Node)?)|blur)\b(?=\()/},{token:"support.constant",regex:/(s(?:ystemLanguage|cr(?:ipts|ollbars|een(?:X|Y|Top|Left))|t(?:yle(?:Sheets)?|atus(?:Text|bar)?)|ibling(?:Below|Above)|ource|uffixes|e(?:curity(?:Policy)?|l(?:ection|f)))|h(?:istory|ost(?:name)?|as(?:h|Focus))|y|X(?:MLDocument|SLDocument)|n(?:ext|ame(?:space(?:s|URI)|Prop))|M(?:IN_VALUE|AX_VALUE)|c(?:haracterSet|o(?:n(?:structor|trollers)|okieEnabled|lorDepth|mp(?:onents|lete))|urrent|puClass|l(?:i(?:p(?:boardData)?|entInformation)|osed|asses)|alle(?:e|r)|rypto)|t(?:o(?:olbar|p)|ext(?:Transform|Indent|Decoration|Align)|ags)|SQRT(?:1_2|2)|i(?:n(?:ner(?:Height|Width)|put)|ds|gnoreCase)|zIndex|o(?:scpu|n(?:readystatechange|Line)|uter(?:Height|Width)|p(?:sProfile|ener)|ffscreenBuffering)|NEGATIVE_INFINITY|d(?:i(?:splay|alog(?:Height|Top|Width|Left|Arguments)|rectories)|e(?:scription|fault(?:Status|Ch(?:ecked|arset)|View)))|u(?:ser(?:Profile|Language|Agent)|n(?:iqueID|defined)|pdateInterval)|_content|p(?:ixelDepth|ort|ersonalbar|kcs11|l(?:ugins|atform)|a(?:thname|dding(?:Right|Bottom|Top|Left)|rent(?:Window|Layer)?|ge(?:X(?:Offset)?|Y(?:Offset)?))|r(?:o(?:to(?:col|type)|duct(?:Sub)?|mpter)|e(?:vious|fix)))|e(?:n(?:coding|abledPlugin)|x(?:ternal|pando)|mbeds)|v(?:isibility|endor(?:Sub)?|Linkcolor)|URLUnencoded|P(?:I|OSITIVE_INFINITY)|f(?:ilename|o(?:nt(?:Size|Family|Weight)|rmName)|rame(?:s|Element)|gColor)|E|whiteSpace|l(?:i(?:stStyleType|n(?:eHeight|kColor))|o(?:ca(?:tion(?:bar)?|lName)|wsrc)|e(?:ngth|ft(?:Context)?)|a(?:st(?:M(?:odified|atch)|Index|Paren)|yer(?:s|X)|nguage))|a(?:pp(?:MinorVersion|Name|Co(?:deName|re)|Version)|vail(?:Height|Top|Width|Left)|ll|r(?:ity|guments)|Linkcolor|bove)|r(?:ight(?:Context)?|e(?:sponse(?:XML|Text)|adyState))|global|x|m(?:imeTypes|ultiline|enubar|argin(?:Right|Bottom|Top|Left))|L(?:N(?:10|2)|OG(?:10E|2E))|b(?:o(?:ttom|rder(?:Width|RightWidth|BottomWidth|Style|Color|TopWidth|LeftWidth))|ufferDepth|elow|ackground(?:Color|Image)))\b/},{token:"identifier",regex:o},{regex:"",token:"empty",next:"no_regex"}],start:[i.getStartRule("doc-start"),f("start"),{token:"string.regexp",regex:"\\/",next:"regex"},{token:"text",regex:"\\s+|^$",next:"start"},{token:"empty",regex:"",next:"no_regex"}],regex:[{token:"regexp.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"string.regexp",regex:"/[sxngimy]*",next:"no_regex"},{token:"invalid",regex:/\{\d+\b,?\d*\}[+*]|[+*$^?][+*]|[$^][?]|\?{3,}/},{token:"constant.language.escape",regex:/\(\?[:=!]|\)|\{\d+\b,?\d*\}|[+*]\?|[()$^+*?.]/},{token:"constant.language.delimiter",regex:/\|/},{token:"constant.language.escape",regex:/\[\^?/,next:"regex_character_class"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp"}],regex_character_class:[{token:"regexp.charclass.keyword.operator",regex:"\\\\(?:u[\\da-fA-F]{4}|x[\\da-fA-F]{2}|.)"},{token:"constant.language.escape",regex:"]",next:"regex"},{token:"constant.language.escape",regex:"-"},{token:"empty",regex:"$",next:"no_regex"},{defaultToken:"string.regexp.charachterclass"}],function_arguments:[{token:"variable.parameter",regex:o},{token:"punctuation.operator",regex:"[, ]+"},{token:"punctuation.operator",regex:"$"},{token:"empty",regex:"",next:"no_regex"}],qqstring:[{token:"constant.language.escape",regex:r},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:'"|$',next:"no_regex"},{defaultToken:"string"}],qstring:[{token:"constant.language.escape",regex:r},{token:"string",regex:"\\\\$",consumeLineEnd:!0},{token:"string",regex:"'|$",next:"no_regex"},{defaultToken:"string"}]};if(!e||!e.noES6)this.$rules.no_regex.unshift({regex:"[{}]",onMatch:function(e,t,n){this.next=e=="{"?this.nextState:"";if(e=="{"&&n.length)n.unshift("start",t);else if(e=="}"&&n.length){n.shift(),this.next=n.shift();if(this.next.indexOf("string")!=-1||this.next.indexOf("jsx")!=-1)return"paren.quasi.end"}return e=="{"?"paren.lparen":"paren.rparen"},nextState:"start"},{token:"string.quasi.start",regex:/`/,push:[{token:"constant.language.escape",regex:r},{token:"paren.quasi.start",regex:/\${/,push:"start"},{token:"string.quasi.end",regex:/`/,next:"pop"},{defaultToken:"string.quasi"}]}),(!e||e.jsx!=0)&&a.call(this);this.embedRules(i,"doc-",[i.getEndRule("no_regex")]),this.normalizeRules()};r.inherits(u,s),t.JavaScriptHighlightRules=u}),define("ace/mode/matching_brace_outdent",["require","exports","module","ace/range"],function(e,t,n){"use strict";var r=e("../range").Range,i=function(){};(function(){this.checkOutdent=function(e,t){return/^\s+$/.test(e)?/^\s*\}/.test(t):!1},this.autoOutdent=function(e,t){var n=e.getLine(t),i=n.match(/^(\s*\})/);if(!i)return 0;var s=i[1].length,o=e.findMatchingBracket({row:t,column:s});if(!o||o.row==t)return 0;var u=this.$getIndent(e.getLine(o.row));e.replace(new r(t,0,t,s-1),u)},this.$getIndent=function(e){return e.match(/^\s*/)[0]}}).call(i.prototype),t.MatchingBraceOutdent=i}),define("ace/mode/folding/cstyle",["require","exports","module","ace/lib/oop","ace/range","ace/mode/folding/fold_mode"],function(e,t,n){"use strict";var r=e("../../lib/oop"),i=e("../../range").Range,s=e("./fold_mode").FoldMode,o=t.FoldMode=function(e){e&&(this.foldingStartMarker=new RegExp(this.foldingStartMarker.source.replace(/\|[^|]*?$/,"|"+e.start)),this.foldingStopMarker=new RegExp(this.foldingStopMarker.source.replace(/\|[^|]*?$/,"|"+e.end)))};r.inherits(o,s),function(){this.foldingStartMarker=/([\{\[\(])[^\}\]\)]*$|^\s*(\/\*)/,this.foldingStopMarker=/^[^\[\{\(]*([\}\]\)])|^[\s\*]*(\*\/)/,this.singleLineBlockCommentRe=/^\s*(\/\*).*\*\/\s*$/,this.tripleStarBlockCommentRe=/^\s*(\/\*\*\*).*\*\/\s*$/,this.startRegionRe=/^\s*(\/\*|\/\/)#?region\b/,this._getFoldWidgetBase=this.getFoldWidget,this.getFoldWidget=function(e,t,n){var r=e.getLine(n);if(this.singleLineBlockCommentRe.test(r)&&!this.startRegionRe.test(r)&&!this.tripleStarBlockCommentRe.test(r))return"";var i=this._getFoldWidgetBase(e,t,n);return!i&&this.startRegionRe.test(r)?"start":i},this.getFoldWidgetRange=function(e,t,n,r){var i=e.getLine(n);if(this.startRegionRe.test(i))return this.getCommentRegionBlock(e,i,n);var s=i.match(this.foldingStartMarker);if(s){var o=s.index;if(s[1])return this.openingBracketBlock(e,s[1],n,o);var u=e.getCommentFoldRange(n,o+s[0].length,1);return u&&!u.isMultiLine()&&(r?u=this.getSectionRange(e,n):t!="all"&&(u=null)),u}if(t==="markbegin")return;var s=i.match(this.foldingStopMarker);if(s){var o=s.index+s[0].length;return s[1]?this.closingBracketBlock(e,s[1],n,o):e.getCommentFoldRange(n,o,-1)}},this.getSectionRange=function(e,t){var n=e.getLine(t),r=n.search(/\S/),s=t,o=n.length;t+=1;var u=t,a=e.getLength();while(++tf)break;var l=this.getFoldWidgetRange(e,"all",t);if(l){if(l.start.row<=s)break;if(l.isMultiLine())t=l.end.row;else if(r==f)break}u=t}return new i(s,o,u,e.getLine(u).length)},this.getCommentRegionBlock=function(e,t,n){var r=t.search(/\s*$/),s=e.getLength(),o=n,u=/^\s*(?:\/\*|\/\/|--)#?(end)?region\b/,a=1;while(++no)return new i(o,r,l,t.length)}}.call(o.prototype)}),define("ace/mode/javascript",["require","exports","module","ace/lib/oop","ace/mode/text","ace/mode/javascript_highlight_rules","ace/mode/matching_brace_outdent","ace/worker/worker_client","ace/mode/behaviour/cstyle","ace/mode/folding/cstyle"],function(e,t,n){"use strict";var r=e("../lib/oop"),i=e("./text").Mode,s=e("./javascript_highlight_rules").JavaScriptHighlightRules,o=e("./matching_brace_outdent").MatchingBraceOutdent,u=e("../worker/worker_client").WorkerClient,a=e("./behaviour/cstyle").CstyleBehaviour,f=e("./folding/cstyle").FoldMode,l=function(){this.HighlightRules=s,this.$outdent=new o,this.$behaviour=new a,this.foldingRules=new f};r.inherits(l,i),function(){this.lineCommentStart="//",this.blockComment={start:"/*",end:"*/"},this.$quotes={'"':'"',"'":"'","`":"`"},this.getNextLineIndent=function(e,t,n){var r=this.$getIndent(t),i=this.getTokenizer().getLineTokens(t,e),s=i.tokens,o=i.state;if(s.length&&s[s.length-1].type=="comment")return r;if(e=="start"||e=="no_regex"){var u=t.match(/^.*(?:\bcase\b.*:|[\{\(\[])\s*$/);u&&(r+=n)}else if(e=="doc-start"){if(o=="start"||o=="no_regex")return"";var u=t.match(/^\s*(\/?)\*/);u&&(u[1]&&(r+=" "),r+="* ")}return r},this.checkOutdent=function(e,t,n){return this.$outdent.checkOutdent(t,n)},this.autoOutdent=function(e,t,n){this.$outdent.autoOutdent(t,n)},this.createWorker=function(e){var t=new u(["ace"],"ace/mode/javascript_worker","JavaScriptWorker");return t.attachToDocument(e.getDocument()),t.on("annotate",function(t){e.setAnnotations(t.data)}),t.on("terminate",function(){e.clearAnnotations()}),t},this.$id="ace/mode/javascript",this.snippetFileId="ace/snippets/javascript"}.call(l.prototype),t.Mode=l}); (function() { - window.require(["ace/mode/javascript"], function(m) { - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = m; - } - }); - })(); - diff --git a/src/html/ace/theme-monokai.js b/src/html/ace/theme-monokai.js deleted file mode 100644 index 15db94cac..000000000 --- a/src/html/ace/theme-monokai.js +++ /dev/null @@ -1,8 +0,0 @@ -define("ace/theme/monokai",["require","exports","module","ace/lib/dom"],function(e,t,n){t.isDark=!0,t.cssClass="ace-monokai",t.cssText=".ace-monokai .ace_gutter {background: #2F3129;color: #8F908A}.ace-monokai .ace_print-margin {width: 1px;background: #555651}.ace-monokai {background-color: #272822;color: #F8F8F2}.ace-monokai .ace_cursor {color: #F8F8F0}.ace-monokai .ace_marker-layer .ace_selection {background: #49483E}.ace-monokai.ace_multiselect .ace_selection.ace_start {box-shadow: 0 0 3px 0px #272822;}.ace-monokai .ace_marker-layer .ace_step {background: rgb(102, 82, 0)}.ace-monokai .ace_marker-layer .ace_bracket {margin: -1px 0 0 -1px;border: 1px solid #49483E}.ace-monokai .ace_marker-layer .ace_active-line {background: #202020}.ace-monokai .ace_gutter-active-line {background-color: #272727}.ace-monokai .ace_marker-layer .ace_selected-word {border: 1px solid #49483E}.ace-monokai .ace_invisible {color: #52524d}.ace-monokai .ace_entity.ace_name.ace_tag,.ace-monokai .ace_keyword,.ace-monokai .ace_meta.ace_tag,.ace-monokai .ace_storage {color: #F92672}.ace-monokai .ace_punctuation,.ace-monokai .ace_punctuation.ace_tag {color: #fff}.ace-monokai .ace_constant.ace_character,.ace-monokai .ace_constant.ace_language,.ace-monokai .ace_constant.ace_numeric,.ace-monokai .ace_constant.ace_other {color: #AE81FF}.ace-monokai .ace_invalid {color: #F8F8F0;background-color: #F92672}.ace-monokai .ace_invalid.ace_deprecated {color: #F8F8F0;background-color: #AE81FF}.ace-monokai .ace_support.ace_constant,.ace-monokai .ace_support.ace_function {color: #66D9EF}.ace-monokai .ace_fold {background-color: #A6E22E;border-color: #F8F8F2}.ace-monokai .ace_storage.ace_type,.ace-monokai .ace_support.ace_class,.ace-monokai .ace_support.ace_type {font-style: italic;color: #66D9EF}.ace-monokai .ace_entity.ace_name.ace_function,.ace-monokai .ace_entity.ace_other,.ace-monokai .ace_entity.ace_other.ace_attribute-name,.ace-monokai .ace_variable {color: #A6E22E}.ace-monokai .ace_variable.ace_parameter {font-style: italic;color: #FD971F}.ace-monokai .ace_string {color: #E6DB74}.ace-monokai .ace_comment {color: #75715E}.ace-monokai .ace_indent-guide {background: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAACCAYAAACZgbYnAAAAEklEQVQImWPQ0FD0ZXBzd/wPAAjVAoxeSgNeAAAAAElFTkSuQmCC) right repeat-y}";var r=e("../lib/dom");r.importCssString(t.cssText,t.cssClass)}); (function() { - window.require(["ace/theme/monokai"], function(m) { - if (typeof module == "object" && typeof exports == "object" && module) { - module.exports = m; - } - }); - })(); - diff --git a/src/html/before-navigate.html b/src/html/before-navigate.html index 1a4067292..fe5d99c02 100644 --- a/src/html/before-navigate.html +++ b/src/html/before-navigate.html @@ -1,21 +1,29 @@ - - - - - - - -
-

-

-

-

- -
+ + + + + + + +
+

+

+
+

+
+ +
- - - + + + diff --git a/src/html/before-navigate.js b/src/html/before-navigate.js index 9333e29c8..e0447f5bd 100644 --- a/src/html/before-navigate.js +++ b/src/html/before-navigate.js @@ -1,38 +1,51 @@ -const args=new URLSearchParams(location.search) -if(args.has("target")) -{ - let span=document.querySelector("[data-message='beforeNavigateDestination']") - span.innerHTML=span.innerHTML.replace("%",'') - const a=span.querySelector("a"),referer=args.get("referer") - a.textContent=args.get("target") - const when_safe=()=>{ - document.getElementById("unsafe").classList.add("uk-hidden") - a.href=referer&&referer!="tracker"?"https://fastforward.team/navigate"+location.search:args.get("target") - brws.storage.sync.get(["navigation_delay","no_instant_navigation_trackers"],res=>{ - if(res.navigation_delay==0||(referer=="tracker"&&res.no_instant_navigation_trackers!=="true")) - { - document.querySelector("div").innerHTML="

" - document.querySelector("p").textContent=brws.i18n.getMessage("beforeNavigateInstant").replace("%",args.get("target")) - setTimeout(()=>location.href=a.href,10) - } - else - { - timer("beforeNavigateTimer",res.navigation_delay,true,()=>location.href=a.href) - } - }) - } - if(args.has('safe_in') && args.get('safe_in') && args.get('safe_in') !== 'null') - { - document.getElementById("unsafe").classList.remove("uk-hidden") - document.getElementById("options-link").classList.add("uk-hidden") - timer("beforeNavigateUnsafeTimer",args.get("safe_in"),false,when_safe) - } - else - { - when_safe() - } -} -else -{ - history.back() +/*global brws*/ +const timerElement = document.getElementById('timer'); +const timerText = timerElement.querySelector('p'); + +// Get target URL from search parameter +const urlParams = new URLSearchParams(window.location.search); +const targetUrl = urlParams.get('target'); + +function escapeHtml(unsafe) { + if (!unsafe) return unsafe; //prevents null objects from throwing an error + return unsafe + .replaceAll('&', '&') + .replaceAll('<', '<') + .replaceAll('>', '>') + .replaceAll('"', '"') + .replaceAll("'", '''); } + +// Update destination message with target URL +const destinationElement = document.querySelector('#destination'); +destinationElement.innerHTML = brws.i18n.getMessage( + 'beforeNavigateDestination', + ''.concat(escapeHtml(targetUrl), '') +); + +brws.storage.local.get('options', (result) => { + if (!result.options.navigationDelayToggle) { + return; + } + const delay = result.options.navigationDelay; + let timeLeft = delay; + + timerElement.classList.remove('uk-hidden'); + timerText.textContent = brws.i18n.getMessage( + timeLeft === 1 ? 'beforeNavigateTimerSingular' : 'beforeNavigateTimer', + [timeLeft] + ); + + const interval = setInterval(() => { + timeLeft--; + if (timeLeft <= 0) { + clearInterval(interval); + window.location.href = targetUrl; + } else { + timerText.textContent = brws.i18n.getMessage( + timeLeft === 1 ? 'beforeNavigateTimerSingular' : 'beforeNavigateTimer', + [timeLeft] + ); + } + }, 1000); +}); diff --git a/src/html/crowd-bypassed.html b/src/html/crowd-bypassed.html index 57d176c38..92bab794b 100644 --- a/src/html/crowd-bypassed.html +++ b/src/html/crowd-bypassed.html @@ -1,21 +1,33 @@ - - - - - - - -
-

-

-

-

-
-

-
- - - + + + + + + + +
+

+

+
+

+
+

+ +
+

+ + +

+
+ + + diff --git a/src/html/crowd-bypassed.js b/src/html/crowd-bypassed.js index fa3cdc33e..3b0c814fb 100644 --- a/src/html/crowd-bypassed.js +++ b/src/html/crowd-bypassed.js @@ -1,28 +1,70 @@ -const args=new URLSearchParams(location.search) -if(args.has("target")&&args.has("referer")) -{ - let span=document.querySelector('[data-message="crowdBypassedInfo"]'),opentimer - span.innerHTML=span.innerHTML.replace("%",'') - const a=span.querySelector("a"), - closetimer=()=>brws.storage.sync.get(["crowd_close_delay"],res=>timer("crowdCloseTimer",res.crowd_close_delay,true,()=>{ - brws.runtime.sendMessage({type: "close-tab"}) - })) - a.textContent=args.get("target") - a.href=args.has("referer")?"https://fastforward.team/navigate"+location.search:args.get("target") - a.onclick=()=>{ - clearInterval(opentimer) - closetimer() - } - document.getElementById("ignore").href=args.get("referer")+"#ignoreCrowdBypass" - brws.storage.sync.get(["crowd_open_delay"],res=>opentimer=timer("crowdBypassedTimer",res.crowd_open_delay,true,()=>{ - brws.runtime.sendMessage({ - type: "open-tab", - url: a.href - }) - closetimer() - })) +/*global brws*/ +const timerElement = document.getElementById('timer'); +const timerText = timerElement.querySelector('p'); +const tempDisableCrowdButton = document.getElementById('temp-disable-crowd'); + +// Get target URL from search parameter +const urlParams = new URLSearchParams(window.location.search); +const targetUrl = urlParams.get('target'); + +function escapeHtml(unsafe) { + if (!unsafe) return unsafe; //prevents null objects from throwing an error + return unsafe + .replaceAll('&', '&') + .replaceAll('<', '<') + .replaceAll('>', '>') + .replaceAll('"', '"') + .replaceAll("'", '''); } -else -{ - history.back() + +function updateDestinationMessage() { + let msg = brws.i18n.getMessage( + 'crowdBypassedInfo', + ''.concat(escapeHtml(targetUrl), '') + ); + document.querySelector('#crowd-bypass-info').innerHTML = msg; } + +tempDisableCrowdButton.addEventListener('click', () => { + brws.storage.local.get(['options']).then((result) => { + let opt = result.options; + if (!opt.optionCrowdBypass) { + return; + } + opt.optionCrowdBypass = false; + brws.storage.local.set({ options: opt }); + brws.storage.local.set({ tempDisableCrowd: 'true' }); + // Create an alarm that will trigger after 10 minutes + brws.alarms.create('enableCrowdBypass', { delayInMinutes: 10 }); + }); +}); + +brws.storage.local.get('options', (result) => { + if (!result.options.optionCrowdOpenDelayToggle) { + return; + } + const delay = result.options.optionCrowdOpenDelay; + // Show countdown timer + let timeLeft = delay; + timerElement.classList.remove('uk-hidden'); + timerText.textContent = brws.i18n.getMessage( + timeLeft === 1 ? 'crowdBypassedTimerSingular' : 'crowdBypassedTimer', + [timeLeft] + ); + + const interval = setInterval(() => { + timeLeft--; + if (timeLeft <= 0) { + clearInterval(interval); + window.open(targetUrl, '_blank').focus(); + timerElement.hidden = true; + } else { + timerText.textContent = brws.i18n.getMessage( + timeLeft === 1 ? 'crowdBypassedTimerSingular' : 'crowdBypassedTimer', + [timeLeft] + ); + } + }, 1000); +}); + +updateDestinationMessage(); diff --git a/src/html/options.html b/src/html/options.html index 4c3e1a933..852944644 100644 --- a/src/html/options.html +++ b/src/html/options.html @@ -1,53 +1,144 @@ - - FastForward - - - - - - -
-

·

-
- -

-
-
-

You're using FastForward in development mode, which means that bypass definitions are loaded from your local injection_script.js and rules.json. If you would like to use the auto-updating system, delete those files and then check for updates.

-
-
-

-
-

-

-
-
- ()
-
-
- ()
-
-
-

-

- -

-
-
- - - - - + + FastForward + + + + + + +
+

+ +

+
+ +
+ + + ()
+ +
+ +
+ + + () + ()
+ +
+ +
+

+

+ + +
+
+ + + + diff --git a/src/html/options.js b/src/html/options.js index f2f83ad66..d90c578d2 100644 --- a/src/html/options.js +++ b/src/html/options.js @@ -1,381 +1,154 @@ -document.querySelector("[data-message='optionsNavigationDelay']").innerHTML=document.querySelector("[data-message='optionsNavigationDelay']").innerHTML.replace("%",'') -document.querySelector("[data-message='optionsCrowdAutoOpen']").innerHTML=document.querySelector("[data-message='optionsCrowdAutoOpen']").innerHTML.replace("%",'') -document.querySelector("[data-message='optionsCrowdAutoClose']").innerHTML=document.querySelector("[data-message='optionsCrowdAutoClose']").innerHTML.replace("%",'') -document.querySelector("[data-message='optionsUserscriptsDescription']").innerHTML=document.querySelector("[data-message='optionsUserscriptsDescription']").textContent.replace("GitHub","GitHub") +/*global brws*/ +let defaultOptions = { + navigationDelayToggle: true, + navigationDelay: 10, + optionTrackerBypass: false, + optionInstantNavigationTrackers: false, + optionBlockIpLoggers: true, + optionCrowdBypass: false, + optionCrowdOpenDelayToggle: false, + optionCrowdOpenDelay: 5, + optionCrowdCloseDelayToggle: false, + optionCrowdCloseDelay: 15, + whitelist: '', +}; -const updateButton=document.querySelector("[data-message='update']"), -enabledCheckbox=document.getElementById("option-enabled"), -enabledLabel=document.querySelector("label[for='option-enabled']"), -navigationDelayInput=document.getElementById("option-navigation-delay"), -navigationDelayCheckbox=document.getElementById("navigation-delay-toggle"), -trackerBypassCheckbox=document.getElementById("option-tracker-bypass"), -instantNavigationTrackersCheckbox=document.getElementById("option-instant-navigation-trackers"), -blockIPLoggersCheckbox=document.getElementById("option-block-ip-loggers"), -crowdBypassCheckbox=document.getElementById("option-crowd-bypass"), -crowdOpenDelayInput=document.getElementById("option-crowd-open-delay"), -crowdOpenDelayCheckbox=document.getElementById("option-crowd-open-delay-toggle"), -crowdCloseDelayInput=document.getElementById("option-crowd-close-delay"), -crowdCloseDelayCheckbox=document.getElementById("option-crowd-close-delay-toggle"), -instantNavigationTrackersLogic = () => { - if(!trackerBypassCheckbox.checked||(navigationDelayCheckbox.checked&&navigationDelayInput.value==0)) - { - instantNavigationTrackersCheckbox.setAttribute("disabled","disabled") - } - else - { - instantNavigationTrackersCheckbox.removeAttribute("disabled") - } -}, -crowdOpenDelayLogic = () => { - if(crowdOpenDelayCheckbox.checked) - { - crowdOpenDelayInput.removeAttribute("disabled") - } - else - { - crowdOpenDelayInput.setAttribute("disabled","disabled") - } -}, -crowdCloseDelayLogic = () => { - if(crowdCloseDelayCheckbox.checked) - { - crowdCloseDelayInput.removeAttribute("disabled") - } - else - { - crowdCloseDelayInput.setAttribute("disabled","disabled") - } -}, -defaultUserScript=`// Some examples of what you can do with custom bypasses: -domainBypass("example.com", () => { - // Triggered on example.com and subdomains (e.g. www.example.com) - ensureDomLoaded(() => { - // Triggered as soon as the DOM is ready - }) - // You can use ifElement to check if an element is available via document.querySelector: - ifElement("a#skip_button[href]", a => { - safelyNavigate(a.href) - // safelyNavigate asserts that given URL is valid before navigating and returns false if not - }, () => { - // Optional function to be called if the given element is not available - }) - // You can also use awaitElement to wait until an element is available via a query selector: - awaitElement("a#skip_button[href]", a => { - safelyAssign(a.href) - // safelyAssign is the same as safelyNavigate but skips the - // "You're almost at your destination" page, should the user have it enabled - }) -}) -domainBypass(/example\\.(com|org)/, () => { - // Triggered if the regex matches any part of the hostname -}) -hrefBypass(/example\\.(com|org)/, () => { - // Triggered if the regex matches any part of the URL -}) -// Enjoy! Your changes will be saved automatically. -` +const crowdTempDisabledMessage = document.querySelector( + '#crowdTempDisabledMessage' +); +const optionCrowdBypass = document.querySelector('#optionCrowdBypass'); -let navigationDelayInputTimer,crowdOpenDelayInputTimer,crowdCloseDelayInputTimer,saveTimer +async function saveOptions(options) { + return brws.storage.local.set({ options: options }); +} + +async function getOptions() { + return new Promise((resolve) => { + brws.storage.local.get('options').then((result) => { + resolve(result.options); + }); + }); +} +//Add number input boxes +function addNumberInputs() { + const numberInputs = { + 'option-navigation-delay': 'navigationDelay', + 'option-crowd-open-delay': 'optionCrowdOpenDelay', + 'option-crowd-close-delay': 'optionCrowdCloseDelay', + }; //key: for attribute of target, val: id of number input to be created + for (let [key, value] of Object.entries(numberInputs)) { + let element = document.querySelector(`[for="${key}"]`); + let numberInput = document.createElement('input'); + numberInput.setAttribute('type', 'number'); + numberInput.setAttribute('id', value); + numberInput.setAttribute('style', 'width:34px'); + element.innerHTML = element.innerHTML.replace('%', numberInput.outerHTML); + } +} -let hash=location.hash.toString().replace("#","") -if(hash) -{ - if(hash=="firstrun") - { - document.getElementById("firstrun-alert").classList.remove("uk-hidden") - } - else - { - let elm=document.querySelector("[for='"+hash+"']") - if(elm) - { - elm.classList.add("uk-text-warning") - } - } +function displayExtensionVersion() { + brws.storage.local + .get('version') + .then( + (data) => (document.getElementById('version').textContent = data.version) + ); } -let editor=ace.edit("userscript",{ - mode:"ace/mode/javascript", - theme:"ace/theme/monokai", - useWorker:false -}) -editor.on("change", ()=>{ - clearInterval(saveTimer) - saveTimer=setTimeout(()=>{ - brws.storage.local.set({ - userscript: editor.getValue() - }) - },500) -}) +function formatWhitelistDesc() { + document.querySelector( + "[data-message='optionsWhitelistDescription']" + ).innerHTML = document + .querySelector("[data-message='optionsWhitelistDescription']") + .textContent.replace( + 'subdomain.domain.tld', + 'subdomain.domain.tld' + ) + .replace('domain.tld', 'domain.tld'); +} + +function addEventListeners() { + document + .querySelectorAll('#options-form input[type="checkbox"]') + .forEach(function (checkbox) { + checkbox.addEventListener('change', async function () { + let options = await getOptions(); + options[this.id] = this.checked; + saveOptions(options); + }); + }); + + document + .querySelector('#saveWhitelist') + .addEventListener('click', async function () { + let options = await getOptions(); + options['whitelist'] = document.querySelector('#whitelist').value; + saveOptions(options); + }); -let port=brws.runtime.connect({name:"options"}),wasUpdating=false,devMode=false,amoVersion=false -port.onMessage.addListener(data=>{ - if("extension_version" in data) - { - document.getElementById("version").textContent=data.extension_version - } - if("amo" in data) - { - if(data.amo) - { - updateButton.classList.add("uk-hidden") - amoVersion = true - } - } - if("upstreamCommit" in data) - { - if(data.upstreamCommit) - { - devMode=false - document.getElementById("definitionsVersion").innerHTML=brws.i18n.getMessage("definitionsVersion")+" "+data.upstreamCommit.substr(0,7)+"" - document.getElementById("dev-alert").classList.add("uk-hidden") - } - else - { - devMode=true - document.getElementById("definitionsVersion").textContent="Development Mode" - document.getElementById("dev-alert").classList.remove("uk-hidden") - } - } - if("bypassCounter" in data && data.bypassCounter > 1) - { - const counter=document.getElementById("counter"), - span=counter.querySelector("span") - span.textContent=brws.i18n.getMessage("bypassCounter") - span.innerHTML=span.innerHTML.replace("%",""+data.bypassCounter+"") - counter.classList.remove("uk-hidden") - } - if("userScript" in data) - { - if(data.userScript) - { - editor.setValue(data.userScript) - } - else - { - editor.setValue(defaultUserScript) - } - editor.resize() - editor.clearSelection() - } - if("updateSuccess" in data&&!devMode&&!amoVersion) - { - UIkit.notification({ - message:brws.i18n.getMessage("updat"+(data.updateSuccess?"ing":"eNo")), - status:"primary", - timeout:3000 - }) - } - if("updateStatus" in data&&!amoVersion) - { - if(data.updateStatus) - { - updateButton.setAttribute("disabled","disabled") - if(data.updateStatus == "updating") - { - updateButton.textContent=brws.i18n.getMessage("updating") - wasUpdating=true - } - } - else - { - updateButton.textContent=brws.i18n.getMessage("update") - updateButton.removeAttribute("disabled") - if(wasUpdating) - { - UIkit.notification({ - message:devMode?"Successfully loaded local bypass definitions.":brws.i18n.getMessage("updateYes"), - status:"success", - timeout:3000 - }) - wasUpdating=false - } - } - } -}) -updateButton.onclick=()=>{ - if(!updateButton.hasAttribute("disabled")) - { - port.postMessage({type:"update"}) - } + document + .querySelectorAll('#options-form input[type="number"]') + .forEach(function (checkbox) { + checkbox.addEventListener('change', async function () { + let options = await getOptions(); + options[this.id] = this.value; + saveOptions(options); + }); + }); } -brws.storage.sync.get(["disable","navigation_delay","no_tracker_bypass","no_instant_navigation_trackers","allow_ip_loggers","crowd_bypass","crowd_open_delay","crowd_close_delay","no_info_box"],res=>{ - if(res==undefined) - { - res={} - } - if(!res.disable||res.disable!=="true") - { - enabledCheckbox.setAttribute("checked","checked") - } - else - { - enabledLabel.classList.add("uk-text-danger") - } - if(res.navigation_delay<0) - { - navigationDelayInput.value=(res.navigation_delay*-1)-1 - navigationDelayInput.setAttribute("disabled","disabled") - } - else - { - navigationDelayInput.value=res.navigation_delay - navigationDelayCheckbox.setAttribute("checked","checked") - } - if(res.no_tracker_bypass!=="true") - { - trackerBypassCheckbox.setAttribute("checked","checked") - } - if(res.no_instant_navigation_trackers!=="true") - { - instantNavigationTrackersCheckbox.setAttribute("checked","checked") - } - if(res.allow_ip_loggers!=="true") - { - blockIPLoggersCheckbox.setAttribute("checked","checked") - } - if(res.crowd_bypass==="true") - { - crowdBypassCheckbox.setAttribute("checked","checked") - } - if(res.crowd_open_delay<0) - { - crowdOpenDelayInput.value=(res.crowd_open_delay*-1)-1 - crowdOpenDelayInput.setAttribute("disabled","disabled") - } - else - { - crowdOpenDelayInput.value=res.crowd_open_delay - crowdOpenDelayCheckbox.setAttribute("checked","checked") - } - if(res.crowd_close_delay<0) - { - crowdCloseDelayInput.value=(res.crowd_close_delay*-1)-1 - crowdCloseDelayInput.setAttribute("disabled","disabled") - } - else - { - crowdCloseDelayInput.value=res.crowd_close_delay - crowdCloseDelayCheckbox.setAttribute("checked","checked") - } - instantNavigationTrackersLogic() - enabledCheckbox.onchange=function() - { - enabledLabel.classList.remove("uk-text-danger") - brws.storage.sync.set({ - disable:(!this.checked).toString() - }) - } - navigationDelayInput.oninput=()=>{ - clearTimeout(navigationDelayInputTimer) - navigationDelayInputTimer=setTimeout(()=>{ - brws.storage.sync.set({ - navigation_delay:navigationDelayInput.value - }) - instantNavigationTrackersLogic() - },300) - } - navigationDelayCheckbox.onchange=function() - { - let navigation_delay=parseInt(navigationDelayInput.value) - if(!this.checked) - { - navigation_delay=(navigation_delay+1)*-1 - } - brws.storage.sync.set({navigation_delay}) - if(this.checked) - { - navigationDelayInput.removeAttribute("disabled") - } - else - { - navigationDelayInput.setAttribute("disabled","disabled") - } - instantNavigationTrackersLogic() - } - trackerBypassCheckbox.onchange=function() - { - brws.storage.sync.set({ - no_tracker_bypass:(!this.checked).toString() - }) - instantNavigationTrackersLogic() - } - instantNavigationTrackersCheckbox.onchange=function() - { - brws.storage.sync.set({ - no_instant_navigation_trackers:(!this.checked).toString() - }) - } - blockIPLoggersCheckbox.onchange=function() - { - brws.storage.sync.set({ - allow_ip_loggers:(!this.checked).toString() - }) - } - crowdBypassCheckbox.onchange=function() - { - brws.storage.sync.set({ - crowd_bypass:this.checked.toString() - }) - if(this.checked) - { - crowdOpenDelayCheckbox.removeAttribute("disabled") - crowdCloseDelayCheckbox.removeAttribute("disabled") - crowdOpenDelayLogic() - crowdCloseDelayLogic() - } - else - { - crowdOpenDelayCheckbox.setAttribute("disabled","disabled") - crowdOpenDelayInput.setAttribute("disabled","disabled") - crowdCloseDelayCheckbox.setAttribute("disabled","disabled") - crowdCloseDelayInput.setAttribute("disabled","disabled") - } - } - crowdOpenDelayCheckbox.onchange=function() - { - let crowd_open_delay=parseInt(crowdOpenDelayInput.value) - if(!this.checked) - { - crowd_open_delay=(crowd_open_delay+1)*-1 - } - brws.storage.sync.set({crowd_open_delay}) - crowdOpenDelayLogic() - } - crowdOpenDelayInput.oninput=function() - { - clearTimeout(crowdOpenDelayInputTimer) - crowdOpenDelayInputTimer=setTimeout(()=>{ - brws.storage.sync.set({ - crowd_open_delay:crowdOpenDelayInput.value - }) - },300) - } - crowdCloseDelayCheckbox.onchange=function() - { - let crowd_close_delay=parseInt(crowdCloseDelayInput.value) - if(!this.checked) - { - crowd_close_delay=(crowd_close_delay+1)*-1 - } - else if(crowd_close_delay<3) - { - crowd_close_delay=3 - } - brws.storage.sync.set({crowd_close_delay}) - crowdCloseDelayLogic() - } - crowdCloseDelayInput.oninput=function() - { - clearTimeout(crowdCloseDelayInputTimer) - crowdCloseDelayInputTimer=setTimeout(()=>{ - let crowd_close_delay=parseInt(crowdCloseDelayInput.value) - if(crowd_close_delay<3) - { - crowd_close_delay=3 - } - brws.storage.sync.set({crowd_close_delay}) - },300) - } -}) +async function repopulateOptions() { + let options = Object.assign({}, defaultOptions, await getOptions()); + for (let key in options) { + let element = document.querySelector('#' + key); + if (element.type === 'checkbox') { + element.checked = options[key]; + } else if (element.type === 'number') { + element.value = options[key]; + } else if (element.tagName === 'TEXTAREA') { + element.value = options[key]; + } + } + saveOptions(options); +} + +//only refresh the checkboxes otherwise the user won't be able to type anything +async function refreshOptions() { + let options = Object.assign({}, defaultOptions, await getOptions()); + for (let key in options) { + let element = document.querySelector('#' + key); + if (element.type === 'checkbox') { + element.checked = options[key]; + } + saveOptions(options); + } +} +function refCrowdTempDisabledMsg() { + brws.storage.local.get(['tempDisableCrowd']).then((result) => { + if (result.tempDisableCrowd === 'true') { + crowdTempDisabledMessage.hidden = false; + } else { + crowdTempDisabledMessage.hidden = true; + } + }); +} + +document.addEventListener('DOMContentLoaded', async function () { + addNumberInputs(); + await repopulateOptions(); + refCrowdTempDisabledMsg(); + addEventListeners(); + formatWhitelistDesc(); + displayExtensionVersion(); + setInterval(() => { + refCrowdTempDisabledMsg(); + refreshOptions(); + }, 1000); +}); + +// If the user manually checks optionCrowdBypass, set tempDisableCrowd to false +optionCrowdBypass.addEventListener('change', () => { + if (optionCrowdBypass.checked) { + brws.storage.local.set({ tempDisableCrowd: 'false' }); + refCrowdTempDisabledMsg(); + } +}); diff --git a/src/html/uikit/uikit.js b/src/html/uikit/uikit.js index aaadd56e9..4ef7a16e5 100644 --- a/src/html/uikit/uikit.js +++ b/src/html/uikit/uikit.js @@ -1,3 +1 @@ -/*! UIkit 3.3.1 | http://www.getuikit.com | (c) 2014 - 2019 YOOtheme | MIT License */ - -!function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define("uikit",e):(t=t||self).UIkit=e()}(this,function(){"use strict";var t=Object.prototype,i=t.hasOwnProperty;function l(t,e){return i.call(t,e)}var e={},n=/([a-z\d])([A-Z])/g;function d(t){return t in e||(e[t]=t.replace(n,"$1-$2").toLowerCase()),e[t]}var r=/-(\w)/g;function f(t){return t.replace(r,o)}function o(t,e){return e?e.toUpperCase():""}function p(t){return t.length?o(0,t.charAt(0))+t.slice(1):""}var s=String.prototype,a=s.startsWith||function(t){return 0===this.lastIndexOf(t,0)};function w(t,e){return a.call(t,e)}var h=s.endsWith||function(t){return this.substr(-t.length)===t};function u(t,e){return h.call(t,e)}function c(t,e){return~this.indexOf(t,e)}var m=Array.prototype,g=s.includes||c,v=m.includes||c;function b(t,e){return t&&(D(t)?g:v).call(t,e)}var x=m.findIndex||function(t){for(var e=arguments,i=0;ie.left&&t.tope.top}function nt(t,e){return t.x<=e.right&&t.x>=e.left&&t.y<=e.bottom&&t.y>=e.top}var rt={ratio:function(t,e,i){var n,r="width"===e?"height":"width";return(n={})[r]=t[e]?Math.round(i*t[r]/t[e]):t[r],n[e]=i,n},contain:function(i,n){var r=this;return J(i=G({},i),function(t,e){return i=i[e]>n[e]?r.ratio(i,e,n[e]):i}),i},cover:function(i,n){var r=this;return J(i=this.contain(i,n),function(t,e){return i=i[e]+~-]/,Et=/([!>+~-])(?=\s+[!>+~-]|\s*$)/g;function _t(t){return D(t)&&t.match(Tt)}var At=/.*?[^\\](?:,|$)/g;var Ct=Element.prototype,Nt=Ct.matches||Ct.webkitMatchesSelector||Ct.msMatchesSelector;function Mt(t,e){return V(t).some(function(t){return Nt.call(t,e)})}var zt=Ct.closest||function(t){var e=this;do{if(Mt(e,t))return e}while(e=Pt(e))};function Dt(t,e){return w(e,">")&&(e=e.slice(1)),N(t)?zt.call(t,e):V(t).map(function(t){return Dt(t,e)}).filter(Boolean)}function Pt(t){return(t=W(t))&&N(t.parentNode)&&t.parentNode}function Bt(t,e){for(var i=[];t=Pt(t);)e&&!Mt(t,e)||i.push(t);return i}function Ot(t,e){var i=(t=W(t))?V(t.children):[];return e?i.filter(function(t){return Mt(t,e)}):i}var Ht=window.CSS&&CSS.escape||function(t){return t.replace(/([^\x7f-\uFFFF\w-])/g,function(t){return"\\"+t})};function Lt(t){return D(t)?Ht.call(null,t):""}var Ft={area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,menuitem:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0};function jt(t){return V(t).some(function(t){return Ft[t.tagName.toLowerCase()]})}function Wt(t){return V(t).some(function(t){return t.offsetWidth||t.offsetHeight||t.getClientRects().length})}var Vt="input,select,textarea,button";function Rt(t){return V(t).some(function(t){return Mt(t,Vt)})}function qt(t,e){return V(t).filter(function(t){return Mt(t,e)})}function Yt(t,e){return D(e)?Mt(t,e)||Dt(t,e):t===e||(_(e)?e.documentElement:W(e)).contains(W(t))}function Ut(){for(var t=[],e=arguments.length;e--;)t[e]=arguments[e];var i,n,r=Zt(t),o=r[0],s=r[1],a=r[2],h=r[3],l=r[4];return o=ie(o),1]*>/,Ee=/^<(\w+)\s*\/?>(?:<\/\1>)?$/;function _e(t){var e=Ee.exec(t);if(e)return document.createElement(e[1]);var i=document.createElement("div");return Te.test(t)?i.insertAdjacentHTML("beforeend",t.trim()):i.textContent=t,1n[l]){var i=p[s]/2,r="center"===c[a]?-m[s]/2:0;return"center"===u[a]&&(o(i,r)||o(-i,-r))||o(t,e)}function o(e,t){var i=g[h]+e+t-2*d[a];if(i>=n[h]&&i+p[s]<=n[l])return g[h]=i,["element","target"].forEach(function(t){f[t][a]=e?f[t][a]===ri[s][1]?ri[s][2]:ri[s][1]:f[t][a]}),!0}})})}return si(t,g),f}function si(i,n){if(!n)return ai(i);var r=si(i),o=Ve(i,"position");["left","top"].forEach(function(t){if(t in n){var e=Ve(i,t);Ve(i,t,n[t]-r[t]+j("absolute"===o&&"auto"===e?hi(i)[t]:e))}})}function ai(t){if(!t)return{};var e,i,n=R(t),r=n.pageYOffset,o=n.pageXOffset;if(E(t)){var s=t.innerHeight,a=t.innerWidth;return{top:r,left:o,height:s,width:a,bottom:r+s,right:o+a}}Wt(t)||"none"!==Ve(t,"display")||(e=ot(t,"style"),i=ot(t,"hidden"),ot(t,{style:(e||"")+";display:block !important;",hidden:null}));var h=(t=W(t)).getBoundingClientRect();return H(e)||ot(t,{style:e,hidden:i}),{height:h.height,width:h.width,top:h.top+r,left:h.left+o,bottom:h.bottom+r,right:h.right+o}}function hi(t,e){e=e||W(t).offsetParent||R(t).document.documentElement;var i=si(t),n=si(e);return{top:i.top-n.top-j(Ve(e,"borderTopWidth")),left:i.left-n.left-j(Ve(e,"borderLeftWidth"))}}function li(t){var e=[0,0];t=W(t);do{if(e[0]+=t.offsetTop,e[1]+=t.offsetLeft,"fixed"===Ve(t,"position")){var i=R(t);return e[0]+=i.pageYOffset,e[1]+=i.pageXOffset,e}}while(t=t.offsetParent);return e}var ui=di("height"),ci=di("width");function di(n){var r=p(n);return function(t,e){if(H(e)){if(E(t))return t["inner"+r];if(_(t)){var i=t.documentElement;return Math.max(i["offset"+r],i["scroll"+r])}return(e="auto"===(e=Ve(t=W(t),n))?t["offset"+r]:j(e)||0)-fi(t,n)}Ve(t,n,e||0===e?+e+fi(t,n)+"px":"")}}function fi(i,t,e){return void 0===e&&(e="border-box"),Ve(i,"boxSizing")===e?ri[t].slice(1).map(p).reduce(function(t,e){return t+j(Ve(i,"padding"+e))+j(Ve(i,"border"+e+"Width"))},0):0}function pi(o,s,a,h){J(ri,function(t,e){var i=t[0],n=t[1],r=t[2];s[i]===r?o[n]+=a[e]*h:"center"===s[i]&&(o[n]+=a[e]*h/2)})}function mi(t){var e=/left|center|right/,i=/top|center|bottom/;return 1===(t=(t||"").split(" ")).length&&(t=e.test(t[0])?t.concat(["center"]):i.test(t[0])?["center"].concat(t):["center","center"]),{x:e.test(t[0])?t[0]:"center",y:i.test(t[1])?t[1]:"center"}}function gi(t,e,i){var n=(t||"").split(" "),r=n[0],o=n[1];return{x:r?j(r)*(u(r,"%")?e/100:1):0,y:o?j(o)*(u(o,"%")?i/100:1):0}}function vi(t){switch(t){case"left":return"right";case"right":return"left";case"top":return"bottom";case"bottom":return"top";default:return t}}function wi(t,e,i){return void 0===e&&(e="width"),void 0===i&&(i=window),B(t)?+t:u(t,"vh")?bi(ui(R(i)),t):u(t,"vw")?bi(ci(R(i)),t):u(t,"%")?bi(ai(i)[e],t):j(t)}function bi(t,e){return t*j(e)/100}var xi={reads:[],writes:[],read:function(t){return this.reads.push(t),$i(),t},write:function(t){return this.writes.push(t),$i(),t},clear:function(t){return Si(this.reads,t)||Si(this.writes,t)},flush:yi};function yi(t){void 0===t&&(t=1),Ii(xi.reads),Ii(xi.writes.splice(0,xi.writes.length)),xi.scheduled=!1,(xi.reads.length||xi.writes.length)&&$i(t+1)}var ki=5;function $i(t){if(!xi.scheduled){if(xi.scheduled=!0,kiMath.round(si(t).height)}).reverse();return n.length?n:[i]}function Fi(t){return t===Wi(t)?window:t}function ji(t){return Li(t,/auto|scroll|hidden/)}function Wi(t){var e=R(t).document;return e.scrollingElement||e.documentElement}Mi.prototype.isVideo=function(){return this.isYoutube()||this.isVimeo()||this.isHTML5()},Mi.prototype.isHTML5=function(){return"VIDEO"===this.el.tagName},Mi.prototype.isIFrame=function(){return"IFRAME"===this.el.tagName},Mi.prototype.isYoutube=function(){return this.isIFrame()&&!!this.el.src.match(/\/\/.*?youtube(-nocookie)?\.[a-z]+\/(watch\?v=[^&\s]+|embed)|youtu\.be\/.*/)},Mi.prototype.isVimeo=function(){return this.isIFrame()&&!!this.el.src.match(/vimeo\.com\/video\/.*/)},Mi.prototype.enableApi=function(){var e=this;if(this.ready)return this.ready;var i,r=this.isYoutube(),o=this.isVimeo();return r||o?this.ready=new se(function(t){var n;Gt(e.el,"load",function(){if(r){var t=function(){return Di(e.el,{event:"listening",id:e.id})};i=setInterval(t,100),t()}}),(n=function(t){return r&&t.id===e.id&&"onReady"===t.event||o&&Number(t.player_id)===e.id},new se(function(i){Gt(window,"message",function(t,e){return i(e)},!1,function(t){var e=t.data;if(e&&D(e)){try{e=JSON.parse(e)}catch(t){return}return e&&n(e)}})})).then(function(){t(),i&&clearInterval(i)}),ot(e.el,"src",e.el.src+(b(e.el.src,"?")?"&":"?")+(r?"enablejsapi=1":"api=1&player_id="+e.id))}):se.resolve()},Mi.prototype.play=function(){var t=this;if(this.isVideo())if(this.isIFrame())this.enableApi().then(function(){return Di(t.el,{func:"playVideo",method:"play"})});else if(this.isHTML5())try{var e=this.el.play();e&&e.catch(et)}catch(t){}},Mi.prototype.pause=function(){var t=this;this.isVideo()&&(this.isIFrame()?this.enableApi().then(function(){return Di(t.el,{func:"pauseVideo",method:"pause"})}):this.isHTML5()&&this.el.pause())},Mi.prototype.mute=function(){var t=this;this.isVideo()&&(this.isIFrame()?this.enableApi().then(function(){return Di(t.el,{func:"mute",method:"setVolume",value:0})}):this.isHTML5()&&(this.el.muted=!0,ot(this.el,"muted","")))};var Vi="IntersectionObserver"in window?window.IntersectionObserver:function(){function t(e,t){var i=this;void 0===t&&(t={});var n=t.rootMargin;void 0===n&&(n="0 0"),this.targets=[];var r,o=(n||"0 0").split(" ").map(j),s=o[0],a=o[1];this.offsetTop=s,this.offsetLeft=a,this.apply=function(){r=r||requestAnimationFrame(function(){return setTimeout(function(){var t=i.takeRecords();t.length&&e(t,i),r=!1})})},this.off=Ut(window,"scroll resize load",this.apply,{passive:!0,capture:!0})}return t.prototype.takeRecords=function(){var i=this;return this.targets.filter(function(t){var e=Pi(t.target,i.offsetTop,i.offsetLeft);if(null===t.isIntersecting||e^t.isIntersecting)return t.isIntersecting=e,!0})},t.prototype.observe=function(t){this.targets.push({target:t,isIntersecting:null}),this.apply()},t.prototype.disconnect=function(){this.targets=[],this.off()},t}();function Ri(t){return!(!w(t,"uk-")&&!w(t,"data-uk-"))&&f(t.replace("data-uk-","").replace("uk-",""))}function qi(t){this._init(t)}var Yi,Ui,Xi,Gi,Ki,Ji,Zi,Qi,tn;function en(t,e){if(t)for(var i in t)t[i]._connected&&t[i]._callUpdate(e)}function nn(t,e){var i={},n=t.args;void 0===n&&(n=[]);var r=t.props;void 0===r&&(r={});var o=t.el;if(!r)return i;for(var s in r){var a=d(s),h=ht(o,a);if(!H(h)){if(h=r[s]===Boolean&&""===h||an(r[s],h),"target"===a&&(!h||w(h,"_")))continue;i[s]=h}}var l=Ni(ht(o,e),n);for(var u in l){var c=f(u);void 0!==r[c]&&(i[c]=an(r[c],l[u]))}return i}function rn(n,r,o){Object.defineProperty(n,r,{enumerable:!0,get:function(){var t=n._computeds,e=n.$props,i=n.$el;return l(t,r)||(t[r]=(o.get||o).call(n,e,i)),t[r]},set:function(t){var e=n._computeds;e[r]=o.set?o.set.call(n,t):t,H(e[r])&&delete e[r]}})}function on(e,i,n){T(i)||(i={name:n,handler:i});var t=i.name,r=i.el,o=i.handler,s=i.capture,a=i.passive,h=i.delegate,l=i.filter,u=i.self;r=$(r)?r.call(e):r||e.$el,k(r)?r.forEach(function(t){return on(e,G({},i,{el:t}),n)}):!r||l&&!l.call(e)||e._events.push(Ut(r,t,h?D(h)?h:h.call(e):null,D(o)?e[o]:o.bind(e),{passive:a,capture:s,self:u}))}function sn(t,e){return t.every(function(t){return!t||!l(t,e)})}function an(t,e){return t===Boolean?L(e):t===Number?F(e):"list"===t?q(e):t?t(e):e}qi.util=Object.freeze({__proto__:null,ajax:ce,getImage:de,transition:Je,Transition:Ze,animate:ei,Animation:ni,attr:ot,hasAttr:st,removeAttr:at,data:ht,addClass:ze,removeClass:De,removeClasses:Pe,replaceClass:Be,hasClass:Oe,toggleClass:He,positionAt:oi,offset:si,position:hi,offsetPosition:li,height:ui,width:ci,boxModelAdjust:fi,flipPosition:vi,toPx:wi,ready:fe,index:pe,getIndex:me,empty:ge,html:ve,prepend:function(e,t){return(e=Ce(e)).hasChildNodes()?ye(t,function(t){return e.insertBefore(t,e.firstChild)}):we(e,t)},append:we,before:be,after:xe,remove:ke,wrapAll:$e,wrapInner:Ie,unwrap:Se,fragment:_e,apply:Ae,$:Ce,$$:Ne,isIE:lt,isRtl:ut,hasTouch:ft,pointerDown:pt,pointerMove:mt,pointerUp:gt,pointerEnter:vt,pointerLeave:wt,pointerCancel:bt,on:Ut,off:Xt,once:Gt,trigger:Kt,createEvent:Jt,toEventTargets:ie,isTouch:ne,getEventPos:re,fastdom:xi,isVoidElement:jt,isVisible:Wt,selInput:Vt,isInput:Rt,filter:qt,within:Yt,hasOwn:l,hyphenate:d,camelize:f,ucfirst:p,startsWith:w,endsWith:u,includes:b,findIndex:y,isArray:k,isFunction:$,isObject:I,isPlainObject:T,isWindow:E,isDocument:_,isJQuery:A,isNode:C,isElement:N,isNodeCollection:M,isBoolean:z,isString:D,isNumber:P,isNumeric:B,isEmpty:O,isUndefined:H,toBoolean:L,toNumber:F,toFloat:j,toNode:W,toNodes:V,toWindow:R,toList:q,toMs:Y,isEqual:U,swap:X,assign:G,last:K,each:J,sortBy:Z,uniqueBy:Q,clamp:tt,noop:et,intersectRect:it,pointInRect:nt,Dimensions:rt,MouseTracker:Ti,mergeOptions:Ci,parseOptions:Ni,Player:Mi,Promise:se,Deferred:oe,IntersectionObserver:Vi,query:xt,queryAll:yt,find:$t,findAll:It,matches:Mt,closest:Dt,parent:Pt,parents:Bt,children:Ot,escape:Lt,css:Ve,getStyles:Re,getStyle:qe,getCssVar:Ue,propName:Ge,isInView:Pi,scrollTop:Bi,scrollIntoView:Oi,scrolledOver:Hi,scrollParents:Li,getViewport:Fi}),qi.data="__uikit__",qi.prefix="uk-",qi.options={},qi.version="3.3.1",Xi=(Yi=qi).data,Yi.use=function(t){if(!t.installed)return t.call(null,this),t.installed=!0,this},Yi.mixin=function(t,e){(e=(D(e)?Yi.component(e):e)||this).options=Ci(e.options,t)},Yi.extend=function(t){t=t||{};function e(t){this._init(t)}return((e.prototype=Object.create(this.prototype)).constructor=e).options=Ci(this.options,t),e.super=this,e.extend=this.extend,e},Yi.update=function(t,e){Bt(t=t?W(t):document.body).reverse().forEach(function(t){return en(t[Xi],e)}),Ae(t,function(t){return en(t[Xi],e)})},Object.defineProperty(Yi,"container",{get:function(){return Ui||document.body},set:function(t){Ui=Ce(t)}}),(Gi=qi).prototype._callHook=function(t){var e=this,i=this.$options[t];i&&i.forEach(function(t){return t.call(e)})},Gi.prototype._callConnected=function(){this._connected||(this._data={},this._computeds={},this._initProps(),this._callHook("beforeConnect"),this._connected=!0,this._initWatches(),this._initEvents(),this._initObserver(),this._callHook("connected"),this._callUpdate())},Gi.prototype._callDisconnected=function(){this._connected&&(this._callHook("beforeDisconnect"),this._observer&&(this._observer.disconnect(),this._observer=null),this._unbindEvents(),this._callHook("disconnected"),delete this._computeds,delete this._data,this._connected=!1)},Gi.prototype._callUpdate=function(t){var o=this;void 0===t&&(t="update");var s=t.type||t;b(["update","resize"],s)&&this._callWatches();var e=this.$options.update,i=this._frames,a=i.reads,h=i.writes;e&&e.forEach(function(t,e){var i=t.read,n=t.write,r=t.events;"update"!==s&&!b(r,s)||(i&&!b(xi.reads,a[e])&&(a[e]=xi.read(function(){var t=o._connected&&i.call(o,o._data,s);!1===t&&n?xi.clear(h[e]):T(t)&&G(o._data,t)})),n&&!b(xi.writes,h[e])&&(h[e]=xi.write(function(){return o._connected&&n.call(o,o._data,s)})))})},Ji=0,(Ki=qi).prototype._init=function(t){(t=t||{}).data=function(t,e){var i=t.data,n=(t.el,e.args),r=e.props;void 0===r&&(r={});if(i=k(i)?O(n)?void 0:i.slice(0,n.length).reduce(function(t,e,i){return T(e)?G(t,e):t[n[i]]=e,t},{}):i)for(var o in i)H(i[o])?delete i[o]:i[o]=r[o]?an(r[o],i[o]):i[o];return i}(t,this.constructor.options),this.$options=Ci(this.constructor.options,t,this),this.$el=null,this.$props={},this._frames={reads:{},writes:{}},this._events=[],this._uid=Ji++,this._initData(),this._initMethods(),this._initComputeds(),this._callHook("created"),t.el&&this.$mount(t.el)},Ki.prototype._initData=function(){var t=this.$options.data;for(var e in void 0===t&&(t={}),t)this.$props[e]=this[e]=t[e]},Ki.prototype._initMethods=function(){var t=this.$options.methods;if(t)for(var e in t)this[e]=t[e].bind(this)},Ki.prototype._initComputeds=function(){var t=this.$options.computed;if(this._computeds={},t)for(var e in t)rn(this,e,t[e])},Ki.prototype._initWatches=function(){var t=this.$options.computed;if(t)for(var e in t){var i=t[e],n=i.watch,r=i.immediate;n&&r&&n.call(this,this[e])}},Ki.prototype._callWatches=function(){var t=this.$options.computed,e=this._computeds;for(var i in e){var n=e[i];delete e[i],t[i].watch&&!U(n,this[i])&&t[i].watch.call(this,this[i],n)}},Ki.prototype._initProps=function(t){var e;for(e in t=t||nn(this.$options,this.$name))H(t[e])||(this.$props[e]=t[e]);var i=[this.$options.computed,this.$options.methods];for(e in this.$props)e in t&&sn(i,e)&&(this[e]=this.$props[e])},Ki.prototype._initEvents=function(){var i=this,t=this.$options.events;t&&t.forEach(function(t){if(l(t,"handler"))on(i,t);else for(var e in t)on(i,t[e],e)})},Ki.prototype._unbindEvents=function(){this._events.forEach(function(t){return t()}),this._events=[]},Ki.prototype._initObserver=function(){var i=this,t=this.$options,n=t.attrs,e=t.props,r=t.el;if(!this._observer&&e&&!1!==n){n=k(n)?n:Object.keys(e),this._observer=new MutationObserver(function(){var e=nn(i.$options,i.$name);n.some(function(t){return!H(e[t])&&e[t]!==i.$props[t]})&&i.$reset()});var o=n.map(function(t){return d(t)}).concat(this.$name);this._observer.observe(r,{attributes:!0,attributeFilter:o.concat(o.map(function(t){return"data-"+t}))})}},Qi=(Zi=qi).data,tn={},Zi.component=function(s,t){var e=d(s);if(s=f(e),!t)return T(tn[s])&&(tn[s]=Zi.extend(tn[s])),tn[s];Zi[s]=function(t,i){for(var e=arguments.length,n=Array(e);e--;)n[e]=arguments[e];var r=Zi.component(s);return r.options.functional?new r({data:T(t)?t:[].concat(n)}):t?Ne(t).map(o)[0]:o(t);function o(t){var e=Zi.getComponent(t,s);if(e){if(!i)return e;e.$destroy()}return new r({el:t,data:i})}};var i=T(t)?G({},t):t.options;return i.name=s,i.install&&i.install(Zi,i,s),Zi._initialized&&!i.functional&&xi.read(function(){return Zi[s]("[uk-"+e+"],[data-uk-"+e+"]")}),tn[s]=T(t)?i:t},Zi.getComponents=function(t){return t&&t[Qi]||{}},Zi.getComponent=function(t,e){return Zi.getComponents(t)[e]},Zi.connect=function(t){if(t[Qi])for(var e in t[Qi])t[Qi][e]._callConnected();for(var i=0;i *",active:!1,animation:[!0],collapsible:!0,multiple:!1,clsOpen:"uk-open",toggle:"> .uk-accordion-title",content:"> .uk-accordion-content",transition:"ease"},computed:{items:{get:function(t,e){return Ne(t.targets,e)},watch:function(t,e){var i=this;if(t.forEach(function(t){return i._toggle(Ce(i.content,t),Oe(t,i.clsOpen))}),!Oe(t,this.clsOpen)){var n=!e&&!1!==this.active&&t[Number(this.active)]||!this.collapsible&&t[0];n&&this.toggle(n,!1)}},immediate:!0}},events:[{name:"click",delegate:function(){return this.targets+" "+this.$props.toggle},handler:function(t){t.preventDefault(),this.toggle(pe(Ne(this.targets+" "+this.$props.toggle,this.$el),t.current))}}],methods:{toggle:function(r,o){var s=this,t=me(r,this.items),a=qt(this.items,"."+this.clsOpen);(r=this.items[t])&&[r].concat(!this.multiple&&!b(a,r)&&a||[]).forEach(function(e){var t=e===r,i=t&&!Oe(e,s.clsOpen);if(i||!t||s.collapsible||!(a.length<2)){He(e,s.clsOpen,i);var n=e._wrapper?e._wrapper.firstElementChild:Ce(s.content,e);e._wrapper||(e._wrapper=$e(n,"
"),ot(e._wrapper,"hidden",i?"":null)),s._toggle(n,!0),s.toggleElement(e._wrapper,i,o).then(function(){if(Oe(e,s.clsOpen)===i){if(i){var t=Ce(s.$props.toggle,e);!1===o||Pi(t)||Oi(t)}else s._toggle(n,!1);e._wrapper=null,Se(n)}})}})}}},cn={mixins:[hn,ln],args:"animation",props:{close:String},data:{animation:[!0],selClose:".uk-alert-close",duration:150,hideProps:G({opacity:0},ln.data.hideProps)},events:[{name:"click",delegate:function(){return this.selClose},handler:function(t){t.preventDefault(),this.close()}}],methods:{close:function(){var t=this;this.toggleElement(this.$el).then(function(){return t.$destroy(!0)})}}},dn={args:"autoplay",props:{automute:Boolean,autoplay:Boolean},data:{automute:!1,autoplay:!0},computed:{inView:function(t){return"inview"===t.autoplay}},connected:function(){this.inView&&!st(this.$el,"preload")&&(this.$el.preload="none"),this.player=new Mi(this.$el),this.automute&&this.player.mute()},update:{read:function(){return!!this.player&&{visible:Wt(this.$el)&&"hidden"!==Ve(this.$el,"visibility"),inView:this.inView&&Pi(this.$el)}},write:function(t){var e=t.visible,i=t.inView;!e||this.inView&&!i?this.player.pause():(!0===this.autoplay||this.inView&&i)&&this.player.play()},events:["resize","scroll"]}},fn={mixins:[hn,dn],props:{width:Number,height:Number},data:{automute:!0},update:{read:function(){var t=this.$el,e=function(t){for(;t=Pt(t);)if("static"!==Ve(t,"position"))return t}(t)||t.parentNode,i=e.offsetHeight,n=e.offsetWidth,r=rt.cover({width:this.width||t.naturalWidth||t.videoWidth||t.clientWidth,height:this.height||t.naturalHeight||t.videoHeight||t.clientHeight},{width:n+(n%2?1:0),height:i+(i%2?1:0)});return!(!r.width||!r.height)&&r},write:function(t){var e=t.height,i=t.width;Ve(this.$el,{height:e,width:i})},events:["resize"]}};var pn,mn={props:{pos:String,offset:null,flip:Boolean,clsPos:String},data:{pos:"bottom-"+(ut?"right":"left"),flip:!0,offset:!1,clsPos:""},computed:{pos:function(t){var e=t.pos;return(e+(b(e,"-")?"":"-center")).split("-")},dir:function(){return this.pos[0]},align:function(){return this.pos[1]}},methods:{positionAt:function(t,e,i){var n;Pe(t,this.clsPos+"-(top|bottom|left|right)(-[a-z]+)?"),Ve(t,{top:"",left:""});var r=this.offset,o=this.getAxis();B(r)||(r=(n=Ce(r))?si(n)["x"===o?"left":"top"]-si(e)["x"===o?"right":"bottom"]:0);var s=oi(t,e,"x"===o?vi(this.dir)+" "+this.align:this.align+" "+vi(this.dir),"x"===o?this.dir+" "+this.align:this.align+" "+this.dir,"x"===o?""+("left"===this.dir?-r:r):" "+("top"===this.dir?-r:r),null,this.flip,i).target,a=s.x,h=s.y;this.dir="x"===o?a:h,this.align="x"===o?h:a,He(t,this.clsPos+"-"+this.dir+"-"+this.align,!1===this.offset)},getAxis:function(){return"top"===this.dir||"bottom"===this.dir?"y":"x"}}},gn={mixins:[mn,ln],args:"pos",props:{mode:"list",toggle:Boolean,boundary:Boolean,boundaryAlign:Boolean,delayShow:Number,delayHide:Number,clsDrop:String},data:{mode:["click","hover"],toggle:"- *",boundary:window,boundaryAlign:!1,delayShow:0,delayHide:800,clsDrop:!1,animation:["uk-animation-fade"],cls:"uk-open"},computed:{boundary:function(t,e){return xt(t.boundary,e)},clsDrop:function(t){return t.clsDrop||"uk-"+this.$options.name},clsPos:function(){return this.clsDrop}},created:function(){this.tracker=new Ti},connected:function(){ze(this.$el,this.clsDrop);var t=this.$props.toggle;this.toggle=t&&this.$create("toggle",xt(t,this.$el),{target:this.$el,mode:this.mode}),this.toggle||Kt(this.$el,"updatearia")},disconnected:function(){this.isActive()&&(pn=null)},events:[{name:"click",delegate:function(){return"."+this.clsDrop+"-close"},handler:function(t){t.preventDefault(),this.hide(!1)}},{name:"click",delegate:function(){return'a[href^="#"]'},handler:function(t){var e=t.defaultPrevented,i=t.current.hash;e||!i||Yt(i,this.$el)||this.hide(!1)}},{name:"beforescroll",handler:function(){this.hide(!1)}},{name:"toggle",self:!0,handler:function(t,e){t.preventDefault(),this.isToggled()?this.hide(!1):this.show(e,!1)}},{name:"toggleshow",self:!0,handler:function(t,e){t.preventDefault(),this.show(e)}},{name:"togglehide",self:!0,handler:function(t){t.preventDefault(),this.hide()}},{name:vt,filter:function(){return b(this.mode,"hover")},handler:function(t){ne(t)||this.clearTimers()}},{name:wt,filter:function(){return b(this.mode,"hover")},handler:function(t){ne(t)||Mt(this.$el,":hover")||this.hide()}},{name:"beforeshow",self:!0,handler:function(){this.clearTimers(),ni.cancel(this.$el),this.position()}},{name:"show",self:!0,handler:function(){var n=this;(pn=this).tracker.init(),Kt(this.$el,"updatearia");var t=vn(document,"click",function(t){var e=t.defaultPrevented,i=t.target;e||Yt(i,n.$el)||n.toggle&&Yt(i,n.toggle.$el)||n.hide(!1)});Gt(this.$el,"hide",t,{self:!0})}},{name:"beforehide",self:!0,handler:function(){this.clearTimers()}},{name:"hide",handler:function(t){var e=t.target;this.$el===e?(pn=this.isActive()?null:pn,Kt(this.$el,"updatearia"),this.tracker.cancel()):pn=null===pn&&Yt(e,this.$el)&&this.isToggled()?this:pn}},{name:"updatearia",self:!0,handler:function(t,e){t.preventDefault(),this.updateAria(this.$el),(e||this.toggle)&&(ot((e||this.toggle).$el,"aria-expanded",this.isToggled()),He(this.toggle.$el,this.cls,this.isToggled()))}}],update:{write:function(){this.isToggled()&&!ni.inProgress(this.$el)&&this.position()},events:["resize"]},methods:{show:function(t,e){var i=this;if(void 0===t&&(t=this.toggle),void 0===e&&(e=!0),this.isToggled()&&t&&this.toggle&&t.$el!==this.toggle.$el&&this.hide(!1),this.toggle=t,this.clearTimers(),!this.isActive()){if(pn){if(e&&pn.isDelaying)return void(this.showTimer=setTimeout(this.show,10));for(;pn&&!Yt(this.$el,pn.$el);)pn.hide(!1)}this.showTimer=setTimeout(function(){return!i.isToggled()&&i.toggleElement(i.$el,!0)},e&&this.delayShow||0)}},hide:function(t){var e=this;void 0===t&&(t=!0);function i(){return e.toggleNow(e.$el,!1)}var n,r;this.clearTimers(),this.isDelaying=(n=this.$el,r=[],Ae(n,function(t){return"static"!==Ve(t,"position")&&r.push(t)}),r).some(function(t){return e.tracker.movesTo(t)}),t&&this.isDelaying?this.hideTimer=setTimeout(this.hide,50):t&&this.delayHide?this.hideTimer=setTimeout(i,this.delayHide):i()},clearTimers:function(){clearTimeout(this.showTimer),clearTimeout(this.hideTimer),this.showTimer=null,this.hideTimer=null,this.isDelaying=!1},isActive:function(){return pn===this},position:function(){Pe(this.$el,this.clsDrop+"-(stack|boundary)"),Ve(this.$el,{top:"",left:"",display:"block"}),He(this.$el,this.clsDrop+"-boundary",this.boundaryAlign);var t=si(this.boundary),e=this.boundaryAlign?t:si(this.toggle.$el);if("justify"===this.align){var i="y"===this.getAxis()?"width":"height";Ve(this.$el,i,e[i])}else this.$el.offsetWidth>Math.max(t.right-e.left,e.right-t.left)&&ze(this.$el,this.clsDrop+"-stack");this.positionAt(this.$el,this.boundaryAlign?this.boundary:this.toggle.$el,this.boundary),Ve(this.$el,"display","")}}};function vn(t,e,i){var n=Gt(t,e,function(){return n=Ut(t,e,i)},!0);return function(){return n()}}var wn={extends:gn},bn={mixins:[hn],args:"target",props:{target:Boolean},data:{target:!1},computed:{input:function(t,e){return Ce(Vt,e)},state:function(){return this.input.nextElementSibling},target:function(t,e){var i=t.target;return i&&(!0===i&&this.input.parentNode===e&&this.input.nextElementSibling||xt(i,e))}},update:function(){var t=this.target,e=this.input;if(t){var i,n=Rt(t)?"value":"textContent",r=t[n],o=e.files&&e.files[0]?e.files[0].name:Mt(e,"select")&&(i=Ne("option",e).filter(function(t){return t.selected})[0])?i.textContent:e.value;r!==o&&(t[n]=o)}},events:[{name:"change",handler:function(){this.$update()}},{name:"reset",el:function(){return Dt(this.$el,"form")},handler:function(){this.$update()}}]},xn={update:{read:function(t){var e=Pi(this.$el);if(!e||t.isInView===e)return!1;t.isInView=e},write:function(){this.$el.src=this.$el.src},events:["scroll","resize"]}},yn={props:{margin:String,firstColumn:Boolean},data:{margin:"uk-margin-small-top",firstColumn:"uk-first-column"},update:{read:function(t){var e=this.$el.children;if(!e.length||!Wt(this.$el))return t.rows=[[]];t.rows=kn(e),t.stacks=!t.rows.some(function(t){return 1=a.bottom-1&&r.top!==a.top){e.push([n]);break}if(r.bottom>a.top){if(r.left=t.offsetHeight)&&Ve(t,"height",e)})},order:5,events:["resize"]}]}:{},Tn={mixins:[Sn],args:"target",props:{target:String,row:Boolean},data:{target:"> *",row:!0,forceHeight:!0},computed:{elements:function(t,e){return Ne(t.target,e)}},update:{read:function(){return{rows:(this.row?kn(this.elements):[this.elements]).map(En)}},write:function(t){t.rows.forEach(function(t){var i=t.heights;return t.elements.forEach(function(t,e){return Ve(t,"minHeight",i[e])})})},events:["resize"]}};function En(t){var e;if(t.length<2)return{heights:[""],elements:t};var i=_n(t),n=i.heights,r=i.max,o=t.some(function(t){return t.style.minHeight}),s=t.some(function(t,e){return!t.style.minHeight&&n[e]";zn.lastIndex=0}return Dn[t][e]}(t,e)||t);return(t=Ce(t.substr(t.indexOf("/g,Dn={};function Pn(t){return Math.ceil(Math.max.apply(Math,Ne("[stroke]",t).map(function(t){return t.getTotalLength&&t.getTotalLength()||0}).concat([0])))}function Bn(t,e){return ot(t,"data-svg")===ot(e,"data-svg")}var On={},Hn={spinner:'',totop:'',marker:'',"close-icon":'',"close-large":'',"navbar-toggle-icon":'',"overlay-icon":'',"pagination-next":'',"pagination-previous":'',"search-icon":'',"search-large":'',"search-navbar":'',"slidenav-next":'',"slidenav-next-large":'',"slidenav-previous":'',"slidenav-previous-large":''},Ln={install:function(r){r.icon.add=function(t,e){var i,n=D(t)?((i={})[t]=e,i):t;J(n,function(t,e){Hn[e]=t,delete On[e]}),r._initialized&&Ae(document.body,function(t){return J(r.getComponents(t),function(t){t.$options.isIcon&&t.icon in n&&t.$reset()})})}},extends:Nn,args:"icon",props:["icon"],data:{include:["focusable"]},isIcon:!0,beforeConnect:function(){ze(this.$el,"uk-icon")},methods:{getSvg:function(){var t,e=function(t){if(!Hn[t])return null;On[t]||(On[t]=Ce(Hn[t].trim()));return On[t].cloneNode(!0)}((t=this.icon,ut?X(X(t,"left","right"),"previous","next"):t));return e?se.resolve(e):se.reject("Icon not found.")}}},Fn={args:!1,extends:Ln,data:function(t){return{icon:d(t.constructor.options.name)}},beforeConnect:function(){ze(this.$el,this.$name)}},jn={extends:Fn,beforeConnect:function(){ze(this.$el,"uk-slidenav")},computed:{icon:function(t,e){var i=t.icon;return Oe(e,"uk-slidenav-large")?i+"-large":i}}},Wn={extends:Fn,computed:{icon:function(t,e){var i=t.icon;return Oe(e,"uk-search-icon")&&Bt(e,".uk-search-large").length?"search-large":Bt(e,".uk-search-navbar").length?"search-navbar":i}}},Vn={extends:Fn,computed:{icon:function(){return"close-"+(Oe(this.$el,"uk-close-large")?"large":"icon")}}},Rn={extends:Fn,connected:function(){var e=this;this.svg.then(function(t){return 1!==e.ratio&&Ve(Ce("circle",t),"strokeWidth",1/e.ratio)},et)}};var qn={args:"dataSrc",props:{dataSrc:String,dataSrcset:Boolean,sizes:String,width:Number,height:Number,offsetTop:String,offsetLeft:String,target:String},data:{dataSrc:"",dataSrcset:!1,sizes:!1,width:!1,height:!1,offsetTop:"50vh",offsetLeft:0,target:!1},computed:{cacheKey:function(t){var e=t.dataSrc;return this.$name+"."+e},width:function(t){var e=t.width,i=t.dataWidth;return e||i},height:function(t){var e=t.height,i=t.dataHeight;return e||i},sizes:function(t){var e=t.sizes,i=t.dataSizes;return e||i},isImg:function(t,e){return Zn(e)},target:{get:function(t){var e=t.target;return[this.$el].concat(yt(e,this.$el))},watch:function(){this.observe()}},offsetTop:function(t){return wi(t.offsetTop,"height")},offsetLeft:function(t){return wi(t.offsetLeft,"width")}},connected:function(){tr[this.cacheKey]?Yn(this.$el,tr[this.cacheKey]||this.dataSrc,this.dataSrcset,this.sizes):this.isImg&&this.width&&this.height&&Yn(this.$el,function(t,e,i){var n;i&&(n=rt.ratio({width:t,height:e},"width",wi(Xn(i))),t=n.width,e=n.height);return'data:image/svg+xml;utf8,'}(this.width,this.height,this.sizes)),this.observer=new Vi(this.load,{rootMargin:this.offsetTop+"px "+this.offsetLeft+"px"}),requestAnimationFrame(this.observe)},disconnected:function(){this.observer.disconnect()},update:{read:function(t){var e=this,i=t.image;if(i||"complete"!==document.readyState||this.load(this.observer.takeRecords()),this.isImg)return!1;i&&i.then(function(t){return t&&""!==t.currentSrc&&Yn(e.$el,Qn(t))})},write:function(t){if(this.dataSrcset&&1!==window.devicePixelRatio){var e=Ve(this.$el,"backgroundSize");!e.match(/^(auto\s?)+$/)&&j(e)!==t.bgSize||(t.bgSize=(i=this.dataSrcset,n=this.sizes,r=wi(Xn(n)),(o=(i.match(Jn)||[]).map(j).sort(function(t,e){return t-e})).filter(function(t){return r<=t})[0]||o.pop()||""),Ve(this.$el,"backgroundSize",t.bgSize+"px"))}var i,n,r,o},events:["resize"]},methods:{load:function(t){var e=this;t.some(function(t){return H(t.isIntersecting)||t.isIntersecting})&&(this._data.image=de(this.dataSrc,this.dataSrcset,this.sizes).then(function(t){return Yn(e.$el,Qn(t),t.srcset,t.sizes),tr[e.cacheKey]=Qn(t),t},et),this.observer.disconnect())},observe:function(){var e=this;this._connected&&!this._data.image&&this.target.forEach(function(t){return e.observer.observe(t)})}}};function Yn(t,e,i,n){if(Zn(t))n&&(t.sizes=n),i&&(t.srcset=i),e&&(t.src=e);else if(e){!b(t.style.backgroundImage,e)&&(Ve(t,"backgroundImage","url("+Lt(e)+")"),Kt(t,Jt("load",!1)))}}var Un=/\s*(.*?)\s*(\w+|calc\(.*?\))\s*(?:,|$)/g;function Xn(t){var e,i;for(Un.lastIndex=0;e=Un.exec(t);)if(!e[1]||window.matchMedia(e[1]).matches){e=w(i=e[2],"calc")?i.substring(5,i.length-1).replace(Gn,function(t){return wi(t)}).replace(/ /g,"").match(Kn).reduce(function(t,e){return t+ +e},0):i;break}return e||"100vw"}var Gn=/\d+(?:\w+|%)/g,Kn=/[+-]?(\d+)/g;var Jn=/\s+\d+w\s*(?:,|$)/g;function Zn(t){return"IMG"===t.tagName}function Qn(t){return t.currentSrc||t.src}var tr,er="__test__";try{(tr=window.sessionStorage||{})[er]=1,delete tr[er]}catch(t){tr={}}var ir={props:{media:Boolean},data:{media:!1},computed:{matchMedia:function(){var t=function(t){if(D(t)){if("@"===t[0])t=j(Ue("breakpoint-"+t.substr(1)));else if(isNaN(t))return t}return!(!t||isNaN(t))&&"(min-width: "+t+"px)"}(this.media);return!t||window.matchMedia(t).matches}}};var nr={mixins:[hn,ir],props:{fill:String},data:{fill:"",clsWrapper:"uk-leader-fill",clsHide:"uk-leader-hide",attrFill:"data-fill"},computed:{fill:function(t){return t.fill||Ue("leader-fill-content")}},connected:function(){var t;t=Ie(this.$el,''),this.wrapper=t[0]},disconnected:function(){Se(this.wrapper.childNodes)},update:{read:function(t){var e=t.changed,i=t.width,n=i;return{width:i=Math.floor(this.$el.offsetWidth/2),fill:this.fill,changed:e||n!==i,hide:!this.matchMedia}},write:function(t){He(this.wrapper,this.clsHide,t.hide),t.changed&&(t.changed=!1,ot(this.wrapper,this.attrFill,new Array(t.width).join(t.fill)))},events:["resize"]}},rr={props:{container:Boolean},data:{container:!0},computed:{container:function(t){var e=t.container;return!0===e&&this.$container||e&&Ce(e)}}},or=[],sr={mixins:[hn,rr,ln],props:{selPanel:String,selClose:String,escClose:Boolean,bgClose:Boolean,stack:Boolean},data:{cls:"uk-open",escClose:!0,bgClose:!0,overlay:!0,stack:!1},computed:{panel:function(t,e){return Ce(t.selPanel,e)},transitionElement:function(){return this.panel},bgClose:function(t){return t.bgClose&&this.panel}},beforeDisconnect:function(){this.isToggled()&&this.toggleNow(this.$el,!1)},events:[{name:"click",delegate:function(){return this.selClose},handler:function(t){t.preventDefault(),this.hide()}},{name:"toggle",self:!0,handler:function(t){t.defaultPrevented||(t.preventDefault(),this.toggle())}},{name:"beforeshow",self:!0,handler:function(t){if(b(or,this))return!1;!this.stack&&or.length?(se.all(or.map(function(t){return t.hide()})).then(this.show),t.preventDefault()):or.push(this)}},{name:"show",self:!0,handler:function(){var r=this;ci(window)-ci(document)&&this.overlay&&Ve(document.body,"overflowY","scroll"),ze(document.documentElement,this.clsPage),this.bgClose&&Gt(this.$el,"hide",vn(document,"click",function(t){var e=t.defaultPrevented,i=t.target,n=K(or);e||n!==r||n.overlay&&!Yt(i,n.$el)||Yt(i,n.panel)||n.hide()}),{self:!0}),this.escClose&&Gt(this.$el,"hide",Ut(document,"keydown",function(t){var e=K(or);27===t.keyCode&&e===r&&(t.preventDefault(),e.hide())}),{self:!0})}},{name:"hidden",self:!0,handler:function(){var e=this;or.splice(or.indexOf(this),1),or.length||Ve(document.body,"overflowY",""),or.some(function(t){return t.clsPage===e.clsPage})||De(document.documentElement,this.clsPage)}}],methods:{toggle:function(){return this.isToggled()?this.hide():this.show()},show:function(){var e=this;return this.container&&this.$el.parentNode!==this.container?(we(this.container,this.$el),new se(function(t){return requestAnimationFrame(function(){return e.show().then(t)})})):this.toggleElement(this.$el,!0,ar(this))},hide:function(){return this.toggleElement(this.$el,!1,ar(this))}}};function ar(t){var s=t.transitionElement,a=t._toggle;return function(r,o){return new se(function(i,n){return Gt(r,"show hide",function(){r._reject&&r._reject(),r._reject=n,a(r,o);var t=Gt(s,"transitionstart",function(){Gt(s,"transitionend transitioncancel",i,{self:!0}),clearTimeout(e)},{self:!0}),e=setTimeout(function(){t(),i()},Y(Ve(s,"transitionDuration")))})})}}var hr={install:function(a){a.modal.dialog=function(t,e){var i=a.modal('
'+t+"
",e);return i.show(),Ut(i.$el,"hidden",function(){return se.resolve(function(){return i.$destroy(!0)})},{self:!0}),i},a.modal.alert=function(e,i){return i=G({bgClose:!1,escClose:!1,labels:a.modal.labels},i),new se(function(t){return Ut(a.modal.dialog('
'+(D(e)?e:ve(e))+'
",i).$el,"hide",t)})},a.modal.confirm=function(r,o){return o=G({bgClose:!1,escClose:!0,labels:a.modal.labels},o),new se(function(e,t){var i=a.modal.dialog('
'+(D(r)?r:ve(r))+'
",o),n=!1;Ut(i.$el,"submit","form",function(t){t.preventDefault(),e(),n=!0,i.hide()}),Ut(i.$el,"hide",function(){n||t()})})},a.modal.prompt=function(t,o,s){return s=G({bgClose:!1,escClose:!0,labels:a.modal.labels},s),new se(function(e){var i=a.modal.dialog('
",s),n=Ce("input",i.$el);n.value=o;var r=!1;Ut(i.$el,"submit","form",function(t){t.preventDefault(),e(n.value),r=!0,i.hide()}),Ut(i.$el,"hide",function(){r||e(null)})})},a.modal.labels={ok:"Ok",cancel:"Cancel"}},mixins:[sr],data:{clsPage:"uk-modal-page",selPanel:".uk-modal-dialog",selClose:".uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full"},events:[{name:"show",self:!0,handler:function(){Oe(this.panel,"uk-margin-auto-vertical")?ze(this.$el,"uk-flex"):Ve(this.$el,"display","block"),ui(this.$el)}},{name:"hidden",self:!0,handler:function(){Ve(this.$el,"display",""),De(this.$el,"uk-flex")}}]};var lr={extends:un,data:{targets:"> .uk-parent",toggle:"> a",content:"> ul"}},ur={mixins:[hn,Sn],props:{dropdown:String,mode:"list",align:String,offset:Number,boundary:Boolean,boundaryAlign:Boolean,clsDrop:String,delayShow:Number,delayHide:Number,dropbar:Boolean,dropbarMode:String,dropbarAnchor:Boolean,duration:Number},data:{dropdown:".uk-navbar-nav > li",align:ut?"right":"left",clsDrop:"uk-navbar-dropdown",mode:void 0,offset:void 0,delayShow:void 0,delayHide:void 0,boundaryAlign:void 0,flip:"x",boundary:!0,dropbar:!1,dropbarMode:"slide",dropbarAnchor:!1,duration:200,forceHeight:!0,selMinHeight:".uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle"},computed:{boundary:function(t,e){var i=t.boundary,n=t.boundaryAlign;return!0===i||n?e:i},dropbarAnchor:function(t,e){return xt(t.dropbarAnchor,e)},pos:function(t){return"bottom-"+t.align},dropbar:{get:function(t){var e=t.dropbar;return e?(e=this._dropbar||xt(e,this.$el)||Ce("+ .uk-navbar-dropbar",this.$el))||(this._dropbar=Ce("
")):null},watch:function(t){ze(t,"uk-navbar-dropbar"),He(t,"uk-navbar-dropbar-slide","slide"===this.dropbarMode)},immediate:!0},dropdowns:{get:function(t,e){return Ne(t.dropdown+" ."+t.clsDrop,e)},watch:function(t){var e=this;this.$create("drop",t.filter(function(t){return!e.getDropdown(t)}),G({},this.$props,{boundary:this.boundary,pos:this.pos,offset:this.dropbar||this.offset}))},immediate:!0}},disconnected:function(){this.dropbar&&ke(this.dropbar),delete this._dropbar},events:[{name:"mouseover",delegate:function(){return this.dropdown},handler:function(t){var e=t.current,i=this.getActive();i&&i.toggle&&!Yt(i.toggle.$el,e)&&!i.tracker.movesTo(i.$el)&&i.hide(!1)}},{name:"mouseleave",el:function(){return this.dropbar},handler:function(){var t=this.getActive();t&&!this.dropdowns.some(function(t){return Mt(t,":hover")})&&t.hide()}},{name:"beforeshow",capture:!0,filter:function(){return this.dropbar},handler:function(){this.dropbar.parentNode||xe(this.dropbarAnchor||this.$el,this.dropbar)}},{name:"show",capture:!0,filter:function(){return this.dropbar},handler:function(t,e){var i=e.$el,n=e.dir;this.clsDrop&&ze(i,this.clsDrop+"-dropbar"),"bottom"===n&&this.transitionTo(i.offsetHeight+j(Ve(i,"marginTop"))+j(Ve(i,"marginBottom")),i)}},{name:"beforehide",filter:function(){return this.dropbar},handler:function(t,e){var i=e.$el,n=this.getActive();Mt(this.dropbar,":hover")&&n&&n.$el===i&&t.preventDefault()}},{name:"hide",filter:function(){return this.dropbar},handler:function(t,e){var i=e.$el,n=this.getActive();(!n||n&&n.$el===i)&&this.transitionTo(0)}}],methods:{getActive:function(){var t=this.dropdowns.map(this.getDropdown).filter(function(t){return t&&t.isActive()})[0];return t&&b(t.mode,"hover")&&Yt(t.toggle.$el,this.$el)&&t},transitionTo:function(t,e){var i=this,n=this.dropbar,r=Wt(n)?ui(n):0;return Ve(e=r"),ze(this.panel.parentNode,this.clsMode)),Ve(document.documentElement,"overflowY",this.overlay?"hidden":""),ze(document.body,this.clsContainer,this.clsFlip),Ve(document.body,"touch-action","pan-y pinch-zoom"),Ve(this.$el,"display","block"),ze(this.$el,this.clsOverlay),ze(this.panel,this.clsSidebarAnimation,"reveal"!==this.mode?this.clsMode:""),ui(document.body),ze(document.body,this.clsContainerAnimation),this.clsContainerAnimation&&(dr().content+=",user-scalable=0")}},{name:"hide",self:!0,handler:function(){De(document.body,this.clsContainerAnimation),Ve(document.body,"touch-action","")}},{name:"hidden",self:!0,handler:function(){var t;this.clsContainerAnimation&&((t=dr()).content=t.content.replace(/,user-scalable=0$/,"")),"reveal"===this.mode&&Se(this.panel),De(this.panel,this.clsSidebarAnimation,this.clsMode),De(this.$el,this.clsOverlay),Ve(this.$el,"display",""),De(document.body,this.clsContainer,this.clsFlip),Ve(document.documentElement,"overflowY","")}},{name:"swipeLeft swipeRight",handler:function(t){this.isToggled()&&u(t.type,"Left")^this.flip&&this.hide()}}]};function dr(){return Ce('meta[name="viewport"]',document.head)||we(document.head,'')}var fr={mixins:[hn],props:{selContainer:String,selContent:String},data:{selContainer:".uk-modal",selContent:".uk-modal-dialog"},computed:{container:function(t,e){return Dt(e,t.selContainer)},content:function(t,e){return Dt(e,t.selContent)}},connected:function(){Ve(this.$el,"minHeight",150)},update:{read:function(){return!(!this.content||!this.container)&&{current:j(Ve(this.$el,"maxHeight")),max:Math.max(150,ui(this.container)-(si(this.content).height-ui(this.$el)))}},write:function(t){var e=t.current,i=t.max;Ve(this.$el,"maxHeight",i),Math.round(e)!==Math.round(i)&&Kt(this.$el,"resize")},events:["resize"]}},pr={props:["width","height"],connected:function(){ze(this.$el,"uk-responsive-width")},update:{read:function(){return!!(Wt(this.$el)&&this.width&&this.height)&&{width:ci(this.$el.parentNode),height:this.height}},write:function(t){ui(this.$el,rt.contain({height:this.height,width:this.width},t).height)},events:["resize"]}},mr={props:{duration:Number,offset:Number},data:{duration:1e3,offset:0},methods:{scrollTo:function(t){var e=this;t=t&&Ce(t)||document.body,Kt(this.$el,"beforescroll",[this,t])&&Oi(t,this.$props).then(function(){return Kt(e.$el,"scrolled",[e,t])})}},events:{click:function(t){t.defaultPrevented||(t.preventDefault(),this.scrollTo(Lt(decodeURIComponent(this.$el.hash)).substr(1)))}}},gr={args:"cls",props:{cls:String,target:String,hidden:Boolean,offsetTop:Number,offsetLeft:Number,repeat:Boolean,delay:Number},data:function(){return{cls:!1,target:!1,hidden:!0,offsetTop:0,offsetLeft:0,repeat:!1,delay:0,inViewClass:"uk-scrollspy-inview"}},computed:{elements:{get:function(t,e){var i=t.target;return i?Ne(i,e):[e]},watch:function(t){this.hidden&&Ve(qt(t,":not(."+this.inViewClass+")"),"visibility","hidden")},immediate:!0}},update:[{read:function(t){var i=this;t.update&&this.elements.forEach(function(t){var e=t._ukScrollspyState;(e=e||{cls:ht(t,"uk-scrollspy-class")||i.cls}).show=Pi(t,i.offsetTop,i.offsetLeft),t._ukScrollspyState=e})},write:function(n){var r=this;if(!n.update)return this.$update(),n.update=!0;this.elements.forEach(function(e){function t(t){Ve(e,"visibility",!t&&r.hidden?"hidden":""),He(e,r.inViewClass,t),He(e,i.cls),Kt(e,t?"inview":"outview"),i.inview=t,r.$update(e)}var i=e._ukScrollspyState;!i.show||i.inview||i.queued?!i.show&&i.inview&&!i.queued&&r.repeat&&t(!1):(i.queued=!0,n.promise=(n.promise||se.resolve()).then(function(){return new se(function(t){return setTimeout(t,r.delay)})}).then(function(){t(!0),setTimeout(function(){return i.queued=!1},300)}))})},events:["scroll","resize"]}]},vr={props:{cls:String,closest:String,scroll:Boolean,overflow:Boolean,offset:Number},data:{cls:"uk-active",closest:!1,scroll:!1,overflow:!0,offset:0},computed:{links:{get:function(t,e){return Ne('a[href^="#"]',e).filter(function(t){return t.hash})},watch:function(t){this.scroll&&this.$create("scroll",t,{offset:this.offset||0})},immediate:!0},targets:function(){return Ne(this.links.map(function(t){return Lt(t.hash).substr(1)}).join(","))},elements:function(t){var e=t.closest;return Dt(Ne(this.targets.map(function(t){return'[href="#'+t.id+'"]'}).join(",")),e||"*")}},update:[{read:function(){var i=this,t=this.targets.length;if(!t||!Wt(this.$el))return!1;var e=K(Li(this.targets[0])),n=e.scrollTop,r=e.scrollHeight,o=Fi(e),s=n,a=r-si(o).height,h=!1;return s===a?h=t-1:(this.targets.every(function(t,e){if(hi(t,o).top-i.offset<=0)return h=e,!0}),!1===h&&this.overflow&&(h=0)),{active:h}},write:function(t){var e=t.active;this.links.forEach(function(t){return t.blur()}),De(this.elements,this.cls),!1!==e&&Kt(this.$el,"active",[e,ze(this.elements[e],this.cls)])},events:["scroll","resize"]}]},wr={mixins:[hn,ir],props:{top:null,bottom:Boolean,offset:String,animation:String,clsActive:String,clsInactive:String,clsFixed:String,clsBelow:String,selTarget:String,widthElement:Boolean,showOnUp:Boolean,targetOffset:Number},data:{top:0,bottom:!1,offset:0,animation:"",clsActive:"uk-active",clsInactive:"",clsFixed:"uk-sticky-fixed",clsBelow:"uk-sticky-below",selTarget:"",widthElement:!1,showOnUp:!1,targetOffset:!1},computed:{offset:function(t){return wi(t.offset)},selTarget:function(t,e){var i=t.selTarget;return i&&Ce(i,e)||e},widthElement:function(t,e){return xt(t.widthElement,e)||this.placeholder},isActive:{get:function(){return Oe(this.selTarget,this.clsActive)},set:function(t){t&&!this.isActive?(Be(this.selTarget,this.clsInactive,this.clsActive),Kt(this.$el,"active")):t||Oe(this.selTarget,this.clsInactive)||(Be(this.selTarget,this.clsActive,this.clsInactive),Kt(this.$el,"inactive"))}}},connected:function(){this.placeholder=Ce("+ .uk-sticky-placeholder",this.$el)||Ce('
'),this.isFixed=!1,this.isActive=!1},disconnected:function(){this.isFixed&&(this.hide(),De(this.selTarget,this.clsInactive)),ke(this.placeholder),this.placeholder=null,this.widthElement=null},events:[{name:"load hashchange popstate",el:window,handler:function(){var n=this;if(!1!==this.targetOffset&&location.hash&&0this.topOffset?(ni.cancel(this.$el),ni.out(this.$el,this.animation).then(function(){return i.hide()},et)):this.hide()}else this.isFixed?this.update():this.animation?(ni.cancel(this.$el),this.show(),ni.in(this.$el,this.animation).catch(et)):this.show()},events:["resize","scroll"]}],methods:{show:function(){this.isFixed=!0,this.update(),ot(this.placeholder,"hidden",null)},hide:function(){this.isActive=!1,De(this.$el,this.clsFixed,this.clsBelow),Ve(this.$el,{position:"",top:"",width:""}),ot(this.placeholder,"hidden","")},update:function(){var t=0!==this.top||this.scroll>this.top,e=Math.max(0,this.offset);this.bottom&&this.scroll>this.bottom-this.offset&&(e=this.bottom-this.scroll),Ve(this.$el,{position:"fixed",top:e+"px",width:this.width}),this.isActive=t,He(this.$el,this.clsBelow,this.scroll>this.bottomOffset),ze(this.$el,this.clsFixed)}}};function br(t,e){var i=e.$props,n=e.$el,r=e[t+"Offset"],o=i[t];if(o)return B(o)&&D(o)&&o.match(/^-?\d/)?r+wi(o):si(!0===o?n.parentNode:xt(o,n)).bottom}var xr={mixins:[ln],args:"connect",props:{connect:String,toggle:String,active:Number,swiping:Boolean},data:{connect:"~.uk-switcher",toggle:"> * > :first-child",active:0,swiping:!0,cls:"uk-active",clsContainer:"uk-switcher",attrItem:"uk-switcher-item",queued:!0},computed:{connects:{get:function(t,e){return yt(t.connect,e)},watch:function(t){var e=this;t.forEach(function(t){return e.updateAria(t.children)}),this.swiping&&Ve(t,"touch-action","pan-y pinch-zoom")},immediate:!0},children:{get:function(){return V(this.$el.children)},watch:function(t){this.show(qt(t,"."+this.cls)[0]||t[this.active]||t[0])},immediate:!0},toggles:function(t,e){return Ne(t.toggle,e)}},events:[{name:"click",delegate:function(){return this.toggle+":not(.uk-disabled)"},handler:function(e){e.preventDefault(),this.show(Ot(this.$el).filter(function(t){return Yt(e.current,t)})[0])}},{name:"click",el:function(){return this.connects},delegate:function(){return"["+this.attrItem+"],[data-"+this.attrItem+"]"},handler:function(t){t.preventDefault(),this.show(ht(t.current,this.attrItem))}},{name:"swipeRight swipeLeft",filter:function(){return this.swiping},el:function(){return this.connects},handler:function(t){var e=t.type;this.show(u(e,"Left")?"next":"previous")}}],methods:{index:function(){return O(this.connects)?-1:pe(qt(this.connects[0].children,"."+this.cls)[0])},show:function(t){for(var e,i,n=this,r=this.children,o=r.length,s=this.index(),a=0<=s,h="previous"===t?-1:1,l=me(t,r,s),u=0;u
"}).join("")),e.forEach(function(t,e){return i.children[e].textContent=t}))})}},methods:{start:function(){this.stop(),this.date&&this.units.length&&(this.$update(),this.timer=setInterval(this.$update,1e3))},stop:function(){this.timer&&(clearInterval(this.timer),this.timer=null)}}};var Sr,Tr="uk-animation-target",Er={props:{animation:Number},data:{animation:150},computed:{target:function(){return this.$el}},methods:{animate:function(t){var n=this;!function(){if(Sr)return;(Sr=we(document.head,"',Ra='',ja='',qa='',Ua='',Va='',Ya='',Ga='',Xa='',Ja='',Ka='',Za='',Qa='';const wi={spinner:Za,totop:Qa,marker:za,"close-icon":Ba,"close-large":Ma,"drop-parent-icon":Na,"nav-parent-icon":Fa,"nav-parent-icon-large":Ha,"navbar-parent-icon":La,"navbar-toggle-icon":Wa,"overlay-icon":Ra,"pagination-next":ja,"pagination-previous":qa,"search-icon":Ua,"search-large":Va,"search-navbar":Ya,"slidenav-next":Ga,"slidenav-next-large":Xa,"slidenav-previous":Ja,"slidenav-previous-large":Ka},ws={install:hl,extends:Hn,args:"icon",props:["icon"],data:{include:[]},isIcon:!0,beforeConnect(){y(this.$el,"uk-icon")},methods:{async getSvg(){const t=cl(this.icon);if(!t)throw"Icon not found.";return t}}},Yt={args:!1,extends:ws,data:t=>({icon:Kt(t.constructor.options.name)}),beforeConnect(){y(this.$el,this.$options.id)}},tl={extends:Yt,beforeConnect(){const t=this.$props.icon;this.icon=Y(this.$el,".uk-nav-primary")?`${t}-large`:t}},el={extends:Yt,beforeConnect(){this.icon=B(this.$el,"uk-search-icon")&&ne(this.$el,".uk-search-large").length?"search-large":ne(this.$el,".uk-search-navbar").length?"search-navbar":this.$props.icon}},il={extends:Yt,beforeConnect(){p(this.$el,"role","status")},methods:{async getSvg(){const t=await ws.methods.getSvg.call(this);return this.ratio!==1&&h(w("circle",t),"strokeWidth",1/this.ratio),t}}},Gt={extends:Yt,mixins:[vs],beforeConnect(){const t=Y(this.$el,"a,button");p(t,"role",this.role!==null&&G(t,"a")?"button":this.role);const e=this.t("label");e&&!bt(t,"aria-label")&&p(t,"aria-label",e)}},jn={extends:Gt,beforeConnect(){y(this.$el,"uk-slidenav");const t=this.$props.icon;this.icon=B(this.$el,"uk-slidenav-large")?`${t}-large`:t}},sl={extends:Gt,i18n:{label:"Open menu"}},nl={extends:Gt,i18n:{label:"Close"},beforeConnect(){this.icon=`close-${B(this.$el,"uk-close-large")?"large":"icon"}`}},ol={extends:Gt,i18n:{label:"Open"}},rl={extends:Gt,i18n:{label:"Back to top"}},al={extends:Gt,i18n:{label:"Next page"},data:{role:null}},ll={extends:Gt,i18n:{label:"Previous page"},data:{role:null}},bi={};function hl(t){t.icon.add=(e,i)=>{const s=O(e)?{[e]:i}:e;It(s,(n,o)=>{wi[o]=n,delete bi[o]}),t._initialized&&Tt(document.body,n=>It(t.getComponents(n),o=>{o.$options.isIcon&&o.icon in s&&o.$reset()}))}}function cl(t){return wi[t]?(bi[t]||(bi[t]=w((wi[ul(t)]||wi[t]).trim())),bi[t].cloneNode(!0)):null}function ul(t){return X?Ni(Ni(t,"left","right"),"previous","next"):t}const dl=Lt&&"loading"in HTMLImageElement.prototype;var fl={args:"dataSrc",props:{dataSrc:String,sources:String,margin:String,target:String,loading:String},data:{dataSrc:"",sources:!1,margin:"50%",target:!1,loading:"lazy"},connected(){if(this.loading!=="lazy"){this.load();return}dl&&$i(this.$el)&&(this.$el.loading="lazy",bs(this.$el)),wl(this.$el)},disconnected(){this.img&&(this.img.onload=""),delete this.img},observe:di({target:({$el:t,$props:e})=>[t,...Se(e.target,t)],handler(t,e){this.load(),e.disconnect()},options:({margin:t})=>({rootMargin:t}),filter:({loading:t})=>t==="lazy"}),methods:{load(){if(this.img)return this.img;const t=$i(this.$el)?this.$el:gl(this.$el,this.dataSrc,this.sources);return $e(t,"loading"),bs(this.$el,t.currentSrc),this.img=t}}};function bs(t,e){if($i(t)){const i=A(t);(G(i,"picture")?P(i):[t]).forEach(n=>qn(n,n))}else e&&!g(t.style.backgroundImage,e)&&(h(t,"backgroundImage",`url(${qi(e)})`),m(t,Mt("load",!1)))}const pl=["data-src","data-srcset","sizes"];function qn(t,e){pl.forEach(i=>{const s=tt(t,i);s&&p(e,i.replace(/^(data-)+/,""),s)})}function gl(t,e,i){const s=new Image;return ml(s,i),qn(t,s),s.onload=()=>{bs(t,s.currentSrc)},p(s,"src",e),s}function ml(t,e){if(e=vl(e),e.length){const i=zt("");for(const s of e){const n=zt("");p(n,s),L(i,n)}L(i,t)}}function vl(t){if(!t)return[];if(ot(t,"["))try{t=JSON.parse(t)}catch{t=[]}else t=De(t);return Z(t)||(t=[t]),t.filter(e=>!be(e))}function wl(t){$i(t)&&!bt(t,"src")&&p(t,"src",'data:image/svg+xml;utf8,')}function $i(t){return G(t,"img")}var xi={props:{media:Boolean},data:{media:!1},connected(){const t=bl(this.media,this.$el);if(this.matchMedia=!0,t){this.mediaObj=window.matchMedia(t);const e=()=>{this.matchMedia=this.mediaObj.matches,m(this.$el,Mt("mediachange",!1,!0,[this.mediaObj]))};this.offMediaObj=x(this.mediaObj,"change",()=>{e(),this.$emit("resize")}),e()}},disconnected(){var t;(t=this.offMediaObj)==null||t.call(this)}};function bl(t,e){if(O(t)){if(ot(t,"@"))t=$(h(e,`--uk-breakpoint-${t.substr(1)}`));else if(isNaN(t))return t}return t&&wt(t)?`(min-width: ${t}px)`:""}var $l={mixins:[st,xi],props:{fill:String},data:{fill:"",clsWrapper:"uk-leader-fill",clsHide:"uk-leader-hide",attrFill:"data-fill"},computed:{fill({fill:t}){return t||h(this.$el,"--uk-leader-fill-content")}},connected(){[this.wrapper]=Zi(this.$el,``)},disconnected(){Te(this.wrapper.childNodes)},observe:ft(),update:{read(){return{width:Math.trunc(this.$el.offsetWidth/2),fill:this.fill,hide:!this.matchMedia}},write({width:t,fill:e,hide:i}){q(this.wrapper,this.clsHide,i),p(this.wrapper,this.attrFill,new Array(t).join(e))},events:["resize"]}};const nt=[];var $s={mixins:[st,Ne,Vt],props:{selPanel:String,selClose:String,escClose:Boolean,bgClose:Boolean,stack:Boolean,role:String},data:{cls:"uk-open",escClose:!0,bgClose:!0,overlay:!0,stack:!1,role:"dialog"},computed:{panel({selPanel:t},e){return w(t,e)},transitionElement(){return this.panel},bgClose({bgClose:t}){return t&&this.panel}},connected(){p(this.panel||this.$el,"role",this.role),this.overlay&&p(this.panel||this.$el,"aria-modal",!0)},beforeDisconnect(){g(nt,this)&&this.toggleElement(this.$el,!1,!1)},events:[{name:"click",delegate(){return`${this.selClose},a[href*="#"]`},handler(t){const{current:e,defaultPrevented:i}=t,{hash:s}=e;!i&&s&&re(e)&&!D(s,this.$el)&&w(s,document.body)?this.hide():E(e,this.selClose)&&(t.preventDefault(),this.hide())}},{name:"toggle",self:!0,handler(t){t.defaultPrevented||(t.preventDefault(),this.isToggled()===g(nt,this)&&this.toggle())}},{name:"beforeshow",self:!0,handler(t){if(g(nt,this))return!1;!this.stack&&nt.length?(Promise.all(nt.map(e=>e.hide())).then(this.show),t.preventDefault()):nt.push(this)}},{name:"show",self:!0,handler(){this.stack&&h(this.$el,"zIndex",$(h(this.$el,"zIndex"))+nt.length);const t=[this.overlay&&yl(this),this.overlay&&_n(this.$el),this.bgClose&&kl(this),this.escClose&&Sl(this)];R(this.$el,"hidden",()=>t.forEach(e=>e&&e()),{self:!0}),y(document.documentElement,this.clsPage)}},{name:"shown",self:!0,handler(){Ke(this.$el)||p(this.$el,"tabindex","-1"),E(this.$el,":focus-within")||this.$el.focus()}},{name:"hidden",self:!0,handler(){g(nt,this)&&nt.splice(nt.indexOf(this),1),h(this.$el,"zIndex",""),nt.some(t=>t.clsPage===this.clsPage)||N(document.documentElement,this.clsPage)}}],methods:{toggle(){return this.isToggled()?this.hide():this.show()},show(){return this.container&&A(this.$el)!==this.container?(L(this.container,this.$el),new Promise(t=>requestAnimationFrame(()=>this.show().then(t)))):this.toggleElement(this.$el,!0,Un)},hide(){return this.toggleElement(this.$el,!1,Un)}}};function Un(t,e,{transitionElement:i,_toggle:s}){return new Promise((n,o)=>R(t,"show hide",()=>{var r;(r=t._reject)==null||r.call(t),t._reject=o,s(t,e);const a=R(i,"transitionstart",()=>{R(i,"transitionend transitioncancel",n,{self:!0}),clearTimeout(l)},{self:!0}),l=setTimeout(()=>{a(),n()},xl(h(i,"transitionDuration")))})).then(()=>delete t._reject)}function xl(t){return t?Zt(t,"ms")?$(t):$(t)*1e3:0}function yl(t){return x(document,"focusin",e=>{se(nt)===t&&!D(e.target,t.$el)&&t.$el.focus()})}function kl(t){return x(document,mt,({target:e})=>{se(nt)!==t||t.overlay&&!D(e,t.$el)||D(e,t.panel)||R(document,`${_t} ${oi} scroll`,({defaultPrevented:i,type:s,target:n})=>{!i&&s===_t&&e===n&&t.hide()},!0)})}function Sl(t){return x(document,"keydown",e=>{e.keyCode===27&&se(nt)===t&&t.hide()})}var Il={install:Cl,mixins:[$s],data:{clsPage:"uk-modal-page",selPanel:".uk-modal-dialog",selClose:".uk-modal-close, .uk-modal-close-default, .uk-modal-close-outside, .uk-modal-close-full"},events:[{name:"show",self:!0,handler(){B(this.panel,"uk-margin-auto-vertical")?y(this.$el,"uk-flex"):h(this.$el,"display","block"),et(this.$el)}},{name:"hidden",self:!0,handler(){h(this.$el,"display",""),N(this.$el,"uk-flex")}}]};function Cl({modal:t}){t.dialog=function(i,s){const n=t(`
${i}
`,s);return n.show(),x(n.$el,"hidden",async()=>{await Promise.resolve(),n.$destroy(!0)},{self:!0}),n},t.alert=function(i,s){return e(({i18n:n})=>`
${O(i)?i:Nt(i)}
`,s,n=>n.resolve())},t.confirm=function(i,s){return e(({i18n:n})=>`
${O(i)?i:Nt(i)}
`,s,n=>n.reject())},t.prompt=function(i,s,n){return e(({i18n:o})=>`
`,n,o=>o.resolve(null),o=>w("input",o.$el).value)},t.i18n={ok:"Ok",cancel:"Cancel"};function e(i,s,n,o){s={bgClose:!1,escClose:!0,role:"alertdialog",...s,i18n:{...t.i18n,...s==null?void 0:s.i18n}};const r=t.dialog(i(s),s),a=new Je;let l=!1;return x(r.$el,"submit","form",c=>{c.preventDefault(),a.resolve(o==null?void 0:o(r)),l=!0,r.hide()}),x(r.$el,"hide",()=>!l&&n(a)),a.promise.dialog=r,a.promise}}var Tl={extends:Cn,data:{targets:"> .uk-parent",toggle:"> a",content:"> ul"}},El={extends:On,data:{clsDrop:"uk-navbar-dropdown",selNavItem:".uk-navbar-nav > li > a,a.uk-navbar-item,button.uk-navbar-item,.uk-navbar-item a,.uk-navbar-item button,.uk-navbar-toggle"},watch:{items(){const t=B(this.$el,"uk-navbar-justify");for(const e of F(".uk-navbar-nav, .uk-navbar-left, .uk-navbar-right",this.$el))h(e,"flexGrow",t?F(".uk-navbar-nav > li > a, .uk-navbar-item, .uk-navbar-toggle",e).length:"")}}},Pl={mixins:[$s],args:"mode",props:{mode:String,flip:Boolean,overlay:Boolean,swiping:Boolean},data:{mode:"slide",flip:!1,overlay:!1,clsPage:"uk-offcanvas-page",clsContainer:"uk-offcanvas-container",selPanel:".uk-offcanvas-bar",clsFlip:"uk-offcanvas-flip",clsContainerAnimation:"uk-offcanvas-container-animation",clsSidebarAnimation:"uk-offcanvas-bar-animation",clsMode:"uk-offcanvas",clsOverlay:"uk-offcanvas-overlay",selClose:".uk-offcanvas-close",container:!1,swiping:!0},computed:{clsFlip({flip:t,clsFlip:e}){return t?e:""},clsOverlay({overlay:t,clsOverlay:e}){return t?e:""},clsMode({mode:t,clsMode:e}){return`${e}-${t}`},clsSidebarAnimation({mode:t,clsSidebarAnimation:e}){return t==="none"||t==="reveal"?"":e},clsContainerAnimation({mode:t,clsContainerAnimation:e}){return t!=="push"&&t!=="reveal"?"":e},transitionElement({mode:t}){return t==="reveal"?A(this.panel):this.panel}},observe:In({filter:({swiping:t})=>t}),update:{read(){this.isToggled()&&!j(this.$el)&&this.hide()},events:["resize"]},events:[{name:"touchmove",self:!0,passive:!1,filter(){return this.overlay},handler(t){t.cancelable&&t.preventDefault()}},{name:"show",self:!0,handler(){this.mode==="reveal"&&!B(A(this.panel),this.clsMode)&&(ei(this.panel,"
"),y(A(this.panel),this.clsMode));const{body:t,scrollingElement:e}=document;y(t,this.clsContainer,this.clsFlip),h(t,"touch-action","pan-y pinch-zoom"),h(this.$el,"display","block"),h(this.panel,"maxWidth",e.clientWidth),y(this.$el,this.clsOverlay),y(this.panel,this.clsSidebarAnimation,this.mode==="reveal"?"":this.clsMode),et(t),y(t,this.clsContainerAnimation),this.clsContainerAnimation&&_l()}},{name:"hide",self:!0,handler(){N(document.body,this.clsContainerAnimation),h(document.body,"touch-action","")}},{name:"hidden",self:!0,handler(){this.clsContainerAnimation&&Al(),this.mode==="reveal"&&Te(this.panel),N(this.panel,this.clsSidebarAnimation,this.clsMode),N(this.$el,this.clsOverlay),h(this.$el,"display",""),h(this.panel,"maxWidth",""),N(document.body,this.clsContainer,this.clsFlip)}},{name:"swipeLeft swipeRight",handler(t){this.isToggled()&&Zt(t.type,"Left")^this.flip&&this.hide()}}]};function _l(){Vn().content+=",user-scalable=0"}function Al(){const t=Vn();t.content=t.content.replace(/,user-scalable=0$/,"")}function Vn(){return w('meta[name="viewport"]',document.head)||L(document.head,'')}var Ol={mixins:[st],props:{selContainer:String,selContent:String,minHeight:Number},data:{selContainer:".uk-modal",selContent:".uk-modal-dialog",minHeight:150},computed:{container({selContainer:t},e){return Y(e,t)},content({selContent:t},e){return Y(e,t)}},observe:ft({target:({container:t,content:e})=>[t,e]}),update:{read(){return!this.content||!this.container||!j(this.$el)?!1:{max:Math.max(this.minHeight,et(this.container)-(b(this.content).height-et(this.$el)))}},write({max:t}){h(this.$el,{minHeight:this.minHeight,maxHeight:t})},events:["resize"]}},Dl={props:["width","height"],connected(){y(this.$el,"uk-responsive-width")},observe:ft({target:({$el:t})=>[t,A(t)]}),update:{read(){return j(this.$el)&&this.width&&this.height?{width:Ee(A(this.$el)),height:this.height}:!1},write(t){et(this.$el,Xe.contain({height:this.height,width:this.width},t).height)},events:["resize"]}},Bl={props:{offset:Number},data:{offset:0},connected(){Ml(this)},disconnected(){Nl(this)},methods:{async scrollTo(t){t=t&&w(t)||document.body,m(this.$el,"beforescroll",[this,t])&&(await en(t,{offset:this.offset}),m(this.$el,"scrolled",[this,t]))}}};const ze=new Set;function Ml(t){ze.size||x(document,"click",Yn),ze.add(t)}function Nl(t){ze.delete(t),ze.size||Bt(document,"click",Yn)}function Yn(t){if(!t.defaultPrevented)for(const e of ze)D(t.target,e.$el)&&re(e.$el)&&(t.preventDefault(),window.history.pushState({},"",e.$el.href),e.scrollTo(Ri(e.$el)))}var zl={args:"cls",props:{cls:String,target:String,hidden:Boolean,margin:String,repeat:Boolean,delay:Number},data:()=>({cls:"",target:!1,hidden:!0,margin:"-1px",repeat:!1,delay:0,inViewClass:"uk-scrollspy-inview"}),computed:{elements({target:t},e){return t?F(t,e):[e]}},watch:{elements(t){this.hidden&&h(ke(t,`:not(.${this.inViewClass})`),"opacity",0)}},connected(){this.elementData=new Map},disconnected(){for(const[t,e]of this.elementData.entries())N(t,this.inViewClass,(e==null?void 0:e.cls)||"");delete this.elementData},observe:di({target:({elements:t})=>t,handler(t){const e=this.elementData;for(const{target:i,isIntersecting:s}of t){e.has(i)||e.set(i,{cls:tt(i,"uk-scrollspy-class")||this.cls});const n=e.get(i);!this.repeat&&n.show||(n.show=s)}this.$emit()},options:t=>({rootMargin:t.margin}),args:{intersecting:!1}}),update:[{write(t){for(const[e,i]of this.elementData.entries())i.show&&!i.inview&&!i.queued?(i.queued=!0,t.promise=(t.promise||Promise.resolve()).then(()=>new Promise(s=>setTimeout(s,this.delay))).then(()=>{this.toggle(e,!0),setTimeout(()=>{i.queued=!1,this.$emit()},300)})):!i.show&&i.inview&&!i.queued&&this.repeat&&this.toggle(e,!1)}}],methods:{toggle(t,e){var i;const s=this.elementData.get(t);if(s){if((i=s.off)==null||i.call(s),h(t,"opacity",!e&&this.hidden?0:""),q(t,this.inViewClass,e),q(t,s.cls),/\buk-animation-/.test(s.cls)){const n=()=>Gi(t,"uk-animation-[\\w-]+");e?s.off=R(t,"animationcancel animationend",n):n()}m(t,e?"inview":"outview"),s.inview=e,this.$update(t)}}}},Fl={props:{cls:String,closest:String,scroll:Boolean,overflow:Boolean,offset:Number},data:{cls:"uk-active",closest:!1,scroll:!1,overflow:!0,offset:0},computed:{links(t,e){return F('a[href*="#"]',e).filter(i=>i.hash&&re(i))},elements({closest:t}){return Y(this.links,t||"*")}},watch:{links(t){this.scroll&&this.$create("scroll",t,{offset:this.offset||0})}},observe:fi(),update:[{read(){const t=this.links.map(Ri).filter(Boolean),{length:e}=t;if(!e||!j(this.$el))return!1;const[i]=vt(t,!0),{scrollTop:s,scrollHeight:n}=i,o=ht(i),r=n-o.height;let a=!1;if(s===r)a=e-1;else{for(let l=0;l0);l++)a=+l;a===!1&&this.overflow&&(a=0)}return{active:a}},write({active:t}){const e=t!==!1&&!B(this.elements[t],this.cls);this.links.forEach(i=>i.blur());for(let i=0;i
'),this.isFixed=!1,this.setActive(!1)},disconnected(){this.isFixed&&(this.hide(),N(this.selTarget,this.clsInactive)),Xn(this.$el),at(this.placeholder),this.placeholder=null},observe:[ft({handler(){!this.isFixed&&this.$emit("resize")}}),ft({target:()=>[document.documentElement]}),fi()],events:[{name:"resize",el(){return[window,window.visualViewport]},handler(){this.$emit("resizeViewport")}},{name:"load hashchange popstate",el(){return window},filter(){return this.targetOffset!==!1},handler(){const{scrollingElement:t}=document;!location.hash||t.scrollTop===0||setTimeout(()=>{const e=_(w(location.hash)),i=_(this.$el);this.isFixed&&Fi(e,i)&&(t.scrollTop=e.top-i.height-lt(this.targetOffset,"height",this.placeholder)-lt(this.offset,"height",this.placeholder))})}}],update:[{read({height:t,width:e,margin:i,sticky:s},n){if(this.inactive=!this.matchMedia||!j(this.$el),this.inactive)return;const o=this.isFixed&&n.has("resize")&&!s;o&&(Jn(this.selTarget),this.hide()),this.active||({height:t,width:e}=_(this.$el),i=h(this.$el,"margin")),o&&this.show();const r=lt("100vh","height"),a=et(window),l=document.scrollingElement.scrollHeight-r;let c=this.position;this.overflowFlip&&t>r&&(c=c==="top"?"bottom":"top");const u=this.isFixed?this.placeholder:this.$el;let d=lt(this.offset,"height",s?this.$el:u);c==="bottom"&&(t300||n!==o)&&(t.initScroll=r,t.initTimestamp=f),!(this.showOnUp&&!this.isFixed&&Math.abs(t.initScroll-r)<=30&&Math.abs(a-r)<=10))if(this.inactive||rr&&(gt.cancel(this.$el),this.hide());return}this.animation&&r>u?(gt.cancel(this.$el),gt.out(this.$el,this.animation).then(()=>this.hide(),S)):this.hide()}else this.isFixed?this.update():this.animation&&r>u?(gt.cancel(this.$el),this.show(),gt.in(this.$el,this.animation).catch(S)):(Jn(this.selTarget),this.show())},events:["resize","resizeViewport","scroll"]}],methods:{show(){this.isFixed=!0,this.update(),this.placeholder.hidden=!1},hide(){const{offset:t,sticky:e}=this._data;this.setActive(!1),N(this.$el,this.clsFixed,this.clsBelow),e?h(this.$el,"top",t):h(this.$el,{position:"",top:"",width:"",marginTop:""}),this.placeholder.hidden=!0,this.isFixed=!1},update(){let{width:t,scroll:e=0,overflow:i,overflowScroll:s=0,start:n,end:o,offset:r,topOffset:a,height:l,elHeight:c,offsetParentTop:u,sticky:d}=this._data;const f=n!==0||e>n;if(!d){let v="fixed";e>o&&(r+=o-u,v="absolute"),h(this.$el,{position:v,width:t}),h(this.$el,"marginTop",0,"important")}i&&(r-=s),h(this.$el,"top",r),this.setActive(f),q(this.$el,this.clsBelow,e>a+(d?Math.min(l,c):l)),y(this.$el,this.clsFixed)},setActive(t){const e=this.active;this.active=t,t?(Xi(this.selTarget,this.clsInactive,this.clsActive),e!==t&&m(this.$el,"active")):(Xi(this.selTarget,this.clsActive,this.clsInactive),e!==t&&m(this.$el,"inactive"))}}};function xs(t,e,i,s){if(!t)return 0;if(wt(t)||O(t)&&t.match(/^-?\d/))return i+lt(t,"height",e,!0);{const n=t===!0?A(e):rt(t,e);return _(n).bottom-(s&&n&&D(e,n)?$(h(n,"paddingBottom")):0)}}function Gn(t){return t==="true"?!0:t==="false"?!1:t}function Xn(t){h(t,{position:"",top:"",marginTop:"",width:""})}function Jn(t){h(t,"transition","0s"),requestAnimationFrame(()=>h(t,"transition",""))}const ys=".uk-disabled *, .uk-disabled, [disabled]";var Kn={mixins:[Vt],args:"connect",props:{connect:String,toggle:String,itemNav:String,active:Number,followFocus:Boolean,swiping:Boolean},data:{connect:"~.uk-switcher",toggle:"> * > :first-child",itemNav:!1,active:0,cls:"uk-active",attrItem:"uk-switcher-item",selVertical:".uk-nav",followFocus:!1,swiping:!0},computed:{connects({connect:t},e){return Se(t,e)},connectChildren(){return this.connects.map(t=>P(t)).flat()},toggles({toggle:t},e){return F(t,e)},children(){return P(this.$el).filter(t=>this.toggles.some(e=>D(e,t)))}},watch:{connects(t){this.swiping&&h(t,"touchAction","pan-y pinch-zoom"),this.$emit()},connectChildren(){const t=this.index();for(const e of this.connects)P(e).forEach((i,s)=>q(i,this.cls,s===t));this.$emit()},toggles(t){this.$emit();const e=this.index();this.show(~e?e:t[this.active]||t[0])}},connected(){p(this.$el,"role","tablist")},observe:[Me({targets:({connectChildren:t})=>t}),In({target:({connects:t})=>t,filter:({swiping:t})=>t})],events:[{name:"click keydown",delegate(){return this.toggle},handler(t){!E(t.current,ys)&&(t.type==="click"||t.keyCode===T.SPACE)&&(t.preventDefault(),this.show(t.current))}},{name:"keydown",delegate(){return this.toggle},handler(t){const{current:e,keyCode:i}=t,s=E(this.$el,this.selVertical);let n=i===T.HOME?0:i===T.END?"last":i===T.LEFT&&!s||i===T.UP&&s?"previous":i===T.RIGHT&&!s||i===T.DOWN&&s?"next":-1;if(~n){t.preventDefault();const o=this.toggles.filter(a=>!E(a,ys)),r=o[dt(n,o,o.indexOf(e))];r.focus(),this.followFocus&&this.show(r)}}},{name:"click",el(){return this.connects.concat(this.itemNav?Se(this.itemNav,this.$el):[])},delegate(){return`[${this.attrItem}],[data-${this.attrItem}]`},handler(t){Y(t.target,"a,button")&&(t.preventDefault(),this.show(tt(t.current,this.attrItem)))}},{name:"swipeRight swipeLeft",filter(){return this.swiping},el(){return this.connects},handler({type:t}){this.show(Zt(t,"Left")?"next":"previous")}}],update(){var t;p(this.connects,"role","presentation"),p(P(this.$el),"role","presentation");for(const e in this.toggles){const i=this.toggles[e],s=(t=this.connects[0])==null?void 0:t.children[e];p(i,"role","tab"),s&&(i.id=At(this,i,`-tab-${e}`),s.id=At(this,s,`-tabpanel-${e}`),p(i,"aria-controls",s.id),p(s,{role:"tabpanel","aria-labelledby":i.id}))}p(this.$el,"aria-orientation",E(this.$el,this.selVertical)?"vertical":null)},methods:{index(){return xt(this.children,t=>B(t,this.cls))},show(t){const e=this.toggles.filter(r=>!E(r,ys)),i=this.index(),s=dt(!Ue(t)||g(e,t)?t:0,e,dt(this.toggles[i],e)),n=dt(e[s],this.toggles);this.children.forEach((r,a)=>{q(r,this.cls,n===a),p(this.toggles[a],{"aria-selected":n===a,tabindex:n===a?null:-1})});const o=i>=0&&i!==s;this.connects.forEach(async({children:r})=>{await this.toggleElement(k(r).filter(a=>B(a,this.cls)),!1,o),await this.toggleElement(r[n],!0,o)})}}},Ll={mixins:[st],extends:Kn,props:{media:Boolean},data:{media:960,attrItem:"uk-tab-item",selVertical:".uk-tab-left,.uk-tab-right"},connected(){const t=B(this.$el,"uk-tab-left")?"uk-tab-left":B(this.$el,"uk-tab-right")?"uk-tab-right":!1;t&&this.$create("toggle",this.$el,{cls:t,mode:"media",media:this.media})}};const Wl=32;var Rl={mixins:[xi,Vt],args:"target",props:{href:String,target:null,mode:"list",queued:Boolean},data:{href:!1,target:!1,mode:"click",queued:!0},computed:{target({href:t,target:e},i){return e=Se(e||t,i),e.length&&e||[i]}},connected(){g(this.mode,"media")||(Ke(this.$el)||p(this.$el,"tabindex","0"),!this.cls&&G(this.$el,"a")&&p(this.$el,"role","button"))},observe:Me({target:({target:t})=>t}),events:[{name:mt,filter(){return g(this.mode,"hover")},handler(t){this._preventClick=null,!(!Ct(t)||this._showState||this.$el.disabled)&&(m(this.$el,"focus"),R(document,mt,()=>m(this.$el,"blur"),!0,e=>!D(e.target,this.$el)),g(this.mode,"click")&&(this._preventClick=!0))}},{name:`${Rt} ${ue} focus blur`,filter(){return g(this.mode,"hover")},handler(t){if(Ct(t)||this.$el.disabled)return;const e=g([Rt,"focus"],t.type),i=this.isToggled(this.target);if(!(!e&&(t.type===ue&&E(this.$el,":focus")||t.type==="blur"&&E(this.$el,":hover")))){if(this._showState&&e&&i!==this._showState){e||(this._showState=null);return}this._showState=e?i:null,this.toggle(`toggle${e?"show":"hide"}`)}}},{name:"keydown",filter(){return g(this.mode,"click")&&!G(this.$el,"input")},handler(t){t.keyCode===Wl&&(t.preventDefault(),this.$el.click())}},{name:"click",filter(){return["click","hover"].some(t=>g(this.mode,t))},handler(t){let e;(this._preventClick||Y(t.target,'a[href="#"], a[href=""]')||(e=Y(t.target,"a[href]"))&&(!this.isToggled(this.target)||e.hash&&E(this.target,e.hash)))&&t.preventDefault(),!this._preventClick&&g(this.mode,"click")&&this.toggle()}},{name:"mediachange",filter(){return g(this.mode,"media")},el(){return this.target},handler(t,e){e.matches^this.isToggled(this.target)&&this.toggle()}}],methods:{async toggle(t){if(!m(this.target,t||"toggle",[this]))return;if(bt(this.$el,"aria-expanded")&&p(this.$el,"aria-expanded",!this.isToggled(this.target)),!this.queued)return this.toggleElement(this.target);const e=this.target.filter(s=>B(s,this.clsLeave));if(e.length){for(const s of this.target){const n=g(e,s);this.toggleElement(s,n,n)}return}const i=this.target.filter(this.isToggled);await this.toggleElement(i,!1),await this.toggleElement(this.target.filter(s=>!g(i,s)),!0)}}},jl=Object.freeze({__proto__:null,Accordion:Cn,Alert:ca,Close:nl,Cover:da,Drop:An,DropParentIcon:Yt,Dropdown:An,Dropnav:On,FormCustom:xa,Grid:ka,HeightMatch:Ca,HeightViewport:Pa,Icon:ws,Img:fl,Leader:$l,Margin:Mn,Marker:ol,Modal:Il,Nav:Tl,NavParentIcon:tl,Navbar:El,NavbarParentIcon:Yt,NavbarToggleIcon:sl,Offcanvas:Pl,OverflowAuto:Ol,OverlayIcon:Yt,PaginationNext:al,PaginationPrevious:ll,Responsive:Dl,Scroll:Bl,Scrollspy:zl,ScrollspyNav:Fl,SearchIcon:el,SlidenavNext:jn,SlidenavPrevious:jn,Spinner:il,Sticky:Hl,Svg:Hn,Switcher:Kn,Tab:Ll,Toggle:Rl,Totop:rl,Video:Tn});It(jl,(t,e)=>ut.component(e,t)),Qr(ut);const ql=["days","hours","minutes","seconds"];var Ul={mixins:[st],props:{date:String,clsWrapper:String,role:String},data:{date:"",clsWrapper:".uk-countdown-%unit%",role:"timer"},connected(){p(this.$el,"role",this.role),this.date=$(Date.parse(this.$props.date)),this.end=!1,this.start()},disconnected(){this.stop()},events:{name:"visibilitychange",el(){return document},handler(){document.hidden?this.stop():this.start()}},methods:{start(){this.stop(),this.update(),this.timer||(m(this.$el,"countdownstart"),this.timer=setInterval(this.update,1e3))},stop(){this.timer&&(clearInterval(this.timer),m(this.$el,"countdownstop"),this.timer=null)},update(){const t=Vl(this.date);t.total||(this.stop(),this.end||(m(this.$el,"countdownend"),this.end=!0));for(const e of ql){const i=w(this.clsWrapper.replace("%unit%",e),this.$el);if(!i)continue;let s=String(Math.trunc(t[e]));s=s.length<2?`0${s}`:s,i.textContent!==s&&(s=s.split(""),s.length!==i.children.length&&Nt(i,s.map(()=>"").join("")),s.forEach((n,o)=>i.children[o].textContent=n))}}}};function Vl(t){const e=Math.max(0,t-Date.now())/1e3;return{total:e,seconds:e%60,minutes:e/60%60,hours:e/60/60%24,days:e/60/60/24}}const ks="uk-transition-leave",Ss="uk-transition-enter";function Zn(t,e,i,s=0){const n=yi(e,!0),o={opacity:1},r={opacity:0},a=u=>()=>n===yi(e)?u():Promise.reject(),l=a(async()=>{y(e,ks),await Promise.all(to(e).map((u,d)=>new Promise(f=>setTimeout(()=>I.start(u,r,i/2,"ease").then(f),d*s)))),N(e,ks)}),c=a(async()=>{const u=et(e);y(e,Ss),t(),h(P(e),{opacity:0}),await Yl();const d=P(e),f=et(e);h(e,"alignContent","flex-start"),et(e,u);const v=to(e);h(d,r);const C=v.map(async(z,M)=>{await Gl(M*s),await I.start(z,o,i/2,"ease")});u!==f&&C.push(I.start(e,{height:f},i/2+v.length*s,"ease")),await Promise.all(C).then(()=>{N(e,Ss),n===yi(e)&&(h(e,{height:"",alignContent:""}),h(d,{opacity:""}),delete e.dataset.transition)})});return B(e,ks)?Qn(e).then(c):B(e,Ss)?Qn(e).then(l).then(c):l().then(c)}function yi(t,e){return e&&(t.dataset.transition=1+yi(t)),St(t.dataset.transition)||0}function Qn(t){return Promise.all(P(t).filter(I.inProgress).map(e=>new Promise(i=>R(e,"transitionend transitioncanceled",i))))}function to(t){return ms(P(t)).reduce((e,i)=>e.concat(Ye(i.filter(s=>os(s)),"offsetLeft")),[])}function Yl(){return new Promise(t=>requestAnimationFrame(t))}function Gl(t){return new Promise(e=>setTimeout(e,t))}async function Xl(t,e,i){await so();let s=P(e);const n=s.map(f=>eo(f,!0)),o={...h(e,["height","padding"]),display:"block"};await Promise.all(s.concat(e).map(I.cancel)),t(),s=s.concat(P(e).filter(f=>!g(s,f))),await Promise.resolve(),J.flush();const r=p(e,"style"),a=h(e,["height","padding"]),[l,c]=Jl(e,s,n),u=s.map(f=>({style:p(f,"style")}));s.forEach((f,v)=>c[v]&&h(f,c[v])),h(e,o),m(e,"scroll"),J.flush(),await so();const d=s.map((f,v)=>A(f)===e&&I.start(f,l[v],i,"ease")).concat(I.start(e,a,i,"ease"));try{await Promise.all(d),s.forEach((f,v)=>{p(f,u[v]),A(f)===e&&h(f,"display",l[v].opacity===0?"none":"")}),p(e,"style",r)}catch{p(s,"style",""),Kl(e,o)}}function eo(t,e){const i=h(t,"zIndex");return j(t)?{display:"",opacity:e?h(t,"opacity"):"0",pointerEvents:"none",position:"absolute",zIndex:i==="auto"?oe(t):i,...io(t)}:!1}function Jl(t,e,i){const s=e.map((o,r)=>A(o)&&r in i?i[r]?j(o)?io(o):{opacity:0}:{opacity:j(o)?1:0}:!1),n=s.map((o,r)=>{const a=A(e[r])===t&&(i[r]||eo(e[r]));if(!a)return!1;if(!o)delete a.opacity;else if(!("opacity"in o)){const{opacity:l}=a;l%1?o.opacity=1:delete a.opacity}return a});return[s,n]}function Kl(t,e){for(const i in e)h(t,i,"")}function io(t){const{height:e,width:i}=_(t);return{height:e,width:i,transform:"",...ii(t),...h(t,["marginTop","marginLeft"])}}function so(){return new Promise(t=>requestAnimationFrame(t))}var no={props:{duration:Number,animation:Boolean},data:{duration:150,animation:"slide"},methods:{animate(t,e=this.$el){const i=this.animation;return(i==="fade"?Zn:i==="delayed-fade"?(...n)=>Zn(...n,40):i?Xl:()=>(t(),Promise.resolve()))(t,e,this.duration).catch(S)}}},Zl={mixins:[no],args:"target",props:{target:Boolean,selActive:Boolean},data:{target:null,selActive:!1,attrItem:"uk-filter-control",cls:"uk-active",duration:250},computed:{toggles({attrItem:t},e){return F(`[${t}],[data-${t}]`,e)},children({target:t},e){return F(`${t} > *`,e)}},watch:{toggles(t){this.updateState();const e=F(this.selActive,this.$el);for(const i of t){this.selActive!==!1&&q(i,this.cls,g(e,i));const s=nh(i);G(s,"a")&&p(s,"role","button")}},children(t,e){e&&this.updateState()}},events:{name:"click keydown",delegate(){return`[${this.attrItem}],[data-${this.attrItem}]`},handler(t){t.type==="keydown"&&t.keyCode!==T.SPACE||Y(t.target,"a,button")&&(t.preventDefault(),this.apply(t.current))}},methods:{apply(t){const e=this.getState(),i=ro(t,this.attrItem,this.getState());Ql(e,i)||this.setState(i)},getState(){return this.toggles.filter(t=>B(t,this.cls)).reduce((t,e)=>ro(e,this.attrItem,t),{filter:{"":""},sort:[]})},async setState(t,e=!0){t={filter:{"":""},sort:[],...t},m(this.$el,"beforeFilter",[this,t]);for(const i of this.toggles)q(i,this.cls,eh(i,this.attrItem,t));await Promise.all(F(this.target,this.$el).map(i=>{const s=()=>{th(t,i,P(i)),this.$update(this.$el)};return e?this.animate(s,i):s()})),m(this.$el,"afterFilter",[this])},updateState(){J.write(()=>this.setState(this.getState(),!1))}}};function oo(t,e){return De(tt(t,e),["filter"])}function Ql(t,e){return["filter","sort"].every(i=>Ve(t[i],e[i]))}function th(t,e,i){const s=ih(t);i.forEach(r=>h(r,"display",s&&!E(r,s)?"none":""));const[n,o]=t.sort;if(n){const r=sh(i,n,o);Ve(r,i)||L(e,r)}}function ro(t,e,i){const{filter:s,group:n,sort:o,order:r="asc"}=oo(t,e);return(s||V(o))&&(n?s?(delete i.filter[""],i.filter[n]=s):(delete i.filter[n],(be(i.filter)||""in i.filter)&&(i.filter={"":s||""})):i.filter={"":s||""}),V(o)||(i.sort=[o,r]),i}function eh(t,e,{filter:i={"":""},sort:[s,n]}){const{filter:o="",group:r="",sort:a,order:l="asc"}=oo(t,e);return V(a)?r in i&&o===i[r]||!o&&r&&!(r in i)&&!i[""]:s===a&&n===l}function ih({filter:t}){let e="";return It(t,i=>e+=i||""),e}function sh(t,e,i){return[...t].sort((s,n)=>tt(s,e).localeCompare(tt(n,e),void 0,{numeric:!0})*(i==="asc"||-1))}function nh(t){return w("a,button",t)||t}var Is={slide:{show(t){return[{transform:W(t*-100)},{transform:W()}]},percent(t){return Fe(t)},translate(t,e){return[{transform:W(e*-100*t)},{transform:W(e*100*(1-t))}]}}};function Fe(t){return Math.abs(h(t,"transform").split(",")[4]/t.offsetWidth)||0}function W(t=0,e="%"){return t+=t?e:"",`translate3d(${t}, 0, 0)`}function pe(t){return`scale3d(${t}, ${t}, 1)`}var ao={...Is,fade:{show(){return[{opacity:0},{opacity:1}]},percent(t){return 1-h(t,"opacity")},translate(t){return[{opacity:1-t},{opacity:t}]}},scale:{show(){return[{opacity:0,transform:pe(1-.2)},{opacity:1,transform:pe(1)}]},percent(t){return 1-h(t,"opacity")},translate(t){return[{opacity:1-t,transform:pe(1-.2*t)},{opacity:t,transform:pe(1-.2+.2*t)}]}}};function oh(t,e,i,{animation:s,easing:n}){const{percent:o,translate:r,show:a=S}=s,l=a(i),c=new Je;return{dir:i,show(u,d=0,f){const v=f?"linear":n;return u-=Math.round(u*Q(d,-1,1)),this.translate(d),ki(e,"itemin",{percent:d,duration:u,timing:v,dir:i}),ki(t,"itemout",{percent:1-d,duration:u,timing:v,dir:i}),Promise.all([I.start(e,l[1],u,v),I.start(t,l[0],u,v)]).then(()=>{this.reset(),c.resolve()},S),c.promise},cancel(){I.cancel([e,t])},reset(){for(const u in l[0])h([e,t],u,"")},forward(u,d=this.percent()){return I.cancel([e,t]),this.show(u,d,!0)},translate(u){this.reset();const d=r(u,i);h(e,d[1]),h(t,d[0]),ki(e,"itemtranslatein",{percent:u,dir:i}),ki(t,"itemtranslateout",{percent:1-u,dir:i})},percent(){return o(t||e,e,i)},getDistance(){return t==null?void 0:t.offsetWidth}}}function ki(t,e,i){m(t,Mt(e,!1,!1,i))}var rh={i18n:{next:"Next slide",previous:"Previous slide",slideX:"Slide %s",slideLabel:"%s of %s",role:"String"},data:{selNav:!1,role:"region"},computed:{nav({selNav:t},e){return w(t,e)},navChildren(){return P(this.nav)},selNavItem({attrItem:t}){return`[${t}],[data-${t}]`},navItems(t,e){return F(this.selNavItem,e)}},watch:{nav(t,e){p(t,"role","tablist"),e&&this.$emit()},list(t){p(t,"role","presentation")},navChildren(t){p(t,"role","presentation")},navItems(t){for(const e of t){const i=tt(e,this.attrItem),s=w("a,button",e)||e;let n,o=null;if(wt(i)){const r=St(i),a=this.slides[r];a&&(a.id||(a.id=At(this,a,`-item-${i}`)),o=a.id),n=this.t("slideX",$(i)+1),p(s,"role","tab")}else this.list&&(this.list.id||(this.list.id=At(this,this.list,"-items")),o=this.list.id),n=this.t(i);p(s,{"aria-controls":o,"aria-label":p(s,"aria-label")||n})}},slides(t){t.forEach((e,i)=>p(e,{role:this.nav?"tabpanel":"group","aria-label":this.t("slideLabel",i+1,this.length),"aria-roledescription":this.nav?null:"slide"}))},length(t){const e=this.navChildren.length;if(this.nav&&t!==e){Ki(this.nav);for(let i=0;i`)}}},connected(){p(this.$el,{role:this.role,ariaRoleDescription:"carousel"})},update:[{write(){this.navItems.concat(this.nav).forEach(t=>t&&(t.hidden=!this.maxIndex)),this.updateNav()},events:["resize"]}],events:[{name:"click keydown",delegate(){return this.selNavItem},handler(t){Y(t.target,"a,button")&&(t.type==="click"||t.keyCode===T.SPACE)&&(t.preventDefault(),this.show(tt(t.current,this.attrItem)))}},{name:"itemshow",handler:"updateNav"},{name:"keydown",delegate(){return this.selNavItem},handler(t){const{current:e,keyCode:i}=t,s=tt(e,this.attrItem);if(!wt(s))return;let n=i===T.HOME?0:i===T.END?"last":i===T.LEFT?"previous":i===T.RIGHT?"next":-1;~n&&(t.preventDefault(),this.show(n))}}],methods:{updateNav(){const t=this.getValidIndex();let e,i;for(const s of this.navItems){const n=tt(s,this.attrItem),o=w("a,button",s)||s;if(wt(n)){const a=St(n)===t;q(s,this.clsActive,a),p(o,{"aria-selected":a,tabindex:a?null:-1}),a&&(i=o),e=e||E(o,":focus")}else q(s,"uk-invisible",this.finite&&(n==="previous"&&t===0||n==="next"&&t>=this.maxIndex));e&&i&&i.focus()}}}};const Cs={passive:!1,capture:!0},lo={passive:!0,capture:!0},ah="touchstart mousedown",Ts="touchmove mousemove",ho="touchend touchcancel mouseup click input scroll";var lh={props:{draggable:Boolean},data:{draggable:!0,threshold:10},created(){for(const t of["start","move","end"]){const e=this[t];this[t]=i=>{const s=ae(i).x*(X?-1:1);this.prevPos=s===this.pos?this.prevPos:this.pos,this.pos=s,e(i)}}},events:[{name:ah,passive:!0,delegate(){return`${this.selList} > *`},handler(t){!this.draggable||!Ct(t)&&hh(t.target)||Y(t.target,xe)||t.button>0||this.length<2||this.start(t)}},{name:"dragstart",handler(t){t.preventDefault()}},{name:Ts,el(){return this.list},handler:S,...Cs}],methods:{start(){this.drag=this.pos,this._transitioner?(this.percent=this._transitioner.percent(),this.drag+=this._transitioner.getDistance()*this.percent*this.dir,this._transitioner.cancel(),this._transitioner.translate(this.percent),this.dragging=!0,this.stack=[]):this.prevIndex=this.index,x(document,Ts,this.move,Cs),x(document,ho,this.end,lo),h(this.list,"userSelect","none")},move(t){const e=this.pos-this.drag;if(e===0||this.prevPos===this.pos||!this.dragging&&Math.abs(e)r;)this.drag-=r*this.dir,s=o,n-=r,o=this.getIndex(s+this.dir,s),r=this._getDistance(s,o)||i[s].offsetWidth;this.percent=n/r;const a=i[s],l=i[o],c=this.index!==o,u=s===o;let d;[this.index,this.prevIndex].filter(f=>!g([o,s],f)).forEach(f=>{m(i[f],"itemhidden",[this]),u&&(d=!0,this.prevIndex=s)}),(this.index===s&&this.prevIndex!==s||d)&&m(i[this.index],"itemshown",[this]),c&&(this.prevIndex=s,this.index=o,!u&&m(a,"beforeitemhide",[this]),m(l,"beforeitemshow",[this])),this._transitioner=this._translate(Math.abs(this.percent),a,!u&&l),c&&(!u&&m(a,"itemhide",[this]),m(l,"itemshow",[this]))},end(){if(Bt(document,Ts,this.move,Cs),Bt(document,ho,this.end,lo),this.dragging)if(this.dragging=null,this.index===this.prevIndex)this.percent=1-this.percent,this.dir*=-1,this._show(!1,this.index,!0),this._transitioner=null;else{const t=(X?this.dir*(X?1:-1):this.dir)<0==this.prevPos>this.pos;this.index=t?this.index:this.prevIndex,t&&(this.percent=1-this.percent),this.show(this.dir>0&&!t||this.dir<0&&t?"next":"previous",!0)}h(this.list,{userSelect:"",pointerEvents:""}),this.drag=this.percent=null}}};function hh(t){return h(t,"userSelect")!=="none"&&k(t.childNodes).some(e=>e.nodeType===3&&e.textContent.trim())}var ch={props:{autoplay:Boolean,autoplayInterval:Number,pauseOnHover:Boolean},data:{autoplay:!1,autoplayInterval:7e3,pauseOnHover:!0},connected(){p(this.list,"aria-live",this.autoplay?"off":"polite"),this.autoplay&&this.startAutoplay()},disconnected(){this.stopAutoplay()},update(){p(this.slides,"tabindex","-1")},events:[{name:"visibilitychange",el(){return document},filter(){return this.autoplay},handler(){document.hidden?this.stopAutoplay():this.startAutoplay()}}],methods:{startAutoplay(){this.stopAutoplay(),this.interval=setInterval(()=>{this.stack.length||this.draggable&&E(this.$el,":focus-within")||this.pauseOnHover&&E(this.$el,":hover")||this.show("next")},this.autoplayInterval)},stopAutoplay(){clearInterval(this.interval)}}},co={mixins:[ch,lh,rh,vs],props:{clsActivated:Boolean,easing:String,index:Number,finite:Boolean,velocity:Number},data:()=>({easing:"ease",finite:!1,velocity:1,index:0,prevIndex:-1,stack:[],percent:0,clsActive:"uk-active",clsActivated:!1,Transitioner:!1,transitionOptions:{}}),connected(){this.prevIndex=-1,this.index=this.getValidIndex(this.$props.index),this.stack=[]},disconnected(){N(this.slides,this.clsActive)},computed:{duration({velocity:t},e){return uo(e.offsetWidth/t)},list({selList:t},e){return w(t,e)},maxIndex(){return this.length-1},slides(){return P(this.list)},length(){return this.slides.length}},watch:{slides(t,e){e&&this.$emit()}},observe:ft(),methods:{show(t,e=!1){var i;if(this.dragging||!this.length)return;const{stack:s}=this,n=e?0:s.length,o=()=>{s.splice(n,1),s.length&&this.show(s.shift(),!0)};if(s[e?"unshift":"push"](t),!e&&s.length>1){s.length===2&&((i=this._transitioner)==null||i.forward(Math.min(this.duration,200)));return}const r=this.getIndex(this.index),a=B(this.slides,this.clsActive)&&this.slides[r],l=this.getIndex(t,this.index),c=this.slides[l];if(a===c){o();return}if(this.dir=uh(t,r),this.prevIndex=r,this.index=l,a&&!m(a,"beforeitemhide",[this])||!m(c,"beforeitemshow",[this,a])){this.index=this.prevIndex,o();return}const u=this._show(a,c,e).then(()=>{a&&m(a,"itemhidden",[this]),m(c,"itemshown",[this]),s.shift(),this._transitioner=null,requestAnimationFrame(()=>s.length&&this.show(s.shift(),!0))});return a&&m(a,"itemhide",[this]),m(c,"itemshow",[this]),u},getIndex(t=this.index,e=this.index){return Q(dt(t,this.slides,e,this.finite),0,Math.max(0,this.maxIndex))},getValidIndex(t=this.index,e=this.prevIndex){return this.getIndex(t,e)},_show(t,e,i){if(this._transitioner=this._getTransitioner(t,e,this.dir,{easing:i?e.offsetWidth<600?"cubic-bezier(0.25, 0.46, 0.45, 0.94)":"cubic-bezier(0.165, 0.84, 0.44, 1)":this.easing,...this.transitionOptions}),!i&&!t)return this._translate(1),Promise.resolve();const{length:s}=this.stack;return this._transitioner[s>1?"forward":"show"](s>1?Math.min(this.duration,75+75/(s-1)):this.duration,this.percent)},_getDistance(t,e){return this._getTransitioner(t,t!==e&&e).getDistance()},_translate(t,e=this.prevIndex,i=this.index){const s=this._getTransitioner(e===i?!1:e,i);return s.translate(t),s},_getTransitioner(t=this.prevIndex,e=this.index,i=this.dir||1,s=this.transitionOptions){return new this.Transitioner(ee(t)?this.slides[t]:t,ee(e)?this.slides[e]:e,i*(X?-1:1),s)}}};function uh(t,e){return t==="next"?1:t==="previous"||t({preload:1,videoAutoplay:!1,delayControls:3e3,items:[],cls:"uk-open",clsPage:"uk-lightbox-page",selList:".uk-lightbox-items",attrItem:"uk-lightbox-item",selClose:".uk-close-large",selCaption:".uk-lightbox-caption",pauseOnHover:!1,velocity:2,Animations:ao,template:'
    '}),created(){const t=w(this.template),e=w(this.selList,t);this.items.forEach(()=>L(e,"
  • "));const i=w("[uk-close]",t),s=this.t("close");i&&s&&(i.dataset.i18n=JSON.stringify({label:s})),this.$mount(L(this.container,t))},computed:{caption({selCaption:t},e){return w(t,e)}},events:[{name:`${ni} ${mt} keydown`,handler:"showControls"},{name:"click",self:!0,delegate(){return`${this.selList} > *`},handler(t){t.defaultPrevented||this.hide()}},{name:"shown",self:!0,handler(){this.showControls()}},{name:"hide",self:!0,handler(){this.hideControls(),N(this.slides,this.clsActive),I.stop(this.slides)}},{name:"hidden",self:!0,handler(){this.$destroy(!0)}},{name:"keyup",el(){return document},handler({keyCode:t}){if(!this.isToggled(this.$el)||!this.draggable)return;let e=-1;t===T.LEFT?e="previous":t===T.RIGHT?e="next":t===T.HOME?e=0:t===T.END&&(e="last"),~e&&this.show(e)}},{name:"beforeitemshow",handler(t){this.isToggled()||(this.draggable=!1,t.preventDefault(),this.toggleElement(this.$el,!0,!1),this.animation=ao.scale,N(t.target,this.clsActive),this.stack.splice(1,0,this.index))}},{name:"itemshow",handler(){Nt(this.caption,this.getItem().caption||"");for(let t=-this.preload;t<=this.preload;t++)this.loadItem(this.index+t)}},{name:"itemshown",handler(){this.draggable=this.$props.draggable}},{name:"itemload",async handler(t,e){const{source:i,type:s,alt:n="",poster:o,attrs:r={}}=e;if(this.setItem(e,""),!i)return;let a;const l={allowfullscreen:"",style:"max-width: 100%; box-sizing: border-box;","uk-responsive":"","uk-video":`${this.videoAutoplay}`};if(s==="image"||i.match(/\.(avif|jpe?g|jfif|a?png|gif|svg|webp)($|\?)/i)){const c=He("img",{src:i,alt:n,...r});x(c,"load",()=>this.setItem(e,c)),x(c,"error",()=>this.setError(e))}else if(s==="video"||i.match(/\.(mp4|webm|ogv)($|\?)/i)){const c=He("video",{src:i,poster:o,controls:"",playsinline:"","uk-video":`${this.videoAutoplay}`,...r});x(c,"loadedmetadata",()=>this.setItem(e,c)),x(c,"error",()=>this.setError(e))}else if(s==="iframe"||i.match(/\.(html|php)($|\?)/i))this.setItem(e,He("iframe",{src:i,allowfullscreen:"",class:"uk-lightbox-iframe",...r}));else if(a=i.match(/\/\/(?:.*?youtube(-nocookie)?\..*?(?:[?&]v=|\/shorts\/)|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))this.setItem(e,He("iframe",{src:`https://www.youtube${a[1]||""}.com/embed/${a[2]}${a[3]?`?${a[3]}`:""}`,width:1920,height:1080,...l,...r}));else if(a=i.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))try{const{height:c,width:u}=await(await fetch(`https://vimeo.com/api/oembed.json?maxwidth=1920&url=${encodeURI(i)}`,{credentials:"omit"})).json();this.setItem(e,He("iframe",{src:`https://player.vimeo.com/video/${a[1]}${a[2]?`?${a[2]}`:""}`,width:u,height:c,...l,...r}))}catch{this.setError(e)}}}],methods:{loadItem(t=this.index){const e=this.getItem(t);this.getSlide(e).childElementCount||m(this.$el,"itemload",[e])},getItem(t=this.index){return this.items[dt(t,this.slides)]},setItem(t,e){m(this.$el,"itemloaded",[this,Nt(this.getSlide(t),e)])},getSlide(t){return this.slides[this.items.indexOf(t)]},setError(t){this.setItem(t,'')},showControls(){clearTimeout(this.controlsTimer),this.controlsTimer=setTimeout(this.hideControls,this.delayControls),y(this.$el,"uk-active","uk-transition-active")},hideControls(){N(this.$el,"uk-active","uk-transition-active")}}};function He(t,e){const i=zt(`<${t}>`);return p(i,e),i}var dh={install:fh,props:{toggle:String},data:{toggle:"a"},computed:{toggles({toggle:t},e){return F(t,e)}},watch:{toggles(t){this.hide();for(const e of t)G(e,"a")&&p(e,"role","button")}},disconnected(){this.hide()},events:{name:"click",delegate(){return`${this.toggle}:not(.uk-disabled)`},handler(t){t.preventDefault(),this.show(t.current)}},methods:{show(t){const e=Ds(this.toggles.map(go),"source");if(te(t)){const{source:i}=go(t);t=xt(e,({source:s})=>i===s)}return this.panel=this.panel||this.$create("lightboxPanel",{...this.$props,items:e}),x(this.panel.$el,"hidden",()=>this.panel=null),this.panel.show(t)},hide(){var t;return(t=this.panel)==null?void 0:t.hide()}}};function fh(t,e){t.lightboxPanel||t.component("lightboxPanel",po),yt(e.props,t.component("lightboxPanel").options.props)}function go(t){const e={};for(const i of["href","caption","type","poster","alt","attrs"])e[i==="href"?"source":i]=tt(t,i);return e.attrs=De(e.attrs),e}var ph={mixins:[Ne],functional:!0,args:["message","status"],data:{message:"",status:"",timeout:5e3,group:null,pos:"top-center",clsContainer:"uk-notification",clsClose:"uk-notification-close",clsMsg:"uk-notification-message"},install:gh,computed:{marginProp({pos:t}){return`margin${ot(t,"top")?"Top":"Bottom"}`},startProps(){return{opacity:0,[this.marginProp]:-this.$el.offsetHeight}}},created(){const t=w(`.${this.clsContainer}-${this.pos}`,this.container)||L(this.container,`
    `);this.$mount(L(t,``))},async connected(){const t=$(h(this.$el,this.marginProp));await I.start(h(this.$el,this.startProps),{opacity:1,[this.marginProp]:t}),this.timeout&&(this.timer=setTimeout(this.close,this.timeout))},events:{click(t){Y(t.target,'a[href="#"],a[href=""]')&&t.preventDefault(),this.close()},[Rt](){this.timer&&clearTimeout(this.timer)},[ue](){this.timeout&&(this.timer=setTimeout(this.close,this.timeout))}},methods:{async close(t){const e=i=>{const s=A(i);m(i,"close",[this]),at(i),s!=null&&s.hasChildNodes()||at(s)};this.timer&&clearTimeout(this.timer),t||await I.start(this.$el,this.startProps),e(this.$el)}}};function gh(t){t.notification.closeAll=function(e,i){Tt(document.body,s=>{const n=t.getComponent(s,"notification");n&&(!e||e===n.group)&&n.close(i)})}}const Si={x:Ii,y:Ii,rotate:Ii,scale:Ii,color:Es,backgroundColor:Es,borderColor:Es,blur:Xt,hue:Xt,fopacity:Xt,grayscale:Xt,invert:Xt,saturate:Xt,sepia:Xt,opacity:vh,stroke:wh,bgx:wo,bgy:wo},{keys:mo}=Object;var vo={mixins:[xi],props:yo(mo(Si),"list"),data:yo(mo(Si),void 0),computed:{props(t,e){const i={};for(const n in t)n in Si&&!V(t[n])&&(i[n]=t[n].slice());const s={};for(const n in i)s[n]=Si[n](n,e,i[n],i);return s}},events:{load(){this.$emit()}},methods:{reset(){for(const t in this.getCss(0))h(this.$el,t,"")},getCss(t){const e={transform:"",filter:""};for(const i in this.props)this.props[i](e,t);return e.willChange=Object.keys(e).filter(i=>e[i]!=="").join(","),e}}};function Ii(t,e,i){let s=Ti(i)||{x:"px",y:"px",rotate:"deg"}[t]||"",n;return t==="x"||t==="y"?(t=`translate${Et(t)}`,n=o=>$($(o).toFixed(s==="px"?0:6))):t==="scale"&&(s="",n=o=>Ti([o])?lt(o,"width",e,!0)/e.offsetWidth:o),i.length===1&&i.unshift(t==="scale"?1:0),i=ge(i,n),(o,r)=>{o.transform+=` ${t}(${Le(i,r)}${s})`}}function Es(t,e,i){return i.length===1&&i.unshift(We(e,t,"")),i=ge(i,s=>mh(e,s)),(s,n)=>{const[o,r,a]=xo(i,n),l=o.map((c,u)=>(c+=a*(r[u]-c),u===3?$(c):parseInt(c,10))).join(",");s[t]=`rgba(${l})`}}function mh(t,e){return We(t,"color",e).split(/[(),]/g).slice(1,-1).concat(1).slice(0,4).map($)}function Xt(t,e,i){i.length===1&&i.unshift(0);const s=Ti(i)||{blur:"px",hue:"deg"}[t]||"%";return t={fopacity:"opacity",hue:"hue-rotate"}[t]||t,i=ge(i),(n,o)=>{const r=Le(i,o);n.filter+=` ${t}(${r+s})`}}function vh(t,e,i){return i.length===1&&i.unshift(We(e,t,"")),i=ge(i),(s,n)=>{s[t]=Le(i,n)}}function wh(t,e,i){i.length===1&&i.unshift(0);const s=Ti(i),n=Fn(e);return i=ge(i.reverse(),o=>(o=$(o),s==="%"?o*n/100:o)),i.some(([o])=>o)?(h(e,"strokeDasharray",n),(o,r)=>{o.strokeDashoffset=Le(i,r)}):S}function wo(t,e,i,s){i.length===1&&i.unshift(0);const n=t==="bgy"?"height":"width";s[t]=ge(i,a=>lt(a,n,e));const o=["bgx","bgy"].filter(a=>a in s);if(o.length===2&&t==="bgx")return S;if(We(e,"backgroundSize","")==="cover")return bh(t,e,i,s);const r={};for(const a of o)r[a]=bo(e,a);return $o(o,r,s)}function bh(t,e,i,s){const n=$h(e);if(!n.width)return S;const o={width:e.offsetWidth,height:e.offsetHeight},r=["bgx","bgy"].filter(u=>u in s),a={};for(const u of r){const d=s[u].map(([M])=>M),f=Math.min(...d),v=Math.max(...d),C=d.indexOf(f){c(u,d),u.backgroundSize=`${l.width}px ${l.height}px`,u.backgroundRepeat="no-repeat"}}function bo(t,e){return We(t,`background-position-${e.substr(-1)}`,"")}function $o(t,e,i){return function(s,n){for(const o of t){const r=Le(i[o],n);s[`background-position-${o.substr(-1)}`]=`calc(${e[o]} + ${r}px)`}}}const Ci={};function $h(t){const e=h(t,"backgroundImage").replace(/^none|url\(["']?(.+?)["']?\)$/,"$1");if(Ci[e])return Ci[e];const i=new Image;return e&&(i.src=e,!i.naturalWidth)?(i.onload=()=>{Ci[e]=Ps(i),m(t,Mt("load",!1))},Ps(i)):Ci[e]=Ps(i)}function Ps(t){return{width:t.naturalWidth,height:t.naturalHeight}}function ge(t,e=$){const i=[],{length:s}=t;let n=0;for(let o=0;o0;u--)i[o-u][1]=l+c*(n-u+1);n=0}}return i}function xo(t,e){const i=xt(t.slice(1),([,s])=>e<=s)+1;return[t[i-1][0],t[i][0],(e-t[i-1][1])/(t[i][1]-t[i-1][1])]}function Le(t,e){const[i,s,n]=xo(t,e);return ee(i)?i+Math.abs(i-s)*n*(i(i[s]=e,i),{})}var yh={mixins:[vo],props:{target:String,viewport:Number,easing:Number,start:String,end:String},data:{target:!1,viewport:1,easing:1,start:0,end:0},computed:{target({target:t},e){return ko(t&&rt(t,e)||e)},start({start:t}){return lt(t,"height",this.target,!0)},end({end:t,viewport:e}){return lt(t||(e=(1-e)*100)&&`${e}vh+${e}%`,"height",this.target,!0)}},observe:[ft({target:({$el:t,target:e})=>[t,e]}),fi()],update:{read({percent:t},e){if(e.has("scroll")||(t=!1),!j(this.$el))return!1;if(!this.matchMedia)return;const i=t;return t=kh(rs(this.target,this.start,this.end),this.easing),{percent:t,style:i===t?!1:this.getCss(t)}},write({style:t}){if(!this.matchMedia){this.reset();return}t&&h(this.$el,t)},events:["scroll","resize"]}};function kh(t,e){return e>=0?Math.pow(t,e+1):1-Math.pow(1-t,1-e)}function ko(t){return t?"offsetTop"in t?t:ko(A(t)):document.documentElement}var So={update:{write(){if(this.stack.length||this.dragging)return;const t=this.getValidIndex(this.index);!~this.prevIndex||this.index!==t?this.show(t):this._translate(1,this.prevIndex,this.index)},events:["resize"]}},Io={observe:Me({target:({slides:t})=>t,targets:t=>t.getAdjacentSlides()})};function Sh(t,e,i,{center:s,easing:n,list:o}){const r=new Je,a=t?Re(t,o,s):Re(e,o,s)+b(e).width*i,l=e?Re(e,o,s):a+b(t).width*i*(X?-1:1);return{dir:i,show(c,u=0,d){const f=d?"linear":n;return c-=Math.round(c*Q(u,-1,1)),this.translate(u),u=t?u:Q(u,0,1),_s(this.getItemIn(),"itemin",{percent:u,duration:c,timing:f,dir:i}),t&&_s(this.getItemIn(!0),"itemout",{percent:1-u,duration:c,timing:f,dir:i}),I.start(o,{transform:W(-l*(X?-1:1),"px")},c,f).then(r.resolve,S),r.promise},cancel(){I.cancel(o)},reset(){h(o,"transform","")},forward(c,u=this.percent()){return I.cancel(o),this.show(c,u,!0)},translate(c){const u=this.getDistance()*i*(X?-1:1);h(o,"transform",W(Q(-l+(u-u*c),-Ei(o),b(o).width)*(X?-1:1),"px"));const d=this.getActives(),f=this.getItemIn(),v=this.getItemIn(!0);c=t?Q(c,-1,1):0;for(const C of P(o)){const z=g(d,C),M=C===f,Ot=C===v,As=M||!Ot&&(z||i*(X?-1:1)===-1^Pi(C,o)>Pi(t||e));_s(C,`itemtranslate${As?"in":"out"}`,{dir:i,percent:Ot?1-c:M?c:z?1:0})}},percent(){return Math.abs((h(o,"transform").split(",")[4]*(X?-1:1)+a)/(l-a))},getDistance(){return Math.abs(l-a)},getItemIn(c=!1){let u=this.getActives(),d=To(o,Re(e||t,o,s));if(c){const f=u;u=d,d=f}return d[xt(d,f=>!g(u,f))]},getActives(){return To(o,Re(t||e,o,s))}}}function Re(t,e,i){const s=Pi(t,e);return i?s-Ih(t,e):Math.min(s,Co(e))}function Co(t){return Math.max(0,Ei(t)-b(t).width)}function Ei(t){return Dt(P(t),e=>b(e).width)}function Ih(t,e){return b(e).width/2-b(t).width/2}function Pi(t,e){return t&&(ii(t).left+(X?b(t).width-b(e).width:0))*(X?-1:1)||0}function To(t,e){e-=1;const i=b(t).width,s=e+i+2;return P(t).filter(n=>{const o=Pi(n,t),r=o+Math.min(b(n).width,i);return o>=e&&r<=s})}function _s(t,e,i){m(t,Mt(e,!1,!1,i))}var Ch={mixins:[st,co,So,Io],props:{center:Boolean,sets:Boolean},data:{center:!1,sets:!1,attrItem:"uk-slider-item",selList:".uk-slider-items",selNav:".uk-slider-nav",clsContainer:"uk-slider-container",Transitioner:Sh},computed:{avgWidth(){return Ei(this.list)/this.length},finite({finite:t}){return t||Th(this.list,this.center)},maxIndex(){if(!this.finite||this.center&&!this.sets)return this.length-1;if(this.center)return se(this.sets);let t=0;const e=Co(this.list),i=xt(this.slides,s=>{if(t>=e)return!0;t+=b(s).width});return~i?i:this.length-1},sets({sets:t}){if(!t)return;let e=0;const i=[],s=b(this.list).width;for(let n=0;ns&&(e=0),this.center?es/2&&(i.push(+n),e=s/2-o/2):e===0&&i.push(Math.min(+n,this.maxIndex)),e+=o}if(i.length)return i},transitionOptions(){return{center:this.center,list:this.list}},slides(){return P(this.list).filter(j)}},connected(){q(this.$el,this.clsContainer,!w(`.${this.clsContainer}`,this.$el))},observe:ft({target:({slides:t})=>t}),update:{write(){for(const t of this.navItems){const e=St(tt(t,this.attrItem));e!==!1&&(t.hidden=!this.maxIndex||e>this.maxIndex||this.sets&&!g(this.sets,e))}this.length&&!this.dragging&&!this.stack.length&&(this.reorder(),this._translate(1)),this.updateActiveClasses()},events:["resize"]},events:{beforeitemshow(t){!this.dragging&&this.sets&&this.stack.length<2&&!g(this.sets,this.index)&&(this.index=this.getValidIndex());const e=Math.abs(this.index-this.prevIndex+(this.dir>0&&this.indexthis.prevIndex?(this.maxIndex+1)*this.dir:0));if(!this.dragging&&e>1){for(let s=0;s0?"next":"previous");t.preventDefault();return}const i=this.dir<0||!this.slides[this.prevIndex]?this.index:this.prevIndex;this.duration=uo(this.avgWidth/this.velocity)*(b(this.slides[i]).width/this.avgWidth),this.reorder()},itemshow(){~this.prevIndex&&y(this._getTransitioner().getItemIn(),this.clsActive)},itemshown(){this.updateActiveClasses()}},methods:{reorder(){if(this.finite){h(this.slides,"order","");return}const t=this.dir>0&&this.slides[this.prevIndex]?this.prevIndex:this.index;if(this.slides.forEach((n,o)=>h(n,"order",this.dir>0&&o=this.index?-1:"")),!this.center)return;const e=this.slides[t];let i=b(this.list).width/2-b(e).width/2,s=0;for(;i>0;){const n=this.getIndex(--s+t,t),o=this.slides[n];h(o,"order",n>t?-2:-1),i-=b(o).width}},updateActiveClasses(){const t=this._getTransitioner(this.index).getActives(),e=[this.clsActive,(!this.sets||g(this.sets,$(this.index)))&&this.clsActivated||""];for(const i of this.slides){const s=g(t,i);q(i,e,s),p(i,"aria-hidden",!s),p(F(ye,i),"tabindex",s?null:-1)}},getValidIndex(t=this.index,e=this.prevIndex){if(t=this.getIndex(t,e),!this.sets)return t;let i;do{if(g(this.sets,t))return t;i=t,t=this.getIndex(t+this.dir,e)}while(t!==i);return t},getAdjacentSlides(){const{width:t}=b(this.list),e=-t,i=t*2,s=b(this.slides[this.index]).width,n=this.center?t/2-s/2:0,o=new Set;for(const r of[-1,1]){let a=n+(r>0?s:0),l=0;do{const c=this.slides[this.getIndex(this.index+r+l++*r)];a+=b(c).width*r,o.add(c)}while(this.length>l&&a>e&&aDt(s.filter(u=>!l.has(u)),u=>b(u).width))return!0}return!1}function Eh(t){return Math.max(0,...P(t).map(e=>b(e).width))}var Eo={mixins:[vo],data:{selItem:"!li"},beforeConnect(){this.item=rt(this.selItem,this.$el)},disconnected(){this.item=null},events:[{name:"itemin itemout",self:!0,el(){return this.item},handler({type:t,detail:{percent:e,duration:i,timing:s,dir:n}}){J.read(()=>{if(!this.matchMedia)return;const o=this.getCss(_o(t,n,e)),r=this.getCss(Po(t)?.5:n>0?1:0);J.write(()=>{h(this.$el,o),I.start(this.$el,r,i,s).catch(S)})})}},{name:"transitioncanceled transitionend",self:!0,el(){return this.item},handler(){I.cancel(this.$el)}},{name:"itemtranslatein itemtranslateout",self:!0,el(){return this.item},handler({type:t,detail:{percent:e,dir:i}}){J.read(()=>{if(!this.matchMedia){this.reset();return}const s=this.getCss(_o(t,i,e));J.write(()=>h(this.$el,s))})}}]};function Po(t){return Zt(t,"in")}function _o(t,e,i){return i/=2,Po(t)^e<0?i:1-i}var Ph={...Is,fade:{show(){return[{opacity:0,zIndex:0},{zIndex:-1}]},percent(t){return 1-h(t,"opacity")},translate(t){return[{opacity:1-t,zIndex:0},{zIndex:-1}]}},scale:{show(){return[{opacity:0,transform:pe(1+.5),zIndex:0},{zIndex:-1}]},percent(t){return 1-h(t,"opacity")},translate(t){return[{opacity:1-t,transform:pe(1+.5*t),zIndex:0},{zIndex:-1}]}},pull:{show(t){return t<0?[{transform:W(30),zIndex:-1},{transform:W(),zIndex:0}]:[{transform:W(-100),zIndex:0},{transform:W(),zIndex:-1}]},percent(t,e,i){return i<0?1-Fe(e):Fe(t)},translate(t,e){return e<0?[{transform:W(30*t),zIndex:-1},{transform:W(-100*(1-t)),zIndex:0}]:[{transform:W(-t*100),zIndex:0},{transform:W(30*(1-t)),zIndex:-1}]}},push:{show(t){return t<0?[{transform:W(100),zIndex:0},{transform:W(),zIndex:-1}]:[{transform:W(-30),zIndex:-1},{transform:W(),zIndex:0}]},percent(t,e,i){return i>0?1-Fe(e):Fe(t)},translate(t,e){return e<0?[{transform:W(t*100),zIndex:0},{transform:W(-30*(1-t)),zIndex:-1}]:[{transform:W(-30*t),zIndex:-1},{transform:W(100*(1-t)),zIndex:0}]}}},_h={mixins:[st,fo,So,Io],props:{ratio:String,minHeight:Number,maxHeight:Number},data:{ratio:"16:9",minHeight:!1,maxHeight:!1,selList:".uk-slideshow-items",attrItem:"uk-slideshow-item",selNav:".uk-slideshow-nav",Animations:Ph},update:{read(){if(!this.list)return!1;let[t,e]=this.ratio.split(":").map(Number);return e=e*this.list.offsetWidth/t||0,this.minHeight&&(e=Math.max(this.minHeight,e)),this.maxHeight&&(e=Math.min(this.maxHeight,e)),{height:e-le(this.list,"height","content-box")}},write({height:t}){t>0&&h(this.list,"minHeight",t)},events:["resize"]},methods:{getAdjacentSlides(){return[1,-1].map(t=>this.slides[this.getIndex(this.index+t)])}}},Ah={mixins:[st,no],props:{group:String,threshold:Number,clsItem:String,clsPlaceholder:String,clsDrag:String,clsDragState:String,clsBase:String,clsNoDrag:String,clsEmpty:String,clsCustom:String,handle:String},data:{group:!1,threshold:5,clsItem:"uk-sortable-item",clsPlaceholder:"uk-sortable-placeholder",clsDrag:"uk-sortable-drag",clsDragState:"uk-drag",clsBase:"uk-sortable",clsNoDrag:"uk-sortable-nodrag",clsEmpty:"uk-sortable-empty",clsCustom:"",handle:!1,pos:{}},created(){for(const t of["init","start","move","end"]){const e=this[t];this[t]=i=>{yt(this.pos,ae(i)),e(i)}}},events:{name:mt,passive:!1,handler:"init"},computed:{target(){return(this.$el.tBodies||[this.$el])[0]},items(){return P(this.target)},isEmpty(){return be(this.items)},handles({handle:t},e){return t?F(t,e):this.items}},watch:{isEmpty(t){q(this.target,this.clsEmpty,t)},handles(t,e){h(e,{touchAction:"",userSelect:""}),h(t,{touchAction:Wt?"none":"",userSelect:"none"})}},update:{write(t){if(!this.drag||!A(this.placeholder))return;const{pos:{x:e,y:i},origin:{offsetTop:s,offsetLeft:n},placeholder:o}=this;h(this.drag,{top:i-s,left:e-n});const r=this.getSortable(document.elementFromPoint(e,i));if(!r)return;const{items:a}=r;if(a.some(I.inProgress))return;const l=Mh(a,{x:e,y:i});if(a.length&&(!l||l===o))return;const c=this.getSortable(o),u=Nh(r.target,l,o,e,i,r===c&&t.moved!==l);u!==!1&&(u&&o===u||(r!==c?(c.remove(o),t.moved=l):delete t.moved,r.insert(o,u),this.touched.add(r)))},events:["move"]},methods:{init(t){const{target:e,button:i,defaultPrevented:s}=t,[n]=this.items.filter(o=>D(e,o));!n||s||i>0||Wi(e)||D(e,`.${this.clsNoDrag}`)||this.handle&&!D(e,this.handle)||(t.preventDefault(),this.touched=new Set([this]),this.placeholder=n,this.origin={target:e,index:oe(n),...this.pos},x(document,ni,this.move),x(document,_t,this.end),this.threshold||this.start(t))},start(t){this.drag=Bh(this.$container,this.placeholder);const{left:e,top:i}=this.placeholder.getBoundingClientRect();yt(this.origin,{offsetLeft:this.pos.x-e,offsetTop:this.pos.y-i}),y(this.drag,this.clsDrag,this.clsCustom),y(this.placeholder,this.clsPlaceholder),y(this.items,this.clsItem),y(document.documentElement,this.clsDragState),m(this.$el,"start",[this,this.placeholder]),Oh(this.pos),this.move(t)},move(t){this.drag?this.$emit("move"):(Math.abs(this.pos.x-this.origin.x)>this.threshold||Math.abs(this.pos.y-this.origin.y)>this.threshold)&&this.start(t)},end(){if(Bt(document,ni,this.move),Bt(document,_t,this.end),!this.drag)return;Dh();const t=this.getSortable(this.placeholder);this===t?this.origin.index!==oe(this.placeholder)&&m(this.$el,"moved",[this,this.placeholder]):(m(t.$el,"added",[t,this.placeholder]),m(this.$el,"removed",[this,this.placeholder])),m(this.$el,"stop",[this,this.placeholder]),at(this.drag),this.drag=null;for(const{clsPlaceholder:e,clsItem:i}of this.touched)for(const s of this.touched)N(s.items,e,i);this.touched=null,N(document.documentElement,this.clsDragState)},insert(t,e){y(this.items,this.clsItem);const i=()=>e?Ze(e,t):L(this.target,t);this.animate(i)},remove(t){D(t,this.target)&&this.animate(()=>at(t))},getSortable(t){do{const e=this.$getComponent(t,"sortable");if(e&&(e===this||this.group!==!1&&e.group===this.group))return e}while(t=A(t))}}};let Ao;function Oh(t){let e=Date.now();Ao=setInterval(()=>{let{x:i,y:s}=t;s+=document.scrollingElement.scrollTop;const n=(Date.now()-e)*.3;e=Date.now(),vt(document.elementFromPoint(i,t.y)).reverse().some(o=>{let{scrollTop:r,scrollHeight:a}=o;const{top:l,bottom:c,height:u}=ht(o);if(ls)r-=n;else if(c>s&&c-350&&r"),L(i,e.cloneNode(!0).children);for(const s of e.getAttributeNames())p(i,s,e.getAttribute(s))}else i=e.cloneNode(!0);return L(t,i),h(i,"margin","0","important"),h(i,{boxSizing:"border-box",width:e.offsetWidth,height:e.offsetHeight,padding:h(e,"padding")}),et(i.firstElementChild,et(e.firstElementChild)),i}function Mh(t,e){return t[xt(t,i=>Ge(e,i.getBoundingClientRect()))]}function Nh(t,e,i,s,n,o){if(!P(t).length)return;const r=e.getBoundingClientRect();if(!o)return zh(t,i)||nr[f]-v?!1:e}function zh(t,e){const i=P(t).length===1;i&&L(t,e);const s=P(t),n=s.some((o,r)=>{const a=o.getBoundingClientRect();return s.slice(r+1).some(l=>{const c=l.getBoundingClientRect();return!Oo([a.left,a.right],[c.left,c.right])})});return i&&at(e),n}function Oo(t,e){return t[1]>e[0]&&e[1]>t[0]}var Fh={mixins:[Ne,Vt,Pn],args:"title",props:{delay:Number,title:String},data:{pos:"top",title:"",delay:0,animation:["uk-animation-scale-up"],duration:100,cls:"uk-active"},beforeConnect(){this.id=At(this),this._hasTitle=bt(this.$el,"title"),p(this.$el,{title:"","aria-describedby":this.id}),Hh(this.$el)},disconnected(){this.hide(),p(this.$el,"title")||p(this.$el,"title",this._hasTitle?this.title:null)},methods:{show(){this.isToggled(this.tooltip||null)||!this.title||(clearTimeout(this.showTimer),this.showTimer=setTimeout(this._show,this.delay))},async hide(){E(this.$el,"input:focus")||(clearTimeout(this.showTimer),this.isToggled(this.tooltip||null)&&(await this.toggleElement(this.tooltip,!1,!1),at(this.tooltip),this.tooltip=null))},_show(){this.tooltip=L(this.container,``),x(this.tooltip,"toggled",(t,e)=>{if(!e)return;const i=()=>this.positionAt(this.tooltip,this.$el);i();const[s,n]=Lh(this.tooltip,this.$el,this.pos);this.origin=this.axis==="y"?`${si(s)}-${n}`:`${n}-${si(s)}`;const o=[R(document,`keydown ${mt}`,this.hide,!1,r=>r.type===mt&&!D(r.target,this.$el)||r.type==="keydown"&&r.keyCode===T.ESC),x([document,...jt(this.$el)],"scroll",i,{passive:!0})];R(this.tooltip,"hide",()=>o.forEach(r=>r()),{self:!0})}),this.toggleElement(this.tooltip,!0)}},events:{focus:"show",blur:"hide",[`${Rt} ${ue}`](t){Ct(t)||this[t.type===Rt?"show":"hide"]()},[mt](t){Ct(t)&&this.show()}}};function Hh(t){Ke(t)||p(t,"tabindex","0")}function Lh(t,e,[i,s]){const n=_(t),o=_(e),r=[["left","right"],["top","bottom"]];for(const l of r){if(n[l[0]]>=o[l[1]]){i=l[1];break}if(n[l[1]]<=o[l[0]]){i=l[0];break}}const a=g(r[0],i)?r[1]:r[0];return n[a[0]]===o[a[0]]?s=a[0]:n[a[1]]===o[a[1]]?s=a[1]:s="center",[i,s]}var Wh={mixins:[vs],i18n:{invalidMime:"Invalid File Type: %s",invalidName:"Invalid File Name: %s",invalidSize:"Invalid File Size: %s Kilobytes Max"},props:{allow:String,clsDragover:String,concurrent:Number,maxSize:Number,method:String,mime:String,multiple:Boolean,name:String,params:Object,type:String,url:String},data:{allow:!1,clsDragover:"uk-dragover",concurrent:1,maxSize:0,method:"POST",mime:!1,multiple:!1,name:"files[]",params:{},type:"",url:"",abort:S,beforeAll:S,beforeSend:S,complete:S,completeAll:S,error:S,fail:S,load:S,loadEnd:S,loadStart:S,progress:S},events:{change(t){E(t.target,'input[type="file"]')&&(t.preventDefault(),t.target.files&&this.upload(t.target.files),t.target.value="")},drop(t){_i(t);const e=t.dataTransfer;e!=null&&e.files&&(N(this.$el,this.clsDragover),this.upload(e.files))},dragenter(t){_i(t)},dragover(t){_i(t),y(this.$el,this.clsDragover)},dragleave(t){_i(t),N(this.$el,this.clsDragover)}},methods:{async upload(t){if(t=Oi(t),!t.length)return;m(this.$el,"upload",[t]);for(const s of t){if(this.maxSize&&this.maxSize*1e3{const n=new FormData;s.forEach(o=>n.append(this.name,o));for(const o in this.params)n.append(o,this.params[o]);try{const o=await jh(this.url,{data:n,method:this.method,responseType:this.type,beforeSend:r=>{const{xhr:a}=r;x(a.upload,"progress",this.progress);for(const l of["loadStart","load","loadEnd","abort"])x(a,l.toLowerCase(),this[l]);return this.beforeSend(r)}});this.complete(o),e.length?await i(e.shift()):this.completeAll(o)}catch(o){this.error(o)}};await i(e.shift())}}};function Do(t,e){return e.match(new RegExp(`^${t.replace(/\//g,"\\/").replace(/\*\*/g,"(\\/[^\\/]+)*").replace(/\*/g,"[^\\/]+").replace(/((?!\\))\?/g,"$1.")}$`,"i"))}function Rh(t,e){const i=[];for(let s=0;si.beforeSend(i)).then(()=>qh(t,i))}function qh(t,e){return new Promise((i,s)=>{const{xhr:n}=e;for(const o in e)if(o in n)try{n[o]=e[o]}catch{}n.open(e.method.toUpperCase(),t);for(const o in e.headers)n.setRequestHeader(o,e.headers[o]);x(n,"load",()=>{n.status===0||n.status>=200&&n.status<300||n.status===304?i(n):s(yt(Error(n.statusText),{xhr:n,status:n.status}))}),x(n,"error",()=>s(yt(Error("Network Error"),{xhr:n}))),x(n,"timeout",()=>s(yt(Error("Network Timeout"),{xhr:n}))),n.send(e.data)})}var Uh=Object.freeze({__proto__:null,Countdown:Ul,Filter:Zl,Lightbox:dh,LightboxPanel:po,Notification:ph,Parallax:yh,Slider:Ch,SliderParallax:Eo,Slideshow:_h,SlideshowParallax:Eo,Sortable:Ah,Tooltip:Fh,Upload:Wh});return It(Uh,(t,e)=>ut.component(e,t)),ut}); diff --git a/src/js/background.js b/src/js/background.js index d0483d385..2c586f462 100644 --- a/src/js/background.js +++ b/src/js/background.js @@ -1,1010 +1,92 @@ -const brws=(typeof browser=="undefined"?chrome:browser), -firefox=(brws.runtime.getURL("").substr(0,4)=="moz-"), -extension_version=brws.runtime.getManifest().version, -definitions_version="", -getRedirect=(url,referer,safe_in)=>{ - if(!isGoodLink(url)) - { - return - } - let redirectUrl=brws.runtime.getURL("html/before-navigate.html")+"?target="+encodeURIComponent(url) - if(referer) - { - redirectUrl+="&referer="+encodeURIComponent(referer) - } - if(safe_in!==undefined) - { - redirectUrl+="&safe_in="+safe_in - } - countIt() - return {redirectUrl} -}, -encodedRedirect=(url,referer,safe_in)=>getRedirect(decodeURIComponent(url),referer,safe_in), -isGoodLink=link=>{ - if(typeof link !== "string"||(link.split("#")[0]==location.href.split("#")[0]&&!isGoodLink_allowSelf)) - { - return false - } - try - { - let u = new URL(decodeURI(link).trim().toLocaleLowerCase()) - //check if host is a private/internal ip - if (u.hostname === 'localhost' || u.hostname === '[::1]' || /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/.test(u.hostname)) { - return false - } - var parts = u.hostname.split('.'); - if (parts[0] === '10' || (parts[0] === '172' && (parseInt(parts[1], 10) >= 16 && parseInt(parts[1], 10) <= 31)) || (parts[0] === '192' && parts[1] === '168')) { - return false - } - // Check if protocol is safe - let safeProtocols = ["http:", "https:", "mailto:", "irc:", "telnet:", "tel:", "svn:"] - if (!safeProtocols.includes(u.protocol)) { - return false - } - } - catch(e) - { - return false - } - return true -}, -countIt=()=>{ - brws.storage.local.set({bypass_counter:++bypassCounter}) - sendToOptions({bypassCounter}) -}, -resetCounter=()=>{ - bypassCounter=0 - brws.storage.local.set({bypass_counter:0}) - sendToOptions({bypassCounter}) -} - -// Install handler -brws.runtime.onInstalled.addListener(details=>{ - if(details.reason=="install") - { - brws.tabs.create({url:"https://fastforward.team/firstrun"}) - } - //init clipboard - chrome.storage.local.get({ff_clipboard: "{}"}, function(data) { - chrome.storage.local.set({ff_clipboard: data.ff_clipboard}, function() { - })}) -}) - -//clean clipboard on startup -brws.runtime.onStartup.addListener(() => { - chrome.storage.local.get({ff_clipboard: "{}"}, function(data) { - chrome.storage.local.set({ff_clipboard: data.ff_clipboard}, function() { - })}) -}) - -// Uninstall handler +const brws = typeof browser !== 'undefined' ? browser : chrome; -// Keeping track of options -var bypassCounter=0,enabled=true,instantNavigation=true,trackerBypassEnabled=true,instantNavigationTrackers=false,blockIPLoggers=true,crowdEnabled=true,userScript="" -brws.storage.sync.get(["disable","navigation_delay","no_tracker_bypass","no_instant_navigation_trackers","allow_ip_loggers","crowd_bypass","crowd_bypass_opt_out","crowd_open_delay","crowd_close_delay","no_info_box"],res=>{ - if(res) - { - enabled=(!res.disable||res.disable!=="true") - if(!enabled) - { - brws.browserAction.setIcon({path: { - "48": "icon_disabled/48.png", - "128": "icon_disabled/128.png", - "150": "icon_disabled/150.png", - "176": "icon_disabled/176.png", - "512": "icon_disabled/512.png" - }}) - } - if(res.navigation_delay) - { - instantNavigation=(res.navigation_delay==0) - if(res.navigation_delay==61) - { - brws.storage.sync.set({navigation_delay:-1}) - } - } - else - { - brws.storage.sync.set({navigation_delay:0}) - } - trackerBypassEnabled=(res.no_tracker_bypass!=="true") - instantNavigationTrackers=(res.no_instant_navigation_trackers!=="true") - blockIPLoggers=(res.allow_ip_loggers!=="true") - if(res.crowd_bypass) - { - crowdEnabled=(res.crowd_bypass==="true") - } - else - { - crowdEnabled=(res.crowd_bypass_opt_out==="false"||!firefox) - if(crowdEnabled) - { - brws.storage.sync.set({crowd_bypass:"true"}) - } - if(res.crowd_bypass_opt_out) - { - brws.storage.sync.remove(["crowd_bypass_opt_out"]) - } - } - if(!res.crowd_open_delay||res.crowd_open_delay==61) - { - brws.storage.sync.set({crowd_open_delay:-6}) - } - if(!res.crowd_close_delay||res.crowd_close_delay==61) - { - brws.storage.sync.set({crowd_close_delay:-11}) - } - if(res.no_info_box) - { - brws.storage.sync.remove(["no_info_box"]) - } - } -}) -brws.storage.onChanged.addListener(changes=>{ - if(changes.disable) - { - enabled=(changes.disable.newValue!=="true") - if(enabled) - { - brws.browserAction.setIcon({path: { - "48": "icon/48.png", - "128": "icon/128.png", - "150": "icon/150.png", - "176": "icon/176.png", - "512": "icon/512.png" - }}) - } - else - { - brws.browserAction.setIcon({path: { - "48": "icon_disabled/48.png", - "128": "icon_disabled/128.png", - "150": "icon_disabled/150.png", - "176": "icon_disabled/176.png", - "512": "icon_disabled/512.png" - }}) - } - } - if(changes.navigation_delay) - { - instantNavigation=(changes.navigation_delay.newValue==0) - } - if(changes.no_tracker_bypass) - { - trackerBypassEnabled=(changes.no_tracker_bypass.newValue!=="true") - } - if(changes.no_instant_navigation_trackers) - { - instantNavigationTrackers=(changes.no_instant_navigation_trackers.newValue!=="true") - } - if(changes.allow_ip_loggers) - { - blockIPLoggers=(changes.allow_ip_loggers.newValue!=="true") - } - if(changes.crowd_bypass) - { - crowdEnabled=(changes.crowd_bypass.newValue==="true") - } - if(changes.userscript) - { - userScript=changes.userscript.newValue - } - refreshInjectionScript() -}) - -// Bypass definition management -let updateStatus = "", injectionScript = "", preflightRules = {}, upstreamInjectionScript = "", upstreamCommit, channel = {}, optionsTab, optionsPort, bypassClipboard = "" -const updateBypassDefinitions = callback => { - if(updateStatus != "") - { - return - } - if(typeof callback != "function") - { - callback = () => {} - } - updateStatus = "checking" - sendToOptions({updateStatus}) - const finishDownload = () => { - channel = {} - let uniqueness = [] - ;["stop_watching","count_it","crowd_referer","crowd_domain","crowd_path","crowd_query","crowd_queried","crowd_contribute","adlinkfly_info","adlinkfly_target","bypass_clipboard"].forEach(name => { - let val - do - { - val = Math.random().toString().substr(2) - } - while(uniqueness.indexOf(val) != -1); - uniqueness.push(val) - upstreamInjectionScript = upstreamInjectionScript.split("{{channel."+name+"}}").join(channel[name] = "data-" + val) - }) - ;["infoLinkvertise","infoFileHoster","infoOutdated","crowdWait","crowdDisabled"].forEach(name => { - upstreamInjectionScript = upstreamInjectionScript.split("{{msg."+name+"}}").join(brws.i18n.getMessage(name).split("\\").join("\\\\").split("\"").join("\\\"")) - }) - upstreamInjectionScript = upstreamInjectionScript.split("{{icon/48.png}}").join(brws.runtime.getURL("icon/48.png")) - refreshInjectionScript() - updateStatus = "" - sendToOptions({upstreamCommit, updateStatus}) - } - let xhr = new XMLHttpRequest() - xhr.onload = () => { - updateStatus = "updating" - upstreamCommit = definitions_version - sendToOptions({upstreamCommit, updateStatus}) - callback(true) - upstreamInjectionScript = xhr.responseText - xhr = new XMLHttpRequest() - xhr.open("GET", brws.runtime.getURL("rules.json"), true) - xhr.onload = () => { - preflightRules = JSON.parse(xhr.responseText) - finishDownload() - } - xhr.send() - } - if(definitions_version==="") - { - xhr.onerror = () => { - let xhr = new XMLHttpRequest() - xhr.onload = () => { - const latestCommit = JSON.parse(xhr.responseText).sha - if(latestCommit == upstreamCommit) - { - updateStatus = "" - sendToOptions({updateStatus}) - callback(false) - } - else - { - updateStatus = "updating" - if(upstreamCommit == "") - { - sendToOptions({upstreamCommit: latestCommit}) - } - sendToOptions({updateStatus}) - callback(true) - upstreamCommit = latestCommit - let downloads = 0 - xhr = new XMLHttpRequest() - xhr.onload = () => { - upstreamInjectionScript = xhr.responseText - if(++downloads == 2) - { - finishDownload() - } - } - xhr.onerror = () => { - if(++downloads == 2) - { - finishDownload() - } - } - xhr.open("GET", "https://cdn.jsdelivr.net/gh/FastForwardTeam/FastForward@" + upstreamCommit + "/src/js/injection_script.js", true) - xhr.send() - let xhr2 = new XMLHttpRequest() - xhr2.onload = () => { - preflightRules = JSON.parse(xhr2.responseText) - if(++downloads == 2) - { - finishDownload() - } - } - xhr2.onerror = () => { - if(++downloads == 2) - { - finishDownload() - } - } - xhr2.open("GET", "https://cdn.jsdelivr.net/gh/FastForwardTeam/FastForward@" + upstreamCommit + "/src/js/rules.json", true) - xhr2.send() - } - } - xhr.onerror = () => { - updateStatus = "" - sendToOptions({updateStatus}) - callback(false) - } - xhr.open("GET", "https://api.github.com/repos/FastForwardTeam/FastForward/commits/main", true) - xhr.send() - } - } - xhr.open("GET", brws.runtime.getURL("injection_script.js"), true) - xhr.send() -}, -refreshInjectionScript = () => { - Object.values(onBeforeRequest_rules).forEach(func => brws.webRequest.onBeforeRequest.removeListener(func)) - Object.values(onBeforeSendHeaders_rules).forEach(func => brws.webRequest.onBeforeSendHeaders.removeListener(func)) - Object.values(onHeadersReceived_rules).forEach(func => brws.webRequest.onHeadersReceived.removeListener(func)) - if(enabled) - { - injectionScript = (upstreamInjectionScript + "\n" + userScript) - .split("FAST_FORWARD_INTERNAL_VERSION").join("10") - .split("FAST_FORWARD_EXTERNAL_VERSION").join(extension_version) - .split("FAST_FORWARD_INJECTION_VERSION").join(upstreamCommit?upstreamCommit.substr(0,7):"dev") - Object.keys(preflightRules).forEach(name=>{ - if(name in onBeforeRequest_rules) - { - brws.webRequest.onBeforeRequest.addListener(onBeforeRequest_rules[name],{types:["main_frame"],urls:preflightRules[name]},["blocking"]) - } - else if(name in onBeforeSendHeaders_rules) - { - brws.webRequest.onBeforeSendHeaders.addListener(onBeforeSendHeaders_rules[name],{types:["main_frame","xmlhttprequest"],urls:preflightRules[name]},["blocking","requestHeaders"]) - } - else if(name in onHeadersReceived_rules) - { - brws.webRequest.onHeadersReceived.addListener(onHeadersReceived_rules[name],{types:["main_frame"],urls:preflightRules[name]},["blocking","responseHeaders"]) - } - }) - } -}, -sendToOptions = data => { - if(optionsPort) - { - optionsPort.postMessage(data) - } -} -if(!definitions_version) -{ - brws.alarms.create("update-bypass-definitions", {periodInMinutes: 60}) - brws.alarms.onAlarm.addListener(()=>updateBypassDefinitions()) +function handleClick() { + brws.runtime.openOptionsPage(); } -// Messaging -brws.runtime.onMessage.addListener((req, sender, respond) => { - switch(req.type) - { - case "content": - respond({enabled, channel, crowdEnabled, injectionScript}) - break; - - case "count-it": - countIt() - break; - - case "open-tab": - brws.tabs.create({ - url: req.url - }) - break; - - case "close-tab": - brws.tabs.remove(sender.tab.id) - break; - - case "crowd-contribute": - if(crowdEnabled) - { - let xhr=new XMLHttpRequest() - xhr.open("POST","https://crowd.fastforward.team/crowd/contribute_v1",true) - xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded") - xhr.send(req.data) - } - else - { - console.warn("Unexpected message:", req) - } - break; - - case "bypass-clipboard": - bypassClipboard=req.data - break; - - default: - console.warn("Invalid message:", req) - } -}) -brws.runtime.onConnect.addListener(port => { - switch(port.name) - { - case "options": - if(optionsTab) - { - optionsPort.disconnect() - brws.tabs.remove(optionsTab) - } - optionsTab=port.sender.tab.id - optionsPort=port - port.onDisconnect.addListener(()=>{ - optionsTab=undefined - optionsPort=undefined - }) - port.onMessage.addListener(req=>{ - switch(req.type) - { - case "update": - updateBypassDefinitions(updateSuccess => port.postMessage({updateSuccess})) - break; - } - }) - port.postMessage({updateStatus, upstreamCommit, bypassCounter, userScript, extension_version, amo: !!definitions_version}) - break; - - case "crowd-query": - port.onMessage.addListener(msg=>{ - let xhr=new XMLHttpRequest() - xhr.onreadystatechange=()=>{ - if(xhr.readyState==4) - { - port.postMessage(xhr.status==200&&xhr.responseText!=""?xhr.responseText:"") - } - } - xhr.open("POST","https://crowd.fastforward.team/crowd/query_v1",true) - xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded") - xhr.send("domain="+encodeURIComponent(msg.domain)+"&path="+encodeURIComponent(msg.crowdPath)) - }) - break; - - case "adlinkfly-info": - port.onMessage.addListener(msg=>{ - let xhr=new XMLHttpRequest(),t="",iu=msg - xhr.onload=()=>{ - let i=new DOMParser().parseFromString(xhr.responseText,"text/html").querySelector("img[src^='//api.miniature.io']") - if(i) - { - let url=new URL(i.src) - if(url.search&&url.search.indexOf("url=")) - { - t=decodeURIComponent(url.search.split("url=")[1].split("&")[0]) - } - } - port.postMessage(t) - } - xhr.onerror=()=>port.postMessage(t) - if(iu.substr(-1) != "/") - { - iu += "/" - } - xhr.open("GET", iu+"info", true) - xhr.send() - }) - break; - - default: - console.warn("Invalid connection:", port) - } -}) - -// Internal redirects to extension URLs to bypass content script limitations -brws.webRequest.onBeforeRequest.addListener(details=>{ - return {redirectUrl:brws.runtime.getURL("html/noscript.html")} -},{types:["main_frame"],urls:["*://fastforward.team/firstrun?0"]},["blocking"]) -brws.webRequest.onBeforeRequest.addListener(details=>{ - return {redirectUrl:brws.runtime.getURL("html/options.html#firstrun")} -},{types:["main_frame"],urls:["*://fastforward.team/firstrun?1"]},["blocking"]) - -brws.webRequest.onBeforeRequest.addListener(details=>{ - const parsed_url = new URL(details.url); - const referer = parsed_url.searchParams.get('referer'); - const safe_in = parsed_url.searchParams.get('safe_in'); - const target = parsed_url.searchParams.get('target'); - - return encodedRedirect(target, referer, safe_in) -},{types:["main_frame"],urls:["*://fastforward.team/bypassed?target=*","*://fastforward.team/bypassed?target=*&referer=*"]},["blocking"]) - -brws.webRequest.onBeforeRequest.addListener(details=>{ - countIt() - return {redirectUrl:brws.runtime.getURL("html/crowd-bypassed.html")+details.url.substr(43)} -},{types:["main_frame"],urls:["https://fastforward.team/crowd-bypassed?*"]},["blocking"]) - -brws.webRequest.onBeforeRequest.addListener(details=>{ - return {redirectUrl:brws.runtime.getURL("html/options.html")+details.url.substr(36)} -},{types:["main_frame"],urls:["https://fastforward.team/options*"]},["blocking"]) - -// Navigation handling including presenting referer header to destinations -var refererCache={} -brws.webRequest.onBeforeRequest.addListener(details=>{ - const parsed_url = new URL(details.url); - const target = parsed_url.searchParams.get('target'); - return {redirectUrl:target} -},{types:["main_frame"],urls:["*://fastforward.team/navigate?target=*"]},["blocking"]) - -let infoSpec=["blocking","requestHeaders"] -if("EXTRA_HEADERS" in brws.webRequest.OnBeforeSendHeadersOptions) -{ - infoSpec.push("extraHeaders") +function ffclipboardClear() { + brws.storage.local.set({ ff_clipboard: '{}' }); } -brws.webRequest.onBeforeSendHeaders.addListener(details=>{ - if(enabled&&details.url in refererCache) - { - details.requestHeaders.push({ - name: "Referer", - value: refererCache[details.url] - }) - return {requestHeaders: details.requestHeaders} - } -},{types:["main_frame"],urls:[""]},infoSpec) -brws.webRequest.onBeforeRedirect.addListener(details=>{ - if(enabled&&details.url in refererCache) - { - if(details.redirectUrl == details.url + "/") - { - refererCache[details.redirectUrl] = refererCache[details.url] - } - delete refererCache[details.url] - } -},{types:["main_frame"],urls:[""]}) - -brws.webRequest.onCompleted.addListener(details=>{ - if(enabled&&details.url in refererCache) - { - delete refererCache[details.url] - } -},{types:["main_frame"],urls:[""]}) - -// Preflight Bypasses including Tracker Bypass using Apimon.de -function resolveRedirect(url) -{ - let xhr=new XMLHttpRequest(),destination - xhr.onload=()=>{ - let json=JSON.parse(xhr.responseText) - if(json&&json.destination) - { - destination=json.destination - preflightRules.tracker_force_http.forEach(domain=>{ - if(destination.substr(0,9+domain.length)=="https://"+domain+"/") - { - destination="http://"+domain+"/"+destination.substr(9+domain.length) - } - }) - } - } - xhr.open("GET","https://apimon.de/redirect/"+encodeURIComponent(url),false) - xhr.send() - return destination -} -function decodeHexString(hexstr) -{ - let a=[] - for(let i=0;i getRedirect(atob(details.url.substr(details.url.indexOf("aHR0c")))), - path_s_encoded: details => encodedRedirect(details.url.substr(details.url.indexOf("/s/")+3)), - path_r_base64: details => getRedirect(atob(details.url.substr(details.url.indexOf("/r/")+3))), - path_dl_base64: details => getRedirect(atob(details.url.substr(details.url.indexOf("/dl/")+4))), - path_ads_hex: details => getRedirect(decodeHexString(details.url.substr(details.url.indexOf("/ads/")+5))), - path_u_id_base64: details => { - let data=details.url.substr(details.url.indexOf("/u/")+3) - return getRedirect(atob(data.substr(data.indexOf("/")+1))) - }, - query_raw: details => { - let url=new URL(details.url) - if(url.search) - { - return getRedirect(url.search.substr(1)+url.hash) - } - }, - query_base64: details => getRedirect(atob((new URL(details.url)).search.replace("?",""))), - hash_base64: details => { - let url=new URL(details.url) - if(url.hash) - { - return getRedirect(atob(url.hash.replace("#",""))) - } - }, - param_url_general: details => { - let url=details.url.substr(details.url.indexOf("&url=")+5) - if(url.substr(0,5)=="aHR0c"||url.substr(0,7)=="bWFnbmV") - { - url=atob(url.split("&")[0]) - } - else if(url.substr(0,13)=="http%3A%2F%2F"||url.substr(0,14)=="https%3A%2F%2F") - { - url=decodeURIComponent(url.split("&")[0]) - } - else - { - if(url.substr(0,7)!="http://"&&url.substr(0,8)!="https://") - { - url="http://"+url - } - url+=(new URL(details.url)).hash - } - return getRedirect(url,details.url) - }, - param_url_encoded: details => { - let url=new URL(details.url) - if(url.searchParams.has("url")) - { - return getRedirect(url.searchParams.get("url")) - } - }, - param_url_raw: details => getRedirect(details.url.substr(details.url.indexOf("?url=")+5)), - param_q_encoded: details => { - let url=new URL(details.url) - if(url.searchParams.has("q")) - { - return getRedirect(url.searchParams.get("q")) - } - }, - param_xurl_raw_http: details => getRedirect("http"+details.url.substr(details.url.indexOf("?xurl=")+6)), - param_aurl_encoded: details => { - let url=new URL(details.url) - if(url.searchParams.has("aurl")) - { - return getRedirect(url.searchParams.get("aurl")) - } - }, - param_capital_url_encoded: details => { - let url=new URL(details.url) - if(url.searchParams.has("URL")) - { - return getRedirect(url.searchParams.get("URL")) - } - }, - param_rel_base64: details => getRedirect(atob(details.url.substr(details.url.indexOf("?rel=")+5))), - param_link_encoded: details => encodedRedirect(details.url.substr(details.url.indexOf("link=")+5)), - param_link_base64: details => { - let url=new URL(details.url) - if(url.searchParams.has("link")) - { - return getRedirect(atob(url.searchParams.get("link"))) - } - }, - param_link_encoded_base64: details => getRedirect(decodeURIComponent(atob(details.url.substr(details.url.indexOf("?link=")+6)))), - param_kesehatan_base64: details => getRedirect(atob(details.url.substr(details.url.indexOf("?kesehatan=")+11))), - param_wildcard_base64: details => getRedirect(atob(new URL(details.url).searchParams.values().next().value)), - param_r_base64: details => getRedirect(atob(decodeURIComponent(details.url.substr(details.url.indexOf("?r=")+3))),0,safe_in), - param_kareeI_base64_pipes: details => getRedirect(atob(details.url.substr(details.url.indexOf("?kareeI=")+8)).split("||")[0]), - param_cr_base64: details => { - let i=details.url.indexOf("cr=") - if(i>0) - { - return getRedirect(atob(details.url.substr(i+3).split("&")[0])) - } - }, - param_a_base64: details => getRedirect(atob(details.url.substr(details.url.indexOf("?a=")+3).split("#",1)[0])), - param_url_base64: details => { - let i=details.url.indexOf("?url=") - if(i>0) - { - return getRedirect(atob(details.url.substr(i+5).split("&")[0])) - } - }, - param_id_base64: details => getRedirect(atob(details.url.substr(details.url.indexOf("?id=")+4))), - param_get_base64: details => { - let arg=details.url.substr(details.url.indexOf("?get=")+5) - return getRedirect(atob(arg.substr(0,arg.length-1))) - }, - param_u_base64: details => { - let url=new URL(details.url) - if(url.searchParams.has("u")) - { - return getRedirect(atob(url.searchParams.get("u"))+url.hash) - } - }, - param_go_base64: details => { - let b64=details.url.substr(details.url.indexOf("?go=")+4).split("&")[0] - if(b64.substr(0,5)=="0OoL1") - { - b64="aHR0c"+b64.substr(5) - } - return getRedirect(atob(b64)) - }, - param_site_base64: details => getRedirect(atob(details.url.substr(details.url.indexOf("?site=")+6).split("&")[0])), - param_reff_base64: details => getRedirect(atob(details.url.substr(details.url.indexOf("?reff=")+6))), - param_s_encoded: details => encodedRedirect(details.url.substr(details.url.indexOf("?s=")+3),details.url), - param_dl_encoded_base64: details => encodedRedirect(atob(details.url.substr(details.url.indexOf("?dl=")+4).split("&")[0])), - param_health_encoded_base64: details => encodedRedirect(atob(details.url.substr(details.url.indexOf("?health=")+8))), - param_id_reverse_base64: details => { - let url=new URL(details.url) - if(url.searchParams.has("id")) - { - let t=atob(url.searchParams.get("id").split("").reverse().join("")) - if(t.substr(-16)=='" target="_blank') - { - t=t.substr(0,t.length-16) - } - return getRedirect(t) - } - }, - param_token_base64: details => { - let url=new URL(details.url) - if(url.searchParams.has("token")) - { - return getRedirect(atob(url.searchParams.get("token"))) - } - }, - param_href_encoded: details => { - let url=new URL(details.url) - if(url.searchParams.has("href")) - { - return getRedirect(url.searchParams.get("href")) - } - }, - param_short_encoded: details => { - let url=new URL(details.url) - if(url.searchParams.has("short")) - { - return getRedirect(url.searchParams.get("short")) - } - }, - param_id_base64_replacements: details => { - let url=new URL(details.url) - if(url.searchParams.has("id")) - { - return getRedirect(atob(url.searchParams.get("id")).split("!").join("a").split(")").join("e").split("_").join("i").split("(").join("o").split("*").join("u")) - } - }, - param_dest_encoded: details => { - let url=new URL(details.url) - if(url.searchParams.has("dest")) - { - return getRedirect(url.searchParams.get("dest")) - } - }, - param_go_hex: details => { - let url=new URL(details.url) - if(url.searchParams.has("go")) - { - return getRedirect(decodeHexString(url.searchParams.get("go"))) - } - }, - param_to_base64: details => { - let url=new URL(details.url) - if(url.searchParams.has("to")) - { - return getRedirect(atob(url.searchParams.get("to"))) - } - }, - param_data_base64: details => { - let url=new URL(details.url) - if(url.searchParams.has("data")) - { - return getRedirect(atob(url.searchParams.get("data"))) - } - }, - bypass_clipboard: details => { - let url=details.url+bypassClipboard - bypassClipboard="" - return{redirectUrl:url} - }, - tracker: details => { - if(trackerBypassEnabled&&new URL(details.url).pathname!="/") - { - let destination=resolveRedirect(details.url) - if(destination&&destination!=details.url) - { - return getRedirect(destination,"tracker") - } - } - }, - ip_logger: details => { - if(new URL(details.url).pathname!="/") - { - if(trackerBypassEnabled) - { - let destination=resolveRedirect(details.url) - if(destination&&destination!=details.url) - { - return getRedirect(destination,"tracker") - } - } - if(blockIPLoggers) - { - return {redirectUrl:brws.runtime.getURL("html/blocked.html")} - } - } - } -}, -onBeforeSendHeaders_rules = { - useragent_googlebot: details => { - details.requestHeaders.push({ - name: "User-Agent", - value: "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)" - }) - return {requestHeaders: details.requestHeaders} - }, - useragent_iphone: details => { - details.requestHeaders.push({ - name: "User-Agent", - value: "Mozilla/5.0 (iPhone; CPU iPhone OS 13_4 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Mobile/15E148 Safari/604.1" - }) - return {requestHeaders: details.requestHeaders} - }, - useragent_chrome: details => { - if(firefox) - { - details.requestHeaders.push({ - name: "User-Agent", - value: "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36" - }) - return {requestHeaders: details.requestHeaders} - } - }, - useragent_empty: details => { - details.requestHeaders.push({ - name: "User-Agent", - value: "" - }) - return {requestHeaders: details.requestHeaders} - } -}, -onHeadersReceived_rules = { - redirect_persist_id_path: details => { - let url = new URL(details.url) - if(url.pathname.substr(0,6)!="/post/") - { - for(let i in details.responseHeaders) - { - let header = details.responseHeaders[i] - if(header.name.toLowerCase() == "location") - { - details.responseHeaders[i].value += "#" + url.pathname.substr(1) - break - } - } - } - return {responseHeaders: details.responseHeaders} - }, - redirect_persist_id_path_1_letter: details => { - let url = new URL(details.url) - for(let i in details.responseHeaders) - { - let header = details.responseHeaders[i] - if(header.name.toLowerCase() == "location") - { - details.responseHeaders[i].value += "#" + url.pathname.substr(3).split("/")[0] - break - } - } - return {responseHeaders: details.responseHeaders} - }, - contribute_hash: details => { - if(crowdEnabled&&details.method=="POST") - { - let url=new URL(details.url) - if(url.hash.length>1) - { - for(let i in details.responseHeaders) - { - let header=details.responseHeaders[i] - if(header.name.toLowerCase()=="location"&&isGoodLink(header.value)) - { - let xhr=new XMLHttpRequest() - xhr.open("POST","https://crowd.fastforward.team/crowd/contribute_v1",true) - xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded") - xhr.send("domain="+url.host+"&path="+encodeURIComponent(url.hash.substr(1))+"&target="+encodeURIComponent(header.value)) - break - } - } - } - } - } +function clearCrowdIgnoredURLs() { + brws.storage.local.set({ crowd_ignore: '{}' }); } -brws.storage.local.get(["userscript","bypass_counter"],res=>{ - if(res) - { - if(res.userscript) - { - userScript=res.userscript - } - if(res.bypass_counter) - { - bypassCounter=res.bypass_counter - } - } - updateBypassDefinitions() -}) - -// Very Specific Preflight Bypasses -brws.webRequest.onBeforeRequest.addListener(details=>{ - if(enabled) - { - return encodedRedirect(details.url.substr(details.url.indexOf("/12/1/")+6)) - } -},{types:["main_frame"],urls:["*://*.sh.st/r/*/12/1/*"]},["blocking"]) - -brws.webRequest.onBeforeRequest.addListener(details=>{ - if(enabled) - { - return getRedirect(details.url.substr(details.url.substr(16).indexOf("/")+17)) - } -},{types:["main_frame"],urls:["http://sh.st/st/*/*"]},["blocking"]) - -brws.webRequest.onBeforeRequest.addListener(details=>{ - if(enabled) - { - let url=details.url - do - { - let arr=url.substr(19).split("/") - if(arr.length!=2) - { - return - } - url=atob(arr[1]) - } - while(url.length>=19&&url.substr(0,19)=="http://gslink.co/a/"); - if(url!=details.url) - { - return getRedirect(url) - } - } -},{types:["main_frame"],urls:["http://gslink.co/a/*"]},["blocking"]) - -brws.webRequest.onBeforeRequest.addListener(details=>{ - if(enabled) - { - let url=new URL(details.url) - if(url.searchParams.has("go")) - { - return getRedirect("https://clickar.net/"+url.searchParams.get("go")) - } - } -},{types:["main_frame"],urls:["*://*.surfsees.com/?*"]},["blocking"]) +function firstrun() { + brws.tabs.create({ url: 'https://fastforward.team/firstrun' }); + ffclipboardClear(); + brws.storage.local.set({ tempDisableCrowd: 'false' }); + brws.storage.local.set({ version: brws.runtime.getManifest().version }); + brws.runtime.openOptionsPage(); //required for loading default options, to do: implement a better way +} -// Ouo.io/press / lnk2.cc / Cshort.org Crowd Bypass -brws.webRequest.onHeadersReceived.addListener(details=>{ - if(enabled&&crowdEnabled) - { - let url=new URL(details.url) - for(let i in details.responseHeaders) - { - let header=details.responseHeaders[i] - if(header.name.toLowerCase()=="location"&&isGoodLink(header.value)) - { - let xhr=new XMLHttpRequest(), - domain=url.hostname,path - if(domain=="ouo.press") - { - domain="ouo.io" - } - path=(domain=="cshort.org"?url.pathname.substr(1):url.pathname.split("/")[2]) - xhr.open("POST","https://crowd.fastforward.team/crowd/contribute_v1",true) - xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded") - xhr.send("domain="+domain+"&path="+encodeURIComponent(path)+"&target="+encodeURIComponent(header.value)) - break - } - } - } -},{types:["main_frame"],urls:[ -"*://*.ouo.io/*/*", -"*://*.ouo.press/*/*", -"*://*.lnk2.cc/*/*", -"*://*.cshort.org/*?u=*" -]},["blocking","responseHeaders"]) +function preflight(details) { + let url = new URL(details.url); + if (url.hostname !== 'fastforward.team') { + return; + } + //navigate + if (url.pathname === '/bypassed') { + url.hostname = brws.runtime.id; + url.protocol = brws.runtime.getURL('').split(':')[0] + ':'; + url.pathname = '/html' + url.pathname; + if (url.searchParams.get('crowd') === 'true') { + url.pathname = + url.pathname.split('/').slice(0, -1).join('/') + '/crowd-bypassed.html'; + } else { + url.pathname = + url.pathname.split('/').slice(0, -1).join('/') + + '/before-navigate.html'; + } + + brws.tabs.update(details.tabId, { + url: decodeURIComponent(url.href), + }); + } +} -// SoraLink Crowd Bypass -let soralink_contribute={} -brws.webRequest.onBeforeRequest.addListener(details=>{ - if(enabled) - { - const arg_index=details.url.indexOf("&soralink_contribute="),url=details.url.substr(0,arg_index) - if(crowdEnabled) - { - soralink_contribute[url]=details.url.substr(arg_index+21) - } - return{redirectUrl:url} - } -},{types:["main_frame"],urls:["*://*/?*=*&soralink_contribute=*"]},["blocking"]) +// If user restarts the browser before the is alarm triggered +function reEnableCrowdBypassStartup() { + brws.storage.local.get(['tempDisableCrowd']).then((result) => { + if (result.tempDisableCrowd === 'true') { + brws.storage.local.get(['options']).then((result) => { + let opt = result.options; + opt.optionCrowdBypass = true; + brws.storage.local.set({ options: opt }); + }); + } + brws.storage.local.set({ tempDisableCrowd: 'false' }); + }); +} -brws.webRequest.onHeadersReceived.addListener(details=>{ - if(enabled) - { - if(crowdEnabled && details.url in soralink_contribute) - { - if(details.method=="POST") - { - for(let i in details.responseHeaders) - { - let header=details.responseHeaders[i] - if(header.name.toLowerCase()=="location"&&isGoodLink(header.value)) - { - let xhr=new XMLHttpRequest() - xhr.open("POST","https://crowd.fastforward.team/crowd/contribute_v1",true) - xhr.setRequestHeader("Content-Type","application/x-www-form-urlencoded") - xhr.send("domain="+(new URL(details.url)).host+"&path="+encodeURIComponent(soralink_contribute[details.url])+"&target="+encodeURIComponent(header.value)) - break - } - } - } - delete soralink_contribute[details.url] - } - } -},{types:["main_frame"],urls:[""]},["blocking","responseHeaders"]) +// Add a listener for the temp crowd disable alarm +brws.alarms.onAlarm.addListener((alarm) => { + brws.storage.local.get(['tempDisableCrowd']).then((result) => { + if ( + alarm.name === 'enableCrowdBypass' && + result.tempDisableCrowd === 'true' + ) { + brws.storage.local.get(['options']).then((result) => { + let opt = result.options; + opt.optionCrowdBypass = true; + brws.storage.local.set({ options: opt }); + brws.storage.local.set({ tempDisableCrowd: 'false' }); + }); + } + }); +}); + +brws.action.onClicked.addListener(handleClick); +brws.runtime.onInstalled.addListener(firstrun); +brws.runtime.onStartup.addListener(() => { + ffclipboardClear(); + clearCrowdIgnoredURLs(); + reEnableCrowdBypassStartup(); + brws.storage.local.set({ version: brws.runtime.getManifest().version }); +}); +brws.webNavigation.onBeforeNavigate.addListener( + (details) => preflight(details), + { + url: [{ hostContains: 'fastforward.team' }], + } +); diff --git a/src/js/content_script.js b/src/js/content_script.js index 9d2144beb..420fdd1bb 100644 --- a/src/js/content_script.js +++ b/src/js/content_script.js @@ -1,157 +1,105 @@ -//If you want to add your own bypass, go to injection_script.js -if(document instanceof Document) -{ - let clipboardIndex=location.hash.indexOf("#bypassClipboard="),ignoreCrowdBypass=false,bypassClipboard="" - if(location.hash.substr(-18)=="#ignoreCrowdBypass") - { - ignoreCrowdBypass=true - location.hash=location.hash.substr(0,location.hash.length-18) - } - if(clipboardIndex!=-1) - { - bypassClipboard=location.hash.substr(clipboardIndex+17) - location.hash=location.hash.substr(0,location.hash.length-bypassClipboard.length-17) - } - if(location.hash.substr(-18)=="#ignoreCrowdBypass") - { - ignoreCrowdBypass=true - location.hash=location.hash.substr(0,location.hash.length-18) - } - const simplifyDomain=domain=>{ - if(domain.substr(0,4)=="www.") - { - domain=domain.substr(4) - } - return domain - } - const brws=(typeof browser=="undefined"?chrome:browser) - brws.runtime.sendMessage({type: "content"}, res => { - if(!res.enabled) - { - return - } - const channel = res.channel, - observer = new MutationObserver(mutations => { - if(document.documentElement.hasAttribute(channel.stop_watching)) - { - document.documentElement.removeAttribute(channel.stop_watching) - observer.disconnect() - } - else if(document.documentElement.hasAttribute(channel.count_it)) - { - document.documentElement.removeAttribute(channel.count_it) - brws.runtime.sendMessage({type:"count-it"}) - } - else if(document.documentElement.hasAttribute(channel.crowd_referer)) - { - referer=document.documentElement.getAttribute(channel.crowd_referer) - document.documentElement.removeAttribute(channel.crowd_referer) - } - else if(document.documentElement.hasAttribute(channel.crowd_domain)) - { - domain=simplifyDomain(document.documentElement.getAttribute(channel.crowd_domain)) - document.documentElement.removeAttribute(channel.crowd_domain) - } - else if(document.documentElement.hasAttribute(channel.crowd_path)) - { - crowdPath=document.documentElement.getAttribute(channel.crowd_path) - document.documentElement.removeAttribute(channel.crowd_path) - } - else if(document.documentElement.hasAttribute(channel.crowd_query)) - { - document.documentElement.removeAttribute(channel.crowd_query) - let port=brws.runtime.connect({name: "crowd-query"}) - port.onMessage.addListener(msg=>{ - if(msg=="") - { - document.documentElement.setAttribute(channel.crowd_queried, "") - } - else - { - location.assign("https://fastforward.team/crowd-bypassed?target="+encodeURIComponent(msg)+"&referer="+encodeURIComponent(referer)) - //The background script will intercept the request and redirect to html/crowd-bypassed.html - } - port.disconnect() - }) - port.postMessage({domain, crowdPath}) - } - else if(document.documentElement.hasAttribute(channel.crowd_contribute)) - { - const target=document.documentElement.getAttribute(channel.crowd_contribute) - document.documentElement.removeAttribute(channel.crowd_contribute) - brws.runtime.sendMessage({ - type: "crowd-contribute", - data: "domain="+encodeURIComponent(domain)+"&path="+encodeURIComponent(crowdPath)+"&target="+encodeURIComponent(target) - }) - } - else if(document.documentElement.hasAttribute(channel.adlinkfly_info)) - { - document.documentElement.removeAttribute(channel.adlinkfly_info) - if(crowdPath==location.pathname.substr(1)) - { - let port=brws.runtime.connect({name: "adlinkfly-info"}) - port.onMessage.addListener(msg=>{ - document.documentElement.setAttribute(channel.adlinkfly_target, msg) - port.disconnect() - }) - port.postMessage(location.href) - } - else - { - document.documentElement.setAttribute(channel.adlinkfly_target, "") - } - } - else if(document.documentElement.hasAttribute(channel.bypass_clipboard)) - { - const clipboard=document.documentElement.getAttribute(channel.bypass_clipboard) - document.documentElement.removeAttribute(channel.bypass_clipboard) - brws.runtime.sendMessage({ - type: "bypass-clipboard", - data: clipboard - }) - } - }) - observer.observe(document.documentElement, {attributes: true}) - - let domain=simplifyDomain(location.hostname), - crowdPath=location.pathname.substr(1), - referer=location.href - - //ffclipboard reciever - window.addEventListener("message", function(event) { - // We only accept messages from ourselves - if (event.source != window) { - return; - } - if (event.data.type === "ffclipboardSet") { - brws.storage.local.set({ff_clipboard: event.data.text}) - } - }); - brws.storage.local.get('ff_clipboard', function(result) { - ffClipboard_stored = result.ff_clipboard - - //encodeURIcomponent and replace whatever's not encoded, https://stackoverflow.com/a/16435373/17117909 - ffClipboard_stored = encodeURIComponent(ffClipboard_stored).replace(/\-/g, "%2D").replace(/\_/g, "%5F").replace(/\./g, "%2E").replace(/\!/g, "%21").replace(/\~/g, "%7E").replace(/\*/g, "%2A").replace(/\'/g, "%27").replace(/\(/g, "%28").replace(/\)/g, "%29") - const s = document.createElement('script'); - s.innerHTML = `window.x8675309bp = '${brws.runtime.getURL('')}';`; - document.documentElement.appendChild(s); - - let script=document.createElement("script") - script.setAttribute('type', 'module'); - script.src = brws.runtime.getURL('injection_script.js'); - // script.innerHTML=`(()=>{ - // const crowdEnabled=`+(res.crowdEnabled?"true":"false")+`, - // ignoreCrowdBypass=`+(ignoreCrowdBypass?"true":"false")+`, - // bypassClipboard="`+bypassClipboard.split("\\").join("\\\\").split("\"").join("\\\"")+`" - // let ffClipboard_stored="`+ffClipboard_stored+`" - // if(location.href=="https://fastforward.team/firstrun") - // { - // location.replace("https://fastforward.team/firstrun?1") - // return - // } - // })()` - script=document.documentElement.appendChild(script) - setTimeout(()=>document.documentElement.removeChild(script),10) - }); - }) -} +const brws = typeof browser !== 'undefined' ? browser : chrome; +async function getOptions() { + return new Promise((resolve) => { + brws.storage.local.get('options').then((result) => { + resolve(result.options); + }); + }); +} + +function getExtBaseURL() { + return brws.runtime.getURL('/'); +} + +async function injectScript() { + let options = await getOptions(); + if ( + options.whitelist && + matchDomains(window.location.hostname, options.whitelist) + ) { + console.log('FastForward: Site whitelisted'); + return; + } + let script = document.createElement('script'); + script.src = + brws.runtime.getURL('injection_script.js') + + '?' + + new URLSearchParams({ ext_base_URL: getExtBaseURL() }); //pass base url to injection script https://stackoverflow.com/a/9517879 + script.onload = function () { + script.remove(); + }; + (document.head || document.documentElement).appendChild(script); +} + +//ff + first 10 characters of SHA256 of fastforward to prevent collisions +document.addEventListener('ff53054c0e13_crowdQuery', async function (event) { + //we shoudn't receive an event if it's disabled but double checking anyway + let options = await getOptions(); + if (options.optionCrowdBypass === false) { + const src = brws.runtime.getURL('helpers/infobox.js'); + const insertInfoBox = await import(src); + insertInfoBox(brws.i18n.getMessage('crowdDisabled')); + return; + } + let data = event.detail; + let url = 'https://crowd.fastforward.team/crowd/query_v1'; + let params = new URLSearchParams(); + params.append('domain', data.domain); + params.append('path', data.path); + fetch(url, { + method: 'POST', + body: params, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }) + .then(function (response) { + if (response.status === 200) { + response.text().then(function (text) { + document.dispatchEvent( + new CustomEvent('ff53054c0e13_crowdResponse', { detail: text }) + ); + }); + } + }) + .catch(function (error) { + console.log(error); + }); +}); + +document.addEventListener( + 'ff53054c0e13_crowdContribute', + async function (event) { + let options = await getOptions(); + if (options.optionCrowdBypass === false) { + return; + } + let data = event.detail; + let url = 'https://crowd.fastforward.team/crowd/contribute_v1'; + let params = new URLSearchParams(); + params.append('domain', data.domain); + params.append('path', data.path); + params.append('target', data.target); + fetch(url, { + method: 'POST', + body: params, + headers: { + 'Content-Type': 'application/x-www-form-urlencoded', + }, + }).catch(function (error) { + console.log(error); + }); + } +); +function matchDomains(inputString, domains) { + let domainList = domains.split('\n'); + for (let domain of domainList) { + let regex = new RegExp('^' + domain.replace(/\*/g, '[^.]+') + '$'); + if (regex.test(inputString)) { + return true; + } + } + return false; +} + +injectScript(); diff --git a/src/js/injection_script.js b/src/js/injection_script.js deleted file mode 100644 index 248d362b2..000000000 --- a/src/js/injection_script.js +++ /dev/null @@ -1,83 +0,0 @@ -const bypasses = { - "acortalink.me": "bypasses/acortalink.js", - "www93.davisonbarker.pro": "bypasses/adfly.js", - "www96.lowrihouston.pro": "bypasses/adfly.js", - "akoam.to": "bypasses/akoam.js", - "anonym.ninja": "bypasses/anonym.js", - "brpaper.com": "bypasses/brpaper.js", - "cb.run": "bypasses/cbrun.js", - "cb.click": "bypasses/cbrun.js", - "clink1.com": "bypasses/clink1.js", - "complete2unlock.com": "bypasses/complete2unlock.js", - "cpmlink.net": "bypasses/cpmlink.js", - "daominhha.com/download": "bypasses/daominhha.js", - "earnme.club": "bypasses/earnme.js", - "usanewstoday.club": "bypasses/earnme.js", - "fastforward.team": "bypasses/fastforward.js", - "fc-lc.com": "bypasses/fclc.js", - "filedm.com": "bypasses/filedm.js", - "filehorse.com": "bypasses/filehorse.js", - "forex1pro.com": "bypasses/forex1pro.js", - "4shared.com": "bypasses/fourshared.js", - "fssquad.com": "bypasses/fssquad.js", - "gamesmega.net": "bypasses/gamesmega.js", - "gixen.com/home_1.php": "bypasses/gixen.js", - "leitup.com": "bypasses/leitup.js", - "liblink.pl": "bypasses/liblink.js", - "linkspy.cc": "bypasses/linkspy.js", - "linkvertise.com": "bypasses/linkvertise.js", - "linkvertise.net": "bypasses/linkvertise.js", - "link-to.net": "bypasses/linkvertise.js", - "lnk2.cc": "bypasses/lnk2cc.js", - "mydramalist.com": "bypasses/mydramalist.js", - "onepieceex.net": "bypasses/onepieceex.js", - "online-fix.me/ext/": "bypasses/onlinefix.js", - "oracle.com": "bypasses/oracle.js", - "pirateproxy.wtf": "bypasses/pirateproxy.js", - "rekonise.com": "bypasses/rekonise.js", - "sfile.mobi": "bypasses/sfile.js", - "sfile.xyz": "bypasses/sfile.js", - "apkmos.com": "bypasses/sfile.js", - "links.shortenbuddy.com": "bypasses/shortenbuddy.js", - "shortmoz.link": "bypasses/shortmoz.js", - "/sourceforge.net/projects/.+/files/.+/download/": "bypasses/sourceforge.js", - "srt.am": "bypasses/srtam.js", - "sub4unlock.com": "bypasses/sub4unlock.js", - "syosetu.org": "bypasses/syosetu.js", - "tik.lat": "bypasses/tiklat.js", - "uiz.io": "bypasses/uiz.js", - "uiz.app": "bypasses/uiz.js", - "tlkm.id": "bypasses/uiz.js", - "vk.com/away.php?to=": "bypasses/vk.js", - "wadooo.com": "bypasses/wadooo.js", - "ytsubme.com": "bypasses/ytsubme.js" -}; - -if (bypasses.hasOwnProperty(location.host)) { - const bypass_url = bypasses[location.host]; - - import(`${window.x8675309bp}${bypass_url}`).then(({default: bypass}) => { - import(`${window.x8675309bp}helpers/dom.js`).then(({default: helpers}) => { - const bps = new bypass; - bps.set_helpers(helpers); - console.log('ensure_dom: %r', bps.ensure_dom); - if (bps.ensure_dom) { - let executed = false; - document.addEventListener('readystatechange', () => { - if (['interactive', 'complete'].includes(document.readyState) && !executed) { - executed = true; - bps.execute(); - } - }); - document.addEventListener("DOMContentLoaded",()=>{ - if (!executed) { - executed = true; - bps.execute(); - } - }); - } else { - bps.execute(); - } - }); - }); -}