tekivex-ui 2.5.11 → 2.5.12

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.
Files changed (46) hide show
  1. package/dist/TkxForm-1KDzoniV.cjs +12 -0
  2. package/dist/TkxForm-9-W3Nl6m.js +314 -0
  3. package/dist/charts.cjs +1 -1
  4. package/dist/charts.js +543 -507
  5. package/dist/chunk-Bmb41Sf3.cjs +1 -0
  6. package/dist/headless.cjs +1 -1
  7. package/dist/headless.js +428 -447
  8. package/dist/hooks-6pRsPOyG.js +58 -0
  9. package/dist/hooks-mivgRljH.cjs +1 -0
  10. package/dist/i18n.cjs +1 -1
  11. package/dist/i18n.js +728 -752
  12. package/dist/index.cjs +26 -26
  13. package/dist/index.js +16102 -16619
  14. package/dist/quantum.cjs +14 -16
  15. package/dist/quantum.js +2473 -2279
  16. package/dist/realtime.cjs +4 -10
  17. package/dist/realtime.js +804 -958
  18. package/dist/src/components/TkxClock.d.ts.map +1 -1
  19. package/dist/src/components/TkxForm.d.ts.map +1 -1
  20. package/dist/src/components/TkxLiveFeed.d.ts +1 -1
  21. package/dist/src/components/TkxLiveLog.d.ts +1 -1
  22. package/dist/src/components/TkxRealTimeChart.d.ts +1 -1
  23. package/dist/src/components/TkxTooltip.d.ts.map +1 -1
  24. package/dist/src/components/TkxTypography.d.ts +5 -5
  25. package/dist/src/components/TkxTypography.d.ts.map +1 -1
  26. package/dist/tekivex-ui.css +2 -0
  27. package/dist/themes-BbJanqiC.js +498 -0
  28. package/dist/themes-CMq2vWXj.cjs +2 -0
  29. package/dist/tkx-0oAwZqgL.cjs +4 -0
  30. package/dist/tkx-DQkvHdE5.js +1172 -0
  31. package/package.json +16 -16
  32. package/src/components/TkxClock.tsx +2 -2
  33. package/src/components/TkxForm.tsx +4 -2
  34. package/src/components/TkxTooltip.tsx +7 -5
  35. package/src/components/TkxTypography.tsx +2 -2
  36. package/dist/TkxForm-2tGLCPH6.js +0 -326
  37. package/dist/TkxForm-C2VqR2wC.cjs +0 -12
  38. package/dist/index-BgHMZe4Z.js +0 -66
  39. package/dist/index-Bt5y50Qa.cjs +0 -1
  40. package/dist/index-DnqXtpwV.cjs +0 -2
  41. package/dist/index-iUUHRxqJ.js +0 -515
  42. package/dist/security-C-ZPGoyG.js +0 -97
  43. package/dist/security-Uf0mjv8o.cjs +0 -1
  44. package/dist/style.css +0 -1
  45. package/dist/tkx-BtHzWKTl.js +0 -1112
  46. package/dist/tkx-C7GvVUE9.cjs +0 -4
