\n" +
79 | "\n" +
80 | "\n" +
81 | "\n"
82 | )
83 | var share=Intent(Intent.ACTION_SEND);
84 | var uri:Uri
85 | if (Build.VERSION.SDK_INT >= 24) {
86 | uri = FileProvider.getUriForFile(getApplicationContext(), getAppProcessName(this)+".fileprovider", file);
87 | } else {
88 | uri = Uri.fromFile(file);
89 | }
90 | share.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
91 | share.putExtra(Intent.EXTRA_STREAM, uri);//此处一定要用Uri.fromFile(file),其中file为File类型,否则附件无法发送成功。
92 | share.setType("text/html");
93 | startActivity(Intent.createChooser(share,"logviewer"));
94 | }
95 |
96 | internal inner class MyWebViewClient : WebViewClient() {
97 | override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
98 | view.loadUrl(url)
99 | return true
100 | }
101 |
102 |
103 | override fun onPageFinished(view: WebView, url: String) {
104 | var messageLog: MessageLogBean = MessageLogBean(
105 | data.applicationId!!,
106 | data.createTime!!,
107 | data.id.toString(),
108 | data.level!!,
109 | data.type!!,
110 | data.src!!,
111 | data.subject!!,
112 | data.content!!,
113 | data.url!!,
114 | data.tag!!)
115 |
116 | this@WebLogActivity.content = gsonFromat(messageLog)
117 | this@WebLogActivity.content = changeAddBr(content)
118 | web.loadUrl("javascript:code('" + this@WebLogActivity.content + "'" + ")")
119 | super.onPageFinished(view, url)
120 | }
121 | }
122 |
123 |
124 | /**
125 | * 生成一个临时的缓存文件
126 | */
127 | private fun getFile(): File {
128 | val dir = getFiledir()
129 | if (!dir.exists()) {
130 | dir.mkdirs()
131 | }
132 | return File(Environment.getExternalStorageDirectory()
133 | .path , "temp.html")
134 | }
135 |
136 |
137 | fun getFiledir(): File {
138 | return File(Environment.getExternalStorageDirectory().path)
139 | }
140 |
141 |
142 | fun getAppProcessName(context: Context): String {
143 | //当前应用pid
144 | val pid = android.os.Process.myPid()
145 | //任务管理类
146 | val manager = context.getSystemService(Context.ACTIVITY_SERVICE) as ActivityManager
147 | //遍历所有应用
148 | val infos = manager.runningAppProcesses
149 | for (info in infos) {
150 | if (info.pid == pid)
151 | //得到当前应用
152 | return info.processName//返回包名
153 | }
154 | return ""
155 | }
156 |
157 | private fun changeAddBr(content: String): String {
158 | return content.replace("\n".toRegex(), " ")
159 | }
160 |
161 | private fun gsonFromat(data: MessageLogBean): String {
162 | return GsonBuilder()
163 | .setPrettyPrinting()
164 | .create().toJson(data)
165 | }
166 |
167 | companion object {
168 | var DATA = "DATA"
169 | }
170 |
171 |
172 | fun whriteStringFile(str: String):File{
173 |
174 | var file=getFile()
175 |
176 | file.createNewFile()
177 | try {
178 |
179 |
180 | if (!file.exists()) {
181 |
182 | val dir = File(file.getParent())
183 |
184 | dir.mkdirs()
185 |
186 | file.createNewFile()
187 |
188 | }
189 |
190 | val outStream = FileOutputStream(file)
191 |
192 | outStream.write(str.toByteArray(Charsets.UTF_8))
193 |
194 | outStream.close()
195 |
196 | } catch (e: Exception) {
197 |
198 | e.printStackTrace()
199 |
200 | }
201 | return file
202 |
203 | }
204 |
205 |
206 | }
207 |
--------------------------------------------------------------------------------
/LogViewer/src/main/java/share/DataShare.kt:
--------------------------------------------------------------------------------
1 | package com.lxz.kotlin.tools.share
2 |
3 | import android.content.SharedPreferences
4 |
5 | import com.google.gson.Gson
6 |
7 | import java.util.HashMap
8 |
9 | import io.reactivex.Observable
10 |
11 | class DataShare {
12 | val androidShare: AndroidShare
13 |
14 | init {
15 | androidShare = AndroidShare(filename)
16 | }
17 |
18 |
19 | fun begin(): Build {
20 | return Build()
21 | }
22 |
23 | inner class Build {
24 | internal var localEditor: SharedPreferences.Editor = androidShare.settings.edit()
25 | fun put(key: String, value: String) {
26 | val localEditor = androidShare.settings.edit()
27 | localEditor.putString(key, value)
28 | }
29 |
30 | fun saveJsonObject(key: String, value: String) {
31 | val localEditor = androidShare.settings.edit()
32 | localEditor.putString(key, value)
33 | }
34 |
35 | fun commit() {
36 | localEditor.commit()
37 | }
38 | }
39 |
40 |
41 | fun clear(filename: String) {
42 | instance.androidShare.clear(filename)
43 | }
44 |
45 | companion object {
46 | private val filename = "DataObject"
47 | val dataObjectShare: DataShare by lazy { DataShare() }
48 |
49 | private val map = HashMap()
50 |
51 | // public static void init(Context ctx) {
52 | // context = ctx;
53 | // getInstance();
54 | // }
55 |
56 | val instance: DataShare
57 | get() = dataObjectShare
58 |
59 | fun clear() {
60 | map.clear()
61 | instance.androidShare.clear(filename)
62 | }
63 |
64 | fun saveJsonObject(obj: Any): Boolean {
65 |
66 | try {
67 |
68 | map[obj.javaClass.name] = obj
69 | instance.androidShare.put(obj.javaClass.name,
70 | Gson().toJson(obj))
71 |
72 | return true
73 | } catch (e: Exception) {
74 | // TODO Auto-generated catch block
75 | e.printStackTrace()
76 | }
77 |
78 | return false
79 | }
80 |
81 |
82 | fun saveJsonObject(key: String, obj: Any): Any {
83 | map[key] = obj
84 | instance.androidShare.put(key,
85 | Gson().toJson(obj))
86 | return obj
87 | }
88 |
89 | fun cleanJsonObject(key: String){
90 | map.remove(key)
91 | instance.androidShare.clearKey(key)
92 | }
93 |
94 |
95 | fun getJsonObject(key: String, cls: Class): T? {
96 | try {
97 | val obj = map[key]
98 | if (obj != null) return obj as T?
99 | val content = instance.androidShare.getString(key)
100 | return Gson().fromJson(content, cls)
101 | } catch (e: Exception) {
102 |
103 | }
104 |
105 | return null
106 | }
107 |
108 | fun getJsonObject(key: String, cls: Class ,defaultvalue:T?): T? {
109 | try {
110 | val obj = map[key]
111 | if (obj != null) return obj as T
112 | val content = instance.androidShare.getString(key)
113 | return Gson().fromJson(content, cls)
114 | } catch (e: Exception) {
115 |
116 | }
117 | return defaultvalue
118 | }
119 |
120 | fun getJsonObject(cls: Class): T? {
121 |
122 | try {
123 |
124 | val obj = map.get(cls.name)
125 | if (obj != null) return obj as T?
126 | val content = instance.androidShare.getString(cls.name)
127 | return Gson().fromJson(content, cls)
128 | } catch (e: Exception) {
129 |
130 | }
131 |
132 | return null
133 | }
134 |
135 |
136 | fun getJsonObjectObservable(cls: Class): Observable {
137 | return Observable.defer {
138 | Observable.create{ e ->
139 | var obj: Any? = map.get(cls.name)
140 | if (obj != null) {
141 | e.onNext(obj as T)
142 | } else {
143 | val content = instance.androidShare.getString(cls.name)
144 | if (content != null) {
145 | obj = Gson().fromJson(content, cls)
146 | if (obj != null) {
147 | e.onNext(Gson().fromJson(content, cls))
148 | } else {
149 | e.onError(NullPointerException(cls.name))
150 | }
151 | } else {
152 | e.onError(NullPointerException(cls.name))
153 | }
154 | }
155 |
156 | e.onComplete()
157 | }
158 | }
159 |
160 |
161 | }
162 |
163 |
164 | fun clean(cls: Class<*>): Boolean {
165 | map.remove(cls.name)
166 | instance.androidShare.put(cls.name, "")
167 | return true
168 |
169 | }
170 |
171 | fun put(key: String, value: String) {
172 | instance.androidShare.put(key, value)
173 | }
174 |
175 | fun put(key: String, value: Int?) {
176 | instance.androidShare.put(key, value)
177 | }
178 |
179 | fun put(key: String, value: Float?) {
180 | instance.androidShare.put(key, value)
181 | }
182 |
183 | fun put(key: String, value: Boolean?) {
184 | instance.androidShare.put(key, value!!)
185 | }
186 |
187 | fun put(key: String, value: Long?) {
188 | instance.androidShare.put(key, value)
189 | }
190 |
191 |
192 | fun getString(key: String): String? {
193 | return instance.androidShare.getString(key)
194 | }
195 |
196 | fun getString(key: String, defaultvalue: String): String? {
197 | return instance.androidShare.getString(key, defaultvalue)
198 | }
199 |
200 | fun getInt(key: String): Int? {
201 | return instance.androidShare.getInt(key)
202 | }
203 |
204 | fun getInt(key: String, defaultvalue: Int?): Int? {
205 | return instance.androidShare.getInt(key, defaultvalue)
206 | }
207 |
208 | fun getBoolean(key: String): Boolean {
209 | return instance.androidShare.getBoolean(key, false)!!
210 | }
211 |
212 | fun getBoolean(key: String, defaultvalue: Boolean?): Boolean {
213 | return instance.androidShare.getBoolean(key, defaultvalue)!!
214 | }
215 |
216 |
217 | fun getLong(key: String): Long {
218 | return instance.androidShare.getLong(key)!!
219 | }
220 |
221 | fun getLong(key: String, defaultvalue: Long?): Long {
222 | return instance.androidShare.getLong(key, defaultvalue)!!
223 | }
224 |
225 | fun getFloat(key: String): Float {
226 | return instance.androidShare.getFloat(key, 0f)!!
227 | }
228 |
229 | fun getFloat(key: String, defaultvalue: Float): Float {
230 | return instance.androidShare.getFloat(key, defaultvalue)!!
231 | }
232 |
233 |
234 | }
235 | }
236 |
--------------------------------------------------------------------------------
/LICENSE.txt:
--------------------------------------------------------------------------------
1 | Apache License
2 | Version 2.0, January 2004
3 | http://www.apache.org/licenses/
4 |
5 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6 |
7 | 1. Definitions.
8 |
9 | "License" shall mean the terms and conditions for use, reproduction,
10 | and distribution as defined by Sections 1 through 9 of this document.
11 |
12 | "Licensor" shall mean the copyright owner or entity authorized by
13 | the copyright owner that is granting the License.
14 |
15 | "Legal Entity" shall mean the union of the acting entity and all
16 | other entities that control, are controlled by, or are under common
17 | control with that entity. For the purposes of this definition,
18 | "control" means (i) the power, direct or indirect, to cause the
19 | direction or management of such entity, whether by contract or
20 | otherwise, or (ii) ownership of fifty percent (50%) or more of the
21 | outstanding shares, or (iii) beneficial ownership of such entity.
22 |
23 | "You" (or "Your") shall mean an individual or Legal Entity
24 | exercising permissions granted by this License.
25 |
26 | "Source" form shall mean the preferred form for making modifications,
27 | including but not limited to software source code, documentation
28 | source, and configuration files.
29 |
30 | "Object" form shall mean any form resulting from mechanical
31 | transformation or translation of a Source form, including but
32 | not limited to compiled object code, generated documentation,
33 | and conversions to other media types.
34 |
35 | "Work" shall mean the work of authorship, whether in Source or
36 | Object form, made available under the License, as indicated by a
37 | copyright notice that is included in or attached to the work
38 | (an example is provided in the Appendix below).
39 |
40 | "Derivative Works" shall mean any work, whether in Source or Object
41 | form, that is based on (or derived from) the Work and for which the
42 | editorial revisions, annotations, elaborations, or other modifications
43 | represent, as a whole, an original work of authorship. For the purposes
44 | of this License, Derivative Works shall not include works that remain
45 | separable from, or merely link (or bind by name) to the interfaces of,
46 | the Work and Derivative Works thereof.
47 |
48 | "Contribution" shall mean any work of authorship, including
49 | the original version of the Work and any modifications or additions
50 | to that Work or Derivative Works thereof, that is intentionally
51 | submitted to Licensor for inclusion in the Work by the copyright owner
52 | or by an individual or Legal Entity authorized to submit on behalf of
53 | the copyright owner. For the purposes of this definition, "submitted"
54 | means any form of electronic, verbal, or written communication sent
55 | to the Licensor or its representatives, including but not limited to
56 | communication on electronic mailing lists, source code control systems,
57 | and issue tracking systems that are managed by, or on behalf of, the
58 | Licensor for the purpose of discussing and improving the Work, but
59 | excluding communication that is conspicuously marked or otherwise
60 | designated in writing by the copyright owner as "Not a Contribution."
61 |
62 | "Contributor" shall mean Licensor and any individual or Legal Entity
63 | on behalf of whom a Contribution has been received by Licensor and
64 | subsequently incorporated within the Work.
65 |
66 | 2. Grant of Copyright License. Subject to the terms and conditions of
67 | this License, each Contributor hereby grants to You a perpetual,
68 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69 | copyright license to reproduce, prepare Derivative Works of,
70 | publicly display, publicly perform, sublicense, and distribute the
71 | Work and such Derivative Works in Source or Object form.
72 |
73 | 3. Grant of Patent License. Subject to the terms and conditions of
74 | this License, each Contributor hereby grants to You a perpetual,
75 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76 | (except as stated in this section) patent license to make, have made,
77 | use, offer to sell, sell, import, and otherwise transfer the Work,
78 | where such license applies only to those patent claims licensable
79 | by such Contributor that are necessarily infringed by their
80 | Contribution(s) alone or by combination of their Contribution(s)
81 | with the Work to which such Contribution(s) was submitted. If You
82 | institute patent litigation against any entity (including a
83 | cross-claim or counterclaim in a lawsuit) alleging that the Work
84 | or a Contribution incorporated within the Work constitutes direct
85 | or contributory patent infringement, then any patent licenses
86 | granted to You under this License for that Work shall terminate
87 | as of the date such litigation is filed.
88 |
89 | 4. Redistribution. You may reproduce and distribute copies of the
90 | Work or Derivative Works thereof in any medium, with or without
91 | modifications, and in Source or Object form, provided that You
92 | meet the following conditions:
93 |
94 | (a) You must give any other recipients of the Work or
95 | Derivative Works a copy of this License; and
96 |
97 | (b) You must cause any modified files to carry prominent notices
98 | stating that You changed the files; and
99 |
100 | (c) You must retain, in the Source form of any Derivative Works
101 | that You distribute, all copyright, patent, trademark, and
102 | attribution notices from the Source form of the Work,
103 | excluding those notices that do not pertain to any part of
104 | the Derivative Works; and
105 |
106 | (d) If the Work includes a "NOTICE" text file as part of its
107 | distribution, then any Derivative Works that You distribute must
108 | include a readable copy of the attribution notices contained
109 | within such NOTICE file, excluding those notices that do not
110 | pertain to any part of the Derivative Works, in at least one
111 | of the following places: within a NOTICE text file distributed
112 | as part of the Derivative Works; within the Source form or
113 | documentation, if provided along with the Derivative Works; or,
114 | within a display generated by the Derivative Works, if and
115 | wherever such third-party notices normally appear. The contents
116 | of the NOTICE file are for informational purposes only and
117 | do not modify the License. You may add Your own attribution
118 | notices within Derivative Works that You distribute, alongside
119 | or as an addendum to the NOTICE text from the Work, provided
120 | that such additional attribution notices cannot be construed
121 | as modifying the License.
122 |
123 | You may add Your own copyright statement to Your modifications and
124 | may provide additional or different license terms and conditions
125 | for use, reproduction, or distribution of Your modifications, or
126 | for any such Derivative Works as a whole, provided Your use,
127 | reproduction, and distribution of the Work otherwise complies with
128 | the conditions stated in this License.
129 |
130 | 5. Submission of Contributions. Unless You explicitly state otherwise,
131 | any Contribution intentionally submitted for inclusion in the Work
132 | by You to the Licensor shall be under the terms and conditions of
133 | this License, without any additional terms or conditions.
134 | Notwithstanding the above, nothing herein shall supersede or modify
135 | the terms of any separate license agreement you may have executed
136 | with Licensor regarding such Contributions.
137 |
138 | 6. Trademarks. This License does not grant permission to use the trade
139 | names, trademarks, service marks, or product names of the Licensor,
140 | except as required for reasonable and customary use in describing the
141 | origin of the Work and reproducing the content of the NOTICE file.
142 |
143 | 7. Disclaimer of Warranty. Unless required by applicable law or
144 | agreed to in writing, Licensor provides the Work (and each
145 | Contributor provides its Contributions) on an "AS IS" BASIS,
146 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147 | implied, including, without limitation, any warranties or conditions
148 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149 | PARTICULAR PURPOSE. You are solely responsible for determining the
150 | appropriateness of using or redistributing the Work and assume any
151 | risks associated with Your exercise of permissions under this License.
152 |
153 | 8. Limitation of Liability. In no event and under no legal theory,
154 | whether in tort (including negligence), contract, or otherwise,
155 | unless required by applicable law (such as deliberate and grossly
156 | negligent acts) or agreed to in writing, shall any Contributor be
157 | liable to You for damages, including any direct, indirect, special,
158 | incidental, or consequential damages of any character arising as a
159 | result of this License or out of the use or inability to use the
160 | Work (including but not limited to damages for loss of goodwill,
161 | work stoppage, computer failure or malfunction, or any and all
162 | other commercial damages or losses), even if such Contributor
163 | has been advised of the possibility of such damages.
164 |
165 | 9. Accepting Warranty or Additional Liability. While redistributing
166 | the Work or Derivative Works thereof, You may choose to offer,
167 | and charge a fee for, acceptance of support, warranty, indemnity,
168 | or other liability obligations and/or rights consistent with this
169 | License. However, in accepting such obligations, You may act only
170 | on Your own behalf and on Your sole responsibility, not on behalf
171 | of any other Contributor, and only if You agree to indemnify,
172 | defend, and hold each Contributor harmless for any liability
173 | incurred by, or claims asserted against, such Contributor by reason
174 | of your accepting any such warranty or additional liability.
175 |
176 | END OF TERMS AND CONDITIONS
177 |
178 | APPENDIX: How to apply the Apache License to your work.
179 |
180 | To apply the Apache License to your work, attach the following
181 | boilerplate notice, with the fields enclosed by brackets "{}"
182 | replaced with your own identifying information. (Don't include
183 | the brackets!) The text should be enclosed in the appropriate
184 | comment syntax for the file format. We also recommend that a
185 | file or class name and description of purpose be included on the
186 | same "printed page" as the copyright notice for easier
187 | identification within third-party archives.
188 |
189 | Copyright 2017 Wang YingHao
190 |
191 | Licensed under the Apache License, Version 2.0 (the "License");
192 | you may not use this file except in compliance with the License.
193 | You may obtain a copy of the License at
194 |
195 | http://www.apache.org/licenses/LICENSE-2.0
196 |
197 | Unless required by applicable law or agreed to in writing, software
198 | distributed under the License is distributed on an "AS IS" BASIS,
199 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200 | See the License for the specific language governing permissions and
201 | limitations under the License.
202 |
203 |
--------------------------------------------------------------------------------
/LogViewer/src/main/res/layout/activity_main.xml:
--------------------------------------------------------------------------------
1 |
2 |
7 |
8 |
14 |
15 |
19 |
20 |
30 |
31 |
39 |
40 |
41 |
42 |
43 |
44 |
49 |
50 |
54 |
55 |
61 |
62 |
63 |
67 |
68 |
69 |
74 |
75 |
78 |
79 |
85 |
86 |
87 |
88 |
89 |
90 |
91 |
92 |
93 |
100 |
101 |
106 |
107 |
111 |
112 |
121 |
122 |
132 |
133 |
143 |
144 |
145 |
150 |
151 |
152 |
153 |
154 |
155 |
156 |
157 |
158 |
159 |
160 |
168 |
169 |
174 |
175 |
185 |
186 |
187 |
190 |
191 |
200 |
201 |
218 |
219 |
220 |
221 |
225 |
226 |
234 |
235 |
246 |
247 |
248 |
249 |
250 |
251 |
252 |
253 |
254 |
255 |
256 |
--------------------------------------------------------------------------------
/LogViewer/src/main/assets/rtf/prettify.js:
--------------------------------------------------------------------------------
1 | !function(){var q=null;window.PR_SHOULD_USE_CONTINUATION=!0;
2 | (function(){function S(a){function d(e){var b=e.charCodeAt(0);if(b!==92)return b;var a=e.charAt(1);return(b=r[a])?b:"0"<=a&&a<="7"?parseInt(e.substring(1),8):a==="u"||a==="x"?parseInt(e.substring(2),16):e.charCodeAt(1)}function g(e){if(e<32)return(e<16?"\\x0":"\\x")+e.toString(16);e=String.fromCharCode(e);return e==="\\"||e==="-"||e==="]"||e==="^"?"\\"+e:e}function b(e){var b=e.substring(1,e.length-1).match(/\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\[0-3][0-7]{0,2}|\\[0-7]{1,2}|\\[\S\s]|[^\\]/g),e=[],a=
3 | b[0]==="^",c=["["];a&&c.push("^");for(var a=a?1:0,f=b.length;a122||(l<65||h>90||e.push([Math.max(65,h)|32,Math.min(l,90)|32]),l<97||h>122||e.push([Math.max(97,h)&-33,Math.min(l,122)&-33]))}}e.sort(function(e,a){return e[0]-a[0]||a[1]-e[1]});b=[];f=[];for(a=0;ah[0]&&(h[1]+1>h[0]&&c.push("-"),c.push(g(h[1])));c.push("]");return c.join("")}function s(e){for(var a=e.source.match(/\[(?:[^\\\]]|\\[\S\s])*]|\\u[\dA-Fa-f]{4}|\\x[\dA-Fa-f]{2}|\\\d+|\\[^\dux]|\(\?[!:=]|[()^]|[^()[\\^]+/g),c=a.length,d=[],f=0,h=0;f=2&&e==="["?a[f]=b(l):e!=="\\"&&(a[f]=l.replace(/[A-Za-z]/g,function(a){a=a.charCodeAt(0);return"["+String.fromCharCode(a&-33,a|32)+"]"}));return a.join("")}for(var x=0,m=!1,j=!1,k=0,c=a.length;k=5&&"lang-"===w.substring(0,5))&&!(t&&typeof t[1]==="string"))f=!1,w="src";f||(r[z]=w)}h=c;c+=z.length;if(f){f=t[1];var l=z.indexOf(f),B=l+f.length;t[2]&&(B=z.length-t[2].length,l=B-f.length);w=w.substring(5);H(j+h,z.substring(0,l),g,k);H(j+h+l,f,I(w,f),k);H(j+h+B,z.substring(B),g,k)}else k.push(j+h,w)}a.g=k}var b={},s;(function(){for(var g=a.concat(d),j=[],k={},c=0,i=g.length;c=0;)b[n.charAt(e)]=r;r=r[1];n=""+r;k.hasOwnProperty(n)||(j.push(r),k[n]=q)}j.push(/[\S\s]/);s=S(j)})();var x=d.length;return g}function v(a){var d=[],g=[];a.tripleQuotedStrings?d.push(["str",/^(?:'''(?:[^'\\]|\\[\S\s]|''?(?=[^']))*(?:'''|$)|"""(?:[^"\\]|\\[\S\s]|""?(?=[^"]))*(?:"""|$)|'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$))/,q,"'\""]):a.multiLineStrings?d.push(["str",/^(?:'(?:[^'\\]|\\[\S\s])*(?:'|$)|"(?:[^"\\]|\\[\S\s])*(?:"|$)|`(?:[^\\`]|\\[\S\s])*(?:`|$))/,
10 | q,"'\"`"]):d.push(["str",/^(?:'(?:[^\n\r'\\]|\\.)*(?:'|$)|"(?:[^\n\r"\\]|\\.)*(?:"|$))/,q,"\"'"]);a.verbatimStrings&&g.push(["str",/^@"(?:[^"]|"")*(?:"|$)/,q]);var b=a.hashComments;b&&(a.cStyleComments?(b>1?d.push(["com",/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,q,"#"]):d.push(["com",/^#(?:(?:define|e(?:l|nd)if|else|error|ifn?def|include|line|pragma|undef|warning)\b|[^\n\r]*)/,q,"#"]),g.push(["str",/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h(?:h|pp|\+\+)?|[a-z]\w*)>/,q])):d.push(["com",
11 | /^#[^\n\r]*/,q,"#"]));a.cStyleComments&&(g.push(["com",/^\/\/[^\n\r]*/,q]),g.push(["com",/^\/\*[\S\s]*?(?:\*\/|$)/,q]));if(b=a.regexLiterals){var s=(b=b>1?"":"\n\r")?".":"[\\S\\s]";g.push(["lang-regex",RegExp("^(?:^^\\.?|[+-]|[!=]=?=?|\\#|%=?|&&?=?|\\(|\\*=?|[+\\-]=|->|\\/=?|::?|<=?|>>?>?=?|,|;|\\?|@|\\[|~|{|\\^\\^?=?|\\|\\|?=?|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*("+("/(?=[^/*"+b+"])(?:[^/\\x5B\\x5C"+b+"]|\\x5C"+s+"|\\x5B(?:[^\\x5C\\x5D"+b+"]|\\x5C"+
12 | s+")*(?:\\x5D|$))+/")+")")])}(b=a.types)&&g.push(["typ",b]);b=(""+a.keywords).replace(/^ | $/g,"");b.length&&g.push(["kwd",RegExp("^(?:"+b.replace(/[\s,]+/g,"|")+")\\b"),q]);d.push(["pln",/^\s+/,q," \r\n\t\u00a0"]);b="^.[^\\s\\w.$@'\"`/\\\\]*";a.regexLiterals&&(b+="(?!s*/)");g.push(["lit",/^@[$_a-z][\w$@]*/i,q],["typ",/^(?:[@_]?[A-Z]+[a-z][\w$@]*|\w+_t\b)/,q],["pln",/^[$_a-z][\w$@]*/i,q],["lit",/^(?:0x[\da-f]+|(?:\d(?:_\d+)*\d*(?:\.\d*)?|\.\d\+)(?:e[+-]?\d+)?)[a-z]*/i,q,"0123456789"],["pln",/^\\[\S\s]?/,
13 | q],["pun",RegExp(b),q]);return C(d,g)}function J(a,d,g){function b(a){var c=a.nodeType;if(c==1&&!x.test(a.className))if("br"===a.nodeName)s(a),a.parentNode&&a.parentNode.removeChild(a);else for(a=a.firstChild;a;a=a.nextSibling)b(a);else if((c==3||c==4)&&g){var d=a.nodeValue,i=d.match(m);if(i)c=d.substring(0,i.index),a.nodeValue=c,(d=d.substring(i.index+i[0].length))&&a.parentNode.insertBefore(j.createTextNode(d),a.nextSibling),s(a),c||a.parentNode.removeChild(a)}}function s(a){function b(a,c){var d=
14 | c?a.cloneNode(!1):a,e=a.parentNode;if(e){var e=b(e,1),g=a.nextSibling;e.appendChild(d);for(var i=g;i;i=g)g=i.nextSibling,e.appendChild(i)}return d}for(;!a.nextSibling;)if(a=a.parentNode,!a)return;for(var a=b(a.nextSibling,0),d;(d=a.parentNode)&&d.nodeType===1;)a=d;c.push(a)}for(var x=/(?:^|\s)nocode(?:\s|$)/,m=/\r\n?|\n/,j=a.ownerDocument,k=j.createElement("li");a.firstChild;)k.appendChild(a.firstChild);for(var c=[k],i=0;i=0;){var b=d[g];F.hasOwnProperty(b)?D.console&&console.warn("cannot override language handler %s",b):F[b]=a}}function I(a,d){if(!a||!F.hasOwnProperty(a))a=/^\s*=l&&(b+=2);g>=B&&(r+=2)}}finally{if(f)f.style.display=h}}catch(u){D.console&&console.log(u&&u.stack||u)}}var D=window,y=["break,continue,do,else,for,if,return,while"],E=[[y,"auto,case,char,const,default,double,enum,extern,float,goto,inline,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"],
18 | "catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"],M=[E,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,delegate,dynamic_cast,explicit,export,friend,generic,late_check,mutable,namespace,nullptr,property,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"],N=[E,"abstract,assert,boolean,byte,extends,final,finally,implements,import,instanceof,interface,null,native,package,strictfp,super,synchronized,throws,transient"],
19 | O=[N,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,internal,into,is,let,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var,virtual,where"],E=[E,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"],P=[y,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"],
20 | Q=[y,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"],W=[y,"as,assert,const,copy,drop,enum,extern,fail,false,fn,impl,let,log,loop,match,mod,move,mut,priv,pub,pure,ref,self,static,struct,true,trait,type,unsafe,use"],y=[y,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"],R=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)\b/,
21 | V=/\S/,X=v({keywords:[M,O,E,"caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END",P,Q,y],hashComments:!0,cStyleComments:!0,multiLineStrings:!0,regexLiterals:!0}),F={};p(X,["default-code"]);p(C([],[["pln",/^[^]+/],["dec",/^]*(?:>|$)/],["com",/^<\!--[\S\s]*?(?:--\>|$)/],["lang-",/^<\?([\S\s]+?)(?:\?>|$)/],["lang-",/^<%([\S\s]+?)(?:%>|$)/],["pun",/^(?:<[%?]|[%?]>)/],["lang-",
22 | /^]*>([\S\s]+?)<\/xmp\b[^>]*>/i],["lang-js",/^