@leemeyer/nth-letter 1.0.19 → 1.0.20
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.
- package/dist/nth-letter.es.js +143 -9
- package/dist/nth-letter.umd.js +3 -1
- package/package.json +1 -1
package/dist/nth-letter.es.js
CHANGED
|
@@ -160,22 +160,156 @@ function r(e, t) {
|
|
|
160
160
|
return (e.matches || e.matchesSelector || e.webkitMatchesSelector || e.mozMatchesSelector || e.msMatchesSelector || e.oMatchesSelector).call(e, t);
|
|
161
161
|
}
|
|
162
162
|
//#endregion
|
|
163
|
+
//#region node_modules/gsap/SplitText.js
|
|
164
|
+
var i, a, o = typeof Symbol == "function" ? Symbol() : "_split", s, c = () => s || D.register(window.gsap), l = typeof Intl < "u" && "Segmenter" in Intl ? new Intl.Segmenter() : 0, u = (e) => typeof e == "string" ? u(document.querySelectorAll(e)) : "length" in e ? Array.from(e).reduce((e, t) => (typeof t == "string" ? e.push(...u(t)) : e.push(t), e), []) : [e], d = (e) => u(e).filter((e) => e instanceof HTMLElement), f = [], p = function() {}, m = { add: (e) => e() }, h = /\s+/g, g = /* @__PURE__ */ RegExp("\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?(\\u{200D}\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?)*|.", "gu"), _ = {
|
|
165
|
+
left: 0,
|
|
166
|
+
top: 0,
|
|
167
|
+
width: 0,
|
|
168
|
+
height: 0
|
|
169
|
+
}, v = (e, t) => {
|
|
170
|
+
for (; ++t < e.length && e[t] === _;);
|
|
171
|
+
return e[t] || _;
|
|
172
|
+
}, y = ({ element: e, html: t, ariaL: n, ariaH: r }) => {
|
|
173
|
+
e.innerHTML = t, n ? e.setAttribute("aria-label", n) : e.removeAttribute("aria-label"), r ? e.setAttribute("aria-hidden", r) : e.removeAttribute("aria-hidden");
|
|
174
|
+
}, b = (e, t) => {
|
|
175
|
+
if (t) {
|
|
176
|
+
let n = new Set(e.join("").match(t) || f), r = e.length, i, a, o, s;
|
|
177
|
+
if (n.size) for (; --r > -1;) {
|
|
178
|
+
a = e[r];
|
|
179
|
+
for (o of n) if (o.startsWith(a) && o.length > a.length) {
|
|
180
|
+
for (i = 0, s = a; o.startsWith(s += e[r + ++i]) && s.length < o.length;);
|
|
181
|
+
if (i && s.length === o.length) {
|
|
182
|
+
e[r] = o, e.splice(r + 1, i);
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
return e;
|
|
189
|
+
}, x = (e) => window.getComputedStyle(e).display === "inline" && (e.style.display = "inline-block"), S = (e, t, n) => t.insertBefore(typeof e == "string" ? document.createTextNode(e) : e, n), C = (e, t, n) => {
|
|
190
|
+
let r = t[e + "sClass"] || "", { tag: i = "div", aria: a = "auto", propIndex: o = !1 } = t, s = e === "line" ? "block" : "inline-block", c = r.indexOf("++") > -1, l = (t) => {
|
|
191
|
+
let l = document.createElement(i), u = n.length + 1;
|
|
192
|
+
return r && (l.className = r + (c ? " " + r + u : "")), o && l.style.setProperty("--" + e, u + ""), a !== "none" && l.setAttribute("aria-hidden", "true"), i !== "span" && (l.style.position = "relative", l.style.display = s), l.textContent = t, n.push(l), l;
|
|
193
|
+
};
|
|
194
|
+
return c && (r = r.replace("++", "")), l.collection = n, l;
|
|
195
|
+
}, w = (e, t, n, r) => {
|
|
196
|
+
let i = C("line", n, r), a = window.getComputedStyle(e).textAlign || "left";
|
|
197
|
+
return (n, r) => {
|
|
198
|
+
let o = i("");
|
|
199
|
+
for (o.style.textAlign = a, e.insertBefore(o, t[n]); n < r; n++) o.appendChild(t[n]);
|
|
200
|
+
o.normalize();
|
|
201
|
+
};
|
|
202
|
+
}, T = (e, t, n, r, i, a, o, s, c, u) => {
|
|
203
|
+
var d;
|
|
204
|
+
let p = Array.from(e.childNodes), m = 0, { wordDelimiter: g, reduceWhiteSpace: _ = !0, prepareText: v } = t, y = e.getBoundingClientRect(), C = y, w = !_ && window.getComputedStyle(e).whiteSpace.substring(0, 3) === "pre", E = 0, D = n.collection, O, k, A, j, M, N, P, F, I, L, R, z, B, V, H, U, W, G;
|
|
205
|
+
for (typeof g == "object" ? (A = g.delimiter || g, k = g.replaceWith || "") : k = g === "" ? "" : g || " ", O = k !== " "; m < p.length; m++) if (j = p[m], j.nodeType === 3) {
|
|
206
|
+
for (H = j.textContent || "", _ ? H = H.replace(h, " ") : w && (H = H.replace(/\n/g, k + "\n")), v && (H = v(H, e)), j.textContent = H, M = k || A ? H.split(A || k) : H.match(s) || f, W = M[M.length - 1], F = O ? W.slice(-1) === " " : !W, W || M.pop(), C = y, P = O ? M[0].charAt(0) === " " : !M[0], P && S(" ", e, j), M[0] || M.shift(), b(M, c), a && u || (j.textContent = ""), I = 1; I <= M.length; I++) if (U = M[I - 1], !_ && w && U.charAt(0) === "\n" && ((d = j.previousSibling) == null || d.remove(), S(document.createElement("br"), e, j), U = U.slice(1)), !_ && U === "") S(k, e, j);
|
|
207
|
+
else if (U === " ") e.insertBefore(document.createTextNode(" "), j);
|
|
208
|
+
else {
|
|
209
|
+
if (O && U.charAt(0) === " " && S(" ", e, j), E && I === 1 && !P && D.indexOf(E.parentNode) > -1 ? (N = D[D.length - 1], N.appendChild(document.createTextNode(r ? "" : U))) : (N = n(r ? "" : U), S(N, e, j), E && I === 1 && !P && N.insertBefore(E, N.firstChild)), r) for (R = l ? b([...l.segment(U)].map((e) => e.segment), c) : U.match(s) || f, G = 0; G < R.length; G++) N.appendChild(R[G] === " " ? document.createTextNode(" ") : r(R[G]));
|
|
210
|
+
if (a && u) {
|
|
211
|
+
if (H = j.textContent = H.substring(U.length + 1, H.length), L = N.getBoundingClientRect(), L.top > C.top && L.left <= C.left) {
|
|
212
|
+
for (z = e.cloneNode(), B = e.childNodes[0]; B && B !== N;) V = B, B = B.nextSibling, z.appendChild(V);
|
|
213
|
+
e.parentNode.insertBefore(z, e), i && x(z);
|
|
214
|
+
}
|
|
215
|
+
C = L;
|
|
216
|
+
}
|
|
217
|
+
(I < M.length || F) && S(I >= M.length ? " " : O && U.slice(-1) === " " ? " " + k : k, e, j);
|
|
218
|
+
}
|
|
219
|
+
e.removeChild(j), E = 0;
|
|
220
|
+
} else j.nodeType === 1 && (o && o.indexOf(j) > -1 ? (D.indexOf(j.previousSibling) > -1 && D[D.length - 1].appendChild(j), E = j) : (T(j, t, n, r, i, a, o, s, c, !0), E = 0), i && x(j));
|
|
221
|
+
}, E = class e {
|
|
222
|
+
constructor(e, t) {
|
|
223
|
+
this.isSplit = !1, c(), this.elements = d(e), this.chars = [], this.words = [], this.lines = [], this.masks = [], this.vars = t, this.elements.forEach((e) => {
|
|
224
|
+
var n;
|
|
225
|
+
t.overwrite !== !1 && ((n = e[o]) == null || n._data.orig.filter(({ element: t }) => t === e).forEach(y)), e[o] = this;
|
|
226
|
+
}), this._split = () => this.isSplit && this.split(this.vars);
|
|
227
|
+
let n = [], r, i = () => {
|
|
228
|
+
let e = n.length, t;
|
|
229
|
+
for (; e--;) {
|
|
230
|
+
t = n[e];
|
|
231
|
+
let r = t.element.offsetWidth;
|
|
232
|
+
if (r !== t.width) {
|
|
233
|
+
t.width = r, this._split();
|
|
234
|
+
return;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
};
|
|
238
|
+
this._data = {
|
|
239
|
+
orig: n,
|
|
240
|
+
obs: typeof ResizeObserver < "u" && new ResizeObserver(() => {
|
|
241
|
+
clearTimeout(r), r = setTimeout(i, 200);
|
|
242
|
+
})
|
|
243
|
+
}, p(this), this.split(t);
|
|
244
|
+
}
|
|
245
|
+
split(e) {
|
|
246
|
+
return (this._ctx || m).add(() => {
|
|
247
|
+
this.isSplit && this.revert(), this.vars = e = e || this.vars || {};
|
|
248
|
+
let { type: t = "chars,words,lines", aria: n = "auto", deepSlice: r = !0, smartWrap: i, onSplit: o, autoSplit: s = !1, specialChars: c, mask: l } = this.vars, f = t.indexOf("lines") > -1, p = t.indexOf("chars") > -1, m = t.indexOf("words") > -1, h = p && !m && !f, y = c && ("push" in c ? RegExp("(?:" + c.join("|") + ")", "gu") : c), b = y ? RegExp(y.source + "|" + g.source, "gu") : g, x = !!e.ignore && d(e.ignore), { orig: S, animTime: E, obs: D } = this._data, O;
|
|
249
|
+
(p || m || f) && (this.elements.forEach((t, a) => {
|
|
250
|
+
S[a] = {
|
|
251
|
+
element: t,
|
|
252
|
+
html: t.innerHTML,
|
|
253
|
+
ariaL: t.getAttribute("aria-label"),
|
|
254
|
+
ariaH: t.getAttribute("aria-hidden")
|
|
255
|
+
}, n === "auto" ? t.setAttribute("aria-label", (t.textContent || "").trim()) : n === "hidden" && t.setAttribute("aria-hidden", "true");
|
|
256
|
+
let o = [], s = [], c = [], l = p ? C("char", e, o) : null, d = C("word", e, s), g, E, D, O;
|
|
257
|
+
if (T(t, e, d, l, h, r && (f || h), x, b, y, !1), f) {
|
|
258
|
+
let n = u(t.childNodes), r = w(t, n, e, c), i, a = [], o = 0, s = n.map((e) => e.nodeType === 1 ? e.getBoundingClientRect() : _), l = _, d;
|
|
259
|
+
for (g = 0; g < n.length; g++) i = n[g], i.nodeType === 1 && (i.nodeName === "BR" ? ((!g || n[g - 1].nodeName !== "BR") && (a.push(i), r(o, g + 1)), o = g + 1, l = v(s, g)) : (d = s[g], g && d.top > l.top && d.left < l.left + l.width - 1 && (r(o, g), o = g), l = d));
|
|
260
|
+
o < g && r(o, g), a.forEach((e) => e.parentNode?.removeChild(e));
|
|
261
|
+
}
|
|
262
|
+
if (!m) {
|
|
263
|
+
for (g = 0; g < s.length; g++) if (E = s[g], p || !E.nextSibling || E.nextSibling.nodeType !== 3) if (i && !f) {
|
|
264
|
+
for (D = document.createElement("span"), D.style.whiteSpace = "nowrap"; E.firstChild;) D.appendChild(E.firstChild);
|
|
265
|
+
E.replaceWith(D);
|
|
266
|
+
} else E.replaceWith(...E.childNodes);
|
|
267
|
+
else O = E.nextSibling, O && O.nodeType === 3 && (O.textContent = (E.textContent || "") + (O.textContent || ""), E.remove());
|
|
268
|
+
s.length = 0, t.normalize();
|
|
269
|
+
}
|
|
270
|
+
this.lines.push(...c), this.words.push(...s), this.chars.push(...o);
|
|
271
|
+
}), l && this[l] && this.masks.push(...this[l].map((e) => {
|
|
272
|
+
let t = e.cloneNode();
|
|
273
|
+
return e.replaceWith(t), t.appendChild(e), e.className && (t.className = e.className.trim() + "-mask"), t.style.overflow = "clip", t;
|
|
274
|
+
}))), this.isSplit = !0, a && f && (s ? a.addEventListener("loadingdone", this._split) : a.status === "loading" && console.warn("SplitText called before fonts loaded")), (O = o && o(this)) && O.totalTime && (this._data.anim = E ? O.totalTime(E) : O), f && s && this.elements.forEach((e, t) => {
|
|
275
|
+
S[t].width = e.offsetWidth, D && D.observe(e);
|
|
276
|
+
});
|
|
277
|
+
}), this;
|
|
278
|
+
}
|
|
279
|
+
kill() {
|
|
280
|
+
let { obs: e } = this._data;
|
|
281
|
+
e && e.disconnect(), a?.removeEventListener("loadingdone", this._split);
|
|
282
|
+
}
|
|
283
|
+
revert() {
|
|
284
|
+
var e, t;
|
|
285
|
+
if (this.isSplit) {
|
|
286
|
+
let { orig: n, anim: r } = this._data;
|
|
287
|
+
this.kill(), n.forEach(y), this.chars.length = this.words.length = this.lines.length = n.length = this.masks.length = 0, this.isSplit = !1, r && (this._data.animTime = r.totalTime(), r.revert()), (t = (e = this.vars).onRevert) == null || t.call(e, this);
|
|
288
|
+
}
|
|
289
|
+
return this;
|
|
290
|
+
}
|
|
291
|
+
static create(t, n) {
|
|
292
|
+
return new e(t, n);
|
|
293
|
+
}
|
|
294
|
+
static register(e) {
|
|
295
|
+
i = i || e || window.gsap, i && (u = i.utils.toArray, p = i.core.context || p), !s && window.innerWidth > 0 && (a = document.fonts, s = !0);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
E.version = "3.14.2";
|
|
299
|
+
var D = E;
|
|
300
|
+
//#endregion
|
|
163
301
|
//#region index.js
|
|
164
302
|
t({ onComplete(e, t, n) {
|
|
165
303
|
n.forEach((e) => e.remove());
|
|
166
304
|
let r = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
167
305
|
e = e.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
168
|
-
let a = e.replace(/([^,{{\r\n]+?)::?nth-letter[ \t]*\(([^\n)]*)\)/gi, (e, t, n) => (t = t.trim(), r.add(t), i.add(n), `${t}
|
|
306
|
+
let a = e.replace(/([^,{{\r\n]+?)::?nth-letter[ \t]*\(([^\n)]*)\)/gi, (e, t, n) => (t = t.trim(), r.add(t), i.add(n), `${t} .char:nth-child(${n})`));
|
|
169
307
|
document.head.insertAdjacentHTML("beforeend", `<style>${a}</style>`), r.forEach((e) => {
|
|
170
308
|
document.querySelectorAll(e).forEach((e) => {
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
for (let n = 0; n < t.length; n++) {
|
|
176
|
-
let r = document.createElement("span");
|
|
177
|
-
r.className = "char", r.textContent = t[n], e.appendChild(r);
|
|
178
|
-
}
|
|
309
|
+
e.hasAttribute("data-nth-letter") || (e.setAttribute("data-nth-letter", "attached"), new D(e, {
|
|
310
|
+
type: "chars",
|
|
311
|
+
charsClass: "char"
|
|
312
|
+
}));
|
|
179
313
|
});
|
|
180
314
|
});
|
|
181
315
|
} });
|
package/dist/nth-letter.umd.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
(function(e){typeof define==`function`&&define.amd?define([],e):e()})(function(){function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={mimeType:t.mimeType||null,onBeforeSend:t.onBeforeSend||Function.prototype,onSuccess:t.onSuccess||Function.prototype,onError:t.onError||Function.prototype,onComplete:t.onComplete||Function.prototype},r=Array.isArray(e)?e:[e],i=Array.apply(null,Array(r.length)).map((function(e){return null}));function a(e){var t=typeof e==`string`,n=t&&e.trim().charAt(0)===`<`;return t&&!n}function o(e,t){n.onError(e,r[t],t)}function s(e,t){var a=n.onSuccess(e,r[t],t);e=a===!1?``:a||e,i[t]=e,i.indexOf(null)===-1&&n.onComplete(i)}var c=document.createElement(`a`);r.forEach((function(e,t){if(c.setAttribute(`href`,e),c.href=String(c.href),document.all&&!window.atob&&c.host.split(`:`)[0]!==location.host.split(`:`)[0])if(c.protocol===location.protocol){var r=new XDomainRequest;r.open(`GET`,e),r.timeout=0,r.onprogress=Function.prototype,r.ontimeout=Function.prototype,r.onload=function(){var e=r.responseText;a(e)?s(e,t):o(r,t)},r.onerror=function(e){o(r,t)},setTimeout((function(){r.send()}),0)}else console.warn(`Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol (${e})`),o(null,t);else{var i=new XMLHttpRequest;i.open(`GET`,e),n.mimeType&&i.overrideMimeType&&i.overrideMimeType(n.mimeType),n.onBeforeSend(i,e,t),i.onreadystatechange=function(){if(i.readyState===4){var e=i.responseText;i.status<400&&a(e)||i.status===0&&a(e)?s(e,t):o(i,t)}},i.send()}}))}function t(t){var i={cssComments:/\/\*[\s\S]+?\*\//g,cssImports:/(?:@import\s*)(?:url\(\s*)?(?:['"])([^'"]*)(?:['"])(?:\s*\))?(?:[^;]*;)/g},a={rootElement:t.rootElement||document,include:t.include||`style,link[rel="stylesheet"]`,exclude:t.exclude||null,filter:t.filter||null,skipDisabled:t.skipDisabled!==!1,useCSSOM:t.useCSSOM||!1,onBeforeSend:t.onBeforeSend||Function.prototype,onSuccess:t.onSuccess||Function.prototype,onError:t.onError||Function.prototype,onComplete:t.onComplete||Function.prototype},o=Array.apply(null,a.rootElement.querySelectorAll(a.include)).filter((function(e){return!r(e,a.exclude)})),s=Array.apply(null,Array(o.length)).map((function(e){return null}));function c(){if(s.indexOf(null)===-1){s.reduce((function(e,t,n){return t===``&&e.push(n),e}),[]).reverse().forEach((function(e){return[o,s].forEach((function(t){return t.splice(e,1)}))}));var e=s.join(``);a.onComplete(e,s,o)}}function l(e,t,n,r){var i=a.onSuccess(e,n,r);e=i!==void 0&&!i?``:i||e,d(e,n,r,(function(e,r){s[t]===null&&(r.forEach((function(e){return a.onError(e.xhr,n,e.url)})),!a.filter||a.filter.test(e)?s[t]=e:s[t]=``,c())}))}function u(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],a={};return a.rules=(e.replace(i.cssComments,``).match(i.cssImports)||[]).filter((function(e){return r.indexOf(e)===-1})),a.urls=a.rules.map((function(e){return e.replace(i.cssImports,`$1`)})),a.absoluteUrls=a.urls.map((function(e){return n(e,t)})),a.absoluteRules=a.rules.map((function(e,r){var i=a.urls[r],o=n(a.absoluteUrls[r],t);return e.replace(i,o)})),a}function d(t,n,r,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],c=u(t,r,s);c.rules.length?e(c.absoluteUrls,{onBeforeSend:function(e,t,r){a.onBeforeSend(e,n,t)},onSuccess:function(e,t,r){var i=a.onSuccess(e,n,t);e=i===!1?``:i||e;var o=u(e,t,s);return o.rules.forEach((function(t,n){e=e.replace(t,o.absoluteRules[n])})),e},onError:function(e,a,l){o.push({xhr:e,url:a}),s.push(c.rules[l]),d(t,n,r,i,o,s)},onComplete:function(e){e.forEach((function(e,n){t=t.replace(c.rules[n],e)})),d(t,n,r,i,o,s)}}):i(t,o)}o.length?o.forEach((function(t,r){var i=t.getAttribute(`href`),o=t.getAttribute(`rel`),u=t.nodeName.toLowerCase()===`link`&&i&&o&&o.toLowerCase().indexOf(`stylesheet`)!==-1,d=a.skipDisabled===!1?!1:t.disabled,f=t.nodeName.toLowerCase()===`style`;if(u&&!d)if(i.indexOf(`data:text/css`)!==-1){var p=decodeURIComponent(i.substring(i.indexOf(`,`)+1));a.useCSSOM&&(p=Array.apply(null,t.sheet.cssRules).map((function(e){return e.cssText})).join(``)),l(p,r,t,location.href)}else e(i,{mimeType:`text/css`,onBeforeSend:function(e,n,r){a.onBeforeSend(e,t,n)},onSuccess:function(e,a,o){l(e,r,t,n(i))},onError:function(e,n,i){s[r]=``,a.onError(e,t,n),c()}});else if(f&&!d){var m=t.textContent;a.useCSSOM&&(m=Array.apply(null,t.sheet.cssRules).map((function(e){return e.cssText})).join(``)),l(m,r,t,location.href)}else s[r]=``,c()})):a.onComplete(``,[])}function n(e,t){var n=document.implementation.createHTMLDocument(``),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),r.href=t||document.baseURI||(document.querySelector(`base`)||{}).href||location.href,i.href=e,i.href}function r(e,t){return(e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector).call(e,t)}
|
|
1
|
+
(function(e){typeof define==`function`&&define.amd?define([],e):e()})(function(){function e(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n={mimeType:t.mimeType||null,onBeforeSend:t.onBeforeSend||Function.prototype,onSuccess:t.onSuccess||Function.prototype,onError:t.onError||Function.prototype,onComplete:t.onComplete||Function.prototype},r=Array.isArray(e)?e:[e],i=Array.apply(null,Array(r.length)).map((function(e){return null}));function a(e){var t=typeof e==`string`,n=t&&e.trim().charAt(0)===`<`;return t&&!n}function o(e,t){n.onError(e,r[t],t)}function s(e,t){var a=n.onSuccess(e,r[t],t);e=a===!1?``:a||e,i[t]=e,i.indexOf(null)===-1&&n.onComplete(i)}var c=document.createElement(`a`);r.forEach((function(e,t){if(c.setAttribute(`href`,e),c.href=String(c.href),document.all&&!window.atob&&c.host.split(`:`)[0]!==location.host.split(`:`)[0])if(c.protocol===location.protocol){var r=new XDomainRequest;r.open(`GET`,e),r.timeout=0,r.onprogress=Function.prototype,r.ontimeout=Function.prototype,r.onload=function(){var e=r.responseText;a(e)?s(e,t):o(r,t)},r.onerror=function(e){o(r,t)},setTimeout((function(){r.send()}),0)}else console.warn(`Internet Explorer 9 Cross-Origin (CORS) requests must use the same protocol (${e})`),o(null,t);else{var i=new XMLHttpRequest;i.open(`GET`,e),n.mimeType&&i.overrideMimeType&&i.overrideMimeType(n.mimeType),n.onBeforeSend(i,e,t),i.onreadystatechange=function(){if(i.readyState===4){var e=i.responseText;i.status<400&&a(e)||i.status===0&&a(e)?s(e,t):o(i,t)}},i.send()}}))}function t(t){var i={cssComments:/\/\*[\s\S]+?\*\//g,cssImports:/(?:@import\s*)(?:url\(\s*)?(?:['"])([^'"]*)(?:['"])(?:\s*\))?(?:[^;]*;)/g},a={rootElement:t.rootElement||document,include:t.include||`style,link[rel="stylesheet"]`,exclude:t.exclude||null,filter:t.filter||null,skipDisabled:t.skipDisabled!==!1,useCSSOM:t.useCSSOM||!1,onBeforeSend:t.onBeforeSend||Function.prototype,onSuccess:t.onSuccess||Function.prototype,onError:t.onError||Function.prototype,onComplete:t.onComplete||Function.prototype},o=Array.apply(null,a.rootElement.querySelectorAll(a.include)).filter((function(e){return!r(e,a.exclude)})),s=Array.apply(null,Array(o.length)).map((function(e){return null}));function c(){if(s.indexOf(null)===-1){s.reduce((function(e,t,n){return t===``&&e.push(n),e}),[]).reverse().forEach((function(e){return[o,s].forEach((function(t){return t.splice(e,1)}))}));var e=s.join(``);a.onComplete(e,s,o)}}function l(e,t,n,r){var i=a.onSuccess(e,n,r);e=i!==void 0&&!i?``:i||e,d(e,n,r,(function(e,r){s[t]===null&&(r.forEach((function(e){return a.onError(e.xhr,n,e.url)})),!a.filter||a.filter.test(e)?s[t]=e:s[t]=``,c())}))}function u(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:[],a={};return a.rules=(e.replace(i.cssComments,``).match(i.cssImports)||[]).filter((function(e){return r.indexOf(e)===-1})),a.urls=a.rules.map((function(e){return e.replace(i.cssImports,`$1`)})),a.absoluteUrls=a.urls.map((function(e){return n(e,t)})),a.absoluteRules=a.rules.map((function(e,r){var i=a.urls[r],o=n(a.absoluteUrls[r],t);return e.replace(i,o)})),a}function d(t,n,r,i){var o=arguments.length>4&&arguments[4]!==void 0?arguments[4]:[],s=arguments.length>5&&arguments[5]!==void 0?arguments[5]:[],c=u(t,r,s);c.rules.length?e(c.absoluteUrls,{onBeforeSend:function(e,t,r){a.onBeforeSend(e,n,t)},onSuccess:function(e,t,r){var i=a.onSuccess(e,n,t);e=i===!1?``:i||e;var o=u(e,t,s);return o.rules.forEach((function(t,n){e=e.replace(t,o.absoluteRules[n])})),e},onError:function(e,a,l){o.push({xhr:e,url:a}),s.push(c.rules[l]),d(t,n,r,i,o,s)},onComplete:function(e){e.forEach((function(e,n){t=t.replace(c.rules[n],e)})),d(t,n,r,i,o,s)}}):i(t,o)}o.length?o.forEach((function(t,r){var i=t.getAttribute(`href`),o=t.getAttribute(`rel`),u=t.nodeName.toLowerCase()===`link`&&i&&o&&o.toLowerCase().indexOf(`stylesheet`)!==-1,d=a.skipDisabled===!1?!1:t.disabled,f=t.nodeName.toLowerCase()===`style`;if(u&&!d)if(i.indexOf(`data:text/css`)!==-1){var p=decodeURIComponent(i.substring(i.indexOf(`,`)+1));a.useCSSOM&&(p=Array.apply(null,t.sheet.cssRules).map((function(e){return e.cssText})).join(``)),l(p,r,t,location.href)}else e(i,{mimeType:`text/css`,onBeforeSend:function(e,n,r){a.onBeforeSend(e,t,n)},onSuccess:function(e,a,o){l(e,r,t,n(i))},onError:function(e,n,i){s[r]=``,a.onError(e,t,n),c()}});else if(f&&!d){var m=t.textContent;a.useCSSOM&&(m=Array.apply(null,t.sheet.cssRules).map((function(e){return e.cssText})).join(``)),l(m,r,t,location.href)}else s[r]=``,c()})):a.onComplete(``,[])}function n(e,t){var n=document.implementation.createHTMLDocument(``),r=n.createElement(`base`),i=n.createElement(`a`);return n.head.appendChild(r),n.body.appendChild(i),r.href=t||document.baseURI||(document.querySelector(`base`)||{}).href||location.href,i.href=e,i.href}function r(e,t){return(e.matches||e.matchesSelector||e.webkitMatchesSelector||e.mozMatchesSelector||e.msMatchesSelector||e.oMatchesSelector).call(e,t)}var i,a,o=typeof Symbol==`function`?Symbol():`_split`,s,c=()=>s||D.register(window.gsap),l=typeof Intl<`u`&&`Segmenter`in Intl?new Intl.Segmenter:0,u=e=>typeof e==`string`?u(document.querySelectorAll(e)):`length`in e?Array.from(e).reduce((e,t)=>(typeof t==`string`?e.push(...u(t)):e.push(t),e),[]):[e],d=e=>u(e).filter(e=>e instanceof HTMLElement),f=[],p=function(){},m={add:e=>e()},h=/\s+/g,g=RegExp(`\\p{RI}\\p{RI}|\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?(\\u{200D}\\p{Emoji}(\\p{EMod}|\\u{FE0F}\\u{20E3}?|[\\u{E0020}-\\u{E007E}]+\\u{E007F})?)*|.`,`gu`),_={left:0,top:0,width:0,height:0},v=(e,t)=>{for(;++t<e.length&&e[t]===_;);return e[t]||_},y=({element:e,html:t,ariaL:n,ariaH:r})=>{e.innerHTML=t,n?e.setAttribute(`aria-label`,n):e.removeAttribute(`aria-label`),r?e.setAttribute(`aria-hidden`,r):e.removeAttribute(`aria-hidden`)},b=(e,t)=>{if(t){let n=new Set(e.join(``).match(t)||f),r=e.length,i,a,o,s;if(n.size)for(;--r>-1;){a=e[r];for(o of n)if(o.startsWith(a)&&o.length>a.length){for(i=0,s=a;o.startsWith(s+=e[r+ ++i])&&s.length<o.length;);if(i&&s.length===o.length){e[r]=o,e.splice(r+1,i);break}}}}return e},x=e=>window.getComputedStyle(e).display===`inline`&&(e.style.display=`inline-block`),S=(e,t,n)=>t.insertBefore(typeof e==`string`?document.createTextNode(e):e,n),C=(e,t,n)=>{let r=t[e+`sClass`]||``,{tag:i=`div`,aria:a=`auto`,propIndex:o=!1}=t,s=e===`line`?`block`:`inline-block`,c=r.indexOf(`++`)>-1,l=t=>{let l=document.createElement(i),u=n.length+1;return r&&(l.className=r+(c?` `+r+u:``)),o&&l.style.setProperty(`--`+e,u+``),a!==`none`&&l.setAttribute(`aria-hidden`,`true`),i!==`span`&&(l.style.position=`relative`,l.style.display=s),l.textContent=t,n.push(l),l};return c&&(r=r.replace(`++`,``)),l.collection=n,l},w=(e,t,n,r)=>{let i=C(`line`,n,r),a=window.getComputedStyle(e).textAlign||`left`;return(n,r)=>{let o=i(``);for(o.style.textAlign=a,e.insertBefore(o,t[n]);n<r;n++)o.appendChild(t[n]);o.normalize()}},T=(e,t,n,r,i,a,o,s,c,u)=>{var d;let p=Array.from(e.childNodes),m=0,{wordDelimiter:g,reduceWhiteSpace:_=!0,prepareText:v}=t,y=e.getBoundingClientRect(),C=y,w=!_&&window.getComputedStyle(e).whiteSpace.substring(0,3)===`pre`,E=0,D=n.collection,O,k,A,j,M,N,P,F,I,L,R,z,B,V,H,U,W,G;for(typeof g==`object`?(A=g.delimiter||g,k=g.replaceWith||``):k=g===``?``:g||` `,O=k!==` `;m<p.length;m++)if(j=p[m],j.nodeType===3){for(H=j.textContent||``,_?H=H.replace(h,` `):w&&(H=H.replace(/\n/g,k+`
|
|
2
|
+
`)),v&&(H=v(H,e)),j.textContent=H,M=k||A?H.split(A||k):H.match(s)||f,W=M[M.length-1],F=O?W.slice(-1)===` `:!W,W||M.pop(),C=y,P=O?M[0].charAt(0)===` `:!M[0],P&&S(` `,e,j),M[0]||M.shift(),b(M,c),a&&u||(j.textContent=``),I=1;I<=M.length;I++)if(U=M[I-1],!_&&w&&U.charAt(0)===`
|
|
3
|
+
`&&((d=j.previousSibling)==null||d.remove(),S(document.createElement(`br`),e,j),U=U.slice(1)),!_&&U===``)S(k,e,j);else if(U===` `)e.insertBefore(document.createTextNode(` `),j);else{if(O&&U.charAt(0)===` `&&S(` `,e,j),E&&I===1&&!P&&D.indexOf(E.parentNode)>-1?(N=D[D.length-1],N.appendChild(document.createTextNode(r?``:U))):(N=n(r?``:U),S(N,e,j),E&&I===1&&!P&&N.insertBefore(E,N.firstChild)),r)for(R=l?b([...l.segment(U)].map(e=>e.segment),c):U.match(s)||f,G=0;G<R.length;G++)N.appendChild(R[G]===` `?document.createTextNode(` `):r(R[G]));if(a&&u){if(H=j.textContent=H.substring(U.length+1,H.length),L=N.getBoundingClientRect(),L.top>C.top&&L.left<=C.left){for(z=e.cloneNode(),B=e.childNodes[0];B&&B!==N;)V=B,B=B.nextSibling,z.appendChild(V);e.parentNode.insertBefore(z,e),i&&x(z)}C=L}(I<M.length||F)&&S(I>=M.length?` `:O&&U.slice(-1)===` `?` `+k:k,e,j)}e.removeChild(j),E=0}else j.nodeType===1&&(o&&o.indexOf(j)>-1?(D.indexOf(j.previousSibling)>-1&&D[D.length-1].appendChild(j),E=j):(T(j,t,n,r,i,a,o,s,c,!0),E=0),i&&x(j))},E=class e{constructor(e,t){this.isSplit=!1,c(),this.elements=d(e),this.chars=[],this.words=[],this.lines=[],this.masks=[],this.vars=t,this.elements.forEach(e=>{var n;t.overwrite!==!1&&((n=e[o])==null||n._data.orig.filter(({element:t})=>t===e).forEach(y)),e[o]=this}),this._split=()=>this.isSplit&&this.split(this.vars);let n=[],r,i=()=>{let e=n.length,t;for(;e--;){t=n[e];let r=t.element.offsetWidth;if(r!==t.width){t.width=r,this._split();return}}};this._data={orig:n,obs:typeof ResizeObserver<`u`&&new ResizeObserver(()=>{clearTimeout(r),r=setTimeout(i,200)})},p(this),this.split(t)}split(e){return(this._ctx||m).add(()=>{this.isSplit&&this.revert(),this.vars=e=e||this.vars||{};let{type:t=`chars,words,lines`,aria:n=`auto`,deepSlice:r=!0,smartWrap:i,onSplit:o,autoSplit:s=!1,specialChars:c,mask:l}=this.vars,f=t.indexOf(`lines`)>-1,p=t.indexOf(`chars`)>-1,m=t.indexOf(`words`)>-1,h=p&&!m&&!f,y=c&&(`push`in c?RegExp(`(?:`+c.join(`|`)+`)`,`gu`):c),b=y?RegExp(y.source+`|`+g.source,`gu`):g,x=!!e.ignore&&d(e.ignore),{orig:S,animTime:E,obs:D}=this._data,O;(p||m||f)&&(this.elements.forEach((t,a)=>{S[a]={element:t,html:t.innerHTML,ariaL:t.getAttribute(`aria-label`),ariaH:t.getAttribute(`aria-hidden`)},n===`auto`?t.setAttribute(`aria-label`,(t.textContent||``).trim()):n===`hidden`&&t.setAttribute(`aria-hidden`,`true`);let o=[],s=[],c=[],l=p?C(`char`,e,o):null,d=C(`word`,e,s),g,E,D,O;if(T(t,e,d,l,h,r&&(f||h),x,b,y,!1),f){let n=u(t.childNodes),r=w(t,n,e,c),i,a=[],o=0,s=n.map(e=>e.nodeType===1?e.getBoundingClientRect():_),l=_,d;for(g=0;g<n.length;g++)i=n[g],i.nodeType===1&&(i.nodeName===`BR`?((!g||n[g-1].nodeName!==`BR`)&&(a.push(i),r(o,g+1)),o=g+1,l=v(s,g)):(d=s[g],g&&d.top>l.top&&d.left<l.left+l.width-1&&(r(o,g),o=g),l=d));o<g&&r(o,g),a.forEach(e=>e.parentNode?.removeChild(e))}if(!m){for(g=0;g<s.length;g++)if(E=s[g],p||!E.nextSibling||E.nextSibling.nodeType!==3)if(i&&!f){for(D=document.createElement(`span`),D.style.whiteSpace=`nowrap`;E.firstChild;)D.appendChild(E.firstChild);E.replaceWith(D)}else E.replaceWith(...E.childNodes);else O=E.nextSibling,O&&O.nodeType===3&&(O.textContent=(E.textContent||``)+(O.textContent||``),E.remove());s.length=0,t.normalize()}this.lines.push(...c),this.words.push(...s),this.chars.push(...o)}),l&&this[l]&&this.masks.push(...this[l].map(e=>{let t=e.cloneNode();return e.replaceWith(t),t.appendChild(e),e.className&&(t.className=e.className.trim()+`-mask`),t.style.overflow=`clip`,t}))),this.isSplit=!0,a&&f&&(s?a.addEventListener(`loadingdone`,this._split):a.status===`loading`&&console.warn(`SplitText called before fonts loaded`)),(O=o&&o(this))&&O.totalTime&&(this._data.anim=E?O.totalTime(E):O),f&&s&&this.elements.forEach((e,t)=>{S[t].width=e.offsetWidth,D&&D.observe(e)})}),this}kill(){let{obs:e}=this._data;e&&e.disconnect(),a?.removeEventListener(`loadingdone`,this._split)}revert(){var e,t;if(this.isSplit){let{orig:n,anim:r}=this._data;this.kill(),n.forEach(y),this.chars.length=this.words.length=this.lines.length=n.length=this.masks.length=0,this.isSplit=!1,r&&(this._data.animTime=r.totalTime(),r.revert()),(t=(e=this.vars).onRevert)==null||t.call(e,this)}return this}static create(t,n){return new e(t,n)}static register(e){i=i||e||window.gsap,i&&(u=i.utils.toArray,p=i.core.context||p),!s&&window.innerWidth>0&&(a=document.fonts,s=!0)}};E.version=`3.14.2`;var D=E;t({onComplete(e,t,n){n.forEach(e=>e.remove());let r=new Set,i=new Set;e=e.replace(/\/\*[\s\S]*?\*\//g,``);let a=e.replace(/([^,{{\r\n]+?)::?nth-letter[ \t]*\(([^\n)]*)\)/gi,(e,t,n)=>(t=t.trim(),r.add(t),i.add(n),`${t} .char:nth-child(${n})`));document.head.insertAdjacentHTML(`beforeend`,`<style>${a}</style>`),r.forEach(e=>{document.querySelectorAll(e).forEach(e=>{e.hasAttribute(`data-nth-letter`)||(e.setAttribute(`data-nth-letter`,`attached`),new D(e,{type:`chars`,charsClass:`char`}))})})}})});
|