@nowline/embed 0.4.1 → 0.4.2

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.
@@ -1,4 +1,4 @@
1
- /*! @nowline/embed 0.4.1 sha=b28a065 built=2026-05-27T23:49:38.587Z env=prod */
1
+ /*! @nowline/embed 0.4.2 sha=1625fac built=2026-05-29T01:31:09.978Z env=prod */
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -336,9 +336,9 @@ var init_main = __esm({
336
336
  }
337
337
  Diagnostic2.create = create;
338
338
  function is(value) {
339
- var _a;
339
+ var _a2;
340
340
  let candidate = value;
341
- return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a = candidate.codeDescription) === null || _a === void 0 ? void 0 : _a.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
341
+ return Is.defined(candidate) && Range.is(candidate.range) && Is.string(candidate.message) && (Is.number(candidate.severity) || Is.undefined(candidate.severity)) && (Is.integer(candidate.code) || Is.string(candidate.code) || Is.undefined(candidate.code)) && (Is.undefined(candidate.codeDescription) || Is.string((_a2 = candidate.codeDescription) === null || _a2 === void 0 ? void 0 : _a2.href)) && (Is.string(candidate.source) || Is.undefined(candidate.source)) && (Is.undefined(candidate.relatedInformation) || Is.typedArray(candidate.relatedInformation, DiagnosticRelatedInformation.is));
342
342
  }
343
343
  Diagnostic2.is = is;
344
344
  })(Diagnostic || (Diagnostic = {}));