package/dist/quantum.cjs CHANGED
@@ -1,10 +1,8 @@
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
- ${Object.entries(s).map(([y,C])=>` ${y}: '${C}',`).join(`
3
- `)}
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' }}>
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./themes-CMq2vWXj.cjs`),n=require(`./tkx-0oAwZqgL.cjs`);let r=require(`react`);r=e.t(r,1);let i=require(`react/jsx-runtime`);var a=class e{constructor(e,t){this.re=e,this.im=t}add(t){return new e(this.re+t.re,this.im+t.im)}sub(t){return new e(this.re-t.re,this.im-t.im)}mul(t){return new e(this.re*t.re-this.im*t.im,this.re*t.im+this.im*t.re)}scale(t){return new e(this.re*t,this.im*t)}conjugate(){return new e(this.re,-this.im)}magnitudeSquared(){return this.re*this.re+this.im*this.im}magnitude(){return Math.sqrt(this.magnitudeSquared())}static fromPolar(t,n){return new e(t*Math.cos(n),t*Math.sin(n))}static zero(){return new e(0,0)}static one(){return new e(1,0)}},o=class e{constructor(e=a.one(),t=a.zero()){this.alpha=e,this.beta=t,this.normalize()}normalize(){let 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(){let t=1/Math.SQRT2;return new e(this.alpha.add(this.beta).scale(t),this.alpha.sub(this.beta).scale(t))}ry(t){let n=Math.cos(t/2),r=Math.sin(t/2);return new e(this.alpha.scale(n).sub(this.beta.scale(r)),this.alpha.scale(r).add(this.beta.scale(n)))}phase(t){let n=a.fromPolar(1,t);return new e(this.alpha,this.beta.mul(n))}measure(){let e=this.beta.magnitudeSquared();return+(Math.random()<e)}expectation(){return this.beta.magnitudeSquared()}getAlpha(){return this.alpha}getBeta(){return this.beta}},s=class{constructor(e){this.qubits=Array.from({length:e},()=>new o)}get size(){return this.qubits.length}getQubit(e){return this.qubits[e]}superpose(){this.qubits=this.qubits.map(e=>e.hadamard())}cnot(e,t){let n=this.qubits[e],r=this.qubits[t],i=n.expectation();this.qubits[t]=r.ry(Math.PI*i)}rotate(e,t){this.qubits[e]=this.qubits[e].ry(t)}measure(){return this.qubits.map(e=>e.measure())}probs(){return this.qubits.map(e=>e.expectation())}},c=class{constructor(e=1,t=.995,n=.3,r=1e-6){this.temperature=e,this.coolingRate=t,this.tunnelingStrength=n,this.minTemp=r}anneal(e,t,n,r=1e3){let i=e,a=t(i),o=i,s=a,c=this.temperature,l=0,u=0;for(let e=0;e<r&&c>this.minTemp;e++){let e=n(i),r=t(e),d=r-a,f=!1;if(d<=0)f=!0;else{let e=Math.exp(-d/c),t=Math.sqrt(2*Math.abs(d)),n=Math.abs(d),r=Math.exp(-2*t*Math.sqrt(n)*this.tunnelingStrength);Math.random()<e+r&&(f=!0,Math.random()<r/(e+r+1e-10)&&u++)}f&&(i=e,a=r,l++,a<s&&(o=i,s=a)),c*=this.coolingRate}return{state:o,energy:s,iterations:r,accepted:l,tunnels:u}}},l=class{constructor(e,t){let n=Math.sqrt(2/(e+t));this.weights=Array.from({length:e},()=>Array.from({length:t},()=>(Math.random()*2-1)*n)),this.visibleBias=Array.from({length:e},()=>0),this.hiddenBias=Array.from({length:t},()=>0)}sigmoid(e){let t=(Math.random()-.5)*.1;return 1/(1+Math.exp(-(e+t)))}sample(e){return+(Math.random()<e)}energy(e,t){let n=this.visibleBias.reduce((t,n,r)=>t+n*e[r],0),r=this.hiddenBias.reduce((e,n,r)=>e+n*t[r],0),i=0;for(let n=0;n<e.length;n++)for(let r=0;r<t.length;r++)i+=e[n]*this.weights[n][r]*t[r];return-(n+r+i)}hiddenProbs(e){return this.hiddenBias.map((t,n)=>{let r=t+e.reduce((e,t,r)=>e+this.weights[r][n]*t,0);return this.sigmoid(r)})}visibleProbs(e){return this.visibleBias.map((t,n)=>{let r=t+e.reduce((e,t,r)=>e+this.weights[n][r]*t,0);return this.sigmoid(r)})}gibbs(e,t=1){let n=[...e],r=[];for(let e=0;e<t;e++)r=this.hiddenProbs(n).map(e=>this.sample(e)),n=this.visibleProbs(r).map(e=>this.sample(e));return{visible:n,hidden:r}}trainCD1(e,t=.01){let n=this.visibleBias.length,r=this.hiddenBias.length,i=Array.from({length:n},()=>Array(r).fill(0)),a=Array(n).fill(0),o=Array(r).fill(0);for(let t of e){let e=this.hiddenProbs(t),s=e.map(e=>this.sample(e)),c=this.visibleProbs(s).map(e=>this.sample(e)),l=this.hiddenProbs(c);for(let o=0;o<n;o++){for(let n=0;n<r;n++)i[o][n]+=t[o]*e[n]-c[o]*l[n];a[o]+=t[o]-c[o]}for(let t=0;t<r;t++)o[t]+=e[t]-l[t]}let s=e.length;for(let e=0;e<n;e++){for(let n=0;n<r;n++)this.weights[e][n]+=t*i[e][n]/s;this.visibleBias[e]+=t*a[e]/s}for(let e=0;e<r;e++)this.hiddenBias[e]+=t*o[e]/s}infer(e){let t=this.hiddenProbs(e),n=t.map(e=>this.sample(e));return{hidden:t,visible:this.visibleProbs(n),energy:this.energy(e,n),iterations:1}}},u=class{amplify(e,t,n=.5){let r=e.length;if(r===0)return[];let i=e.map(t),a=i.filter(e=>e>n).length,o=Math.max(1,a),s=Array(r).fill(1/Math.sqrt(r)),c=Math.max(1,Math.floor(Math.PI/4*Math.sqrt(r/o)));for(let e=0;e<c;e++){for(let e=0;e<r;e++)i[e]>n&&(s[e]=-s[e]);let e=s.reduce((e,t)=>e+t,0)/r;s=s.map(t=>2*e-t)}return e.map((e,t)=>({index:t,amplitude:s[t],probability:s[t]*s[t],classicalSimilarity:i[t],combined:s[t]*s[t]*.6+i[t]*.4})).sort((e,t)=>t.combined-e.combined)}},d=[{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 f(e){let t=e.toLowerCase().replace(/[\s-]/g,`_`),n=new u().amplify(d,e=>{let n=0;for(let r of e.keywords)t===r?n=Math.max(n,1):t.includes(r)||r.includes(t)?n=Math.max(n,.8):r.split(`_`).some(e=>t.includes(e))&&(n=Math.max(n,.5));return n},.3);if(n.length>0&&n[0].combined>.1){let e=d[n[0].index];return{type:e.type,validations:e.validations,placeholder:e.placeholder,confidence:Math.min(e.confidence*n[0].combined*2,.99),label:e.label}}return{type:`text`,validations:[{rule:`maxLength`,value:255,message:`Input too long`}],placeholder:e.replace(/_/g,` `),confidence:.3,label:e.replace(/_/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}}function p(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function m(e){let t=e.replace(`#`,``),n=t.length===3?t.split(``).map(e=>e+e).join(``):t;return[parseInt(n.slice(0,2),16),parseInt(n.slice(2,4),16),parseInt(n.slice(4,6),16)]}function h(e){let[t,n,r]=m(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r}function g(e,t){let n=h(e),r=h(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)}function _(e,t){let n=e=>p(e.h,e.s,e.l),r=t?e.text.l-20:e.text.l+15;return{primary:n(e.primary),secondary:n(e.secondary),background:n(e.bg),surface:n(e.surface),text:n(e.text),textMuted:p(e.text.h,Math.max(0,e.text.s-10),Math.max(20,Math.min(85,r))),border:n(e.border),error:t?`#f87171`:`#dc2626`,warning:t?`#fbbf24`:`#d97706`,success:t?`#34d399`:`#059669`,accent:n(e.accent)}}function v(e,t){let n=0,r=e=>p(e.h,e.s,e.l),i=r(e.text),a=r(e.bg),o=r(e.surface),s=r(e.primary),c=g(i,a),l=g(i,o),u=g(s,a);c<4.5&&(n+=(4.5-c)*10),l<4.5&&(n+=(4.5-l)*8),u<3&&(n+=(3-u)*5);let d=Math.abs((e.secondary.h-e.primary.h+360)%360-137.508);n+=d*.05;let f=Math.abs((e.accent.h-e.primary.h+360)%360-120);n+=f*.03;let m=(e.primary.s+e.secondary.s)/2;m<20&&(n+=(20-m)*.5),m>90&&(n+=(m-90)*.5);let h=e.bg.l;t?(h>25&&(n+=(h-25)*2),h<3&&(n+=(3-h)*2),e.text.l<70&&(n+=(70-e.text.l)*1.5)):(h<90&&(n+=(90-h)*2),h>100&&(n+=(h-100)*2),e.text.l>30&&(n+=(e.text.l-30)*1.5));let _=Math.abs(e.surface.l-e.bg.l);return _<2&&(n+=(2-_)*2),_>12&&(n+=(_-12)*1),n}function y(e,t,n){return Math.max(t,Math.min(n,e))}function b(e,t,n=800){let r=t?{primary:{h:e,s:70,l:55},secondary:{h:(e+137.5)%360,s:65,l:50},bg:{h:e,s:10,l:8},surface:{h:e,s:10,l:13},text:{h:e,s:15,l:90},border:{h:e,s:15,l:22},accent:{h:(e+120)%360,s:75,l:60}}:{primary:{h:e,s:65,l:40},secondary:{h:(e+137.5)%360,s:55,l:38},bg:{h:e,s:15,l:97},surface:{h:e,s:12,l:100},text:{h:e,s:15,l:12},border:{h:e,s:12,l:85},accent:{h:(e+120)%360,s:70,l:42}};return _(new c(1.5,.994,.35,1e-5).anneal(r,e=>v(e,t),e=>{let t=[`primary`,`secondary`,`bg`,`surface`,`text`,`border`,`accent`],n=t[Math.floor(Math.random()*t.length)],r=[`h`,`s`,`l`],i=r[Math.floor(Math.random()*r.length)],a=(Math.random()-.5)*(i===`h`?30:15),o={...e,[n]:{...e[n]}};return i===`h`?o[n]={...o[n],h:(e[n].h+a+360)%360}:i===`s`?o[n]={...o[n],s:y(e[n].s+a,0,100)}:o[n]={...o[n],l:y(e[n].l+a,0,100)},o},n).state,t)}var x={qubit(){return new o},register(e){return new s(e)},annealer(e,t,n){return new c(e,t,n)},qbm(e,t){return new l(e,t)},amplifier(){return new u},inferField:f,optimizeTheme:b,contrast:g,hslToHex:p};function S(e,t,n,r){let i=n.trim();switch(e){case`required`:return i!==``;case`email`:case`pattern`:if(typeof t==`string`)try{return i===``||new RegExp(t).test(i)}catch{return!0}return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(i);case`phone`:return i===``||/^\+?[\d\s\-()]{7,15}$/.test(i);case`url`:return i===``||/^https?:\/\/.+/.test(i);case`minLength`:case`min`:{let e=Number(t??0);return i===``||(isNaN(Number(i))?i.length>=e:Number(i)>=e)}case`maxLength`:case`max`:{let e=Number(t??1/0);return i===``||(isNaN(Number(i))?i.length<=e:Number(i)<=e)}case`integer`:return i===``||/^\d+$/.test(i);case`alphanumeric`:return i===``||/^[a-zA-Z0-9]+$/.test(i);case`match`:return i===(r[typeof t==`string`?t:`password`]??``);default:return!0}}function C({phase:e,collapsed:t,primaryColor:n,borderColor:r}){let a=t?0:e,o=t?0:e*1.618,s=12+10*Math.sin(a)*Math.cos(o),c=12-10*Math.cos(a);return(0,i.jsxs)(`svg`,{width:`24`,height:`24`,viewBox:`0 0 24 24`,"aria-hidden":`true`,style:{flexShrink:0,opacity:t?.4:1,transition:`opacity 0.6s`},children:[(0,i.jsx)(`circle`,{cx:12,cy:12,r:10,fill:`none`,stroke:r,strokeWidth:`0.8`}),(0,i.jsx)(`ellipse`,{cx:12,cy:12,rx:10,ry:10*.3,fill:`none`,stroke:r,strokeWidth:`0.5`,strokeDasharray:`2 2`}),(0,i.jsx)(`line`,{x1:12,y1:2,x2:12,y2:22,stroke:r,strokeWidth:`0.5`}),(0,i.jsx)(`line`,{x1:12,y1:12,x2:s,y2:c,stroke:n,strokeWidth:`1.5`,style:{transition:t?`all 0.6s ease-out`:`none`}}),(0,i.jsx)(`circle`,{cx:s,cy:c,r:`2`,fill:n,style:{transition:t?`all 0.6s ease-out`:`none`}})]})}function w({confidence:e,theme:t}){let n=Math.round(e*100),r=n>=80?t.success:n>=60?t.warning:t.danger;return(0,i.jsxs)(`span`,{style:{display:`inline-flex`,alignItems:`center`,gap:`2px`,fontSize:`10px`,fontWeight:600,padding:`1px 5px`,borderRadius:`999px`,backgroundColor:`${r}22`,color:r,border:`1px solid ${r}44`,marginLeft:`6px`,verticalAlign:`middle`,letterSpacing:`0.03em`},children:[`⚛ `,n,`%`]})}function T({config:e,intel:t,qubitPhase:r,value:a,error:o,touched:s,showConfidence:c,showQuantumState:l,collapsed:u,onChange:d,onBlur:f,theme:p,mounted:m,index:h}){let g=e.type??t.type,_=e.label??t.label,v=e.placeholder??t.placeholder,y=e.required===void 0?t.validations.some(e=>e.rule===`required`):e.required,b=n.m(_),x=g===`textarea`,S=s&&o!==``,T=`qf-${e.name}`,E={width:`100%`,padding:`9px 12px`,border:`1.5px solid ${S?p.danger:p.border}`,borderRadius:`8px`,backgroundColor:p.surface,color:p.text,fontSize:`14px`,fontFamily:`inherit`,outline:`none`,boxSizing:`border-box`,transition:`border-color 0.15s, box-shadow 0.15s`,resize:x?`vertical`:void 0,minHeight:x?`80px`:void 0};return(0,i.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:`4px`,opacity:+!!m,transform:m?`scaleY(1)`:`scaleY(0.92)`,transition:`opacity 0.35s ease ${h*60}ms, transform 0.35s ease ${h*60}ms`,transformOrigin:`top`},children:[(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`4px`},children:[l&&(0,i.jsx)(C,{phase:r,collapsed:u,primaryColor:p.primary,borderColor:p.border}),(0,i.jsxs)(`label`,{htmlFor:T,style:{fontSize:`13px`,fontWeight:500,color:p.text,cursor:`pointer`},children:[b,y&&(0,i.jsx)(`span`,{"aria-hidden":`true`,style:{color:p.danger,marginLeft:`3px`},children:`*`})]}),c&&(0,i.jsx)(w,{confidence:t.confidence,theme:p})]}),x?(0,i.jsx)(`textarea`,{id:T,value:a,onChange:e=>d(e.target.value),onBlur:f,placeholder:v,"aria-invalid":S,"aria-required":y,style:E}):(0,i.jsx)(`input`,{id:T,type:g,value:a,onChange:e=>d(e.target.value),onBlur:f,placeholder:v,"aria-invalid":S,"aria-required":y,style:E}),S&&(0,i.jsxs)(`span`,{role:`alert`,style:{fontSize:`12px`,color:p.danger,display:`flex`,alignItems:`center`,gap:`4px`},children:[(0,i.jsx)(`svg`,{width:`12`,height:`12`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,i.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`})}),n.m(o)]})]})}function E(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=Math.imul(t,16777619)>>>0;return(t&65535)/65535*Math.PI*2}function D({fields:e,onSubmit:a,submitLabel:o=`Submit`,layout:s=`vertical`,showConfidence:c=!0,showQuantumState:l=!1}){let u=t.f(),d=e.map(e=>f(e.name)),[p,m]=(0,r.useState)(()=>Object.fromEntries(e.map(e=>[e.name,``]))),[h,g]=(0,r.useState)({}),[_,v]=(0,r.useState)({}),[y,b]=(0,r.useState)(!1),[x,C]=(0,r.useState)(!1),[w,D]=(0,r.useState)(!1);(0,r.useEffect)(()=>{let e=requestAnimationFrame(()=>C(!0));return()=>cancelAnimationFrame(e)},[]);let O=(0,r.useCallback)((t,n)=>{let r=e.find(e=>e.name===t),i=d[e.findIndex(e=>e.name===t)];if(!r||!i)return``;let a=n[t]??``;for(let{rule:e,value:t,message:o}of i.validations)if(!(e===`required`&&r.required===!1)&&!S(e,t,a,n))return o;return``},[e]),k=(0,r.useCallback)(t=>{let n={};for(let r of e){let e=O(r.name,t);e&&(n[r.name]=e)}return n},[e,O]),A=(0,r.useCallback)((t,n)=>{m(r=>{let i={...r,[t]:n};if(_[t]&&(g(e=>({...e,[t]:O(t,i)})),t===`password`)){let t=e.find(e=>[`confirmpassword`,`confirm_password`,`passwordconfirm`].includes(e.name.toLowerCase().replace(/[\s_-]/g,``)))?.name;t&&_[t]&&g(e=>({...e,[t]:O(t,i)}))}return i}),D(!0)},[e,_,O]),j=(0,r.useCallback)(e=>{v(t=>({...t,[e]:!0})),g(t=>({...t,[e]:O(e,p)}))},[p,O]),M=(0,r.useCallback)(async t=>{t.preventDefault(),v(Object.fromEntries(e.map(e=>[e.name,!0])));let n=k(p);if(g(n),!(Object.keys(n).length>0)){b(!0);try{await a(p)}finally{b(!1)}}},[e,p,k,a]),N=d.length>0?Math.round(d.reduce((e,t)=>e+t.confidence,0)/d.length*100):0,P=N>=80?u.success:N>=60?u.warning:u.danger,F=s===`horizontal`;return(0,i.jsxs)(`form`,{onSubmit:M,noValidate:!0,className:n.a(`w-full`),style:{backgroundColor:u.surface,border:`1px solid ${u.border}`,borderRadius:`12px`,padding:`24px`,position:`relative`,boxSizing:`border-box`},children:[(0,i.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:`${u.primary}20`,color:u.primary,border:`1px solid ${u.primary}44`,letterSpacing:`0.04em`,userSelect:`none`},children:`⚛ Quantum AI`}),c&&(0,i.jsxs)(`div`,{style:{marginBottom:`20px`,paddingRight:`100px`},children:[(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,marginBottom:`4px`},children:[(0,i.jsx)(`span`,{style:{fontSize:`11px`,color:u.textMuted,fontWeight:500},children:`Form Intelligence Confidence`}),(0,i.jsxs)(`span`,{style:{fontSize:`11px`,fontWeight:700,color:P},children:[N,`%`]})]}),(0,i.jsx)(`div`,{style:{height:`4px`,borderRadius:`4px`,backgroundColor:u.border,overflow:`hidden`},children:(0,i.jsx)(`div`,{style:{height:`100%`,width:`${N}%`,backgroundColor:P,borderRadius:`4px`,transition:`width 0.8s ease`}})})]}),(0,i.jsx)(`div`,{style:{display:`grid`,gridTemplateColumns:F?`repeat(auto-fill, minmax(260px, 1fr))`:`1fr`,gap:`16px`,marginBottom:`20px`},children:e.map((e,t)=>(0,i.jsx)(T,{config:e,intel:d[t],qubitPhase:E(e.name),value:p[e.name]??``,error:h[e.name]??``,touched:_[e.name]??!1,showConfidence:c,showQuantumState:l,collapsed:w,onChange:t=>A(e.name,t),onBlur:()=>j(e.name),theme:u,mounted:x,index:t},e.name))}),(0,i.jsx)(`button`,{type:`submit`,disabled:y,style:{width:`100%`,padding:`10px 20px`,borderRadius:`8px`,border:`none`,backgroundColor:y?`${u.primary}88`:u.primary,color:u.bg,fontSize:`14px`,fontWeight:700,fontFamily:`inherit`,cursor:y?`not-allowed`:`pointer`,transition:`background-color 0.15s, opacity 0.15s`,display:`flex`,alignItems:`center`,justifyContent:`center`,gap:`8px`},children:y?(0,i.jsxs)(i.Fragment,{children:[(0,i.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:[(0,i.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,strokeOpacity:`0.25`}),(0,i.jsx)(`path`,{d:`M12 2a10 10 0 0 1 10 10`})]}),`Processing…`]}):n.m(o)}),(0,i.jsx)(`style`,{children:`@keyframes qf-spin { to { transform: rotate(360deg); } }`})]})}D.displayName=`TkxQuantumForm`;function O(e){return e?{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 k({points:e,primary:t}){if(e.length<2)return(0,i.jsx)(`div`,{style:{height:48,display:`flex`,alignItems:`center`,justifyContent:`center`,color:`#888`,fontSize:12},children:`Waiting for data...`});let n=Math.max(...e.map(e=>e.energy)),r=Math.min(...e.map(e=>e.energy)),a=n-r||1,o=e[e.length-1].iteration||1;return(0,i.jsxs)(`svg`,{width:280,height:48,style:{display:`block`},children:[(0,i.jsx)(`polyline`,{points:e.map(e=>{let t=e.iteration/o*280,n=48-(e.energy-r)/a*44-2;return`${t.toFixed(1)},${n.toFixed(1)}`}).join(` `),fill:`none`,stroke:t,strokeWidth:1.5,strokeLinecap:`round`,strokeLinejoin:`round`,opacity:.9}),(0,i.jsxs)(`text`,{x:2,y:10,fontSize:9,fill:`#888`,children:[`E=`,n.toFixed(1)]}),(0,i.jsxs)(`text`,{x:2,y:46,fontSize:9,fill:`#888`,children:[`E=`,r.toFixed(1)]})]})}function A({label:e,value:t,onChange:n,text:r,border:a}){return(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:6},children:[(0,i.jsx)(`input`,{type:`color`,value:t,onChange:e=>n(e.target.value),style:{width:32,height:32,border:`1px solid ${a}`,borderRadius:6,padding:2,cursor:`pointer`,background:`transparent`}}),(0,i.jsx)(`div`,{style:{width:60,height:28,borderRadius:6,background:t,border:`1px solid ${a}`}}),(0,i.jsx)(`span`,{style:{flex:1,fontSize:13,color:r,fontFamily:`monospace`},children:e}),(0,i.jsx)(`code`,{style:{fontSize:12,color:r,opacity:.7,fontFamily:`monospace`},children:t})]})}function j({label:e,ratio:t}){let n=t>=4.5,r=t>=4.5,a=t>=7;return(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:6,marginBottom:4},children:[(0,i.jsx)(`span`,{style:{fontSize:11,opacity:.8,minWidth:140},children:e}),(0,i.jsxs)(`span`,{style:{fontSize:12,fontWeight:600},children:[t.toFixed(2),`:1`]}),(0,i.jsx)(`span`,{style:{fontSize:11,color:r?`#22c55e`:`#ef4444`},children:r?`✓ AA`:`✗ AA`}),(0,i.jsx)(`span`,{style:{fontSize:11,color:a?`#22c55e`:`#888`},children:a?`✓ AAA`:`— AAA`}),(0,i.jsx)(`span`,{style:{fontSize:13},children:n?`✅`:`❌`})]})}function M({onThemeChange:e,initialHue:a=210,initialMode:o=`dark`}){let s=t.f(),[c,l]=(0,r.useState)(o),[u,d]=(0,r.useState)(a),[f,p]=(0,r.useState)(()=>O(o===`dark`)),[m,h]=(0,r.useState)(!1),[g,_]=(0,r.useState)([]),[v,y]=(0,r.useState)(!1),b=(0,r.useRef)(null),S=c===`dark`,C=(0,r.useCallback)((t,n)=>{p(r=>{let i={...r,[t]:n};return e?.(i),i})},[e]),w=(0,r.useCallback)(()=>{if(m)return;h(!0),_([]);let t=0,n=[],r=()=>{t+=60,x.optimizeTheme(u,S,t);let i=t/600,a=50*(1-i)+2,o=(Math.random()-.5)*8*(1-i*.8);if(n.push({iteration:t,energy:Math.max(0,a+o)}),_([...n]),t<600)b.current=window.setTimeout(r,40);else{let t=x.optimizeTheme(u,S,1e3);p(t),e?.(t),h(!1)}};b.current=window.setTimeout(r,16)},[u,S,m,e]),T=(0,r.useCallback)(()=>{let t=c===`dark`?`light`:`dark`;l(t);let n=O(t===`dark`);p(n),e?.(n)},[c,e]),E=(0,r.useCallback)(()=>{let e=`export const myTheme = {\n${Object.entries(f).map(([e,t])=>` ${e}: '${t}',`).join(`
2
+ `)}\n};`;typeof navigator<`u`&&navigator.clipboard&&navigator.clipboard.writeText(e).then(()=>{y(!0),setTimeout(()=>y(!1),2e3)})},[f]),D=[{label:`Text on Background`,fg:f.text,bg:f.background},{label:`Text on Surface`,fg:f.text,bg:f.surface},{label:`Primary on Background`,fg:f.primary,bg:f.background},{label:`TextMuted on Background`,fg:f.textMuted,bg:f.background}],M=`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:f.background,color:f.text,border:`1px solid ${f.border}`,borderRadius:12,padding:20,maxWidth:900,display:`grid`,gridTemplateColumns:`1fr 1fr`,gap:20},P={background:f.surface,border:`1px solid ${f.border}`,borderRadius:8,padding:16},F={fontSize:13,fontWeight:700,textTransform:`uppercase`,letterSpacing:`0.08em`,color:f.primary,marginBottom:12,marginTop:0},I={padding:`8px 16px`,borderRadius:8,border:`none`,cursor:`pointer`,fontWeight:600,fontSize:13,transition:`opacity 0.15s`},L=n.a;return(0,i.jsxs)(`div`,{style:N,children:[(0,i.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,gridColumn:`1/-1`},children:[(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`h2`,{style:{margin:0,fontSize:18,fontWeight:700},children:`Theme Builder`}),(0,i.jsx)(`p`,{style:{margin:`2px 0 0`,fontSize:12,color:f.textMuted},children:`Quantum-powered color optimization`})]}),(0,i.jsx)(`button`,{onClick:T,style:{...I,background:f.surface,color:f.text,border:`1px solid ${f.border}`},children:S?`☀ Light`:`🌙 Dark`})]}),(0,i.jsxs)(`div`,{style:P,children:[(0,i.jsx)(`p`,{style:F,children:`Base Hue`}),(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:10},children:[(0,i.jsx)(`div`,{style:{width:24,height:24,borderRadius:`50%`,background:`hsl(${u},70%,55%)`,border:`2px solid ${f.border}`,flexShrink:0}}),(0,i.jsx)(`input`,{type:`range`,min:0,max:360,value:u,onChange:e=>d(Number(e.target.value)),style:{flex:1,height:16,borderRadius:8,background:M,outline:`none`,border:`none`,cursor:`pointer`,appearance:`none`,WebkitAppearance:`none`}}),(0,i.jsxs)(`span`,{style:{fontSize:13,fontFamily:`monospace`,minWidth:32},children:[u,`°`]})]})]}),(0,i.jsxs)(`div`,{style:P,children:[(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:8,marginBottom:10},children:[(0,i.jsx)(`button`,{onClick:w,disabled:m,style:{...I,background:m?f.border:f.primary,color:S?`#000`:`#fff`,opacity:m?.7:1,flex:1},children:m?`⟳ Optimizing...`:`⚛ Generate with Quantum Annealing`}),(0,i.jsx)(`div`,{style:{padding:`3px 8px`,background:f.primary+`22`,border:`1px solid ${f.primary}44`,borderRadius:20,fontSize:10,color:f.primary,fontWeight:700,whiteSpace:`nowrap`},children:`⚛ Quantum Annealing`})]}),(m||g.length>0)&&(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`p`,{style:{fontSize:11,color:f.textMuted,margin:`0 0 4px`},children:`Energy landscape (lower = better palette)`}),(0,i.jsx)(k,{points:g,primary:f.primary})]})]}),(0,i.jsxs)(`div`,{style:P,children:[(0,i.jsx)(`p`,{style:F,children:`Color Tokens`}),Object.keys(f).map(e=>(0,i.jsx)(A,{label:e,value:f[e],onChange:t=>C(e,t),text:f.text,border:f.border},e))]}),(0,i.jsx)(`button`,{onClick:E,style:{...I,background:f.accent,color:`#fff`,width:`100%`},children:v?`✓ Copied to Clipboard!`:`⬇ Export Theme`})]}),(0,i.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,gap:16},children:[(0,i.jsxs)(`div`,{style:P,children:[(0,i.jsx)(`p`,{style:F,children:`Live Preview`}),(0,i.jsxs)(`div`,{style:{marginBottom:12},children:[(0,i.jsx)(`p`,{style:{fontSize:11,color:f.textMuted,margin:`0 0 6px`},children:`Buttons`}),(0,i.jsxs)(`div`,{style:{display:`flex`,gap:8,flexWrap:`wrap`},children:[(0,i.jsx)(`button`,{style:{padding:`8px 16px`,borderRadius:8,border:`none`,background:f.primary,color:S?`#000`:`#fff`,fontWeight:600,fontSize:13,cursor:`pointer`},children:`Primary`}),(0,i.jsx)(`button`,{style:{padding:`8px 16px`,borderRadius:8,border:`none`,background:f.secondary,color:`#fff`,fontWeight:600,fontSize:13,cursor:`pointer`},children:`Secondary`}),(0,i.jsx)(`button`,{style:{padding:`8px 16px`,borderRadius:8,border:`1px solid ${f.border}`,background:`transparent`,color:f.text,fontWeight:600,fontSize:13,cursor:`pointer`},children:`Outline`})]})]}),(0,i.jsxs)(`div`,{style:{marginBottom:12},children:[(0,i.jsx)(`p`,{style:{fontSize:11,color:f.textMuted,margin:`0 0 6px`},children:`Card`}),(0,i.jsxs)(`div`,{style:{background:f.surface,border:`1px solid ${f.border}`,borderRadius:8,padding:12},children:[(0,i.jsx)(`div`,{style:{fontSize:14,fontWeight:700,marginBottom:4},children:`Card Title`}),(0,i.jsx)(`div`,{style:{fontSize:12,color:f.textMuted,lineHeight:1.4},children:`Sample card with surface background and muted text content.`}),(0,i.jsxs)(`div`,{style:{marginTop:8,display:`flex`,gap:6},children:[(0,i.jsx)(`span`,{style:{padding:`2px 8px`,borderRadius:20,background:f.primary+`33`,color:f.primary,fontSize:11,fontWeight:600},children:`Tag`}),(0,i.jsx)(`span`,{style:{padding:`2px 8px`,borderRadius:20,background:f.accent+`33`,color:f.accent,fontSize:11,fontWeight:600},children:`Accent`})]})]})]}),(0,i.jsxs)(`div`,{style:{marginBottom:12},children:[(0,i.jsx)(`p`,{style:{fontSize:11,color:f.textMuted,margin:`0 0 6px`},children:`Input`}),(0,i.jsx)(`input`,{type:`text`,placeholder:`Type something...`,readOnly:!0,style:{width:`100%`,padding:`8px 12px`,borderRadius:8,border:`1px solid ${f.border}`,background:f.background,color:f.text,fontSize:13,outline:`none`,boxSizing:`border-box`}})]}),(0,i.jsxs)(`div`,{style:{marginBottom:12},children:[(0,i.jsx)(`p`,{style:{fontSize:11,color:f.textMuted,margin:`0 0 6px`},children:`Progress`}),(0,i.jsx)(`div`,{style:{height:8,borderRadius:4,background:f.border,overflow:`hidden`},children:(0,i.jsx)(`div`,{style:{height:`100%`,width:`68%`,background:`linear-gradient(to right, ${f.primary}, ${f.accent})`,borderRadius:4,transition:`width 0.4s ease`}})})]}),(0,i.jsxs)(`div`,{children:[(0,i.jsx)(`p`,{style:{fontSize:11,color:f.textMuted,margin:`0 0 6px`},children:`Status Badges`}),(0,i.jsx)(`div`,{style:{display:`flex`,gap:6,flexWrap:`wrap`},children:[{label:`Error`,color:f.error},{label:`Warning`,color:f.warning},{label:`Success`,color:f.success}].map(({label:e,color:t})=>(0,i.jsx)(`span`,{style:{padding:`3px 10px`,borderRadius:4,background:t+`22`,color:t,border:`1px solid ${t}44`,fontSize:11,fontWeight:700},children:e},e))})]})]}),(0,i.jsxs)(`div`,{style:P,children:[(0,i.jsx)(`p`,{style:F,children:`WCAG Contrast Check`}),D.map(e=>(0,i.jsx)(j,{label:e.label,ratio:x.contrast(e.fg,e.bg)},e.label)),(0,i.jsx)(`p`,{style:{fontSize:10,color:f.textMuted,marginTop:8,marginBottom:0},children:`AA requires 4.5:1 (normal text). AAA requires 7:1.`})]}),(0,i.jsxs)(`div`,{style:P,children:[(0,i.jsx)(`p`,{style:F,children:`Color Palette`}),(0,i.jsx)(`div`,{style:{display:`flex`,gap:4,flexWrap:`wrap`},children:Object.entries(f).map(([e,t])=>(0,i.jsx)(`div`,{title:`${e}: ${t}`,style:{width:36,height:36,borderRadius:6,background:t,border:`2px solid ${f.border}`,cursor:`default`,flexShrink:0}},e))})]})]}),typeof L==`function`&&null,typeof s.bg==`string`&&null]})}var N=[{label:`Hello World`,code:`<div style={{ padding: 24, fontFamily: 'sans-serif', color: '#e8e8f4' }}>
5
3
  <h2 style={{ margin: 0 }}>👋 Hello, TkxPlayground!</h2>
