longdown 2023.4.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/LICENSE +10 -0
  2. package/README.md +77 -0
  3. package/bin/cli.js +3 -0
  4. package/lib/cli.js +120 -0
  5. package/lib/cljs-runtime/cljs.core.js +38285 -0
  6. package/lib/cljs-runtime/cljs.core.js.map +1 -0
  7. package/lib/cljs-runtime/cljs_env.js +1268 -0
  8. package/lib/cljs-runtime/clojure.string.js +477 -0
  9. package/lib/cljs-runtime/clojure.string.js.map +1 -0
  10. package/lib/cljs-runtime/clojure.tools.cli.js +1684 -0
  11. package/lib/cljs-runtime/clojure.tools.cli.js.map +1 -0
  12. package/lib/cljs-runtime/clojure.walk.js +131 -0
  13. package/lib/cljs-runtime/clojure.walk.js.map +1 -0
  14. package/lib/cljs-runtime/goog.array.array.js +658 -0
  15. package/lib/cljs-runtime/goog.array.array.js.map +9 -0
  16. package/lib/cljs-runtime/goog.asserts.asserts.js +131 -0
  17. package/lib/cljs-runtime/goog.asserts.asserts.js.map +9 -0
  18. package/lib/cljs-runtime/goog.asserts.dom.js +87 -0
  19. package/lib/cljs-runtime/goog.asserts.dom.js.map +9 -0
  20. package/lib/cljs-runtime/goog.base.js +1242 -0
  21. package/lib/cljs-runtime/goog.base.js.map +9 -0
  22. package/lib/cljs-runtime/goog.collections.maps.js +79 -0
  23. package/lib/cljs-runtime/goog.collections.maps.js.map +9 -0
  24. package/lib/cljs-runtime/goog.debug.error.js +29 -0
  25. package/lib/cljs-runtime/goog.debug.error.js.map +9 -0
  26. package/lib/cljs-runtime/goog.dom.asserts.js +39 -0
  27. package/lib/cljs-runtime/goog.dom.asserts.js.map +9 -0
  28. package/lib/cljs-runtime/goog.dom.element.js +67 -0
  29. package/lib/cljs-runtime/goog.dom.element.js.map +9 -0
  30. package/lib/cljs-runtime/goog.dom.htmlelement.js +6 -0
  31. package/lib/cljs-runtime/goog.dom.htmlelement.js.map +9 -0
  32. package/lib/cljs-runtime/goog.dom.nodetype.js +5 -0
  33. package/lib/cljs-runtime/goog.dom.nodetype.js.map +9 -0
  34. package/lib/cljs-runtime/goog.dom.safe.js +265 -0
  35. package/lib/cljs-runtime/goog.dom.safe.js.map +9 -0
  36. package/lib/cljs-runtime/goog.dom.tagname.js +146 -0
  37. package/lib/cljs-runtime/goog.dom.tagname.js.map +9 -0
  38. package/lib/cljs-runtime/goog.dom.tags.js +9 -0
  39. package/lib/cljs-runtime/goog.dom.tags.js.map +9 -0
  40. package/lib/cljs-runtime/goog.flags.flags.js +11 -0
  41. package/lib/cljs-runtime/goog.flags.flags.js.map +9 -0
  42. package/lib/cljs-runtime/goog.fs.blob.js +37 -0
  43. package/lib/cljs-runtime/goog.fs.blob.js.map +9 -0
  44. package/lib/cljs-runtime/goog.fs.url.js +36 -0
  45. package/lib/cljs-runtime/goog.fs.url.js.map +9 -0
  46. package/lib/cljs-runtime/goog.functions.functions.js +210 -0
  47. package/lib/cljs-runtime/goog.functions.functions.js.map +9 -0
  48. package/lib/cljs-runtime/goog.html.safehtml.js +306 -0
  49. package/lib/cljs-runtime/goog.html.safehtml.js.map +9 -0
  50. package/lib/cljs-runtime/goog.html.safescript.js +61 -0
  51. package/lib/cljs-runtime/goog.html.safescript.js.map +9 -0
  52. package/lib/cljs-runtime/goog.html.safestyle.js +170 -0
  53. package/lib/cljs-runtime/goog.html.safestyle.js.map +9 -0
  54. package/lib/cljs-runtime/goog.html.safestylesheet.js +93 -0
  55. package/lib/cljs-runtime/goog.html.safestylesheet.js.map +9 -0
  56. package/lib/cljs-runtime/goog.html.safeurl.js +225 -0
  57. package/lib/cljs-runtime/goog.html.safeurl.js.map +9 -0
  58. package/lib/cljs-runtime/goog.html.trustedresourceurl.js +113 -0
  59. package/lib/cljs-runtime/goog.html.trustedresourceurl.js.map +9 -0
  60. package/lib/cljs-runtime/goog.html.trustedtypes.js +15 -0
  61. package/lib/cljs-runtime/goog.html.trustedtypes.js.map +9 -0
  62. package/lib/cljs-runtime/goog.html.uncheckedconversions.js +43 -0
  63. package/lib/cljs-runtime/goog.html.uncheckedconversions.js.map +9 -0
  64. package/lib/cljs-runtime/goog.labs.useragent.browser.js +332 -0
  65. package/lib/cljs-runtime/goog.labs.useragent.browser.js.map +9 -0
  66. package/lib/cljs-runtime/goog.labs.useragent.highentropy.highentropydata.js +13 -0
  67. package/lib/cljs-runtime/goog.labs.useragent.highentropy.highentropydata.js.map +9 -0
  68. package/lib/cljs-runtime/goog.labs.useragent.highentropy.highentropyvalue.js +72 -0
  69. package/lib/cljs-runtime/goog.labs.useragent.highentropy.highentropyvalue.js.map +9 -0
  70. package/lib/cljs-runtime/goog.labs.useragent.useragent.js +20 -0
  71. package/lib/cljs-runtime/goog.labs.useragent.useragent.js.map +9 -0
  72. package/lib/cljs-runtime/goog.labs.useragent.util.js +77 -0
  73. package/lib/cljs-runtime/goog.labs.useragent.util.js.map +9 -0
  74. package/lib/cljs-runtime/goog.math.integer.js +425 -0
  75. package/lib/cljs-runtime/goog.math.integer.js.map +9 -0
  76. package/lib/cljs-runtime/goog.math.long.js +427 -0
  77. package/lib/cljs-runtime/goog.math.long.js.map +9 -0
  78. package/lib/cljs-runtime/goog.object.object.js +283 -0
  79. package/lib/cljs-runtime/goog.object.object.js.map +9 -0
  80. package/lib/cljs-runtime/goog.reflect.reflect.js +31 -0
  81. package/lib/cljs-runtime/goog.reflect.reflect.js.map +9 -0
  82. package/lib/cljs-runtime/goog.string.const.js +33 -0
  83. package/lib/cljs-runtime/goog.string.const.js.map +9 -0
  84. package/lib/cljs-runtime/goog.string.internal.js +118 -0
  85. package/lib/cljs-runtime/goog.string.internal.js.map +9 -0
  86. package/lib/cljs-runtime/goog.string.string.js +458 -0
  87. package/lib/cljs-runtime/goog.string.string.js.map +9 -0
  88. package/lib/cljs-runtime/goog.string.stringbuffer.js +31 -0
  89. package/lib/cljs-runtime/goog.string.stringbuffer.js.map +9 -0
  90. package/lib/cljs-runtime/goog.string.stringformat.js +74 -0
  91. package/lib/cljs-runtime/goog.string.stringformat.js.map +9 -0
  92. package/lib/cljs-runtime/goog.string.typedstring.js +8 -0
  93. package/lib/cljs-runtime/goog.string.typedstring.js.map +9 -0
  94. package/lib/cljs-runtime/goog.structs.structs.js +188 -0
  95. package/lib/cljs-runtime/goog.structs.structs.js.map +9 -0
  96. package/lib/cljs-runtime/goog.uri.uri.js +616 -0
  97. package/lib/cljs-runtime/goog.uri.uri.js.map +9 -0
  98. package/lib/cljs-runtime/goog.uri.utils.js +320 -0
  99. package/lib/cljs-runtime/goog.uri.utils.js.map +9 -0
  100. package/lib/cljs-runtime/longdown.cli.js +128 -0
  101. package/lib/cljs-runtime/longdown.cli.js.map +1 -0
  102. package/lib/cljs-runtime/longdown.lib.js +122 -0
  103. package/lib/cljs-runtime/longdown.lib.js.map +1 -0
  104. package/lib/cljs-runtime/shadow.esm.esm_import$mdast_util_from_markdown.js +5 -0
  105. package/lib/cljs-runtime/shadow.esm.esm_import$mdast_util_from_markdown.js.map +9 -0
  106. package/lib/cljs-runtime/shadow.esm.esm_import$mdast_util_to_markdown$lib$unsafe.js +5 -0
  107. package/lib/cljs-runtime/shadow.esm.esm_import$mdast_util_to_markdown$lib$unsafe.js.map +9 -0
  108. package/lib/cljs-runtime/shadow.esm.esm_import$mdast_util_to_markdown.js +5 -0
  109. package/lib/cljs-runtime/shadow.esm.esm_import$mdast_util_to_markdown.js.map +9 -0
  110. package/lib/cljs-runtime/shadow.esm.esm_import$node_fs.js +5 -0
  111. package/lib/cljs-runtime/shadow.esm.esm_import$node_fs.js.map +9 -0
  112. package/lib/cljs-runtime/shadow.esm.esm_import$node_path.js +5 -0
  113. package/lib/cljs-runtime/shadow.esm.esm_import$node_path.js.map +9 -0
  114. package/lib/cljs-runtime/shadow.esm.esm_import$remark_parse.js +5 -0
  115. package/lib/cljs-runtime/shadow.esm.esm_import$remark_parse.js.map +9 -0
  116. package/lib/cljs-runtime/shadow.esm.esm_import$remark_stringify.js +5 -0
  117. package/lib/cljs-runtime/shadow.esm.esm_import$remark_stringify.js.map +9 -0
  118. package/lib/cljs-runtime/shadow.esm.esm_import$unified.js +5 -0
  119. package/lib/cljs-runtime/shadow.esm.esm_import$unified.js.map +9 -0
  120. package/lib/cljs-runtime/shadow.module.cli.append.js +1 -0
  121. package/lib/cljs-runtime/shadow.module.cli.prepend.js +17 -0
  122. package/lib/cljs-runtime/shadow.module.lib.append.js +1 -0
  123. package/lib/cljs-runtime/shadow.module.lib.prepend.js +2 -0
  124. package/lib/lib.js +8 -0
  125. package/package.json +33 -0
