declare const _default: "'use strict';\n\nvar oc = oc || {};\noc.cmd = oc.cmd || [];\n\noc.cmd.push(function() {\n var escapeRegExp = function(s) {\n return String(s).replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\n };\n\n var safeRegExp = function(pattern, flags) {\n try {\n return new RegExp(pattern, flags);\n } catch (e) {\n return new RegExp(escapeRegExp(pattern), flags);\n }\n };\n\n // Client-side pagination for the components list. Enabled only once the\n // registry has more components than a single page so smaller registries keep\n // the simple single-page view.\n var COMPONENTS_PAGE_SIZE = 50;\n var paginationEnabled = componentsList.length > COMPONENTS_PAGE_SIZE;\n var currentPage = 1;\n\n var renderComponentsPagination = function(totalMatching, totalPages) {\n // Rendered into both the top and bottom containers so they stay in sync.\n var containers = $('.components-pagination');\n if (!paginationEnabled || totalMatching <= COMPONENTS_PAGE_SIZE) {\n containers.addClass('hide').empty();\n return;\n }\n\n // Build a compact list of page numbers: first, last, and a window around\n // the current page, with ellipses for the gaps.\n var pages = [];\n var windowSize = 1;\n var start = Math.max(2, currentPage - windowSize);\n var end = Math.min(totalPages - 1, currentPage + windowSize);\n pages.push(1);\n if (start > 2) {\n pages.push('...');\n }\n for (var p = start; p <= end; p++) {\n pages.push(p);\n }\n if (end < totalPages - 1) {\n pages.push('...');\n }\n if (totalPages > 1) {\n pages.push(totalPages);\n }\n\n var html =\n '';\n for (var k = 0; k < pages.length; k++) {\n if (pages[k] === '...') {\n html += '\u2026';\n } else {\n html +=\n '';\n }\n }\n html +=\n '';\n\n containers.html(html).removeClass('hide');\n };\n\n var applyComponentsView = function() {\n var s = $('#search-filter').val(),\n a = $('#author-filter').val(),\n r = safeRegExp(s, ''),\n ar = safeRegExp(a, 'i'),\n selectedCheckboxes = $('input[type=checkbox]:checked'),\n hiddenStates = [],\n matchingNames = [],\n i;\n\n for (i = 0; i < selectedCheckboxes.length; i++) {\n hiddenStates.push($(selectedCheckboxes[i]).attr('name'));\n }\n\n // First pass: figure out which components match the current filters.\n for (i = 0; i < componentsList.length; i++) {\n var matches = !s || !!componentsList[i].name.match(r),\n matchesAuthor =\n !a ||\n (componentsList[i].author.name &&\n !!componentsList[i].author.name.match(ar)),\n isHidden = false;\n\n for (var j = 0; j < hiddenStates.length; j++) {\n if (componentsList[i].state.toLowerCase() === hiddenStates[j]) {\n isHidden = true;\n }\n }\n\n if (matches && matchesAuthor && !isHidden) {\n matchingNames.push(componentsList[i].name);\n }\n }\n\n var totalMatching = matchingNames.length;\n var totalPages = paginationEnabled\n ? Math.max(1, Math.ceil(totalMatching / COMPONENTS_PAGE_SIZE))\n : 1;\n if (currentPage > totalPages) {\n currentPage = totalPages;\n }\n if (currentPage < 1) {\n currentPage = 1;\n }\n\n var startIdx = paginationEnabled\n ? (currentPage - 1) * COMPONENTS_PAGE_SIZE\n : 0;\n var endIdx = paginationEnabled ? startIdx + COMPONENTS_PAGE_SIZE : totalMatching;\n var visibleNames = {};\n for (i = startIdx; i < endIdx && i < totalMatching; i++) {\n visibleNames[matchingNames[i]] = true;\n }\n\n // Second pass: only rows that match the filters AND fall on the current\n // page are shown.\n for (i = 0; i < componentsList.length; i++) {\n var name = componentsList[i].name,\n show = visibleNames[name] === true;\n $('#component-' + name)[show ? 'removeClass' : 'addClass']('hide');\n }\n\n var result =\n totalMatching + (totalMatching === 1 ? ' component' : ' components');\n\n if (s) {\n result += ' matching \"' + s + '\"';\n if (a) {\n result += ' and';\n }\n }\n if (a) {\n result += ' by author \"' + a + '\"';\n }\n if (paginationEnabled && totalMatching > COMPONENTS_PAGE_SIZE) {\n result +=\n ' (showing ' +\n (startIdx + 1) +\n '\u2013' +\n Math.min(endIdx, totalMatching) +\n ')';\n }\n\n $('#results-count').text(result);\n $('#components-empty')[totalMatching === 0 ? 'removeClass' : 'addClass'](\n 'hide'\n );\n\n renderComponentsPagination(totalMatching, totalPages);\n\n return false;\n };\n\n var componentsListChanged = function() {\n // Any filter change resets back to the first page.\n currentPage = 1;\n return applyComponentsView();\n };\n\n var historyData = [];\n var historyRenderedCount = 0;\n var historyBatchSize = 50; // Number of items to render per batch\n var isLoadingMore = false;\n\n var renderHistoryBatch = function() {\n if (historyRenderedCount >= historyData.length || isLoadingMore) {\n return;\n }\n\n isLoadingMore = true;\n var historyContent = $('#history-content');\n var batchEnd = Math.min(historyRenderedCount + historyBatchSize, historyData.length);\n var batchHtml = '';\n\n for (var i = historyRenderedCount; i < batchEnd; i++) {\n var item = historyData[i];\n var templateSizeText = item.templateSize ? \n ' [' + Math.round(item.templateSize / 1024) + ' kb]' : '';\n \n batchHtml += '' +\n ' ' +\n item.publishDate + ' - Published ' + item.name + '@' + item.version +\n templateSizeText +\n '
No components history available.
');\n return;\n }\n\n // Render first batch\n renderHistoryBatch();\n \n // Setup scroll listener for infinite loading\n setupHistoryScrollListener();\n })\n .catch(function(error) {\n console.error('Error loading components history:', error);\n historyLoader.hide();\n historyError.show();\n });\n };\n\n var isHistoryLoaded = false;\n\n var initialiseTabs = function() {\n var selectItem = function(target) {\n var $target = $(target);\n $('.box').hide();\n $target.show();\n $('#menuList a').removeClass('selected');\n $('#menuList a[href=\"' + target + '\"]').addClass('selected');\n\n // Keep URL in sync so tab survives refresh and back/forward\n try {\n if (history && history.replaceState && location.hash !== target) {\n history.replaceState(null, '', target);\n }\n } catch (e) {}\n\n // Clean up scroll listeners when leaving history tab\n if (target !== '#components-history') {\n $(window).off('scroll.history resize.history');\n }\n \n // Load history data when history tab is selected for the first time\n if (target === '#components-history' && !isHistoryLoaded) {\n loadComponentsHistory();\n isHistoryLoaded = true;\n }\n // Re-enable scroll listeners when returning to history tab\n else if (target === '#components-history' && isHistoryLoaded && historyRenderedCount < historyData.length) {\n setupHistoryScrollListener();\n }\n };\n\n var hash = location.href.split('#')[1] || '';\n var isHashValid = hash && $('#' + hash);\n var target = isHashValid ? '#' + hash : $($('#menuList a')[0]).attr('href');\n selectItem(target);\n\n $('#menuList a').click(function() {\n selectItem($(this).attr('href'));\n });\n };\n\n var debounce = function(fn, wait) {\n var t;\n return function() {\n var ctx = this, args = arguments;\n clearTimeout(t);\n t = setTimeout(function(){ fn.apply(ctx, args); }, wait);\n };\n };\n\n $('#filter-components')\n .submit(componentsListChanged)\n .keyup(debounce(componentsListChanged, 80));\n $('#filter-components input[type=checkbox]').change(componentsListChanged);\n\n // Delegated from the stable list container so both the top and bottom\n // pagination bars work. No auto-scroll, so repeated clicks stay put.\n $('#components-list').on('click', '.pagination-btn', function() {\n var $btn = $(this);\n if ($btn.is('[disabled]')) {\n return;\n }\n var page = parseInt($btn.attr('data-page'), 10);\n if (isNaN(page)) {\n return;\n }\n currentPage = page;\n applyComponentsView();\n });\n\n if (q) {\n $('.search').val(q);\n }\n\n // Keyboard shortcuts: \"/\" focuses search, \"Esc\" clears the focused filter\n $(document).on('keydown', function(e) {\n var tag = (e.target && e.target.tagName) ? e.target.tagName.toLowerCase() : '';\n var typing = tag === 'input' || tag === 'textarea' || tag === 'select';\n\n if (e.key === '/' && !typing) {\n var $s = $('#search-filter');\n if ($s.length) {\n e.preventDefault();\n $s.focus();\n }\n } else if (e.key === 'Escape' && typing && $(e.target).closest('#filter-components').length) {\n $(e.target).val('');\n componentsListChanged();\n }\n });\n\n // Focus the search input only on a fresh load (no tab hash, no in-page nav)\n if (!location.hash) {\n var $searchInput = $('#search-filter');\n if ($searchInput.length) { $searchInput.focus(); }\n }\n\n componentsListChanged();\n initialiseTabs();\n});"; export default _default;