UNPKG

@paratco/rhf-mui-form

Version:

MUI + React Hook Form Reusable Form Components

981 lines (980 loc) 75.7 kB
import { jsx as T, jsxs as ne } from "react/jsx-runtime"; import { useFormContext as Q, Controller as Z, useWatch as Fe } from "react-hook-form"; import { Autocomplete as Pe, TextField as we, FormControl as se, FormControlLabel as ve, Checkbox as ie, FormHelperText as ue, RadioGroup as Ue, Radio as ke, Stack as pe, Chip as je, InputLabel as Ce, Select as Le, ListSubheader as Ae, MenuItem as ae, Switch as Me } from "@mui/material"; import { useMemo as oe, memo as Re, forwardRef as Oe } from "react"; import { LocalizationProvider as ce, DatePicker as Ne, DateTimePicker as Ye, renderTimeViewClock as ye, DateField as De, DateTimeField as He } from "@mui/x-date-pickers"; import { AdapterDateFnsJalali as de } from "@mui/x-date-pickers/AdapterDateFnsJalali"; import { IMaskInput as Ve } from "react-imask"; function et({ name: D, label: N, options: m, control: g, renderInputProps: _, multiple: A, ...L }) { const C = Q(), x = oe(() => { const B = {}; for (const P of m) B[P.value] = P; return B; }, [m]); return /* @__PURE__ */ T( Z, { name: D, control: g ?? C.control, render: ({ field: { onChange: B, value: P, ref: R }, fieldState: { error: O } }) => /* @__PURE__ */ T( Pe, { fullWidth: !0, multiple: A, ...L, value: P != null ? A === !0 ? P.map((U) => x[U]) : x[P] : A === !0 ? [] : null, onChange: (U, c) => { B(A === !0 ? c.map((w) => w.value) : c !== null ? c.value : null); }, getOptionLabel: (U) => U.label, options: m, isOptionEqualToValue: (U, c) => U.value === c.value, renderInput: (U) => /* @__PURE__ */ T( we, { ..._, ...U, InputProps: { ...U.InputProps, // eslint-disable-next-line @typescript-eslint/no-deprecated ..._ == null ? void 0 : _.InputProps }, label: N, inputRef: R, error: L.disabled !== !0 && O !== void 0, helperText: L.disabled !== !0 && (O == null ? void 0 : O.message) !== void 0 && O.message.length > 0 ? O.message : (_ == null ? void 0 : _.helperText) !== void 0 ? _.helperText : " " } ) } ) } ); } function tt({ name: D, label: N, control: m, ...g }) { const _ = Q(); return /* @__PURE__ */ T( Z, { name: D, control: m ?? _.control, render: ({ field: { value: A, onChange: L, ...C }, fieldState: { error: x } }) => /* @__PURE__ */ ne(se, { error: g.disabled !== !0 && x !== void 0, children: [ /* @__PURE__ */ T( ve, { control: /* @__PURE__ */ T( ie, { ...g, ...C, checked: A === !0, onChange: (B) => { L(B.target.checked); } } ), label: N } ), /* @__PURE__ */ T(ue, { children: g.disabled !== !0 && (x == null ? void 0 : x.message) !== void 0 && x.message.length > 0 ? x.message : " " }) ] }) } ); } function nt({ name: D, control: N, isReadOnly: m, ...g }) { const _ = Q(); return /* @__PURE__ */ T( Z, { name: D, control: N ?? _.control, render: ({ field: { value: A, ...L }, fieldState: { error: C } }) => { var x, B, P, R; return /* @__PURE__ */ T(ce, { dateAdapter: de, children: /* @__PURE__ */ T( Ne, { ...g, sx: { width: "100%", ...g.sx }, slotProps: { ...g.slotProps, field: { // eslint-disable-next-line @typescript-eslint/no-misused-spread ...(x = g.slotProps) == null ? void 0 : x.field, readOnly: m }, textField: { // eslint-disable-next-line @typescript-eslint/no-misused-spread ...(B = g.slotProps) == null ? void 0 : B.textField, error: g.disabled !== !0 && C !== void 0, // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment helperText: g.disabled !== !0 && (C == null ? void 0 : C.message) !== void 0 && C.message.length > 0 ? C.message : ( // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error ((R = (P = g.slotProps) == null ? void 0 : P.textField) == null ? void 0 : R.helperText) !== void 0 ? ( // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error g.slotProps.textField.helperText ) : " " ) } }, value: A ?? null, ...L } ) }); } } ); } function rt({ name: D, control: N, isReadOnly: m, ...g }) { const _ = Q(); return /* @__PURE__ */ T( Z, { name: D, control: N ?? _.control, render: ({ field: { value: A, ...L }, fieldState: { error: C } }) => { var x, B, P, R; return /* @__PURE__ */ T(ce, { dateAdapter: de, children: /* @__PURE__ */ T( Ye, { ...g, sx: { width: "100%", ...g.sx }, viewRenderers: { hours: ye, minutes: ye, seconds: ye }, slotProps: { ...g.slotProps, field: { // eslint-disable-next-line @typescript-eslint/no-misused-spread ...(x = g.slotProps) == null ? void 0 : x.field, readOnly: m }, textField: { // eslint-disable-next-line @typescript-eslint/no-misused-spread ...(B = g.slotProps) == null ? void 0 : B.textField, error: g.disabled !== !0 && C !== void 0, // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment helperText: g.disabled !== !0 && (C == null ? void 0 : C.message) !== void 0 && C.message.length > 0 ? C.message : ( // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error ((R = (P = g.slotProps) == null ? void 0 : P.textField) == null ? void 0 : R.helperText) !== void 0 ? ( // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error g.slotProps.textField.helperText ) : " " ) } }, value: A ?? null, ...L } ) }); } } ); } function ot({ name: D, options: N, formLabel: m, control: g, ..._ }) { const A = Q(); return /* @__PURE__ */ T( Z, { name: D, control: g ?? A.control, render: ({ field: L, fieldState: { error: C } }) => /* @__PURE__ */ ne(se, { error: C !== void 0, children: [ m ?? null, /* @__PURE__ */ T(Ue, { ..._, ...L, children: N.map((x) => /* @__PURE__ */ T( ve, { value: x.value, control: /* @__PURE__ */ T(ke, {}), label: x.label, disabled: x.disabled }, x.value )) }), /* @__PURE__ */ T(ue, { children: C !== void 0 ? C.message : " " }) ] }) } ); } function Be({ options: D, selected: N }) { return N.map((m) => /* @__PURE__ */ T(je, { label: D[m].label, size: "small" }, m)); } function We({ options: D, selected: N, maxHeight: m, inputDir: g }) { return m === void 0 ? /* @__PURE__ */ T(pe, { direction: "row", flexWrap: "wrap", gap: 1, children: /* @__PURE__ */ T(Be, { options: D, selected: N }) }) : /* @__PURE__ */ T(pe, { dir: "ltr", maxHeight: m, sx: { overflowY: "auto" }, children: /* @__PURE__ */ T(pe, { dir: g, direction: "row", flexWrap: "wrap", gap: 1, children: /* @__PURE__ */ T(Be, { options: D, selected: N }) }) }); } const Te = Re(We); function it({ name: D, options: N, control: m, inputDir: g, maxHeight: _, dropDownMaxHeight: A, categorized: L = !1, uncategorizedText: C = "Uncategorized", ...x }) { const B = Q(), P = x.multiple === !0, R = oe(() => { const U = {}; for (const c of N) c.value in U && console.warn("Duplicate option value for select component:", c.value), U[c.value] = c; return U; }, [N]), O = oe(() => { if (!L) return null; const U = {}, c = []; for (const w of N) { if (w.category === void 0) { c.push(w.value); continue; } w.category.value in U ? U[w.category.value].push(w.value) : U[w.category.value] = [w.value]; } return { categories: U, uncategorized: c }; }, [L, N]); return /* @__PURE__ */ T( Z, { name: D, control: m ?? B.control, render: ({ field: { value: U, ...c }, fieldState: { error: w } }) => { var f, y, v, b, p, F; return /* @__PURE__ */ ne( se, { fullWidth: !0, disabled: x.disabled, error: x.disabled !== !0 && w !== void 0, children: [ /* @__PURE__ */ T(Ce, { children: x.label }), /* @__PURE__ */ T( Le, { ...x, error: x.disabled !== !0 && w !== void 0, value: U === void 0 ? P ? [] : "" : U, ...c, MenuProps: { ...x.MenuProps, slotProps: { ...(f = x.MenuProps) == null ? void 0 : f.slotProps, paper: { // eslint-disable-next-line @typescript-eslint/no-misused-spread ...(v = (y = x.MenuProps) == null ? void 0 : y.slotProps) == null ? void 0 : v.paper, // eslint-disable-next-line @typescript-eslint/no-unsafe-assignment style: { maxHeight: A, // eslint-disable-next-line @typescript-eslint/ban-ts-comment // @ts-expect-error ...(F = (p = (b = x.MenuProps) == null ? void 0 : b.slotProps) == null ? void 0 : p.paper) == null ? void 0 : F.style } } } }, renderValue: ( // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing x.renderValue !== void 0 ? x.renderValue : P ? (i) => /* @__PURE__ */ T( Te, { options: R, selected: i, maxHeight: _, inputDir: g } ) : void 0 ), children: L && O !== null ? Object.entries(O.categories).reduce((i, [u, n]) => { var o; return i.push( /* @__PURE__ */ T(Ae, { children: (o = R[n[0]].category) == null ? void 0 : o.label }, u) ), i.push( ...n.map((t) => /* @__PURE__ */ ne(ae, { value: t, disabled: R[t].disabled, dir: g, children: [ /* @__PURE__ */ T(ie, { checked: U.includes(t) }), R[t].label ] }, t)) ), i; }, []).concat( O.uncategorized.length > 0 ? /* @__PURE__ */ T(Ae, { children: C }, "rhf-uncategorized") : [] ).concat( O.uncategorized.map((i) => /* @__PURE__ */ ne(ae, { value: i, disabled: R[i].disabled, dir: g, children: [ /* @__PURE__ */ T(ie, { checked: U.includes(i) }), R[i].label ] }, i)) ) : Object.entries(R).map(([i, u]) => /* @__PURE__ */ ne(ae, { value: i, disabled: u.disabled, dir: g, children: [ P ? /* @__PURE__ */ T(ie, { checked: U.includes(i) }) : null, u.label ] }, i)) } ), /* @__PURE__ */ T(ue, { children: x.disabled !== !0 && (w == null ? void 0 : w.message) !== void 0 && w.message.length > 0 ? w.message : " " }) ] } ); } } ); } function fe(D) { throw new Error('Could not dynamically require "' + D + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var me = { exports: {} }, Se; function qe() { return Se || (Se = 1, function(D, N) { (function(m) { D.exports = m(); })(function() { return function m(g, _, A) { function L(B, P) { if (!_[B]) { if (!g[B]) { var R = typeof fe == "function" && fe; if (!P && R) return R(B, !0); if (C) return C(B, !0); throw new Error("Cannot find module '" + B + "'"); } P = _[B] = { exports: {} }, g[B][0].call(P.exports, function(O) { var U = g[B][1][O]; return L(U || O); }, P, P.exports, m, g, _, A); } return _[B].exports; } for (var C = typeof fe == "function" && fe, x = 0; x < A.length; x++) L(A[x]); return L; }({ 1: [function(m, g, _) { (function(A, L, C, x, B, P, R, O, U) { var c = m("crypto"); function w(i, u) { u = v(i, u); var n; return (n = u.algorithm !== "passthrough" ? c.createHash(u.algorithm) : new F()).write === void 0 && (n.write = n.update, n.end = n.update), p(u, n).dispatch(i), n.update || n.end(""), n.digest ? n.digest(u.encoding === "buffer" ? void 0 : u.encoding) : (i = n.read(), u.encoding !== "buffer" ? i.toString(u.encoding) : i); } (_ = g.exports = w).sha1 = function(i) { return w(i); }, _.keys = function(i) { return w(i, { excludeValues: !0, algorithm: "sha1", encoding: "hex" }); }, _.MD5 = function(i) { return w(i, { algorithm: "md5", encoding: "hex" }); }, _.keysMD5 = function(i) { return w(i, { algorithm: "md5", encoding: "hex", excludeValues: !0 }); }; var f = c.getHashes ? c.getHashes().slice() : ["sha1", "md5"], y = (f.push("passthrough"), ["buffer", "hex", "binary", "base64"]); function v(i, u) { var n = {}; if (n.algorithm = (u = u || {}).algorithm || "sha1", n.encoding = u.encoding || "hex", n.excludeValues = !!u.excludeValues, n.algorithm = n.algorithm.toLowerCase(), n.encoding = n.encoding.toLowerCase(), n.ignoreUnknown = u.ignoreUnknown === !0, n.respectType = u.respectType !== !1, n.respectFunctionNames = u.respectFunctionNames !== !1, n.respectFunctionProperties = u.respectFunctionProperties !== !1, n.unorderedArrays = u.unorderedArrays === !0, n.unorderedSets = u.unorderedSets !== !1, n.unorderedObjects = u.unorderedObjects !== !1, n.replacer = u.replacer || void 0, n.excludeKeys = u.excludeKeys || void 0, i === void 0) throw new Error("Object argument required."); for (var o = 0; o < f.length; ++o) f[o].toLowerCase() === n.algorithm.toLowerCase() && (n.algorithm = f[o]); if (f.indexOf(n.algorithm) === -1) throw new Error('Algorithm "' + n.algorithm + '" not supported. supported values: ' + f.join(", ")); if (y.indexOf(n.encoding) === -1 && n.algorithm !== "passthrough") throw new Error('Encoding "' + n.encoding + '" not supported. supported values: ' + y.join(", ")); return n; } function b(i) { if (typeof i == "function") return /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i.exec(Function.prototype.toString.call(i)) != null; } function p(i, u, n) { n = n || []; function o(t) { return u.update ? u.update(t, "utf8") : u.write(t, "utf8"); } return { dispatch: function(t) { return this["_" + ((t = i.replacer ? i.replacer(t) : t) === null ? "null" : typeof t)](t); }, _object: function(t) { var s, l = Object.prototype.toString.call(t), j = /\[object (.*)\]/i.exec(l); if (j = (j = j ? j[1] : "unknown:[" + l + "]").toLowerCase(), 0 <= (l = n.indexOf(t))) return this.dispatch("[CIRCULAR:" + l + "]"); if (n.push(t), C !== void 0 && C.isBuffer && C.isBuffer(t)) return o("buffer:"), o(t); if (j === "object" || j === "function" || j === "asyncfunction") return l = Object.keys(t), i.unorderedObjects && (l = l.sort()), i.respectType === !1 || b(t) || l.splice(0, 0, "prototype", "__proto__", "constructor"), i.excludeKeys && (l = l.filter(function(k) { return !i.excludeKeys(k); })), o("object:" + l.length + ":"), s = this, l.forEach(function(k) { s.dispatch(k), o(":"), i.excludeValues || s.dispatch(t[k]), o(","); }); if (!this["_" + j]) { if (i.ignoreUnknown) return o("[" + j + "]"); throw new Error('Unknown object type "' + j + '"'); } this["_" + j](t); }, _array: function(t, k) { k = k !== void 0 ? k : i.unorderedArrays !== !1; var l = this; if (o("array:" + t.length + ":"), !k || t.length <= 1) return t.forEach(function(M) { return l.dispatch(M); }); var j = [], k = t.map(function(M) { var S = new F(), V = n.slice(); return p(i, S, V).dispatch(M), j = j.concat(V.slice(n.length)), S.read().toString(); }); return n = n.concat(j), k.sort(), this._array(k, !1); }, _date: function(t) { return o("date:" + t.toJSON()); }, _symbol: function(t) { return o("symbol:" + t.toString()); }, _error: function(t) { return o("error:" + t.toString()); }, _boolean: function(t) { return o("bool:" + t.toString()); }, _string: function(t) { o("string:" + t.length + ":"), o(t.toString()); }, _function: function(t) { o("fn:"), b(t) ? this.dispatch("[native]") : this.dispatch(t.toString()), i.respectFunctionNames !== !1 && this.dispatch("function-name:" + String(t.name)), i.respectFunctionProperties && this._object(t); }, _number: function(t) { return o("number:" + t.toString()); }, _xml: function(t) { return o("xml:" + t.toString()); }, _null: function() { return o("Null"); }, _undefined: function() { return o("Undefined"); }, _regexp: function(t) { return o("regex:" + t.toString()); }, _uint8array: function(t) { return o("uint8array:"), this.dispatch(Array.prototype.slice.call(t)); }, _uint8clampedarray: function(t) { return o("uint8clampedarray:"), this.dispatch(Array.prototype.slice.call(t)); }, _int8array: function(t) { return o("int8array:"), this.dispatch(Array.prototype.slice.call(t)); }, _uint16array: function(t) { return o("uint16array:"), this.dispatch(Array.prototype.slice.call(t)); }, _int16array: function(t) { return o("int16array:"), this.dispatch(Array.prototype.slice.call(t)); }, _uint32array: function(t) { return o("uint32array:"), this.dispatch(Array.prototype.slice.call(t)); }, _int32array: function(t) { return o("int32array:"), this.dispatch(Array.prototype.slice.call(t)); }, _float32array: function(t) { return o("float32array:"), this.dispatch(Array.prototype.slice.call(t)); }, _float64array: function(t) { return o("float64array:"), this.dispatch(Array.prototype.slice.call(t)); }, _arraybuffer: function(t) { return o("arraybuffer:"), this.dispatch(new Uint8Array(t)); }, _url: function(t) { return o("url:" + t.toString()); }, _map: function(t) { return o("map:"), t = Array.from(t), this._array(t, i.unorderedSets !== !1); }, _set: function(t) { return o("set:"), t = Array.from(t), this._array(t, i.unorderedSets !== !1); }, _file: function(t) { return o("file:"), this.dispatch([t.name, t.size, t.type, t.lastModfied]); }, _blob: function() { if (i.ignoreUnknown) return o("[blob]"); throw Error(`Hashing Blob objects is currently not supported (see https://github.com/puleos/object-hash/issues/26) Use "options.replacer" or "options.ignoreUnknown" `); }, _domwindow: function() { return o("domwindow"); }, _bigint: function(t) { return o("bigint:" + t.toString()); }, _process: function() { return o("process"); }, _timer: function() { return o("timer"); }, _pipe: function() { return o("pipe"); }, _tcp: function() { return o("tcp"); }, _udp: function() { return o("udp"); }, _tty: function() { return o("tty"); }, _statwatcher: function() { return o("statwatcher"); }, _securecontext: function() { return o("securecontext"); }, _connection: function() { return o("connection"); }, _zlib: function() { return o("zlib"); }, _context: function() { return o("context"); }, _nodescript: function() { return o("nodescript"); }, _httpparser: function() { return o("httpparser"); }, _dataview: function() { return o("dataview"); }, _signal: function() { return o("signal"); }, _fsevent: function() { return o("fsevent"); }, _tlswrap: function() { return o("tlswrap"); } }; } function F() { return { buf: "", write: function(i) { this.buf += i; }, end: function(i) { this.buf += i; }, read: function() { return this.buf; } }; } _.writeToStream = function(i, u, n) { return n === void 0 && (n = u, u = {}), p(u = v(i, u), n).dispatch(i); }; }).call(this, m("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, m("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/fake_9a5aa49d.js", "/"); }, { buffer: 3, crypto: 5, lYpoI2: 11 }], 2: [function(m, g, _) { (function(A, L, C, x, B, P, R, O, U) { (function(c) { var w = typeof Uint8Array < "u" ? Uint8Array : Array, f = 43, y = 47, v = 48, b = 97, p = 65, F = 45, i = 95; function u(n) { return n = n.charCodeAt(0), n === f || n === F ? 62 : n === y || n === i ? 63 : n < v ? -1 : n < v + 10 ? n - v + 26 + 26 : n < p + 26 ? n - p : n < b + 26 ? n - b + 26 : void 0; } c.toByteArray = function(n) { var o, t; if (0 < n.length % 4) throw new Error("Invalid string. Length must be a multiple of 4"); var s = n.length, s = n.charAt(s - 2) === "=" ? 2 : n.charAt(s - 1) === "=" ? 1 : 0, l = new w(3 * n.length / 4 - s), j = 0 < s ? n.length - 4 : n.length, k = 0; function M(S) { l[k++] = S; } for (o = 0; o < j; o += 4, 0) M((16711680 & (t = u(n.charAt(o)) << 18 | u(n.charAt(o + 1)) << 12 | u(n.charAt(o + 2)) << 6 | u(n.charAt(o + 3)))) >> 16), M((65280 & t) >> 8), M(255 & t); return s == 2 ? M(255 & (t = u(n.charAt(o)) << 2 | u(n.charAt(o + 1)) >> 4)) : s == 1 && (M((t = u(n.charAt(o)) << 10 | u(n.charAt(o + 1)) << 4 | u(n.charAt(o + 2)) >> 2) >> 8 & 255), M(255 & t)), l; }, c.fromByteArray = function(n) { var o, t, s, l, j = n.length % 3, k = ""; function M(S) { return "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".charAt(S); } for (o = 0, s = n.length - j; o < s; o += 3) t = (n[o] << 16) + (n[o + 1] << 8) + n[o + 2], k += M((l = t) >> 18 & 63) + M(l >> 12 & 63) + M(l >> 6 & 63) + M(63 & l); switch (j) { case 1: k = (k += M((t = n[n.length - 1]) >> 2)) + M(t << 4 & 63) + "=="; break; case 2: k = (k = (k += M((t = (n[n.length - 2] << 8) + n[n.length - 1]) >> 10)) + M(t >> 4 & 63)) + M(t << 2 & 63) + "="; } return k; }; })(_ === void 0 ? this.base64js = {} : _); }).call(this, m("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, m("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/base64-js/lib/b64.js", "/node_modules/gulp-browserify/node_modules/base64-js/lib"); }, { buffer: 3, lYpoI2: 11 }], 3: [function(m, g, _) { (function(A, L, f, x, B, P, R, O, U) { var c = m("base64-js"), w = m("ieee754"); function f(e, r, a) { if (!(this instanceof f)) return new f(e, r, a); var h, d, I, Y, q = typeof e; if (r === "base64" && q == "string") for (e = (Y = e).trim ? Y.trim() : Y.replace(/^\s+|\s+$/g, ""); e.length % 4 != 0; ) e += "="; if (q == "number") h = G(e); else if (q == "string") h = f.byteLength(e, r); else { if (q != "object") throw new Error("First argument needs to be a number, array or string."); h = G(e.length); } if (f._useTypedArrays ? d = f._augment(new Uint8Array(h)) : ((d = this).length = h, d._isBuffer = !0), f._useTypedArrays && typeof e.byteLength == "number") d._set(e); else if (W(Y = e) || f.isBuffer(Y) || Y && typeof Y == "object" && typeof Y.length == "number") for (I = 0; I < h; I++) f.isBuffer(e) ? d[I] = e.readUInt8(I) : d[I] = e[I]; else if (q == "string") d.write(e, 0, r); else if (q == "number" && !f._useTypedArrays && !a) for (I = 0; I < h; I++) d[I] = 0; return d; } function y(e, r, a, h) { return f._charsWritten = le(function(d) { for (var I = [], Y = 0; Y < d.length; Y++) I.push(255 & d.charCodeAt(Y)); return I; }(r), e, a, h); } function v(e, r, a, h) { return f._charsWritten = le(function(d) { for (var I, Y, q = [], J = 0; J < d.length; J++) Y = d.charCodeAt(J), I = Y >> 8, Y = Y % 256, q.push(Y), q.push(I); return q; }(r), e, a, h); } function b(e, r, a) { var h = ""; a = Math.min(e.length, a); for (var d = r; d < a; d++) h += String.fromCharCode(e[d]); return h; } function p(e, r, a, I) { I || (E(typeof a == "boolean", "missing or invalid endian"), E(r != null, "missing offset"), E(r + 1 < e.length, "Trying to read beyond buffer length")); var d, I = e.length; if (!(I <= r)) return a ? (d = e[r], r + 1 < I && (d |= e[r + 1] << 8)) : (d = e[r] << 8, r + 1 < I && (d |= e[r + 1])), d; } function F(e, r, a, I) { I || (E(typeof a == "boolean", "missing or invalid endian"), E(r != null, "missing offset"), E(r + 3 < e.length, "Trying to read beyond buffer length")); var d, I = e.length; if (!(I <= r)) return a ? (r + 2 < I && (d = e[r + 2] << 16), r + 1 < I && (d |= e[r + 1] << 8), d |= e[r], r + 3 < I && (d += e[r + 3] << 24 >>> 0)) : (r + 1 < I && (d = e[r + 1] << 16), r + 2 < I && (d |= e[r + 2] << 8), r + 3 < I && (d |= e[r + 3]), d += e[r] << 24 >>> 0), d; } function i(e, r, a, h) { if (h || (E(typeof a == "boolean", "missing or invalid endian"), E(r != null, "missing offset"), E(r + 1 < e.length, "Trying to read beyond buffer length")), !(e.length <= r)) return h = p(e, r, a, !0), 32768 & h ? -1 * (65535 - h + 1) : h; } function u(e, r, a, h) { if (h || (E(typeof a == "boolean", "missing or invalid endian"), E(r != null, "missing offset"), E(r + 3 < e.length, "Trying to read beyond buffer length")), !(e.length <= r)) return h = F(e, r, a, !0), 2147483648 & h ? -1 * (4294967295 - h + 1) : h; } function n(e, r, a, h) { return h || (E(typeof a == "boolean", "missing or invalid endian"), E(r + 3 < e.length, "Trying to read beyond buffer length")), w.read(e, r, a, 23, 4); } function o(e, r, a, h) { return h || (E(typeof a == "boolean", "missing or invalid endian"), E(r + 7 < e.length, "Trying to read beyond buffer length")), w.read(e, r, a, 52, 8); } function t(e, r, a, h, d) { if (d || (E(r != null, "missing value"), E(typeof h == "boolean", "missing or invalid endian"), E(a != null, "missing offset"), E(a + 1 < e.length, "trying to write beyond buffer length"), he(r, 65535)), d = e.length, !(d <= a)) for (var I = 0, Y = Math.min(d - a, 2); I < Y; I++) e[a + I] = (r & 255 << 8 * (h ? I : 1 - I)) >>> 8 * (h ? I : 1 - I); } function s(e, r, a, h, d) { if (d || (E(r != null, "missing value"), E(typeof h == "boolean", "missing or invalid endian"), E(a != null, "missing offset"), E(a + 3 < e.length, "trying to write beyond buffer length"), he(r, 4294967295)), d = e.length, !(d <= a)) for (var I = 0, Y = Math.min(d - a, 4); I < Y; I++) e[a + I] = r >>> 8 * (h ? I : 3 - I) & 255; } function l(e, r, a, h, d) { d || (E(r != null, "missing value"), E(typeof h == "boolean", "missing or invalid endian"), E(a != null, "missing offset"), E(a + 1 < e.length, "Trying to write beyond buffer length"), ge(r, 32767, -32768)), e.length <= a || t(e, 0 <= r ? r : 65535 + r + 1, a, h, d); } function j(e, r, a, h, d) { d || (E(r != null, "missing value"), E(typeof h == "boolean", "missing or invalid endian"), E(a != null, "missing offset"), E(a + 3 < e.length, "Trying to write beyond buffer length"), ge(r, 2147483647, -2147483648)), e.length <= a || s(e, 0 <= r ? r : 4294967295 + r + 1, a, h, d); } function k(e, r, a, h, d) { d || (E(r != null, "missing value"), E(typeof h == "boolean", "missing or invalid endian"), E(a != null, "missing offset"), E(a + 3 < e.length, "Trying to write beyond buffer length"), Ee(r, 34028234663852886e22, -34028234663852886e22)), e.length <= a || w.write(e, r, a, h, 23, 4); } function M(e, r, a, h, d) { d || (E(r != null, "missing value"), E(typeof h == "boolean", "missing or invalid endian"), E(a != null, "missing offset"), E(a + 7 < e.length, "Trying to write beyond buffer length"), Ee(r, 17976931348623157e292, -17976931348623157e292)), e.length <= a || w.write(e, r, a, h, 52, 8); } _.Buffer = f, _.SlowBuffer = f, _.INSPECT_MAX_BYTES = 50, f.poolSize = 8192, f._useTypedArrays = function() { try { var e = new ArrayBuffer(0), r = new Uint8Array(e); return r.foo = function() { return 42; }, r.foo() === 42 && typeof r.subarray == "function"; } catch { return !1; } }(), f.isEncoding = function(e) { switch (String(e).toLowerCase()) { case "hex": case "utf8": case "utf-8": case "ascii": case "binary": case "base64": case "raw": case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": return !0; default: return !1; } }, f.isBuffer = function(e) { return !(e == null || !e._isBuffer); }, f.byteLength = function(e, r) { var a; switch (e += "", r || "utf8") { case "hex": a = e.length / 2; break; case "utf8": case "utf-8": a = te(e).length; break; case "ascii": case "binary": case "raw": a = e.length; break; case "base64": a = xe(e).length; break; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": a = 2 * e.length; break; default: throw new Error("Unknown encoding"); } return a; }, f.concat = function(e, r) { if (E(W(e), `Usage: Buffer.concat(list, [totalLength]) list should be an Array.`), e.length === 0) return new f(0); if (e.length === 1) return e[0]; if (typeof r != "number") for (d = r = 0; d < e.length; d++) r += e[d].length; for (var a = new f(r), h = 0, d = 0; d < e.length; d++) { var I = e[d]; I.copy(a, h), h += I.length; } return a; }, f.prototype.write = function(e, r, a, h) { isFinite(r) ? isFinite(a) || (h = a, a = void 0) : (J = h, h = r, r = a, a = J), r = Number(r) || 0; var d, I, Y, q, J = this.length - r; switch ((!a || J < (a = Number(a))) && (a = J), h = String(h || "utf8").toLowerCase()) { case "hex": d = function(ee, X, $, K) { $ = Number($) || 0; var z = ee.length - $; (!K || z < (K = Number(K))) && (K = z), E((z = X.length) % 2 == 0, "Invalid hex string"), z / 2 < K && (K = z / 2); for (var re = 0; re < K; re++) { var Ie = parseInt(X.substr(2 * re, 2), 16); E(!isNaN(Ie), "Invalid hex string"), ee[$ + re] = Ie; } return f._charsWritten = 2 * re, re; }(this, e, r, a); break; case "utf8": case "utf-8": I = this, Y = r, q = a, d = f._charsWritten = le(te(e), I, Y, q); break; case "ascii": case "binary": d = y(this, e, r, a); break; case "base64": I = this, Y = r, q = a, d = f._charsWritten = le(xe(e), I, Y, q); break; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": d = v(this, e, r, a); break; default: throw new Error("Unknown encoding"); } return d; }, f.prototype.toString = function(e, r, a) { var h, d, I, Y, q = this; if (e = String(e || "utf8").toLowerCase(), r = Number(r) || 0, (a = a !== void 0 ? Number(a) : q.length) === r) return ""; switch (e) { case "hex": h = function(J, ee, X) { var $ = J.length; (!ee || ee < 0) && (ee = 0), (!X || X < 0 || $ < X) && (X = $); for (var K = "", z = ee; z < X; z++) K += H(J[z]); return K; }(q, r, a); break; case "utf8": case "utf-8": h = function(J, ee, X) { var $ = "", K = ""; X = Math.min(J.length, X); for (var z = ee; z < X; z++) J[z] <= 127 ? ($ += _e(K) + String.fromCharCode(J[z]), K = "") : K += "%" + J[z].toString(16); return $ + _e(K); }(q, r, a); break; case "ascii": case "binary": h = b(q, r, a); break; case "base64": d = q, Y = a, h = (I = r) === 0 && Y === d.length ? c.fromByteArray(d) : c.fromByteArray(d.slice(I, Y)); break; case "ucs2": case "ucs-2": case "utf16le": case "utf-16le": h = function(J, ee, X) { for (var $ = J.slice(ee, X), K = "", z = 0; z < $.length; z += 2) K += String.fromCharCode($[z] + 256 * $[z + 1]); return K; }(q, r, a); break; default: throw new Error("Unknown encoding"); } return h; }, f.prototype.toJSON = function() { return { type: "Buffer", data: Array.prototype.slice.call(this._arr || this, 0) }; }, f.prototype.copy = function(e, r, a, h) { if (r = r || 0, (h = h || h === 0 ? h : this.length) !== (a = a || 0) && e.length !== 0 && this.length !== 0) { E(a <= h, "sourceEnd < sourceStart"), E(0 <= r && r < e.length, "targetStart out of bounds"), E(0 <= a && a < this.length, "sourceStart out of bounds"), E(0 <= h && h <= this.length, "sourceEnd out of bounds"), h > this.length && (h = this.length); var d = (h = e.length - r < h - a ? e.length - r + a : h) - a; if (d < 100 || !f._useTypedArrays) for (var I = 0; I < d; I++) e[I + r] = this[I + a]; else e._set(this.subarray(a, a + d), r); } }, f.prototype.slice = function(e, r) { var a = this.length; if (e = V(e, a, 0), r = V(r, a, a), f._useTypedArrays) return f._augment(this.subarray(e, r)); for (var h = r - e, d = new f(h, void 0, !0), I = 0; I < h; I++) d[I] = this[I + e]; return d; }, f.prototype.get = function(e) { return console.log(".get() is deprecated. Access using array indexes instead."), this.readUInt8(e); }, f.prototype.set = function(e, r) { return console.log(".set() is deprecated. Access using array indexes instead."), this.writeUInt8(e, r); }, f.prototype.readUInt8 = function(e, r) { if (r || (E(e != null, "missing offset"), E(e < this.length, "Trying to read beyond buffer length")), !(e >= this.length)) return this[e]; }, f.prototype.readUInt16LE = function(e, r) { return p(this, e, !0, r); }, f.prototype.readUInt16BE = function(e, r) { return p(this, e, !1, r); }, f.prototype.readUInt32LE = function(e, r) { return F(this, e, !0, r); }, f.prototype.readUInt32BE = function(e, r) { return F(this, e, !1, r); }, f.prototype.readInt8 = function(e, r) { if (r || (E(e != null, "missing offset"), E(e < this.length, "Trying to read beyond buffer length")), !(e >= this.length)) return 128 & this[e] ? -1 * (255 - this[e] + 1) : this[e]; }, f.prototype.readInt16LE = function(e, r) { return i(this, e, !0, r); }, f.prototype.readInt16BE = function(e, r) { return i(this, e, !1, r); }, f.prototype.readInt32LE = function(e, r) { return u(this, e, !0, r); }, f.prototype.readInt32BE = function(e, r) { return u(this, e, !1, r); }, f.prototype.readFloatLE = function(e, r) { return n(this, e, !0, r); }, f.prototype.readFloatBE = function(e, r) { return n(this, e, !1, r); }, f.prototype.readDoubleLE = function(e, r) { return o(this, e, !0, r); }, f.prototype.readDoubleBE = function(e, r) { return o(this, e, !1, r); }, f.prototype.writeUInt8 = function(e, r, a) { a || (E(e != null, "missing value"), E(r != null, "missing offset"), E(r < this.length, "trying to write beyond buffer length"), he(e, 255)), r >= this.length || (this[r] = e); }, f.prototype.writeUInt16LE = function(e, r, a) { t(this, e, r, !0, a); }, f.prototype.writeUInt16BE = function(e, r, a) { t(this, e, r, !1, a); }, f.prototype.writeUInt32LE = function(e, r, a) { s(this, e, r, !0, a); }, f.prototype.writeUInt32BE = function(e, r, a) { s(this, e, r, !1, a); }, f.prototype.writeInt8 = function(e, r, a) { a || (E(e != null, "missing value"), E(r != null, "missing offset"), E(r < this.length, "Trying to write beyond buffer length"), ge(e, 127, -128)), r >= this.length || (0 <= e ? this.writeUInt8(e, r, a) : this.writeUInt8(255 + e + 1, r, a)); }, f.prototype.writeInt16LE = function(e, r, a) { l(this, e, r, !0, a); }, f.prototype.writeInt16BE = function(e, r, a) { l(this, e, r, !1, a); }, f.prototype.writeInt32LE = function(e, r, a) { j(this, e, r, !0, a); }, f.prototype.writeInt32BE = function(e, r, a) { j(this, e, r, !1, a); }, f.prototype.writeFloatLE = function(e, r, a) { k(this, e, r, !0, a); }, f.prototype.writeFloatBE = function(e, r, a) { k(this, e, r, !1, a); }, f.prototype.writeDoubleLE = function(e, r, a) { M(this, e, r, !0, a); }, f.prototype.writeDoubleBE = function(e, r, a) { M(this, e, r, !1, a); }, f.prototype.fill = function(e, r, a) { if (r = r || 0, a = a || this.length, E(typeof (e = typeof (e = e || 0) == "string" ? e.charCodeAt(0) : e) == "number" && !isNaN(e), "value is not a number"), E(r <= a, "end < start"), a !== r && this.length !== 0) { E(0 <= r && r < this.length, "start out of bounds"), E(0 <= a && a <= this.length, "end out of bounds"); for (var h = r; h < a; h++) this[h] = e; } }, f.prototype.inspect = function() { for (var e = [], r = this.length, a = 0; a < r; a++) if (e[a] = H(this[a]), a === _.INSPECT_MAX_BYTES) { e[a + 1] = "..."; break; } return "<Buffer " + e.join(" ") + ">"; }, f.prototype.toArrayBuffer = function() { if (typeof Uint8Array > "u") throw new Error("Buffer.toArrayBuffer not supported in this browser"); if (f._useTypedArrays) return new f(this).buffer; for (var e = new Uint8Array(this.length), r = 0, a = e.length; r < a; r += 1) e[r] = this[r]; return e.buffer; }; var S = f.prototype; function V(e, r, a) { return typeof e != "number" ? a : r <= (e = ~~e) ? r : 0 <= e || 0 <= (e += r) ? e : 0; } function G(e) { return (e = ~~Math.ceil(+e)) < 0 ? 0 : e; } function W(e) { return (Array.isArray || function(r) { return Object.prototype.toString.call(r) === "[object Array]"; })(e); } function H(e) { return e < 16 ? "0" + e.toString(16) : e.toString(16); } function te(e) { for (var r = [], a = 0; a < e.length; a++) { var h = e.charCodeAt(a); if (h <= 127) r.push(e.charCodeAt(a)); else for (var d = a, I = (55296 <= h && h <= 57343 && a++, encodeURIComponent(e.slice(d, a + 1)).substr(1).split("%")), Y = 0; Y < I.length; Y++) r.push(parseInt(I[Y], 16)); } return r; } function xe(e) { return c.toByteArray(e); } function le(e, r, a, h) { for (var d = 0; d < h && !(d + a >= r.length || d >= e.length); d++) r[d + a] = e[d]; return d; } function _e(e) { try { return decodeURIComponent(e); } catch { return "�"; } } function he(e, r) { E(typeof e == "number", "cannot write a non-number as a number"), E(0 <= e, "specified a negative value for writing an unsigned value"), E(e <= r, "value is larger than maximum value for type"), E(Math.floor(e) === e, "value has a fractional component"); } function ge(e, r, a) { E(typeof e == "number", "cannot write a non-number as a number"), E(e <= r, "value larger than maximum allowed value"), E(a <= e, "value smaller than minimum allowed value"), E(Math.floor(e) === e, "value has a fractional component"); } function Ee(e, r, a) { E(typeof e == "number", "cannot write a non-number as a number"), E(e <= r, "value larger than maximum allowed value"), E(a <= e, "value smaller than minimum allowed value"); } function E(e, r) { if (!e) throw new Error(r || "Failed assertion"); } f._augment = function(e) { return e._isBuffer = !0, e._get = e.get, e._set = e.set, e.get = S.get, e.set = S.set, e.write = S.write, e.toString = S.toString, e.toLocaleString = S.toString, e.toJSON = S.toJSON, e.copy = S.copy, e.slice = S.slice, e.readUInt8 = S.readUInt8, e.readUInt16LE = S.readUInt16LE, e.readUInt16BE = S.readUInt16BE, e.readUInt32LE = S.readUInt32LE, e.readUInt32BE = S.readUInt32BE, e.readInt8 = S.readInt8, e.readInt16LE = S.readInt16LE, e.readInt16BE = S.readInt16BE, e.readInt32LE = S.readInt32LE, e.readInt32BE = S.readInt32BE, e.readFloatLE = S.readFloatLE, e.readFloatBE = S.readFloatBE, e.readDoubleLE = S.readDoubleLE, e.readDoubleBE = S.readDoubleBE, e.writeUInt8 = S.writeUInt8, e.writeUInt16LE = S.writeUInt16LE, e.writeUInt16BE = S.writeUInt16BE, e.writeUInt32LE = S.writeUInt32LE, e.writeUInt32BE = S.writeUInt32BE, e.writeInt8 = S.writeInt8, e.writeInt16LE = S.writeInt16LE, e.writeInt16BE = S.writeInt16BE, e.writeInt32LE = S.writeInt32LE, e.writeInt32BE = S.writeInt32BE, e.writeFloatLE = S.writeFloatLE, e.writeFloatBE = S.writeFloatBE, e.writeDoubleLE = S.writeDoubleLE, e.writeDoubleBE = S.writeDoubleBE, e.fill = S.fill, e.inspect = S.inspect, e.toArrayBuffer = S.toArrayBuffer, e; }; }).call(this, m("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, m("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/buffer/index.js", "/node_modules/gulp-browserify/node_modules/buffer"); }, { "base64-js": 2, buffer: 3, ieee754: 10, lYpoI2: 11 }], 4: [function(m, g, _) { (function(A, L, c, x, B, P, R, O, U) { var c = m("buffer").Buffer, w = 4, f = new c(w); f.fill(0), g.exports = { hash: function(y, v, b, p) { for (var F = v(function(t, s) { t.length % w != 0 && (l = t.length + (w - t.length % w), t = c.concat([t, f], l)); for (var l, j = [], k = s ? t.readInt32BE : t.readInt32LE, M = 0; M < t.length; M += w) j.push(k.call(t, M)); return j; }(y = c.isBuffer(y) ? y : new c(y), p), 8 * y.length), v = p, i = new c(b), u = v ? i.writeInt32BE : i.writeInt32LE, n = 0; n < F.length; n++) u.call(i, F[n], 4 * n, !0); return i; } }; }).call(this, m("lYpoI2"), typeof self < "u" ? self : typeof window < "u" ? window : {}, m("buffer").Buffer, arguments[3], arguments[4], arguments[5], arguments[6], "/node_modules/gulp-browserify/node_modules/crypto-browserify/helpers.js", "/node_modules/gulp-browserify/node_modules/crypto-browserify"); }, { buffer: 3, lYpoI2: 11 }], 5: [function(m, g, _) { (function(A, L, c, x, B, P, R, O, U) { var c = m("buffer").Buffer, w = m("./sha"), f = m("./sha256"), y = m("./rng"), v = { sha1: w, sha256: f, md5: m("./md5") }, b = 64, p = new c(b); function F(t, s) { var l = v[t = t || "sha1"], j = []; return l || i("algorithm:", t, "is not yet supported"), { update: function(k) { return c.isBuffer(k) || (k = new c(k)), j.push(k), k.length, this; }, digest: function(k) { var M = c.concat(j), M = s ? function(S, V, G) { c.isBuffer(V) || (V = new c(V)), c.isBuffer(G) || (G = new c(G)), V.length > b ? V = S(V) : V.length < b && (V = c.concat([V, p], b)); for (var W = new c(b), H = new c(b), te = 0; te < b; te++) W[te] = 54 ^ V[te], H[te] = 92 ^ V[te]; return G = S(c.concat([W, G])), S(c.concat([H, G])); }(l, s, M) : l(M); return j = null, k ? M.toString(k) : M; } }; } function i() { var t = [].slice.call(arguments).join(" "); throw new Error([t, "we accept pull requests", "http://github.com/dominictarr/crypto-browserify"].join(` `)); } p.fill(0), _.createHash = function(t) { return F(t); }, _.createHmac = F, _.randomBytes = function(t, s) { if (!s || !s.call) return new c(y(t)); try { s.call(this, void 0, new c(y(t))); } catch (l) { s(l);