@@ -2056,7 +2056,7 @@ var require_messages = __commonJS({
2056
2056
  var require_linkedMap = __commonJS({
2057
2057
  "../../node_modules/.pnpm/vscode-jsonrpc@8.2.0/node_modules/vscode-jsonrpc/lib/common/linkedMap.js"(exports2) {
2058
2058
  "use strict";
2059
- var _a;
2059
+ var _a2;
2060
2060
  Object.defineProperty(exports2, "__esModule", { value: true });
2061
2061
  exports2.LRUCache = exports2.LinkedMap = exports2.Touch = void 0;
2062
2062
  var Touch;
@@ -2069,7 +2069,7 @@ var require_linkedMap = __commonJS({
2069
2069
  })(Touch || (exports2.Touch = Touch = {}));
2070
2070
  var LinkedMap = class {
2071
2071
  constructor() {
2072
- this[_a] = "LinkedMap";
2072
+ this[_a2] = "LinkedMap";
2073
2073
  this._map = /* @__PURE__ */ new Map();
2074
2074
  this._head = void 0;
2075
2075
  this._tail = void 0;
@@ -2243,7 +2243,7 @@ var require_linkedMap = __commonJS({
2243
2243
  };
2244
2244
  return iterator;
2245
2245
  }
2246
- [(_a = Symbol.toStringTag, Symbol.iterator)]() {
2246
+ [(_a2 = Symbol.toStringTag, Symbol.iterator)]() {
2247
2247
  return this.entries();
2248
2248
  }
2249
2249
  trimOld(newSize) {
@@ -6373,8 +6373,8 @@ var init_node_read_file = __esm({
6373
6373
  });
6374
6374
 
6375
6375
  // src/auth/env.ts
6376
- var EMBED_VERSION = true ? "0.4.1" : "0.0.0";
6377
- var EMBED_SHA = true ? "b28a065" : "unknown";
6376
+ var EMBED_VERSION = true ? "0.4.2" : "0.0.0";
6377
+ var EMBED_SHA = true ? "1625fac" : "unknown";
6378
6378
 
6379
6379
  // ../browser/dist/diagnostic-row.js
6380
6380
  var DID_YOU_MEAN_RE = /did you mean ['"]?([^'"?]+)['"]?\??/i;
@@ -14153,8 +14153,8 @@ function resolveGrammar2(options) {
14153
14153
  return resolveGrammar(topRulesTable, actualOptions.errMsgProvider);
14154
14154
  }
14155
14155
  function validateGrammar2(options) {
14156
- var _a;
14157
- const errMsgProvider = (_a = options.errMsgProvider) !== null && _a !== void 0 ? _a : defaultGrammarValidatorErrorProvider;
14156
+ var _a2;
14157
+ const errMsgProvider = (_a2 = options.errMsgProvider) !== null && _a2 !== void 0 ? _a2 : defaultGrammarValidatorErrorProvider;
14158
14158
  return validateGrammar(options.rules, options.tokenTypes, errMsgProvider, options.grammarName);
14159
14159
  }
14160
14160
 
@@ -14494,8 +14494,8 @@ var BITS_START_FOR_ALT_IDX = 32 - BITS_FOR_ALT_IDX;
14494
14494
  // ../../node_modules/.pnpm/chevrotain@12.0.0/node_modules/chevrotain/lib/src/parse/grammar/llk_lookahead.js
14495
14495
  var LLkLookaheadStrategy = class {
14496
14496
  constructor(options) {
14497
- var _a;
14498
- this.maxLookahead = (_a = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a !== void 0 ? _a : DEFAULT_PARSER_CONFIG.maxLookahead;
14497
+ var _a2;
14498
+ this.maxLookahead = (_a2 = options === null || options === void 0 ? void 0 : options.maxLookahead) !== null && _a2 !== void 0 ? _a2 : DEFAULT_PARSER_CONFIG.maxLookahead;
14499
14499
  }
14500
14500
  validate(options) {
14501
14501
  const leftRecursionErrors = this.validateNoLeftRecursion(options.rules);
@@ -15304,8 +15304,8 @@ var RecognizerApi = class {
15304
15304
  return ruleImplementation;
15305
15305
  }
15306
15306
  BACKTRACK(grammarRule, args) {
15307
- var _a;
15308
- const ruleToCall = (_a = grammarRule.coreRule) !== null && _a !== void 0 ? _a : grammarRule;
15307
+ var _a2;
15308
+ const ruleToCall = (_a2 = grammarRule.coreRule) !== null && _a2 !== void 0 ? _a2 : grammarRule;
15309
15309
  return function() {
15310
15310
  this.isBackTrackingStack.push(1);
15311
15311
  const orgState = this.saveRecogState();
@@ -15384,8 +15384,8 @@ var RecognizerEngine = class {
15384
15384
  const noTokenCategoriesUsed = allTokenTypes.every(
15385
15385
  // intentional "==" to also cover "undefined"
15386
15386
  (tokenConstructor) => {
15387
- var _a;
15388
- return ((_a = tokenConstructor.categoryMatches) === null || _a === void 0 ? void 0 : _a.length) == 0;
15387
+ var _a2;
15388
+ return ((_a2 = tokenConstructor.categoryMatches) === null || _a2 === void 0 ? void 0 : _a2.length) == 0;
15389
15389
  }
15390
15390
  );
15391
15391
  this.tokenMatcher = noTokenCategoriesUsed ? tokenStructuredMatcherNoCategories : tokenStructuredMatcher;
@@ -16299,8 +16299,8 @@ var Parser = class _Parser {
16299
16299
  });
16300
16300
  }
16301
16301
  this.TRACE_INIT("ComputeLookaheadFunctions", () => {
16302
- var _a, _b;
16303
- (_b = (_a = this.lookaheadStrategy).initialize) === null || _b === void 0 ? void 0 : _b.call(_a, {
16302
+ var _a2, _b2;
16303
+ (_b2 = (_a2 = this.lookaheadStrategy).initialize) === null || _b2 === void 0 ? void 0 : _b2.call(_a2, {
16304
16304
  rules: Object.values(this.gastProductionsCache)
16305
16305
  });
16306
16306
  this.preComputeLookaheadFunctions(Object.values(this.gastProductionsCache));
@@ -18472,10 +18472,10 @@ var PredicateSet = class {
18472
18472
  var EMPTY_PREDICATES = new PredicateSet();
18473
18473
  var LLStarLookaheadStrategy = class extends LLkLookaheadStrategy {
18474
18474
  constructor(options) {
18475
- var _a, _b;
18475
+ var _a2, _b2;
18476
18476
  super();
18477
- this.logging = (_a = options === null || options === void 0 ? void 0 : options.logging) !== null && _a !== void 0 ? _a : ((message) => console.log(message));
18478
- this.incomplete = (_b = options === null || options === void 0 ? void 0 : options.incomplete) !== null && _b !== void 0 ? _b : false;
18477
+ this.logging = (_a2 = options === null || options === void 0 ? void 0 : options.logging) !== null && _a2 !== void 0 ? _a2 : ((message) => console.log(message));
18478
+ this.incomplete = (_b2 = options === null || options === void 0 ? void 0 : options.incomplete) !== null && _b2 !== void 0 ? _b2 : false;
18479
18479
  }
18480
18480
  initialize(options) {
18481
18481
  this.atn = createATN(options.rules);
@@ -18515,11 +18515,11 @@ var LLStarLookaheadStrategy = class extends LLkLookaheadStrategy {
18515
18515
  }, {});
18516
18516
  if (hasPredicates) {
18517
18517
  return function(orAlts) {
18518
- var _a;
18518
+ var _a2;
18519
18519
  const nextToken = this.LA_FAST(1);
18520
18520
  const prediction = choiceToAlt[nextToken.tokenTypeIdx];
18521
18521
  if (orAlts !== void 0 && prediction !== void 0) {
18522
- const gate = (_a = orAlts[prediction]) === null || _a === void 0 ? void 0 : _a.GATE;
18522
+ const gate = (_a2 = orAlts[prediction]) === null || _a2 === void 0 ? void 0 : _a2.GATE;
18523
18523
  if (gate !== void 0 && gate.call(this) === false) {
18524
18524
  return void 0;
18525
18525
  }
@@ -35174,9 +35174,9 @@ function classifyLoad(load, capacity, warnFraction, overFraction) {
35174
35174
  return "green";
35175
35175
  }
35176
35176
  function resolveLaneUtilizationThresholds(lane, defaults) {
35177
- const dflt = defaults.get("swimlane");
35178
- const warn = resolveThreshold(propValue(lane.properties, "utilization-warn-at"), dflt ? propValue(dflt.properties, "utilization-warn-at") : void 0, DEFAULT_UTILIZATION_WARN_FRACTION);
35179
- const over = resolveThreshold(propValue(lane.properties, "utilization-over-at"), dflt ? propValue(dflt.properties, "utilization-over-at") : void 0, DEFAULT_UTILIZATION_OVER_FRACTION);
35177
+ const dflt2 = defaults.get("swimlane");
35178
+ const warn = resolveThreshold(propValue(lane.properties, "utilization-warn-at"), dflt2 ? propValue(dflt2.properties, "utilization-warn-at") : void 0, DEFAULT_UTILIZATION_WARN_FRACTION);
35179
+ const over = resolveThreshold(propValue(lane.properties, "utilization-over-at"), dflt2 ? propValue(dflt2.properties, "utilization-over-at") : void 0, DEFAULT_UTILIZATION_OVER_FRACTION);
35180
35180
  return { warn, over };
35181
35181
  }
35182
35182
  function resolveThreshold(laneVal, defaultVal, builtinFraction) {
@@ -38853,6 +38853,580 @@ function __resetEmbedPipelineForTests() {
38853
38853
  __resetBrowserPipelineForTests();
38854
38854
  }
38855
38855
 
38856
+ // ../../node_modules/.pnpm/fflate@0.8.3/node_modules/fflate/esm/browser.js
38857
+ var u8 = Uint8Array;
38858
+ var u16 = Uint16Array;
38859
+ var i32 = Int32Array;
38860
+ var fleb = new u8([
38861
+ 0,
38862
+ 0,
38863
+ 0,
38864
+ 0,
38865
+ 0,
38866
+ 0,
38867
+ 0,
38868
+ 0,
38869
+ 1,
38870
+ 1,
38871
+ 1,
38872
+ 1,
38873
+ 2,
38874
+ 2,
38875
+ 2,
38876
+ 2,
38877
+ 3,
38878
+ 3,
38879
+ 3,
38880
+ 3,
38881
+ 4,
38882
+ 4,
38883
+ 4,
38884
+ 4,
38885
+ 5,
38886
+ 5,
38887
+ 5,
38888
+ 5,
38889
+ 0,
38890
+ /* unused */
38891
+ 0,
38892
+ 0,
38893
+ /* impossible */
38894
+ 0
38895
+ ]);
38896
+ var fdeb = new u8([
38897
+ 0,
38898
+ 0,
38899
+ 0,
38900
+ 0,
38901
+ 1,
38902
+ 1,
38903
+ 2,
38904
+ 2,
38905
+ 3,
38906
+ 3,
38907
+ 4,
38908
+ 4,
38909
+ 5,
38910
+ 5,
38911
+ 6,
38912
+ 6,
38913
+ 7,
38914
+ 7,
38915
+ 8,
38916
+ 8,
38917
+ 9,
38918
+ 9,
38919
+ 10,
38920
+ 10,
38921
+ 11,
38922
+ 11,
38923
+ 12,
38924
+ 12,
38925
+ 13,
38926
+ 13,
38927
+ /* unused */
38928
+ 0,
38929
+ 0
38930
+ ]);
38931
+ var clim = new u8([16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15]);
38932
+ var freb = function(eb, start) {
38933
+ var b = new u16(31);
38934
+ for (var i = 0; i < 31; ++i) {
38935
+ b[i] = start += 1 << eb[i - 1];
38936
+ }
38937
+ var r = new i32(b[30]);
38938
+ for (var i = 1; i < 30; ++i) {
38939
+ for (var j = b[i]; j < b[i + 1]; ++j) {
38940
+ r[j] = j - b[i] << 5 | i;
38941
+ }
38942
+ }
38943
+ return { b, r };
38944
+ };
38945
+ var _a = freb(fleb, 2);
38946
+ var fl = _a.b;
38947
+ var revfl = _a.r;
38948
+ fl[28] = 258, revfl[258] = 28;
38949
+ var _b = freb(fdeb, 0);
38950
+ var fd = _b.b;
38951
+ var revfd = _b.r;
38952
+ var rev = new u16(32768);
38953
+ for (i = 0; i < 32768; ++i) {
38954
+ x = (i & 43690) >> 1 | (i & 21845) << 1;
38955
+ x = (x & 52428) >> 2 | (x & 13107) << 2;
38956
+ x = (x & 61680) >> 4 | (x & 3855) << 4;
38957
+ rev[i] = ((x & 65280) >> 8 | (x & 255) << 8) >> 1;
38958
+ }
38959
+ var x;
38960
+ var i;
38961
+ var hMap = (function(cd, mb, r) {
38962
+ var s = cd.length;
38963
+ var i = 0;
38964
+ var l = new u16(mb);
38965
+ for (; i < s; ++i) {
38966
+ if (cd[i])
38967
+ ++l[cd[i] - 1];
38968
+ }
38969
+ var le = new u16(mb);
38970
+ for (i = 1; i < mb; ++i) {
38971
+ le[i] = le[i - 1] + l[i - 1] << 1;
38972
+ }
38973
+ var co;
38974
+ if (r) {
38975
+ co = new u16(1 << mb);
38976
+ var rvb = 15 - mb;
38977
+ for (i = 0; i < s; ++i) {
38978
+ if (cd[i]) {
38979
+ var sv = i << 4 | cd[i];
38980
+ var r_1 = mb - cd[i];
38981
+ var v = le[cd[i] - 1]++ << r_1;
38982
+ for (var m = v | (1 << r_1) - 1; v <= m; ++v) {
38983
+ co[rev[v] >> rvb] = sv;
38984
+ }
38985
+ }
38986
+ }
38987
+ } else {
38988
+ co = new u16(s);
38989
+ for (i = 0; i < s; ++i) {
38990
+ if (cd[i]) {
38991
+ co[i] = rev[le[cd[i] - 1]++] >> 15 - cd[i];
38992
+ }
38993
+ }
38994
+ }
38995
+ return co;
38996
+ });
38997
+ var flt = new u8(288);
38998
+ for (i = 0; i < 144; ++i)
38999
+ flt[i] = 8;
39000
+ var i;
39001
+ for (i = 144; i < 256; ++i)
39002
+ flt[i] = 9;
39003
+ var i;
39004
+ for (i = 256; i < 280; ++i)
39005
+ flt[i] = 7;
39006
+ var i;
39007
+ for (i = 280; i < 288; ++i)
39008
+ flt[i] = 8;
39009
+ var i;
39010
+ var fdt = new u8(32);
39011
+ for (i = 0; i < 32; ++i)
39012
+ fdt[i] = 5;
39013
+ var i;
39014
+ var flm = /* @__PURE__ */ hMap(flt, 9, 0);
39015
+ var fdm = /* @__PURE__ */ hMap(fdt, 5, 0);
39016
+ var shft = function(p) {
39017
+ return (p + 7) / 8 | 0;
39018
+ };
39019
+ var slc = function(v, s, e) {
39020
+ if (s == null || s < 0)
39021
+ s = 0;
39022
+ if (e == null || e > v.length)
39023
+ e = v.length;
39024
+ return new u8(v.subarray(s, e));
39025
+ };
39026
+ var wbits = function(d, p, v) {
39027
+ v <<= p & 7;
39028
+ var o = p / 8 | 0;
39029
+ d[o] |= v;
39030
+ d[o + 1] |= v >> 8;
39031
+ };
39032
+ var wbits16 = function(d, p, v) {
39033
+ v <<= p & 7;
39034
+ var o = p / 8 | 0;
39035
+ d[o] |= v;
39036
+ d[o + 1] |= v >> 8;
39037
+ d[o + 2] |= v >> 16;
39038
+ };
39039
+ var hTree = function(d, mb) {
39040
+ var t = [];
39041
+ for (var i = 0; i < d.length; ++i) {
39042
+ if (d[i])
39043
+ t.push({ s: i, f: d[i] });
39044
+ }
39045
+ var s = t.length;
39046
+ var t2 = t.slice();
39047
+ if (!s)
39048
+ return { t: et, l: 0 };
39049
+ if (s == 1) {
39050
+ var v = new u8(t[0].s + 1);
39051
+ v[t[0].s] = 1;
39052
+ return { t: v, l: 1 };
39053
+ }
39054
+ t.sort(function(a, b) {
39055
+ return a.f - b.f;
39056
+ });
39057
+ t.push({ s: -1, f: 25001 });
39058
+ var l = t[0], r = t[1], i0 = 0, i1 = 1, i2 = 2;
39059
+ t[0] = { s: -1, f: l.f + r.f, l, r };
39060
+ while (i1 != s - 1) {
39061
+ l = t[t[i0].f < t[i2].f ? i0++ : i2++];
39062
+ r = t[i0 != i1 && t[i0].f < t[i2].f ? i0++ : i2++];
39063
+ t[i1++] = { s: -1, f: l.f + r.f, l, r };
39064
+ }
39065
+ var maxSym = t2[0].s;
39066
+ for (var i = 1; i < s; ++i) {
39067
+ if (t2[i].s > maxSym)
39068
+ maxSym = t2[i].s;
39069
+ }
39070
+ var tr2 = new u16(maxSym + 1);
39071
+ var mbt = ln(t[i1 - 1], tr2, 0);
39072
+ if (mbt > mb) {
39073
+ var i = 0, dt = 0;
39074
+ var lft = mbt - mb, cst = 1 << lft;
39075
+ t2.sort(function(a, b) {
39076
+ return tr2[b.s] - tr2[a.s] || a.f - b.f;
39077
+ });
39078
+ for (; i < s; ++i) {
39079
+ var i2_1 = t2[i].s;
39080
+ if (tr2[i2_1] > mb) {
39081
+ dt += cst - (1 << mbt - tr2[i2_1]);
39082
+ tr2[i2_1] = mb;
39083
+ } else
39084
+ break;
39085
+ }
39086
+ dt >>= lft;
39087
+ while (dt > 0) {
39088
+ var i2_2 = t2[i].s;
39089
+ if (tr2[i2_2] < mb)
39090
+ dt -= 1 << mb - tr2[i2_2]++ - 1;
39091
+ else
39092
+ ++i;
39093
+ }
39094
+ for (; i >= 0 && dt; --i) {
39095
+ var i2_3 = t2[i].s;
39096
+ if (tr2[i2_3] == mb) {
39097
+ --tr2[i2_3];
39098
+ ++dt;
39099
+ }
39100
+ }
39101
+ mbt = mb;
39102
+ }
39103
+ return { t: new u8(tr2), l: mbt };
39104
+ };
39105
+ var ln = function(n, l, d) {
39106
+ return n.s == -1 ? Math.max(ln(n.l, l, d + 1), ln(n.r, l, d + 1)) : l[n.s] = d;
39107
+ };
39108
+ var lc = function(c) {
39109
+ var s = c.length;
39110
+ while (s && !c[--s])
39111
+ ;
39112
+ var cl = new u16(++s);
39113
+ var cli = 0, cln = c[0], cls = 1;
39114
+ var w = function(v) {
39115
+ cl[cli++] = v;
39116
+ };
39117
+ for (var i = 1; i <= s; ++i) {
39118
+ if (c[i] == cln && i != s)
39119
+ ++cls;
39120
+ else {
39121
+ if (!cln && cls > 2) {
39122
+ for (; cls > 138; cls -= 138)
39123
+ w(32754);
39124
+ if (cls > 2) {
39125
+ w(cls > 10 ? cls - 11 << 5 | 28690 : cls - 3 << 5 | 12305);
39126
+ cls = 0;
39127
+ }
39128
+ } else if (cls > 3) {
39129
+ w(cln), --cls;
39130
+ for (; cls > 6; cls -= 6)
39131
+ w(8304);
39132
+ if (cls > 2)
39133
+ w(cls - 3 << 5 | 8208), cls = 0;
39134
+ }
39135
+ while (cls--)
39136
+ w(cln);
39137
+ cls = 1;
39138
+ cln = c[i];
39139
+ }
39140
+ }
39141
+ return { c: cl.subarray(0, cli), n: s };
39142
+ };
39143
+ var clen = function(cf, cl) {
39144
+ var l = 0;
39145
+ for (var i = 0; i < cl.length; ++i)
39146
+ l += cf[i] * cl[i];
39147
+ return l;
39148
+ };
39149
+ var wfblk = function(out, pos, dat) {
39150
+ var s = dat.length;
39151
+ var o = shft(pos + 2);
39152
+ out[o] = s & 255;
39153
+ out[o + 1] = s >> 8;
39154
+ out[o + 2] = out[o] ^ 255;
39155
+ out[o + 3] = out[o + 1] ^ 255;
39156
+ for (var i = 0; i < s; ++i)
39157
+ out[o + i + 4] = dat[i];
39158
+ return (o + 4 + s) * 8;
39159
+ };
39160
+ var wblk = function(dat, out, final, syms, lf, df, eb, li, bs, bl, p) {
39161
+ wbits(out, p++, final);
39162
+ ++lf[256];
39163
+ var _a2 = hTree(lf, 15), dlt = _a2.t, mlb = _a2.l;
39164
+ var _b2 = hTree(df, 15), ddt = _b2.t, mdb = _b2.l;
39165
+ var _c = lc(dlt), lclt = _c.c, nlc = _c.n;
39166
+ var _d = lc(ddt), lcdt = _d.c, ndc = _d.n;
39167
+ var lcfreq = new u16(19);
39168
+ for (var i = 0; i < lclt.length; ++i)
39169
+ ++lcfreq[lclt[i] & 31];
39170
+ for (var i = 0; i < lcdt.length; ++i)
39171
+ ++lcfreq[lcdt[i] & 31];
39172
+ var _e = hTree(lcfreq, 7), lct = _e.t, mlcb = _e.l;
39173
+ var nlcc = 19;
39174
+ for (; nlcc > 4 && !lct[clim[nlcc - 1]]; --nlcc)
39175
+ ;
39176
+ var flen = bl + 5 << 3;
39177
+ var ftlen = clen(lf, flt) + clen(df, fdt) + eb;
39178
+ var dtlen = clen(lf, dlt) + clen(df, ddt) + eb + 14 + 3 * nlcc + clen(lcfreq, lct) + 2 * lcfreq[16] + 3 * lcfreq[17] + 7 * lcfreq[18];
39179
+ if (bs >= 0 && flen <= ftlen && flen <= dtlen)
39180
+ return wfblk(out, p, dat.subarray(bs, bs + bl));
39181
+ var lm, ll, dm, dl;
39182
+ wbits(out, p, 1 + (dtlen < ftlen)), p += 2;
39183
+ if (dtlen < ftlen) {
39184
+ lm = hMap(dlt, mlb, 0), ll = dlt, dm = hMap(ddt, mdb, 0), dl = ddt;
39185
+ var llm = hMap(lct, mlcb, 0);
39186
+ wbits(out, p, nlc - 257);
39187
+ wbits(out, p + 5, ndc - 1);
39188
+ wbits(out, p + 10, nlcc - 4);
39189
+ p += 14;
39190
+ for (var i = 0; i < nlcc; ++i)
39191
+ wbits(out, p + 3 * i, lct[clim[i]]);
39192
+ p += 3 * nlcc;
39193
+ var lcts = [lclt, lcdt];
39194
+ for (var it = 0; it < 2; ++it) {
39195
+ var clct = lcts[it];
39196
+ for (var i = 0; i < clct.length; ++i) {
39197
+ var len = clct[i] & 31;
39198
+ wbits(out, p, llm[len]), p += lct[len];
39199
+ if (len > 15)
39200
+ wbits(out, p, clct[i] >> 5 & 127), p += clct[i] >> 12;
39201
+ }
39202
+ }
39203
+ } else {
39204
+ lm = flm, ll = flt, dm = fdm, dl = fdt;
39205
+ }
39206
+ for (var i = 0; i < li; ++i) {
39207
+ var sym = syms[i];
39208
+ if (sym > 255) {
39209
+ var len = sym >> 18 & 31;
39210
+ wbits16(out, p, lm[len + 257]), p += ll[len + 257];
39211
+ if (len > 7)
39212
+ wbits(out, p, sym >> 23 & 31), p += fleb[len];
39213
+ var dst = sym & 31;
39214
+ wbits16(out, p, dm[dst]), p += dl[dst];
39215
+ if (dst > 3)
39216
+ wbits16(out, p, sym >> 5 & 8191), p += fdeb[dst];
39217
+ } else {
39218
+ wbits16(out, p, lm[sym]), p += ll[sym];
39219
+ }
39220
+ }
39221
+ wbits16(out, p, lm[256]);
39222
+ return p + ll[256];
39223
+ };
39224
+ var deo = /* @__PURE__ */ new i32([65540, 131080, 131088, 131104, 262176, 1048704, 1048832, 2114560, 2117632]);
39225
+ var et = /* @__PURE__ */ new u8(0);
39226
+ var dflt = function(dat, lvl, plvl, pre, post, st) {
39227
+ var s = st.z || dat.length;
39228
+ var o = new u8(pre + s + 5 * (1 + Math.ceil(s / 7e3)) + post);
39229
+ var w = o.subarray(pre, o.length - post);
39230
+ var lst = st.l;
39231
+ var pos = (st.r || 0) & 7;
39232
+ if (lvl) {
39233
+ if (pos)
39234
+ w[0] = st.r >> 3;
39235
+ var opt = deo[lvl - 1];
39236
+ var n = opt >> 13, c = opt & 8191;
39237
+ var msk_1 = (1 << plvl) - 1;
39238
+ var prev = st.p || new u16(32768), head = st.h || new u16(msk_1 + 1);
39239
+ var bs1_1 = Math.ceil(plvl / 3), bs2_1 = 2 * bs1_1;
39240
+ var hsh = function(i2) {
39241
+ return (dat[i2] ^ dat[i2 + 1] << bs1_1 ^ dat[i2 + 2] << bs2_1) & msk_1;
39242
+ };
39243
+ var syms = new i32(25e3);
39244
+ var lf = new u16(288), df = new u16(32);
39245
+ var lc_1 = 0, eb = 0, i = st.i || 0, li = 0, wi = st.w || 0, bs = 0;
39246
+ for (; i + 2 < s; ++i) {
39247
+ var hv = hsh(i);
39248
+ var imod = i & 32767, pimod = head[hv];
39249
+ prev[imod] = pimod;
39250
+ head[hv] = imod;
39251
+ if (wi <= i) {
39252
+ var rem = s - i;
39253
+ if ((lc_1 > 7e3 || li > 24576) && (rem > 423 || !lst)) {
39254
+ pos = wblk(dat, w, 0, syms, lf, df, eb, li, bs, i - bs, pos);
39255
+ li = lc_1 = eb = 0, bs = i;
39256
+ for (var j = 0; j < 286; ++j)
39257
+ lf[j] = 0;
39258
+ for (var j = 0; j < 30; ++j)
39259
+ df[j] = 0;
39260
+ }
39261
+ var l = 2, d = 0, ch_1 = c, dif = imod - pimod & 32767;
39262
+ if (rem > 2 && hv == hsh(i - dif)) {
39263
+ var maxn = Math.min(n, rem) - 1;
39264
+ var maxd = Math.min(32767, i);
39265
+ var ml = Math.min(258, rem);
39266
+ while (dif <= maxd && --ch_1 && imod != pimod) {
39267
+ if (dat[i + l] == dat[i + l - dif]) {
39268
+ var nl = 0;
39269
+ for (; nl < ml && dat[i + nl] == dat[i + nl - dif]; ++nl)
39270
+ ;
39271
+ if (nl > l) {
39272
+ l = nl, d = dif;
39273
+ if (nl > maxn)
39274
+ break;
39275
+ var mmd = Math.min(dif, nl - 2);
39276
+ var md = 0;
39277
+ for (var j = 0; j < mmd; ++j) {
39278
+ var ti = i - dif + j & 32767;
39279
+ var pti = prev[ti];
39280
+ var cd = ti - pti & 32767;
39281
+ if (cd > md)
39282
+ md = cd, pimod = ti;
39283
+ }
39284
+ }
39285
+ }
39286
+ imod = pimod, pimod = prev[imod];
39287
+ dif += imod - pimod & 32767;
39288
+ }
39289
+ }
39290
+ if (d) {
39291
+ syms[li++] = 268435456 | revfl[l] << 18 | revfd[d];
39292
+ var lin = revfl[l] & 31, din = revfd[d] & 31;
39293
+ eb += fleb[lin] + fdeb[din];
39294
+ ++lf[257 + lin];
39295
+ ++df[din];
39296
+ wi = i + l;
39297
+ ++lc_1;
39298
+ } else {
39299
+ syms[li++] = dat[i];
39300
+ ++lf[dat[i]];
39301
+ }
39302
+ }
39303
+ }
39304
+ for (i = Math.max(i, wi); i < s; ++i) {
39305
+ syms[li++] = dat[i];
39306
+ ++lf[dat[i]];
39307
+ }
39308
+ pos = wblk(dat, w, lst, syms, lf, df, eb, li, bs, i - bs, pos);
39309
+ if (!lst) {
39310
+ st.r = pos & 7 | w[pos / 8 | 0] << 3;
39311
+ pos -= 7;
39312
+ st.h = head, st.p = prev, st.i = i, st.w = wi;
39313
+ }
39314
+ } else {
39315
+ for (var i = st.w || 0; i < s + lst; i += 65535) {
39316
+ var e = i + 65535;
39317
+ if (e >= s) {
39318
+ w[pos / 8 | 0] = lst;
39319
+ e = s;
39320
+ }
39321
+ pos = wfblk(w, pos + 1, dat.subarray(i, e));
39322
+ }
39323
+ st.i = s;
39324
+ }
39325
+ return slc(o, 0, pre + shft(pos) + post);
39326
+ };
39327
+ var adler = function() {
39328
+ var a = 1, b = 0;
39329
+ return {
39330
+ p: function(d) {
39331
+ var n = a, m = b;
39332
+ var l = d.length | 0;
39333
+ for (var i = 0; i != l; ) {
39334
+ var e = Math.min(i + 2655, l);
39335
+ for (; i < e; ++i)
39336
+ m += n += d[i];
39337
+ n = (n & 65535) + 15 * (n >> 16), m = (m & 65535) + 15 * (m >> 16);
39338
+ }
39339
+ a = n, b = m;
39340
+ },
39341
+ d: function() {
39342
+ a %= 65521, b %= 65521;
39343
+ return (a & 255) << 24 | (a & 65280) << 8 | (b & 255) << 8 | b >> 8;
39344
+ }
39345
+ };
39346
+ };
39347
+ var dopt = function(dat, opt, pre, post, st) {
39348
+ if (!st) {
39349
+ st = { l: 1 };
39350
+ if (opt.dictionary) {
39351
+ var dict = opt.dictionary.subarray(-32768);
39352
+ var newDat = new u8(dict.length + dat.length);
39353
+ newDat.set(dict);
39354
+ newDat.set(dat, dict.length);
39355
+ dat = newDat;
39356
+ st.w = dict.length;
39357
+ }
39358
+ }
39359
+ return dflt(dat, opt.level == null ? 6 : opt.level, opt.mem == null ? st.l ? Math.ceil(Math.max(8, Math.min(13, Math.log(dat.length))) * 1.5) : 20 : 12 + opt.mem, pre, post, st);
39360
+ };
39361
+ var wbytes = function(d, b, v) {
39362
+ for (; v; ++b)
39363
+ d[b] = v, v >>>= 8;
39364
+ };
39365
+ var zlh = function(c, o) {
39366
+ var lv = o.level, fl2 = lv == 0 ? 0 : lv < 6 ? 1 : lv == 9 ? 3 : 2;
39367
+ c[0] = 120, c[1] = fl2 << 6 | (o.dictionary && 32);
39368
+ c[1] |= 31 - (c[0] << 8 | c[1]) % 31;
39369
+ if (o.dictionary) {
39370
+ var h = adler();
39371
+ h.p(o.dictionary);
39372
+ wbytes(c, 2, h.d());
39373
+ }
39374
+ };
39375
+ function zlibSync(data, opts) {
39376
+ if (!opts)
39377
+ opts = {};
39378
+ var a = adler();
39379
+ a.p(data);
39380
+ var d = dopt(data, opts, opts.dictionary ? 6 : 2, 4);
39381
+ return zlh(d, opts), wbytes(d, d.length - 4, a.d()), d;
39382
+ }
39383
+ var td = typeof TextDecoder != "undefined" && /* @__PURE__ */ new TextDecoder();
39384
+ var tds = 0;
39385
+ try {
39386
+ td.decode(et, { stream: true });
39387
+ tds = 1;
39388
+ } catch (e) {
39389
+ }
39390
+
39391
+ // src/share.ts
39392
+ var DEFAULT_SHARE_BASE = "https://free.nowline.io/open";
39393
+ function _encodePayload(source) {
39394
+ const bytes = new TextEncoder().encode(source);
39395
+ const compressed = zlibSync(bytes);
39396
+ const chunk = 32768;
39397
+ let bin = "";
39398
+ for (let i = 0; i < compressed.length; i += chunk) {
39399
+ bin += String.fromCharCode(...compressed.subarray(i, i + chunk));
39400
+ }
39401
+ return btoa(bin).replace(/\+/g, "-").replace(/\//g, "_").replace(/=+$/, "");
39402
+ }
39403
+ function buildShareLink({ source, sourceUrl, share }) {
39404
+ if (share === false || share === "none") {
39405
+ return null;
39406
+ }
39407
+ if (typeof share === "object") {
39408
+ if (sourceUrl !== void 0 && _isHttps(sourceUrl)) {
39409
+ return share.remoteUrl.replace("{url}", encodeURIComponent(sourceUrl));
39410
+ }
39411
+ return share.textUrl.replace("{text}", _encodePayload(source));
39412
+ }
39413
+ const base = share === true ? DEFAULT_SHARE_BASE : share;
39414
+ const url = new URL(base);
39415
+ if (sourceUrl !== void 0 && _isHttps(sourceUrl)) {
39416
+ url.hash = `url=${encodeURIComponent(sourceUrl)}`;
39417
+ } else {
39418
+ url.hash = `text=${_encodePayload(source)}`;
39419
+ }
39420
+ return url.toString();
39421
+ }
39422
+ function _isHttps(url) {
39423
+ try {
39424
+ return new URL(url).protocol === "https:";
39425
+ } catch {
39426
+ return false;
39427
+ }
39428
+ }
39429
+
38856
39430
  // src/auto-scan.ts
38857
39431
  var runCounter = 0;
38858
39432
  async function runAutoScan(inputs) {
@@ -38864,6 +39438,7 @@ async function runAutoScan(inputs) {
38864
39438
  let rendered = 0;
38865
39439
  let failed = 0;
38866
39440
  const baseRunId = ++runCounter;
39441
+ const share = inputs.share ?? true;
38867
39442
  const tasks = [];
38868
39443
  let blockIndex = 0;
38869
39444
  for (const code of Array.from(blocks)) {
@@ -38880,11 +39455,31 @@ async function runAutoScan(inputs) {
38880
39455
  today: inputs.today,
38881
39456
  idPrefix
38882
39457
  };
39458
+ const parent = target.parentElement;
39459
+ const nextSibling = target.nextSibling;
39460
+ const perBlockUrl = code.getAttribute("data-nowline-source-url") ?? void 0;
39461
+ const resolvedSourceUrl = perBlockUrl ?? inputs.sourceUrl;
38883
39462
  tasks.push(
38884
39463
  renderSource2(source, opts).then(
38885
39464
  (svg) => {
38886
39465
  replaceWithSvg(target, svg);
38887
39466
  rendered++;
39467
+ if (parent !== null) {
39468
+ const href = buildShareLink({
39469
+ source,
39470
+ sourceUrl: resolvedSourceUrl,
39471
+ share
39472
+ });
39473
+ if (href !== null) {
39474
+ const a = doc.createElement("a");
39475
+ a.className = "nowline-share";
39476
+ a.href = href;
39477
+ a.target = "_blank";
39478
+ a.rel = "noopener noreferrer";
39479
+ a.textContent = "Share on Nowline";
39480
+ parent.insertBefore(a, nextSibling);
39481
+ }
39482
+ }
38888
39483
  },
38889
39484
  (err) => {
38890
39485
  failed++;
@@ -38937,7 +39532,8 @@ var initialConfig = {
38937
39532
  theme: "auto",
38938
39533
  startOnLoad: true,
38939
39534
  selector: DEFAULT_SELECTOR,
38940
- systemTheme: resolveSystemTheme()
39535
+ systemTheme: resolveSystemTheme(),
39536
+ share: true
38941
39537
  };
38942
39538
  var config = { ...initialConfig };
38943
39539
  var autoStartScheduled = false;
@@ -38949,6 +39545,8 @@ function initialize(options = {}) {
38949
39545
  locale: options.locale ?? config.locale,
38950
39546
  width: options.width ?? config.width,
38951
39547
  today: options.today ?? config.today,
39548
+ share: options.share ?? config.share,
39549
+ sourceUrl: options.sourceUrl ?? config.sourceUrl,
38952
39550
  // Re-read `prefers-color-scheme` on every initialize() so callers
38953
39551
  // who explicitly want the latest system theme can ask for it by
38954
39552
  // calling initialize() again. Auto-scan paths still use the value
@@ -38981,6 +39579,8 @@ async function init(overrides) {
38981
39579
  locale: overrides?.locale ?? config.locale,
38982
39580
  width: overrides?.width ?? config.width,
38983
39581
  today: overrides?.today ?? config.today,
39582
+ share: overrides?.share ?? config.share,
39583
+ sourceUrl: overrides?.sourceUrl ?? config.sourceUrl,
38984
39584
  document: overrides?.document
38985
39585
  };
38986
39586
  return runAutoScan(inputs);