@aiquants/contact-map 0.16.0 → 0.17.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/dist/client.js +1 -1
- package/dist/client.mjs +1 -1
- package/package.json +3 -3
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
var Ko=Object.defineProperty;var he=(e,t)=>()=>(e&&(t=e(e=0)),t);var jo=(e,t)=>{for(var n in t)Ko(e,n,{get:t[n],enumerable:!0})};var Ie,Ct,hr,Kt,jt,fn,nt,Pe,Wn,va,Ca,Ge,q,kt=he(()=>{"use strict";Ie=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},Ct=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,hr=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let n of t){let a=Ie(e[n]);if(a)return{value:a,fieldKey:n}}return{value:null,fieldKey:null}},Kt=e=>hr(e,["custom_email","email"]),jt=e=>hr(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),fn=e=>{let t=Ie(e);if(!t)return null;let n=t.replace(/[^0-9+#*]/g,"");return n.length===0?null:`tel:${n}`},nt=(e,t)=>{let n=Ie(e);return n?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(n)}`:`mailto:${encodeURIComponent(n)}`:null},Pe=(e,t)=>String(e).padStart(t,"0"),Wn=e=>`${Pe(e.getUTCFullYear(),4)}-${Pe(e.getUTCMonth()+1,2)}-${Pe(e.getUTCDate(),2)}`,va=e=>`${Wn(e)} ${Pe(e.getUTCHours(),2)}:${Pe(e.getUTCMinutes(),2)}:${Pe(e.getUTCSeconds(),2)}`,Ca=e=>`${Pe(e.getFullYear(),4)}-${Pe(e.getMonth()+1,2)}-${Pe(e.getDate(),2)} ${Pe(e.getHours(),2)}:${Pe(e.getMinutes(),2)}:${Pe(e.getSeconds(),2)}`,Ge=(e,t)=>{if(e==null||e==="")return"-";let n=typeof e=="string"?new Date(e):e;return Number.isNaN(n.getTime())?typeof e=="string"?e:"-":t(n)},q=e=>e==null?"-":typeof e=="string"?Ie(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":String(e)});var Z,fr,St=he(()=>{"use strict";Z=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":fr(e);case"function":return fr(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},fr=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var Gt,xe,qt=he(()=>{"use strict";Gt=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},xe=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var Go,Hn,ka=he(()=>{"use strict";Go=(e,t)=>{let n=Array.from({length:t.length+1},(a,s)=>s);for(let a=1;a<=e.length;a+=1){let s=[a];for(let o=1;o<=t.length;o+=1){let r=n[o-1]+(e[a-1]===t[o-1]?0:1);s.push(Math.min(n[o]+1,s[o-1]+1,r))}n=s}return n[t.length]},Hn=(e,t)=>{let n=e.toLowerCase();if(n.length>=3){let s=t.find(o=>o.toLowerCase().startsWith(n));if(s!==void 0)return s}let a;for(let s of t){let o=Go(n,s.toLowerCase());o<=Math.max(1,Math.floor(s.length/4))&&(a===void 0||o<a.distance)&&(a={key:s,distance:o})}return a?.key}});import{DIRECTORY_TREE_LABEL_CATALOGS as br,DIRECTORY_TREE_LABEL_KEYS as Sa,resolveDirectoryTreeLabels as qo}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as Yo,VIRTUAL_SCROLL_LABEL_KEYS as Qo}from"@aiquants/virtualscroll";var Xo,G,Tt,In,xr,bn,at,Jo,yr,vr,Zo,Ta,es,ts,ns,wa,Na,Ma,wt=he(()=>{"use strict";kt();St();qt();ka();Xo=Object.freeze({en:"en-US",ja:"ja-JP"}),G=(e,t)=>t.toLocaleString(Xo[e]),Tt=(e,t,n)=>e==="1"?t:n,In=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`Streaming (${G("en",e)} / ${G("en",t)} \xB7 ${n}%)`,annotationStreamingCount:e=>`Streaming (${G("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${G("en",e)} received)`,annotationReconnecting:e=>`Reconnecting (${G("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>Tt(e,"record","records"),companyUnit:e=>Tt(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=>Tt(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",listboxLabel:"Contact list",listKeyboardHelp:"Up and down arrows move between contacts, Page Up and Page Down move by a screen, Home and End go to the first and the last; Enter or Space opens the contact's details.",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=>G("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${G("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",recordDateTime:va,recordDate:Wn,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",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:"Operator for words inside quotes",basicOperatorOr:"OR (any word matches)",basicOperatorAnd:"AND (all words match)",basicMultiTermHint:'How words between quotation marks ("tanaka taro") are combined (default: AND). Words outside quotation marks are separate keywords combined by the AND / OR button',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",statsTabsLabel:"Statistics tabs",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",statsTimestamp:Ca,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=G("en",e);return`${n} ${Tt(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: ${G("en",t)}`,timesUnit:e=>Tt(e," time"," times"),itemsUnit:e=>Tt(e," item"," items"),charactersUnit:e=>Tt(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 (${G("ja",e)} / ${G("ja",t)} \u4EF6\u30FB${n}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${G("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${G("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationReconnecting:e=>`\u518D\u63A5\u7D9A\u4E2D (${G("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",listboxLabel:"\u9023\u7D61\u5148\u4E00\u89A7",listKeyboardHelp:"\u4E0A\u4E0B\u306E\u77E2\u5370\u30AD\u30FC\u3067\u9023\u7D61\u5148\u3092\u79FB\u308A\u3001Page Up \u3068 Page Down \u3067 1 \u753B\u9762\u305A\u3064\u3001Home \u3068 End \u3067\u5148\u982D\u3068\u672B\u5C3E\u3078\u79FB\u308A\u307E\u3059\u3002Enter \u304B Space \u3067\u9023\u7D61\u5148\u306E\u8A73\u7D30\u3092\u958B\u304D\u307E\u3059\u3002",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=>`${G("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${G("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",recordDateTime:va,recordDate:Wn,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",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:"\u5F15\u7528\u7B26\u306E\u4E2D\u306E\u8A9E\u306E\u6F14\u7B97\u5B50",basicOperatorOr:"OR (\u3044\u305A\u308C\u304B\u4E00\u81F4)",basicOperatorAnd:"AND (\u3059\u3079\u3066\u4E00\u81F4)",basicMultiTermHint:'\u5F15\u7528\u7B26\u3067\u56F2\u3093\u3060\u8A9E ("\u7530\u4E2D \u592A\u90CE") \u306E\u7D50\u5408\u65B9\u6CD5 (\u65E2\u5B9A\u306F AND)\u3002\u5F15\u7528\u7B26\u306E\u5916\u306E\u8A9E\u306F\u305D\u308C\u305E\u308C\u5225\u306E\u30AD\u30FC\u30EF\u30FC\u30C9\u3067\u3001AND / OR \u30DC\u30BF\u30F3\u3067\u7D50\u5408\u3059\u308B',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",statsTabsLabel:"\u691C\u7D22\u7D71\u8A08\u30BF\u30D6",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",statsTimestamp:Ca,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})=>`${G("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: ${G("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),xr=Object.freeze(Object.keys(In.en)),bn=Object.freeze([...Sa,...xr]),at=Object.freeze({en:Object.freeze({...br.en,...In.en}),ja:Object.freeze({...br.ja,...In.ja})}),Jo=new Set(bn),yr=Object.keys(at).map(e=>JSON.stringify(e)).join(" or "),vr=Object.freeze({locale:"locale",labels:"labels"}),Zo=(e,t,n)=>{e[t]=n},Ta=(e,t=vr.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${yr} or left out; got ${Z(e)}`);if(e!==void 0&&!Object.hasOwn(at,e))throw new RangeError(`[contact-map] ${t} must be ${yr} or left out; got ${Z(e)}`);return Yo(e)},es=(e,t,n,a)=>{if(typeof a=="function"){if(typeof n!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${Z(n)}`);return}if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${Z(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${Z(n)}`)},ts=(e,t,n)=>{let a=Object.create(null);for(let s of Object.getOwnPropertyNames(e)){if(!Jo.has(s)){let r=Hn(s,bn);throw new RangeError(`[contact-map] ${n} has a key that is not a label key (${r===void 0?"":`did you mean ${JSON.stringify(r)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${Z(s)}`)}let o=e[s];o!==void 0&&(es(n,s,o,t[s]),a[s]=o)}return a},ns=e=>{let t={},n=!1;for(let a of Sa){let s=e[a];s!==void 0&&(t[a]=s,n=!0)}return n?t:void 0},wa=(e,t,n=vr)=>{let a=Ta(e,n.locale);if(t===void 0)return at[a];if(!Gt(t))throw new TypeError(`[contact-map] ${n.labels} must be a plain object or left out; got ${Z(t)}`);let s=ts(t,at[a],n.labels),r={...qo(a,ns(s)),...In[a]};for(let c of xr){let d=s[c];d!==void 0&&Zo(r,c,d)}return Object.freeze(r)},Na=e=>{let t={};for(let n of Sa)t[n]=e[n];return Object.freeze(t)},Ma=e=>{let t={};for(let n of Qo)t[n]=e[n];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as as}from"@aiquants/directory-tree";import{VIRTUAL_SCROLL_LABEL_KEYS as rs}from"@aiquants/virtualscroll";import{createContext as os,useContext as kr,useMemo as Cr,useRef as ss}from"react";import{jsx as ls}from"react/jsx-runtime";var is,Pa,Ea,Sr,ve,Y,le=he(()=>{"use strict";wt();is=Object.freeze({locale:"en",labels:at.en,treeLabels:Na(at.en),engineLabels:Ma(at.en)}),Pa=os(is),Ea=(e,t)=>{let n=ss(null),a=n.current;return a!==null&&t.every(s=>a[s]===e[s])?a:(n.current=e,e)},Sr=({locale:e,labels:t,surface:n,children:a})=>{let s=Ta(e,n.locale),o=Cr(()=>wa(s,t,n),[s,t,n]),r=Ea(o,bn),c=Ea(Na(r),as),d=Ea(Ma(r),rs),l=Cr(()=>({locale:s,labels:r,treeLabels:c,engineLabels:d}),[s,r,c,d]);return ls(Pa.Provider,{value:l,children:a})},ve=()=>kr(Pa),Y=()=>kr(Pa).labels});var E,pt,y,ge=he(()=>{"use strict";E="text-[length:var(--aqcm-font-size-body,0.8125rem)] leading-[var(--aqcm-line-height-body,1.25rem)]",pt="text-[length:var(--aqcm-font-size-caption,0.6875rem)]",y=`${pt} leading-[var(--aqcm-line-height-caption,1.25rem)]`});var Fn,$n,zn,Bn,Oa=he(()=>{"use strict";Fn="fixed inset-y-0 left-0 m-0 h-auto max-h-none w-auto max-w-none border-0 bg-transparent p-0 text-inherit outline-none backdrop:bg-transparent motion-safe:transition-[right] motion-safe:duration-500 motion-safe:ease-[ease]",$n=Object.freeze({right:"var(--aqcm-overlay-right, 0px)"}),zn="absolute inset-0 bg-slate-900/50",Bn=()=>!1});var us,gt,wr,Qt,yn=he(()=>{"use strict";us="min-w-11 py-[max(0px,calc((2.75rem_-_1lh)_/_2))]",gt="focus-visible:outline-2 focus-visible:outline-blue-700 focus-visible:outline-offset-2 dark:focus-visible:outline-sky-300",wr="in-focus-visible:data-[contact-map-row-active]:outline-2 in-focus-visible:data-[contact-map-row-active]:-outline-offset-2 in-focus-visible:data-[contact-map-row-active]:outline-blue-700 dark:in-focus-visible:data-[contact-map-row-active]:outline-sky-300",Qt=`inline-block max-w-full underline-offset-2 hover:underline focus-visible:underline ${gt} ${us}`});import{clsx as ms}from"clsx";import{twMerge as ps}from"tailwind-merge";function fe(...e){return ps(ms(e))}var xn=he(()=>{"use strict"});import{useOverlayDialog as gs}from"@aiquants/swipe-overlay";import hs from"lucide-react/dist/esm/icons/check.js";import fs from"lucide-react/dist/esm/icons/copy.js";import bs from"lucide-react/dist/esm/icons/x.js";import{useCallback as Zt,useEffect as Nr,useId as ys,useMemo as Un,useRef as Mr,useState as xs}from"react";import{createPortal as vs}from"react-dom";import{jsx as Q,jsxs as Fe}from"react/jsx-runtime";var Cs,we,ks,Ss,Ts,vn,Jt,ws,Ns,Xt,_a,Aa,Vn,Da=he(()=>{"use strict";kt();le();Oa();yn();ge();xn();Cs=350,we=e=>e.stopPropagation(),ks=Object.freeze({onClick:we,onDoubleClick:we,onContextMenu:we,onPointerDown:we,onPointerUp:we,onMouseDown:we,onMouseUp:we,onTouchStart:we,onTouchEnd:we,onKeyDown:we,onKeyUp:we,onFocus:we,onBlur:we}),Ss=fe(Fn,"flex items-center justify-center px-4 py-6"),Ts="relative max-h-full w-full max-w-md overflow-y-auto overscroll-contain 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",vn=0,Jt=null,ws=()=>{let e=document.body.style;vn+=1,vn===1&&(Jt={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},Ns=()=>{if(vn=Math.max(0,vn-1),vn>0||!Jt)return;let e=document.body.style;e.userSelect=Jt.userSelect,typeof Jt.webkitUserSelect<"u"&&(e.webkitUserSelect=Jt.webkitUserSelect),Jt=null},Xt=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},_a=(e,t)=>{let n=new Set;return e.reduce((a,s)=>{let o=typeof s.value=="string"?s.value.trim():"";if(!o)return a;let{normalized:r,key:c,entry:d}=t(o,s);return r&&!n.has(c)&&(n.add(c),a.push(d(r))),a},[])},Aa=({value:e,ariaLabel:t})=>{let[n,a]=xs(!1),s=Mr(null),o=Zt(async d=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(d),!0}catch{}if(typeof document>"u")return!1;let l=document.createElement("textarea");l.value=d,l.setAttribute("readonly",""),l.style.position="absolute",l.style.left="-9999px",document.body.appendChild(l),l.select(),l.setSelectionRange(0,l.value.length);let u=document.execCommand("copy");return document.body.removeChild(l),u},[]),r=Zt(async d=>{d.preventDefault(),d.stopPropagation(),s.current!==null&&typeof window<"u"&&(window.clearTimeout(s.current),s.current=null);let l=await o(e);a(l),l&&typeof window<"u"&&(s.current=window.setTimeout(()=>{a(!1),s.current=null},1500))},[o,e]);Nr(()=>()=>{s.current!==null&&typeof window<"u"&&(window.clearTimeout(s.current),s.current=null)},[]);let c=n?hs:fs;return Q("button",{type:"button",className:`inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 dark:text-slate-300 ${gt}`,onClick:r,"aria-label":t,title:t,children:Q(c,{className:"h-3.5 w-3.5","aria-hidden":"true"})})},Vn=({contactData:e,openEmailsWithGmail:t,openGmailCompose:n,onRequestClose:a})=>{let s=Y(),o=Mr(null),r=Un(()=>e.contacted_at?Ge(e.contacted_at,s.recordDate):null,[e.contacted_at,s.recordDate]),c=Xt(e.full_name)??s.noName,d=Xt(e.company_name),l=Xt(e.department),u=Xt(e.title),m=Un(()=>_a([{fieldKey:"company_name",label:s.fieldCompanyName,value:d},{fieldKey:"department",label:s.fieldDepartment,value:l},{fieldKey:"title",label:s.fieldTitle,value:u}],(x,{fieldKey:w,label:D})=>({normalized:x,key:`${w}-${x.toLowerCase()}`,entry:b=>({fieldKey:w,label:D,value:b})})),[d,l,u,s]),i=Un(()=>_a([{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}],(x,{fieldKey:w,label:D})=>{let b=fn(x);return{normalized:Xt(x),key:(b??x).toLowerCase(),entry:X=>({fieldKey:w,label:D,value:X,href:b})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,s]),p=Un(()=>_a([{fieldKey:"custom_email",label:s.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:s.popupEmail,value:e.email}],(x,{fieldKey:w,label:D})=>{let b=Xt(x),T=nt(x,t),X=!!T?.startsWith("https://mail.google.com");return{normalized:b,key:x.toLowerCase(),entry:W=>({fieldKey:w,label:D,value:W,href:T,isGmailLink:X})}}),[e.custom_email,e.email,t,s]),h=i.length>0||p.length>0,v=ys(),k=Zt(()=>{a(),o.current=null},[a]),C=Zt(x=>x.ownerDocument.getElementById(v),[v]),{dialogProps:F,backdropProps:I}=gs({isOpen:!0,onClose:k,isCloseBlocked:Bn,initialFocus:C}),f=Zt((x,w)=>{w.isGmailLink&&(x.preventDefault(),n(w.value))},[n]),g=Zt((x,w)=>{if(!w.isGmailLink){o.current=null;return}let D=Date.now(),b=o.current;if(b&&b.email===w.value&&D-b.timestamp<=Cs){o.current=null,x.preventDefault(),n(w.value);return}o.current={email:w.value,timestamp:D}},[n]);return Nr(()=>(ws(),Ns),[]),vs(Fe("dialog",{...F,...ks,"data-contact-popup-root":"true","aria-labelledby":v,className:Ss,style:$n,children:[Q("div",{...I,"data-contact-popup-backdrop":"",className:zn}),Fe("div",{"data-contact-popup-card":"",className:Ts,children:[Fe("div",{className:"flex items-center justify-between gap-4",children:[Q("h2",{id:v,tabIndex:-1,className:"wrap-break-word min-w-0 font-semibold text-gray-900 text-lg outline-none dark:text-slate-100",children:c}),Q("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-md p-3.5 text-slate-600 transition-colors hover:bg-gray-100 dark:text-slate-300 dark:hover:bg-slate-800/70 ${gt}`,onClick:k,"aria-label":s.close,children:Q(bs,{className:"h-4 w-4","aria-hidden":"true"})})]}),m.length>0?Q("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:m.map(x=>Fe("div",{className:"flex items-center gap-3",children:[Q("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:x.value}),Q(Aa,{value:x.value,ariaLabel:s.copyField(x.label)})]},x.fieldKey))}):null,Fe("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[i.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:i.map(x=>Q("li",{className:"flex items-start gap-3",children:Fe("div",{className:"min-w-0 flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:x.label}),Fe("div",{className:"mt-1 flex items-center gap-3",children:[Q("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:x.href?Q("a",{href:x.href,className:`wrap-break-word text-blue-800 dark:text-blue-300 ${Qt}`,children:x.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:x.value})}),Q(Aa,{value:x.value,ariaLabel:s.copyField(x.label)})]})]})},`${x.fieldKey}-${x.value}`))})}):null,p.length>0?Q("div",{children:Q("ul",{className:"space-y-3 text-sm",children:p.map(x=>Q("li",{className:"flex items-start gap-3",children:Fe("div",{className:"min-w-0 flex-1",children:[Q("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:x.label}),Fe("div",{className:"mt-1 flex items-start gap-3",children:[Fe("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[x.href?Q("a",{href:x.href,className:`wrap-break-word text-blue-800 dark:text-blue-300 ${Qt}`,target:x.isGmailLink?"_blank":void 0,rel:x.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:w=>f(w,x),onTouchEnd:w=>g(w,x),children:x.value}):Q("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:x.value}),x.isGmailLink?Q("span",{className:`mt-1 block ${y} text-slate-600 dark:text-slate-300`,children:s.popupGmailHint}):null]}),Q(Aa,{value:x.value,ariaLabel:s.copyField(x.label)})]})]})},`${x.fieldKey}-${x.value}`))})}):null,r?Fe("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[Q("span",{className:"text-xs",children:s.popupLastContactDate}),Q("span",{children:r})]}):null,h?null:Q("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:s.popupNoContactMethods})]})]})]}),document.body)}});import{jsx as Ce,jsxs as Cn}from"react/jsx-runtime";var Kn,Wa=he(()=>{"use strict";ge();Kn=({fullName:e,title:t="-",companyName:n="-",department:a="-",phoneNumber:s="-",email:o="-",updatedAtText:r="-"})=>Cn("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:[Cn("div",{className:"flex items-center gap-1 sm:hidden",children:[Ce("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),Ce("div",{className:`shrink-0 whitespace-nowrap ${pt} text-slate-600 dark:text-slate-300`,children:s})]}),Ce("div",{className:"flex items-center gap-1 sm:hidden",children:Ce("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:n})}),Ce("div",{className:"block sm:hidden",children:Ce("span",{className:`w-full truncate text-left ${pt} text-slate-700 leading-tight dark:text-slate-200`,children:a})}),Cn("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[Ce("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),Ce("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),Cn("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[Ce("span",{className:"truncate text-slate-800 dark:text-slate-100",children:n}),Ce("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:a})]}),Cn("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[Ce("span",{className:"truncate text-slate-700 dark:text-slate-200",children:s}),Ce("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:o})]}),Ce("div",{className:`hidden items-end justify-end ${pt} text-slate-600 xl:flex dark:text-slate-300`,children:Ce("span",{className:"truncate",children:r})})]})});import{formatQuerySets as Ms,parseQuerySets as Es}from"@aiquants/fuzzy-search";import{getNormalizedVariants as Ps,normalizeText as Ls,romajiToKatakana as Rs}from"@aiquants/select-box";var Lr,Os,_s,As,Ds,Rr,Or,Ws,Hs,Is,Fs,$s,zs,Bs,Us,_r,Ar,Er,Pr,jn,Vs,Ks,Ha,Dr,Ia=he(()=>{"use strict";Lr=/[]/g,Os=/^[\s ]+|[\s ]+$/g,_s=/\s+/,As=/^[\p{Script=Latin}\s]+$/u,Ds=/\p{Script=Latin}/u,Rr=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1,normalizeVariants:!1,ignoreSpaces:!1,ignoreSymbols:!1,ignoreLongVowels:!1}),Or="union",Ws=65377,Hs=65439,Is=["\uFF9E","\uFF9F"],Fs=(()=>{let e=new Map;for(let t=Ws;t<=Hs;t+=1){let n=String.fromCharCode(t);e.set(n.normalize("NFKC"),n);for(let a of Is){let s=(n+a).normalize("NFKC");s.length===1&&e.set(s,n+a)}}return e})(),$s=/[-ヿ]/u,zs=e=>{let t=Array.from(e,n=>Fs.get(n)??n).join("");return $s.test(t)?null:t},Bs=e=>Ls(e.replace(Lr,"").replace(Os,""),Rr),Us=e=>{if(!As.test(e))return null;let t=Rs(e);return Ds.test(t)?null:t},_r=e=>e.split(_s).filter(Boolean),Ar=e=>Es(e,Or).sets.map(({query:t})=>t),Er=e=>Ar(e).flatMap(t=>_r(t)),Pr=e=>Ms({combine:Or,sets:Array.from(new Set(e),t=>({query:t}))}),jn=e=>{let t=Ar(e.replace(Lr,"")).map(a=>_r(Bs(a)).join(" ")).filter(a=>a!==""),n=[];for(let a of t){let s=Us(a);if(s===null)return Pr(t);n.push(s)}return Pr(n)},Vs=e=>{let t=new Set([...Er(e),...Er(jn(e))]),n=new Set;for(let a of t)for(let s of Ps(a,Rr)){let o=s.trim();if(!o)continue;n.add(o);let r=zs(o);r!==null&&n.add(r)}return Array.from(n)},Ks=/[.*+?^${}()|[\]\\]/g,Ha=e=>{let t=Vs(e);if(t.length===0)return null;let n=t.map(a=>a.replace(Ks,"\\$&")).sort((a,s)=>s.length-a.length);return new RegExp(n.join("|"),"gi")},Dr=(e,t)=>{let n=Ha(e);if(n===null)return s=>s;let a=s=>t.some(o=>{let r=s[o];return typeof r=="string"&&r.search(n)!==-1});return s=>{let o=[],r=[];for(let c of s)a(c.item)?o.push(c):r.push(c);return[...o,...r]}}});import{memo as js}from"react";import{Fragment as Fa,jsx as Gn}from"react/jsx-runtime";var Gs,pe,qn=he(()=>{"use strict";Ia();Gs="rounded bg-yellow-200 px-1 text-gray-900 dark:bg-yellow-900 dark:text-yellow-100",pe=js(({text:e,query:t,enabled:n=!0})=>{if(!(n&&t?.trim()&&e))return Gn(Fa,{children:e});let a=Ha(t);if(a===null)return Gn(Fa,{children:e});let s=[],o=0,r=a.exec(e),c=0;for(;r;){let d=r[0],l=r.index;if(l>o&&s.push(e.substring(o,l)),d.length===0){a.lastIndex++,r=a.exec(e);continue}s.push(Gn("mark",{className:Gs,children:d},`highlight-${l}-${c}`)),o=l+d.length,c+=1,r=a.exec(e)}return o<e.length&&s.push(e.substring(o)),Gn(Fa,{children:s})});pe.displayName="HighlightedText"});var Hr={};jo(Hr,{ContactDetailGrid:()=>Wr,default:()=>qs});import{useMemo as $a}from"react";import{Fragment as Ys,jsx as za,jsxs as Qs}from"react/jsx-runtime";var Yn,Wr,qs,Ir=he(()=>{"use strict";kt();le();Da();Wa();qn();Yn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Wr=({contactData:e,searchTerm:t,enableHighlighting:n,openEmailsWithGmail:a,openGmailCompose:s,isPopupVisible:o,onRequestClose:r})=>{let c=Y(),d=$a(()=>Kt(e),[e]),l=$a(()=>jt(e),[e]),u=d.value??"-",m=l.value??"-",i=$a(()=>Ge(e.updated_at,c.recordDateTime),[e.updated_at,c.recordDateTime]),p=Yn(e.full_name)??c.noName,h=Yn(e.company_name),v=Yn(e.department),k=(C,F="-")=>za(pe,{text:C??F,query:t,enabled:n});return Qs(Ys,{children:[za(Kn,{fullName:k(p),title:k(Yn(e.title)),companyName:k(h),department:k(v),phoneNumber:m,email:k(u),updatedAtText:i}),o?za(Vn,{contactData:e,openEmailsWithGmail:a,openGmailCompose:s,onRequestClose:r}):null]})},qs=Wr});le();ge();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Yt}from"@aiquants/fuzzy-search";import{memo as ds,useId as Tr}from"react";import{jsx as qe,jsxs as rt}from"react/jsx-runtime";var La=ds(({searchOptions:e,setSearchOptions:t})=>{let n=Y(),a="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",o=Tr(),r=Tr(),c=[];return c.push(rt("div",{className:`${a} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[rt("div",{className:`${s} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",n.advancedLearningHeading]}),qe("label",{htmlFor:o,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.advancedLearningLabel}),qe("input",{id:o,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||Yt.learningWeight,onChange:d=>t(l=>({...l,learningWeight:parseFloat(d.target.value)})),className:"h-11 w-full"}),rt("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[n.currentValueLabel," ",e.learningWeight||Yt.learningWeight]}),qe("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.advancedLearningHint})]},"learning")),c.push(rt("div",{className:`${a} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[rt("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",n.advancedDebounceHeading]}),qe("label",{htmlFor:r,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.advancedDebounceLabel}),qe("input",{id:r,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs??Yt.debounceMs,onChange:d=>t(l=>({...l,debounceMs:parseInt(d.target.value,10)})),className:"h-11 w-full"}),rt("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.debounceMs??Yt.debounceMs]}),qe("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.advancedDebounceHint})]},"debounce")),rt("section",{className:"space-y-3",children:[rt("div",{className:"flex items-center justify-between gap-3",children:[rt("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[qe("span",{children:"\u26A1"}),qe("span",{className:"tracking-wide",children:n.settingsAdvancedTab})]}),qe("button",{type:"button",onClick:()=>t(d=>({...d,learningWeight:Yt.learningWeight,debounceMs:Yt.debounceMs})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border border-gray-300 bg-gray-100 px-2 font-medium text-gray-700 ${E} 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})]}),qe("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:c})]})});La.displayName="AdvancedSearchSettings";le();ge();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Nt}from"@aiquants/fuzzy-search";import{memo as cs,useId as Ye}from"react";import{jsx as ee,jsxs as ne}from"react/jsx-runtime";var Ra=cs(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:a,openEmailsWithGmail:s,setOpenEmailsWithGmail:o})=>{let r=Y(),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",d="text-xs font-semibold",l=Ye(),u=Ye(),m=Ye(),i=Ye(),p=Ye(),h=Ye(),v=Ye(),k=Ye(),C=Ye(),F=Ye(),I=[];return I.push(ne("div",{className:`${c} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[ne("div",{className:`${d} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",r.basicThresholdHeading]}),ee("label",{htmlFor:l,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:r.basicThresholdLabel}),ee("input",{id:l,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??Nt.threshold,onChange:f=>t(g=>({...g,threshold:parseFloat(f.target.value)})),className:"h-11 w-full"}),ne("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[r.currentValueLabel," ",e.threshold??Nt.threshold]}),ee("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:e.sortBy==="relevance"?r.basicThresholdRangeRelevance:r.basicThresholdRange})]},"threshold")),I.push(ne("div",{className:`${c} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[ne("div",{className:`${d} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",r.basicDisplayHeading]}),ne("label",{htmlFor:u,className:`flex min-h-11 items-center gap-2 text-gray-700 ${E} transition-colors dark:text-slate-200`,children:[ee("input",{id:u,type:"checkbox",checked:e.caseSensitive??Nt.caseSensitive,onChange:f=>t(g=>({...g,caseSensitive:f.target.checked})),className:"h-3 w-3"}),r.basicCaseSensitive]}),ne("label",{htmlFor:m,className:`flex min-h-11 items-center gap-2 text-gray-700 ${E} transition-colors dark:text-slate-200`,children:[ee("input",{id:m,type:"checkbox",checked:n,onChange:f=>a(f.target.checked),className:"h-3 w-3"}),r.basicHighlight]}),ne("label",{htmlFor:i,className:`flex min-h-11 items-center gap-2 text-gray-700 ${E} transition-colors dark:text-slate-200`,children:[ee("input",{id:i,type:"checkbox",checked:s,onChange:f=>o(f.target.checked),className:"h-3 w-3"}),r.basicOpenEmailsWithGmail]}),ne("div",{className:"flex flex-col gap-1",children:[ee("label",{htmlFor:p,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:r.basicMultiTermOperator}),ne("select",{id:p,value:e.multiTermOperator??Nt.multiTermOperator,onChange:f=>t(g=>({...g,multiTermOperator:f.target.value})),className:`min-h-11 rounded border border-gray-300 px-2 pointer-coarse:text-base ${E} transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100`,children:[ee("option",{value:"or",children:r.basicOperatorOr}),ee("option",{value:"and",children:r.basicOperatorAnd})]}),ee("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:r.basicMultiTermHint})]})]},"display")),I.push(ne("div",{className:`${c} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[ne("div",{className:`${d} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",r.basicSortHeading]}),ne("div",{className:"flex flex-col gap-2",children:[ee("label",{htmlFor:h,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:r.basicSortBy}),ne("select",{id:h,value:e.sortBy||Nt.sortBy,onChange:f=>t(g=>({...g,sortBy:f.target.value})),className:`min-h-11 rounded border border-gray-300 px-2 pointer-coarse:text-base ${E} transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100`,children:[ee("option",{value:"score",children:r.basicSortByScore}),ee("option",{value:"relevance",children:r.basicSortByRelevance}),ee("option",{value:"original",children:r.basicSortByOriginal})]})]}),ne("div",{className:"flex flex-col gap-2",children:[ee("label",{htmlFor:v,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:r.basicSortOrder}),ne("select",{id:v,value:e.sortOrder||Nt.sortOrder,onChange:f=>t(g=>({...g,sortOrder:f.target.value})),className:`min-h-11 rounded border border-gray-300 px-2 pointer-coarse:text-base ${E} transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100`,children:[ee("option",{value:"desc",children:r.basicSortDescending}),ee("option",{value:"asc",children:r.basicSortAscending})]})]})]},"sorting")),I.push(ne("div",{className:`${c} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[ne("div",{className:`${d} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",r.basicEngineHeading]}),ee("label",{htmlFor:k,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:r.basicStrategy}),ne("select",{id:k,value:e.parallelSearchStrategy||Nt.parallelSearchStrategy,onChange:f=>t(g=>({...g,parallelSearchStrategy:f.target.value})),className:`min-h-11 rounded border border-gray-300 px-2 pointer-coarse:text-base ${E} transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100`,children:[ee("option",{value:"balanced",children:r.basicStrategyBalanced}),ee("option",{value:"index-first",children:r.basicStrategyIndexFirst}),ee("option",{value:"levenshtein-first",children:r.basicStrategyLevenshteinFirst})]}),ne("div",{className:"mt-2 space-y-2",children:[ne("label",{htmlFor:C,className:`flex min-h-11 items-center gap-2 text-gray-700 ${E} transition-colors dark:text-slate-200`,children:[ee("input",{id:C,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:f=>t(g=>({...g,enableIndexFiltering:f.target.checked})),className:"h-3 w-3"}),r.basicIndexFiltering]}),ne("label",{htmlFor:F,className:`flex min-h-11 items-center gap-2 text-gray-700 ${E} transition-colors dark:text-slate-200`,children:[ee("input",{id:F,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:f=>t(g=>({...g,enableLevenshtein:f.target.checked})),className:"h-3 w-3"}),r.basicLevenshtein]})]})]},"engine")),ne("section",{className:"space-y-3",children:[ne("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[ee("span",{children:"\u{1F527}"}),ee("span",{className:"tracking-wide",children:r.settingsBasicTab})]}),ee("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:I})]})});Ra.displayName="BasicSearchSettings";kt();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as Xs}from"@aiquants/swipe-overlay";import Js from"lucide-react/dist/esm/icons/badge-check.js";import Zs from"lucide-react/dist/esm/icons/building-2.js";import ei from"lucide-react/dist/esm/icons/calendar-clock.js";import ti from"lucide-react/dist/esm/icons/check.js";import ni from"lucide-react/dist/esm/icons/copy.js";import ai from"lucide-react/dist/esm/icons/id-card.js";import ri from"lucide-react/dist/esm/icons/mail.js";import oi from"lucide-react/dist/esm/icons/phone.js";import si from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as ii,useEffect as li,useMemo as Jn,useRef as di,useState as ci}from"react";var Qe={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)};le();xn();import*as $e from"@radix-ui/react-tabs";import*as Qn from"react";import{jsx as Ba}from"react/jsx-runtime";var Xn=$e.Root,kn=Qn.forwardRef(({className:e,...t},n)=>Ba($e.List,{ref:n,className:fe("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));kn.displayName=$e.List.displayName;var Mt=Qn.forwardRef(({className:e,...t},n)=>Ba($e.Trigger,{ref:n,className:fe("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}));Mt.displayName=$e.Trigger.displayName;var Et=Qn.forwardRef(({className:e,...t},n)=>Ba($e.Content,{ref:n,className:fe("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}));Et.displayName=$e.Content.displayName;yn();ge();qn();import{jsx as N,jsxs as me}from"react/jsx-runtime";var Fr=`truncate font-semibold text-slate-900 ${E} dark:text-slate-100`,$r={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},ui=({icon:e,label:t,value:n,fieldKey:a,copyValue:s,onCopy:o,isCopied:r,linkHref:c,searchTerm:d,enableHighlighting:l})=>{let u=Y(),m=!!(o&&a&&s),i=c?.startsWith("https://mail.google.com")?"_blank":void 0;return me("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:[me("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[N("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:N(e,{size:14})}),me("div",{className:"min-w-0 flex-1",children:[N("div",{className:`font-medium ${y} text-slate-600 dark:text-slate-300`,children:t}),c?N("a",{href:c,className:`align-top ${Fr} ${Qt}`,target:i,rel:i?"noopener noreferrer":void 0,children:N(pe,{text:n,query:d??"",enabled:l})}):N("div",{className:Fr,children:N(pe,{text:n,query:d??"",enabled:l})})]})]}),m?N("button",{type:"button",onClick:()=>o&&a&&s&&o(a,s,t),className:`inline-flex h-11 w-11 shrink-0 touch-manipulation 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 ${gt}`,"aria-label":u.copyField(t),children:r?N(ti,{size:14}):N(ni,{size:14})}):null]})},zr=({items:e,searchTerm:t,enableHighlighting:n})=>N("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(a=>me("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:[N("dt",{className:`font-semibold ${y} text-slate-600 uppercase tracking-wide dark:text-slate-300`,children:a.label}),N("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:N(pe,{text:a.value,query:t??"",enabled:n})})]},a.fieldKey))}),Ua=({title:e})=>N("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),mi=()=>{let e=Y();return me("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:[N("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),N("p",{className:`${y} text-slate-600 dark:text-slate-300`,children:e.detailEmptyHint})]})},pi=Object.freeze({overlay:Xs,pane:void 0}),en=({contact:e,placement:t,searchTerm:n,enableHighlighting:a,style:s,className:o=""})=>{let r=Y(),[c,d]=ci(null),l=di(null),u=Jn(()=>({...$r,...s}),[s]);li(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=Jn(()=>Kt(e),[e]),i=Jn(()=>jt(e),[e]),p=Jn(()=>Ge(e?.contacted_at,r.recordDateTime),[e?.contacted_at,r.recordDateTime]),h=ii(async(b,T,X)=>{try{await navigator.clipboard.writeText(T),d(b),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{d(null)},2e3)}catch(W){Qe.error("Failed to copy contact detail",W)}},[]);if(!e)return N("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:$r,children:N(mi,{})});let v=[q(e.title),q(e.department)].filter(b=>b!=="-"),k=[v.join(" / "),q(e.company_name)].filter(b=>b&&b!=="-").join(" \u30FB ")||"-",C=Ie(e.full_name)??r.noName,F=[{fieldKey:"full_name",label:r.fieldFullName,value:C},{fieldKey:"full_name_reading",label:r.fieldFullNameReading,value:q(e.full_name_reading)},{fieldKey:"title",label:r.fieldTitle,value:q(e.title)},{fieldKey:"department",label:r.fieldDepartment,value:q(e.department)},{fieldKey:"company_name",label:r.fieldCompanyName,value:q(e.company_name)},{fieldKey:"company_name_reading",label:r.fieldCompanyNameReading,value:q(e.company_name_reading)},{fieldKey:"address",label:r.fieldAddress,value:q(e.address)},{fieldKey:"postal_code",label:r.fieldPostalCode,value:q(e.postal_code)},{fieldKey:"url",label:r.fieldUrl,value:q(e.url)}],I=[{label:r.fieldCustomEmail,value:q(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:r.fieldEmail,value:q(e.email),fieldKey:"email",rawValue:e.email}].filter(b=>b.value!=="-"),f=[{label:r.fieldCustomMobilePhone,value:q(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:r.fieldMobilePhone,value:q(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:r.fieldCompanyPhone,value:q(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:r.fieldCompanyFax,value:q(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(b=>b.value!=="-"),g=[{fieldKey:"person_id",label:"person_id",value:q(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:q(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:q(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:q(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:q(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:q(e.is_in_eight)},{fieldKey:"created_by",label:r.fieldCreatedBy,value:q(e.created_by)},{fieldKey:"created_at",label:r.fieldCreatedAt,value:Ge(e.created_at,r.recordDateTime)},{fieldKey:"updated_by",label:r.fieldUpdatedBy,value:q(e.updated_by)},{fieldKey:"updated_at",label:r.fieldUpdatedAt,value:Ge(e.updated_at,r.recordDateTime)}],x=[{rowKey:"person_id",icon:ai,label:"person_id",value:q(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:ri,label:r.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:nt(m.value,!1)},{rowKey:"primary_phone",icon:oi,label:r.summaryPhone,value:i.value??"-",fieldKey:"primary_phone",copyValue:i.value,linkHref:fn(i.value)},{rowKey:"contacted_at",icon:ei,label:r.summaryLastContact,value:p}],w=[{sectionKey:"email",title:r.sectionEmail,emptyText:r.sectionEmailEmpty,entries:I,recommendedKey:m.fieldKey??null,resolveHref:b=>nt(b!=null?String(b):null,!1)},{sectionKey:"phone",title:r.sectionPhone,emptyText:r.sectionPhoneEmpty,entries:f,recommendedKey:i.fieldKey??null,resolveHref:b=>fn(b!=null?String(b):null)}],D=[{value:"summary",label:r.detailTabSummary,content:me("div",{className:"flex flex-col gap-4",children:[me("div",{className:"flex flex-col gap-1",children:[me("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[N(Zs,{size:16}),N("span",{children:N(pe,{text:q(e.company_name),query:n??"",enabled:a})})]}),v.length>0?N("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:v.map((b,T)=>me("span",{children:[T>0&&" / ",N(pe,{text:b,query:n??"",enabled:a})]},`header-line-${T}`))}):null]}),N("div",{className:"flex flex-col gap-3",children:x.map(b=>N(ui,{icon:b.icon,label:b.label,value:b.value,fieldKey:b.fieldKey,copyValue:b.copyValue,onCopy:h,isCopied:b.fieldKey?c===b.fieldKey:!1,linkHref:b.linkHref,searchTerm:n,enableHighlighting:a},b.rowKey))})]})},{value:"basic",label:r.detailTabBasic,content:me("div",{className:"flex flex-col gap-3",children:[N(Ua,{title:r.detailBasicProfile}),N(zr,{items:F,searchTerm:n,enableHighlighting:a})]})},{value:"contact",label:r.detailTabContact,content:N("div",{className:"flex flex-col gap-4",children:w.map(({sectionKey:b,title:T,emptyText:X,entries:W,recommendedKey:de,resolveHref:J})=>me("div",{className:"flex flex-col gap-2",children:[N(Ua,{title:T}),W.length===0?N("p",{className:"text-slate-600 text-xs dark:text-slate-300",children:X}):N("div",{className:"flex flex-col gap-2",children:W.map(A=>{let _=J(A.rawValue),U=A.fieldKey===de;return me("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[me("div",{className:"min-w-0 flex-1",children:[N("div",{className:"font-medium text-slate-600 text-xs dark:text-slate-300",children:A.label}),N("div",{className:"wrap-break-word text-slate-900 text-sm dark:text-slate-100",children:_?N("a",{href:_,className:`text-inherit ${Qt}`,children:N(pe,{text:A.value,query:n??"",enabled:a})}):N(pe,{text:A.value,query:n??"",enabled:a})})]}),U?me("span",{className:`inline-flex shrink-0 items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold ${y} text-emerald-900 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200`,children:[N(Js,{size:14}),r.preferred]}):null]},A.fieldKey)})})]},b))})},{value:"meta",label:r.detailTabMeta,content:me("div",{className:"flex flex-col gap-3",children:[N(Ua,{title:r.detailTabMeta}),N(zr,{items:g,searchTerm:n,enableHighlighting:a})]})}];return me("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 ${o}`.trim(),style:u,children:[N("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:me("div",{className:"flex items-center gap-2",children:[N("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:N(si,{size:16})}),me("div",{className:"min-w-0 flex-1",children:[N("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:N(pe,{text:C,query:n??"",enabled:a})}),N("div",{className:`truncate ${y} text-slate-600 dark:text-slate-300`,children:N(pe,{text:k,query:n??"",enabled:a})})]})]})}),me(Xn,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[N(kn,{className:"grid h-auto grid-cols-4 gap-1 rounded-none border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:D.map(b=>N(Mt,{value:b.value,className:`flex min-h-11 min-w-0 touch-manipulation rounded-md px-1 py-1 font-semibold text-slate-700 ${E} transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-800 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300`,children:N("span",{className:"min-w-0 truncate",children:b.label})},b.value))}),D.map(b=>N(Et,{value:b.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",style:pi[t],children:b.content},b.value))]})]})};wt();le();ge();import{memo as gi}from"react";import{jsx as ot,jsxs as Zn}from"react/jsx-runtime";var Va=gi(({recordCount:e,companyCount:t,phase:n,loadedCount:a,totalCount:s,errorMessage:o,onRetry:r})=>{let{locale:c,labels:d}=ve(),l=G(c,e),u=G(c,t);return Zn("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[Zn("span",{className:"flex items-baseline gap-1",children:[ot("span",{className:"text-slate-600 dark:text-slate-300",children:d.annotationTotalLabel}),ot("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:l}),ot("span",{className:"text-slate-600 dark:text-slate-300",children:d.recordUnit(l)})]}),Zn("span",{className:"flex items-baseline gap-1",children:[ot("span",{className:"text-slate-600 dark:text-slate-300",children:d.annotationCompaniesLabel}),ot("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:u}),ot("span",{className:"text-slate-600 dark:text-slate-300",children:d.companyUnit(u)})]}),n==="streaming"||n==="idle"?ot("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?d.annotationStreamingProgress({loaded:a,total:s,percent:Math.min(100,Math.round(a/s*100))}):d.annotationStreamingCount(a)}):null,n==="retrying"?ot("span",{"data-testid":"contact-map-reconnecting-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-amber-50 px-2 py-0.5 font-medium text-amber-900 text-xs dark:bg-amber-900/30 dark:text-amber-200",children:d.annotationReconnecting(a)}):null,n==="failed"||n==="auth-required"?Zn("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"?o??void 0:void 0,children:["\u26D4 ",n==="auth-required"?d.annotationAuthRequired:d.annotationLoadFailed(a),r?ot("button",{type:"button","data-testid":"contact-map-retry-button",onClick:r,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border border-rose-300 bg-white px-1.5 font-semibold ${E} 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:d.annotationRetry}):null]}):null]})});Va.displayName="ContactMapAnnotation";qt();import{useMemo as Uo}from"react";St();qt();le();import{createContext as fi,useContext as bi,useMemo as yi}from"react";St();qt();ka();var hi=["indexWorker","levenshteinWorker","treeWorker"];function Br(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 ${Z(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${Z(n)}`)}}var Ur={setting:"workerUrls"},Vr=(e,t)=>{if(e===void 0)return;let{setting:n,keys:a=hi,hints:s={}}=t;if(!Gt(e))throw new TypeError(`[contact-map] ${n} must be a plain object or left out; got ${Z(e)}`);let o=Object.getOwnPropertyNames(e).map(d=>({key:d,url:e[d]})),r=o.find(({key:d,url:l})=>l!==void 0&&!a.includes(d));if(r!==void 0){let d=Object.hasOwn(s,r.key)?s[r.key]:void 0,l=d===void 0?Hn(r.key,a):void 0;throw new RangeError(`[contact-map] ${n} has a key it does not take (it takes ${a.join(", ")}${d===void 0?"":`; ${d}`}${l===void 0?"":`; did you mean ${JSON.stringify(l)}?`}); got ${Z(r.key)}`)}let c=Object.create(null);for(let{key:d,url:l}of o){let u=d;Br(n,u,l),l!==void 0&&(c[u]=l)}return c};function Tu(e,t=Ur){Vr(e,t)}function Kr(e){Br("workerUrls","treeWorker",e)}var tn=(e,t,n=Ur)=>{let a=Vr(t,n);return{indexWorker:a?.indexWorker===void 0?e?.indexWorker:a.indexWorker,levenshteinWorker:a?.levenshteinWorker===void 0?e?.levenshteinWorker:a.levenshteinWorker,treeWorker:a?.treeWorker===void 0?e?.treeWorker:a.treeWorker}};import{jsx as Ka}from"react/jsx-runtime";var jr=e=>{if(!Gt(e))throw new TypeError(`[contact-map] config must be a plain object; got ${Z(e)}`);let t=e;return{streamEndpoint:xe(t,"streamEndpoint"),openEmailsWithGmail:xe(t,"openEmailsWithGmail"),treeWorkerFactory:xe(t,"treeWorkerFactory"),workerUrls:tn(void 0,xe(t,"workerUrls")),locale:xe(t,"locale"),labels:xe(t,"labels")}},Gr=({workerUrls:e,...t})=>{let{indexWorker:n,levenshteinWorker:a,treeWorker:s}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:n,levenshteinWorker:a,treeWorker:s})}))},xi=Gr(jr({})),qr=fi(xi),vi=Object.freeze({locale:"locale",labels:"labels"});function ja({config:e,chromeSurface:t,children:n}){let{streamEndpoint:a,openEmailsWithGmail:s,treeWorkerFactory:o,workerUrls:r,locale:c,labels:d}=jr(e),{indexWorker:l,levenshteinWorker:u,treeWorker:m}=r,i=yi(()=>Gr({streamEndpoint:a,openEmailsWithGmail:s,treeWorkerFactory:o,workerUrls:{indexWorker:l,levenshteinWorker:u,treeWorker:m},locale:c,labels:d}),[a,s,o,l,u,m,c,d]);return Ka(qr.Provider,{value:i,children:Ka(Sr,{locale:c,labels:d,surface:t,children:n})})}function Ci({config:e,children:t}){return Ka(ja,{config:e,chromeSurface:vi,children:t})}function st(){return bi(qr)}import{useCallback as Ga,useEffect as Mi,useMemo as na,useSyncExternalStore as Yr}from"react";St();var ki=1e3,Si=3e4,Ti=6;function ta(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 ${Z(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${Z(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 ${Z(e)}`)}var wi=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}),Ni=e=>Array.isArray(e.records),ea=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?.()};ta(t.endpoint),this.fetchFn=t.fetchFn??((...n)=>fetch(...n)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??ki,this.maxRetryDelayMs=t.maxRetryDelayMs??Si,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Ti,this.logger=t.logger??Qe}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(){this.setState({phase:"streaming"});let t=!1;for(;!this.disposed;){let n=this.lastCursor!==null,a=await this.streamOnce();if(a==="aborted")return;if(a==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(a==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(a==="rejected"){if(n&&!t){t=!0,this.lastCursor=null,this.logger.warn("[ContactMapStream] the server rejected the resume cursor (400); restarting from the beginning");continue}this.setState({phase:"failed",isLoading:!1,error:new Error("[contact-map] the server rejected the stream request (400); reload the page")});return}if(this.consecutiveFailures+=1,this.consecutiveFailures>=this.maxConsecutiveFailures){this.setState({phase:"failed",isLoading:!1});return}let s=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 ${s}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(s),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(n=>{let a=setTimeout(()=>{this.wakeRetryWait=null,n()},t);this.wakeRetryWait=()=>{clearTimeout(a),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.status===400)return"rejected";if(!(t.ok&&t.body))return this.logger.warn(`[ContactMapStream] unexpected response: ${t.status}`),this.setState({error:new Error(`[contact-map] the stream request failed (status ${t.status})`)}),"retryable";let n=t.body.getReader(),a=new TextDecoder,s="",o=!1,r=!1;for(;;){let{done:c,value:d}=await n.read();if(c)break;let l=a.decode(d,{stream:!0}),u=(s+l).split(`
|
|
2
|
-
`);s=u.pop()??"";let m=!1;for(let i of u){let p=i.trim();if(!p)continue;let h;try{h=JSON.parse(p)}catch(v){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",v);continue}if("type"in h&&h.type==="METADATA"){Number.isSafeInteger(h.total)&&h.total>=0&&this.setState({totalCount:h.total});continue}if(!Ni(h)){this.logger.warn("[ContactMapStream] server reported error:","error"in h?h.error:""),r=!0;continue}for(let v of h.records)v&&typeof v.person_id=="number"&&(this.recordMap.set(v.person_id,wi(v)),m=!0);h.nextCursor&&(this.lastCursor=h.nextCursor),h.isLast&&(o=!0)}m&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return r?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):o?"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 ze=null,Ei=e=>{if(ze!==null&&ze.endpoint===e)return ze;if(ta(e),ze===null)return ze=new ea({endpoint:e}),ze;if(ze.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(ze.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 ze},Fu=()=>{ze?.dispose(),ze=null},Pi=new Map,Li={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Ri=()=>{let{streamEndpoint:e}=st();return na(()=>(ta(e),e),[e])};function Oi(){let e=Ri(),t=Ga(()=>Ei(e),[e]);Mi(()=>{let r=t();r.start(),r.retryNow()},[t]);let n=Ga(r=>t().subscribe(r),[t]),a=Yr(n,()=>t().getState(),()=>Li),s=Yr(n,()=>t().getRecordMap(),()=>Pi),o=Ga(()=>t().retryNow(),[t]);return na(()=>({...a,recordMap:s,retryNow:o}),[a,s,o])}var _i=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 aa(){let{records:e,recordMap:t,isComplete:n,phase:a,loadedCount:s,totalCount:o,error:r,retryNow:c}=Oi(),d=na(()=>_i(e),[e]);return{context:na(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:a==="failed",streamPhase:a,loadedCount:s,companyCount:d,totalCount:o,errorMessage:r?.message??null}),[e,t,n,a,s,d,o,r]),retryNow:c}}le();import{DEFAULT_FUZZY_SEARCH_OPTIONS as hd,parseQuerySets as fd}from"@aiquants/fuzzy-search";import{useFuzzySearch as bd}from"@aiquants/fuzzy-search/react";import yd from"lucide-react/dist/esm/icons/search.js";import{useCallback as ln,useEffect as lt,useMemo as bt,useRef as Fo,useState as Ve,useTransition as xd}from"react";import{useNavigation as vd,useSearchParams as Cd}from"react-router";Ia();qt();import{useCallback as Pt,useEffect as Ai,useRef as Qr}from"react";var ht=e=>{let t=Qr(null),n=Qr({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),a=e?.dragThreshold??4,s=Pt(m=>{let i=m.currentTarget,p=m.deltaY;!i||p===0||(m.preventDefault(),i.scrollBy({left:p,behavior:"smooth"}))},[]),o=Pt(m=>{t.current?.removeEventListener("wheel",s),t.current=m,m?.addEventListener("wheel",s,{passive:!1})},[s]);Ai(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let r=Pt(m=>{if(m.pointerType==="touch")return;let i=n.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=m.clientX,i.scrollLeft=m.currentTarget.scrollLeft,i.pointerId=m.pointerId,i.hasCapture=!1,i.pointerType=m.pointerType},[]),c=Pt(m=>{let i=n.current;if(!i.isPointerDown||i.pointerType==="touch")return;let p=m.currentTarget,h=m.clientX-i.startX;!i.isDragging&&Math.abs(h)>a&&(i.isDragging=!0,i.hasCapture||(p.setPointerCapture?.(m.pointerId),i.hasCapture=!0)),i.isDragging&&(m.preventDefault(),p.scrollLeft=i.scrollLeft-h)},[a]),d=Pt(m=>{let i=n.current;if(i.pointerType==="touch")return;let p=m.currentTarget;i.isPointerDown&&i.hasCapture&&p.hasPointerCapture?.(m.pointerId)&&p.releasePointerCapture(m.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),l=Pt(m=>{d(m)},[d]),u=Pt(m=>{n.current.didDrag&&(m.preventDefault(),m.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:o,onPointerDown:r,onPointerMove:c,onPointerUp:l,onPointerLeave:l,onPointerCancel:l,onClickCapture:u}};wt();le();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Di}from"@aiquants/fuzzy-search";var ra=e=>{let{indexWorkerOptions:t,levenshteinWorkerOptions:n,...a}=Di;return{...a,autoSearchOnIndexRebuild:!1,multiTermOperator:"and",workerUrls:e,indexWorkerOptions:{...t},levenshteinWorkerOptions:{...n}}};xn();import{jsx as Xr}from"react/jsx-runtime";function Jr({value:e,max:t=100,className:n,indicatorClassName:a,...s}){let o=e===void 0,r=o?0:Math.min(100,Math.max(0,e/t*100));return Xr("div",{role:"progressbar","aria-valuenow":o?void 0:r,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:fe("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...s,children:Xr("div",{"data-slot":"progress-indicator",className:fe("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",o&&"w-1/3 animate-progress-indeterminate",a),style:o?void 0:{width:`${r}%`}})})}ge();var nn="view";import{useCallback as td,useState as nd}from"react";import{useSearchParams as ad}from"react-router";le();ge();kt();import{Panel as so,PanelGroup as ol,PanelResizeHandle as sl}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as il,VirtualScroll as ll,virtualScrollItemElementId as dl}from"@aiquants/virtualscroll";import{lazy as cl,memo as ul,Suspense as ml,useCallback as Le,useEffect as go,useId as io,useLayoutEffect as ho,useMemo as Lt,useRef as an,useState as wn}from"react";var Sn={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},Tn={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,n=t+e.scrollbarSafetyBuffer,a=n+e.hysteresisSafetyMargin,s=a-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:a,hysteresisWidth:s}}import{useCallback as Wi,useEffect as Hi,useState as Ii}from"react";var Zr=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:a=4,minFallbackHeight:s=240}=t??{},[o,r]=Ii(600),c=Wi(()=>{if(typeof window>"u")return;let d=e.current;if(!d||d.offsetParent===null&&window.getComputedStyle(d).position!=="fixed")return;let l=T=>Number.parseFloat(T)||0,{top:u}=d.getBoundingClientRect(),m=d.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),p=l(i.getPropertyValue("--footer-height")),h=l(i.getPropertyValue("--header-height")),v=l(i.getPropertyValue("--scrollbar-height")),k=window.getComputedStyle(d),C=l(k.marginBottom),F=l(k.paddingBottom),I=window.innerHeight-p-v-a,f=m?Math.min(m.bottom,I):I,g=m?Math.max(m.top,h):h,x=Math.max(u,g),w=f-x-C-F,D=Number.isFinite(w)?Math.floor(w):0,b=D>0?D:s;b>0&&Number.isFinite(b)&&r(T=>Math.abs(T-b)>1?b:T)},[a,e,s]);return Hi(()=>{if(typeof window>"u")return;let d=null,l=null,u=null,m=null,i=()=>{d!==null&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{c()})};i(),l=window.setTimeout(()=>{i()},150);let p=e.current;return typeof ResizeObserver<"u"&&p&&(u=new ResizeObserver(()=>{i()}),u.observe(p),p.parentElement&&u.observe(p.parentElement)),n&&typeof MutationObserver<"u"&&(m=new MutationObserver(()=>{i()}),m.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{d!==null&&window.cancelAnimationFrame(d),l!==null&&window.clearTimeout(l),u&&u.disconnect(),m&&m.disconnect(),window.removeEventListener("resize",i)}},[e,n,c]),{viewportHeight:o,updateViewportHeight:c}};import{useCallback as it,useEffect as eo,useRef as sa,useState as to}from"react";var Fi=600,no=8,ia=({ref:e,onSelect:t,resolveItem:n,item:a})=>{let[s,o]=to(!1),[r,c]=to(null),d=sa(null),l=sa(!1),u=sa(null),m=sa({onSelect:t,resolveItem:n,item:a});eo(()=>{m.current={onSelect:t,resolveItem:n,item:a}},[t,n,a]);let i=it(()=>{typeof window>"u"||d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),p=it(()=>{u.current&&(i(),u.current=null)},[i]),h=it(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(i(),l.current=!1,u.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},d.current=window.setTimeout(()=>{let x=m.current,w=null;x.item!==void 0?w=x.item:x.resolveItem&&g.target&&(w=x.resolveItem(g.target)),w!==null&&(l.current=!0,x.onSelect?.(w),c(w),o(!0)),p()},Fi))},[i,p]),v=it(g=>{u.current&&g.pointerId===u.current.pointerId&&(i(),u.current=null)},[i]),k=it(g=>{l.current&&(g.preventDefault(),g.stopPropagation(),g.type==="click"&&(l.current=!1))},[]),C=it(()=>{l.current=!1},[]),F=it(g=>{if(!u.current||g.pointerId!==u.current.pointerId)return;let x=Math.abs(g.clientX-u.current.x),w=Math.abs(g.clientY-u.current.y);(x>no||w>no)&&(i(),u.current=null)},[i]),I=it(g=>{(s||d.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),f=it(()=>{o(!1),c(null),l.current=!1,u.current=null},[]);return eo(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let x=[["pointerdown",h,void 0],["pointerup",v,void 0],["pointercancel",v,void 0],["pointermove",F,void 0],["pointerleave",v,void 0],["contextmenu",I,void 0]],w=[["mousedown",k,!0],["mouseup",k,!0],["click",k,!0],["pointerdown",C,!0],["keydown",C,!0],["contextmenu",I,!0],["pointerup",v,!0],["pointercancel",v,!0]];for(let[D,b,T]of x)g.addEventListener(D,b,T);for(let[D,b,T]of w)window.addEventListener(D,b,T);return()=>{for(let[D,b,T]of x)g.removeEventListener(D,b,T);for(let[D,b,T]of w)window.removeEventListener(D,b,T);i()}},[e,h,v,F,k,C,I,i]),{isPopupVisible:s,popupItem:r,handleClosePopup:f}};import{useCallback as $i,useEffect as zi,useState as ao,useSyncExternalStore as Bi}from"react";function la(e,t,n){let a=n?.mediaQuery??"(min-width: 1024px)",s=Bi($i(u=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let m=window.matchMedia(a);return m.addEventListener("change",u),()=>m.removeEventListener("change",u)},[a]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(a).matches:!0,()=>!1),[o,r]=ao(!1),[c,d]=ao(0);return zi(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let u=e.current;if(!u)return;let m=new ResizeObserver(i=>{for(let p of i){if(p.target!==u)continue;let h=0;p.borderBoxSize&&p.borderBoxSize.length>0?h=p.borderBoxSize[0].inlineSize:h=p.contentRect.width,!(!Number.isFinite(h)||h<=0)&&(d(h),r(v=>v&&h>=t.expandThreshold?!1:!v&&h<t.collapseThreshold?!0:v))}});return m.observe(u),()=>m.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!o,isContainerNarrow:o,isMediaMatches:s,containerWidth:c}}le();St();var ro=e=>e.isComposing||e.keyCode===229;var oo=(e,t)=>{if(Ki(t),e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||ro(e)||t.itemCount===0)return null;if(e.key==="Enter"||e.key===" ")return{kind:"activate"};let n=t.itemCount-1;if(t.activeIndex===null)return Vi(e.key)?{kind:"move",index:t.startIndex,direction:1}:null;let a=t.activeIndex;switch(e.key){case"ArrowDown":return{kind:"move",index:Math.min(a+1,n),direction:1};case"ArrowUp":return{kind:"move",index:Math.max(a-1,0),direction:-1};case"PageDown":return{kind:"move",index:Math.min(a+t.pageSize,n),direction:1};case"PageUp":return{kind:"move",index:Math.max(a-t.pageSize,0),direction:-1};case"Home":return{kind:"move",index:0,direction:1};case"End":return{kind:"move",index:n,direction:-1};default:return null}},Ui=new Set(["ArrowDown","ArrowUp","PageDown","PageUp","Home","End"]),Vi=e=>Ui.has(e),Ki=e=>{let{activeIndex:t,startIndex:n,itemCount:a,pageSize:s}=e;if(!Number.isInteger(a)||a<0)throw new RangeError(`[contact-map] listbox itemCount must be a non-negative integer; got ${Z(a)}`);if(!Number.isInteger(s)||s<1)throw new RangeError(`[contact-map] listbox pageSize must be an integer of at least 1; got ${Z(s)}`);let o=r=>Number.isInteger(r)&&r>=0&&r<a;if(a>0&&!o(n))throw new RangeError(`[contact-map] listbox startIndex must be an index below ${a}; got ${Z(n)}`);if(t!==null&&!o(t))throw new RangeError(`[contact-map] listbox activeIndex must be null or an index below ${a}; got ${Z(t)}`)};le();Oa();yn();xn();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as ji,useOverlayPresence as Gi,useSwipeOverlayDialog as qi}from"@aiquants/swipe-overlay";import{useCallback as Yi,useId as Qi}from"react";import{jsx as da,jsxs as qa}from"react/jsx-runtime";var Xi=fe(Fn,"flex overflow-hidden"),Ji=fe(zn,"motion-safe:transition-opacity motion-safe:duration-200"),Zi="relative ml-auto flex h-full w-full max-w-lg flex-col bg-white shadow-xl motion-safe:transition-[transform] motion-safe:duration-200 motion-safe:ease-out dark:bg-slate-900",el="flex shrink-0 items-center justify-between gap-3 border-slate-200 border-b px-3 py-2 dark:border-slate-700",tl="min-w-0 truncate font-semibold text-base text-slate-900 outline-none dark:text-slate-100",nl=`inline-flex min-h-11 min-w-11 shrink-0 touch-manipulation items-center justify-center rounded-full border border-slate-300 px-4 font-medium text-slate-700 text-sm hover:bg-slate-100 dark:border-slate-600 dark:text-slate-200 dark:hover:bg-slate-800 ${gt}`,al="flex min-h-0 flex-1 flex-col overflow-y-auto p-3",ca=({isOpen:e,onClose:t,children:n,className:a,title:s})=>{let o=Y(),r=Qi(),c=Gi(e),d=Yi(h=>h.ownerDocument.getElementById(r),[r]),{dialogProps:l,backdropProps:u,panelProps:m,attemptClose:i,isSwiping:p}=qi({isOpen:e,onClose:t,isCloseBlocked:Bn,skipWhenTextSelected:!0,initialFocus:d});return c?qa("dialog",{...l,"data-testid":"contact-map-mobile-overlay","aria-labelledby":r,className:fe(Xi,e&&!p?"pointer-events-auto":"pointer-events-none"),style:$n,children:[da("div",{...u,"data-contact-map-overlay-backdrop":"",className:fe(Ji,e?"opacity-100":"opacity-0")}),qa("div",{...m,"data-contact-map-overlay-panel":"",className:fe(Zi,e?"pointer-events-auto":"pointer-events-none",a),children:[qa("div",{className:el,children:[da("h2",{id:r,tabIndex:-1,className:tl,children:s===void 0?o.overlayTitle:s}),da("button",{type:"button",className:nl,onClick:()=>i(),children:o.close})]}),da("div",{"data-contact-map-overlay-body":"",className:al,style:ji,children:n})]})]}):null};yn();ge();Wa();import{Fragment as Nl,jsx as $,jsxs as Be}from"react/jsx-runtime";var pl=cl(async()=>({default:(await Promise.resolve().then(()=>(Ir(),Hr))).default})),Ya=64,lo="h-[64px]",co=240,gl=4,Qa=oa(Sn),hl=Sn.listPanelMinWidth,fl=Sn.detailPanelMinWidth,bl=Sn.handleThickness,Pm=Qa.collapseThreshold,Lm=Qa.expandThreshold,yl=({contactData:e})=>{let t=Y(),n=Ie(e?.full_name)??t.noName,a=Ie(e?.title)??"-",s=Ie(e?.company_name)??"-",o=Ie(e?.department)??"-",r=Kt(e).value??"-",c=jt(e).value??"-",d=Ge(e?.updated_at,t.recordDateTime);return $(Kn,{fullName:n,title:a,companyName:s,department:o,phoneNumber:c,email:r,updatedAtText:d})},xl=e=>({"--contact-panel-height":`${e}px`}),vl=e=>typeof e=="object"&&e!==null&&"item"in e,Cl=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,kl=(e,t)=>{for(let n of e){let a=Ct(n);if(a?.person_id===t)return a}return null},uo=(e,t)=>t!==null&&Ct(e)?.person_id===t,mo=(e,t,n)=>{for(let a=t;a>=0&&a<e.length;a+=n){let s=Ct(e[a]);if(s!==null)return{index:a,personId:s.person_id}}return null},po=(e,t,n)=>{let a=mo(e,t,n);return a!==null?a:mo(e,t-n,n===1?-1:1)},Xa=(e,t,n)=>{let{viewportHeight:a}=Zr(t,{enableMutationObserver:!0,bottomGap:gl,minFallbackHeight:co}),[s,o]=wn(0),r=Le(()=>{let m=n.current,i=t.current;if(!(m&&i))return;let p=m.getBoundingClientRect(),h=i.getBoundingClientRect(),v=Math.ceil(h.top-p.top);Number.isFinite(v)&&v>0&&o(k=>Math.abs(k-v)>1?v:k)},[t,n]);ho(()=>{if(!e)return;r();let m=requestAnimationFrame(r);return window.addEventListener("resize",r),()=>{cancelAnimationFrame(m),window.removeEventListener("resize",r)}},[e,r]);let c=a>0?a:co,d=s>0?s:0,l=c+d,u=Lt(()=>xl(l),[l]);return{normalizedViewportHeight:c,normalizedDetailHeight:l,panelSizingStyle:u}},Sl=new Set,Tl=()=>{let[e,t]=wn(Sl),n=Le((a,s)=>{t(o=>{if(o.has(a)===s)return o;let r=new Set(o);return s?r.add(a):r.delete(a),r})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},wl=(e,t,n)=>{let a=an(n);ho(()=>{a.current=n},[n]),go(()=>{if(e!==null)return a.current(e,t),()=>{a.current(e,!1)}},[e,t])},fo=ul(({entry:e,index:t,itemCount:n,listboxId:a,isSelected:s,isActive:o,onSelect:r,onLongPressSelect:c,searchQuery:d,enableHighlighting:l,openEmailsWithGmail:u,openGmailCompose:m,onPopupVisibilityChange:i})=>{let p=Y(),h=an(null),v=$("div",{className:lo}),k=vl(e)?e:null,C=Ct(e),{isPopupVisible:F,handleClosePopup:I}=ia({ref:h,onSelect:c,item:C?.person_id});if(wl(C?.person_id??null,F,i),!e||!C)return v;let{person_id:f}=C,g=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",w=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":g,D=["B","F"].map(b=>Cl(b,b==="B"?k?.baseScore:k?.score)).filter(Boolean);return Be("div",{ref:h,id:dl(a,f),className:`flex ${lo} 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 ${w} ${wr}`,style:{height:Ya},role:"option","aria-selected":s,"aria-posinset":t+1,"aria-setsize":n,"data-selected":s?"true":"false","data-contact-map-row-active":o?"":void 0,onClick:()=>r(f),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:p.listRowNumber(t+1)}),$("div",{className:`truncate ${pt} text-slate-700 leading-tight dark:text-slate-200`,children:f}),$("div",{className:`flex items-center gap-1 whitespace-nowrap font-mono ${pt} text-slate-600 leading-tight dark:text-slate-300`,children:D.length?D.map(b=>$("span",{children:b},b)):$("span",{children:"-"})})]}),$(ml,{fallback:$(yl,{contactData:C}),children:$(pl,{contactData:C,searchTerm:d,enableHighlighting:l,openEmailsWithGmail:u,openGmailCompose:m,isPopupVisible:F,onRequestClose:I})})]})});fo.displayName="ContactListRow";var bo=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:a,hasSearchTerm:s,enableHighlighting:o,openEmailsWithGmail:r,isSearchTabActive:c}=e,{locale:d,labels:l,engineLabels:u}=ve(),m=an(null),i=an(null),[p,h]=wn(null),{normalizedViewportHeight:v,panelSizingStyle:k}=Xa(c,i,m),{isAnyPopupVisible:C,handlePopupVisibilityChange:F}=Tl(),I=Lt(()=>({enablePointerDrag:!C,enableKeyboardNavigation:!1}),[C]),f=Lt(()=>s?n:t,[s,n,t]),[g,x]=wn(null),w=Le(K=>{h(K),x(K)},[]),D=Le(K=>{if(!r)return;let se=K.trim();if(!se||se==="-"||typeof window>"u")return;let V=nt(se,!0);V&&window.open(V,"_blank","noopener,noreferrer")},[r]),[b,T]=wn(!1),X=Le(()=>T(!1),[]),W=Le(K=>{w(K),T(!0)},[w]),de=io(),J=io(),A=an(null),_=f.length,U=Le((K,se)=>$(fo,{entry:K,index:se,itemCount:_,listboxId:de,isSelected:uo(K,p),isActive:uo(K,g),onSelect:W,onLongPressSelect:w,searchQuery:a,enableHighlighting:o,openEmailsWithGmail:r,openGmailCompose:D,onPopupVisibilityChange:F}),[_,de,p,g,W,w,a,o,r,D,F]),re=Lt(()=>{let K=new Map;return f.forEach((se,V)=>{let ct=Ct(se);ct!==null&&K.set(ct.person_id,V)}),K},[f]),ce=g===null?null:re.get(g)??null,Se=p===null?null:re.get(p)??null,yt=Math.max(1,Math.floor(v/Ya)),_t=Le(K=>{if(K.target.id!==de)return;let se=oo(K.nativeEvent,{activeIndex:ce,startIndex:Se===null?0:Se,itemCount:_,pageSize:yt});if(se===null)return;if(K.preventDefault(),se.kind==="activate"){ce!==null&&g!==null&&W(g);return}let V=po(f,se.index,se.direction);V!==null&&(x(V.personId),A.current?.scrollToIndex(V.index,{align:"nearest"}))},[de,ce,Se,_,yt,g,W,f]),dt=Le(K=>{if(K.target.id!==de||ce!==null||!K.target.matches(":focus-visible"))return;let se=po(f,Se===null?0:Se,1);se!==null&&x(se.personId)},[de,ce,Se,f]),At=Lt(()=>({id:de,role:"listbox",tabIndex:0,"aria-label":l.listboxLabel,"aria-describedby":J}),[de,l.listboxLabel,J]),ue=Le(K=>f[K],[f]),Dt=Le(K=>Ct(f[K])?.person_id??`row-${K}`,[f]),Ae=Le(()=>Ya,[]),Ze=Lt(()=>({enabled:!0,renderVisual:il}),[]),De=Lt(()=>p===null?null:kl(f,p),[p,f]);go(()=>{p!==null&&!De&&h(null)},[p,De]);let Me=an(null),{isTwoColumn:Wt}=la(Me,Qa);b&&(Wt||De===null)&&T(!1);let xt=Be("div",{ref:m,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 ${y} 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:l.columnNo}),$("span",{className:"leading-tight",children:l.columnId}),$("span",{className:"whitespace-nowrap leading-tight",children:l.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:l.columnName}),$("span",{className:`font-normal ${y} text-slate-600 uppercase tracking-wider dark:text-slate-300`,children:l.columnTitle})]}),Be("div",{className:"flex flex-col gap-0.5",children:[$("span",{children:l.columnCompany}),$("span",{className:`font-normal ${y} text-slate-600 uppercase tracking-wider dark:text-slate-300`,children:l.columnDepartment})]}),Be("div",{className:"flex flex-col gap-0.5",children:[$("span",{children:l.columnPhone}),$("span",{className:`font-normal ${y} text-slate-600 uppercase tracking-wider dark:text-slate-300`,children:l.columnEmail})]}),$("div",{className:"hidden items-end justify-end xl:flex",children:$("span",{className:`font-normal ${y} text-slate-600 uppercase tracking-wider dark:text-slate-300`,children:l.columnUpdatedAt})})]})]})}),$("p",{id:J,hidden:!0,children:l.listKeyboardHelp}),$("div",{ref:i,className:"flex-1",onKeyDown:_t,onFocus:dt,children:$(ll,{ref:A,contentProps:At,activeItemIndex:_===0?void 0:ce,activeItemVisibleInset:2,itemCount:_,getItemKey:Dt,behaviorOptions:I,getItem:ue,getItemHeight:Ae,viewportSize:v,overscanCount:10,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:Ze},locale:d,labels:u,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:(K,se)=>U(K,se)})}),n.length===0&&s?$("div",{className:"py-8 text-center",children:$("p",{className:"text-slate-600 dark:text-slate-300",children:l.listNoSearchResults})}):null,_===0&&!s?$("div",{className:"py-8 text-center",children:$("p",{className:"text-slate-600 dark:text-slate-300",children:l.listNoData})}):null]});return $("div",{ref:Me,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:k,children:Wt?Be(ol,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[$(so,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:hl,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:xt}),$(sl,{id:"contact-map-list-handle",thickness:bl,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":l.listResizeHandle}),$(so,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:fl,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:$(en,{placement:"pane",contact:De,searchTerm:a,enableHighlighting:o})})]}):Be(Nl,{children:[xt,De?$(ca,{isOpen:b,onClose:X,title:l.detailHeading,children:$(en,{placement:"overlay",contact:De,searchTerm:a,enableHighlighting:o})}):null]})})};kt();import{DirectoryTree as Hl}from"@aiquants/directory-tree";import{Panel as To,PanelGroup as Il,PanelResizeHandle as Fl}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as $l}from"@aiquants/virtualscroll";import zl from"@heroicons/react/24/solid/FolderMinusIcon.js";import Bl from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as Re,useEffect as Ot,useMemo as Ue,useRef as ga,useState as ft}from"react";import{createPortal as Ul}from"react-dom";var Ja=(e,t)=>e&&e.trim()||t;import{useEffect as Ml,useRef as ua,useState as El}from"react";var yo=(e,t=250)=>{let[n,a]=El(e),s=ua(null),o=ua(e),r=ua(null),c=ua(!1);return Ml(()=>{if(!c.current){c.current=!0,a(e),o.current=e;return}o.current=n,s.current=null;let d=l=>{s.current??(s.current=l);let u=l-s.current,m=Math.min(1,Math.max(0,u/t)),i=1-(1-m)**3,p=Math.max(0,Math.round(o.current+(e-o.current)*i));a(p),m<1&&(r.current=requestAnimationFrame(d))};return r.current=requestAnimationFrame(d),()=>{r.current!==null&&cancelAnimationFrame(r.current)}},[e,t]),Math.max(0,n)};St();import{useCallback as Za,useEffect as er,useMemo as xo,useRef as Pl,useSyncExternalStore as Ll}from"react";le();var Rl=250,Ol=4e3,ma=3,vo={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},Co=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,pa=class{constructor(t,{workerSource:n,logger:a=Qe}){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>=ma){this.logger.error(`[TreeWorker] the tree Worker failed ${ma} times in a row; the tree stops updating until ${vo[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Rl*2**(this.consecutiveFailures-1),Ol);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${ma})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let a=this.lastSyncedNaming;a!==null&&this.syncRecords(this.lastSyncedRecords,a)},n)};if(typeof n!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${Z(n)}`);if(!Object.hasOwn(vo,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${Z(n)}`);this.workerFactory=t,this.workerSource=n,this.logger=a}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>=ma||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||!Co(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let a=this.ensureWorker();if(!a)return;let s=this.workerNeedsReset,o=this.postedNaming===null||!Co(this.postedNaming,n);if((this.workerNeedsReset||o||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=n,a.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),this.updateState()),t.length>this.postedCount){let r=t.slice(this.postedCount);this.postedCount=t.length,a.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:r}),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}}},_l=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 a=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(a,t),{type:"module"})}throw new Error("[contact-map] the tree Worker needs workerUrls.treeWorker in a build without import.meta.url (CommonJS)")},Rt=null,ko=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),Al=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},Dl=e=>{if(Kr(e),Rt===null){let t=new pa(()=>_l(e),{workerSource:"workerUrls.treeWorker"});return Rt={session:t,workerUrl:e},t}if(Rt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${ko(Rt.workerUrl)} and cannot also load it from ${ko(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return Rt.session},Bm=()=>{Rt?.session.reset(),Rt=null},Wl={snapshot:null,isBuilding:!1};function So(e,t=!1){let n=st(),a=n.treeWorkerFactory,s=n.workerUrls?.treeWorker,{labels:o}=ve(),r=o.uncategorizedCompany,c=o.noName,d=xo(()=>({uncategorizedCompany:r,unnamedPerson:c}),[r,c]),l=Pl(a);er(()=>{l.current=a},[a]);let u=a!==void 0,m=u?void 0:s,i=xo(()=>u?new pa(()=>Al(l.current)(),{workerSource:"treeWorkerFactory"}):null,[u]),p=Za(()=>i===null?Dl(m):i,[i,m]),h=Za(k=>p().subscribe(k),[p]),v=Za(()=>p().getState(),[p]);return er(()=>{let k=p();k.syncRecords(e,d),t&&k.finalize()},[p,e,t,d]),er(()=>{if(i!==null)return()=>i.stop()},[i]),Ll(h,v,()=>Wl)}le();ge();Da();qn();import{Fragment as ed,jsx as z,jsxs as ke}from"react/jsx-runtime";var ar=oa(Tn),Vl=Tn.listPanelMinWidth,Kl=Tn.detailPanelMinWidth,jl=Tn.handleThickness,mp=ar.collapseThreshold,pp=ar.expandThreshold,Gl=(e,t)=>{let{searchQuery:n,enableHighlighting:a}=t,s=Ja(e.full_name,t.noName),o=Ja(e.title,""),r=z(pe,{text:s,query:n,enabled:a});return o?ke("span",{className:"flex items-center gap-1.5",children:[z("span",{children:r}),z("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:z(pe,{text:o,query:n,enabled:a})})]}):r},ql="contact-map-tree h-full w-full",Yl={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"},tr="h-4 w-4 shrink-0 transition-colors duration-150",Ql=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),ha=null,wo=null,Nn=new Map,No="",Mo=null,Eo=null,Xl=(e,t,n,a,s)=>{let o=`${n?"icons":"plain"}#${a}#${s.noName}`;(o!==No||s.formatDirectoryName!==Mo||t!==Eo)&&(Nn.clear(),No=o,Mo=s.formatDirectoryName,Eo=t);let r={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},c=new Set;for(let d of e){c.add(d.absolutePath);let l=`${d.name}\0${d.memberCount}`,u=Nn.get(d.absolutePath);(!u||u.signature!==l)&&(u={signature:l,result:Ro([d],t,n,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},Nn.set(d.absolutePath,u));let m=u.result;m.entries.length>0&&r.entries.push(m.entries[0]);for(let[i,p]of m.personPathMap){let h=r.personPathMap.get(i);if(h)for(let v of p)h.add(v);else r.personPathMap.set(i,new Set(p))}for(let[i,p]of m.contactByPath)r.contactByPath.set(i,p);for(let[i,p]of m.ancestorsByPath)r.ancestorsByPath.set(i,p);r.totalCount+=m.totalCount,!r.firstPerson&&m.firstPerson&&(r.firstPerson=m.firstPerson)}for(let d of Nn.keys())c.has(d)||Nn.delete(d);return r},nr=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",Lo=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...Lo(n.children)));return t},Jl=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Ro=(e,t,n,a,s)=>{let o=new Map,r=new Map,c=new Map,d=0,l=null,u=(i,p)=>{let h=[...p,i.absolutePath];c.set(i.absolutePath,h);let v,k,C=i.type==="directory"?a.formatDirectoryName(i.name,Jl(i)):i.name,F=z(pe,{text:C,query:a.searchQuery,enabled:a.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let I=t.get(i.personId);if(I){r.set(i.absolutePath,I),o.has(i.personId)||o.set(i.personId,new Set);let f=o.get(i.personId);f&&f.add(i.absolutePath),d++,l||(l={personId:i.personId,path:i.absolutePath}),n&&(k=g=>{let x=nr(g);return g.isSelected||g.isItemSelected||i.isPrimary&&(x=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),z(n.person,{"aria-hidden":"true",className:`${tr} ${x}`})},i.title&&(F=Gl(I,a))),F=z("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:F})}}else if(i.children){let I=i.children.map(f=>u(f,h)).filter(f=>f!==null);if(s&&I.length===0)return null;if(v=I,n){let f=i.relativePath.startsWith("company:")?n.company:n.department;k=g=>z(f,{"aria-hidden":"true",className:`${tr} ${nr(g)}`})}}return{name:C,label:F,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:k,children:v}};return{entries:e.map(i=>u(i,[])).filter(i=>i!==null),personPathMap:o,contactByPath:r,ancestorsByPath:c,firstPerson:l,totalCount:d}},Zl=(e,t,n)=>{let a=new Set,s=new Set,o=new Map;t.forEach((u,m)=>{o.set(u.item.person_id,m)});for(let u of t){let m=u.item.person_id,i=e.personPathMap.get(m);if(i)for(let p of i){a.add(p);let h=e.ancestorsByPath.get(p);if(h){for(let v of h)a.add(v);n&&h.length>0&&s.add(h[0])}}}let r=new Map,c=u=>{let m=r.get(u.absolutePath);if(m!==void 0)return m;let i=1/0;if(u.type==="file"){let p=e.contactByPath.get(u.absolutePath);p&&(i=o.get(p.person_id)??1/0)}else if(u.children)for(let p of u.children)i=Math.min(i,c(p));return r.set(u.absolutePath,i),i},d=(u,m=0)=>u.filter(i=>n&&m===0&&s.has(i.absolutePath)?!0:a.has(i.absolutePath)).map(i=>n&&m===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:d(i.children,m+1)}:i).sort((i,p)=>m===0?c(i)-c(p):0),l=d(e.entries);return{...e,entries:l}},Po=(e,t,n)=>{if(e===null)return null;let a=n.get(e);if(a===void 0)return null;if(t!==null&&a.has(t))return t;let s=a.values().next();return s.done?null:s.value},Oo=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:a,filteredItems:s,hasSearchTerm:o,isSearchInProgress:r,isSearchTabActive:c}=e,{locale:d,labels:l,treeLabels:u}=ve(),m=l.noName,i=l.treeDirectoryName,p=Ue(()=>({noName:m,formatDirectoryName:i}),[m,i]),[h,v]=ft(null),[k,C]=ft(!1),{snapshot:F,isBuilding:I}=So(n,e.isStreamingComplete),f=F?.tree??null,g=F?.rebuildEpoch??0,x=Ue(()=>f?Xl(f,a,h,g,p):null,[f,a,h,g,p]),w=Ue(()=>{if(!f)return null;if(!o)return x;let R;k||(R=new Set(s.map(P=>P.item.person_id)));let S=Ro(f,a,h,{...p,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},R);return Zl(S,s,k)},[f,x,a,h,e.searchQuery,e.enableHighlighting,o,s,k,p]),D=Ue(()=>w||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[w]),b=o&&e.errorMessage!==null,[T,X]=ft(D),W=ga(!1);Ot(()=>{if(!(r||b)){W.current=!!f,X(D);return}!W.current&&f&&D.entries.length>0&&(W.current=!0,X(D))},[D,f,r,b]);let de=o&&(r||b)?T:D,{entries:J,personPathMap:A,contactByPath:_,totalCount:U}=de,re=Ue(()=>Lo(J),[J]),[ce,Se]=ft(()=>wo??new Set),yt=Re(R=>!ce.has(R),[ce]),_t=Re(R=>{Se(S=>{let P=new Set(S);return P.has(R)?P.delete(R):P.add(R),P})},[]),dt=Re(R=>{R.length!==0&&Se(S=>{let P=new Set(S);for(let ie of R)P.add(ie);return P})},[]),At=Re(R=>{Se(S=>{if(S.size===0)return S;let P=!1,ie=new Set(S);for(let Te of R)ie.delete(Te)&&(P=!0);return P?ie:S})},[]);Ot(()=>{wo=ce},[ce]),Ot(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[ue,Dt]=ft(null),[Ae,Ze]=ft(null),[De,Me]=ft(!1),Wt=Re(()=>Me(!1),[]),[xt,K]=ft(!1),se=ga(null),V=ga(null),{normalizedViewportHeight:ct,panelSizingStyle:Ht}=Xa(c,V,se),It=Re(R=>{let S=_.get(R);return S?(ue!==S.person_id&&Dt(S.person_id),R!==Ae&&Ze(R),!0):!1},[_,Ae,ue]),et=Re(R=>{It(R)&&Me(!0)},[It]),Ee=Re(R=>{et(R.entry.absolutePath)},[et]),En=Re(R=>R instanceof Element?R.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:un,popupItem:We,handleClosePopup:mn}=ia({ref:V,resolveItem:En,onSelect:It}),ut=Re(R=>{if(!e.openEmailsWithGmail)return;let S=R.trim();if(!S||S==="-"||typeof window>"u")return;let P=nt(S,!0);P&&window.open(P,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),He=We?_.get(We):null,Ke=un&&He!==null&&He!==void 0;Ot(()=>{un&&!He&&mn()},[un,He,mn]);let pn=Ue(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:$l}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Ft=Ue(()=>Ql(pn,ct,Ke),[pn,ct,Ke]);Ot(()=>{let R=!1;return typeof window>"u"?()=>{R=!0}:ha?(v(ha),()=>{R=!0}):((async()=>{try{let[P,ie,Te,tt]=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(R)return;let vt=P.default,xa=ie.default,pr=Te.default,gr=tt.default;vt&&xa&&pr&&gr&&(ha={company:vt,department:xa,title:pr,person:gr},v(ha))}catch(P){Qe.warn("Failed to load lucide icons",P)}})(),()=>{R=!0})},[]);let $t=Ue(()=>{if(!h)return;let R=tt=>vt=>z(tt,{"aria-hidden":"true",className:`${tr} ${nr(vt)}`}),S={company:R(h.company),department:R(h.department),title:R(h.title)},P=R(h.person),ie=tt=>tt in S,Te=tt=>{let[vt]=tt.entry.relativePath.split(":",1);return(ie(vt)?S[vt]:S.company)(tt)};return{directory:Te,directoryExpanded:Te,file:P}},[h]),gn=Re(()=>{Se(R=>R.size===0?R:new Set)},[]),mt=Re(()=>{re.length>0&&dt(re)},[re,dt]);Ot(()=>{if(typeof window>"u")return;let R=document.documentElement,S=window.matchMedia("(prefers-color-scheme: dark)"),P=()=>K(R.classList.contains("dark")||S.matches);P(),S.addEventListener("change",P);let ie=new MutationObserver(P);return ie.observe(R,{attributes:!0,attributeFilter:["class"]}),()=>{S.removeEventListener("change",P),ie.disconnect()}},[]);let zt=Po(ue,Ae,A);Ot(()=>{let R=Po(ue,Ae,A);if(R===null){ue!==null&&Dt(null),Ae!==null&&Ze(null);return}R!==Ae&&Ze(R)},[ue,Ae,A]);let Bt=zt===null?null:_.get(zt)??null,Pn=xt?"#475569":"#94A3B8",Ut=e.isStreamingComplete,Ln=e.isStreamingFailed,je=Ut&&n.length===0,Vt=(I||!f)&&!je,ba=yo(U,250),Rn=f!==null||je,On=ke("div",{className:"flex flex-wrap items-center gap-1.5",children:[ke("span",{className:`inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono ${y} text-slate-700 dark:bg-slate-800 dark:text-slate-200`,title:l.treeNodeCountTitle,children:[z("span",{children:"\u{1F333}"})," ",l.treeNodeCountLabel," ",Rn?l.treeNodeCount(ba):"\u2026"]}),Ln&&!Ut?ke("span",{className:`inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium ${y} text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300`,title:l.treeStreamInterruptedTitle,children:[z("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),z("span",{children:"\u26D4"})," ",l.treeStreamInterrupted]}):Ut?Vt?ke("span",{className:`inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium ${y} text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300`,title:l.treeBuildingTitle,children:[ke("span",{className:"relative flex h-1.5 w-1.5",children:[z("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),z("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),z("span",{children:"\u{1F33F}"})," ",l.treeBuilding]}):ke("span",{className:`inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium ${y} text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300`,title:l.treeCompleteTitle,children:[z("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),z("span",{children:"\u2705"})," ",l.treeComplete]}):ke("span",{className:`inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium ${y} text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300`,title:l.treeStreamLoadingTitle,children:[ke("span",{className:"relative flex h-1.5 w-1.5",children:[z("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),z("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),z("span",{children:"\u23F3"})," ",l.treeStreamLoading]}),o&&ke("button",{type:"button",onClick:()=>C(!k),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${k?"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:l.treeShowEntireCompanyTitle,children:[z("span",{children:"\u{1F3E2}"})," ",l.treeShowEntireCompany]}),re.length>0?ke("div",{className:"flex items-center gap-1",children:[z("button",{type:"button",onClick:gn,className:"inline-flex h-11 w-11 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":l.treeExpandAll,title:l.treeExpandAllTitle,children:z(Bl,{className:"h-4 w-4"})}),z("button",{type:"button",onClick:mt,className:"inline-flex h-11 w-11 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":l.treeCollapseAll,title:l.treeCollapseAllTitle,children:z(zl,{className:"h-4 w-4"})})]}):null]}),hn=ga(null),{isTwoColumn:_n}=la(hn,ar,{mediaQuery:"(min-width: 768px)"});De&&(_n||Bt===null)&&Me(!1);let An=Ue(()=>({toggle:_t,isExpanded:yt,expandMultiple:At,collapseMultiple:dt,isPending:r}),[dt,At,yt,_t,r]),Dn=Ue(()=>({onEntryClick:Ee,selectedPath:zt}),[Ee,zt]),mr=Ue(()=>({className:ql,lineColor:Pn,iconOverrides:$t,showDirectoryIcons:!!$t,showFileIcons:!!$t,highlightStyles:Yl,entryClassName:"rounded-md px-1 py-0.5",nameClassName:"tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[Pn,$t]),ya=z("div",{ref:se,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:z("div",{ref:V,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:J.length>0?z(Hl,{entries:J,expansion:An,selection:Dn,visual:mr,virtualScroll:Ft,locale:d,labels:u}):z("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:o?l.treeNoMatches:l.treeEmpty})})});return ke("div",{ref:hn,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Ht,children:[t&&Ul(On,t),_n?ke(Il,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[z(To,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:Vl,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ya}),z(Fl,{id:"contact-map-tree-handle",thickness:jl,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":l.treeResizeHandle}),z(To,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:Kl,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:z(en,{placement:"pane",contact:Bt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):ke(ed,{children:[ya,Bt?z(ca,{isOpen:De,onClose:Wt,title:l.detailHeading,children:z(en,{placement:"overlay",contact:Bt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}):null]}),Ke&&He&&z(Vn,{contactData:He,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:ut,onRequestClose:mn})]})};import{jsx as Mn,jsxs as rn}from"react/jsx-runtime";var rd={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},od=e=>e==="tree"?"tree":"list",_o=({context:e})=>{let t=Y(),[n,a]=ad(),[s,o]=nd(null),r=od(n.get(nn)),{setScrollableRef:c,onPointerDown:d,onPointerMove:l,onPointerUp:u,onPointerLeave:m,onPointerCancel:i,onClickCapture:p}=ht(),h=td(v=>{let k=v==="tree"?"tree":"list";if(k===r)return;let C=new URLSearchParams(typeof window<"u"?window.location.search:"");k==="list"?C.delete(nn):C.set(nn,k),a(C,{replace:!0})},[r,a]);return rn("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[rn("div",{className:"mt-1 mb-1.5 flex shrink-0 flex-wrap items-center gap-2",children:[rn("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:rd,onPointerDown:d,onPointerMove:l,onPointerUp:u,onPointerLeave:m,onPointerCancel:i,onClickCapture:p,children:[rn("button",{type:"button","data-testid":"contact-map-tab-list","aria-pressed":r==="list",onClick:()=>h("list"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-2 ${E} transition-colors ${r==="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]}),rn("button",{type:"button","data-testid":"contact-map-tab-tree","aria-pressed":r==="tree",onClick:()=>h("tree"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-2 ${E} transition-colors ${r==="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]})]}),Mn("div",{ref:o,className:"flex flex-wrap items-center gap-1.5"})]}),rn("div",{className:"flex h-full flex-1 flex-col",children:[Mn("div",{className:`${r==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="list"?Mn(bo,{context:e}):null}),Mn("div",{className:`${r==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="tree"?Mn(Oo,{context:e,controlsContainer:s}):null})]})]})};import{memo as ld}from"react";le();ge();le();ge();import{DEFAULT_FUZZY_SEARCH_OPTIONS as B}from"@aiquants/fuzzy-search";import{memo as sd,useId as Ne}from"react";import{jsx as O,jsxs as H}from"react/jsx-runtime";var rr=1e3,or=sd(({searchOptions:e,setSearchOptions:t})=>{let n=Y(),a="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",o=e.sortBy==="relevance",r=Ne(),c=Ne(),d=Ne(),l=Ne(),u=Ne(),m=Ne(),i=Ne(),p=Ne(),h=Ne(),v=Ne(),k=Ne(),C=[];C.push(H("div",{className:`${a} border-green-200 border-l-4 dark:border-green-400/60`,children:[H("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:r,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexNgramSize}),O("input",{id:r,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||B.ngramSize,onChange:f=>t(g=>({...g,ngramSize:parseInt(f.target.value,10)})),className:"h-11 w-full"}),H("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.ngramSize||B.ngramSize]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexNgramSizeHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:c,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexMinNgramOverlap}),O("input",{id:c,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||B.minNgramOverlap,onChange:f=>t(g=>({...g,minNgramOverlap:parseInt(f.target.value,10)})),className:"h-11 w-full"}),H("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.minNgramOverlap||B.minNgramOverlap]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexMinNgramOverlapHint})]})]},"index-build")),C.push(H("div",{className:`${a} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[H("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.indexCandidateHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:d,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexThreshold}),O("input",{id:d,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??B.indexWorkerOptions?.threshold,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??B.indexWorkerOptions?.threshold]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexThresholdHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:u,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexNgramOverlapThreshold}),O("input",{id:u,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??B.indexWorkerOptions?.ngramOverlapThreshold,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??B.indexWorkerOptions?.ngramOverlapThreshold]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),C.push(H("div",{className:`${a} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[H("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:l,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexStrategy}),H("select",{id:l,value:e.indexWorkerOptions?.strategy??B.indexWorkerOptions?.strategy??"hybrid",onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:f.target.value}})),className:`min-h-11 rounded border border-gray-300 px-2 pointer-coarse:text-base ${E} transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100`,children:[O("option",{value:"fast",children:n.indexStrategyFast}),O("option",{value:"accurate",children:n.indexStrategyAccurate}),O("option",{value:"hybrid",children:n.indexStrategyHybrid})]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexStrategyHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:m,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexMinCandidatesRatio}),O("input",{id:m,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??B.indexWorkerOptions?.minCandidatesRatio,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??B.indexWorkerOptions?.minCandidatesRatio]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexMinCandidatesRatioHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:i,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexMaxCandidatesRatio}),O("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??B.indexWorkerOptions?.maxCandidatesRatio,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??B.indexWorkerOptions?.maxCandidatesRatio]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),C.push(H("div",{className:`${a} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[H("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",n.scoreTuningHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:p,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexJaroWinklerPrefix}),O("input",{id:p,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??B.indexWorkerOptions?.jaroWinklerPrefix,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??B.indexWorkerOptions?.jaroWinklerPrefix]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexJaroWinklerPrefixHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:h,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.maxResults}),H("label",{className:`flex min-h-11 items-center gap-2 ${E} text-gray-600 dark:text-slate-300`,children:[O("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:f.target.checked?void 0:rr}}))}),n.noLimit]}),O("input",{id:h,type:"range",min:rr,max:"10000",step:"1000",disabled:e.indexWorkerOptions?.maxResults===void 0,value:e.indexWorkerOptions?.maxResults===void 0?rr:e.indexWorkerOptions.maxResults,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(f.target.value,10)}})),className:"h-11 w-full disabled:cursor-not-allowed"}),H("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexMaxResultsHint})]})]},"jaro")),C.push(H("div",{className:`${a} border-emerald-200 border-l-4 ${o?"":"opacity-50"} dark:border-emerald-400/60`,children:[H("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:v,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.fieldWeight}),O("input",{id:v,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??B.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(f.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),H("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??B.indexWorkerOptions?.relevanceFieldWeight??.2]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexFieldWeightHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:k,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexPerfectMatchBonus}),O("input",{id:k,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??B.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(f.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),H("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??B.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexPerfectMatchBonusHint})]}),!o&&O("p",{className:`${y} text-emerald-600 dark:text-emerald-300`,children:n.relevanceOnlyNotice})]},"relevance"));let F=Ne(),I=Ne();return C.push(H("div",{className:`${a} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[H("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",n.indexContainmentHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:F,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexContainmentBase}),O("input",{id:F,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??B.indexWorkerOptions?.containmentScoreBase??.7,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??B.indexWorkerOptions?.containmentScoreBase??.7]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexContainmentBaseHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:I,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexContainmentCoverage}),O("input",{id:I,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??B.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??B.indexWorkerOptions?.containmentCoverageWeight??.3]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexContainmentCoverageHint})]})]},"containment")),H("section",{className:"space-y-3",children:[H("div",{className:"flex items-center justify-between gap-3",children:[H("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[O("span",{children:"\u{1F4CA}"}),O("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),O("button",{type:"button",onClick:()=>t(f=>({...f,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:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border border-green-300 bg-green-100 px-2 font-medium text-green-700 ${E} 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})]}),O("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:C})]})});or.displayName="IndexWorkerSettings";le();ge();import{DEFAULT_FUZZY_SEARCH_OPTIONS as be}from"@aiquants/fuzzy-search";import{memo as id,useId as on}from"react";import{jsx as ae,jsxs as oe}from"react/jsx-runtime";var sr=1e3,ir=id(({searchOptions:e,setSearchOptions:t})=>{let n=Y(),a="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",o=e.sortBy==="relevance",r=on(),c=on(),d=on(),l=on(),u=on(),m=on(),i=[];return i.push(oe("div",{className:`${a} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[oe("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:r,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.levenshteinThreshold}),ae("input",{id:r,type:"range",min:"0.0",max:o?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??be.levenshteinWorkerOptions?.threshold,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,threshold:parseFloat(p.target.value)}})),className:"h-11 w-full"}),oe("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??be.levenshteinWorkerOptions?.threshold]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:o?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:c,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.levenshteinLengthSimilarity}),ae("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??be.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(p.target.value)}})),className:"h-11 w-full"}),oe("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??be.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push(oe("div",{className:`${a} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[oe("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",n.scoreTuningHeading]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:d,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.levenshteinLengthPenalty}),ae("input",{id:d,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??be.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(p.target.value)}})),className:"h-11 w-full"}),oe("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??be.levenshteinWorkerOptions?.lengthDiffPenalty]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push(oe("div",{className:`${a} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[oe("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),ae("label",{htmlFor:l,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.maxResults}),oe("label",{className:`flex min-h-11 items-center gap-2 ${E} text-gray-600 dark:text-slate-300`,children:[ae("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:p.target.checked?void 0:sr}}))}),n.noLimit]}),ae("input",{id:l,type:"range",min:sr,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?sr:e.levenshteinWorkerOptions.maxResults,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:parseInt(p.target.value,10)}})),className:"h-11 w-full disabled:cursor-not-allowed"}),oe("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinMaxResultsHint})]},"max-results")),i.push(oe("div",{className:`${a} border-rose-200 border-l-4 ${o?"":"opacity-50"} dark:border-rose-400/60`,children:[oe("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:u,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.fieldWeight}),ae("input",{id:u,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??be.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(p.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),oe("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??be.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinFieldWeightHint})]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:m,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.levenshteinPartialBonus}),ae("input",{id:m,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??be.levenshteinWorkerOptions?.partialMatchBonus,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,partialMatchBonus:parseFloat(p.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),oe("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??be.levenshteinWorkerOptions?.partialMatchBonus]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinPartialBonusHint})]}),!o&&ae("p",{className:`${y} text-rose-600 dark:text-rose-300`,children:n.relevanceOnlyNotice})]},"relevance")),oe("section",{className:"space-y-3",children:[oe("div",{className:"flex items-center justify-between gap-3",children:[oe("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[ae("span",{children:"\u{1F4CF}"}),ae("span",{className:"tracking-wide",children:n.levenshteinSettingsHeading})]}),ae("button",{type:"button",onClick:()=>t(p=>({...p,levenshteinWorkerOptions:{threshold:be.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:be.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:be.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:be.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:be.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border border-purple-300 bg-purple-100 px-2 font-medium text-purple-700 ${E} 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})]}),ae("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});ir.displayName="LevenshteinWorkerSettings";import{jsx as Je,jsxs as Xe}from"react/jsx-runtime";var dd={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},lr=ld(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:a,openEmailsWithGmail:s,setOpenEmailsWithGmail:o,activeTab:r,onTabChange:c})=>{let d=Y(),{setScrollableRef:l,onPointerDown:u,onPointerMove:m,onPointerUp:i,onPointerLeave:p,onPointerCancel:h,onClickCapture:v}=ht();return Xe("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:[Xe("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:[Xe("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",d.searchSettings]}),Je("div",{className:"flex flex-wrap gap-1.5",children:Xe("button",{type:"button",onClick:()=>t(k=>ra(k.workerUrls)),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded bg-red-500 px-1.5 ${E} text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700`,title:d.settingsResetAllTitle,children:["\u{1F504} ",d.settingsResetAll]})})]}),Je("div",{className:"mb-0 shrink-0",children:Xe("div",{ref:l,role:"tablist","aria-label":d.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:dd,onPointerDown:u,onPointerMove:m,onPointerUp:i,onPointerLeave:p,onPointerCancel:h,onClickCapture:v,children:[Xe("button",{type:"button",role:"tab","aria-selected":r==="basic",onClick:()=>c("basic"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${r==="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} ",d.settingsBasicTab]}),Xe("button",{type:"button",role:"tab","aria-selected":r==="advanced",onClick:()=>c("advanced"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${r==="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 ",d.settingsAdvancedTab]}),Xe("button",{type:"button",role:"tab","aria-selected":r==="index",onClick:()=>c("index"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${r==="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} ",d.indexWorkerName]}),Xe("button",{type:"button",role:"tab","aria-selected":r==="levenshtein",onClick:()=>c("levenshtein"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${r==="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} ",d.levenshteinWorkerName]})]})}),Xe("div",{className:"flex flex-col gap-1",children:[Je("div",{className:`${r==="basic"?"block":"hidden"}`,children:Je(Ra,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:a,openEmailsWithGmail:s,setOpenEmailsWithGmail:o})}),Je("div",{className:`${r==="advanced"?"block":"hidden"}`,children:Je(La,{searchOptions:e,setSearchOptions:t})}),Je("div",{className:`${r==="index"?"block":"hidden"}`,children:Je(or,{searchOptions:e,setSearchOptions:t})}),Je("div",{className:`${r==="levenshtein"?"block":"hidden"}`,children:Je(ir,{searchOptions:e,setSearchOptions:t})})]})]})});lr.displayName="SearchOptionsPanel";import{memo as md,useCallback as pd}from"react";wt();le();ge();import{memo as cd}from"react";import{jsxs as dr}from"react/jsx-runtime";var L=cd(({label:e,value:t,unit:n,color:a="text-gray-600 dark:text-slate-300"})=>dr("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:[dr("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),dr("span",{className:`font-medium ${a} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));L.displayName="StatItem";wt();le();ge();import{memo as ud}from"react";import{jsx as M,jsxs as j}from"react/jsx-runtime";var sn=ud(({kind:e,icon:t,stats:n,color:a})=>{let{locale:s,labels:o}=ve(),r=A=>G(s,A);if(!n)return M("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:o.statsNoData});let c=n.basic||{},d=n.workerSpecific||{},l=n.analysis||{},u=c.totalSearches??0,m=c.totalProcessingTime??0,i=c.averageSearchTime??0,p=c.lastSearchTime??0,h=c.errorCount??0,v=c.timestamp,k=l.fieldPerformance||{},C=l.performanceInsights||{},F=l.recentHistory||[],I=d.specificMetrics||{},f=d.operationCount??0,g=d.operationDistribution||{},x=e==="index",w=e==="levenshtein",D=x?o.indexWorkerName:o.levenshteinWorkerName,b=I,T=I,X="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",W="text-xs font-semibold transition-colors",de=A=>{if(!A)return;let _=new Date(A);return Number.isNaN(_.getTime())?void 0:o.statsTimestamp(_)},J=[];if(J.push(j("div",{className:`${X} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[j("div",{className:`${W} ${a}`,children:["\u{1F4CA} ",o.statsBasicHeading]}),M(L,{label:o.statTotalSearches,value:r(u),color:a}),M(L,{label:o.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:a}),M(L,{label:o.statTotalProcessingTime,value:m.toFixed(2),unit:"ms",color:a}),M(L,{label:o.statLastSearchTime,value:p.toFixed(2),unit:"ms",color:a}),M(L,{label:o.statErrorCount,value:h,color:h>0?"text-red-600 dark:text-red-400":a}),de(v)&&M(L,{label:o.statUpdatedAt,value:de(v),color:"text-gray-500 dark:text-slate-400"})]},"basic")),f>0||Object.keys(g).length>0){let A=Object.entries(g).sort(([,_],[,U])=>(Number(U)||0)-(Number(_)||0)).slice(0,6);J.push(j("div",{className:`${X} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[j("div",{className:`${W} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",o.statsOperationsHeading]}),M(L,{label:o.statTotalOperations,value:r(f),color:"text-amber-700 dark:text-amber-300"}),A.length>0&&M("div",{className:"mt-1 space-y-1",children:A.map(([_,U])=>M(L,{label:_,value:r(Number(U)),unit:o.timesUnit(r(Number(U))),color:"text-amber-700 dark:text-amber-300"},_))})]},"operations"))}if(x&&(J.push(j("div",{className:`${X} border-green-200 border-l-4 dark:border-green-400/60`,children:[j("div",{className:`${W} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",o.statsIndexHeading]}),M(L,{label:o.statIndexBuilds,value:r(b.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),M(L,{label:o.statDataSize,value:r(b.currentDataSize??0),unit:o.itemsUnit(r(b.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),M(L,{label:o.statLastBuildTime,value:(b.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),b.cacheSize&&J.push(j("div",{className:`${X} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[j("div",{className:`${W} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",o.statsCacheHeading]}),M(L,{label:o.statCacheNgram,value:r(b.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),M(L,{label:o.statCacheWord,value:r(b.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),M(L,{label:o.statCachePhonetic,value:r(b.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),b.indexMetadata)){let A=Object.entries(b.indexMetadata).slice(0,6);A.length>0&&J.push(j("div",{className:`${X} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[j("div",{className:`${W} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",o.statsIndexMetadataHeading]}),A.map(([_,U])=>{let re;if(typeof U=="number"){let ce=_.toLowerCase();ce.includes("time")&&!ce.includes("timestamp")?re=`${U.toFixed(2)}ms`:ce.includes("timestamp")||ce.includes("at")?re=de(U)??U.toString():re=r(U)}else re=String(U);return M(L,{label:_,value:re,color:"text-teal-700 dark:text-teal-300"},_)})]},"index-meta"))}if(w){if(J.push(j("div",{className:`${X} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[j("div",{className:`${W} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",o.statsCalculationsHeading]}),M(L,{label:o.statTotalCalculations,value:r(T.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statDistanceCalculations,value:r(T.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statAverageDistance,value:typeof T.averageDistance=="number"?T.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statMinDistance,value:T.minDistance??o.notAvailable,color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statMaxDistance,value:T.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),J.push(j("div",{className:`${X} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[j("div",{className:`${W} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",o.statsMatchesHeading]}),M(L,{label:o.statPartialMatches,value:r(T.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),M(L,{label:o.statPerfectMatches,value:r(T.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),M(L,{label:o.statEarlyTerminations,value:r(T.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),T.similarityThresholds&&J.push(j("div",{className:`${X} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[j("div",{className:`${W} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",o.statsSimilarityHeading]}),M(L,{label:o.statAbove80,value:r(T.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),M(L,{label:o.statAbove60,value:r(T.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),M(L,{label:o.statAbove40,value:r(T.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),M(L,{label:o.statBelow40,value:r(T.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),T.distanceDistribution){let A=Object.entries(T.distanceDistribution).sort(([,_],[,U])=>Number(U)-Number(_)).slice(0,6);A.length>0&&J.push(j("div",{className:`${X} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[j("div",{className:`${W} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",o.statsDistanceHeading]}),A.map(([_,U])=>M(L,{label:o.statDistance(_),value:r(Number(U)),unit:o.timesUnit(r(Number(U))),color:"text-indigo-700 dark:text-indigo-300"},_))]},"lev-distance"))}if(T.queryLengthStats){let A=Object.entries(T.queryLengthStats).sort(([,_],[,U])=>(U.count??0)-(_.count??0)).slice(0,6);A.length>0&&J.push(j("div",{className:`${X} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[j("div",{className:`${W} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",o.statsQueryLengthHeading]}),A.map(([_,U])=>{let re=Number(U.count??0),ce=Number(U.averageScore??0);return M(L,{label:o.statQueryLength(_),value:o.statQueryLengthValue({count:re,averagePercent:(ce*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},_)})]},"lev-query-length"))}}if(Object.keys(k).length>0){let A=Object.entries(k).sort(([,_],[,U])=>(U.averageScore??0)-(_.averageScore??0)).slice(0,6);J.push(j("div",{className:`${X} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[j("div",{className:`${W} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",o.statsFieldPerformanceHeading]}),A.map(([_,U])=>{let re=U;return j("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[M("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:_}),M(L,{label:o.statAverageScore,value:`${((re.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statMatchCount,value:r(re.matchCount??0),unit:o.itemsUnit(r(re.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statBestWorstScore,value:`${((re.bestScore??0)*100).toFixed(1)}% / ${((re.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},_)})]},"field-performance"))}if(C.bestPerformingField||C.totalHistoryEntries||C.similarityDistribution){let A=(C.recentAverageResultCount??0).toFixed(1);J.push(j("div",{className:`${X} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[j("div",{className:`${W} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",o.statsInsightsHeading]}),C.bestPerformingField&&M(L,{label:o.statBestField,value:C.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statRecentAverageTime,value:(C.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statRecentAverageResults,value:A,unit:o.itemsUnit(A),color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statThroughput,value:(C.throughputPerSecond??0).toFixed(2),unit:o.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statCommonQueryLength,value:r(C.mostCommonQueryLength??0),unit:o.charactersUnit(r(C.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statHistoryEntries,value:r(C.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),C.similarityDistribution&&j("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[M(L,{label:o.statHighSimilarity,value:r(C.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),M(L,{label:o.statMediumSimilarity,value:r(C.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),M(L,{label:o.statLowSimilarity,value:r(C.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),M(L,{label:o.statVeryLowSimilarity,value:r(C.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return F.length>0&&J.push(j("div",{className:`${X} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[j("div",{className:`${W} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",o.statsRecentHistoryHeading]}),F.slice(-3).reverse().map((A,_)=>j("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[M("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:A.operationType}),M("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:o.statsHistoryEntry({processingTimeMs:A.processingTime.toFixed(2),resultCount:A.resultCount??0})}),de(A.timestamp)&&M("div",{className:`${y} text-sky-500 transition-colors dark:text-sky-200`,children:de(A.timestamp)})]},`${A.operationType}-${A.timestamp??_}`))]},"recent-history")),j("section",{className:"space-y-2",children:[j("div",{className:`flex items-center gap-2 font-semibold text-xs ${a}`,children:[M("span",{children:t}),M("span",{className:"tracking-wide",children:D})]}),M("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:J})]})});sn.displayName="WorkerStatsSection";import{jsx as _e,jsxs as Oe}from"react/jsx-runtime";var gd={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},cr=md(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:a,resetStats:s,rebuildIndex:o,isIndexBuilding:r,activeTab:c,onTabChange:d})=>{let{locale:l,labels:u}=ve(),m=t.trim(),i=m?a:n,{setScrollableRef:p,onPointerDown:h,onPointerMove:v,onPointerUp:k,onPointerLeave:C,onPointerCancel:F,onClickCapture:I}=ht(),f=c!=="index"||r,g=r?u.statsRebuildingTitle:c!=="index"?u.statsRebuildIndexTabOnlyTitle:u.statsRebuildTitle,x=f?"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",w=r?`\u23F3 ${u.statsRebuilding}`:`\u{1F3D7}\uFE0F ${u.statsRebuild}`,D=pd(()=>{o().catch(()=>{})},[o]);return Oe("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:[Oe("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:[Oe("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",u.searchStatistics]}),Oe("div",{className:"flex flex-wrap gap-1.5",children:[_e("button",{type:"button",onClick:D,disabled:f,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${x}`,title:g,children:w}),Oe("button",{type:"button",onClick:s,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded bg-red-500 px-1.5 ${E} text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700`,title:u.statsResetTitle,children:["\u{1F504} ",u.reset]})]})]}),_e("div",{className:"mb-0 shrink-0",children:Oe("div",{ref:p,role:"tablist","aria-label":u.statsTabsLabel,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:gd,onPointerDown:h,onPointerMove:v,onPointerUp:k,onPointerLeave:C,onPointerCancel:F,onClickCapture:I,children:[Oe("button",{type:"button",role:"tab","aria-selected":c==="overview",onClick:()=>d("overview"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} 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} ",u.statsOverviewTab]}),Oe("button",{type:"button",role:"tab","aria-selected":c==="index",onClick:()=>d("index"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} 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} ",u.statsIndexTab]}),Oe("button",{type:"button",role:"tab","aria-selected":c==="levenshtein",onClick:()=>d("levenshtein"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} 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} ",u.statsLevenshteinTab]})]})}),Oe("div",{className:"flex flex-col gap-1 pb-0.5",children:[Oe("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:[_e(L,{label:u.statTotalSearches,value:G(l,e.totalSearches)}),_e(L,{label:u.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),_e(L,{label:u.statDataCount,value:G(l,e.itemCount)}),_e(L,{label:m?u.statResultCount:u.statDisplayedCount,value:G(l,i)})]}),_e("div",{className:`${c==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:_e(sn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),_e("div",{className:`${c==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:_e(sn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),Oe("div",{className:"hidden",children:[_e(sn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),_e(sn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});cr.displayName="StatisticsPanel";import{Fragment as Io,jsx as te,jsxs as ye}from"react/jsx-runtime";var kd=/[\u200B\uFEFF]/g,ur=typeof window<"u",$o=ur&&typeof document<"u",fa=(e,t=[],n=!1)=>{let a=Fo(e);a.current=e,lt(()=>{if(!(!ur||n&&!$o))return a.current()},[n,...t])},Ao=(e,t,n)=>{let[a,s]=Ve(()=>{let o=Do(r=>r.getItem(e));return o&&t.includes(o)?o:n});return fa(()=>{Do(o=>{o.setItem(e,a)})},[e,a]),[a,s]},Do=e=>{if(!ur)return null;try{return e(window.sessionStorage)}catch{return null}},Wo=(e,t)=>{let[n,a]=Ve(e);return lt(()=>{let s=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},Sd="contact-map.settings-tab",Td="contact-map.statistics-tab",wd=["basic","advanced","index","levenshtein"],Nd=["overview","index","levenshtein"],Ho=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Md={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},zo=({streamState:e,...t}={})=>e===void 0?te(Ed,{...t}):te(Bo,{...t,streamState:e}),Ed=e=>{let{context:t}=aa();return te(Bo,{...e,streamState:t})},Pd={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},Bo=e=>{let{streamState:t,onFooterVisibilityChange:n,children:a}=e,s=xe(e,"workerUrls"),o=st(),{locale:r,labels:c}=ve(),{contactMapRecords:d,contactMapRecordMap:l,isStreamingComplete:u,isStreamingFailed:m}=t,i=vd(),[p]=Cd(),h=Fo(null),[v,k]=Ve(!0),[C,F]=Ve(o.openEmailsWithGmail??!1),{indexWorker:I,levenshteinWorker:f}=tn(o.workerUrls,s,Pd),[g,x]=Ve(()=>ra({indexWorker:I,levenshteinWorker:f})),[w,D]=Ve(p.get("q")||""),b=Wo(w,g.debounceMs??hd.debounceMs);lt(()=>{let S=p.get("q")||"";D(P=>P!==S?S:P)},[p]),lt(()=>{if(typeof window>"u")return;let S=new URL(window.location.href);(S.searchParams.get("q")||"")!==b&&(b?S.searchParams.set("q",b):S.searchParams.delete("q"),window.history.replaceState(window.history.state,"",S.toString()))},[b]);let[T,X]=xd(),[W,de]=Ve("search"),[J,A]=Ao(Sd,wd,"basic"),[_,U]=Ao(Td,Nd,"overview"),{setScrollableRef:re,onPointerDown:ce,onPointerMove:Se,onPointerUp:yt,onPointerLeave:_t,onPointerCancel:dt,onClickCapture:At}=ht(),ue=ln(()=>{if(!$o)return;let S=h.current;!S||document.activeElement===S||window.requestAnimationFrame(()=>{try{S.focus({preventScroll:!0})}catch{}})},[]),Dt=ln(S=>{let P=S;de(P),P==="search"&&ue()},[ue]),Ae=bt(()=>({...g,debounceMs:0}),[g]),[Ze,De]=Ve("union"),Me=Ze==="intersection",Wt=Me?c.operatorAndTitle:c.operatorOrTitle,xt=ln(S=>fd(S,Ze),[Ze]),K=bt(()=>({querySetsOf:xt}),[xt]),se=Wo(d,u?0:800),{searchTerm:V,setSearchTerm:ct,filteredItems:Ht,resultTerm:It,isSearching:et,isIndexBuilding:Ee,clearSearch:En,resetStats:un,performanceMetrics:We,rebuildIndex:mn,error:ut}=bd(se,Ho,Ae,K),He=V.trim().length>0,[Ke,pn]=Ve(""),[Ft,$t]=Ve(()=>V),gn=bt(()=>jn(w),[w]),mt=bt(()=>jn(b),[b]);lt(()=>{b===Ke&&mt===V||X(()=>{pn(b),ct(mt)})},[b,Ke,mt,V,ct]);let zt=ln(S=>{let ie=S.target.value.replace(kd,"");D(ie)},[]),Bt=ln(()=>{D(""),pn(""),En(),ue()},[En,ue]),Pn=ln(()=>{De(S=>S==="intersection"?"union":"intersection"),ue()},[ue]);fa(()=>{if(!(W==="search"&&i.state==="idle"&&!T))return;let P=document.activeElement;if(!!!(P?.matches('[role="tab"]')||P?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&P&&P!==document.body&&P!==h.current)return;let Te=window.requestAnimationFrame(()=>{ue()});return()=>{window.cancelAnimationFrame(Te)}},[W,i.state,T,ue],!0),fa(()=>{if(W!=="search")return;let S=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ue()}],[window,"pageshow",()=>{ue()}]];for(let[P,ie,Te]of S)P.addEventListener(ie,Te);return()=>{for(let[P,ie,Te]of S)P.removeEventListener(ie,Te)}},[W,ue],!0),lt(()=>(n&&n(W==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[W,n]),fa(()=>{let S=document.body,P=S.style.overflow;return W==="search"&&(S.style.overflow="hidden"),()=>{S.style.overflow=P}},[W],!0),lt(()=>{We&&Qe.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:We.totalSearches,averageSearchTime:We.averageSearchTime,itemCount:We.itemCount,resultsCount:We.resultsCount,workersAvailable:!!We.workerStats})},[We]);let{isAwaitingDebounce:Ut,isAwaitingSearchTermSync:Ln,isSearchInProgress:je}=bt(()=>{let S=gn!==mt,P=mt!==V,ie=V.trim().length>0||gn.trim().length>0;return{isAwaitingDebounce:S,isAwaitingSearchTermSync:P,isSearchInProgress:T||et||It!==V&&ut===null||ie&&Ee||S||P||Ft!==V}},[gn,mt,V,It,ut,T,et,Ee,Ft]),[Vt,ba]=Ve(V);lt(()=>{Vt!==V&&ba(V)},[V,Vt]),lt(()=>{Ut||Ln||T||et||Ee||Vt===V&&Ft!==V&&$t(V)},[V,Ft,Ut,Ln,T,et,Ee,Vt]);let Rn=bt(()=>Dr(Ke,Ho),[Ke]),On=bt(()=>Rn(Ht),[Rn,Ht]),hn=bt(()=>({contactMapRecords:d,contactMapRecordMap:l,filteredItems:On,searchQuery:Ke,searchTerm:V,isSearching:et,isIndexBuilding:Ee,isPending:T,hasSearchTerm:He,enableHighlighting:v,openEmailsWithGmail:C,isSearchInProgress:je,isSearchTabActive:W==="search",errorMessage:ut??null,isStreamingComplete:u,isStreamingFailed:m}),[d,l,On,Ke,V,et,Ee,T,He,v,C,je,W,ut,u,m]),_n=He?Ht.length:d.length,An=G(r,d.length),Dn=G(r,Ht.length);return te("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${W==="search"?" h-full min-h-0":""}`,children:ye(Xn,{value:W,onValueChange:Dt,className:`flex flex-col${W==="search"?" h-full min-h-0":""}`,children:[ye(kn,{ref:re,style:Md,className:"scrollbar-none mt-0 mb-1 flex h-auto 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:ce,onPointerMove:Se,onPointerUp:yt,onPointerLeave:_t,onPointerCancel:dt,onClickCapture:At,children:[ye(Mt,{value:"search",className:`min-h-11 min-w-16 px-2 py-0 ${E} transition-colors sm:min-w-24 sm:px-2.5 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100`,children:["\u{1F50D} ",c.searchTab]}),ye(Mt,{value:"settings",className:`min-h-11 min-w-16 px-2 py-0 ${E} transition-colors sm:min-w-24 sm:px-2.5 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100`,children:["\u2699\uFE0F ",c.searchSettings]}),ye(Mt,{value:"statistics",className:`min-h-11 min-w-16 px-2 py-0 ${E} transition-colors sm:min-w-24 sm:px-2.5 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100`,children:["\u{1F4CA} ",c.searchStatistics]})]}),te(Et,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:ye("div",{className:"flex h-full flex-col",children:[te("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:ye("div",{className:"flex flex-col",children:[te("div",{className:"relative",children:ye("div",{className:"flex items-center gap-1 p-1",children:[ye("button",{type:"button",onClick:Pn,"aria-pressed":Me,title:Wt,className:`inline-flex min-h-11 min-w-11 items-center justify-center gap-0.5 rounded border px-1.5 font-semibold ${E} transition-colors sm:min-w-12 sm:px-2 ${Me?"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:[te("span",{children:Me?c.operatorAnd:c.operatorOr}),te("span",{className:`hidden ${y} sm:inline`,children:Me?c.operatorAndHint:c.operatorOrHint})]}),te("input",{ref:h,type:"text",value:w,onChange:zt,placeholder:c.searchPlaceholder,className:`min-h-11 flex-1 rounded border border-gray-300 border-solid px-2 pointer-coarse:text-base ${E} shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none`}),w&&te("button",{type:"button",onClick:Bt,className:`flex min-h-11 min-w-11 items-center justify-center gap-1 rounded border border-gray-300 px-1.5 ${E} transition-colors hover:text-gray-700 sm:px-2 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100`,title:je?c.searchBusyTitle:c.clearSearch,"aria-label":je?void 0:c.clearSearch,disabled:je,children:je?ye(Io,{children:[te(yd,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),te("span",{className:"hidden sm:inline",children:c.searching})]}):"\u2715"})]})}),ye("p",{className:`px-1.5 py-0.5 ${y} text-slate-700 transition-colors dark:text-slate-200`,children:[c.registeredCountLabel," ",te("span",{className:`font-semibold ${E} text-slate-900 dark:text-white`,children:An})," ",c.recordUnit(An),Ee?ye("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",c.rebuildingIndex]}):null,ut?ye("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-rose-700 dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",c.errorLabel,te("span",{className:"ml-1 break-all font-semibold",children:ut})]}):null,He&&ye("span",{className:"ml-1.5 text-blue-600 dark:text-sky-400",children:["| ",c.resultCountLabel,je?te("span",{className:"ml-1 font-semibold",children:c.searching}):ye(Io,{children:[te("span",{className:`ml-1 font-semibold ${E} text-slate-900 dark:text-white`,children:Dn}),te("span",{className:"ml-0.5",children:c.resultUnit(Dn)})]})]})]}),te("div",{className:"h-2.5 px-2 pb-1.5",children:Ee?te(Jr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),a?a(hn):te(_o,{context:hn})]})}),te(Et,{value:"settings",className:"mt-0",children:te(lr,{searchOptions:g,setSearchOptions:x,enableHighlighting:v,setEnableHighlighting:k,openEmailsWithGmail:C,setOpenEmailsWithGmail:F,activeTab:J,onTabChange:A})}),te(Et,{value:"statistics",className:"mt-0",children:te(cr,{performanceMetrics:We,searchTerm:V,totalDataCount:d.length,resultsCount:_n,resetStats:un,rebuildIndex:mn,isIndexBuilding:Ee,activeTab:_,onTabChange:U})})]})})};import{jsx as cn,jsxs as Vo}from"react/jsx-runtime";var Ld=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let a=Y(),s=t===void 0?a.appTitle:t,{context:o,retryNow:r}=aa(),c=cn(Va,{recordCount:o.contactMapRecords.length,companyCount:o.companyCount,phase:o.streamPhase,loadedCount:o.loadedCount,totalCount:o.totalCount,errorMessage:o.errorMessage,onRetry:r});return Vo("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:s,annotation:c}):Vo("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[cn("h1",{className:"font-bold text-xl",children:s}),c]}),cn("div",{className:"min-h-0 flex-1",children:cn(zo,{streamState:o,onFooterVisibilityChange:n})})]})},Kg=e=>{let t=st(),n=xe(e,"streamEndpoint"),a=xe(e,"workerUrls"),s=xe(e,"locale"),o=xe(e,"labels"),r=Uo(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:tn(t.workerUrls,a,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:o===void 0?t.labels:o}),[t,n,a,s,o]),c=s!==void 0,d=o!==void 0,l=Uo(()=>({locale:c?"ContactMapAppView locale":"locale",labels:d?"ContactMapAppView labels":"labels"}),[c,d]);return cn(ja,{config:r,chromeSurface:l,children:cn(Ld,{...e})})};wt();le();import{createShouldRevalidate as Rd}from"@aiquants/route-revalidation";var Qg=Rd({submissions:"url",query:{ignore:[nn,"q"]}});export{La as AdvancedSearchSettings,Ra as BasicSearchSettings,at as CONTACT_MAP_LABEL_CATALOGS,bn as CONTACT_MAP_LABEL_KEYS,Wr as ContactDetailGrid,en as ContactDetailPanel,Vn as ContactDetailPopup,Kn as ContactDetailRowLayout,Va as ContactMapAnnotation,Kg as ContactMapAppView,Ci as ContactMapConfigProvider,bo as ContactMapSearchListView,zo as ContactMapSearchPage,_o as ContactMapSearchTabGroup,Oo as ContactMapSearchTreeView,ea as ContactMapStreamClient,pe as HighlightedText,or as IndexWorkerSettings,Pm as LIST_COLLAPSE_THRESHOLD,fl as LIST_DETAIL_PANEL_MIN_WIDTH,Lm as LIST_EXPAND_THRESHOLD,hl as LIST_PANEL_MIN_WIDTH,bl as LIST_RESIZE_HANDLE_THICKNESS,ir as LevenshteinWorkerSettings,Jr as Progress,lr as SearchOptionsPanel,L as StatItem,cr as StatisticsPanel,ca as SwipeOverlay,mp as TREE_COLLAPSE_THRESHOLD,Kl as TREE_DETAIL_PANEL_MIN_WIDTH,pp as TREE_EXPAND_THRESHOLD,Vl as TREE_PANEL_MIN_WIDTH,jl as TREE_RESIZE_HANDLE_THICKNESS,Xn as Tabs,Et as TabsContent,kn as TabsList,Mt as TabsTrigger,pa as TreeWorkerSession,sn as WorkerStatsSection,ta as assertContactMapStreamEndpoint,Kr as assertContactMapTreeWorkerUrl,Tu as assertContactMapWorkerUrls,Ql as composeTreeVirtualScrollOptions,Qg as contactMapShouldRevalidate,_i as countContactMapCompanies,wi as deserializeStreamRecord,Ei as getContactMapStreamClient,Dl as getTreeWorkerSession,tn as layerContactMapWorkerUrls,Fu as resetContactMapStreamClientForTesting,Bm as resetTreeWorkerSessionForTesting,wa as resolveContactMapLabels,yo as useAnimatedNumber,st as useContactMapConfig,Y as useContactMapLabels,Oi as useContactMapStream,Xa as useContactPanelSizing,Zr as useDynamicViewportHeight,ht as useHorizontalDragScroll,ia as useLongPressPopup,wl as useReportPopupVisibility,la as useResponsiveTwoColumnLayout,Tl as useRowPopupRegistry,aa as useStreamedContactMapContext,So as useTreeWorker};
|
|
2
|
+
`);s=u.pop()??"";let m=!1;for(let i of u){let p=i.trim();if(!p)continue;let h;try{h=JSON.parse(p)}catch(v){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",v);continue}if("type"in h&&h.type==="METADATA"){Number.isSafeInteger(h.total)&&h.total>=0&&this.setState({totalCount:h.total});continue}if(!Ni(h)){this.logger.warn("[ContactMapStream] server reported error:","error"in h?h.error:""),r=!0;continue}for(let v of h.records)v&&typeof v.person_id=="number"&&(this.recordMap.set(v.person_id,wi(v)),m=!0);h.nextCursor&&(this.lastCursor=h.nextCursor),h.isLast&&(o=!0)}m&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return r?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):o?"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 ze=null,Ei=e=>{if(ze!==null&&ze.endpoint===e)return ze;if(ta(e),ze===null)return ze=new ea({endpoint:e}),ze;if(ze.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(ze.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 ze},Fu=()=>{ze?.dispose(),ze=null},Pi=new Map,Li={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Ri=()=>{let{streamEndpoint:e}=st();return na(()=>(ta(e),e),[e])};function Oi(){let e=Ri(),t=Ga(()=>Ei(e),[e]);Mi(()=>{let r=t();r.start(),r.retryNow()},[t]);let n=Ga(r=>t().subscribe(r),[t]),a=Yr(n,()=>t().getState(),()=>Li),s=Yr(n,()=>t().getRecordMap(),()=>Pi),o=Ga(()=>t().retryNow(),[t]);return na(()=>({...a,recordMap:s,retryNow:o}),[a,s,o])}var _i=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 aa(){let{records:e,recordMap:t,isComplete:n,phase:a,loadedCount:s,totalCount:o,error:r,retryNow:c}=Oi(),d=na(()=>_i(e),[e]);return{context:na(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:a==="failed",streamPhase:a,loadedCount:s,companyCount:d,totalCount:o,errorMessage:r?.message??null}),[e,t,n,a,s,d,o,r]),retryNow:c}}le();import{DEFAULT_FUZZY_SEARCH_OPTIONS as hd,parseQuerySets as fd}from"@aiquants/fuzzy-search";import{useFuzzySearch as bd}from"@aiquants/fuzzy-search/react";import yd from"lucide-react/dist/esm/icons/search.js";import{useCallback as ln,useEffect as lt,useMemo as bt,useRef as Fo,useState as Ve,useTransition as xd}from"react";import{useNavigation as vd,useSearchParams as Cd}from"react-router";Ia();qt();import{useCallback as Pt,useEffect as Ai,useRef as Qr}from"react";var ht=e=>{let t=Qr(null),n=Qr({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),a=e?.dragThreshold??4,s=Pt(m=>{let i=m.currentTarget,p=m.deltaY;!i||p===0||(m.preventDefault(),i.scrollBy({left:p,behavior:"smooth"}))},[]),o=Pt(m=>{t.current?.removeEventListener("wheel",s),t.current=m,m?.addEventListener("wheel",s,{passive:!1})},[s]);Ai(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let r=Pt(m=>{if(m.pointerType==="touch")return;let i=n.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=m.clientX,i.scrollLeft=m.currentTarget.scrollLeft,i.pointerId=m.pointerId,i.hasCapture=!1,i.pointerType=m.pointerType},[]),c=Pt(m=>{let i=n.current;if(!i.isPointerDown||i.pointerType==="touch")return;let p=m.currentTarget,h=m.clientX-i.startX;!i.isDragging&&Math.abs(h)>a&&(i.isDragging=!0,i.hasCapture||(p.setPointerCapture?.(m.pointerId),i.hasCapture=!0)),i.isDragging&&(m.preventDefault(),p.scrollLeft=i.scrollLeft-h)},[a]),d=Pt(m=>{let i=n.current;if(i.pointerType==="touch")return;let p=m.currentTarget;i.isPointerDown&&i.hasCapture&&p.hasPointerCapture?.(m.pointerId)&&p.releasePointerCapture(m.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),l=Pt(m=>{d(m)},[d]),u=Pt(m=>{n.current.didDrag&&(m.preventDefault(),m.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:o,onPointerDown:r,onPointerMove:c,onPointerUp:l,onPointerLeave:l,onPointerCancel:l,onClickCapture:u}};wt();le();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Di}from"@aiquants/fuzzy-search";var ra=e=>{let{indexWorkerOptions:t,levenshteinWorkerOptions:n,...a}=Di;return{...a,autoSearchOnIndexRebuild:!1,multiTermOperator:"and",workerUrls:e,indexWorkerOptions:{...t},levenshteinWorkerOptions:{...n}}};xn();import{jsx as Xr}from"react/jsx-runtime";function Jr({value:e,max:t=100,className:n,indicatorClassName:a,...s}){let o=e===void 0,r=o?0:Math.min(100,Math.max(0,e/t*100));return Xr("div",{role:"progressbar","aria-valuenow":o?void 0:r,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:fe("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...s,children:Xr("div",{"data-slot":"progress-indicator",className:fe("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",o&&"w-1/3 animate-progress-indeterminate",a),style:o?void 0:{width:`${r}%`}})})}ge();var nn="view";import{useCallback as td,useState as nd}from"react";import{useSearchParams as ad}from"react-router";le();ge();kt();import{Panel as so,PanelGroup as ol,PanelResizeHandle as sl}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as il,VirtualScroll as ll,virtualScrollItemElementId as dl}from"@aiquants/virtualscroll";import{lazy as cl,memo as ul,Suspense as ml,useCallback as Le,useEffect as go,useId as io,useLayoutEffect as ho,useMemo as Lt,useRef as an,useState as wn}from"react";var Sn={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},Tn={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,n=t+e.scrollbarSafetyBuffer,a=n+e.hysteresisSafetyMargin,s=a-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:a,hysteresisWidth:s}}import{useCallback as Wi,useEffect as Hi,useState as Ii}from"react";var Zr=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:a=4,minFallbackHeight:s=240}=t??{},[o,r]=Ii(600),c=Wi(()=>{if(typeof window>"u")return;let d=e.current;if(!d||d.offsetParent===null&&window.getComputedStyle(d).position!=="fixed")return;let l=T=>Number.parseFloat(T)||0,{top:u}=d.getBoundingClientRect(),m=d.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),p=l(i.getPropertyValue("--footer-height")),h=l(i.getPropertyValue("--header-height")),v=l(i.getPropertyValue("--scrollbar-height")),k=window.getComputedStyle(d),C=l(k.marginBottom),F=l(k.paddingBottom),I=window.innerHeight-p-v-a,f=m?Math.min(m.bottom,I):I,g=m?Math.max(m.top,h):h,x=Math.max(u,g),w=f-x-C-F,D=Number.isFinite(w)?Math.floor(w):0,b=D>0?D:s;b>0&&Number.isFinite(b)&&r(T=>Math.abs(T-b)>1?b:T)},[a,e,s]);return Hi(()=>{if(typeof window>"u")return;let d=null,l=null,u=null,m=null,i=()=>{d!==null&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{c()})};i(),l=window.setTimeout(()=>{i()},150);let p=e.current;return typeof ResizeObserver<"u"&&p&&(u=new ResizeObserver(()=>{i()}),u.observe(p),p.parentElement&&u.observe(p.parentElement)),n&&typeof MutationObserver<"u"&&(m=new MutationObserver(()=>{i()}),m.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{d!==null&&window.cancelAnimationFrame(d),l!==null&&window.clearTimeout(l),u&&u.disconnect(),m&&m.disconnect(),window.removeEventListener("resize",i)}},[e,n,c]),{viewportHeight:o,updateViewportHeight:c}};import{useCallback as it,useEffect as eo,useRef as sa,useState as to}from"react";var Fi=600,no=8,ia=({ref:e,onSelect:t,resolveItem:n,item:a})=>{let[s,o]=to(!1),[r,c]=to(null),d=sa(null),l=sa(!1),u=sa(null),m=sa({onSelect:t,resolveItem:n,item:a});eo(()=>{m.current={onSelect:t,resolveItem:n,item:a}},[t,n,a]);let i=it(()=>{typeof window>"u"||d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),p=it(()=>{u.current&&(i(),u.current=null)},[i]),h=it(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(i(),l.current=!1,u.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},d.current=window.setTimeout(()=>{let x=m.current,w=null;x.item!==void 0?w=x.item:x.resolveItem&&g.target&&(w=x.resolveItem(g.target)),w!==null&&(l.current=!0,x.onSelect?.(w),c(w),o(!0)),p()},Fi))},[i,p]),v=it(g=>{u.current&&g.pointerId===u.current.pointerId&&(i(),u.current=null)},[i]),k=it(g=>{l.current&&(g.preventDefault(),g.stopPropagation(),g.type==="click"&&(l.current=!1))},[]),C=it(()=>{l.current=!1},[]),F=it(g=>{if(!u.current||g.pointerId!==u.current.pointerId)return;let x=Math.abs(g.clientX-u.current.x),w=Math.abs(g.clientY-u.current.y);(x>no||w>no)&&(i(),u.current=null)},[i]),I=it(g=>{(s||d.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),f=it(()=>{o(!1),c(null),l.current=!1,u.current=null},[]);return eo(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let x=[["pointerdown",h,void 0],["pointerup",v,void 0],["pointercancel",v,void 0],["pointermove",F,void 0],["pointerleave",v,void 0],["contextmenu",I,void 0]],w=[["mousedown",k,!0],["mouseup",k,!0],["click",k,!0],["pointerdown",C,!0],["keydown",C,!0],["contextmenu",I,!0],["pointerup",v,!0],["pointercancel",v,!0]];for(let[D,b,T]of x)g.addEventListener(D,b,T);for(let[D,b,T]of w)window.addEventListener(D,b,T);return()=>{for(let[D,b,T]of x)g.removeEventListener(D,b,T);for(let[D,b,T]of w)window.removeEventListener(D,b,T);i()}},[e,h,v,F,k,C,I,i]),{isPopupVisible:s,popupItem:r,handleClosePopup:f}};import{useCallback as $i,useEffect as zi,useState as ao,useSyncExternalStore as Bi}from"react";function la(e,t,n){let a=n?.mediaQuery??"(min-width: 1024px)",s=Bi($i(u=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let m=window.matchMedia(a);return m.addEventListener("change",u),()=>m.removeEventListener("change",u)},[a]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(a).matches:!0,()=>!1),[o,r]=ao(!1),[c,d]=ao(0);return zi(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let u=e.current;if(!u)return;let m=new ResizeObserver(i=>{for(let p of i){if(p.target!==u)continue;let h=0;p.borderBoxSize&&p.borderBoxSize.length>0?h=p.borderBoxSize[0].inlineSize:h=p.contentRect.width,!(!Number.isFinite(h)||h<=0)&&(d(h),r(v=>v&&h>=t.expandThreshold?!1:!v&&h<t.collapseThreshold?!0:v))}});return m.observe(u),()=>m.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!o,isContainerNarrow:o,isMediaMatches:s,containerWidth:c}}le();St();var ro=e=>e.isComposing||e.keyCode===229;var oo=(e,t)=>{if(Ki(t),e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||ro(e)||t.itemCount===0)return null;if(e.key==="Enter"||e.key===" ")return{kind:"activate"};let n=t.itemCount-1;if(t.activeIndex===null)return Vi(e.key)?{kind:"move",index:t.startIndex,direction:1}:null;let a=t.activeIndex;switch(e.key){case"ArrowDown":return{kind:"move",index:Math.min(a+1,n),direction:1};case"ArrowUp":return{kind:"move",index:Math.max(a-1,0),direction:-1};case"PageDown":return{kind:"move",index:Math.min(a+t.pageSize,n),direction:1};case"PageUp":return{kind:"move",index:Math.max(a-t.pageSize,0),direction:-1};case"Home":return{kind:"move",index:0,direction:1};case"End":return{kind:"move",index:n,direction:-1};default:return null}},Ui=new Set(["ArrowDown","ArrowUp","PageDown","PageUp","Home","End"]),Vi=e=>Ui.has(e),Ki=e=>{let{activeIndex:t,startIndex:n,itemCount:a,pageSize:s}=e;if(!Number.isInteger(a)||a<0)throw new RangeError(`[contact-map] listbox itemCount must be a non-negative integer; got ${Z(a)}`);if(!Number.isInteger(s)||s<1)throw new RangeError(`[contact-map] listbox pageSize must be an integer of at least 1; got ${Z(s)}`);let o=r=>Number.isInteger(r)&&r>=0&&r<a;if(a>0&&!o(n))throw new RangeError(`[contact-map] listbox startIndex must be an index below ${a}; got ${Z(n)}`);if(t!==null&&!o(t))throw new RangeError(`[contact-map] listbox activeIndex must be null or an index below ${a}; got ${Z(t)}`)};le();Oa();yn();xn();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as ji,useOverlayPresence as Gi,useSwipeOverlayDialog as qi}from"@aiquants/swipe-overlay";import{useCallback as Yi,useId as Qi}from"react";import{jsx as da,jsxs as qa}from"react/jsx-runtime";var Xi=fe(Fn,"flex overflow-hidden"),Ji=fe(zn,"motion-safe:transition-opacity motion-safe:duration-200"),Zi="relative ml-auto flex h-full w-full max-w-lg flex-col bg-white shadow-xl motion-safe:transition-[transform] motion-safe:duration-200 motion-safe:ease-out dark:bg-slate-900",el="flex shrink-0 items-center justify-between gap-3 border-slate-200 border-b px-3 py-2 dark:border-slate-700",tl="min-w-0 truncate font-semibold text-base text-slate-900 outline-none dark:text-slate-100",nl=`inline-flex min-h-11 min-w-11 shrink-0 touch-manipulation items-center justify-center rounded-full border border-slate-300 px-4 font-medium text-slate-700 text-sm hover:bg-slate-100 dark:border-slate-600 dark:text-slate-200 dark:hover:bg-slate-800 ${gt}`,al="flex min-h-0 flex-1 flex-col overflow-y-auto p-3",ca=({isOpen:e,onClose:t,children:n,className:a,title:s})=>{let o=Y(),r=Qi(),c=Gi(e),d=Yi(h=>h.ownerDocument.getElementById(r),[r]),{dialogProps:l,backdropProps:u,panelProps:m,attemptClose:i,isSwiping:p}=qi({isOpen:e,onClose:t,isCloseBlocked:Bn,skipWhenTextSelected:!0,initialFocus:d});return c?qa("dialog",{...l,"data-testid":"contact-map-mobile-overlay","aria-labelledby":r,className:fe(Xi,e&&!p?"pointer-events-auto":"pointer-events-none"),style:$n,children:[da("div",{...u,"data-contact-map-overlay-backdrop":"",className:fe(Ji,e?"opacity-100":"opacity-0")}),qa("div",{...m,"data-contact-map-overlay-panel":"",className:fe(Zi,e?"pointer-events-auto":"pointer-events-none",a),children:[qa("div",{className:el,children:[da("h2",{id:r,tabIndex:-1,className:tl,children:s===void 0?o.overlayTitle:s}),da("button",{type:"button",className:nl,onClick:()=>i(),children:o.close})]}),da("div",{"data-contact-map-overlay-body":"",className:al,style:ji,children:n})]})]}):null};yn();ge();Wa();import{Fragment as Nl,jsx as $,jsxs as Be}from"react/jsx-runtime";var pl=cl(async()=>({default:(await Promise.resolve().then(()=>(Ir(),Hr))).default})),Ya=64,lo="h-[64px]",co=240,gl=4,Qa=oa(Sn),hl=Sn.listPanelMinWidth,fl=Sn.detailPanelMinWidth,bl=Sn.handleThickness,Pm=Qa.collapseThreshold,Lm=Qa.expandThreshold,yl=({contactData:e})=>{let t=Y(),n=Ie(e?.full_name)??t.noName,a=Ie(e?.title)??"-",s=Ie(e?.company_name)??"-",o=Ie(e?.department)??"-",r=Kt(e).value??"-",c=jt(e).value??"-",d=Ge(e?.updated_at,t.recordDateTime);return $(Kn,{fullName:n,title:a,companyName:s,department:o,phoneNumber:c,email:r,updatedAtText:d})},xl=e=>({"--contact-panel-height":`${e}px`}),vl=e=>typeof e=="object"&&e!==null&&"item"in e,Cl=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,kl=(e,t)=>{for(let n of e){let a=Ct(n);if(a?.person_id===t)return a}return null},uo=(e,t)=>t!==null&&Ct(e)?.person_id===t,mo=(e,t,n)=>{for(let a=t;a>=0&&a<e.length;a+=n){let s=Ct(e[a]);if(s!==null)return{index:a,personId:s.person_id}}return null},po=(e,t,n)=>{let a=mo(e,t,n);return a!==null?a:mo(e,t-n,n===1?-1:1)},Xa=(e,t,n)=>{let{viewportHeight:a}=Zr(t,{enableMutationObserver:!0,bottomGap:gl,minFallbackHeight:co}),[s,o]=wn(0),r=Le(()=>{let m=n.current,i=t.current;if(!(m&&i))return;let p=m.getBoundingClientRect(),h=i.getBoundingClientRect(),v=Math.ceil(h.top-p.top);Number.isFinite(v)&&v>0&&o(k=>Math.abs(k-v)>1?v:k)},[t,n]);ho(()=>{if(!e)return;r();let m=requestAnimationFrame(r);return window.addEventListener("resize",r),()=>{cancelAnimationFrame(m),window.removeEventListener("resize",r)}},[e,r]);let c=a>0?a:co,d=s>0?s:0,l=c+d,u=Lt(()=>xl(l),[l]);return{normalizedViewportHeight:c,normalizedDetailHeight:l,panelSizingStyle:u}},Sl=new Set,Tl=()=>{let[e,t]=wn(Sl),n=Le((a,s)=>{t(o=>{if(o.has(a)===s)return o;let r=new Set(o);return s?r.add(a):r.delete(a),r})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},wl=(e,t,n)=>{let a=an(n);ho(()=>{a.current=n},[n]),go(()=>{if(e!==null)return a.current(e,t),()=>{a.current(e,!1)}},[e,t])},fo=ul(({entry:e,index:t,itemCount:n,listboxId:a,isSelected:s,isActive:o,onSelect:r,onLongPressSelect:c,searchQuery:d,enableHighlighting:l,openEmailsWithGmail:u,openGmailCompose:m,onPopupVisibilityChange:i})=>{let p=Y(),h=an(null),v=$("div",{className:lo}),k=vl(e)?e:null,C=Ct(e),{isPopupVisible:F,handleClosePopup:I}=ia({ref:h,onSelect:c,item:C?.person_id});if(wl(C?.person_id??null,F,i),!e||!C)return v;let{person_id:f}=C,g=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",w=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":g,D=["B","F"].map(b=>Cl(b,b==="B"?k?.baseScore:k?.score)).filter(Boolean);return Be("div",{ref:h,id:dl(a,f),className:`flex ${lo} 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 ${w} ${wr}`,style:{height:Ya},role:"option","aria-selected":s,"aria-posinset":t+1,"aria-setsize":n,"data-selected":s?"true":"false","data-contact-map-row-active":o?"":void 0,onClick:()=>r(f),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:p.listRowNumber(t+1)}),$("div",{className:`truncate ${pt} text-slate-700 leading-tight dark:text-slate-200`,children:f}),$("div",{className:`flex items-center gap-1 whitespace-nowrap font-mono ${pt} text-slate-600 leading-tight dark:text-slate-300`,children:D.length?D.map(b=>$("span",{children:b},b)):$("span",{children:"-"})})]}),$(ml,{fallback:$(yl,{contactData:C}),children:$(pl,{contactData:C,searchTerm:d,enableHighlighting:l,openEmailsWithGmail:u,openGmailCompose:m,isPopupVisible:F,onRequestClose:I})})]})});fo.displayName="ContactListRow";var bo=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:a,hasSearchTerm:s,enableHighlighting:o,openEmailsWithGmail:r,isSearchTabActive:c}=e,{locale:d,labels:l,engineLabels:u}=ve(),m=an(null),i=an(null),[p,h]=wn(null),{normalizedViewportHeight:v,panelSizingStyle:k}=Xa(c,i,m),{isAnyPopupVisible:C,handlePopupVisibilityChange:F}=Tl(),I=Lt(()=>({enablePointerDrag:!C,enableKeyboardNavigation:!1}),[C]),f=Lt(()=>s?n:t,[s,n,t]),[g,x]=wn(null),w=Le(K=>{h(K),x(K)},[]),D=Le(K=>{if(!r)return;let se=K.trim();if(!se||se==="-"||typeof window>"u")return;let V=nt(se,!0);V&&window.open(V,"_blank","noopener,noreferrer")},[r]),[b,T]=wn(!1),X=Le(()=>T(!1),[]),W=Le(K=>{w(K),T(!0)},[w]),de=io(),J=io(),A=an(null),_=f.length,U=Le((K,se)=>$(fo,{entry:K,index:se,itemCount:_,listboxId:de,isSelected:uo(K,p),isActive:uo(K,g),onSelect:W,onLongPressSelect:w,searchQuery:a,enableHighlighting:o,openEmailsWithGmail:r,openGmailCompose:D,onPopupVisibilityChange:F}),[_,de,p,g,W,w,a,o,r,D,F]),re=Lt(()=>{let K=new Map;return f.forEach((se,V)=>{let ct=Ct(se);ct!==null&&K.set(ct.person_id,V)}),K},[f]),ce=g===null?null:re.get(g)??null,Se=p===null?null:re.get(p)??null,yt=Math.max(1,Math.floor(v/Ya)),_t=Le(K=>{if(K.target.id!==de)return;let se=oo(K.nativeEvent,{activeIndex:ce,startIndex:Se===null?0:Se,itemCount:_,pageSize:yt});if(se===null)return;if(K.preventDefault(),se.kind==="activate"){ce!==null&&g!==null&&W(g);return}let V=po(f,se.index,se.direction);V!==null&&(x(V.personId),A.current?.scrollToIndex(V.index,{align:"nearest"}))},[de,ce,Se,_,yt,g,W,f]),dt=Le(K=>{if(K.target.id!==de||ce!==null||!K.target.matches(":focus-visible"))return;let se=po(f,Se===null?0:Se,1);se!==null&&x(se.personId)},[de,ce,Se,f]),At=Lt(()=>({id:de,role:"listbox",tabIndex:0,"aria-label":l.listboxLabel,"aria-describedby":J}),[de,l.listboxLabel,J]),ue=Le(K=>f[K],[f]),Dt=Le(K=>Ct(f[K])?.person_id??`row-${K}`,[f]),Ae=Le(()=>Ya,[]),Ze=Lt(()=>({enabled:!0,renderVisual:il}),[]),De=Lt(()=>p===null?null:kl(f,p),[p,f]);go(()=>{p!==null&&!De&&h(null)},[p,De]);let Me=an(null),{isTwoColumn:Wt}=la(Me,Qa);b&&(Wt||De===null)&&T(!1);let xt=Be("div",{ref:m,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 ${y} 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:l.columnNo}),$("span",{className:"leading-tight",children:l.columnId}),$("span",{className:"whitespace-nowrap leading-tight",children:l.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:l.columnName}),$("span",{className:`font-normal ${y} text-slate-600 uppercase tracking-wider dark:text-slate-300`,children:l.columnTitle})]}),Be("div",{className:"flex flex-col gap-0.5",children:[$("span",{children:l.columnCompany}),$("span",{className:`font-normal ${y} text-slate-600 uppercase tracking-wider dark:text-slate-300`,children:l.columnDepartment})]}),Be("div",{className:"flex flex-col gap-0.5",children:[$("span",{children:l.columnPhone}),$("span",{className:`font-normal ${y} text-slate-600 uppercase tracking-wider dark:text-slate-300`,children:l.columnEmail})]}),$("div",{className:"hidden items-end justify-end xl:flex",children:$("span",{className:`font-normal ${y} text-slate-600 uppercase tracking-wider dark:text-slate-300`,children:l.columnUpdatedAt})})]})]})}),$("p",{id:J,hidden:!0,children:l.listKeyboardHelp}),$("div",{ref:i,className:"flex-1",onKeyDown:_t,onFocus:dt,children:$(ll,{ref:A,contentProps:At,activeItemIndex:_===0?void 0:ce,activeItemVisibleInset:2,itemCount:_,getItemKey:Dt,behaviorOptions:I,getItem:ue,getItemHeight:Ae,viewportSize:v,overscanCount:10,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:Ze},locale:d,labels:u,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:(K,se)=>U(K,se)})}),n.length===0&&s?$("div",{className:"py-8 text-center",children:$("p",{className:"text-slate-600 dark:text-slate-300",children:l.listNoSearchResults})}):null,_===0&&!s?$("div",{className:"py-8 text-center",children:$("p",{className:"text-slate-600 dark:text-slate-300",children:l.listNoData})}):null]});return $("div",{ref:Me,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:k,children:Wt?Be(ol,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[$(so,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:hl,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:xt}),$(sl,{id:"contact-map-list-handle",thickness:bl,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":l.listResizeHandle}),$(so,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:fl,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:$(en,{placement:"pane",contact:De,searchTerm:a,enableHighlighting:o})})]}):Be(Nl,{children:[xt,De?$(ca,{isOpen:b,onClose:X,title:l.detailHeading,children:$(en,{placement:"overlay",contact:De,searchTerm:a,enableHighlighting:o})}):null]})})};kt();import{DirectoryTree as Hl}from"@aiquants/directory-tree";import{Panel as To,PanelGroup as Il,PanelResizeHandle as Fl}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as $l}from"@aiquants/virtualscroll";import zl from"@heroicons/react/24/solid/FolderMinusIcon.js";import Bl from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as Re,useEffect as Ot,useMemo as Ue,useRef as ga,useState as ft}from"react";import{createPortal as Ul}from"react-dom";var Ja=(e,t)=>e&&e.trim()||t;import{useEffect as Ml,useRef as ua,useState as El}from"react";var yo=(e,t=250)=>{let[n,a]=El(e),s=ua(null),o=ua(e),r=ua(null),c=ua(!1);return Ml(()=>{if(!c.current){c.current=!0,a(e),o.current=e;return}o.current=n,s.current=null;let d=l=>{s.current??(s.current=l);let u=l-s.current,m=Math.min(1,Math.max(0,u/t)),i=1-(1-m)**3,p=Math.max(0,Math.round(o.current+(e-o.current)*i));a(p),m<1&&(r.current=requestAnimationFrame(d))};return r.current=requestAnimationFrame(d),()=>{r.current!==null&&cancelAnimationFrame(r.current)}},[e,t]),Math.max(0,n)};St();import{useCallback as Za,useEffect as er,useMemo as xo,useRef as Pl,useSyncExternalStore as Ll}from"react";le();var Rl=250,Ol=4e3,ma=3,vo={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},Co=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,pa=class{constructor(t,{workerSource:n,logger:a=Qe}){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>=ma){this.logger.error(`[TreeWorker] the tree Worker failed ${ma} times in a row; the tree stops updating until ${vo[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Rl*2**(this.consecutiveFailures-1),Ol);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${ma})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let a=this.lastSyncedNaming;a!==null&&this.syncRecords(this.lastSyncedRecords,a)},n)};if(typeof n!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${Z(n)}`);if(!Object.hasOwn(vo,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${Z(n)}`);this.workerFactory=t,this.workerSource=n,this.logger=a}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>=ma||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||!Co(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let a=this.ensureWorker();if(!a)return;let s=this.workerNeedsReset,o=this.postedNaming===null||!Co(this.postedNaming,n);if((this.workerNeedsReset||o||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=n,a.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),this.updateState()),t.length>this.postedCount){let r=t.slice(this.postedCount);this.postedCount=t.length,a.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:r}),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}}},_l=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 a=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(a,t),{type:"module"})}throw new Error("[contact-map] the tree Worker needs workerUrls.treeWorker in a build without import.meta.url (CommonJS)")},Rt=null,ko=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),Al=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},Dl=e=>{if(Kr(e),Rt===null){let t=new pa(()=>_l(e),{workerSource:"workerUrls.treeWorker"});return Rt={session:t,workerUrl:e},t}if(Rt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${ko(Rt.workerUrl)} and cannot also load it from ${ko(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return Rt.session},Bm=()=>{Rt?.session.reset(),Rt=null},Wl={snapshot:null,isBuilding:!1};function So(e,t=!1){let n=st(),a=n.treeWorkerFactory,s=n.workerUrls?.treeWorker,{labels:o}=ve(),r=o.uncategorizedCompany,c=o.noName,d=xo(()=>({uncategorizedCompany:r,unnamedPerson:c}),[r,c]),l=Pl(a);er(()=>{l.current=a},[a]);let u=a!==void 0,m=u?void 0:s,i=xo(()=>u?new pa(()=>Al(l.current)(),{workerSource:"treeWorkerFactory"}):null,[u]),p=Za(()=>i===null?Dl(m):i,[i,m]),h=Za(k=>p().subscribe(k),[p]),v=Za(()=>p().getState(),[p]);return er(()=>{let k=p();k.syncRecords(e,d),t&&k.finalize()},[p,e,t,d]),er(()=>{if(i!==null)return()=>i.stop()},[i]),Ll(h,v,()=>Wl)}le();ge();Da();qn();import{Fragment as ed,jsx as z,jsxs as ke}from"react/jsx-runtime";var ar=oa(Tn),Vl=Tn.listPanelMinWidth,Kl=Tn.detailPanelMinWidth,jl=Tn.handleThickness,mp=ar.collapseThreshold,pp=ar.expandThreshold,Gl=(e,t)=>{let{searchQuery:n,enableHighlighting:a}=t,s=Ja(e.full_name,t.noName),o=Ja(e.title,""),r=z(pe,{text:s,query:n,enabled:a});return o?ke("span",{className:"flex items-center gap-1.5",children:[z("span",{children:r}),z("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:z(pe,{text:o,query:n,enabled:a})})]}):r},ql="contact-map-tree h-full w-full",Yl={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"},tr="h-4 w-4 shrink-0 transition-colors duration-150",Ql=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),ha=null,wo=null,Nn=new Map,No="",Mo=null,Eo=null,Xl=(e,t,n,a,s)=>{let o=`${n?"icons":"plain"}#${a}#${s.noName}`;(o!==No||s.formatDirectoryName!==Mo||t!==Eo)&&(Nn.clear(),No=o,Mo=s.formatDirectoryName,Eo=t);let r={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},c=new Set;for(let d of e){c.add(d.absolutePath);let l=`${d.name}\0${d.memberCount}`,u=Nn.get(d.absolutePath);(!u||u.signature!==l)&&(u={signature:l,result:Ro([d],t,n,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},Nn.set(d.absolutePath,u));let m=u.result;m.entries.length>0&&r.entries.push(m.entries[0]);for(let[i,p]of m.personPathMap){let h=r.personPathMap.get(i);if(h)for(let v of p)h.add(v);else r.personPathMap.set(i,new Set(p))}for(let[i,p]of m.contactByPath)r.contactByPath.set(i,p);for(let[i,p]of m.ancestorsByPath)r.ancestorsByPath.set(i,p);r.totalCount+=m.totalCount,!r.firstPerson&&m.firstPerson&&(r.firstPerson=m.firstPerson)}for(let d of Nn.keys())c.has(d)||Nn.delete(d);return r},nr=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",Lo=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...Lo(n.children)));return t},Jl=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Ro=(e,t,n,a,s)=>{let o=new Map,r=new Map,c=new Map,d=0,l=null,u=(i,p)=>{let h=[...p,i.absolutePath];c.set(i.absolutePath,h);let v,k,C=i.type==="directory"?a.formatDirectoryName(i.name,Jl(i)):i.name,F=z(pe,{text:C,query:a.searchQuery,enabled:a.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let I=t.get(i.personId);if(I){r.set(i.absolutePath,I),o.has(i.personId)||o.set(i.personId,new Set);let f=o.get(i.personId);f&&f.add(i.absolutePath),d++,l||(l={personId:i.personId,path:i.absolutePath}),n&&(k=g=>{let x=nr(g);return g.isSelected||g.isItemSelected||i.isPrimary&&(x=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),z(n.person,{"aria-hidden":"true",className:`${tr} ${x}`})},i.title&&(F=Gl(I,a))),F=z("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:F})}}else if(i.children){let I=i.children.map(f=>u(f,h)).filter(f=>f!==null);if(s&&I.length===0)return null;if(v=I,n){let f=i.relativePath.startsWith("company:")?n.company:n.department;k=g=>z(f,{"aria-hidden":"true",className:`${tr} ${nr(g)}`})}}return{name:C,label:F,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:k,children:v}};return{entries:e.map(i=>u(i,[])).filter(i=>i!==null),personPathMap:o,contactByPath:r,ancestorsByPath:c,firstPerson:l,totalCount:d}},Zl=(e,t,n)=>{let a=new Set,s=new Set,o=new Map;t.forEach((u,m)=>{o.set(u.item.person_id,m)});for(let u of t){let m=u.item.person_id,i=e.personPathMap.get(m);if(i)for(let p of i){a.add(p);let h=e.ancestorsByPath.get(p);if(h){for(let v of h)a.add(v);n&&h.length>0&&s.add(h[0])}}}let r=new Map,c=u=>{let m=r.get(u.absolutePath);if(m!==void 0)return m;let i=1/0;if(u.type==="file"){let p=e.contactByPath.get(u.absolutePath);p&&(i=o.get(p.person_id)??1/0)}else if(u.children)for(let p of u.children)i=Math.min(i,c(p));return r.set(u.absolutePath,i),i},d=(u,m=0)=>u.filter(i=>n&&m===0&&s.has(i.absolutePath)?!0:a.has(i.absolutePath)).map(i=>n&&m===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:d(i.children,m+1)}:i).sort((i,p)=>m===0?c(i)-c(p):0),l=d(e.entries);return{...e,entries:l}},Po=(e,t,n)=>{if(e===null)return null;let a=n.get(e);if(a===void 0)return null;if(t!==null&&a.has(t))return t;let s=a.values().next();return s.done?null:s.value},Oo=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:a,filteredItems:s,hasSearchTerm:o,isSearchInProgress:r,isSearchTabActive:c}=e,{locale:d,labels:l,treeLabels:u}=ve(),m=l.noName,i=l.treeDirectoryName,p=Ue(()=>({noName:m,formatDirectoryName:i}),[m,i]),[h,v]=ft(null),[k,C]=ft(!1),{snapshot:F,isBuilding:I}=So(n,e.isStreamingComplete),f=F?.tree??null,g=F?.rebuildEpoch??0,x=Ue(()=>f?Xl(f,a,h,g,p):null,[f,a,h,g,p]),w=Ue(()=>{if(!f)return null;if(!o)return x;let R;k||(R=new Set(s.map(P=>P.item.person_id)));let S=Ro(f,a,h,{...p,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},R);return Zl(S,s,k)},[f,x,a,h,e.searchQuery,e.enableHighlighting,o,s,k,p]),D=Ue(()=>w||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[w]),b=o&&e.errorMessage!==null,[T,X]=ft(D),W=ga(!1);Ot(()=>{if(!(r||b)){W.current=!!f,X(D);return}!W.current&&f&&D.entries.length>0&&(W.current=!0,X(D))},[D,f,r,b]);let de=o&&(r||b)?T:D,{entries:J,personPathMap:A,contactByPath:_,totalCount:U}=de,re=Ue(()=>Lo(J),[J]),[ce,Se]=ft(()=>wo??new Set),yt=Re(R=>!ce.has(R),[ce]),_t=Re(R=>{Se(S=>{let P=new Set(S);return P.has(R)?P.delete(R):P.add(R),P})},[]),dt=Re(R=>{R.length!==0&&Se(S=>{let P=new Set(S);for(let ie of R)P.add(ie);return P})},[]),At=Re(R=>{Se(S=>{if(S.size===0)return S;let P=!1,ie=new Set(S);for(let Te of R)ie.delete(Te)&&(P=!0);return P?ie:S})},[]);Ot(()=>{wo=ce},[ce]),Ot(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[ue,Dt]=ft(null),[Ae,Ze]=ft(null),[De,Me]=ft(!1),Wt=Re(()=>Me(!1),[]),[xt,K]=ft(!1),se=ga(null),V=ga(null),{normalizedViewportHeight:ct,panelSizingStyle:Ht}=Xa(c,V,se),It=Re(R=>{let S=_.get(R);return S?(ue!==S.person_id&&Dt(S.person_id),R!==Ae&&Ze(R),!0):!1},[_,Ae,ue]),et=Re(R=>{It(R)&&Me(!0)},[It]),Ee=Re(R=>{et(R.entry.absolutePath)},[et]),En=Re(R=>R instanceof Element?R.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:un,popupItem:We,handleClosePopup:mn}=ia({ref:V,resolveItem:En,onSelect:It}),ut=Re(R=>{if(!e.openEmailsWithGmail)return;let S=R.trim();if(!S||S==="-"||typeof window>"u")return;let P=nt(S,!0);P&&window.open(P,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),He=We?_.get(We):null,Ke=un&&He!==null&&He!==void 0;Ot(()=>{un&&!He&&mn()},[un,He,mn]);let pn=Ue(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:$l}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Ft=Ue(()=>Ql(pn,ct,Ke),[pn,ct,Ke]);Ot(()=>{let R=!1;return typeof window>"u"?()=>{R=!0}:ha?(v(ha),()=>{R=!0}):((async()=>{try{let[P,ie,Te,tt]=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(R)return;let vt=P.default,xa=ie.default,pr=Te.default,gr=tt.default;vt&&xa&&pr&&gr&&(ha={company:vt,department:xa,title:pr,person:gr},v(ha))}catch(P){Qe.warn("Failed to load lucide icons",P)}})(),()=>{R=!0})},[]);let $t=Ue(()=>{if(!h)return;let R=tt=>vt=>z(tt,{"aria-hidden":"true",className:`${tr} ${nr(vt)}`}),S={company:R(h.company),department:R(h.department),title:R(h.title)},P=R(h.person),ie=tt=>tt in S,Te=tt=>{let[vt]=tt.entry.relativePath.split(":",1);return(ie(vt)?S[vt]:S.company)(tt)};return{directory:Te,directoryExpanded:Te,file:P}},[h]),gn=Re(()=>{Se(R=>R.size===0?R:new Set)},[]),mt=Re(()=>{re.length>0&&dt(re)},[re,dt]);Ot(()=>{if(typeof window>"u")return;let R=document.documentElement,S=window.matchMedia("(prefers-color-scheme: dark)"),P=()=>K(R.classList.contains("dark")||S.matches);P(),S.addEventListener("change",P);let ie=new MutationObserver(P);return ie.observe(R,{attributes:!0,attributeFilter:["class"]}),()=>{S.removeEventListener("change",P),ie.disconnect()}},[]);let zt=Po(ue,Ae,A);Ot(()=>{let R=Po(ue,Ae,A);if(R===null){ue!==null&&Dt(null),Ae!==null&&Ze(null);return}R!==Ae&&Ze(R)},[ue,Ae,A]);let Bt=zt===null?null:_.get(zt)??null,Pn=xt?"#475569":"#94A3B8",Ut=e.isStreamingComplete,Ln=e.isStreamingFailed,je=Ut&&n.length===0,Vt=(I||!f)&&!je,ba=yo(U,250),Rn=f!==null||je,On=ke("div",{className:"flex flex-wrap items-center gap-1.5",children:[ke("span",{className:`inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono ${y} text-slate-700 dark:bg-slate-800 dark:text-slate-200`,title:l.treeNodeCountTitle,children:[z("span",{children:"\u{1F333}"})," ",l.treeNodeCountLabel," ",Rn?l.treeNodeCount(ba):"\u2026"]}),Ln&&!Ut?ke("span",{className:`inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium ${y} text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300`,title:l.treeStreamInterruptedTitle,children:[z("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),z("span",{children:"\u26D4"})," ",l.treeStreamInterrupted]}):Ut?Vt?ke("span",{className:`inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium ${y} text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300`,title:l.treeBuildingTitle,children:[ke("span",{className:"relative flex h-1.5 w-1.5",children:[z("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),z("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),z("span",{children:"\u{1F33F}"})," ",l.treeBuilding]}):ke("span",{className:`inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium ${y} text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300`,title:l.treeCompleteTitle,children:[z("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),z("span",{children:"\u2705"})," ",l.treeComplete]}):ke("span",{className:`inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium ${y} text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300`,title:l.treeStreamLoadingTitle,children:[ke("span",{className:"relative flex h-1.5 w-1.5",children:[z("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),z("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),z("span",{children:"\u23F3"})," ",l.treeStreamLoading]}),o&&ke("button",{type:"button",onClick:()=>C(!k),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${k?"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:l.treeShowEntireCompanyTitle,children:[z("span",{children:"\u{1F3E2}"})," ",l.treeShowEntireCompany]}),re.length>0?ke("div",{className:"flex items-center gap-1",children:[z("button",{type:"button",onClick:gn,className:"inline-flex h-11 w-11 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":l.treeExpandAll,title:l.treeExpandAllTitle,children:z(Bl,{className:"h-4 w-4"})}),z("button",{type:"button",onClick:mt,className:"inline-flex h-11 w-11 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":l.treeCollapseAll,title:l.treeCollapseAllTitle,children:z(zl,{className:"h-4 w-4"})})]}):null]}),hn=ga(null),{isTwoColumn:_n}=la(hn,ar,{mediaQuery:"(min-width: 768px)"});De&&(_n||Bt===null)&&Me(!1);let An=Ue(()=>({toggle:_t,isExpanded:yt,expandMultiple:At,collapseMultiple:dt,isPending:r}),[dt,At,yt,_t,r]),Dn=Ue(()=>({onEntryClick:Ee,selectedPath:zt}),[Ee,zt]),mr=Ue(()=>({className:ql,lineColor:Pn,iconOverrides:$t,showDirectoryIcons:!!$t,showFileIcons:!!$t,highlightStyles:Yl,entryClassName:"rounded-md",nameClassName:"tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[Pn,$t]),ya=z("div",{ref:se,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:z("div",{ref:V,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:J.length>0?z(Hl,{entries:J,expansion:An,selection:Dn,visual:mr,virtualScroll:Ft,locale:d,labels:u}):z("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:o?l.treeNoMatches:l.treeEmpty})})});return ke("div",{ref:hn,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Ht,children:[t&&Ul(On,t),_n?ke(Il,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[z(To,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:Vl,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ya}),z(Fl,{id:"contact-map-tree-handle",thickness:jl,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":l.treeResizeHandle}),z(To,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:Kl,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:z(en,{placement:"pane",contact:Bt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):ke(ed,{children:[ya,Bt?z(ca,{isOpen:De,onClose:Wt,title:l.detailHeading,children:z(en,{placement:"overlay",contact:Bt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}):null]}),Ke&&He&&z(Vn,{contactData:He,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:ut,onRequestClose:mn})]})};import{jsx as Mn,jsxs as rn}from"react/jsx-runtime";var rd={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},od=e=>e==="tree"?"tree":"list",_o=({context:e})=>{let t=Y(),[n,a]=ad(),[s,o]=nd(null),r=od(n.get(nn)),{setScrollableRef:c,onPointerDown:d,onPointerMove:l,onPointerUp:u,onPointerLeave:m,onPointerCancel:i,onClickCapture:p}=ht(),h=td(v=>{let k=v==="tree"?"tree":"list";if(k===r)return;let C=new URLSearchParams(typeof window<"u"?window.location.search:"");k==="list"?C.delete(nn):C.set(nn,k),a(C,{replace:!0})},[r,a]);return rn("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[rn("div",{className:"mt-1 mb-1.5 flex shrink-0 flex-wrap items-center gap-2",children:[rn("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:rd,onPointerDown:d,onPointerMove:l,onPointerUp:u,onPointerLeave:m,onPointerCancel:i,onClickCapture:p,children:[rn("button",{type:"button","data-testid":"contact-map-tab-list","aria-pressed":r==="list",onClick:()=>h("list"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-2 ${E} transition-colors ${r==="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]}),rn("button",{type:"button","data-testid":"contact-map-tab-tree","aria-pressed":r==="tree",onClick:()=>h("tree"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-2 ${E} transition-colors ${r==="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]})]}),Mn("div",{ref:o,className:"flex flex-wrap items-center gap-1.5"})]}),rn("div",{className:"flex h-full flex-1 flex-col",children:[Mn("div",{className:`${r==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="list"?Mn(bo,{context:e}):null}),Mn("div",{className:`${r==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:r==="tree"?Mn(Oo,{context:e,controlsContainer:s}):null})]})]})};import{memo as ld}from"react";le();ge();le();ge();import{DEFAULT_FUZZY_SEARCH_OPTIONS as B}from"@aiquants/fuzzy-search";import{memo as sd,useId as Ne}from"react";import{jsx as O,jsxs as H}from"react/jsx-runtime";var rr=1e3,or=sd(({searchOptions:e,setSearchOptions:t})=>{let n=Y(),a="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",o=e.sortBy==="relevance",r=Ne(),c=Ne(),d=Ne(),l=Ne(),u=Ne(),m=Ne(),i=Ne(),p=Ne(),h=Ne(),v=Ne(),k=Ne(),C=[];C.push(H("div",{className:`${a} border-green-200 border-l-4 dark:border-green-400/60`,children:[H("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:r,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexNgramSize}),O("input",{id:r,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||B.ngramSize,onChange:f=>t(g=>({...g,ngramSize:parseInt(f.target.value,10)})),className:"h-11 w-full"}),H("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.ngramSize||B.ngramSize]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexNgramSizeHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:c,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexMinNgramOverlap}),O("input",{id:c,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||B.minNgramOverlap,onChange:f=>t(g=>({...g,minNgramOverlap:parseInt(f.target.value,10)})),className:"h-11 w-full"}),H("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.minNgramOverlap||B.minNgramOverlap]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexMinNgramOverlapHint})]})]},"index-build")),C.push(H("div",{className:`${a} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[H("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.indexCandidateHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:d,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexThreshold}),O("input",{id:d,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??B.indexWorkerOptions?.threshold,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??B.indexWorkerOptions?.threshold]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexThresholdHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:u,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexNgramOverlapThreshold}),O("input",{id:u,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??B.indexWorkerOptions?.ngramOverlapThreshold,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??B.indexWorkerOptions?.ngramOverlapThreshold]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),C.push(H("div",{className:`${a} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[H("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:l,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexStrategy}),H("select",{id:l,value:e.indexWorkerOptions?.strategy??B.indexWorkerOptions?.strategy??"hybrid",onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:f.target.value}})),className:`min-h-11 rounded border border-gray-300 px-2 pointer-coarse:text-base ${E} transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100`,children:[O("option",{value:"fast",children:n.indexStrategyFast}),O("option",{value:"accurate",children:n.indexStrategyAccurate}),O("option",{value:"hybrid",children:n.indexStrategyHybrid})]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexStrategyHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:m,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexMinCandidatesRatio}),O("input",{id:m,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??B.indexWorkerOptions?.minCandidatesRatio,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??B.indexWorkerOptions?.minCandidatesRatio]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexMinCandidatesRatioHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:i,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexMaxCandidatesRatio}),O("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??B.indexWorkerOptions?.maxCandidatesRatio,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??B.indexWorkerOptions?.maxCandidatesRatio]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),C.push(H("div",{className:`${a} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[H("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",n.scoreTuningHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:p,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexJaroWinklerPrefix}),O("input",{id:p,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??B.indexWorkerOptions?.jaroWinklerPrefix,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??B.indexWorkerOptions?.jaroWinklerPrefix]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexJaroWinklerPrefixHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:h,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.maxResults}),H("label",{className:`flex min-h-11 items-center gap-2 ${E} text-gray-600 dark:text-slate-300`,children:[O("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:f.target.checked?void 0:rr}}))}),n.noLimit]}),O("input",{id:h,type:"range",min:rr,max:"10000",step:"1000",disabled:e.indexWorkerOptions?.maxResults===void 0,value:e.indexWorkerOptions?.maxResults===void 0?rr:e.indexWorkerOptions.maxResults,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(f.target.value,10)}})),className:"h-11 w-full disabled:cursor-not-allowed"}),H("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexMaxResultsHint})]})]},"jaro")),C.push(H("div",{className:`${a} border-emerald-200 border-l-4 ${o?"":"opacity-50"} dark:border-emerald-400/60`,children:[H("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:v,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.fieldWeight}),O("input",{id:v,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??B.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(f.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),H("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??B.indexWorkerOptions?.relevanceFieldWeight??.2]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexFieldWeightHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:k,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexPerfectMatchBonus}),O("input",{id:k,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??B.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(f.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),H("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??B.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexPerfectMatchBonusHint})]}),!o&&O("p",{className:`${y} text-emerald-600 dark:text-emerald-300`,children:n.relevanceOnlyNotice})]},"relevance"));let F=Ne(),I=Ne();return C.push(H("div",{className:`${a} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[H("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",n.indexContainmentHeading]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:F,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexContainmentBase}),O("input",{id:F,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??B.indexWorkerOptions?.containmentScoreBase??.7,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??B.indexWorkerOptions?.containmentScoreBase??.7]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexContainmentBaseHint})]}),H("div",{className:"space-y-2",children:[O("label",{htmlFor:I,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.indexContainmentCoverage}),O("input",{id:I,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??B.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:f=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(f.target.value)}})),className:"h-11 w-full"}),H("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??B.indexWorkerOptions?.containmentCoverageWeight??.3]}),O("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.indexContainmentCoverageHint})]})]},"containment")),H("section",{className:"space-y-3",children:[H("div",{className:"flex items-center justify-between gap-3",children:[H("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[O("span",{children:"\u{1F4CA}"}),O("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),O("button",{type:"button",onClick:()=>t(f=>({...f,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:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border border-green-300 bg-green-100 px-2 font-medium text-green-700 ${E} 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})]}),O("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:C})]})});or.displayName="IndexWorkerSettings";le();ge();import{DEFAULT_FUZZY_SEARCH_OPTIONS as be}from"@aiquants/fuzzy-search";import{memo as id,useId as on}from"react";import{jsx as ae,jsxs as oe}from"react/jsx-runtime";var sr=1e3,ir=id(({searchOptions:e,setSearchOptions:t})=>{let n=Y(),a="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",o=e.sortBy==="relevance",r=on(),c=on(),d=on(),l=on(),u=on(),m=on(),i=[];return i.push(oe("div",{className:`${a} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[oe("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:r,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.levenshteinThreshold}),ae("input",{id:r,type:"range",min:"0.0",max:o?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??be.levenshteinWorkerOptions?.threshold,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,threshold:parseFloat(p.target.value)}})),className:"h-11 w-full"}),oe("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??be.levenshteinWorkerOptions?.threshold]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:o?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:c,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.levenshteinLengthSimilarity}),ae("input",{id:c,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??be.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(p.target.value)}})),className:"h-11 w-full"}),oe("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??be.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push(oe("div",{className:`${a} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[oe("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",n.scoreTuningHeading]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:d,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.levenshteinLengthPenalty}),ae("input",{id:d,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??be.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(p.target.value)}})),className:"h-11 w-full"}),oe("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??be.levenshteinWorkerOptions?.lengthDiffPenalty]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push(oe("div",{className:`${a} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[oe("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),ae("label",{htmlFor:l,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.maxResults}),oe("label",{className:`flex min-h-11 items-center gap-2 ${E} text-gray-600 dark:text-slate-300`,children:[ae("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:p.target.checked?void 0:sr}}))}),n.noLimit]}),ae("input",{id:l,type:"range",min:sr,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?sr:e.levenshteinWorkerOptions.maxResults,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,maxResults:parseInt(p.target.value,10)}})),className:"h-11 w-full disabled:cursor-not-allowed"}),oe("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinMaxResultsHint})]},"max-results")),i.push(oe("div",{className:`${a} border-rose-200 border-l-4 ${o?"":"opacity-50"} dark:border-rose-400/60`,children:[oe("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:u,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.fieldWeight}),ae("input",{id:u,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??be.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(p.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),oe("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??be.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinFieldWeightHint})]}),oe("div",{className:"space-y-2",children:[ae("label",{htmlFor:m,className:`font-medium ${y} text-gray-600 transition-colors dark:text-slate-300`,children:n.levenshteinPartialBonus}),ae("input",{id:m,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??be.levenshteinWorkerOptions?.partialMatchBonus,onChange:p=>t(h=>({...h,levenshteinWorkerOptions:{...h.levenshteinWorkerOptions,partialMatchBonus:parseFloat(p.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),oe("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??be.levenshteinWorkerOptions?.partialMatchBonus]}),ae("p",{className:`${y} text-gray-500 transition-colors dark:text-slate-400`,children:n.levenshteinPartialBonusHint})]}),!o&&ae("p",{className:`${y} text-rose-600 dark:text-rose-300`,children:n.relevanceOnlyNotice})]},"relevance")),oe("section",{className:"space-y-3",children:[oe("div",{className:"flex items-center justify-between gap-3",children:[oe("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[ae("span",{children:"\u{1F4CF}"}),ae("span",{className:"tracking-wide",children:n.levenshteinSettingsHeading})]}),ae("button",{type:"button",onClick:()=>t(p=>({...p,levenshteinWorkerOptions:{threshold:be.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:be.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:be.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:be.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:be.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border border-purple-300 bg-purple-100 px-2 font-medium text-purple-700 ${E} 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})]}),ae("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});ir.displayName="LevenshteinWorkerSettings";import{jsx as Je,jsxs as Xe}from"react/jsx-runtime";var dd={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},lr=ld(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:a,openEmailsWithGmail:s,setOpenEmailsWithGmail:o,activeTab:r,onTabChange:c})=>{let d=Y(),{setScrollableRef:l,onPointerDown:u,onPointerMove:m,onPointerUp:i,onPointerLeave:p,onPointerCancel:h,onClickCapture:v}=ht();return Xe("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:[Xe("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:[Xe("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",d.searchSettings]}),Je("div",{className:"flex flex-wrap gap-1.5",children:Xe("button",{type:"button",onClick:()=>t(k=>ra(k.workerUrls)),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded bg-red-500 px-1.5 ${E} text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700`,title:d.settingsResetAllTitle,children:["\u{1F504} ",d.settingsResetAll]})})]}),Je("div",{className:"mb-0 shrink-0",children:Xe("div",{ref:l,role:"tablist","aria-label":d.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:dd,onPointerDown:u,onPointerMove:m,onPointerUp:i,onPointerLeave:p,onPointerCancel:h,onClickCapture:v,children:[Xe("button",{type:"button",role:"tab","aria-selected":r==="basic",onClick:()=>c("basic"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${r==="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} ",d.settingsBasicTab]}),Xe("button",{type:"button",role:"tab","aria-selected":r==="advanced",onClick:()=>c("advanced"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${r==="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 ",d.settingsAdvancedTab]}),Xe("button",{type:"button",role:"tab","aria-selected":r==="index",onClick:()=>c("index"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${r==="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} ",d.indexWorkerName]}),Xe("button",{type:"button",role:"tab","aria-selected":r==="levenshtein",onClick:()=>c("levenshtein"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${r==="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} ",d.levenshteinWorkerName]})]})}),Xe("div",{className:"flex flex-col gap-1",children:[Je("div",{className:`${r==="basic"?"block":"hidden"}`,children:Je(Ra,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:a,openEmailsWithGmail:s,setOpenEmailsWithGmail:o})}),Je("div",{className:`${r==="advanced"?"block":"hidden"}`,children:Je(La,{searchOptions:e,setSearchOptions:t})}),Je("div",{className:`${r==="index"?"block":"hidden"}`,children:Je(or,{searchOptions:e,setSearchOptions:t})}),Je("div",{className:`${r==="levenshtein"?"block":"hidden"}`,children:Je(ir,{searchOptions:e,setSearchOptions:t})})]})]})});lr.displayName="SearchOptionsPanel";import{memo as md,useCallback as pd}from"react";wt();le();ge();import{memo as cd}from"react";import{jsxs as dr}from"react/jsx-runtime";var L=cd(({label:e,value:t,unit:n,color:a="text-gray-600 dark:text-slate-300"})=>dr("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:[dr("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),dr("span",{className:`font-medium ${a} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));L.displayName="StatItem";wt();le();ge();import{memo as ud}from"react";import{jsx as M,jsxs as j}from"react/jsx-runtime";var sn=ud(({kind:e,icon:t,stats:n,color:a})=>{let{locale:s,labels:o}=ve(),r=A=>G(s,A);if(!n)return M("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:o.statsNoData});let c=n.basic||{},d=n.workerSpecific||{},l=n.analysis||{},u=c.totalSearches??0,m=c.totalProcessingTime??0,i=c.averageSearchTime??0,p=c.lastSearchTime??0,h=c.errorCount??0,v=c.timestamp,k=l.fieldPerformance||{},C=l.performanceInsights||{},F=l.recentHistory||[],I=d.specificMetrics||{},f=d.operationCount??0,g=d.operationDistribution||{},x=e==="index",w=e==="levenshtein",D=x?o.indexWorkerName:o.levenshteinWorkerName,b=I,T=I,X="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",W="text-xs font-semibold transition-colors",de=A=>{if(!A)return;let _=new Date(A);return Number.isNaN(_.getTime())?void 0:o.statsTimestamp(_)},J=[];if(J.push(j("div",{className:`${X} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[j("div",{className:`${W} ${a}`,children:["\u{1F4CA} ",o.statsBasicHeading]}),M(L,{label:o.statTotalSearches,value:r(u),color:a}),M(L,{label:o.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:a}),M(L,{label:o.statTotalProcessingTime,value:m.toFixed(2),unit:"ms",color:a}),M(L,{label:o.statLastSearchTime,value:p.toFixed(2),unit:"ms",color:a}),M(L,{label:o.statErrorCount,value:h,color:h>0?"text-red-600 dark:text-red-400":a}),de(v)&&M(L,{label:o.statUpdatedAt,value:de(v),color:"text-gray-500 dark:text-slate-400"})]},"basic")),f>0||Object.keys(g).length>0){let A=Object.entries(g).sort(([,_],[,U])=>(Number(U)||0)-(Number(_)||0)).slice(0,6);J.push(j("div",{className:`${X} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[j("div",{className:`${W} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",o.statsOperationsHeading]}),M(L,{label:o.statTotalOperations,value:r(f),color:"text-amber-700 dark:text-amber-300"}),A.length>0&&M("div",{className:"mt-1 space-y-1",children:A.map(([_,U])=>M(L,{label:_,value:r(Number(U)),unit:o.timesUnit(r(Number(U))),color:"text-amber-700 dark:text-amber-300"},_))})]},"operations"))}if(x&&(J.push(j("div",{className:`${X} border-green-200 border-l-4 dark:border-green-400/60`,children:[j("div",{className:`${W} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",o.statsIndexHeading]}),M(L,{label:o.statIndexBuilds,value:r(b.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),M(L,{label:o.statDataSize,value:r(b.currentDataSize??0),unit:o.itemsUnit(r(b.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),M(L,{label:o.statLastBuildTime,value:(b.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),b.cacheSize&&J.push(j("div",{className:`${X} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[j("div",{className:`${W} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",o.statsCacheHeading]}),M(L,{label:o.statCacheNgram,value:r(b.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),M(L,{label:o.statCacheWord,value:r(b.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),M(L,{label:o.statCachePhonetic,value:r(b.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),b.indexMetadata)){let A=Object.entries(b.indexMetadata).slice(0,6);A.length>0&&J.push(j("div",{className:`${X} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[j("div",{className:`${W} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",o.statsIndexMetadataHeading]}),A.map(([_,U])=>{let re;if(typeof U=="number"){let ce=_.toLowerCase();ce.includes("time")&&!ce.includes("timestamp")?re=`${U.toFixed(2)}ms`:ce.includes("timestamp")||ce.includes("at")?re=de(U)??U.toString():re=r(U)}else re=String(U);return M(L,{label:_,value:re,color:"text-teal-700 dark:text-teal-300"},_)})]},"index-meta"))}if(w){if(J.push(j("div",{className:`${X} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[j("div",{className:`${W} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",o.statsCalculationsHeading]}),M(L,{label:o.statTotalCalculations,value:r(T.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statDistanceCalculations,value:r(T.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statAverageDistance,value:typeof T.averageDistance=="number"?T.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statMinDistance,value:T.minDistance??o.notAvailable,color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statMaxDistance,value:T.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),J.push(j("div",{className:`${X} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[j("div",{className:`${W} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",o.statsMatchesHeading]}),M(L,{label:o.statPartialMatches,value:r(T.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),M(L,{label:o.statPerfectMatches,value:r(T.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),M(L,{label:o.statEarlyTerminations,value:r(T.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),T.similarityThresholds&&J.push(j("div",{className:`${X} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[j("div",{className:`${W} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",o.statsSimilarityHeading]}),M(L,{label:o.statAbove80,value:r(T.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),M(L,{label:o.statAbove60,value:r(T.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),M(L,{label:o.statAbove40,value:r(T.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),M(L,{label:o.statBelow40,value:r(T.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),T.distanceDistribution){let A=Object.entries(T.distanceDistribution).sort(([,_],[,U])=>Number(U)-Number(_)).slice(0,6);A.length>0&&J.push(j("div",{className:`${X} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[j("div",{className:`${W} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",o.statsDistanceHeading]}),A.map(([_,U])=>M(L,{label:o.statDistance(_),value:r(Number(U)),unit:o.timesUnit(r(Number(U))),color:"text-indigo-700 dark:text-indigo-300"},_))]},"lev-distance"))}if(T.queryLengthStats){let A=Object.entries(T.queryLengthStats).sort(([,_],[,U])=>(U.count??0)-(_.count??0)).slice(0,6);A.length>0&&J.push(j("div",{className:`${X} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[j("div",{className:`${W} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",o.statsQueryLengthHeading]}),A.map(([_,U])=>{let re=Number(U.count??0),ce=Number(U.averageScore??0);return M(L,{label:o.statQueryLength(_),value:o.statQueryLengthValue({count:re,averagePercent:(ce*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},_)})]},"lev-query-length"))}}if(Object.keys(k).length>0){let A=Object.entries(k).sort(([,_],[,U])=>(U.averageScore??0)-(_.averageScore??0)).slice(0,6);J.push(j("div",{className:`${X} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[j("div",{className:`${W} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",o.statsFieldPerformanceHeading]}),A.map(([_,U])=>{let re=U;return j("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[M("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:_}),M(L,{label:o.statAverageScore,value:`${((re.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statMatchCount,value:r(re.matchCount??0),unit:o.itemsUnit(r(re.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),M(L,{label:o.statBestWorstScore,value:`${((re.bestScore??0)*100).toFixed(1)}% / ${((re.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},_)})]},"field-performance"))}if(C.bestPerformingField||C.totalHistoryEntries||C.similarityDistribution){let A=(C.recentAverageResultCount??0).toFixed(1);J.push(j("div",{className:`${X} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[j("div",{className:`${W} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",o.statsInsightsHeading]}),C.bestPerformingField&&M(L,{label:o.statBestField,value:C.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statRecentAverageTime,value:(C.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statRecentAverageResults,value:A,unit:o.itemsUnit(A),color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statThroughput,value:(C.throughputPerSecond??0).toFixed(2),unit:o.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statCommonQueryLength,value:r(C.mostCommonQueryLength??0),unit:o.charactersUnit(r(C.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),M(L,{label:o.statHistoryEntries,value:r(C.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),C.similarityDistribution&&j("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[M(L,{label:o.statHighSimilarity,value:r(C.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),M(L,{label:o.statMediumSimilarity,value:r(C.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),M(L,{label:o.statLowSimilarity,value:r(C.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),M(L,{label:o.statVeryLowSimilarity,value:r(C.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return F.length>0&&J.push(j("div",{className:`${X} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[j("div",{className:`${W} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",o.statsRecentHistoryHeading]}),F.slice(-3).reverse().map((A,_)=>j("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[M("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:A.operationType}),M("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:o.statsHistoryEntry({processingTimeMs:A.processingTime.toFixed(2),resultCount:A.resultCount??0})}),de(A.timestamp)&&M("div",{className:`${y} text-sky-500 transition-colors dark:text-sky-200`,children:de(A.timestamp)})]},`${A.operationType}-${A.timestamp??_}`))]},"recent-history")),j("section",{className:"space-y-2",children:[j("div",{className:`flex items-center gap-2 font-semibold text-xs ${a}`,children:[M("span",{children:t}),M("span",{className:"tracking-wide",children:D})]}),M("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:J})]})});sn.displayName="WorkerStatsSection";import{jsx as _e,jsxs as Oe}from"react/jsx-runtime";var gd={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},cr=md(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:a,resetStats:s,rebuildIndex:o,isIndexBuilding:r,activeTab:c,onTabChange:d})=>{let{locale:l,labels:u}=ve(),m=t.trim(),i=m?a:n,{setScrollableRef:p,onPointerDown:h,onPointerMove:v,onPointerUp:k,onPointerLeave:C,onPointerCancel:F,onClickCapture:I}=ht(),f=c!=="index"||r,g=r?u.statsRebuildingTitle:c!=="index"?u.statsRebuildIndexTabOnlyTitle:u.statsRebuildTitle,x=f?"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",w=r?`\u23F3 ${u.statsRebuilding}`:`\u{1F3D7}\uFE0F ${u.statsRebuild}`,D=pd(()=>{o().catch(()=>{})},[o]);return Oe("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:[Oe("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:[Oe("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",u.searchStatistics]}),Oe("div",{className:"flex flex-wrap gap-1.5",children:[_e("button",{type:"button",onClick:D,disabled:f,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} transition-colors ${x}`,title:g,children:w}),Oe("button",{type:"button",onClick:s,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded bg-red-500 px-1.5 ${E} text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700`,title:u.statsResetTitle,children:["\u{1F504} ",u.reset]})]})]}),_e("div",{className:"mb-0 shrink-0",children:Oe("div",{ref:p,role:"tablist","aria-label":u.statsTabsLabel,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:gd,onPointerDown:h,onPointerMove:v,onPointerUp:k,onPointerLeave:C,onPointerCancel:F,onClickCapture:I,children:[Oe("button",{type:"button",role:"tab","aria-selected":c==="overview",onClick:()=>d("overview"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} 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} ",u.statsOverviewTab]}),Oe("button",{type:"button",role:"tab","aria-selected":c==="index",onClick:()=>d("index"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} 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} ",u.statsIndexTab]}),Oe("button",{type:"button",role:"tab","aria-selected":c==="levenshtein",onClick:()=>d("levenshtein"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${E} 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} ",u.statsLevenshteinTab]})]})}),Oe("div",{className:"flex flex-col gap-1 pb-0.5",children:[Oe("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:[_e(L,{label:u.statTotalSearches,value:G(l,e.totalSearches)}),_e(L,{label:u.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),_e(L,{label:u.statDataCount,value:G(l,e.itemCount)}),_e(L,{label:m?u.statResultCount:u.statDisplayedCount,value:G(l,i)})]}),_e("div",{className:`${c==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:_e(sn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),_e("div",{className:`${c==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:_e(sn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),Oe("div",{className:"hidden",children:[_e(sn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),_e(sn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});cr.displayName="StatisticsPanel";import{Fragment as Io,jsx as te,jsxs as ye}from"react/jsx-runtime";var kd=/[\u200B\uFEFF]/g,ur=typeof window<"u",$o=ur&&typeof document<"u",fa=(e,t=[],n=!1)=>{let a=Fo(e);a.current=e,lt(()=>{if(!(!ur||n&&!$o))return a.current()},[n,...t])},Ao=(e,t,n)=>{let[a,s]=Ve(()=>{let o=Do(r=>r.getItem(e));return o&&t.includes(o)?o:n});return fa(()=>{Do(o=>{o.setItem(e,a)})},[e,a]),[a,s]},Do=e=>{if(!ur)return null;try{return e(window.sessionStorage)}catch{return null}},Wo=(e,t)=>{let[n,a]=Ve(e);return lt(()=>{let s=setTimeout(()=>{a(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},Sd="contact-map.settings-tab",Td="contact-map.statistics-tab",wd=["basic","advanced","index","levenshtein"],Nd=["overview","index","levenshtein"],Ho=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Md={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},zo=({streamState:e,...t}={})=>e===void 0?te(Ed,{...t}):te(Bo,{...t,streamState:e}),Ed=e=>{let{context:t}=aa();return te(Bo,{...e,streamState:t})},Pd={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},Bo=e=>{let{streamState:t,onFooterVisibilityChange:n,children:a}=e,s=xe(e,"workerUrls"),o=st(),{locale:r,labels:c}=ve(),{contactMapRecords:d,contactMapRecordMap:l,isStreamingComplete:u,isStreamingFailed:m}=t,i=vd(),[p]=Cd(),h=Fo(null),[v,k]=Ve(!0),[C,F]=Ve(o.openEmailsWithGmail??!1),{indexWorker:I,levenshteinWorker:f}=tn(o.workerUrls,s,Pd),[g,x]=Ve(()=>ra({indexWorker:I,levenshteinWorker:f})),[w,D]=Ve(p.get("q")||""),b=Wo(w,g.debounceMs??hd.debounceMs);lt(()=>{let S=p.get("q")||"";D(P=>P!==S?S:P)},[p]),lt(()=>{if(typeof window>"u")return;let S=new URL(window.location.href);(S.searchParams.get("q")||"")!==b&&(b?S.searchParams.set("q",b):S.searchParams.delete("q"),window.history.replaceState(window.history.state,"",S.toString()))},[b]);let[T,X]=xd(),[W,de]=Ve("search"),[J,A]=Ao(Sd,wd,"basic"),[_,U]=Ao(Td,Nd,"overview"),{setScrollableRef:re,onPointerDown:ce,onPointerMove:Se,onPointerUp:yt,onPointerLeave:_t,onPointerCancel:dt,onClickCapture:At}=ht(),ue=ln(()=>{if(!$o)return;let S=h.current;!S||document.activeElement===S||window.requestAnimationFrame(()=>{try{S.focus({preventScroll:!0})}catch{}})},[]),Dt=ln(S=>{let P=S;de(P),P==="search"&&ue()},[ue]),Ae=bt(()=>({...g,debounceMs:0}),[g]),[Ze,De]=Ve("union"),Me=Ze==="intersection",Wt=Me?c.operatorAndTitle:c.operatorOrTitle,xt=ln(S=>fd(S,Ze),[Ze]),K=bt(()=>({querySetsOf:xt}),[xt]),se=Wo(d,u?0:800),{searchTerm:V,setSearchTerm:ct,filteredItems:Ht,resultTerm:It,isSearching:et,isIndexBuilding:Ee,clearSearch:En,resetStats:un,performanceMetrics:We,rebuildIndex:mn,error:ut}=bd(se,Ho,Ae,K),He=V.trim().length>0,[Ke,pn]=Ve(""),[Ft,$t]=Ve(()=>V),gn=bt(()=>jn(w),[w]),mt=bt(()=>jn(b),[b]);lt(()=>{b===Ke&&mt===V||X(()=>{pn(b),ct(mt)})},[b,Ke,mt,V,ct]);let zt=ln(S=>{let ie=S.target.value.replace(kd,"");D(ie)},[]),Bt=ln(()=>{D(""),pn(""),En(),ue()},[En,ue]),Pn=ln(()=>{De(S=>S==="intersection"?"union":"intersection"),ue()},[ue]);fa(()=>{if(!(W==="search"&&i.state==="idle"&&!T))return;let P=document.activeElement;if(!!!(P?.matches('[role="tab"]')||P?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&P&&P!==document.body&&P!==h.current)return;let Te=window.requestAnimationFrame(()=>{ue()});return()=>{window.cancelAnimationFrame(Te)}},[W,i.state,T,ue],!0),fa(()=>{if(W!=="search")return;let S=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ue()}],[window,"pageshow",()=>{ue()}]];for(let[P,ie,Te]of S)P.addEventListener(ie,Te);return()=>{for(let[P,ie,Te]of S)P.removeEventListener(ie,Te)}},[W,ue],!0),lt(()=>(n&&n(W==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[W,n]),fa(()=>{let S=document.body,P=S.style.overflow;return W==="search"&&(S.style.overflow="hidden"),()=>{S.style.overflow=P}},[W],!0),lt(()=>{We&&Qe.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:We.totalSearches,averageSearchTime:We.averageSearchTime,itemCount:We.itemCount,resultsCount:We.resultsCount,workersAvailable:!!We.workerStats})},[We]);let{isAwaitingDebounce:Ut,isAwaitingSearchTermSync:Ln,isSearchInProgress:je}=bt(()=>{let S=gn!==mt,P=mt!==V,ie=V.trim().length>0||gn.trim().length>0;return{isAwaitingDebounce:S,isAwaitingSearchTermSync:P,isSearchInProgress:T||et||It!==V&&ut===null||ie&&Ee||S||P||Ft!==V}},[gn,mt,V,It,ut,T,et,Ee,Ft]),[Vt,ba]=Ve(V);lt(()=>{Vt!==V&&ba(V)},[V,Vt]),lt(()=>{Ut||Ln||T||et||Ee||Vt===V&&Ft!==V&&$t(V)},[V,Ft,Ut,Ln,T,et,Ee,Vt]);let Rn=bt(()=>Dr(Ke,Ho),[Ke]),On=bt(()=>Rn(Ht),[Rn,Ht]),hn=bt(()=>({contactMapRecords:d,contactMapRecordMap:l,filteredItems:On,searchQuery:Ke,searchTerm:V,isSearching:et,isIndexBuilding:Ee,isPending:T,hasSearchTerm:He,enableHighlighting:v,openEmailsWithGmail:C,isSearchInProgress:je,isSearchTabActive:W==="search",errorMessage:ut??null,isStreamingComplete:u,isStreamingFailed:m}),[d,l,On,Ke,V,et,Ee,T,He,v,C,je,W,ut,u,m]),_n=He?Ht.length:d.length,An=G(r,d.length),Dn=G(r,Ht.length);return te("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${W==="search"?" h-full min-h-0":""}`,children:ye(Xn,{value:W,onValueChange:Dt,className:`flex flex-col${W==="search"?" h-full min-h-0":""}`,children:[ye(kn,{ref:re,style:Md,className:"scrollbar-none mt-0 mb-1 flex h-auto 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:ce,onPointerMove:Se,onPointerUp:yt,onPointerLeave:_t,onPointerCancel:dt,onClickCapture:At,children:[ye(Mt,{value:"search",className:`min-h-11 min-w-16 px-2 py-0 ${E} transition-colors sm:min-w-24 sm:px-2.5 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100`,children:["\u{1F50D} ",c.searchTab]}),ye(Mt,{value:"settings",className:`min-h-11 min-w-16 px-2 py-0 ${E} transition-colors sm:min-w-24 sm:px-2.5 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100`,children:["\u2699\uFE0F ",c.searchSettings]}),ye(Mt,{value:"statistics",className:`min-h-11 min-w-16 px-2 py-0 ${E} transition-colors sm:min-w-24 sm:px-2.5 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100`,children:["\u{1F4CA} ",c.searchStatistics]})]}),te(Et,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:ye("div",{className:"flex h-full flex-col",children:[te("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:ye("div",{className:"flex flex-col",children:[te("div",{className:"relative",children:ye("div",{className:"flex items-center gap-1 p-1",children:[ye("button",{type:"button",onClick:Pn,"aria-pressed":Me,title:Wt,className:`inline-flex min-h-11 min-w-11 items-center justify-center gap-0.5 rounded border px-1.5 font-semibold ${E} transition-colors sm:min-w-12 sm:px-2 ${Me?"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:[te("span",{children:Me?c.operatorAnd:c.operatorOr}),te("span",{className:`hidden ${y} sm:inline`,children:Me?c.operatorAndHint:c.operatorOrHint})]}),te("input",{ref:h,type:"text",value:w,onChange:zt,placeholder:c.searchPlaceholder,className:`min-h-11 flex-1 rounded border border-gray-300 border-solid px-2 pointer-coarse:text-base ${E} shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none`}),w&&te("button",{type:"button",onClick:Bt,className:`flex min-h-11 min-w-11 items-center justify-center gap-1 rounded border border-gray-300 px-1.5 ${E} transition-colors hover:text-gray-700 sm:px-2 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100`,title:je?c.searchBusyTitle:c.clearSearch,"aria-label":je?void 0:c.clearSearch,disabled:je,children:je?ye(Io,{children:[te(yd,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),te("span",{className:"hidden sm:inline",children:c.searching})]}):"\u2715"})]})}),ye("p",{className:`px-1.5 py-0.5 ${y} text-slate-700 transition-colors dark:text-slate-200`,children:[c.registeredCountLabel," ",te("span",{className:`font-semibold ${E} text-slate-900 dark:text-white`,children:An})," ",c.recordUnit(An),Ee?ye("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-blue-700 dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",c.rebuildingIndex]}):null,ut?ye("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-rose-700 dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",c.errorLabel,te("span",{className:"ml-1 break-all font-semibold",children:ut})]}):null,He&&ye("span",{className:"ml-1.5 text-blue-600 dark:text-sky-400",children:["| ",c.resultCountLabel,je?te("span",{className:"ml-1 font-semibold",children:c.searching}):ye(Io,{children:[te("span",{className:`ml-1 font-semibold ${E} text-slate-900 dark:text-white`,children:Dn}),te("span",{className:"ml-0.5",children:c.resultUnit(Dn)})]})]})]}),te("div",{className:"h-2.5 px-2 pb-1.5",children:Ee?te(Jr,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),a?a(hn):te(_o,{context:hn})]})}),te(Et,{value:"settings",className:"mt-0",children:te(lr,{searchOptions:g,setSearchOptions:x,enableHighlighting:v,setEnableHighlighting:k,openEmailsWithGmail:C,setOpenEmailsWithGmail:F,activeTab:J,onTabChange:A})}),te(Et,{value:"statistics",className:"mt-0",children:te(cr,{performanceMetrics:We,searchTerm:V,totalDataCount:d.length,resultsCount:_n,resetStats:un,rebuildIndex:mn,isIndexBuilding:Ee,activeTab:_,onTabChange:U})})]})})};import{jsx as cn,jsxs as Vo}from"react/jsx-runtime";var Ld=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let a=Y(),s=t===void 0?a.appTitle:t,{context:o,retryNow:r}=aa(),c=cn(Va,{recordCount:o.contactMapRecords.length,companyCount:o.companyCount,phase:o.streamPhase,loadedCount:o.loadedCount,totalCount:o.totalCount,errorMessage:o.errorMessage,onRetry:r});return Vo("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:s,annotation:c}):Vo("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[cn("h1",{className:"font-bold text-xl",children:s}),c]}),cn("div",{className:"min-h-0 flex-1",children:cn(zo,{streamState:o,onFooterVisibilityChange:n})})]})},Kg=e=>{let t=st(),n=xe(e,"streamEndpoint"),a=xe(e,"workerUrls"),s=xe(e,"locale"),o=xe(e,"labels"),r=Uo(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:tn(t.workerUrls,a,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:o===void 0?t.labels:o}),[t,n,a,s,o]),c=s!==void 0,d=o!==void 0,l=Uo(()=>({locale:c?"ContactMapAppView locale":"locale",labels:d?"ContactMapAppView labels":"labels"}),[c,d]);return cn(ja,{config:r,chromeSurface:l,children:cn(Ld,{...e})})};wt();le();import{createShouldRevalidate as Rd}from"@aiquants/route-revalidation";var Qg=Rd({submissions:"url",query:{ignore:[nn,"q"]}});export{La as AdvancedSearchSettings,Ra as BasicSearchSettings,at as CONTACT_MAP_LABEL_CATALOGS,bn as CONTACT_MAP_LABEL_KEYS,Wr as ContactDetailGrid,en as ContactDetailPanel,Vn as ContactDetailPopup,Kn as ContactDetailRowLayout,Va as ContactMapAnnotation,Kg as ContactMapAppView,Ci as ContactMapConfigProvider,bo as ContactMapSearchListView,zo as ContactMapSearchPage,_o as ContactMapSearchTabGroup,Oo as ContactMapSearchTreeView,ea as ContactMapStreamClient,pe as HighlightedText,or as IndexWorkerSettings,Pm as LIST_COLLAPSE_THRESHOLD,fl as LIST_DETAIL_PANEL_MIN_WIDTH,Lm as LIST_EXPAND_THRESHOLD,hl as LIST_PANEL_MIN_WIDTH,bl as LIST_RESIZE_HANDLE_THICKNESS,ir as LevenshteinWorkerSettings,Jr as Progress,lr as SearchOptionsPanel,L as StatItem,cr as StatisticsPanel,ca as SwipeOverlay,mp as TREE_COLLAPSE_THRESHOLD,Kl as TREE_DETAIL_PANEL_MIN_WIDTH,pp as TREE_EXPAND_THRESHOLD,Vl as TREE_PANEL_MIN_WIDTH,jl as TREE_RESIZE_HANDLE_THICKNESS,Xn as Tabs,Et as TabsContent,kn as TabsList,Mt as TabsTrigger,pa as TreeWorkerSession,sn as WorkerStatsSection,ta as assertContactMapStreamEndpoint,Kr as assertContactMapTreeWorkerUrl,Tu as assertContactMapWorkerUrls,Ql as composeTreeVirtualScrollOptions,Qg as contactMapShouldRevalidate,_i as countContactMapCompanies,wi as deserializeStreamRecord,Ei as getContactMapStreamClient,Dl as getTreeWorkerSession,tn as layerContactMapWorkerUrls,Fu as resetContactMapStreamClientForTesting,Bm as resetTreeWorkerSessionForTesting,wa as resolveContactMapLabels,yo as useAnimatedNumber,st as useContactMapConfig,Y as useContactMapLabels,Oi as useContactMapStream,Xa as useContactPanelSizing,Zr as useDynamicViewportHeight,ht as useHorizontalDragScroll,ia as useLongPressPopup,wl as useReportPopupVisibility,la as useResponsiveTwoColumnLayout,Tl as useRowPopupRegistry,aa as useStreamedContactMapContext,So as useTreeWorker};
|