@@ -0,0 +1,616 @@
1
+ import "./cljs_env.js";
2
+ goog.provide("goog.Uri");
3
+ goog.provide("goog.Uri.QueryData");
4
+ goog.require("goog.array");
5
+ goog.require("goog.asserts");
6
+ goog.require("goog.collections.maps");
7
+ goog.require("goog.string");
8
+ goog.require("goog.structs");
9
+ goog.require("goog.uri.utils");
10
+ goog.require("goog.uri.utils.ComponentIndex");
11
+ goog.require("goog.uri.utils.StandardQueryParam");
12
+ goog.Uri = function(opt_uri, opt_ignoreCase) {
13
+ this.scheme_ = "";
14
+ this.userInfo_ = "";
15
+ this.domain_ = "";
16
+ this.port_ = null;
17
+ this.path_ = "";
18
+ this.fragment_ = "";
19
+ this.isReadOnly_ = false;
20
+ this.ignoreCase_ = false;
21
+ this.queryData_;
22
+ var m;
23
+ if (opt_uri instanceof goog.Uri) {
24
+ this.ignoreCase_ = opt_ignoreCase !== undefined ? opt_ignoreCase : opt_uri.getIgnoreCase();
25
+ this.setScheme(opt_uri.getScheme());
26
+ this.setUserInfo(opt_uri.getUserInfo());
27
+ this.setDomain(opt_uri.getDomain());
28
+ this.setPort(opt_uri.getPort());
29
+ this.setPath(opt_uri.getPath());
30
+ this.setQueryData(opt_uri.getQueryData().clone());
31
+ this.setFragment(opt_uri.getFragment());
32
+ } else if (opt_uri && (m = goog.uri.utils.split(String(opt_uri)))) {
33
+ this.ignoreCase_ = !!opt_ignoreCase;
34
+ this.setScheme(m[goog.uri.utils.ComponentIndex.SCHEME] || "", true);
35
+ this.setUserInfo(m[goog.uri.utils.ComponentIndex.USER_INFO] || "", true);
36
+ this.setDomain(m[goog.uri.utils.ComponentIndex.DOMAIN] || "", true);
37
+ this.setPort(m[goog.uri.utils.ComponentIndex.PORT]);
38
+ this.setPath(m[goog.uri.utils.ComponentIndex.PATH] || "", true);
39
+ this.setQueryData(m[goog.uri.utils.ComponentIndex.QUERY_DATA] || "", true);
40
+ this.setFragment(m[goog.uri.utils.ComponentIndex.FRAGMENT] || "", true);
41
+ } else {
42
+ this.ignoreCase_ = !!opt_ignoreCase;
43
+ this.queryData_ = new goog.Uri.QueryData(null, this.ignoreCase_);
44
+ }
45
+ };
46
+ goog.Uri.RANDOM_PARAM = goog.uri.utils.StandardQueryParam.RANDOM;
47
+ goog.Uri.prototype.toString = function() {
48
+ var out = [];
49
+ var scheme = this.getScheme();
50
+ if (scheme) {
51
+ out.push(goog.Uri.encodeSpecialChars_(scheme, goog.Uri.reDisallowedInSchemeOrUserInfo_, true), ":");
52
+ }
53
+ var domain = this.getDomain();
54
+ if (domain || scheme == "file") {
55
+ out.push("//");
56
+ var userInfo = this.getUserInfo();
57
+ if (userInfo) {
58
+ out.push(goog.Uri.encodeSpecialChars_(userInfo, goog.Uri.reDisallowedInSchemeOrUserInfo_, true), "@");
59
+ }
60
+ out.push(goog.Uri.removeDoubleEncoding_(goog.string.urlEncode(domain)));
61
+ var port = this.getPort();
62
+ if (port != null) {
63
+ out.push(":", String(port));
64
+ }
65
+ }
66
+ var path = this.getPath();
67
+ if (path) {
68
+ if (this.hasDomain() && path.charAt(0) != "/") {
69
+ out.push("/");
70
+ }
71
+ out.push(goog.Uri.encodeSpecialChars_(path, path.charAt(0) == "/" ? goog.Uri.reDisallowedInAbsolutePath_ : goog.Uri.reDisallowedInRelativePath_, true));
72
+ }
73
+ var query = this.getEncodedQuery();
74
+ if (query) {
75
+ out.push("?", query);
76
+ }
77
+ var fragment = this.getFragment();
78
+ if (fragment) {
79
+ out.push("#", goog.Uri.encodeSpecialChars_(fragment, goog.Uri.reDisallowedInFragment_));
80
+ }
81
+ return out.join("");
82
+ };
83
+ goog.Uri.prototype.resolve = function(relativeUri) {
84
+ var absoluteUri = this.clone();
85
+ var overridden = relativeUri.hasScheme();
86
+ if (overridden) {
87
+ absoluteUri.setScheme(relativeUri.getScheme());
88
+ } else {
89
+ overridden = relativeUri.hasUserInfo();
90
+ }
91
+ if (overridden) {
92
+ absoluteUri.setUserInfo(relativeUri.getUserInfo());
93
+ } else {
94
+ overridden = relativeUri.hasDomain();
95
+ }
96
+ if (overridden) {
97
+ absoluteUri.setDomain(relativeUri.getDomain());
98
+ } else {
99
+ overridden = relativeUri.hasPort();
100
+ }
101
+ var path = relativeUri.getPath();
102
+ if (overridden) {
103
+ absoluteUri.setPort(relativeUri.getPort());
104
+ } else {
105
+ overridden = relativeUri.hasPath();
106
+ if (overridden) {
107
+ if (path.charAt(0) != "/") {
108
+ if (this.hasDomain() && !this.hasPath()) {
109
+ path = "/" + path;
110
+ } else {
111
+ var lastSlashIndex = absoluteUri.getPath().lastIndexOf("/");
112
+ if (lastSlashIndex != -1) {
113
+ path = absoluteUri.getPath().slice(0, lastSlashIndex + 1) + path;
114
+ }
115
+ }
116
+ }
117
+ path = goog.Uri.removeDotSegments(path);
118
+ }
119
+ }
120
+ if (overridden) {
121
+ absoluteUri.setPath(path);
122
+ } else {
123
+ overridden = relativeUri.hasQuery();
124
+ }
125
+ if (overridden) {
126
+ absoluteUri.setQueryData(relativeUri.getQueryData().clone());
127
+ } else {
128
+ overridden = relativeUri.hasFragment();
129
+ }
130
+ if (overridden) {
131
+ absoluteUri.setFragment(relativeUri.getFragment());
132
+ }
133
+ return absoluteUri;
134
+ };
135
+ goog.Uri.prototype.clone = function() {
136
+ return new goog.Uri(this);
137
+ };
138
+ goog.Uri.prototype.getScheme = function() {
139
+ return this.scheme_;
140
+ };
141
+ goog.Uri.prototype.setScheme = function(newScheme, opt_decode) {
142
+ this.enforceReadOnly();
143
+ this.scheme_ = opt_decode ? goog.Uri.decodeOrEmpty_(newScheme, true) : newScheme;
144
+ if (this.scheme_) {
145
+ this.scheme_ = this.scheme_.replace(/:$/, "");
146
+ }
147
+ return this;
148
+ };
149
+ goog.Uri.prototype.hasScheme = function() {
150
+ return !!this.scheme_;
151
+ };
152
+ goog.Uri.prototype.getUserInfo = function() {
153
+ return this.userInfo_;
154
+ };
155
+ goog.Uri.prototype.setUserInfo = function(newUserInfo, opt_decode) {
156
+ this.enforceReadOnly();
157
+ this.userInfo_ = opt_decode ? goog.Uri.decodeOrEmpty_(newUserInfo) : newUserInfo;
158
+ return this;
159
+ };
160
+ goog.Uri.prototype.hasUserInfo = function() {
161
+ return !!this.userInfo_;
162
+ };
163
+ goog.Uri.prototype.getDomain = function() {
164
+ return this.domain_;
165
+ };
166
+ goog.Uri.prototype.setDomain = function(newDomain, opt_decode) {
167
+ this.enforceReadOnly();
168
+ this.domain_ = opt_decode ? goog.Uri.decodeOrEmpty_(newDomain, true) : newDomain;
169
+ return this;
170
+ };
171
+ goog.Uri.prototype.hasDomain = function() {
172
+ return !!this.domain_;
173
+ };
174
+ goog.Uri.prototype.getPort = function() {
175
+ return this.port_;
176
+ };
177
+ goog.Uri.prototype.setPort = function(newPort) {
178
+ this.enforceReadOnly();
179
+ if (newPort) {
180
+ newPort = Number(newPort);
181
+ if (isNaN(newPort) || newPort < 0) {
182
+ throw new Error("Bad port number " + newPort);
183
+ }
184
+ this.port_ = newPort;
185
+ } else {
186
+ this.port_ = null;
187
+ }
188
+ return this;
189
+ };
190
+ goog.Uri.prototype.hasPort = function() {
191
+ return this.port_ != null;
192
+ };
193
+ goog.Uri.prototype.getPath = function() {
194
+ return this.path_;
195
+ };
196
+ goog.Uri.prototype.setPath = function(newPath, opt_decode) {
197
+ this.enforceReadOnly();
198
+ this.path_ = opt_decode ? goog.Uri.decodeOrEmpty_(newPath, true) : newPath;
199
+ return this;
200
+ };
201
+ goog.Uri.prototype.hasPath = function() {
202
+ return !!this.path_;
203
+ };
204
+ goog.Uri.prototype.hasQuery = function() {
205
+ return this.queryData_.toString() !== "";
206
+ };
207
+ goog.Uri.prototype.setQueryData = function(queryData, opt_decode) {
208
+ this.enforceReadOnly();
209
+ if (queryData instanceof goog.Uri.QueryData) {
210
+ this.queryData_ = queryData;
211
+ this.queryData_.setIgnoreCase(this.ignoreCase_);
212
+ } else {
213
+ if (!opt_decode) {
214
+ queryData = goog.Uri.encodeSpecialChars_(queryData, goog.Uri.reDisallowedInQuery_);
215
+ }
216
+ this.queryData_ = new goog.Uri.QueryData(queryData, this.ignoreCase_);
217
+ }
218
+ return this;
219
+ };
220
+ goog.Uri.prototype.setQuery = function(newQuery, opt_decode) {
221
+ return this.setQueryData(newQuery, opt_decode);
222
+ };
223
+ goog.Uri.prototype.getEncodedQuery = function() {
224
+ return this.queryData_.toString();
225
+ };
226
+ goog.Uri.prototype.getDecodedQuery = function() {
227
+ return this.queryData_.toDecodedString();
228
+ };
229
+ goog.Uri.prototype.getQueryData = function() {
230
+ return this.queryData_;
231
+ };
232
+ goog.Uri.prototype.getQuery = function() {
233
+ return this.getEncodedQuery();
234
+ };
235
+ goog.Uri.prototype.setParameterValue = function(key, value) {
236
+ this.enforceReadOnly();
237
+ this.queryData_.set(key, value);
238
+ return this;
239
+ };
240
+ goog.Uri.prototype.setParameterValues = function(key, values) {
241
+ this.enforceReadOnly();
242
+ if (!Array.isArray(values)) {
243
+ values = [String(values)];
244
+ }
245
+ this.queryData_.setValues(key, values);
246
+ return this;
247
+ };
248
+ goog.Uri.prototype.getParameterValues = function(name) {
249
+ return this.queryData_.getValues(name);
250
+ };
251
+ goog.Uri.prototype.getParameterValue = function(paramName) {
252
+ return this.queryData_.get(paramName);
253
+ };
254
+ goog.Uri.prototype.getFragment = function() {
255
+ return this.fragment_;
256
+ };
257
+ goog.Uri.prototype.setFragment = function(newFragment, opt_decode) {
258
+ this.enforceReadOnly();
259
+ this.fragment_ = opt_decode ? goog.Uri.decodeOrEmpty_(newFragment) : newFragment;
260
+ return this;
261
+ };
262
+ goog.Uri.prototype.hasFragment = function() {
263
+ return !!this.fragment_;
264
+ };
265
+ goog.Uri.prototype.hasSameDomainAs = function(uri2) {
266
+ return (!this.hasDomain() && !uri2.hasDomain() || this.getDomain() == uri2.getDomain()) && (!this.hasPort() && !uri2.hasPort() || this.getPort() == uri2.getPort());
267
+ };
268
+ goog.Uri.prototype.makeUnique = function() {
269
+ this.enforceReadOnly();
270
+ this.setParameterValue(goog.Uri.RANDOM_PARAM, goog.string.getRandomString());
271
+ return this;
272
+ };
273
+ goog.Uri.prototype.removeParameter = function(key) {
274
+ this.enforceReadOnly();
275
+ this.queryData_.remove(key);
276
+ return this;
277
+ };
278
+ goog.Uri.prototype.setReadOnly = function(isReadOnly) {
279
+ this.isReadOnly_ = isReadOnly;
280
+ return this;
281
+ };
282
+ goog.Uri.prototype.isReadOnly = function() {
283
+ return this.isReadOnly_;
284
+ };
285
+ goog.Uri.prototype.enforceReadOnly = function() {
286
+ if (this.isReadOnly_) {
287
+ throw new Error("Tried to modify a read-only Uri");
288
+ }
289
+ };
290
+ goog.Uri.prototype.setIgnoreCase = function(ignoreCase) {
291
+ this.ignoreCase_ = ignoreCase;
292
+ if (this.queryData_) {
293
+ this.queryData_.setIgnoreCase(ignoreCase);
294
+ }
295
+ return this;
296
+ };
297
+ goog.Uri.prototype.getIgnoreCase = function() {
298
+ return this.ignoreCase_;
299
+ };
300
+ goog.Uri.parse = function(uri, opt_ignoreCase) {
301
+ return uri instanceof goog.Uri ? uri.clone() : new goog.Uri(uri, opt_ignoreCase);
302
+ };
303
+ goog.Uri.create = function(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_query, opt_fragment, opt_ignoreCase) {
304
+ var uri = new goog.Uri(null, opt_ignoreCase);
305
+ opt_scheme && uri.setScheme(opt_scheme);
306
+ opt_userInfo && uri.setUserInfo(opt_userInfo);
307
+ opt_domain && uri.setDomain(opt_domain);
308
+ opt_port && uri.setPort(opt_port);
309
+ opt_path && uri.setPath(opt_path);
310
+ opt_query && uri.setQueryData(opt_query);
311
+ opt_fragment && uri.setFragment(opt_fragment);
312
+ return uri;
313
+ };
314
+ goog.Uri.resolve = function(base, rel) {
315
+ if (!(base instanceof goog.Uri)) {
316
+ base = goog.Uri.parse(base);
317
+ }
318
+ if (!(rel instanceof goog.Uri)) {
319
+ rel = goog.Uri.parse(rel);
320
+ }
321
+ return base.resolve(rel);
322
+ };
323
+ goog.Uri.removeDotSegments = function(path) {
324
+ if (path == ".." || path == ".") {
325
+ return "";
326
+ } else if (!goog.string.contains(path, "./") && !goog.string.contains(path, "/.")) {
327
+ return path;
328
+ } else {
329
+ var leadingSlash = goog.string.startsWith(path, "/");
330
+ var segments = path.split("/");
331
+ var out = [];
332
+ for (var pos = 0; pos < segments.length;) {
333
+ var segment = segments[pos++];
334
+ if (segment == ".") {
335
+ if (leadingSlash && pos == segments.length) {
336
+ out.push("");
337
+ }
338
+ } else if (segment == "..") {
339
+ if (out.length > 1 || out.length == 1 && out[0] != "") {
340
+ out.pop();
341
+ }
342
+ if (leadingSlash && pos == segments.length) {
343
+ out.push("");
344
+ }
345
+ } else {
346
+ out.push(segment);
347
+ leadingSlash = true;
348
+ }
349
+ }
350
+ return out.join("/");
351
+ }
352
+ };
353
+ goog.Uri.decodeOrEmpty_ = function(val, opt_preserveReserved) {
354
+ if (!val) {
355
+ return "";
356
+ }
357
+ return opt_preserveReserved ? decodeURI(val.replace(/%25/g, "%2525")) : decodeURIComponent(val);
358
+ };
359
+ goog.Uri.encodeSpecialChars_ = function(unescapedPart, extra, opt_removeDoubleEncoding) {
360
+ if (typeof unescapedPart === "string") {
361
+ var encoded = encodeURI(unescapedPart).replace(extra, goog.Uri.encodeChar_);
362
+ if (opt_removeDoubleEncoding) {
363
+ encoded = goog.Uri.removeDoubleEncoding_(encoded);
364
+ }
365
+ return encoded;
366
+ }
367
+ return null;
368
+ };
369
+ goog.Uri.encodeChar_ = function(ch) {
370
+ var n = ch.charCodeAt(0);
371
+ return "%" + (n >> 4 & 15).toString(16) + (n & 15).toString(16);
372
+ };
373
+ goog.Uri.removeDoubleEncoding_ = function(doubleEncodedString) {
374
+ return doubleEncodedString.replace(/%25([0-9a-fA-F]{2})/g, "%$1");
375
+ };
376
+ goog.Uri.reDisallowedInSchemeOrUserInfo_ = /[#\/\?@]/g;
377
+ goog.Uri.reDisallowedInRelativePath_ = /[#\?:]/g;
378
+ goog.Uri.reDisallowedInAbsolutePath_ = /[#\?]/g;
379
+ goog.Uri.reDisallowedInQuery_ = /[#\?@]/g;
380
+ goog.Uri.reDisallowedInFragment_ = /#/g;
381
+ goog.Uri.haveSameDomain = function(uri1String, uri2String) {
382
+ var pieces1 = goog.uri.utils.split(uri1String);
383
+ var pieces2 = goog.uri.utils.split(uri2String);
384
+ return pieces1[goog.uri.utils.ComponentIndex.DOMAIN] == pieces2[goog.uri.utils.ComponentIndex.DOMAIN] && pieces1[goog.uri.utils.ComponentIndex.PORT] == pieces2[goog.uri.utils.ComponentIndex.PORT];
385
+ };
386
+ goog.Uri.QueryData = function(opt_query, opt_ignoreCase) {
387
+ this.keyMap_ = null;
388
+ this.count_ = null;
389
+ this.encodedQuery_ = opt_query || null;
390
+ this.ignoreCase_ = !!opt_ignoreCase;
391
+ };
392
+ goog.Uri.QueryData.prototype.ensureKeyMapInitialized_ = function() {
393
+ if (!this.keyMap_) {
394
+ this.keyMap_ = new Map();
395
+ this.count_ = 0;
396
+ if (this.encodedQuery_) {
397
+ var self = this;
398
+ goog.uri.utils.parseQueryData(this.encodedQuery_, function(name, value) {
399
+ self.add(goog.string.urlDecode(name), value);
400
+ });
401
+ }
402
+ }
403
+ };
404
+ goog.Uri.QueryData.createFromMap = function(map, opt_ignoreCase) {
405
+ var keys = goog.structs.getKeys(map);
406
+ if (typeof keys == "undefined") {
407
+ throw new Error("Keys are undefined");
408
+ }
409
+ var queryData = new goog.Uri.QueryData(null, opt_ignoreCase);
410
+ var values = goog.structs.getValues(map);
411
+ for (var i = 0; i < keys.length; i++) {
412
+ var key = keys[i];
413
+ var value = values[i];
414
+ if (!Array.isArray(value)) {
415
+ queryData.add(key, value);
416
+ } else {
417
+ queryData.setValues(key, value);
418
+ }
419
+ }
420
+ return queryData;
421
+ };
422
+ goog.Uri.QueryData.createFromKeysValues = function(keys, values, opt_ignoreCase) {
423
+ if (keys.length != values.length) {
424
+ throw new Error("Mismatched lengths for keys/values");
425
+ }
426
+ var queryData = new goog.Uri.QueryData(null, opt_ignoreCase);
427
+ for (var i = 0; i < keys.length; i++) {
428
+ queryData.add(keys[i], values[i]);
429
+ }
430
+ return queryData;
431
+ };
432
+ goog.Uri.QueryData.prototype.getCount = function() {
433
+ this.ensureKeyMapInitialized_();
434
+ return this.count_;
435
+ };
436
+ goog.Uri.QueryData.prototype.add = function(key, value) {
437
+ this.ensureKeyMapInitialized_();
438
+ this.invalidateCache_();
439
+ key = this.getKeyName_(key);
440
+ var values = this.keyMap_.get(key);
441
+ if (!values) {
442
+ this.keyMap_.set(key, values = []);
443
+ }
444
+ values.push(value);
445
+ this.count_ = goog.asserts.assertNumber(this.count_) + 1;
446
+ return this;
447
+ };
448
+ goog.Uri.QueryData.prototype.remove = function(key) {
449
+ this.ensureKeyMapInitialized_();
450
+ key = this.getKeyName_(key);
451
+ if (this.keyMap_.has(key)) {
452
+ this.invalidateCache_();
453
+ this.count_ = goog.asserts.assertNumber(this.count_) - this.keyMap_.get(key).length;
454
+ return this.keyMap_.delete(key);
455
+ }
456
+ return false;
457
+ };
458
+ goog.Uri.QueryData.prototype.clear = function() {
459
+ this.invalidateCache_();
460
+ this.keyMap_ = null;
461
+ this.count_ = 0;
462
+ };
463
+ goog.Uri.QueryData.prototype.isEmpty = function() {
464
+ this.ensureKeyMapInitialized_();
465
+ return this.count_ == 0;
466
+ };
467
+ goog.Uri.QueryData.prototype.containsKey = function(key) {
468
+ this.ensureKeyMapInitialized_();
469
+ key = this.getKeyName_(key);
470
+ return this.keyMap_.has(key);
471
+ };
472
+ goog.Uri.QueryData.prototype.containsValue = function(value) {
473
+ var vals = this.getValues();
474
+ return goog.array.contains(vals, value);
475
+ };
476
+ goog.Uri.QueryData.prototype.forEach = function(f, opt_scope) {
477
+ this.ensureKeyMapInitialized_();
478
+ this.keyMap_.forEach(function(values, key) {
479
+ values.forEach(function(value) {
480
+ f.call(opt_scope, value, key, this);
481
+ }, this);
482
+ }, this);
483
+ };
484
+ goog.Uri.QueryData.prototype.getKeys = function() {
485
+ this.ensureKeyMapInitialized_();
486
+ const vals = Array.from(this.keyMap_.values());
487
+ const keys = Array.from(this.keyMap_.keys());
488
+ const rv = [];
489
+ for (let i = 0; i < keys.length; i++) {
490
+ const val = vals[i];
491
+ for (let j = 0; j < val.length; j++) {
492
+ rv.push(keys[i]);
493
+ }
494
+ }
495
+ return rv;
496
+ };
497
+ goog.Uri.QueryData.prototype.getValues = function(opt_key) {
498
+ this.ensureKeyMapInitialized_();
499
+ let rv = [];
500
+ if (typeof opt_key === "string") {
501
+ if (this.containsKey(opt_key)) {
502
+ rv = rv.concat(this.keyMap_.get(this.getKeyName_(opt_key)));
503
+ }
504
+ } else {
505
+ const values = Array.from(this.keyMap_.values());
506
+ for (let i = 0; i < values.length; i++) {
507
+ rv = rv.concat(values[i]);
508
+ }
509
+ }
510
+ return rv;
511
+ };
512
+ goog.Uri.QueryData.prototype.set = function(key, value) {
513
+ this.ensureKeyMapInitialized_();
514
+ this.invalidateCache_();
515
+ key = this.getKeyName_(key);
516
+ if (this.containsKey(key)) {
517
+ this.count_ = goog.asserts.assertNumber(this.count_) - this.keyMap_.get(key).length;
518
+ }
519
+ this.keyMap_.set(key, [value]);
520
+ this.count_ = goog.asserts.assertNumber(this.count_) + 1;
521
+ return this;
522
+ };
523
+ goog.Uri.QueryData.prototype.get = function(key, opt_default) {
524
+ if (!key) {
525
+ return opt_default;
526
+ }
527
+ var values = this.getValues(key);
528
+ return values.length > 0 ? String(values[0]) : opt_default;
529
+ };
530
+ goog.Uri.QueryData.prototype.setValues = function(key, values) {
531
+ this.remove(key);
532
+ if (values.length > 0) {
533
+ this.invalidateCache_();
534
+ this.keyMap_.set(this.getKeyName_(key), goog.array.clone(values));
535
+ this.count_ = goog.asserts.assertNumber(this.count_) + values.length;
536
+ }
537
+ };
538
+ goog.Uri.QueryData.prototype.toString = function() {
539
+ if (this.encodedQuery_) {
540
+ return this.encodedQuery_;
541
+ }
542
+ if (!this.keyMap_) {
543
+ return "";
544
+ }
545
+ const sb = [];
546
+ const keys = Array.from(this.keyMap_.keys());
547
+ for (var i = 0; i < keys.length; i++) {
548
+ const key = keys[i];
549
+ const encodedKey = goog.string.urlEncode(key);
550
+ const val = this.getValues(key);
551
+ for (var j = 0; j < val.length; j++) {
552
+ var param = encodedKey;
553
+ if (val[j] !== "") {
554
+ param += "\x3d" + goog.string.urlEncode(val[j]);
555
+ }
556
+ sb.push(param);
557
+ }
558
+ }
559
+ return this.encodedQuery_ = sb.join("\x26");
560
+ };
561
+ goog.Uri.QueryData.prototype.toDecodedString = function() {
562
+ return goog.Uri.decodeOrEmpty_(this.toString());
563
+ };
564
+ goog.Uri.QueryData.prototype.invalidateCache_ = function() {
565
+ this.encodedQuery_ = null;
566
+ };
567
+ goog.Uri.QueryData.prototype.filterKeys = function(keys) {
568
+ this.ensureKeyMapInitialized_();
569
+ this.keyMap_.forEach(function(value, key) {
570
+ if (!goog.array.contains(keys, key)) {
571
+ this.remove(key);
572
+ }
573
+ }, this);
574
+ return this;
575
+ };
576
+ goog.Uri.QueryData.prototype.clone = function() {
577
+ var rv = new goog.Uri.QueryData();
578
+ rv.encodedQuery_ = this.encodedQuery_;
579
+ if (this.keyMap_) {
580
+ rv.keyMap_ = new Map(this.keyMap_);
581
+ rv.count_ = this.count_;
582
+ }
583
+ return rv;
584
+ };
585
+ goog.Uri.QueryData.prototype.getKeyName_ = function(arg) {
586
+ var keyName = String(arg);
587
+ if (this.ignoreCase_) {
588
+ keyName = keyName.toLowerCase();
589
+ }
590
+ return keyName;
591
+ };
592
+ goog.Uri.QueryData.prototype.setIgnoreCase = function(ignoreCase) {
593
+ var resetKeys = ignoreCase && !this.ignoreCase_;
594
+ if (resetKeys) {
595
+ this.ensureKeyMapInitialized_();
596
+ this.invalidateCache_();
597
+ this.keyMap_.forEach(function(value, key) {
598
+ var lowerCase = key.toLowerCase();
599
+ if (key != lowerCase) {
600
+ this.remove(key);
601
+ this.setValues(lowerCase, value);
602
+ }
603
+ }, this);
604
+ }
605
+ this.ignoreCase_ = ignoreCase;
606
+ };
607
+ goog.Uri.QueryData.prototype.extend = function(var_args) {
608
+ for (var i = 0; i < arguments.length; i++) {
609
+ var data = arguments[i];
610
+ goog.structs.forEach(data, function(value, key) {
611
+ this.add(key, value);
612
+ }, this);
613
+ }
614
+ };
615
+
616
+ //# sourceMappingURL=goog.uri.uri.js.map