@aiquants/contact-map 0.7.0 → 0.8.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.
- package/README.md +1 -0
- package/dist/client.d.mts +1 -2
- package/dist/client.d.ts +1 -2
- package/dist/client.js +2 -2
- package/dist/client.mjs +2 -2
- package/package.json +9 -9
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var po=Object.defineProperty;var Te=(e,t)=>()=>(e&&(t=e(e=0)),t);var uo=(e,t)=>{for(var a in t)po(e,a,{get:t[a],enumerable:!0})};var ae,Kn,Pt=Te(()=>{"use strict";ae=e=>{switch(typeof e){case"string":return JSON.stringify(e);case"bigint":return`${e}n`;case"symbol":return e.toString();case"object":return e===null?"null":Kn(e);case"function":return Kn(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},Kn=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var Mt,me,Rt=Te(()=>{"use strict";Mt=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},me=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var mo,ma,Qa=Te(()=>{"use strict";mo=(e,t)=>{let a=Array.from({length:t.length+1},(r,s)=>s);for(let r=1;r<=e.length;r+=1){let s=[r];for(let n=1;n<=t.length;n+=1){let o=a[n-1]+(e[r-1]===t[n-1]?0:1);s.push(Math.min(a[n]+1,s[n-1]+1,o))}a=s}return a[t.length]},ma=(e,t)=>{let a=e.toLowerCase();if(a.length>=3){let s=t.find(n=>n.toLowerCase().startsWith(a));if(s!==void 0)return s}let r;for(let s of t){let n=mo(a,s.toLowerCase());n<=Math.max(1,Math.floor(s.length/4))&&(r===void 0||n<r.distance)&&(r={key:s,distance:n})}return r?.key}});import{DIRECTORY_TREE_LABEL_CATALOGS as jn,DIRECTORY_TREE_LABEL_KEYS as Ya,resolveDirectoryTreeLabels as go}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as ho,VIRTUAL_SCROLL_LABEL_KEYS as fo}from"@aiquants/virtualscroll";var yo,j,ut,ga,Gn,Vt,Be,bo,qn,Qn,xo,Ja,vo,Co,ko,Xa,Za,en,mt=Te(()=>{"use strict";Pt();Rt();Qa();yo=Object.freeze({en:"en-US",ja:"ja-JP"}),j=(e,t)=>t.toLocaleString(yo[e]),ut=(e,t,a)=>e==="1"?t:a,ga=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`Streaming (${j("en",e)} / ${j("en",t)} \xB7 ${a}%)`,annotationStreamingCount:e=>`Streaming (${j("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${j("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>ut(e,"record","records"),companyUnit:e=>ut(e,"company","companies"),searchTab:"Fuzzy search",searchSettings:"Search settings",searchStatistics:"Search statistics",operatorAndTitle:"AND search (all terms match)",operatorOrTitle:"OR search (any term matches)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"All terms",operatorOrHint:"Any term",searchPlaceholder:"Fuzzy search...",searchBusyTitle:"Searching",clearSearch:"Clear search",searching:"Searching...",registeredCountLabel:"Registered:",rebuildingIndex:"Rebuilding index...",errorLabel:"Error:",resultCountLabel:"Results:",resultUnit:e=>ut(e,"match","matches"),listViewTab:"List",treeViewTab:"Tree",columnNo:"No",columnId:"ID",columnScore:"Score",columnName:"Name",columnTitle:"Title",columnCompany:"Company",columnDepartment:"Department",columnPhone:"Phone",columnEmail:"Email",columnUpdatedAt:"Updated",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"No search results found",listNoData:"No data",listResizeHandle:"Resize the border between the contact list and the detail pane",detailHeading:"Contact details",close:"Close",noName:"(No Name)",treeNodeCountTitle:"Number of nodes built in the tree view",treeNodeCountLabel:"Nodes:",treeNodeCount:e=>j("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${j("en",t)})`,treeStreamInterruptedTitle:"Streaming was interrupted. Only the data received so far is shown",treeStreamInterrupted:"Interrupted",treeStreamLoadingTitle:"Receiving data streamed from the network",treeStreamLoading:"Loading...",treeBuildingTitle:"Building and expanding the directory tree from the received data",treeBuilding:"Treeing...",treeCompleteTitle:"Every tree node has been built",treeComplete:"Complete",treeShowEntireCompanyTitle:"Show the whole company of every search hit",treeShowEntireCompany:"Whole company",treeExpandAll:"Expand all directories",treeExpandAllTitle:"Expand all",treeCollapseAll:"Collapse all directories",treeCollapseAllTitle:"Collapse all",treeNoMatches:"No contacts match the criteria",treeEmpty:"No contacts to display",treeResizeHandle:"Resize the border between the directory tree and the detail pane",copyField:e=>`Copy ${e}`,detailEmptyTitle:"Select a contact to see its details",detailEmptyHint:"Choose a person from the list",detailTabSummary:"Summary",detailTabBasic:"Basic info",detailBasicProfile:"Profile",detailTabContact:"Contact",detailTabMeta:"Metadata",preferred:"Preferred",summaryEmail:"Email",summaryPhone:"Phone",summaryLastContact:"Last contact",sectionEmail:"Email",sectionEmailEmpty:"No email addresses registered",sectionPhone:"Phone / Fax",sectionPhoneEmpty:"No phone numbers registered",fieldFullName:"Name",fieldFullNameReading:"Name (reading)",fieldTitle:"Title",fieldDepartment:"Department",fieldCompanyName:"Company",fieldCompanyNameReading:"Company (reading)",fieldAddress:"Address",fieldPostalCode:"Postal code",fieldUrl:"URL",fieldCustomEmail:"Custom email",fieldEmail:"Email",fieldCustomMobilePhone:"Custom mobile",fieldMobilePhone:"Mobile",fieldCompanyPhone:"Company phone",fieldCompanyFax:"Company fax",fieldCreatedBy:"Created by",fieldCreatedAt:"Created at",fieldUpdatedBy:"Updated by",fieldUpdatedAt:"Updated at",popupCustomMobilePhone:"Mobile (custom)",popupMobilePhone:"Mobile",popupCustomCompanyPhone:"Company phone (custom)",popupCompanyPhone:"Company phone",popupCustomEmail:"Email (custom)",popupEmail:"Email",popupGmailHint:"Double-click or double-tap to open Gmail",popupLastContactDate:"Last contact:",popupNoContactMethods:"No contact information to display",overlayTitle:"Details",overlayBackdrop:"Tap the background to close",settingsResetAllTitle:"Reset all settings",settingsResetAll:"Reset all",settingsTabsLabel:"Search option tabs",settingsBasicTab:"Basic settings",settingsAdvancedTab:"Advanced settings",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"Current:",resetToDefaultsTitle:"Reset to defaults",reset:"Reset",relevanceOnlyNotice:"Editable only when sorting by relevance",relevanceWeightsHeading:"Relevance score weights",fieldWeight:"Field weight",scoreTuningHeading:"Score tuning",maxResults:"Maximum results",basicThresholdHeading:"Final similarity threshold",basicThresholdLabel:"Adjust the minimum score",basicThresholdRangeRelevance:"In relevance mode a score can exceed 1.0 (range: 0.0-1.5)",basicThresholdRange:"Range: 0.0-1.0",basicDisplayHeading:"Display options",basicCaseSensitive:"Case-sensitive",basicHighlight:"Highlight matches",basicOpenEmailsWithGmail:"Open email addresses in Gmail compose",basicMultiTermOperator:"Multi-term query operator",basicOperatorOr:"OR (any term matches)",basicOperatorAnd:"AND (all terms match)",basicMultiTermHint:"How space-separated terms are combined (default: OR)",basicSortHeading:"Sorting",basicSortBy:"Sort by",basicSortByScore:"Score",basicSortByRelevance:"Relevance",basicSortByOriginal:"Original order",basicSortOrder:"Sort order",basicSortDescending:"Descending",basicSortAscending:"Ascending",basicEngineHeading:"Search engine",basicStrategy:"Parallel search strategy",basicStrategyBalanced:"Balanced",basicStrategyIndexFirst:"Index first",basicStrategyLevenshteinFirst:"Levenshtein first",basicIndexFiltering:"Index filtering",basicLevenshtein:"Levenshtein distance",advancedLearningHeading:"Learning weight",advancedLearningLabel:"Weight factor",advancedLearningHint:"Weight applied when re-learning (higher favors past search results)",advancedDebounceHeading:"Debounce time",advancedDebounceLabel:"Input delay (ms)",advancedDebounceHint:"How long input is awaited. Shorter is more real-time, longer reduces load",indexSettingsHeading:"Index Worker settings",indexBuildHeading:"Index build",indexNgramSize:"N-gram size",indexNgramSizeHint:"How many characters each chunk holds. Smaller is faster but less accurate",indexMinNgramOverlap:"Minimum N-gram matches",indexMinNgramOverlapHint:"Candidates with fewer matches are excluded",indexCandidateHeading:"Candidate filtering",indexThreshold:"Index threshold",indexThresholdHint:"Lower bound of the Jaro-Winkler similarity (range: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram overlap threshold",indexNgramOverlapThresholdHint:"How much N-grams must overlap. Higher narrows candidates more strictly",indexStrategyHeading:"Search strategy and candidates",indexStrategy:"Search strategy",indexStrategyFast:"Fast",indexStrategyAccurate:"Accurate",indexStrategyHybrid:"Hybrid (adaptive)",indexStrategyHint:"Balance processing load against accuracy",indexMinCandidatesRatio:"Minimum candidate ratio",indexMinCandidatesRatioHint:"Share of candidates always kept",indexMaxCandidatesRatio:"Maximum candidate ratio",indexMaxCandidatesRatioHint:"Upper bound on candidates; narrowed dynamically when exceeded",indexJaroWinklerPrefix:"Jaro-Winkler prefix weight",indexJaroWinklerPrefixHint:"Bonus given to a matching prefix",indexMaxResultsHint:"Maximum number of results to fetch. Larger is more thorough but slower",indexFieldWeightHint:"How much the number of matched fields counts",indexPerfectMatchBonus:"Exact match bonus",indexPerfectMatchBonusHint:"Bonus added on an exact match",indexContainmentHeading:"Containment score (Japanese / substrings)",indexContainmentBase:"Containment base score (containmentScoreBase)",indexContainmentBaseHint:"Minimum base score when the query is fully contained in the string (rescues short Japanese queries such as 2 characters)",indexContainmentCoverage:"Containment coverage weight (containmentCoverageWeight)",indexContainmentCoverageHint:"Extra score by the query length / field length ratio (total capped at 1.0)",levenshteinSettingsHeading:"Levenshtein Worker settings",levenshteinCandidateHeading:"Candidate filter",levenshteinThreshold:"Levenshtein threshold",levenshteinThresholdHintRelevance:"Keep only results at or above this threshold (range: 0.0-1.5)",levenshteinThresholdHint:"Keep only results at or above this threshold (range: 0.0-1.0)",levenshteinLengthSimilarity:"Length similarity threshold",levenshteinLengthSimilarityHint:"Exclude candidates whose length differs greatly, for speed",levenshteinLengthPenalty:"Length difference penalty",levenshteinLengthPenaltyHint:"How much a length difference is penalized. Larger favors equal lengths",levenshteinResultsHeading:"Result count",levenshteinMaxResultsHint:"Maximum number of results to return. Larger is more thorough but slower",levenshteinFieldWeightHint:"Weight of the number of matched fields",levenshteinPartialBonus:"Partial match bonus",levenshteinPartialBonusHint:"Extra score for a partial match",statsRebuildingTitle:"Rebuilding the index",statsRebuildIndexTabOnlyTitle:"Available on the Index tab only",statsRebuildTitle:"Rebuild the index",statsRebuilding:"Rebuilding...",statsRebuild:"Rebuild Index",statsResetTitle:"Reset statistics",statsOverviewTab:"Overview",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"Total searches",statAverageSearchTime:"Average search time",statDataCount:"Data items",statResultCount:"Search results",statDisplayedCount:"Displayed items",statsNoData:"No statistics yet",statsBasicHeading:"Basic statistics",statTotalProcessingTime:"Total processing time",statLastSearchTime:"Last search time",statErrorCount:"Errors",statUpdatedAt:"Statistics updated at",statsOperationsHeading:"Operations",statTotalOperations:"Total operations",statsIndexHeading:"Index statistics",statIndexBuilds:"Index builds",statDataSize:"Data size",statLastBuildTime:"Last build time",statsCacheHeading:"Cache statistics",statCacheNgram:"N-gram",statCacheWord:"Words",statCachePhonetic:"Phonetic",statsIndexMetadataHeading:"Index metadata",statsCalculationsHeading:"Calculations",statTotalCalculations:"Total calculations",statDistanceCalculations:"Distance calculations",statAverageDistance:"Average distance",statMinDistance:"Minimum distance",statMaxDistance:"Maximum distance",notAvailable:"N/A",statsMatchesHeading:"Matches",statPartialMatches:"Partial matches",statPerfectMatches:"Exact matches",statEarlyTerminations:"Early terminations",statsSimilarityHeading:"Similarity distribution",statAbove80:"80% or more",statAbove60:"60% or more",statAbove40:"40% or more",statBelow40:"Below 40%",statsDistanceHeading:"Distance distribution (top 6)",statDistance:e=>`Distance ${e}`,statsQueryLengthHeading:"Query lengths (top 6)",statQueryLength:e=>`Length ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>{let a=j("en",e);return`${a} ${ut(a,"time","times")} / average ${t}%`},statsFieldPerformanceHeading:"Field performance (top 6)",statAverageScore:"Average score",statMatchCount:"Matches",statBestWorstScore:"Best / worst score",statsInsightsHeading:"Performance insights",statBestField:"Best-performing field",statRecentAverageTime:"Recent average processing time",statRecentAverageResults:"Recent average results",statThroughput:"Throughput",statCommonQueryLength:"Most common query length",statHistoryEntries:"History entries",statHighSimilarity:"High similarity",statMediumSimilarity:"Medium similarity",statLowSimilarity:"Low similarity",statVeryLowSimilarity:"Very low similarity",statsRecentHistoryHeading:"Recent history (latest 3)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`Processing time: ${e} ms / results: ${j("en",t)}`,timesUnit:e=>ut(e," time"," times"),itemsUnit:e=>ut(e," item"," items"),charactersUnit:e=>ut(e," character"," characters"),throughputUnit:" ops/s"}),ja:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"\u7DCF\u4EF6\u6570:",annotationCompaniesLabel:"\u4F01\u696D\u6570:",annotationStreamingProgress:({loaded:e,total:t,percent:a})=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${j("ja",e)} / ${j("ja",t)} \u4EF6\u30FB${a}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${j("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${j("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationAuthRequired:"\u30BB\u30C3\u30B7\u30E7\u30F3\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u76F4\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044",annotationRetry:"\u518D\u8A66\u884C",recordUnit:()=>"\u4EF6",companyUnit:()=>"\u793E",searchTab:"\u3042\u3044\u307E\u3044\u691C\u7D22",searchSettings:"\u691C\u7D22\u8A2D\u5B9A",searchStatistics:"\u691C\u7D22\u7D71\u8A08",operatorAndTitle:"AND \u691C\u7D22 (\u3059\u3079\u3066\u4E00\u81F4)",operatorOrTitle:"OR \u691C\u7D22 (\u3044\u305A\u308C\u304B\u4E00\u81F4)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"\u5168\u8A9E\u4E00\u81F4",operatorOrHint:"\u3044\u305A\u308C\u304B\u4E00\u81F4",searchPlaceholder:"\u3042\u3044\u307E\u3044\u691C\u7D22...",searchBusyTitle:"\u691C\u7D22\u51E6\u7406\u4E2D",clearSearch:"\u691C\u7D22\u3092\u30AF\u30EA\u30A2",searching:"\u691C\u7D22\u4E2D...",registeredCountLabel:"\u767B\u9332\u4EF6\u6570:",rebuildingIndex:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D...",errorLabel:"\u30A8\u30E9\u30FC:",resultCountLabel:"\u691C\u7D22\u7D50\u679C:",resultUnit:()=>"\u4EF6",listViewTab:"\u4E00\u89A7",treeViewTab:"\u30C4\u30EA\u30FC",columnNo:"No",columnId:"ID",columnScore:"\u30B9\u30B3\u30A2",columnName:"\u6C0F\u540D",columnTitle:"\u5F79\u8077",columnCompany:"\u4F1A\u793E\u540D",columnDepartment:"\u90E8\u7F72",columnPhone:"\u96FB\u8A71\u756A\u53F7",columnEmail:"\u30E1\u30FC\u30EB",columnUpdatedAt:"\u66F4\u65B0\u65E5\u6642",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"\u691C\u7D22\u7D50\u679C\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",listNoData:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",listResizeHandle:"\u9023\u7D61\u5148\u4E00\u89A7\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",detailHeading:"\u9023\u7D61\u5148\u8A73\u7D30",close:"\u9589\u3058\u308B",noName:"\u540D\u524D\u672A\u8A2D\u5B9A",treeNodeCountTitle:"\u30C4\u30EA\u30FC\u30D3\u30E5\u30FC\u3067\u69CB\u7BC9\u3055\u308C\u305F\u5168\u30CE\u30FC\u30C9\u6570",treeNodeCountLabel:"\u30CE\u30FC\u30C9:",treeNodeCount:e=>`${j("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${j("ja",t)})`,treeStreamInterruptedTitle:"\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u53D7\u4FE1\u6E08\u307F\u30C7\u30FC\u30BF\u306E\u307F\u8868\u793A\u3057\u3066\u3044\u307E\u3059",treeStreamInterrupted:"\u4E2D\u65AD",treeStreamLoadingTitle:"\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u304B\u3089\u306E\u30C7\u30FC\u30BF\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u3092\u53D7\u4FE1\u4E2D",treeStreamLoading:"\u8AAD\u307F\u8FBC\u307F\u4E2D...",treeBuildingTitle:"\u53D7\u53D6\u30C7\u30FC\u30BF\u3092\u57FA\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u69CB\u9020\u3092\u6700\u7D42\u69CB\u7BC9\u30FB\u5C55\u958B\u4E2D",treeBuilding:"\u30C4\u30EA\u30FC\u69CB\u7BC9\u4E2D...",treeCompleteTitle:"\u30C4\u30EA\u30FC\u30CE\u30FC\u30C9\u306E\u5168\u4EF6\u69CB\u7BC9\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F",treeComplete:"\u5B8C\u4E86",treeShowEntireCompanyTitle:"\u691C\u7D22\u30D2\u30C3\u30C8\u3057\u305F\u4F1A\u793E\u5168\u4F53\u3092\u8868\u793A",treeShowEntireCompany:"\u5168\u4F53\u8868\u793A",treeExpandAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5C55\u958B",treeExpandAllTitle:"\u3059\u3079\u3066\u5C55\u958B",treeCollapseAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u6298\u308A\u305F\u305F\u307F",treeCollapseAllTitle:"\u3059\u3079\u3066\u6298\u308A\u305F\u305F\u307F",treeNoMatches:"\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u9023\u7D61\u5148\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",treeEmpty:"\u8868\u793A\u3059\u308B\u9023\u7D61\u5148\u304C\u3042\u308A\u307E\u305B\u3093",treeResizeHandle:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",copyField:e=>`\u300C${e}\u300D\u3092\u30B3\u30D4\u30FC`,detailEmptyTitle:"\u9023\u7D61\u5148\u3092\u9078\u629E\u3059\u308B\u3068\u8A73\u7D30\u304C\u8868\u793A\u3055\u308C\u307E\u3059",detailEmptyHint:"\u4E00\u89A7\u304B\u3089\u5BFE\u8C61\u306E\u4EBA\u7269\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",detailTabSummary:"\u30B5\u30DE\u30EA\u30FC",detailTabBasic:"\u57FA\u672C\u60C5\u5831",detailBasicProfile:"\u57FA\u672C\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB",detailTabContact:"\u9023\u7D61\u5148",detailTabMeta:"\u30E1\u30BF\u60C5\u5831",preferred:"\u512A\u5148",summaryEmail:"\u30E1\u30FC\u30EB",summaryPhone:"\u96FB\u8A71",summaryLastContact:"\u6700\u7D42\u63A5\u89E6",sectionEmail:"\u30E1\u30FC\u30EB",sectionEmailEmpty:"\u767B\u9332\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306F\u3042\u308A\u307E\u305B\u3093",sectionPhone:"\u96FB\u8A71\u30FBFAX",sectionPhoneEmpty:"\u767B\u9332\u3055\u308C\u305F\u96FB\u8A71\u756A\u53F7\u306F\u3042\u308A\u307E\u305B\u3093",fieldFullName:"\u6C0F\u540D",fieldFullNameReading:"\u6C0F\u540D (\u304B\u306A)",fieldTitle:"\u5F79\u8077",fieldDepartment:"\u90E8\u7F72",fieldCompanyName:"\u4F1A\u793E\u540D",fieldCompanyNameReading:"\u4F1A\u793E\u540D (\u304B\u306A)",fieldAddress:"\u4F4F\u6240",fieldPostalCode:"\u90F5\u4FBF\u756A\u53F7",fieldUrl:"URL",fieldCustomEmail:"\u30AB\u30B9\u30BF\u30E0\u30E1\u30FC\u30EB",fieldEmail:"\u30E1\u30FC\u30EB",fieldCustomMobilePhone:"\u30AB\u30B9\u30BF\u30E0\u643A\u5E2F\u756A\u53F7",fieldMobilePhone:"\u643A\u5E2F\u756A\u53F7",fieldCompanyPhone:"\u4F1A\u793E\u96FB\u8A71\u756A\u53F7",fieldCompanyFax:"\u4F1A\u793E FAX \u756A\u53F7",fieldCreatedBy:"\u4F5C\u6210\u8005",fieldCreatedAt:"\u4F5C\u6210\u65E5\u6642",fieldUpdatedBy:"\u66F4\u65B0\u8005",fieldUpdatedAt:"\u66F4\u65B0\u65E5\u6642",popupCustomMobilePhone:"\u643A\u5E2F\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupMobilePhone:"\u643A\u5E2F\u96FB\u8A71",popupCustomCompanyPhone:"\u4F1A\u793E\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupCompanyPhone:"\u4F1A\u793E\u96FB\u8A71",popupCustomEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9 (\u30AB\u30B9\u30BF\u30E0)",popupEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",popupGmailHint:"\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u4E8C\u5EA6\u30BF\u30C3\u30D7\u3067 Gmail \u3092\u958B\u304D\u307E\u3059",popupLastContactDate:"\u6700\u7D42\u30B3\u30F3\u30BF\u30AF\u30C8\u65E5:",popupNoContactMethods:"\u8868\u793A\u3067\u304D\u308B\u9023\u7D61\u5148\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093",overlayTitle:"\u8A73\u7D30",overlayBackdrop:"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",settingsResetAllTitle:"\u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u30EA\u30BB\u30C3\u30C8",settingsResetAll:"\u3059\u3079\u3066\u30EA\u30BB\u30C3\u30C8",settingsTabsLabel:"\u691C\u7D22\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A\u30BF\u30D6",settingsBasicTab:"\u57FA\u672C\u8A2D\u5B9A",settingsAdvancedTab:"\u8A73\u7D30\u8A2D\u5B9A",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"\u73FE\u5728\u5024:",resetToDefaultsTitle:"\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u306B\u30EA\u30BB\u30C3\u30C8",reset:"\u30EA\u30BB\u30C3\u30C8",relevanceOnlyNotice:"Relevance \u30BD\u30FC\u30C8\u6642\u306E\u307F\u5909\u66F4\u53EF\u80FD",relevanceWeightsHeading:"Relevance \u30B9\u30B3\u30A2\u91CD\u307F",fieldWeight:"\u30D5\u30A3\u30FC\u30EB\u30C9\u91CD\u307F",scoreTuningHeading:"\u30B9\u30B3\u30A2\u8ABF\u6574",maxResults:"\u6700\u5927\u7D50\u679C\u6570",basicThresholdHeading:"\u6700\u7D42\u985E\u4F3C\u5EA6\u95BE\u5024",basicThresholdLabel:"\u30B9\u30B3\u30A2\u306E\u4E0B\u9650\u3092\u8ABF\u6574",basicThresholdRangeRelevance:"Relevance \u30E2\u30FC\u30C9\u3067\u306F\u30B9\u30B3\u30A2\u304C 1.0 \u3092\u8D85\u3048\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059 (\u7BC4\u56F2: 0.0-1.5)",basicThresholdRange:"\u7BC4\u56F2: 0.0-1.0",basicDisplayHeading:"\u8868\u793A\u30AA\u30D7\u30B7\u30E7\u30F3",basicCaseSensitive:"\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225",basicHighlight:"\u30CF\u30A4\u30E9\u30A4\u30C8\u8868\u793A",basicOpenEmailsWithGmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 Gmail \u306E\u4F5C\u6210\u753B\u9762\u3067\u958B\u304F",basicMultiTermOperator:"\u8907\u6570\u8A9E\u30AF\u30A8\u30EA\u306E\u6F14\u7B97\u5B50",basicOperatorOr:"OR (\u3044\u305A\u308C\u304B\u4E00\u81F4)",basicOperatorAnd:"AND (\u3059\u3079\u3066\u4E00\u81F4)",basicMultiTermHint:"\u8907\u6570\u8A9E\u3092\u30B9\u30DA\u30FC\u30B9\u3067\u5165\u529B\u3057\u305F\u3068\u304D\u306E\u7D50\u5408\u65B9\u6CD5 (\u65E2\u5B9A\u306F OR)",basicSortHeading:"\u30BD\u30FC\u30C8\u8A2D\u5B9A",basicSortBy:"\u30BD\u30FC\u30C8\u57FA\u6E96",basicSortByScore:"\u30B9\u30B3\u30A2",basicSortByRelevance:"\u95A2\u9023\u6027",basicSortByOriginal:"\u5143\u306E\u9806\u5E8F",basicSortOrder:"\u30BD\u30FC\u30C8\u9806\u5E8F",basicSortDescending:"\u964D\u9806",basicSortAscending:"\u6607\u9806",basicEngineHeading:"\u691C\u7D22\u30A8\u30F3\u30B8\u30F3\u8A2D\u5B9A",basicStrategy:"\u4E26\u5217\u691C\u7D22\u6226\u7565",basicStrategyBalanced:"\u30D0\u30E9\u30F3\u30B9",basicStrategyIndexFirst:"Index \u512A\u5148",basicStrategyLevenshteinFirst:"Levenshtein \u512A\u5148",basicIndexFiltering:"Index \u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0",basicLevenshtein:"Levenshtein \u8DDD\u96E2\u8A08\u7B97",advancedLearningHeading:"\u5B66\u7FD2\u91CD\u307F",advancedLearningLabel:"\u91CD\u307F\u4FC2\u6570",advancedLearningHint:"\u518D\u5B66\u7FD2\u6642\u306E\u91CD\u307F\u4ED8\u3051 (\u5927\u304D\u3044\u307B\u3069\u904E\u53BB\u306E\u691C\u7D22\u7D50\u679C\u3092\u512A\u5148)",advancedDebounceHeading:"\u30C7\u30D0\u30A6\u30F3\u30B9\u6642\u9593",advancedDebounceLabel:"\u5165\u529B\u9045\u5EF6 (ms)",advancedDebounceHint:"\u5165\u529B\u306E\u5F85\u3061\u6642\u9593\u3002\u77ED\u3044\u307B\u3069\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u3001\u9577\u3044\u307B\u3069\u8CA0\u8377\u8EFD\u6E1B",indexSettingsHeading:"Index Worker \u8A2D\u5B9A",indexBuildHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9",indexNgramSize:"N-gram \u30B5\u30A4\u30BA",indexNgramSizeHint:"\u6587\u5B57\u5217\u3092\u4F55\u6587\u5B57\u5358\u4F4D\u3067\u5206\u5272\u3059\u308B\u304B\u3002\u5C0F\u3055\u3044\u307B\u3069\u9AD8\u901F\u3060\u304C\u7CBE\u5EA6\u4F4E\u4E0B",indexMinNgramOverlap:"\u6700\u5C0F N-gram \u4E00\u81F4\u6570",indexMinNgramOverlapHint:"\u4E00\u81F4\u6570\u304C\u3053\u306E\u5024\u3092\u4E0B\u56DE\u308B\u5019\u88DC\u306F\u9664\u5916",indexCandidateHeading:"\u5019\u88DC\u7D5E\u308A\u8FBC\u307F",indexThreshold:"Index \u95BE\u5024",indexThresholdHint:"Jaro-Winkler \u985E\u4F3C\u5EA6\u306E\u4E0B\u9650 (\u7BC4\u56F2: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram \u91CD\u8907\u5EA6\u95BE\u5024",indexNgramOverlapThresholdHint:"N-gram \u306E\u91CD\u306A\u308A\u5177\u5408\u3002\u9AD8\u3044\u307B\u3069\u53B3\u5BC6\u306B\u5019\u88DC\u3092\u7D5E\u308B",indexStrategyHeading:"\u691C\u7D22\u6226\u7565\u3068\u5019\u88DC\u6570",indexStrategy:"\u691C\u7D22\u6226\u7565",indexStrategyFast:"Fast (\u9AD8\u901F)",indexStrategyAccurate:"Accurate (\u6B63\u78BA)",indexStrategyHybrid:"Hybrid (\u52D5\u7684)",indexStrategyHint:"\u51E6\u7406\u8CA0\u8377\u3068\u7CBE\u5EA6\u306E\u30D0\u30E9\u30F3\u30B9\u3092\u9078\u629E",indexMinCandidatesRatio:"\u6700\u5C0F\u5019\u88DC\u6BD4\u7387",indexMinCandidatesRatioHint:"\u6700\u4F4E\u9650\u78BA\u4FDD\u3059\u308B\u5019\u88DC\u5272\u5408",indexMaxCandidatesRatio:"\u6700\u5927\u5019\u88DC\u6BD4\u7387",indexMaxCandidatesRatioHint:"\u5019\u88DC\u6570\u306E\u4E0A\u9650\u3002\u8D85\u3048\u308B\u3068\u52D5\u7684\u306B\u7D5E\u308A\u8FBC\u307F",indexJaroWinklerPrefix:"Jaro-Winkler \u63A5\u982D\u8F9E\u91CD\u307F",indexJaroWinklerPrefixHint:"\u5148\u982D\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexMaxResultsHint:"\u53D6\u5F97\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u5305\u62EC\u7684\u3060\u304C\u9045\u5EF6\u304C\u5897\u52A0",indexFieldWeightHint:"\u30DE\u30C3\u30C1\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306B\u3069\u308C\u3060\u3051\u91CD\u307F\u4ED8\u3051\u3059\u308B\u304B",indexPerfectMatchBonus:"\u5B8C\u5168\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",indexPerfectMatchBonusHint:"\u5B8C\u5168\u4E00\u81F4\u6642\u306B\u8FFD\u52A0\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexContainmentHeading:"\u548C\u6587\u30FB\u90E8\u5206\u6587\u5B57\u5217\u5305\u542B\u30B9\u30B3\u30A2",indexContainmentBase:"\u5305\u542B \u57FA\u790E\u30B9\u30B3\u30A2 (containmentScoreBase)",indexContainmentBaseHint:"\u30AF\u30A8\u30EA\u304C\u6587\u5B57\u5217\u4E2D\u306B\u5B8C\u5168\u306B\u542B\u307E\u308C\u308B\u5834\u5408\u306E\u6700\u4F4E\u57FA\u790E\u30B9\u30B3\u30A2 (\u548C\u6587 2 \u6587\u5B57\u7B49\u306E\u6551\u6E08)",indexContainmentCoverage:"\u5305\u542B \u88AB\u8986\u7387\u91CD\u307F (containmentCoverageWeight)",indexContainmentCoverageHint:"\u30AF\u30A8\u30EA\u9577 / \u30D5\u30A3\u30FC\u30EB\u30C9\u9577\u306E\u6BD4\u7387\u306B\u5FDC\u3058\u305F\u52A0\u7B97\u30B9\u30B3\u30A2 (\u5408\u8A08 1.0 \u4EE5\u4E0B\u306B\u5236\u9650)",levenshteinSettingsHeading:"Levenshtein Worker \u8A73\u7D30\u8A2D\u5B9A",levenshteinCandidateHeading:"\u5019\u88DC\u30D5\u30A3\u30EB\u30BF",levenshteinThreshold:"Levenshtein \u95BE\u5024",levenshteinThresholdHintRelevance:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.5)",levenshteinThresholdHint:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.0)",levenshteinLengthSimilarity:"\u9577\u3055\u985E\u4F3C\u5EA6\u95BE\u5024",levenshteinLengthSimilarityHint:"\u9577\u3055\u304C\u5927\u304D\u304F\u7570\u306A\u308B\u5019\u88DC\u3092\u4E8B\u524D\u306B\u9664\u5916\u3057\u3066\u901F\u5EA6\u5411\u4E0A",levenshteinLengthPenalty:"\u9577\u3055\u5DEE\u30DA\u30CA\u30EB\u30C6\u30A3",levenshteinLengthPenaltyHint:"\u9577\u3055\u5DEE\u3092\u3069\u308C\u3060\u3051\u6E1B\u70B9\u3059\u308B\u304B\u3002\u5927\u304D\u3044\u307B\u3069\u9577\u3055\u4E00\u81F4\u3092\u91CD\u8996",levenshteinResultsHeading:"\u7D50\u679C\u6570\u5236\u5FA1",levenshteinMaxResultsHint:"\u8FD4\u5374\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u7DB2\u7F85\u7684\u3060\u304C\u51E6\u7406\u6642\u9593\u304C\u5897\u52A0",levenshteinFieldWeightHint:"\u4E00\u81F4\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306E\u8A55\u4FA1\u91CD\u307F",levenshteinPartialBonus:"\u90E8\u5206\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",levenshteinPartialBonusHint:"\u90E8\u5206\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u8FFD\u52A0\u30B9\u30B3\u30A2",statsRebuildingTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D",statsRebuildIndexTabOnlyTitle:"Index \u30BF\u30D6\u3067\u306E\u307F\u4F7F\u7528\u53EF\u80FD",statsRebuildTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u518D\u69CB\u7BC9",statsRebuilding:"\u518D\u69CB\u7BC9\u4E2D...",statsRebuild:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9",statsResetTitle:"\u7D71\u8A08\u3092\u30EA\u30BB\u30C3\u30C8",statsOverviewTab:"\u6982\u8981",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"\u7DCF\u691C\u7D22\u56DE\u6570",statAverageSearchTime:"\u5E73\u5747\u691C\u7D22\u6642\u9593",statDataCount:"\u30C7\u30FC\u30BF\u4EF6\u6570",statResultCount:"\u691C\u7D22\u7D50\u679C\u4EF6\u6570",statDisplayedCount:"\u8868\u793A\u4EF6\u6570",statsNoData:"\u7D71\u8A08\u30C7\u30FC\u30BF\u306A\u3057",statsBasicHeading:"\u57FA\u672C\u7D71\u8A08",statTotalProcessingTime:"\u7DCF\u51E6\u7406\u6642\u9593",statLastSearchTime:"\u6700\u5F8C\u306E\u691C\u7D22\u6642\u9593",statErrorCount:"\u30A8\u30E9\u30FC\u6570",statUpdatedAt:"\u7D71\u8A08\u66F4\u65B0\u6642\u523B",statsOperationsHeading:"\u64CD\u4F5C\u7D71\u8A08",statTotalOperations:"\u7DCF\u64CD\u4F5C\u6570",statsIndexHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u7D71\u8A08",statIndexBuilds:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9\u56DE\u6570",statDataSize:"\u30C7\u30FC\u30BF\u30B5\u30A4\u30BA",statLastBuildTime:"\u6700\u5F8C\u306E\u69CB\u7BC9\u6642\u9593",statsCacheHeading:"\u30AD\u30E3\u30C3\u30B7\u30E5\u7D71\u8A08",statCacheNgram:"N-gram",statCacheWord:"\u5358\u8A9E",statCachePhonetic:"\u97F3\u97FB",statsIndexMetadataHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u30E1\u30BF\u30C7\u30FC\u30BF",statsCalculationsHeading:"\u8A08\u7B97\u7D71\u8A08",statTotalCalculations:"\u7DCF\u8A08\u7B97\u6570",statDistanceCalculations:"\u8DDD\u96E2\u8A08\u7B97\u6570",statAverageDistance:"\u5E73\u5747\u8DDD\u96E2",statMinDistance:"\u6700\u5C0F\u8DDD\u96E2",statMaxDistance:"\u6700\u5927\u8DDD\u96E2",notAvailable:"N/A",statsMatchesHeading:"\u30DE\u30C3\u30C1\u7D71\u8A08",statPartialMatches:"\u90E8\u5206\u30DE\u30C3\u30C1\u6570",statPerfectMatches:"\u5B8C\u5168\u30DE\u30C3\u30C1\u6570",statEarlyTerminations:"\u65E9\u671F\u7D42\u4E86\u6570",statsSimilarityHeading:"\u985E\u4F3C\u5EA6\u5206\u5E03",statAbove80:"80% \u4EE5\u4E0A",statAbove60:"60% \u4EE5\u4E0A",statAbove40:"40% \u4EE5\u4E0A",statBelow40:"40% \u672A\u6E80",statsDistanceHeading:"\u8DDD\u96E2\u5206\u5E03 (\u4E0A\u4F4D 6)",statDistance:e=>`\u8DDD\u96E2 ${e}`,statsQueryLengthHeading:"\u30AF\u30A8\u30EA\u9577\u7D71\u8A08 (\u4E0A\u4F4D 6)",statQueryLength:e=>`\u9577\u3055 ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>`${j("ja",e)} \u56DE / \u5E73\u5747 ${t}%`,statsFieldPerformanceHeading:"\u30D5\u30A3\u30FC\u30EB\u30C9\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9 (\u4E0A\u4F4D 6)",statAverageScore:"\u5E73\u5747\u30B9\u30B3\u30A2",statMatchCount:"\u30DE\u30C3\u30C1\u6570",statBestWorstScore:"\u6700\u9AD8 / \u6700\u4F4E\u30B9\u30B3\u30A2",statsInsightsHeading:"\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6D1E\u5BDF",statBestField:"\u6700\u9AD8\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30D5\u30A3\u30FC\u30EB\u30C9",statRecentAverageTime:"\u6700\u8FD1\u306E\u5E73\u5747\u51E6\u7406\u6642\u9593",statRecentAverageResults:"\u6700\u8FD1\u306E\u5E73\u5747\u7D50\u679C\u6570",statThroughput:"\u30B9\u30EB\u30FC\u30D7\u30C3\u30C8",statCommonQueryLength:"\u6700\u983B\u51FA\u30AF\u30A8\u30EA\u9577",statHistoryEntries:"\u5C65\u6B74\u30A8\u30F3\u30C8\u30EA\u6570",statHighSimilarity:"\u9AD8\u985E\u4F3C",statMediumSimilarity:"\u4E2D\u985E\u4F3C",statLowSimilarity:"\u4F4E\u985E\u4F3C",statVeryLowSimilarity:"\u6975\u4F4E\u985E\u4F3C",statsRecentHistoryHeading:"\u6700\u8FD1\u306E\u5C65\u6B74 (\u6700\u65B0 3 \u4EF6)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`\u51E6\u7406\u6642\u9593: ${e} ms / \u7D50\u679C: ${j("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),Gn=Object.freeze(Object.keys(ga.en)),Vt=Object.freeze([...Ya,...Gn]),Be=Object.freeze({en:Object.freeze({...jn.en,...ga.en}),ja:Object.freeze({...jn.ja,...ga.ja})}),bo=new Set(Vt),qn=Object.keys(Be).map(e=>JSON.stringify(e)).join(" or "),Qn=Object.freeze({locale:"locale",labels:"labels"}),xo=(e,t,a)=>{e[t]=a},Ja=(e,t=Qn.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${qn} or left out; got ${ae(e)}`);if(e!==void 0&&!Object.hasOwn(Be,e))throw new RangeError(`[contact-map] ${t} must be ${qn} or left out; got ${ae(e)}`);return ho(e)},vo=(e,t,a,r)=>{if(typeof r=="function"){if(typeof a!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${ae(a)}`);return}if(typeof a!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${ae(a)}`);if(a.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${ae(a)}`)},Co=(e,t,a)=>{let r=Object.create(null);for(let s of Object.getOwnPropertyNames(e)){if(!bo.has(s)){let o=ma(s,Vt);throw new RangeError(`[contact-map] ${a} has a key that is not a label key (${o===void 0?"":`did you mean ${JSON.stringify(o)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${ae(s)}`)}let n=e[s];n!==void 0&&(vo(a,s,n,t[s]),r[s]=n)}return r},ko=e=>{let t={},a=!1;for(let r of Ya){let s=e[r];s!==void 0&&(t[r]=s,a=!0)}return a?t:void 0},Xa=(e,t,a=Qn)=>{let r=Ja(e,a.locale);if(t===void 0)return Be[r];if(!Mt(t))throw new TypeError(`[contact-map] ${a.labels} must be a plain object or left out; got ${ae(t)}`);let s=Co(t,Be[r],a.labels),o={...go(r,ko(s)),...ga[r]};for(let c of Gn){let l=s[c];l!==void 0&&xo(o,c,l)}return Object.freeze(o)},Za=e=>{let t={};for(let a of Ya)t[a]=e[a];return Object.freeze(t)},en=e=>{let t={};for(let a of fo)t[a]=e[a];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as So}from"@aiquants/directory-tree";import{VIRTUAL_SCROLL_LABEL_KEYS as To}from"@aiquants/virtualscroll";import{createContext as wo,useContext as Jn,useMemo as Yn,useRef as No}from"react";import{jsx as Mo}from"react/jsx-runtime";var Po,an,tn,Xn,fe,q,se=Te(()=>{"use strict";mt();Po=Object.freeze({locale:"en",labels:Be.en,treeLabels:Za(Be.en),engineLabels:en(Be.en)}),an=wo(Po),tn=(e,t)=>{let a=No(null),r=a.current;return r!==null&&t.every(s=>r[s]===e[s])?r:(a.current=e,e)},Xn=({locale:e,labels:t,surface:a,children:r})=>{let s=Ja(e,a.locale),n=Yn(()=>Xa(s,t,a),[s,t,a]),o=tn(n,Vt),c=tn(Za(o),So),l=tn(en(o),To),d=Yn(()=>({locale:s,labels:o,treeLabels:c,engineLabels:l}),[s,o,c,l]);return Mo(an.Provider,{value:d,children:r})},fe=()=>Jn(an),q=()=>Jn(an).labels});var ha,fa,er,ya,ba,Kt,$e,tr,we,K,ht=Te(()=>{"use strict";ha=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},fa=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,er=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let a of t){let r=ha(e[a]);if(r)return{value:r,fieldKey:a}}return{value:null,fieldKey:null}},ya=e=>er(e,["custom_email","email"]),ba=e=>er(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),Kt=e=>{let t=ha(e);if(!t)return null;let a=t.replace(/[^0-9+#*]/g,"");return a.length===0?null:`tel:${a}`},$e=(e,t)=>{let a=ha(e);return a?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(a)}`:`mailto:${encodeURIComponent(a)}`:null},tr=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString().split("T")[0]},we=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString()},K=e=>e==null?"-":typeof e=="string"?ha(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":e instanceof Date?we(e):String(e)});import Eo from"lucide-react/dist/esm/icons/check.js";import Oo from"lucide-react/dist/esm/icons/copy.js";import Wo from"lucide-react/dist/esm/icons/x.js";import{useCallback as et,useEffect as ln,useMemo as jt,useRef as dn,useState as rr}from"react";import{createPortal as Do}from"react-dom";import{jsx as G,jsxs as Ne}from"react/jsx-runtime";var Ho,ar,Gt,Et,_o,Ao,qt,on,nr,sn,xa,cn=Te(()=>{"use strict";ht();se();Ho=350,ar=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Gt=0,Et=null,_o=()=>{let e=document.body.style;Gt+=1,Gt===1&&(Et={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},Ao=()=>{if(Gt=Math.max(0,Gt-1),Gt>0||!Et)return;let e=document.body.style;e.userSelect=Et.userSelect,typeof Et.webkitUserSelect<"u"&&(e.webkitUserSelect=Et.webkitUserSelect),Et=null},qt=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},on=(e,t)=>{let a=new Set;return e.reduce((r,s)=>{let n=typeof s.value=="string"?s.value.trim():"";if(!n)return r;let{normalized:o,key:c,entry:l}=t(n,s);return o&&!a.has(c)&&(a.add(c),r.push(l(o))),r},[])},nr=(e,t)=>e===t,sn=({value:e,ariaLabel:t,size:a="md"})=>{let[r,s]=rr(!1),n=dn(null),o=et(async p=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(p),!0}catch{}if(typeof document>"u")return!1;let i=document.createElement("textarea");i.value=p,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),i.setSelectionRange(0,i.value.length);let u=document.execCommand("copy");return document.body.removeChild(i),u},[]),c=et(async p=>{p.preventDefault(),p.stopPropagation(),n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null);let i=await o(e);s(i),i&&typeof window<"u"&&(n.current=window.setTimeout(()=>{s(!1),n.current=null},1500))},[o,e]);ln(()=>()=>{n.current!==null&&typeof window<"u"&&(window.clearTimeout(n.current),n.current=null)},[]);let l=a==="sm"?"h-6 w-6":"h-7 w-7",d=a==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=r?Eo:Oo;return G("button",{type:"button",className:`inline-flex ${l} shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-200 dark:text-slate-300`,onClick:c,"aria-label":t,title:t,children:G(m,{className:d,"aria-hidden":"true"})})},xa=({contactData:e,openEmailsWithGmail:t,openGmailCompose:a,onRequestClose:r})=>{let s=q(),[n,o]=rr(null);ln(()=>{o(document.body)},[]);let c=dn(null),l=dn(null),d=jt(()=>e.contacted_at?tr(e.contacted_at):null,[e.contacted_at]),m=e.full_name||"-",p=qt(e.company_name),i=qt(e.department),u=qt(e.title),h=jt(()=>on([{fieldKey:"company_name",label:s.fieldCompanyName,value:p},{fieldKey:"department",label:s.fieldDepartment,value:i},{fieldKey:"title",label:s.fieldTitle,value:u}],(f,{fieldKey:v,label:W})=>({normalized:f,key:`${v}-${f.toLowerCase()}`,entry:D=>({fieldKey:v,label:W,value:D})})),[p,i,u,s]),k=jt(()=>on([{fieldKey:"custom_mobile_phone_number",label:s.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:s.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:s.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:s.popupCompanyPhone,value:e.company_phone_number}],(f,{fieldKey:v,label:W})=>{let D=Kt(f);return{normalized:qt(f),key:(D??f).toLowerCase(),entry:P=>({fieldKey:v,label:W,value:P,href:D})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,s]),C=jt(()=>on([{fieldKey:"custom_email",label:s.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:s.popupEmail,value:e.email}],(f,{fieldKey:v,label:W})=>{let D=qt(f),X=$e(f,t),P=!!X?.startsWith("https://mail.google.com");return{normalized:D,key:f.toLowerCase(),entry:M=>({fieldKey:v,label:W,value:M,href:X,isGmailLink:P})}}),[e.custom_email,e.email,t,s]),S=k.length>0||C.length>0,B=jt(()=>`contact-methods-${e.person_id}`,[e.person_id]),N=et(f=>{r(f),l.current=null},[r]),y=et(f=>{f.stopPropagation(),nr(f.target,f.currentTarget)&&N()},[N]),g=et(f=>{f.stopPropagation(),nr(f.target,f.currentTarget)&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),N())},[N]),O=et(f=>{f.stopPropagation(),N()},[N]),V=et((f,v)=>{v.isGmailLink&&(f.preventDefault(),a(v.value))},[a]),b=et((f,v)=>{if(!v.isGmailLink){l.current=null;return}let W=Date.now(),D=l.current;if(D&&D.email===v.value&&W-D.timestamp<=Ho){l.current=null,f.preventDefault(),a(v.value);return}l.current={email:v.value,timestamp:W}},[a]);return ln(()=>{let f=[];if(typeof window<"u"){let v=W=>{if(W.key==="Escape"){N();return}if(W.key==="Tab"&&c.current){let D=c.current.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(D.length===0)return;let X=D[0],P=D[D.length-1];W.shiftKey?document.activeElement===X&&(W.preventDefault(),P.focus()):document.activeElement===P&&(W.preventDefault(),X.focus())}};window.addEventListener("keydown",v),f.push(()=>window.removeEventListener("keydown",v))}if(typeof document<"u"){let v=c.current;if(v){let P=M=>{M.stopPropagation()};for(let M of ar)v.addEventListener(M,P);f.push(()=>{for(let M of ar)v.removeEventListener(M,P)})}let W=P=>{let M=c.current;return M&&P instanceof Node?M.contains(P):!1},D=P=>{W(P.target)||N({suppressLongPress:!0,cancelLongPressTimer:!0})},X=["pointerdown","wheel","touchmove"];for(let P of X)document.addEventListener(P,D,!0);f.push(()=>{for(let P of X)document.removeEventListener(P,D,!0)}),_o(),f.push(Ao)}return()=>{for(let v of f)v()}},[N,n]),n?Do(G("div",{"data-contact-popup-root":"true",className:"fixed top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-black/50 px-4 py-6",style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s"},role:"dialog","aria-modal":"true","aria-labelledby":B,tabIndex:-1,onClick:y,onKeyDown:g,children:Ne("div",{ref:c,className:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-lg transition-colors dark:border-transparent dark:bg-slate-900 dark:shadow-slate-950/40 dark:ring-1 dark:ring-white/70",children:[Ne("div",{className:"flex items-start justify-between gap-4",children:[Ne("div",{children:[G("h2",{id:B,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),h.length>0?G("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:h.map(f=>Ne("div",{className:"flex items-center gap-3",children:[G("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:f.value}),G(sn,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]},f.fieldKey))}):null]}),G("button",{type:"button",className:"rounded-md p-0.5 text-slate-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring focus-visible:ring-blue-200 dark:text-slate-300 dark:hover:bg-slate-800/70",onClick:O,"aria-label":s.close,children:G(Wo,{className:"h-4 w-4","aria-hidden":"true"})})]}),Ne("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[k.length>0?G("div",{children:G("ul",{className:"space-y-3 text-sm",children:k.map(f=>G("li",{className:"flex items-start gap-3",children:Ne("div",{className:"flex-1",children:[G("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:f.label}),Ne("div",{className:"mt-1 flex items-center gap-3",children:[G("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:f.href?G("a",{href:f.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",children:f.value}):G("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:f.value})}),G(sn,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]})]})},`${f.fieldKey}-${f.value}`))})}):null,C.length>0?G("div",{children:G("ul",{className:"space-y-3 text-sm",children:C.map(f=>G("li",{className:"flex items-start gap-3",children:Ne("div",{className:"flex-1",children:[G("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:f.label}),Ne("div",{className:"mt-1 flex items-start gap-3",children:[Ne("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[f.href?G("a",{href:f.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",target:f.isGmailLink?"_blank":void 0,rel:f.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:v=>V(v,f),onTouchEnd:v=>b(v,f),children:f.value}):G("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:f.value}),f.isGmailLink?G("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:s.popupGmailHint}):null]}),G(sn,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]})]})},`${f.fieldKey}-${f.value}`))})}):null,d?Ne("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[G("span",{className:"text-xs",children:s.popupLastContactDate}),G("span",{children:d})]}):null,S?null:G("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:s.popupNoContactMethods})]})]})}),n):null}});import{jsx as ye,jsxs as Qt}from"react/jsx-runtime";var va,pn=Te(()=>{"use strict";va=({fullName:e,title:t="-",companyName:a="-",department:r="-",phoneNumber:s="-",email:n="-",updatedAtText:o="-"})=>Qt("div",{className:"flex h-full w-full flex-col justify-center gap-0.5 text-slate-800 text-xs leading-tight transition-colors sm:grid sm:grid-cols-3 sm:gap-2 sm:text-sm xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[Qt("div",{className:"flex items-center gap-1 sm:hidden",children:[ye("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),ye("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:s})]}),ye("div",{className:"flex items-center gap-1 sm:hidden",children:ye("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:a})}),ye("div",{className:"block sm:hidden",children:ye("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:r})}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[ye("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),ye("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[ye("span",{className:"truncate text-slate-800 dark:text-slate-100",children:a}),ye("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:r})]}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[ye("span",{className:"truncate text-slate-700 dark:text-slate-200",children:s}),ye("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:n})]}),ye("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:ye("span",{className:"truncate",children:o})})]})});import{getNormalizedVariants as Io,normalizeText as Fo,romajiToKatakana as zo}from"@aiquants/select-box";var Bo,Uo,$o,Vo,Ko,sr,jo,qo,or,Ca,Go,Qo,un,ir,mn=Te(()=>{"use strict";Bo=/[]/g,Uo=/^[\s ]+|[\s ]+$/g,$o=/\s+/,Vo=/^[\p{Script=Latin}\s]+$/u,Ko=/\p{Script=Latin}/u,sr=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1}),jo=e=>Fo(e.replace(Bo,"").replace(Uo,""),sr),qo=e=>{if(!Vo.test(e))return null;let t=zo(e);return Ko.test(t)?null:t},or=e=>e.split($o).filter(Boolean),Ca=e=>{let t=jo(e),a=qo(t);return a===null?t:a},Go=e=>{let t=new Set([...or(e),...or(Ca(e))]),a=new Set;for(let r of t)for(let s of Io(r,sr)){let n=s.trim();n&&a.add(n)}return Array.from(a)},Qo=/[.*+?^${}()|[\]\\]/g,un=e=>{let t=Go(e);if(t.length===0)return null;let a=t.map(r=>r.replace(Qo,"\\$&")).sort((r,s)=>s.length-r.length);return new RegExp(a.join("|"),"gi")},ir=(e,t)=>{let a=un(e);if(a===null)return s=>s;let r=s=>t.some(n=>{let o=s[n];return typeof o=="string"&&o.search(a)!==-1});return s=>{let n=[],o=[];for(let c of s)r(c.item)?n.push(c):o.push(c);return[...n,...o]}}});import{memo as Yo}from"react";import{Fragment as gn,jsx as ka}from"react/jsx-runtime";var ce,Sa=Te(()=>{"use strict";mn();ce=Yo(({text:e,query:t,enabled:a=!0})=>{if(!(a&&t?.trim()&&e))return ka(gn,{children:e});let r=un(t);if(r===null)return ka(gn,{children:e});let s=[],n=0,o=r.exec(e),c=0;for(;o;){let l=o[0],d=o.index;if(d>n&&s.push(e.substring(n,d)),l.length===0){r.lastIndex++,o=r.exec(e);continue}s.push(ka("mark",{className:"rounded bg-yellow-200 px-1 text-gray-900",children:l},`highlight-${d}-${c}`)),n=d+l.length,c+=1,o=r.exec(e)}return n<e.length&&s.push(e.substring(n)),ka(gn,{children:s})});ce.displayName="HighlightedText"});var dr={};uo(dr,{ContactDetailGrid:()=>lr,default:()=>Jo});import{useMemo as hn}from"react";import{Fragment as Xo,jsx as yn,jsxs as Zo}from"react/jsx-runtime";var fn,lr,Jo,cr=Te(()=>{"use strict";ht();se();cn();pn();Sa();fn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},lr=({contactData:e,searchTerm:t,enableHighlighting:a,openEmailsWithGmail:r,openGmailCompose:s,isPopupVisible:n,onRequestClose:o})=>{let c=q(),l=hn(()=>ya(e),[e]),d=hn(()=>ba(e),[e]),m=l.value??"-",p=d.value??"-",i=hn(()=>we(e.updated_at),[e.updated_at]),u=fn(e.full_name)??c.noName,h=fn(e.company_name),k=fn(e.department),C=(S,B="-")=>yn(ce,{text:S??B,query:t,enabled:a});return Zo(Xo,{children:[yn(va,{fullName:C(u),title:C(e.title),companyName:C(h),department:C(k),phoneNumber:p,email:C(m),updatedAtText:i}),n?yn(xa,{contactData:e,openEmailsWithGmail:r,openGmailCompose:s,onRequestClose:o}):null]})},Jo=lr});se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Lt}from"@aiquants/fuzzy-search";import{memo as Ro,useId as Zn}from"react";import{jsx as Ee,jsxs as Ue}from"react/jsx-runtime";var nn=Ro(({searchOptions:e,setSearchOptions:t})=>{let a=q(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",n=Zn(),o=Zn(),c=[];return c.push(Ue("div",{className:`${r} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[Ue("div",{className:`${s} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",a.advancedLearningHeading]}),Ee("label",{htmlFor:n,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedLearningLabel}),Ee("input",{id:n,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||Lt.learningWeight,onChange:l=>t(d=>({...d,learningWeight:parseFloat(l.target.value)})),className:"w-full"}),Ue("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[a.currentValueLabel," ",e.learningWeight||Lt.learningWeight]}),Ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedLearningHint})]},"learning")),c.push(Ue("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[Ue("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",a.advancedDebounceHeading]}),Ee("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.advancedDebounceLabel}),Ee("input",{id:o,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs||Lt.debounceMs,onChange:l=>t(d=>({...d,debounceMs:parseInt(l.target.value,10)})),className:"w-full"}),Ue("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.debounceMs||Lt.debounceMs]}),Ee("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.advancedDebounceHint})]},"debounce")),Ue("section",{className:"space-y-3",children:[Ue("div",{className:"flex items-center justify-between gap-3",children:[Ue("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Ee("span",{children:"\u26A1"}),Ee("span",{className:"tracking-wide",children:a.settingsAdvancedTab})]}),Ee("button",{type:"button",onClick:()=>t(l=>({...l,learningWeight:Lt.learningWeight,debounceMs:Lt.debounceMs})),className:"rounded border border-gray-300 bg-gray-100 px-2 py-1 font-medium text-gray-700 text-xs transition-colors hover:bg-gray-200 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-200 dark:hover:bg-slate-700/70",title:a.resetToDefaultsTitle,children:a.reset})]}),Ee("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:c})]})});nn.displayName="AdvancedSearchSettings";se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as gt}from"@aiquants/fuzzy-search";import{memo as Lo,useId as Oe}from"react";import{jsx as Q,jsxs as J}from"react/jsx-runtime";var rn=Lo(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:n})=>{let o=q(),c="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",d=Oe(),m=Oe(),p=Oe(),i=Oe(),u=Oe(),h=Oe(),k=Oe(),C=Oe(),S=Oe(),B=Oe(),N=[];return N.push(J("div",{className:`${c} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[J("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",o.basicThresholdHeading]}),Q("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicThresholdLabel}),Q("input",{id:d,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??gt.threshold,onChange:y=>t(g=>({...g,threshold:parseFloat(y.target.value)})),className:"w-full"}),J("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[o.currentValueLabel," ",e.threshold??gt.threshold]}),Q("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?o.basicThresholdRangeRelevance:o.basicThresholdRange})]},"threshold")),N.push(J("div",{className:`${c} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[J("div",{className:`${l} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",o.basicDisplayHeading]}),J("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:m,type:"checkbox",checked:e.caseSensitive??gt.caseSensitive,onChange:y=>t(g=>({...g,caseSensitive:y.target.checked})),className:"h-3 w-3"}),o.basicCaseSensitive]}),J("label",{htmlFor:p,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:p,type:"checkbox",checked:a,onChange:y=>r(y.target.checked),className:"h-3 w-3"}),o.basicHighlight]}),J("label",{htmlFor:i,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:i,type:"checkbox",checked:s,onChange:y=>n(y.target.checked),className:"h-3 w-3"}),o.basicOpenEmailsWithGmail]}),J("div",{className:"flex flex-col gap-1",children:[Q("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicMultiTermOperator}),J("select",{id:u,value:e.multiTermOperator??gt.multiTermOperator,onChange:y=>t(g=>({...g,multiTermOperator:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[Q("option",{value:"or",children:o.basicOperatorOr}),Q("option",{value:"and",children:o.basicOperatorAnd})]}),Q("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:o.basicMultiTermHint})]})]},"display")),N.push(J("div",{className:`${c} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[J("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",o.basicSortHeading]}),J("div",{className:"flex flex-col gap-2",children:[Q("label",{htmlFor:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortBy}),J("select",{id:h,value:e.sortBy||gt.sortBy,onChange:y=>t(g=>({...g,sortBy:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[Q("option",{value:"score",children:o.basicSortByScore}),Q("option",{value:"relevance",children:o.basicSortByRelevance}),Q("option",{value:"original",children:o.basicSortByOriginal})]})]}),J("div",{className:"flex flex-col gap-2",children:[Q("label",{htmlFor:k,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortOrder}),J("select",{id:k,value:e.sortOrder||gt.sortOrder,onChange:y=>t(g=>({...g,sortOrder:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[Q("option",{value:"desc",children:o.basicSortDescending}),Q("option",{value:"asc",children:o.basicSortAscending})]})]})]},"sorting")),N.push(J("div",{className:`${c} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[J("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",o.basicEngineHeading]}),Q("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicStrategy}),J("select",{id:C,value:e.parallelSearchStrategy||gt.parallelSearchStrategy,onChange:y=>t(g=>({...g,parallelSearchStrategy:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[Q("option",{value:"balanced",children:o.basicStrategyBalanced}),Q("option",{value:"index-first",children:o.basicStrategyIndexFirst}),Q("option",{value:"levenshtein-first",children:o.basicStrategyLevenshteinFirst})]}),J("div",{className:"mt-2 space-y-2",children:[J("label",{htmlFor:S,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:S,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:y=>t(g=>({...g,enableIndexFiltering:y.target.checked})),className:"h-3 w-3"}),o.basicIndexFiltering]}),J("label",{htmlFor:B,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:B,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:y=>t(g=>({...g,enableLevenshtein:y.target.checked})),className:"h-3 w-3"}),o.basicLevenshtein]})]})]},"engine")),J("section",{className:"space-y-3",children:[J("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[Q("span",{children:"\u{1F527}"}),Q("span",{className:"tracking-wide",children:o.settingsBasicTab})]}),Q("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:N})]})});rn.displayName="BasicSearchSettings";ht();import as from"lucide-react/dist/esm/icons/badge-check.js";import ns from"lucide-react/dist/esm/icons/building-2.js";import rs from"lucide-react/dist/esm/icons/calendar-clock.js";import os from"lucide-react/dist/esm/icons/check.js";import ss from"lucide-react/dist/esm/icons/copy.js";import is from"lucide-react/dist/esm/icons/id-card.js";import ls from"lucide-react/dist/esm/icons/mail.js";import ds from"lucide-react/dist/esm/icons/phone.js";import cs from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as ps,useEffect as us,useMemo as Na,useRef as ms,useState as gs}from"react";var We={info:(e,...t)=>console.info(`[contact-map] ${e}`,...t),warn:(e,...t)=>console.warn(`[contact-map] ${e}`,...t),error:(e,...t)=>console.error(`[contact-map] ${e}`,...t)};se();import*as Pe from"@radix-ui/react-tabs";import*as Ta from"react";import{clsx as es}from"clsx";import{twMerge as ts}from"tailwind-merge";function ft(...e){return ts(es(e))}import{jsx as bn}from"react/jsx-runtime";var wa=Pe.Root,Yt=Ta.forwardRef(({className:e,...t},a)=>bn(Pe.List,{ref:a,className:ft("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Yt.displayName=Pe.List.displayName;var yt=Ta.forwardRef(({className:e,...t},a)=>bn(Pe.Trigger,{ref:a,className:ft("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-2xs",e),...t}));yt.displayName=Pe.Trigger.displayName;var bt=Ta.forwardRef(({className:e,...t},a)=>bn(Pe.Content,{ref:a,className:ft("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",e),...t}));bt.displayName=Pe.Content.displayName;Sa();import{jsx as R,jsxs as ie}from"react/jsx-runtime";var pr={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},hs=({icon:e,label:t,value:a,fieldKey:r,copyValue:s,onCopy:n,isCopied:o,linkHref:c,searchTerm:l,enableHighlighting:d})=>{let m=q(),p=!!(n&&r&&s),i=c?.startsWith("https://mail.google.com")?"_blank":void 0;return ie("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[ie("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[R("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-white text-slate-500 transition-colors dark:bg-slate-800 dark:text-slate-200",children:R(e,{size:14})}),ie("div",{className:"min-w-0 flex-1",children:[R("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),R("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:c?R("a",{href:c,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",target:i,rel:i?"noopener noreferrer":void 0,children:R(ce,{text:a,query:l??"",enabled:d})}):R(ce,{text:a,query:l??"",enabled:d})})]})]}),p?R("button",{type:"button",onClick:()=>n&&r&&s&&n(r,s,t),className:"inline-flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-500 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:border-blue-400 dark:hover:text-blue-300","aria-label":m.copyField(t),children:o?R(os,{size:14}):R(ss,{size:14})}):null]})},ur=({items:e,searchTerm:t,enableHighlighting:a})=>R("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(r=>ie("div",{className:"flex flex-col gap-0.5 rounded-md border border-slate-200 bg-white/60 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[R("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:r.label}),R("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:R(ce,{text:r.value,query:t??"",enabled:a})})]},r.fieldKey))}),xn=({title:e})=>R("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),fs=()=>{let e=q();return ie("div",{className:"flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-slate-300 border-dashed bg-white/60 p-4 text-center transition-colors dark:border-slate-700 dark:bg-slate-900/40",children:[R("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),R("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},tt=({contact:e,searchTerm:t,enableHighlighting:a,style:r,className:s=""})=>{let n=q(),[o,c]=gs(null),l=ms(null),d=Na(()=>({...pr,...r}),[r]);us(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=Na(()=>ya(e),[e]),p=Na(()=>ba(e),[e]),i=Na(()=>we(e?.contacted_at??null),[e?.contacted_at]),u=ps(async(b,f,v)=>{try{await navigator.clipboard.writeText(f),c(b),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{c(null)},2e3)}catch(W){We.error("Failed to copy contact detail",W)}},[]);if(!e)return R("div",{className:"flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",style:pr,children:R(fs,{})});let h=[K(e.title),K(e.department)].filter(b=>b!=="-"),k=[h.join(" / "),K(e.company_name)].filter(b=>b&&b!=="-").join(" \u30FB ")||"-",C=K(e.full_name),S=[{fieldKey:"full_name",label:n.fieldFullName,value:C==="-"?n.noName:C},{fieldKey:"full_name_reading",label:n.fieldFullNameReading,value:K(e.full_name_reading)},{fieldKey:"title",label:n.fieldTitle,value:K(e.title)},{fieldKey:"department",label:n.fieldDepartment,value:K(e.department)},{fieldKey:"company_name",label:n.fieldCompanyName,value:K(e.company_name)},{fieldKey:"company_name_reading",label:n.fieldCompanyNameReading,value:K(e.company_name_reading)},{fieldKey:"address",label:n.fieldAddress,value:K(e.address)},{fieldKey:"postal_code",label:n.fieldPostalCode,value:K(e.postal_code)},{fieldKey:"url",label:n.fieldUrl,value:K(e.url)}],B=[{label:n.fieldCustomEmail,value:K(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:n.fieldEmail,value:K(e.email),fieldKey:"email",rawValue:e.email}].filter(b=>b.value!=="-"),N=[{label:n.fieldCustomMobilePhone,value:K(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:n.fieldMobilePhone,value:K(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:n.fieldCompanyPhone,value:K(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:n.fieldCompanyFax,value:K(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(b=>b.value!=="-"),y=[{fieldKey:"person_id",label:"person_id",value:K(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:K(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:K(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:K(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:K(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:K(e.is_in_eight)},{fieldKey:"created_by",label:n.fieldCreatedBy,value:K(e.created_by)},{fieldKey:"created_at",label:n.fieldCreatedAt,value:we(e.created_at)},{fieldKey:"updated_by",label:n.fieldUpdatedBy,value:K(e.updated_by)},{fieldKey:"updated_at",label:n.fieldUpdatedAt,value:we(e.updated_at)}],g=[{rowKey:"person_id",icon:is,label:"person_id",value:K(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:ls,label:n.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:$e(m.value,!1)},{rowKey:"primary_phone",icon:ds,label:n.summaryPhone,value:p.value??"-",fieldKey:"primary_phone",copyValue:p.value,linkHref:Kt(p.value)},{rowKey:"contacted_at",icon:rs,label:n.summaryLastContact,value:i}],O=[{sectionKey:"email",title:n.sectionEmail,emptyText:n.sectionEmailEmpty,entries:B,recommendedKey:m.fieldKey??null,resolveHref:b=>$e(b!=null?String(b):null,!1)},{sectionKey:"phone",title:n.sectionPhone,emptyText:n.sectionPhoneEmpty,entries:N,recommendedKey:p.fieldKey??null,resolveHref:b=>Kt(b!=null?String(b):null)}],V=[{value:"summary",label:n.detailTabSummary,content:ie("div",{className:"flex flex-col gap-4",children:[ie("div",{className:"flex flex-col gap-1",children:[ie("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[R(ns,{size:16}),R("span",{children:R(ce,{text:K(e.company_name),query:t??"",enabled:a})})]}),h.length>0?R("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:h.map((b,f)=>ie("span",{children:[f>0&&" / ",R(ce,{text:b,query:t??"",enabled:a})]},`header-line-${f}`))}):null]}),R("div",{className:"flex flex-col gap-3",children:g.map(b=>R(hs,{icon:b.icon,label:b.label,value:b.value,fieldKey:b.fieldKey,copyValue:b.copyValue,onCopy:u,isCopied:b.fieldKey?o===b.fieldKey:!1,linkHref:b.linkHref,searchTerm:t,enableHighlighting:a},b.rowKey))})]})},{value:"basic",label:n.detailTabBasic,content:ie("div",{className:"flex flex-col gap-3",children:[R(xn,{title:n.detailBasicProfile}),R(ur,{items:S,searchTerm:t,enableHighlighting:a})]})},{value:"contact",label:n.detailTabContact,content:R("div",{className:"flex flex-col gap-4",children:O.map(({sectionKey:b,title:f,emptyText:v,entries:W,recommendedKey:D,resolveHref:X})=>ie("div",{className:"flex flex-col gap-2",children:[R(xn,{title:f}),W.length===0?R("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:v}):R("div",{className:"flex flex-col gap-2",children:W.map(P=>{let M=X(P.rawValue),H=P.fieldKey===D;return ie("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[ie("div",{children:[R("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:P.label}),R("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:M?R("a",{href:M,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:R(ce,{text:P.value,query:t??"",enabled:a})}):R(ce,{text:P.value,query:t??"",enabled:a})})]}),H?ie("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-700 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[R(as,{size:14}),n.preferred]}):null]},P.fieldKey)})})]},b))})},{value:"meta",label:n.detailTabMeta,content:ie("div",{className:"flex flex-col gap-3",children:[R(xn,{title:n.detailTabMeta}),R(ur,{items:y,searchTerm:t,enableHighlighting:a})]})}];return ie("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950 ${s}`.trim(),style:d,children:[R("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:ie("div",{className:"flex items-center gap-2",children:[R("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-50 text-blue-600 transition-colors dark:bg-sky-900/40 dark:text-sky-300",children:R(cs,{size:16})}),ie("div",{className:"min-w-0 flex-1",children:[R("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:R(ce,{text:K(e.full_name),query:t??"",enabled:a})}),R("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:R(ce,{text:k,query:t??"",enabled:a})})]})]})}),ie(wa,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[R(Yt,{className:"flex gap-1.5 border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:V.map(b=>R(yt,{value:b.value,className:"rounded-md px-1.5 py-0.5 font-semibold text-[11px] transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-600 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300",children:b.label},b.value))}),V.map(b=>R(bt,{value:b.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:b.content},b.value))]})]})};mt();se();import{memo as ys}from"react";import{jsx as at,jsxs as Pa}from"react/jsx-runtime";var vn=ys(({recordCount:e,companyCount:t,phase:a,loadedCount:r,totalCount:s,errorMessage:n,onRetry:o})=>{let{locale:c,labels:l}=fe(),d=j(c,e),m=j(c,t);return Pa("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[Pa("span",{className:"flex items-baseline gap-1",children:[at("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationTotalLabel}),at("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:d}),at("span",{className:"text-slate-600 dark:text-slate-300",children:l.recordUnit(d)})]}),Pa("span",{className:"flex items-baseline gap-1",children:[at("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationCompaniesLabel}),at("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),at("span",{className:"text-slate-600 dark:text-slate-300",children:l.companyUnit(m)})]}),a==="streaming"||a==="retrying"||a==="idle"?at("span",{"data-testid":"contact-map-stream-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-blue-50 px-2 py-0.5 font-medium text-blue-700 text-xs dark:bg-blue-900/30 dark:text-blue-300",children:s!==null&&s>0?l.annotationStreamingProgress({loaded:r,total:s,percent:Math.min(100,Math.round(r/s*100))}):l.annotationStreamingCount(r)}):null,a==="failed"||a==="auth-required"?Pa("span",{"data-testid":"contact-map-error-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-rose-50 px-2 py-0.5 font-medium text-rose-700 text-xs dark:bg-rose-900/30 dark:text-rose-300",title:a==="failed"?n??void 0:void 0,children:["\u26D4 ",a==="auth-required"?l.annotationAuthRequired:l.annotationLoadFailed(r),o?at("button",{type:"button","data-testid":"contact-map-retry-button",onClick:o,className:"rounded border border-rose-300 bg-white px-1.5 py-0.5 font-semibold text-rose-700 transition-colors hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900",children:l.annotationRetry}):null]}):null]})});vn.displayName="ContactMapAnnotation";Rt();import{useMemo as lo}from"react";Pt();Rt();se();import{createContext as xs,useContext as vs,useMemo as Cs}from"react";Pt();Rt();Qa();var bs=["indexWorker","levenshteinWorker","treeWorker"];function mr(e,t,a){if(a!==void 0){if(typeof a!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string or left out (pass url.href for a URL object); got ${ae(a)}`);if(a.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${ae(a)}`)}}var gr={setting:"workerUrls"},hr=(e,t)=>{if(e===void 0)return;let{setting:a,keys:r=bs,hints:s={}}=t;if(!Mt(e))throw new TypeError(`[contact-map] ${a} must be a plain object or left out; got ${ae(e)}`);let n=Object.getOwnPropertyNames(e).map(l=>({key:l,url:e[l]})),o=n.find(({key:l,url:d})=>d!==void 0&&!r.includes(l));if(o!==void 0){let l=Object.hasOwn(s,o.key)?s[o.key]:void 0,d=l===void 0?ma(o.key,r):void 0;throw new RangeError(`[contact-map] ${a} has a key it does not take (it takes ${r.join(", ")}${l===void 0?"":`; ${l}`}${d===void 0?"":`; did you mean ${JSON.stringify(d)}?`}); got ${ae(o.key)}`)}let c=Object.create(null);for(let{key:l,url:d}of n){let m=l;mr(a,m,d),d!==void 0&&(c[m]=d)}return c};function Gd(e,t=gr){hr(e,t)}function fr(e){mr("workerUrls","treeWorker",e)}var Ot=(e,t,a=gr)=>{let r=hr(t,a);return{indexWorker:r?.indexWorker===void 0?e?.indexWorker:r.indexWorker,levenshteinWorker:r?.levenshteinWorker===void 0?e?.levenshteinWorker:r.levenshteinWorker,treeWorker:r?.treeWorker===void 0?e?.treeWorker:r.treeWorker}};import{jsx as Cn}from"react/jsx-runtime";var yr=e=>{if(!Mt(e))throw new TypeError(`[contact-map] config must be a plain object; got ${ae(e)}`);let t=e;return{streamEndpoint:me(t,"streamEndpoint"),openEmailsWithGmail:me(t,"openEmailsWithGmail"),treeWorkerFactory:me(t,"treeWorkerFactory"),workerUrls:Ot(void 0,me(t,"workerUrls")),layoutSpec:me(t,"layoutSpec"),locale:me(t,"locale"),labels:me(t,"labels")}},br=({workerUrls:e,...t})=>{let{indexWorker:a,levenshteinWorker:r,treeWorker:s}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:a,levenshteinWorker:r,treeWorker:s})}))},ks=br(yr({})),xr=xs(ks),Ss=Object.freeze({locale:"locale",labels:"labels"});function kn({config:e,chromeSurface:t,children:a}){let{streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:n,workerUrls:o,layoutSpec:c,locale:l,labels:d}=yr(e),{indexWorker:m,levenshteinWorker:p,treeWorker:i}=o,u=Cs(()=>br({streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:n,workerUrls:{indexWorker:m,levenshteinWorker:p,treeWorker:i},layoutSpec:c,locale:l,labels:d}),[r,s,n,m,p,i,c,l,d]);return Cn(xr.Provider,{value:u,children:Cn(Xn,{locale:l,labels:d,surface:t,children:a})})}function Ts({config:e,children:t}){return Cn(kn,{config:e,chromeSurface:Ss,children:t})}function Ve(){return vs(xr)}import{useCallback as Sn,useEffect as Ls,useMemo as La,useSyncExternalStore as vr}from"react";Pt();var ws=1e3,Ns=3e4,Ps=6;function Ra(e){if(typeof e!="string")throw new TypeError(`[contact-map] streamEndpoint must be a same-origin absolute path such as "/api/contact_map/stream", set on ContactMapConfigProvider or ContactMapAppView; got ${ae(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${ae(e)}`);if(!e.startsWith("/")||e.startsWith("//")||e.startsWith("/\\"))throw new RangeError(`[contact-map] streamEndpoint must be a same-origin absolute path such as "/api/contact_map/stream"; got ${ae(e)}`)}var Ms=e=>({...e,contacted_at:e.contacted_at?new Date(e.contacted_at):null,created_at:e.created_at?new Date(e.created_at):void 0,updated_at:e.updated_at?new Date(e.updated_at):void 0}),Rs=e=>Array.isArray(e.records),Ma=class{constructor(t){this.recordMap=new Map;this.listeners=new Set;this.lastCursor=null;this.consecutiveFailures=0;this.started=!1;this.disposed=!1;this.activeController=null;this.wakeRetryWait=null;this.state={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};this.handleOnline=()=>{this.wakeRetryWait?.()};Ra(t.endpoint),this.fetchFn=t.fetchFn??((...a)=>fetch(...a)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??ws,this.maxRetryDelayMs=t.maxRetryDelayMs??Ns,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Ps,this.logger=t.logger??We}getState(){return this.state}getRecordMap(){return this.recordMap}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}start(){this.started||this.disposed||(this.started=!0,typeof window<"u"&&window.addEventListener("online",this.handleOnline),this.runStreamLoop())}retryNow(){if(!this.disposed)switch(this.state.phase){case"retrying":this.wakeRetryWait?.();return;case"failed":case"auth-required":this.consecutiveFailures=0,this.setState({error:null,isLoading:this.recordMap.size===0}),this.runStreamLoop();return;case"idle":case"streaming":case"complete":return}}dispose(){this.disposed=!0,this.activeController?.abort(),this.wakeRetryWait?.(),typeof window<"u"&&window.removeEventListener("online",this.handleOnline)}setState(t){this.state={...this.state,...t};for(let a of this.listeners)a(this.state)}publishRecords(t={}){let a=Array.from(this.recordMap.values());this.setState({records:a,loadedCount:a.length,isLoading:!1,...t})}async runStreamLoop(){for(this.setState({phase:"streaming"});!this.disposed;){let t=await this.streamOnce();if(t==="aborted")return;if(t==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(t==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(this.consecutiveFailures+=1,this.consecutiveFailures>=this.maxConsecutiveFailures){this.setState({phase:"failed",isLoading:!1});return}let a=Math.min(this.initialRetryDelayMs*2**(this.consecutiveFailures-1),this.maxRetryDelayMs);if(this.setState({phase:"retrying",isLoading:this.recordMap.size===0}),this.logger.warn(`[ContactMapStream] retrying in ${a}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(a),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(a=>{let r=setTimeout(()=>{this.wakeRetryWait=null,a()},t);this.wakeRetryWait=()=>{clearTimeout(r),this.wakeRetryWait=null,a()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",a=new URLSearchParams;return this.lastCursor.contacted_at!==null&&a.set("cursor_contacted_at",this.lastCursor.contacted_at),a.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${a.toString()}`}async streamOnce(){this.activeController=new AbortController;try{let t=await this.fetchFn(this.buildStreamUrl(),{signal:this.activeController.signal,credentials:"same-origin"});if(t.status===401||t.status===403)return"auth-required";if(!(t.ok&&t.body))return this.logger.warn(`[ContactMapStream] unexpected response: ${t.status}`),"retryable";let a=t.body.getReader(),r=new TextDecoder,s="",n=!1,o=!1;for(;;){let{done:c,value:l}=await a.read();if(c)break;let d=r.decode(l,{stream:!0}),m=(s+d).split(`
|
|
2
|
-
`);s=m.pop()??"";let p=!1;for(let i of m){let u=i.trim();if(!u)continue;let h;try{h=JSON.parse(u)}catch(k){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",k);continue}if("type"in h&&h.type==="METADATA"){Number.isSafeInteger(h.total)&&h.total>=0&&this.setState({totalCount:h.total});continue}if(!Rs(h)){this.logger.warn("[ContactMapStream] server reported error:","error"in h?h.error:""),o=!0;continue}for(let k of h.records)k&&typeof k.person_id=="number"&&(this.recordMap.set(k.person_id,Ms(k)),p=!0);h.nextCursor&&(this.lastCursor=h.nextCursor),h.isLast&&(n=!0)}p&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return o?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):n?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let a=t instanceof Error?t:new Error(String(t));return this.setState({error:a}),"retryable"}finally{this.activeController=null}}};var Me=null,Es=e=>{if(Me!==null&&Me.endpoint===e)return Me;if(Ra(e),Me===null)return Me=new Ma({endpoint:e}),Me;if(Me.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Me.endpoint)} and cannot also stream from ${JSON.stringify(e)}; give every contact-map view in the browser tab the same streamEndpoint, on every route (after changing it, reload the page)`);return Me},dc=()=>{Me?.dispose(),Me=null},Os=new Map,Ws={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Ds=()=>{let{streamEndpoint:e}=Ve();return La(()=>(Ra(e),e),[e])};function Hs(){let e=Ds(),t=Sn(()=>Es(e),[e]);Ls(()=>{let o=t();o.start(),o.retryNow()},[t]);let a=Sn(o=>t().subscribe(o),[t]),r=vr(a,()=>t().getState(),()=>Ws),s=vr(a,()=>t().getRecordMap(),()=>Os),n=Sn(()=>t().retryNow(),[t]);return La(()=>({...r,recordMap:s,retryNow:n}),[r,s,n])}var _s=e=>{let t=new Set;for(let{company_name:a}of e)typeof a=="string"&&a.trim().length>0&&t.add(a);return t.size};function Ea(){let{records:e,recordMap:t,isComplete:a,phase:r,loadedCount:s,totalCount:n,error:o,retryNow:c}=Hs(),l=La(()=>_s(e),[e]);return{context:La(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:a,isStreamingFailed:r==="failed",streamPhase:r,loadedCount:s,companyCount:l,totalCount:n,errorMessage:o?.message??null}),[e,t,a,r,s,l,n,o]),retryNow:c}}se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Fn}from"@aiquants/fuzzy-search";import{useFuzzySearch as ol}from"@aiquants/fuzzy-search/react";import sl from"lucide-react/dist/esm/icons/search.js";import{useCallback as ra,useEffect as je,useMemo as kt,useRef as ro,useState as Ae,useTransition as il}from"react";import{useNavigation as ll,useSearchParams as dl}from"react-router";mn();Rt();import{useCallback as xt,useEffect as As,useRef as Cr}from"react";var nt=e=>{let t=Cr(null),a=Cr({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),r=e?.dragThreshold??4,s=xt(p=>{let i=p.currentTarget,u=p.deltaY;!i||u===0||(p.preventDefault(),i.scrollBy({left:u,behavior:"smooth"}))},[]),n=xt(p=>{t.current?.removeEventListener("wheel",s),t.current=p,p?.addEventListener("wheel",s,{passive:!1})},[s]);As(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let o=xt(p=>{if(p.pointerType==="touch")return;let i=a.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=p.clientX,i.scrollLeft=p.currentTarget.scrollLeft,i.pointerId=p.pointerId,i.hasCapture=!1,i.pointerType=p.pointerType},[]),c=xt(p=>{let i=a.current;if(!i.isPointerDown||i.pointerType==="touch")return;let u=p.currentTarget,h=p.clientX-i.startX;!i.isDragging&&Math.abs(h)>r&&(i.isDragging=!0,i.hasCapture||(u.setPointerCapture?.(p.pointerId),i.hasCapture=!0)),i.isDragging&&(p.preventDefault(),u.scrollLeft=i.scrollLeft-h)},[r]),l=xt(p=>{let i=a.current;if(i.pointerType==="touch")return;let u=p.currentTarget;i.isPointerDown&&i.hasCapture&&u.hasPointerCapture?.(p.pointerId)&&u.releasePointerCapture(p.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),d=xt(p=>{l(p)},[l]),m=xt(p=>{a.current.didDrag&&(p.preventDefault(),p.stopPropagation(),a.current.didDrag=!1)},[]);return{setScrollableRef:n,onPointerDown:o,onPointerMove:c,onPointerUp:d,onPointerLeave:d,onPointerCancel:d,onClickCapture:m}};mt();se();import{jsx as kr}from"react/jsx-runtime";function Sr({value:e,max:t=100,className:a,indicatorClassName:r,...s}){let n=e===void 0,o=n?0:Math.min(100,Math.max(0,e/t*100));return kr("div",{role:"progressbar","aria-valuenow":n?void 0:o,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:ft("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",a),...s,children:kr("div",{"data-slot":"progress-indicator",className:ft("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",n&&"w-1/3 animate-progress-indeterminate",r),style:n?void 0:{width:`${o}%`}})})}import{useCallback as ji,useState as qi}from"react";import{useSearchParams as Gi}from"react-router";se();ht();import{Panel as Lr,PanelGroup as Js,PanelResizeHandle as Xs}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Zs,VirtualScroll as ei}from"@aiquants/virtualscroll";import{lazy as ti,memo as ai,Suspense as ni,useCallback as Ke,useEffect as Wr,useLayoutEffect as Dr,useMemo as ea,useRef as ta,useState as _a}from"react";var Jt={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},Xt={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function Oa(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,a=t+e.scrollbarSafetyBuffer,r=a+e.hysteresisSafetyMargin,s=r-a;return{physicalMinWidth:t,collapseThreshold:a,expandThreshold:r,hysteresisWidth:s}}import{useCallback as Is,useEffect as Fs,useState as zs}from"react";var Tr=(e,t)=>{let{enableMutationObserver:a=!1,bottomGap:r=4,minFallbackHeight:s=240}=t??{},[n,o]=zs(600),c=Is(()=>{if(typeof window>"u")return;let l=e.current;if(!l||l.offsetParent===null&&window.getComputedStyle(l).position!=="fixed")return;let d=v=>Number.parseFloat(v)||0,{top:m}=l.getBoundingClientRect(),p=l.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),u=d(i.getPropertyValue("--footer-height")),h=d(i.getPropertyValue("--header-height")),k=d(i.getPropertyValue("--scrollbar-height")),C=window.getComputedStyle(l),S=d(C.marginBottom),B=d(C.paddingBottom),N=window.innerHeight-u-k-r,y=p?Math.min(p.bottom,N):N,g=p?Math.max(p.top,h):h,O=Math.max(m,g),V=y-O-S-B,b=Number.isFinite(V)?Math.floor(V):0,f=b>0?b:s;f>0&&Number.isFinite(f)&&o(v=>Math.abs(v-f)>1?f:v)},[r,e,s]);return Fs(()=>{if(typeof window>"u")return;let l=null,d=null,m=null,p=null,i=()=>{l!==null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{c()})};i(),d=window.setTimeout(()=>{i()},150);let u=e.current;return typeof ResizeObserver<"u"&&u&&(m=new ResizeObserver(()=>{i()}),m.observe(u),u.parentElement&&m.observe(u.parentElement)),a&&typeof MutationObserver<"u"&&(p=new MutationObserver(()=>{i()}),p.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{l!==null&&window.cancelAnimationFrame(l),d!==null&&window.clearTimeout(d),m&&m.disconnect(),p&&p.disconnect(),window.removeEventListener("resize",i)}},[e,a,c]),{viewportHeight:n,updateViewportHeight:c}};import{useCallback as rt,useEffect as wr,useRef as Zt,useState as Nr}from"react";var Bs=600,Pr=8,Wa=({ref:e,onSelect:t,resolveItem:a,item:r})=>{let[s,n]=Nr(!1),[o,c]=Nr(null),l=Zt(null),d=Zt(!1),m=Zt(!1),p=Zt(null),i=Zt({onSelect:t,resolveItem:a,item:r});wr(()=>{i.current={onSelect:t,resolveItem:a,item:r}},[t,a,r]);let u=rt(()=>{typeof window>"u"||l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),h=rt(()=>{p.current&&(u(),m.current=!1,p.current=null)},[u]),k=rt(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(u(),m.current=!1,d.current=!1,p.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},l.current=window.setTimeout(()=>{let O=i.current,V=null;O.item!==void 0?V=O.item:O.resolveItem&&g.target&&(V=O.resolveItem(g.target)),V!==null&&(d.current=!0,O.onSelect?.(V),c(V),n(!0)),h()},Bs))},[u,h]),C=rt(g=>{p.current&&g.pointerId===p.current.pointerId&&(u(),p.current=null,m.current=!1)},[u]),S=rt(g=>{d.current&&(g.preventDefault(),g.stopPropagation(),d.current=!1)},[]),B=rt(g=>{if(!p.current||g.pointerId!==p.current.pointerId)return;let O=Math.abs(g.clientX-p.current.x),V=Math.abs(g.clientY-p.current.y);(O>Pr||V>Pr)&&(u(),p.current=null)},[u]),N=rt(g=>{(s||l.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),y=rt(g=>{g?.cancelLongPressTimer&&u(),g?.suppressLongPress&&(m.current=!0),n(!1),c(null),d.current=!1,p.current=null},[u]);return wr(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let O=[["pointerdown",k,void 0],["pointerup",C,void 0],["pointercancel",C,void 0],["pointermove",B,void 0],["pointerleave",C,void 0],["click",S,!0],["contextmenu",N,void 0]],V=[["contextmenu",N,!0],["pointerup",C,!0],["pointercancel",C,!0]];for(let[b,f,v]of O)g.addEventListener(b,f,v);for(let[b,f,v]of V)window.addEventListener(b,f,v);return()=>{for(let[b,f,v]of O)g.removeEventListener(b,f,v);for(let[b,f,v]of V)window.removeEventListener(b,f,v);u()}},[e,k,C,B,S,N,u]),{isPopupVisible:s,popupItem:o,handleClosePopup:y}};import{useCallback as Us,useEffect as $s,useState as Mr,useSyncExternalStore as Vs}from"react";function Da(e,t,a){let r=a?.mediaQuery??"(min-width: 1024px)",s=Vs(Us(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let p=window.matchMedia(r);return p.addEventListener("change",m),()=>p.removeEventListener("change",m)},[r]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(r).matches:!0,()=>!1),[n,o]=Mr(!1),[c,l]=Mr(0);return $s(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let p=new ResizeObserver(i=>{for(let u of i){if(u.target!==m)continue;let h=0;u.borderBoxSize&&u.borderBoxSize.length>0?h=u.borderBoxSize[0].inlineSize:h=u.contentRect.width,!(!Number.isFinite(h)||h<=0)&&(l(h),o(k=>k&&h>=t.expandThreshold?!1:!k&&h<t.collapseThreshold?!0:k))}});return p.observe(m),()=>p.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!n,isContainerNarrow:n,isMediaMatches:s,containerWidth:c}}se();se();import{useSwipeToDismissOverlay as Ks,useTapClick as js}from"@aiquants/swipe-overlay";import{useCallback as qs,useEffect as Gs,useRef as Qs}from"react";import{jsx as Rr,jsxs as Ys}from"react/jsx-runtime";var Ha=({isOpen:e,onClose:t,children:a,className:r="",title:s})=>{let n=q(),o=Qs(null),{overlayRef:c,overlayStyle:l,attemptClose:d}=Ks({isOpen:e,onClose:t,isCloseBlocked:qs(()=>!1,[]),skipWhenTextSelected:!0}),m=js(()=>d());return Gs(()=>{!e&&o.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?Ys("div",{ref:o,"data-testid":"contact-map-mobile-overlay",className:`fixed top-0 bottom-0 left-0 z-50 flex touch-manipulation transition-[visibility] duration-200 ${e?"pointer-events-auto visible":"pointer-events-none invisible"}`,style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[Rr("button",{type:"button","aria-label":n.overlayBackdrop,className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...m}),Rr("aside",{role:"dialog","aria-modal":"true","aria-label":s===void 0?n.overlayTitle:s,style:l,ref:c,className:`relative ml-auto flex h-full w-full max-w-lg transform touch-pan-y flex-col bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900 ${r}`,onKeyDown:p=>{p.key==="Escape"&&(p.stopPropagation(),d())},children:a})]}):null};pn();import{Fragment as yi,jsx as _,jsxs as be}from"react/jsx-runtime";var ri=ti(async()=>({default:(await Promise.resolve().then(()=>(cr(),dr))).default})),Hr=64,Er="h-[64px]",Or=240,oi=4,Tn=Oa(Jt),si=Jt.listPanelMinWidth,ii=Jt.detailPanelMinWidth,li=Jt.handleThickness,zc=Tn.collapseThreshold,Bc=Tn.expandThreshold,di=({contactData:e})=>{let t=q(),a=e?.full_name??t.noName,r=e?.title??"-",s=e?.company_name??"-",n=e?.department??"-",o=e?.email??"-",c=e?.company_phone_number??e?.mobile_phone_number??"-",l=e?.updated_at?we(e.updated_at):"-";return _(va,{fullName:a,title:r,companyName:s,department:n,phoneNumber:c,email:o,updatedAtText:l})},ci=e=>({"--contact-panel-height":`${e}px`}),pi=e=>typeof e=="object"&&e!==null&&"item"in e,ui=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,mi=(e,t)=>{for(let a of e){let r=fa(a);if(r?.person_id===t)return r}return null},wn=(e,t,a)=>{let{viewportHeight:r}=Tr(t,{enableMutationObserver:!0,bottomGap:oi,minFallbackHeight:Or}),[s,n]=_a(0),o=Ke(()=>{let p=a.current,i=t.current;if(!(p&&i))return;let u=p.getBoundingClientRect(),h=i.getBoundingClientRect(),k=Math.ceil(h.top-u.top);Number.isFinite(k)&&k>0&&n(C=>Math.abs(C-k)>1?k:C)},[t,a]);Dr(()=>{if(!e)return;o();let p=requestAnimationFrame(o);return window.addEventListener("resize",o),()=>{cancelAnimationFrame(p),window.removeEventListener("resize",o)}},[e,o]);let c=r>0?r:Or,l=s>0?s:0,d=c+l,m=ea(()=>ci(d),[d]);return{normalizedViewportHeight:c,normalizedDetailHeight:d,panelSizingStyle:m}},gi=new Set,hi=()=>{let[e,t]=_a(gi),a=Ke((r,s)=>{t(n=>{if(n.has(r)===s)return n;let o=new Set(n);return s?o.add(r):o.delete(r),o})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:a}},fi=(e,t,a)=>{let r=ta(a);Dr(()=>{r.current=a},[a]),Wr(()=>{if(e!==null)return r.current(e,t),()=>{r.current(e,!1)}},[e,t])},_r=ai(({entry:e,index:t,selectedPersonId:a,onSelect:r,searchQuery:s,enableHighlighting:n,openEmailsWithGmail:o,openGmailCompose:c,onPopupVisibilityChange:l})=>{let d=q(),m=ta(null),p=_("div",{className:Er}),i=pi(e)?e:null,u=fa(e),{isPopupVisible:h,handleClosePopup:k}=Wa({ref:m,onSelect:r,item:u?.person_id});if(fi(u?.person_id??null,h,l),!e||!u)return p;let{person_id:C}=u,S=a===C,B=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",y=S?"border-blue-300 bg-blue-50 ring-1 ring-blue-200 dark:border-blue-500 dark:bg-blue-500/20 dark:ring-blue-500/40":B,g=["B","F"].map(O=>ui(O,O==="B"?i?.baseScore:i?.score)).filter(Boolean);return be("div",{ref:m,className:`flex ${Er} w-full items-center overflow-hidden border-gray-200 border-b px-4 py-2 text-left transition-colors hover:bg-blue-50 dark:border-slate-700 dark:hover:bg-blue-500/10 ${y}`,style:{height:Hr},role:"button","aria-pressed":S,"data-selected":S?"true":"false",onClick:()=>r(C),children:[be("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[_("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:d.listRowNumber(t+1)}),_("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:C}),_("div",{className:"flex items-center gap-1 whitespace-nowrap font-mono text-[11px] text-slate-600 leading-tight dark:text-slate-300",children:g.length?g.map(O=>_("span",{children:O},O)):_("span",{children:"-"})})]}),_(ni,{fallback:_(di,{contactData:u}),children:_(ri,{contactData:u,searchTerm:s,enableHighlighting:n,openEmailsWithGmail:o,openGmailCompose:c,isPopupVisible:h,onRequestClose:k})})]})});_r.displayName="ContactListRow";var Ar=({context:e})=>{let{contactMapRecords:t,filteredItems:a,searchQuery:r,hasSearchTerm:s,enableHighlighting:n,openEmailsWithGmail:o,isSearchTabActive:c}=e,{locale:l,labels:d,engineLabels:m}=fe(),p=ta(null),i=ta(null),[u,h]=_a(null),{normalizedViewportHeight:k,panelSizingStyle:C}=wn(c,i,p),{isAnyPopupVisible:S,handlePopupVisibilityChange:B}=hi(),N=ea(()=>({enablePointerDrag:!S,enableKeyboardNavigation:!S}),[S]),y=ea(()=>s?a:t,[s,a,t]),g=Ke(re=>{h(re)},[]),O=Ke(re=>{if(!o)return;let te=re.trim();if(!te||te==="-"||typeof window>"u")return;let st=$e(te,!0);st&&window.open(st,"_blank","noopener,noreferrer")},[o]),[V,b]=_a(!1),f=Ke(re=>{g(re),b(!0)},[g]),v=Ke((re,te)=>_(_r,{entry:re,index:te,selectedPersonId:u,onSelect:f,searchQuery:r,enableHighlighting:n,openEmailsWithGmail:o,openGmailCompose:O,onPopupVisibilityChange:B}),[u,f,r,n,o,O,B]),W=Ke(re=>y[re],[y]),D=Ke(re=>fa(y[re])?.person_id??`row-${re}`,[y]),X=Ke(()=>Hr,[]),P=y.length,M=ea(()=>({enabled:!0,renderVisual:Zs}),[]),H=ea(()=>u===null?null:mi(y,u),[u,y]);Wr(()=>{u!==null&&!H&&h(null)},[u,H]);let U=ta(null),{isTwoColumn:ee}=Da(U,Tn),pe=be("div",{ref:p,className:"flex min-h-0 flex-1 flex-col gap-1",children:[_("div",{className:"hidden rounded-t-lg border border-gray-200 bg-gray-50 px-4 py-2 transition-colors sm:block dark:border-slate-700 dark:bg-slate-900/70",children:be("div",{className:"flex items-center",children:[be("div",{className:"flex w-28 shrink-0 flex-col items-center gap-0.5 text-center text-[11px] text-slate-700 uppercase tracking-wider dark:text-slate-200",children:[_("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:d.columnNo}),_("span",{className:"leading-tight",children:d.columnId}),_("span",{className:"whitespace-nowrap leading-tight",children:d.columnScore})]}),be("div",{className:"hidden w-full grid-cols-3 gap-2 font-medium text-slate-700 text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[be("div",{className:"flex flex-col gap-0.5",children:[_("span",{children:d.columnName}),_("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnTitle})]}),be("div",{className:"flex flex-col gap-0.5",children:[_("span",{children:d.columnCompany}),_("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnDepartment})]}),be("div",{className:"flex flex-col gap-0.5",children:[_("span",{children:d.columnPhone}),_("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnEmail})]}),_("div",{className:"hidden items-end justify-end xl:flex",children:_("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnUpdatedAt})})]})]})}),_("div",{ref:i,className:"flex-1",children:_(ei,{itemCount:P,getItemKey:D,behaviorOptions:N,getItem:W,getItemHeight:X,viewportSize:k,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:M},locale:l,labels:m,className:"w-full rounded-b-lg border border-gray-200 border-t-0 bg-white pr-0.75 transition-colors dark:border-slate-700 dark:bg-slate-950",children:(re,te)=>v(re,te)})}),a.length===0&&s?_("div",{className:"py-8 text-center",children:_("p",{className:"text-slate-600 dark:text-slate-300",children:d.listNoSearchResults})}):null,P===0&&!s?_("div",{className:"py-8 text-center",children:_("p",{className:"text-slate-600 dark:text-slate-300",children:d.listNoData})}):null]});return _("div",{ref:U,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:C,children:ee?be(Js,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[_(Lr,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:si,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:pe}),_(Xs,{id:"contact-map-list-handle",thickness:li,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":d.listResizeHandle}),_(Lr,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:ii,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:_(tt,{contact:H,searchTerm:r,enableHighlighting:n})})]}):be(yi,{children:[pe,_("div",{className:"hidden","aria-hidden":"true",children:_(tt,{contact:H,searchTerm:r,enableHighlighting:n})}),H?_(Ha,{isOpen:V,onClose:()=>b(!1),className:"z-50 bg-white dark:bg-slate-900",children:be("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[be("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[_("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:d.detailHeading}),_("button",{type:"button",onClick:()=>b(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:d.close})]}),_("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:_(tt,{contact:H,searchTerm:r,enableHighlighting:n})})]})}):null]})})};ht();import{DirectoryTree as Mi}from"@aiquants/directory-tree";import{Panel as Vr,PanelGroup as Ri,PanelResizeHandle as Li}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Ei}from"@aiquants/virtualscroll";import Oi from"@heroicons/react/24/solid/FolderMinusIcon.js";import Wi from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as De,useEffect as Ct,useMemo as Re,useRef as za,useState as ot}from"react";import{createPortal as Di}from"react-dom";var Nn=(e,t)=>e&&e.trim()||t;import{useEffect as bi,useRef as Aa,useState as xi}from"react";var Ir=(e,t=250)=>{let[a,r]=xi(e),s=Aa(null),n=Aa(e),o=Aa(null),c=Aa(!1);return bi(()=>{if(!c.current){c.current=!0,r(e),n.current=e;return}n.current=a,s.current=null;let l=d=>{s.current??(s.current=d);let m=d-s.current,p=Math.min(1,Math.max(0,m/t)),i=1-(1-p)**3,u=Math.max(0,Math.round(n.current+(e-n.current)*i));r(u),p<1&&(o.current=requestAnimationFrame(l))};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current)}},[e,t]),Math.max(0,a)};Pt();import{useCallback as Pn,useEffect as Mn,useMemo as Fr,useRef as vi,useSyncExternalStore as Ci}from"react";se();var ki=250,Si=4e3,Ia=3,zr={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},Br=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,Fa=class{constructor(t,{workerSource:a,logger:r=We}){this.worker=null;this.generation=0;this.postedCount=0;this.latestSnapshot=null;this.workerNeedsReset=!1;this.lastSyncedRecords=[];this.postedNaming=null;this.lastSyncedNaming=null;this.consecutiveFailures=0;this.finalizeRequest=null;this.finalizedPostedCount=null;this.retryTimer=null;this.listeners=new Set;this.state={snapshot:null,isBuilding:!1};this.getState=()=>this.state;this.subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));this.handleMessage=t=>{let a=t.data;a.type!=="TREE_CHUNK"||a.generation!==this.generation||a.uniquePersonCount===0&&this.postedCount>0&&(this.latestSnapshot?.uniquePersonCount??0)>0||this.latestSnapshot!==null&&a.uniquePersonCount<this.latestSnapshot.uniquePersonCount&&!(a.isIdle&&a.consumedRecords>=this.postedCount)||(a.isIdle&&a.consumedRecords>=this.postedCount&&(this.consecutiveFailures=0),this.latestSnapshot={tree:a.tree,directoryPaths:a.directoryPaths,consumedRecords:a.consumedRecords,uniquePersonCount:a.uniquePersonCount,isIdle:a.isIdle,rebuildEpoch:a.rebuildEpoch},this.updateState())};this.handleFailure=t=>{if(this.worker?.terminate(),this.worker=null,this.postedCount=0,this.consecutiveFailures+=1,this.updateState(),this.consecutiveFailures>=Ia){this.logger.error(`[TreeWorker] the tree Worker failed ${Ia} times in a row; the tree stops updating until ${zr[this.workerSource]} (check ${this.workerSource})`,t);return}let a=Math.min(ki*2**(this.consecutiveFailures-1),Si);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${a}ms (failure ${this.consecutiveFailures} of ${Ia})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let r=this.lastSyncedNaming;r!==null&&this.syncRecords(this.lastSyncedRecords,r)},a)};if(typeof a!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${ae(a)}`);if(!Object.hasOwn(zr,a))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${ae(a)}`);this.workerFactory=t,this.workerSource=a,this.logger=r}updateState(){let t=this.postedCount>(this.latestSnapshot?.consumedRecords??0);this.state.snapshot===this.latestSnapshot&&this.state.isBuilding===t||(this.state={snapshot:this.latestSnapshot,isBuilding:t},this.notify())}notify(){for(let t of this.listeners)t()}ensureWorker(){if(this.consecutiveFailures>=Ia||this.retryTimer!==null)return null;if(!this.worker)try{this.worker=this.workerFactory(),this.workerNeedsReset=!0,this.worker.onerror=this.handleFailure,this.worker.onmessageerror=this.handleFailure,this.worker.onmessage=this.handleMessage}catch(t){return this.handleFailure(t),null}return this.worker}syncRecords(t,a){this.finalizeRequest!==null&&(t.length<this.finalizeRequest.recordCount||this.finalizeRequest.naming===null||!Br(this.finalizeRequest.naming,a))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=a;let r=this.ensureWorker();if(!r)return;let s=this.workerNeedsReset,n=this.postedNaming===null||!Br(this.postedNaming,a);if((this.workerNeedsReset||n||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=a,r.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:a}),this.updateState()),t.length>this.postedCount){let o=t.slice(this.postedCount);this.postedCount=t.length,r.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:o}),this.updateState()}s&&this.finalizeRequest!==null&&this.finalize()}finalize(){this.finalizeRequest={recordCount:this.lastSyncedRecords.length,naming:this.lastSyncedNaming},!(this.worker===null||this.finalizedPostedCount===this.postedCount)&&(this.finalizedPostedCount=this.postedCount,this.worker.postMessage({type:"FINALIZE_TREE",generation:this.generation}))}cancelWorker(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.worker?.terminate(),this.worker=null,this.postedCount=0,this.postedNaming=null,this.finalizedPostedCount=null}stop(){this.cancelWorker(),this.consecutiveFailures=0,this.updateState()}reset(){this.cancelWorker(),this.listeners.clear(),this.latestSnapshot=null,this.lastSyncedRecords=[],this.lastSyncedNaming=null,this.consecutiveFailures=0,this.finalizeRequest=null,this.state={snapshot:null,isBuilding:!1}}},Ti=e=>{if(e!==void 0)return new Worker(e,{type:"module"});let t=typeof import.meta<"u"?import.meta.url:void 0;if(t){let r=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(r,t),{type:"module"})}throw new Error("[contact-map] the tree Worker needs workerUrls.treeWorker in a build without import.meta.url (CommonJS)")},vt=null,Ur=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),wi=e=>{if(e===void 0)throw new Error("[contact-map] treeWorkerFactory was removed from the config while its tree session was still in use");return e},Ni=e=>{if(fr(e),vt===null){let t=new Fa(()=>Ti(e),{workerSource:"workerUrls.treeWorker"});return vt={session:t,workerUrl:e},t}if(vt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${Ur(vt.workerUrl)} and cannot also load it from ${Ur(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return vt.session},Zc=()=>{vt?.session.reset(),vt=null},Pi={snapshot:null,isBuilding:!1};function $r(e,t=!1){let a=Ve(),r=a.treeWorkerFactory,s=a.workerUrls?.treeWorker,{labels:n}=fe(),o=n.uncategorizedCompany,c=n.noName,l=Fr(()=>({uncategorizedCompany:o,unnamedPerson:c}),[o,c]),d=vi(r);Mn(()=>{d.current=r},[r]);let m=r!==void 0,p=m?void 0:s,i=Fr(()=>m?new Fa(()=>wi(d.current)(),{workerSource:"treeWorkerFactory"}):null,[m]),u=Pn(()=>i===null?Ni(p):i,[i,p]),h=Pn(C=>u().subscribe(C),[u]),k=Pn(()=>u().getState(),[u]);return Mn(()=>{let C=u();C.syncRecords(e,l),t&&C.finalize()},[u,e,t,l]),Mn(()=>{if(i!==null)return()=>i.stop()},[i]),Ci(h,k,()=>Pi)}se();cn();Sa();import{Fragment as Ki,jsx as A,jsxs as ue}from"react/jsx-runtime";var En=Oa(Xt),Hi=Xt.listPanelMinWidth,_i=Xt.detailPanelMinWidth,Ai=Xt.handleThickness,kp=En.collapseThreshold,Sp=En.expandThreshold,Ii=(e,t)=>{let{searchQuery:a,enableHighlighting:r}=t,s=Nn(e.full_name,t.noName),n=Nn(e.title,""),o=A(ce,{text:s,query:a,enabled:r});return n?ue("span",{className:"flex items-center gap-1.5",children:[A("span",{children:o}),A("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:A(ce,{text:n,query:a,enabled:r})})]}):o},Fi="contact-map-tree h-full w-full",zi={hoverClassName:"bg-slate-100/70 dark:bg-slate-800/60",directorySelectedClassName:"bg-sky-100/55 dark:bg-sky-900/40 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300",itemSelectedClassName:"bg-sky-100/70 dark:bg-sky-900/55 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300"},Rn="h-4 w-4 shrink-0 transition-colors duration-150",Bi=(e,t,a)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!a,enableKeyboardNavigation:!a}}),Ba=null,Kr=null,aa=new Map,jr="",qr=null,Gr=null,Ui=(e,t,a,r,s)=>{let n=`${a?"icons":"plain"}#${r}#${s.noName}`;(n!==jr||s.formatDirectoryName!==qr||t!==Gr)&&(aa.clear(),jr=n,qr=s.formatDirectoryName,Gr=t);let o={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},c=new Set;for(let l of e){c.add(l.absolutePath);let d=`${l.name}\0${l.memberCount}`,m=aa.get(l.absolutePath);(!m||m.signature!==d)&&(m={signature:d,result:Yr([l],t,a,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},aa.set(l.absolutePath,m));let p=m.result;p.entries.length>0&&o.entries.push(p.entries[0]);for(let[i,u]of p.personPathMap){let h=o.personPathMap.get(i);if(h)for(let k of u)h.add(k);else o.personPathMap.set(i,new Set(u))}for(let[i,u]of p.contactByPath)o.contactByPath.set(i,u);for(let[i,u]of p.ancestorsByPath)o.ancestorsByPath.set(i,u);o.totalCount+=p.totalCount,!o.firstPerson&&p.firstPerson&&(o.firstPerson=p.firstPerson)}for(let l of aa.keys())c.has(l)||aa.delete(l);return o},Ln=e=>e.isSelected||e.isItemSelected?"text-sky-600 dark:text-sky-300":e.isExpanded&&e.isDirectory?"text-slate-600 dark:text-slate-200":"text-slate-500 dark:text-slate-400",Qr=e=>{let t=[];for(let a of e)a.type==="directory"&&(t.push(a.absolutePath),a.children&&t.push(...Qr(a.children)));return t},$i=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Yr=(e,t,a,r,s)=>{let n=new Map,o=new Map,c=new Map,l=0,d=null,m=(i,u)=>{let h=[...u,i.absolutePath];c.set(i.absolutePath,h);let k,C,S=i.type==="directory"?r.formatDirectoryName(i.name,$i(i)):i.name,B=A(ce,{text:S,query:r.searchQuery,enabled:r.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let N=t.get(i.personId);if(N){o.set(i.absolutePath,N),n.has(i.personId)||n.set(i.personId,new Set);let y=n.get(i.personId);y&&y.add(i.absolutePath),l++,d||(d={personId:i.personId,path:i.absolutePath}),a&&(C=g=>{let O=Ln(g);return g.isSelected||g.isItemSelected||i.isPrimary&&(O=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),A(a.person,{"aria-hidden":"true",className:`${Rn} ${O}`})},i.title&&(B=Ii(N,r))),B=A("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:B})}}else if(i.children){let N=i.children.map(y=>m(y,h)).filter(y=>y!==null);if(s&&N.length===0)return null;if(k=N,a){let y=i.relativePath.startsWith("company:")?a.company:a.department;C=g=>A(y,{"aria-hidden":"true",className:`${Rn} ${Ln(g)}`})}}return{name:S,label:B,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:C,children:k}};return{entries:e.map(i=>m(i,[])).filter(i=>i!==null),personPathMap:n,contactByPath:o,ancestorsByPath:c,firstPerson:d,totalCount:l}},Vi=(e,t,a)=>{let r=new Set,s=new Set,n=new Map;t.forEach((m,p)=>{n.set(m.item.person_id,p)});for(let m of t){let p=m.item.person_id,i=e.personPathMap.get(p);if(i)for(let u of i){r.add(u);let h=e.ancestorsByPath.get(u);if(h){for(let k of h)r.add(k);a&&h.length>0&&s.add(h[0])}}}let o=new Map,c=m=>{let p=o.get(m.absolutePath);if(p!==void 0)return p;let i=1/0;if(m.type==="file"){let u=e.contactByPath.get(m.absolutePath);u&&(i=n.get(u.person_id)??1/0)}else if(m.children)for(let u of m.children)i=Math.min(i,c(u));return o.set(m.absolutePath,i),i},l=(m,p=0)=>m.filter(i=>a&&p===0&&s.has(i.absolutePath)?!0:r.has(i.absolutePath)).map(i=>a&&p===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:l(i.children,p+1)}:i).sort((i,u)=>p===0?c(i)-c(u):0),d=l(e.entries);return{...e,entries:d}},Jr=({context:e,controlsContainer:t})=>{let{contactMapRecords:a,contactMapRecordMap:r,filteredItems:s,hasSearchTerm:n,isSearchInProgress:o,isSearchTabActive:c}=e,{locale:l,labels:d,treeLabels:m}=fe(),p=d.noName,i=d.treeDirectoryName,u=Re(()=>({noName:p,formatDirectoryName:i}),[p,i]),[h,k]=ot(null),[C,S]=ot(!1),{snapshot:B,isBuilding:N}=$r(a,e.isStreamingComplete),y=B?.tree??null,g=B?.rebuildEpoch??0,O=Re(()=>y?Ui(y,r,h,g,u):null,[y,r,h,g,u]),V=Re(()=>{if(!y)return null;if(!n)return O;let x;C||(x=new Set(s.map(F=>F.item.person_id)));let T=Yr(y,r,h,{...u,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},x);return Vi(T,s,C)},[y,O,r,h,e.searchQuery,e.enableHighlighting,n,s,C,u]),b=Re(()=>V||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[V]),f=n&&e.errorMessage!==null,[v,W]=ot(b),D=za(!1);Ct(()=>{if(!(o||f)){D.current=!!y,W(b);return}!D.current&&y&&b.entries.length>0&&(D.current=!0,W(b))},[b,y,o,f]);let X=n&&(o||f)?v:b,{entries:P,personPathMap:M,contactByPath:H,totalCount:U}=X,ee=Re(()=>Qr(P),[P]),[pe,re]=ot(()=>Kr??new Set),te=De(x=>!pe.has(x),[pe]),st=De(x=>{re(T=>{let F=new Set(T);return F.has(x)?F.delete(x):F.add(x),F})},[]),it=De(x=>{x.length!==0&&re(T=>{let F=new Set(T);for(let le of x)F.add(le);return F})},[]),At=De(x=>{re(T=>{if(T.size===0)return T;let F=!1,le=new Set(T);for(let Nt of x)le.delete(Nt)&&(F=!0);return F?le:T})},[]);Ct(()=>{Kr=pe},[pe]),Ct(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[Ie,lt]=ot(null),[he,It]=ot(null),[qe,Ft]=ot(!1),[$a,oe]=ot(!1),zt=za(null),Ge=za(null),{normalizedViewportHeight:Fe,panelSizingStyle:ke}=wn(c,Ge,zt),St=De(x=>{let T=H.get(x);T&&(Ie!==T.person_id&<(T.person_id),x!==he&&It(x),Ft(!0))},[H,he,Ie]),oa=De(x=>{St(x.entry.absolutePath)},[St]),Le=De(x=>x instanceof Element?x.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:Bt,popupItem:dt,handleClosePopup:Qe}=Wa({ref:Ge,resolveItem:Le,onSelect:St}),Ye=De(x=>{if(!e.openEmailsWithGmail)return;let T=x.trim();if(!T||T==="-"||typeof window>"u")return;let F=$e(T,!0);F&&window.open(F,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),ze=dt?H.get(dt):null,Je=Bt&&ze!==null&&ze!==void 0;Ct(()=>{Bt&&!ze&&Qe()},[Bt,ze,Qe]);let sa=Re(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Ei}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Ut=Re(()=>Bi(sa,Fe,Je),[sa,Fe,Je]);Ct(()=>{let x=!1;return typeof window>"u"?()=>{x=!0}:Ba?(k(Ba),()=>{x=!0}):((async()=>{try{let[F,le,Nt,Ze]=await Promise.all([import("lucide-react/dist/esm/icons/building-2.js"),import("lucide-react/dist/esm/icons/users-round.js"),import("lucide-react/dist/esm/icons/id-card.js"),import("lucide-react/dist/esm/icons/user-round.js")]);if(x)return;let pt=F.default,Ga=le.default,$n=Nt.default,Vn=Ze.default;pt&&Ga&&$n&&Vn&&(Ba={company:pt,department:Ga,title:$n,person:Vn},k(Ba))}catch(F){We.warn("Failed to load lucide icons",F)}})(),()=>{x=!0})},[]);let Se=Re(()=>{if(!h)return;let x=Ze=>pt=>A(Ze,{"aria-hidden":"true",className:`${Rn} ${Ln(pt)}`}),T={company:x(h.company),department:x(h.department),title:x(h.title)},F=x(h.person),le=Ze=>Ze in T,Nt=Ze=>{let[pt]=Ze.entry.relativePath.split(":",1);return(le(pt)?T[pt]:T.company)(Ze)};return{directory:Nt,directoryExpanded:Nt,file:F}},[h]),Va=De(()=>{re(x=>x.size===0?x:new Set)},[]),Ka=De(()=>{ee.length>0&&it(ee)},[ee,it]);Ct(()=>{if(typeof window>"u")return;let x=document.documentElement,T=window.matchMedia("(prefers-color-scheme: dark)"),F=()=>oe(x.classList.contains("dark")||T.matches);F(),T.addEventListener("change",F);let le=new MutationObserver(F);return le.observe(x,{attributes:!0,attributeFilter:["class"]}),()=>{T.removeEventListener("change",F),le.disconnect()}},[]),Ct(()=>{if(U===0){Ie!==null&<(null),he!==null&&It(null);return}if(Ie!==null){let x=M.get(Ie);if(x){if(he&&x.has(he))return;let T=x.values().next().value;T&&It(T);return}}Ie!==null&<(null),he!==null&&It(null)},[U,Ie,he,M]);let Tt=he?H.get(he)??null:null,$t=$a?"#475569":"#94A3B8",wt=e.isStreamingComplete,Xe=e.isStreamingFailed,ct=wt&&a.length===0,ja=(N||!y)&&!ct,ia=Ir(U,250),la=y!==null||ct,da=ue("div",{className:"flex items-center gap-1.5",children:[ue("span",{className:"inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono text-[10px] text-slate-700 dark:bg-slate-800 dark:text-slate-200",title:d.treeNodeCountTitle,children:[A("span",{className:"text-[10px]",children:"\u{1F333}"})," ",d.treeNodeCountLabel," ",la?d.treeNodeCount(ia):"\u2026"]}),Xe&&!wt?ue("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium text-[10px] text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300",title:d.treeStreamInterruptedTitle,children:[A("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),A("span",{className:"text-[10px]",children:"\u26D4"})," ",d.treeStreamInterrupted]}):wt?ja?ue("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium text-[10px] text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:d.treeBuildingTitle,children:[ue("span",{className:"relative flex h-1.5 w-1.5",children:[A("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),A("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),A("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",d.treeBuilding]}):ue("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium text-[10px] text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300",title:d.treeCompleteTitle,children:[A("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),A("span",{className:"text-[10px]",children:"\u2705"})," ",d.treeComplete]}):ue("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium text-[10px] text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300",title:d.treeStreamLoadingTitle,children:[ue("span",{className:"relative flex h-1.5 w-1.5",children:[A("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),A("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),A("span",{className:"text-[10px]",children:"\u23F3"})," ",d.treeStreamLoading]}),n&&ue("button",{type:"button",onClick:()=>S(!C),className:`inline-flex h-5 items-center rounded px-1.5 text-[10px] transition-colors ${C?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800"}`,title:d.treeShowEntireCompanyTitle,children:[A("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",d.treeShowEntireCompany]}),ee.length>0?ue("div",{className:"flex items-center gap-1",children:[A("button",{type:"button",onClick:Va,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":d.treeExpandAll,title:d.treeExpandAllTitle,children:A(Wi,{className:"h-3 w-3"})}),A("button",{type:"button",onClick:Ka,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":d.treeCollapseAll,title:d.treeCollapseAllTitle,children:A(Oi,{className:"h-3 w-3"})})]}):null]}),ca=za(null),{isTwoColumn:pa}=Da(ca,En,{mediaQuery:"(min-width: 768px)"}),ua=Re(()=>({toggle:st,isExpanded:te,expandMultiple:At,collapseMultiple:it,isPending:o}),[it,At,te,st,o]),Bn=Re(()=>({onEntryClick:oa,selectedPath:he}),[oa,he]),Un=Re(()=>({className:Fi,lineColor:$t,iconOverrides:Se,showDirectoryIcons:!!Se,showFileIcons:!!Se,highlightStyles:zi,entryClassName:"rounded-md px-1 py-0.5",nameClassName:"text-xs tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[$t,Se]),qa=A("div",{ref:zt,className:"flex min-h-0 flex-1 flex-col rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",children:A("div",{ref:Ge,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:P.length>0?A(Mi,{entries:P,expansion:ua,selection:Bn,visual:Un,virtualScroll:Ut,locale:l,labels:m}):A("div",{className:"flex h-full w-full items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white/70 px-6 text-center text-slate-500 text-sm transition-colors dark:border-slate-700 dark:bg-slate-900/50 dark:text-slate-300",children:n?d.treeNoMatches:d.treeEmpty})})});return ue("div",{ref:ca,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:ke,children:[t&&Di(da,t),pa?ue(Ri,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[A(Vr,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:Hi,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:qa}),A(Li,{id:"contact-map-tree-handle",thickness:Ai,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":d.treeResizeHandle}),A(Vr,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:_i,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:A(tt,{contact:Tt??null,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):ue(Ki,{children:[qa,A("div",{className:"hidden","aria-hidden":"true",children:A(tt,{contact:Tt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}),qe&&Tt?A(Ha,{isOpen:qe,onClose:()=>Ft(!1),className:"z-50 bg-white dark:bg-slate-900",children:ue("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[ue("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[A("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:d.detailHeading}),A("button",{type:"button",onClick:()=>Ft(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:d.close})]}),A("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:A(tt,{contact:Tt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]})}):null]}),Je&&ze&&A(xa,{contactData:ze,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:Ye,onRequestClose:Qe})]})};import{jsx as na,jsxs as Wt}from"react/jsx-runtime";var On="view",Qi={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Yi=e=>e==="tree"?"tree":"list",Xr=({context:e})=>{let t=q(),[a,r]=Gi(),[s,n]=qi(null),o=Yi(a.get(On)),{setScrollableRef:c,onPointerDown:l,onPointerMove:d,onPointerUp:m,onPointerLeave:p,onPointerCancel:i,onClickCapture:u}=nt(),h=ji(k=>{let C=k==="tree"?"tree":"list";if(C===o)return;let S=new URLSearchParams(typeof window<"u"?window.location.search:"");C==="list"?S.delete(On):S.set(On,C),r(S,{replace:!0})},[o,r]);return Wt("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[Wt("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[Wt("div",{ref:c,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-lg bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:Qi,onPointerDown:l,onPointerMove:d,onPointerUp:m,onPointerLeave:p,onPointerCancel:i,onClickCapture:u,children:[Wt("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>h("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="list"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4C4} ",t.listViewTab]}),Wt("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>h("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="tree"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F333} ",t.treeViewTab]})]}),na("div",{ref:n,className:"flex items-center gap-1.5"})]}),Wt("div",{className:"flex h-full flex-1 flex-col",children:[na("div",{className:`${o==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="list"?na(Ar,{context:e}):null}),na("div",{className:`${o==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="tree"?na(Jr,{context:e,controlsContainer:s}):null})]})]})};import{DEFAULT_FUZZY_SEARCH_OPTIONS as Hn}from"@aiquants/fuzzy-search";import{memo as Zi}from"react";se();se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as z}from"@aiquants/fuzzy-search";import{memo as Ji,useId as xe}from"react";import{jsx as E,jsxs as I}from"react/jsx-runtime";var Wn=Ji(({searchOptions:e,setSearchOptions:t})=>{let a=q(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",n=e.sortBy==="relevance",o=xe(),c=xe(),l=xe(),d=xe(),m=xe(),p=xe(),i=xe(),u=xe(),h=xe(),k=xe(),C=xe(),S=[];S.push(I("div",{className:`${r} border-green-200 border-l-4 dark:border-green-400/60`,children:[I("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.indexBuildHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramSize}),E("input",{id:o,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||z.ngramSize,onChange:y=>t(g=>({...g,ngramSize:parseInt(y.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.ngramSize||z.ngramSize]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramSizeHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinNgramOverlap}),E("input",{id:c,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||z.minNgramOverlap,onChange:y=>t(g=>({...g,minNgramOverlap:parseInt(y.target.value,10)})),className:"w-full"}),I("span",{className:"text-green-600 text-xs dark:text-green-300",children:[a.currentValueLabel," ",e.minNgramOverlap||z.minNgramOverlap]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinNgramOverlapHint})]})]},"index-build")),S.push(I("div",{className:`${r} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[I("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.indexCandidateHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexThreshold}),E("input",{id:l,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??z.indexWorkerOptions?.threshold,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.threshold??z.indexWorkerOptions?.threshold]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexThresholdHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexNgramOverlapThreshold}),E("input",{id:m,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??z.indexWorkerOptions?.ngramOverlapThreshold,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??z.indexWorkerOptions?.ngramOverlapThreshold]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexNgramOverlapThresholdHint})]})]},"candidate-control")),S.push(I("div",{className:`${r} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[I("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",a.indexStrategyHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexStrategy}),I("select",{id:d,value:e.indexWorkerOptions?.strategy??z.indexWorkerOptions?.strategy??"hybrid",onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:y.target.value}})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[E("option",{value:"fast",children:a.indexStrategyFast}),E("option",{value:"accurate",children:a.indexStrategyAccurate}),E("option",{value:"hybrid",children:a.indexStrategyHybrid})]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexStrategyHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMinCandidatesRatio}),E("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??z.indexWorkerOptions?.minCandidatesRatio,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??z.indexWorkerOptions?.minCandidatesRatio]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMinCandidatesRatioHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:i,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexMaxCandidatesRatio}),E("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??z.indexWorkerOptions?.maxCandidatesRatio,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??z.indexWorkerOptions?.maxCandidatesRatio]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxCandidatesRatioHint})]})]},"strategy")),S.push(I("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[I("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",a.scoreTuningHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexJaroWinklerPrefix}),E("input",{id:u,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??z.indexWorkerOptions?.jaroWinklerPrefix,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??z.indexWorkerOptions?.jaroWinklerPrefix]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexJaroWinklerPrefixHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),E("input",{id:h,type:"range",min:"1000",max:"10000",step:"1000",value:e.indexWorkerOptions?.maxResults??z.indexWorkerOptions?.maxResults,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(y.target.value,10)}})),className:"w-full"}),I("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.maxResults??z.indexWorkerOptions?.maxResults]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexMaxResultsHint})]})]},"jaro")),S.push(I("div",{className:`${r} border-emerald-200 border-l-4 ${n?"":"opacity-50"} dark:border-emerald-400/60`,children:[I("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:k,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),E("input",{id:k,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??z.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(y.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),I("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??z.indexWorkerOptions?.relevanceFieldWeight??.2]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexFieldWeightHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexPerfectMatchBonus}),E("input",{id:C,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??z.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(y.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),I("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??z.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexPerfectMatchBonusHint})]}),!n&&E("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:a.relevanceOnlyNotice})]},"relevance"));let B=xe(),N=xe();return S.push(I("div",{className:`${r} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[I("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",a.indexContainmentHeading]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:B,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentBase}),E("input",{id:B,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??z.indexWorkerOptions?.containmentScoreBase??.7,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??z.indexWorkerOptions?.containmentScoreBase??.7]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentBaseHint})]}),I("div",{className:"space-y-2",children:[E("label",{htmlFor:N,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.indexContainmentCoverage}),E("input",{id:N,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??z.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(y.target.value)}})),className:"w-full"}),I("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[a.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??z.indexWorkerOptions?.containmentCoverageWeight??.3]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.indexContainmentCoverageHint})]})]},"containment")),I("section",{className:"space-y-3",children:[I("div",{className:"flex items-center justify-between gap-3",children:[I("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[E("span",{children:"\u{1F4CA}"}),E("span",{className:"tracking-wide",children:a.indexSettingsHeading})]}),E("button",{type:"button",onClick:()=>t(y=>({...y,indexWorkerOptions:{threshold:z.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:z.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:z.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:z.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:z.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:z.indexWorkerOptions?.maxResults||100,relevanceFieldWeight:z.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:z.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:z.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:z.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:z.indexWorkerOptions?.strategy},ngramSize:z.ngramSize,minNgramOverlap:z.minNgramOverlap})),className:"rounded border border-green-300 bg-green-100 px-2 py-1 font-medium text-green-700 text-xs transition-colors hover:bg-green-200 dark:border-green-400/60 dark:bg-green-900/20 dark:text-green-200 dark:hover:bg-green-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),E("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:S})]})});Wn.displayName="IndexWorkerSettings";se();import{DEFAULT_FUZZY_SEARCH_OPTIONS as de}from"@aiquants/fuzzy-search";import{memo as Xi,useId as Dt}from"react";import{jsx as Z,jsxs as ne}from"react/jsx-runtime";var Dn=Xi(({searchOptions:e,setSearchOptions:t})=>{let a=q(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",n=e.sortBy==="relevance",o=Dt(),c=Dt(),l=Dt(),d=Dt(),m=Dt(),p=Dt(),i=[];return i.push(ne("div",{className:`${r} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[ne("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",a.levenshteinCandidateHeading]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinThreshold}),Z("input",{id:o,type:"range",min:"0.0",max:n?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??de.levenshteinWorkerOptions?.threshold,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,threshold:parseFloat(u.target.value)}})),className:"w-full"}),ne("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??de.levenshteinWorkerOptions?.threshold]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n?a.levenshteinThresholdHintRelevance:a.levenshteinThresholdHint})]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthSimilarity}),Z("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??de.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(u.target.value)}})),className:"w-full"}),ne("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??de.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push(ne("div",{className:`${r} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[ne("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",a.scoreTuningHeading]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinLengthPenalty}),Z("input",{id:l,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??de.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(u.target.value)}})),className:"w-full"}),ne("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??de.levenshteinWorkerOptions?.lengthDiffPenalty]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push(ne("div",{className:`${r} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[ne("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",a.levenshteinResultsHeading]}),Z("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.maxResults}),Z("input",{id:d,type:"range",min:"1000",max:"10000",step:"1000",value:e.levenshteinWorkerOptions?.maxResults??de.levenshteinWorkerOptions?.maxResults,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:parseInt(u.target.value,10)}})),className:"w-full"}),ne("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults??de.levenshteinWorkerOptions?.maxResults]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinMaxResultsHint})]},"max-results")),i.push(ne("div",{className:`${r} border-rose-200 border-l-4 ${n?"":"opacity-50"} dark:border-rose-400/60`,children:[ne("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",a.relevanceWeightsHeading]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.fieldWeight}),Z("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??de.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(u.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),ne("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??de.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinFieldWeightHint})]}),ne("div",{className:"space-y-2",children:[Z("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:a.levenshteinPartialBonus}),Z("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??de.levenshteinWorkerOptions?.partialMatchBonus,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,partialMatchBonus:parseFloat(u.target.value)}})),disabled:!n,className:"w-full disabled:cursor-not-allowed"}),ne("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[a.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??de.levenshteinWorkerOptions?.partialMatchBonus]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a.levenshteinPartialBonusHint})]}),!n&&Z("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:a.relevanceOnlyNotice})]},"relevance")),ne("section",{className:"space-y-3",children:[ne("div",{className:"flex items-center justify-between gap-3",children:[ne("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[Z("span",{children:"\u{1F4CF}"}),Z("span",{className:"tracking-wide",children:a.levenshteinSettingsHeading})]}),Z("button",{type:"button",onClick:()=>t(u=>({...u,levenshteinWorkerOptions:{threshold:de.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:de.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:de.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:de.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:de.levenshteinWorkerOptions?.maxResults||100,relevanceFieldWeight:de.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:"rounded border border-purple-300 bg-purple-100 px-2 py-1 font-medium text-purple-700 text-xs transition-colors hover:bg-purple-200 dark:border-purple-400/60 dark:bg-purple-900/20 dark:text-purple-200 dark:hover:bg-purple-800/30",title:a.resetToDefaultsTitle,children:a.reset})]}),Z("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});Dn.displayName="LevenshteinWorkerSettings";import{jsx as _e,jsxs as He}from"react/jsx-runtime";var el={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},_n=Zi(({searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:n,activeTab:o,onTabChange:c})=>{let l=q(),{setScrollableRef:d,onPointerDown:m,onPointerMove:p,onPointerUp:i,onPointerLeave:u,onPointerCancel:h,onClickCapture:k}=nt();return He("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[He("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[He("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",l.searchSettings]}),_e("div",{className:"flex flex-wrap gap-1.5",children:He("button",{type:"button",onClick:()=>t(C=>({...Hn,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:C.workerUrls,indexWorkerOptions:{...Hn.indexWorkerOptions},levenshteinWorkerOptions:{...Hn.levenshteinWorkerOptions}})),className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:l.settingsResetAllTitle,children:["\u{1F504} ",l.settingsResetAll]})})]}),_e("div",{className:"mb-0 shrink-0",children:He("div",{ref:d,role:"tablist","aria-label":l.settingsTabsLabel,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:el,onPointerDown:m,onPointerMove:p,onPointerUp:i,onPointerLeave:u,onPointerCancel:h,onClickCapture:k,children:[He("button",{type:"button",role:"tab","aria-selected":o==="basic",onClick:()=>c("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",l.settingsBasicTab]}),He("button",{type:"button",role:"tab","aria-selected":o==="advanced",onClick:()=>c("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",l.settingsAdvancedTab]}),He("button",{type:"button",role:"tab","aria-selected":o==="index",onClick:()=>c("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",l.indexWorkerName]}),He("button",{type:"button",role:"tab","aria-selected":o==="levenshtein",onClick:()=>c("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",l.levenshteinWorkerName]})]})}),He("div",{className:"flex flex-col gap-1",children:[_e("div",{className:`${o==="basic"?"block":"hidden"}`,children:_e(rn,{searchOptions:e,setSearchOptions:t,enableHighlighting:a,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:n})}),_e("div",{className:`${o==="advanced"?"block":"hidden"}`,children:_e(nn,{searchOptions:e,setSearchOptions:t})}),_e("div",{className:`${o==="index"?"block":"hidden"}`,children:_e(Wn,{searchOptions:e,setSearchOptions:t})}),_e("div",{className:`${o==="levenshtein"?"block":"hidden"}`,children:_e(Dn,{searchOptions:e,setSearchOptions:t})})]})]})});_n.displayName="SearchOptionsPanel";import{memo as nl}from"react";mt();se();import{memo as tl}from"react";import{jsxs as An}from"react/jsx-runtime";var L=tl(({label:e,value:t,unit:a,color:r="text-gray-600 dark:text-slate-300"})=>An("div",{className:"wrap-break-word flex min-w-0 flex-col overflow-hidden text-gray-700 transition-colors sm:flex-row sm:justify-between dark:text-slate-200",children:[An("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),An("span",{className:`font-medium ${r} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,a]})]}));L.displayName="StatItem";ht();mt();se();import{memo as al}from"react";import{jsx as w,jsxs as $}from"react/jsx-runtime";var Ht=al(({kind:e,icon:t,stats:a,color:r})=>{let{locale:s,labels:n}=fe(),o=M=>j(s,M);if(!a)return w("section",{className:"rounded-lg border border-gray-200 border-dashed bg-white/40 p-3 text-gray-400 text-xs transition-colors dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:n.statsNoData});let c=a.basic||{},l=a.workerSpecific||{},d=a.analysis||{},m=c.totalSearches??0,p=c.totalProcessingTime??0,i=c.averageSearchTime??0,u=c.lastSearchTime??0,h=c.errorCount??0,k=c.timestamp,C=d.fieldPerformance||{},S=d.performanceInsights||{},B=d.recentHistory||[],N=l.specificMetrics||{},y=l.operationCount??0,g=l.operationDistribution||{},O=e==="index",V=e==="levenshtein",b=O?n.indexWorkerName:n.levenshteinWorkerName,f=N,v=N,W="flex flex-col gap-1 rounded-lg border border-gray-200 bg-white/80 p-3 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",D="text-xs font-semibold transition-colors",X=M=>{if(M)return we(M)},P=[];if(P.push($("div",{className:`${W} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[$("div",{className:`${D} ${r}`,children:["\u{1F4CA} ",n.statsBasicHeading]}),w(L,{label:n.statTotalSearches,value:o(m),color:r}),w(L,{label:n.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:r}),w(L,{label:n.statTotalProcessingTime,value:p.toFixed(2),unit:"ms",color:r}),w(L,{label:n.statLastSearchTime,value:u.toFixed(2),unit:"ms",color:r}),w(L,{label:n.statErrorCount,value:h,color:h>0?"text-red-600 dark:text-red-400":r}),X(k)&&w(L,{label:n.statUpdatedAt,value:X(k),color:"text-gray-500 dark:text-slate-400"})]},"basic")),y>0||Object.keys(g).length>0){let M=Object.entries(g).sort(([,H],[,U])=>(Number(U)||0)-(Number(H)||0)).slice(0,6);P.push($("div",{className:`${W} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[$("div",{className:`${D} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",n.statsOperationsHeading]}),w(L,{label:n.statTotalOperations,value:o(y),color:"text-amber-700 dark:text-amber-300"}),M.length>0&&w("div",{className:"mt-1 space-y-1",children:M.map(([H,U])=>w(L,{label:H,value:o(Number(U)),unit:n.timesUnit(o(Number(U))),color:"text-amber-700 dark:text-amber-300"},H))})]},"operations"))}if(O&&(P.push($("div",{className:`${W} border-green-200 border-l-4 dark:border-green-400/60`,children:[$("div",{className:`${D} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.statsIndexHeading]}),w(L,{label:n.statIndexBuilds,value:o(f.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),w(L,{label:n.statDataSize,value:o(f.currentDataSize??0),unit:n.itemsUnit(o(f.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),w(L,{label:n.statLastBuildTime,value:(f.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),f.cacheSize&&P.push($("div",{className:`${W} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[$("div",{className:`${D} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",n.statsCacheHeading]}),w(L,{label:n.statCacheNgram,value:o(f.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:n.statCacheWord,value:o(f.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:n.statCachePhonetic,value:o(f.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),f.indexMetadata)){let M=Object.entries(f.indexMetadata).slice(0,6);M.length>0&&P.push($("div",{className:`${W} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[$("div",{className:`${D} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",n.statsIndexMetadataHeading]}),M.map(([H,U])=>{let ee;if(typeof U=="number"){let pe=H.toLowerCase();pe.includes("time")&&!pe.includes("timestamp")?ee=`${U.toFixed(2)}ms`:pe.includes("timestamp")||pe.includes("at")?ee=X(U)??U.toString():ee=o(U)}else ee=String(U);return w(L,{label:H,value:ee,color:"text-teal-700 dark:text-teal-300"},H)})]},"index-meta"))}if(V){if(P.push($("div",{className:`${W} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${D} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",n.statsCalculationsHeading]}),w(L,{label:n.statTotalCalculations,value:o(v.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statDistanceCalculations,value:o(v.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statAverageDistance,value:typeof v.averageDistance=="number"?v.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statMinDistance,value:v.minDistance??n.notAvailable,color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statMaxDistance,value:v.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),P.push($("div",{className:`${W} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[$("div",{className:`${D} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",n.statsMatchesHeading]}),w(L,{label:n.statPartialMatches,value:o(v.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),w(L,{label:n.statPerfectMatches,value:o(v.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),w(L,{label:n.statEarlyTerminations,value:o(v.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),v.similarityThresholds&&P.push($("div",{className:`${W} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[$("div",{className:`${D} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",n.statsSimilarityHeading]}),w(L,{label:n.statAbove80,value:o(v.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:n.statAbove60,value:o(v.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),w(L,{label:n.statAbove40,value:o(v.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),w(L,{label:n.statBelow40,value:o(v.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),v.distanceDistribution){let M=Object.entries(v.distanceDistribution).sort(([,H],[,U])=>Number(U)-Number(H)).slice(0,6);M.length>0&&P.push($("div",{className:`${W} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[$("div",{className:`${D} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",n.statsDistanceHeading]}),M.map(([H,U])=>w(L,{label:n.statDistance(H),value:o(Number(U)),unit:n.timesUnit(o(Number(U))),color:"text-indigo-700 dark:text-indigo-300"},H))]},"lev-distance"))}if(v.queryLengthStats){let M=Object.entries(v.queryLengthStats).sort(([,H],[,U])=>(U.count??0)-(H.count??0)).slice(0,6);M.length>0&&P.push($("div",{className:`${W} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[$("div",{className:`${D} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",n.statsQueryLengthHeading]}),M.map(([H,U])=>{let ee=Number(U.count??0),pe=Number(U.averageScore??0);return w(L,{label:n.statQueryLength(H),value:n.statQueryLengthValue({count:ee,averagePercent:(pe*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},H)})]},"lev-query-length"))}}if(Object.keys(C).length>0){let M=Object.entries(C).sort(([,H],[,U])=>(U.averageScore??0)-(H.averageScore??0)).slice(0,6);P.push($("div",{className:`${W} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${D} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",n.statsFieldPerformanceHeading]}),M.map(([H,U])=>{let ee=U;return $("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[w("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:H}),w(L,{label:n.statAverageScore,value:`${((ee.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statMatchCount,value:o(ee.matchCount??0),unit:n.itemsUnit(o(ee.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:n.statBestWorstScore,value:`${((ee.bestScore??0)*100).toFixed(1)}% / ${((ee.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},H)})]},"field-performance"))}if(S.bestPerformingField||S.totalHistoryEntries||S.similarityDistribution){let M=(S.recentAverageResultCount??0).toFixed(1);P.push($("div",{className:`${W} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[$("div",{className:`${D} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.statsInsightsHeading]}),S.bestPerformingField&&w(L,{label:n.statBestField,value:S.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statRecentAverageTime,value:(S.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statRecentAverageResults,value:M,unit:n.itemsUnit(M),color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statThroughput,value:(S.throughputPerSecond??0).toFixed(2),unit:n.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statCommonQueryLength,value:o(S.mostCommonQueryLength??0),unit:n.charactersUnit(o(S.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),w(L,{label:n.statHistoryEntries,value:o(S.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),S.similarityDistribution&&$("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[w(L,{label:n.statHighSimilarity,value:o(S.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:n.statMediumSimilarity,value:o(S.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),w(L,{label:n.statLowSimilarity,value:o(S.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),w(L,{label:n.statVeryLowSimilarity,value:o(S.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return B.length>0&&P.push($("div",{className:`${W} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[$("div",{className:`${D} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",n.statsRecentHistoryHeading]}),B.slice(-3).reverse().map((M,H)=>$("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[w("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:M.operationType}),w("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:n.statsHistoryEntry({processingTimeMs:M.processingTime.toFixed(2),resultCount:M.resultCount??0})}),X(M.timestamp)&&w("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:X(M.timestamp)})]},`${M.operationType}-${M.timestamp??H}`))]},"recent-history")),$("section",{className:"space-y-2",children:[$("div",{className:`flex items-center gap-2 font-semibold text-xs ${r}`,children:[w("span",{children:t}),w("span",{className:"tracking-wide",children:b})]}),w("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:P})]})});Ht.displayName="WorkerStatsSection";import{jsx as Ce,jsxs as ve}from"react/jsx-runtime";var rl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},In=nl(({performanceMetrics:e,searchTerm:t,totalDataCount:a,resultsCount:r,resetStats:s,rebuildIndex:n,isIndexBuilding:o,activeTab:c,onTabChange:l})=>{let{locale:d,labels:m}=fe(),p=t.trim(),i=p?r:a,{setScrollableRef:u,onPointerDown:h,onPointerMove:k,onPointerUp:C,onPointerLeave:S,onPointerCancel:B,onClickCapture:N}=nt(),y=c!=="index"||o,g=o?m.statsRebuildingTitle:c!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,O=y?"cursor-not-allowed bg-gray-300 text-gray-500 dark:bg-slate-700 dark:text-slate-400":"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-500 dark:hover:bg-blue-600",V=o?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`;return ve("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[ve("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[ve("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),ve("div",{className:"flex flex-wrap gap-1.5",children:[Ce("button",{type:"button",onClick:()=>n(),disabled:y,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${O}`,title:g,children:V}),ve("button",{type:"button",onClick:s,className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:m.statsResetTitle,children:["\u{1F504} ",m.reset]})]})]}),Ce("div",{className:"mb-0 shrink-0",children:ve("div",{ref:u,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:rl,onPointerDown:h,onPointerMove:k,onPointerUp:C,onPointerLeave:S,onPointerCancel:B,onClickCapture:N,children:[ve("button",{type:"button",onClick:()=>l("overview"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${c==="overview"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CB} ",m.statsOverviewTab]}),ve("button",{type:"button",onClick:()=>l("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${c==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",m.statsIndexTab]}),ve("button",{type:"button",onClick:()=>l("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${c==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",m.statsLevenshteinTab]})]})}),ve("div",{className:"flex flex-col gap-1 pb-0.5",children:[ve("div",{className:`${c==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 text-gray-600 text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 dark:text-slate-300`,children:[Ce(L,{label:m.statTotalSearches,value:j(d,e.totalSearches)}),Ce(L,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),Ce(L,{label:m.statDataCount,value:j(d,e.itemCount)}),Ce(L,{label:p?m.statResultCount:m.statDisplayedCount,value:j(d,i)})]}),Ce("div",{className:`${c==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Ce(Ht,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),Ce("div",{className:`${c==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:Ce(Ht,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),ve("div",{className:"hidden",children:[Ce(Ht,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),Ce(Ht,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});In.displayName="StatisticsPanel";import{Fragment as no,jsx as Y,jsxs as ge}from"react/jsx-runtime";var cl=/[\u200B\uFEFF]/g,zn=typeof window<"u",oo=zn&&typeof document<"u",Ua=(e,t=[],a=!1)=>{let r=ro(e);r.current=e,je(()=>{if(!(!zn||a&&!oo))return r.current()},[a,...t])},Zr=(e,t,a)=>{let[r,s]=Ae(()=>{let n=eo(o=>o.getItem(e));return n&&t.includes(n)?n:a});return Ua(()=>{eo(n=>{n.setItem(e,r)})},[e,r]),[r,s]},eo=e=>{if(!zn)return null;try{return e(window.sessionStorage)}catch{return null}},to=(e,t)=>{let[a,r]=Ae(e);return je(()=>{let s=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(s)}},[e,t]),a},pl="contact-map.settings-tab",ul="contact-map.statistics-tab",ml=["basic","advanced","index","levenshtein"],gl=["overview","index","levenshtein"],ao=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],hl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},so=({streamState:e,...t}={})=>e===void 0?Y(fl,{...t}):Y(io,{...t,streamState:e}),fl=e=>{let{context:t}=Ea();return Y(io,{...e,streamState:t})},yl={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},io=e=>{let{streamState:t,onFooterVisibilityChange:a,children:r}=e,s=me(e,"workerUrls"),n=Ve(),{locale:o,labels:c}=fe(),{contactMapRecords:l,contactMapRecordMap:d,isStreamingComplete:m,isStreamingFailed:p}=t,i=ll(),[u]=dl(),h=ro(null),[k,C]=Ae(!0),[S,B]=Ae(n.openEmailsWithGmail??!1),[N,y]=Ae(u.get("q")||""),g=to(N,300);je(()=>{let x=u.get("q")||"";y(T=>T!==x?x:T)},[u]),je(()=>{if(typeof window>"u")return;let x=new URL(window.location.href);(x.searchParams.get("q")||"")!==g&&(g?x.searchParams.set("q",g):x.searchParams.delete("q"),window.history.replaceState(window.history.state,"",x.toString()))},[g]);let[O,V]=il(),[b,f]=Ae("search"),[v,W]=Zr(pl,ml,"basic"),[D,X]=Zr(ul,gl,"overview"),{setScrollableRef:P,onPointerDown:M,onPointerMove:H,onPointerUp:U,onPointerLeave:ee,onPointerCancel:pe,onClickCapture:re}=nt(),te=ra(()=>{if(!oo)return;let x=h.current;!x||document.activeElement===x||window.requestAnimationFrame(()=>{try{x.focus({preventScroll:!0})}catch{}})},[]),st=ra(x=>{let T=x;f(T),T==="search"&&te()},[te]),{indexWorker:it,levenshteinWorker:At}=Ot(n.workerUrls,s,yl),Ie=kt(()=>{let{indexWorkerOptions:x={},levenshteinWorkerOptions:T={},...F}=Fn;return{...F,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:{indexWorker:it,levenshteinWorker:At},indexWorkerOptions:{...x},levenshteinWorkerOptions:{...T}}},[it,At]),[lt,he]=Ae(Ie),qe=(lt.multiTermOperator??Fn.multiTermOperator)==="and",Ft=qe?c.operatorAndTitle:c.operatorOrTitle,$a=to(l,m?0:800),{searchTerm:oe,setSearchTerm:zt,filteredItems:Ge,isSearching:Fe,isIndexBuilding:ke,clearSearch:St,resetStats:oa,performanceMetrics:Le,rebuildIndex:Bt,error:dt}=ol($a,ao,lt),Qe=oe.trim().length>0,[Ye,ze]=Ae(""),[Je,sa]=Ae(()=>oe),Ut=kt(()=>Ca(N),[N]),Se=kt(()=>Ca(g),[g]);je(()=>{g===Ye&&Se===oe||V(()=>{ze(g),zt(Se)})},[g,Ye,Se,oe,zt]);let Va=ra(x=>{let F=x.target.value.replace(cl,"");y(F)},[]),Ka=ra(()=>{y(""),ze(""),St(),te()},[St,te]),Tt=ra(()=>{he(x=>{let F=(x.multiTermOperator??Fn.multiTermOperator??"and")==="and"?"or":"and";return{...x,multiTermOperator:F}}),te()},[te]);Ua(()=>{if(!(b==="search"&&i.state==="idle"&&!O))return;let T=document.activeElement;if(!!!(T?.matches('[role="tab"]')||T?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&T&&T!==document.body&&T!==h.current)return;let le=window.requestAnimationFrame(()=>{te()});return()=>{window.cancelAnimationFrame(le)}},[b,i.state,O,te],!0),Ua(()=>{if(b!=="search")return;let x=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&te()}],[window,"pageshow",()=>{te()}]];for(let[T,F,le]of x)T.addEventListener(F,le);return()=>{for(let[T,F,le]of x)T.removeEventListener(F,le)}},[b,te],!0),je(()=>(a&&a(b==="search"?"mobile-hidden":"visible"),()=>{a&&a("visible")}),[b,a]),Ua(()=>{let x=document.body,T=x.style.overflow;return b==="search"&&(x.style.overflow="hidden"),()=>{x.style.overflow=T}},[b],!0),je(()=>{Le&&We.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:Le.totalSearches,averageSearchTime:Le.averageSearchTime,itemCount:Le.itemCount,resultsCount:Le.resultsCount,workersAvailable:!!Le.workerStats})},[Le]);let{isAwaitingDebounce:$t,isAwaitingSearchTermSync:wt,isSearchInProgress:Xe}=kt(()=>{let x=Ut!==Se,T=Se!==oe,F=oe.trim().length>0||Ut.trim().length>0;return{isAwaitingDebounce:x,isAwaitingSearchTermSync:T,isSearchInProgress:O||Fe||F&&ke||x||T||Je!==oe}},[Ut,Se,oe,O,Fe,ke,Je]),[ct,ja]=Ae(oe);je(()=>{ct!==oe&&ja(oe)},[oe,ct]),je(()=>{$t||wt||O||Fe||ke||ct===oe&&Je!==oe&&sa(oe)},[oe,Je,$t,wt,O,Fe,ke,ct]);let ia=kt(()=>ir(Ye,ao),[Ye]),la=kt(()=>ia(Ge),[ia,Ge]),da=kt(()=>({contactMapRecords:l,contactMapRecordMap:d,filteredItems:la,searchQuery:Ye,searchTerm:oe,isSearching:Fe,isIndexBuilding:ke,isPending:O,hasSearchTerm:Qe,enableHighlighting:k,openEmailsWithGmail:S,isSearchInProgress:Xe,isSearchTabActive:b==="search",errorMessage:dt??null,isStreamingComplete:m,isStreamingFailed:p}),[l,d,la,Ye,oe,Fe,ke,O,Qe,k,S,Xe,b,dt,m,p]),ca=Qe?Ge.length:l.length,pa=j(o,l.length),ua=j(o,Ge.length);return Y("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${b==="search"?" h-full min-h-0":""}`,children:ge(wa,{value:b,onValueChange:st,className:`flex flex-col${b==="search"?" h-full min-h-0":""}`,children:[ge(Yt,{ref:P,style:hl,className:"scrollbar-none mt-0 mb-1 flex w-full touch-pan-x flex-nowrap overflow-x-auto overflow-y-hidden rounded-md bg-slate-50 transition-colors dark:bg-slate-900/70 dark:text-slate-200",onPointerDown:M,onPointerMove:H,onPointerUp:U,onPointerLeave:ee,onPointerCancel:pe,onClickCapture:re,children:[ge(yt,{value:"search",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F50D} ",c.searchTab]}),ge(yt,{value:"settings",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u2699\uFE0F ",c.searchSettings]}),ge(yt,{value:"statistics",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F4CA} ",c.searchStatistics]})]}),Y(bt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:ge("div",{className:"flex h-full flex-col",children:[Y("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:ge("div",{className:"flex flex-col",children:[Y("div",{className:"relative",children:ge("div",{className:"flex items-center gap-1 p-1",children:[ge("button",{type:"button",onClick:Tt,"aria-pressed":qe,title:Ft,className:`inline-flex min-w-9 items-center justify-center gap-0.5 rounded border px-1.5 py-0.5 font-semibold text-[10px] transition-colors sm:min-w-12 sm:px-2 sm:py-0.5 sm:text-xs ${qe?"border-blue-500 bg-blue-600 text-white hover:bg-blue-700 dark:border-blue-400 dark:bg-blue-500 dark:hover:bg-blue-600":"border-amber-400 bg-amber-100 text-amber-800 hover:bg-amber-200 dark:border-amber-500/70 dark:bg-amber-300/20 dark:text-amber-200 dark:hover:bg-amber-300/30"}`,children:[Y("span",{className:"text-[10px] sm:text-xs",children:qe?c.operatorAnd:c.operatorOr}),Y("span",{className:"hidden text-[10px] sm:inline",children:qe?c.operatorAndHint:c.operatorOrHint})]}),Y("input",{ref:h,type:"text",value:N,onChange:Va,placeholder:c.searchPlaceholder,className:"flex-1 rounded border border-gray-300 border-solid px-2 py-0.5 text-xs shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none"}),N&&Y("button",{type:"button",onClick:Ka,className:"flex items-center justify-center gap-1 rounded border border-gray-300 px-1.5 py-0.5 text-[10px] transition-colors hover:text-gray-700 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100",title:Xe?c.searchBusyTitle:c.clearSearch,disabled:Xe,children:Xe?ge(no,{children:[Y(sl,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),Y("span",{className:"hidden sm:inline",children:c.searching})]}):"\u2715"})]})}),ge("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[c.registeredCountLabel," ",Y("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:pa})," ",c.recordUnit(pa),ke?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",c.rebuildingIndex]}):null,dt?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",c.errorLabel,Y("span",{className:"ml-1 break-all font-semibold",children:dt})]}):null,Qe&&ge("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",c.resultCountLabel,Xe?Y("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:c.searching}):ge(no,{children:[Y("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:ua}),Y("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:c.resultUnit(ua)})]})]})]}),Y("div",{className:"h-2.5 px-2 pb-1.5",children:ke?Y(Sr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),r?r(da):Y(Xr,{context:da})]})}),Y(bt,{value:"settings",className:"mt-0",children:Y(_n,{searchOptions:lt,setSearchOptions:he,enableHighlighting:k,setEnableHighlighting:C,openEmailsWithGmail:S,setOpenEmailsWithGmail:B,activeTab:v,onTabChange:W})}),Y(bt,{value:"statistics",className:"mt-0",children:Y(In,{performanceMetrics:Le,searchTerm:oe,totalDataCount:l.length,resultsCount:ca,resetStats:oa,rebuildIndex:Bt,isIndexBuilding:ke,activeTab:D,onTabChange:X})})]})})};import{jsx as _t,jsxs as co}from"react/jsx-runtime";var bl=({renderHeader:e,title:t,onFooterVisibilityChange:a})=>{let r=q(),s=t===void 0?r.appTitle:t,{context:n,retryNow:o}=Ea(),c=_t(vn,{recordCount:n.contactMapRecords.length,companyCount:n.companyCount,phase:n.streamPhase,loadedCount:n.loadedCount,totalCount:n.totalCount,errorMessage:n.errorMessage,onRetry:o});return co("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:s,annotation:c}):co("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[_t("h1",{className:"font-bold text-xl",children:s}),c]}),_t("div",{className:"min-h-0 flex-1",children:_t(so,{streamState:n,onFooterVisibilityChange:a})})]})},qu=e=>{let t=Ve(),a=me(e,"streamEndpoint"),r=me(e,"workerUrls"),s=me(e,"locale"),n=me(e,"labels"),o=lo(()=>({...t,streamEndpoint:a===void 0?t.streamEndpoint:a,workerUrls:Ot(t.workerUrls,r,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:n===void 0?t.labels:n}),[t,a,r,s,n]),c=s!==void 0,l=n!==void 0,d=lo(()=>({locale:c?"ContactMapAppView locale":"locale",labels:l?"ContactMapAppView labels":"labels"}),[c,l]);return _t(kn,{config:o,chromeSurface:d,children:_t(bl,{...e})})};mt();se();function Yu(){return!1}export{nn as AdvancedSearchSettings,rn as BasicSearchSettings,Be as CONTACT_MAP_LABEL_CATALOGS,Vt as CONTACT_MAP_LABEL_KEYS,lr as ContactDetailGrid,tt as ContactDetailPanel,xa as ContactDetailPopup,va as ContactDetailRowLayout,vn as ContactMapAnnotation,qu as ContactMapAppView,Ts as ContactMapConfigProvider,Ar as ContactMapSearchListView,so as ContactMapSearchPage,Xr as ContactMapSearchTabGroup,Jr as ContactMapSearchTreeView,Ma as ContactMapStreamClient,ce as HighlightedText,Wn as IndexWorkerSettings,zc as LIST_COLLAPSE_THRESHOLD,ii as LIST_DETAIL_PANEL_MIN_WIDTH,Bc as LIST_EXPAND_THRESHOLD,si as LIST_PANEL_MIN_WIDTH,li as LIST_RESIZE_HANDLE_THICKNESS,Dn as LevenshteinWorkerSettings,Sr as Progress,_n as SearchOptionsPanel,L as StatItem,In as StatisticsPanel,Ha as SwipeOverlay,kp as TREE_COLLAPSE_THRESHOLD,_i as TREE_DETAIL_PANEL_MIN_WIDTH,Sp as TREE_EXPAND_THRESHOLD,Hi as TREE_PANEL_MIN_WIDTH,Ai as TREE_RESIZE_HANDLE_THICKNESS,wa as Tabs,bt as TabsContent,Yt as TabsList,yt as TabsTrigger,Fa as TreeWorkerSession,Ht as WorkerStatsSection,Ra as assertContactMapStreamEndpoint,fr as assertContactMapTreeWorkerUrl,Gd as assertContactMapWorkerUrls,Bi as composeTreeVirtualScrollOptions,Yu as contactMapShouldRevalidate,_s as countContactMapCompanies,Ms as deserializeStreamRecord,Es as getContactMapStreamClient,Ni as getTreeWorkerSession,Ot as layerContactMapWorkerUrls,dc as resetContactMapStreamClientForTesting,Zc as resetTreeWorkerSessionForTesting,Xa as resolveContactMapLabels,Ir as useAnimatedNumber,Ve as useContactMapConfig,q as useContactMapLabels,Hs as useContactMapStream,wn as useContactPanelSizing,Tr as useDynamicViewportHeight,nt as useHorizontalDragScroll,Wa as useLongPressPopup,fi as useReportPopupVisibility,Da as useResponsiveTwoColumnLayout,hi as useRowPopupRegistry,Ea as useStreamedContactMapContext,$r as useTreeWorker};
|
|
1
|
+
var mo=Object.defineProperty;var Ne=(e,t)=>()=>(e&&(t=e(e=0)),t);var go=(e,t)=>{for(var n in t)mo(e,n,{get:t[n],enumerable:!0})};var oe,qa,Pt=Ne(()=>{"use strict";oe=e=>{switch(typeof e){case"string":return JSON.stringify(e);case"bigint":return`${e}n`;case"symbol":return e.toString();case"object":return e===null?"null":qa(e);case"function":return qa(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},qa=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var Mt,ue,Rt=Ne(()=>{"use strict";Mt=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},ue=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var ho,mn,Xn=Ne(()=>{"use strict";ho=(e,t)=>{let n=Array.from({length:t.length+1},(r,s)=>s);for(let r=1;r<=e.length;r+=1){let s=[r];for(let a=1;a<=t.length;a+=1){let o=n[a-1]+(e[r-1]===t[a-1]?0:1);s.push(Math.min(n[a]+1,s[a-1]+1,o))}n=s}return n[t.length]},mn=(e,t)=>{let n=e.toLowerCase();if(n.length>=3){let s=t.find(a=>a.toLowerCase().startsWith(n));if(s!==void 0)return s}let r;for(let s of t){let a=ho(n,s.toLowerCase());a<=Math.max(1,Math.floor(s.length/4))&&(r===void 0||a<r.distance)&&(r={key:s,distance:a})}return r?.key}});import{DIRECTORY_TREE_LABEL_CATALOGS as Ga,DIRECTORY_TREE_LABEL_KEYS as Jn,resolveDirectoryTreeLabels as fo}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as bo,VIRTUAL_SCROLL_LABEL_KEYS as yo}from"@aiquants/virtualscroll";var xo,j,pt,gn,Ya,Vt,$e,vo,Qa,Xa,Co,Zn,ko,So,To,ea,ta,na,ut=Ne(()=>{"use strict";Pt();Rt();Xn();xo=Object.freeze({en:"en-US",ja:"ja-JP"}),j=(e,t)=>t.toLocaleString(xo[e]),pt=(e,t,n)=>e==="1"?t:n,gn=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`Streaming (${j("en",e)} / ${j("en",t)} \xB7 ${n}%)`,annotationStreamingCount:e=>`Streaming (${j("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${j("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>pt(e,"record","records"),companyUnit:e=>pt(e,"company","companies"),searchTab:"Fuzzy search",searchSettings:"Search settings",searchStatistics:"Search statistics",operatorAndTitle:"AND search (all terms match)",operatorOrTitle:"OR search (any term matches)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"All terms",operatorOrHint:"Any term",searchPlaceholder:"Fuzzy search...",searchBusyTitle:"Searching",clearSearch:"Clear search",searching:"Searching...",registeredCountLabel:"Registered:",rebuildingIndex:"Rebuilding index...",errorLabel:"Error:",resultCountLabel:"Results:",resultUnit:e=>pt(e,"match","matches"),listViewTab:"List",treeViewTab:"Tree",columnNo:"No",columnId:"ID",columnScore:"Score",columnName:"Name",columnTitle:"Title",columnCompany:"Company",columnDepartment:"Department",columnPhone:"Phone",columnEmail:"Email",columnUpdatedAt:"Updated",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"No search results found",listNoData:"No data",listResizeHandle:"Resize the border between the contact list and the detail pane",detailHeading:"Contact details",close:"Close",noName:"(No Name)",treeNodeCountTitle:"Number of nodes built in the tree view",treeNodeCountLabel:"Nodes:",treeNodeCount:e=>j("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${j("en",t)})`,treeStreamInterruptedTitle:"Streaming was interrupted. Only the data received so far is shown",treeStreamInterrupted:"Interrupted",treeStreamLoadingTitle:"Receiving data streamed from the network",treeStreamLoading:"Loading...",treeBuildingTitle:"Building and expanding the directory tree from the received data",treeBuilding:"Treeing...",treeCompleteTitle:"Every tree node has been built",treeComplete:"Complete",treeShowEntireCompanyTitle:"Show the whole company of every search hit",treeShowEntireCompany:"Whole company",treeExpandAll:"Expand all directories",treeExpandAllTitle:"Expand all",treeCollapseAll:"Collapse all directories",treeCollapseAllTitle:"Collapse all",treeNoMatches:"No contacts match the criteria",treeEmpty:"No contacts to display",treeResizeHandle:"Resize the border between the directory tree and the detail pane",copyField:e=>`Copy ${e}`,detailEmptyTitle:"Select a contact to see its details",detailEmptyHint:"Choose a person from the list",detailTabSummary:"Summary",detailTabBasic:"Basic info",detailBasicProfile:"Profile",detailTabContact:"Contact",detailTabMeta:"Metadata",preferred:"Preferred",summaryEmail:"Email",summaryPhone:"Phone",summaryLastContact:"Last contact",sectionEmail:"Email",sectionEmailEmpty:"No email addresses registered",sectionPhone:"Phone / Fax",sectionPhoneEmpty:"No phone numbers registered",fieldFullName:"Name",fieldFullNameReading:"Name (reading)",fieldTitle:"Title",fieldDepartment:"Department",fieldCompanyName:"Company",fieldCompanyNameReading:"Company (reading)",fieldAddress:"Address",fieldPostalCode:"Postal code",fieldUrl:"URL",fieldCustomEmail:"Custom email",fieldEmail:"Email",fieldCustomMobilePhone:"Custom mobile",fieldMobilePhone:"Mobile",fieldCompanyPhone:"Company phone",fieldCompanyFax:"Company fax",fieldCreatedBy:"Created by",fieldCreatedAt:"Created at",fieldUpdatedBy:"Updated by",fieldUpdatedAt:"Updated at",popupCustomMobilePhone:"Mobile (custom)",popupMobilePhone:"Mobile",popupCustomCompanyPhone:"Company phone (custom)",popupCompanyPhone:"Company phone",popupCustomEmail:"Email (custom)",popupEmail:"Email",popupGmailHint:"Double-click or double-tap to open Gmail",popupLastContactDate:"Last contact:",popupNoContactMethods:"No contact information to display",overlayTitle:"Details",overlayBackdrop:"Tap the background to close",settingsResetAllTitle:"Reset all settings",settingsResetAll:"Reset all",settingsTabsLabel:"Search option tabs",settingsBasicTab:"Basic settings",settingsAdvancedTab:"Advanced settings",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"Current:",resetToDefaultsTitle:"Reset to defaults",reset:"Reset",relevanceOnlyNotice:"Editable only when sorting by relevance",relevanceWeightsHeading:"Relevance score weights",fieldWeight:"Field weight",scoreTuningHeading:"Score tuning",maxResults:"Maximum results",noLimit:"No limit",basicThresholdHeading:"Final similarity threshold",basicThresholdLabel:"Adjust the minimum score",basicThresholdRangeRelevance:"In relevance mode a score can exceed 1.0 (range: 0.0-1.5)",basicThresholdRange:"Range: 0.0-1.0",basicDisplayHeading:"Display options",basicCaseSensitive:"Case-sensitive",basicHighlight:"Highlight matches",basicOpenEmailsWithGmail:"Open email addresses in Gmail compose",basicMultiTermOperator:"Multi-term query operator",basicOperatorOr:"OR (any term matches)",basicOperatorAnd:"AND (all terms match)",basicMultiTermHint:"How space-separated terms are combined (default: OR)",basicSortHeading:"Sorting",basicSortBy:"Sort by",basicSortByScore:"Score",basicSortByRelevance:"Relevance",basicSortByOriginal:"Original order",basicSortOrder:"Sort order",basicSortDescending:"Descending",basicSortAscending:"Ascending",basicEngineHeading:"Search engine",basicStrategy:"Parallel search strategy",basicStrategyBalanced:"Balanced",basicStrategyIndexFirst:"Index first",basicStrategyLevenshteinFirst:"Levenshtein first",basicIndexFiltering:"Index filtering",basicLevenshtein:"Levenshtein distance",advancedLearningHeading:"Learning weight",advancedLearningLabel:"Weight factor",advancedLearningHint:"Weight applied when re-learning (higher favors past search results)",advancedDebounceHeading:"Debounce time",advancedDebounceLabel:"Input delay (ms)",advancedDebounceHint:"How long input is awaited. Shorter is more real-time, longer reduces load",indexSettingsHeading:"Index Worker settings",indexBuildHeading:"Index build",indexNgramSize:"N-gram size",indexNgramSizeHint:"How many characters each chunk holds. Smaller is faster but less accurate",indexMinNgramOverlap:"Minimum N-gram matches",indexMinNgramOverlapHint:"Candidates with fewer matches are excluded",indexCandidateHeading:"Candidate filtering",indexThreshold:"Index threshold",indexThresholdHint:"Lower bound of the Jaro-Winkler similarity (range: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram overlap threshold",indexNgramOverlapThresholdHint:"How much N-grams must overlap. Higher narrows candidates more strictly",indexStrategyHeading:"Search strategy and candidates",indexStrategy:"Search strategy",indexStrategyFast:"Fast",indexStrategyAccurate:"Accurate",indexStrategyHybrid:"Hybrid (adaptive)",indexStrategyHint:"Balance processing load against accuracy",indexMinCandidatesRatio:"Minimum candidate ratio",indexMinCandidatesRatioHint:"Share of candidates always kept",indexMaxCandidatesRatio:"Maximum candidate ratio",indexMaxCandidatesRatioHint:"Upper bound on candidates; narrowed dynamically when exceeded",indexJaroWinklerPrefix:"Jaro-Winkler prefix weight",indexJaroWinklerPrefixHint:"Bonus given to a matching prefix",indexMaxResultsHint:"Maximum number of results to fetch. Larger is more thorough but slower",indexFieldWeightHint:"How much the number of matched fields counts",indexPerfectMatchBonus:"Exact match bonus",indexPerfectMatchBonusHint:"Bonus added on an exact match",indexContainmentHeading:"Containment score (Japanese / substrings)",indexContainmentBase:"Containment base score (containmentScoreBase)",indexContainmentBaseHint:"Minimum base score when the query is fully contained in the string (rescues short Japanese queries such as 2 characters)",indexContainmentCoverage:"Containment coverage weight (containmentCoverageWeight)",indexContainmentCoverageHint:"Extra score by the query length / field length ratio (total capped at 1.0)",levenshteinSettingsHeading:"Levenshtein Worker settings",levenshteinCandidateHeading:"Candidate filter",levenshteinThreshold:"Levenshtein threshold",levenshteinThresholdHintRelevance:"Keep only results at or above this threshold (range: 0.0-1.5)",levenshteinThresholdHint:"Keep only results at or above this threshold (range: 0.0-1.0)",levenshteinLengthSimilarity:"Length similarity threshold",levenshteinLengthSimilarityHint:"Exclude candidates whose length differs greatly, for speed",levenshteinLengthPenalty:"Length difference penalty",levenshteinLengthPenaltyHint:"How much a length difference is penalized. Larger favors equal lengths",levenshteinResultsHeading:"Result count",levenshteinMaxResultsHint:"Maximum number of results to return. Larger is more thorough but slower",levenshteinFieldWeightHint:"Weight of the number of matched fields",levenshteinPartialBonus:"Partial match bonus",levenshteinPartialBonusHint:"Extra score for a partial match",statsRebuildingTitle:"Rebuilding the index",statsRebuildIndexTabOnlyTitle:"Available on the Index tab only",statsRebuildTitle:"Rebuild the index",statsRebuilding:"Rebuilding...",statsRebuild:"Rebuild Index",statsResetTitle:"Reset statistics",statsOverviewTab:"Overview",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"Total searches",statAverageSearchTime:"Average search time",statDataCount:"Data items",statResultCount:"Search results",statDisplayedCount:"Displayed items",statsNoData:"No statistics yet",statsBasicHeading:"Basic statistics",statTotalProcessingTime:"Total processing time",statLastSearchTime:"Last search time",statErrorCount:"Errors",statUpdatedAt:"Statistics updated at",statsOperationsHeading:"Operations",statTotalOperations:"Total operations",statsIndexHeading:"Index statistics",statIndexBuilds:"Index builds",statDataSize:"Data size",statLastBuildTime:"Last build time",statsCacheHeading:"Cache statistics",statCacheNgram:"N-gram",statCacheWord:"Words",statCachePhonetic:"Phonetic",statsIndexMetadataHeading:"Index metadata",statsCalculationsHeading:"Calculations",statTotalCalculations:"Total calculations",statDistanceCalculations:"Distance calculations",statAverageDistance:"Average distance",statMinDistance:"Minimum distance",statMaxDistance:"Maximum distance",notAvailable:"N/A",statsMatchesHeading:"Matches",statPartialMatches:"Partial matches",statPerfectMatches:"Exact matches",statEarlyTerminations:"Early terminations",statsSimilarityHeading:"Similarity distribution",statAbove80:"80% or more",statAbove60:"60% or more",statAbove40:"40% or more",statBelow40:"Below 40%",statsDistanceHeading:"Distance distribution (top 6)",statDistance:e=>`Distance ${e}`,statsQueryLengthHeading:"Query lengths (top 6)",statQueryLength:e=>`Length ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>{let n=j("en",e);return`${n} ${pt(n,"time","times")} / average ${t}%`},statsFieldPerformanceHeading:"Field performance (top 6)",statAverageScore:"Average score",statMatchCount:"Matches",statBestWorstScore:"Best / worst score",statsInsightsHeading:"Performance insights",statBestField:"Best-performing field",statRecentAverageTime:"Recent average processing time",statRecentAverageResults:"Recent average results",statThroughput:"Throughput",statCommonQueryLength:"Most common query length",statHistoryEntries:"History entries",statHighSimilarity:"High similarity",statMediumSimilarity:"Medium similarity",statLowSimilarity:"Low similarity",statVeryLowSimilarity:"Very low similarity",statsRecentHistoryHeading:"Recent history (latest 3)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`Processing time: ${e} ms / results: ${j("en",t)}`,timesUnit:e=>pt(e," time"," times"),itemsUnit:e=>pt(e," item"," items"),charactersUnit:e=>pt(e," character"," characters"),throughputUnit:" ops/s"}),ja:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"\u7DCF\u4EF6\u6570:",annotationCompaniesLabel:"\u4F01\u696D\u6570:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${j("ja",e)} / ${j("ja",t)} \u4EF6\u30FB${n}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${j("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${j("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationAuthRequired:"\u30BB\u30C3\u30B7\u30E7\u30F3\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u76F4\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044",annotationRetry:"\u518D\u8A66\u884C",recordUnit:()=>"\u4EF6",companyUnit:()=>"\u793E",searchTab:"\u3042\u3044\u307E\u3044\u691C\u7D22",searchSettings:"\u691C\u7D22\u8A2D\u5B9A",searchStatistics:"\u691C\u7D22\u7D71\u8A08",operatorAndTitle:"AND \u691C\u7D22 (\u3059\u3079\u3066\u4E00\u81F4)",operatorOrTitle:"OR \u691C\u7D22 (\u3044\u305A\u308C\u304B\u4E00\u81F4)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"\u5168\u8A9E\u4E00\u81F4",operatorOrHint:"\u3044\u305A\u308C\u304B\u4E00\u81F4",searchPlaceholder:"\u3042\u3044\u307E\u3044\u691C\u7D22...",searchBusyTitle:"\u691C\u7D22\u51E6\u7406\u4E2D",clearSearch:"\u691C\u7D22\u3092\u30AF\u30EA\u30A2",searching:"\u691C\u7D22\u4E2D...",registeredCountLabel:"\u767B\u9332\u4EF6\u6570:",rebuildingIndex:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D...",errorLabel:"\u30A8\u30E9\u30FC:",resultCountLabel:"\u691C\u7D22\u7D50\u679C:",resultUnit:()=>"\u4EF6",listViewTab:"\u4E00\u89A7",treeViewTab:"\u30C4\u30EA\u30FC",columnNo:"No",columnId:"ID",columnScore:"\u30B9\u30B3\u30A2",columnName:"\u6C0F\u540D",columnTitle:"\u5F79\u8077",columnCompany:"\u4F1A\u793E\u540D",columnDepartment:"\u90E8\u7F72",columnPhone:"\u96FB\u8A71\u756A\u53F7",columnEmail:"\u30E1\u30FC\u30EB",columnUpdatedAt:"\u66F4\u65B0\u65E5\u6642",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"\u691C\u7D22\u7D50\u679C\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",listNoData:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",listResizeHandle:"\u9023\u7D61\u5148\u4E00\u89A7\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",detailHeading:"\u9023\u7D61\u5148\u8A73\u7D30",close:"\u9589\u3058\u308B",noName:"\u540D\u524D\u672A\u8A2D\u5B9A",treeNodeCountTitle:"\u30C4\u30EA\u30FC\u30D3\u30E5\u30FC\u3067\u69CB\u7BC9\u3055\u308C\u305F\u5168\u30CE\u30FC\u30C9\u6570",treeNodeCountLabel:"\u30CE\u30FC\u30C9:",treeNodeCount:e=>`${j("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${j("ja",t)})`,treeStreamInterruptedTitle:"\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u304C\u4E2D\u65AD\u3055\u308C\u307E\u3057\u305F\u3002\u53D7\u4FE1\u6E08\u307F\u30C7\u30FC\u30BF\u306E\u307F\u8868\u793A\u3057\u3066\u3044\u307E\u3059",treeStreamInterrupted:"\u4E2D\u65AD",treeStreamLoadingTitle:"\u30CD\u30C3\u30C8\u30EF\u30FC\u30AF\u304B\u3089\u306E\u30C7\u30FC\u30BF\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u3092\u53D7\u4FE1\u4E2D",treeStreamLoading:"\u8AAD\u307F\u8FBC\u307F\u4E2D...",treeBuildingTitle:"\u53D7\u53D6\u30C7\u30FC\u30BF\u3092\u57FA\u306B\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u69CB\u9020\u3092\u6700\u7D42\u69CB\u7BC9\u30FB\u5C55\u958B\u4E2D",treeBuilding:"\u30C4\u30EA\u30FC\u69CB\u7BC9\u4E2D...",treeCompleteTitle:"\u30C4\u30EA\u30FC\u30CE\u30FC\u30C9\u306E\u5168\u4EF6\u69CB\u7BC9\u304C\u5B8C\u4E86\u3057\u307E\u3057\u305F",treeComplete:"\u5B8C\u4E86",treeShowEntireCompanyTitle:"\u691C\u7D22\u30D2\u30C3\u30C8\u3057\u305F\u4F1A\u793E\u5168\u4F53\u3092\u8868\u793A",treeShowEntireCompany:"\u5168\u4F53\u8868\u793A",treeExpandAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u5C55\u958B",treeExpandAllTitle:"\u3059\u3079\u3066\u5C55\u958B",treeCollapseAll:"\u5168\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u3092\u6298\u308A\u305F\u305F\u307F",treeCollapseAllTitle:"\u3059\u3079\u3066\u6298\u308A\u305F\u305F\u307F",treeNoMatches:"\u6761\u4EF6\u306B\u4E00\u81F4\u3059\u308B\u9023\u7D61\u5148\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",treeEmpty:"\u8868\u793A\u3059\u308B\u9023\u7D61\u5148\u304C\u3042\u308A\u307E\u305B\u3093",treeResizeHandle:"\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30C4\u30EA\u30FC\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",copyField:e=>`\u300C${e}\u300D\u3092\u30B3\u30D4\u30FC`,detailEmptyTitle:"\u9023\u7D61\u5148\u3092\u9078\u629E\u3059\u308B\u3068\u8A73\u7D30\u304C\u8868\u793A\u3055\u308C\u307E\u3059",detailEmptyHint:"\u4E00\u89A7\u304B\u3089\u5BFE\u8C61\u306E\u4EBA\u7269\u3092\u9078\u629E\u3057\u3066\u304F\u3060\u3055\u3044",detailTabSummary:"\u30B5\u30DE\u30EA\u30FC",detailTabBasic:"\u57FA\u672C\u60C5\u5831",detailBasicProfile:"\u57FA\u672C\u30D7\u30ED\u30D5\u30A3\u30FC\u30EB",detailTabContact:"\u9023\u7D61\u5148",detailTabMeta:"\u30E1\u30BF\u60C5\u5831",preferred:"\u512A\u5148",summaryEmail:"\u30E1\u30FC\u30EB",summaryPhone:"\u96FB\u8A71",summaryLastContact:"\u6700\u7D42\u63A5\u89E6",sectionEmail:"\u30E1\u30FC\u30EB",sectionEmailEmpty:"\u767B\u9332\u3055\u308C\u305F\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u306F\u3042\u308A\u307E\u305B\u3093",sectionPhone:"\u96FB\u8A71\u30FBFAX",sectionPhoneEmpty:"\u767B\u9332\u3055\u308C\u305F\u96FB\u8A71\u756A\u53F7\u306F\u3042\u308A\u307E\u305B\u3093",fieldFullName:"\u6C0F\u540D",fieldFullNameReading:"\u6C0F\u540D (\u304B\u306A)",fieldTitle:"\u5F79\u8077",fieldDepartment:"\u90E8\u7F72",fieldCompanyName:"\u4F1A\u793E\u540D",fieldCompanyNameReading:"\u4F1A\u793E\u540D (\u304B\u306A)",fieldAddress:"\u4F4F\u6240",fieldPostalCode:"\u90F5\u4FBF\u756A\u53F7",fieldUrl:"URL",fieldCustomEmail:"\u30AB\u30B9\u30BF\u30E0\u30E1\u30FC\u30EB",fieldEmail:"\u30E1\u30FC\u30EB",fieldCustomMobilePhone:"\u30AB\u30B9\u30BF\u30E0\u643A\u5E2F\u756A\u53F7",fieldMobilePhone:"\u643A\u5E2F\u756A\u53F7",fieldCompanyPhone:"\u4F1A\u793E\u96FB\u8A71\u756A\u53F7",fieldCompanyFax:"\u4F1A\u793E FAX \u756A\u53F7",fieldCreatedBy:"\u4F5C\u6210\u8005",fieldCreatedAt:"\u4F5C\u6210\u65E5\u6642",fieldUpdatedBy:"\u66F4\u65B0\u8005",fieldUpdatedAt:"\u66F4\u65B0\u65E5\u6642",popupCustomMobilePhone:"\u643A\u5E2F\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupMobilePhone:"\u643A\u5E2F\u96FB\u8A71",popupCustomCompanyPhone:"\u4F1A\u793E\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupCompanyPhone:"\u4F1A\u793E\u96FB\u8A71",popupCustomEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9 (\u30AB\u30B9\u30BF\u30E0)",popupEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",popupGmailHint:"\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u4E8C\u5EA6\u30BF\u30C3\u30D7\u3067 Gmail \u3092\u958B\u304D\u307E\u3059",popupLastContactDate:"\u6700\u7D42\u30B3\u30F3\u30BF\u30AF\u30C8\u65E5:",popupNoContactMethods:"\u8868\u793A\u3067\u304D\u308B\u9023\u7D61\u5148\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093",overlayTitle:"\u8A73\u7D30",overlayBackdrop:"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",settingsResetAllTitle:"\u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u30EA\u30BB\u30C3\u30C8",settingsResetAll:"\u3059\u3079\u3066\u30EA\u30BB\u30C3\u30C8",settingsTabsLabel:"\u691C\u7D22\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A\u30BF\u30D6",settingsBasicTab:"\u57FA\u672C\u8A2D\u5B9A",settingsAdvancedTab:"\u8A73\u7D30\u8A2D\u5B9A",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"\u73FE\u5728\u5024:",resetToDefaultsTitle:"\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u306B\u30EA\u30BB\u30C3\u30C8",reset:"\u30EA\u30BB\u30C3\u30C8",relevanceOnlyNotice:"Relevance \u30BD\u30FC\u30C8\u6642\u306E\u307F\u5909\u66F4\u53EF\u80FD",relevanceWeightsHeading:"Relevance \u30B9\u30B3\u30A2\u91CD\u307F",fieldWeight:"\u30D5\u30A3\u30FC\u30EB\u30C9\u91CD\u307F",scoreTuningHeading:"\u30B9\u30B3\u30A2\u8ABF\u6574",maxResults:"\u6700\u5927\u7D50\u679C\u6570",noLimit:"\u4E0A\u9650\u306A\u3057",basicThresholdHeading:"\u6700\u7D42\u985E\u4F3C\u5EA6\u95BE\u5024",basicThresholdLabel:"\u30B9\u30B3\u30A2\u306E\u4E0B\u9650\u3092\u8ABF\u6574",basicThresholdRangeRelevance:"Relevance \u30E2\u30FC\u30C9\u3067\u306F\u30B9\u30B3\u30A2\u304C 1.0 \u3092\u8D85\u3048\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059 (\u7BC4\u56F2: 0.0-1.5)",basicThresholdRange:"\u7BC4\u56F2: 0.0-1.0",basicDisplayHeading:"\u8868\u793A\u30AA\u30D7\u30B7\u30E7\u30F3",basicCaseSensitive:"\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225",basicHighlight:"\u30CF\u30A4\u30E9\u30A4\u30C8\u8868\u793A",basicOpenEmailsWithGmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 Gmail \u306E\u4F5C\u6210\u753B\u9762\u3067\u958B\u304F",basicMultiTermOperator:"\u8907\u6570\u8A9E\u30AF\u30A8\u30EA\u306E\u6F14\u7B97\u5B50",basicOperatorOr:"OR (\u3044\u305A\u308C\u304B\u4E00\u81F4)",basicOperatorAnd:"AND (\u3059\u3079\u3066\u4E00\u81F4)",basicMultiTermHint:"\u8907\u6570\u8A9E\u3092\u30B9\u30DA\u30FC\u30B9\u3067\u5165\u529B\u3057\u305F\u3068\u304D\u306E\u7D50\u5408\u65B9\u6CD5 (\u65E2\u5B9A\u306F OR)",basicSortHeading:"\u30BD\u30FC\u30C8\u8A2D\u5B9A",basicSortBy:"\u30BD\u30FC\u30C8\u57FA\u6E96",basicSortByScore:"\u30B9\u30B3\u30A2",basicSortByRelevance:"\u95A2\u9023\u6027",basicSortByOriginal:"\u5143\u306E\u9806\u5E8F",basicSortOrder:"\u30BD\u30FC\u30C8\u9806\u5E8F",basicSortDescending:"\u964D\u9806",basicSortAscending:"\u6607\u9806",basicEngineHeading:"\u691C\u7D22\u30A8\u30F3\u30B8\u30F3\u8A2D\u5B9A",basicStrategy:"\u4E26\u5217\u691C\u7D22\u6226\u7565",basicStrategyBalanced:"\u30D0\u30E9\u30F3\u30B9",basicStrategyIndexFirst:"Index \u512A\u5148",basicStrategyLevenshteinFirst:"Levenshtein \u512A\u5148",basicIndexFiltering:"Index \u30D5\u30A3\u30EB\u30BF\u30EA\u30F3\u30B0",basicLevenshtein:"Levenshtein \u8DDD\u96E2\u8A08\u7B97",advancedLearningHeading:"\u5B66\u7FD2\u91CD\u307F",advancedLearningLabel:"\u91CD\u307F\u4FC2\u6570",advancedLearningHint:"\u518D\u5B66\u7FD2\u6642\u306E\u91CD\u307F\u4ED8\u3051 (\u5927\u304D\u3044\u307B\u3069\u904E\u53BB\u306E\u691C\u7D22\u7D50\u679C\u3092\u512A\u5148)",advancedDebounceHeading:"\u30C7\u30D0\u30A6\u30F3\u30B9\u6642\u9593",advancedDebounceLabel:"\u5165\u529B\u9045\u5EF6 (ms)",advancedDebounceHint:"\u5165\u529B\u306E\u5F85\u3061\u6642\u9593\u3002\u77ED\u3044\u307B\u3069\u30EA\u30A2\u30EB\u30BF\u30A4\u30E0\u3001\u9577\u3044\u307B\u3069\u8CA0\u8377\u8EFD\u6E1B",indexSettingsHeading:"Index Worker \u8A2D\u5B9A",indexBuildHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9",indexNgramSize:"N-gram \u30B5\u30A4\u30BA",indexNgramSizeHint:"\u6587\u5B57\u5217\u3092\u4F55\u6587\u5B57\u5358\u4F4D\u3067\u5206\u5272\u3059\u308B\u304B\u3002\u5C0F\u3055\u3044\u307B\u3069\u9AD8\u901F\u3060\u304C\u7CBE\u5EA6\u4F4E\u4E0B",indexMinNgramOverlap:"\u6700\u5C0F N-gram \u4E00\u81F4\u6570",indexMinNgramOverlapHint:"\u4E00\u81F4\u6570\u304C\u3053\u306E\u5024\u3092\u4E0B\u56DE\u308B\u5019\u88DC\u306F\u9664\u5916",indexCandidateHeading:"\u5019\u88DC\u7D5E\u308A\u8FBC\u307F",indexThreshold:"Index \u95BE\u5024",indexThresholdHint:"Jaro-Winkler \u985E\u4F3C\u5EA6\u306E\u4E0B\u9650 (\u7BC4\u56F2: 0.0-1.0)",indexNgramOverlapThreshold:"N-gram \u91CD\u8907\u5EA6\u95BE\u5024",indexNgramOverlapThresholdHint:"N-gram \u306E\u91CD\u306A\u308A\u5177\u5408\u3002\u9AD8\u3044\u307B\u3069\u53B3\u5BC6\u306B\u5019\u88DC\u3092\u7D5E\u308B",indexStrategyHeading:"\u691C\u7D22\u6226\u7565\u3068\u5019\u88DC\u6570",indexStrategy:"\u691C\u7D22\u6226\u7565",indexStrategyFast:"Fast (\u9AD8\u901F)",indexStrategyAccurate:"Accurate (\u6B63\u78BA)",indexStrategyHybrid:"Hybrid (\u52D5\u7684)",indexStrategyHint:"\u51E6\u7406\u8CA0\u8377\u3068\u7CBE\u5EA6\u306E\u30D0\u30E9\u30F3\u30B9\u3092\u9078\u629E",indexMinCandidatesRatio:"\u6700\u5C0F\u5019\u88DC\u6BD4\u7387",indexMinCandidatesRatioHint:"\u6700\u4F4E\u9650\u78BA\u4FDD\u3059\u308B\u5019\u88DC\u5272\u5408",indexMaxCandidatesRatio:"\u6700\u5927\u5019\u88DC\u6BD4\u7387",indexMaxCandidatesRatioHint:"\u5019\u88DC\u6570\u306E\u4E0A\u9650\u3002\u8D85\u3048\u308B\u3068\u52D5\u7684\u306B\u7D5E\u308A\u8FBC\u307F",indexJaroWinklerPrefix:"Jaro-Winkler \u63A5\u982D\u8F9E\u91CD\u307F",indexJaroWinklerPrefixHint:"\u5148\u982D\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexMaxResultsHint:"\u53D6\u5F97\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u5305\u62EC\u7684\u3060\u304C\u9045\u5EF6\u304C\u5897\u52A0",indexFieldWeightHint:"\u30DE\u30C3\u30C1\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306B\u3069\u308C\u3060\u3051\u91CD\u307F\u4ED8\u3051\u3059\u308B\u304B",indexPerfectMatchBonus:"\u5B8C\u5168\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",indexPerfectMatchBonusHint:"\u5B8C\u5168\u4E00\u81F4\u6642\u306B\u8FFD\u52A0\u3059\u308B\u30DC\u30FC\u30CA\u30B9\u5024",indexContainmentHeading:"\u548C\u6587\u30FB\u90E8\u5206\u6587\u5B57\u5217\u5305\u542B\u30B9\u30B3\u30A2",indexContainmentBase:"\u5305\u542B \u57FA\u790E\u30B9\u30B3\u30A2 (containmentScoreBase)",indexContainmentBaseHint:"\u30AF\u30A8\u30EA\u304C\u6587\u5B57\u5217\u4E2D\u306B\u5B8C\u5168\u306B\u542B\u307E\u308C\u308B\u5834\u5408\u306E\u6700\u4F4E\u57FA\u790E\u30B9\u30B3\u30A2 (\u548C\u6587 2 \u6587\u5B57\u7B49\u306E\u6551\u6E08)",indexContainmentCoverage:"\u5305\u542B \u88AB\u8986\u7387\u91CD\u307F (containmentCoverageWeight)",indexContainmentCoverageHint:"\u30AF\u30A8\u30EA\u9577 / \u30D5\u30A3\u30FC\u30EB\u30C9\u9577\u306E\u6BD4\u7387\u306B\u5FDC\u3058\u305F\u52A0\u7B97\u30B9\u30B3\u30A2 (\u5408\u8A08 1.0 \u4EE5\u4E0B\u306B\u5236\u9650)",levenshteinSettingsHeading:"Levenshtein Worker \u8A73\u7D30\u8A2D\u5B9A",levenshteinCandidateHeading:"\u5019\u88DC\u30D5\u30A3\u30EB\u30BF",levenshteinThreshold:"Levenshtein \u95BE\u5024",levenshteinThresholdHintRelevance:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.5)",levenshteinThresholdHint:"\u3053\u306E\u95BE\u5024\u4EE5\u4E0A\u306E\u7D50\u679C\u306E\u307F\u4FDD\u6301 (\u7BC4\u56F2: 0.0-1.0)",levenshteinLengthSimilarity:"\u9577\u3055\u985E\u4F3C\u5EA6\u95BE\u5024",levenshteinLengthSimilarityHint:"\u9577\u3055\u304C\u5927\u304D\u304F\u7570\u306A\u308B\u5019\u88DC\u3092\u4E8B\u524D\u306B\u9664\u5916\u3057\u3066\u901F\u5EA6\u5411\u4E0A",levenshteinLengthPenalty:"\u9577\u3055\u5DEE\u30DA\u30CA\u30EB\u30C6\u30A3",levenshteinLengthPenaltyHint:"\u9577\u3055\u5DEE\u3092\u3069\u308C\u3060\u3051\u6E1B\u70B9\u3059\u308B\u304B\u3002\u5927\u304D\u3044\u307B\u3069\u9577\u3055\u4E00\u81F4\u3092\u91CD\u8996",levenshteinResultsHeading:"\u7D50\u679C\u6570\u5236\u5FA1",levenshteinMaxResultsHint:"\u8FD4\u5374\u3059\u308B\u6700\u5927\u4EF6\u6570\u3002\u5927\u304D\u3044\u307B\u3069\u7DB2\u7F85\u7684\u3060\u304C\u51E6\u7406\u6642\u9593\u304C\u5897\u52A0",levenshteinFieldWeightHint:"\u4E00\u81F4\u30D5\u30A3\u30FC\u30EB\u30C9\u6570\u306E\u8A55\u4FA1\u91CD\u307F",levenshteinPartialBonus:"\u90E8\u5206\u4E00\u81F4\u30DC\u30FC\u30CA\u30B9",levenshteinPartialBonusHint:"\u90E8\u5206\u4E00\u81F4\u306B\u4ED8\u4E0E\u3059\u308B\u8FFD\u52A0\u30B9\u30B3\u30A2",statsRebuildingTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D",statsRebuildIndexTabOnlyTitle:"Index \u30BF\u30D6\u3067\u306E\u307F\u4F7F\u7528\u53EF\u80FD",statsRebuildTitle:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u3092\u518D\u69CB\u7BC9",statsRebuilding:"\u518D\u69CB\u7BC9\u4E2D...",statsRebuild:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9",statsResetTitle:"\u7D71\u8A08\u3092\u30EA\u30BB\u30C3\u30C8",statsOverviewTab:"\u6982\u8981",statsIndexTab:"Index",statsLevenshteinTab:"Levenshtein",statTotalSearches:"\u7DCF\u691C\u7D22\u56DE\u6570",statAverageSearchTime:"\u5E73\u5747\u691C\u7D22\u6642\u9593",statDataCount:"\u30C7\u30FC\u30BF\u4EF6\u6570",statResultCount:"\u691C\u7D22\u7D50\u679C\u4EF6\u6570",statDisplayedCount:"\u8868\u793A\u4EF6\u6570",statsNoData:"\u7D71\u8A08\u30C7\u30FC\u30BF\u306A\u3057",statsBasicHeading:"\u57FA\u672C\u7D71\u8A08",statTotalProcessingTime:"\u7DCF\u51E6\u7406\u6642\u9593",statLastSearchTime:"\u6700\u5F8C\u306E\u691C\u7D22\u6642\u9593",statErrorCount:"\u30A8\u30E9\u30FC\u6570",statUpdatedAt:"\u7D71\u8A08\u66F4\u65B0\u6642\u523B",statsOperationsHeading:"\u64CD\u4F5C\u7D71\u8A08",statTotalOperations:"\u7DCF\u64CD\u4F5C\u6570",statsIndexHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u7D71\u8A08",statIndexBuilds:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u69CB\u7BC9\u56DE\u6570",statDataSize:"\u30C7\u30FC\u30BF\u30B5\u30A4\u30BA",statLastBuildTime:"\u6700\u5F8C\u306E\u69CB\u7BC9\u6642\u9593",statsCacheHeading:"\u30AD\u30E3\u30C3\u30B7\u30E5\u7D71\u8A08",statCacheNgram:"N-gram",statCacheWord:"\u5358\u8A9E",statCachePhonetic:"\u97F3\u97FB",statsIndexMetadataHeading:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u30E1\u30BF\u30C7\u30FC\u30BF",statsCalculationsHeading:"\u8A08\u7B97\u7D71\u8A08",statTotalCalculations:"\u7DCF\u8A08\u7B97\u6570",statDistanceCalculations:"\u8DDD\u96E2\u8A08\u7B97\u6570",statAverageDistance:"\u5E73\u5747\u8DDD\u96E2",statMinDistance:"\u6700\u5C0F\u8DDD\u96E2",statMaxDistance:"\u6700\u5927\u8DDD\u96E2",notAvailable:"N/A",statsMatchesHeading:"\u30DE\u30C3\u30C1\u7D71\u8A08",statPartialMatches:"\u90E8\u5206\u30DE\u30C3\u30C1\u6570",statPerfectMatches:"\u5B8C\u5168\u30DE\u30C3\u30C1\u6570",statEarlyTerminations:"\u65E9\u671F\u7D42\u4E86\u6570",statsSimilarityHeading:"\u985E\u4F3C\u5EA6\u5206\u5E03",statAbove80:"80% \u4EE5\u4E0A",statAbove60:"60% \u4EE5\u4E0A",statAbove40:"40% \u4EE5\u4E0A",statBelow40:"40% \u672A\u6E80",statsDistanceHeading:"\u8DDD\u96E2\u5206\u5E03 (\u4E0A\u4F4D 6)",statDistance:e=>`\u8DDD\u96E2 ${e}`,statsQueryLengthHeading:"\u30AF\u30A8\u30EA\u9577\u7D71\u8A08 (\u4E0A\u4F4D 6)",statQueryLength:e=>`\u9577\u3055 ${e}`,statQueryLengthValue:({count:e,averagePercent:t})=>`${j("ja",e)} \u56DE / \u5E73\u5747 ${t}%`,statsFieldPerformanceHeading:"\u30D5\u30A3\u30FC\u30EB\u30C9\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9 (\u4E0A\u4F4D 6)",statAverageScore:"\u5E73\u5747\u30B9\u30B3\u30A2",statMatchCount:"\u30DE\u30C3\u30C1\u6570",statBestWorstScore:"\u6700\u9AD8 / \u6700\u4F4E\u30B9\u30B3\u30A2",statsInsightsHeading:"\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6D1E\u5BDF",statBestField:"\u6700\u9AD8\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u30D5\u30A3\u30FC\u30EB\u30C9",statRecentAverageTime:"\u6700\u8FD1\u306E\u5E73\u5747\u51E6\u7406\u6642\u9593",statRecentAverageResults:"\u6700\u8FD1\u306E\u5E73\u5747\u7D50\u679C\u6570",statThroughput:"\u30B9\u30EB\u30FC\u30D7\u30C3\u30C8",statCommonQueryLength:"\u6700\u983B\u51FA\u30AF\u30A8\u30EA\u9577",statHistoryEntries:"\u5C65\u6B74\u30A8\u30F3\u30C8\u30EA\u6570",statHighSimilarity:"\u9AD8\u985E\u4F3C",statMediumSimilarity:"\u4E2D\u985E\u4F3C",statLowSimilarity:"\u4F4E\u985E\u4F3C",statVeryLowSimilarity:"\u6975\u4F4E\u985E\u4F3C",statsRecentHistoryHeading:"\u6700\u8FD1\u306E\u5C65\u6B74 (\u6700\u65B0 3 \u4EF6)",statsHistoryEntry:({processingTimeMs:e,resultCount:t})=>`\u51E6\u7406\u6642\u9593: ${e} ms / \u7D50\u679C: ${j("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),Ya=Object.freeze(Object.keys(gn.en)),Vt=Object.freeze([...Jn,...Ya]),$e=Object.freeze({en:Object.freeze({...Ga.en,...gn.en}),ja:Object.freeze({...Ga.ja,...gn.ja})}),vo=new Set(Vt),Qa=Object.keys($e).map(e=>JSON.stringify(e)).join(" or "),Xa=Object.freeze({locale:"locale",labels:"labels"}),Co=(e,t,n)=>{e[t]=n},Zn=(e,t=Xa.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${Qa} or left out; got ${oe(e)}`);if(e!==void 0&&!Object.hasOwn($e,e))throw new RangeError(`[contact-map] ${t} must be ${Qa} or left out; got ${oe(e)}`);return bo(e)},ko=(e,t,n,r)=>{if(typeof r=="function"){if(typeof n!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${oe(n)}`);return}if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${oe(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${oe(n)}`)},So=(e,t,n)=>{let r=Object.create(null);for(let s of Object.getOwnPropertyNames(e)){if(!vo.has(s)){let o=mn(s,Vt);throw new RangeError(`[contact-map] ${n} has a key that is not a label key (${o===void 0?"":`did you mean ${JSON.stringify(o)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${oe(s)}`)}let a=e[s];a!==void 0&&(ko(n,s,a,t[s]),r[s]=a)}return r},To=e=>{let t={},n=!1;for(let r of Jn){let s=e[r];s!==void 0&&(t[r]=s,n=!0)}return n?t:void 0},ea=(e,t,n=Xa)=>{let r=Zn(e,n.locale);if(t===void 0)return $e[r];if(!Mt(t))throw new TypeError(`[contact-map] ${n.labels} must be a plain object or left out; got ${oe(t)}`);let s=So(t,$e[r],n.labels),o={...fo(r,To(s)),...gn[r]};for(let c of Ya){let l=s[c];l!==void 0&&Co(o,c,l)}return Object.freeze(o)},ta=e=>{let t={};for(let n of Jn)t[n]=e[n];return Object.freeze(t)},na=e=>{let t={};for(let n of yo)t[n]=e[n];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as wo}from"@aiquants/directory-tree";import{VIRTUAL_SCROLL_LABEL_KEYS as No}from"@aiquants/virtualscroll";import{createContext as Po,useContext as Za,useMemo as Ja,useRef as Mo}from"react";import{jsx as Lo}from"react/jsx-runtime";var Ro,ra,aa,er,fe,q,ie=Ne(()=>{"use strict";ut();Ro=Object.freeze({locale:"en",labels:$e.en,treeLabels:ta($e.en),engineLabels:na($e.en)}),ra=Po(Ro),aa=(e,t)=>{let n=Mo(null),r=n.current;return r!==null&&t.every(s=>r[s]===e[s])?r:(n.current=e,e)},er=({locale:e,labels:t,surface:n,children:r})=>{let s=Zn(e,n.locale),a=Ja(()=>ea(s,t,n),[s,t,n]),o=aa(a,Vt),c=aa(ta(o),wo),l=aa(na(o),No),d=Ja(()=>({locale:s,labels:o,treeLabels:c,engineLabels:l}),[s,o,c,l]);return Lo(ra.Provider,{value:d,children:r})},fe=()=>Za(ra),q=()=>Za(ra).labels});var hn,fn,nr,bn,yn,Kt,Ke,ar,Pe,K,gt=Ne(()=>{"use strict";hn=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},fn=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,nr=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let n of t){let r=hn(e[n]);if(r)return{value:r,fieldKey:n}}return{value:null,fieldKey:null}},bn=e=>nr(e,["custom_email","email"]),yn=e=>nr(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),Kt=e=>{let t=hn(e);if(!t)return null;let n=t.replace(/[^0-9+#*]/g,"");return n.length===0?null:`tel:${n}`},Ke=(e,t)=>{let n=hn(e);return n?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(n)}`:`mailto:${encodeURIComponent(n)}`:null},ar=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString().split("T")[0]},Pe=e=>{if(!e)return"-";let t=typeof e=="string"||typeof e=="number"?new Date(e):e;return!(t instanceof Date)||Number.isNaN(t.getTime())?typeof e=="string"?e:"-":t.toISOString()},K=e=>e==null?"-":typeof e=="string"?hn(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":e instanceof Date?Pe(e):String(e)});import Wo from"lucide-react/dist/esm/icons/check.js";import Do from"lucide-react/dist/esm/icons/copy.js";import Ho from"lucide-react/dist/esm/icons/x.js";import{useCallback as et,useEffect as da,useMemo as jt,useRef as ca,useState as sr}from"react";import{createPortal as _o}from"react-dom";import{jsx as G,jsxs as Me}from"react/jsx-runtime";var Ao,rr,Gt,Et,Io,Fo,qt,ia,or,la,xn,pa=Ne(()=>{"use strict";gt();ie();Ao=350,rr=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Gt=0,Et=null,Io=()=>{let e=document.body.style;Gt+=1,Gt===1&&(Et={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},Fo=()=>{if(Gt=Math.max(0,Gt-1),Gt>0||!Et)return;let e=document.body.style;e.userSelect=Et.userSelect,typeof Et.webkitUserSelect<"u"&&(e.webkitUserSelect=Et.webkitUserSelect),Et=null},qt=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},ia=(e,t)=>{let n=new Set;return e.reduce((r,s)=>{let a=typeof s.value=="string"?s.value.trim():"";if(!a)return r;let{normalized:o,key:c,entry:l}=t(a,s);return o&&!n.has(c)&&(n.add(c),r.push(l(o))),r},[])},or=(e,t)=>e===t,la=({value:e,ariaLabel:t,size:n="md"})=>{let[r,s]=sr(!1),a=ca(null),o=et(async p=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(p),!0}catch{}if(typeof document>"u")return!1;let i=document.createElement("textarea");i.value=p,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),i.setSelectionRange(0,i.value.length);let u=document.execCommand("copy");return document.body.removeChild(i),u},[]),c=et(async p=>{p.preventDefault(),p.stopPropagation(),a.current!==null&&typeof window<"u"&&(window.clearTimeout(a.current),a.current=null);let i=await o(e);s(i),i&&typeof window<"u"&&(a.current=window.setTimeout(()=>{s(!1),a.current=null},1500))},[o,e]);da(()=>()=>{a.current!==null&&typeof window<"u"&&(window.clearTimeout(a.current),a.current=null)},[]);let l=n==="sm"?"h-6 w-6":"h-7 w-7",d=n==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=r?Wo:Do;return G("button",{type:"button",className:`inline-flex ${l} shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-200 dark:text-slate-300`,onClick:c,"aria-label":t,title:t,children:G(m,{className:d,"aria-hidden":"true"})})},xn=({contactData:e,openEmailsWithGmail:t,openGmailCompose:n,onRequestClose:r})=>{let s=q(),[a,o]=sr(null);da(()=>{o(document.body)},[]);let c=ca(null),l=ca(null),d=jt(()=>e.contacted_at?ar(e.contacted_at):null,[e.contacted_at]),m=e.full_name||"-",p=qt(e.company_name),i=qt(e.department),u=qt(e.title),h=jt(()=>ia([{fieldKey:"company_name",label:s.fieldCompanyName,value:p},{fieldKey:"department",label:s.fieldDepartment,value:i},{fieldKey:"title",label:s.fieldTitle,value:u}],(f,{fieldKey:x,label:D})=>({normalized:f,key:`${x}-${f.toLowerCase()}`,entry:H=>({fieldKey:x,label:D,value:H})})),[p,i,u,s]),C=jt(()=>ia([{fieldKey:"custom_mobile_phone_number",label:s.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:s.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:s.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:s.popupCompanyPhone,value:e.company_phone_number}],(f,{fieldKey:x,label:D})=>{let H=Kt(f);return{normalized:qt(f),key:(H??f).toLowerCase(),entry:P=>({fieldKey:x,label:D,value:P,href:H})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,s]),v=jt(()=>ia([{fieldKey:"custom_email",label:s.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:s.popupEmail,value:e.email}],(f,{fieldKey:x,label:D})=>{let H=qt(f),ee=Ke(f,t),P=!!ee?.startsWith("https://mail.google.com");return{normalized:H,key:f.toLowerCase(),entry:M=>({fieldKey:x,label:D,value:M,href:ee,isGmailLink:P})}}),[e.custom_email,e.email,t,s]),S=C.length>0||v.length>0,z=jt(()=>`contact-methods-${e.person_id}`,[e.person_id]),N=et(f=>{r(f),l.current=null},[r]),b=et(f=>{f.stopPropagation(),or(f.target,f.currentTarget)&&N()},[N]),g=et(f=>{f.stopPropagation(),or(f.target,f.currentTarget)&&(f.key==="Enter"||f.key===" ")&&(f.preventDefault(),N())},[N]),O=et(f=>{f.stopPropagation(),N()},[N]),V=et((f,x)=>{x.isGmailLink&&(f.preventDefault(),n(x.value))},[n]),y=et((f,x)=>{if(!x.isGmailLink){l.current=null;return}let D=Date.now(),H=l.current;if(H&&H.email===x.value&&D-H.timestamp<=Ao){l.current=null,f.preventDefault(),n(x.value);return}l.current={email:x.value,timestamp:D}},[n]);return da(()=>{let f=[];if(typeof window<"u"){let x=D=>{if(D.key==="Escape"){N();return}if(D.key==="Tab"&&c.current){let H=c.current.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(H.length===0)return;let ee=H[0],P=H[H.length-1];D.shiftKey?document.activeElement===ee&&(D.preventDefault(),P.focus()):document.activeElement===P&&(D.preventDefault(),ee.focus())}};window.addEventListener("keydown",x),f.push(()=>window.removeEventListener("keydown",x))}if(typeof document<"u"){let x=c.current;if(x){let P=M=>{M.stopPropagation()};for(let M of rr)x.addEventListener(M,P);f.push(()=>{for(let M of rr)x.removeEventListener(M,P)})}let D=P=>{let M=c.current;return M&&P instanceof Node?M.contains(P):!1},H=P=>{D(P.target)||N({suppressLongPress:!0,cancelLongPressTimer:!0})},ee=["pointerdown","wheel","touchmove"];for(let P of ee)document.addEventListener(P,H,!0);f.push(()=>{for(let P of ee)document.removeEventListener(P,H,!0)}),Io(),f.push(Fo)}return()=>{for(let x of f)x()}},[N,a]),a?_o(G("div",{"data-contact-popup-root":"true",className:"fixed top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-black/50 px-4 py-6",style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s"},role:"dialog","aria-modal":"true","aria-labelledby":z,tabIndex:-1,onClick:b,onKeyDown:g,children:Me("div",{ref:c,className:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-lg transition-colors dark:border-transparent dark:bg-slate-900 dark:shadow-slate-950/40 dark:ring-1 dark:ring-white/70",children:[Me("div",{className:"flex items-start justify-between gap-4",children:[Me("div",{children:[G("h2",{id:z,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),h.length>0?G("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:h.map(f=>Me("div",{className:"flex items-center gap-3",children:[G("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:f.value}),G(la,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]},f.fieldKey))}):null]}),G("button",{type:"button",className:"rounded-md p-0.5 text-slate-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring focus-visible:ring-blue-200 dark:text-slate-300 dark:hover:bg-slate-800/70",onClick:O,"aria-label":s.close,children:G(Ho,{className:"h-4 w-4","aria-hidden":"true"})})]}),Me("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[C.length>0?G("div",{children:G("ul",{className:"space-y-3 text-sm",children:C.map(f=>G("li",{className:"flex items-start gap-3",children:Me("div",{className:"flex-1",children:[G("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:f.label}),Me("div",{className:"mt-1 flex items-center gap-3",children:[G("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:f.href?G("a",{href:f.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",children:f.value}):G("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:f.value})}),G(la,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]})]})},`${f.fieldKey}-${f.value}`))})}):null,v.length>0?G("div",{children:G("ul",{className:"space-y-3 text-sm",children:v.map(f=>G("li",{className:"flex items-start gap-3",children:Me("div",{className:"flex-1",children:[G("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:f.label}),Me("div",{className:"mt-1 flex items-start gap-3",children:[Me("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[f.href?G("a",{href:f.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",target:f.isGmailLink?"_blank":void 0,rel:f.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:x=>V(x,f),onTouchEnd:x=>y(x,f),children:f.value}):G("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:f.value}),f.isGmailLink?G("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:s.popupGmailHint}):null]}),G(la,{value:f.value,ariaLabel:s.copyField(f.label),size:"sm"})]})]})},`${f.fieldKey}-${f.value}`))})}):null,d?Me("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[G("span",{className:"text-xs",children:s.popupLastContactDate}),G("span",{children:d})]}):null,S?null:G("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:s.popupNoContactMethods})]})]})}),a):null}});import{jsx as be,jsxs as Qt}from"react/jsx-runtime";var vn,ua=Ne(()=>{"use strict";vn=({fullName:e,title:t="-",companyName:n="-",department:r="-",phoneNumber:s="-",email:a="-",updatedAtText:o="-"})=>Qt("div",{className:"flex h-full w-full flex-col justify-center gap-0.5 text-slate-800 text-xs leading-tight transition-colors sm:grid sm:grid-cols-3 sm:gap-2 sm:text-sm xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[Qt("div",{className:"flex items-center gap-1 sm:hidden",children:[be("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),be("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:s})]}),be("div",{className:"flex items-center gap-1 sm:hidden",children:be("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:n})}),be("div",{className:"block sm:hidden",children:be("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:r})}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate text-slate-800 dark:text-slate-100",children:n}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:r})]}),Qt("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[be("span",{className:"truncate text-slate-700 dark:text-slate-200",children:s}),be("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:a})]}),be("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:be("span",{className:"truncate",children:o})})]})});import{getNormalizedVariants as zo,normalizeText as Bo,romajiToKatakana as Uo}from"@aiquants/select-box";var $o,Vo,Ko,jo,qo,lr,Go,Qo,ir,Cn,Yo,Xo,ma,dr,ga=Ne(()=>{"use strict";$o=/[]/g,Vo=/^[\s ]+|[\s ]+$/g,Ko=/\s+/,jo=/^[\p{Script=Latin}\s]+$/u,qo=/\p{Script=Latin}/u,lr=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1}),Go=e=>Bo(e.replace($o,"").replace(Vo,""),lr),Qo=e=>{if(!jo.test(e))return null;let t=Uo(e);return qo.test(t)?null:t},ir=e=>e.split(Ko).filter(Boolean),Cn=e=>{let t=Go(e),n=Qo(t);return n===null?t:n},Yo=e=>{let t=new Set([...ir(e),...ir(Cn(e))]),n=new Set;for(let r of t)for(let s of zo(r,lr)){let a=s.trim();a&&n.add(a)}return Array.from(n)},Xo=/[.*+?^${}()|[\]\\]/g,ma=e=>{let t=Yo(e);if(t.length===0)return null;let n=t.map(r=>r.replace(Xo,"\\$&")).sort((r,s)=>s.length-r.length);return new RegExp(n.join("|"),"gi")},dr=(e,t)=>{let n=ma(e);if(n===null)return s=>s;let r=s=>t.some(a=>{let o=s[a];return typeof o=="string"&&o.search(n)!==-1});return s=>{let a=[],o=[];for(let c of s)r(c.item)?a.push(c):o.push(c);return[...a,...o]}}});import{memo as Jo}from"react";import{Fragment as ha,jsx as kn}from"react/jsx-runtime";var de,Sn=Ne(()=>{"use strict";ga();de=Jo(({text:e,query:t,enabled:n=!0})=>{if(!(n&&t?.trim()&&e))return kn(ha,{children:e});let r=ma(t);if(r===null)return kn(ha,{children:e});let s=[],a=0,o=r.exec(e),c=0;for(;o;){let l=o[0],d=o.index;if(d>a&&s.push(e.substring(a,d)),l.length===0){r.lastIndex++,o=r.exec(e);continue}s.push(kn("mark",{className:"rounded bg-yellow-200 px-1 text-gray-900",children:l},`highlight-${d}-${c}`)),a=d+l.length,c+=1,o=r.exec(e)}return a<e.length&&s.push(e.substring(a)),kn(ha,{children:s})});de.displayName="HighlightedText"});var pr={};go(pr,{ContactDetailGrid:()=>cr,default:()=>Zo});import{useMemo as fa}from"react";import{Fragment as es,jsx as ya,jsxs as ts}from"react/jsx-runtime";var ba,cr,Zo,ur=Ne(()=>{"use strict";gt();ie();pa();ua();Sn();ba=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},cr=({contactData:e,searchTerm:t,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:s,isPopupVisible:a,onRequestClose:o})=>{let c=q(),l=fa(()=>bn(e),[e]),d=fa(()=>yn(e),[e]),m=l.value??"-",p=d.value??"-",i=fa(()=>Pe(e.updated_at),[e.updated_at]),u=ba(e.full_name)??c.noName,h=ba(e.company_name),C=ba(e.department),v=(S,z="-")=>ya(de,{text:S??z,query:t,enabled:n});return ts(es,{children:[ya(vn,{fullName:v(u),title:v(e.title),companyName:v(h),department:v(C),phoneNumber:p,email:v(m),updatedAtText:i}),a?ya(xn,{contactData:e,openEmailsWithGmail:r,openGmailCompose:s,onRequestClose:o}):null]})},Zo=cr});ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Lt}from"@aiquants/fuzzy-search";import{memo as Eo,useId as tr}from"react";import{jsx as We,jsxs as Ve}from"react/jsx-runtime";var oa=Eo(({searchOptions:e,setSearchOptions:t})=>{let n=q(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=tr(),o=tr(),c=[];return c.push(Ve("div",{className:`${r} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[Ve("div",{className:`${s} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",n.advancedLearningHeading]}),We("label",{htmlFor:a,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedLearningLabel}),We("input",{id:a,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||Lt.learningWeight,onChange:l=>t(d=>({...d,learningWeight:parseFloat(l.target.value)})),className:"w-full"}),Ve("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[n.currentValueLabel," ",e.learningWeight||Lt.learningWeight]}),We("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedLearningHint})]},"learning")),c.push(Ve("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[Ve("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",n.advancedDebounceHeading]}),We("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedDebounceLabel}),We("input",{id:o,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs||Lt.debounceMs,onChange:l=>t(d=>({...d,debounceMs:parseInt(l.target.value,10)})),className:"w-full"}),Ve("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.debounceMs||Lt.debounceMs]}),We("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedDebounceHint})]},"debounce")),Ve("section",{className:"space-y-3",children:[Ve("div",{className:"flex items-center justify-between gap-3",children:[Ve("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[We("span",{children:"\u26A1"}),We("span",{className:"tracking-wide",children:n.settingsAdvancedTab})]}),We("button",{type:"button",onClick:()=>t(l=>({...l,learningWeight:Lt.learningWeight,debounceMs:Lt.debounceMs})),className:"rounded border border-gray-300 bg-gray-100 px-2 py-1 font-medium text-gray-700 text-xs transition-colors hover:bg-gray-200 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-200 dark:hover:bg-slate-700/70",title:n.resetToDefaultsTitle,children:n.reset})]}),We("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:c})]})});oa.displayName="AdvancedSearchSettings";ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as mt}from"@aiquants/fuzzy-search";import{memo as Oo,useId as De}from"react";import{jsx as Q,jsxs as J}from"react/jsx-runtime";var sa=Oo(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a})=>{let o=q(),c="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",d=De(),m=De(),p=De(),i=De(),u=De(),h=De(),C=De(),v=De(),S=De(),z=De(),N=[];return N.push(J("div",{className:`${c} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[J("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",o.basicThresholdHeading]}),Q("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicThresholdLabel}),Q("input",{id:d,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??mt.threshold,onChange:b=>t(g=>({...g,threshold:parseFloat(b.target.value)})),className:"w-full"}),J("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[o.currentValueLabel," ",e.threshold??mt.threshold]}),Q("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?o.basicThresholdRangeRelevance:o.basicThresholdRange})]},"threshold")),N.push(J("div",{className:`${c} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[J("div",{className:`${l} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",o.basicDisplayHeading]}),J("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:m,type:"checkbox",checked:e.caseSensitive??mt.caseSensitive,onChange:b=>t(g=>({...g,caseSensitive:b.target.checked})),className:"h-3 w-3"}),o.basicCaseSensitive]}),J("label",{htmlFor:p,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:p,type:"checkbox",checked:n,onChange:b=>r(b.target.checked),className:"h-3 w-3"}),o.basicHighlight]}),J("label",{htmlFor:i,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:i,type:"checkbox",checked:s,onChange:b=>a(b.target.checked),className:"h-3 w-3"}),o.basicOpenEmailsWithGmail]}),J("div",{className:"flex flex-col gap-1",children:[Q("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicMultiTermOperator}),J("select",{id:u,value:e.multiTermOperator??mt.multiTermOperator,onChange:b=>t(g=>({...g,multiTermOperator:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[Q("option",{value:"or",children:o.basicOperatorOr}),Q("option",{value:"and",children:o.basicOperatorAnd})]}),Q("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:o.basicMultiTermHint})]})]},"display")),N.push(J("div",{className:`${c} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[J("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",o.basicSortHeading]}),J("div",{className:"flex flex-col gap-2",children:[Q("label",{htmlFor:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortBy}),J("select",{id:h,value:e.sortBy||mt.sortBy,onChange:b=>t(g=>({...g,sortBy:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[Q("option",{value:"score",children:o.basicSortByScore}),Q("option",{value:"relevance",children:o.basicSortByRelevance}),Q("option",{value:"original",children:o.basicSortByOriginal})]})]}),J("div",{className:"flex flex-col gap-2",children:[Q("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortOrder}),J("select",{id:C,value:e.sortOrder||mt.sortOrder,onChange:b=>t(g=>({...g,sortOrder:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[Q("option",{value:"desc",children:o.basicSortDescending}),Q("option",{value:"asc",children:o.basicSortAscending})]})]})]},"sorting")),N.push(J("div",{className:`${c} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[J("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",o.basicEngineHeading]}),Q("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicStrategy}),J("select",{id:v,value:e.parallelSearchStrategy||mt.parallelSearchStrategy,onChange:b=>t(g=>({...g,parallelSearchStrategy:b.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[Q("option",{value:"balanced",children:o.basicStrategyBalanced}),Q("option",{value:"index-first",children:o.basicStrategyIndexFirst}),Q("option",{value:"levenshtein-first",children:o.basicStrategyLevenshteinFirst})]}),J("div",{className:"mt-2 space-y-2",children:[J("label",{htmlFor:S,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:S,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:b=>t(g=>({...g,enableIndexFiltering:b.target.checked})),className:"h-3 w-3"}),o.basicIndexFiltering]}),J("label",{htmlFor:z,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[Q("input",{id:z,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:b=>t(g=>({...g,enableLevenshtein:b.target.checked})),className:"h-3 w-3"}),o.basicLevenshtein]})]})]},"engine")),J("section",{className:"space-y-3",children:[J("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[Q("span",{children:"\u{1F527}"}),Q("span",{className:"tracking-wide",children:o.settingsBasicTab})]}),Q("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:N})]})});sa.displayName="BasicSearchSettings";gt();import rs from"lucide-react/dist/esm/icons/badge-check.js";import os from"lucide-react/dist/esm/icons/building-2.js";import ss from"lucide-react/dist/esm/icons/calendar-clock.js";import is from"lucide-react/dist/esm/icons/check.js";import ls from"lucide-react/dist/esm/icons/copy.js";import ds from"lucide-react/dist/esm/icons/id-card.js";import cs from"lucide-react/dist/esm/icons/mail.js";import ps from"lucide-react/dist/esm/icons/phone.js";import us from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as ms,useEffect as gs,useMemo as Nn,useRef as hs,useState as fs}from"react";var He={info:(e,...t)=>console.info(`[contact-map] ${e}`,...t),warn:(e,...t)=>console.warn(`[contact-map] ${e}`,...t),error:(e,...t)=>console.error(`[contact-map] ${e}`,...t)};ie();import*as Re from"@radix-ui/react-tabs";import*as Tn from"react";import{clsx as ns}from"clsx";import{twMerge as as}from"tailwind-merge";function ht(...e){return as(ns(e))}import{jsx as xa}from"react/jsx-runtime";var wn=Re.Root,Yt=Tn.forwardRef(({className:e,...t},n)=>xa(Re.List,{ref:n,className:ht("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Yt.displayName=Re.List.displayName;var ft=Tn.forwardRef(({className:e,...t},n)=>xa(Re.Trigger,{ref:n,className:ht("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-2xs",e),...t}));ft.displayName=Re.Trigger.displayName;var bt=Tn.forwardRef(({className:e,...t},n)=>xa(Re.Content,{ref:n,className:ht("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",e),...t}));bt.displayName=Re.Content.displayName;Sn();import{jsx as R,jsxs as le}from"react/jsx-runtime";var mr={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},bs=({icon:e,label:t,value:n,fieldKey:r,copyValue:s,onCopy:a,isCopied:o,linkHref:c,searchTerm:l,enableHighlighting:d})=>{let m=q(),p=!!(a&&r&&s),i=c?.startsWith("https://mail.google.com")?"_blank":void 0;return le("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[le("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[R("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-white text-slate-500 transition-colors dark:bg-slate-800 dark:text-slate-200",children:R(e,{size:14})}),le("div",{className:"min-w-0 flex-1",children:[R("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),R("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:c?R("a",{href:c,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",target:i,rel:i?"noopener noreferrer":void 0,children:R(de,{text:n,query:l??"",enabled:d})}):R(de,{text:n,query:l??"",enabled:d})})]})]}),p?R("button",{type:"button",onClick:()=>a&&r&&s&&a(r,s,t),className:"inline-flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-500 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:border-blue-400 dark:hover:text-blue-300","aria-label":m.copyField(t),children:o?R(is,{size:14}):R(ls,{size:14})}):null]})},gr=({items:e,searchTerm:t,enableHighlighting:n})=>R("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(r=>le("div",{className:"flex flex-col gap-0.5 rounded-md border border-slate-200 bg-white/60 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[R("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:r.label}),R("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:R(de,{text:r.value,query:t??"",enabled:n})})]},r.fieldKey))}),va=({title:e})=>R("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),ys=()=>{let e=q();return le("div",{className:"flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-slate-300 border-dashed bg-white/60 p-4 text-center transition-colors dark:border-slate-700 dark:bg-slate-900/40",children:[R("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),R("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},tt=({contact:e,searchTerm:t,enableHighlighting:n,style:r,className:s=""})=>{let a=q(),[o,c]=fs(null),l=hs(null),d=Nn(()=>({...mr,...r}),[r]);gs(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=Nn(()=>bn(e),[e]),p=Nn(()=>yn(e),[e]),i=Nn(()=>Pe(e?.contacted_at??null),[e?.contacted_at]),u=ms(async(y,f,x)=>{try{await navigator.clipboard.writeText(f),c(y),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{c(null)},2e3)}catch(D){He.error("Failed to copy contact detail",D)}},[]);if(!e)return R("div",{className:"flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",style:mr,children:R(ys,{})});let h=[K(e.title),K(e.department)].filter(y=>y!=="-"),C=[h.join(" / "),K(e.company_name)].filter(y=>y&&y!=="-").join(" \u30FB ")||"-",v=K(e.full_name),S=[{fieldKey:"full_name",label:a.fieldFullName,value:v==="-"?a.noName:v},{fieldKey:"full_name_reading",label:a.fieldFullNameReading,value:K(e.full_name_reading)},{fieldKey:"title",label:a.fieldTitle,value:K(e.title)},{fieldKey:"department",label:a.fieldDepartment,value:K(e.department)},{fieldKey:"company_name",label:a.fieldCompanyName,value:K(e.company_name)},{fieldKey:"company_name_reading",label:a.fieldCompanyNameReading,value:K(e.company_name_reading)},{fieldKey:"address",label:a.fieldAddress,value:K(e.address)},{fieldKey:"postal_code",label:a.fieldPostalCode,value:K(e.postal_code)},{fieldKey:"url",label:a.fieldUrl,value:K(e.url)}],z=[{label:a.fieldCustomEmail,value:K(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:a.fieldEmail,value:K(e.email),fieldKey:"email",rawValue:e.email}].filter(y=>y.value!=="-"),N=[{label:a.fieldCustomMobilePhone,value:K(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:a.fieldMobilePhone,value:K(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:a.fieldCompanyPhone,value:K(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:a.fieldCompanyFax,value:K(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(y=>y.value!=="-"),b=[{fieldKey:"person_id",label:"person_id",value:K(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:K(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:K(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:K(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:K(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:K(e.is_in_eight)},{fieldKey:"created_by",label:a.fieldCreatedBy,value:K(e.created_by)},{fieldKey:"created_at",label:a.fieldCreatedAt,value:Pe(e.created_at)},{fieldKey:"updated_by",label:a.fieldUpdatedBy,value:K(e.updated_by)},{fieldKey:"updated_at",label:a.fieldUpdatedAt,value:Pe(e.updated_at)}],g=[{rowKey:"person_id",icon:ds,label:"person_id",value:K(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:cs,label:a.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:Ke(m.value,!1)},{rowKey:"primary_phone",icon:ps,label:a.summaryPhone,value:p.value??"-",fieldKey:"primary_phone",copyValue:p.value,linkHref:Kt(p.value)},{rowKey:"contacted_at",icon:ss,label:a.summaryLastContact,value:i}],O=[{sectionKey:"email",title:a.sectionEmail,emptyText:a.sectionEmailEmpty,entries:z,recommendedKey:m.fieldKey??null,resolveHref:y=>Ke(y!=null?String(y):null,!1)},{sectionKey:"phone",title:a.sectionPhone,emptyText:a.sectionPhoneEmpty,entries:N,recommendedKey:p.fieldKey??null,resolveHref:y=>Kt(y!=null?String(y):null)}],V=[{value:"summary",label:a.detailTabSummary,content:le("div",{className:"flex flex-col gap-4",children:[le("div",{className:"flex flex-col gap-1",children:[le("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[R(os,{size:16}),R("span",{children:R(de,{text:K(e.company_name),query:t??"",enabled:n})})]}),h.length>0?R("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:h.map((y,f)=>le("span",{children:[f>0&&" / ",R(de,{text:y,query:t??"",enabled:n})]},`header-line-${f}`))}):null]}),R("div",{className:"flex flex-col gap-3",children:g.map(y=>R(bs,{icon:y.icon,label:y.label,value:y.value,fieldKey:y.fieldKey,copyValue:y.copyValue,onCopy:u,isCopied:y.fieldKey?o===y.fieldKey:!1,linkHref:y.linkHref,searchTerm:t,enableHighlighting:n},y.rowKey))})]})},{value:"basic",label:a.detailTabBasic,content:le("div",{className:"flex flex-col gap-3",children:[R(va,{title:a.detailBasicProfile}),R(gr,{items:S,searchTerm:t,enableHighlighting:n})]})},{value:"contact",label:a.detailTabContact,content:R("div",{className:"flex flex-col gap-4",children:O.map(({sectionKey:y,title:f,emptyText:x,entries:D,recommendedKey:H,resolveHref:ee})=>le("div",{className:"flex flex-col gap-2",children:[R(va,{title:f}),D.length===0?R("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:x}):R("div",{className:"flex flex-col gap-2",children:D.map(P=>{let M=ee(P.rawValue),A=P.fieldKey===H;return le("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[le("div",{children:[R("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:P.label}),R("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:M?R("a",{href:M,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:R(de,{text:P.value,query:t??"",enabled:n})}):R(de,{text:P.value,query:t??"",enabled:n})})]}),A?le("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-700 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[R(rs,{size:14}),a.preferred]}):null]},P.fieldKey)})})]},y))})},{value:"meta",label:a.detailTabMeta,content:le("div",{className:"flex flex-col gap-3",children:[R(va,{title:a.detailTabMeta}),R(gr,{items:b,searchTerm:t,enableHighlighting:n})]})}];return le("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950 ${s}`.trim(),style:d,children:[R("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:le("div",{className:"flex items-center gap-2",children:[R("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-50 text-blue-600 transition-colors dark:bg-sky-900/40 dark:text-sky-300",children:R(us,{size:16})}),le("div",{className:"min-w-0 flex-1",children:[R("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:R(de,{text:K(e.full_name),query:t??"",enabled:n})}),R("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:R(de,{text:C,query:t??"",enabled:n})})]})]})}),le(wn,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[R(Yt,{className:"flex gap-1.5 border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:V.map(y=>R(ft,{value:y.value,className:"rounded-md px-1.5 py-0.5 font-semibold text-[11px] transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-600 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300",children:y.label},y.value))}),V.map(y=>R(bt,{value:y.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:y.content},y.value))]})]})};ut();ie();import{memo as xs}from"react";import{jsx as nt,jsxs as Pn}from"react/jsx-runtime";var Ca=xs(({recordCount:e,companyCount:t,phase:n,loadedCount:r,totalCount:s,errorMessage:a,onRetry:o})=>{let{locale:c,labels:l}=fe(),d=j(c,e),m=j(c,t);return Pn("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[Pn("span",{className:"flex items-baseline gap-1",children:[nt("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationTotalLabel}),nt("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:d}),nt("span",{className:"text-slate-600 dark:text-slate-300",children:l.recordUnit(d)})]}),Pn("span",{className:"flex items-baseline gap-1",children:[nt("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationCompaniesLabel}),nt("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),nt("span",{className:"text-slate-600 dark:text-slate-300",children:l.companyUnit(m)})]}),n==="streaming"||n==="retrying"||n==="idle"?nt("span",{"data-testid":"contact-map-stream-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-blue-50 px-2 py-0.5 font-medium text-blue-700 text-xs dark:bg-blue-900/30 dark:text-blue-300",children:s!==null&&s>0?l.annotationStreamingProgress({loaded:r,total:s,percent:Math.min(100,Math.round(r/s*100))}):l.annotationStreamingCount(r)}):null,n==="failed"||n==="auth-required"?Pn("span",{"data-testid":"contact-map-error-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-rose-50 px-2 py-0.5 font-medium text-rose-700 text-xs dark:bg-rose-900/30 dark:text-rose-300",title:n==="failed"?a??void 0:void 0,children:["\u26D4 ",n==="auth-required"?l.annotationAuthRequired:l.annotationLoadFailed(r),o?nt("button",{type:"button","data-testid":"contact-map-retry-button",onClick:o,className:"rounded border border-rose-300 bg-white px-1.5 py-0.5 font-semibold text-rose-700 transition-colors hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900",children:l.annotationRetry}):null]}):null]})});Ca.displayName="ContactMapAnnotation";Rt();import{useMemo as po}from"react";Pt();Rt();ie();import{createContext as Cs,useContext as ks,useMemo as Ss}from"react";Pt();Rt();Xn();var vs=["indexWorker","levenshteinWorker","treeWorker"];function hr(e,t,n){if(n!==void 0){if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string or left out (pass url.href for a URL object); got ${oe(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${oe(n)}`)}}var fr={setting:"workerUrls"},br=(e,t)=>{if(e===void 0)return;let{setting:n,keys:r=vs,hints:s={}}=t;if(!Mt(e))throw new TypeError(`[contact-map] ${n} must be a plain object or left out; got ${oe(e)}`);let a=Object.getOwnPropertyNames(e).map(l=>({key:l,url:e[l]})),o=a.find(({key:l,url:d})=>d!==void 0&&!r.includes(l));if(o!==void 0){let l=Object.hasOwn(s,o.key)?s[o.key]:void 0,d=l===void 0?mn(o.key,r):void 0;throw new RangeError(`[contact-map] ${n} has a key it does not take (it takes ${r.join(", ")}${l===void 0?"":`; ${l}`}${d===void 0?"":`; did you mean ${JSON.stringify(d)}?`}); got ${oe(o.key)}`)}let c=Object.create(null);for(let{key:l,url:d}of a){let m=l;hr(n,m,d),d!==void 0&&(c[m]=d)}return c};function Yd(e,t=fr){br(e,t)}function yr(e){hr("workerUrls","treeWorker",e)}var Ot=(e,t,n=fr)=>{let r=br(t,n);return{indexWorker:r?.indexWorker===void 0?e?.indexWorker:r.indexWorker,levenshteinWorker:r?.levenshteinWorker===void 0?e?.levenshteinWorker:r.levenshteinWorker,treeWorker:r?.treeWorker===void 0?e?.treeWorker:r.treeWorker}};import{jsx as ka}from"react/jsx-runtime";var xr=e=>{if(!Mt(e))throw new TypeError(`[contact-map] config must be a plain object; got ${oe(e)}`);let t=e;return{streamEndpoint:ue(t,"streamEndpoint"),openEmailsWithGmail:ue(t,"openEmailsWithGmail"),treeWorkerFactory:ue(t,"treeWorkerFactory"),workerUrls:Ot(void 0,ue(t,"workerUrls")),layoutSpec:ue(t,"layoutSpec"),locale:ue(t,"locale"),labels:ue(t,"labels")}},vr=({workerUrls:e,...t})=>{let{indexWorker:n,levenshteinWorker:r,treeWorker:s}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:n,levenshteinWorker:r,treeWorker:s})}))},Ts=vr(xr({})),Cr=Cs(Ts),ws=Object.freeze({locale:"locale",labels:"labels"});function Sa({config:e,chromeSurface:t,children:n}){let{streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:a,workerUrls:o,layoutSpec:c,locale:l,labels:d}=xr(e),{indexWorker:m,levenshteinWorker:p,treeWorker:i}=o,u=Ss(()=>vr({streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:a,workerUrls:{indexWorker:m,levenshteinWorker:p,treeWorker:i},layoutSpec:c,locale:l,labels:d}),[r,s,a,m,p,i,c,l,d]);return ka(Cr.Provider,{value:u,children:ka(er,{locale:l,labels:d,surface:t,children:n})})}function Ns({config:e,children:t}){return ka(Sa,{config:e,chromeSurface:ws,children:t})}function je(){return ks(Cr)}import{useCallback as Ta,useEffect as Os,useMemo as Ln,useSyncExternalStore as kr}from"react";Pt();var Ps=1e3,Ms=3e4,Rs=6;function Rn(e){if(typeof e!="string")throw new TypeError(`[contact-map] streamEndpoint must be a same-origin absolute path such as "/api/contact_map/stream", set on ContactMapConfigProvider or ContactMapAppView; got ${oe(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${oe(e)}`);if(!e.startsWith("/")||e.startsWith("//")||e.startsWith("/\\"))throw new RangeError(`[contact-map] streamEndpoint must be a same-origin absolute path such as "/api/contact_map/stream"; got ${oe(e)}`)}var Ls=e=>({...e,contacted_at:e.contacted_at?new Date(e.contacted_at):null,created_at:e.created_at?new Date(e.created_at):void 0,updated_at:e.updated_at?new Date(e.updated_at):void 0}),Es=e=>Array.isArray(e.records),Mn=class{constructor(t){this.recordMap=new Map;this.listeners=new Set;this.lastCursor=null;this.consecutiveFailures=0;this.started=!1;this.disposed=!1;this.activeController=null;this.wakeRetryWait=null;this.state={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null};this.handleOnline=()=>{this.wakeRetryWait?.()};Rn(t.endpoint),this.fetchFn=t.fetchFn??((...n)=>fetch(...n)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??Ps,this.maxRetryDelayMs=t.maxRetryDelayMs??Ms,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Rs,this.logger=t.logger??He}getState(){return this.state}getRecordMap(){return this.recordMap}subscribe(t){return this.listeners.add(t),()=>{this.listeners.delete(t)}}start(){this.started||this.disposed||(this.started=!0,typeof window<"u"&&window.addEventListener("online",this.handleOnline),this.runStreamLoop())}retryNow(){if(!this.disposed)switch(this.state.phase){case"retrying":this.wakeRetryWait?.();return;case"failed":case"auth-required":this.consecutiveFailures=0,this.setState({error:null,isLoading:this.recordMap.size===0}),this.runStreamLoop();return;case"idle":case"streaming":case"complete":return}}dispose(){this.disposed=!0,this.activeController?.abort(),this.wakeRetryWait?.(),typeof window<"u"&&window.removeEventListener("online",this.handleOnline)}setState(t){this.state={...this.state,...t};for(let n of this.listeners)n(this.state)}publishRecords(t={}){let n=Array.from(this.recordMap.values());this.setState({records:n,loadedCount:n.length,isLoading:!1,...t})}async runStreamLoop(){for(this.setState({phase:"streaming"});!this.disposed;){let t=await this.streamOnce();if(t==="aborted")return;if(t==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(t==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(this.consecutiveFailures+=1,this.consecutiveFailures>=this.maxConsecutiveFailures){this.setState({phase:"failed",isLoading:!1});return}let n=Math.min(this.initialRetryDelayMs*2**(this.consecutiveFailures-1),this.maxRetryDelayMs);if(this.setState({phase:"retrying",isLoading:this.recordMap.size===0}),this.logger.warn(`[ContactMapStream] retrying in ${n}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(n),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(n=>{let r=setTimeout(()=>{this.wakeRetryWait=null,n()},t);this.wakeRetryWait=()=>{clearTimeout(r),this.wakeRetryWait=null,n()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",n=new URLSearchParams;return this.lastCursor.contacted_at!==null&&n.set("cursor_contacted_at",this.lastCursor.contacted_at),n.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${n.toString()}`}async streamOnce(){this.activeController=new AbortController;try{let t=await this.fetchFn(this.buildStreamUrl(),{signal:this.activeController.signal,credentials:"same-origin"});if(t.status===401||t.status===403)return"auth-required";if(!(t.ok&&t.body))return this.logger.warn(`[ContactMapStream] unexpected response: ${t.status}`),"retryable";let n=t.body.getReader(),r=new TextDecoder,s="",a=!1,o=!1;for(;;){let{done:c,value:l}=await n.read();if(c)break;let d=r.decode(l,{stream:!0}),m=(s+d).split(`
|
|
2
|
+
`);s=m.pop()??"";let p=!1;for(let i of m){let u=i.trim();if(!u)continue;let h;try{h=JSON.parse(u)}catch(C){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",C);continue}if("type"in h&&h.type==="METADATA"){Number.isSafeInteger(h.total)&&h.total>=0&&this.setState({totalCount:h.total});continue}if(!Es(h)){this.logger.warn("[ContactMapStream] server reported error:","error"in h?h.error:""),o=!0;continue}for(let C of h.records)C&&typeof C.person_id=="number"&&(this.recordMap.set(C.person_id,Ls(C)),p=!0);h.nextCursor&&(this.lastCursor=h.nextCursor),h.isLast&&(a=!0)}p&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return o?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):a?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let n=t instanceof Error?t:new Error(String(t));return this.setState({error:n}),"retryable"}finally{this.activeController=null}}};var Le=null,Ws=e=>{if(Le!==null&&Le.endpoint===e)return Le;if(Rn(e),Le===null)return Le=new Mn({endpoint:e}),Le;if(Le.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Le.endpoint)} and cannot also stream from ${JSON.stringify(e)}; give every contact-map view in the browser tab the same streamEndpoint, on every route (after changing it, reload the page)`);return Le},pc=()=>{Le?.dispose(),Le=null},Ds=new Map,Hs={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},_s=()=>{let{streamEndpoint:e}=je();return Ln(()=>(Rn(e),e),[e])};function As(){let e=_s(),t=Ta(()=>Ws(e),[e]);Os(()=>{let o=t();o.start(),o.retryNow()},[t]);let n=Ta(o=>t().subscribe(o),[t]),r=kr(n,()=>t().getState(),()=>Hs),s=kr(n,()=>t().getRecordMap(),()=>Ds),a=Ta(()=>t().retryNow(),[t]);return Ln(()=>({...r,recordMap:s,retryNow:a}),[r,s,a])}var Is=e=>{let t=new Set;for(let{company_name:n}of e)typeof n=="string"&&n.trim().length>0&&t.add(n);return t.size};function En(){let{records:e,recordMap:t,isComplete:n,phase:r,loadedCount:s,totalCount:a,error:o,retryNow:c}=As(),l=Ln(()=>Is(e),[e]);return{context:Ln(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:r==="failed",streamPhase:r,loadedCount:s,companyCount:l,totalCount:a,errorMessage:o?.message??null}),[e,t,n,r,s,l,a,o]),retryNow:c}}ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Ua}from"@aiquants/fuzzy-search";import{useFuzzySearch as il}from"@aiquants/fuzzy-search/react";import ll from"lucide-react/dist/esm/icons/search.js";import{useCallback as rn,useEffect as Ge,useMemo as Ct,useRef as so,useState as Fe,useTransition as dl}from"react";import{useNavigation as cl,useSearchParams as pl}from"react-router";ga();Rt();import{useCallback as yt,useEffect as Fs,useRef as Sr}from"react";var at=e=>{let t=Sr(null),n=Sr({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),r=e?.dragThreshold??4,s=yt(p=>{let i=p.currentTarget,u=p.deltaY;!i||u===0||(p.preventDefault(),i.scrollBy({left:u,behavior:"smooth"}))},[]),a=yt(p=>{t.current?.removeEventListener("wheel",s),t.current=p,p?.addEventListener("wheel",s,{passive:!1})},[s]);Fs(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let o=yt(p=>{if(p.pointerType==="touch")return;let i=n.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=p.clientX,i.scrollLeft=p.currentTarget.scrollLeft,i.pointerId=p.pointerId,i.hasCapture=!1,i.pointerType=p.pointerType},[]),c=yt(p=>{let i=n.current;if(!i.isPointerDown||i.pointerType==="touch")return;let u=p.currentTarget,h=p.clientX-i.startX;!i.isDragging&&Math.abs(h)>r&&(i.isDragging=!0,i.hasCapture||(u.setPointerCapture?.(p.pointerId),i.hasCapture=!0)),i.isDragging&&(p.preventDefault(),u.scrollLeft=i.scrollLeft-h)},[r]),l=yt(p=>{let i=n.current;if(i.pointerType==="touch")return;let u=p.currentTarget;i.isPointerDown&&i.hasCapture&&u.hasPointerCapture?.(p.pointerId)&&u.releasePointerCapture(p.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),d=yt(p=>{l(p)},[l]),m=yt(p=>{n.current.didDrag&&(p.preventDefault(),p.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:a,onPointerDown:o,onPointerMove:c,onPointerUp:d,onPointerLeave:d,onPointerCancel:d,onClickCapture:m}};ut();ie();import{jsx as Tr}from"react/jsx-runtime";function wr({value:e,max:t=100,className:n,indicatorClassName:r,...s}){let a=e===void 0,o=a?0:Math.min(100,Math.max(0,e/t*100));return Tr("div",{role:"progressbar","aria-valuenow":a?void 0:o,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:ht("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...s,children:Tr("div",{"data-slot":"progress-indicator",className:ht("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",a&&"w-1/3 animate-progress-indeterminate",r),style:a?void 0:{width:`${o}%`}})})}import{useCallback as Gi,useState as Qi}from"react";import{useSearchParams as Yi}from"react-router";ie();gt();import{Panel as Or,PanelGroup as Zs,PanelResizeHandle as ei}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as ti,VirtualScroll as ni}from"@aiquants/virtualscroll";import{lazy as ai,memo as ri,Suspense as oi,useCallback as qe,useEffect as Hr,useLayoutEffect as _r,useMemo as en,useRef as tn,useState as _n}from"react";var Xt={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},Jt={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function On(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,n=t+e.scrollbarSafetyBuffer,r=n+e.hysteresisSafetyMargin,s=r-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:r,hysteresisWidth:s}}import{useCallback as zs,useEffect as Bs,useState as Us}from"react";var Nr=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:r=4,minFallbackHeight:s=240}=t??{},[a,o]=Us(600),c=zs(()=>{if(typeof window>"u")return;let l=e.current;if(!l||l.offsetParent===null&&window.getComputedStyle(l).position!=="fixed")return;let d=x=>Number.parseFloat(x)||0,{top:m}=l.getBoundingClientRect(),p=l.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),u=d(i.getPropertyValue("--footer-height")),h=d(i.getPropertyValue("--header-height")),C=d(i.getPropertyValue("--scrollbar-height")),v=window.getComputedStyle(l),S=d(v.marginBottom),z=d(v.paddingBottom),N=window.innerHeight-u-C-r,b=p?Math.min(p.bottom,N):N,g=p?Math.max(p.top,h):h,O=Math.max(m,g),V=b-O-S-z,y=Number.isFinite(V)?Math.floor(V):0,f=y>0?y:s;f>0&&Number.isFinite(f)&&o(x=>Math.abs(x-f)>1?f:x)},[r,e,s]);return Bs(()=>{if(typeof window>"u")return;let l=null,d=null,m=null,p=null,i=()=>{l!==null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{c()})};i(),d=window.setTimeout(()=>{i()},150);let u=e.current;return typeof ResizeObserver<"u"&&u&&(m=new ResizeObserver(()=>{i()}),m.observe(u),u.parentElement&&m.observe(u.parentElement)),n&&typeof MutationObserver<"u"&&(p=new MutationObserver(()=>{i()}),p.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{l!==null&&window.cancelAnimationFrame(l),d!==null&&window.clearTimeout(d),m&&m.disconnect(),p&&p.disconnect(),window.removeEventListener("resize",i)}},[e,n,c]),{viewportHeight:a,updateViewportHeight:c}};import{useCallback as rt,useEffect as Pr,useRef as Zt,useState as Mr}from"react";var $s=600,Rr=8,Wn=({ref:e,onSelect:t,resolveItem:n,item:r})=>{let[s,a]=Mr(!1),[o,c]=Mr(null),l=Zt(null),d=Zt(!1),m=Zt(!1),p=Zt(null),i=Zt({onSelect:t,resolveItem:n,item:r});Pr(()=>{i.current={onSelect:t,resolveItem:n,item:r}},[t,n,r]);let u=rt(()=>{typeof window>"u"||l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),h=rt(()=>{p.current&&(u(),m.current=!1,p.current=null)},[u]),C=rt(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(u(),m.current=!1,d.current=!1,p.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},l.current=window.setTimeout(()=>{let O=i.current,V=null;O.item!==void 0?V=O.item:O.resolveItem&&g.target&&(V=O.resolveItem(g.target)),V!==null&&(d.current=!0,O.onSelect?.(V),c(V),a(!0)),h()},$s))},[u,h]),v=rt(g=>{p.current&&g.pointerId===p.current.pointerId&&(u(),p.current=null,m.current=!1)},[u]),S=rt(g=>{d.current&&(g.preventDefault(),g.stopPropagation(),d.current=!1)},[]),z=rt(g=>{if(!p.current||g.pointerId!==p.current.pointerId)return;let O=Math.abs(g.clientX-p.current.x),V=Math.abs(g.clientY-p.current.y);(O>Rr||V>Rr)&&(u(),p.current=null)},[u]),N=rt(g=>{(s||l.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),b=rt(g=>{g?.cancelLongPressTimer&&u(),g?.suppressLongPress&&(m.current=!0),a(!1),c(null),d.current=!1,p.current=null},[u]);return Pr(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let O=[["pointerdown",C,void 0],["pointerup",v,void 0],["pointercancel",v,void 0],["pointermove",z,void 0],["pointerleave",v,void 0],["click",S,!0],["contextmenu",N,void 0]],V=[["contextmenu",N,!0],["pointerup",v,!0],["pointercancel",v,!0]];for(let[y,f,x]of O)g.addEventListener(y,f,x);for(let[y,f,x]of V)window.addEventListener(y,f,x);return()=>{for(let[y,f,x]of O)g.removeEventListener(y,f,x);for(let[y,f,x]of V)window.removeEventListener(y,f,x);u()}},[e,C,v,z,S,N,u]),{isPopupVisible:s,popupItem:o,handleClosePopup:b}};import{useCallback as Vs,useEffect as Ks,useState as Lr,useSyncExternalStore as js}from"react";function Dn(e,t,n){let r=n?.mediaQuery??"(min-width: 1024px)",s=js(Vs(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let p=window.matchMedia(r);return p.addEventListener("change",m),()=>p.removeEventListener("change",m)},[r]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(r).matches:!0,()=>!1),[a,o]=Lr(!1),[c,l]=Lr(0);return Ks(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let p=new ResizeObserver(i=>{for(let u of i){if(u.target!==m)continue;let h=0;u.borderBoxSize&&u.borderBoxSize.length>0?h=u.borderBoxSize[0].inlineSize:h=u.contentRect.width,!(!Number.isFinite(h)||h<=0)&&(l(h),o(C=>C&&h>=t.expandThreshold?!1:!C&&h<t.collapseThreshold?!0:C))}});return p.observe(m),()=>p.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!a,isContainerNarrow:a,isMediaMatches:s,containerWidth:c}}ie();ie();import{useSwipeToDismissOverlay as qs,useTapClick as Gs}from"@aiquants/swipe-overlay";import{useCallback as Qs,useEffect as Ys,useRef as Xs}from"react";import{jsx as Er,jsxs as Js}from"react/jsx-runtime";var Hn=({isOpen:e,onClose:t,children:n,className:r="",title:s})=>{let a=q(),o=Xs(null),{overlayRef:c,overlayStyle:l,attemptClose:d}=qs({isOpen:e,onClose:t,isCloseBlocked:Qs(()=>!1,[]),skipWhenTextSelected:!0}),m=Gs(()=>d());return Ys(()=>{!e&&o.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?Js("div",{ref:o,"data-testid":"contact-map-mobile-overlay",className:`fixed top-0 bottom-0 left-0 z-50 flex touch-manipulation transition-[visibility] duration-200 ${e?"pointer-events-auto visible":"pointer-events-none invisible"}`,style:{right:"var(--aqcm-overlay-right, var(--aiquants-menu-pinned-width, 0px))",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[Er("button",{type:"button","aria-label":a.overlayBackdrop,className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...m}),Er("aside",{role:"dialog","aria-modal":"true","aria-label":s===void 0?a.overlayTitle:s,style:l,ref:c,className:`relative ml-auto flex h-full w-full max-w-lg transform touch-pan-y flex-col bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900 ${r}`,onKeyDown:p=>{p.key==="Escape"&&(p.stopPropagation(),d())},children:n})]}):null};ua();import{Fragment as xi,jsx as I,jsxs as Ce}from"react/jsx-runtime";var si=ai(async()=>({default:(await Promise.resolve().then(()=>(ur(),pr))).default})),Ar=64,Wr="h-[64px]",Dr=240,ii=4,wa=On(Xt),li=Xt.listPanelMinWidth,di=Xt.detailPanelMinWidth,ci=Xt.handleThickness,Uc=wa.collapseThreshold,$c=wa.expandThreshold,pi=({contactData:e})=>{let t=q(),n=e?.full_name??t.noName,r=e?.title??"-",s=e?.company_name??"-",a=e?.department??"-",o=e?.email??"-",c=e?.company_phone_number??e?.mobile_phone_number??"-",l=e?.updated_at?Pe(e.updated_at):"-";return I(vn,{fullName:n,title:r,companyName:s,department:a,phoneNumber:c,email:o,updatedAtText:l})},ui=e=>({"--contact-panel-height":`${e}px`}),mi=e=>typeof e=="object"&&e!==null&&"item"in e,gi=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,hi=(e,t)=>{for(let n of e){let r=fn(n);if(r?.person_id===t)return r}return null},Na=(e,t,n)=>{let{viewportHeight:r}=Nr(t,{enableMutationObserver:!0,bottomGap:ii,minFallbackHeight:Dr}),[s,a]=_n(0),o=qe(()=>{let p=n.current,i=t.current;if(!(p&&i))return;let u=p.getBoundingClientRect(),h=i.getBoundingClientRect(),C=Math.ceil(h.top-u.top);Number.isFinite(C)&&C>0&&a(v=>Math.abs(v-C)>1?C:v)},[t,n]);_r(()=>{if(!e)return;o();let p=requestAnimationFrame(o);return window.addEventListener("resize",o),()=>{cancelAnimationFrame(p),window.removeEventListener("resize",o)}},[e,o]);let c=r>0?r:Dr,l=s>0?s:0,d=c+l,m=en(()=>ui(d),[d]);return{normalizedViewportHeight:c,normalizedDetailHeight:d,panelSizingStyle:m}},fi=new Set,bi=()=>{let[e,t]=_n(fi),n=qe((r,s)=>{t(a=>{if(a.has(r)===s)return a;let o=new Set(a);return s?o.add(r):o.delete(r),o})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},yi=(e,t,n)=>{let r=tn(n);_r(()=>{r.current=n},[n]),Hr(()=>{if(e!==null)return r.current(e,t),()=>{r.current(e,!1)}},[e,t])},Ir=ri(({entry:e,index:t,selectedPersonId:n,onSelect:r,searchQuery:s,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:c,onPopupVisibilityChange:l})=>{let d=q(),m=tn(null),p=I("div",{className:Wr}),i=mi(e)?e:null,u=fn(e),{isPopupVisible:h,handleClosePopup:C}=Wn({ref:m,onSelect:r,item:u?.person_id});if(yi(u?.person_id??null,h,l),!e||!u)return p;let{person_id:v}=u,S=n===v,z=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",b=S?"border-blue-300 bg-blue-50 ring-1 ring-blue-200 dark:border-blue-500 dark:bg-blue-500/20 dark:ring-blue-500/40":z,g=["B","F"].map(O=>gi(O,O==="B"?i?.baseScore:i?.score)).filter(Boolean);return Ce("div",{ref:m,className:`flex ${Wr} w-full items-center overflow-hidden border-gray-200 border-b px-4 py-2 text-left transition-colors hover:bg-blue-50 dark:border-slate-700 dark:hover:bg-blue-500/10 ${b}`,style:{height:Ar},role:"button","aria-pressed":S,"data-selected":S?"true":"false",onClick:()=>r(v),children:[Ce("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[I("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:d.listRowNumber(t+1)}),I("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:v}),I("div",{className:"flex items-center gap-1 whitespace-nowrap font-mono text-[11px] text-slate-600 leading-tight dark:text-slate-300",children:g.length?g.map(O=>I("span",{children:O},O)):I("span",{children:"-"})})]}),I(oi,{fallback:I(pi,{contactData:u}),children:I(si,{contactData:u,searchTerm:s,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:c,isPopupVisible:h,onRequestClose:C})})]})});Ir.displayName="ContactListRow";var Fr=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:r,hasSearchTerm:s,enableHighlighting:a,openEmailsWithGmail:o,isSearchTabActive:c}=e,{locale:l,labels:d,engineLabels:m}=fe(),p=tn(null),i=tn(null),[u,h]=_n(null),{normalizedViewportHeight:C,panelSizingStyle:v}=Na(c,i,p),{isAnyPopupVisible:S,handlePopupVisibilityChange:z}=bi(),N=en(()=>({enablePointerDrag:!S,enableKeyboardNavigation:!S}),[S]),b=en(()=>s?n:t,[s,n,t]),g=qe(se=>{h(se)},[]),O=qe(se=>{if(!o)return;let ae=se.trim();if(!ae||ae==="-"||typeof window>"u")return;let st=Ke(ae,!0);st&&window.open(st,"_blank","noopener,noreferrer")},[o]),[V,y]=_n(!1),f=qe(se=>{g(se),y(!0)},[g]),x=qe((se,ae)=>I(Ir,{entry:se,index:ae,selectedPersonId:u,onSelect:f,searchQuery:r,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:O,onPopupVisibilityChange:z}),[u,f,r,a,o,O,z]),D=qe(se=>b[se],[b]),H=qe(se=>fn(b[se])?.person_id??`row-${se}`,[b]),ee=qe(()=>Ar,[]),P=b.length,M=en(()=>({enabled:!0,renderVisual:ti}),[]),A=en(()=>u===null?null:hi(b,u),[u,b]);Hr(()=>{u!==null&&!A&&h(null)},[u,A]);let U=tn(null),{isTwoColumn:ne}=Dn(U,wa),ce=Ce("div",{ref:p,className:"flex min-h-0 flex-1 flex-col gap-1",children:[I("div",{className:"hidden rounded-t-lg border border-gray-200 bg-gray-50 px-4 py-2 transition-colors sm:block dark:border-slate-700 dark:bg-slate-900/70",children:Ce("div",{className:"flex items-center",children:[Ce("div",{className:"flex w-28 shrink-0 flex-col items-center gap-0.5 text-center text-[11px] text-slate-700 uppercase tracking-wider dark:text-slate-200",children:[I("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:d.columnNo}),I("span",{className:"leading-tight",children:d.columnId}),I("span",{className:"whitespace-nowrap leading-tight",children:d.columnScore})]}),Ce("div",{className:"hidden w-full grid-cols-3 gap-2 font-medium text-slate-700 text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[Ce("div",{className:"flex flex-col gap-0.5",children:[I("span",{children:d.columnName}),I("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnTitle})]}),Ce("div",{className:"flex flex-col gap-0.5",children:[I("span",{children:d.columnCompany}),I("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnDepartment})]}),Ce("div",{className:"flex flex-col gap-0.5",children:[I("span",{children:d.columnPhone}),I("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnEmail})]}),I("div",{className:"hidden items-end justify-end xl:flex",children:I("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:d.columnUpdatedAt})})]})]})}),I("div",{ref:i,className:"flex-1",children:I(ni,{itemCount:P,getItemKey:H,behaviorOptions:N,getItem:D,getItemHeight:ee,viewportSize:C,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:M},locale:l,labels:m,className:"w-full rounded-b-lg border border-gray-200 border-t-0 bg-white pr-0.75 transition-colors dark:border-slate-700 dark:bg-slate-950",children:(se,ae)=>x(se,ae)})}),n.length===0&&s?I("div",{className:"py-8 text-center",children:I("p",{className:"text-slate-600 dark:text-slate-300",children:d.listNoSearchResults})}):null,P===0&&!s?I("div",{className:"py-8 text-center",children:I("p",{className:"text-slate-600 dark:text-slate-300",children:d.listNoData})}):null]});return I("div",{ref:U,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:v,children:ne?Ce(Zs,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[I(Or,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:li,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ce}),I(ei,{id:"contact-map-list-handle",thickness:ci,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":d.listResizeHandle}),I(Or,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:di,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:I(tt,{contact:A,searchTerm:r,enableHighlighting:a})})]}):Ce(xi,{children:[ce,I("div",{className:"hidden","aria-hidden":"true",children:I(tt,{contact:A,searchTerm:r,enableHighlighting:a})}),A?I(Hn,{isOpen:V,onClose:()=>y(!1),className:"z-50 bg-white dark:bg-slate-900",children:Ce("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[Ce("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[I("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:d.detailHeading}),I("button",{type:"button",onClick:()=>y(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:d.close})]}),I("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:I(tt,{contact:A,searchTerm:r,enableHighlighting:a})})]})}):null]})})};gt();import{DirectoryTree as Li}from"@aiquants/directory-tree";import{Panel as jr,PanelGroup as Ei,PanelResizeHandle as Oi}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Wi}from"@aiquants/virtualscroll";import Di from"@heroicons/react/24/solid/FolderMinusIcon.js";import Hi from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as _e,useEffect as vt,useMemo as Ee,useRef as zn,useState as ot}from"react";import{createPortal as _i}from"react-dom";var Pa=(e,t)=>e&&e.trim()||t;import{useEffect as vi,useRef as An,useState as Ci}from"react";var zr=(e,t=250)=>{let[n,r]=Ci(e),s=An(null),a=An(e),o=An(null),c=An(!1);return vi(()=>{if(!c.current){c.current=!0,r(e),a.current=e;return}a.current=n,s.current=null;let l=d=>{s.current??(s.current=d);let m=d-s.current,p=Math.min(1,Math.max(0,m/t)),i=1-(1-p)**3,u=Math.max(0,Math.round(a.current+(e-a.current)*i));r(u),p<1&&(o.current=requestAnimationFrame(l))};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current)}},[e,t]),Math.max(0,n)};Pt();import{useCallback as Ma,useEffect as Ra,useMemo as Br,useRef as ki,useSyncExternalStore as Si}from"react";ie();var Ti=250,wi=4e3,In=3,Ur={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},$r=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,Fn=class{constructor(t,{workerSource:n,logger:r=He}){this.worker=null;this.generation=0;this.postedCount=0;this.latestSnapshot=null;this.workerNeedsReset=!1;this.lastSyncedRecords=[];this.postedNaming=null;this.lastSyncedNaming=null;this.consecutiveFailures=0;this.finalizeRequest=null;this.finalizedPostedCount=null;this.retryTimer=null;this.listeners=new Set;this.state={snapshot:null,isBuilding:!1};this.getState=()=>this.state;this.subscribe=t=>(this.listeners.add(t),()=>this.listeners.delete(t));this.handleMessage=t=>{let n=t.data;n.type!=="TREE_CHUNK"||n.generation!==this.generation||n.uniquePersonCount===0&&this.postedCount>0&&(this.latestSnapshot?.uniquePersonCount??0)>0||this.latestSnapshot!==null&&n.uniquePersonCount<this.latestSnapshot.uniquePersonCount&&!(n.isIdle&&n.consumedRecords>=this.postedCount)||(n.isIdle&&n.consumedRecords>=this.postedCount&&(this.consecutiveFailures=0),this.latestSnapshot={tree:n.tree,directoryPaths:n.directoryPaths,consumedRecords:n.consumedRecords,uniquePersonCount:n.uniquePersonCount,isIdle:n.isIdle,rebuildEpoch:n.rebuildEpoch},this.updateState())};this.handleFailure=t=>{if(this.worker?.terminate(),this.worker=null,this.postedCount=0,this.consecutiveFailures+=1,this.updateState(),this.consecutiveFailures>=In){this.logger.error(`[TreeWorker] the tree Worker failed ${In} times in a row; the tree stops updating until ${Ur[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Ti*2**(this.consecutiveFailures-1),wi);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${In})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let r=this.lastSyncedNaming;r!==null&&this.syncRecords(this.lastSyncedRecords,r)},n)};if(typeof n!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${oe(n)}`);if(!Object.hasOwn(Ur,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${oe(n)}`);this.workerFactory=t,this.workerSource=n,this.logger=r}updateState(){let t=this.postedCount>(this.latestSnapshot?.consumedRecords??0);this.state.snapshot===this.latestSnapshot&&this.state.isBuilding===t||(this.state={snapshot:this.latestSnapshot,isBuilding:t},this.notify())}notify(){for(let t of this.listeners)t()}ensureWorker(){if(this.consecutiveFailures>=In||this.retryTimer!==null)return null;if(!this.worker)try{this.worker=this.workerFactory(),this.workerNeedsReset=!0,this.worker.onerror=this.handleFailure,this.worker.onmessageerror=this.handleFailure,this.worker.onmessage=this.handleMessage}catch(t){return this.handleFailure(t),null}return this.worker}syncRecords(t,n){this.finalizeRequest!==null&&(t.length<this.finalizeRequest.recordCount||this.finalizeRequest.naming===null||!$r(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let r=this.ensureWorker();if(!r)return;let s=this.workerNeedsReset,a=this.postedNaming===null||!$r(this.postedNaming,n);if((this.workerNeedsReset||a||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=n,r.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),this.updateState()),t.length>this.postedCount){let o=t.slice(this.postedCount);this.postedCount=t.length,r.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:o}),this.updateState()}s&&this.finalizeRequest!==null&&this.finalize()}finalize(){this.finalizeRequest={recordCount:this.lastSyncedRecords.length,naming:this.lastSyncedNaming},!(this.worker===null||this.finalizedPostedCount===this.postedCount)&&(this.finalizedPostedCount=this.postedCount,this.worker.postMessage({type:"FINALIZE_TREE",generation:this.generation}))}cancelWorker(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.worker?.terminate(),this.worker=null,this.postedCount=0,this.postedNaming=null,this.finalizedPostedCount=null}stop(){this.cancelWorker(),this.consecutiveFailures=0,this.updateState()}reset(){this.cancelWorker(),this.listeners.clear(),this.latestSnapshot=null,this.lastSyncedRecords=[],this.lastSyncedNaming=null,this.consecutiveFailures=0,this.finalizeRequest=null,this.state={snapshot:null,isBuilding:!1}}},Ni=e=>{if(e!==void 0)return new Worker(e,{type:"module"});let t=typeof import.meta<"u"?import.meta.url:void 0;if(t){let r=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(r,t),{type:"module"})}throw new Error("[contact-map] the tree Worker needs workerUrls.treeWorker in a build without import.meta.url (CommonJS)")},xt=null,Vr=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),Pi=e=>{if(e===void 0)throw new Error("[contact-map] treeWorkerFactory was removed from the config while its tree session was still in use");return e},Mi=e=>{if(yr(e),xt===null){let t=new Fn(()=>Ni(e),{workerSource:"workerUrls.treeWorker"});return xt={session:t,workerUrl:e},t}if(xt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${Vr(xt.workerUrl)} and cannot also load it from ${Vr(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return xt.session},tp=()=>{xt?.session.reset(),xt=null},Ri={snapshot:null,isBuilding:!1};function Kr(e,t=!1){let n=je(),r=n.treeWorkerFactory,s=n.workerUrls?.treeWorker,{labels:a}=fe(),o=a.uncategorizedCompany,c=a.noName,l=Br(()=>({uncategorizedCompany:o,unnamedPerson:c}),[o,c]),d=ki(r);Ra(()=>{d.current=r},[r]);let m=r!==void 0,p=m?void 0:s,i=Br(()=>m?new Fn(()=>Pi(d.current)(),{workerSource:"treeWorkerFactory"}):null,[m]),u=Ma(()=>i===null?Mi(p):i,[i,p]),h=Ma(v=>u().subscribe(v),[u]),C=Ma(()=>u().getState(),[u]);return Ra(()=>{let v=u();v.syncRecords(e,l),t&&v.finalize()},[u,e,t,l]),Ra(()=>{if(i!==null)return()=>i.stop()},[i]),Si(h,C,()=>Ri)}ie();pa();Sn();import{Fragment as qi,jsx as F,jsxs as pe}from"react/jsx-runtime";var Oa=On(Jt),Ai=Jt.listPanelMinWidth,Ii=Jt.detailPanelMinWidth,Fi=Jt.handleThickness,Tp=Oa.collapseThreshold,wp=Oa.expandThreshold,zi=(e,t)=>{let{searchQuery:n,enableHighlighting:r}=t,s=Pa(e.full_name,t.noName),a=Pa(e.title,""),o=F(de,{text:s,query:n,enabled:r});return a?pe("span",{className:"flex items-center gap-1.5",children:[F("span",{children:o}),F("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:F(de,{text:a,query:n,enabled:r})})]}):o},Bi="contact-map-tree h-full w-full",Ui={hoverClassName:"bg-slate-100/70 dark:bg-slate-800/60",directorySelectedClassName:"bg-sky-100/55 dark:bg-sky-900/40 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300",itemSelectedClassName:"bg-sky-100/70 dark:bg-sky-900/55 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300"},La="h-4 w-4 shrink-0 transition-colors duration-150",$i=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),Bn=null,qr=null,nn=new Map,Gr="",Qr=null,Yr=null,Vi=(e,t,n,r,s)=>{let a=`${n?"icons":"plain"}#${r}#${s.noName}`;(a!==Gr||s.formatDirectoryName!==Qr||t!==Yr)&&(nn.clear(),Gr=a,Qr=s.formatDirectoryName,Yr=t);let o={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},c=new Set;for(let l of e){c.add(l.absolutePath);let d=`${l.name}\0${l.memberCount}`,m=nn.get(l.absolutePath);(!m||m.signature!==d)&&(m={signature:d,result:Jr([l],t,n,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},nn.set(l.absolutePath,m));let p=m.result;p.entries.length>0&&o.entries.push(p.entries[0]);for(let[i,u]of p.personPathMap){let h=o.personPathMap.get(i);if(h)for(let C of u)h.add(C);else o.personPathMap.set(i,new Set(u))}for(let[i,u]of p.contactByPath)o.contactByPath.set(i,u);for(let[i,u]of p.ancestorsByPath)o.ancestorsByPath.set(i,u);o.totalCount+=p.totalCount,!o.firstPerson&&p.firstPerson&&(o.firstPerson=p.firstPerson)}for(let l of nn.keys())c.has(l)||nn.delete(l);return o},Ea=e=>e.isSelected||e.isItemSelected?"text-sky-600 dark:text-sky-300":e.isExpanded&&e.isDirectory?"text-slate-600 dark:text-slate-200":"text-slate-500 dark:text-slate-400",Xr=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...Xr(n.children)));return t},Ki=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Jr=(e,t,n,r,s)=>{let a=new Map,o=new Map,c=new Map,l=0,d=null,m=(i,u)=>{let h=[...u,i.absolutePath];c.set(i.absolutePath,h);let C,v,S=i.type==="directory"?r.formatDirectoryName(i.name,Ki(i)):i.name,z=F(de,{text:S,query:r.searchQuery,enabled:r.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let N=t.get(i.personId);if(N){o.set(i.absolutePath,N),a.has(i.personId)||a.set(i.personId,new Set);let b=a.get(i.personId);b&&b.add(i.absolutePath),l++,d||(d={personId:i.personId,path:i.absolutePath}),n&&(v=g=>{let O=Ea(g);return g.isSelected||g.isItemSelected||i.isPrimary&&(O=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),F(n.person,{"aria-hidden":"true",className:`${La} ${O}`})},i.title&&(z=zi(N,r))),z=F("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:z})}}else if(i.children){let N=i.children.map(b=>m(b,h)).filter(b=>b!==null);if(s&&N.length===0)return null;if(C=N,n){let b=i.relativePath.startsWith("company:")?n.company:n.department;v=g=>F(b,{"aria-hidden":"true",className:`${La} ${Ea(g)}`})}}return{name:S,label:z,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:v,children:C}};return{entries:e.map(i=>m(i,[])).filter(i=>i!==null),personPathMap:a,contactByPath:o,ancestorsByPath:c,firstPerson:d,totalCount:l}},ji=(e,t,n)=>{let r=new Set,s=new Set,a=new Map;t.forEach((m,p)=>{a.set(m.item.person_id,p)});for(let m of t){let p=m.item.person_id,i=e.personPathMap.get(p);if(i)for(let u of i){r.add(u);let h=e.ancestorsByPath.get(u);if(h){for(let C of h)r.add(C);n&&h.length>0&&s.add(h[0])}}}let o=new Map,c=m=>{let p=o.get(m.absolutePath);if(p!==void 0)return p;let i=1/0;if(m.type==="file"){let u=e.contactByPath.get(m.absolutePath);u&&(i=a.get(u.person_id)??1/0)}else if(m.children)for(let u of m.children)i=Math.min(i,c(u));return o.set(m.absolutePath,i),i},l=(m,p=0)=>m.filter(i=>n&&p===0&&s.has(i.absolutePath)?!0:r.has(i.absolutePath)).map(i=>n&&p===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:l(i.children,p+1)}:i).sort((i,u)=>p===0?c(i)-c(u):0),d=l(e.entries);return{...e,entries:d}},Zr=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:r,filteredItems:s,hasSearchTerm:a,isSearchInProgress:o,isSearchTabActive:c}=e,{locale:l,labels:d,treeLabels:m}=fe(),p=d.noName,i=d.treeDirectoryName,u=Ee(()=>({noName:p,formatDirectoryName:i}),[p,i]),[h,C]=ot(null),[v,S]=ot(!1),{snapshot:z,isBuilding:N}=Kr(n,e.isStreamingComplete),b=z?.tree??null,g=z?.rebuildEpoch??0,O=Ee(()=>b?Vi(b,r,h,g,u):null,[b,r,h,g,u]),V=Ee(()=>{if(!b)return null;if(!a)return O;let W;v||(W=new Set(s.map(T=>T.item.person_id)));let k=Jr(b,r,h,{...u,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},W);return ji(k,s,v)},[b,O,r,h,e.searchQuery,e.enableHighlighting,a,s,v,u]),y=Ee(()=>V||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[V]),f=a&&e.errorMessage!==null,[x,D]=ot(y),H=zn(!1);vt(()=>{if(!(o||f)){H.current=!!b,D(y);return}!H.current&&b&&y.entries.length>0&&(H.current=!0,D(y))},[y,b,o,f]);let ee=a&&(o||f)?x:y,{entries:P,personPathMap:M,contactByPath:A,totalCount:U}=ee,ne=Ee(()=>Xr(P),[P]),[ce,se]=ot(()=>qr??new Set),ae=_e(W=>!ce.has(W),[ce]),st=_e(W=>{se(k=>{let T=new Set(k);return T.has(W)?T.delete(W):T.add(W),T})},[]),it=_e(W=>{W.length!==0&&se(k=>{let T=new Set(k);for(let Y of W)T.add(Y);return T})},[]),At=_e(W=>{se(k=>{if(k.size===0)return k;let T=!1,Y=new Set(k);for(let ve of W)Y.delete(ve)&&(T=!0);return T?Y:k})},[]);vt(()=>{qr=ce},[ce]),vt(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[ze,lt]=ot(null),[he,It]=ot(null),[Qe,Ft]=ot(!1),[$n,re]=ot(!1),zt=zn(null),Ye=zn(null),{normalizedViewportHeight:Bt,panelSizingStyle:Xe}=Na(c,Ye,zt),ye=_e(W=>{let k=A.get(W);k&&(ze!==k.person_id&<(k.person_id),W!==he&&It(W),Ft(!0))},[A,he,ze]),Ut=_e(W=>{ye(W.entry.absolutePath)},[ye]),Vn=_e(W=>W instanceof Element?W.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:Se,popupItem:on,handleClosePopup:Oe}=Wn({ref:Ye,resolveItem:Vn,onSelect:ye}),kt=_e(W=>{if(!e.openEmailsWithGmail)return;let k=W.trim();if(!k||k==="-"||typeof window>"u")return;let T=Ke(k,!0);T&&window.open(T,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),xe=on?A.get(on):null,St=Se&&xe!==null&&xe!==void 0;vt(()=>{Se&&!xe&&Oe()},[Se,xe,Oe]);let dt=Ee(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Wi}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Kn=Ee(()=>$i(dt,Bt,St),[dt,Bt,St]);vt(()=>{let W=!1;return typeof window>"u"?()=>{W=!0}:Bn?(C(Bn),()=>{W=!0}):((async()=>{try{let[T,Y,ve,Ue]=await Promise.all([import("lucide-react/dist/esm/icons/building-2.js"),import("lucide-react/dist/esm/icons/users-round.js"),import("lucide-react/dist/esm/icons/id-card.js"),import("lucide-react/dist/esm/icons/user-round.js")]);if(W)return;let ct=T.default,Yn=Y.default,Ka=ve.default,ja=Ue.default;ct&&Yn&&Ka&&ja&&(Bn={company:ct,department:Yn,title:Ka,person:ja},C(Bn))}catch(T){He.warn("Failed to load lucide icons",T)}})(),()=>{W=!0})},[]);let Je=Ee(()=>{if(!h)return;let W=Ue=>ct=>F(Ue,{"aria-hidden":"true",className:`${La} ${Ea(ct)}`}),k={company:W(h.company),department:W(h.department),title:W(h.title)},T=W(h.person),Y=Ue=>Ue in k,ve=Ue=>{let[ct]=Ue.entry.relativePath.split(":",1);return(Y(ct)?k[ct]:k.company)(Ue)};return{directory:ve,directoryExpanded:ve,file:T}},[h]),Ze=_e(()=>{se(W=>W.size===0?W:new Set)},[]),jn=_e(()=>{ne.length>0&&it(ne)},[ne,it]);vt(()=>{if(typeof window>"u")return;let W=document.documentElement,k=window.matchMedia("(prefers-color-scheme: dark)"),T=()=>re(W.classList.contains("dark")||k.matches);T(),k.addEventListener("change",T);let Y=new MutationObserver(T);return Y.observe(W,{attributes:!0,attributeFilter:["class"]}),()=>{k.removeEventListener("change",T),Y.disconnect()}},[]),vt(()=>{if(U===0){ze!==null&<(null),he!==null&&It(null);return}if(ze!==null){let W=M.get(ze);if(W){if(he&&W.has(he))return;let k=W.values().next().value;k&&It(k);return}}ze!==null&<(null),he!==null&&It(null)},[U,ze,he,M]);let Tt=he?A.get(he)??null:null,sn=$n?"#475569":"#94A3B8",wt=e.isStreamingComplete,ln=e.isStreamingFailed,Be=wt&&n.length===0,Nt=(N||!b)&&!Be,qn=zr(U,250),dn=b!==null||Be,cn=pe("div",{className:"flex items-center gap-1.5",children:[pe("span",{className:"inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono text-[10px] text-slate-700 dark:bg-slate-800 dark:text-slate-200",title:d.treeNodeCountTitle,children:[F("span",{className:"text-[10px]",children:"\u{1F333}"})," ",d.treeNodeCountLabel," ",dn?d.treeNodeCount(qn):"\u2026"]}),ln&&!wt?pe("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium text-[10px] text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300",title:d.treeStreamInterruptedTitle,children:[F("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),F("span",{className:"text-[10px]",children:"\u26D4"})," ",d.treeStreamInterrupted]}):wt?Nt?pe("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium text-[10px] text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:d.treeBuildingTitle,children:[pe("span",{className:"relative flex h-1.5 w-1.5",children:[F("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),F("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),F("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",d.treeBuilding]}):pe("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium text-[10px] text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300",title:d.treeCompleteTitle,children:[F("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),F("span",{className:"text-[10px]",children:"\u2705"})," ",d.treeComplete]}):pe("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium text-[10px] text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300",title:d.treeStreamLoadingTitle,children:[pe("span",{className:"relative flex h-1.5 w-1.5",children:[F("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),F("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),F("span",{className:"text-[10px]",children:"\u23F3"})," ",d.treeStreamLoading]}),a&&pe("button",{type:"button",onClick:()=>S(!v),className:`inline-flex h-5 items-center rounded px-1.5 text-[10px] transition-colors ${v?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800"}`,title:d.treeShowEntireCompanyTitle,children:[F("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",d.treeShowEntireCompany]}),ne.length>0?pe("div",{className:"flex items-center gap-1",children:[F("button",{type:"button",onClick:Ze,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":d.treeExpandAll,title:d.treeExpandAllTitle,children:F(Hi,{className:"h-3 w-3"})}),F("button",{type:"button",onClick:jn,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":d.treeCollapseAll,title:d.treeCollapseAllTitle,children:F(Di,{className:"h-3 w-3"})})]}):null]}),$t=zn(null),{isTwoColumn:Gn}=Dn($t,Oa,{mediaQuery:"(min-width: 768px)"}),pn=Ee(()=>({toggle:st,isExpanded:ae,expandMultiple:At,collapseMultiple:it,isPending:o}),[it,At,ae,st,o]),un=Ee(()=>({onEntryClick:Ut,selectedPath:he}),[Ut,he]),Va=Ee(()=>({className:Bi,lineColor:sn,iconOverrides:Je,showDirectoryIcons:!!Je,showFileIcons:!!Je,highlightStyles:Ui,entryClassName:"rounded-md px-1 py-0.5",nameClassName:"text-xs tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[sn,Je]),Qn=F("div",{ref:zt,className:"flex min-h-0 flex-1 flex-col rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",children:F("div",{ref:Ye,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:P.length>0?F(Li,{entries:P,expansion:pn,selection:un,visual:Va,virtualScroll:Kn,locale:l,labels:m}):F("div",{className:"flex h-full w-full items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white/70 px-6 text-center text-slate-500 text-sm transition-colors dark:border-slate-700 dark:bg-slate-900/50 dark:text-slate-300",children:a?d.treeNoMatches:d.treeEmpty})})});return pe("div",{ref:$t,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Xe,children:[t&&_i(cn,t),Gn?pe(Ei,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[F(jr,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:Ai,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:Qn}),F(Oi,{id:"contact-map-tree-handle",thickness:Fi,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":d.treeResizeHandle}),F(jr,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:Ii,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:F(tt,{contact:Tt??null,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):pe(qi,{children:[Qn,F("div",{className:"hidden","aria-hidden":"true",children:F(tt,{contact:Tt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}),Qe&&Tt?F(Hn,{isOpen:Qe,onClose:()=>Ft(!1),className:"z-50 bg-white dark:bg-slate-900",children:pe("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[pe("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[F("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:d.detailHeading}),F("button",{type:"button",onClick:()=>Ft(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:d.close})]}),F("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:F(tt,{contact:Tt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]})}):null]}),St&&xe&&F(xn,{contactData:xe,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:kt,onRequestClose:Oe})]})};import{jsx as an,jsxs as Wt}from"react/jsx-runtime";var Wa="view",Xi={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ji=e=>e==="tree"?"tree":"list",eo=({context:e})=>{let t=q(),[n,r]=Yi(),[s,a]=Qi(null),o=Ji(n.get(Wa)),{setScrollableRef:c,onPointerDown:l,onPointerMove:d,onPointerUp:m,onPointerLeave:p,onPointerCancel:i,onClickCapture:u}=at(),h=Gi(C=>{let v=C==="tree"?"tree":"list";if(v===o)return;let S=new URLSearchParams(typeof window<"u"?window.location.search:"");v==="list"?S.delete(Wa):S.set(Wa,v),r(S,{replace:!0})},[o,r]);return Wt("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[Wt("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[Wt("div",{ref:c,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-lg bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:Xi,onPointerDown:l,onPointerMove:d,onPointerUp:m,onPointerLeave:p,onPointerCancel:i,onClickCapture:u,children:[Wt("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>h("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="list"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4C4} ",t.listViewTab]}),Wt("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>h("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="tree"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F333} ",t.treeViewTab]})]}),an("div",{ref:a,className:"flex items-center gap-1.5"})]}),Wt("div",{className:"flex h-full flex-1 flex-col",children:[an("div",{className:`${o==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="list"?an(Fr,{context:e}):null}),an("div",{className:`${o==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="tree"?an(Zr,{context:e,controlsContainer:s}):null})]})]})};import{DEFAULT_FUZZY_SEARCH_OPTIONS as Ia}from"@aiquants/fuzzy-search";import{memo as tl}from"react";ie();ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as B}from"@aiquants/fuzzy-search";import{memo as Zi,useId as ke}from"react";import{jsx as E,jsxs as _}from"react/jsx-runtime";var Da=1e3,Ha=Zi(({searchOptions:e,setSearchOptions:t})=>{let n=q(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=e.sortBy==="relevance",o=ke(),c=ke(),l=ke(),d=ke(),m=ke(),p=ke(),i=ke(),u=ke(),h=ke(),C=ke(),v=ke(),S=[];S.push(_("div",{className:`${r} border-green-200 border-l-4 dark:border-green-400/60`,children:[_("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramSize}),E("input",{id:o,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||B.ngramSize,onChange:b=>t(g=>({...g,ngramSize:parseInt(b.target.value,10)})),className:"w-full"}),_("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.ngramSize||B.ngramSize]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramSizeHint})]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinNgramOverlap}),E("input",{id:c,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||B.minNgramOverlap,onChange:b=>t(g=>({...g,minNgramOverlap:parseInt(b.target.value,10)})),className:"w-full"}),_("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.minNgramOverlap||B.minNgramOverlap]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinNgramOverlapHint})]})]},"index-build")),S.push(_("div",{className:`${r} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[_("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.indexCandidateHeading]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexThreshold}),E("input",{id:l,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??B.indexWorkerOptions?.threshold,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(b.target.value)}})),className:"w-full"}),_("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??B.indexWorkerOptions?.threshold]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexThresholdHint})]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramOverlapThreshold}),E("input",{id:m,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??B.indexWorkerOptions?.ngramOverlapThreshold,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(b.target.value)}})),className:"w-full"}),_("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??B.indexWorkerOptions?.ngramOverlapThreshold]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),S.push(_("div",{className:`${r} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[_("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexStrategy}),_("select",{id:d,value:e.indexWorkerOptions?.strategy??B.indexWorkerOptions?.strategy??"hybrid",onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:b.target.value}})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[E("option",{value:"fast",children:n.indexStrategyFast}),E("option",{value:"accurate",children:n.indexStrategyAccurate}),E("option",{value:"hybrid",children:n.indexStrategyHybrid})]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexStrategyHint})]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinCandidatesRatio}),E("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??B.indexWorkerOptions?.minCandidatesRatio,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(b.target.value)}})),className:"w-full"}),_("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??B.indexWorkerOptions?.minCandidatesRatio]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinCandidatesRatioHint})]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:i,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMaxCandidatesRatio}),E("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??B.indexWorkerOptions?.maxCandidatesRatio,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(b.target.value)}})),className:"w-full"}),_("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??B.indexWorkerOptions?.maxCandidatesRatio]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),S.push(_("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[_("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",n.scoreTuningHeading]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexJaroWinklerPrefix}),E("input",{id:u,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??B.indexWorkerOptions?.jaroWinklerPrefix,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(b.target.value)}})),className:"w-full"}),_("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??B.indexWorkerOptions?.jaroWinklerPrefix]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexJaroWinklerPrefixHint})]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:h,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),_("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[E("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:b.target.checked?void 0:Da}}))}),n.noLimit]}),E("input",{id:h,type:"range",min:Da,max:"10000",step:"1000",disabled:e.indexWorkerOptions?.maxResults===void 0,value:e.indexWorkerOptions?.maxResults===void 0?Da:e.indexWorkerOptions.maxResults,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(b.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),_("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxResultsHint})]})]},"jaro")),S.push(_("div",{className:`${r} border-emerald-200 border-l-4 ${a?"":"opacity-50"} dark:border-emerald-400/60`,children:[_("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:C,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),E("input",{id:C,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??B.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(b.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),_("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??B.indexWorkerOptions?.relevanceFieldWeight??.2]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexFieldWeightHint})]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:v,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexPerfectMatchBonus}),E("input",{id:v,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??B.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(b.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),_("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??B.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexPerfectMatchBonusHint})]}),!a&&E("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:n.relevanceOnlyNotice})]},"relevance"));let z=ke(),N=ke();return S.push(_("div",{className:`${r} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[_("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",n.indexContainmentHeading]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:z,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentBase}),E("input",{id:z,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??B.indexWorkerOptions?.containmentScoreBase??.7,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(b.target.value)}})),className:"w-full"}),_("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??B.indexWorkerOptions?.containmentScoreBase??.7]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentBaseHint})]}),_("div",{className:"space-y-2",children:[E("label",{htmlFor:N,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentCoverage}),E("input",{id:N,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??B.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:b=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(b.target.value)}})),className:"w-full"}),_("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??B.indexWorkerOptions?.containmentCoverageWeight??.3]}),E("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentCoverageHint})]})]},"containment")),_("section",{className:"space-y-3",children:[_("div",{className:"flex items-center justify-between gap-3",children:[_("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[E("span",{children:"\u{1F4CA}"}),E("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),E("button",{type:"button",onClick:()=>t(b=>({...b,indexWorkerOptions:{threshold:B.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:B.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:B.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:B.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:B.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:void 0,relevanceFieldWeight:B.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:B.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:B.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:B.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:B.indexWorkerOptions?.strategy},ngramSize:B.ngramSize,minNgramOverlap:B.minNgramOverlap})),className:"rounded border border-green-300 bg-green-100 px-2 py-1 font-medium text-green-700 text-xs transition-colors hover:bg-green-200 dark:border-green-400/60 dark:bg-green-900/20 dark:text-green-200 dark:hover:bg-green-800/30",title:n.resetToDefaultsTitle,children:n.reset})]}),E("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:S})]})});Ha.displayName="IndexWorkerSettings";ie();import{DEFAULT_FUZZY_SEARCH_OPTIONS as me}from"@aiquants/fuzzy-search";import{memo as el,useId as Dt}from"react";import{jsx as Z,jsxs as te}from"react/jsx-runtime";var _a=1e3,Aa=el(({searchOptions:e,setSearchOptions:t})=>{let n=q(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=e.sortBy==="relevance",o=Dt(),c=Dt(),l=Dt(),d=Dt(),m=Dt(),p=Dt(),i=[];return i.push(te("div",{className:`${r} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[te("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),te("div",{className:"space-y-2",children:[Z("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinThreshold}),Z("input",{id:o,type:"range",min:"0.0",max:a?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??me.levenshteinWorkerOptions?.threshold,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,threshold:parseFloat(u.target.value)}})),className:"w-full"}),te("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??me.levenshteinWorkerOptions?.threshold]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),te("div",{className:"space-y-2",children:[Z("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinLengthSimilarity}),Z("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??me.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(u.target.value)}})),className:"w-full"}),te("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??me.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push(te("div",{className:`${r} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[te("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",n.scoreTuningHeading]}),te("div",{className:"space-y-2",children:[Z("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinLengthPenalty}),Z("input",{id:l,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??me.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(u.target.value)}})),className:"w-full"}),te("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??me.levenshteinWorkerOptions?.lengthDiffPenalty]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push(te("div",{className:`${r} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[te("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),Z("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),te("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[Z("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:u.target.checked?void 0:_a}}))}),n.noLimit]}),Z("input",{id:d,type:"range",min:_a,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?_a:e.levenshteinWorkerOptions.maxResults,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:parseInt(u.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),te("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinMaxResultsHint})]},"max-results")),i.push(te("div",{className:`${r} border-rose-200 border-l-4 ${a?"":"opacity-50"} dark:border-rose-400/60`,children:[te("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),te("div",{className:"space-y-2",children:[Z("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),Z("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??me.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(u.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),te("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??me.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinFieldWeightHint})]}),te("div",{className:"space-y-2",children:[Z("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinPartialBonus}),Z("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??me.levenshteinWorkerOptions?.partialMatchBonus,onChange:u=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,partialMatchBonus:parseFloat(u.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),te("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??me.levenshteinWorkerOptions?.partialMatchBonus]}),Z("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinPartialBonusHint})]}),!a&&Z("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:n.relevanceOnlyNotice})]},"relevance")),te("section",{className:"space-y-3",children:[te("div",{className:"flex items-center justify-between gap-3",children:[te("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[Z("span",{children:"\u{1F4CF}"}),Z("span",{className:"tracking-wide",children:n.levenshteinSettingsHeading})]}),Z("button",{type:"button",onClick:()=>t(u=>({...u,levenshteinWorkerOptions:{threshold:me.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:me.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:me.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:me.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:me.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:"rounded border border-purple-300 bg-purple-100 px-2 py-1 font-medium text-purple-700 text-xs transition-colors hover:bg-purple-200 dark:border-purple-400/60 dark:bg-purple-900/20 dark:text-purple-200 dark:hover:bg-purple-800/30",title:n.resetToDefaultsTitle,children:n.reset})]}),Z("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});Aa.displayName="LevenshteinWorkerSettings";import{jsx as Ie,jsxs as Ae}from"react/jsx-runtime";var nl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Fa=tl(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a,activeTab:o,onTabChange:c})=>{let l=q(),{setScrollableRef:d,onPointerDown:m,onPointerMove:p,onPointerUp:i,onPointerLeave:u,onPointerCancel:h,onClickCapture:C}=at();return Ae("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[Ae("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[Ae("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",l.searchSettings]}),Ie("div",{className:"flex flex-wrap gap-1.5",children:Ae("button",{type:"button",onClick:()=>t(v=>({...Ia,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:v.workerUrls,indexWorkerOptions:{...Ia.indexWorkerOptions},levenshteinWorkerOptions:{...Ia.levenshteinWorkerOptions}})),className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:l.settingsResetAllTitle,children:["\u{1F504} ",l.settingsResetAll]})})]}),Ie("div",{className:"mb-0 shrink-0",children:Ae("div",{ref:d,role:"tablist","aria-label":l.settingsTabsLabel,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:nl,onPointerDown:m,onPointerMove:p,onPointerUp:i,onPointerLeave:u,onPointerCancel:h,onClickCapture:C,children:[Ae("button",{type:"button",role:"tab","aria-selected":o==="basic",onClick:()=>c("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",l.settingsBasicTab]}),Ae("button",{type:"button",role:"tab","aria-selected":o==="advanced",onClick:()=>c("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",l.settingsAdvancedTab]}),Ae("button",{type:"button",role:"tab","aria-selected":o==="index",onClick:()=>c("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",l.indexWorkerName]}),Ae("button",{type:"button",role:"tab","aria-selected":o==="levenshtein",onClick:()=>c("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",l.levenshteinWorkerName]})]})}),Ae("div",{className:"flex flex-col gap-1",children:[Ie("div",{className:`${o==="basic"?"block":"hidden"}`,children:Ie(sa,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a})}),Ie("div",{className:`${o==="advanced"?"block":"hidden"}`,children:Ie(oa,{searchOptions:e,setSearchOptions:t})}),Ie("div",{className:`${o==="index"?"block":"hidden"}`,children:Ie(Ha,{searchOptions:e,setSearchOptions:t})}),Ie("div",{className:`${o==="levenshtein"?"block":"hidden"}`,children:Ie(Aa,{searchOptions:e,setSearchOptions:t})})]})]})});Fa.displayName="SearchOptionsPanel";import{memo as ol}from"react";ut();ie();import{memo as al}from"react";import{jsxs as za}from"react/jsx-runtime";var L=al(({label:e,value:t,unit:n,color:r="text-gray-600 dark:text-slate-300"})=>za("div",{className:"wrap-break-word flex min-w-0 flex-col overflow-hidden text-gray-700 transition-colors sm:flex-row sm:justify-between dark:text-slate-200",children:[za("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),za("span",{className:`font-medium ${r} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));L.displayName="StatItem";gt();ut();ie();import{memo as rl}from"react";import{jsx as w,jsxs as $}from"react/jsx-runtime";var Ht=rl(({kind:e,icon:t,stats:n,color:r})=>{let{locale:s,labels:a}=fe(),o=M=>j(s,M);if(!n)return w("section",{className:"rounded-lg border border-gray-200 border-dashed bg-white/40 p-3 text-gray-400 text-xs transition-colors dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:a.statsNoData});let c=n.basic||{},l=n.workerSpecific||{},d=n.analysis||{},m=c.totalSearches??0,p=c.totalProcessingTime??0,i=c.averageSearchTime??0,u=c.lastSearchTime??0,h=c.errorCount??0,C=c.timestamp,v=d.fieldPerformance||{},S=d.performanceInsights||{},z=d.recentHistory||[],N=l.specificMetrics||{},b=l.operationCount??0,g=l.operationDistribution||{},O=e==="index",V=e==="levenshtein",y=O?a.indexWorkerName:a.levenshteinWorkerName,f=N,x=N,D="flex flex-col gap-1 rounded-lg border border-gray-200 bg-white/80 p-3 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",H="text-xs font-semibold transition-colors",ee=M=>{if(M)return Pe(M)},P=[];if(P.push($("div",{className:`${D} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[$("div",{className:`${H} ${r}`,children:["\u{1F4CA} ",a.statsBasicHeading]}),w(L,{label:a.statTotalSearches,value:o(m),color:r}),w(L,{label:a.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:r}),w(L,{label:a.statTotalProcessingTime,value:p.toFixed(2),unit:"ms",color:r}),w(L,{label:a.statLastSearchTime,value:u.toFixed(2),unit:"ms",color:r}),w(L,{label:a.statErrorCount,value:h,color:h>0?"text-red-600 dark:text-red-400":r}),ee(C)&&w(L,{label:a.statUpdatedAt,value:ee(C),color:"text-gray-500 dark:text-slate-400"})]},"basic")),b>0||Object.keys(g).length>0){let M=Object.entries(g).sort(([,A],[,U])=>(Number(U)||0)-(Number(A)||0)).slice(0,6);P.push($("div",{className:`${D} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[$("div",{className:`${H} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",a.statsOperationsHeading]}),w(L,{label:a.statTotalOperations,value:o(b),color:"text-amber-700 dark:text-amber-300"}),M.length>0&&w("div",{className:"mt-1 space-y-1",children:M.map(([A,U])=>w(L,{label:A,value:o(Number(U)),unit:a.timesUnit(o(Number(U))),color:"text-amber-700 dark:text-amber-300"},A))})]},"operations"))}if(O&&(P.push($("div",{className:`${D} border-green-200 border-l-4 dark:border-green-400/60`,children:[$("div",{className:`${H} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.statsIndexHeading]}),w(L,{label:a.statIndexBuilds,value:o(f.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),w(L,{label:a.statDataSize,value:o(f.currentDataSize??0),unit:a.itemsUnit(o(f.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),w(L,{label:a.statLastBuildTime,value:(f.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),f.cacheSize&&P.push($("div",{className:`${D} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[$("div",{className:`${H} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",a.statsCacheHeading]}),w(L,{label:a.statCacheNgram,value:o(f.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:a.statCacheWord,value:o(f.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:a.statCachePhonetic,value:o(f.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),f.indexMetadata)){let M=Object.entries(f.indexMetadata).slice(0,6);M.length>0&&P.push($("div",{className:`${D} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[$("div",{className:`${H} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",a.statsIndexMetadataHeading]}),M.map(([A,U])=>{let ne;if(typeof U=="number"){let ce=A.toLowerCase();ce.includes("time")&&!ce.includes("timestamp")?ne=`${U.toFixed(2)}ms`:ce.includes("timestamp")||ce.includes("at")?ne=ee(U)??U.toString():ne=o(U)}else ne=String(U);return w(L,{label:A,value:ne,color:"text-teal-700 dark:text-teal-300"},A)})]},"index-meta"))}if(V){if(P.push($("div",{className:`${D} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${H} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",a.statsCalculationsHeading]}),w(L,{label:a.statTotalCalculations,value:o(x.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:a.statDistanceCalculations,value:o(x.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:a.statAverageDistance,value:typeof x.averageDistance=="number"?x.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),w(L,{label:a.statMinDistance,value:x.minDistance??a.notAvailable,color:"text-purple-700 dark:text-purple-300"}),w(L,{label:a.statMaxDistance,value:x.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),P.push($("div",{className:`${D} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[$("div",{className:`${H} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",a.statsMatchesHeading]}),w(L,{label:a.statPartialMatches,value:o(x.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),w(L,{label:a.statPerfectMatches,value:o(x.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),w(L,{label:a.statEarlyTerminations,value:o(x.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),x.similarityThresholds&&P.push($("div",{className:`${D} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[$("div",{className:`${H} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",a.statsSimilarityHeading]}),w(L,{label:a.statAbove80,value:o(x.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:a.statAbove60,value:o(x.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),w(L,{label:a.statAbove40,value:o(x.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),w(L,{label:a.statBelow40,value:o(x.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),x.distanceDistribution){let M=Object.entries(x.distanceDistribution).sort(([,A],[,U])=>Number(U)-Number(A)).slice(0,6);M.length>0&&P.push($("div",{className:`${D} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[$("div",{className:`${H} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",a.statsDistanceHeading]}),M.map(([A,U])=>w(L,{label:a.statDistance(A),value:o(Number(U)),unit:a.timesUnit(o(Number(U))),color:"text-indigo-700 dark:text-indigo-300"},A))]},"lev-distance"))}if(x.queryLengthStats){let M=Object.entries(x.queryLengthStats).sort(([,A],[,U])=>(U.count??0)-(A.count??0)).slice(0,6);M.length>0&&P.push($("div",{className:`${D} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[$("div",{className:`${H} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",a.statsQueryLengthHeading]}),M.map(([A,U])=>{let ne=Number(U.count??0),ce=Number(U.averageScore??0);return w(L,{label:a.statQueryLength(A),value:a.statQueryLengthValue({count:ne,averagePercent:(ce*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},A)})]},"lev-query-length"))}}if(Object.keys(v).length>0){let M=Object.entries(v).sort(([,A],[,U])=>(U.averageScore??0)-(A.averageScore??0)).slice(0,6);P.push($("div",{className:`${D} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[$("div",{className:`${H} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",a.statsFieldPerformanceHeading]}),M.map(([A,U])=>{let ne=U;return $("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[w("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:A}),w(L,{label:a.statAverageScore,value:`${((ne.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),w(L,{label:a.statMatchCount,value:o(ne.matchCount??0),unit:a.itemsUnit(o(ne.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),w(L,{label:a.statBestWorstScore,value:`${((ne.bestScore??0)*100).toFixed(1)}% / ${((ne.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},A)})]},"field-performance"))}if(S.bestPerformingField||S.totalHistoryEntries||S.similarityDistribution){let M=(S.recentAverageResultCount??0).toFixed(1);P.push($("div",{className:`${D} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[$("div",{className:`${H} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.statsInsightsHeading]}),S.bestPerformingField&&w(L,{label:a.statBestField,value:S.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),w(L,{label:a.statRecentAverageTime,value:(S.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),w(L,{label:a.statRecentAverageResults,value:M,unit:a.itemsUnit(M),color:"text-blue-700 dark:text-blue-300"}),w(L,{label:a.statThroughput,value:(S.throughputPerSecond??0).toFixed(2),unit:a.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),w(L,{label:a.statCommonQueryLength,value:o(S.mostCommonQueryLength??0),unit:a.charactersUnit(o(S.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),w(L,{label:a.statHistoryEntries,value:o(S.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),S.similarityDistribution&&$("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[w(L,{label:a.statHighSimilarity,value:o(S.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),w(L,{label:a.statMediumSimilarity,value:o(S.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),w(L,{label:a.statLowSimilarity,value:o(S.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),w(L,{label:a.statVeryLowSimilarity,value:o(S.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return z.length>0&&P.push($("div",{className:`${D} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[$("div",{className:`${H} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",a.statsRecentHistoryHeading]}),z.slice(-3).reverse().map((M,A)=>$("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[w("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:M.operationType}),w("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:a.statsHistoryEntry({processingTimeMs:M.processingTime.toFixed(2),resultCount:M.resultCount??0})}),ee(M.timestamp)&&w("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:ee(M.timestamp)})]},`${M.operationType}-${M.timestamp??A}`))]},"recent-history")),$("section",{className:"space-y-2",children:[$("div",{className:`flex items-center gap-2 font-semibold text-xs ${r}`,children:[w("span",{children:t}),w("span",{className:"tracking-wide",children:y})]}),w("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:P})]})});Ht.displayName="WorkerStatsSection";import{jsx as we,jsxs as Te}from"react/jsx-runtime";var sl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ba=ol(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:r,resetStats:s,rebuildIndex:a,isIndexBuilding:o,activeTab:c,onTabChange:l})=>{let{locale:d,labels:m}=fe(),p=t.trim(),i=p?r:n,{setScrollableRef:u,onPointerDown:h,onPointerMove:C,onPointerUp:v,onPointerLeave:S,onPointerCancel:z,onClickCapture:N}=at(),b=c!=="index"||o,g=o?m.statsRebuildingTitle:c!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,O=b?"cursor-not-allowed bg-gray-300 text-gray-500 dark:bg-slate-700 dark:text-slate-400":"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-500 dark:hover:bg-blue-600",V=o?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`;return Te("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[Te("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[Te("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),Te("div",{className:"flex flex-wrap gap-1.5",children:[we("button",{type:"button",onClick:()=>a(),disabled:b,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${O}`,title:g,children:V}),Te("button",{type:"button",onClick:s,className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:m.statsResetTitle,children:["\u{1F504} ",m.reset]})]})]}),we("div",{className:"mb-0 shrink-0",children:Te("div",{ref:u,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:sl,onPointerDown:h,onPointerMove:C,onPointerUp:v,onPointerLeave:S,onPointerCancel:z,onClickCapture:N,children:[Te("button",{type:"button",onClick:()=>l("overview"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${c==="overview"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CB} ",m.statsOverviewTab]}),Te("button",{type:"button",onClick:()=>l("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${c==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",m.statsIndexTab]}),Te("button",{type:"button",onClick:()=>l("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${c==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",m.statsLevenshteinTab]})]})}),Te("div",{className:"flex flex-col gap-1 pb-0.5",children:[Te("div",{className:`${c==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 text-gray-600 text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 dark:text-slate-300`,children:[we(L,{label:m.statTotalSearches,value:j(d,e.totalSearches)}),we(L,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),we(L,{label:m.statDataCount,value:j(d,e.itemCount)}),we(L,{label:p?m.statResultCount:m.statDisplayedCount,value:j(d,i)})]}),we("div",{className:`${c==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:we(Ht,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),we("div",{className:`${c==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:we(Ht,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),Te("div",{className:"hidden",children:[we(Ht,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),we(Ht,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});Ba.displayName="StatisticsPanel";import{Fragment as oo,jsx as X,jsxs as ge}from"react/jsx-runtime";var ul=/[\u200B\uFEFF]/g,$a=typeof window<"u",io=$a&&typeof document<"u",Un=(e,t=[],n=!1)=>{let r=so(e);r.current=e,Ge(()=>{if(!(!$a||n&&!io))return r.current()},[n,...t])},to=(e,t,n)=>{let[r,s]=Fe(()=>{let a=no(o=>o.getItem(e));return a&&t.includes(a)?a:n});return Un(()=>{no(a=>{a.setItem(e,r)})},[e,r]),[r,s]},no=e=>{if(!$a)return null;try{return e(window.sessionStorage)}catch{return null}},ao=(e,t)=>{let[n,r]=Fe(e);return Ge(()=>{let s=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},ml="contact-map.settings-tab",gl="contact-map.statistics-tab",hl=["basic","advanced","index","levenshtein"],fl=["overview","index","levenshtein"],ro=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],bl={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},lo=({streamState:e,...t}={})=>e===void 0?X(yl,{...t}):X(co,{...t,streamState:e}),yl=e=>{let{context:t}=En();return X(co,{...e,streamState:t})},xl={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},co=e=>{let{streamState:t,onFooterVisibilityChange:n,children:r}=e,s=ue(e,"workerUrls"),a=je(),{locale:o,labels:c}=fe(),{contactMapRecords:l,contactMapRecordMap:d,isStreamingComplete:m,isStreamingFailed:p}=t,i=cl(),[u]=pl(),h=so(null),[C,v]=Fe(!0),[S,z]=Fe(a.openEmailsWithGmail??!1),[N,b]=Fe(u.get("q")||""),g=ao(N,300);Ge(()=>{let k=u.get("q")||"";b(T=>T!==k?k:T)},[u]),Ge(()=>{if(typeof window>"u")return;let k=new URL(window.location.href);(k.searchParams.get("q")||"")!==g&&(g?k.searchParams.set("q",g):k.searchParams.delete("q"),window.history.replaceState(window.history.state,"",k.toString()))},[g]);let[O,V]=dl(),[y,f]=Fe("search"),[x,D]=to(ml,hl,"basic"),[H,ee]=to(gl,fl,"overview"),{setScrollableRef:P,onPointerDown:M,onPointerMove:A,onPointerUp:U,onPointerLeave:ne,onPointerCancel:ce,onClickCapture:se}=at(),ae=rn(()=>{if(!io)return;let k=h.current;!k||document.activeElement===k||window.requestAnimationFrame(()=>{try{k.focus({preventScroll:!0})}catch{}})},[]),st=rn(k=>{let T=k;f(T),T==="search"&&ae()},[ae]),{indexWorker:it,levenshteinWorker:At}=Ot(a.workerUrls,s,xl),ze=Ct(()=>{let{indexWorkerOptions:k={},levenshteinWorkerOptions:T={},...Y}=Ua;return{...Y,autoSearchOnIndexRebuild:!1,debounceMs:0,workerUrls:{indexWorker:it,levenshteinWorker:At},indexWorkerOptions:{...k},levenshteinWorkerOptions:{...T}}},[it,At]),[lt,he]=Fe(ze),Qe=(lt.multiTermOperator??Ua.multiTermOperator)==="and",Ft=Qe?c.operatorAndTitle:c.operatorOrTitle,$n=ao(l,m?0:800),{searchTerm:re,setSearchTerm:zt,filteredItems:Ye,resultTerm:Bt,isSearching:Xe,isIndexBuilding:ye,clearSearch:Ut,resetStats:Vn,performanceMetrics:Se,rebuildIndex:on,error:Oe}=il($n,ro,lt),kt=re.trim().length>0,[xe,St]=Fe(""),[dt,Kn]=Fe(()=>re),Je=Ct(()=>Cn(N),[N]),Ze=Ct(()=>Cn(g),[g]);Ge(()=>{g===xe&&Ze===re||V(()=>{St(g),zt(Ze)})},[g,xe,Ze,re,zt]);let jn=rn(k=>{let Y=k.target.value.replace(ul,"");b(Y)},[]),Tt=rn(()=>{b(""),St(""),Ut(),ae()},[Ut,ae]),sn=rn(()=>{he(k=>{let Y=(k.multiTermOperator??Ua.multiTermOperator??"and")==="and"?"or":"and";return{...k,multiTermOperator:Y}}),ae()},[ae]);Un(()=>{if(!(y==="search"&&i.state==="idle"&&!O))return;let T=document.activeElement;if(!!!(T?.matches('[role="tab"]')||T?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&T&&T!==document.body&&T!==h.current)return;let ve=window.requestAnimationFrame(()=>{ae()});return()=>{window.cancelAnimationFrame(ve)}},[y,i.state,O,ae],!0),Un(()=>{if(y!=="search")return;let k=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ae()}],[window,"pageshow",()=>{ae()}]];for(let[T,Y,ve]of k)T.addEventListener(Y,ve);return()=>{for(let[T,Y,ve]of k)T.removeEventListener(Y,ve)}},[y,ae],!0),Ge(()=>(n&&n(y==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[y,n]),Un(()=>{let k=document.body,T=k.style.overflow;return y==="search"&&(k.style.overflow="hidden"),()=>{k.style.overflow=T}},[y],!0),Ge(()=>{Se&&He.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:Se.totalSearches,averageSearchTime:Se.averageSearchTime,itemCount:Se.itemCount,resultsCount:Se.resultsCount,workersAvailable:!!Se.workerStats})},[Se]);let{isAwaitingDebounce:wt,isAwaitingSearchTermSync:ln,isSearchInProgress:Be}=Ct(()=>{let k=Je!==Ze,T=Ze!==re,Y=re.trim().length>0||Je.trim().length>0;return{isAwaitingDebounce:k,isAwaitingSearchTermSync:T,isSearchInProgress:O||Xe||Bt!==re&&Oe===null||Y&&ye||k||T||dt!==re}},[Je,Ze,re,Bt,Oe,O,Xe,ye,dt]),[Nt,qn]=Fe(re);Ge(()=>{Nt!==re&&qn(re)},[re,Nt]),Ge(()=>{wt||ln||O||Xe||ye||Nt===re&&dt!==re&&Kn(re)},[re,dt,wt,ln,O,Xe,ye,Nt]);let dn=Ct(()=>dr(xe,ro),[xe]),cn=Ct(()=>dn(Ye),[dn,Ye]),$t=Ct(()=>({contactMapRecords:l,contactMapRecordMap:d,filteredItems:cn,searchQuery:xe,searchTerm:re,isSearching:Xe,isIndexBuilding:ye,isPending:O,hasSearchTerm:kt,enableHighlighting:C,openEmailsWithGmail:S,isSearchInProgress:Be,isSearchTabActive:y==="search",errorMessage:Oe??null,isStreamingComplete:m,isStreamingFailed:p}),[l,d,cn,xe,re,Xe,ye,O,kt,C,S,Be,y,Oe,m,p]),Gn=kt?Ye.length:l.length,pn=j(o,l.length),un=j(o,Ye.length);return X("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${y==="search"?" h-full min-h-0":""}`,children:ge(wn,{value:y,onValueChange:st,className:`flex flex-col${y==="search"?" h-full min-h-0":""}`,children:[ge(Yt,{ref:P,style:bl,className:"scrollbar-none mt-0 mb-1 flex w-full touch-pan-x flex-nowrap overflow-x-auto overflow-y-hidden rounded-md bg-slate-50 transition-colors dark:bg-slate-900/70 dark:text-slate-200",onPointerDown:M,onPointerMove:A,onPointerUp:U,onPointerLeave:ne,onPointerCancel:ce,onClickCapture:se,children:[ge(ft,{value:"search",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F50D} ",c.searchTab]}),ge(ft,{value:"settings",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u2699\uFE0F ",c.searchSettings]}),ge(ft,{value:"statistics",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F4CA} ",c.searchStatistics]})]}),X(bt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:ge("div",{className:"flex h-full flex-col",children:[X("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:ge("div",{className:"flex flex-col",children:[X("div",{className:"relative",children:ge("div",{className:"flex items-center gap-1 p-1",children:[ge("button",{type:"button",onClick:sn,"aria-pressed":Qe,title:Ft,className:`inline-flex min-w-9 items-center justify-center gap-0.5 rounded border px-1.5 py-0.5 font-semibold text-[10px] transition-colors sm:min-w-12 sm:px-2 sm:py-0.5 sm:text-xs ${Qe?"border-blue-500 bg-blue-600 text-white hover:bg-blue-700 dark:border-blue-400 dark:bg-blue-500 dark:hover:bg-blue-600":"border-amber-400 bg-amber-100 text-amber-800 hover:bg-amber-200 dark:border-amber-500/70 dark:bg-amber-300/20 dark:text-amber-200 dark:hover:bg-amber-300/30"}`,children:[X("span",{className:"text-[10px] sm:text-xs",children:Qe?c.operatorAnd:c.operatorOr}),X("span",{className:"hidden text-[10px] sm:inline",children:Qe?c.operatorAndHint:c.operatorOrHint})]}),X("input",{ref:h,type:"text",value:N,onChange:jn,placeholder:c.searchPlaceholder,className:"flex-1 rounded border border-gray-300 border-solid px-2 py-0.5 text-xs shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none"}),N&&X("button",{type:"button",onClick:Tt,className:"flex items-center justify-center gap-1 rounded border border-gray-300 px-1.5 py-0.5 text-[10px] transition-colors hover:text-gray-700 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100",title:Be?c.searchBusyTitle:c.clearSearch,disabled:Be,children:Be?ge(oo,{children:[X(ll,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),X("span",{className:"hidden sm:inline",children:c.searching})]}):"\u2715"})]})}),ge("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[c.registeredCountLabel," ",X("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:pn})," ",c.recordUnit(pn),ye?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",c.rebuildingIndex]}):null,Oe?ge("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",c.errorLabel,X("span",{className:"ml-1 break-all font-semibold",children:Oe})]}):null,kt&&ge("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",c.resultCountLabel,Be?X("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:c.searching}):ge(oo,{children:[X("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:un}),X("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:c.resultUnit(un)})]})]})]}),X("div",{className:"h-2.5 px-2 pb-1.5",children:ye?X(wr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),r?r($t):X(eo,{context:$t})]})}),X(bt,{value:"settings",className:"mt-0",children:X(Fa,{searchOptions:lt,setSearchOptions:he,enableHighlighting:C,setEnableHighlighting:v,openEmailsWithGmail:S,setOpenEmailsWithGmail:z,activeTab:x,onTabChange:D})}),X(bt,{value:"statistics",className:"mt-0",children:X(Ba,{performanceMetrics:Se,searchTerm:re,totalDataCount:l.length,resultsCount:Gn,resetStats:Vn,rebuildIndex:on,isIndexBuilding:ye,activeTab:H,onTabChange:ee})})]})})};import{jsx as _t,jsxs as uo}from"react/jsx-runtime";var vl=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let r=q(),s=t===void 0?r.appTitle:t,{context:a,retryNow:o}=En(),c=_t(Ca,{recordCount:a.contactMapRecords.length,companyCount:a.companyCount,phase:a.streamPhase,loadedCount:a.loadedCount,totalCount:a.totalCount,errorMessage:a.errorMessage,onRetry:o});return uo("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:s,annotation:c}):uo("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[_t("h1",{className:"font-bold text-xl",children:s}),c]}),_t("div",{className:"min-h-0 flex-1",children:_t(lo,{streamState:a,onFooterVisibilityChange:n})})]})},Qu=e=>{let t=je(),n=ue(e,"streamEndpoint"),r=ue(e,"workerUrls"),s=ue(e,"locale"),a=ue(e,"labels"),o=po(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:Ot(t.workerUrls,r,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:a===void 0?t.labels:a}),[t,n,r,s,a]),c=s!==void 0,l=a!==void 0,d=po(()=>({locale:c?"ContactMapAppView locale":"locale",labels:l?"ContactMapAppView labels":"labels"}),[c,l]);return _t(Sa,{config:o,chromeSurface:d,children:_t(vl,{...e})})};ut();ie();function Ju(){return!1}export{oa as AdvancedSearchSettings,sa as BasicSearchSettings,$e as CONTACT_MAP_LABEL_CATALOGS,Vt as CONTACT_MAP_LABEL_KEYS,cr as ContactDetailGrid,tt as ContactDetailPanel,xn as ContactDetailPopup,vn as ContactDetailRowLayout,Ca as ContactMapAnnotation,Qu as ContactMapAppView,Ns as ContactMapConfigProvider,Fr as ContactMapSearchListView,lo as ContactMapSearchPage,eo as ContactMapSearchTabGroup,Zr as ContactMapSearchTreeView,Mn as ContactMapStreamClient,de as HighlightedText,Ha as IndexWorkerSettings,Uc as LIST_COLLAPSE_THRESHOLD,di as LIST_DETAIL_PANEL_MIN_WIDTH,$c as LIST_EXPAND_THRESHOLD,li as LIST_PANEL_MIN_WIDTH,ci as LIST_RESIZE_HANDLE_THICKNESS,Aa as LevenshteinWorkerSettings,wr as Progress,Fa as SearchOptionsPanel,L as StatItem,Ba as StatisticsPanel,Hn as SwipeOverlay,Tp as TREE_COLLAPSE_THRESHOLD,Ii as TREE_DETAIL_PANEL_MIN_WIDTH,wp as TREE_EXPAND_THRESHOLD,Ai as TREE_PANEL_MIN_WIDTH,Fi as TREE_RESIZE_HANDLE_THICKNESS,wn as Tabs,bt as TabsContent,Yt as TabsList,ft as TabsTrigger,Fn as TreeWorkerSession,Ht as WorkerStatsSection,Rn as assertContactMapStreamEndpoint,yr as assertContactMapTreeWorkerUrl,Yd as assertContactMapWorkerUrls,$i as composeTreeVirtualScrollOptions,Ju as contactMapShouldRevalidate,Is as countContactMapCompanies,Ls as deserializeStreamRecord,Ws as getContactMapStreamClient,Mi as getTreeWorkerSession,Ot as layerContactMapWorkerUrls,pc as resetContactMapStreamClientForTesting,tp as resetTreeWorkerSessionForTesting,ea as resolveContactMapLabels,zr as useAnimatedNumber,je as useContactMapConfig,q as useContactMapLabels,As as useContactMapStream,Na as useContactPanelSizing,Nr as useDynamicViewportHeight,at as useHorizontalDragScroll,Wn as useLongPressPopup,yi as useReportPopupVisibility,Dn as useResponsiveTwoColumnLayout,bi as useRowPopupRegistry,En as useStreamedContactMapContext,Kr as useTreeWorker};
|