tekivex-ui 2.5.7 → 2.5.9
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/README.md +15 -1
- package/dist/TkxForm-2tGLCPH6.js +326 -0
- package/dist/TkxForm-C2VqR2wC.cjs +12 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.js +264 -251
- package/dist/headless.cjs +1 -1
- package/dist/headless.js +21 -20
- package/dist/index-BgHMZe4Z.js +66 -0
- package/dist/index-Bt5y50Qa.cjs +1 -0
- package/dist/index-DnqXtpwV.cjs +2 -0
- package/dist/{index-CAXjeKoK.js → index-iUUHRxqJ.js} +77 -75
- package/dist/index.cjs +21 -21
- package/dist/index.js +24 -25
- package/dist/quantum.cjs +2 -2
- package/dist/quantum.js +4 -4
- package/dist/realtime.cjs +8 -4
- package/dist/realtime.js +391 -377
- package/dist/{security-loRa1HyV.js → security-C-ZPGoyG.js} +1 -1
- package/dist/{security-DMqZVW5d.cjs → security-Uf0mjv8o.cjs} +1 -1
- package/dist/src/charts/TkxDonutChart.d.ts.map +1 -1
- package/dist/src/charts/TkxPieChart.d.ts.map +1 -1
- package/dist/src/components/TkxForm.d.ts +17 -16
- package/dist/src/components/TkxForm.d.ts.map +1 -1
- package/dist/src/components/TkxLiveMetrics.d.ts.map +1 -1
- package/dist/src/components/TkxPlayground.d.ts.map +1 -1
- package/dist/src/components/TkxProgress.d.ts.map +1 -1
- package/dist/src/themes/index.d.ts.map +1 -1
- package/dist/{tkx-C_AlpMt4.js → tkx-BtHzWKTl.js} +1 -1
- package/dist/{tkx-69KQ0myA.cjs → tkx-C7GvVUE9.cjs} +1 -1
- package/package.json +5 -5
- package/src/charts/TkxDonutChart.tsx +6 -2
- package/src/charts/TkxPieChart.tsx +7 -3
- package/src/charts/shared.ts +4 -4
- package/src/components/TkxForm.tsx +35 -32
- package/src/components/TkxLiveMetrics.tsx +24 -2
- package/src/components/TkxPlayground.tsx +40 -5
- package/src/components/TkxProgress.tsx +0 -2
- package/src/themes/index.ts +8 -1
- package/dist/TkxForm-BK5Sq7oj.cjs +0 -12
- package/dist/TkxForm-br3i_vo8.js +0 -388
- package/dist/index-DB_m7X7e.cjs +0 -2
package/dist/index.js
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
import { u as G, g as St, h as Mn } from "./index-
|
|
2
|
-
import { L as tc, Q as rc, T as nc, a as oc, b as ic, W as sc, c as lc, d as ac, e as cc, f as dc, i as uc, j as fc, k as pc, l as hc, m as mc, n as xc, o as gc, p as bc, q as yc, r as vc, s as kc, t as wc, v as Sc, w as Mc, x as $c, y as Cc, z as Ic, A as Tc, B as Nc, C as Lc, D as zc, E as Ec } from "./index-
|
|
1
|
+
import { u as G, g as St, h as Mn } from "./index-iUUHRxqJ.js";
|
|
2
|
+
import { L as tc, Q as rc, T as nc, a as oc, b as ic, W as sc, c as lc, d as ac, e as cc, f as dc, i as uc, j as fc, k as pc, l as hc, m as mc, n as xc, o as gc, p as bc, q as yc, r as vc, s as kc, t as wc, v as Sc, w as Mc, x as $c, y as Cc, z as Ic, A as Tc, B as Nc, C as Lc, D as zc, E as Ec } from "./index-iUUHRxqJ.js";
|
|
3
3
|
import { jsx as t, jsxs as y, Fragment as Ne } from "react/jsx-runtime";
|
|
4
4
|
import { forwardRef as He, useId as $e, useEffect as Z, useRef as q, useState as j, useContext as Et, createContext as Ht, cloneElement as $n, useMemo as Pe, useCallback as _, useReducer as Cn, Children as In, createElement as ce } from "react";
|
|
5
|
-
import { s as R, v as nn } from "./security-
|
|
6
|
-
import { S as Ac, a as Bc, g as Rc, b as Wc, c as Pc } from "./security-
|
|
7
|
-
import { u as pe, a as on, b as nr, c as wt, d as Tn } from "./
|
|
8
|
-
import {
|
|
9
|
-
import { t as x, c as ke } from "./tkx-
|
|
10
|
-
import { e as
|
|
5
|
+
import { s as R, v as nn } from "./security-C-ZPGoyG.js";
|
|
6
|
+
import { S as Ac, a as Bc, g as Rc, b as Wc, c as Pc } from "./security-C-ZPGoyG.js";
|
|
7
|
+
import { u as pe, a as on, b as nr, c as wt, d as Tn } from "./index-BgHMZe4Z.js";
|
|
8
|
+
import { e as Hc } from "./index-BgHMZe4Z.js";
|
|
9
|
+
import { t as x, c as ke } from "./tkx-BtHzWKTl.js";
|
|
10
|
+
import { e as Vc, r as Yc, a as Oc, b as _c, d as Kc, f as Uc, g as Xc } from "./tkx-BtHzWKTl.js";
|
|
11
11
|
import { createPortal as Ye } from "react-dom";
|
|
12
|
+
import { T as Gc, a as qc, u as Jc } from "./TkxForm-2tGLCPH6.js";
|
|
12
13
|
import { LOCALES as Nn, enUS as Ln, isRTL as zn, I18nContext as En } from "./i18n.js";
|
|
13
|
-
import { useDirection as
|
|
14
|
+
import { useDirection as ed, useI18n as td, useLocale as rd } from "./i18n.js";
|
|
14
15
|
const Dn = {
|
|
15
16
|
sm: "text-xs font-semibold",
|
|
16
17
|
md: "text-sm font-semibold",
|
|
@@ -303,7 +304,6 @@ const On = { sm: "4px", md: "8px", lg: "12px" }, _n = { sm: 32, md: 48, lg: 64 }
|
|
|
303
304
|
"aria-label": i ?? (h ? "Loading" : `${b}%`),
|
|
304
305
|
className: ke(x("inline-flex flex-col items-center gap-1"), l),
|
|
305
306
|
style: a,
|
|
306
|
-
...u,
|
|
307
307
|
children: [
|
|
308
308
|
/* @__PURE__ */ y("svg", { width: g, height: g, viewBox: `0 0 ${g} ${g}`, "aria-hidden": "true", children: [
|
|
309
309
|
/* @__PURE__ */ t("circle", { cx: g / 2, cy: g / 2, r: $, fill: "none", stroke: c.border, strokeWidth: m }),
|
|
@@ -347,7 +347,6 @@ const On = { sm: "4px", md: "8px", lg: "12px" }, _n = { sm: 32, md: 48, lg: 64 }
|
|
|
347
347
|
"aria-label": i ?? (h ? "Loading" : `${b}%`),
|
|
348
348
|
className: ke(x("flex flex-col gap-1 w-full"), l),
|
|
349
349
|
style: a,
|
|
350
|
-
...u,
|
|
351
350
|
children: [
|
|
352
351
|
i && /* @__PURE__ */ y("div", { className: x("flex justify-between text-sm"), style: { color: c.text }, children: [
|
|
353
352
|
/* @__PURE__ */ t("span", { children: i }),
|
|
@@ -16148,8 +16147,8 @@ export {
|
|
|
16148
16147
|
Aa as TkxEmpty,
|
|
16149
16148
|
Jl as TkxFileUpload,
|
|
16150
16149
|
Vs as TkxFooter,
|
|
16151
|
-
|
|
16152
|
-
|
|
16150
|
+
Gc as TkxForm,
|
|
16151
|
+
qc as TkxFormField,
|
|
16153
16152
|
Ps as TkxHeader,
|
|
16154
16153
|
ql as TkxImage,
|
|
16155
16154
|
Hn as TkxInput,
|
|
@@ -16215,7 +16214,7 @@ export {
|
|
|
16215
16214
|
pc as css,
|
|
16216
16215
|
hc as cssVar,
|
|
16217
16216
|
ke as cx,
|
|
16218
|
-
|
|
16217
|
+
Vc as extractAtomicCSS,
|
|
16219
16218
|
mc as extractCSS,
|
|
16220
16219
|
xc as fnv1aHash,
|
|
16221
16220
|
gc as fromObject,
|
|
@@ -16234,36 +16233,36 @@ export {
|
|
|
16234
16233
|
$c as prefersReducedMotion,
|
|
16235
16234
|
Cc as quantumDark,
|
|
16236
16235
|
Ic as radii,
|
|
16237
|
-
|
|
16238
|
-
|
|
16236
|
+
Yc as resetAtomicCSS,
|
|
16237
|
+
Oc as resolvePluginUtility,
|
|
16239
16238
|
Tc as responsive,
|
|
16240
16239
|
Wc as sanitizeProps,
|
|
16241
16240
|
R as sanitizeString,
|
|
16242
16241
|
Nc as shadows,
|
|
16243
16242
|
Lc as spacing,
|
|
16244
16243
|
x as tkx,
|
|
16245
|
-
|
|
16246
|
-
|
|
16247
|
-
|
|
16248
|
-
|
|
16244
|
+
_c as tkxListPlugins,
|
|
16245
|
+
Kc as tkxPlugin,
|
|
16246
|
+
Uc as tkxRemovePlugin,
|
|
16247
|
+
Xc as tx,
|
|
16249
16248
|
zc as typography,
|
|
16250
16249
|
on as useAnnounce,
|
|
16251
16250
|
Tn as useClickOutside,
|
|
16252
16251
|
ya as useComponentSize,
|
|
16253
16252
|
jt as useConfig,
|
|
16254
|
-
|
|
16253
|
+
ed as useDirection,
|
|
16255
16254
|
wt as useEscapeKey,
|
|
16256
16255
|
nr as useFocusTrap,
|
|
16257
|
-
|
|
16258
|
-
|
|
16259
|
-
|
|
16256
|
+
Hc as useHighContrast,
|
|
16257
|
+
td as useI18n,
|
|
16258
|
+
rd as useLocale,
|
|
16260
16259
|
Ia as useLogicalSpacing,
|
|
16261
16260
|
ba as usePrefixCls,
|
|
16262
16261
|
pe as useReducedMotion,
|
|
16263
16262
|
Ca as useRtlFlip,
|
|
16264
16263
|
G as useTheme,
|
|
16265
16264
|
oa as useTkxCommand,
|
|
16266
|
-
|
|
16265
|
+
Jc as useTkxForm,
|
|
16267
16266
|
Xl as useToast,
|
|
16268
16267
|
nn as validateProps,
|
|
16269
16268
|
Pc as verifyAuditIntegrity,
|
package/dist/quantum.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),x=require("react"),Z=require("./index-DB_m7X7e.cjs"),se=require("./tkx-69KQ0myA.cjs"),Y=require("./security-DMqZVW5d.cjs");class R{constructor(e,o){this.re=e,this.im=o}add(e){return new R(this.re+e.re,this.im+e.im)}sub(e){return new R(this.re-e.re,this.im-e.im)}mul(e){return new R(this.re*e.re-this.im*e.im,this.re*e.im+this.im*e.re)}scale(e){return new R(this.re*e,this.im*e)}conjugate(){return new R(this.re,-this.im)}magnitudeSquared(){return this.re*this.re+this.im*this.im}magnitude(){return Math.sqrt(this.magnitudeSquared())}static fromPolar(e,o){return new R(e*Math.cos(o),e*Math.sin(o))}static zero(){return new R(0,0)}static one(){return new R(1,0)}}class I{constructor(e=R.one(),o=R.zero()){this.alpha=e,this.beta=o,this.normalize()}normalize(){const e=Math.sqrt(this.alpha.magnitudeSquared()+this.beta.magnitudeSquared());e>0&&(this.alpha=this.alpha.scale(1/e),this.beta=this.beta.scale(1/e))}hadamard(){const e=1/Math.SQRT2,o=this.alpha.add(this.beta).scale(e),a=this.alpha.sub(this.beta).scale(e);return new I(o,a)}ry(e){const o=Math.cos(e/2),a=Math.sin(e/2),r=this.alpha.scale(o).sub(this.beta.scale(a)),l=this.alpha.scale(a).add(this.beta.scale(o));return new I(r,l)}phase(e){const o=R.fromPolar(1,e);return new I(this.alpha,this.beta.mul(o))}measure(){const e=this.beta.magnitudeSquared();return Math.random()<e?1:0}expectation(){return this.beta.magnitudeSquared()}getAlpha(){return this.alpha}getBeta(){return this.beta}}class ae{constructor(e){this.qubits=Array.from({length:e},()=>new I)}get size(){return this.qubits.length}getQubit(e){return this.qubits[e]}superpose(){this.qubits=this.qubits.map(e=>e.hadamard())}cnot(e,o){const a=this.qubits[e],r=this.qubits[o],l=a.expectation();this.qubits[o]=r.ry(Math.PI*l)}rotate(e,o){this.qubits[e]=this.qubits[e].ry(o)}measure(){return this.qubits.map(e=>e.measure())}probs(){return this.qubits.map(e=>e.expectation())}}class V{constructor(e=1,o=.995,a=.3,r=1e-6){this.temperature=e,this.coolingRate=o,this.tunnelingStrength=a,this.minTemp=r}anneal(e,o,a,r=1e3){let l=e,i=o(l),d=l,s=i,c=this.temperature,g=0,h=0;for(let m=0;m<r&&c>this.minTemp;m++){const b=a(l),p=o(b),v=p-i;let S=!1;if(v<=0)S=!0;else{const k=Math.exp(-v/c),q=Math.sqrt(2*Math.abs(v)),E=Math.abs(v),w=Math.exp(-2*q*Math.sqrt(E)*this.tunnelingStrength);Math.random()<k+w&&(S=!0,Math.random()<w/(k+w+1e-10)&&h++)}S&&(l=b,i=p,g++,i<s&&(d=l,s=i)),c*=this.coolingRate}return{state:d,energy:s,iterations:r,accepted:g,tunnels:h}}}class ie{constructor(e,o){const a=Math.sqrt(2/(e+o));this.weights=Array.from({length:e},()=>Array.from({length:o},()=>(Math.random()*2-1)*a)),this.visibleBias=Array.from({length:e},()=>0),this.hiddenBias=Array.from({length:o},()=>0)}sigmoid(e){const o=(Math.random()-.5)*.1;return 1/(1+Math.exp(-(e+o)))}sample(e){return Math.random()<e?1:0}energy(e,o){const a=this.visibleBias.reduce((i,d,s)=>i+d*e[s],0),r=this.hiddenBias.reduce((i,d,s)=>i+d*o[s],0);let l=0;for(let i=0;i<e.length;i++)for(let d=0;d<o.length;d++)l+=e[i]*this.weights[i][d]*o[d];return-(a+r+l)}hiddenProbs(e){return this.hiddenBias.map((o,a)=>{const r=o+e.reduce((l,i,d)=>l+this.weights[d][a]*i,0);return this.sigmoid(r)})}visibleProbs(e){return this.visibleBias.map((o,a)=>{const r=o+e.reduce((l,i,d)=>l+this.weights[a][d]*i,0);return this.sigmoid(r)})}gibbs(e,o=1){let a=[...e],r=[];for(let l=0;l<o;l++)r=this.hiddenProbs(a).map(i=>this.sample(i)),a=this.visibleProbs(r).map(i=>this.sample(i));return{visible:a,hidden:r}}trainCD1(e,o=.01){const a=this.visibleBias.length,r=this.hiddenBias.length,l=Array.from({length:a},()=>Array(r).fill(0)),i=Array(a).fill(0),d=Array(r).fill(0);for(const c of e){const g=this.hiddenProbs(c),h=g.map(p=>this.sample(p)),m=this.visibleProbs(h).map(p=>this.sample(p)),b=this.hiddenProbs(m);for(let p=0;p<a;p++){for(let v=0;v<r;v++)l[p][v]+=c[p]*g[v]-m[p]*b[v];i[p]+=c[p]-m[p]}for(let p=0;p<r;p++)d[p]+=g[p]-b[p]}const s=e.length;for(let c=0;c<a;c++){for(let g=0;g<r;g++)this.weights[c][g]+=o*l[c][g]/s;this.visibleBias[c]+=o*i[c]/s}for(let c=0;c<r;c++)this.hiddenBias[c]+=o*d[c]/s}infer(e){const o=this.hiddenProbs(e),a=o.map(l=>this.sample(l)),r=this.visibleProbs(a);return{hidden:o,visible:r,energy:this.energy(e,a),iterations:1}}}class G{amplify(e,o,a=.5){const r=e.length;if(r===0)return[];const l=e.map(o),i=l.filter(h=>h>a).length,d=Math.max(1,i);let s=Array(r).fill(1/Math.sqrt(r));const c=Math.max(1,Math.floor(Math.PI/4*Math.sqrt(r/d)));for(let h=0;h<c;h++){for(let b=0;b<r;b++)l[b]>a&&(s[b]=-s[b]);const m=s.reduce((b,p)=>b+p,0)/r;s=s.map(b=>2*m-b)}return e.map((h,m)=>({index:m,amplitude:s[m],probability:s[m]*s[m],classicalSimilarity:l[m],combined:s[m]*s[m]*.6+l[m]*.4})).sort((h,m)=>m.combined-h.combined)}}const J=[{keywords:["email","e-mail","mail"],type:"email",validations:[{rule:"required",message:"Email is required"},{rule:"pattern",value:"^[^@]+@[^@]+\\.[^@]+$",message:"Enter a valid email address"},{rule:"maxLength",value:254,message:"Email too long"}],placeholder:"you@example.com",label:"Email Address",confidence:.98},{keywords:["password","passwd","pwd","pass"],type:"password",validations:[{rule:"required",message:"Password is required"},{rule:"minLength",value:8,message:"Password must be at least 8 characters"},{rule:"pattern",value:"(?=.*[A-Z])(?=.*[0-9])",message:"Include uppercase and a number"}],placeholder:"••••••••",label:"Password",confidence:.97},{keywords:["confirm_password","confirmpassword","confirm_pass","repassword","password2","repeat_password"],type:"password",validations:[{rule:"required",message:"Please confirm your password"},{rule:"match",value:"password",message:"Passwords do not match"}],placeholder:"••••••••",label:"Confirm Password",confidence:.95},{keywords:["phone","mobile","cell","tel","telephone","contact_number"],type:"tel",validations:[{rule:"pattern",value:"^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$",message:"Enter a valid phone number"}],placeholder:"+1 (555) 000-0000",label:"Phone Number",confidence:.93},{keywords:["age"],type:"number",validations:[{rule:"min",value:0,message:"Age cannot be negative"},{rule:"max",value:150,message:"Enter a valid age"},{rule:"integer",message:"Age must be a whole number"}],placeholder:"25",label:"Age",confidence:.9},{keywords:["price","amount","cost","fee","payment","salary","wage","total"],type:"number",validations:[{rule:"min",value:0,message:"Amount cannot be negative"},{rule:"pattern",value:"^\\d+(\\.\\d{1,2})?$",message:"Enter a valid amount (e.g. 9.99)"}],placeholder:"0.00",label:"Amount",confidence:.88},{keywords:["url","website","site","link","homepage","web"],type:"url",validations:[{rule:"pattern",value:"https?://.+",message:"Enter a valid URL starting with http:// or https://"}],placeholder:"https://example.com",label:"Website URL",confidence:.92},{keywords:["zip","zipcode","postal","postcode","pin_code"],type:"text",validations:[{rule:"pattern",value:"^[0-9]{5}(-[0-9]{4})?$",message:"Enter a valid ZIP code (e.g. 12345)"}],placeholder:"12345",label:"ZIP / Postal Code",confidence:.91},{keywords:["date","dob","birthday","birth_date","birthdate","born"],type:"date",validations:[{rule:"required",message:"Date is required"}],placeholder:"YYYY-MM-DD",label:"Date of Birth",confidence:.89},{keywords:["first_name","firstname","fname","given_name"],type:"text",validations:[{rule:"minLength",value:2,message:"First name too short"},{rule:"maxLength",value:50,message:"First name too long"}],placeholder:"Jane",label:"First Name",confidence:.9},{keywords:["last_name","lastname","lname","surname","family_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Last name too short"},{rule:"maxLength",value:50,message:"Last name too long"}],placeholder:"Doe",label:"Last Name",confidence:.9},{keywords:["name","full_name","fullname","display_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Name too short"},{rule:"maxLength",value:100,message:"Name too long"}],placeholder:"Jane Doe",label:"Full Name",confidence:.85},{keywords:["username","user_name","handle","login","loginname"],type:"text",validations:[{rule:"minLength",value:3,message:"Username must be at least 3 characters"},{rule:"maxLength",value:32,message:"Username too long"},{rule:"pattern",value:"^[a-zA-Z0-9_.-]+$",message:"Only letters, numbers, _, - and . allowed"}],placeholder:"cooluser42",label:"Username",confidence:.94},{keywords:["bio","biography","about","description","summary","details"],type:"textarea",validations:[{rule:"maxLength",value:500,message:"Bio must be under 500 characters"}],placeholder:"Tell us about yourself...",label:"Bio",confidence:.87},{keywords:["message","comment","feedback","note","notes","remarks","body"],type:"textarea",validations:[{rule:"minLength",value:10,message:"Message too short"},{rule:"maxLength",value:2e3,message:"Message too long"}],placeholder:"Write your message here...",label:"Message",confidence:.86},{keywords:["search","query","q","keyword","find"],type:"search",validations:[],placeholder:"Search...",label:"Search",confidence:.9},{keywords:["otp","one_time_password","verification_code","pin","code"],type:"text",validations:[{rule:"minLength",value:4,message:"Code too short"},{rule:"maxLength",value:8,message:"Code too long"},{rule:"pattern",value:"^[0-9]+$",message:"Code must be numeric"}],placeholder:"123456",label:"Verification Code",confidence:.92},{keywords:["color","colour","hex_color","brand_color"],type:"color",validations:[],placeholder:"#3b82f6",label:"Color",confidence:.95},{keywords:["address","street","street_address","addr"],type:"text",validations:[{rule:"maxLength",value:200,message:"Address too long"}],placeholder:"123 Main Street",label:"Street Address",confidence:.87},{keywords:["city","town","municipality"],type:"text",validations:[{rule:"maxLength",value:100,message:"City name too long"}],placeholder:"San Francisco",label:"City",confidence:.89},{keywords:["country","nation","country_code"],type:"text",validations:[],placeholder:"United States",label:"Country",confidence:.88},{keywords:["company","organization","org","employer","company_name"],type:"text",validations:[{rule:"maxLength",value:200,message:"Company name too long"}],placeholder:"Acme Inc.",label:"Company",confidence:.87}];function X(n){const e=n.toLowerCase().replace(/[\s-]/g,"_"),a=new G().amplify(J,r=>{let l=0;for(const i of r.keywords)e===i?l=Math.max(l,1):e.includes(i)||i.includes(e)?l=Math.max(l,.8):i.split("_").some(d=>e.includes(d))&&(l=Math.max(l,.5));return l},.3);if(a.length>0&&a[0].combined>.1){const r=J[a[0].index];return{type:r.type,validations:r.validations,placeholder:r.placeholder,confidence:Math.min(r.confidence*a[0].combined*2,.99),label:r.label}}return{type:"text",validations:[{rule:"maxLength",value:255,message:"Input too long"}],placeholder:n.replace(/_/g," "),confidence:.3,label:n.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}}function O(n,e,o){const a=e/100,r=o/100,l=a*Math.min(r,1-r),i=d=>{const s=(d+n/30)%12,c=r-l*Math.max(Math.min(s-3,9-s,1),-1);return Math.round(255*c).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}function ue(n){const e=n.replace("#",""),o=e.length===3?e.split("").map(a=>a+a).join(""):e;return[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16)]}function K(n){const[e,o,a]=ue(n).map(r=>{const l=r/255;return l<=.03928?l/12.92:((l+.055)/1.055)**2.4});return .2126*e+.7152*o+.0722*a}function H(n,e){const o=K(n),a=K(e),r=Math.max(o,a),l=Math.min(o,a);return(r+.05)/(l+.05)}function pe(n,e){const o=r=>O(r.h,r.s,r.l),a=e?n.text.l-20:n.text.l+15;return{primary:o(n.primary),secondary:o(n.secondary),background:o(n.bg),surface:o(n.surface),text:o(n.text),textMuted:O(n.text.h,Math.max(0,n.text.s-10),Math.max(20,Math.min(85,a))),border:o(n.border),error:e?"#f87171":"#dc2626",warning:e?"#fbbf24":"#d97706",success:e?"#34d399":"#059669",accent:o(n.accent)}}function he(n,e){let o=0;const a=k=>O(k.h,k.s,k.l),r=a(n.text),l=a(n.bg),i=a(n.surface),d=a(n.primary),s=H(r,l),c=H(r,i),g=H(d,l);s<4.5&&(o+=(4.5-s)*10),c<4.5&&(o+=(4.5-c)*8),g<3&&(o+=(3-g)*5);const m=Math.abs((n.secondary.h-n.primary.h+360)%360-137.508);o+=m*.05;const b=Math.abs((n.accent.h-n.primary.h+360)%360-120);o+=b*.03;const p=(n.primary.s+n.secondary.s)/2;p<20&&(o+=(20-p)*.5),p>90&&(o+=(p-90)*.5);const v=n.bg.l;e?(v>25&&(o+=(v-25)*2),v<3&&(o+=(3-v)*2),n.text.l<70&&(o+=(70-n.text.l)*1.5)):(v<90&&(o+=(90-v)*2),v>100&&(o+=(v-100)*2),n.text.l>30&&(o+=(n.text.l-30)*1.5));const S=Math.abs(n.surface.l-n.bg.l);return S<2&&(o+=(2-S)*2),S>12&&(o+=(S-12)*1),o}function ee(n,e,o){return Math.max(e,Math.min(o,n))}function le(n,e,o=800){const a=e?{primary:{h:n,s:70,l:55},secondary:{h:(n+137.5)%360,s:65,l:50},bg:{h:n,s:10,l:8},surface:{h:n,s:10,l:13},text:{h:n,s:15,l:90},border:{h:n,s:15,l:22},accent:{h:(n+120)%360,s:75,l:60}}:{primary:{h:n,s:65,l:40},secondary:{h:(n+137.5)%360,s:55,l:38},bg:{h:n,s:15,l:97},surface:{h:n,s:12,l:100},text:{h:n,s:15,l:12},border:{h:n,s:12,l:85},accent:{h:(n+120)%360,s:70,l:42}},l=new V(1.5,.994,.35,1e-5).anneal(a,i=>he(i,e),i=>{const d=["primary","secondary","bg","surface","text","border","accent"],s=d[Math.floor(Math.random()*d.length)],c=["h","s","l"],g=c[Math.floor(Math.random()*c.length)],h=(Math.random()-.5)*(g==="h"?30:15),m={...i,[s]:{...i[s]}};return g==="h"?m[s]={...m[s],h:(i[s].h+h+360)%360}:g==="s"?m[s]={...m[s],s:ee(i[s].s+h,0,100)}:m[s]={...m[s],l:ee(i[s].l+h,0,100)},m},o);return pe(l.state,e)}const U={qubit(){return new I},register(n){return new ae(n)},annealer(n,e,o){return new V(n,e,o)},qbm(n,e){return new ie(n,e)},amplifier(){return new G},inferField:X,optimizeTheme:le,contrast:H,hslToHex:O};function me(n,e,o,a){const r=o.trim();switch(n){case"required":return r!=="";case"email":case"pattern":if(typeof e=="string")try{return r===""||new RegExp(e).test(r)}catch{return!0}return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);case"phone":return r===""||/^\+?[\d\s\-()]{7,15}$/.test(r);case"url":return r===""||/^https?:\/\/.+/.test(r);case"minLength":case"min":{const l=Number(e??0);return r===""||(isNaN(Number(r))?r.length>=l:Number(r)>=l)}case"maxLength":case"max":{const l=Number(e??1/0);return r===""||(isNaN(Number(r))?r.length<=l:Number(r)<=l)}case"integer":return r===""||/^\d+$/.test(r);case"alphanumeric":return r===""||/^[a-zA-Z0-9]+$/.test(r);case"match":return r===(a[typeof e=="string"?e:"password"]??"");default:return!0}}function xe({phase:n,collapsed:e,primaryColor:o,borderColor:a}){const d=e?0:n,s=e?0:n*1.618,c=12+10*Math.sin(d)*Math.cos(s),g=12-10*Math.cos(d);return t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",style:{flexShrink:0,opacity:e?.4:1,transition:"opacity 0.6s"},children:[t.jsx("circle",{cx:12,cy:12,r:10,fill:"none",stroke:a,strokeWidth:"0.8"}),t.jsx("ellipse",{cx:12,cy:12,rx:10,ry:10*.3,fill:"none",stroke:a,strokeWidth:"0.5",strokeDasharray:"2 2"}),t.jsx("line",{x1:12,y1:2,x2:12,y2:22,stroke:a,strokeWidth:"0.5"}),t.jsx("line",{x1:12,y1:12,x2:c,y2:g,stroke:o,strokeWidth:"1.5",style:{transition:e?"all 0.6s ease-out":"none"}}),t.jsx("circle",{cx:c,cy:g,r:"2",fill:o,style:{transition:e?"all 0.6s ease-out":"none"}})]})}function ge({confidence:n,theme:e}){const o=Math.round(n*100),a=o>=80?e.success:o>=60?e.warning:e.danger;return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",fontSize:"10px",fontWeight:600,padding:"1px 5px",borderRadius:"999px",backgroundColor:`${a}22`,color:a,border:`1px solid ${a}44`,marginLeft:"6px",verticalAlign:"middle",letterSpacing:"0.03em"},children:["⚛ ",o,"%"]})}function fe({config:n,intel:e,qubitPhase:o,value:a,error:r,touched:l,showConfidence:i,showQuantumState:d,collapsed:s,onChange:c,onBlur:g,theme:h,mounted:m,index:b}){const p=n.type??e.type,v=n.label??e.label,S=n.placeholder??e.placeholder,k=n.required!==void 0?n.required:e.validations.some($=>$.rule==="required"),q=Y.sanitizeString(v),E=p==="textarea",w=l&&r!=="",A=`qf-${n.name}`,W={width:"100%",padding:"9px 12px",border:`1.5px solid ${w?h.danger:h.border}`,borderRadius:"8px",backgroundColor:h.surface,color:h.text,fontSize:"14px",fontFamily:"inherit",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",resize:E?"vertical":void 0,minHeight:E?"80px":void 0};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px",opacity:m?1:0,transform:m?"scaleY(1)":"scaleY(0.92)",transition:`opacity 0.35s ease ${b*60}ms, transform 0.35s ease ${b*60}ms`,transformOrigin:"top"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[d&&t.jsx(xe,{phase:o,collapsed:s,primaryColor:h.primary,borderColor:h.border}),t.jsxs("label",{htmlFor:A,style:{fontSize:"13px",fontWeight:500,color:h.text,cursor:"pointer"},children:[q,k&&t.jsx("span",{"aria-hidden":"true",style:{color:h.danger,marginLeft:"3px"},children:"*"})]}),i&&t.jsx(ge,{confidence:e.confidence,theme:h})]}),E?t.jsx("textarea",{id:A,value:a,onChange:$=>c($.target.value),onBlur:g,placeholder:S,"aria-invalid":w,"aria-required":k,style:W}):t.jsx("input",{id:A,type:p,value:a,onChange:$=>c($.target.value),onBlur:g,placeholder:S,"aria-invalid":w,"aria-required":k,style:W}),w&&t.jsxs("span",{role:"alert",style:{fontSize:"12px",color:h.danger,display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Y.sanitizeString(r)]})]})}function ye(n){let e=2166136261;for(let o=0;o<n.length;o++)e^=n.charCodeAt(o),e=Math.imul(e,16777619)>>>0;return(e&65535)/65535*Math.PI*2}function de({fields:n,onSubmit:e,submitLabel:o="Submit",layout:a="vertical",showConfidence:r=!0,showQuantumState:l=!1}){const i=Z.useTheme(),d=n.map(f=>X(f.name)),[s,c]=x.useState(()=>Object.fromEntries(n.map(f=>[f.name,""]))),[g,h]=x.useState({}),[m,b]=x.useState({}),[p,v]=x.useState(!1),[S,k]=x.useState(!1),[q,E]=x.useState(!1);x.useEffect(()=>{const f=requestAnimationFrame(()=>k(!0));return()=>cancelAnimationFrame(f)},[]);const w=x.useCallback((f,u)=>{const y=n.find(M=>M.name===f),C=d[n.findIndex(M=>M.name===f)];if(!y||!C)return"";const j=u[f]??"";for(const{rule:M,value:P,message:_}of C.validations)if(!(M==="required"&&y.required===!1)&&!me(M,P,j,u))return _;return""},[n]),A=x.useCallback(f=>{const u={};for(const y of n){const C=w(y.name,f);C&&(u[y.name]=C)}return u},[n,w]),W=x.useCallback((f,u)=>{c(y=>{var j;const C={...y,[f]:u};if(m[f]&&(h(M=>({...M,[f]:w(f,C)})),f==="password")){const M=(j=n.find(P=>["confirmpassword","confirm_password","passwordconfirm"].includes(P.name.toLowerCase().replace(/[\s_-]/g,""))))==null?void 0:j.name;M&&m[M]&&h(P=>({...P,[M]:w(M,C)}))}return C}),E(!0)},[n,m,w]),$=x.useCallback(f=>{b(u=>({...u,[f]:!0})),h(u=>({...u,[f]:w(f,s)}))},[s,w]),N=x.useCallback(async f=>{f.preventDefault();const u=Object.fromEntries(n.map(C=>[C.name,!0]));b(u);const y=A(s);if(h(y),!(Object.keys(y).length>0)){v(!0);try{await e(s)}finally{v(!1)}}},[n,s,A,e]),B=d.length>0?Math.round(d.reduce((f,u)=>f+u.confidence,0)/d.length*100):0,F=B>=80?i.success:B>=60?i.warning:i.danger,L=a==="horizontal";return t.jsxs("form",{onSubmit:N,noValidate:!0,className:se.tkx("w-full"),style:{backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:"12px",padding:"24px",position:"relative",boxSizing:"border-box"},children:[t.jsx("span",{"aria-label":"Powered by Quantum AI",style:{position:"absolute",top:"16px",right:"16px",fontSize:"10px",fontWeight:700,padding:"3px 8px",borderRadius:"999px",backgroundColor:`${i.primary}20`,color:i.primary,border:`1px solid ${i.primary}44`,letterSpacing:"0.04em",userSelect:"none"},children:"⚛ Quantum AI"}),r&&t.jsxs("div",{style:{marginBottom:"20px",paddingRight:"100px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[t.jsx("span",{style:{fontSize:"11px",color:i.textMuted,fontWeight:500},children:"Form Intelligence Confidence"}),t.jsxs("span",{style:{fontSize:"11px",fontWeight:700,color:F},children:[B,"%"]})]}),t.jsx("div",{style:{height:"4px",borderRadius:"4px",backgroundColor:i.border,overflow:"hidden"},children:t.jsx("div",{style:{height:"100%",width:`${B}%`,backgroundColor:F,borderRadius:"4px",transition:"width 0.8s ease"}})})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:L?"repeat(auto-fill, minmax(260px, 1fr))":"1fr",gap:"16px",marginBottom:"20px"},children:n.map((f,u)=>t.jsx(fe,{config:f,intel:d[u],qubitPhase:ye(f.name),value:s[f.name]??"",error:g[f.name]??"",touched:m[f.name]??!1,showConfidence:r,showQuantumState:l,collapsed:q,onChange:y=>W(f.name,y),onBlur:()=>$(f.name),theme:i,mounted:S,index:u},f.name))}),t.jsx("button",{type:"submit",disabled:p,style:{width:"100%",padding:"10px 20px",borderRadius:"8px",border:"none",backgroundColor:p?`${i.primary}88`:i.primary,color:i.bg,fontSize:"14px",fontWeight:700,fontFamily:"inherit",cursor:p?"not-allowed":"pointer",transition:"background-color 0.15s, opacity 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:p?t.jsxs(t.Fragment,{children:[t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{animation:"qf-spin 0.8s linear infinite"},"aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),t.jsx("path",{d:"M12 2a10 10 0 0 1 10 10"})]}),"Processing…"]}):Y.sanitizeString(o)}),t.jsx("style",{children:"@keyframes qf-spin { to { transform: rotate(360deg); } }"})]})}de.displayName="TkxQuantumForm";function te(n){return n?{primary:"#00f5d4",secondary:"#7b2ff7",background:"#0a0a0f",surface:"#12121a",text:"#e8e8f4",textMuted:"#8888aa",border:"#2a2a3e",error:"#f87171",warning:"#fbbf24",success:"#34d399",accent:"#ff6b6b"}:{primary:"#0d7c5f",secondary:"#6930c3",background:"#f8f6f1",surface:"#ffffff",text:"#1a1815",textMuted:"#6b6560",border:"#ddd8cc",error:"#dc2626",warning:"#d97706",success:"#059669",accent:"#e05a00"}}function be({points:n,primary:e}){if(n.length<2)return t.jsx("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#888",fontSize:12},children:"Waiting for data..."});const o=280,a=48,r=Math.max(...n.map(c=>c.energy)),l=Math.min(...n.map(c=>c.energy)),i=r-l||1,d=n[n.length-1].iteration||1,s=n.map(c=>{const g=c.iteration/d*o,h=a-(c.energy-l)/i*(a-4)-2;return`${g.toFixed(1)},${h.toFixed(1)}`}).join(" ");return t.jsxs("svg",{width:o,height:a,style:{display:"block"},children:[t.jsx("polyline",{points:s,fill:"none",stroke:e,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",opacity:.9}),t.jsxs("text",{x:2,y:10,fontSize:9,fill:"#888",children:["E=",r.toFixed(1)]}),t.jsxs("text",{x:2,y:a-2,fontSize:9,fill:"#888",children:["E=",l.toFixed(1)]})]})}function ve({label:n,value:e,onChange:o,text:a,border:r}){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[t.jsx("input",{type:"color",value:e,onChange:l=>o(l.target.value),style:{width:32,height:32,border:`1px solid ${r}`,borderRadius:6,padding:2,cursor:"pointer",background:"transparent"}}),t.jsx("div",{style:{width:60,height:28,borderRadius:6,background:e,border:`1px solid ${r}`}}),t.jsx("span",{style:{flex:1,fontSize:13,color:a,fontFamily:"monospace"},children:n}),t.jsx("code",{style:{fontSize:12,color:a,opacity:.7,fontFamily:"monospace"},children:e})]})}function ke({label:n,ratio:e}){const o=e>=4.5,a=e>=4.5,r=e>=7;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[t.jsx("span",{style:{fontSize:11,opacity:.8,minWidth:140},children:n}),t.jsxs("span",{style:{fontSize:12,fontWeight:600},children:[e.toFixed(2),":1"]}),t.jsx("span",{style:{fontSize:11,color:a?"#22c55e":"#ef4444"},children:a?"✓ AA":"✗ AA"}),t.jsx("span",{style:{fontSize:11,color:r?"#22c55e":"#888"},children:r?"✓ AAA":"— AAA"}),t.jsx("span",{style:{fontSize:13},children:o?"✅":"❌"})]})}function we({onThemeChange:n,initialHue:e=210,initialMode:o="dark"}){const a=Z.useTheme(),[r,l]=x.useState(o),[i,d]=x.useState(e),[s,c]=x.useState(()=>te(o==="dark")),[g,h]=x.useState(!1),[m,b]=x.useState([]),[p,v]=x.useState(!1),S=x.useRef(null),k=r==="dark",q=x.useCallback((u,y)=>{c(C=>{const j={...C,[u]:y};return n==null||n(j),j})},[n]),E=x.useCallback(()=>{if(g)return;h(!0),b([]);let u=0;const y=600,C=60,j=[],M=()=>{u+=C,U.optimizeTheme(i,k,u);const P=u/y,_=50*(1-P)+2,Q=(Math.random()-.5)*8*(1-P*.8);if(j.push({iteration:u,energy:Math.max(0,_+Q)}),b([...j]),u<y)S.current=window.setTimeout(M,40);else{const z=U.optimizeTheme(i,k,1e3);c(z),n==null||n(z),h(!1)}};S.current=window.setTimeout(M,16)},[i,k,g,n]),w=x.useCallback(()=>{const u=r==="dark"?"light":"dark";l(u);const y=te(u==="dark");c(y),n==null||n(y)},[r,n]),A=x.useCallback(()=>{const u=`export const myTheme = {
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),x=require("react"),Z=require("./index-DnqXtpwV.cjs"),se=require("./tkx-C7GvVUE9.cjs"),Y=require("./security-Uf0mjv8o.cjs");class R{constructor(e,o){this.re=e,this.im=o}add(e){return new R(this.re+e.re,this.im+e.im)}sub(e){return new R(this.re-e.re,this.im-e.im)}mul(e){return new R(this.re*e.re-this.im*e.im,this.re*e.im+this.im*e.re)}scale(e){return new R(this.re*e,this.im*e)}conjugate(){return new R(this.re,-this.im)}magnitudeSquared(){return this.re*this.re+this.im*this.im}magnitude(){return Math.sqrt(this.magnitudeSquared())}static fromPolar(e,o){return new R(e*Math.cos(o),e*Math.sin(o))}static zero(){return new R(0,0)}static one(){return new R(1,0)}}class I{constructor(e=R.one(),o=R.zero()){this.alpha=e,this.beta=o,this.normalize()}normalize(){const e=Math.sqrt(this.alpha.magnitudeSquared()+this.beta.magnitudeSquared());e>0&&(this.alpha=this.alpha.scale(1/e),this.beta=this.beta.scale(1/e))}hadamard(){const e=1/Math.SQRT2,o=this.alpha.add(this.beta).scale(e),a=this.alpha.sub(this.beta).scale(e);return new I(o,a)}ry(e){const o=Math.cos(e/2),a=Math.sin(e/2),r=this.alpha.scale(o).sub(this.beta.scale(a)),l=this.alpha.scale(a).add(this.beta.scale(o));return new I(r,l)}phase(e){const o=R.fromPolar(1,e);return new I(this.alpha,this.beta.mul(o))}measure(){const e=this.beta.magnitudeSquared();return Math.random()<e?1:0}expectation(){return this.beta.magnitudeSquared()}getAlpha(){return this.alpha}getBeta(){return this.beta}}class ae{constructor(e){this.qubits=Array.from({length:e},()=>new I)}get size(){return this.qubits.length}getQubit(e){return this.qubits[e]}superpose(){this.qubits=this.qubits.map(e=>e.hadamard())}cnot(e,o){const a=this.qubits[e],r=this.qubits[o],l=a.expectation();this.qubits[o]=r.ry(Math.PI*l)}rotate(e,o){this.qubits[e]=this.qubits[e].ry(o)}measure(){return this.qubits.map(e=>e.measure())}probs(){return this.qubits.map(e=>e.expectation())}}class V{constructor(e=1,o=.995,a=.3,r=1e-6){this.temperature=e,this.coolingRate=o,this.tunnelingStrength=a,this.minTemp=r}anneal(e,o,a,r=1e3){let l=e,i=o(l),d=l,s=i,c=this.temperature,g=0,h=0;for(let m=0;m<r&&c>this.minTemp;m++){const b=a(l),p=o(b),v=p-i;let S=!1;if(v<=0)S=!0;else{const k=Math.exp(-v/c),q=Math.sqrt(2*Math.abs(v)),E=Math.abs(v),w=Math.exp(-2*q*Math.sqrt(E)*this.tunnelingStrength);Math.random()<k+w&&(S=!0,Math.random()<w/(k+w+1e-10)&&h++)}S&&(l=b,i=p,g++,i<s&&(d=l,s=i)),c*=this.coolingRate}return{state:d,energy:s,iterations:r,accepted:g,tunnels:h}}}class ie{constructor(e,o){const a=Math.sqrt(2/(e+o));this.weights=Array.from({length:e},()=>Array.from({length:o},()=>(Math.random()*2-1)*a)),this.visibleBias=Array.from({length:e},()=>0),this.hiddenBias=Array.from({length:o},()=>0)}sigmoid(e){const o=(Math.random()-.5)*.1;return 1/(1+Math.exp(-(e+o)))}sample(e){return Math.random()<e?1:0}energy(e,o){const a=this.visibleBias.reduce((i,d,s)=>i+d*e[s],0),r=this.hiddenBias.reduce((i,d,s)=>i+d*o[s],0);let l=0;for(let i=0;i<e.length;i++)for(let d=0;d<o.length;d++)l+=e[i]*this.weights[i][d]*o[d];return-(a+r+l)}hiddenProbs(e){return this.hiddenBias.map((o,a)=>{const r=o+e.reduce((l,i,d)=>l+this.weights[d][a]*i,0);return this.sigmoid(r)})}visibleProbs(e){return this.visibleBias.map((o,a)=>{const r=o+e.reduce((l,i,d)=>l+this.weights[a][d]*i,0);return this.sigmoid(r)})}gibbs(e,o=1){let a=[...e],r=[];for(let l=0;l<o;l++)r=this.hiddenProbs(a).map(i=>this.sample(i)),a=this.visibleProbs(r).map(i=>this.sample(i));return{visible:a,hidden:r}}trainCD1(e,o=.01){const a=this.visibleBias.length,r=this.hiddenBias.length,l=Array.from({length:a},()=>Array(r).fill(0)),i=Array(a).fill(0),d=Array(r).fill(0);for(const c of e){const g=this.hiddenProbs(c),h=g.map(p=>this.sample(p)),m=this.visibleProbs(h).map(p=>this.sample(p)),b=this.hiddenProbs(m);for(let p=0;p<a;p++){for(let v=0;v<r;v++)l[p][v]+=c[p]*g[v]-m[p]*b[v];i[p]+=c[p]-m[p]}for(let p=0;p<r;p++)d[p]+=g[p]-b[p]}const s=e.length;for(let c=0;c<a;c++){for(let g=0;g<r;g++)this.weights[c][g]+=o*l[c][g]/s;this.visibleBias[c]+=o*i[c]/s}for(let c=0;c<r;c++)this.hiddenBias[c]+=o*d[c]/s}infer(e){const o=this.hiddenProbs(e),a=o.map(l=>this.sample(l)),r=this.visibleProbs(a);return{hidden:o,visible:r,energy:this.energy(e,a),iterations:1}}}class G{amplify(e,o,a=.5){const r=e.length;if(r===0)return[];const l=e.map(o),i=l.filter(h=>h>a).length,d=Math.max(1,i);let s=Array(r).fill(1/Math.sqrt(r));const c=Math.max(1,Math.floor(Math.PI/4*Math.sqrt(r/d)));for(let h=0;h<c;h++){for(let b=0;b<r;b++)l[b]>a&&(s[b]=-s[b]);const m=s.reduce((b,p)=>b+p,0)/r;s=s.map(b=>2*m-b)}return e.map((h,m)=>({index:m,amplitude:s[m],probability:s[m]*s[m],classicalSimilarity:l[m],combined:s[m]*s[m]*.6+l[m]*.4})).sort((h,m)=>m.combined-h.combined)}}const J=[{keywords:["email","e-mail","mail"],type:"email",validations:[{rule:"required",message:"Email is required"},{rule:"pattern",value:"^[^@]+@[^@]+\\.[^@]+$",message:"Enter a valid email address"},{rule:"maxLength",value:254,message:"Email too long"}],placeholder:"you@example.com",label:"Email Address",confidence:.98},{keywords:["password","passwd","pwd","pass"],type:"password",validations:[{rule:"required",message:"Password is required"},{rule:"minLength",value:8,message:"Password must be at least 8 characters"},{rule:"pattern",value:"(?=.*[A-Z])(?=.*[0-9])",message:"Include uppercase and a number"}],placeholder:"••••••••",label:"Password",confidence:.97},{keywords:["confirm_password","confirmpassword","confirm_pass","repassword","password2","repeat_password"],type:"password",validations:[{rule:"required",message:"Please confirm your password"},{rule:"match",value:"password",message:"Passwords do not match"}],placeholder:"••••••••",label:"Confirm Password",confidence:.95},{keywords:["phone","mobile","cell","tel","telephone","contact_number"],type:"tel",validations:[{rule:"pattern",value:"^[+]?[(]?[0-9]{3}[)]?[-\\s.]?[0-9]{3}[-\\s.]?[0-9]{4,6}$",message:"Enter a valid phone number"}],placeholder:"+1 (555) 000-0000",label:"Phone Number",confidence:.93},{keywords:["age"],type:"number",validations:[{rule:"min",value:0,message:"Age cannot be negative"},{rule:"max",value:150,message:"Enter a valid age"},{rule:"integer",message:"Age must be a whole number"}],placeholder:"25",label:"Age",confidence:.9},{keywords:["price","amount","cost","fee","payment","salary","wage","total"],type:"number",validations:[{rule:"min",value:0,message:"Amount cannot be negative"},{rule:"pattern",value:"^\\d+(\\.\\d{1,2})?$",message:"Enter a valid amount (e.g. 9.99)"}],placeholder:"0.00",label:"Amount",confidence:.88},{keywords:["url","website","site","link","homepage","web"],type:"url",validations:[{rule:"pattern",value:"https?://.+",message:"Enter a valid URL starting with http:// or https://"}],placeholder:"https://example.com",label:"Website URL",confidence:.92},{keywords:["zip","zipcode","postal","postcode","pin_code"],type:"text",validations:[{rule:"pattern",value:"^[0-9]{5}(-[0-9]{4})?$",message:"Enter a valid ZIP code (e.g. 12345)"}],placeholder:"12345",label:"ZIP / Postal Code",confidence:.91},{keywords:["date","dob","birthday","birth_date","birthdate","born"],type:"date",validations:[{rule:"required",message:"Date is required"}],placeholder:"YYYY-MM-DD",label:"Date of Birth",confidence:.89},{keywords:["first_name","firstname","fname","given_name"],type:"text",validations:[{rule:"minLength",value:2,message:"First name too short"},{rule:"maxLength",value:50,message:"First name too long"}],placeholder:"Jane",label:"First Name",confidence:.9},{keywords:["last_name","lastname","lname","surname","family_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Last name too short"},{rule:"maxLength",value:50,message:"Last name too long"}],placeholder:"Doe",label:"Last Name",confidence:.9},{keywords:["name","full_name","fullname","display_name"],type:"text",validations:[{rule:"minLength",value:2,message:"Name too short"},{rule:"maxLength",value:100,message:"Name too long"}],placeholder:"Jane Doe",label:"Full Name",confidence:.85},{keywords:["username","user_name","handle","login","loginname"],type:"text",validations:[{rule:"minLength",value:3,message:"Username must be at least 3 characters"},{rule:"maxLength",value:32,message:"Username too long"},{rule:"pattern",value:"^[a-zA-Z0-9_.-]+$",message:"Only letters, numbers, _, - and . allowed"}],placeholder:"cooluser42",label:"Username",confidence:.94},{keywords:["bio","biography","about","description","summary","details"],type:"textarea",validations:[{rule:"maxLength",value:500,message:"Bio must be under 500 characters"}],placeholder:"Tell us about yourself...",label:"Bio",confidence:.87},{keywords:["message","comment","feedback","note","notes","remarks","body"],type:"textarea",validations:[{rule:"minLength",value:10,message:"Message too short"},{rule:"maxLength",value:2e3,message:"Message too long"}],placeholder:"Write your message here...",label:"Message",confidence:.86},{keywords:["search","query","q","keyword","find"],type:"search",validations:[],placeholder:"Search...",label:"Search",confidence:.9},{keywords:["otp","one_time_password","verification_code","pin","code"],type:"text",validations:[{rule:"minLength",value:4,message:"Code too short"},{rule:"maxLength",value:8,message:"Code too long"},{rule:"pattern",value:"^[0-9]+$",message:"Code must be numeric"}],placeholder:"123456",label:"Verification Code",confidence:.92},{keywords:["color","colour","hex_color","brand_color"],type:"color",validations:[],placeholder:"#3b82f6",label:"Color",confidence:.95},{keywords:["address","street","street_address","addr"],type:"text",validations:[{rule:"maxLength",value:200,message:"Address too long"}],placeholder:"123 Main Street",label:"Street Address",confidence:.87},{keywords:["city","town","municipality"],type:"text",validations:[{rule:"maxLength",value:100,message:"City name too long"}],placeholder:"San Francisco",label:"City",confidence:.89},{keywords:["country","nation","country_code"],type:"text",validations:[],placeholder:"United States",label:"Country",confidence:.88},{keywords:["company","organization","org","employer","company_name"],type:"text",validations:[{rule:"maxLength",value:200,message:"Company name too long"}],placeholder:"Acme Inc.",label:"Company",confidence:.87}];function X(n){const e=n.toLowerCase().replace(/[\s-]/g,"_"),a=new G().amplify(J,r=>{let l=0;for(const i of r.keywords)e===i?l=Math.max(l,1):e.includes(i)||i.includes(e)?l=Math.max(l,.8):i.split("_").some(d=>e.includes(d))&&(l=Math.max(l,.5));return l},.3);if(a.length>0&&a[0].combined>.1){const r=J[a[0].index];return{type:r.type,validations:r.validations,placeholder:r.placeholder,confidence:Math.min(r.confidence*a[0].combined*2,.99),label:r.label}}return{type:"text",validations:[{rule:"maxLength",value:255,message:"Input too long"}],placeholder:n.replace(/_/g," "),confidence:.3,label:n.replace(/_/g," ").replace(/\b\w/g,r=>r.toUpperCase())}}function O(n,e,o){const a=e/100,r=o/100,l=a*Math.min(r,1-r),i=d=>{const s=(d+n/30)%12,c=r-l*Math.max(Math.min(s-3,9-s,1),-1);return Math.round(255*c).toString(16).padStart(2,"0")};return`#${i(0)}${i(8)}${i(4)}`}function ue(n){const e=n.replace("#",""),o=e.length===3?e.split("").map(a=>a+a).join(""):e;return[parseInt(o.slice(0,2),16),parseInt(o.slice(2,4),16),parseInt(o.slice(4,6),16)]}function K(n){const[e,o,a]=ue(n).map(r=>{const l=r/255;return l<=.03928?l/12.92:((l+.055)/1.055)**2.4});return .2126*e+.7152*o+.0722*a}function H(n,e){const o=K(n),a=K(e),r=Math.max(o,a),l=Math.min(o,a);return(r+.05)/(l+.05)}function pe(n,e){const o=r=>O(r.h,r.s,r.l),a=e?n.text.l-20:n.text.l+15;return{primary:o(n.primary),secondary:o(n.secondary),background:o(n.bg),surface:o(n.surface),text:o(n.text),textMuted:O(n.text.h,Math.max(0,n.text.s-10),Math.max(20,Math.min(85,a))),border:o(n.border),error:e?"#f87171":"#dc2626",warning:e?"#fbbf24":"#d97706",success:e?"#34d399":"#059669",accent:o(n.accent)}}function he(n,e){let o=0;const a=k=>O(k.h,k.s,k.l),r=a(n.text),l=a(n.bg),i=a(n.surface),d=a(n.primary),s=H(r,l),c=H(r,i),g=H(d,l);s<4.5&&(o+=(4.5-s)*10),c<4.5&&(o+=(4.5-c)*8),g<3&&(o+=(3-g)*5);const m=Math.abs((n.secondary.h-n.primary.h+360)%360-137.508);o+=m*.05;const b=Math.abs((n.accent.h-n.primary.h+360)%360-120);o+=b*.03;const p=(n.primary.s+n.secondary.s)/2;p<20&&(o+=(20-p)*.5),p>90&&(o+=(p-90)*.5);const v=n.bg.l;e?(v>25&&(o+=(v-25)*2),v<3&&(o+=(3-v)*2),n.text.l<70&&(o+=(70-n.text.l)*1.5)):(v<90&&(o+=(90-v)*2),v>100&&(o+=(v-100)*2),n.text.l>30&&(o+=(n.text.l-30)*1.5));const S=Math.abs(n.surface.l-n.bg.l);return S<2&&(o+=(2-S)*2),S>12&&(o+=(S-12)*1),o}function ee(n,e,o){return Math.max(e,Math.min(o,n))}function le(n,e,o=800){const a=e?{primary:{h:n,s:70,l:55},secondary:{h:(n+137.5)%360,s:65,l:50},bg:{h:n,s:10,l:8},surface:{h:n,s:10,l:13},text:{h:n,s:15,l:90},border:{h:n,s:15,l:22},accent:{h:(n+120)%360,s:75,l:60}}:{primary:{h:n,s:65,l:40},secondary:{h:(n+137.5)%360,s:55,l:38},bg:{h:n,s:15,l:97},surface:{h:n,s:12,l:100},text:{h:n,s:15,l:12},border:{h:n,s:12,l:85},accent:{h:(n+120)%360,s:70,l:42}},l=new V(1.5,.994,.35,1e-5).anneal(a,i=>he(i,e),i=>{const d=["primary","secondary","bg","surface","text","border","accent"],s=d[Math.floor(Math.random()*d.length)],c=["h","s","l"],g=c[Math.floor(Math.random()*c.length)],h=(Math.random()-.5)*(g==="h"?30:15),m={...i,[s]:{...i[s]}};return g==="h"?m[s]={...m[s],h:(i[s].h+h+360)%360}:g==="s"?m[s]={...m[s],s:ee(i[s].s+h,0,100)}:m[s]={...m[s],l:ee(i[s].l+h,0,100)},m},o);return pe(l.state,e)}const U={qubit(){return new I},register(n){return new ae(n)},annealer(n,e,o){return new V(n,e,o)},qbm(n,e){return new ie(n,e)},amplifier(){return new G},inferField:X,optimizeTheme:le,contrast:H,hslToHex:O};function me(n,e,o,a){const r=o.trim();switch(n){case"required":return r!=="";case"email":case"pattern":if(typeof e=="string")try{return r===""||new RegExp(e).test(r)}catch{return!0}return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(r);case"phone":return r===""||/^\+?[\d\s\-()]{7,15}$/.test(r);case"url":return r===""||/^https?:\/\/.+/.test(r);case"minLength":case"min":{const l=Number(e??0);return r===""||(isNaN(Number(r))?r.length>=l:Number(r)>=l)}case"maxLength":case"max":{const l=Number(e??1/0);return r===""||(isNaN(Number(r))?r.length<=l:Number(r)<=l)}case"integer":return r===""||/^\d+$/.test(r);case"alphanumeric":return r===""||/^[a-zA-Z0-9]+$/.test(r);case"match":return r===(a[typeof e=="string"?e:"password"]??"");default:return!0}}function xe({phase:n,collapsed:e,primaryColor:o,borderColor:a}){const d=e?0:n,s=e?0:n*1.618,c=12+10*Math.sin(d)*Math.cos(s),g=12-10*Math.cos(d);return t.jsxs("svg",{width:"24",height:"24",viewBox:"0 0 24 24","aria-hidden":"true",style:{flexShrink:0,opacity:e?.4:1,transition:"opacity 0.6s"},children:[t.jsx("circle",{cx:12,cy:12,r:10,fill:"none",stroke:a,strokeWidth:"0.8"}),t.jsx("ellipse",{cx:12,cy:12,rx:10,ry:10*.3,fill:"none",stroke:a,strokeWidth:"0.5",strokeDasharray:"2 2"}),t.jsx("line",{x1:12,y1:2,x2:12,y2:22,stroke:a,strokeWidth:"0.5"}),t.jsx("line",{x1:12,y1:12,x2:c,y2:g,stroke:o,strokeWidth:"1.5",style:{transition:e?"all 0.6s ease-out":"none"}}),t.jsx("circle",{cx:c,cy:g,r:"2",fill:o,style:{transition:e?"all 0.6s ease-out":"none"}})]})}function ge({confidence:n,theme:e}){const o=Math.round(n*100),a=o>=80?e.success:o>=60?e.warning:e.danger;return t.jsxs("span",{style:{display:"inline-flex",alignItems:"center",gap:"2px",fontSize:"10px",fontWeight:600,padding:"1px 5px",borderRadius:"999px",backgroundColor:`${a}22`,color:a,border:`1px solid ${a}44`,marginLeft:"6px",verticalAlign:"middle",letterSpacing:"0.03em"},children:["⚛ ",o,"%"]})}function fe({config:n,intel:e,qubitPhase:o,value:a,error:r,touched:l,showConfidence:i,showQuantumState:d,collapsed:s,onChange:c,onBlur:g,theme:h,mounted:m,index:b}){const p=n.type??e.type,v=n.label??e.label,S=n.placeholder??e.placeholder,k=n.required!==void 0?n.required:e.validations.some($=>$.rule==="required"),q=Y.sanitizeString(v),E=p==="textarea",w=l&&r!=="",A=`qf-${n.name}`,W={width:"100%",padding:"9px 12px",border:`1.5px solid ${w?h.danger:h.border}`,borderRadius:"8px",backgroundColor:h.surface,color:h.text,fontSize:"14px",fontFamily:"inherit",outline:"none",boxSizing:"border-box",transition:"border-color 0.15s, box-shadow 0.15s",resize:E?"vertical":void 0,minHeight:E?"80px":void 0};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:"4px",opacity:m?1:0,transform:m?"scaleY(1)":"scaleY(0.92)",transition:`opacity 0.35s ease ${b*60}ms, transform 0.35s ease ${b*60}ms`,transformOrigin:"top"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"4px"},children:[d&&t.jsx(xe,{phase:o,collapsed:s,primaryColor:h.primary,borderColor:h.border}),t.jsxs("label",{htmlFor:A,style:{fontSize:"13px",fontWeight:500,color:h.text,cursor:"pointer"},children:[q,k&&t.jsx("span",{"aria-hidden":"true",style:{color:h.danger,marginLeft:"3px"},children:"*"})]}),i&&t.jsx(ge,{confidence:e.confidence,theme:h})]}),E?t.jsx("textarea",{id:A,value:a,onChange:$=>c($.target.value),onBlur:g,placeholder:S,"aria-invalid":w,"aria-required":k,style:W}):t.jsx("input",{id:A,type:p,value:a,onChange:$=>c($.target.value),onBlur:g,placeholder:S,"aria-invalid":w,"aria-required":k,style:W}),w&&t.jsxs("span",{role:"alert",style:{fontSize:"12px",color:h.danger,display:"flex",alignItems:"center",gap:"4px"},children:[t.jsx("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),Y.sanitizeString(r)]})]})}function ye(n){let e=2166136261;for(let o=0;o<n.length;o++)e^=n.charCodeAt(o),e=Math.imul(e,16777619)>>>0;return(e&65535)/65535*Math.PI*2}function de({fields:n,onSubmit:e,submitLabel:o="Submit",layout:a="vertical",showConfidence:r=!0,showQuantumState:l=!1}){const i=Z.useTheme(),d=n.map(f=>X(f.name)),[s,c]=x.useState(()=>Object.fromEntries(n.map(f=>[f.name,""]))),[g,h]=x.useState({}),[m,b]=x.useState({}),[p,v]=x.useState(!1),[S,k]=x.useState(!1),[q,E]=x.useState(!1);x.useEffect(()=>{const f=requestAnimationFrame(()=>k(!0));return()=>cancelAnimationFrame(f)},[]);const w=x.useCallback((f,u)=>{const y=n.find(M=>M.name===f),C=d[n.findIndex(M=>M.name===f)];if(!y||!C)return"";const j=u[f]??"";for(const{rule:M,value:P,message:_}of C.validations)if(!(M==="required"&&y.required===!1)&&!me(M,P,j,u))return _;return""},[n]),A=x.useCallback(f=>{const u={};for(const y of n){const C=w(y.name,f);C&&(u[y.name]=C)}return u},[n,w]),W=x.useCallback((f,u)=>{c(y=>{var j;const C={...y,[f]:u};if(m[f]&&(h(M=>({...M,[f]:w(f,C)})),f==="password")){const M=(j=n.find(P=>["confirmpassword","confirm_password","passwordconfirm"].includes(P.name.toLowerCase().replace(/[\s_-]/g,""))))==null?void 0:j.name;M&&m[M]&&h(P=>({...P,[M]:w(M,C)}))}return C}),E(!0)},[n,m,w]),$=x.useCallback(f=>{b(u=>({...u,[f]:!0})),h(u=>({...u,[f]:w(f,s)}))},[s,w]),N=x.useCallback(async f=>{f.preventDefault();const u=Object.fromEntries(n.map(C=>[C.name,!0]));b(u);const y=A(s);if(h(y),!(Object.keys(y).length>0)){v(!0);try{await e(s)}finally{v(!1)}}},[n,s,A,e]),B=d.length>0?Math.round(d.reduce((f,u)=>f+u.confidence,0)/d.length*100):0,F=B>=80?i.success:B>=60?i.warning:i.danger,L=a==="horizontal";return t.jsxs("form",{onSubmit:N,noValidate:!0,className:se.tkx("w-full"),style:{backgroundColor:i.surface,border:`1px solid ${i.border}`,borderRadius:"12px",padding:"24px",position:"relative",boxSizing:"border-box"},children:[t.jsx("span",{"aria-label":"Powered by Quantum AI",style:{position:"absolute",top:"16px",right:"16px",fontSize:"10px",fontWeight:700,padding:"3px 8px",borderRadius:"999px",backgroundColor:`${i.primary}20`,color:i.primary,border:`1px solid ${i.primary}44`,letterSpacing:"0.04em",userSelect:"none"},children:"⚛ Quantum AI"}),r&&t.jsxs("div",{style:{marginBottom:"20px",paddingRight:"100px"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",marginBottom:"4px"},children:[t.jsx("span",{style:{fontSize:"11px",color:i.textMuted,fontWeight:500},children:"Form Intelligence Confidence"}),t.jsxs("span",{style:{fontSize:"11px",fontWeight:700,color:F},children:[B,"%"]})]}),t.jsx("div",{style:{height:"4px",borderRadius:"4px",backgroundColor:i.border,overflow:"hidden"},children:t.jsx("div",{style:{height:"100%",width:`${B}%`,backgroundColor:F,borderRadius:"4px",transition:"width 0.8s ease"}})})]}),t.jsx("div",{style:{display:"grid",gridTemplateColumns:L?"repeat(auto-fill, minmax(260px, 1fr))":"1fr",gap:"16px",marginBottom:"20px"},children:n.map((f,u)=>t.jsx(fe,{config:f,intel:d[u],qubitPhase:ye(f.name),value:s[f.name]??"",error:g[f.name]??"",touched:m[f.name]??!1,showConfidence:r,showQuantumState:l,collapsed:q,onChange:y=>W(f.name,y),onBlur:()=>$(f.name),theme:i,mounted:S,index:u},f.name))}),t.jsx("button",{type:"submit",disabled:p,style:{width:"100%",padding:"10px 20px",borderRadius:"8px",border:"none",backgroundColor:p?`${i.primary}88`:i.primary,color:i.bg,fontSize:"14px",fontWeight:700,fontFamily:"inherit",cursor:p?"not-allowed":"pointer",transition:"background-color 0.15s, opacity 0.15s",display:"flex",alignItems:"center",justifyContent:"center",gap:"8px"},children:p?t.jsxs(t.Fragment,{children:[t.jsxs("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.5",style:{animation:"qf-spin 0.8s linear infinite"},"aria-hidden":"true",children:[t.jsx("circle",{cx:"12",cy:"12",r:"10",strokeOpacity:"0.25"}),t.jsx("path",{d:"M12 2a10 10 0 0 1 10 10"})]}),"Processing…"]}):Y.sanitizeString(o)}),t.jsx("style",{children:"@keyframes qf-spin { to { transform: rotate(360deg); } }"})]})}de.displayName="TkxQuantumForm";function te(n){return n?{primary:"#00f5d4",secondary:"#7b2ff7",background:"#0a0a0f",surface:"#12121a",text:"#e8e8f4",textMuted:"#8888aa",border:"#2a2a3e",error:"#f87171",warning:"#fbbf24",success:"#34d399",accent:"#ff6b6b"}:{primary:"#0d7c5f",secondary:"#6930c3",background:"#f8f6f1",surface:"#ffffff",text:"#1a1815",textMuted:"#6b6560",border:"#ddd8cc",error:"#dc2626",warning:"#d97706",success:"#059669",accent:"#e05a00"}}function be({points:n,primary:e}){if(n.length<2)return t.jsx("div",{style:{height:48,display:"flex",alignItems:"center",justifyContent:"center",color:"#888",fontSize:12},children:"Waiting for data..."});const o=280,a=48,r=Math.max(...n.map(c=>c.energy)),l=Math.min(...n.map(c=>c.energy)),i=r-l||1,d=n[n.length-1].iteration||1,s=n.map(c=>{const g=c.iteration/d*o,h=a-(c.energy-l)/i*(a-4)-2;return`${g.toFixed(1)},${h.toFixed(1)}`}).join(" ");return t.jsxs("svg",{width:o,height:a,style:{display:"block"},children:[t.jsx("polyline",{points:s,fill:"none",stroke:e,strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round",opacity:.9}),t.jsxs("text",{x:2,y:10,fontSize:9,fill:"#888",children:["E=",r.toFixed(1)]}),t.jsxs("text",{x:2,y:a-2,fontSize:9,fill:"#888",children:["E=",l.toFixed(1)]})]})}function ve({label:n,value:e,onChange:o,text:a,border:r}){return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:6},children:[t.jsx("input",{type:"color",value:e,onChange:l=>o(l.target.value),style:{width:32,height:32,border:`1px solid ${r}`,borderRadius:6,padding:2,cursor:"pointer",background:"transparent"}}),t.jsx("div",{style:{width:60,height:28,borderRadius:6,background:e,border:`1px solid ${r}`}}),t.jsx("span",{style:{flex:1,fontSize:13,color:a,fontFamily:"monospace"},children:n}),t.jsx("code",{style:{fontSize:12,color:a,opacity:.7,fontFamily:"monospace"},children:e})]})}function ke({label:n,ratio:e}){const o=e>=4.5,a=e>=4.5,r=e>=7;return t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:4},children:[t.jsx("span",{style:{fontSize:11,opacity:.8,minWidth:140},children:n}),t.jsxs("span",{style:{fontSize:12,fontWeight:600},children:[e.toFixed(2),":1"]}),t.jsx("span",{style:{fontSize:11,color:a?"#22c55e":"#ef4444"},children:a?"✓ AA":"✗ AA"}),t.jsx("span",{style:{fontSize:11,color:r?"#22c55e":"#888"},children:r?"✓ AAA":"— AAA"}),t.jsx("span",{style:{fontSize:13},children:o?"✅":"❌"})]})}function we({onThemeChange:n,initialHue:e=210,initialMode:o="dark"}){const a=Z.useTheme(),[r,l]=x.useState(o),[i,d]=x.useState(e),[s,c]=x.useState(()=>te(o==="dark")),[g,h]=x.useState(!1),[m,b]=x.useState([]),[p,v]=x.useState(!1),S=x.useRef(null),k=r==="dark",q=x.useCallback((u,y)=>{c(C=>{const j={...C,[u]:y};return n==null||n(j),j})},[n]),E=x.useCallback(()=>{if(g)return;h(!0),b([]);let u=0;const y=600,C=60,j=[],M=()=>{u+=C,U.optimizeTheme(i,k,u);const P=u/y,_=50*(1-P)+2,Q=(Math.random()-.5)*8*(1-P*.8);if(j.push({iteration:u,energy:Math.max(0,_+Q)}),b([...j]),u<y)S.current=window.setTimeout(M,40);else{const z=U.optimizeTheme(i,k,1e3);c(z),n==null||n(z),h(!1)}};S.current=window.setTimeout(M,16)},[i,k,g,n]),w=x.useCallback(()=>{const u=r==="dark"?"light":"dark";l(u);const y=te(u==="dark");c(y),n==null||n(y)},[r,n]),A=x.useCallback(()=>{const u=`export const myTheme = {
|
|
2
2
|
${Object.entries(s).map(([y,C])=>` ${y}: '${C}',`).join(`
|
|
3
3
|
`)}
|
|
4
4
|
};`;typeof navigator<"u"&&navigator.clipboard&&navigator.clipboard.writeText(u).then(()=>{v(!0),setTimeout(()=>v(!1),2e3)})},[s]),W=[{label:"Text on Background",fg:s.text,bg:s.background},{label:"Text on Surface",fg:s.text,bg:s.surface},{label:"Primary on Background",fg:s.primary,bg:s.background},{label:"TextMuted on Background",fg:s.textMuted,bg:s.background}],$="linear-gradient(to right,"+["hsl(0,80%,55%)","hsl(30,80%,55%)","hsl(60,80%,55%)","hsl(90,80%,55%)","hsl(120,80%,55%)","hsl(150,80%,55%)","hsl(180,80%,55%)","hsl(210,80%,55%)","hsl(240,80%,55%)","hsl(270,80%,55%)","hsl(300,80%,55%)","hsl(330,80%,55%)","hsl(360,80%,55%)"].join(",")+")",N={fontFamily:"system-ui, -apple-system, sans-serif",background:s.background,color:s.text,border:`1px solid ${s.border}`,borderRadius:12,padding:20,maxWidth:900,display:"grid",gridTemplateColumns:"1fr 1fr",gap:20},B={background:s.surface,border:`1px solid ${s.border}`,borderRadius:8,padding:16},F={fontSize:13,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.08em",color:s.primary,marginBottom:12,marginTop:0},L={padding:"8px 16px",borderRadius:8,border:"none",cursor:"pointer",fontWeight:600,fontSize:13,transition:"opacity 0.15s"},f=se.tkx;return t.jsxs("div",{style:N,children:[t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gridColumn:"1/-1"},children:[t.jsxs("div",{children:[t.jsx("h2",{style:{margin:0,fontSize:18,fontWeight:700},children:"Theme Builder"}),t.jsx("p",{style:{margin:"2px 0 0",fontSize:12,color:s.textMuted},children:"Quantum-powered color optimization"})]}),t.jsx("button",{onClick:w,style:{...L,background:s.surface,color:s.text,border:`1px solid ${s.border}`},children:k?"☀ Light":"🌙 Dark"})]}),t.jsxs("div",{style:B,children:[t.jsx("p",{style:F,children:"Base Hue"}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:10},children:[t.jsx("div",{style:{width:24,height:24,borderRadius:"50%",background:`hsl(${i},70%,55%)`,border:`2px solid ${s.border}`,flexShrink:0}}),t.jsx("input",{type:"range",min:0,max:360,value:i,onChange:u=>d(Number(u.target.value)),style:{flex:1,height:16,borderRadius:8,background:$,outline:"none",border:"none",cursor:"pointer",appearance:"none",WebkitAppearance:"none"}}),t.jsxs("span",{style:{fontSize:13,fontFamily:"monospace",minWidth:32},children:[i,"°"]})]})]}),t.jsxs("div",{style:B,children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:8,marginBottom:10},children:[t.jsx("button",{onClick:E,disabled:g,style:{...L,background:g?s.border:s.primary,color:k?"#000":"#fff",opacity:g?.7:1,flex:1},children:g?"⟳ Optimizing...":"⚛ Generate with Quantum Annealing"}),t.jsx("div",{style:{padding:"3px 8px",background:s.primary+"22",border:`1px solid ${s.primary}44`,borderRadius:20,fontSize:10,color:s.primary,fontWeight:700,whiteSpace:"nowrap"},children:"⚛ Quantum Annealing"})]}),(g||m.length>0)&&t.jsxs("div",{children:[t.jsx("p",{style:{fontSize:11,color:s.textMuted,margin:"0 0 4px"},children:"Energy landscape (lower = better palette)"}),t.jsx(be,{points:m,primary:s.primary})]})]}),t.jsxs("div",{style:B,children:[t.jsx("p",{style:F,children:"Color Tokens"}),Object.keys(s).map(u=>t.jsx(ve,{label:u,value:s[u],onChange:y=>q(u,y),text:s.text,border:s.border},u))]}),t.jsx("button",{onClick:A,style:{...L,background:s.accent,color:"#fff",width:"100%"},children:p?"✓ Copied to Clipboard!":"⬇ Export Theme"})]}),t.jsxs("div",{style:{display:"flex",flexDirection:"column",gap:16},children:[t.jsxs("div",{style:B,children:[t.jsx("p",{style:F,children:"Live Preview"}),t.jsxs("div",{style:{marginBottom:12},children:[t.jsx("p",{style:{fontSize:11,color:s.textMuted,margin:"0 0 6px"},children:"Buttons"}),t.jsxs("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[t.jsx("button",{style:{padding:"8px 16px",borderRadius:8,border:"none",background:s.primary,color:k?"#000":"#fff",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Primary"}),t.jsx("button",{style:{padding:"8px 16px",borderRadius:8,border:"none",background:s.secondary,color:"#fff",fontWeight:600,fontSize:13,cursor:"pointer"},children:"Secondary"}),t.jsx("button",{style:{padding:"8px 16px",borderRadius:8,border:`1px solid ${s.border}`,background:"transparent",color:s.text,fontWeight:600,fontSize:13,cursor:"pointer"},children:"Outline"})]})]}),t.jsxs("div",{style:{marginBottom:12},children:[t.jsx("p",{style:{fontSize:11,color:s.textMuted,margin:"0 0 6px"},children:"Card"}),t.jsxs("div",{style:{background:s.surface,border:`1px solid ${s.border}`,borderRadius:8,padding:12},children:[t.jsx("div",{style:{fontSize:14,fontWeight:700,marginBottom:4},children:"Card Title"}),t.jsx("div",{style:{fontSize:12,color:s.textMuted,lineHeight:1.4},children:"Sample card with surface background and muted text content."}),t.jsxs("div",{style:{marginTop:8,display:"flex",gap:6},children:[t.jsx("span",{style:{padding:"2px 8px",borderRadius:20,background:s.primary+"33",color:s.primary,fontSize:11,fontWeight:600},children:"Tag"}),t.jsx("span",{style:{padding:"2px 8px",borderRadius:20,background:s.accent+"33",color:s.accent,fontSize:11,fontWeight:600},children:"Accent"})]})]})]}),t.jsxs("div",{style:{marginBottom:12},children:[t.jsx("p",{style:{fontSize:11,color:s.textMuted,margin:"0 0 6px"},children:"Input"}),t.jsx("input",{type:"text",placeholder:"Type something...",readOnly:!0,style:{width:"100%",padding:"8px 12px",borderRadius:8,border:`1px solid ${s.border}`,background:s.background,color:s.text,fontSize:13,outline:"none",boxSizing:"border-box"}})]}),t.jsxs("div",{style:{marginBottom:12},children:[t.jsx("p",{style:{fontSize:11,color:s.textMuted,margin:"0 0 6px"},children:"Progress"}),t.jsx("div",{style:{height:8,borderRadius:4,background:s.border,overflow:"hidden"},children:t.jsx("div",{style:{height:"100%",width:"68%",background:`linear-gradient(to right, ${s.primary}, ${s.accent})`,borderRadius:4,transition:"width 0.4s ease"}})})]}),t.jsxs("div",{children:[t.jsx("p",{style:{fontSize:11,color:s.textMuted,margin:"0 0 6px"},children:"Status Badges"}),t.jsx("div",{style:{display:"flex",gap:6,flexWrap:"wrap"},children:[{label:"Error",color:s.error},{label:"Warning",color:s.warning},{label:"Success",color:s.success}].map(({label:u,color:y})=>t.jsx("span",{style:{padding:"3px 10px",borderRadius:4,background:y+"22",color:y,border:`1px solid ${y}44`,fontSize:11,fontWeight:700},children:u},u))})]})]}),t.jsxs("div",{style:B,children:[t.jsx("p",{style:F,children:"WCAG Contrast Check"}),W.map(u=>t.jsx(ke,{label:u.label,ratio:U.contrast(u.fg,u.bg)},u.label)),t.jsx("p",{style:{fontSize:10,color:s.textMuted,marginTop:8,marginBottom:0},children:"AA requires 4.5:1 (normal text). AAA requires 7:1."})]}),t.jsxs("div",{style:B,children:[t.jsx("p",{style:F,children:"Color Palette"}),t.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:Object.entries(s).map(([u,y])=>t.jsx("div",{title:`${u}: ${y}`,style:{width:36,height:36,borderRadius:6,background:y,border:`2px solid ${s.border}`,cursor:"default",flexShrink:0}},u))})]})]}),typeof f=="function"&&null,typeof a.bg=="string"&&null]})}const re=[{label:"Hello World",code:`<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>
|
|
@@ -81,11 +81,11 @@ ${Object.entries(s).map(([y,C])=>` ${y}: '${C}',`).join(`
|
|
|
81
81
|
function PlaygroundRoot() {
|
|
82
82
|
${a.startsWith("<")||a.startsWith("(")?`return (${a});`:a}
|
|
83
83
|
}
|
|
84
|
-
return PlaygroundRoot;
|
|
85
84
|
`;const d=Se();d&&(i=d.transform(i,{presets:["react"],filename:"playground.jsx"}).code??i);const c=new Function("React","imports",`
|
|
86
85
|
"use strict";
|
|
87
86
|
const { ${Object.keys(e).join(", ")} } = imports;
|
|
88
87
|
${i}
|
|
88
|
+
return PlaygroundRoot;
|
|
89
89
|
`)(x,e),g=x.createElement(c),h=parseFloat((performance.now()-o).toFixed(2));return{element:g,error:null,renderMs:h}}catch(a){const r=parseFloat((performance.now()-o).toFixed(2));return{element:null,error:a instanceof Error?a.message:String(a),renderMs:r}}}function Me({code:n,lineHeight:e}){const o=n.split(`
|
|
90
90
|
`);return t.jsx("div",{"aria-hidden":"true",style:{position:"absolute",top:0,left:0,width:"36px",padding:"12px 0",textAlign:"right",paddingRight:"8px",userSelect:"none",pointerEvents:"none",fontSize:"12px",lineHeight:`${e}px`,color:"#555577",fontFamily:'"Fira Code", "Cascadia Code", "Consolas", monospace',boxSizing:"border-box"},children:o.map((a,r)=>t.jsx("div",{children:r+1},r))})}const ne=["TkxButton","TkxInput","TkxCard","TkxModal","TkxTable","TkxSelect","TkxCheckbox","TkxRadio","TkxSwitch","TkxSlider","TkxBadge","TkxAlert","TkxToast","TkxTooltip","TkxPopover","TkxTabs","TkxAccordion","TkxDrawer","TkxDropdown","TkxMenu","TkxForm","TkxDataGrid","TkxChart","TkxSpinner","TkxSkeleton","TkxAvatar","TkxTag","TkxDivider","TkxProgress","TkxStatistic","TkxQuantumForm","TkxPlayground"],ze=new G;function oe(n){const e=n.match(/([A-Z][a-zA-Z0-9]*)$/);return e?e[1]:""}function Te(n,e=4){if(!n||n.length<2)return[];const o=n.toLowerCase();return ze.amplify(ne,r=>{const l=r.toLowerCase();if(l.startsWith(o))return 1;if(l.includes(o))return .7;let i=0;for(let d=0;d<o.length-1;d++)l.includes(o.slice(d,d+2))&&(i+=.15);return Math.min(i,.5)},.1).slice(0,e).map(r=>({name:ne[r.index]??"",amplitude:parseFloat(r.combined.toFixed(3))})).filter(r=>r.name!=="")}function ce({defaultCode:n,examples:e,height:o=480,imports:a={}}){const r=Z.useTheme(),l=[...re,...e??[]],i=n??re[0].code,[d,s]=x.useState(i),[c,g]=x.useState({element:null,error:null,renderMs:0}),[h,m]=x.useState(null),[b,p]=x.useState([]),[v,S]=x.useState(!1),[k,q]=x.useState(0),E=x.useRef(null),w=18,A=x.useRef(null),W=x.useCallback(z=>{m(null);const T=Ce(z,a);g(T)},[a]);x.useEffect(()=>(A.current&&clearTimeout(A.current),A.current=setTimeout(()=>W(d),300),()=>{A.current&&clearTimeout(A.current)}),[d,W]),x.useEffect(()=>{W(i)},[]);const $=x.useCallback(z=>{const T=z.target.value;s(T);const D=oe(T);D.length>=2?p(Te(D,4)):p([])},[]),N=x.useCallback(z=>{const T=l[z];T&&(q(z),s(T.code),p([]))},[l]),B=x.useCallback(async()=>{try{await navigator.clipboard.writeText(d),S(!0),setTimeout(()=>S(!1),1500)}catch{}},[d]),F=x.useCallback(()=>{s(i),q(0),p([])},[i]),L=x.useCallback(z=>{const T=oe(d);T&&s(D=>D.slice(0,D.lastIndexOf(T))+z),p([])},[d]),f=c.error!==null||h!==null,u=c.error??h??"",y=r.bg,C=r.surfaceAlt,j=r.border,M=r.surface,P={width:"50%",display:"flex",flexDirection:"column",borderRight:`1px solid ${j}`,position:"relative"},_={display:"flex",alignItems:"center",gap:"6px",padding:"6px 10px",borderBottom:`1px solid ${j}`,backgroundColor:r.surface,flexWrap:"wrap"},Q={padding:"3px 10px",borderRadius:"6px",border:`1px solid ${j}`,backgroundColor:"transparent",color:r.textMuted,fontSize:"11px",fontWeight:600,cursor:"pointer",fontFamily:"inherit",transition:"color 0.15s, border-color 0.15s"};return t.jsxs("div",{style:{display:"flex",flexDirection:"column",border:`1px solid ${j}`,borderRadius:"12px",overflow:"hidden",backgroundColor:y,fontFamily:"inherit",boxSizing:"border-box",position:"relative"},children:[t.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"8px 14px",borderBottom:`1px solid ${j}`,backgroundColor:r.surface},children:[t.jsx("span",{style:{fontSize:"12px",fontWeight:700,color:r.primary,letterSpacing:"0.05em"},children:"⚛ TkxPlayground"}),t.jsx("span",{style:{fontSize:"10px",color:r.textMuted},children:"Live JSX Preview"})]}),t.jsx("div",{style:{display:"flex",gap:"4px",padding:"6px 10px",borderBottom:`1px solid ${j}`,backgroundColor:r.surface,overflowX:"auto"},children:l.map((z,T)=>t.jsx("button",{onClick:()=>N(T),style:{padding:"3px 10px",borderRadius:"6px",border:`1px solid ${T===k?r.primary:j}`,backgroundColor:T===k?`${r.primary}20`:"transparent",color:T===k?r.primary:r.textMuted,fontSize:"11px",fontWeight:T===k?700:400,cursor:"pointer",whiteSpace:"nowrap",fontFamily:"inherit",transition:"all 0.15s"},children:z.label},T))}),t.jsxs("div",{style:{display:"flex",height:`${o}px`},children:[t.jsxs("div",{style:P,children:[t.jsxs("div",{style:_,children:[t.jsx("span",{style:{fontSize:"11px",color:r.textMuted,marginRight:"auto"},children:"editor.tsx"}),t.jsx("button",{onClick:B,style:Q,title:"Copy code",children:v?"✓ Copied":"⎘ Copy"}),t.jsx("button",{onClick:F,style:Q,title:"Reset to default",children:"↺ Reset"})]}),t.jsxs("div",{style:{position:"relative",flex:1,overflow:"hidden"},children:[t.jsx(Me,{code:d,lineHeight:w}),t.jsx("textarea",{ref:E,value:d,onChange:$,spellCheck:!1,autoCorrect:"off",autoCapitalize:"off",style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",padding:"12px 12px 12px 44px",margin:0,border:"none",outline:"none",resize:"none",backgroundColor:y,color:r.text,fontSize:"12px",lineHeight:`${w}px`,fontFamily:'"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace',boxSizing:"border-box",overflowY:"auto",tabSize:2}})]}),b.length>0&&t.jsxs("div",{style:{position:"absolute",bottom:"40px",left:"44px",zIndex:10,backgroundColor:r.surface,border:`1px solid ${r.primary}44`,borderRadius:"8px",overflow:"hidden",boxShadow:"0 4px 16px rgba(0,0,0,0.3)",minWidth:"180px"},children:[t.jsx("div",{style:{padding:"4px 10px 4px",fontSize:"10px",color:r.primary,fontWeight:700,borderBottom:`1px solid ${j}`,letterSpacing:"0.05em"},children:"⚛ Quantum Suggestions"}),b.map(z=>t.jsxs("button",{onClick:()=>L(z.name),style:{display:"flex",alignItems:"center",justifyContent:"space-between",width:"100%",padding:"6px 10px",border:"none",backgroundColor:"transparent",color:r.text,fontSize:"12px",fontFamily:'"Fira Code", monospace',cursor:"pointer",textAlign:"left",gap:"12px"},children:[t.jsx("span",{children:z.name}),t.jsxs("span",{style:{fontSize:"10px",color:r.textMuted,flexShrink:0},children:[Math.round(z.amplitude*100),"%"]})]},z.name))]})]}),t.jsxs("div",{style:{width:"50%",display:"flex",flexDirection:"column"},children:[t.jsx("div",{style:{padding:"6px 10px",borderBottom:`1px solid ${j}`,backgroundColor:r.surface,fontSize:"11px",color:r.textMuted,fontWeight:600},children:"Preview"}),t.jsx("div",{style:{flex:1,overflow:"auto",backgroundColor:C,position:"relative"},children:f?t.jsxs("div",{style:{padding:"16px",color:r.danger,fontFamily:'"Fira Code", monospace',fontSize:"12px",lineHeight:1.6,whiteSpace:"pre-wrap",wordBreak:"break-word"},children:[t.jsxs("div",{style:{marginBottom:"8px",fontWeight:700,display:"flex",alignItems:"center",gap:"6px"},children:[t.jsx("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:t.jsx("path",{d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z"})}),"Runtime Error"]}),u]}):t.jsx(je,{onError:m,children:t.jsx("div",{style:{minHeight:"100%"},children:c.element})})})]})]}),t.jsxs("div",{style:{display:"flex",alignItems:"center",gap:"16px",padding:"4px 12px",backgroundColor:M,borderTop:`1px solid ${j}`,fontSize:"11px",color:r.textMuted},children:[t.jsxs("span",{style:{display:"flex",alignItems:"center",gap:"4px",color:f?r.danger:r.success,fontWeight:600},children:[t.jsx("span",{style:{width:"6px",height:"6px",borderRadius:"50%",backgroundColor:f?r.danger:r.success,display:"inline-block"}}),f?"Error":"OK"]}),t.jsxs("span",{children:["⏱ ",c.renderMs," ms"]}),t.jsxs("span",{children:[d.split(`
|
|
91
91
|
`).length," lines"]}),t.jsxs("span",{children:[d.length," chars"]}),b.length>0&&t.jsxs("span",{style:{marginLeft:"auto",color:r.primary,fontWeight:600},children:["⚛ ",b.length," suggestion",b.length>1?"s":""]})]})]})}ce.displayName="TkxPlayground";exports.AmplitudeAmplifier=G;exports.QuantumAI=U;exports.QuantumAnnealer=V;exports.QuantumBoltzmannMachine=ie;exports.QuantumRegister=ae;exports.Qubit=I;exports.TkxPlayground=ce;exports.TkxQuantumForm=de;exports.TkxThemeBuilder=we;exports.hslToHex=O;exports.inferFieldIntelligence=X;exports.optimizeThemeColors=le;
|
package/dist/quantum.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsxs as c, jsx as a, Fragment as pe } from "react/jsx-runtime";
|
|
2
2
|
import Z, { useState as A, useEffect as V, useCallback as R, useRef as X } from "react";
|
|
3
|
-
import { u as K } from "./index-
|
|
4
|
-
import { t as le } from "./tkx-
|
|
5
|
-
import { s as J } from "./security-
|
|
3
|
+
import { u as K } from "./index-iUUHRxqJ.js";
|
|
4
|
+
import { t as le } from "./tkx-BtHzWKTl.js";
|
|
5
|
+
import { s as J } from "./security-C-ZPGoyG.js";
|
|
6
6
|
class W {
|
|
7
7
|
constructor(e, n) {
|
|
8
8
|
this.re = e, this.im = n;
|
|
@@ -1793,7 +1793,6 @@ function Be(r, e) {
|
|
|
1793
1793
|
function PlaygroundRoot() {
|
|
1794
1794
|
${i.startsWith("<") || i.startsWith("(") ? `return (${i});` : i}
|
|
1795
1795
|
}
|
|
1796
|
-
return PlaygroundRoot;
|
|
1797
1796
|
`;
|
|
1798
1797
|
const d = Ae();
|
|
1799
1798
|
d && (s = d.transform(s, {
|
|
@@ -1807,6 +1806,7 @@ function Be(r, e) {
|
|
|
1807
1806
|
"use strict";
|
|
1808
1807
|
const { ${Object.keys(e).join(", ")} } = imports;
|
|
1809
1808
|
${s}
|
|
1809
|
+
return PlaygroundRoot;
|
|
1810
1810
|
`
|
|
1811
1811
|
)(Z, e), f = Z.createElement(p), m = parseFloat((performance.now() - n).toFixed(2));
|
|
1812
1812
|
return { element: f, error: null, renderMs: m };
|
package/dist/realtime.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),K=require("./index-
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),K=require("./index-DnqXtpwV.cjs"),z=require("./security-Uf0mjv8o.cjs"),O=64,se=5;let ae=!1;function Ee(){if(ae||typeof document>"u")return;ae=!0;const e=document.createElement("style");e.id="tkx-live-feed-styles",e.textContent=`
|
|
2
2
|
@keyframes tkx-feed-slide-in {
|
|
3
3
|
from { transform: translateY(-20px); opacity: 0; }
|
|
4
4
|
to { transform: translateY(0); opacity: 1; }
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
.tkx-feed-item-new {
|
|
7
7
|
animation: tkx-feed-slide-in 0.25s ease-out both;
|
|
8
8
|
}
|
|
9
|
-
`.trim(),document.head.appendChild(e)}function ke(e){const n=Date.now()-e;return n<1e4?"just now":n<6e4?`${Math.floor(n/1e3)}s ago`:n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}function we(e,n){switch(e){case"info":return n.info;case"success":return n.success;case"warning":return n.warning;case"error":return n.danger;default:return n.border}}function Me(e){return e?e.split(" ").map(n=>n[0]??"").slice(0,2).join("").toUpperCase():"?"}function $e({item:e,isNew:n,showTimestamps:r,onItemClick:o,renderItem:
|
|
9
|
+
`.trim(),document.head.appendChild(e)}function ke(e){const n=Date.now()-e;return n<1e4?"just now":n<6e4?`${Math.floor(n/1e3)}s ago`:n<36e5?`${Math.floor(n/6e4)}m ago`:n<864e5?`${Math.floor(n/36e5)}h ago`:`${Math.floor(n/864e5)}d ago`}function we(e,n){switch(e){case"info":return n.info;case"success":return n.success;case"warning":return n.warning;case"error":return n.danger;default:return n.border}}function Me(e){return e?e.split(" ").map(n=>n[0]??"").slice(0,2).join("").toUpperCase():"?"}function $e({item:e,isNew:n,showTimestamps:r,onItemClick:o,renderItem:a,theme:s,style:f}){const u=we(e.type,s);if(a)return t.createElement("div",{style:f,className:n?"tkx-feed-item-new":void 0},a(e));const x={...f,display:"flex",alignItems:"center",gap:10,padding:"0 12px",borderLeft:`3px solid ${u}`,cursor:o?"pointer":"default",boxSizing:"border-box",height:O,background:s.surface,transition:"background 0.15s"};return t.createElement("div",{style:x,className:n?"tkx-feed-item-new":void 0,onClick:o?()=>o(e):void 0,role:o?"button":void 0,tabIndex:o?0:void 0,onKeyDown:o?l=>{(l.key==="Enter"||l.key===" ")&&o(e)}:void 0},t.createElement("div",{style:{width:36,height:36,borderRadius:"50%",background:u,display:"flex",alignItems:"center",justifyContent:"center",fontSize:13,fontWeight:700,color:s.bg,flexShrink:0,overflow:"hidden"}},e.avatar?t.createElement("img",{src:e.avatar,alt:e.author??"",style:{width:"100%",height:"100%",objectFit:"cover"}}):Me(e.author)),t.createElement("div",{style:{flex:1,minWidth:0}},t.createElement("div",{style:{display:"flex",alignItems:"center",gap:6,marginBottom:2}},e.author&&t.createElement("span",{style:{fontWeight:600,fontSize:13,color:s.text}},z.sanitizeString(e.author)),e.meta&&t.createElement("span",{style:{fontSize:11,color:s.textMuted,background:s.surfaceAlt,borderRadius:4,padding:"1px 5px"}},z.sanitizeString(e.meta))),t.createElement("div",{style:{fontSize:13,color:s.text,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}},z.sanitizeString(e.content))),r&&t.createElement("div",{style:{fontSize:11,color:s.textMuted,flexShrink:0}},ke(e.timestamp)))}function Te({items:e,maxItems:n=100,height:r=400,autoScroll:o=!0,showTimestamps:a=!0,onItemClick:s,emptyMessage:f="No activity yet.",pauseOnHover:u=!0,renderItem:x}){const l=K.useTheme();Ee();const y=t.useRef(null),[S,E]=t.useState(0),[v,m]=t.useState(!1),[C,N]=t.useState(new Set),D=t.useRef([]),R=t.useMemo(()=>e.slice(-n),[e,n]),M=typeof r=="number"?r:400,k=R.length*O;t.useEffect(()=>{const T=new Set(D.current.map(I=>I.id)),b=R.filter(I=>!T.has(I.id)).map(I=>I.id);if(b.length>0){N(A=>{const F=new Set(A);return b.forEach(H=>F.add(H)),F});const I=window.setTimeout(()=>{N(A=>{const F=new Set(A);return b.forEach(H=>F.delete(H)),F})},400);return()=>clearTimeout(I)}},[R]),t.useEffect(()=>{D.current=R},[R]);const B=o&&!(u&&v);t.useEffect(()=>{if(!B||!y.current)return;const T=y.current;(T.scrollHeight-T.scrollTop-T.clientHeight<O*3||R.length<=5)&&(T.scrollTop=T.scrollHeight)},[R.length,B]);const V=t.useCallback(()=>{y.current&&E(y.current.scrollTop)},[]),W=Math.max(0,Math.floor(S/O)-se),g=Math.min(R.length-1,Math.ceil((S+M)/O)+se),$={position:"relative",overflow:"auto",height:typeof r=="number"?`${r}px`:r,background:l.bg,border:`1px solid ${l.border}`,borderRadius:8,boxSizing:"border-box"},P={position:"relative",height:k,minHeight:"100%"};if(R.length===0)return t.createElement("div",{style:{...$,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement("span",{style:{color:l.textMuted,fontSize:14}},z.sanitizeString(f)));const L=[];for(let T=W;T<=g;T++){const b=R[T];b&&L.push(t.createElement($e,{key:b.id,item:b,isNew:C.has(b.id),showTimestamps:a,onItemClick:s,renderItem:x,theme:l,style:{position:"absolute",top:T*O,left:0,right:0}}))}return t.createElement("div",{ref:y,style:$,onScroll:V,onMouseEnter:u?()=>m(!0):void 0,onMouseLeave:u?()=>m(!1):void 0,"aria-label":"Live feed",role:"feed"},t.createElement("div",{style:P},...L))}let le=!1;function ze(){if(le||typeof document>"u")return;le=!0;const e=document.createElement("style");e.id="tkx-live-metrics-styles",e.textContent=`
|
|
10
10
|
@keyframes tkx-metric-pulse {
|
|
11
11
|
0% { opacity: 1; }
|
|
12
12
|
40% { opacity: 0.4; }
|
|
@@ -19,7 +19,11 @@
|
|
|
19
19
|
.tkx-metric-shimmer {
|
|
20
20
|
animation: tkx-metric-shimmer 0.6s ease-in-out;
|
|
21
21
|
}
|
|
22
|
-
|
|
22
|
+
@media (prefers-reduced-motion: reduce) {
|
|
23
|
+
.tkx-metric-shimmer { animation: none; }
|
|
24
|
+
.tkx-metric-pulse { animation: none; }
|
|
25
|
+
}
|
|
26
|
+
`.trim(),document.head.appendChild(e)}function ce(e,n){if(typeof e=="string")return e;const r=e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(Number.isInteger(e)?e:e.toFixed(2));return n?`${r}${n}`:r}function Re(e,n){switch(e){case"warning":return n.warning;case"critical":return n.danger;default:return n.primary}}function Le(){const[e,n]=t.useState(()=>typeof window<"u"?window.matchMedia("(prefers-reduced-motion: reduce)").matches:!1);return t.useEffect(()=>{if(typeof window>"u")return;const r=window.matchMedia("(prefers-reduced-motion: reduce)"),o=a=>n(a.matches);return r.addEventListener("change",o),()=>r.removeEventListener("change",o)},[]),e}function Ie(e,n,r){const[o,a]=t.useState(e),s=t.useRef(e),f=t.useRef(null),u=t.useRef(null),x=Le();return t.useEffect(()=>{if(!r||x){a(e),s.current=e;return}const l=s.current;if(l===e)return;f.current=null;const y=S=>{f.current===null&&(f.current=S);const E=S-f.current,v=Math.min(E/n,1),m=1-Math.pow(1-v,3);a(l+(e-l)*m),v<1?u.current=requestAnimationFrame(y):s.current=e};return u.current=requestAnimationFrame(y),()=>{u.current!==null&&cancelAnimationFrame(u.current)}},[e,n,r,x]),o}function Ce({data:e,color:n}){if(e.length<2)return null;const r=80,o=24,a=Math.min(...e),f=Math.max(...e)-a||1,u=e.map((x,l)=>{const y=l/(e.length-1)*r,S=o-(x-a)/f*(o-2)-1;return`${y.toFixed(1)},${S.toFixed(1)}`});return t.createElement("svg",{width:r,height:o,viewBox:`0 0 ${r} ${o}`,"aria-hidden":"true"},t.createElement("polyline",{points:u.join(" "),fill:"none",stroke:n,strokeWidth:1.5,strokeLinejoin:"round",strokeLinecap:"round"}))}function Ne({trend:e,theme:n}){return e==="up"?t.createElement("span",{style:{color:n.success,fontSize:14,fontWeight:700}},"▲"):e==="down"?t.createElement("span",{style:{color:n.danger,fontSize:14,fontWeight:700}},"▼"):t.createElement("span",{style:{color:n.textMuted,fontSize:14}},"→")}function We({metric:e,animate:n,onMetricClick:r,theme:o}){const a=e.color??Re(e.status,o),s=typeof e.value=="number"?e.value:NaN,f=Ie(isNaN(s)?0:s,600,n&&!isNaN(s)),[u,x]=t.useState(!1),l=t.useRef(e.value);t.useEffect(()=>{if(l.current!==e.value){l.current=e.value,x(!0);const m=window.setTimeout(()=>x(!1),700);return()=>clearTimeout(m)}},[e.value]);const y=e.previousValue!==void 0&&e.previousValue!==s,S={background:o.surface,border:`1px solid ${o.border}`,borderLeft:`4px solid ${a}`,borderRadius:8,padding:"14px 16px",cursor:r?"pointer":"default",position:"relative",overflow:"hidden",boxSizing:"border-box"},E=u?{position:"absolute",inset:0,background:`linear-gradient(90deg, transparent 0%, ${a}22 50%, transparent 100%)`,backgroundSize:"200% 100%",animation:"tkx-metric-shimmer 0.6s ease-in-out",pointerEvents:"none"}:{},v=isNaN(s)?z.sanitizeString(String(e.value)):ce(f,e.unit);return t.createElement("div",{style:S,className:u?"tkx-metric-shimmer":void 0,onClick:r?()=>r(e):void 0,role:r?"button":void 0,tabIndex:r?0:void 0},u&&t.createElement("div",{style:E}),t.createElement("div",{style:{fontSize:12,color:o.textMuted,marginBottom:6,fontWeight:500,letterSpacing:"0.03em"}},z.sanitizeString(e.label)),t.createElement("div",{style:{display:"flex",alignItems:"flex-end",gap:6,marginBottom:6}},t.createElement("span",{style:{fontSize:28,fontWeight:700,color:o.text,lineHeight:1}},v),e.unit&&isNaN(s)&&t.createElement("span",{style:{fontSize:14,color:o.textMuted,marginBottom:2}},z.sanitizeString(e.unit))),(e.trend||e.trendValue)&&t.createElement("div",{style:{display:"flex",alignItems:"center",gap:4,marginBottom:e.sparkline?8:0}},e.trend&&t.createElement(Ne,{trend:e.trend,theme:o}),e.trendValue&&t.createElement("span",{style:{fontSize:12,color:o.textMuted}},z.sanitizeString(e.trendValue))),y&&t.createElement("div",{style:{fontSize:11,color:o.textMuted,marginTop:2}},`was ${ce(e.previousValue)}`),e.sparkline&&e.sparkline.length>=2&&t.createElement("div",{style:{marginTop:8}},t.createElement(Ce,{data:e.sparkline,color:a})))}function Fe({metrics:e,columns:n=3,animate:r=!0,onMetricClick:o}){const a=K.useTheme();ze();const s={display:"grid",gridTemplateColumns:`repeat(${n}, minmax(0, 1fr))`,gap:16};return t.createElement("div",{style:s},...e.map(f=>t.createElement(We,{key:f.id,metric:f,animate:r,onMetricClick:o,theme:a})))}function de(e){const n=new Date(e),r=String(n.getHours()).padStart(2,"0"),o=String(n.getMinutes()).padStart(2,"0"),a=String(n.getSeconds()).padStart(2,"0");return`${r}:${o}:${a}`}function ue(e){return Math.abs(e)>=1e6?`${(e/1e6).toFixed(1)}M`:Math.abs(e)>=1e3?`${(e/1e3).toFixed(1)}k`:Number.isInteger(e)?String(e):e.toFixed(2)}function He({data:e,maxPoints:n=60,height:r=200,width:o="100%",color:a,fill:s=!0,showGrid:f=!0,showLabels:u=!0,showTooltip:x=!0,label:l,unit:y,animate:S=!0,yMin:E,yMax:v}){const m=K.useTheme(),C=a??m.primary,N=t.useRef(null),[D,R]=t.useState(600),[M,k]=t.useState(null),[B,V]=t.useState(0),W=t.useRef(e.length);t.useEffect(()=>{if(!N.current)return;const i=new ResizeObserver(h=>{const j=h[0];j&&R(j.contentRect.width)});return i.observe(N.current),R(N.current.offsetWidth),()=>i.disconnect()},[]);const g=t.useMemo(()=>e.slice(-n),[e,n]);t.useEffect(()=>{g.length>W.current&&V(i=>i+1),W.current=g.length},[g.length]);const $=u?48:12,P=12,L=l?28:12,T=28,b=Math.max(D-$-P,1),I=Math.max(r-L-T,1),A=g.length?Math.min(...g.map(i=>i.value)):0,F=g.length?Math.max(...g.map(i=>i.value)):1,H=F-A||1,d=E!==void 0?E:A-H*.1,p=(v!==void 0?v:F+H*.1)-d||1;function w(i){return g.length<2?b/2:i/(g.length-1)*b}function _(i){return I-(i-d)/p*I}const G=g.length>=2?g.map((i,h)=>`${h===0?"M":"L"}${w(h).toFixed(2)},${_(i.value).toFixed(2)}`).join(" "):"",ne=G?`${G} L${w(g.length-1).toFixed(2)},${I} L${w(0).toFixed(2)},${I} Z`:"",X=4,J=[];for(let i=0;i<=X;i++)J.push(i);const me=J.map(i=>{const h=d+i/X*p;return{y:_(h),text:ue(h)}}),Z=Math.min(4,g.length),xe=Z>0?Array.from({length:Z},(i,h)=>Math.round(h/Math.max(Z-1,1)*(g.length-1))):[],he=t.useCallback(i=>{if(!x||g.length===0)return;const h=i.currentTarget.getBoundingClientRect(),j=i.clientX-h.left-$;let Y=0,re=1/0;g.forEach((Ge,oe)=>{const ie=Math.abs(w(oe)-j);ie<re&&(re=ie,Y=oe)});const te=g[Y];if(!te)return;const ve=w(Y)+$,be=_(te.value)+L;k({x:ve,y:be,point:te})},[g,x,$,L]),ye=t.useCallback(()=>k(null),[]),Q=D,q=r,ee=`tkx-chart-clip-${B}`,Se={position:"relative",width:typeof o=="number"?`${o}px`:o,background:m.surface,border:`1px solid ${m.border}`,borderRadius:8,overflow:"hidden",boxSizing:"border-box"};return t.createElement("div",{ref:N,style:Se},t.createElement("svg",{width:Q,height:q,viewBox:`0 0 ${Q} ${q}`,onMouseMove:he,onMouseLeave:ye,style:{display:"block",userSelect:"none"},"aria-label":l?z.sanitizeString(l):"Real-time chart"},S&&g.length>=2&&t.createElement("defs",null,t.createElement("clipPath",{id:ee},t.createElement("rect",{x:0,y:0,width:b,height:q},t.createElement("animate",{attributeName:"width",from:Math.max(0,b-b/Math.max(g.length-1,1)),to:b,dur:"0.3s",fill:"freeze"})))),l&&t.createElement("text",{x:$,y:18,fill:m.textMuted,fontSize:12,fontWeight:500},z.sanitizeString(l)),f&&J.map(i=>{const h=_(d+i/X*p)+L;return t.createElement("line",{key:`grid-${i}`,x1:$,y1:h,x2:$+b,y2:h,stroke:m.border,strokeWidth:1,strokeDasharray:"4 4"})}),u&&me.map((i,h)=>t.createElement("text",{key:`yl-${h}`,x:$-4,y:i.y+L+4,fill:m.textMuted,fontSize:10,textAnchor:"end"},i.text)),y&&t.createElement("text",{x:4,y:L+10,fill:m.textMuted,fontSize:9},z.sanitizeString(y)),s&&ne&&t.createElement("path",{d:ne,fill:`${C}22`,clipPath:S?`url(#${ee})`:void 0,transform:`translate(${$}, ${L})`}),G&&t.createElement("path",{d:G,fill:"none",stroke:C,strokeWidth:2,strokeLinejoin:"round",strokeLinecap:"round",clipPath:S?`url(#${ee})`:void 0,transform:`translate(${$}, ${L})`}),xe.map(i=>{const h=g[i];return h?t.createElement("text",{key:`xl-${i}`,x:$+w(i),y:q-8,fill:m.textMuted,fontSize:9,textAnchor:"middle"},de(h.timestamp)):null}),M&&t.createElement("line",{x1:M.x,y1:L,x2:M.x,y2:L+I,stroke:C,strokeWidth:1,strokeDasharray:"3 3",opacity:.6}),M&&t.createElement("circle",{cx:M.x,cy:M.y,r:4,fill:C,stroke:m.surface,strokeWidth:2}),M&&(()=>{const i=Math.min(M.x+8,Q-100),h=Math.max(M.y-36,4),j=`${ue(M.point.value)}${y||""}`,Y=de(M.point.timestamp);return t.createElement("g",null,t.createElement("rect",{x:i-4,y:h-2,width:90,height:34,rx:4,fill:m.surfaceAlt,stroke:m.border,strokeWidth:1}),t.createElement("text",{x:i,y:h+11,fill:m.text,fontSize:12,fontWeight:700},j),t.createElement("text",{x:i,y:h+26,fill:m.textMuted,fontSize:10},Y))})()))}const U=28,fe=8,pe={debug:0,info:1,warn:2,error:3,fatal:4};let ge=!1;function Ae(){if(ge||typeof document>"u")return;ge=!0;const e=document.createElement("style");e.id="tkx-live-log-styles",e.textContent=`
|
|
23
27
|
.tkx-log-row:hover { filter: brightness(1.12); }
|
|
24
28
|
.tkx-log-highlight { background: #ffbe0b55; border-radius: 2px; padding: 0 1px; }
|
|
25
|
-
`.trim(),document.head.appendChild(e)}function
|
|
29
|
+
`.trim(),document.head.appendChild(e)}function De(e){const n=new Date(e),r=String(n.getHours()).padStart(2,"0"),o=String(n.getMinutes()).padStart(2,"0"),a=String(n.getSeconds()).padStart(2,"0"),s=String(n.getMilliseconds()).padStart(3,"0");return`${r}:${o}:${a}.${s}`}function je(e,n){switch(e){case"debug":return n.textMuted;case"info":return n.info;case"warn":return n.warning;case"error":return n.danger;case"fatal":return n.danger;default:return n.textMuted}}function Be(e,n){return e==="fatal"?`${n.danger}22`:"transparent"}function Ve(e){return`[${e.toUpperCase().padEnd(5)}]`}function Oe(e,n){if(!n)return[e];const r=z.sanitizeString(e),o=z.sanitizeString(n);if(!o)return[r];try{const a=new RegExp(`(${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi");return r.split(a).map((f,u)=>a.test(f)?t.createElement("mark",{key:u,className:"tkx-log-highlight"},f):f)}catch{return[r]}}function Pe({entry:e,showLevel:n,showTimestamp:r,showSource:o,searchQuery:a,monospace:s,isExpanded:f,onToggle:u,onEntryClick:x,theme:l,style:y}){const S=je(e.level,l),E=Be(e.level,l),v=e.metadata&&Object.keys(e.metadata).length>0,m={...y,display:"flex",alignItems:"center",gap:6,padding:"0 10px",fontSize:12,fontFamily:s?'"JetBrains Mono", "Fira Mono", Consolas, monospace':"inherit",cursor:v||x?"pointer":"default",background:E,boxSizing:"border-box",height:U,overflow:"hidden",whiteSpace:"nowrap",borderBottom:`1px solid ${l.border}22`},C=()=>{v&&u(),x&&x(e)};return t.createElement("div",{style:m,className:"tkx-log-row",onClick:C,role:v?"button":void 0,tabIndex:v?0:void 0,onKeyDown:v?N=>{(N.key==="Enter"||N.key===" ")&&u()}:void 0,"aria-expanded":v?f:void 0},r&&t.createElement("span",{style:{color:l.textMuted,flexShrink:0,minWidth:84}},De(e.timestamp)),n&&t.createElement("span",{style:{color:S,flexShrink:0,fontWeight:e.level==="fatal"?700:500,minWidth:56}},Ve(e.level)),o&&e.source&&t.createElement("span",{style:{background:l.surfaceAlt,border:`1px solid ${l.border}`,borderRadius:10,padding:"0 5px",fontSize:10,color:l.textMuted,flexShrink:0,maxWidth:80,overflow:"hidden",textOverflow:"ellipsis"}},z.sanitizeString(e.source)),t.createElement("span",{style:{flex:1,color:l.text,overflow:"hidden",textOverflow:"ellipsis"}},...Oe(e.message,a)),v&&t.createElement("span",{style:{color:l.textMuted,fontSize:10,flexShrink:0}},f?"▲":"▼"))}function Ye({metadata:e,theme:n,style:r}){const o={...r,background:n.surfaceAlt,borderBottom:`1px solid ${n.border}`,padding:"6px 10px 6px 56px",display:"flex",flexWrap:"wrap",gap:6,boxSizing:"border-box"};return t.createElement("div",{style:o},...Object.entries(e).map(([a,s])=>t.createElement("span",{key:a,style:{fontSize:11,fontFamily:"monospace",color:n.textMuted,background:n.surface,border:`1px solid ${n.border}`,borderRadius:4,padding:"1px 6px"}},t.createElement("span",{style:{color:n.info}},`${z.sanitizeString(a)}: `),z.sanitizeString(String(s)))))}function _e({entries:e,maxEntries:n=500,height:r=400,autoScroll:o=!0,showLevel:a=!0,showTimestamp:s=!0,showSource:f=!0,filterLevel:u,searchQuery:x="",monospace:l=!0,onEntryClick:y}){const S=K.useTheme();Ae();const E=t.useRef(null),[v,m]=t.useState(0),[C,N]=t.useState(new Set),[D,R]=t.useState(!1),M=t.useRef(e.length),k=t.useMemo(()=>{let d=e.slice(-n);if(u!==void 0){const c=pe[u];d=d.filter(p=>pe[p.level]>=c)}if(x){const c=x.toLowerCase();d=d.filter(p=>p.message.toLowerCase().includes(c)||(p.source??"").toLowerCase().includes(c))}return d},[e,n,u,x]),B=typeof r=="number"?r:400,V=40,W=t.useMemo(()=>{const d=[];let c=0;for(const p of k)d.push(c),c+=U+(C.has(p.id)?V:0);return d.push(c),d},[k,C]),g=W[W.length-1]??0;t.useEffect(()=>{!o||D||k.length!==M.current&&(M.current=k.length,E.current&&(E.current.scrollTop=E.current.scrollHeight))},[k.length,o,D]);const $=t.useCallback(()=>{if(!E.current)return;const d=E.current,c=d.scrollHeight-d.scrollTop-d.clientHeight<U*2;R(!c),m(d.scrollTop)},[]),P=t.useCallback(d=>{N(c=>{const p=new Set(c);return p.has(d)?p.delete(d):p.add(d),p})},[]);function L(d){let c=0,p=k.length-1;for(;c<p;){const w=c+p>>1;(W[w+1]??0)<=d?c=w+1:p=w}return Math.max(0,c-fe)}function T(d){let c=0,p=k.length-1;for(;c<p;){const w=c+p+1>>1;(W[w]??0)>=d+B?p=w-1:c=w}return Math.min(k.length-1,c+fe)}const b=k.length>0?L(v):0,I=k.length>0?T(v):-1,A={position:"relative",overflow:"auto",height:typeof r=="number"?`${r}px`:r,background:S.bg,border:`1px solid ${S.border}`,borderRadius:8,boxSizing:"border-box"},F={position:"relative",height:g,minHeight:"100%"};if(k.length===0)return t.createElement("div",{style:{...A,display:"flex",alignItems:"center",justifyContent:"center"}},t.createElement("span",{style:{color:S.textMuted,fontSize:13,fontFamily:"monospace"}},"No log entries."));const H=[];for(let d=b;d<=I;d++){const c=k[d];if(!c)continue;const p=W[d]??0,w=C.has(c.id);H.push(t.createElement(Pe,{key:c.id,entry:c,showLevel:a,showTimestamp:s,showSource:f,searchQuery:x,monospace:l,isExpanded:w,onToggle:()=>P(c.id),onEntryClick:y,theme:S,style:{position:"absolute",top:p,left:0,right:0}})),w&&c.metadata&&Object.keys(c.metadata).length>0&&H.push(t.createElement(Ye,{key:`${c.id}-meta`,metadata:c.metadata,theme:S,style:{position:"absolute",top:p+U,left:0,right:0,height:V}}))}return t.createElement("div",{ref:E,style:A,onScroll:$,role:"log","aria-live":"polite","aria-label":"Log viewer"},t.createElement("div",{style:F},...H))}exports.TkxLiveFeed=Te;exports.TkxLiveLog=_e;exports.TkxLiveMetrics=Fe;exports.TkxRealTimeChart=He;
|