dphelper 4.5.2 → 4.6.0

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 (170) hide show
  1. package/COPYRIGHT.md +6 -6
  2. package/FUNDING.yml +12 -12
  3. package/LICENSE.md +21 -21
  4. package/README.md +397 -397
  5. package/SECURITY.md +26 -26
  6. package/SUMMARY.md +83 -83
  7. package/index.cjs +2 -2
  8. package/index.d.ts +1 -1
  9. package/index.js +2 -2
  10. package/llms.txt +73 -73
  11. package/modules/ai.cjs +1 -1
  12. package/modules/ai.d.ts +11 -11
  13. package/modules/ai.js +1 -1
  14. package/modules/anchor.cjs +1 -1
  15. package/modules/anchor.d.ts +6 -6
  16. package/modules/anchor.js +1 -1
  17. package/modules/array.cjs +1 -1
  18. package/modules/array.d.ts +21 -21
  19. package/modules/array.js +1 -1
  20. package/modules/audio.cjs +1 -1
  21. package/modules/audio.d.ts +10 -10
  22. package/modules/audio.js +1 -1
  23. package/modules/avoid.cjs +1 -1
  24. package/modules/avoid.d.ts +2 -2
  25. package/modules/avoid.js +1 -1
  26. package/modules/biometric.cjs +1 -1
  27. package/modules/biometric.d.ts +14 -14
  28. package/modules/biometric.js +1 -1
  29. package/modules/browser.cjs +1 -1
  30. package/modules/browser.d.ts +10 -10
  31. package/modules/browser.js +1 -1
  32. package/modules/check.cjs +1 -1
  33. package/modules/check.d.ts +4 -4
  34. package/modules/check.js +1 -1
  35. package/modules/color.cjs +1 -1
  36. package/modules/color.d.ts +6 -6
  37. package/modules/color.js +1 -1
  38. package/modules/compress.cjs +1 -1
  39. package/modules/compress.d.ts +13 -13
  40. package/modules/compress.js +1 -1
  41. package/modules/cookie.cjs +1 -1
  42. package/modules/cookie.d.ts +12 -12
  43. package/modules/cookie.js +1 -1
  44. package/modules/coords.cjs +1 -1
  45. package/modules/coords.d.ts +8 -8
  46. package/modules/coords.js +1 -1
  47. package/modules/credits.cjs +1 -1
  48. package/modules/credits.d.ts +11 -11
  49. package/modules/credits.js +1 -1
  50. package/modules/date.cjs +1 -1
  51. package/modules/date.d.ts +25 -25
  52. package/modules/date.js +1 -1
  53. package/modules/disable.cjs +1 -1
  54. package/modules/disable.d.ts +8 -8
  55. package/modules/disable.js +1 -1
  56. package/modules/dispatch.cjs +1 -1
  57. package/modules/dispatch.d.ts +4 -4
  58. package/modules/dispatch.js +1 -1
  59. package/modules/elements.cjs +1 -1
  60. package/modules/elements.d.ts +3 -3
  61. package/modules/elements.js +1 -1
  62. package/modules/events.cjs +1 -1
  63. package/modules/events.d.ts +6 -6
  64. package/modules/events.js +1 -1
  65. package/modules/fetch.cjs +1 -1
  66. package/modules/fetch.d.ts +15 -15
  67. package/modules/fetch.js +1 -1
  68. package/modules/form.cjs +1 -1
  69. package/modules/form.d.ts +13 -13
  70. package/modules/form.js +1 -1
  71. package/modules/format.cjs +1 -1
  72. package/modules/format.d.ts +3 -3
  73. package/modules/format.js +1 -1
  74. package/modules/i18n.cjs +1 -1
  75. package/modules/i18n.d.ts +11 -11
  76. package/modules/i18n.js +1 -1
  77. package/modules/image.cjs +1 -1
  78. package/modules/image.d.ts +13 -13
  79. package/modules/image.js +1 -1
  80. package/modules/json.cjs +1 -1
  81. package/modules/json.d.ts +8 -8
  82. package/modules/json.js +1 -1
  83. package/modules/load.cjs +1 -1
  84. package/modules/load.d.ts +8 -8
  85. package/modules/load.js +1 -1
  86. package/modules/logging.cjs +1 -1
  87. package/modules/logging.d.ts +8 -8
  88. package/modules/logging.js +1 -1
  89. package/modules/math.cjs +1 -1
  90. package/modules/math.d.ts +13 -13
  91. package/modules/math.js +1 -1
  92. package/modules/memory.cjs +1 -1
  93. package/modules/memory.d.ts +3 -3
  94. package/modules/memory.js +1 -1
  95. package/modules/navigation.cjs +1 -1
  96. package/modules/navigation.d.ts +4 -4
  97. package/modules/navigation.js +1 -1
  98. package/modules/net.cjs +1 -1
  99. package/modules/net.d.ts +10 -10
  100. package/modules/net.js +1 -1
  101. package/modules/objects.cjs +1 -1
  102. package/modules/objects.d.ts +15 -15
  103. package/modules/objects.js +1 -1
  104. package/modules/path.cjs +1 -1
  105. package/modules/path.d.ts +4 -4
  106. package/modules/path.js +1 -1
  107. package/modules/promise.cjs +1 -1
  108. package/modules/promise.d.ts +3 -3
  109. package/modules/promise.js +1 -1
  110. package/modules/sanitize.cjs +1 -1
  111. package/modules/sanitize.d.ts +2 -2
  112. package/modules/sanitize.js +1 -1
  113. package/modules/screen.cjs +1 -1
  114. package/modules/screen.d.ts +11 -11
  115. package/modules/screen.js +1 -1
  116. package/modules/scrollbar.cjs +1 -1
  117. package/modules/scrollbar.d.ts +9 -9
  118. package/modules/scrollbar.js +1 -1
  119. package/modules/security.cjs +1 -1
  120. package/modules/security.d.ts +15 -15
  121. package/modules/security.js +1 -1
  122. package/modules/shortcut.cjs +1 -1
  123. package/modules/shortcut.d.ts +2 -2
  124. package/modules/shortcut.js +1 -1
  125. package/modules/socket.cjs +1 -1
  126. package/modules/socket.d.ts +13 -13
  127. package/modules/socket.js +1 -1
  128. package/modules/sse.cjs +1 -1
  129. package/modules/sse.d.ts +8 -8
  130. package/modules/sse.js +1 -1
  131. package/modules/svg.cjs +1 -1
  132. package/modules/svg.d.ts +12 -12
  133. package/modules/svg.js +1 -1
  134. package/modules/sync.cjs +1 -1
  135. package/modules/sync.d.ts +13 -13
  136. package/modules/sync.js +1 -1
  137. package/modules/system.cjs +1 -1
  138. package/modules/system.d.ts +2 -2
  139. package/modules/system.js +1 -1
  140. package/modules/text.cjs +2 -2
  141. package/modules/text.d.ts +13 -12
  142. package/modules/text.js +2 -2
  143. package/modules/timer.cjs +1 -1
  144. package/modules/timer.d.ts +3 -3
  145. package/modules/timer.js +1 -1
  146. package/modules/tools.cjs +1 -1
  147. package/modules/tools.d.ts +5 -5
  148. package/modules/tools.js +1 -1
  149. package/modules/translators.cjs +1 -1
  150. package/modules/translators.d.ts +2 -2
  151. package/modules/translators.js +1 -1
  152. package/modules/triggers.cjs +1 -1
  153. package/modules/triggers.d.ts +43 -43
  154. package/modules/triggers.js +1 -1
  155. package/modules/types.cjs +1 -1
  156. package/modules/types.d.ts +5 -5
  157. package/modules/types.js +1 -1
  158. package/modules/ui.cjs +1 -1
  159. package/modules/ui.d.ts +3 -3
  160. package/modules/ui.js +1 -1
  161. package/modules/window.cjs +1 -1
  162. package/modules/window.d.ts +9 -9
  163. package/modules/window.js +1 -1
  164. package/modules/worker.cjs +1 -1
  165. package/modules/worker.d.ts +16 -16
  166. package/modules/worker.js +1 -1
  167. package/package.json +2 -2
  168. package/sbom.json +14 -9
  169. package/types/dphelper.d.ts +546 -545
  170. package/types/global.d.ts +8 -8
package/SECURITY.md CHANGED
@@ -1,27 +1,27 @@
1
- # Security Policy
2
-
3
- ## Supported Versions
4
-
5
- | Version | Supported |
6
- | ------- | --------- |
7
- | 3.9.x | ✅ |
8
- | < 3.5 | ❌ |
9
-
10
- ## Security Standards
11
-
12
- - **NIST SP 800-53:** 98% compliance
13
- - **OWASP Top 10:** 100% compliance
14
- - **Socket.dev:** 90%+ target
15
-
16
- ## Reporting a Vulnerability
17
-
18
- Email: architecture@biglogic.ca
19
- Response: Within 24 hours
20
-
21
- ## Security Features
22
-
23
- - PBKDF2 310k iterations (OWASP 2023)
24
- - AES-GCM 256-bit encryption
25
- - TLS 1.2+ enforcement
26
- - WebSocket wss:// only
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ | Version | Supported |
6
+ | ------- | --------- |
7
+ | 3.9.x | ✅ |
8
+ | < 3.5 | ❌ |
9
+
10
+ ## Security Standards
11
+
12
+ - **NIST SP 800-53:** 98% compliance
13
+ - **OWASP Top 10:** 100% compliance
14
+ - **Socket.dev:** 90%+ target
15
+
16
+ ## Reporting a Vulnerability
17
+
18
+ Email: architecture@biglogic.ca
19
+ Response: Within 24 hours
20
+
21
+ ## Security Features
22
+
23
+ - PBKDF2 310k iterations (OWASP 2023)
24
+ - AES-GCM 256-bit encryption
25
+ - TLS 1.2+ enforcement
26
+ - WebSocket wss:// only
27
27
  - Input validation on all endpoints
