@qualcomm-ui/react-mdx 1.0.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 (256) hide show
  1. package/LICENSE.txt +31 -0
  2. package/dist/all.min.css +1 -0
  3. package/dist/angular-logo/angular-logo.d.ts +3 -0
  4. package/dist/angular-logo/angular-logo.d.ts.map +1 -0
  5. package/dist/angular-logo/index.d.ts +2 -0
  6. package/dist/angular-logo/index.d.ts.map +1 -0
  7. package/dist/angular-logo/index.js +3 -0
  8. package/dist/angular-logo/index.js.map +7 -0
  9. package/dist/code-demo/code-demo.types.d.ts +14 -0
  10. package/dist/code-demo/code-demo.types.d.ts.map +1 -0
  11. package/dist/code-demo/code-demo.utils.d.ts +54 -0
  12. package/dist/code-demo/code-demo.utils.d.ts.map +1 -0
  13. package/dist/code-demo/index.d.ts +6 -0
  14. package/dist/code-demo/index.d.ts.map +1 -0
  15. package/dist/code-demo/index.js +7 -0
  16. package/dist/code-demo/index.js.map +7 -0
  17. package/dist/code-demo/internal/index.d.ts +4 -0
  18. package/dist/code-demo/internal/index.d.ts.map +1 -0
  19. package/dist/code-demo/internal/qds-demo-theme-selector.d.ts +6 -0
  20. package/dist/code-demo/internal/qds-demo-theme-selector.d.ts.map +1 -0
  21. package/dist/code-demo/internal/use-code-demo-preview.d.ts +21 -0
  22. package/dist/code-demo/internal/use-code-demo-preview.d.ts.map +1 -0
  23. package/dist/code-demo/internal/use-qds-demo-theme.d.ts +19 -0
  24. package/dist/code-demo/internal/use-qds-demo-theme.d.ts.map +1 -0
  25. package/dist/code-demo/qds-angular-demo-runner.d.ts +32 -0
  26. package/dist/code-demo/qds-angular-demo-runner.d.ts.map +1 -0
  27. package/dist/code-demo/qds-demo-runner.d.ts +46 -0
  28. package/dist/code-demo/qds-demo-runner.d.ts.map +1 -0
  29. package/dist/code-demo/qds-react-demo.d.ts +56 -0
  30. package/dist/code-demo/qds-react-demo.d.ts.map +1 -0
  31. package/dist/code-highlight/code-highlight.d.ts +65 -0
  32. package/dist/code-highlight/code-highlight.d.ts.map +1 -0
  33. package/dist/code-highlight/index.d.ts +2 -0
  34. package/dist/code-highlight/index.d.ts.map +1 -0
  35. package/dist/code-highlight/index.js +4 -0
  36. package/dist/code-highlight/index.js.map +7 -0
  37. package/dist/code-highlight/reflection-reference-popup.d.ts +8 -0
  38. package/dist/code-highlight/reflection-reference-popup.d.ts.map +1 -0
  39. package/dist/context/index.d.ts +3 -0
  40. package/dist/context/index.d.ts.map +1 -0
  41. package/dist/context/index.js +3 -0
  42. package/dist/context/index.js.map +7 -0
  43. package/dist/context/use-mdx-docs-context.d.ts +44 -0
  44. package/dist/context/use-mdx-docs-context.d.ts.map +1 -0
  45. package/dist/context/use-site-context.d.ts +5 -0
  46. package/dist/context/use-site-context.d.ts.map +1 -0
  47. package/dist/copy-to-clipboard/copy-to-clipboard-button.d.ts +6 -0
  48. package/dist/copy-to-clipboard/copy-to-clipboard-button.d.ts.map +1 -0
  49. package/dist/copy-to-clipboard/copy-to-clipboard-context.d.ts +8 -0
  50. package/dist/copy-to-clipboard/copy-to-clipboard-context.d.ts.map +1 -0
  51. package/dist/copy-to-clipboard/copy-to-clipboard-icon-button.d.ts +6 -0
  52. package/dist/copy-to-clipboard/copy-to-clipboard-icon-button.d.ts.map +1 -0
  53. package/dist/copy-to-clipboard/index.d.ts +5 -0
  54. package/dist/copy-to-clipboard/index.d.ts.map +1 -0
  55. package/dist/copy-to-clipboard/index.js +3 -0
  56. package/dist/copy-to-clipboard/index.js.map +7 -0
  57. package/dist/copy-to-clipboard/use-copy-to-clipboard.d.ts +9 -0
  58. package/dist/copy-to-clipboard/use-copy-to-clipboard.d.ts.map +1 -0
  59. package/dist/deprecated-module/deprecated-module.d.ts +14 -0
  60. package/dist/deprecated-module/deprecated-module.d.ts.map +1 -0
  61. package/dist/deprecated-module/index.d.ts +2 -0
  62. package/dist/deprecated-module/index.d.ts.map +1 -0
  63. package/dist/deprecated-module/index.js +3 -0
  64. package/dist/deprecated-module/index.js.map +7 -0
  65. package/dist/docs-layout/docs-layout.d.ts +15 -0
  66. package/dist/docs-layout/docs-layout.d.ts.map +1 -0
  67. package/dist/docs-layout/index.d.ts +5 -0
  68. package/dist/docs-layout/index.d.ts.map +1 -0
  69. package/dist/docs-layout/index.js +3 -0
  70. package/dist/docs-layout/index.js.map +7 -0
  71. package/dist/docs-layout/internal/anchor-header.d.ts +22 -0
  72. package/dist/docs-layout/internal/anchor-header.d.ts.map +1 -0
  73. package/dist/docs-layout/internal/code-tabs.d.ts +6 -0
  74. package/dist/docs-layout/internal/code-tabs.d.ts.map +1 -0
  75. package/dist/docs-layout/internal/index.d.ts +5 -0
  76. package/dist/docs-layout/internal/index.d.ts.map +1 -0
  77. package/dist/docs-layout/internal/shiki-pre.d.ts +5 -0
  78. package/dist/docs-layout/internal/shiki-pre.d.ts.map +1 -0
  79. package/dist/docs-layout/internal/toc-link.d.ts +10 -0
  80. package/dist/docs-layout/internal/toc-link.d.ts.map +1 -0
  81. package/dist/docs-layout/layout/app-content.d.ts +10 -0
  82. package/dist/docs-layout/layout/app-content.d.ts.map +1 -0
  83. package/dist/docs-layout/layout/breadcrumbs.d.ts +11 -0
  84. package/dist/docs-layout/layout/breadcrumbs.d.ts.map +1 -0
  85. package/dist/docs-layout/layout/content-wrapper.d.ts +10 -0
  86. package/dist/docs-layout/layout/content-wrapper.d.ts.map +1 -0
  87. package/dist/docs-layout/layout/docs-footer.d.ts +10 -0
  88. package/dist/docs-layout/layout/docs-footer.d.ts.map +1 -0
  89. package/dist/docs-layout/layout/index.d.ts +5 -0
  90. package/dist/docs-layout/layout/index.d.ts.map +1 -0
  91. package/dist/docs-layout/layout/layout.d.ts +21 -0
  92. package/dist/docs-layout/layout/layout.d.ts.map +1 -0
  93. package/dist/docs-layout/layout/main-content.d.ts +14 -0
  94. package/dist/docs-layout/layout/main-content.d.ts.map +1 -0
  95. package/dist/docs-layout/layout/mobile-sidebar.d.ts +12 -0
  96. package/dist/docs-layout/layout/mobile-sidebar.d.ts.map +1 -0
  97. package/dist/docs-layout/layout/page-links.d.ts +8 -0
  98. package/dist/docs-layout/layout/page-links.d.ts.map +1 -0
  99. package/dist/docs-layout/layout/root.d.ts +12 -0
  100. package/dist/docs-layout/layout/root.d.ts.map +1 -0
  101. package/dist/docs-layout/layout/sidebar.d.ts +27 -0
  102. package/dist/docs-layout/layout/sidebar.d.ts.map +1 -0
  103. package/dist/docs-layout/layout/table-of-contents.d.ts +7 -0
  104. package/dist/docs-layout/layout/table-of-contents.d.ts.map +1 -0
  105. package/dist/docs-layout/layout/use-mdx-docs-layout.d.ts +18 -0
  106. package/dist/docs-layout/layout/use-mdx-docs-layout.d.ts.map +1 -0
  107. package/dist/docs-layout/mdx-provider.d.ts +44 -0
  108. package/dist/docs-layout/mdx-provider.d.ts.map +1 -0
  109. package/dist/docs-layout/types.d.ts +88 -0
  110. package/dist/docs-layout/types.d.ts.map +1 -0
  111. package/dist/file-tree/file-tree.d.ts +12 -0
  112. package/dist/file-tree/file-tree.d.ts.map +1 -0
  113. package/dist/file-tree/index.d.ts +2 -0
  114. package/dist/file-tree/index.d.ts.map +1 -0
  115. package/dist/file-tree/index.js +3 -0
  116. package/dist/file-tree/index.js.map +7 -0
  117. package/dist/not-found/index.d.ts +2 -0
  118. package/dist/not-found/index.d.ts.map +1 -0
  119. package/dist/not-found/index.js +3 -0
  120. package/dist/not-found/index.js.map +7 -0
  121. package/dist/not-found/not-found.d.ts +5 -0
  122. package/dist/not-found/not-found.d.ts.map +1 -0
  123. package/dist/npm-install-tabs/index.d.ts +2 -0
  124. package/dist/npm-install-tabs/index.d.ts.map +1 -0
  125. package/dist/npm-install-tabs/index.js +3 -0
  126. package/dist/npm-install-tabs/index.js.map +7 -0
  127. package/dist/npm-install-tabs/npm-install-tabs.d.ts +19 -0
  128. package/dist/npm-install-tabs/npm-install-tabs.d.ts.map +1 -0
  129. package/dist/qui-ecosystem/index.d.ts +2 -0
  130. package/dist/qui-ecosystem/index.d.ts.map +1 -0
  131. package/dist/qui-ecosystem/index.js +3 -0
  132. package/dist/qui-ecosystem/index.js.map +7 -0
  133. package/dist/qui-ecosystem/qui-ecosystem.d.ts +8 -0
  134. package/dist/qui-ecosystem/qui-ecosystem.d.ts.map +1 -0
  135. package/dist/react-logo/index.d.ts +2 -0
  136. package/dist/react-logo/index.d.ts.map +1 -0
  137. package/dist/react-logo/index.js +3 -0
  138. package/dist/react-logo/index.js.map +7 -0
  139. package/dist/react-logo/react-logo.d.ts +6 -0
  140. package/dist/react-logo/react-logo.d.ts.map +1 -0
  141. package/dist/runner/index.d.ts +5 -0
  142. package/dist/runner/index.d.ts.map +1 -0
  143. package/dist/runner/index.js +3 -0
  144. package/dist/runner/index.js.map +7 -0
  145. package/dist/runner/runner.d.ts +26 -0
  146. package/dist/runner/runner.d.ts.map +1 -0
  147. package/dist/runner/transform.d.ts +3 -0
  148. package/dist/runner/transform.d.ts.map +1 -0
  149. package/dist/runner/types.d.ts +11 -0
  150. package/dist/runner/types.d.ts.map +1 -0
  151. package/dist/runner/use-runner.d.ts +12 -0
  152. package/dist/runner/use-runner.d.ts.map +1 -0
  153. package/dist/runner/utils.d.ts +6 -0
  154. package/dist/runner/utils.d.ts.map +1 -0
  155. package/dist/shiki/index.d.ts +3 -0
  156. package/dist/shiki/index.d.ts.map +1 -0
  157. package/dist/shiki/index.js +3 -0
  158. package/dist/shiki/index.js.map +7 -0
  159. package/dist/shiki/shiki-highlighter.d.ts +12 -0
  160. package/dist/shiki/shiki-highlighter.d.ts.map +1 -0
  161. package/dist/shiki/shiki-instance.d.ts +10 -0
  162. package/dist/shiki/shiki-instance.d.ts.map +1 -0
  163. package/dist/site-search/grouped-result-item.d.ts +9 -0
  164. package/dist/site-search/grouped-result-item.d.ts.map +1 -0
  165. package/dist/site-search/index.d.ts +6 -0
  166. package/dist/site-search/index.d.ts.map +1 -0
  167. package/dist/site-search/index.js +3 -0
  168. package/dist/site-search/index.js.map +7 -0
  169. package/dist/site-search/search-result-item.d.ts +11 -0
  170. package/dist/site-search/search-result-item.d.ts.map +1 -0
  171. package/dist/site-search/site-search.d.ts +12 -0
  172. package/dist/site-search/site-search.d.ts.map +1 -0
  173. package/dist/site-search/use-grouped-results.d.ts +11 -0
  174. package/dist/site-search/use-grouped-results.d.ts.map +1 -0
  175. package/dist/site-search/use-site-search.d.ts +6 -0
  176. package/dist/site-search/use-site-search.d.ts.map +1 -0
  177. package/dist/spoiler/index.d.ts +2 -0
  178. package/dist/spoiler/index.d.ts.map +1 -0
  179. package/dist/spoiler/index.js +3 -0
  180. package/dist/spoiler/index.js.map +7 -0
  181. package/dist/spoiler/spoiler.d.ts +25 -0
  182. package/dist/spoiler/spoiler.d.ts.map +1 -0
  183. package/dist/tsbuildinfo +1 -0
  184. package/dist/typedoc/docs-external-link.d.ts +9 -0
  185. package/dist/typedoc/docs-external-link.d.ts.map +1 -0
  186. package/dist/typedoc/index.d.ts +15 -0
  187. package/dist/typedoc/index.d.ts.map +1 -0
  188. package/dist/typedoc/index.js +10 -0
  189. package/dist/typedoc/index.js.map +7 -0
  190. package/dist/typedoc/internal/index.d.ts +3 -0
  191. package/dist/typedoc/internal/index.d.ts.map +1 -0
  192. package/dist/typedoc/internal/jsdoc-comment.d.ts +7 -0
  193. package/dist/typedoc/internal/jsdoc-comment.d.ts.map +1 -0
  194. package/dist/typedoc/internal/prop-types.utils.d.ts +30 -0
  195. package/dist/typedoc/internal/prop-types.utils.d.ts.map +1 -0
  196. package/dist/typedoc/prop-default.d.ts +7 -0
  197. package/dist/typedoc/prop-default.d.ts.map +1 -0
  198. package/dist/typedoc/prop-description/index.d.ts +9 -0
  199. package/dist/typedoc/prop-description/index.d.ts.map +1 -0
  200. package/dist/typedoc/prop-description/prop-description-block-tags.d.ts +7 -0
  201. package/dist/typedoc/prop-description/prop-description-block-tags.d.ts.map +1 -0
  202. package/dist/typedoc/prop-description/prop-description-extra-details.d.ts +8 -0
  203. package/dist/typedoc/prop-description/prop-description-extra-details.d.ts.map +1 -0
  204. package/dist/typedoc/prop-description/prop-description-function-args.d.ts +8 -0
  205. package/dist/typedoc/prop-description/prop-description-function-args.d.ts.map +1 -0
  206. package/dist/typedoc/prop-description/prop-description-inline-tag.d.ts +8 -0
  207. package/dist/typedoc/prop-description/prop-description-inline-tag.d.ts.map +1 -0
  208. package/dist/typedoc/prop-description/prop-description-option-tags.d.ts +8 -0
  209. package/dist/typedoc/prop-description/prop-description-option-tags.d.ts.map +1 -0
  210. package/dist/typedoc/prop-description/prop-description-see-tags.d.ts +9 -0
  211. package/dist/typedoc/prop-description/prop-description-see-tags.d.ts.map +1 -0
  212. package/dist/typedoc/prop-description/prop-description-summary.d.ts +8 -0
  213. package/dist/typedoc/prop-description/prop-description-summary.d.ts.map +1 -0
  214. package/dist/typedoc/prop-description/prop-description.d.ts +8 -0
  215. package/dist/typedoc/prop-description/prop-description.d.ts.map +1 -0
  216. package/dist/typedoc/prop-name.d.ts +10 -0
  217. package/dist/typedoc/prop-name.d.ts.map +1 -0
  218. package/dist/typedoc/prop-types/index.d.ts +7 -0
  219. package/dist/typedoc/prop-types/index.d.ts.map +1 -0
  220. package/dist/typedoc/prop-types/prop-type.d.ts +8 -0
  221. package/dist/typedoc/prop-types/prop-type.d.ts.map +1 -0
  222. package/dist/typedoc/prop-types/reference.d.ts +8 -0
  223. package/dist/typedoc/prop-types/reference.d.ts.map +1 -0
  224. package/dist/typedoc/prop-types/reflection.d.ts +7 -0
  225. package/dist/typedoc/prop-types/reflection.d.ts.map +1 -0
  226. package/dist/typedoc/prop-types/simple-type.d.ts +10 -0
  227. package/dist/typedoc/prop-types/simple-type.d.ts.map +1 -0
  228. package/dist/typedoc/prop-types/ts-icon.d.ts +5 -0
  229. package/dist/typedoc/prop-types/ts-icon.d.ts.map +1 -0
  230. package/dist/typedoc/prop-types/type-info-popup.d.ts +7 -0
  231. package/dist/typedoc/prop-types/type-info-popup.d.ts.map +1 -0
  232. package/dist/typedoc/reflection/index.d.ts +4 -0
  233. package/dist/typedoc/reflection/index.d.ts.map +1 -0
  234. package/dist/typedoc/reflection/type-doc-parameters-table.d.ts +7 -0
  235. package/dist/typedoc/reflection/type-doc-parameters-table.d.ts.map +1 -0
  236. package/dist/typedoc/reflection/type-doc-reflection-return.d.ts +7 -0
  237. package/dist/typedoc/reflection/type-doc-reflection-return.d.ts.map +1 -0
  238. package/dist/typedoc/reflection/type-doc-reflection.d.ts +9 -0
  239. package/dist/typedoc/reflection/type-doc-reflection.d.ts.map +1 -0
  240. package/dist/typedoc/type-doc-angular-attributes.d.ts +6 -0
  241. package/dist/typedoc/type-doc-angular-attributes.d.ts.map +1 -0
  242. package/dist/typedoc/type-doc-attributes.d.ts +10 -0
  243. package/dist/typedoc/type-doc-attributes.d.ts.map +1 -0
  244. package/dist/typedoc/type-doc-props.d.ts +71 -0
  245. package/dist/typedoc/type-doc-props.d.ts.map +1 -0
  246. package/dist/typedoc/typedoc-props-list.d.ts +11 -0
  247. package/dist/typedoc/typedoc-props-list.d.ts.map +1 -0
  248. package/dist/typedoc/typedoc-props-table.d.ts +11 -0
  249. package/dist/typedoc/typedoc-props-table.d.ts.map +1 -0
  250. package/dist/typedoc/use-props-context.d.ts +6 -0
  251. package/dist/typedoc/use-props-context.d.ts.map +1 -0
  252. package/dist/typedoc/use-props-layout-context.d.ts +16 -0
  253. package/dist/typedoc/use-props-layout-context.d.ts.map +1 -0
  254. package/dist/typedoc/use-typedoc-context.d.ts +21 -0
  255. package/dist/typedoc/use-typedoc-context.d.ts.map +1 -0
  256. package/package.json +53 -0
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{jsx as F,jsxs as Z}from"react/jsx-runtime";import{FileTextIcon as Kt}from"lucide-react";import{isObject as S}from"@qualcomm-ui/utils/guard";import{noop as be}from"@qualcomm-ui/utils/functions";var dt=1,mt=9,pt=11,ht=t=>S(t)&&t.nodeType===dt&&typeof t.nodeName=="string",U=t=>S(t)&&t.nodeType===mt,gt=t=>S(t)&&t===t.window;var vt=t=>S(t)&&t.nodeType!==void 0,yt=t=>vt(t)&&t.nodeType===pt&&"host"in t;function A(t){return U(t)?t:gt(t)?t.document:t?.ownerDocument??document}function v(t){return yt(t)?v(t.host):U(t)?t.defaultView??window:ht(t)?t.ownerDocument?.defaultView??window:window}function bt(){return typeof document<"u"}function wt(){return navigator.userAgentData?.platform??navigator.platform}function Et(t){return bt()&&t.test(wt())}function W(){return Et(/^Mac/)}function xt(t){return t.composedPath?.()??t.nativeEvent?.composedPath?.()}function P(t){return xt(t)?.[0]??t.target}function kt(t,n){return t.map((e,r)=>t[(Math.max(n,0)+r)%t.length])}function Tt(t){return t.split("").map(n=>{let e=n.charCodeAt(0);return e>0&&e<128?n:e>=128&&e<=255?`/x${e.toString(16)}`.replace("/","\\"):""}).join("").trim()}function R(t){return t.id}function It(t,n,e=R){return t.find(r=>e(r)===n)}function Lt(t,n,e=R){let r=It(t,n,e);return r?t.indexOf(r):-1}function St(t){return Tt(t.dataset?.valuetext??t.textContent??"")}function At(t,n){return t.trim().toLowerCase().startsWith(n.toLowerCase())}function Nt(t,n,e,r=R){let i=e?Lt(t,e,r):-1,o=e?kt(t,i):t;return n.length===1&&(o=o.filter(s=>r(s)!==e)),o.find(s=>At(St(s),n))}function Dt(t,n){let{activeId:e,itemToId:r,key:i,state:o,timeout:s=350}=n,l=o.keysSoFar+i,u=l.length>1&&Array.from(l).every(g=>g===l[0])?l[0]:l,m=t.slice(),c=Nt(m,u,e,r);function p(){clearTimeout(o.timer),o.timer=-1}function E(g){o.keysSoFar=g,p(),g!==""&&(o.timer=+setTimeout(()=>{E(""),p()},s))}return E(l),c}var we=Object.assign(Dt,{defaultOptions:{keysSoFar:"",timer:-1},isValidEvent:Ct});function Ct(t){return t.key.length===1&&!t.ctrlKey&&!t.metaKey}var Ee=1e3/60;function Mt(t){return t.mozInputSource===0&&t.isTrusted?!0:t.detail===0&&!t.pointerType}function Pt(t){return!(t.metaKey||!W()&&t.altKey||t.ctrlKey||t.key==="Control"||t.key==="Shift"||t.key==="Meta")}var Rt=new Set(["checkbox","radio","range","color","file","image","button","submit","reset"]);function _t(t,n,e){let r=e?P(e):null,i=v(r);return t=t||r instanceof i.HTMLInputElement&&!Rt.has(r?.type)||r instanceof i.HTMLTextAreaElement||r instanceof i.HTMLElement&&r.isContentEditable,!(t&&n==="keyboard"&&e instanceof i.KeyboardEvent&&!Reflect.has(Vt,e.key))}var b=null,_=new Set,k=new Map,y=!1,V=!1,Vt={Escape:!0,Tab:!0};function D(t,n){for(let e of _)e(t,n)}function N(t){y=!0,Pt(t)&&(b="keyboard",D("keyboard",t))}function d(t){b="pointer",(t.type==="mousedown"||t.type==="pointerdown")&&(y=!0,D("pointer",t))}function z(t){Mt(t)&&(y=!0,b="virtual")}function X(t){let n=P(t);n===v(n)||n===A(n)||(!y&&!V&&(b="virtual",D("virtual",t)),y=!1,V=!1)}function G(){y=!1,V=!0}function Ft(t){if(typeof window>"u"||k.get(v(t)))return;let n=v(t),e=A(t),r=n.HTMLElement.prototype.focus;n.HTMLElement.prototype.focus=function(){b="virtual",D("virtual",null),y=!0,r.apply(this,arguments)},e.addEventListener("keydown",N,!0),e.addEventListener("keyup",N,!0),e.addEventListener("click",z,!0),n.addEventListener("focus",X,!0),n.addEventListener("blur",G,!1),typeof n.PointerEvent<"u"?(e.addEventListener("pointerdown",d,!0),e.addEventListener("pointermove",d,!0),e.addEventListener("pointerup",d,!0)):(e.addEventListener("mousedown",d,!0),e.addEventListener("mousemove",d,!0),e.addEventListener("mouseup",d,!0)),n.addEventListener("beforeunload",()=>{qt(t)},{once:!0}),k.set(n,{focus:r})}var qt=(t,n)=>{let e=v(t),r=A(t);n&&r.removeEventListener("DOMContentLoaded",n),k.has(e)&&(e.HTMLElement.prototype.focus=k.get(e)?.focus??(()=>{}),r.removeEventListener("keydown",N,!0),r.removeEventListener("keyup",N,!0),r.removeEventListener("click",z,!0),e.removeEventListener("focus",X,!0),e.removeEventListener("blur",G,!1),typeof e.PointerEvent<"u"?(r.removeEventListener("pointerdown",d,!0),r.removeEventListener("pointermove",d,!0),r.removeEventListener("pointerup",d,!0)):(r.removeEventListener("mousedown",d,!0),r.removeEventListener("mousemove",d,!0),r.removeEventListener("mouseup",d,!0)),k.delete(e))};function x(){return b==="keyboard"}function Y(t={}){let{autoFocus:n,isTextInput:e,onChange:r,root:i}=t;Ft(i),r?.({isFocusVisible:n||x(),modality:b});let o=(s,l)=>{_t(!!e,s,l)&&r?.({isFocusVisible:x(),modality:s})};return _.add(o),()=>{_.delete(o)}}import{Icon as Ht}from"@qualcomm-ui/react/icon";import{PolymorphicElement as Ot}from"@qualcomm-ui/react-core/system";import{booleanDataAttr as J}from"@qualcomm-ui/utils/attributes";import{clsx as Bt}from"@qualcomm-ui/utils/clsx";function Q({active:t,className:n,item:e,ref:r,...i}){return Z(Ot,{ref:r,as:"button",className:Bt("qui-site-search__list-item qui-menu-item__root",n),"data-focus-visible":J(x()),"data-highlighted":J(t),...i,children:[F(Ht,{className:"qui-site-search__item-icon",icon:Kt,size:"lg"}),Z("div",{className:"qui-site-search__list-item-content",children:[F("span",{className:"qui-site-search__content",children:e.title}),F("div",{className:"qui-site-search__metadata",children:e.categoryId})]})]})}import{Fragment as tt,jsx as w,jsxs as q}from"react/jsx-runtime";import{useRef as $t}from"react";import{HashIcon as jt,TablePropertiesIcon as Ut,TextSearchIcon as Wt}from"lucide-react";import{Icon as zt}from"@qualcomm-ui/react/icon";import{HighlightText as Xt}from"@qualcomm-ui/react-core/highlight";import{useMergedRef as Gt}from"@qualcomm-ui/react-core/refs";import{PolymorphicElement as Yt}from"@qualcomm-ui/react-core/system";import{booleanDataAttr as K}from"@qualcomm-ui/utils/attributes";import{clsx as Zt}from"@qualcomm-ui/utils/clsx";function Jt(t){return t.isDocProp?Ut:t.type==="content"?Wt:jt}function et(t){let{active:n,className:e,inputValue:r,isChild:i,item:o,ref:s,...l}=t,u=i===void 0?!1:i,m=$t(null),c=Gt(s,m),p=Jt(o);return q(Yt,{ref:c,as:"button",className:Zt("qui-site-search__list-item","qui-menu-item__root",e),"data-child":K(u),"data-focus-visible":K(x()),"data-highlighted":K(n),"data-type":o.type,...l,children:[p?w(zt,{className:"qui-site-search__item-icon",icon:p,size:"lg"}):null,w("div",{className:"qui-site-search__list-item-content",children:o.type==="content"&&o.content?q(tt,{children:[w("span",{className:"qui-site-search__content",children:w(Xt,{ignoreCase:!0,matchAll:!0,query:r.split(" ").at(-1)??"",text:o.content.map(Qt).join("")})}),w("div",{className:"qui-site-search__metadata",children:o.heading})]}):q(tt,{children:[w("span",{className:"qui-site-search__content",children:o.heading}),o.title&&w("div",{className:"qui-site-search__metadata",children:o.title})]})})]})}function Qt(t){return t.content}import{Fragment as ae,jsx as f,jsxs as C}from"react/jsx-runtime";import{useCallback as H,useEffect as ot,useRef as M,useState as O}from"react";import{useFloating as se,useInteractions as le,useListNavigation as ue}from"@floating-ui/react";import{SearchIcon as it}from"lucide-react";import{getSelectorsByUserAgent as ce,OsTypes as fe}from"react-device-detect";import{Dialog as T}from"@qualcomm-ui/react/dialog";import{HeaderBar as de}from"@qualcomm-ui/react/header-bar";import{TextInput as me}from"@qualcomm-ui/react/text-input";import{useDebounce as pe}from"@qualcomm-ui/react-core/effects";import{Portal as he}from"@qualcomm-ui/react-core/portal";import{useMdxDocsContext as ge}from"@qualcomm-ui/react-mdx/context";import{useMemo as oe}from"react";import{useSiteContext as ie}from"@qualcomm-ui/react-mdx/context";import{c as te}from"react/compiler-runtime";import"react";import ee from"fuzzysort";import{formatSearchResults as ne}from"@qualcomm-ui/mdx-common";function re(t,n){let e=ne(ee.go(t,n,{keys:["title","heading","content"],limit:50,threshold:.2})),r=new Map;for(let o of e){let s=o.href.split("#")[0];r.has(s)||r.set(s,[]),r.get(s).push(o)}let i=[];for(let[,o]of r){let s=o.filter(u=>u.type==="content"),l=o.filter(u=>u.type!=="content");s.length>0?i.push(...s):i.push(l[0])}return i}function nt(t){let n=te(2),e;return n[0]!==t?(e=r=>re(r,t),n[0]=t,n[1]=e):e=n[1],e}function rt(t){let{searchIndex:n}=ie(),e=nt(n);return oe(()=>{if(!t.trim())return[];let r=e(t),i=new Map,o=[];for(let u of r){let c=`${u.href.split("#")[0]}::${u.title}`;i.has(c)||(i.set(c,[]),o.push(c)),i.get(c).push(u)}let s=0,l=[];for(let u of o){let m=i.get(u),c=m[0],p=c.href.split("#")[0],E=c.categories[0]||"Other";l.push({categoryId:E,id:`${p}-${c.title}`,index:s++,items:m.map(g=>({...g,index:s++})),pathname:p,title:c.title})}return l},[t,e])}function gn({noResults:t="No results found..."}){let[n,e]=O(!1),[r,i]=O(""),o=M(null),s=M(null),l=M(null),u=M([]),[m,c]=O(null),{renderLink:p}=ge();ot(()=>{let a=Y({root:document.documentElement});return()=>{a()}},[]);let{context:E,refs:g}=se({open:n}),at=ue(E,{activeIndex:m,listRef:u,loop:!0,onNavigate:a=>{c(a)}}),st=pe(r,100),B=rt(st),lt=H(a=>{i(a)},[]);ot(()=>{let{osName:a}=ce(window.navigator.userAgent),h=a===fe.MAC_OS;function I(L){L.key==="k"&&(h&&L.metaKey||!h&&L.ctrlKey)&&(o.current?.focus(),L.preventDefault())}return window.addEventListener("keydown",I),()=>{window.removeEventListener("keydown",I)}},[n]);let $=H(a=>{switch(a.key){case"Enter":case"Space":break;case"Tab":s.current?.focus(),a.preventDefault();break;case"ArrowDown":break;case"ArrowUp":break;default:s.current?.focus?.();break}},[]),ut=H(a=>{switch(a.key){case"ArrowDown":a.preventDefault(),u.current[0]?.focus();break;case"ArrowUp":a.preventDefault();break}},[]),{getFloatingProps:ct,getItemProps:j,getReferenceProps:ft}=le([at]);return C(T.Root,{onOpenChange:a=>{e(a)},open:n,restoreFocus:!1,children:[f(T.Trigger,{children:f("div",{"aria-label":"Search the documentation",className:"qui-site-search__mobile-icon",role:"searchbox",children:f(de.ActionIconButton,{"aria-label":"Search",icon:it})})}),C(he,{children:[f(T.Backdrop,{className:"qui-site-search__mobile-dialog-backdrop"}),f(T.Positioner,{children:f(T.Content,{className:"qui-site-search__mobile-dialog-content",onClick:a=>{l.current?.contains(a.target)||e(!1)},style:{background:"transparent",border:0,padding:0},children:C("div",{className:"qui-site-search__mobile-input-wrapper",children:[f(me,{...ft({onKeyDown:ut}),ref:l,className:"q-background-2",inputProps:{ref:s},onValueChange:lt,placeholder:"Search the docs",size:"lg",startIcon:it,value:r}),r.length?f("div",{ref:g.setFloating,...ct(),className:"qui-site-search__floating-panel-mobile",children:B.length?f(ae,{children:B.map(a=>C("div",{className:"qui-site-search__result-group-wrapper",children:[f(Q,{active:a.index===m,render:f(p,{href:a.pathname}),...j({onKeyDown:$,ref:h=>{u.current[a.index]=h},tabIndex:-1}),item:a}),f("div",{className:"qui-site-search__result-group",children:a.items.map(h=>f(et,{inputValue:r,...j({onKeyDown:$,ref:I=>{u.current[h.index]=I},tabIndex:-1}),active:h.index===m,isChild:!0,item:h,render:f(p,{href:h.href})},h.id))})]},`${a.id}-${a.categoryId}`))}):t?f("div",{className:"qui-site-search__no-results",children:t}):null}):null," "]})})})]})]})}export{Q as GroupedResultItem,et as SearchResultItem,gn as SiteSearch,re as doSiteSearch,rt as useGroupedResults,nt as useSiteSearch};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/site-search/grouped-result-item.tsx", "../../../../common/dom/src/query/caret.ts", "../../../../common/dom/src/query/node.ts", "../../../../common/dom/src/query/computed-style.ts", "../../../../common/dom/src/query/data-url.ts", "../../../../common/dom/src/query/platform.ts", "../../../../common/dom/src/query/event.ts", "../../../../common/dom/src/query/form.ts", "../../../../common/dom/src/query/tabbable.ts", "../../../../common/dom/src/query/initial-focus.ts", "../../../../common/dom/src/query/raf.ts", "../../../../common/dom/src/query/mutation-observer.ts", "../../../../common/dom/src/query/navigate.ts", "../../../../common/dom/src/query/overflow.ts", "../../../../common/dom/src/query/shared.ts", "../../../../common/dom/src/query/point.ts", "../../../../common/dom/src/query/pointer-lock.ts", "../../../../common/dom/src/query/text-selection.ts", "../../../../common/dom/src/query/pointer-move.ts", "../../../../common/dom/src/query/press.ts", "../../../../common/dom/src/query/proxy-tab-focus.ts", "../../../../common/dom/src/query/query.ts", "../../../../common/dom/src/query/scope.ts", "../../../../common/dom/src/query/searchable.ts", "../../../../common/dom/src/query/set.ts", "../../../../common/dom/src/query/typeahead.ts", "../../../../common/dom/src/query/visual-viewport.ts", "../../../../common/dom/src/query/visually-hidden.ts", "../../../../common/dom/src/query/wait-for.ts", "../../../../common/dom/src/focus-visible/focus-visible.ts", "../../src/site-search/search-result-item.tsx", "../../src/site-search/site-search.tsx", "../../src/site-search/use-grouped-results.ts", "../../src/site-search/use-site-search.ts"],
4
+ "sourcesContent": ["import { jsx, jsxs } from \"react/jsx-runtime\";\nimport { FileTextIcon } from \"lucide-react\";\nimport { isFocusVisible } from \"@qualcomm-ui/dom/focus-visible\";\nimport { Icon } from \"@qualcomm-ui/react/icon\";\nimport { PolymorphicElement } from \"@qualcomm-ui/react-core/system\";\nimport { booleanDataAttr } from \"@qualcomm-ui/utils/attributes\";\nimport { clsx } from \"@qualcomm-ui/utils/clsx\";\nexport function GroupedResultItem({\n active,\n className,\n item,\n ref,\n ...props\n}) {\n return /* @__PURE__ */jsxs(PolymorphicElement, {\n ref,\n as: \"button\",\n className: clsx(\"qui-site-search__list-item qui-menu-item__root\", className),\n \"data-focus-visible\": booleanDataAttr(isFocusVisible()),\n \"data-highlighted\": booleanDataAttr(active),\n ...props,\n children: [/* @__PURE__ */jsx(Icon, {\n className: \"qui-site-search__item-icon\",\n icon: FileTextIcon,\n size: \"lg\"\n }), /* @__PURE__ */jsxs(\"div\", {\n className: \"qui-site-search__list-item-content\",\n children: [/* @__PURE__ */jsx(\"span\", {\n className: \"qui-site-search__content\",\n children: item.title\n }), /* @__PURE__ */jsx(\"div\", {\n className: \"qui-site-search__metadata\",\n children: item.categoryId\n })]\n })]\n });\n}", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nexport function isCaretAtStart(\n input: HTMLInputElement | HTMLTextAreaElement | null,\n): boolean {\n if (!input) {\n return false\n }\n try {\n return input.selectionStart === 0 && input.selectionEnd === 0\n } catch {\n return input.value === \"\"\n }\n}\n\nexport function setCaretToEnd(\n input: HTMLInputElement | HTMLTextAreaElement | null,\n): void {\n if (!input) {\n return\n }\n const start = input.selectionStart ?? 0\n const end = input.selectionEnd ?? 0\n if (Math.abs(end - start) !== 0) {\n return\n }\n if (start !== 0) {\n return\n }\n input.setSelectionRange(input.value.length, input.value.length)\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {isObject} from \"@qualcomm-ui/utils/guard\"\n\nconst ELEMENT_NODE: typeof Node.ELEMENT_NODE = 1\nconst DOCUMENT_NODE: typeof Node.DOCUMENT_NODE = 9\nconst DOCUMENT_FRAGMENT_NODE: typeof Node.DOCUMENT_FRAGMENT_NODE = 11\n\nexport const isHTMLElement = (el: any): el is HTMLElement =>\n isObject(el) &&\n el.nodeType === ELEMENT_NODE &&\n typeof el.nodeName === \"string\"\n\nexport const isDocument = (el: any): el is Document =>\n isObject(el) && el.nodeType === DOCUMENT_NODE\n\nexport const isWindow = (el: any): el is Window =>\n isObject(el) && el === el.window\n\nexport const isVisualViewport = (el: any): el is VisualViewport =>\n isObject(el) && el.constructor.name === \"VisualViewport\"\n\nexport const getNodeName = (node: Node | Window): string => {\n if (isHTMLElement(node)) {\n return node.localName || \"\"\n }\n return \"#document\"\n}\n\nexport function isRootElement(node: Node): boolean {\n return [\"html\", \"body\", \"#document\"].includes(getNodeName(node))\n}\n\nexport const isNode = (el: any): el is Node =>\n isObject(el) && el.nodeType !== undefined\n\nexport const isShadowRoot = (el: any): el is ShadowRoot =>\n isNode(el) && el.nodeType === DOCUMENT_FRAGMENT_NODE && \"host\" in el\n\nexport const isInputElement = (el: any): el is HTMLInputElement =>\n isHTMLElement(el) && el.localName === \"input\"\n\nexport const isAnchorElement = (\n el: HTMLElement | null | undefined,\n): el is HTMLAnchorElement => !!el?.matches(\"a[href]\")\n\nexport function isElementVisible(el: Node): boolean {\n if (!isHTMLElement(el)) {\n return false\n }\n return (\n el.offsetWidth > 0 || el.offsetHeight > 0 || el.getClientRects().length > 0\n )\n}\n\nconst TEXTAREA_SELECT_REGEX = /(textarea|select)/\n\nexport function isEditableElement(\n el: HTMLElement | EventTarget | null,\n): boolean {\n if (el == null || !isHTMLElement(el)) {\n return false\n }\n try {\n return (\n (isInputElement(el) && el.selectionStart != null) ||\n TEXTAREA_SELECT_REGEX.test(el.localName) ||\n el.isContentEditable ||\n el.getAttribute(\"contenteditable\") === \"true\" ||\n el.getAttribute(\"contenteditable\") === \"\"\n )\n } catch {\n return false\n }\n}\n\ntype Target = HTMLElement | EventTarget | null | undefined\n\nexport function contains(parent: Target, child: Target): boolean {\n if (!parent || !child) {\n return false\n }\n if (!isHTMLElement(parent) || !isHTMLElement(child)) {\n return false\n }\n const rootNode = child.getRootNode?.()\n if (parent === child) {\n return true\n }\n if (parent.contains(child)) {\n return true\n }\n if (rootNode && isShadowRoot(rootNode)) {\n let next = child\n while (next) {\n if (parent === next) {\n return true\n }\n // @ts-ignore\n next = next.parentNode || next.host\n }\n }\n return false\n}\n\nexport function getDocument(\n el: Element | Window | Node | Document | null | undefined,\n): Document {\n if (isDocument(el)) {\n return el\n }\n if (isWindow(el)) {\n return el.document\n }\n return el?.ownerDocument ?? document\n}\n\nexport function getDocumentElement(\n el: Element | Node | Window | Document | null | undefined,\n): HTMLElement {\n return getDocument(el).documentElement\n}\n\nexport function getWindow(\n el: Node | ShadowRoot | Document | null | undefined,\n): Window & typeof globalThis {\n if (isShadowRoot(el)) {\n return getWindow(el.host)\n }\n if (isDocument(el)) {\n return el.defaultView ?? window\n }\n if (isHTMLElement(el)) {\n return el.ownerDocument?.defaultView ?? window\n }\n return window\n}\n\nexport function getActiveElement(\n rootNode: Document | ShadowRoot,\n): HTMLElement | null {\n let activeElement = rootNode.activeElement as HTMLElement | null\n while (activeElement?.shadowRoot) {\n const el = activeElement.shadowRoot.activeElement as HTMLElement | null\n if (el === activeElement) {\n break\n } else {\n activeElement = el\n }\n }\n return activeElement\n}\n\nexport function getParentNode(node: Node): Node {\n if (getNodeName(node) === \"html\") {\n return node\n }\n const result =\n (node as any).assignedSlot ||\n node.parentNode ||\n (isShadowRoot(node) && node.host) ||\n getDocumentElement(node)\n return isShadowRoot(result) ? result.host : result\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {getWindow} from \"./node\"\n\nconst styleCache = new WeakMap<Element, CSSStyleDeclaration>()\n\nexport function getComputedStyle(el: Element): CSSStyleDeclaration | undefined {\n if (!styleCache.has(el)) {\n styleCache.set(el, getWindow(el).getComputedStyle(el))\n }\n return styleCache.get(el)\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {getWindow} from \"./node\"\n\nexport type DataUrlType = \"image/png\" | \"image/jpeg\" | \"image/svg+xml\"\n\nexport interface DataUrlOptions {\n /**\n * The background color of the canvas.\n * Useful when type is `image/jpeg`\n */\n background?: string | undefined\n /**\n * The quality of the image\n * @default 0.92\n */\n quality?: number | undefined\n /**\n * The type of the image\n */\n type: DataUrlType\n}\n\nexport function getDataUrl(\n svg: SVGSVGElement | undefined | null,\n opts: DataUrlOptions,\n): Promise<string> {\n const {background, quality = 0.92, type} = opts\n\n if (!svg) {\n throw new Error(\"[@qualcomm-ui/dom/query]: Could not find the svg element\")\n }\n\n const win = getWindow(svg)\n const doc = win.document\n\n const svgBounds = svg.getBoundingClientRect()\n\n const svgClone = svg.cloneNode(true) as SVGSVGElement\n if (!svgClone.hasAttribute(\"viewBox\")) {\n svgClone.setAttribute(\n \"viewBox\",\n `0 0 ${svgBounds.width} ${svgBounds.height}`,\n )\n }\n\n const serializer = new win.XMLSerializer()\n const source = `<?xml version=\"1.0\" standalone=\"no\"?>\\r\\n${serializer.serializeToString(\n svgClone,\n )}`\n const svgString = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(source)}`\n\n if (type === \"image/svg+xml\") {\n return Promise.resolve(svgString).then((str) => {\n svgClone.remove()\n return str\n })\n }\n\n const dpr = win.devicePixelRatio || 1\n\n const canvas = doc.createElement(\"canvas\")\n const image = new win.Image()\n image.src = svgString\n\n canvas.width = svgBounds.width * dpr\n canvas.height = svgBounds.height * dpr\n\n const context = canvas.getContext(\"2d\")\n\n if (!context) {\n throw new Error(\"[getDataUrl]: Could not get the canvas context\")\n }\n\n if (type === \"image/jpeg\" || background) {\n context.fillStyle = background || \"white\"\n context.fillRect(0, 0, canvas.width, canvas.height)\n }\n\n return new Promise((resolve) => {\n image.onload = () => {\n context?.drawImage(image, 0, 0, canvas.width, canvas.height)\n resolve(canvas.toDataURL(type, quality))\n svgClone.remove()\n }\n })\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nexport function isDom(): boolean {\n return typeof document !== \"undefined\"\n}\n\ninterface NavigatorUserAgentData {\n brands: Array<{brand: string; version: string}>\n mobile: boolean\n platform: string\n}\n\nexport function getPlatform(): string {\n const agent = (navigator as any).userAgentData as\n | NavigatorUserAgentData\n | undefined\n return agent?.platform ?? navigator.platform\n}\n\nexport function getUserAgent(): string {\n const ua = (navigator as any).userAgentData as\n | NavigatorUserAgentData\n | undefined\n if (ua && Array.isArray(ua.brands)) {\n return ua.brands.map(({brand, version}) => `${brand}/${version}`).join(\" \")\n }\n return navigator.userAgent\n}\n\nfunction pt(v: RegExp) {\n return isDom() && v.test(getPlatform())\n}\n\nfunction ua(v: RegExp) {\n return isDom() && v.test(getUserAgent())\n}\n\nconst vn = (v: RegExp) => isDom() && v.test(navigator.vendor)\n\nexport function isTouchDevice(): boolean {\n return isDom() && !!navigator.maxTouchPoints\n}\n\nexport function isMac(): boolean {\n return pt(/^Mac/)\n}\n\nexport function isSafari(): boolean {\n return isApple() && vn(/apple/i)\n}\n\nexport function isFirefox(): boolean {\n return ua(/firefox\\//i)\n}\n\nexport function isApple(): boolean {\n return pt(/mac|iphone|ipad|ipod/i)\n}\n\nexport function isIos(): boolean {\n return pt(/iP(hone|ad|od)|iOS/)\n}\n\nexport function isWebKit(): boolean {\n return ua(/AppleWebKit/)\n}\n\nexport function isAndroid(): boolean {\n const re = /android/i\n return pt(re) || ua(re)\n}\n\n/**\n * Returns the keyboard modifier key: CMD if on Mac, Ctrl if on Windows or Linux.\n *\n * @param ssrFallback fallback value to render during SSR.\n */\nexport function getModifierKey(ssrFallback: string = \"Ctrl\"): string {\n return isMac() ? \"\u2318\" : ssrFallback\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {MaybeFn} from \"@qualcomm-ui/utils/guard\"\n\nimport {contains} from \"./node\"\nimport {isAndroid, isApple, isMac} from \"./platform\"\nimport type {AnyPointerEvent, EventKeyOptions, NativeEvent} from \"./types\"\n\nexport function getBeforeInputValue(\n event: Pick<InputEvent, \"currentTarget\">,\n): string {\n const {selectionEnd, selectionStart, value} =\n event.currentTarget as HTMLInputElement\n return (\n value.slice(0, selectionStart ?? -1) +\n (event as any).data +\n value.slice(selectionEnd ?? -1)\n )\n}\n\nfunction getComposedPath(event: any): EventTarget[] | undefined {\n return event.composedPath?.() ?? event.nativeEvent?.composedPath?.()\n}\n\nexport function getEventTarget<T extends EventTarget>(\n event: Partial<Pick<UIEvent, \"target\" | \"composedPath\">>,\n): T | null {\n const composedPath = getComposedPath(event)\n return (composedPath?.[0] ?? event.target) as T | null\n}\n\nexport function isSelfTarget(\n event: Partial<Pick<UIEvent, \"currentTarget\" | \"target\" | \"composedPath\">>,\n): boolean {\n return contains(event.currentTarget as Node, getEventTarget(event))\n}\n\nexport function isOpeningInNewTab(\n event: Pick<MouseEvent, \"currentTarget\" | \"metaKey\" | \"ctrlKey\">,\n): boolean {\n const element = event.currentTarget as\n | HTMLAnchorElement\n | HTMLButtonElement\n | HTMLInputElement\n | null\n if (!element) {\n return false\n }\n\n const isAppleDevice = isApple()\n if (isAppleDevice && !event.metaKey) {\n return false\n }\n if (!isAppleDevice && !event.ctrlKey) {\n return false\n }\n\n const localName = element.localName\n\n if (localName === \"a\") {\n return true\n }\n if (localName === \"button\" && element.type === \"submit\") {\n return true\n }\n if (localName === \"input\" && element.type === \"submit\") {\n return true\n }\n\n return false\n}\n\nexport function isDownloadingEvent(\n event: Pick<MouseEvent, \"altKey\" | \"currentTarget\">,\n): boolean {\n const element = event.currentTarget as\n | HTMLAnchorElement\n | HTMLButtonElement\n | HTMLInputElement\n | null\n if (!element) {\n return false\n }\n const localName = element.localName\n if (!event.altKey) {\n return false\n }\n if (localName === \"a\") {\n return true\n }\n if (localName === \"button\" && element.type === \"submit\") {\n return true\n }\n if (localName === \"input\" && element.type === \"submit\") {\n return true\n }\n return false\n}\n\nexport function isComposingEvent(event: any): boolean {\n return getNativeEvent(event).isComposing\n}\n\nexport function isKeyboardClick(\n e: Pick<MouseEvent, \"detail\" | \"clientX\" | \"clientY\">,\n): boolean {\n return e.detail === 0 || (e.clientX === 0 && e.clientY === 0)\n}\n\nexport function isPrintableKey(\n e: Pick<KeyboardEvent, \"key\" | \"ctrlKey\" | \"metaKey\">,\n): boolean {\n return e.key.length === 1 && !e.ctrlKey && !e.metaKey\n}\n\nexport function isVirtualPointerEvent(e: PointerEvent): boolean {\n return (\n (e.width === 0 && e.height === 0) ||\n (e.width === 1 &&\n e.height === 1 &&\n e.pressure === 0 &&\n e.detail === 0 &&\n e.pointerType === \"mouse\")\n )\n}\n\nexport function isVirtualClick(e: MouseEvent | PointerEvent): boolean {\n if ((e as any).mozInputSource === 0 && e.isTrusted) {\n return true\n }\n if (isAndroid() && (e as PointerEvent).pointerType) {\n return e.type === \"click\" && e.buttons === 1\n }\n return e.detail === 0 && !(e as PointerEvent).pointerType\n}\n\nexport function isLeftClick(e: Pick<MouseEvent, \"button\">): boolean {\n return e.button === 0\n}\n\nexport function isContextMenuEvent(\n e: Pick<MouseEvent, \"button\" | \"ctrlKey\" | \"metaKey\">,\n): boolean {\n return e.button === 2 || (isMac() && e.ctrlKey && e.button === 0)\n}\n\nexport function isModifierKey(\n e: Pick<KeyboardEvent, \"ctrlKey\" | \"metaKey\" | \"altKey\">,\n): boolean {\n return e.ctrlKey || e.altKey || e.metaKey\n}\n\nexport const isTouchEvent = (event: AnyPointerEvent): event is TouchEvent =>\n \"touches\" in event && event.touches.length > 0\n\nconst keyMap: Record<string, string> = {\n \" \": \"Space\",\n \",\": \"Comma\",\n Down: \"ArrowDown\",\n Esc: \"Escape\",\n Left: \"ArrowLeft\",\n Right: \"ArrowRight\",\n Up: \"ArrowUp\",\n}\n\nconst rtlKeyMap: Record<string, string> = {\n ArrowLeft: \"ArrowRight\",\n ArrowRight: \"ArrowLeft\",\n}\n\nexport function getEventKey(\n event: Pick<KeyboardEvent, \"key\">,\n options: EventKeyOptions = {},\n): string {\n const {dir = \"ltr\", orientation = \"horizontal\"} = options\n let key = event.key\n key = keyMap[key] ?? key\n const isRtl = dir === \"rtl\" && orientation === \"horizontal\"\n if (isRtl && key in rtlKeyMap) {\n key = rtlKeyMap[key]\n }\n return key\n}\n\nexport function getNativeEvent<E>(event: E): NativeEvent<E> {\n return (event as any).nativeEvent ?? event\n}\n\nconst pageKeys = new Set([\"PageUp\", \"PageDown\"])\nconst arrowKeys = new Set([\"ArrowUp\", \"ArrowDown\", \"ArrowLeft\", \"ArrowRight\"])\n\nexport function getEventStep(\n event: Pick<KeyboardEvent, \"ctrlKey\" | \"metaKey\" | \"key\" | \"shiftKey\">,\n): 1 | 0.1 | 10 {\n if (event.ctrlKey || event.metaKey) {\n return 0.1\n } else {\n const isPageKey = pageKeys.has(event.key)\n const isSkipKey = isPageKey || (event.shiftKey && arrowKeys.has(event.key))\n return isSkipKey ? 10 : 1\n }\n}\n\nexport function getEventPoint(\n event: any,\n type: \"page\" | \"client\" = \"client\",\n): {x: number; y: number} {\n const point = isTouchEvent(event)\n ? event.touches[0] || event.changedTouches[0]\n : event\n return {x: point[`${type}X`], y: point[`${type}Y`]}\n}\n\ninterface DOMEventMap\n extends DocumentEventMap,\n WindowEventMap,\n HTMLElementEventMap {}\n\nexport const addDomEvent = <K extends keyof DOMEventMap>(\n target: MaybeFn<EventTarget | null>,\n eventName: K,\n handler: (event: DOMEventMap[K]) => void,\n options?: boolean | AddEventListenerOptions,\n) => {\n const node = typeof target === \"function\" ? target() : target\n node?.addEventListener(eventName, handler as any, options)\n return (): void => {\n node?.removeEventListener(eventName, handler as any, options)\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {getWindow} from \"./node\"\nimport type {HTMLElementWithValue} from \"./types\"\n\ninterface DescriptorOptions {\n property?: \"value\" | \"checked\" | undefined\n type?:\n | \"HTMLInputElement\"\n | \"HTMLTextAreaElement\"\n | \"HTMLSelectElement\"\n | undefined\n}\n\nfunction getDescriptor(el: HTMLElement, options: DescriptorOptions) {\n const {property = \"value\", type = \"HTMLInputElement\"} = options\n const proto = getWindow(el)[type].prototype\n return Object.getOwnPropertyDescriptor(proto, property) ?? {}\n}\n\nfunction getElementType(\n el: HTMLElementWithValue,\n):\n | \"HTMLInputElement\"\n | \"HTMLTextAreaElement\"\n | \"HTMLSelectElement\"\n | undefined {\n if (el.localName === \"input\") {\n return \"HTMLInputElement\"\n }\n if (el.localName === \"textarea\") {\n return \"HTMLTextAreaElement\"\n }\n if (el.localName === \"select\") {\n return \"HTMLSelectElement\"\n }\n return undefined\n}\n\nexport function setElementValue(\n el: HTMLElementWithValue | null,\n value: string,\n property: \"value\" | \"checked\" = \"value\",\n): void {\n if (!el) {\n return\n }\n const type = getElementType(el)\n if (type) {\n const descriptor = getDescriptor(el, {property, type})\n descriptor.set?.call(el, value)\n }\n el.setAttribute(property, value)\n}\n\nexport function setElementChecked(\n el: HTMLInputElement | null,\n checked: boolean,\n): void {\n if (!el) {\n return\n }\n const descriptor = getDescriptor(el, {\n property: \"checked\",\n type: \"HTMLInputElement\",\n })\n descriptor.set?.call(el, checked)\n // react applies the `checked` automatically when we call the descriptor\n // but for consistency with vanilla JS, we need to do it manually as well\n if (checked) {\n el.setAttribute(\"checked\", \"\")\n } else {\n el.removeAttribute(\"checked\")\n }\n}\n\nexport interface InputValueEventOptions {\n bubbles?: boolean\n value: string | number\n}\n\nexport function dispatchInputValueEvent(\n el: HTMLElementWithValue | null,\n options: InputValueEventOptions,\n): void {\n const {bubbles = true, value} = options\n\n if (!el) {\n return\n }\n\n const win = getWindow(el)\n if (!(el instanceof win.HTMLInputElement)) {\n return\n }\n\n setElementValue(el, `${value}`)\n el.dispatchEvent(new win.Event(\"input\", {bubbles}))\n}\n\nexport interface CheckedEventOptions {\n bubbles?: boolean\n checked: boolean\n}\n\nexport function dispatchInputCheckedEvent(\n el: HTMLInputElement | null,\n options: CheckedEventOptions,\n): void {\n const {bubbles = true, checked} = options\n if (!el) {\n return\n }\n const win = getWindow(el)\n if (!(el instanceof win.HTMLInputElement)) {\n return\n }\n setElementChecked(el, checked)\n el.dispatchEvent(new win.Event(\"click\", {bubbles}))\n}\n\nfunction getClosestForm(el: HTMLElement) {\n return isFormElement(el) ? el.form : el.closest(\"form\")\n}\n\nfunction isFormElement(el: HTMLElement): el is HTMLElementWithValue {\n return el.matches(\"textarea, input, select, button\")\n}\n\nfunction trackFormReset(\n el: HTMLElement | null | undefined,\n callback: VoidFunction,\n) {\n if (!el) {\n return\n }\n const form = getClosestForm(el)\n const onReset = (e: Event) => {\n if (e.defaultPrevented) {\n return\n }\n callback()\n }\n form?.addEventListener(\"reset\", onReset, {passive: true})\n return () => form?.removeEventListener(\"reset\", onReset)\n}\n\nfunction trackFieldsetDisabled(\n el: HTMLElement | null | undefined,\n callback: (disabled: boolean) => void,\n) {\n const fieldset = el?.closest(\"fieldset\")\n if (!fieldset) {\n return\n }\n callback(fieldset.disabled)\n const win = getWindow(fieldset)\n const obs = new win.MutationObserver(() => callback(fieldset.disabled))\n obs.observe(fieldset, {\n attributeFilter: [\"disabled\"],\n attributes: true,\n })\n return () => obs.disconnect()\n}\n\nexport interface TrackFormControlOptions {\n onFieldsetDisabledChange: (disabled: boolean) => void\n onFormReset: VoidFunction\n}\n\nexport function trackFormControl(\n el: HTMLElement | null,\n options: TrackFormControlOptions,\n): VoidFunction | undefined {\n if (!el) {\n return\n }\n const {onFieldsetDisabledChange, onFormReset} = options\n const cleanups = [\n trackFormReset(el, onFormReset),\n trackFieldsetDisabled(el, onFieldsetDisabledChange),\n ]\n return (): void => cleanups.forEach((cleanup) => cleanup?.())\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {isEditableElement, isElementVisible, isHTMLElement} from \"./node\"\n\ntype IncludeContainerType = boolean | \"if-empty\"\n\nconst isFrame = (el: any): el is HTMLIFrameElement =>\n isHTMLElement(el) && el.tagName === \"IFRAME\"\n\nconst hasTabIndex = (el: Element) =>\n !Number.isNaN(parseInt(el.getAttribute(\"tabindex\") || \"0\", 10))\nconst hasNegativeTabIndex = (el: Element) =>\n parseInt(el.getAttribute(\"tabindex\") || \"0\", 10) < 0\n\nconst focusableSelector =\n /* #__PURE__ */ \"input:not([type='hidden']):not([disabled]), select:not([disabled]), \" +\n \"textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], \" +\n \"iframe, object, embed, area[href], audio[controls], video[controls], \" +\n \"[contenteditable]:not([contenteditable='false']), details > summary:first-of-type\"\n\nexport function getFocusables(\n container: Pick<HTMLElement, \"querySelectorAll\"> | null,\n includeContainer: IncludeContainerType = false,\n): HTMLElement[] {\n if (!container) {\n return []\n }\n const elements = Array.from(\n container.querySelectorAll<HTMLElement>(focusableSelector),\n )\n\n const include =\n // eslint-disable-next-line eqeqeq\n includeContainer == true ||\n (includeContainer === \"if-empty\" && elements.length === 0)\n if (include && isHTMLElement(container) && isFocusable(container)) {\n elements.unshift(container)\n }\n\n const focusableElements = elements.filter(isFocusable)\n\n focusableElements.forEach((element, i) => {\n if (isFrame(element) && element.contentDocument) {\n const frameBody = element.contentDocument.body\n focusableElements.splice(i, 1, ...getFocusables(frameBody))\n }\n })\n\n return focusableElements\n}\n\nexport function isFocusable(\n element: HTMLElement | null,\n): element is HTMLElement {\n if (!element || element.closest(\"[inert]\")) {\n return false\n }\n return element.matches(focusableSelector) && isElementVisible(element)\n}\n\nexport function getFirstFocusable(\n container: HTMLElement | null,\n includeContainer?: IncludeContainerType,\n): HTMLElement | null {\n const [first] = getFocusables(container, includeContainer)\n return first || null\n}\n\nexport function getTabbables(\n container: HTMLElement | null | undefined,\n includeContainer?: IncludeContainerType,\n): HTMLElement[] {\n if (!container) {\n return []\n }\n const elements = Array.from(\n container.querySelectorAll<HTMLElement>(focusableSelector),\n )\n const tabbableElements = elements.filter(isTabbable)\n\n if (includeContainer && isTabbable(container)) {\n tabbableElements.unshift(container)\n }\n\n tabbableElements.forEach((element, i) => {\n if (isFrame(element) && element.contentDocument) {\n const frameBody = element.contentDocument.body\n const allFrameTabbable = getTabbables(frameBody)\n tabbableElements.splice(i, 1, ...allFrameTabbable)\n }\n })\n\n if (!tabbableElements.length && includeContainer) {\n return elements\n }\n\n return tabbableElements\n}\n\nexport function isTabbable(el: HTMLElement | null): el is HTMLElement {\n if (el != null && el.tabIndex > 0) {\n return true\n }\n return isFocusable(el) && !hasNegativeTabIndex(el)\n}\n\nexport function getFirstTabbable(\n container: HTMLElement | null,\n includeContainer?: IncludeContainerType,\n): HTMLElement | null {\n const [first] = getTabbables(container, includeContainer)\n return first || null\n}\n\nexport function getLastTabbable(\n container: HTMLElement | null,\n includeContainer?: IncludeContainerType,\n): HTMLElement | null {\n const elements = getTabbables(container, includeContainer)\n return elements[elements.length - 1] || null\n}\n\nexport function getTabbableEdges(\n container: HTMLElement | null | undefined,\n includeContainer?: IncludeContainerType,\n): [HTMLElement, HTMLElement] | [null, null] {\n const elements = getTabbables(container, includeContainer)\n const first = elements[0] || null\n const last = elements[elements.length - 1] || null\n return [first, last]\n}\n\nexport function getNextTabbable(\n container: HTMLElement | null,\n current?: HTMLElement | null,\n): HTMLElement | null {\n const tabbables = getTabbables(container)\n const doc = container?.ownerDocument || document\n const currentElement = current ?? (doc.activeElement as HTMLElement | null)\n if (!currentElement) {\n return null\n }\n const index = tabbables.indexOf(currentElement)\n return tabbables[index + 1] || null\n}\n\nexport function getTabIndex(node: HTMLElement | SVGElement): number {\n if (node.tabIndex < 0) {\n if (\n (/^(audio|video|details)$/.test(node.localName) ||\n isEditableElement(node)) &&\n !hasTabIndex(node)\n ) {\n return 0\n }\n }\n return node.tabIndex\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {getTabbableEdges, getTabbables} from \"./tabbable\"\n\n/**\n * Represents options for managing the initial focus within a focusable area.\n */\nexport interface InitialFocusOptions {\n enabled?: boolean | undefined\n filter?: ((el: HTMLElement) => boolean) | undefined\n getInitialEl?: (() => HTMLElement | null) | undefined\n root: HTMLElement | null\n}\n\n/**\n * Determines and returns the initial focusable element based on the provided\n * options.\n *\n * @param {InitialFocusOptions} options - Configuration options for determining the initial focus element.\n * @param {boolean} [options.enabled=true] - Whether the focus logic should be processed.\n * @param {(HTMLElement | (() => HTMLElement | null | undefined))} [options.getInitialEl] - A specific element or a function returning an element to set as the initial focus target.\n * @param {HTMLElement} [options.root] - The root container within which to search for focusable elements.\n * @param {(node: HTMLElement) => boolean} [options.filter] - A function to filter and prioritize focusable elements.\n * @return {HTMLElement | undefined} The element to receive initial focus, or `undefined` if no suitable element is found.\n */\nexport function getInitialFocus(\n options: InitialFocusOptions,\n): HTMLElement | undefined {\n const {enabled = true, filter, getInitialEl, root} = options\n\n if (!enabled) {\n return\n }\n\n let node: HTMLElement | null | undefined = null\n\n node ||= typeof getInitialEl === \"function\" ? getInitialEl() : getInitialEl\n node ||= root?.querySelector<HTMLElement>(\"[data-autofocus],[autofocus]\")\n\n if (!node) {\n const tabbables = getTabbables(root)\n node = filter ? tabbables.filter(filter)[0] : tabbables[0]\n }\n\n return node || root || undefined\n}\n\nexport function isValidTabEvent(\n event: Pick<KeyboardEvent, \"shiftKey\" | \"currentTarget\">,\n): boolean {\n const container = event.currentTarget as HTMLElement | null\n if (!container) {\n return false\n }\n\n const [firstTabbable, lastTabbable] = getTabbableEdges(container)\n const doc = container.ownerDocument || document\n\n if (doc.activeElement === firstTabbable && event.shiftKey) {\n return false\n }\n if (doc.activeElement === lastTabbable && !event.shiftKey) {\n return false\n }\n if (!firstTabbable && !lastTabbable) {\n return false\n }\n\n return true\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nexport function nextTick(fn: VoidFunction): VoidFunction {\n const set = new Set<VoidFunction>()\n function raf(fn: VoidFunction) {\n const id = globalThis.requestAnimationFrame(fn)\n set.add(() => globalThis.cancelAnimationFrame(id))\n }\n raf(() => raf(fn))\n return function cleanup() {\n set.forEach((fn) => fn())\n }\n}\n\nexport function raf(fn: VoidFunction | (() => VoidFunction)): VoidFunction {\n let cleanup: VoidFunction | undefined | void\n const id = globalThis.requestAnimationFrame(() => {\n cleanup = fn()\n })\n return () => {\n globalThis.cancelAnimationFrame(id)\n cleanup?.()\n }\n}\n\nexport function queueBeforeEvent(\n el: EventTarget,\n type: string,\n cb: () => void,\n): VoidFunction {\n const cancelTimer = raf(() => {\n el.removeEventListener(type, exec, true)\n cb()\n })\n const exec = () => {\n cancelTimer()\n cb()\n }\n el.addEventListener(type, exec, {capture: true, once: true})\n return cancelTimer\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {raf} from \"./raf\"\nimport type {MaybeElement, MaybeElementOrFn} from \"./types\"\n\nexport interface ObserveAttributeOptions {\n attributes: string[]\n callback(record: MutationRecord): void\n defer?: boolean | undefined\n}\n\nfunction observeAttributesImpl(\n node: MaybeElement,\n options: ObserveAttributeOptions,\n) {\n if (!node) {\n return\n }\n const {attributes, callback: fn} = options\n const win = node.ownerDocument.defaultView || window\n const obs = new win.MutationObserver((changes: any) => {\n for (const change of changes) {\n if (\n change.type === \"attributes\" &&\n change.attributeName &&\n attributes.includes(change.attributeName)\n ) {\n fn(change)\n }\n }\n })\n obs.observe(node, {attributeFilter: attributes, attributes: true})\n return () => obs.disconnect()\n}\n\nexport function observeAttributes(\n nodeOrFn: MaybeElementOrFn,\n options: ObserveAttributeOptions,\n): VoidFunction {\n const {defer} = options\n const func = defer ? raf : (v: any) => v()\n const cleanups: (VoidFunction | undefined)[] = []\n cleanups.push(\n func(() => {\n const node = typeof nodeOrFn === \"function\" ? nodeOrFn() : nodeOrFn\n cleanups.push(observeAttributesImpl(node, options))\n }),\n )\n return () => {\n cleanups.forEach((fn) => fn?.())\n }\n}\n\nexport interface ObserveChildrenOptions {\n callback: MutationCallback\n defer?: boolean | undefined\n}\n\nfunction observeChildrenImpl(\n node: MaybeElement,\n options: ObserveChildrenOptions,\n) {\n const {callback: fn} = options\n if (!node) {\n return\n }\n const win = node.ownerDocument.defaultView || window\n const obs = new win.MutationObserver(fn)\n obs.observe(node, {childList: true, subtree: true})\n return () => obs.disconnect()\n}\n\nexport function observeChildren(\n nodeOrFn: MaybeElementOrFn,\n options: ObserveChildrenOptions,\n): VoidFunction {\n const {defer} = options\n const func = defer ? raf : (v: any) => v()\n const cleanups: (VoidFunction | undefined)[] = []\n cleanups.push(\n func(() => {\n const node = typeof nodeOrFn === \"function\" ? nodeOrFn() : nodeOrFn\n cleanups.push(observeChildrenImpl(node, options))\n }),\n )\n return () => {\n cleanups.forEach((fn) => fn?.())\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {isFirefox} from \"./platform\"\nimport {queueBeforeEvent} from \"./raf\"\n\nexport function clickIfLink(el: HTMLAnchorElement): void {\n const click = () => el.click()\n if (isFirefox()) {\n queueBeforeEvent(el, \"keyup\", click)\n } else {\n queueMicrotask(click)\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {\n getDocument,\n getParentNode,\n getWindow,\n isHTMLElement,\n isRootElement,\n isVisualViewport,\n} from \"./node\"\n\nexport type OverflowAncestor = Array<\n VisualViewport | Window | HTMLElement | null\n>\n\nexport function getNearestOverflowAncestor(el: Node): HTMLElement {\n const parentNode = getParentNode(el)\n if (isRootElement(parentNode)) {\n return getDocument(parentNode).body\n }\n if (isHTMLElement(parentNode) && isOverflowElement(parentNode)) {\n return parentNode\n }\n return getNearestOverflowAncestor(parentNode)\n}\n\nexport function getOverflowAncestors(\n el: HTMLElement,\n list: OverflowAncestor = [],\n): OverflowAncestor {\n const scrollableAncestor = getNearestOverflowAncestor(el)\n const isBody = scrollableAncestor === el.ownerDocument.body\n const win = getWindow(scrollableAncestor)\n if (isBody) {\n return list.concat(\n win,\n win.visualViewport || [],\n isOverflowElement(scrollableAncestor) ? scrollableAncestor : [],\n )\n }\n return list.concat(\n scrollableAncestor,\n getOverflowAncestors(scrollableAncestor, []),\n )\n}\n\nconst getElementRect = (el: HTMLElement | Window | VisualViewport) => {\n if (isHTMLElement(el)) {\n return el.getBoundingClientRect()\n }\n if (isVisualViewport(el)) {\n return {bottom: el.height, left: 0, right: el.width, top: 0}\n }\n return {bottom: el.innerHeight, left: 0, right: el.innerWidth, top: 0}\n}\n\nexport function isInView(\n el: HTMLElement | Window | VisualViewport,\n ancestor: HTMLElement | Window | VisualViewport,\n): boolean {\n if (!isHTMLElement(el)) {\n return true\n }\n const ancestorRect = getElementRect(ancestor)\n const elRect = el.getBoundingClientRect()\n return (\n elRect.top >= ancestorRect.top &&\n elRect.left >= ancestorRect.left &&\n elRect.bottom <= ancestorRect.bottom &&\n elRect.right <= ancestorRect.right\n )\n}\n\nconst OVERFLOW_RE = /auto|scroll|overlay|hidden|clip/\n\nexport function isOverflowElement(el: HTMLElement): boolean {\n const win = getWindow(el)\n const {display, overflow, overflowX, overflowY} = win.getComputedStyle(el)\n return (\n OVERFLOW_RE.test(overflow + overflowY + overflowX) &&\n ![\"inline\", \"contents\"].includes(display)\n )\n}\n\nexport interface ScrollOptions extends ScrollIntoViewOptions {\n rootEl: HTMLElement | null\n}\n\nfunction isScrollable(el: HTMLElement): boolean {\n return el.scrollHeight > el.clientHeight || el.scrollWidth > el.clientWidth\n}\n\nexport function scrollIntoView(\n el: HTMLElement | null | undefined,\n options?: ScrollOptions,\n): void {\n const {rootEl, ...scrollOptions} = options || {}\n if (!el || !rootEl) {\n return\n }\n if (!isOverflowElement(rootEl) || !isScrollable(rootEl)) {\n return\n }\n el.scrollIntoView(scrollOptions)\n}\n\nexport interface ScrollPosition {\n scrollLeft: number\n scrollTop: number\n}\n\nexport function getScrollPosition(\n element: HTMLElement | Window,\n): ScrollPosition {\n if (isHTMLElement(element)) {\n return {scrollLeft: element.scrollLeft, scrollTop: element.scrollTop}\n }\n return {scrollLeft: element.scrollX, scrollTop: element.scrollY}\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nexport function clamp(value: number): number {\n return Math.max(0, Math.min(1, value))\n}\n\nexport function wrap<T>(v: T[], idx: number): T[] {\n return v.map((_, index) => v[(Math.max(idx, 0) + index) % v.length])\n}\n\nexport function pipe<T>(...fns: Array<(arg: T) => T>): (arg: T) => T {\n return (arg: T) => fns.reduce((acc, fn) => fn(acc), arg)\n}\n\nexport const MAX_Z_INDEX = 2147483647\n\nexport function sanitize(str: string): string {\n return str\n .split(\"\")\n .map((char) => {\n const code = char.charCodeAt(0)\n if (code > 0 && code < 128) {\n return char\n }\n if (code >= 128 && code <= 255) {\n return `/x${code.toString(16)}`.replace(\"/\", \"\\\\\")\n }\n return \"\"\n })\n .join(\"\")\n .trim()\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {clamp} from \"./shared\"\nimport type {Point} from \"./types\"\n\nexport interface PercentValueOptions {\n dir?: \"ltr\" | \"rtl\" | undefined\n inverted?: boolean | {x?: boolean; y?: boolean} | undefined\n orientation?: \"vertical\" | \"horizontal\" | undefined\n}\n\nexport function getRelativePoint(\n point: Point,\n element: HTMLElement,\n): {\n getPercentValue: (options?: PercentValueOptions) => number\n offset: {x: number; y: number}\n percent: {x: number; y: number}\n} {\n const {height, left, top, width} = element.getBoundingClientRect()\n const offset = {x: point.x - left, y: point.y - top}\n const percent = {x: clamp(offset.x / width), y: clamp(offset.y / height)}\n\n function getPercentValue(options: PercentValueOptions = {}): number {\n const {dir = \"ltr\", inverted, orientation = \"horizontal\"} = options\n const invertX = typeof inverted === \"object\" ? inverted.x : inverted\n const invertY = typeof inverted === \"object\" ? inverted.y : inverted\n if (orientation === \"horizontal\") {\n return dir === \"rtl\" || invertX ? 1 - percent.x : percent.x\n }\n return invertY ? 1 - percent.y : percent.y\n }\n return {getPercentValue, offset, percent}\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {addDomEvent} from \"./event\"\n\nexport function requestPointerLock(\n doc: Document,\n fn?: (locked: boolean) => void,\n): VoidFunction | undefined {\n const body = doc.body\n\n const supported =\n \"pointerLockElement\" in doc || \"mozPointerLockElement\" in doc\n const isLocked = () => !!doc.pointerLockElement\n\n function onPointerChange() {\n fn?.(isLocked())\n }\n\n function onPointerError(event: Event) {\n if (isLocked()) {\n fn?.(false)\n }\n console.error(\"PointerLock error occurred:\", event)\n doc.exitPointerLock()\n }\n\n if (!supported) {\n return\n }\n\n try {\n body.requestPointerLock()\n } catch {}\n\n // prettier-ignore\n const cleanup = [\n addDomEvent(doc, \"pointerlockchange\", onPointerChange, false),\n addDomEvent(doc, \"pointerlockerror\", onPointerError, false)\n ]\n\n return () => {\n cleanup.forEach((cleanup) => cleanup())\n doc.exitPointerLock()\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {isIos} from \"./platform\"\nimport {nextTick, raf} from \"./raf\"\n\ntype State = \"default\" | \"disabled\" | \"restoring\"\n\nlet state: State = \"default\"\nlet userSelect = \"\"\nconst elementMap = new WeakMap<HTMLElement, string>()\n\nexport interface DisableTextSelectionOptions<T = MaybeElement> {\n defer?: boolean | undefined\n doc?: Document | undefined\n target?: T | undefined\n}\n\nfunction disableTextSelectionImpl(options: DisableTextSelectionOptions = {}) {\n const {doc, target} = options\n\n const docNode = doc ?? document\n const rootEl = docNode.documentElement\n\n if (isIos()) {\n if (state === \"default\") {\n userSelect = rootEl.style.webkitUserSelect\n rootEl.style.webkitUserSelect = \"none\"\n }\n\n state = \"disabled\"\n } else if (target) {\n elementMap.set(target, target.style.userSelect)\n target.style.userSelect = \"none\"\n }\n\n return () => restoreTextSelection({doc: docNode, target})\n}\n\nexport function restoreTextSelection(\n options: DisableTextSelectionOptions = {},\n): void {\n const {doc, target} = options\n\n const docNode = doc ?? document\n const rootEl = docNode.documentElement\n\n if (isIos()) {\n if (state !== \"disabled\") {\n return\n }\n state = \"restoring\"\n\n setTimeout(() => {\n nextTick(() => {\n if (state === \"restoring\") {\n if (rootEl.style.webkitUserSelect === \"none\") {\n rootEl.style.webkitUserSelect = userSelect || \"\"\n }\n userSelect = \"\"\n state = \"default\"\n }\n })\n }, 300)\n } else {\n if (target && elementMap.has(target)) {\n const prevUserSelect = elementMap.get(target)\n\n if (target.style.userSelect === \"none\") {\n target.style.userSelect = prevUserSelect ?? \"\"\n }\n\n if (target.getAttribute(\"style\") === \"\") {\n target.removeAttribute(\"style\")\n }\n elementMap.delete(target)\n }\n }\n}\n\ntype MaybeElement = HTMLElement | null | undefined\n\ntype NodeOrFn = MaybeElement | (() => MaybeElement)\n\nexport function disableTextSelection(\n options: DisableTextSelectionOptions<NodeOrFn> = {},\n): VoidFunction {\n const {defer, target, ...restOptions} = options\n const func = defer ? raf : (v: any) => v()\n const cleanups: (VoidFunction | undefined)[] = []\n cleanups.push(\n func(() => {\n const node = typeof target === \"function\" ? target() : target\n cleanups.push(disableTextSelectionImpl({...restOptions, target: node}))\n }),\n )\n return () => {\n cleanups.forEach((fn) => fn?.())\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {addDomEvent, getEventPoint} from \"./event\"\nimport {disableTextSelection} from \"./text-selection\"\nimport type {Point} from \"./types\"\n\nexport interface PointerMoveDetails {\n /**\n * The event that triggered the move.\n */\n event: PointerEvent\n /**\n * The current position of the pointer.\n */\n point: Point\n}\n\nexport interface PointerMoveHandlers {\n /**\n * Called when the pointer moves.\n */\n onPointerMove: (details: PointerMoveDetails) => void\n /**\n * Called when the pointer is released.\n */\n onPointerUp: VoidFunction\n}\n\nexport function trackPointerMove(\n doc: Document,\n handlers: PointerMoveHandlers,\n): VoidFunction {\n const {onPointerMove, onPointerUp} = handlers\n\n const handleMove = (event: PointerEvent) => {\n const point = getEventPoint(event)\n\n const distance = Math.sqrt(point.x ** 2 + point.y ** 2)\n const moveBuffer = event.pointerType === \"touch\" ? 10 : 5\n\n if (distance < moveBuffer) {\n return\n }\n\n // Because Safari doesn't trigger mouseup events when it's above a `<select>`\n if (event.pointerType === \"mouse\" && event.button === 0) {\n onPointerUp()\n return\n }\n\n onPointerMove({event, point})\n }\n\n const cleanups = [\n addDomEvent(doc, \"pointermove\", handleMove, false),\n addDomEvent(doc, \"pointerup\", onPointerUp, false),\n addDomEvent(doc, \"pointercancel\", onPointerUp, false),\n addDomEvent(doc, \"contextmenu\", onPointerUp, false),\n disableTextSelection({doc}),\n ]\n\n return (): void => {\n cleanups.forEach((cleanup) => cleanup())\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {noop} from \"@qualcomm-ui/utils/functions\"\n\nimport {addDomEvent, getEventPoint, getEventTarget} from \"./event\"\nimport {contains, getDocument, getWindow} from \"./node\"\nimport {pipe} from \"./shared\"\nimport type {Point} from \"./types\"\n\nexport interface PressDetails {\n /**\n * The event that triggered the move.\n */\n event: PointerEvent\n /**\n * The current position of the pointer.\n */\n point: Point\n}\n\nexport interface TrackPressOptions {\n /**\n * A function that determines if the key is valid for the press event.\n */\n isValidKey?(event: KeyboardEvent): boolean\n /**\n * The element that will be used to track the keyboard focus events.\n */\n keyboardNode?: Element | null | undefined\n /**\n * A function that will be called when the pointer is pressed.\n */\n onPress?(details: PressDetails): void\n /**\n * A function that will be called when the pointer is pressed up or cancelled.\n */\n onPressEnd?(details: PressDetails): void\n /**\n * A function that will be called when the pointer is pressed down.\n */\n onPressStart?(details: PressDetails): void\n /**\n * The element that will be used to track the pointer events.\n */\n pointerNode: Element | null\n}\n\nexport function trackPress(options: TrackPressOptions): VoidFunction {\n const {\n isValidKey = (e) => e.key === \"Enter\",\n pointerNode,\n keyboardNode = pointerNode,\n onPress,\n onPressEnd,\n onPressStart,\n } = options\n\n if (!pointerNode) {\n return noop\n }\n\n const win = getWindow(pointerNode)\n const doc = getDocument(pointerNode)\n\n let removeStartListeners: VoidFunction = noop\n let removeEndListeners: VoidFunction = noop\n let removeAccessibleListeners: VoidFunction = noop\n\n const getInfo = (event: PointerEvent): PressDetails => ({\n event,\n point: getEventPoint(event),\n })\n\n function startPress(event: PointerEvent) {\n onPressStart?.(getInfo(event))\n }\n\n function cancelPress(event: PointerEvent) {\n onPressEnd?.(getInfo(event))\n }\n\n const startPointerPress = (startEvent: PointerEvent) => {\n removeEndListeners()\n\n const endPointerPress = (endEvent: PointerEvent) => {\n const target = getEventTarget<Element>(endEvent)\n if (contains(pointerNode, target)) {\n onPress?.(getInfo(endEvent))\n } else {\n onPressEnd?.(getInfo(endEvent))\n }\n }\n\n const removePointerUpListener = addDomEvent(\n win,\n \"pointerup\",\n endPointerPress,\n {once: true, passive: !onPress},\n )\n const removePointerCancelListener = addDomEvent(\n win,\n \"pointercancel\",\n cancelPress,\n {\n once: true,\n passive: !onPressEnd,\n },\n )\n\n removeEndListeners = pipe(\n removePointerUpListener,\n removePointerCancelListener,\n )\n\n if (\n doc.activeElement === keyboardNode &&\n startEvent.pointerType === \"mouse\"\n ) {\n startEvent.preventDefault()\n }\n\n startPress(startEvent)\n }\n\n const removePointerListener = addDomEvent(\n pointerNode,\n \"pointerdown\",\n startPointerPress,\n {passive: !onPressStart},\n )\n const removeFocusListener = addDomEvent(\n keyboardNode,\n \"focus\",\n startAccessiblePress,\n )\n\n removeStartListeners = pipe(removePointerListener, removeFocusListener)\n\n function startAccessiblePress() {\n const handleKeydown = (keydownEvent: KeyboardEvent) => {\n if (!isValidKey(keydownEvent)) {\n return\n }\n\n const handleKeyup = (keyupEvent: KeyboardEvent) => {\n if (!isValidKey(keyupEvent)) {\n return\n }\n const evt = new win.PointerEvent(\"pointerup\")\n const info = getInfo(evt)\n onPress?.(info)\n onPressEnd?.(info)\n }\n\n removeEndListeners()\n removeEndListeners = addDomEvent(keyboardNode, \"keyup\", handleKeyup)\n\n const evt = new win.PointerEvent(\"pointerdown\")\n startPress(evt)\n }\n\n const handleBlur = () => {\n const evt = new win.PointerEvent(\"pointercancel\")\n cancelPress(evt)\n }\n\n const removeKeydownListener = addDomEvent(\n keyboardNode,\n \"keydown\",\n handleKeydown,\n )\n const removeBlurListener = addDomEvent(keyboardNode, \"blur\", handleBlur)\n\n removeAccessibleListeners = pipe(removeKeydownListener, removeBlurListener)\n }\n\n return () => {\n removeStartListeners()\n removeEndListeners()\n removeAccessibleListeners()\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {addDomEvent} from \"./event\"\nimport {raf} from \"./raf\"\nimport {getNextTabbable, getTabbableEdges} from \"./tabbable\"\nimport type {MaybeElement, MaybeElementOrFn} from \"./types\"\n\n/**\n *\n * Options that tune the behaviour of {@link proxyTabFocus}.\n *\n * @template T The element type (or getter returning that element) supplied\n * to `triggerElement`.\n */\nexport interface ProxyTabFocusOptions<T = MaybeElement> {\n /**\n * Register the key-down listener during the next animation frame instead of\n * immediately. Enable this when the element(s) involved are not yet present\n * in the DOM at the moment you call `proxyTabFocus`.\n */\n defer?: boolean | undefined\n\n /**\n * Hook that fires right before focus is moved by the proxy logic.\n *\n * When provided, the callback is responsible for moving focus\u2014call\n * `elementToFocus.focus()` yourself.\n * If omitted, `proxyTabFocus` performs `elementToFocus.focus()` automatically.\n */\n onFocus?: ((elementToFocus: HTMLElement) => void) | undefined\n\n /**\n * Invoked exactly once, the first time keyboard focus \"enters\" the container\n * via the proxy (i.e. when the user Tabs from `triggerElement` into\n * `container` or Shift-Tabs from the element after `triggerElement`\n * back into `container`).\n */\n onFocusEnter?: VoidFunction | undefined\n\n /**\n * Element that acts as the gateway into/out of the focus-trap area, or a function\n * returning that element.\n *\n * Tab *forward* from `triggerElement` lands on the first tabbable element in the\n * container.\n *\n * Shift-Tab *backward* from the element immediately **after** `triggerElement`\n * lands on the last tabbable element in the container.\n */\n triggerElement?: T | undefined\n}\n\nfunction proxyTabFocusImpl(\n container: MaybeElement,\n options: ProxyTabFocusOptions = {},\n): VoidFunction {\n const {onFocus, onFocusEnter, triggerElement} = options\n\n const doc = container?.ownerDocument || document\n const body = doc.body\n\n function onKeyDown(event: KeyboardEvent) {\n if (event.key !== \"Tab\") {\n return\n }\n\n let elementToFocus: MaybeElement | undefined = null\n\n // get all tabbable elements within the container\n const [firstTabbable, lastTabbable] = getTabbableEdges(container, true)\n const nextTabbableAfterTrigger = getNextTabbable(body, triggerElement)\n\n const noTabbableElements = !firstTabbable && !lastTabbable\n\n // if we're focused on the element after the reference element and the user tabs\n // backwards we want to focus the last tabbable element\n if (event.shiftKey && nextTabbableAfterTrigger === doc.activeElement) {\n onFocusEnter?.()\n elementToFocus = lastTabbable\n }\n // if we're focused on the first tabbable element and the user tabs backwards\n // we want to focus the reference element\n else if (\n event.shiftKey &&\n (doc.activeElement === firstTabbable || noTabbableElements)\n ) {\n elementToFocus = triggerElement\n }\n // if we're focused on the reference element and the user tabs forwards\n // we want to focus the first tabbable element\n else if (!event.shiftKey && doc.activeElement === triggerElement) {\n onFocusEnter?.()\n elementToFocus = firstTabbable\n }\n // if we're focused on the last tabbable element and the user tabs forwards\n // we want to focus the next tabbable element after the reference element\n else if (\n !event.shiftKey &&\n (doc.activeElement === lastTabbable || noTabbableElements)\n ) {\n elementToFocus = nextTabbableAfterTrigger\n }\n\n if (!elementToFocus) {\n return\n }\n\n event.preventDefault()\n\n if (typeof onFocus === \"function\") {\n onFocus(elementToFocus)\n } else {\n elementToFocus.focus()\n }\n }\n\n // listen for the tab key in the capture phase\n return addDomEvent(doc, \"keydown\", onKeyDown, true)\n}\n\n/**\n * Installs keyboard Tab trapping for a DOM subtree.\n *\n * When focus is on `triggerElement` (or inside `container`) and the user\n * presses Tab / Shift + Tab, the handler redirects focus so it never leaves the\n * `container`. The listener is added to the owning document in the *capture*\n * phase and stays active until the cleanup function returned by this call is\n * executed.\n *\n * @template T\n *\n * @returns {VoidFunction} Call this function to remove the `keydown` listener and clean up internal resources.\n */\nexport function proxyTabFocus(\n container: MaybeElementOrFn,\n options: ProxyTabFocusOptions<MaybeElementOrFn>,\n): VoidFunction {\n const {defer, triggerElement, ...restOptions} = options\n const func = defer ? raf : (v: any) => v()\n const cleanups: (VoidFunction | undefined)[] = []\n cleanups.push(\n func(() => {\n const node = typeof container === \"function\" ? container() : container\n const trigger =\n typeof triggerElement === \"function\" ? triggerElement() : triggerElement\n cleanups.push(\n proxyTabFocusImpl(node, {triggerElement: trigger, ...restOptions}),\n )\n }),\n )\n return () => {\n cleanups.forEach((fn) => fn?.())\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\ntype Root = Document | Element | null | undefined\n\nexport function queryAll<T extends Element = HTMLElement>(\n root: Root,\n selector: string,\n): T[] {\n return Array.from(root?.querySelectorAll<T>(selector) ?? [])\n}\n\nexport function query<T extends Element = HTMLElement>(\n root: Root,\n selector: string,\n): T | null {\n return root?.querySelector<T>(selector) ?? null\n}\n\nexport type ItemToId<T> = (v: T) => string\n\ninterface Item {\n id: string\n}\n\nexport function defaultItemToId<T extends Item>(v: T): string {\n return v.id\n}\n\nexport function itemById<T extends Item>(\n v: T[],\n id: string,\n itemToId: ItemToId<T> = defaultItemToId,\n): T | undefined {\n return v.find((item) => itemToId(item) === id)\n}\n\nexport function indexOfId<T extends Item>(\n v: T[],\n id: string,\n itemToId: ItemToId<T> = defaultItemToId,\n): number {\n const item = itemById(v, id, itemToId)\n return item ? v.indexOf(item) : -1\n}\n\nexport function nextById<T extends Item>(v: T[], id: string, loop = true): T {\n let idx = indexOfId(v, id)\n idx = loop ? (idx + 1) % v.length : Math.min(idx + 1, v.length - 1)\n return v[idx]\n}\n\nexport function prevById<T extends Item>(\n v: T[],\n id: string,\n loop = true,\n): T | null {\n let idx = indexOfId(v, id)\n if (idx === -1) {\n return loop ? v[v.length - 1] : null\n }\n idx = loop ? (idx - 1 + v.length) % v.length : Math.max(0, idx - 1)\n return v[idx]\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {Scope} from \"@qualcomm-ui/utils/machine\"\n\nimport {getActiveElement, getDocument} from \"./node\"\n\nexport function createScope<T>(\n props: Pick<Scope, \"getRootNode\"> & T,\n): Scope & T {\n const getRootNode = () =>\n (props.getRootNode?.() as Document | ShadowRoot | undefined) ?? document\n const getDoc = () => getDocument(getRootNode())\n const getWin = () => getDoc().defaultView ?? window\n const getActiveElementFn = () => getActiveElement(getRootNode())\n const isActiveElement = (elem: HTMLElement | null) =>\n elem === getActiveElementFn()\n const getById = <T extends Element = HTMLElement>(id: string) =>\n getRootNode().getElementById(id) as T | null\n\n const dom = {\n getActiveElement: getActiveElementFn,\n getById,\n getDoc,\n getRootNode,\n getWin,\n isActiveElement,\n }\n\n return {...props, ...dom}\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {defaultItemToId, indexOfId, type ItemToId} from \"./query\"\nimport {sanitize, wrap} from \"./shared\"\n\nfunction getValueText<T extends SearchableItem>(el: T): string {\n return sanitize(el.dataset?.valuetext ?? el.textContent ?? \"\")\n}\n\nfunction match(valueText: string, query: string): boolean {\n return valueText.trim().toLowerCase().startsWith(query.toLowerCase())\n}\n\nexport interface SearchableItem {\n dataset?: any\n id: string\n textContent: string | null\n}\n\nexport function getByText<T extends SearchableItem>(\n v: T[],\n text: string,\n currentId?: string | null,\n itemToId: ItemToId<T> = defaultItemToId,\n): T | undefined {\n const index = currentId ? indexOfId(v, currentId, itemToId) : -1\n let items = currentId ? wrap(v, index) : v\n const isSingleKey = text.length === 1\n if (isSingleKey) {\n items = items.filter((item) => itemToId(item) !== currentId)\n }\n return items.find((item) => match(getValueText(item), text))\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nconst cleanups = new WeakMap<Element, Map<string, () => void>>()\n\nfunction set(\n element: Element,\n key: string,\n setup: () => () => void,\n): VoidFunction {\n if (!cleanups.has(element)) {\n cleanups.set(element, new Map())\n }\n\n const elementCleanups = cleanups.get(element)\n const prevCleanup = elementCleanups?.get(key)\n\n if (!prevCleanup) {\n elementCleanups?.set(key, setup())\n return () => {\n elementCleanups?.get(key)?.()\n elementCleanups?.delete(key)\n }\n }\n\n const cleanup = setup()\n\n const nextCleanup = () => {\n cleanup()\n prevCleanup()\n elementCleanups?.delete(key)\n }\n\n elementCleanups?.set(key, nextCleanup)\n\n return () => {\n const isCurrent = elementCleanups?.get(key) === nextCleanup\n if (!isCurrent) {\n return\n }\n cleanup()\n elementCleanups.set(key, prevCleanup)\n }\n}\n\nexport function setAttribute(\n element: Element,\n attr: string,\n value: string,\n): VoidFunction {\n const setup = () => {\n const previousValue = element.getAttribute(attr)\n element.setAttribute(attr, value)\n return () => {\n if (previousValue == null) {\n element.removeAttribute(attr)\n } else {\n element.setAttribute(attr, previousValue)\n }\n }\n }\n\n return set(element, attr, setup)\n}\n\nexport function setProperty<T extends Element, K extends keyof T & string>(\n element: T,\n property: K,\n value: T[K],\n): VoidFunction {\n const setup = () => {\n const exists = property in element\n const previousValue = element[property]\n element[property] = value\n return () => {\n if (!exists) {\n delete element[property]\n } else {\n element[property] = previousValue\n }\n }\n }\n\n return set(element, property, setup)\n}\n\nexport function setStyle(\n element: HTMLElement | null | undefined,\n style: Partial<CSSStyleDeclaration>,\n): VoidFunction {\n if (!element) {\n return () => {}\n }\n\n const setup = () => {\n const prevStyle = element.style.cssText\n Object.assign(element.style, style)\n return () => {\n element.style.cssText = prevStyle\n }\n }\n\n return set(element, \"style\", setup)\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport type {ItemToId} from \"./query\"\nimport {getByText, type SearchableItem} from \"./searchable\"\n\nexport interface TypeaheadState {\n keysSoFar: string\n timer: number\n}\n\nexport interface TypeaheadOptions<T> {\n activeId: string | null\n itemToId?: ItemToId<T> | undefined\n key: string\n state: TypeaheadState\n timeout?: number | undefined\n}\n\nfunction getByTypeaheadImpl<T extends SearchableItem>(\n baseItems: T[],\n options: TypeaheadOptions<T>,\n): T | undefined {\n const {activeId, itemToId, key, state, timeout = 350} = options\n\n const search = state.keysSoFar + key\n const isRepeated =\n search.length > 1 && Array.from(search).every((char) => char === search[0])\n\n const query = isRepeated ? search[0] : search\n\n const items = baseItems.slice()\n\n const next = getByText(items, query, activeId, itemToId)\n\n function cleanup() {\n clearTimeout(state.timer)\n state.timer = -1\n }\n\n function update(value: string) {\n state.keysSoFar = value\n cleanup()\n\n if (value !== \"\") {\n state.timer = +setTimeout(() => {\n update(\"\")\n cleanup()\n }, timeout)\n }\n }\n\n update(search)\n\n return next\n}\n\nexport const getByTypeahead: typeof getByTypeaheadImpl & {\n defaultOptions: {\n keysSoFar: string\n timer: number\n }\n isValidEvent: typeof isValidTypeaheadEvent\n} = /* #__PURE__ */ Object.assign(getByTypeaheadImpl, {\n defaultOptions: {keysSoFar: \"\", timer: -1},\n isValidEvent: isValidTypeaheadEvent,\n})\n\nfunction isValidTypeaheadEvent(\n event: Pick<KeyboardEvent, \"key\" | \"ctrlKey\" | \"metaKey\">,\n): boolean {\n return event.key.length === 1 && !event.ctrlKey && !event.metaKey\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {addDomEvent} from \"./event\"\n\nexport interface ViewportSize {\n height: number\n width: number\n}\n\nexport function trackVisualViewport(\n doc: Document,\n fn: (data: ViewportSize) => void,\n): VoidFunction {\n const win = doc?.defaultView || window\n const onResize = () => {\n fn?.(getViewportSize(win))\n }\n onResize()\n return addDomEvent(win.visualViewport ?? win, \"resize\", onResize)\n}\n\nfunction getViewportSize(win: Window): ViewportSize {\n return {\n height: win.visualViewport?.height || win.innerHeight,\n width: win.visualViewport?.width || win.innerWidth,\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nexport const visuallyHiddenStyle = {\n border: \"0\",\n clip: \"rect(0 0 0 0)\",\n height: \"1px\",\n margin: \"-1px\",\n overflow: \"hidden\",\n padding: \"0\",\n position: \"absolute\",\n whiteSpace: \"nowrap\",\n width: \"1px\",\n wordWrap: \"normal\",\n} as const\n\nexport function setVisuallyHidden(el: HTMLElement): void {\n Object.assign(el.style, visuallyHiddenStyle)\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\nimport {isHTMLElement} from \"./node\"\n\ntype ElementGetter = () => Element | null\n\nconst fps = 1000 / 60\n\nexport function waitForElement(\n query: ElementGetter,\n cb: (el: HTMLElement) => void,\n): VoidFunction {\n const el = query()\n if (isHTMLElement(el) && el.isConnected) {\n cb(el)\n return () => void 0\n } else {\n const timerId = setInterval(() => {\n const el = query()\n if (isHTMLElement(el) && el.isConnected) {\n cb(el)\n clearInterval(timerId)\n }\n }, fps)\n return () => clearInterval(timerId)\n }\n}\n\nexport function waitForElements(\n queries: ElementGetter[],\n cb: (el: HTMLElement) => void,\n): VoidFunction {\n const cleanups: VoidFunction[] = []\n queries?.forEach((query) => {\n const clean = waitForElement(query, cb)\n cleanups.push(clean)\n })\n return () => {\n cleanups.forEach((fn) => fn())\n }\n}\n", "// Modified from https://github.com/chakra-ui/zag\n// MIT License\n// Changes from Qualcomm Technologies, Inc. are provided under the following license:\n// Copyright (c) Qualcomm Technologies, Inc. and/or its subsidiaries.\n// SPDX-License-Identifier: BSD-3-Clause-Clear\n\n/**\n * Credit: Huge props to the team at Adobe for inspiring this implementation.\n * https://github.com/adobe/react-spectrum/blob/main/packages/%40react-aria/interactions/src/useFocusVisible.ts\n */\n\nimport {\n getDocument,\n getEventTarget,\n getWindow,\n isMac,\n} from \"@qualcomm-ui/dom/query\"\n\nfunction isVirtualClick(event: MouseEvent | PointerEvent): boolean {\n if ((event as any).mozInputSource === 0 && event.isTrusted) {\n return true\n }\n return event.detail === 0 && !(event as PointerEvent).pointerType\n}\n\nfunction isValidKey(e: KeyboardEvent) {\n return !(\n e.metaKey ||\n (!isMac() && e.altKey) ||\n e.ctrlKey ||\n e.key === \"Control\" ||\n e.key === \"Shift\" ||\n e.key === \"Meta\"\n )\n}\n\nconst nonTextInputTypes = new Set([\n \"checkbox\",\n \"radio\",\n \"range\",\n \"color\",\n \"file\",\n \"image\",\n \"button\",\n \"submit\",\n \"reset\",\n])\n\nfunction isKeyboardFocusEvent(\n isTextInput: boolean,\n modality: Modality,\n e: HandlerEvent,\n) {\n const target = e ? getEventTarget<Element>(e) : null\n const win = getWindow(target)\n\n isTextInput =\n isTextInput ||\n (target instanceof win.HTMLInputElement &&\n !nonTextInputTypes.has(target?.type)) ||\n target instanceof win.HTMLTextAreaElement ||\n (target instanceof win.HTMLElement && target.isContentEditable)\n\n return !(\n isTextInput &&\n modality === \"keyboard\" &&\n e instanceof win.KeyboardEvent &&\n !Reflect.has(FOCUS_VISIBLE_INPUT_KEYS, e.key)\n )\n}\n\n// /\n// //////////////////////////////////////////////////////////////////////////////////////////\n\nexport type Modality = \"keyboard\" | \"pointer\" | \"virtual\"\n\ntype RootNode = Document | ShadowRoot | Node\n\ntype HandlerEvent =\n | PointerEvent\n | MouseEvent\n | KeyboardEvent\n | FocusEvent\n | null\n\ntype Handler = (modality: Modality, e: HandlerEvent) => void\n\n// /\n// //////////////////////////////////////////////////////////////////////////////////////////\n\nlet currentModality: Modality | null = null\n\nconst changeHandlers = new Set<Handler>()\n\ninterface GlobalListenerData {\n focus: VoidFunction\n}\n\nexport const listenerMap: Map<Window, GlobalListenerData> = new Map<\n Window,\n GlobalListenerData\n>()\n\nlet hasEventBeforeFocus = false\nlet hasBlurredWindowRecently = false\n\n// Only Tab or Esc keys will make focus visible on text input elements\nconst FOCUS_VISIBLE_INPUT_KEYS = {\n Escape: true,\n Tab: true,\n}\n\nfunction triggerChangeHandlers(modality: Modality, e: HandlerEvent) {\n for (const handler of changeHandlers) {\n handler(modality, e)\n }\n}\n\nfunction handleKeyboardEvent(e: KeyboardEvent) {\n hasEventBeforeFocus = true\n if (isValidKey(e)) {\n currentModality = \"keyboard\"\n triggerChangeHandlers(\"keyboard\", e)\n }\n}\n\nfunction handlePointerEvent(e: PointerEvent | MouseEvent) {\n currentModality = \"pointer\"\n if (e.type === \"mousedown\" || e.type === \"pointerdown\") {\n hasEventBeforeFocus = true\n triggerChangeHandlers(\"pointer\", e)\n }\n}\n\nfunction handleClickEvent(e: MouseEvent) {\n if (isVirtualClick(e)) {\n hasEventBeforeFocus = true\n currentModality = \"virtual\"\n }\n}\n\nfunction handleFocusEvent(e: FocusEvent) {\n // Firefox fires two extra focus events when the user first clicks into an iframe:\n // first on the window, then on the document. We ignore these events so they don't\n // cause keyboard focus rings to appear.\n const target = getEventTarget(e)\n\n if (\n target === getWindow(target as Element) ||\n target === getDocument(target as Element)\n ) {\n return\n }\n\n // If a focus event occurs without a preceding keyboard or pointer event, switch\n // to virtual modality. This occurs, for example, when navigating a form with the\n // next/previous buttons on iOS.\n if (!hasEventBeforeFocus && !hasBlurredWindowRecently) {\n currentModality = \"virtual\"\n triggerChangeHandlers(\"virtual\", e)\n }\n\n hasEventBeforeFocus = false\n hasBlurredWindowRecently = false\n}\n\nfunction handleWindowBlur() {\n // When the window is blurred, reset state. This is necessary when tabbing out of\n // the window, for example, since a subsequent focus event won't be fired.\n hasEventBeforeFocus = false\n hasBlurredWindowRecently = true\n}\n\n/**\n * Setup global event listeners to control when keyboard focus style should be\n * visible.\n */\nfunction setupGlobalFocusEvents(root?: RootNode) {\n if (typeof window === \"undefined\" || listenerMap.get(getWindow(root))) {\n return\n }\n\n const win = getWindow(root)\n const doc = getDocument(root)\n\n const focus = win.HTMLElement.prototype.focus\n win.HTMLElement.prototype.focus = function () {\n // For programmatic focus, we remove the focus visible state to prevent showing\n // focus rings When `options.focusVisible` is supported in most browsers, we can\n // remove this @see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/focus#focusvisible\n currentModality = \"virtual\"\n triggerChangeHandlers(\"virtual\", null)\n\n hasEventBeforeFocus = true\n focus.apply(\n this,\n arguments as unknown as [options?: FocusOptions | undefined],\n )\n }\n\n doc.addEventListener(\"keydown\", handleKeyboardEvent, true)\n doc.addEventListener(\"keyup\", handleKeyboardEvent, true)\n doc.addEventListener(\"click\", handleClickEvent, true)\n\n win.addEventListener(\"focus\", handleFocusEvent, true)\n win.addEventListener(\"blur\", handleWindowBlur, false)\n\n if (typeof win.PointerEvent !== \"undefined\") {\n doc.addEventListener(\"pointerdown\", handlePointerEvent, true)\n doc.addEventListener(\"pointermove\", handlePointerEvent, true)\n doc.addEventListener(\"pointerup\", handlePointerEvent, true)\n } else {\n doc.addEventListener(\"mousedown\", handlePointerEvent, true)\n doc.addEventListener(\"mousemove\", handlePointerEvent, true)\n doc.addEventListener(\"mouseup\", handlePointerEvent, true)\n }\n\n // Add unmount handler\n win.addEventListener(\n \"beforeunload\",\n () => {\n tearDownWindowFocusTracking(root)\n },\n {once: true},\n )\n\n listenerMap.set(win, {focus})\n}\n\nconst tearDownWindowFocusTracking = (\n root?: RootNode,\n loadListener?: () => void,\n) => {\n const win = getWindow(root)\n const doc = getDocument(root)\n\n if (loadListener) {\n doc.removeEventListener(\"DOMContentLoaded\", loadListener)\n }\n\n if (!listenerMap.has(win)) {\n return\n }\n\n win.HTMLElement.prototype.focus = listenerMap.get(win)?.focus ?? (() => {})\n\n doc.removeEventListener(\"keydown\", handleKeyboardEvent, true)\n doc.removeEventListener(\"keyup\", handleKeyboardEvent, true)\n doc.removeEventListener(\"click\", handleClickEvent, true)\n win.removeEventListener(\"focus\", handleFocusEvent, true)\n win.removeEventListener(\"blur\", handleWindowBlur, false)\n\n if (typeof win.PointerEvent !== \"undefined\") {\n doc.removeEventListener(\"pointerdown\", handlePointerEvent, true)\n doc.removeEventListener(\"pointermove\", handlePointerEvent, true)\n doc.removeEventListener(\"pointerup\", handlePointerEvent, true)\n } else {\n doc.removeEventListener(\"mousedown\", handlePointerEvent, true)\n doc.removeEventListener(\"mousemove\", handlePointerEvent, true)\n doc.removeEventListener(\"mouseup\", handlePointerEvent, true)\n }\n\n listenerMap.delete(win)\n}\n\n// /\n// //////////////////////////////////////////////////////////////////////////////////////////\n\nexport function getInteractionModality(): Modality | null {\n return currentModality\n}\n\nexport function setInteractionModality(modality: Modality): void {\n currentModality = modality\n triggerChangeHandlers(modality, null)\n}\n\nexport interface InteractionModalityChangeDetails {\n /** The modality of the interaction that caused the focus to be visible. */\n modality: Modality | null\n}\n\nexport interface InteractionModalityProps {\n /** Callback to be called when the interaction modality changes. */\n onChange: (details: InteractionModalityChangeDetails) => void\n /** The root element to track focus visibility for. */\n root?: RootNode | undefined\n}\n\nexport function trackInteractionModality(\n props: InteractionModalityProps,\n): VoidFunction {\n const {onChange, root} = props\n\n setupGlobalFocusEvents(root)\n\n onChange({modality: currentModality})\n\n const handler = () => onChange({modality: currentModality})\n\n changeHandlers.add(handler)\n return () => {\n changeHandlers.delete(handler)\n }\n}\n\n// /\n// //////////////////////////////////////////////////////////////////////////////////////////\n\nexport function isFocusVisible(): boolean {\n return currentModality === \"keyboard\"\n}\n\nexport interface FocusVisibleChangeDetails {\n /** Whether keyboard focus is visible globally. */\n isFocusVisible: boolean\n /** The modality of the interaction that caused the focus to be visible. */\n modality: Modality | null\n}\n\nexport interface FocusVisibleProps {\n /** Whether the element will be auto focused. */\n autoFocus?: boolean | undefined\n /** Whether the element is a text input. */\n isTextInput?: boolean | undefined\n /** Callback to be called when the focus visibility changes. */\n onChange?: ((details: FocusVisibleChangeDetails) => void) | undefined\n /** The root element to track focus visibility for. */\n root?: RootNode | undefined\n}\n\nexport function trackFocusVisible(props: FocusVisibleProps = {}): VoidFunction {\n const {autoFocus, isTextInput, onChange, root} = props\n\n setupGlobalFocusEvents(root)\n\n onChange?.({\n isFocusVisible: autoFocus || isFocusVisible(),\n modality: currentModality,\n })\n\n const handler = (modality: Modality, e: HandlerEvent) => {\n if (!isKeyboardFocusEvent(!!isTextInput, modality, e)) {\n return\n }\n onChange?.({isFocusVisible: isFocusVisible(), modality})\n }\n\n changeHandlers.add(handler)\n\n return () => {\n changeHandlers.delete(handler)\n }\n}\n", "import { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { useRef } from \"react\";\nimport { HashIcon, TablePropertiesIcon, TextSearchIcon } from \"lucide-react\";\nimport { isFocusVisible } from \"@qualcomm-ui/dom/focus-visible\";\nimport { Icon } from \"@qualcomm-ui/react/icon\";\nimport { HighlightText } from \"@qualcomm-ui/react-core/highlight\";\nimport { useMergedRef } from \"@qualcomm-ui/react-core/refs\";\nimport { PolymorphicElement } from \"@qualcomm-ui/react-core/system\";\nimport { booleanDataAttr } from \"@qualcomm-ui/utils/attributes\";\nimport { clsx } from \"@qualcomm-ui/utils/clsx\";\nfunction getSearchResultIcon(item) {\n if (item.isDocProp) {\n return TablePropertiesIcon;\n }\n if (item.type === \"content\") {\n return TextSearchIcon;\n }\n return HashIcon;\n}\nexport function SearchResultItem(t0) {\n const {\n active,\n className,\n inputValue,\n isChild: t1,\n item,\n ref,\n ...props\n } = t0;\n const isChild = t1 === undefined ? false : t1;\n const rootRef = useRef(null);\n const mergedRef = useMergedRef(ref, rootRef);\n const icon = getSearchResultIcon(item);\n return jsxs(PolymorphicElement, {\n ref: mergedRef,\n as: \"button\",\n className: clsx(\"qui-site-search__list-item\", \"qui-menu-item__root\", className),\n \"data-child\": booleanDataAttr(isChild),\n \"data-focus-visible\": booleanDataAttr(isFocusVisible()),\n \"data-highlighted\": booleanDataAttr(active),\n \"data-type\": item.type,\n ...props,\n children: [icon ? jsx(Icon, {\n className: \"qui-site-search__item-icon\",\n icon,\n size: \"lg\"\n }) : null, jsx(\"div\", {\n className: \"qui-site-search__list-item-content\",\n children: item.type === \"content\" && item.content ? jsxs(Fragment, {\n children: [jsx(\"span\", {\n className: \"qui-site-search__content\",\n children: jsx(HighlightText, {\n ignoreCase: true,\n matchAll: true,\n query: inputValue.split(\" \").at(-1) ?? \"\",\n text: item.content.map(_temp).join(\"\")\n })\n }), jsx(\"div\", {\n className: \"qui-site-search__metadata\",\n children: item.heading\n })]\n }) : jsxs(Fragment, {\n children: [jsx(\"span\", {\n className: \"qui-site-search__content\",\n children: item.heading\n }), item.title && jsx(\"div\", {\n className: \"qui-site-search__metadata\",\n children: item.title\n })]\n })\n })]\n });\n}\nfunction _temp(content) {\n return content.content;\n}", "import { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { useCallback, useEffect, useRef, useState } from \"react\";\nimport { useFloating, useInteractions, useListNavigation } from \"@floating-ui/react\";\nimport { SearchIcon } from \"lucide-react\";\nimport { getSelectorsByUserAgent, OsTypes } from \"react-device-detect\";\nimport { trackFocusVisible } from \"@qualcomm-ui/dom/focus-visible\";\nimport { Dialog } from \"@qualcomm-ui/react/dialog\";\nimport { HeaderBar } from \"@qualcomm-ui/react/header-bar\";\nimport { TextInput } from \"@qualcomm-ui/react/text-input\";\nimport { useDebounce } from \"@qualcomm-ui/react-core/effects\";\nimport { Portal } from \"@qualcomm-ui/react-core/portal\";\nimport { useMdxDocsContext } from \"@qualcomm-ui/react-mdx/context\";\nimport { GroupedResultItem } from \"./grouped-result-item\";\nimport { SearchResultItem } from \"./search-result-item\";\nimport { useGroupedResults } from \"./use-grouped-results\";\nexport function SiteSearch({\n noResults = \"No results found...\"\n}) {\n const [showDialog, setShowDialog] = useState(false);\n const [inputValue, setInputValue] = useState(\"\");\n const inputRef = useRef(null);\n const dialogInputRef = useRef(null);\n const dialogInputContainerRef = useRef(null);\n const listRef = useRef([]);\n const [activeIndex, setActiveIndex] = useState(null);\n const {\n renderLink: Link\n } = useMdxDocsContext();\n useEffect(() => {\n const unsub = trackFocusVisible({\n root: document.documentElement\n });\n return () => {\n unsub();\n };\n }, []);\n const {\n context,\n refs\n } = useFloating({\n open: showDialog\n });\n const listNavigation = useListNavigation(context, {\n activeIndex,\n listRef,\n loop: true,\n onNavigate: index => {\n setActiveIndex(index);\n }\n });\n const debouncedInputValue = useDebounce(inputValue, 100);\n const groupedResults = useGroupedResults(debouncedInputValue);\n const onInputChange = useCallback(value => {\n setInputValue(value);\n }, []);\n useEffect(() => {\n const {\n osName\n } = getSelectorsByUserAgent(window.navigator.userAgent);\n const isMac = osName === OsTypes.MAC_OS;\n function listener(event) {\n if (event.key === \"k\" && (isMac && event.metaKey || !isMac && event.ctrlKey)) {\n inputRef.current?.focus();\n event.preventDefault();\n }\n }\n window.addEventListener(\"keydown\", listener);\n return () => {\n window.removeEventListener(\"keydown\", listener);\n };\n }, [showDialog]);\n const onListItemKeyDown = useCallback(event_0 => {\n switch (event_0.key) {\n case \"Enter\":\n case \"Space\":\n break;\n case \"Tab\":\n dialogInputRef.current?.focus();\n event_0.preventDefault();\n break;\n case \"ArrowDown\":\n break;\n case \"ArrowUp\":\n break;\n default:\n dialogInputRef.current?.focus?.();\n break;\n }\n }, []);\n const onInputKeyDown = useCallback(event_1 => {\n switch (event_1.key) {\n case \"ArrowDown\":\n event_1.preventDefault();\n listRef.current[0]?.focus();\n break;\n case \"ArrowUp\":\n event_1.preventDefault();\n break;\n }\n }, []);\n const {\n getFloatingProps,\n getItemProps,\n getReferenceProps\n } = useInteractions([listNavigation]);\n return /* @__PURE__ */jsxs(Dialog.Root, {\n onOpenChange: open => {\n setShowDialog(open);\n },\n open: showDialog,\n restoreFocus: false,\n children: [/* @__PURE__ */jsx(Dialog.Trigger, {\n children: /* @__PURE__ */jsx(\"div\", {\n \"aria-label\": \"Search the documentation\",\n className: \"qui-site-search__mobile-icon\",\n role: \"searchbox\",\n children: /* @__PURE__ */jsx(HeaderBar.ActionIconButton, {\n \"aria-label\": \"Search\",\n icon: SearchIcon\n })\n })\n }), /* @__PURE__ */jsxs(Portal, {\n children: [/* @__PURE__ */jsx(Dialog.Backdrop, {\n className: \"qui-site-search__mobile-dialog-backdrop\"\n }), /* @__PURE__ */jsx(Dialog.Positioner, {\n children: /* @__PURE__ */jsx(Dialog.Content, {\n className: \"qui-site-search__mobile-dialog-content\",\n onClick: event_2 => {\n if (!dialogInputContainerRef.current?.contains(event_2.target)) {\n setShowDialog(false);\n }\n },\n style: {\n background: \"transparent\",\n border: 0,\n padding: 0\n },\n children: /* @__PURE__ */jsxs(\"div\", {\n className: \"qui-site-search__mobile-input-wrapper\",\n children: [/* @__PURE__ */jsx(TextInput, {\n ...getReferenceProps({\n onKeyDown: onInputKeyDown\n }),\n ref: dialogInputContainerRef,\n className: \"q-background-2\",\n inputProps: {\n ref: dialogInputRef\n },\n onValueChange: onInputChange,\n placeholder: \"Search the docs\",\n size: \"lg\",\n startIcon: SearchIcon,\n value: inputValue\n }), inputValue.length ? /* @__PURE__ */jsx(\"div\", {\n ref: refs.setFloating,\n ...getFloatingProps(),\n className: \"qui-site-search__floating-panel-mobile\",\n children: groupedResults.length ? /* @__PURE__ */jsx(Fragment, {\n children: groupedResults.map(result => /* @__PURE__ */jsxs(\"div\", {\n className: \"qui-site-search__result-group-wrapper\",\n children: [/* @__PURE__ */jsx(GroupedResultItem, {\n active: result.index === activeIndex,\n render: /* @__PURE__ */jsx(Link, {\n href: result.pathname\n }),\n ...getItemProps({\n onKeyDown: onListItemKeyDown,\n ref: ref => {\n listRef.current[result.index] = ref;\n },\n tabIndex: -1\n }),\n item: result\n }), /* @__PURE__ */jsx(\"div\", {\n className: \"qui-site-search__result-group\",\n children: result.items.map(item => /* @__PURE__ */jsx(SearchResultItem, {\n inputValue,\n ...getItemProps({\n onKeyDown: onListItemKeyDown,\n ref: ref_0 => {\n listRef.current[item.index] = ref_0;\n },\n tabIndex: -1\n }),\n active: item.index === activeIndex,\n isChild: true,\n item,\n render: /* @__PURE__ */jsx(Link, {\n href: item.href\n })\n }, item.id))\n })]\n }, `${result.id}-${result.categoryId}`))\n }) : noResults ? /* @__PURE__ */jsx(\"div\", {\n className: \"qui-site-search__no-results\",\n children: noResults\n }) : null\n }) : null, \" \"]\n })\n })\n })]\n })]\n });\n}", "import { useMemo } from \"react\";\nimport { useSiteContext } from \"@qualcomm-ui/react-mdx/context\";\nimport { useSiteSearch } from \"./use-site-search\";\nexport function useGroupedResults(query) {\n const {\n searchIndex\n } = useSiteContext();\n const search = useSiteSearch(searchIndex);\n return useMemo(() => {\n if (!query.trim()) {\n return [];\n }\n const results = search(query);\n const groups = /* @__PURE__ */new Map();\n const groupOrder = [];\n for (const result of results) {\n const basePath = result.href.split(\"#\")[0];\n const key = `${basePath}::${result.title}`;\n if (!groups.has(key)) {\n groups.set(key, []);\n groupOrder.push(key);\n }\n groups.get(key).push(result);\n }\n let currentIndex = 0;\n const grouped = [];\n for (const key_0 of groupOrder) {\n const items = groups.get(key_0);\n const firstItem = items[0];\n const basePath_0 = firstItem.href.split(\"#\")[0];\n const categoryId = firstItem.categories[0] || \"Other\";\n grouped.push({\n categoryId,\n id: `${basePath_0}-${firstItem.title}`,\n index: currentIndex++,\n items: items.map(item => ({\n ...item,\n index: currentIndex++\n })),\n pathname: basePath_0,\n title: firstItem.title\n });\n }\n return grouped;\n }, [query, search]);\n}", "import { c as _c } from \"react/compiler-runtime\";\nimport { useCallback } from \"react\";\nimport Fuzzysort from \"fuzzysort\";\nimport { formatSearchResults } from \"@qualcomm-ui/mdx-common\";\nexport function doSiteSearch(input, searchIndex) {\n const allResults = formatSearchResults(Fuzzysort.go(input, searchIndex, {\n keys: [\"title\", \"heading\", \"content\"],\n limit: 50,\n threshold: 0.2\n }));\n const pageContentMap = /* @__PURE__ */new Map();\n for (const result of allResults) {\n const basePath = result.href.split(\"#\")[0];\n if (!pageContentMap.has(basePath)) {\n pageContentMap.set(basePath, []);\n }\n pageContentMap.get(basePath).push(result);\n }\n const filtered = [];\n for (const [, pageResults] of pageContentMap) {\n const contentResults = pageResults.filter(r => r.type === \"content\");\n const headingResults = pageResults.filter(r => r.type !== \"content\");\n if (contentResults.length > 0) {\n filtered.push(...contentResults);\n } else {\n filtered.push(headingResults[0]);\n }\n }\n return filtered;\n}\nexport function useSiteSearch(searchIndex) {\n const $ = _c(2);\n let t0;\n if ($[0] !== searchIndex) {\n t0 = input => doSiteSearch(input, searchIndex);\n $[0] = searchIndex;\n $[1] = t0;\n } else {\n t0 = $[1];\n }\n return t0;\n}"],
5
+ "mappings": ";AAAA,OAAS,OAAAA,EAAK,QAAAC,MAAY,oBAC1B,OAAS,gBAAAC,OAAoB,eEK7B,OAAQ,YAAAC,MAAe,2BiBAvB,OAAQ,QAAAC,OAAW,+BjBEnB,IAAMC,GAAyC,EACzCC,GAA2C,EAC3CC,GAA6D,GAEtDC,GAAiBC,GAC5BC,EAASD,CAAE,GACXA,EAAG,WAAaJ,IAChB,OAAOI,EAAG,UAAa,SAEZE,EAAcF,GACzBC,EAASD,CAAE,GAAKA,EAAG,WAAaH,GAErBM,GAAYH,GACvBC,EAASD,CAAE,GAAKA,IAAOA,EAAG,OAgBrB,IAAMI,GAAUC,GACrB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KuB,GAAS,CACZlD,EAAQ,QAAQgD,EAAK,KAAK,EAAIE,CAChC,EACA,SAAU,EACZ,CAAC,EACD,OAAQF,EAAK,QAAU/C,EACvB,QAAS,GACT,KAAA+C,EACA,OAAuBV,EAAInC,EAAM,CAC/B,KAAM6C,EAAK,IACb,CAAC,CACH,EAAGA,EAAK,EAAE,CAAC,CACb,CAAC,CAAC,CACJ,EAAG,GAAGH,EAAO,EAAE,IAAIA,EAAO,UAAU,EAAE,CAAC,CACzC,CAAC,EAAIvD,EAA2BgD,EAAI,MAAO,CACzC,UAAW,8BACX,SAAUhD,CACZ,CAAC,EAAI,IACP,CAAC,EAAI,KAAM,GAAG,CAChB,CAAC,CACH,CAAC,CACH,CAAC,CAAC,CACJ,CAAC,CAAC,CACJ,CAAC,CACH",
6
+ "names": ["jsx", "jsxs", "FileTextIcon", "isObject", "noop", "ELEMENT_NODE", "DOCUMENT_NODE", "DOCUMENT_FRAGMENT_NODE", "isHTMLElement", "el", "isObject", "isDocument", "isWindow", "isNode", "el", "isObject", "isShadowRoot", "DOCUMENT_FRAGMENT_NODE", "getDocument", "el", "isDocument", "isWindow", "getWindow", "el", "isShadowRoot", "isDocument", "isHTMLElement", "isDom", "getPlatform", "pt", "v", "isDom", "getPlatform", "isMac", "pt", "getComposedPath", "event", "getEventTarget", "wrap", "v", "idx", "_", "index", "sanitize", "str", "char", "code", "defaultItemToId", "v", "itemById", "id", "itemToId", "item", "indexOfId", "getValueText", "el", "sanitize", "match", "valueText", "query", "getByText", "v", "text", "currentId", "itemToId", "defaultItemToId", "index", "indexOfId", "items", "wrap", "item", "getByTypeaheadImpl", "baseItems", "options", "activeId", "itemToId", "key", "state", "timeout", "search", "query", "char", "items", "next", "getByText", "cleanup", "update", "value", "getByTypeahead", "isValidTypeaheadEvent", "event", "fps", "isVirtualClick", "event", "isValidKey", "e", "isMac", "nonTextInputTypes", "isKeyboardFocusEvent", "isTextInput", "modality", "target", "getEventTarget", "win", "getWindow", "FOCUS_VISIBLE_INPUT_KEYS", "currentModality", "changeHandlers", "listenerMap", "hasEventBeforeFocus", "hasBlurredWindowRecently", "triggerChangeHandlers", "handler", "handleKeyboardEvent", "handlePointerEvent", "handleClickEvent", "handleFocusEvent", "getDocument", "handleWindowBlur", "setupGlobalFocusEvents", "root", "doc", "focus", "tearDownWindowFocusTracking", "loadListener", "isFocusVisible", "currentModality", "trackFocusVisible", "props", "autoFocus", "isTextInput", "onChange", "root", "setupGlobalFocusEvents", "handler", "modality", "e", "isKeyboardFocusEvent", "changeHandlers", "Icon", "PolymorphicElement", "booleanDataAttr", "clsx", "GroupedResultItem", "active", "className", "item", "ref", "props", "jsxs", "m", "jsx", "FileTextIcon", "Fragment", "jsx", "jsxs", "useRef", "HashIcon", "TablePropertiesIcon", "TextSearchIcon", "Icon", "HighlightText", "useMergedRef", "PolymorphicElement", "booleanDataAttr", "clsx", "getSearchResultIcon", "item", "TablePropertiesIcon", "TextSearchIcon", "HashIcon", "SearchResultItem", "t0", "active", "className", "inputValue", "t1", "ref", "props", "isChild", "rootRef", "useRef", "mergedRef", "icon", "jsxs", "m", "jsx", "Fragment", "_temp", "content", "Fragment", "jsx", "jsxs", "useCallback", "useEffect", "useRef", "useState", "useFloating", "useInteractions", "useListNavigation", "SearchIcon", "getSelectorsByUserAgent", "OsTypes", "Dialog", "HeaderBar", "TextInput", "useDebounce", "Portal", "useMdxDocsContext", "useMemo", "useSiteContext", "_c", "Fuzzysort", "formatSearchResults", "doSiteSearch", "input", "searchIndex", "allResults", "pageContentMap", "result", "basePath", "filtered", "pageResults", "contentResults", "r", "headingResults", "useSiteSearch", "$", "t0", "useGroupedResults", "query", "searchIndex", "useSiteContext", "search", "useSiteSearch", "useMemo", "results", "groups", "groupOrder", "result", "key", "currentIndex", "grouped", "key_0", "items", "firstItem", "basePath_0", "categoryId", "item", "SiteSearch", "noResults", "showDialog", "setShowDialog", "useState", "inputValue", "setInputValue", "inputRef", "useRef", "dialogInputRef", "dialogInputContainerRef", "listRef", "activeIndex", "setActiveIndex", "Link", "useMdxDocsContext", "useEffect", "unsub", "R", "context", "refs", "useFloating", "listNavigation", "useListNavigation", "index", "debouncedInputValue", "useDebounce", "groupedResults", "useGroupedResults", "onInputChange", "useCallback", "value", "osName", "getSelectorsByUserAgent", "isMac", "OsTypes", "listener", "event", "onListItemKeyDown", "event_0", "onInputKeyDown", "event_1", "getFloatingProps", "getItemProps", "getReferenceProps", "useInteractions", "jsxs", "Dialog", "open", "jsx", "HeaderBar", "SearchIcon", "Portal", "event_2", "TextInput", "Fragment", "result", "GroupedResultItem", "ref", "item", "SearchResultItem", "ref_0"]
7
+ }
@@ -0,0 +1,11 @@
1
+ import { type ReactElement } from "react";
2
+ import type { SearchResult } from "@qualcomm-ui/mdx-common";
3
+ import { type ElementRenderProp } from "@qualcomm-ui/react-core/system";
4
+ export type SearchResultItemProps = ElementRenderProp<"button"> & {
5
+ active: boolean;
6
+ inputValue: string;
7
+ isChild?: boolean;
8
+ item: SearchResult;
9
+ };
10
+ export declare function SearchResultItem({ active, className, inputValue, isChild, item, ref, ...props }: SearchResultItemProps): ReactElement;
11
+ //# sourceMappingURL=search-result-item.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"search-result-item.d.ts","sourceRoot":"","sources":["../../src/site-search/search-result-item.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,KAAK,YAAY,EAAS,MAAM,OAAO,CAAA;AAK/C,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAA;AAIzD,OAAO,EACL,KAAK,iBAAiB,EAEvB,MAAM,gCAAgC,CAAA;AAIvC,MAAM,MAAM,qBAAqB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,GAAG;IAChE,MAAM,EAAE,OAAO,CAAA;IACf,UAAU,EAAE,MAAM,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,IAAI,EAAE,YAAY,CAAA;CACnB,CAAA;AAYD,wBAAgB,gBAAgB,CAAC,EAC/B,MAAM,EACN,SAAS,EACT,UAAU,EACV,OAAe,EACf,IAAI,EACJ,GAAG,EACH,GAAG,KAAK,EACT,EAAE,qBAAqB,GAAG,YAAY,CA+CtC"}
@@ -0,0 +1,12 @@
1
+ import { type ReactNode } from "react";
2
+ interface SiteSearchMobileProps {
3
+ /**
4
+ * Node to render when no results are found.
5
+ *
6
+ * @default "No results found..."
7
+ */
8
+ noResults?: ReactNode;
9
+ }
10
+ export declare function SiteSearch({ noResults, }: SiteSearchMobileProps): ReactNode;
11
+ export {};
12
+ //# sourceMappingURL=site-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"site-search.d.ts","sourceRoot":"","sources":["../../src/site-search/site-search.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EAKf,MAAM,OAAO,CAAA;AAsBd,UAAU,qBAAqB;IAC7B;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAA;CACtB;AAED,wBAAgB,UAAU,CAAC,EACzB,SAAiC,GAClC,EAAE,qBAAqB,GAAG,SAAS,CA+MnC"}
@@ -0,0 +1,11 @@
1
+ import type { SearchResult } from "@qualcomm-ui/mdx-common";
2
+ export interface GroupedSearchResult {
3
+ categoryId: string;
4
+ id: string;
5
+ index: number;
6
+ items: SearchResult[];
7
+ pathname: string;
8
+ title: string;
9
+ }
10
+ export declare function useGroupedResults(query: string): GroupedSearchResult[];
11
+ //# sourceMappingURL=use-grouped-results.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-grouped-results.d.ts","sourceRoot":"","sources":["../../src/site-search/use-grouped-results.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,yBAAyB,CAAA;AAKzD,MAAM,WAAW,mBAAmB;IAClC,UAAU,EAAE,MAAM,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,YAAY,EAAE,CAAA;IACrB,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAgDtE"}
@@ -0,0 +1,6 @@
1
+ import { type PageSection, type SearchResult } from "@qualcomm-ui/mdx-common";
2
+ type UseSiteSearch = (input: string) => SearchResult[];
3
+ export declare function doSiteSearch(input: string, searchIndex: PageSection[]): SearchResult[];
4
+ export declare function useSiteSearch(searchIndex: PageSection[]): UseSiteSearch;
5
+ export {};
6
+ //# sourceMappingURL=use-site-search.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"use-site-search.d.ts","sourceRoot":"","sources":["../../src/site-search/use-site-search.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,yBAAyB,CAAA;AAEhC,KAAK,aAAa,GAAG,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,EAAE,CAAA;AAEtD,wBAAgB,YAAY,CAC1B,KAAK,EAAE,MAAM,EACb,WAAW,EAAE,WAAW,EAAE,GACzB,YAAY,EAAE,CAiChB;AAED,wBAAgB,aAAa,CAAC,WAAW,EAAE,WAAW,EAAE,GAAG,aAAa,CAKvE"}
@@ -0,0 +1,2 @@
1
+ export * from "./spoiler";
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/spoiler/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
@@ -0,0 +1,3 @@
1
+ "use client";
2
+ import{Fragment as i,jsx as r,jsxs as m}from"react/jsx-runtime";import{ChevronRight as n}from"lucide-react";import{Collapsible as e}from"@qualcomm-ui/react/collapsible";import{Icon as s}from"@qualcomm-ui/react/icon";import{mergeProps as p}from"@qualcomm-ui/utils/merge-props";function _({children:o,...t}){return r(e.Root,{...p({className:"mdx-spoiler__root"},t),children:o})}function f({children:o}){return m(e.Trigger,{className:"mdx-spoiler__trigger",children:[r(i,{children:o}),r(s,{className:"mdx-spoiler__indicator",icon:n})]})}function g({children:o}){return r(e.Content,{className:"mdx-spoiler__content",children:r("div",{className:"mdx-spoiler__content-body",children:o})})}export{g as SpoilerContent,_ as SpoilerRoot,f as SpoilerSummary};
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/spoiler/spoiler.tsx"],
4
+ "sourcesContent": ["import { Fragment, jsx, jsxs } from \"react/jsx-runtime\";\nimport { ChevronRight } from \"lucide-react\";\nimport { Collapsible } from \"@qualcomm-ui/react/collapsible\";\nimport { Icon } from \"@qualcomm-ui/react/icon\";\nimport { mergeProps } from \"@qualcomm-ui/utils/merge-props\";\nexport function SpoilerRoot({\n children,\n ...props\n}) {\n return /* @__PURE__ */jsx(Collapsible.Root, {\n ...mergeProps({\n className: \"mdx-spoiler__root\"\n }, props),\n children\n });\n}\nexport function SpoilerSummary({\n children\n}) {\n return /* @__PURE__ */jsxs(Collapsible.Trigger, {\n className: \"mdx-spoiler__trigger\",\n children: [/* @__PURE__ */jsx(Fragment, {\n children\n }), /* @__PURE__ */jsx(Icon, {\n className: \"mdx-spoiler__indicator\",\n icon: ChevronRight\n })]\n });\n}\nexport function SpoilerContent({\n children\n}) {\n return /* @__PURE__ */jsx(Collapsible.Content, {\n className: \"mdx-spoiler__content\",\n children: /* @__PURE__ */jsx(\"div\", {\n className: \"mdx-spoiler__content-body\",\n children\n })\n });\n}"],
5
+ "mappings": ";AAAA,OAAS,YAAAA,EAAU,OAAAC,EAAK,QAAAC,MAAY,oBACpC,OAAS,gBAAAC,MAAoB,eAC7B,OAAS,eAAAC,MAAmB,iCAC5B,OAAS,QAAAC,MAAY,0BACrB,OAAS,cAAAC,MAAkB,iCACpB,SAASC,EAAY,CAC1B,SAAAC,EACA,GAAGC,CACL,EAAG,CACD,OAAsBR,EAAIG,EAAY,KAAM,CAC1C,GAAGE,EAAW,CACZ,UAAW,mBACb,EAAGG,CAAK,EACR,SAAAD,CACF,CAAC,CACH,CACO,SAASE,EAAe,CAC7B,SAAAF,CACF,EAAG,CACD,OAAsBN,EAAKE,EAAY,QAAS,CAC9C,UAAW,uBACX,SAAU,CAAgBH,EAAID,EAAU,CACtC,SAAAQ,CACF,CAAC,EAAkBP,EAAII,EAAM,CAC3B,UAAW,yBACX,KAAMF,CACR,CAAC,CAAC,CACJ,CAAC,CACH,CACO,SAASQ,EAAe,CAC7B,SAAAH,CACF,EAAG,CACD,OAAsBP,EAAIG,EAAY,QAAS,CAC7C,UAAW,uBACX,SAAyBH,EAAI,MAAO,CAClC,UAAW,4BACX,SAAAO,CACF,CAAC,CACH,CAAC,CACH",
6
+ "names": ["Fragment", "jsx", "jsxs", "ChevronRight", "Collapsible", "Icon", "mergeProps", "SpoilerRoot", "children", "props", "SpoilerSummary", "SpoilerContent"]
7
+ }
@@ -0,0 +1,25 @@
1
+ import type { ReactElement, ReactNode } from "react";
2
+ import { type CollapsibleRootProps } from "@qualcomm-ui/react/collapsible";
3
+ interface SpoilerRootProps extends CollapsibleRootProps {
4
+ /**
5
+ * React {@link https://react.dev/learn/passing-props-to-a-component#passing-jsx-as-children children} prop.
6
+ */
7
+ children: ReactNode;
8
+ }
9
+ export declare function SpoilerRoot({ children, ...props }: SpoilerRootProps): ReactElement;
10
+ interface SpoilerSummaryProps {
11
+ /**
12
+ * React {@link https://react.dev/learn/passing-props-to-a-component#passing-jsx-as-children children} prop.
13
+ */
14
+ children: ReactNode;
15
+ }
16
+ export declare function SpoilerSummary({ children }: SpoilerSummaryProps): ReactElement;
17
+ interface SpoilerContentProps {
18
+ /**
19
+ * React {@link https://react.dev/learn/passing-props-to-a-component#passing-jsx-as-children children} prop.
20
+ */
21
+ children: ReactNode;
22
+ }
23
+ export declare function SpoilerContent({ children }: SpoilerContentProps): ReactElement;
24
+ export {};
25
+ //# sourceMappingURL=spoiler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spoiler.d.ts","sourceRoot":"","sources":["../../src/spoiler/spoiler.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,YAAY,EAAE,SAAS,EAAC,MAAM,OAAO,CAAA;AAIlD,OAAO,EAEL,KAAK,oBAAoB,EAC1B,MAAM,gCAAgC,CAAA;AAIvC,UAAU,gBAAiB,SAAQ,oBAAoB;IACrD;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,WAAW,CAAC,EAC1B,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,gBAAgB,GAAG,YAAY,CAMjC;AAED,UAAU,mBAAmB;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,cAAc,CAAC,EAAC,QAAQ,EAAC,EAAE,mBAAmB,GAAG,YAAY,CAO5E;AAED,UAAU,mBAAmB;IAC3B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAA;CACpB;AAED,wBAAgB,cAAc,CAAC,EAAC,QAAQ,EAAC,EAAE,mBAAmB,GAAG,YAAY,CAM5E"}