@caipira/tamandua 0.0.21 → 0.0.22

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,5 +1,5 @@
1
- import { _ as s } from "./InputPassword.vue_vue_type_script_setup_true_lang-B-MOg3_z.js";
2
- import { p as a } from "./plugin-Oe_WP1sP.js";
1
+ import { _ as s } from "./InputPassword.vue_vue_type_script_setup_true_lang-DPGxncwu.js";
2
+ import { p as a } from "./plugin-F8R_o02l.js";
3
3
  export {
4
4
  s as InputPassword,
5
5
  a as InputPasswordPlugin
@@ -0,0 +1,170 @@
1
+ import { defineComponent as te, mergeModels as O, useModel as ne, ref as R, inject as le, watch as se, resolveComponent as j, openBlock as I, createElementBlock as A, normalizeClass as z, unref as B, createElementVNode as U, createVNode as k, createCommentVNode as _, withKeys as oe, createBlock as ae, toDisplayString as re } from "vue";
2
+ import { u as ie } from "./useClipboard-BHFD0Jvv.js";
3
+ import { f as ue } from "./index-CjvqeRf7.js";
4
+ const ce = (l = 18) => {
5
+ const e = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", o = "!?@#-+<%$>[]{}";
6
+ let n = "";
7
+ const s = [
8
+ Math.floor(Math.random() * l),
9
+ Math.floor(Math.random() * l)
10
+ ];
11
+ for (let a = 0; a < l; a++)
12
+ s.includes(a) ? n += o.charAt(
13
+ Math.floor(Math.random() * o.length)
14
+ ) : n += e.charAt(
15
+ Math.floor(Math.random() * e.length)
16
+ );
17
+ return n;
18
+ }, pe = (l) => {
19
+ let e = 0, o = 0, n = 0, s = 0, a = 0, u = 0, c = 0, w = 0, f = 0, b = 0, d = 0, C = 0, M = 0, x = 0, r = 0, m = 0, S = 0, L = 0, y = 2, T = 2, F = 2, E = 2, D = 3, K = 3, W = 3, Z = 4, G = 4, H = 6, q = "", N = "", P = "", v = "Too Short";
20
+ const J = "abcdefghijklmnopqrstuvwxyz", Q = "01234567890", X = ")!@#$%^&*()", Y = 8, h = l.replace(/\s+/g, "").split(/\s*/), g = h.length;
21
+ e = l.length * Z, o = l.length;
22
+ for (let t = 0; t < g; t++) {
23
+ h[t].match(/[A-Z]/g) ? (q !== "" && q + 1 == t && C++, q = t, n++) : h[t].match(/[a-z]/g) ? (N !== "" && N + 1 == t && M++, N = t, s++) : h[t].match(/[0-9]/g) ? (t > 0 && t < g - 1 && c++, P !== "" && P + 1 == t && x++, P = t, a++) : h[t].match(/[^a-zA-Z0-9_]/g) && (t > 0 && t < g - 1 && c++, u++);
24
+ let i = !1;
25
+ for (let p = 0; p < g; p++)
26
+ h[t] == h[p] && t != p && (i = !0, d += Math.abs(g / (p - t)));
27
+ i && (b++, f = g - b, d = Math.ceil(f ? d / f : d));
28
+ }
29
+ for (let t = 0; t < 23; t++) {
30
+ let i = J.substring(t, parseInt(t + 3)), p = i.split("").reverse().join("");
31
+ (l.toLowerCase().indexOf(i) != -1 || l.toLowerCase().indexOf(p) != -1) && r++;
32
+ }
33
+ for (let t = 0; t < 8; t++) {
34
+ let i = Q.substring(t, parseInt(t + 3));
35
+ var ee = i.split("").reverse().join("");
36
+ (l.toLowerCase().indexOf(i) != -1 || l.toLowerCase().indexOf(ee) != -1) && m++;
37
+ }
38
+ for (let t = 0; t < 8; t++) {
39
+ let i = X.substring(t, parseInt(t + 3)), p = i.split("").reverse().join("");
40
+ (l.toLowerCase().indexOf(i) != -1 || l.toLowerCase().indexOf(p) != -1) && S++;
41
+ }
42
+ n > 0 && n < o && (e = parseInt(e + (o - n) * 2)), s > 0 && s < o && (e = parseInt(e + (o - s) * 2)), a > 0 && a < o && (e = parseInt(e + a * G)), u > 0 && (e = parseInt(e + u * H)), c > 0 && (e = parseInt(e + c * y)), (s > 0 || n > 0) && u === 0 && a === 0 && (e = parseInt(e - o)), s === 0 && n === 0 && u === 0 && a > 0 && (e = parseInt(e - o)), b > 0 && (e = parseInt(e - d)), C > 0 && (e = parseInt(e - C * T)), M > 0 && (e = parseInt(e - M * F)), x > 0 && (e = parseInt(e - x * E)), r > 0 && (e = parseInt(e - r * D)), m > 0 && (e = parseInt(e - m * K)), S > 0 && (e = parseInt(e - S * W)), w = L;
43
+ let V = 0;
44
+ return l.length >= Y ? V = 3 : V = 4, w > V && (e = parseInt(e + w * 2)), e > 100 ? e = 100 : e < 0 && (e = 0), e >= 0 && e < 20 ? v = "Very Weak" : e >= 20 && e < 40 ? v = "Weak" : e >= 40 && e < 60 ? v = "Good" : e >= 60 && e < 80 ? v = "Strong" : e >= 80 && e <= 100 && (v = "Very Strong"), {
45
+ score: e,
46
+ complexity: v
47
+ };
48
+ }, $ = {
49
+ generatePassword: ce,
50
+ getPasswordStrength: pe
51
+ }, fe = { class: "flex border h-9 relative input-roundness input-border" }, de = { class: "border-l select-none input-border input-control" }, me = {
52
+ key: 1,
53
+ class: "inline-block float-right select-none"
54
+ }, ge = /* @__PURE__ */ te({
55
+ name: "TInputPassword",
56
+ __name: "InputPassword",
57
+ props: /* @__PURE__ */ O({
58
+ autocomplete: { default: "current-password" },
59
+ encryptor: { type: Function, default: void 0 },
60
+ showCopy: { type: Boolean, default: !0 },
61
+ showRefresh: { type: Boolean, default: !1 },
62
+ showStrength: { type: Boolean, default: !1 }
63
+ }, {
64
+ modelValue: {
65
+ default: {
66
+ raw: "",
67
+ strength: 0,
68
+ hash: "",
69
+ updatedAt: void 0
70
+ }
71
+ },
72
+ modelModifiers: {}
73
+ }),
74
+ emits: /* @__PURE__ */ O(["generate", "enter"], ["update:modelValue"]),
75
+ setup(l, { expose: e, emit: o }) {
76
+ const n = ne(l, "modelValue"), s = l, a = o, u = R("password"), c = R(null), { copy: w } = ie(), f = R(!1), b = le("formStyle", { input: "w-full" }), d = async () => {
77
+ n.value.strength = $.getPasswordStrength(
78
+ n.value.raw
79
+ ).score, s.encryptor && (n.value.hash = await s.encryptor(n.value.raw));
80
+ }, C = () => {
81
+ c.value && c.value.$el && c.value.$el.focus();
82
+ }, M = async () => {
83
+ n.value.raw = $.generatePassword();
84
+ };
85
+ return se(() => n.value.raw, d), e({ focus: C }), (x, r) => {
86
+ const m = j("t-button"), S = j("t-input-text"), L = j("t-progress-line");
87
+ return I(), A("div", {
88
+ class: z({ [B(b).input]: !0 })
89
+ }, [
90
+ U("div", fe, [
91
+ s.showCopy ? (I(), A("div", {
92
+ key: 0,
93
+ class: z(["border-r select-none input-border input-control", { "w-12": s.showCopy }])
94
+ }, [
95
+ k(m, {
96
+ variant: "transparent",
97
+ icon: "copy",
98
+ size: "sm",
99
+ class: "h-full w-full justify-center",
100
+ animate: {
101
+ target: "icon",
102
+ trigger: "click",
103
+ animation: {
104
+ scale: 4,
105
+ yoyo: !0,
106
+ opacity: 0
107
+ },
108
+ reset: { opacity: 1, scale: 1 }
109
+ },
110
+ disabled: f.value,
111
+ onClick: r[0] || (r[0] = (y) => B(w)(n.value.raw))
112
+ }, null, 8, ["disabled"])
113
+ ], 2)) : _("", !0),
114
+ s.showRefresh ? (I(), A("div", {
115
+ key: 1,
116
+ class: z(["border-r select-none input-border input-control", { "w-12": s.showRefresh }])
117
+ }, [
118
+ k(m, {
119
+ variant: "transparent",
120
+ icon: "refresh",
121
+ size: "sm",
122
+ class: "h-full w-full justify-center",
123
+ animate: {
124
+ target: "icon",
125
+ trigger: "click",
126
+ animation: { rotation: 360 },
127
+ reset: { rotation: 0 }
128
+ },
129
+ disabled: f.value,
130
+ onClick: M
131
+ }, null, 8, ["disabled"])
132
+ ], 2)) : _("", !0),
133
+ k(S, {
134
+ modelValue: n.value.raw,
135
+ "onUpdate:modelValue": r[1] || (r[1] = (y) => n.value.raw = y),
136
+ type: u.value,
137
+ autocomplete: s.autocomplete,
138
+ disabled: f.value,
139
+ "disable-style": !0,
140
+ ref_key: "input",
141
+ ref: c,
142
+ class: "w-full px-2 input-bg-color input-text-color input-outline input-roundness",
143
+ onKeyup: r[2] || (r[2] = oe((y) => a("enter"), ["enter"]))
144
+ }, null, 8, ["modelValue", "type", "autocomplete", "disabled"]),
145
+ U("div", de, [
146
+ k(m, {
147
+ variant: "transparent",
148
+ size: "sm",
149
+ class: "h-full w-full justify-center",
150
+ icon: u.value === "password" ? "eye" : "eye-off",
151
+ disabled: f.value,
152
+ onClick: r[3] || (r[3] = (y) => u.value = u.value === "password" ? "text" : "password")
153
+ }, null, 8, ["icon", "disabled"])
154
+ ])
155
+ ]),
156
+ s.showStrength ? (I(), ae(L, {
157
+ key: 0,
158
+ value: n.value.strength,
159
+ class: "mt-0.5",
160
+ height: 2.5,
161
+ "show-percentage": !1
162
+ }, null, 8, ["value"])) : _("", !0),
163
+ n.value.updatedAt ? (I(), A("small", me, " Last updated " + re(B(ue)(new Date(n.value.updatedAt), "MMMM do yyyy, hh:mm:ss")), 1)) : _("", !0)
164
+ ], 2);
165
+ };
166
+ }
167
+ });
168
+ export {
169
+ ge as _
170
+ };
package/dist/ModalForm.js CHANGED
@@ -1,5 +1,5 @@
1
- import { _ as a } from "./ModalForm.vue_vue_type_script_setup_true_lang-BaYQDOnJ.js";
2
- import { p as l } from "./plugin-BGWPliCj.js";
1
+ import { _ as a } from "./ModalForm.vue_vue_type_script_setup_true_lang-BSEORivR.js";
2
+ import { p as l } from "./plugin-C3jERS0X.js";
3
3
  export {
4
4
  a as ModalForm,
5
5
  l as ModalFormPlugin
@@ -50,7 +50,7 @@ const $ = {
50
50
  c(D, {
51
51
  icon: "dots-vertical",
52
52
  class: "text-lg mr-6",
53
- size: "xs",
53
+ size: "sm",
54
54
  role: "button",
55
55
  "aria-describedby": "tooltip"
56
56
  })
@@ -19,7 +19,7 @@ import { _ as R } from "./InputCheckbox.vue_vue_type_script_setup_true_lang-B5zo
19
19
  import { _ as q } from "./InputColor.vue_vue_type_script_setup_true_lang-CZ0o-B7I.js";
20
20
  import { _ as H } from "./InputDate.vue_vue_type_script_setup_true_lang-D1H0urIZ.js";
21
21
  import { _ as K } from "./InputMultiplier.vue_vue_type_script_setup_true_lang-DlITLRxb.js";
22
- import { _ as O } from "./InputPassword.vue_vue_type_script_setup_true_lang-B-MOg3_z.js";
22
+ import { _ as O } from "./InputPassword.vue_vue_type_script_setup_true_lang-DPGxncwu.js";
23
23
  import { _ as U } from "./InputPhone.vue_vue_type_script_setup_true_lang-DvSNQmar.js";
24
24
  import { _ as W } from "./InputPrice.vue_vue_type_script_setup_true_lang-BBi8qKn8.js";
25
25
  import { _ as Y } from "./InputRadio.vue_vue_type_script_setup_true_lang-Dqbov2kN.js";
@@ -30,7 +30,7 @@ import { _ as ar } from "./InputText.vue_vue_type_script_setup_true_lang-BWM3bHK
30
30
  import { _ as pr } from "./InputTextarea.vue_vue_type_script_setup_true_lang-IMz1cgV5.js";
31
31
  import { _ as sr } from "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
32
32
  import { _ as fr } from "./Modal.vue_vue_type_script_setup_true_lang-DLl5shGS.js";
33
- import { _ as nr } from "./ModalForm.vue_vue_type_script_setup_true_lang-BaYQDOnJ.js";
33
+ import { _ as nr } from "./ModalForm.vue_vue_type_script_setup_true_lang-BSEORivR.js";
34
34
  import { _ as ur } from "./Pagination.vue_vue_type_script_setup_true_lang-PLZQJUd0.js";
35
35
  import { _ as lr } from "./Popconfirm.vue_vue_type_script_setup_true_lang-BNpLdXq7.js";
36
36
  import { _ as hr } from "./Popover.vue_vue_type_script_setup_true_lang-B4Polh2y.js";
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./ModalForm.vue_vue_type_script_setup_true_lang-BaYQDOnJ.js";
2
+ import { _ as s } from "./ModalForm.vue_vue_type_script_setup_true_lang-BSEORivR.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -1,5 +1,5 @@
1
1
  import { r } from "./register-component-B-fdqewb.js";
2
- import { _ as s } from "./InputPassword.vue_vue_type_script_setup_true_lang-B-MOg3_z.js";
2
+ import { _ as s } from "./InputPassword.vue_vue_type_script_setup_true_lang-DPGxncwu.js";
3
3
  const m = {
4
4
  install(o) {
5
5
  r(o, s);
@@ -28,7 +28,7 @@ import { p as c } from "./plugin-DaibhM02.js";
28
28
  import { p as h } from "./plugin-DppW8rQi.js";
29
29
  import { p as b } from "./plugin-DkDbha5K.js";
30
30
  import { p as d } from "./plugin-DEybStkj.js";
31
- import { p as y } from "./plugin-Oe_WP1sP.js";
31
+ import { p as y } from "./plugin-F8R_o02l.js";
32
32
  import { p as T } from "./plugin-hr8-EXeF.js";
33
33
  import { p as v } from "./plugin-C3tFXHbZ.js";
34
34
  import { p as C } from "./plugin-BrwUi1gG.js";
@@ -40,7 +40,7 @@ import { p as D } from "./plugin-CqcxTgW6.js";
40
40
  import "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
41
41
  import { p as F } from "./plugin-dL6oP11N.js";
42
42
  import { p as G } from "./plugin-BZC231Oj.js";
43
- import { p as k } from "./plugin-BGWPliCj.js";
43
+ import { p as k } from "./plugin-C3jERS0X.js";
44
44
  import { p as L } from "./plugin-YUomn9tF.js";
45
45
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-BNpLdXq7.js";
46
46
  import { p as M } from "./plugin-Bt6de9ZA.js";
package/dist/plugins.js CHANGED
@@ -28,7 +28,7 @@ import { p as $ } from "./plugin-DaibhM02.js";
28
28
  import { p as or } from "./plugin-DppW8rQi.js";
29
29
  import { p as tr } from "./plugin-DkDbha5K.js";
30
30
  import { p as ar } from "./plugin-DEybStkj.js";
31
- import { p as nr } from "./plugin-Oe_WP1sP.js";
31
+ import { p as nr } from "./plugin-F8R_o02l.js";
32
32
  import { p as ur } from "./plugin-hr8-EXeF.js";
33
33
  import { p as Pr } from "./plugin-C3tFXHbZ.js";
34
34
  import { p as gr } from "./plugin-BrwUi1gG.js";
@@ -40,7 +40,7 @@ import { p as yr } from "./plugin-CqcxTgW6.js";
40
40
  import "./Link.vue_vue_type_script_setup_true_lang-DeBJ2UGi.js";
41
41
  import { p as Cr } from "./plugin-dL6oP11N.js";
42
42
  import { p as vr } from "./plugin-BZC231Oj.js";
43
- import { p as Dr } from "./plugin-BGWPliCj.js";
43
+ import { p as Dr } from "./plugin-C3jERS0X.js";
44
44
  import { p as Lr } from "./plugin-YUomn9tF.js";
45
45
  import "./Popconfirm.vue_vue_type_script_setup_true_lang-BNpLdXq7.js";
46
46
  import { p as kr } from "./plugin-Bt6de9ZA.js";
package/dist/tamandua.js CHANGED
@@ -1,4 +1,4 @@
1
- import { p as n } from "./plugins-D_vHRI2V.js";
1
+ import { p as n } from "./plugins-DT0DoXfZ.js";
2
2
  const o = {
3
3
  install(s) {
4
4
  for (const i in n)
@@ -1,56 +1,62 @@
1
- import { InputPasswordProps } from './types.ts';
2
1
  import { InputPasswordModel } from '../../types/form.js';
3
2
 
4
- declare const _default: import('vue').DefineComponent<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputPasswordProps>, {
5
- autocomplete: string;
6
- canCopy: boolean;
7
- encryptor: undefined;
8
- keyup: () => () => void;
9
- modelValue: undefined;
10
- showRefresh: boolean;
11
- showStrength: boolean;
12
- }>, {
3
+ declare const _default: import('vue').DefineComponent<{
4
+ modelValue: import("vue").PropType<InputPasswordModel>;
5
+ autocomplete: {
6
+ type: import("vue").PropType<string>;
7
+ default: string;
8
+ };
9
+ encryptor: {
10
+ type: import("vue").PropType<(value: string) => Promise<string>>;
11
+ default: undefined;
12
+ };
13
+ showCopy: {
14
+ type: import("vue").PropType<boolean>;
15
+ default: boolean;
16
+ };
17
+ showRefresh: {
18
+ type: import("vue").PropType<boolean>;
19
+ default: boolean;
20
+ };
21
+ showStrength: {
22
+ type: import("vue").PropType<boolean>;
23
+ default: boolean;
24
+ };
25
+ }, {
13
26
  focus: () => void;
14
27
  }, unknown, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {
15
28
  generate: (val: InputPasswordModel) => void;
16
- "update:model-value": (val: InputPasswordModel) => void;
17
29
  enter: () => void;
18
- }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToRuntimeProps<InputPasswordProps>, {
19
- autocomplete: string;
20
- canCopy: boolean;
21
- encryptor: undefined;
22
- keyup: () => () => void;
23
- modelValue: undefined;
24
- showRefresh: boolean;
25
- showStrength: boolean;
26
- }>>> & {
27
- "onUpdate:model-value"?: ((val: InputPasswordModel) => any) | undefined;
30
+ }, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
31
+ modelValue: import("vue").PropType<InputPasswordModel>;
32
+ autocomplete: {
33
+ type: import("vue").PropType<string>;
34
+ default: string;
35
+ };
36
+ encryptor: {
37
+ type: import("vue").PropType<(value: string) => Promise<string>>;
38
+ default: undefined;
39
+ };
40
+ showCopy: {
41
+ type: import("vue").PropType<boolean>;
42
+ default: boolean;
43
+ };
44
+ showRefresh: {
45
+ type: import("vue").PropType<boolean>;
46
+ default: boolean;
47
+ };
48
+ showStrength: {
49
+ type: import("vue").PropType<boolean>;
50
+ default: boolean;
51
+ };
52
+ }>> & {
28
53
  onEnter?: (() => any) | undefined;
29
54
  onGenerate?: ((val: InputPasswordModel) => any) | undefined;
30
55
  }, {
31
- keyup: any;
32
- modelValue: InputPasswordModel;
33
56
  autocomplete: string;
34
- canCopy: boolean;
35
57
  encryptor: (value: string) => Promise<string>;
58
+ showCopy: boolean;
36
59
  showRefresh: boolean;
37
60
  showStrength: boolean;
38
61
  }, {}>;
39
62
  export default _default;
40
- type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
41
- type __VLS_TypePropsToRuntimeProps<T> = {
42
- [K in keyof T]-?: {} extends Pick<T, K> ? {
43
- type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
44
- } : {
45
- type: import('vue').PropType<T[K]>;
46
- required: true;
47
- };
48
- };
49
- type __VLS_WithDefaults<P, D> = {
50
- [K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_Prettify<P[K] & {
51
- default: D[K];
52
- }> : P[K];
53
- };
54
- type __VLS_Prettify<T> = {
55
- [K in keyof T]: T[K];
56
- } & {};
@@ -17,6 +17,10 @@ declare const _default: {
17
17
  options: boolean[];
18
18
  control: string;
19
19
  };
20
+ showCopy: {
21
+ options: boolean[];
22
+ control: string;
23
+ };
20
24
  };
21
25
  };
22
26
  export default _default;
@@ -2,15 +2,12 @@ import { InputPasswordModel } from '../../types/form.js';
2
2
 
3
3
  export type InputPasswordProps = {
4
4
  autocomplete?: string;
5
- canCopy?: boolean;
6
5
  encryptor?: (value: string) => Promise<string>;
7
- keyup?: any;
8
- modelValue?: InputPasswordModel;
6
+ showCopy?: boolean;
9
7
  showRefresh?: boolean;
10
8
  showStrength?: boolean;
11
9
  };
12
10
  export type InputPasswordEvents = {
13
11
  (e: "generate", val: InputPasswordModel): void;
14
- (e: "update:model-value", val: InputPasswordModel): void;
15
12
  (e: "enter"): void;
16
13
  };
@@ -43,7 +43,7 @@ export interface InputPriceModel {
43
43
  }
44
44
  export interface InputPasswordModel {
45
45
  /** Unencrypted password */
46
- raw?: string;
46
+ raw: string;
47
47
  /** If an encryptor was passed, this prop will hold the encrypted value */
48
48
  hash?: string;
49
49
  /** Strength of the password */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@caipira/tamandua",
3
- "version": "0.0.21",
3
+ "version": "0.0.22",
4
4
  "private": false,
5
5
  "description": "UI library for the Caipira ecosystem",
6
6
  "license": "GPL-3.0-only",
@@ -1,178 +0,0 @@
1
- import { defineComponent as ee, ref as I, inject as te, watch as ne, resolveComponent as T, openBlock as L, createElementBlock as V, normalizeClass as U, unref as F, createElementVNode as K, createVNode as q, createCommentVNode as N, withKeys as le, createBlock as se, toDisplayString as ae } from "vue";
2
- import { u as oe } from "./useClipboard-BHFD0Jvv.js";
3
- import { f as re } from "./index-CjvqeRf7.js";
4
- const ie = (s = 18) => {
5
- const e = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", r = "!?@#-+<%$>[]{}";
6
- let n = "";
7
- const i = [
8
- Math.floor(Math.random() * s),
9
- Math.floor(Math.random() * s)
10
- ];
11
- for (let o = 0; o < s; o++)
12
- i.includes(o) ? n += r.charAt(
13
- Math.floor(Math.random() * r.length)
14
- ) : n += e.charAt(
15
- Math.floor(Math.random() * e.length)
16
- );
17
- return n;
18
- }, ue = (s) => {
19
- let e = 0, r = 0, n = 0, i = 0, o = 0, p = 0, C = 0, f = 0, c = 0, m = 0, y = 0, h = 0, k = 0, w = 0, v = 0, x = 0, A = 0, l = 0, a = 2, _ = 2, R = 2, j = 2, g = 3, P = 3, D = 3, W = 4, Z = 4, G = 6, z = "", $ = "", B = "", M = "Too Short";
20
- const H = "abcdefghijklmnopqrstuvwxyz", J = "01234567890", Q = ")!@#$%^&*()", X = 8, b = s.replace(/\s+/g, "").split(/\s*/), S = b.length;
21
- e = s.length * W, r = s.length;
22
- for (let t = 0; t < S; t++) {
23
- b[t].match(/[A-Z]/g) ? (z !== "" && z + 1 == t && h++, z = t, n++) : b[t].match(/[a-z]/g) ? ($ !== "" && $ + 1 == t && k++, $ = t, i++) : b[t].match(/[0-9]/g) ? (t > 0 && t < S - 1 && C++, B !== "" && B + 1 == t && w++, B = t, o++) : b[t].match(/[^a-zA-Z0-9_]/g) && (t > 0 && t < S - 1 && C++, p++);
24
- let u = !1;
25
- for (let d = 0; d < S; d++)
26
- b[t] == b[d] && t != d && (u = !0, y += Math.abs(S / (d - t)));
27
- u && (m++, c = S - m, y = Math.ceil(c ? y / c : y));
28
- }
29
- for (let t = 0; t < 23; t++) {
30
- let u = H.substring(t, parseInt(t + 3)), d = u.split("").reverse().join("");
31
- (s.toLowerCase().indexOf(u) != -1 || s.toLowerCase().indexOf(d) != -1) && v++;
32
- }
33
- for (let t = 0; t < 8; t++) {
34
- let u = J.substring(t, parseInt(t + 3));
35
- var Y = u.split("").reverse().join("");
36
- (s.toLowerCase().indexOf(u) != -1 || s.toLowerCase().indexOf(Y) != -1) && x++;
37
- }
38
- for (let t = 0; t < 8; t++) {
39
- let u = Q.substring(t, parseInt(t + 3)), d = u.split("").reverse().join("");
40
- (s.toLowerCase().indexOf(u) != -1 || s.toLowerCase().indexOf(d) != -1) && A++;
41
- }
42
- n > 0 && n < r && (e = parseInt(e + (r - n) * 2)), i > 0 && i < r && (e = parseInt(e + (r - i) * 2)), o > 0 && o < r && (e = parseInt(e + o * Z)), p > 0 && (e = parseInt(e + p * G)), C > 0 && (e = parseInt(e + C * a)), (i > 0 || n > 0) && p === 0 && o === 0 && (e = parseInt(e - r)), i === 0 && n === 0 && p === 0 && o > 0 && (e = parseInt(e - r)), m > 0 && (e = parseInt(e - y)), h > 0 && (e = parseInt(e - h * _)), k > 0 && (e = parseInt(e - k * R)), w > 0 && (e = parseInt(e - w * j)), v > 0 && (e = parseInt(e - v * g)), x > 0 && (e = parseInt(e - x * P)), A > 0 && (e = parseInt(e - A * D)), f = l;
43
- let O = 0;
44
- return s.length >= X ? O = 3 : O = 4, f > O && (e = parseInt(e + f * 2)), e > 100 ? e = 100 : e < 0 && (e = 0), e >= 0 && e < 20 ? M = "Very Weak" : e >= 20 && e < 40 ? M = "Weak" : e >= 40 && e < 60 ? M = "Good" : e >= 60 && e < 80 ? M = "Strong" : e >= 80 && e <= 100 && (M = "Very Strong"), {
45
- score: e,
46
- complexity: M
47
- };
48
- }, E = {
49
- generatePassword: ie,
50
- getPasswordStrength: ue
51
- }, pe = { class: "flex border h-9 relative input-roundness input-border" }, ce = { class: "border-l select-none input-border input-control" }, fe = {
52
- key: 1,
53
- class: "inline-block float-right select-none"
54
- }, ye = /* @__PURE__ */ ee({
55
- name: "TInputPassword",
56
- __name: "InputPassword",
57
- props: {
58
- autocomplete: { default: "current-password" },
59
- canCopy: { type: Boolean, default: !0 },
60
- encryptor: { type: Function, default: void 0 },
61
- keyup: { default: () => () => {
62
- } },
63
- modelValue: { default: void 0 },
64
- showRefresh: { type: Boolean, default: !1 },
65
- showStrength: { type: Boolean, default: !1 }
66
- },
67
- emits: ["generate", "update:model-value", "enter"],
68
- setup(s, { expose: e, emit: r }) {
69
- const n = s, i = r, o = I("password"), p = I(null), { copy: C } = oe(), f = I(0), c = I(""), m = I(!1), y = te("formStyle", { input: "w-full" }), h = I(), k = (l) => {
70
- if (typeof l != "object")
71
- return;
72
- let a = !1;
73
- l.raw && (c.value = l.raw), l.strength ? f.value = l.strength : l.raw && (f.value = E.getPasswordStrength(
74
- l.raw
75
- ).score, a = !0), l.updatedAt && (h.value = l.updatedAt), l.raw && n.encryptor && (!n.modelValue?.hash || n.modelValue?.hash !== l.hash) && (a = !0), a && v(c.value);
76
- }, w = async (l) => (f.value = E.getPasswordStrength(l).score, {
77
- raw: l,
78
- strength: f.value,
79
- hash: n.encryptor ? await n.encryptor(l) : void 0,
80
- updatedAt: h.value
81
- }), v = async (l) => {
82
- i("update:model-value", await w(l));
83
- }, x = () => {
84
- p.value && p.value.$el && p.value.$el.focus();
85
- }, A = async () => {
86
- const l = E.generatePassword();
87
- i("generate", await w(l)), v(l);
88
- };
89
- return ne(() => n.modelValue, k, { immediate: !0 }), e({ focus: x }), (l, a) => {
90
- const _ = T("t-button"), R = T("t-input-text"), j = T("t-progress-line");
91
- return L(), V("div", {
92
- class: U({ [F(y).input]: !0 })
93
- }, [
94
- K("div", pe, [
95
- n.canCopy ? (L(), V("div", {
96
- key: 0,
97
- class: U(["border-r select-none input-border input-control", { "w-12": n.canCopy }])
98
- }, [
99
- q(_, {
100
- variant: "transparent",
101
- icon: "copy",
102
- size: "sm",
103
- class: "h-full w-full justify-center",
104
- animate: {
105
- target: "icon",
106
- trigger: "click",
107
- animation: {
108
- scale: 4,
109
- yoyo: !0,
110
- opacity: 0
111
- },
112
- reset: { opacity: 1, scale: 1 }
113
- },
114
- disabled: m.value,
115
- onClick: a[0] || (a[0] = (g) => F(C)(c.value))
116
- }, null, 8, ["disabled"])
117
- ], 2)) : N("", !0),
118
- n.showRefresh ? (L(), V("div", {
119
- key: 1,
120
- class: U(["border-r select-none input-border input-control", { "w-12": n.showRefresh }])
121
- }, [
122
- q(_, {
123
- variant: "transparent",
124
- icon: "refresh",
125
- size: "sm",
126
- class: "h-full w-full justify-center",
127
- animate: {
128
- target: "icon",
129
- trigger: "click",
130
- animation: { rotation: 360 },
131
- reset: { rotation: 0 }
132
- },
133
- disabled: m.value,
134
- onClick: A
135
- }, null, 8, ["disabled"])
136
- ], 2)) : N("", !0),
137
- q(R, {
138
- modelValue: c.value,
139
- "onUpdate:modelValue": a[1] || (a[1] = (g) => c.value = g),
140
- type: o.value,
141
- autocomplete: n.autocomplete,
142
- disabled: m.value,
143
- "disable-style": !0,
144
- ref_key: "input",
145
- ref: p,
146
- class: "w-full px-2 input-bg-color input-text-color input-outline input-roundness",
147
- onKeyup: [
148
- a[2] || (a[2] = le((g) => i("enter"), ["enter"])),
149
- n.keyup
150
- ],
151
- onInput: a[3] || (a[3] = (g) => v(c.value))
152
- }, null, 8, ["modelValue", "type", "autocomplete", "disabled", "onKeyup"]),
153
- K("div", ce, [
154
- q(_, {
155
- variant: "transparent",
156
- size: "sm",
157
- class: "h-full w-full justify-center",
158
- icon: o.value === "password" ? "eye" : "eye-off",
159
- disabled: m.value,
160
- onClick: a[4] || (a[4] = (g) => o.value = o.value === "password" ? "text" : "password")
161
- }, null, 8, ["icon", "disabled"])
162
- ])
163
- ]),
164
- n.showStrength ? (L(), se(j, {
165
- key: 0,
166
- value: f.value,
167
- class: "mt-0.5",
168
- height: 2.5,
169
- "show-percentage": !1
170
- }, null, 8, ["value"])) : N("", !0),
171
- h.value ? (L(), V("small", fe, " Last updated " + ae(F(re)(new Date(h.value), "MMMM do yyyy, hh:mm:ss")), 1)) : N("", !0)
172
- ], 2);
173
- };
174
- }
175
- });
176
- export {
177
- ye as _
178
- };