package/SUMMARY.md CHANGED
@@ -1,83 +1,83 @@
1
- # Table of Contents
2
-
3
- - [dpHelper](../README.md)
4
-
5
- ---
6
-
7
- ## Core Tools
8
-
9
- - [ai](markdown/ai.md)
10
- - [array](markdown/array.md)
11
- - [browser](markdown/browser.md)
12
- - [check](markdown/check.md)
13
- - [date](markdown/date.md)
14
- - [form](markdown/form.md)
15
- - [json](markdown/json.md)
16
- - [load](markdown/load.md)
17
- - [navigation](markdown/navigation.md)
18
- - [security](markdown/security.md)
19
- - [socket](markdown/socket.md)
20
- - [svg](markdown/svg.md)
21
- - [markdown](markdown/markdown.md)
22
- - [window](markdown/window.md)
23
-
24
- ---
25
-
26
- ## UI & DOM
27
-
28
- - [anchor](markdown/anchor.md)
29
- - [audio](markdown/audio.md)
30
- - [color](markdown/color.md)
31
- - [coords](markdown/coords.md)
32
- - [disable](markdown/disable.md)
33
- - [dispatch](markdown/dispatch.md)
34
- - [element](markdown/element.md)
35
- - [event](markdown/event.md)
36
- - [scrollbar](markdown/scrollbar.md)
37
- - [screen](markdown/screen.md)
38
- - [trigger](markdown/trigger.md)
39
- - [type](markdown/type.md)
40
- - [types](markdown/types.md)
41
- - [ui](markdown/ui.md)
42
-
43
- ---
44
-
45
- ## Data & Text
46
-
47
- - [format](markdown/format.md)
48
- - [math](markdown/math.md)
49
- - [objects](markdown/objects.md)
50
- - [path](markdown/path.md)
51
- - [sanitize](markdown/sanitize.md)
52
- - [text](markdown/text.md)
53
- - [translators](markdown/translators.md)
54
-
55
- ---
56
-
57
- ## Network & Storage
58
-
59
- - [cookie](markdown/cookie.md)
60
- - [compress](markdown/compress.md)
61
- - [fetch](markdown/fetch.md)
62
- - [net](markdown/net.md)
63
- - [sse](markdown/sse.md)
64
- - [sync](markdown/sync.md)
65
-
66
- ---
67
-
68
- ## Advanced
69
-
70
- - [avoid](markdown/avoid.md)
71
- - [biometric](markdown/biometric.md)
72
- - [credits](markdown/credits.md)
73
- - [i18n](markdown/i18n.md)
74
- - [image](markdown/image.md)
75
- - [logging](markdown/logging.md)
76
- - [memory](markdown/memory.md)
77
- - [promise](markdown/promise.md)
78
- - [shortcut](markdown/shortcut.md)
79
- - [system](markdown/system.md)
80
- - [terminal](markdown/terminal.md)
81
- - [timer](markdown/timer.md)
82
- - [triggers](markdown/triggers.md)
83
- - [worker](markdown/worker.md)
1
+ # Table of Contents
2
+
3
+ - [dpHelper](../README.md)
4
+
5
+ ---
6
+
7
+ ## Core Tools
8
+
9
+ - [ai](markdown/ai.md)
10
+ - [array](markdown/array.md)
11
+ - [browser](markdown/browser.md)
12
+ - [check](markdown/check.md)
13
+ - [date](markdown/date.md)
14
+ - [form](markdown/form.md)
15
+ - [json](markdown/json.md)
16
+ - [load](markdown/load.md)
17
+ - [navigation](markdown/navigation.md)
18
+ - [security](markdown/security.md)
19
+ - [socket](markdown/socket.md)
20
+ - [svg](markdown/svg.md)
21
+ - [markdown](markdown/markdown.md)
22
+ - [window](markdown/window.md)
23
+
24
+ ---
25
+
26
+ ## UI & DOM
27
+
28
+ - [anchor](markdown/anchor.md)
29
+ - [audio](markdown/audio.md)
30
+ - [color](markdown/color.md)
31
+ - [coords](markdown/coords.md)
32
+ - [disable](markdown/disable.md)
33
+ - [dispatch](markdown/dispatch.md)
34
+ - [element](markdown/element.md)
35
+ - [event](markdown/event.md)
36
+ - [scrollbar](markdown/scrollbar.md)
37
+ - [screen](markdown/screen.md)
38
+ - [trigger](markdown/trigger.md)
39
+ - [type](markdown/type.md)
40
+ - [types](markdown/types.md)
41
+ - [ui](markdown/ui.md)
42
+
43
+ ---
44
+
45
+ ## Data & Text
46
+
47
+ - [format](markdown/format.md)
48
+ - [math](markdown/math.md)
49
+ - [objects](markdown/objects.md)
50
+ - [path](markdown/path.md)
51
+ - [sanitize](markdown/sanitize.md)
52
+ - [text](markdown/text.md)
53
+ - [translators](markdown/translators.md)
54
+
55
+ ---
56
+
57
+ ## Network & Storage
58
+
59
+ - [cookie](markdown/cookie.md)
60
+ - [compress](markdown/compress.md)
61
+ - [fetch](markdown/fetch.md)
62
+ - [net](markdown/net.md)
63
+ - [sse](markdown/sse.md)
64
+ - [sync](markdown/sync.md)
65
+
66
+ ---
67
+
68
+ ## Advanced
69
+
70
+ - [avoid](markdown/avoid.md)
71
+ - [biometric](markdown/biometric.md)
72
+ - [credits](markdown/credits.md)
73
+ - [i18n](markdown/i18n.md)
74
+ - [image](markdown/image.md)
75
+ - [logging](markdown/logging.md)
76
+ - [memory](markdown/memory.md)
77
+ - [promise](markdown/promise.md)
78
+ - [shortcut](markdown/shortcut.md)
79
+ - [system](markdown/system.md)
80
+ - [terminal](markdown/terminal.md)
81
+ - [timer](markdown/timer.md)
82
+ - [triggers](markdown/triggers.md)
83
+ - [worker](markdown/worker.md)
package/index.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var V={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var x={codeName:"dphelper",version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...V},configurable:true,writable:true},version:{value:x.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var P=dphelper;Object.defineProperty(P,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(P,"setDescription",{value:(e,t)=>{Object.defineProperties(P,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(P[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),P.setProps(P,e,{writable:false,configurable:false,enumerable:false}),P._list.scripts.push(e);}});var ue={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},B=e=>e===null||typeof e!="object",H=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
1
+ 'use strict';var V={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var x={codeName:"dphelper",version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...V},configurable:true,writable:true},version:{value:x.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var P=dphelper;Object.defineProperty(P,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(P,"setDescription",{value:(e,t)=>{Object.defineProperties(P,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(P[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),P.setProps(P,e,{writable:false,configurable:false,enumerable:false}),P._list.scripts.push(e);}});var ue={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},B=e=>e===null||typeof e!="object",H=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
2
2
  `)||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),N=(e,t=0)=>{let r=" ".repeat(t);if(B(e))return H(e);if(Array.isArray(e)){if(e.length===0)return "[0]:";let n=e[0];if(!B(n)&&!Array.isArray(n)){let o=Object.keys(n),a=`[${e.length}]{${o.join(",")}}:`;for(let i of e){let s=o.map(l=>H(i[l])).join(",");a+=`
3
3
  ${r} ${s}`;}return a}else return `[${e.length}]: `+e.map(H).join(",")}else return Object.entries(e).map(([n,o])=>{let a=n.includes(" ")||n.includes(":")?`"${n}"`:n;if(!B(o)){let i=N(o,t+1);return i.startsWith("[")?`${a}${i}`:`${a}:
4
4
  ${r}${i}`}return `${a}: ${H(o)}`}).join(`
@@ -143,7 +143,7 @@ ${t(i,`${n} `)}${n}</${a}>
143
143
  )
144
144
 
145
145
  Copyright text (c) became an html symbol
146
- `,env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20250612",lastMod:"20250612"}]},Xr={trim:(e,t,r,n)=>e.charAt(0)===t?e.substring(r,n):e,capitalize:e=>e.toLowerCase().replace(/\b\w/g,t=>t.toUpperCase()),lower:e=>e.toLowerCase(),upper:e=>e.toUpperCase(),nl2br:e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/(?:\r\n|\r|\n)/g,"<br>"),sanitize:e=>e.replace(/<(|\/|[^>\bi]|\/[^>bi]|[^/>][^>]+|\/[^>][^>]+)>/g,""),camelCase:{toSpace:e=>e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()),toUnderscore:e=>e.replace(/\.?([A-Z])/g,(t,r)=>`_${r.toLowerCase()}`).replace(/^_/,"")},fitContainer:e=>{if(!e)return;function t(r){let n=document.querySelectorAll(r),o=n.length;if(!(o<=0))for(let a=0;a<o;a++){let i=n[a].offsetWidth*.05;n[a].style.fontSize=`${i}px`;}}dphelper.addListenerMulti(window,"load resize",()=>t(e));},keywords:e=>{let t=/\b[A-Z][a-z]+\b/g,r=e.match(t)?.filter(n=>n.length>3)||[];return [...new Set(r.map(n=>n.toLowerCase()))]},replaceText:(e,t)=>{let r=e;for(let n in t)Object.hasOwn(t,n)&&(r=r.replaceAll(n,t[n]||""));return r}};dphelper?.setDescription(Zr,Xr);var Qr={name:"timer",active:true,subCommand:[{name:"sleep",version:"0.0.2",example:"dphelper.timer.sleep([ms]) ",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pauses execution for a specified number of milliseconds.",env:"both",subCommand:[]},{name:"percentage",version:"0.0.2",example:"dphelper.timer.percentage([start], [end])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the percentage of time elapsed between two time strings.",env:"both",subCommand:[]}]},en={sleep:e=>new Promise(t=>setTimeout(t,e)),percentage:(e,t)=>{function r(n){let o=n.split(":");return Number.parseInt(o[0]||"",10)*3600+Number.parseInt(o[1]||"",10)*60+Number.parseInt(o[2]||"",10)}return (100*r(e)/r(t)).toFixed(2)}};dphelper?.setDescription(Qr,en);var tn={name:"tools",active:true,subCommand:[{name:"byteSize",description:"Give you the total in 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb' starting from bytes",example:"dphelper.tools.byteSize(bytes)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"both",subCommand:[]},{name:"hashPass",description:"Hashes a password using a specified number and total.",example:"dphelper.tools.hashPass(number, total)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"both",subCommand:[]},{name:"zIndex",description:"Finds the highest z-index value in the document.",example:"dphelper.tools.zIndex()",version:"0.0.2",author:"Dario Passariello",creationDate:"20240807",lastMod:"20240807",type:"function",active:true,env:"both",subCommand:[]},{name:"zeroToFalse",description:"Converts zero to false, otherwise returns the value.",example:"dphelper.tools.zeroToFalse(num)",version:"0.0.2",author:"Dario Passariello",creationDate:"20240924",lastMod:"20240924",type:"function",active:true,env:"both",subCommand:[]}]},rn={byteSize:e=>{if(Math.abs(e)<1024)return `${e}b`;let r=["Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],n=-1,o=e;do o/=1024,++n;while(Math.abs(o)>=1024&&n<r.length-1);return o.toFixed(1)+r[n]},zIndex:()=>Array.from(document.querySelectorAll("body *")).map(e=>Number.parseFloat(getComputedStyle(e).zIndex)).reduce((e,t)=>t>e?t:e,1),zeroToFalse:e=>e===0?false:e};dphelper?.setDescription(tn,rn);var nn={name:"translators",active:true,subCommand:[{name:"convertMatrixToScale",version:"0.0.2",example:"dphelper.translators.convertMatrixToScale({value})",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a transformation matrix to a scale value.",env:"both",subCommand:[]}]},on={convertMatrixToScale:e=>{let t=e.split("(");if(t.length<2)return 0;let r=t[1].split(")")[0];if(!r)return 0;let n=r.split(","),o=Number.parseFloat(n[0]||"0"),a=Number.parseFloat(n[1]||"0");return Math.sqrt(o*o+a*a)}};dphelper?.setDescription(nn,on);var an={name:"triggers",active:true,subCommand:[{name:"add",version:"0.0.1",example:"dphelper.triggers.add('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Add a trigger for custom events.",env:"client",subCommand:[]},{name:"on",version:"0.0.1",example:"dphelper.triggers.on('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Listen for a trigger event.",env:"client",subCommand:[]},{name:"emit",version:"0.0.1",example:"dphelper.triggers.emit('event', data)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Emit a trigger event.",env:"client",subCommand:[]},{name:"remove",version:"0.0.1",example:"dphelper.triggers.remove('event')",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Remove a trigger event.",env:"client",subCommand:[]}]},M=new Map,ie={add:(e,t)=>{M.has(e)||M.set(e,new Set),M.get(e).add(t);},on:(e,t)=>{ie.add(e,t);},emit:(e,...t)=>{let r=M.get(e);r&&r.forEach(n=>{try{n(...t);}catch(o){console.error(`Error in trigger callback for event '${e}':`,o);}});},remove:e=>{M.delete(e);},off:(e,t)=>{let r=M.get(e);r&&r.delete(t);},clear:()=>{M.clear();},list:()=>Array.from(M.keys())};dphelper?.setDescription(an,ie);var sn={name:"type",active:true,subCommand:[{name:"of",version:"0.0.2",example:"dphelper.type.of(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Returns the type of the given parameter.",env:"both",subCommand:[]},{name:"instOfObj",version:"0.0.2",example:"dphelper.type.instOfObj(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is an instance of Object.",env:"both",subCommand:[]},{name:"isNaN",version:"0.0.2",example:"dphelper.type.isNaN(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is NaN.",env:"both",subCommand:[]},{name:"isBool",version:"0.0.2",example:"dphelper.type.isBool(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is a boolean.",env:"both",subCommand:[]}]},ln={of:e=>typeof e,instOfObj:e=>e instanceof Object,isNull:e=>t=>!e(t),isBool:e=>!e||e.length==null?true:e==="1"};dphelper?.setDescription(sn,ln);var cn={name:"UI",active:true,subCommand:[{name:"input",version:"0.0.2",example:"dphelper.UI.input(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Creates an input element with specified options.",env:"client",subCommand:[]},{name:"fps",version:"0.0.2",example:"dphelper.UI.fps(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Toggle a real-time FPS and Memory monitor overlay",env:"client",subCommand:[]},{name:"boxModel",version:"0.0.2",example:"dphelper.UI.boxModel(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Toggle visual box-model highlighter for all elements",env:"client",subCommand:[]},{name:"anchorContext",version:"0.0.1",example:"dphelper.UI.anchorContext()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Snapshot and auto-restore UI state (inputs, scroll) across reloads.",env:"client",subCommand:[]}]},dn={anchorContext:()=>{if(typeof window>"u"||typeof localStorage>"u")return;let e=`dp_anchor_${btoa(location.pathname).replace(/=/g,"")}`,t=()=>{let n={scroll:{x:window.scrollX,y:window.scrollY},inputs:Array.from(document.querySelectorAll("input, textarea, select")).filter(o=>o.type!=="password"&&!o.hasAttribute("data-private")&&o.getAttribute("autocomplete")!=="off").map(o=>({id:o.id,name:o.name,value:o.value}))};localStorage.setItem(e,JSON.stringify(n));},r=()=>{let n=localStorage.getItem(e);if(n)try{let o=JSON.parse(n);window.scrollTo(o.scroll.x,o.scroll.y),o.inputs.forEach(a=>{let i=a.id?document.getElementById(a.id):document.querySelector(`[name="${a.name}"]`);i&&(i.value=a.value);});}catch{console.warn("dphelper: anchorContext restoration failed.");}};window.addEventListener("beforeunload",t),r();},fps:(e=true)=>{if(typeof document>"u")return;let t=document.getElementById("dphelper-fps-monitor");if(!e){t?.remove();return}t||(t=document.createElement("div"),t.id="dphelper-fps-monitor",Object.assign(t.style,{position:"fixed",top:"10px",right:"10px",padding:"8px 12px",background:"rgba(0,0,0,0.8)",color:"#0f0",fontFamily:"monospace",fontSize:"12px",zIndex:"99999",borderRadius:"4px",pointerEvents:"none",boxShadow:"0 2px 10px rgba(0,0,0,0.5)",border:"1px solid #333"}),document.body.appendChild(t));let r=0,n=performance.now(),o=()=>{if(!document.getElementById("dphelper-fps-monitor"))return;r++;let a=performance.now();if(a>=n+1e3){let i=Math.round(r*1e3/(a-n)),s=performance.memory?` | Mem: ${Math.round(performance.memory.usedJSHeapSize/1048576)}MB`:"";t.innerText=`FPS: ${i}${s}`,r=0,n=a;}requestAnimationFrame(o);};requestAnimationFrame(o);},boxModel:(e=true)=>{if(typeof document>"u")return;let t=document.getElementById("dphelper-boxmodel-style");if(!e){t?.remove();return}t||(t=document.createElement("style"),t.id="dphelper-boxmodel-style",t.innerHTML=`
146
+ `,env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20250612",lastMod:"20250612"},{name:"subString",version:"0.0.1",example:"dphelper.text.subString(text)",type:"function",active:true,description:"Length Of Longest Substring",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20260801",lastMod:"20260801"}]},Xr={trim:(e,t,r,n)=>e.charAt(0)===t?e.substring(r,n):e,capitalize:e=>e.toLowerCase().replace(/\b\w/g,t=>t.toUpperCase()),lower:e=>e.toLowerCase(),upper:e=>e.toUpperCase(),nl2br:e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/(?:\r\n|\r|\n)/g,"<br>"),sanitize:e=>e.replace(/<(|\/|[^>\bi]|\/[^>bi]|[^/>][^>]+|\/[^>][^>]+)>/g,""),camelCase:{toSpace:e=>e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()),toUnderscore:e=>e.replace(/\.?([A-Z])/g,(t,r)=>`_${r.toLowerCase()}`).replace(/^_/,"")},fitContainer:e=>{if(!e)return;function t(r){let n=document.querySelectorAll(r),o=n.length;if(!(o<=0))for(let a=0;a<o;a++){let i=n[a].offsetWidth*.05;n[a].style.fontSize=`${i}px`;}}dphelper.addListenerMulti(window,"load resize",()=>t(e));},keywords:e=>{let t=/\b[A-Z][a-z]+\b/g,r=e.match(t)?.filter(n=>n.length>3)||[];return [...new Set(r.map(n=>n.toLowerCase()))]},replaceText:(e,t)=>{let r=e;for(let n in t)Object.hasOwn(t,n)&&(r=r.replaceAll(n,t[n]||""));return r},subString:e=>{let t=new Int32Array(65536);t.fill(-1);let r=0,n=0;for(let o=0;o<e.length;o++){let a=e.charCodeAt(o),i=t[a];r=r+(i-r+1&-(i>=r)),t[a]=o;let s=o-r+1;n=n+(s-n&-(s>n));}return n}};dphelper?.setDescription(Zr,Xr);var Qr={name:"timer",active:true,subCommand:[{name:"sleep",version:"0.0.2",example:"dphelper.timer.sleep([ms]) ",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pauses execution for a specified number of milliseconds.",env:"both",subCommand:[]},{name:"percentage",version:"0.0.2",example:"dphelper.timer.percentage([start], [end])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the percentage of time elapsed between two time strings.",env:"both",subCommand:[]}]},en={sleep:e=>new Promise(t=>setTimeout(t,e)),percentage:(e,t)=>{function r(n){let o=n.split(":");return Number.parseInt(o[0]||"",10)*3600+Number.parseInt(o[1]||"",10)*60+Number.parseInt(o[2]||"",10)}return (100*r(e)/r(t)).toFixed(2)}};dphelper?.setDescription(Qr,en);var tn={name:"tools",active:true,subCommand:[{name:"byteSize",description:"Give you the total in 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb' starting from bytes",example:"dphelper.tools.byteSize(bytes)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"both",subCommand:[]},{name:"hashPass",description:"Hashes a password using a specified number and total.",example:"dphelper.tools.hashPass(number, total)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"both",subCommand:[]},{name:"zIndex",description:"Finds the highest z-index value in the document.",example:"dphelper.tools.zIndex()",version:"0.0.2",author:"Dario Passariello",creationDate:"20240807",lastMod:"20240807",type:"function",active:true,env:"both",subCommand:[]},{name:"zeroToFalse",description:"Converts zero to false, otherwise returns the value.",example:"dphelper.tools.zeroToFalse(num)",version:"0.0.2",author:"Dario Passariello",creationDate:"20240924",lastMod:"20240924",type:"function",active:true,env:"both",subCommand:[]}]},rn={byteSize:e=>{if(Math.abs(e)<1024)return `${e}b`;let r=["Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],n=-1,o=e;do o/=1024,++n;while(Math.abs(o)>=1024&&n<r.length-1);return o.toFixed(1)+r[n]},zIndex:()=>Array.from(document.querySelectorAll("body *")).map(e=>Number.parseFloat(getComputedStyle(e).zIndex)).reduce((e,t)=>t>e?t:e,1),zeroToFalse:e=>e===0?false:e};dphelper?.setDescription(tn,rn);var nn={name:"translators",active:true,subCommand:[{name:"convertMatrixToScale",version:"0.0.2",example:"dphelper.translators.convertMatrixToScale({value})",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a transformation matrix to a scale value.",env:"both",subCommand:[]}]},on={convertMatrixToScale:e=>{let t=e.split("(");if(t.length<2)return 0;let r=t[1].split(")")[0];if(!r)return 0;let n=r.split(","),o=Number.parseFloat(n[0]||"0"),a=Number.parseFloat(n[1]||"0");return Math.sqrt(o*o+a*a)}};dphelper?.setDescription(nn,on);var an={name:"triggers",active:true,subCommand:[{name:"add",version:"0.0.1",example:"dphelper.triggers.add('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Add a trigger for custom events.",env:"client",subCommand:[]},{name:"on",version:"0.0.1",example:"dphelper.triggers.on('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Listen for a trigger event.",env:"client",subCommand:[]},{name:"emit",version:"0.0.1",example:"dphelper.triggers.emit('event', data)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Emit a trigger event.",env:"client",subCommand:[]},{name:"remove",version:"0.0.1",example:"dphelper.triggers.remove('event')",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Remove a trigger event.",env:"client",subCommand:[]}]},M=new Map,ie={add:(e,t)=>{M.has(e)||M.set(e,new Set),M.get(e).add(t);},on:(e,t)=>{ie.add(e,t);},emit:(e,...t)=>{let r=M.get(e);r&&r.forEach(n=>{try{n(...t);}catch(o){console.error(`Error in trigger callback for event '${e}':`,o);}});},remove:e=>{M.delete(e);},off:(e,t)=>{let r=M.get(e);r&&r.delete(t);},clear:()=>{M.clear();},list:()=>Array.from(M.keys())};dphelper?.setDescription(an,ie);var sn={name:"type",active:true,subCommand:[{name:"of",version:"0.0.2",example:"dphelper.type.of(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Returns the type of the given parameter.",env:"both",subCommand:[]},{name:"instOfObj",version:"0.0.2",example:"dphelper.type.instOfObj(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is an instance of Object.",env:"both",subCommand:[]},{name:"isNaN",version:"0.0.2",example:"dphelper.type.isNaN(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is NaN.",env:"both",subCommand:[]},{name:"isBool",version:"0.0.2",example:"dphelper.type.isBool(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is a boolean.",env:"both",subCommand:[]}]},ln={of:e=>typeof e,instOfObj:e=>e instanceof Object,isNull:e=>t=>!e(t),isBool:e=>!e||e.length==null?true:e==="1"};dphelper?.setDescription(sn,ln);var cn={name:"UI",active:true,subCommand:[{name:"input",version:"0.0.2",example:"dphelper.UI.input(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Creates an input element with specified options.",env:"client",subCommand:[]},{name:"fps",version:"0.0.2",example:"dphelper.UI.fps(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Toggle a real-time FPS and Memory monitor overlay",env:"client",subCommand:[]},{name:"boxModel",version:"0.0.2",example:"dphelper.UI.boxModel(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Toggle visual box-model highlighter for all elements",env:"client",subCommand:[]},{name:"anchorContext",version:"0.0.1",example:"dphelper.UI.anchorContext()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Snapshot and auto-restore UI state (inputs, scroll) across reloads.",env:"client",subCommand:[]}]},dn={anchorContext:()=>{if(typeof window>"u"||typeof localStorage>"u")return;let e=`dp_anchor_${btoa(location.pathname).replace(/=/g,"")}`,t=()=>{let n={scroll:{x:window.scrollX,y:window.scrollY},inputs:Array.from(document.querySelectorAll("input, textarea, select")).filter(o=>o.type!=="password"&&!o.hasAttribute("data-private")&&o.getAttribute("autocomplete")!=="off").map(o=>({id:o.id,name:o.name,value:o.value}))};localStorage.setItem(e,JSON.stringify(n));},r=()=>{let n=localStorage.getItem(e);if(n)try{let o=JSON.parse(n);window.scrollTo(o.scroll.x,o.scroll.y),o.inputs.forEach(a=>{let i=a.id?document.getElementById(a.id):document.querySelector(`[name="${a.name}"]`);i&&(i.value=a.value);});}catch{console.warn("dphelper: anchorContext restoration failed.");}};window.addEventListener("beforeunload",t),r();},fps:(e=true)=>{if(typeof document>"u")return;let t=document.getElementById("dphelper-fps-monitor");if(!e){t?.remove();return}t||(t=document.createElement("div"),t.id="dphelper-fps-monitor",Object.assign(t.style,{position:"fixed",top:"10px",right:"10px",padding:"8px 12px",background:"rgba(0,0,0,0.8)",color:"#0f0",fontFamily:"monospace",fontSize:"12px",zIndex:"99999",borderRadius:"4px",pointerEvents:"none",boxShadow:"0 2px 10px rgba(0,0,0,0.5)",border:"1px solid #333"}),document.body.appendChild(t));let r=0,n=performance.now(),o=()=>{if(!document.getElementById("dphelper-fps-monitor"))return;r++;let a=performance.now();if(a>=n+1e3){let i=Math.round(r*1e3/(a-n)),s=performance.memory?` | Mem: ${Math.round(performance.memory.usedJSHeapSize/1048576)}MB`:"";t.innerText=`FPS: ${i}${s}`,r=0,n=a;}requestAnimationFrame(o);};requestAnimationFrame(o);},boxModel:(e=true)=>{if(typeof document>"u")return;let t=document.getElementById("dphelper-boxmodel-style");if(!e){t?.remove();return}t||(t=document.createElement("style"),t.id="dphelper-boxmodel-style",t.innerHTML=`
147
147
  * { outline: 1px solid rgba(255, 0, 0, 0.3) !important; }
148
148
  * * { outline: 1px solid rgba(0, 255, 0, 0.3) !important; }
149
149
  * * * { outline: 1px solid rgba(0, 0, 255, 0.3) !important; }
package/index.d.ts CHANGED
@@ -1 +1 @@
1
- /// <reference path="./types/dphelper.d.ts" />
1
+ /// <reference path="./types/dphelper.d.ts" />
package/index.js CHANGED
@@ -1,4 +1,4 @@
1
- var K={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var C={codeName:"dphelper",version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...K},configurable:true,writable:true},version:{value:C.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var k=dphelper;Object.defineProperty(k,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(k,"setDescription",{value:(e,t)=>{Object.defineProperties(k,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(k[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),k.setProps(k,e,{writable:false,configurable:false,enumerable:false}),k._list.scripts.push(e);}});var pe={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},W=e=>e===null||typeof e!="object",U=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
1
+ var K={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var C={codeName:"dphelper",version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...K},configurable:true,writable:true},version:{value:C.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var k=dphelper;Object.defineProperty(k,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(k,"setDescription",{value:(e,t)=>{Object.defineProperties(k,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(k[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),k.setProps(k,e,{writable:false,configurable:false,enumerable:false}),k._list.scripts.push(e);}});var pe={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},W=e=>e===null||typeof e!="object",U=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
2
2
  `)||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),$=(e,t=0)=>{let r=" ".repeat(t);if(W(e))return U(e);if(Array.isArray(e)){if(e.length===0)return "[0]:";let n=e[0];if(!W(n)&&!Array.isArray(n)){let o=Object.keys(n),a=`[${e.length}]{${o.join(",")}}:`;for(let i of e){let s=o.map(l=>U(i[l])).join(",");a+=`
3
3
  ${r} ${s}`;}return a}else return `[${e.length}]: `+e.map(U).join(",")}else return Object.entries(e).map(([n,o])=>{let a=n.includes(" ")||n.includes(":")?`"${n}"`:n;if(!W(o)){let i=$(o,t+1);return i.startsWith("[")?`${a}${i}`:`${a}:
4
4
  ${r}${i}`}return `${a}: ${U(o)}`}).join(`
@@ -143,7 +143,7 @@ ${t(i,`${n} `)}${n}</${a}>
143
143
  )
144
144
 
145
145
  Copyright text (c) became an html symbol
146
- `,env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20250612",lastMod:"20250612"}]},Qr={trim:(e,t,r,n)=>e.charAt(0)===t?e.substring(r,n):e,capitalize:e=>e.toLowerCase().replace(/\b\w/g,t=>t.toUpperCase()),lower:e=>e.toLowerCase(),upper:e=>e.toUpperCase(),nl2br:e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/(?:\r\n|\r|\n)/g,"<br>"),sanitize:e=>e.replace(/<(|\/|[^>\bi]|\/[^>bi]|[^/>][^>]+|\/[^>][^>]+)>/g,""),camelCase:{toSpace:e=>e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()),toUnderscore:e=>e.replace(/\.?([A-Z])/g,(t,r)=>`_${r.toLowerCase()}`).replace(/^_/,"")},fitContainer:e=>{if(!e)return;function t(r){let n=document.querySelectorAll(r),o=n.length;if(!(o<=0))for(let a=0;a<o;a++){let i=n[a].offsetWidth*.05;n[a].style.fontSize=`${i}px`;}}dphelper.addListenerMulti(window,"load resize",()=>t(e));},keywords:e=>{let t=/\b[A-Z][a-z]+\b/g,r=e.match(t)?.filter(n=>n.length>3)||[];return [...new Set(r.map(n=>n.toLowerCase()))]},replaceText:(e,t)=>{let r=e;for(let n in t)Object.hasOwn(t,n)&&(r=r.replaceAll(n,t[n]||""));return r}};dphelper?.setDescription(Xr,Qr);var en={name:"timer",active:true,subCommand:[{name:"sleep",version:"0.0.2",example:"dphelper.timer.sleep([ms]) ",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pauses execution for a specified number of milliseconds.",env:"both",subCommand:[]},{name:"percentage",version:"0.0.2",example:"dphelper.timer.percentage([start], [end])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the percentage of time elapsed between two time strings.",env:"both",subCommand:[]}]},tn={sleep:e=>new Promise(t=>setTimeout(t,e)),percentage:(e,t)=>{function r(n){let o=n.split(":");return Number.parseInt(o[0]||"",10)*3600+Number.parseInt(o[1]||"",10)*60+Number.parseInt(o[2]||"",10)}return (100*r(e)/r(t)).toFixed(2)}};dphelper?.setDescription(en,tn);var rn={name:"tools",active:true,subCommand:[{name:"byteSize",description:"Give you the total in 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb' starting from bytes",example:"dphelper.tools.byteSize(bytes)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"both",subCommand:[]},{name:"hashPass",description:"Hashes a password using a specified number and total.",example:"dphelper.tools.hashPass(number, total)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"both",subCommand:[]},{name:"zIndex",description:"Finds the highest z-index value in the document.",example:"dphelper.tools.zIndex()",version:"0.0.2",author:"Dario Passariello",creationDate:"20240807",lastMod:"20240807",type:"function",active:true,env:"both",subCommand:[]},{name:"zeroToFalse",description:"Converts zero to false, otherwise returns the value.",example:"dphelper.tools.zeroToFalse(num)",version:"0.0.2",author:"Dario Passariello",creationDate:"20240924",lastMod:"20240924",type:"function",active:true,env:"both",subCommand:[]}]},nn={byteSize:e=>{if(Math.abs(e)<1024)return `${e}b`;let r=["Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],n=-1,o=e;do o/=1024,++n;while(Math.abs(o)>=1024&&n<r.length-1);return o.toFixed(1)+r[n]},zIndex:()=>Array.from(document.querySelectorAll("body *")).map(e=>Number.parseFloat(getComputedStyle(e).zIndex)).reduce((e,t)=>t>e?t:e,1),zeroToFalse:e=>e===0?false:e};dphelper?.setDescription(rn,nn);var on={name:"translators",active:true,subCommand:[{name:"convertMatrixToScale",version:"0.0.2",example:"dphelper.translators.convertMatrixToScale({value})",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a transformation matrix to a scale value.",env:"both",subCommand:[]}]},an={convertMatrixToScale:e=>{let t=e.split("(");if(t.length<2)return 0;let r=t[1].split(")")[0];if(!r)return 0;let n=r.split(","),o=Number.parseFloat(n[0]||"0"),a=Number.parseFloat(n[1]||"0");return Math.sqrt(o*o+a*a)}};dphelper?.setDescription(on,an);var sn={name:"triggers",active:true,subCommand:[{name:"add",version:"0.0.1",example:"dphelper.triggers.add('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Add a trigger for custom events.",env:"client",subCommand:[]},{name:"on",version:"0.0.1",example:"dphelper.triggers.on('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Listen for a trigger event.",env:"client",subCommand:[]},{name:"emit",version:"0.0.1",example:"dphelper.triggers.emit('event', data)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Emit a trigger event.",env:"client",subCommand:[]},{name:"remove",version:"0.0.1",example:"dphelper.triggers.remove('event')",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Remove a trigger event.",env:"client",subCommand:[]}]},S=new Map,se={add:(e,t)=>{S.has(e)||S.set(e,new Set),S.get(e).add(t);},on:(e,t)=>{se.add(e,t);},emit:(e,...t)=>{let r=S.get(e);r&&r.forEach(n=>{try{n(...t);}catch(o){console.error(`Error in trigger callback for event '${e}':`,o);}});},remove:e=>{S.delete(e);},off:(e,t)=>{let r=S.get(e);r&&r.delete(t);},clear:()=>{S.clear();},list:()=>Array.from(S.keys())};dphelper?.setDescription(sn,se);var ln={name:"type",active:true,subCommand:[{name:"of",version:"0.0.2",example:"dphelper.type.of(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Returns the type of the given parameter.",env:"both",subCommand:[]},{name:"instOfObj",version:"0.0.2",example:"dphelper.type.instOfObj(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is an instance of Object.",env:"both",subCommand:[]},{name:"isNaN",version:"0.0.2",example:"dphelper.type.isNaN(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is NaN.",env:"both",subCommand:[]},{name:"isBool",version:"0.0.2",example:"dphelper.type.isBool(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is a boolean.",env:"both",subCommand:[]}]},cn={of:e=>typeof e,instOfObj:e=>e instanceof Object,isNull:e=>t=>!e(t),isBool:e=>!e||e.length==null?true:e==="1"};dphelper?.setDescription(ln,cn);var dn={name:"UI",active:true,subCommand:[{name:"input",version:"0.0.2",example:"dphelper.UI.input(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Creates an input element with specified options.",env:"client",subCommand:[]},{name:"fps",version:"0.0.2",example:"dphelper.UI.fps(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Toggle a real-time FPS and Memory monitor overlay",env:"client",subCommand:[]},{name:"boxModel",version:"0.0.2",example:"dphelper.UI.boxModel(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Toggle visual box-model highlighter for all elements",env:"client",subCommand:[]},{name:"anchorContext",version:"0.0.1",example:"dphelper.UI.anchorContext()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Snapshot and auto-restore UI state (inputs, scroll) across reloads.",env:"client",subCommand:[]}]},un={anchorContext:()=>{if(typeof window>"u"||typeof localStorage>"u")return;let e=`dp_anchor_${btoa(location.pathname).replace(/=/g,"")}`,t=()=>{let n={scroll:{x:window.scrollX,y:window.scrollY},inputs:Array.from(document.querySelectorAll("input, textarea, select")).filter(o=>o.type!=="password"&&!o.hasAttribute("data-private")&&o.getAttribute("autocomplete")!=="off").map(o=>({id:o.id,name:o.name,value:o.value}))};localStorage.setItem(e,JSON.stringify(n));},r=()=>{let n=localStorage.getItem(e);if(n)try{let o=JSON.parse(n);window.scrollTo(o.scroll.x,o.scroll.y),o.inputs.forEach(a=>{let i=a.id?document.getElementById(a.id):document.querySelector(`[name="${a.name}"]`);i&&(i.value=a.value);});}catch{console.warn("dphelper: anchorContext restoration failed.");}};window.addEventListener("beforeunload",t),r();},fps:(e=true)=>{if(typeof document>"u")return;let t=document.getElementById("dphelper-fps-monitor");if(!e){t?.remove();return}t||(t=document.createElement("div"),t.id="dphelper-fps-monitor",Object.assign(t.style,{position:"fixed",top:"10px",right:"10px",padding:"8px 12px",background:"rgba(0,0,0,0.8)",color:"#0f0",fontFamily:"monospace",fontSize:"12px",zIndex:"99999",borderRadius:"4px",pointerEvents:"none",boxShadow:"0 2px 10px rgba(0,0,0,0.5)",border:"1px solid #333"}),document.body.appendChild(t));let r=0,n=performance.now(),o=()=>{if(!document.getElementById("dphelper-fps-monitor"))return;r++;let a=performance.now();if(a>=n+1e3){let i=Math.round(r*1e3/(a-n)),s=performance.memory?` | Mem: ${Math.round(performance.memory.usedJSHeapSize/1048576)}MB`:"";t.innerText=`FPS: ${i}${s}`,r=0,n=a;}requestAnimationFrame(o);};requestAnimationFrame(o);},boxModel:(e=true)=>{if(typeof document>"u")return;let t=document.getElementById("dphelper-boxmodel-style");if(!e){t?.remove();return}t||(t=document.createElement("style"),t.id="dphelper-boxmodel-style",t.innerHTML=`
146
+ `,env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20250612",lastMod:"20250612"},{name:"subString",version:"0.0.1",example:"dphelper.text.subString(text)",type:"function",active:true,description:"Length Of Longest Substring",env:"both",subCommand:[],author:"Dario Passariello",creationDate:"20260801",lastMod:"20260801"}]},Qr={trim:(e,t,r,n)=>e.charAt(0)===t?e.substring(r,n):e,capitalize:e=>e.toLowerCase().replace(/\b\w/g,t=>t.toUpperCase()),lower:e=>e.toLowerCase(),upper:e=>e.toUpperCase(),nl2br:e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/(?:\r\n|\r|\n)/g,"<br>"),sanitize:e=>e.replace(/<(|\/|[^>\bi]|\/[^>bi]|[^/>][^>]+|\/[^>][^>]+)>/g,""),camelCase:{toSpace:e=>e.replace(/([A-Z])/g," $1").replace(/^./,t=>t.toUpperCase()),toUnderscore:e=>e.replace(/\.?([A-Z])/g,(t,r)=>`_${r.toLowerCase()}`).replace(/^_/,"")},fitContainer:e=>{if(!e)return;function t(r){let n=document.querySelectorAll(r),o=n.length;if(!(o<=0))for(let a=0;a<o;a++){let i=n[a].offsetWidth*.05;n[a].style.fontSize=`${i}px`;}}dphelper.addListenerMulti(window,"load resize",()=>t(e));},keywords:e=>{let t=/\b[A-Z][a-z]+\b/g,r=e.match(t)?.filter(n=>n.length>3)||[];return [...new Set(r.map(n=>n.toLowerCase()))]},replaceText:(e,t)=>{let r=e;for(let n in t)Object.hasOwn(t,n)&&(r=r.replaceAll(n,t[n]||""));return r},subString:e=>{let t=new Int32Array(65536);t.fill(-1);let r=0,n=0;for(let o=0;o<e.length;o++){let a=e.charCodeAt(o),i=t[a];r=r+(i-r+1&-(i>=r)),t[a]=o;let s=o-r+1;n=n+(s-n&-(s>n));}return n}};dphelper?.setDescription(Xr,Qr);var en={name:"timer",active:true,subCommand:[{name:"sleep",version:"0.0.2",example:"dphelper.timer.sleep([ms]) ",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Pauses execution for a specified number of milliseconds.",env:"both",subCommand:[]},{name:"percentage",version:"0.0.2",example:"dphelper.timer.percentage([start], [end])",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Calculates the percentage of time elapsed between two time strings.",env:"both",subCommand:[]}]},tn={sleep:e=>new Promise(t=>setTimeout(t,e)),percentage:(e,t)=>{function r(n){let o=n.split(":");return Number.parseInt(o[0]||"",10)*3600+Number.parseInt(o[1]||"",10)*60+Number.parseInt(o[2]||"",10)}return (100*r(e)/r(t)).toFixed(2)}};dphelper?.setDescription(en,tn);var rn={name:"tools",active:true,subCommand:[{name:"byteSize",description:"Give you the total in 'Kb', 'Mb', 'Gb', 'Tb', 'Pb', 'Eb', 'Zb', 'Yb' starting from bytes",example:"dphelper.tools.byteSize(bytes)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"both",subCommand:[]},{name:"hashPass",description:"Hashes a password using a specified number and total.",example:"dphelper.tools.hashPass(number, total)",version:"0.0.2",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,env:"both",subCommand:[]},{name:"zIndex",description:"Finds the highest z-index value in the document.",example:"dphelper.tools.zIndex()",version:"0.0.2",author:"Dario Passariello",creationDate:"20240807",lastMod:"20240807",type:"function",active:true,env:"both",subCommand:[]},{name:"zeroToFalse",description:"Converts zero to false, otherwise returns the value.",example:"dphelper.tools.zeroToFalse(num)",version:"0.0.2",author:"Dario Passariello",creationDate:"20240924",lastMod:"20240924",type:"function",active:true,env:"both",subCommand:[]}]},nn={byteSize:e=>{if(Math.abs(e)<1024)return `${e}b`;let r=["Kb","Mb","Gb","Tb","Pb","Eb","Zb","Yb"],n=-1,o=e;do o/=1024,++n;while(Math.abs(o)>=1024&&n<r.length-1);return o.toFixed(1)+r[n]},zIndex:()=>Array.from(document.querySelectorAll("body *")).map(e=>Number.parseFloat(getComputedStyle(e).zIndex)).reduce((e,t)=>t>e?t:e,1),zeroToFalse:e=>e===0?false:e};dphelper?.setDescription(rn,nn);var on={name:"translators",active:true,subCommand:[{name:"convertMatrixToScale",version:"0.0.2",example:"dphelper.translators.convertMatrixToScale({value})",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Converts a transformation matrix to a scale value.",env:"both",subCommand:[]}]},an={convertMatrixToScale:e=>{let t=e.split("(");if(t.length<2)return 0;let r=t[1].split(")")[0];if(!r)return 0;let n=r.split(","),o=Number.parseFloat(n[0]||"0"),a=Number.parseFloat(n[1]||"0");return Math.sqrt(o*o+a*a)}};dphelper?.setDescription(on,an);var sn={name:"triggers",active:true,subCommand:[{name:"add",version:"0.0.1",example:"dphelper.triggers.add('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Add a trigger for custom events.",env:"client",subCommand:[]},{name:"on",version:"0.0.1",example:"dphelper.triggers.on('event', callback)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Listen for a trigger event.",env:"client",subCommand:[]},{name:"emit",version:"0.0.1",example:"dphelper.triggers.emit('event', data)",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Emit a trigger event.",env:"client",subCommand:[]},{name:"remove",version:"0.0.1",example:"dphelper.triggers.remove('event')",author:"Dario Passariello",creationDate:"20250220",lastMod:"20250220",type:"function",active:true,description:"Remove a trigger event.",env:"client",subCommand:[]}]},S=new Map,se={add:(e,t)=>{S.has(e)||S.set(e,new Set),S.get(e).add(t);},on:(e,t)=>{se.add(e,t);},emit:(e,...t)=>{let r=S.get(e);r&&r.forEach(n=>{try{n(...t);}catch(o){console.error(`Error in trigger callback for event '${e}':`,o);}});},remove:e=>{S.delete(e);},off:(e,t)=>{let r=S.get(e);r&&r.delete(t);},clear:()=>{S.clear();},list:()=>Array.from(S.keys())};dphelper?.setDescription(sn,se);var ln={name:"type",active:true,subCommand:[{name:"of",version:"0.0.2",example:"dphelper.type.of(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Returns the type of the given parameter.",env:"both",subCommand:[]},{name:"instOfObj",version:"0.0.2",example:"dphelper.type.instOfObj(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is an instance of Object.",env:"both",subCommand:[]},{name:"isNaN",version:"0.0.2",example:"dphelper.type.isNaN(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is NaN.",env:"both",subCommand:[]},{name:"isBool",version:"0.0.2",example:"dphelper.type.isBool(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Checks if the given parameter is a boolean.",env:"both",subCommand:[]}]},cn={of:e=>typeof e,instOfObj:e=>e instanceof Object,isNull:e=>t=>!e(t),isBool:e=>!e||e.length==null?true:e==="1"};dphelper?.setDescription(ln,cn);var dn={name:"UI",active:true,subCommand:[{name:"input",version:"0.0.2",example:"dphelper.UI.input(...)",author:"Dario Passariello",creationDate:"20210101",lastMod:"20260220",type:"function",active:true,description:"Creates an input element with specified options.",env:"client",subCommand:[]},{name:"fps",version:"0.0.2",example:"dphelper.UI.fps(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Toggle a real-time FPS and Memory monitor overlay",env:"client",subCommand:[]},{name:"boxModel",version:"0.0.2",example:"dphelper.UI.boxModel(true)",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Toggle visual box-model highlighter for all elements",env:"client",subCommand:[]},{name:"anchorContext",version:"0.0.1",example:"dphelper.UI.anchorContext()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Snapshot and auto-restore UI state (inputs, scroll) across reloads.",env:"client",subCommand:[]}]},un={anchorContext:()=>{if(typeof window>"u"||typeof localStorage>"u")return;let e=`dp_anchor_${btoa(location.pathname).replace(/=/g,"")}`,t=()=>{let n={scroll:{x:window.scrollX,y:window.scrollY},inputs:Array.from(document.querySelectorAll("input, textarea, select")).filter(o=>o.type!=="password"&&!o.hasAttribute("data-private")&&o.getAttribute("autocomplete")!=="off").map(o=>({id:o.id,name:o.name,value:o.value}))};localStorage.setItem(e,JSON.stringify(n));},r=()=>{let n=localStorage.getItem(e);if(n)try{let o=JSON.parse(n);window.scrollTo(o.scroll.x,o.scroll.y),o.inputs.forEach(a=>{let i=a.id?document.getElementById(a.id):document.querySelector(`[name="${a.name}"]`);i&&(i.value=a.value);});}catch{console.warn("dphelper: anchorContext restoration failed.");}};window.addEventListener("beforeunload",t),r();},fps:(e=true)=>{if(typeof document>"u")return;let t=document.getElementById("dphelper-fps-monitor");if(!e){t?.remove();return}t||(t=document.createElement("div"),t.id="dphelper-fps-monitor",Object.assign(t.style,{position:"fixed",top:"10px",right:"10px",padding:"8px 12px",background:"rgba(0,0,0,0.8)",color:"#0f0",fontFamily:"monospace",fontSize:"12px",zIndex:"99999",borderRadius:"4px",pointerEvents:"none",boxShadow:"0 2px 10px rgba(0,0,0,0.5)",border:"1px solid #333"}),document.body.appendChild(t));let r=0,n=performance.now(),o=()=>{if(!document.getElementById("dphelper-fps-monitor"))return;r++;let a=performance.now();if(a>=n+1e3){let i=Math.round(r*1e3/(a-n)),s=performance.memory?` | Mem: ${Math.round(performance.memory.usedJSHeapSize/1048576)}MB`:"";t.innerText=`FPS: ${i}${s}`,r=0,n=a;}requestAnimationFrame(o);};requestAnimationFrame(o);},boxModel:(e=true)=>{if(typeof document>"u")return;let t=document.getElementById("dphelper-boxmodel-style");if(!e){t?.remove();return}t||(t=document.createElement("style"),t.id="dphelper-boxmodel-style",t.innerHTML=`
147
147
  * { outline: 1px solid rgba(255, 0, 0, 0.3) !important; }
148
148
  * * { outline: 1px solid rgba(0, 255, 0, 0.3) !important; }
149
149
  * * * { outline: 1px solid rgba(0, 0, 255, 0.3) !important; }
package/llms.txt CHANGED
@@ -1,73 +1,73 @@
1
- # dphelper
2
-
3
- > [!IMPORTANT]
4
- > **ARCHITECTURAL CHANGE:** State management has been COMPLETELY REMOVED from the `dphelper` library.
5
- > Application state is now handled exclusively through dedicated external managers: **Memorio** (for simple global state) or **Argis RGS** (for enterprise-level state).
6
-
7
- ---
8
-
9
- ## About dphelper
10
-
11
- `dphelper` is a powerful, **zero-dependency, stateless utility library** that packs 303 production-ready tools for modern web developers, AI engineers, and DevTools creators. It is fully isomorphic, running flawlessly across the Browser, Node.js, Bun, and Deno with a tiny minified footprint of ~171KB.
12
-
13
- ### ⚡ Key Capabilities
14
- * **AI-First Engineering:** Built-in support for the modern LLM stack, featuring **TOON optimization** (the efficient JSON alternative for prompts), context-aware token counting, smart RAG-ready chunking, and deep reasoning extraction (supporting architectures like DeepSeek and OpenAI o1/o3).
15
- * **Modern Web Primitives:** Sophisticated wrappers for Web Workers (including worker pool orchestration and multi-tab SharedWorkers), full IndexedDB query builders, and native client-side compression (Gzip/Deflate/LZW).
16
- * **Cross-Tab Intelligence:** Desktop-grade synchronization without a backend, powered by `dphelper.sync.pulse` cross-tab event buses and active browser tab interlocks.
17
- * **Biometric Authentication:** Built-in async WebAuthn primitives for effortless fingerprint and facial recognition integrations.
18
- * **Enterprise Security:** NIST SP 800-53 and NSA CNSA compliant, utilizing AES-256-GCM and strict OWASP-aligned PBKDF2 with 310,000 iterations.
19
-
20
- ---
21
-
22
- ## Quick Usage Syntax
23
-
24
- `dphelper` maps its modules globally. Import it **exactly once** at your application's absolute entry point (e.g., `index.js`, `main.ts`, or `App.tsx`):
25
-
26
- ```javascript
27
- import "dphelper";
28
-
29
- ### 🧬 The Core Architectural Ecosystem
30
-
31
- `dphelper` operates as a completely stateless, high-performance toolkit. To ensure clean separation of concerns and prevent race conditions or state contamination across asynchronous modules, state management has been extracted into dedicated standalone libraries.
32
-
33
- Always map your application architecture according to the following layout:
34
-
35
- | Layer & Purpose | Package | Operational Target | Design Philosophy |
36
- | :--- | :--- | :--- | :--- |
37
- | **Stateless Utilities & AI Tools** | `dphelper` | Isomorphic (Browser, Node.js, Bun, Deno) | **Zero-Dependency Universal Core.** Packs 303 production-ready modules including `ai` (TOON optimization, smart chunking), `worker` multi-threaded pools, `biometric` WebAuthn, `i18n`, desktop-grade cross-tab `sync.pulse`, and NIST-compliant cryptography. |
38
- | **Simple Global State** | `memorio` | Application-Wide Runtime | **Global Singleton Pattern.** High-performance, lightweight state management that eliminates boilerplate. It registers globally upon initial import and removes the need for custom context providers, actions, or dispatch files. |
39
- | **Enterprise State Architecture** | `Argis RGS` | Distributed / Complex SaaS Systems | **Heavy-Duty Reactive Structure.** Built for multi-module, enterprise-grade applications requiring strict state rules, relational data synchronization, and heavy concurrent data pipelines. |
40
-
41
- ---
42
-
43
- ### ⚠️ Integration Best Practices for AI & Humans
44
-
45
- 1. **Do Not Bundle State Logic in dphelper:** Any legacy codebase referencing `dphelper.store` or namespace getters/setters must be migrated to `memorio` or `Argis RGS`.
46
- 2. **Single-Entry Side Effect:** `dphelper` is designed to be imported exactly once in your root file (`import "dphelper";`). It will automatically map its 303 tools safely to the global scope.
47
- 3. **State Integrity:** When building micro-frontends or multi-tab web applications, use `dphelper.sync` primitives to handle cross-tab events, while allowing `memorio` to manage the underlying atomic state memory.
48
-
49
- // dphelper attaches to the global scope and is ready across your entire project
50
- console.debug(dphelper.version);
51
-
52
- // 🤖 AI Stack Snapshot & TOON Optimization
53
- const appStateToon = dphelper.ai.snapshot();
54
- const textChunks = dphelper.ai.chunker(longText, { size: 1000, overlap: 200 });
55
- const { reasoning, content } = dphelper.ai.extractReasoning(rawAiReply);
56
-
57
- // ⚙️ Multi-Threaded Worker Pools
58
- const pool = dphelper.worker.pool('worker.js', 4);
59
- const results = await dphelper.worker.poolExec(pool, [1, 2, 3, 4]);
60
-
61
- // 💓 Real-Time Cross-Tab Sync (No Backend Required)
62
- const bus = dphelper.sync.pulse('my-app', (msg) => console.log(msg));
63
- bus.emit({ action: 'theme-change', value: 'dark' });
64
-
65
- // 🌍 Full i18n Internationalization Suite
66
- dphelper.i18n.setLocale('it');
67
- dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' });
68
-
69
- ## DEVELOPMENT ENVIRONMENT GUIDELINES:
70
- - We are using dphelper (Stateless Core). Never generate code using 'dphelper.store'.
71
- - Global state must be managed exclusively via 'memorio' (lightweight) or 'Argis RGS' (enterprise).
72
- - dphelper is initialized as a global side-effect: 'import "dphelper";' in the root file. Do not generate inline imports for it in sub-modules.
73
- - For cross-tab/micro-frontend synchronization, use 'dphelper.sync.pulse' for events, but delegate data persistence to memorio.
1
+ # dphelper
2
+
3
+ > [!IMPORTANT]
4
+ > **ARCHITECTURAL CHANGE:** State management has been COMPLETELY REMOVED from the `dphelper` library.
5
+ > Application state is now handled exclusively through dedicated external managers: **Memorio** (for simple global state) or **Argis RGS** (for enterprise-level state).
6
+
7
+ ---
8
+
9
+ ## About dphelper
10
+
11
+ `dphelper` is a powerful, **zero-dependency, stateless utility library** that packs 303 production-ready tools for modern web developers, AI engineers, and DevTools creators. It is fully isomorphic, running flawlessly across the Browser, Node.js, Bun, and Deno with a tiny minified footprint of ~171KB.
12
+
13
+ ### ⚡ Key Capabilities
14
+ * **AI-First Engineering:** Built-in support for the modern LLM stack, featuring **TOON optimization** (the efficient JSON alternative for prompts), context-aware token counting, smart RAG-ready chunking, and deep reasoning extraction (supporting architectures like DeepSeek and OpenAI o1/o3).
15
+ * **Modern Web Primitives:** Sophisticated wrappers for Web Workers (including worker pool orchestration and multi-tab SharedWorkers), full IndexedDB query builders, and native client-side compression (Gzip/Deflate/LZW).
16
+ * **Cross-Tab Intelligence:** Desktop-grade synchronization without a backend, powered by `dphelper.sync.pulse` cross-tab event buses and active browser tab interlocks.
17
+ * **Biometric Authentication:** Built-in async WebAuthn primitives for effortless fingerprint and facial recognition integrations.
18
+ * **Enterprise Security:** NIST SP 800-53 and NSA CNSA compliant, utilizing AES-256-GCM and strict OWASP-aligned PBKDF2 with 310,000 iterations.
19
+
20
+ ---
21
+
22
+ ## Quick Usage Syntax
23
+
24
+ `dphelper` maps its modules globally. Import it **exactly once** at your application's absolute entry point (e.g., `index.js`, `main.ts`, or `App.tsx`):
25
+
26
+ ```javascript
27
+ import "dphelper";
28
+
29
+ ### 🧬 The Core Architectural Ecosystem
30
+
31
+ `dphelper` operates as a completely stateless, high-performance toolkit. To ensure clean separation of concerns and prevent race conditions or state contamination across asynchronous modules, state management has been extracted into dedicated standalone libraries.
32
+
33
+ Always map your application architecture according to the following layout:
34
+
35
+ | Layer & Purpose | Package | Operational Target | Design Philosophy |
36
+ | :--- | :--- | :--- | :--- |
37
+ | **Stateless Utilities & AI Tools** | `dphelper` | Isomorphic (Browser, Node.js, Bun, Deno) | **Zero-Dependency Universal Core.** Packs 303 production-ready modules including `ai` (TOON optimization, smart chunking), `worker` multi-threaded pools, `biometric` WebAuthn, `i18n`, desktop-grade cross-tab `sync.pulse`, and NIST-compliant cryptography. |
38
+ | **Simple Global State** | `memorio` | Application-Wide Runtime | **Global Singleton Pattern.** High-performance, lightweight state management that eliminates boilerplate. It registers globally upon initial import and removes the need for custom context providers, actions, or dispatch files. |
39
+ | **Enterprise State Architecture** | `Argis RGS` | Distributed / Complex SaaS Systems | **Heavy-Duty Reactive Structure.** Built for multi-module, enterprise-grade applications requiring strict state rules, relational data synchronization, and heavy concurrent data pipelines. |
40
+
41
+ ---
42
+
43
+ ### ⚠️ Integration Best Practices for AI & Humans
44
+
45
+ 1. **Do Not Bundle State Logic in dphelper:** Any legacy codebase referencing `dphelper.store` or namespace getters/setters must be migrated to `memorio` or `Argis RGS`.
46
+ 2. **Single-Entry Side Effect:** `dphelper` is designed to be imported exactly once in your root file (`import "dphelper";`). It will automatically map its 303 tools safely to the global scope.
47
+ 3. **State Integrity:** When building micro-frontends or multi-tab web applications, use `dphelper.sync` primitives to handle cross-tab events, while allowing `memorio` to manage the underlying atomic state memory.
48
+
49
+ // dphelper attaches to the global scope and is ready across your entire project
50
+ console.debug(dphelper.version);
51
+
52
+ // 🤖 AI Stack Snapshot & TOON Optimization
53
+ const appStateToon = dphelper.ai.snapshot();
54
+ const textChunks = dphelper.ai.chunker(longText, { size: 1000, overlap: 200 });
55
+ const { reasoning, content } = dphelper.ai.extractReasoning(rawAiReply);
56
+
57
+ // ⚙️ Multi-Threaded Worker Pools
58
+ const pool = dphelper.worker.pool('worker.js', 4);
59
+ const results = await dphelper.worker.poolExec(pool, [1, 2, 3, 4]);
60
+
61
+ // 💓 Real-Time Cross-Tab Sync (No Backend Required)
62
+ const bus = dphelper.sync.pulse('my-app', (msg) => console.log(msg));
63
+ bus.emit({ action: 'theme-change', value: 'dark' });
64
+
65
+ // 🌍 Full i18n Internationalization Suite
66
+ dphelper.i18n.setLocale('it');
67
+ dphelper.i18n.addTranslations('it', { hello: 'Ciao {name}!' });
68
+
69
+ ## DEVELOPMENT ENVIRONMENT GUIDELINES:
70
+ - We are using dphelper (Stateless Core). Never generate code using 'dphelper.store'.
71
+ - Global state must be managed exclusively via 'memorio' (lightweight) or 'Argis RGS' (enterprise).
72
+ - dphelper is initialized as a global side-effect: 'import "dphelper";' in the root file. Do not generate inline imports for it in sub-modules.
73
+ - For cross-tab/micro-frontend synchronization, use 'dphelper.sync.pulse' for events, but delegate data persistence to memorio.
package/modules/ai.cjs CHANGED
@@ -1,4 +1,4 @@
1
- 'use strict';var P={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var v={version:"4.5.2"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...P},configurable:true,writable:true},version:{value:v.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var f=dphelper;Object.defineProperty(f,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(f,"setDescription",{value:(e,t)=>{Object.defineProperties(f,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(f[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),f.setProps(f,e,{writable:false,configurable:false,enumerable:false}),f._list.scripts.push(e);}});var M={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},x=e=>e===null||typeof e!="object",O=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
1
+ 'use strict';var P={info:{title:"List",description:"Complete list of tools"},categories:["3party","system","financial","memory","numbers","time","path","file","forms","ui","other","development"]};var v={version:"4.6.0"};Object.defineProperty(globalThis,"dphelper",{value:new Proxy({},{}),writable:true,configurable:true,enumerable:false});Object.defineProperties(dphelper,{_list:{value:{scripts:[],sockets:[],...P},configurable:true,writable:true},version:{value:v.version,configurable:true,writable:true},isServer:{value:false,configurable:true,writable:true},isBrowser:{value:true,configurable:true,writable:true}});var f=dphelper;Object.defineProperty(f,"setProps",{value:(e,t,r)=>{Object.defineProperty(e,t.name,r||{writable:false,configurable:false,enumerable:false}),r?.lock&&Object.freeze(e[t.name]);},writable:false,configurable:false,enumerable:false});Object.defineProperty(f,"setDescription",{value:(e,t)=>{Object.defineProperties(f,{[e.name]:{value:t,writable:false,configurable:false,enumerable:false}}),Object.keys(t).map(r=>(Object.defineProperties(f[e.name],{[r]:{writable:false,configurable:false,enumerable:false}}),null)),f.setProps(f,e,{writable:false,configurable:false,enumerable:false}),f._list.scripts.push(e);}});var M={name:"ai",active:true,subCommand:[{name:"tokenCount",version:"0.0.3",example:"dphelper.ai.tokenCount({ users: [1,2,3] })",author:"Dario Passariello",creationDate:"20260220",lastMod:"20260221",type:"function",active:true,description:"Estimate token count for LLMs. If an object is passed, it uses TOON format for calculation.",env:"both",subCommand:[]},{name:"smartSanitize",version:"0.0.2",example:"dphelper.ai.smartSanitize('My email is test@example.com')",author:"Dario Passariello & Jo",creationDate:"20260220",lastMod:"20260220",type:"function",active:true,description:"Remove PII (emails, phones, etc) from text for AI privacy",subCommand:[]},{name:"toon",version:"0.0.1",example:"dphelper.ai.toon({ users: [{id: 1, name: 'Ada'}] })",author:"TOON + Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert JSON to TOON format (Token-Oriented Object Notation)",subCommand:[]},{name:"toonToJson",version:"0.0.1",example:"dphelper.ai.toonToJson('users[1]{id,name}:\\n 1,Ada')",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Convert TOON format back to JSON/Object",subCommand:[]},{name:"chunker",version:"0.0.1",example:"dphelper.ai.chunker(text, { size: 1000, overlap: 200 })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Split long text into chunks for RAG or AI processing.",subCommand:[]},{name:"similarity",version:"0.0.1",example:"dphelper.ai.similarity(vecA, vecB)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Calculate cosine similarity between two embedding vectors.",subCommand:[]},{name:"extractReasoning",version:"0.0.1",example:"dphelper.ai.extractReasoning(aiResponse)",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Extract <think> tags or internal reasoning from AI responses.",subCommand:[]},{name:"prompt",version:"0.0.1",example:"dphelper.ai.prompt('Hello {{name}}', { name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Simple prompt template engine with variable injection.",subCommand:[]},{name:"schema",version:"0.0.1",example:"dphelper.ai.schema({ id: 1, name: 'Ada' })",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Generate a TOON-style schema definition for AI instructions.",subCommand:[]},{name:"snapshot",version:"0.0.1",example:"dphelper.ai.snapshot()",author:"Dario Passariello",creationDate:"20260221",lastMod:"20260221",type:"function",active:true,description:"Capture a 'mental snapshot' of the app state (logs/globals) in TOON format for AI debugging.",env:"both",subCommand:[]}]},x=e=>e===null||typeof e!="object",O=e=>e===null?"null":typeof e=="string"?e.includes(",")||e.includes(":")||e.includes('"')||e.includes(`
2
2
  `)||e.trim()!==e?`"${e.replace(/"/g,'\\"')}"`:e||'""':String(e),b=(e,t=0)=>{let r=" ".repeat(t);if(x(e))return O(e);if(Array.isArray(e)){if(e.length===0)return "[0]:";let n=e[0];if(!x(n)&&!Array.isArray(n)){let s=Object.keys(n),o=`[${e.length}]{${s.join(",")}}:`;for(let i of e){let u=s.map(a=>O(i[a])).join(",");o+=`
3
3
  ${r} ${u}`;}return o}else return `[${e.length}]: `+e.map(O).join(",")}else return Object.entries(e).map(([n,s])=>{let o=n.includes(" ")||n.includes(":")?`"${n}"`:n;if(!x(s)){let i=b(s,t+1);return i.startsWith("[")?`${o}${i}`:`${o}:
4
4
  ${r}${i}`}return `${o}: ${O(s)}`}).join(`