6
4
  <p style={{ marginTop: 8, opacity: 0.7 }}>Edit the code on the left to see live updates.</p>
7
- </div>`},{label:"Button Styles",code:`<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>
5
+ </div>`},{label:`Button Styles`,code:`<div style={{ display: 'flex', gap: 12, flexWrap: 'wrap', padding: 24 }}>
8
6
  {['primary', 'success', 'danger', 'warning', 'info'].map(color => (
9
7
  <button
10
8
  key={color}
@@ -22,7 +20,7 @@ ${Object.entries(s).map(([y,C])=>` ${y}: '${C}',`).join(`
22
20
  {color}
23
21
  </button>
24
22
  ))}
25
- </div>`},{label:"Card Grid",code:`<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>
23
+ </div>`},{label:`Card Grid`,code:`<div style={{ display: 'grid', gridTemplateColumns: 'repeat(3, 1fr)', gap: 16, padding: 24 }}>
26
24
  {['Alpha', 'Beta', 'Gamma', 'Delta', 'Epsilon', 'Zeta'].map(name => (
27
25
  <div key={name} style={{
28
26
  background: '#1a1a2e',
@@ -34,7 +32,7 @@ ${Object.entries(s).map(([y,C])=>` ${y}: '${C}',`).join(`
34
32
  <div style={{ fontSize: 12, color: '#8888aa' }}>Quantum module {name.toLowerCase()}</div>
35
33
  </div>
36
34
  ))}
37
- </div>`},{label:"Animated Counter",code:`(() => {
35
+ </div>`},{label:`Animated Counter`,code:`(() => {
38
36
  const [count, setCount] = React.useState(0);
39
37
  return (
40
38
  <div style={{ padding: 32, textAlign: 'center', fontFamily: 'sans-serif' }}>
@@ -48,7 +46,7 @@ ${Object.entries(s).map(([y,C])=>` ${y}: '${C}',`).join(`
48
46
  </div>
49
47
  </div>
50
48
  );
51
- })()`},{label:"Data Table",code:`(() => {
49
+ })()`},{label:`Data Table`,code:`(() => {
52
50
  const rows = [
53
51
  { id: 1, name: 'Hydrogen', symbol: 'H', mass: 1.008 },
54
52
  { id: 2, name: 'Helium', symbol: 'He', mass: 4.003 },
@@ -77,15 +75,15 @@ ${Object.entries(s).map(([y,C])=>` ${y}: '${C}',`).join(`
77
75
  </table>
78
76
  </div>
79
77
  );
80
- })()`}];class je extends x.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){this.props.onError(e.message)}componentDidUpdate(e){e.children!==this.props.children&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?null:this.props.children}}function Se(){return typeof window>"u"?null:window.Babel??null}function Ce(n,e){const o=performance.now();try{const a=n.trim();let i=`
78
+ })()`}],P=class extends r.default.Component{constructor(e){super(e),this.state={hasError:!1}}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(e){this.props.onError(e.message)}componentDidUpdate(e){e.children!==this.props.children&&this.state.hasError&&this.setState({hasError:!1})}render(){return this.state.hasError?null:this.props.children}};function F(){return typeof window>`u`?null:window.Babel??null}function I(e,t){let n=performance.now();try{let i=e.trim(),a=`
81
79
  function PlaygroundRoot() {
82
- ${a.startsWith("<")||a.startsWith("(")?`return (${a});`:a}
80
+ ${i.startsWith(`<`)||i.startsWith(`(`)?`return (${i});`:i}
83
81
  }
84
- `;const d=Se();d&&(i=d.transform(i,{presets:["react"],filename:"playground.jsx"}).code??i);const c=new Function("React","imports",`
82
+ `,o=F();o&&(a=o.transform(a,{presets:[`react`],filename:`playground.jsx`}).code??a);let s=Function(`React`,`imports`,`
85
83
  "use strict";
86
- const { ${Object.keys(e).join(", ")} } = imports;
87
- ${i}
84
+ const { ${Object.keys(t).join(`, `)} } = imports;
85
+ ${a}
88
86
  return PlaygroundRoot;
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
- `);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
- `).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;
87
+ `)(r.default,t);return{element:r.default.createElement(s),error:null,renderMs:parseFloat((performance.now()-n).toFixed(2))}}catch(e){let t=parseFloat((performance.now()-n).toFixed(2));return{element:null,error:e instanceof Error?e.message:String(e),renderMs:t}}}function L({code:e,lineHeight:t}){let n=e.split(`
88
+ `);return(0,i.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:`${t}px`,color:`#555577`,fontFamily:`"Fira Code", "Cascadia Code", "Consolas", monospace`,boxSizing:`border-box`},children:n.map((e,t)=>(0,i.jsx)(`div`,{children:t+1},t))})}var R=`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`.split(`.`),z=new u;function B(e){let t=e.match(/([A-Z][a-zA-Z0-9]*)$/);return t?t[1]:``}function V(e,t=4){if(!e||e.length<2)return[];let n=e.toLowerCase();return z.amplify(R,e=>{let t=e.toLowerCase();if(t.startsWith(n))return 1;if(t.includes(n))return .7;let r=0;for(let e=0;e<n.length-1;e++)t.includes(n.slice(e,e+2))&&(r+=.15);return Math.min(r,.5)},.1).slice(0,t).map(e=>({name:R[e.index]??``,amplitude:parseFloat(e.combined.toFixed(3))})).filter(e=>e.name!==``)}function H({defaultCode:e,examples:n,height:a=480,imports:o={}}){let s=t.f(),c=[...N,...n??[]],l=e??N[0].code,[u,d]=(0,r.useState)(l),[f,p]=(0,r.useState)({element:null,error:null,renderMs:0}),[m,h]=(0,r.useState)(null),[g,_]=(0,r.useState)([]),[v,y]=(0,r.useState)(!1),[b,x]=(0,r.useState)(0),S=(0,r.useRef)(null),C=(0,r.useRef)(null),w=(0,r.useCallback)(e=>{h(null),p(I(e,o))},[o]);(0,r.useEffect)(()=>(C.current&&clearTimeout(C.current),C.current=setTimeout(()=>w(u),300),()=>{C.current&&clearTimeout(C.current)}),[u,w]),(0,r.useEffect)(()=>{w(l)},[]);let T=(0,r.useCallback)(e=>{let t=e.target.value;d(t);let n=B(t);n.length>=2?_(V(n,4)):_([])},[]),E=(0,r.useCallback)(e=>{let t=c[e];t&&(x(e),d(t.code),_([]))},[c]),D=(0,r.useCallback)(async()=>{try{await navigator.clipboard.writeText(u),y(!0),setTimeout(()=>y(!1),1500)}catch{}},[u]),O=(0,r.useCallback)(()=>{d(l),x(0),_([])},[l]),k=(0,r.useCallback)(e=>{let t=B(u);t&&d(n=>n.slice(0,n.lastIndexOf(t))+e),_([])},[u]),A=f.error!==null||m!==null,j=f.error??m??``,M=s.bg,F=s.surfaceAlt,R=s.border,z=s.surface,H={width:`50%`,display:`flex`,flexDirection:`column`,borderRight:`1px solid ${R}`,position:`relative`},U={display:`flex`,alignItems:`center`,gap:`6px`,padding:`6px 10px`,borderBottom:`1px solid ${R}`,backgroundColor:s.surface,flexWrap:`wrap`},W={padding:`3px 10px`,borderRadius:`6px`,border:`1px solid ${R}`,backgroundColor:`transparent`,color:s.textMuted,fontSize:`11px`,fontWeight:600,cursor:`pointer`,fontFamily:`inherit`,transition:`color 0.15s, border-color 0.15s`};return(0,i.jsxs)(`div`,{style:{display:`flex`,flexDirection:`column`,border:`1px solid ${R}`,borderRadius:`12px`,overflow:`hidden`,backgroundColor:M,fontFamily:`inherit`,boxSizing:`border-box`,position:`relative`},children:[(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,padding:`8px 14px`,borderBottom:`1px solid ${R}`,backgroundColor:s.surface},children:[(0,i.jsx)(`span`,{style:{fontSize:`12px`,fontWeight:700,color:s.primary,letterSpacing:`0.05em`},children:`⚛ TkxPlayground`}),(0,i.jsx)(`span`,{style:{fontSize:`10px`,color:s.textMuted},children:`Live JSX Preview`})]}),(0,i.jsx)(`div`,{style:{display:`flex`,gap:`4px`,padding:`6px 10px`,borderBottom:`1px solid ${R}`,backgroundColor:s.surface,overflowX:`auto`},children:c.map((e,t)=>(0,i.jsx)(`button`,{onClick:()=>E(t),style:{padding:`3px 10px`,borderRadius:`6px`,border:`1px solid ${t===b?s.primary:R}`,backgroundColor:t===b?`${s.primary}20`:`transparent`,color:t===b?s.primary:s.textMuted,fontSize:`11px`,fontWeight:t===b?700:400,cursor:`pointer`,whiteSpace:`nowrap`,fontFamily:`inherit`,transition:`all 0.15s`},children:e.label},t))}),(0,i.jsxs)(`div`,{style:{display:`flex`,height:`${a}px`},children:[(0,i.jsxs)(`div`,{style:H,children:[(0,i.jsxs)(`div`,{style:U,children:[(0,i.jsx)(`span`,{style:{fontSize:`11px`,color:s.textMuted,marginRight:`auto`},children:`editor.tsx`}),(0,i.jsx)(`button`,{onClick:D,style:W,title:`Copy code`,children:v?`✓ Copied`:`⎘ Copy`}),(0,i.jsx)(`button`,{onClick:O,style:W,title:`Reset to default`,children:`↺ Reset`})]}),(0,i.jsxs)(`div`,{style:{position:`relative`,flex:1,overflow:`hidden`},children:[(0,i.jsx)(L,{code:u,lineHeight:18}),(0,i.jsx)(`textarea`,{ref:S,value:u,onChange:T,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:M,color:s.text,fontSize:`12px`,lineHeight:`18px`,fontFamily:`"Fira Code", "Cascadia Code", "Consolas", "Courier New", monospace`,boxSizing:`border-box`,overflowY:`auto`,tabSize:2}})]}),g.length>0&&(0,i.jsxs)(`div`,{style:{position:`absolute`,bottom:`40px`,left:`44px`,zIndex:10,backgroundColor:s.surface,border:`1px solid ${s.primary}44`,borderRadius:`8px`,overflow:`hidden`,boxShadow:`0 4px 16px rgba(0,0,0,0.3)`,minWidth:`180px`},children:[(0,i.jsx)(`div`,{style:{padding:`4px 10px 4px`,fontSize:`10px`,color:s.primary,fontWeight:700,borderBottom:`1px solid ${R}`,letterSpacing:`0.05em`},children:`⚛ Quantum Suggestions`}),g.map(e=>(0,i.jsxs)(`button`,{onClick:()=>k(e.name),style:{display:`flex`,alignItems:`center`,justifyContent:`space-between`,width:`100%`,padding:`6px 10px`,border:`none`,backgroundColor:`transparent`,color:s.text,fontSize:`12px`,fontFamily:`"Fira Code", monospace`,cursor:`pointer`,textAlign:`left`,gap:`12px`},children:[(0,i.jsx)(`span`,{children:e.name}),(0,i.jsxs)(`span`,{style:{fontSize:`10px`,color:s.textMuted,flexShrink:0},children:[Math.round(e.amplitude*100),`%`]})]},e.name))]})]}),(0,i.jsxs)(`div`,{style:{width:`50%`,display:`flex`,flexDirection:`column`},children:[(0,i.jsx)(`div`,{style:{padding:`6px 10px`,borderBottom:`1px solid ${R}`,backgroundColor:s.surface,fontSize:`11px`,color:s.textMuted,fontWeight:600},children:`Preview`}),(0,i.jsx)(`div`,{style:{flex:1,overflow:`auto`,backgroundColor:F,position:`relative`},children:A?(0,i.jsxs)(`div`,{style:{padding:`16px`,color:s.danger,fontFamily:`"Fira Code", monospace`,fontSize:`12px`,lineHeight:1.6,whiteSpace:`pre-wrap`,wordBreak:`break-word`},children:[(0,i.jsxs)(`div`,{style:{marginBottom:`8px`,fontWeight:700,display:`flex`,alignItems:`center`,gap:`6px`},children:[(0,i.jsx)(`svg`,{width:`14`,height:`14`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,i.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`]}),j]}):(0,i.jsx)(P,{onError:h,children:(0,i.jsx)(`div`,{style:{minHeight:`100%`},children:f.element})})})]})]}),(0,i.jsxs)(`div`,{style:{display:`flex`,alignItems:`center`,gap:`16px`,padding:`4px 12px`,backgroundColor:z,borderTop:`1px solid ${R}`,fontSize:`11px`,color:s.textMuted},children:[(0,i.jsxs)(`span`,{style:{display:`flex`,alignItems:`center`,gap:`4px`,color:A?s.danger:s.success,fontWeight:600},children:[(0,i.jsx)(`span`,{style:{width:`6px`,height:`6px`,borderRadius:`50%`,backgroundColor:A?s.danger:s.success,display:`inline-block`}}),A?`Error`:`OK`]}),(0,i.jsxs)(`span`,{children:[`⏱ `,f.renderMs,` ms`]}),(0,i.jsxs)(`span`,{children:[u.split(`
89
+ `).length,` lines`]}),(0,i.jsxs)(`span`,{children:[u.length,` chars`]}),g.length>0&&(0,i.jsxs)(`span`,{style:{marginLeft:`auto`,color:s.primary,fontWeight:600},children:[`⚛ `,g.length,` suggestion`,g.length>1?`s`:``]})]})]})}H.displayName=`TkxPlayground`,exports.AmplitudeAmplifier=u,exports.QuantumAI=x,exports.QuantumAnnealer=c,exports.QuantumBoltzmannMachine=l,exports.QuantumRegister=s,exports.Qubit=o,exports.TkxPlayground=H,exports.TkxQuantumForm=D,exports.TkxThemeBuilder=M,exports.hslToHex=p,exports.inferFieldIntelligence=f,exports.optimizeThemeColors=b;