@aiquants/contact-map 0.20.0 → 0.21.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -4
- package/dist/client.js +2 -2
- package/dist/client.mjs +2 -2
- package/dist/styles/contact-map.standalone.css +1 -1
- package/package.json +5 -4
package/dist/client.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var ri=Object.defineProperty;var ke=(e,t)=>()=>(e&&(t=e(e=0)),t);var ai=(e,t)=>{for(var n in t)ri(e,n,{get:t[n],enumerable:!0})};var Ge,Dt,Na,tn,nn,Mn,ft,Ie,jn,Pr,_r,at,te,Wt=ke(()=>{"use strict";Ge=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},Dt=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,Na=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let n of t){let r=Ge(e[n]);if(r)return{value:r,fieldKey:n}}return{value:null,fieldKey:null}},tn=e=>Na(e,["custom_email","email"]),nn=e=>Na(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),Mn=e=>{let t=Ge(e);if(!t)return null;let n=t.replace(/[^0-9+#*]/g,"");return n.length===0?null:`tel:${n}`},ft=(e,t)=>{let n=Ge(e);return n?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(n)}`:`mailto:${encodeURIComponent(n)}`:null},Ie=(e,t)=>String(e).padStart(t,"0"),jn=e=>`${Ie(e.getUTCFullYear(),4)}-${Ie(e.getUTCMonth()+1,2)}-${Ie(e.getUTCDate(),2)}`,Pr=e=>`${jn(e)} ${Ie(e.getUTCHours(),2)}:${Ie(e.getUTCMinutes(),2)}:${Ie(e.getUTCSeconds(),2)}`,_r=e=>`${Ie(e.getFullYear(),4)}-${Ie(e.getMonth()+1,2)}-${Ie(e.getDate(),2)} ${Ie(e.getHours(),2)}:${Ie(e.getMinutes(),2)}:${Ie(e.getSeconds(),2)}`,at=(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)},te=e=>e==null?"-":typeof e=="string"?Ge(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":String(e)});var ie,ka,Ht=ke(()=>{"use strict";ie=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":ka(e);case"function":return ka(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},ka=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var rn,Re,an=ke(()=>{"use strict";rn=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},Re=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var oi,Gn,$r=ke(()=>{"use strict";oi=(e,t)=>{let n=Array.from({length:t.length+1},(r,i)=>i);for(let r=1;r<=e.length;r+=1){let i=[r];for(let o=1;o<=t.length;o+=1){let a=n[o-1]+(e[r-1]===t[o-1]?0:1);i.push(Math.min(n[o]+1,i[o-1]+1,a))}n=i}return n[t.length]},Gn=(e,t)=>{let n=e.toLowerCase();if(n.length>=3){let i=t.find(o=>o.toLowerCase().startsWith(n));if(i!==void 0)return i}let r;for(let i of t){let o=oi(n,i.toLowerCase());o<=Math.max(1,Math.floor(i.length/4))&&(r===void 0||o<r.distance)&&(r={key:i,distance:o})}return r?.key}});import{DIRECTORY_TREE_LABEL_CATALOGS as Ea,DIRECTORY_TREE_LABEL_KEYS as Or,resolveDirectoryTreeLabels as ii}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as si,VIRTUAL_SCROLL_LABEL_KEYS as li}from"@aiquants/virtualscroll";var ci,ee,It,qn,Ma,wn,gt,di,La,wa,ui,Ar,mi,pi,fi,Dr,Wr,Hr,Ft=ke(()=>{"use strict";Wt();Ht();an();$r();ci=Object.freeze({en:"en-US",ja:"ja-JP"}),ee=(e,t)=>t.toLocaleString(ci[e]),It=(e,t,n)=>e==="1"?t:n,qn=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`Streaming (${ee("en",e)} / ${ee("en",t)} \xB7 ${n}%)`,annotationStreamingCount:e=>`Streaming (${ee("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${ee("en",e)} received)`,annotationReconnecting:e=>`Reconnecting (${ee("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>It(e,"record","records"),companyUnit:e=>It(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=>It(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=>ee("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${ee("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:Pr,recordDate:jn,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:_r,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=ee("en",e);return`${n} ${It(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: ${ee("en",t)}`,timesUnit:e=>It(e," time"," times"),itemsUnit:e=>It(e," item"," items"),charactersUnit:e=>It(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 (${ee("ja",e)} / ${ee("ja",t)} \u4EF6\u30FB${n}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${ee("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${ee("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationReconnecting:e=>`\u518D\u63A5\u7D9A\u4E2D (${ee("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=>`${ee("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${ee("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:Pr,recordDate:jn,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:_r,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})=>`${ee("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: ${ee("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),Ma=Object.freeze(Object.keys(qn.en)),wn=Object.freeze([...Or,...Ma]),gt=Object.freeze({en:Object.freeze({...Ea.en,...qn.en}),ja:Object.freeze({...Ea.ja,...qn.ja})}),di=new Set(wn),La=Object.keys(gt).map(e=>JSON.stringify(e)).join(" or "),wa=Object.freeze({locale:"locale",labels:"labels"}),ui=(e,t,n)=>{e[t]=n},Ar=(e,t=wa.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${La} or left out; got ${ie(e)}`);if(e!==void 0&&!Object.hasOwn(gt,e))throw new RangeError(`[contact-map] ${t} must be ${La} or left out; got ${ie(e)}`);return si(e)},mi=(e,t,n,r)=>{if(typeof r=="function"){if(typeof n!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${ie(n)}`);return}if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${ie(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${ie(n)}`)},pi=(e,t,n)=>{let r=Object.create(null);for(let i of Object.getOwnPropertyNames(e)){if(!di.has(i)){let a=Gn(i,wn);throw new RangeError(`[contact-map] ${n} has a key that is not a label key (${a===void 0?"":`did you mean ${JSON.stringify(a)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${ie(i)}`)}let o=e[i];o!==void 0&&(mi(n,i,o,t[i]),r[i]=o)}return r},fi=e=>{let t={},n=!1;for(let r of Or){let i=e[r];i!==void 0&&(t[r]=i,n=!0)}return n?t:void 0},Dr=(e,t,n=wa)=>{let r=Ar(e,n.locale);if(t===void 0)return gt[r];if(!rn(t))throw new TypeError(`[contact-map] ${n.labels} must be a plain object or left out; got ${ie(t)}`);let i=pi(t,gt[r],n.labels),a={...ii(r,fi(i)),...qn[r]};for(let u of Ma){let d=i[u];d!==void 0&&ui(a,u,d)}return Object.freeze(a)},Wr=e=>{let t={};for(let n of Or)t[n]=e[n];return Object.freeze(t)},Hr=e=>{let t={};for(let n of li)t[n]=e[n];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as gi}from"@aiquants/directory-tree";import{VIRTUAL_SCROLL_LABEL_KEYS as hi}from"@aiquants/virtualscroll";import{createContext as yi,useContext as Pa,useMemo as Ra,useRef as bi}from"react";import{jsx as vi}from"react/jsx-runtime";var Si,Fr,Ir,_a,Pe,ne,ye=ke(()=>{"use strict";Ft();Si=Object.freeze({locale:"en",labels:gt.en,treeLabels:Wr(gt.en),engineLabels:Hr(gt.en)}),Fr=yi(Si),Ir=(e,t)=>{let n=bi(null),r=n.current;return r!==null&&t.every(i=>r[i]===e[i])?r:(n.current=e,e)},_a=({locale:e,labels:t,surface:n,children:r})=>{let i=Ar(e,n.locale),o=Ra(()=>Dr(i,t,n),[i,t,n]),a=Ir(o,wn),u=Ir(Wr(a),gi),d=Ir(Hr(a),hi),c=Ra(()=>({locale:i,labels:a,treeLabels:u,engineLabels:d}),[i,a,u,d]);return vi(Fr.Provider,{value:c,children:r})},Pe=()=>Pa(Fr),ne=()=>Pa(Fr).labels});var s,N,B,m,Y,$,qe,$a,Te,Bt,k,Lt,Oa,fe=ke(()=>{"use strict";s={fg:"text-[color:light-dark(#0f172b,#f8fafc)]",fgSecondary:"text-[color:light-dark(#314158,#e2e8f0)]",fgMuted:"text-[color:light-dark(#44536a,#cad5e2)]",onPrimary:"text-[color:light-dark(#ffffff,#0f172b)]"},N={surface:"bg-[color:light-dark(#ffffff,#0f172b)]",subtle:"bg-[color:light-dark(#f8fafc,#1d293d)]",muted:"bg-[color:light-dark(#f1f5f9,#1d293d)]"},B={borderSubtle:"border-[color:light-dark(#e2e8f0,#314158)]",borderControl:"border-[color:light-dark(#62748e,#90a1b9)]"},m={amber:"text-[color:light-dark(#7b3306,#fee685)]",blue:"text-[color:light-dark(#193cb8,#bedbff)]",cyan:"text-[color:light-dark(#104e64,#a2f4fd)]",emerald:"text-[color:light-dark(#004f3b,#a4f4cf)]",fuchsia:"text-[color:light-dark(#8a0194,#f6cfff)]",green:"text-[color:light-dark(#0d542b,#b9f8cf)]",indigo:"text-[color:light-dark(#372aac,#c6d2ff)]",lime:"text-[color:light-dark(#35530e,#d8f999)]",orange:"text-[color:light-dark(#7e2a0c,#ffd6a7)]",pink:"text-[color:light-dark(#a3004c,#fccee8)]",purple:"text-[color:light-dark(#6e11b0,#e9d4ff)]",red:"text-[color:light-dark(#9f0712,#ffc9c9)]",rose:"text-[color:light-dark(#a50036,#ffccd3)]",sky:"text-[color:light-dark(#024a70,#b8e6fe)]",teal:"text-[color:light-dark(#0b4f4a,#96f7e4)]",violet:"text-[color:light-dark(#5d0ec0,#ddd6ff)]"},Y={amber:"bg-[color:light-dark(#fffbeb,#461901)]",blue:"bg-[color:light-dark(#eff6ff,#162456)]",emerald:"bg-[color:light-dark(#ecfdf5,#002c22)]",green:"bg-[color:light-dark(#f0fdf4,#032e15)]",purple:"bg-[color:light-dark(#faf5ff,#3c0366)]",rose:"bg-[color:light-dark(#fff1f2,#4d0218)]",sky:"bg-[color:light-dark(#f0f9ff,#052f4a)]"},$={amber:"border-[color:light-dark(#fee685,#7b3306)]",blue:"border-[color:light-dark(#bedbff,#193cb8)]",cyan:"border-[color:light-dark(#a2f4fd,#104e64)]",emerald:"border-[color:light-dark(#a4f4cf,#004f3b)]",fuchsia:"border-[color:light-dark(#f6cfff,#8a0194)]",green:"border-[color:light-dark(#b9f8cf,#0d542b)]",indigo:"border-[color:light-dark(#c6d2ff,#372aac)]",pink:"border-[color:light-dark(#fccee8,#a3004c)]",purple:"border-[color:light-dark(#e9d4ff,#6e11b0)]",rose:"border-[color:light-dark(#ffccd3,#a50036)]",sky:"border-[color:light-dark(#b8e6fe,#024a70)]",teal:"border-[color:light-dark(#96f7e4,#0b4f4a)]",violet:"border-[color:light-dark(#ddd6ff,#5d0ec0)]"},qe={amber:"bg-[color:light-dark(#bb4d00,#fcbb00)]",blue:"bg-[color:light-dark(#155dfc,#51a2ff)]",emerald:"bg-[color:light-dark(#009966,#00d492)]",rose:"bg-[color:light-dark(#ec003f,#ff637e)]",sky:"bg-[color:light-dark(#0084d1,#00bcff)]"},$a={amber:"border-[color:light-dark(#bb4d00,#fcbb00)]"},Te={blue:"bg-[color:light-dark(#193cb8,#bedbff)]",green:"bg-[color:light-dark(#0d542b,#b9f8cf)]",orange:"bg-[color:light-dark(#7e2a0c,#ffd6a7)]",purple:"bg-[color:light-dark(#6e11b0,#e9d4ff)]",red:"bg-[color:light-dark(#9f0712,#ffc9c9)]"},Bt={blue:"hover:bg-[color:light-dark(#162456,#eff6ff)]",red:"hover:bg-[color:light-dark(#460809,#fef2f2)]"},k={hoverSurface:"hover:bg-[color:light-dark(#ffffff,#0f172b)]",hoverMuted:"hover:bg-[color:light-dark(#f1f5f9,#1d293d)]",hoverBlueTint:"hover:bg-[color:light-dark(#eff6ff,#162456)]",hoverRoseTint:"hover:bg-[color:light-dark(#fff1f2,#4d0218)]",hoverFg:"hover:text-[color:light-dark(#0f172b,#f8fafc)]",hoverFgSecondary:"hover:text-[color:light-dark(#314158,#e2e8f0)]",hoverBlueFg:"hover:text-[color:light-dark(#193cb8,#bedbff)]",hoverBlueAccentBorder:"hover:border-[color:light-dark(#155dfc,#51a2ff)]",focusRing:"focus:ring-[color:light-dark(#1447e6,#74d4ff)]",focusBorder:"focus:border-[color:light-dark(#1447e6,#74d4ff)]",focusVisibleRing:"focus-visible:ring-[color:light-dark(#1447e6,#74d4ff)]",focusVisibleOutline:"focus-visible:outline-[color:light-dark(#1447e6,#74d4ff)]",activeRowOutline:"in-focus-visible:data-[contact-map-row-active]:outline-[color:light-dark(#1447e6,#74d4ff)]",ringOffsetSurface:"ring-offset-[color:light-dark(#ffffff,#0f172b)]",selectedRing:"ring-[color:light-dark(#155dfc,#51a2ff)]",activeTabSurface:"data-[state=active]:bg-[color:light-dark(#ffffff,#0f172b)]",activeTabFg:"data-[state=active]:text-[color:light-dark(#0f172b,#f8fafc)]",activeTabBlueFg:"data-[state=active]:text-[color:light-dark(#193cb8,#bedbff)]",treeNameSky:"[&_.directory-tree-name]:text-[color:light-dark(#024a70,#b8e6fe)]"},Lt={mark:"bg-[color:light-dark(#fff085,#733e0a)]",progressTrack:"bg-[color:light-dark(#bedbff,#193cb8)]",scrim:"bg-[color:rgb(15_23_43/0.5)]"},Oa="#71829b"});var C,Mt,w,Ee=ke(()=>{"use strict";C="text-[length:var(--aqcm-font-size-body,0.8125rem)] leading-[var(--aqcm-line-height-body,1.25rem)]",Mt="text-[length:var(--aqcm-font-size-caption,0.6875rem)]",w=`${Mt} leading-[var(--aqcm-line-height-caption,1.25rem)]`});var Xn,Yn,Qn,Jn,Ur=ke(()=>{"use strict";fe();Xn="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]",Yn=Object.freeze({right:"var(--aqcm-overlay-right, 0px)"}),Qn=`absolute inset-0 ${Lt.scrim}`,Jn=()=>!1});var Ti,Ni,wt,Da,Wa,sn,Rn=ke(()=>{"use strict";fe();Ti="min-w-11 py-[max(0px,calc((2.75rem_-_1lh)_/_2))]",Ni=2,wt=`focus-visible:outline-2 ${k.focusVisibleOutline} focus-visible:outline-offset-2`,Da=`in-focus-visible:data-[contact-map-row-active]:outline-2 in-focus-visible:data-[contact-map-row-active]:-outline-offset-2 ${k.activeRowOutline}`,Wa=Ni,sn=`inline-block max-w-full underline-offset-2 hover:underline focus-visible:underline ${wt} ${Ti}`});import{clsx as ki}from"clsx";import{twMerge as Ei}from"tailwind-merge";function Le(...e){return Ei(ki(e))}var Pn=ke(()=>{"use strict"});import{useOverlayDialog as Li}from"@aiquants/swipe-overlay";import Mi from"lucide-react/dist/esm/icons/check.js";import wi from"lucide-react/dist/esm/icons/copy.js";import Ri from"lucide-react/dist/esm/icons/x.js";import{useCallback as dn,useEffect as Ha,useId as Pi,useMemo as Zn,useRef as Ia,useState as _i}from"react";import{createPortal as $i}from"react-dom";import{jsx as re,jsxs as Xe}from"react/jsx-runtime";var Oi,De,Ai,Di,Wi,_n,cn,Hi,Ii,ln,Vr,Kr,er,jr=ke(()=>{"use strict";Wt();ye();Ur();fe();Rn();Ee();Pn();Oi=350,De=e=>e.stopPropagation(),Ai=Object.freeze({onClick:De,onDoubleClick:De,onContextMenu:De,onPointerDown:De,onPointerUp:De,onMouseDown:De,onMouseUp:De,onTouchStart:De,onTouchEnd:De,onKeyDown:De,onKeyUp:De,onFocus:De,onBlur:De}),Di=Le(Xn,"flex items-center justify-center px-4 py-6"),Wi=`relative max-h-full w-full max-w-md overflow-y-auto overscroll-contain rounded-lg border ${B.borderControl} ${N.surface} p-4 shadow-lg transition-colors`,_n=0,cn=null,Hi=()=>{let e=document.body.style;_n+=1,_n===1&&(cn={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},Ii=()=>{if(_n=Math.max(0,_n-1),_n>0||!cn)return;let e=document.body.style;e.userSelect=cn.userSelect,typeof cn.webkitUserSelect<"u"&&(e.webkitUserSelect=cn.webkitUserSelect),cn=null},ln=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Vr=(e,t)=>{let n=new Set;return e.reduce((r,i)=>{let o=typeof i.value=="string"?i.value.trim():"";if(!o)return r;let{normalized:a,key:u,entry:d}=t(o,i);return a&&!n.has(u)&&(n.add(u),r.push(d(a))),r},[])},Kr=({value:e,ariaLabel:t})=>{let[n,r]=_i(!1),i=Ia(null),o=dn(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 c=document.createElement("textarea");c.value=d,c.setAttribute("readonly",""),c.style.position="absolute",c.style.left="-9999px",document.body.appendChild(c),c.select(),c.setSelectionRange(0,c.value.length);let p=document.execCommand("copy");return document.body.removeChild(c),p},[]),a=dn(async d=>{d.preventDefault(),d.stopPropagation(),i.current!==null&&typeof window<"u"&&(window.clearTimeout(i.current),i.current=null);let c=await o(e);r(c),c&&typeof window<"u"&&(i.current=window.setTimeout(()=>{r(!1),i.current=null},1500))},[o,e]);Ha(()=>()=>{i.current!==null&&typeof window<"u"&&(window.clearTimeout(i.current),i.current=null)},[]);let u=n?Mi:wi;return re("button",{type:"button",className:`inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md border ${B.borderControl} ${s.fgMuted} transition-colors ${k.hoverMuted} ${wt}`,onClick:a,"aria-label":t,title:t,children:re(u,{className:"h-3.5 w-3.5","aria-hidden":"true"})})},er=({contactData:e,openEmailsWithGmail:t,openGmailCompose:n,onRequestClose:r})=>{let i=ne(),o=Ia(null),a=Zn(()=>e.contacted_at?at(e.contacted_at,i.recordDate):null,[e.contacted_at,i.recordDate]),u=ln(e.full_name)??i.noName,d=ln(e.company_name),c=ln(e.department),p=ln(e.title),f=Zn(()=>Vr([{fieldKey:"company_name",label:i.fieldCompanyName,value:d},{fieldKey:"department",label:i.fieldDepartment,value:c},{fieldKey:"title",label:i.fieldTitle,value:p}],(v,{fieldKey:M,label:H})=>({normalized:v,key:`${M}-${v.toLowerCase()}`,entry:S=>({fieldKey:M,label:H,value:S})})),[d,c,p,i]),l=Zn(()=>Vr([{fieldKey:"custom_mobile_phone_number",label:i.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:i.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:i.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:i.popupCompanyPhone,value:e.company_phone_number}],(v,{fieldKey:M,label:H})=>{let S=Mn(v);return{normalized:ln(v),key:(S??v).toLowerCase(),entry:ae=>({fieldKey:M,label:H,value:ae,href:S})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,i]),g=Zn(()=>Vr([{fieldKey:"custom_email",label:i.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:i.popupEmail,value:e.email}],(v,{fieldKey:M,label:H})=>{let S=ln(v),L=ft(v,t),ae=!!L?.startsWith("https://mail.google.com");return{normalized:S,key:v.toLowerCase(),entry:I=>({fieldKey:M,label:H,value:I,href:L,isGmailLink:ae})}}),[e.custom_email,e.email,t,i]),y=l.length>0||g.length>0,x=Pi(),E=dn(()=>{r(),o.current=null},[r]),T=dn(v=>v.ownerDocument.getElementById(x),[x]),{dialogProps:U,backdropProps:z}=Li({isOpen:!0,onClose:E,isCloseBlocked:Jn,initialFocus:T}),b=dn((v,M)=>{M.isGmailLink&&(v.preventDefault(),n(M.value))},[n]),h=dn((v,M)=>{if(!M.isGmailLink){o.current=null;return}let H=Date.now(),S=o.current;if(S&&S.email===M.value&&H-S.timestamp<=Oi){o.current=null,v.preventDefault(),n(M.value);return}o.current={email:M.value,timestamp:H}},[n]);return Ha(()=>(Hi(),Ii),[]),$i(Xe("dialog",{...U,...Ai,"data-contact-popup-root":"true","aria-labelledby":x,className:Di,style:Yn,children:[re("div",{...z,"data-contact-popup-backdrop":"",className:Qn}),Xe("div",{"data-contact-popup-card":"",className:Wi,children:[Xe("div",{className:"flex items-center justify-between gap-4",children:[re("h2",{id:x,tabIndex:-1,className:`wrap-break-word min-w-0 font-semibold ${s.fg} text-lg outline-none`,children:u}),re("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-md p-3.5 ${s.fgMuted} transition-colors ${k.hoverMuted} ${wt}`,onClick:E,"aria-label":i.close,children:re(Ri,{className:"h-4 w-4","aria-hidden":"true"})})]}),f.length>0?re("div",{className:`mt-2 space-y-2 ${s.fgSecondary} text-sm`,children:f.map(v=>Xe("div",{className:"flex items-center gap-3",children:[re("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:v.value}),re(Kr,{value:v.value,ariaLabel:i.copyField(v.label)})]},v.fieldKey))}):null,Xe("div",{className:`mt-4 space-y-4 ${s.fgSecondary}`,children:[l.length>0?re("div",{children:re("ul",{className:"space-y-3 text-sm",children:l.map(v=>re("li",{className:"flex items-start gap-3",children:Xe("div",{className:"min-w-0 flex-1",children:[re("span",{className:`${s.fgMuted} text-xs`,children:v.label}),Xe("div",{className:"mt-1 flex items-center gap-3",children:[re("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:v.href?re("a",{href:v.href,className:`wrap-break-word ${m.blue} ${sn}`,children:v.value}):re("span",{className:`wrap-break-word ${s.fg}`,children:v.value})}),re(Kr,{value:v.value,ariaLabel:i.copyField(v.label)})]})]})},`${v.fieldKey}-${v.value}`))})}):null,g.length>0?re("div",{children:re("ul",{className:"space-y-3 text-sm",children:g.map(v=>re("li",{className:"flex items-start gap-3",children:Xe("div",{className:"min-w-0 flex-1",children:[re("span",{className:`${s.fgMuted} text-xs`,children:v.label}),Xe("div",{className:"mt-1 flex items-start gap-3",children:[Xe("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[v.href?re("a",{href:v.href,className:`wrap-break-word ${m.blue} ${sn}`,target:v.isGmailLink?"_blank":void 0,rel:v.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:M=>b(M,v),onTouchEnd:M=>h(M,v),children:v.value}):re("span",{className:`wrap-break-word ${s.fg}`,children:v.value}),v.isGmailLink?re("span",{className:`mt-1 block ${w} ${s.fgMuted}`,children:i.popupGmailHint}):null]}),re(Kr,{value:v.value,ariaLabel:i.copyField(v.label)})]})]})},`${v.fieldKey}-${v.value}`))})}):null,a?Xe("div",{className:`mt-2 flex items-center gap-2 ${s.fgMuted} text-sm`,children:[re("span",{className:"text-xs",children:i.popupLastContactDate}),re("span",{children:a})]}):null,y?null:re("p",{className:`${s.fgMuted} text-sm`,children:i.popupNoContactMethods})]})]})]}),document.body)}});import{jsx as _e,jsxs as $n}from"react/jsx-runtime";var tr,Gr=ke(()=>{"use strict";fe();Ee();tr=({fullName:e,title:t="-",companyName:n="-",department:r="-",phoneNumber:i="-",email:o="-",updatedAtText:a="-"})=>$n("div",{className:`flex h-full w-full flex-col justify-center gap-0.5 ${s.fg} 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]`,children:[$n("div",{className:"flex items-center gap-1 sm:hidden",children:[_e("div",{className:`flex-1 truncate font-medium ${s.fg} text-sm leading-tight`,children:e}),_e("div",{className:`shrink-0 whitespace-nowrap ${Mt} ${s.fgMuted}`,children:i})]}),_e("div",{className:"flex items-center gap-1 sm:hidden",children:_e("div",{className:`flex-1 truncate ${s.fgSecondary} text-xs leading-tight`,children:n})}),_e("div",{className:"block sm:hidden",children:_e("span",{className:`w-full truncate text-left ${Mt} ${s.fgSecondary} leading-tight`,children:r})}),$n("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[_e("span",{className:`truncate font-medium ${s.fg}`,children:e}),_e("span",{className:`truncate ${s.fgMuted} text-xs`,children:t})]}),$n("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[_e("span",{className:`truncate ${s.fg}`,children:n}),_e("span",{className:`truncate ${s.fgMuted} text-xs`,children:r})]}),$n("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[_e("span",{className:`truncate ${s.fgSecondary}`,children:i}),_e("span",{className:`truncate ${s.fgMuted} text-xs`,children:o})]}),_e("div",{className:`hidden items-end justify-end ${Mt} ${s.fgMuted} xl:flex`,children:_e("span",{className:"truncate",children:a})})]})});import{formatQuerySets as Fi,parseQuerySets as Bi}from"@aiquants/fuzzy-search";import{getNormalizedVariants as zi,normalizeText as Ui,romajiToKatakana as Vi}from"@aiquants/select-box";var za,Ki,ji,Gi,qi,Ua,Va,Xi,Yi,Qi,Ji,Zi,es,ts,ns,Ka,ja,Fa,Ba,nr,rs,as,qr,Ga,Xr=ke(()=>{"use strict";za=/[]/g,Ki=/^[\s ]+|[\s ]+$/g,ji=/\s+/,Gi=/^[\p{Script=Latin}\s]+$/u,qi=/\p{Script=Latin}/u,Ua=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1,normalizeVariants:!1,ignoreSpaces:!1,ignoreSymbols:!1,ignoreLongVowels:!1}),Va="union",Xi=65377,Yi=65439,Qi=["\uFF9E","\uFF9F"],Ji=(()=>{let e=new Map;for(let t=Xi;t<=Yi;t+=1){let n=String.fromCharCode(t);e.set(n.normalize("NFKC"),n);for(let r of Qi){let i=(n+r).normalize("NFKC");i.length===1&&e.set(i,n+r)}}return e})(),Zi=/[-ヿ]/u,es=e=>{let t=Array.from(e,n=>Ji.get(n)??n).join("");return Zi.test(t)?null:t},ts=e=>Ui(e.replace(za,"").replace(Ki,""),Ua),ns=e=>{if(!Gi.test(e))return null;let t=Vi(e);return qi.test(t)?null:t},Ka=e=>e.split(ji).filter(Boolean),ja=e=>Bi(e,Va).sets.map(({query:t})=>t),Fa=e=>ja(e).flatMap(t=>Ka(t)),Ba=e=>Fi({combine:Va,sets:Array.from(new Set(e),t=>({query:t}))}),nr=e=>{let t=ja(e.replace(za,"")).map(r=>Ka(ts(r)).join(" ")).filter(r=>r!==""),n=[];for(let r of t){let i=ns(r);if(i===null)return Ba(t);n.push(i)}return Ba(n)},rs=e=>{let t=new Set([...Fa(e),...Fa(nr(e))]),n=new Set;for(let r of t)for(let i of zi(r,Ua)){let o=i.trim();if(!o)continue;n.add(o);let a=es(o);a!==null&&n.add(a)}return Array.from(n)},as=/[.*+?^${}()|[\]\\]/g,qr=e=>{let t=rs(e);if(t.length===0)return null;let n=t.map(r=>r.replace(as,"\\$&")).sort((r,i)=>i.length-r.length);return new RegExp(n.join("|"),"gi")},Ga=(e,t)=>{let n=qr(e);if(n===null)return i=>i;let r=i=>t.some(o=>{let a=i[o];return typeof a=="string"&&a.search(n)!==-1});return i=>{let o=[],a=[];for(let u of i)r(u.item)?o.push(u):a.push(u);return[...o,...a]}}});import{memo as os}from"react";import{Fragment as Yr,jsx as rr}from"react/jsx-runtime";var is,Ne,ar=ke(()=>{"use strict";Xr();fe();is=`rounded ${Lt.mark} px-1 ${s.fg}`,Ne=os(({text:e,query:t,enabled:n=!0})=>{if(!(n&&t?.trim()&&e))return rr(Yr,{children:e});let r=qr(t);if(r===null)return rr(Yr,{children:e});let i=[],o=0,a=r.exec(e),u=0;for(;a;){let d=a[0],c=a.index;if(c>o&&i.push(e.substring(o,c)),d.length===0){r.lastIndex++,a=r.exec(e);continue}i.push(rr("mark",{className:is,children:d},`highlight-${c}-${u}`)),o=c+d.length,u+=1,a=r.exec(e)}return o<e.length&&i.push(e.substring(o)),rr(Yr,{children:i})});Ne.displayName="HighlightedText"});var Xa={};ai(Xa,{ContactDetailGrid:()=>qa,default:()=>ss});import{useMemo as Qr}from"react";import{Fragment as ls,jsx as Jr,jsxs as cs}from"react/jsx-runtime";var or,qa,ss,Ya=ke(()=>{"use strict";Wt();ye();jr();Gr();ar();or=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},qa=({contactData:e,searchTerm:t,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:i,isPopupVisible:o,onRequestClose:a})=>{let u=ne(),d=Qr(()=>tn(e),[e]),c=Qr(()=>nn(e),[e]),p=d.value??"-",f=c.value??"-",l=Qr(()=>at(e.updated_at,u.recordDateTime),[e.updated_at,u.recordDateTime]),g=or(e.full_name)??u.noName,y=or(e.company_name),x=or(e.department),E=(T,U="-")=>Jr(Ne,{text:T??U,query:t,enabled:n});return cs(ls,{children:[Jr(tr,{fullName:E(g),title:E(or(e.title)),companyName:E(y),department:E(x),phoneNumber:f,email:E(p),updatedAtText:l}),o?Jr(er,{contactData:e,openEmailsWithGmail:r,openGmailCompose:i,onRequestClose:a}):null]})},ss=qa});ye();fe();Ee();import{DEFAULT_FUZZY_SEARCH_OPTIONS as on}from"@aiquants/fuzzy-search";import{memo as Ci,useId as Aa}from"react";import{jsx as ot,jsxs as ht}from"react/jsx-runtime";var Br=Ci(({searchOptions:e,setSearchOptions:t})=>{let n=ne(),r=`flex flex-col gap-1 rounded-md border ${N.surface} px-2 py-1 shadow-sm transition-colors`,i="text-xs font-semibold",o=Aa(),a=Aa(),u=[];return u.push(ht("div",{className:`${r} ${$.sky} border-l-4`,children:[ht("div",{className:`${i} ${m.sky}`,children:["\u{1F4D8} ",n.advancedLearningHeading]}),ot("label",{htmlFor:o,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.advancedLearningLabel}),ot("input",{id:o,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||on.learningWeight,onChange:d=>t(c=>({...c,learningWeight:parseFloat(d.target.value)})),className:"h-11 w-full"}),ht("span",{className:`${m.sky} text-xs`,children:[n.currentValueLabel," ",e.learningWeight||on.learningWeight]}),ot("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.advancedLearningHint})]},"learning")),u.push(ht("div",{className:`${r} ${$.indigo} border-l-4`,children:[ht("div",{className:`${i} ${m.indigo}`,children:["\u23F1\uFE0F ",n.advancedDebounceHeading]}),ot("label",{htmlFor:a,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.advancedDebounceLabel}),ot("input",{id:a,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs??on.debounceMs,onChange:d=>t(c=>({...c,debounceMs:parseInt(d.target.value,10)})),className:"h-11 w-full"}),ht("span",{className:`${m.indigo} text-xs`,children:[n.currentValueLabel," ",e.debounceMs??on.debounceMs]}),ot("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.advancedDebounceHint})]},"debounce")),ht("section",{className:"space-y-3",children:[ht("div",{className:"flex items-center justify-between gap-3",children:[ht("div",{className:`flex items-center gap-2 font-semibold ${s.fgSecondary} text-xs transition-colors`,children:[ot("span",{children:"\u26A1"}),ot("span",{className:"tracking-wide",children:n.settingsAdvancedTab})]}),ot("button",{type:"button",onClick:()=>t(d=>({...d,learningWeight:on.learningWeight,debounceMs:on.debounceMs})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border ${B.borderControl} ${N.muted} px-2 font-medium ${s.fgSecondary} ${C} transition-colors ${k.hoverSurface}`,title:n.resetToDefaultsTitle,children:n.reset})]}),ot("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:u})]})});Br.displayName="AdvancedSearchSettings";ye();fe();Ee();import{DEFAULT_FUZZY_SEARCH_OPTIONS as zt}from"@aiquants/fuzzy-search";import{memo as xi,useId as it}from"react";import{jsx as se,jsxs as de}from"react/jsx-runtime";var zr=xi(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:i,setOpenEmailsWithGmail:o})=>{let a=ne(),u=`flex flex-col gap-1 rounded-md border ${N.surface} px-2 py-1 shadow-sm transition-colors`,d="text-xs font-semibold",c=it(),p=it(),f=it(),l=it(),g=it(),y=it(),x=it(),E=it(),T=it(),U=it(),z=[];return z.push(de("div",{className:`${u} ${$.blue} border-l-4`,children:[de("div",{className:`${d} ${m.blue}`,children:["\u{1F3AF} ",a.basicThresholdHeading]}),se("label",{htmlFor:c,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicThresholdLabel}),se("input",{id:c,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??zt.threshold,onChange:b=>t(h=>({...h,threshold:parseFloat(b.target.value)})),className:"h-11 w-full"}),de("span",{className:`${m.blue} text-xs`,children:[a.currentValueLabel," ",e.threshold??zt.threshold]}),se("p",{className:`${w} ${s.fgMuted} transition-colors`,children:e.sortBy==="relevance"?a.basicThresholdRangeRelevance:a.basicThresholdRange})]},"threshold")),z.push(de("div",{className:`${u} ${$.amber} border-l-4`,children:[de("div",{className:`${d} ${m.amber}`,children:["\u{1FA84} ",a.basicDisplayHeading]}),de("label",{htmlFor:p,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:p,type:"checkbox",checked:e.caseSensitive??zt.caseSensitive,onChange:b=>t(h=>({...h,caseSensitive:b.target.checked})),className:"h-3 w-3"}),a.basicCaseSensitive]}),de("label",{htmlFor:f,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:f,type:"checkbox",checked:n,onChange:b=>r(b.target.checked),className:"h-3 w-3"}),a.basicHighlight]}),de("label",{htmlFor:l,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:l,type:"checkbox",checked:i,onChange:b=>o(b.target.checked),className:"h-3 w-3"}),a.basicOpenEmailsWithGmail]}),de("div",{className:"flex flex-col gap-1",children:[se("label",{htmlFor:g,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicMultiTermOperator}),de("select",{id:g,value:e.multiTermOperator??zt.multiTermOperator,onChange:b=>t(h=>({...h,multiTermOperator:b.target.value})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,children:[se("option",{value:"or",children:a.basicOperatorOr}),se("option",{value:"and",children:a.basicOperatorAnd})]}),se("p",{className:`${w} ${s.fgMuted} transition-colors`,children:a.basicMultiTermHint})]})]},"display")),z.push(de("div",{className:`${u} ${$.emerald} border-l-4`,children:[de("div",{className:`${d} ${m.emerald}`,children:["\u{1F4DA} ",a.basicSortHeading]}),de("div",{className:"flex flex-col gap-2",children:[se("label",{htmlFor:y,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicSortBy}),de("select",{id:y,value:e.sortBy||zt.sortBy,onChange:b=>t(h=>({...h,sortBy:b.target.value})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,children:[se("option",{value:"score",children:a.basicSortByScore}),se("option",{value:"relevance",children:a.basicSortByRelevance}),se("option",{value:"original",children:a.basicSortByOriginal})]})]}),de("div",{className:"flex flex-col gap-2",children:[se("label",{htmlFor:x,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicSortOrder}),de("select",{id:x,value:e.sortOrder||zt.sortOrder,onChange:b=>t(h=>({...h,sortOrder:b.target.value})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,children:[se("option",{value:"desc",children:a.basicSortDescending}),se("option",{value:"asc",children:a.basicSortAscending})]})]})]},"sorting")),z.push(de("div",{className:`${u} ${$.purple} border-l-4`,children:[de("div",{className:`${d} ${m.purple}`,children:["\u2699\uFE0F ",a.basicEngineHeading]}),se("label",{htmlFor:E,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicStrategy}),de("select",{id:E,value:e.parallelSearchStrategy||zt.parallelSearchStrategy,onChange:b=>t(h=>({...h,parallelSearchStrategy:b.target.value})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,children:[se("option",{value:"balanced",children:a.basicStrategyBalanced}),se("option",{value:"index-first",children:a.basicStrategyIndexFirst}),se("option",{value:"levenshtein-first",children:a.basicStrategyLevenshteinFirst})]}),de("div",{className:"mt-2 space-y-2",children:[de("label",{htmlFor:T,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:T,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:b=>t(h=>({...h,enableIndexFiltering:b.target.checked})),className:"h-3 w-3"}),a.basicIndexFiltering]}),de("label",{htmlFor:U,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:U,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:b=>t(h=>({...h,enableLevenshtein:b.target.checked})),className:"h-3 w-3"}),a.basicLevenshtein]})]})]},"engine")),de("section",{className:"space-y-3",children:[de("div",{className:`flex items-center gap-2 font-semibold ${m.blue} text-xs transition-colors`,children:[se("span",{children:"\u{1F527}"}),se("span",{className:"tracking-wide",children:a.settingsBasicTab})]}),se("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:z})]})});zr.displayName="BasicSearchSettings";Wt();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as ds}from"@aiquants/swipe-overlay";import us from"lucide-react/dist/esm/icons/badge-check.js";import ms from"lucide-react/dist/esm/icons/building-2.js";import ps from"lucide-react/dist/esm/icons/calendar-clock.js";import fs from"lucide-react/dist/esm/icons/check.js";import gs from"lucide-react/dist/esm/icons/copy.js";import hs from"lucide-react/dist/esm/icons/id-card.js";import ys from"lucide-react/dist/esm/icons/mail.js";import bs from"lucide-react/dist/esm/icons/phone.js";import Ss from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as vs,useEffect as Cs,useMemo as lr,useRef as xs,useState as Ts}from"react";var st={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)};ye();fe();fe();Pn();import*as Ye from"@radix-ui/react-tabs";import*as ir from"react";import{jsx as Zr}from"react/jsx-runtime";var sr=Ye.Root,On=ir.forwardRef(({className:e,...t},n)=>Zr(Ye.List,{ref:n,className:Le(`inline-flex h-10 items-center justify-center rounded-md ${N.muted} p-1 ${s.fgMuted}`,e),...t}));On.displayName=Ye.List.displayName;var Ut=ir.forwardRef(({className:e,...t},n)=>Zr(Ye.Trigger,{ref:n,className:Le(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ${k.ringOffsetSurface} transition-all focus-visible:outline-hidden focus-visible:ring-2 ${k.focusVisibleRing} focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${k.activeTabSurface} ${k.activeTabFg} data-[state=active]:shadow-2xs`,e),...t}));Ut.displayName=Ye.Trigger.displayName;var Vt=ir.forwardRef(({className:e,...t},n)=>Zr(Ye.Content,{ref:n,className:Le(`mt-2 ${k.ringOffsetSurface} focus-visible:outline-hidden focus-visible:ring-2 ${k.focusVisibleRing} focus-visible:ring-offset-2 data-[state=inactive]:hidden`,e),...t}));Vt.displayName=Ye.Content.displayName;Rn();Ee();ar();import{jsx as R,jsxs as Ce}from"react/jsx-runtime";var Qa=`truncate font-semibold ${s.fg} ${C}`,Ja={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},Ns=({icon:e,label:t,value:n,fieldKey:r,copyValue:i,onCopy:o,isCopied:a,linkHref:u,searchTerm:d,enableHighlighting:c})=>{let p=ne(),f=!!(o&&r&&i),l=u?.startsWith("https://mail.google.com")?"_blank":void 0;return Ce("div",{className:`flex items-center justify-between gap-2 rounded-lg border ${B.borderSubtle} ${N.subtle} px-2.5 py-1.5 transition-colors`,children:[Ce("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[R("div",{className:`flex h-7 w-7 items-center justify-center rounded-full ${N.surface} ${s.fgMuted} transition-colors`,children:R(e,{size:14})}),Ce("div",{className:"min-w-0 flex-1",children:[R("div",{className:`font-medium ${w} ${s.fgMuted}`,children:t}),u?R("a",{href:u,className:`align-top ${Qa} ${sn}`,target:l,rel:l?"noopener noreferrer":void 0,children:R(Ne,{text:n,query:d??"",enabled:c})}):R("div",{className:Qa,children:R(Ne,{text:n,query:d??"",enabled:c})})]})]}),f?R("button",{type:"button",onClick:()=>o&&r&&i&&o(r,i,t),className:`inline-flex h-11 w-11 shrink-0 touch-manipulation items-center justify-center rounded-full border ${B.borderControl} ${N.surface} ${s.fgMuted} transition-colors ${k.hoverBlueAccentBorder} ${k.hoverBlueFg} ${wt}`,"aria-label":p.copyField(t),children:a?R(fs,{size:14}):R(gs,{size:14})}):null]})},Za=({items:e,searchTerm:t,enableHighlighting:n})=>R("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(r=>Ce("div",{className:`flex flex-col gap-0.5 rounded-md border ${B.borderSubtle} ${N.surface} px-2 py-1 transition-colors`,children:[R("dt",{className:`font-semibold ${w} ${s.fgMuted} uppercase tracking-wide`,children:r.label}),R("dd",{className:`wrap-break-word ${s.fg} text-xs`,children:R(Ne,{text:r.value,query:t??"",enabled:n})})]},r.fieldKey))}),ea=({title:e})=>R("h3",{className:`font-semibold ${s.fgSecondary} text-xs`,children:e}),ks=()=>{let e=ne();return Ce("div",{className:`flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border ${B.borderSubtle} border-dashed ${N.surface} p-4 text-center transition-colors`,children:[R("p",{className:`font-medium ${s.fgMuted} text-xs`,children:e.detailEmptyTitle}),R("p",{className:`${w} ${s.fgMuted}`,children:e.detailEmptyHint})]})},Es=Object.freeze({overlay:ds,pane:void 0}),un=({contact:e,placement:t,searchTerm:n,enableHighlighting:r,style:i,className:o=""})=>{let a=ne(),[u,d]=Ts(null),c=xs(null),p=lr(()=>({...Ja,...i}),[i]);Cs(()=>()=>{c.current!==null&&window.clearTimeout(c.current)},[]);let f=lr(()=>tn(e),[e]),l=lr(()=>nn(e),[e]),g=lr(()=>at(e?.contacted_at,a.recordDateTime),[e?.contacted_at,a.recordDateTime]),y=vs(async(S,L,ae)=>{try{await navigator.clipboard.writeText(L),d(S),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{d(null)},2e3)}catch(I){st.error("Failed to copy contact detail",I)}},[]);if(!e)return R("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border ${B.borderSubtle} ${N.surface} shadow-sm transition-colors`,style:Ja,children:R(ks,{})});let x=[te(e.title),te(e.department)].filter(S=>S!=="-"),E=[x.join(" / "),te(e.company_name)].filter(S=>S&&S!=="-").join(" \u30FB ")||"-",T=Ge(e.full_name)??a.noName,U=[{fieldKey:"full_name",label:a.fieldFullName,value:T},{fieldKey:"full_name_reading",label:a.fieldFullNameReading,value:te(e.full_name_reading)},{fieldKey:"title",label:a.fieldTitle,value:te(e.title)},{fieldKey:"department",label:a.fieldDepartment,value:te(e.department)},{fieldKey:"company_name",label:a.fieldCompanyName,value:te(e.company_name)},{fieldKey:"company_name_reading",label:a.fieldCompanyNameReading,value:te(e.company_name_reading)},{fieldKey:"address",label:a.fieldAddress,value:te(e.address)},{fieldKey:"postal_code",label:a.fieldPostalCode,value:te(e.postal_code)},{fieldKey:"url",label:a.fieldUrl,value:te(e.url)}],z=[{label:a.fieldCustomEmail,value:te(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:a.fieldEmail,value:te(e.email),fieldKey:"email",rawValue:e.email}].filter(S=>S.value!=="-"),b=[{label:a.fieldCustomMobilePhone,value:te(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:a.fieldMobilePhone,value:te(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:a.fieldCompanyPhone,value:te(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:a.fieldCompanyFax,value:te(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(S=>S.value!=="-"),h=[{fieldKey:"person_id",label:"person_id",value:te(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:te(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:te(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:te(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:te(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:te(e.is_in_eight)},{fieldKey:"created_by",label:a.fieldCreatedBy,value:te(e.created_by)},{fieldKey:"created_at",label:a.fieldCreatedAt,value:at(e.created_at,a.recordDateTime)},{fieldKey:"updated_by",label:a.fieldUpdatedBy,value:te(e.updated_by)},{fieldKey:"updated_at",label:a.fieldUpdatedAt,value:at(e.updated_at,a.recordDateTime)}],v=[{rowKey:"person_id",icon:hs,label:"person_id",value:te(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:ys,label:a.summaryEmail,value:f.value??"-",fieldKey:"primary_email",copyValue:f.value,linkHref:ft(f.value,!1)},{rowKey:"primary_phone",icon:bs,label:a.summaryPhone,value:l.value??"-",fieldKey:"primary_phone",copyValue:l.value,linkHref:Mn(l.value)},{rowKey:"contacted_at",icon:ps,label:a.summaryLastContact,value:g}],M=[{sectionKey:"email",title:a.sectionEmail,emptyText:a.sectionEmailEmpty,entries:z,recommendedKey:f.fieldKey??null,resolveHref:S=>ft(S!=null?String(S):null,!1)},{sectionKey:"phone",title:a.sectionPhone,emptyText:a.sectionPhoneEmpty,entries:b,recommendedKey:l.fieldKey??null,resolveHref:S=>Mn(S!=null?String(S):null)}],H=[{value:"summary",label:a.detailTabSummary,content:Ce("div",{className:"flex flex-col gap-4",children:[Ce("div",{className:"flex flex-col gap-1",children:[Ce("div",{className:`flex items-center gap-2 ${s.fgMuted} text-sm`,children:[R(ms,{size:16}),R("span",{children:R(Ne,{text:te(e.company_name),query:n??"",enabled:r})})]}),x.length>0?R("div",{className:`${s.fgMuted} text-sm`,children:x.map((S,L)=>Ce("span",{children:[L>0&&" / ",R(Ne,{text:S,query:n??"",enabled:r})]},`header-line-${L}`))}):null]}),R("div",{className:"flex flex-col gap-3",children:v.map(S=>R(Ns,{icon:S.icon,label:S.label,value:S.value,fieldKey:S.fieldKey,copyValue:S.copyValue,onCopy:y,isCopied:S.fieldKey?u===S.fieldKey:!1,linkHref:S.linkHref,searchTerm:n,enableHighlighting:r},S.rowKey))})]})},{value:"basic",label:a.detailTabBasic,content:Ce("div",{className:"flex flex-col gap-3",children:[R(ea,{title:a.detailBasicProfile}),R(Za,{items:U,searchTerm:n,enableHighlighting:r})]})},{value:"contact",label:a.detailTabContact,content:R("div",{className:"flex flex-col gap-4",children:M.map(({sectionKey:S,title:L,emptyText:ae,entries:I,recommendedKey:be,resolveHref:oe})=>Ce("div",{className:"flex flex-col gap-2",children:[R(ea,{title:L}),I.length===0?R("p",{className:`${s.fgMuted} text-xs`,children:ae}):R("div",{className:"flex flex-col gap-2",children:I.map(W=>{let A=oe(W.rawValue),q=W.fieldKey===be;return Ce("div",{className:`flex items-center justify-between gap-2 rounded-lg border ${B.borderSubtle} ${N.surface} px-3 py-2 transition-colors`,children:[Ce("div",{className:"min-w-0 flex-1",children:[R("div",{className:`font-medium ${s.fgMuted} text-xs`,children:W.label}),R("div",{className:`wrap-break-word ${s.fg} text-sm`,children:A?R("a",{href:A,className:`text-inherit ${sn}`,children:R(Ne,{text:W.value,query:n??"",enabled:r})}):R(Ne,{text:W.value,query:n??"",enabled:r})})]}),q?Ce("span",{className:`inline-flex shrink-0 items-center gap-1 rounded-full ${Y.emerald} px-2 py-0.5 font-semibold ${w} ${m.emerald} transition-colors`,children:[R(us,{size:14}),a.preferred]}):null]},W.fieldKey)})})]},S))})},{value:"meta",label:a.detailTabMeta,content:Ce("div",{className:"flex flex-col gap-3",children:[R(ea,{title:a.detailTabMeta}),R(Za,{items:h,searchTerm:n,enableHighlighting:r})]})}];return Ce("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border ${B.borderSubtle} ${N.surface} shadow-sm transition-colors ${o}`.trim(),style:p,children:[R("div",{className:`${B.borderSubtle} border-b px-3 py-1.5 transition-colors ${N.subtle}`,children:Ce("div",{className:"flex items-center gap-2",children:[R("div",{className:`flex h-8 w-8 items-center justify-center rounded-full ${Y.blue} ${m.blue} transition-colors`,children:R(Ss,{size:16})}),Ce("div",{className:"min-w-0 flex-1",children:[R("div",{className:`truncate font-semibold ${s.fg} text-sm`,children:R(Ne,{text:T,query:n??"",enabled:r})}),R("div",{className:`truncate ${w} ${s.fgMuted}`,children:R(Ne,{text:E,query:n??"",enabled:r})})]})]})}),Ce(sr,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[R(On,{className:`grid h-auto grid-cols-4 gap-1 rounded-none ${B.borderSubtle} border-b ${N.subtle} px-2 py-1 transition-colors`,children:H.map(S=>R(Ut,{value:S.value,className:`flex min-h-11 min-w-0 touch-manipulation rounded-md px-1 py-1 font-semibold ${s.fgSecondary} ${C} transition-colors ${k.activeTabSurface} ${k.activeTabBlueFg}`,children:R("span",{className:"min-w-0 truncate",children:S.label})},S.value))}),H.map(S=>R(Vt,{value:S.value,className:`scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors ${s.fgSecondary}`,style:Es[t],children:S.content},S.value))]})]})};Ft();ye();fe();Ee();import{memo as Ls}from"react";import{jsx as yt,jsxs as cr}from"react/jsx-runtime";var ta=Ls(({recordCount:e,companyCount:t,phase:n,loadedCount:r,totalCount:i,errorMessage:o,onRetry:a})=>{let{locale:u,labels:d}=Pe(),c=ee(u,e),p=ee(u,t);return cr("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[cr("span",{className:"flex items-baseline gap-1",children:[yt("span",{className:s.fgMuted,children:d.annotationTotalLabel}),yt("span",{className:s.fg,"data-testid":"contact-map-record-count",children:c}),yt("span",{className:s.fgMuted,children:d.recordUnit(c)})]}),cr("span",{className:"flex items-baseline gap-1",children:[yt("span",{className:s.fgMuted,children:d.annotationCompaniesLabel}),yt("span",{className:s.fg,"data-testid":"contact-map-company-count",children:p}),yt("span",{className:s.fgMuted,children:d.companyUnit(p)})]}),n==="streaming"||n==="idle"?yt("span",{"data-testid":"contact-map-stream-badge",className:`ml-2 inline-flex items-center gap-1.5 rounded-full ${Y.blue} px-2 py-0.5 font-medium ${m.blue} text-xs`,children:i!==null&&i>0?d.annotationStreamingProgress({loaded:r,total:i,percent:Math.min(100,Math.round(r/i*100))}):d.annotationStreamingCount(r)}):null,n==="retrying"?yt("span",{"data-testid":"contact-map-reconnecting-badge",className:`ml-2 inline-flex items-center gap-1.5 rounded-full ${Y.amber} px-2 py-0.5 font-medium ${m.amber} text-xs`,children:d.annotationReconnecting(r)}):null,n==="failed"||n==="auth-required"?cr("span",{"data-testid":"contact-map-error-badge",className:`ml-2 inline-flex items-center gap-1.5 rounded-full ${Y.rose} px-2 py-0.5 font-medium ${m.rose} text-xs`,title:n==="failed"?o??void 0:void 0,children:["\u26D4 ",n==="auth-required"?d.annotationAuthRequired:d.annotationLoadFailed(r),a?yt("button",{type:"button","data-testid":"contact-map-retry-button",onClick:a,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border ${$.rose} ${N.surface} px-1.5 font-semibold ${C} ${m.rose} transition-colors ${k.hoverRoseTint}`,children:d.annotationRetry}):null]}):null]})});ta.displayName="ContactMapAnnotation";an();import{useMemo as ti}from"react";Ht();an();ye();import{createContext as ws,useContext as Rs,useMemo as Ps}from"react";Ht();an();$r();var Ms=["indexWorker","levenshteinWorker","treeWorker"];function eo(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 ${ie(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${ie(n)}`)}}var to={setting:"workerUrls"},no=(e,t)=>{if(e===void 0)return;let{setting:n,keys:r=Ms,hints:i={}}=t;if(!rn(e))throw new TypeError(`[contact-map] ${n} must be a plain object or left out; got ${ie(e)}`);let o=Object.getOwnPropertyNames(e).map(d=>({key:d,url:e[d]})),a=o.find(({key:d,url:c})=>c!==void 0&&!r.includes(d));if(a!==void 0){let d=Object.hasOwn(i,a.key)?i[a.key]:void 0,c=d===void 0?Gn(a.key,r):void 0;throw new RangeError(`[contact-map] ${n} has a key it does not take (it takes ${r.join(", ")}${d===void 0?"":`; ${d}`}${c===void 0?"":`; did you mean ${JSON.stringify(c)}?`}); got ${ie(a.key)}`)}let u=Object.create(null);for(let{key:d,url:c}of o){let p=d;eo(n,p,c),c!==void 0&&(u[p]=c)}return u};function Gu(e,t=to){no(e,t)}function ro(e){eo("workerUrls","treeWorker",e)}var mn=(e,t,n=to)=>{let r=no(t,n);return{indexWorker:r?.indexWorker===void 0?e?.indexWorker:r.indexWorker,levenshteinWorker:r?.levenshteinWorker===void 0?e?.levenshteinWorker:r.levenshteinWorker,treeWorker:r?.treeWorker===void 0?e?.treeWorker:r.treeWorker}};import{jsx as na}from"react/jsx-runtime";var ao=e=>{if(!rn(e))throw new TypeError(`[contact-map] config must be a plain object; got ${ie(e)}`);let t=e;return{streamEndpoint:Re(t,"streamEndpoint"),openEmailsWithGmail:Re(t,"openEmailsWithGmail"),treeWorkerFactory:Re(t,"treeWorkerFactory"),workerUrls:mn(void 0,Re(t,"workerUrls")),locale:Re(t,"locale"),labels:Re(t,"labels")}},oo=({workerUrls:e,...t})=>{let{indexWorker:n,levenshteinWorker:r,treeWorker:i}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:n,levenshteinWorker:r,treeWorker:i})}))},_s=oo(ao({})),io=ws(_s),$s=Object.freeze({locale:"locale",labels:"labels"});function ra({config:e,chromeSurface:t,children:n}){let{streamEndpoint:r,openEmailsWithGmail:i,treeWorkerFactory:o,workerUrls:a,locale:u,labels:d}=ao(e),{indexWorker:c,levenshteinWorker:p,treeWorker:f}=a,l=Ps(()=>oo({streamEndpoint:r,openEmailsWithGmail:i,treeWorkerFactory:o,workerUrls:{indexWorker:c,levenshteinWorker:p,treeWorker:f},locale:u,labels:d}),[r,i,o,c,p,f,u,d]);return na(io.Provider,{value:l,children:na(_a,{locale:u,labels:d,surface:t,children:n})})}function Os({config:e,children:t}){return na(ra,{config:e,chromeSurface:$s,children:t})}function bt(){return Rs(io)}import{useCallback as aa,useEffect as Fs,useMemo as mr,useSyncExternalStore as so}from"react";Ht();var As=1e3,Ds=3e4,Ws=6;function ur(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 ${ie(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${ie(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 ${ie(e)}`)}var Hs=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}),Is=e=>Array.isArray(e.records),dr=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?.()};ur(t.endpoint),this.fetchFn=t.fetchFn??((...n)=>fetch(...n)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??As,this.maxRetryDelayMs=t.maxRetryDelayMs??Ds,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Ws,this.logger=t.logger??st}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,r=await this.streamOnce();if(r==="aborted")return;if(r==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(r==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(r==="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 i=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 ${i}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(i),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(n=>{let r=setTimeout(()=>{this.wakeRetryWait=null,n()},t);this.wakeRetryWait=()=>{clearTimeout(r),this.wakeRetryWait=null,n()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",n=new URLSearchParams;return this.lastCursor.contacted_at!==null&&n.set("cursor_contacted_at",this.lastCursor.contacted_at),n.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${n.toString()}`}async streamOnce(){this.activeController=new AbortController;try{let t=await this.fetchFn(this.buildStreamUrl(),{signal:this.activeController.signal,credentials:"same-origin"});if(t.status===401||t.status===403)return"auth-required";if(t.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(),r=new TextDecoder,i="",o=!1,a=!1;for(;;){let{done:u,value:d}=await n.read();if(u)break;let c=r.decode(d,{stream:!0}),p=(i+c).split(`
|
|
2
|
-
`);i=p.pop()??"";let f=!1;for(let l of p){let g=l.trim();if(!g)continue;let y;try{y=JSON.parse(g)}catch(x){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",x);continue}if("type"in y&&y.type==="METADATA"){Number.isSafeInteger(y.total)&&y.total>=0&&this.setState({totalCount:y.total});continue}if(!Is(y)){this.logger.warn("[ContactMapStream] server reported error:","error"in y?y.error:""),a=!0;continue}for(let x of y.records)x&&typeof x.person_id=="number"&&(this.recordMap.set(x.person_id,Hs(x)),f=!0);y.nextCursor&&(this.lastCursor=y.nextCursor),y.isLast&&(o=!0)}f&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return a?(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 Qe=null,Bs=e=>{if(Qe!==null&&Qe.endpoint===e)return Qe;if(ur(e),Qe===null)return Qe=new dr({endpoint:e}),Qe;if(Qe.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Qe.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 Qe},lm=()=>{Qe?.dispose(),Qe=null},zs=new Map,Us={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Vs=()=>{let{streamEndpoint:e}=bt();return mr(()=>(ur(e),e),[e])};function Ks(){let e=Vs(),t=aa(()=>Bs(e),[e]);Fs(()=>{let a=t();a.start(),a.retryNow()},[t]);let n=aa(a=>t().subscribe(a),[t]),r=so(n,()=>t().getState(),()=>Us),i=so(n,()=>t().getRecordMap(),()=>zs),o=aa(()=>t().retryNow(),[t]);return mr(()=>({...r,recordMap:i,retryNow:o}),[r,i,o])}var js=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 pr(){let{records:e,recordMap:t,isComplete:n,phase:r,loadedCount:i,totalCount:o,error:a,retryNow:u}=Ks(),d=mr(()=>js(e),[e]);return{context:mr(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:r==="failed",streamPhase:r,loadedCount:i,companyCount:d,totalCount:o,errorMessage:a?.message??null}),[e,t,n,r,i,d,o,a]),retryNow:u}}ye();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Lc,parseQuerySets as Mc}from"@aiquants/fuzzy-search";import{useFuzzySearch as wc}from"@aiquants/fuzzy-search/react";import Rc from"lucide-react/dist/esm/icons/search.js";import{useCallback as Sn,useEffect as vt,useMemo as Pt,useRef as Qo,useState as et,useTransition as Pc}from"react";import{useNavigation as _c,useSearchParams as $c}from"react-router";Xr();an();import{useCallback as Kt,useEffect as Gs,useRef as lo}from"react";var Rt=e=>{let t=lo(null),n=lo({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),r=e?.dragThreshold??4,i=Kt(f=>{let l=f.currentTarget,g=f.deltaY;!l||g===0||(f.preventDefault(),l.scrollBy({left:g,behavior:"smooth"}))},[]),o=Kt(f=>{t.current?.removeEventListener("wheel",i),t.current=f,f?.addEventListener("wheel",i,{passive:!1})},[i]);Gs(()=>()=>{t.current&&t.current.removeEventListener("wheel",i)},[i]);let a=Kt(f=>{if(f.pointerType==="touch")return;let l=n.current;l.isPointerDown=!0,l.isDragging=!1,l.startX=f.clientX,l.scrollLeft=f.currentTarget.scrollLeft,l.pointerId=f.pointerId,l.hasCapture=!1,l.pointerType=f.pointerType},[]),u=Kt(f=>{let l=n.current;if(!l.isPointerDown||l.pointerType==="touch")return;let g=f.currentTarget,y=f.clientX-l.startX;!l.isDragging&&Math.abs(y)>r&&(l.isDragging=!0,l.hasCapture||(g.setPointerCapture?.(f.pointerId),l.hasCapture=!0)),l.isDragging&&(f.preventDefault(),g.scrollLeft=l.scrollLeft-y)},[r]),d=Kt(f=>{let l=n.current;if(l.pointerType==="touch")return;let g=f.currentTarget;l.isPointerDown&&l.hasCapture&&g.hasPointerCapture?.(f.pointerId)&&g.releasePointerCapture(f.pointerId),l.isDragging&&(l.didDrag=!0,window.setTimeout(()=>{l.didDrag=!1},0)),l.isPointerDown=!1,l.isDragging=!1,l.pointerId=0,l.hasCapture=!1},[]),c=Kt(f=>{d(f)},[d]),p=Kt(f=>{n.current.didDrag&&(f.preventDefault(),f.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:o,onPointerDown:a,onPointerMove:u,onPointerUp:c,onPointerLeave:c,onPointerCancel:c,onClickCapture:p}};Ft();ye();import{DEFAULT_FUZZY_SEARCH_OPTIONS as qs}from"@aiquants/fuzzy-search";var fr=e=>{let{indexWorkerOptions:t,levenshteinWorkerOptions:n,...r}=qs;return{...r,autoSearchOnIndexRebuild:!1,multiTermOperator:"and",workerUrls:e,indexWorkerOptions:{...t},levenshteinWorkerOptions:{...n}}};fe();fe();Pn();import{jsx as co}from"react/jsx-runtime";function uo({value:e,max:t=100,className:n,indicatorClassName:r,...i}){let o=e===void 0,a=o?0:Math.min(100,Math.max(0,e/t*100));return co("div",{role:"progressbar","aria-valuenow":o?void 0:a,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:Le(`relative h-2 w-full overflow-hidden rounded-full ${Lt.progressTrack}`,n),...i,children:co("div",{"data-slot":"progress-indicator",className:Le(`h-full rounded-full ${qe.blue} transition-[width] duration-300 ease-in-out will-change-transform`,o&&"w-1/3 animate-progress-indeterminate",r),style:o?void 0:{width:`${a}%`}})})}Ee();var pn="view";import{useCallback as pc,useState as fc}from"react";import{useSearchParams as gc}from"react-router";ye();fe();Ee();Wt();import{Panel as So,PanelGroup as yl,PanelResizeHandle as bl}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Sl,VirtualScroll as vl,virtualScrollItemElementId as Cl}from"@aiquants/virtualscroll";import{lazy as xl,memo as Tl,Suspense as Nl,useCallback as Fe,useEffect as Eo,useId as vo,useLayoutEffect as Lo,useMemo as jt,useRef as fn,useState as Wn}from"react";var An={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},Dn={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function gr(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,n=t+e.scrollbarSafetyBuffer,r=n+e.hysteresisSafetyMargin,i=r-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:r,hysteresisWidth:i}}import{useCallback as Xs,useEffect as Ys,useState as Qs}from"react";var mo=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:r=4,minFallbackHeight:i=240}=t??{},[o,a]=Qs(600),u=Xs(()=>{if(typeof window>"u")return;let d=e.current;if(!d||d.offsetParent===null&&window.getComputedStyle(d).position!=="fixed")return;let c=L=>Number.parseFloat(L)||0,{top:p}=d.getBoundingClientRect(),f=d.parentElement?.getBoundingClientRect(),l=window.getComputedStyle(document.documentElement),g=c(l.getPropertyValue("--footer-height")),y=c(l.getPropertyValue("--header-height")),x=c(l.getPropertyValue("--scrollbar-height")),E=window.getComputedStyle(d),T=c(E.marginBottom),U=c(E.paddingBottom),z=window.innerHeight-g-x-r,b=f?Math.min(f.bottom,z):z,h=f?Math.max(f.top,y):y,v=Math.max(p,h),M=b-v-T-U,H=Number.isFinite(M)?Math.floor(M):0,S=H>0?H:i;S>0&&Number.isFinite(S)&&a(L=>Math.abs(L-S)>1?S:L)},[r,e,i]);return Ys(()=>{if(typeof window>"u")return;let d=null,c=null,p=null,f=null,l=()=>{d!==null&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{u()})};l(),c=window.setTimeout(()=>{l()},150);let g=e.current;return typeof ResizeObserver<"u"&&g&&(p=new ResizeObserver(()=>{l()}),p.observe(g),g.parentElement&&p.observe(g.parentElement)),n&&typeof MutationObserver<"u"&&(f=new MutationObserver(()=>{l()}),f.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",l),()=>{d!==null&&window.cancelAnimationFrame(d),c!==null&&window.clearTimeout(c),p&&p.disconnect(),f&&f.disconnect(),window.removeEventListener("resize",l)}},[e,n,u]),{viewportHeight:o,updateViewportHeight:u}};import{useCallback as St,useEffect as po,useRef as hr,useState as fo}from"react";var Js=600,go=8,yr=({ref:e,onSelect:t,resolveItem:n,item:r})=>{let[i,o]=fo(!1),[a,u]=fo(null),d=hr(null),c=hr(!1),p=hr(null),f=hr({onSelect:t,resolveItem:n,item:r});po(()=>{f.current={onSelect:t,resolveItem:n,item:r}},[t,n,r]);let l=St(()=>{typeof window>"u"||d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),g=St(()=>{p.current&&(l(),p.current=null)},[l]),y=St(h=>{typeof window>"u"||h.button!==0&&h.pointerType==="mouse"||(l(),c.current=!1,p.current={x:h.clientX,y:h.clientY,pointerId:h.pointerId},d.current=window.setTimeout(()=>{let v=f.current,M=null;v.item!==void 0?M=v.item:v.resolveItem&&h.target&&(M=v.resolveItem(h.target)),M!==null&&(c.current=!0,v.onSelect?.(M),u(M),o(!0)),g()},Js))},[l,g]),x=St(h=>{p.current&&h.pointerId===p.current.pointerId&&(l(),p.current=null)},[l]),E=St(h=>{c.current&&(h.preventDefault(),h.stopPropagation(),h.type==="click"&&(c.current=!1))},[]),T=St(()=>{c.current=!1},[]),U=St(h=>{if(!p.current||h.pointerId!==p.current.pointerId)return;let v=Math.abs(h.clientX-p.current.x),M=Math.abs(h.clientY-p.current.y);(v>go||M>go)&&(l(),p.current=null)},[l]),z=St(h=>{(i||d.current!==null)&&(h.preventDefault(),h.stopPropagation())},[i]),b=St(()=>{o(!1),u(null),c.current=!1,p.current=null},[]);return po(()=>{let h=e.current;if(!(h&&typeof window<"u"))return;let v=[["pointerdown",y,void 0],["pointerup",x,void 0],["pointercancel",x,void 0],["pointermove",U,void 0],["pointerleave",x,void 0],["contextmenu",z,void 0]],M=[["mousedown",E,!0],["mouseup",E,!0],["click",E,!0],["pointerdown",T,!0],["keydown",T,!0],["contextmenu",z,!0],["pointerup",x,!0],["pointercancel",x,!0]];for(let[H,S,L]of v)h.addEventListener(H,S,L);for(let[H,S,L]of M)window.addEventListener(H,S,L);return()=>{for(let[H,S,L]of v)h.removeEventListener(H,S,L);for(let[H,S,L]of M)window.removeEventListener(H,S,L);l()}},[e,y,x,U,E,T,z,l]),{isPopupVisible:i,popupItem:a,handleClosePopup:b}};import{useCallback as Zs,useEffect as el,useState as ho,useSyncExternalStore as tl}from"react";function br(e,t,n){let r=n?.mediaQuery??"(min-width: 1024px)",i=tl(Zs(p=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let f=window.matchMedia(r);return f.addEventListener("change",p),()=>f.removeEventListener("change",p)},[r]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(r).matches:!0,()=>!1),[o,a]=ho(!1),[u,d]=ho(0);return el(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let p=e.current;if(!p)return;let f=new ResizeObserver(l=>{for(let g of l){if(g.target!==p)continue;let y=0;g.borderBoxSize&&g.borderBoxSize.length>0?y=g.borderBoxSize[0].inlineSize:y=g.contentRect.width,!(!Number.isFinite(y)||y<=0)&&(d(y),a(x=>x&&y>=t.expandThreshold?!1:!x&&y<t.collapseThreshold?!0:x))}});return f.observe(p),()=>f.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:i&&!o,isContainerNarrow:o,isMediaMatches:i,containerWidth:u}}ye();Ht();var yo=e=>e.isComposing||e.keyCode===229;var bo=(e,t)=>{if(al(t),e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||yo(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 rl(e.key)?{kind:"move",index:t.startIndex,direction:1}:null;let r=t.activeIndex;switch(e.key){case"ArrowDown":return{kind:"move",index:Math.min(r+1,n),direction:1};case"ArrowUp":return{kind:"move",index:Math.max(r-1,0),direction:-1};case"PageDown":return{kind:"move",index:Math.min(r+t.pageSize,n),direction:1};case"PageUp":return{kind:"move",index:Math.max(r-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}},nl=new Set(["ArrowDown","ArrowUp","PageDown","PageUp","Home","End"]),rl=e=>nl.has(e),al=e=>{let{activeIndex:t,startIndex:n,itemCount:r,pageSize:i}=e;if(!Number.isInteger(r)||r<0)throw new RangeError(`[contact-map] listbox itemCount must be a non-negative integer; got ${ie(r)}`);if(!Number.isInteger(i)||i<1)throw new RangeError(`[contact-map] listbox pageSize must be an integer of at least 1; got ${ie(i)}`);let o=a=>Number.isInteger(a)&&a>=0&&a<r;if(r>0&&!o(n))throw new RangeError(`[contact-map] listbox startIndex must be an index below ${r}; got ${ie(n)}`);if(t!==null&&!o(t))throw new RangeError(`[contact-map] listbox activeIndex must be null or an index below ${r}; got ${ie(t)}`)};fe();ye();Ur();fe();Rn();Pn();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as ol,useOverlayPresence as il,useSwipeOverlayDialog as sl}from"@aiquants/swipe-overlay";import{useCallback as ll,useId as cl}from"react";import{jsx as Sr,jsxs as oa}from"react/jsx-runtime";var dl=Le(Xn,"flex overflow-hidden"),ul=Le(Qn,"motion-safe:transition-opacity motion-safe:duration-200"),ml=`relative ml-auto flex h-full w-full max-w-lg flex-col ${N.surface} shadow-xl motion-safe:transition-[transform] motion-safe:duration-200 motion-safe:ease-out`,pl=`flex shrink-0 items-center justify-between gap-3 ${B.borderSubtle} border-b px-3 py-2`,fl=`min-w-0 truncate font-semibold text-base ${s.fg} outline-none`,gl=`inline-flex min-h-11 min-w-11 shrink-0 touch-manipulation items-center justify-center rounded-full border ${B.borderControl} px-4 font-medium ${s.fgSecondary} text-sm ${k.hoverMuted} ${wt}`,hl="flex min-h-0 flex-1 flex-col overflow-y-auto p-3",vr=({isOpen:e,onClose:t,children:n,className:r,title:i})=>{let o=ne(),a=cl(),u=il(e),d=ll(y=>y.ownerDocument.getElementById(a),[a]),{dialogProps:c,backdropProps:p,panelProps:f,attemptClose:l,isSwiping:g}=sl({isOpen:e,onClose:t,isCloseBlocked:Jn,skipWhenTextSelected:!0,initialFocus:d});return u?oa("dialog",{...c,"data-testid":"contact-map-mobile-overlay","aria-labelledby":a,className:Le(dl,e&&!g?"pointer-events-auto":"pointer-events-none"),style:Yn,children:[Sr("div",{...p,"data-contact-map-overlay-backdrop":"",className:Le(ul,e?"opacity-100":"opacity-0")}),oa("div",{...f,"data-contact-map-overlay-panel":"",className:Le(ml,e?"pointer-events-auto":"pointer-events-none",r),children:[oa("div",{className:pl,children:[Sr("h2",{id:a,tabIndex:-1,className:fl,children:i===void 0?o.overlayTitle:i}),Sr("button",{type:"button",className:gl,onClick:()=>l(),children:o.close})]}),Sr("div",{"data-contact-map-overlay-body":"",className:hl,style:ol,children:n})]})]}):null};Rn();Ee();Gr();import{Fragment as Hl,jsx as K,jsxs as Je}from"react/jsx-runtime";var kl=xl(async()=>({default:(await Promise.resolve().then(()=>(Ya(),Xa))).default})),ia=64,Co="h-[64px]",xo=240,El=4,sa=gr(An),Ll=An.listPanelMinWidth,Ml=An.detailPanelMinWidth,wl=An.handleThickness,tp=sa.collapseThreshold,np=sa.expandThreshold,Rl=({contactData:e})=>{let t=ne(),n=Ge(e?.full_name)??t.noName,r=Ge(e?.title)??"-",i=Ge(e?.company_name)??"-",o=Ge(e?.department)??"-",a=tn(e).value??"-",u=nn(e).value??"-",d=at(e?.updated_at,t.recordDateTime);return K(tr,{fullName:n,title:r,companyName:i,department:o,phoneNumber:u,email:a,updatedAtText:d})},Pl=e=>({"--contact-panel-height":`${e}px`}),_l=e=>typeof e=="object"&&e!==null&&"item"in e,$l=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,Ol=(e,t)=>{for(let n of e){let r=Dt(n);if(r?.person_id===t)return r}return null},To=(e,t)=>t!==null&&Dt(e)?.person_id===t,No=(e,t,n)=>{for(let r=t;r>=0&&r<e.length;r+=n){let i=Dt(e[r]);if(i!==null)return{index:r,personId:i.person_id}}return null},ko=(e,t,n)=>{let r=No(e,t,n);return r!==null?r:No(e,t-n,n===1?-1:1)},la=(e,t,n)=>{let{viewportHeight:r}=mo(t,{enableMutationObserver:!0,bottomGap:El,minFallbackHeight:xo}),[i,o]=Wn(0),a=Fe(()=>{let f=n.current,l=t.current;if(!(f&&l))return;let g=f.getBoundingClientRect(),y=l.getBoundingClientRect(),x=Math.ceil(y.top-g.top);Number.isFinite(x)&&x>0&&o(E=>Math.abs(E-x)>1?x:E)},[t,n]);Lo(()=>{if(!e)return;a();let f=requestAnimationFrame(a);return window.addEventListener("resize",a),()=>{cancelAnimationFrame(f),window.removeEventListener("resize",a)}},[e,a]);let u=r>0?r:xo,d=i>0?i:0,c=u+d,p=jt(()=>Pl(c),[c]);return{normalizedViewportHeight:u,normalizedDetailHeight:c,panelSizingStyle:p}},Al=new Set,Dl=()=>{let[e,t]=Wn(Al),n=Fe((r,i)=>{t(o=>{if(o.has(r)===i)return o;let a=new Set(o);return i?a.add(r):a.delete(r),a})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},Wl=(e,t,n)=>{let r=fn(n);Lo(()=>{r.current=n},[n]),Eo(()=>{if(e!==null)return r.current(e,t),()=>{r.current(e,!1)}},[e,t])},Mo=Tl(({entry:e,index:t,itemCount:n,listboxId:r,isSelected:i,isActive:o,onSelect:a,onLongPressSelect:u,searchQuery:d,enableHighlighting:c,openEmailsWithGmail:p,openGmailCompose:f,onPopupVisibilityChange:l})=>{let g=ne(),y=fn(null),x=K("div",{className:Co}),E=_l(e)?e:null,T=Dt(e),{isPopupVisible:U,handleClosePopup:z}=yr({ref:y,onSelect:u,item:T?.person_id});if(Wl(T?.person_id??null,U,l),!e||!T)return x;let{person_id:b}=T,h=t%2===0?N.surface:N.subtle,v=`${Y.blue} ring-1 ${k.selectedRing}`,M=i?v:h,H=["B","F"].map(S=>$l(S,S==="B"?E?.baseScore:E?.score)).filter(Boolean);return Je("div",{ref:y,id:Cl(r,b),className:`flex ${Co} w-full items-center overflow-hidden ${B.borderSubtle} border-b px-4 py-2 text-left transition-colors ${k.hoverBlueTint} ${M} ${Da}`,style:{height:ia},role:"option","aria-selected":i,"aria-posinset":t+1,"aria-setsize":n,"data-selected":i?"true":"false","data-contact-map-row-active":o?"":void 0,onClick:()=>a(b),children:[Je("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[K("div",{className:`whitespace-nowrap font-medium ${s.fgSecondary} text-xs leading-tight`,children:g.listRowNumber(t+1)}),K("div",{className:`truncate ${Mt} ${s.fgSecondary} leading-tight`,children:b}),K("div",{className:`flex items-center gap-1 whitespace-nowrap font-mono ${Mt} ${s.fgMuted} leading-tight`,children:H.length?H.map(S=>K("span",{children:S},S)):K("span",{children:"-"})})]}),K(Nl,{fallback:K(Rl,{contactData:T}),children:K(kl,{contactData:T,searchTerm:d,enableHighlighting:c,openEmailsWithGmail:p,openGmailCompose:f,isPopupVisible:U,onRequestClose:z})})]})});Mo.displayName="ContactListRow";var wo=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:r,hasSearchTerm:i,enableHighlighting:o,openEmailsWithGmail:a,isSearchTabActive:u}=e,{locale:d,labels:c,engineLabels:p}=Pe(),f=fn(null),l=fn(null),[g,y]=Wn(null),{normalizedViewportHeight:x,panelSizingStyle:E}=la(u,l,f),{isAnyPopupVisible:T,handlePopupVisibilityChange:U}=Dl(),z=jt(()=>({enablePointerDrag:!T,enableKeyboardNavigation:!1}),[T]),b=jt(()=>i?n:t,[i,n,t]),[h,v]=Wn(null),M=Fe(X=>{y(X),v(X)},[]),H=Fe(X=>{if(!a)return;let he=X.trim();if(!he||he==="-"||typeof window>"u")return;let Q=ft(he,!0);Q&&window.open(Q,"_blank","noopener,noreferrer")},[a]),[S,L]=Wn(!1),ae=Fe(()=>L(!1),[]),I=Fe(X=>{M(X),L(!0)},[M]),be=vo(),oe=vo(),W=fn(null),A=b.length,q=Fe((X,he)=>K(Mo,{entry:X,index:he,itemCount:A,listboxId:be,isSelected:To(X,g),isActive:To(X,h),onSelect:I,onLongPressSelect:M,searchQuery:r,enableHighlighting:o,openEmailsWithGmail:a,openGmailCompose:H,onPopupVisibilityChange:U}),[A,be,g,h,I,M,r,o,a,H,U]),me=jt(()=>{let X=new Map;return b.forEach((he,Q)=>{let ut=Dt(he);ut!==null&&X.set(ut.person_id,Q)}),X},[b]),Se=h===null?null:me.get(h)??null,Oe=g===null?null:me.get(g)??null,_t=Math.max(1,Math.floor(x/ia)),Xt=Fe(X=>{if(X.target.id!==be)return;let he=bo(X.nativeEvent,{activeIndex:Se,startIndex:Oe===null?0:Oe,itemCount:A,pageSize:_t});if(he===null)return;if(X.preventDefault(),he.kind==="activate"){Se!==null&&h!==null&&I(h);return}let Q=ko(b,he.index,he.direction);Q!==null&&(v(Q.personId),W.current?.scrollToIndex(Q.index,{align:"nearest"}))},[be,Se,Oe,A,_t,h,I,b]),Ct=Fe(X=>{if(X.target.id!==be||Se!==null||!X.target.matches(":focus-visible"))return;let he=ko(b,Oe===null?0:Oe,1);he!==null&&v(he.personId)},[be,Se,Oe,b]),Yt=jt(()=>({id:be,role:"listbox",tabIndex:0,"aria-label":c.listboxLabel,"aria-describedby":oe}),[be,c.listboxLabel,oe]),ve=Fe(X=>b[X],[b]),Qt=Fe(X=>Dt(b[X])?.person_id??`row-${X}`,[b]),Ve=Fe(()=>ia,[]),dt=jt(()=>({enabled:!0,renderVisual:Sl}),[]),Ke=jt(()=>g===null?null:Ol(b,g),[g,b]);Eo(()=>{g!==null&&!Ke&&y(null)},[g,Ke]);let He=fn(null),{isTwoColumn:Jt}=br(He,sa);S&&(Jt||Ke===null)&&L(!1);let xt=Je("div",{ref:f,className:"flex min-h-0 flex-1 flex-col gap-1",children:[K("div",{className:`hidden rounded-t-lg border ${B.borderSubtle} ${N.subtle} px-4 py-2 transition-colors sm:block`,children:Je("div",{className:"flex items-center",children:[Je("div",{className:`flex w-28 shrink-0 flex-col items-center gap-0.5 text-center ${w} ${s.fgSecondary} uppercase tracking-wider`,children:[K("span",{className:`font-semibold ${s.fg} text-xs`,children:c.columnNo}),K("span",{className:"leading-tight",children:c.columnId}),K("span",{className:"whitespace-nowrap leading-tight",children:c.columnScore})]}),Je("div",{className:`hidden w-full grid-cols-3 gap-2 font-medium ${s.fgSecondary} text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[Je("div",{className:"flex flex-col gap-0.5",children:[K("span",{children:c.columnName}),K("span",{className:`font-normal ${w} ${s.fgMuted} uppercase tracking-wider`,children:c.columnTitle})]}),Je("div",{className:"flex flex-col gap-0.5",children:[K("span",{children:c.columnCompany}),K("span",{className:`font-normal ${w} ${s.fgMuted} uppercase tracking-wider`,children:c.columnDepartment})]}),Je("div",{className:"flex flex-col gap-0.5",children:[K("span",{children:c.columnPhone}),K("span",{className:`font-normal ${w} ${s.fgMuted} uppercase tracking-wider`,children:c.columnEmail})]}),K("div",{className:"hidden items-end justify-end xl:flex",children:K("span",{className:`font-normal ${w} ${s.fgMuted} uppercase tracking-wider`,children:c.columnUpdatedAt})})]})]})}),K("p",{id:oe,hidden:!0,children:c.listKeyboardHelp}),K("div",{ref:l,className:"flex-1",onKeyDown:Xt,onFocus:Ct,children:K(vl,{ref:W,contentProps:Yt,activeItemIndex:A===0?void 0:Se,activeItemVisibleInset:Wa,itemCount:A,getItemKey:Qt,behaviorOptions:z,getItem:ve,getItemHeight:Ve,viewportSize:x,overscanCount:10,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:dt},locale:d,labels:p,className:`w-full rounded-b-lg border ${B.borderSubtle} border-t-0 ${N.surface} pr-0.75 transition-colors`,children:(X,he)=>q(X,he)})}),n.length===0&&i?K("div",{className:"py-8 text-center",children:K("p",{className:s.fgMuted,children:c.listNoSearchResults})}):null,A===0&&!i?K("div",{className:"py-8 text-center",children:K("p",{className:s.fgMuted,children:c.listNoData})}):null]});return K("div",{ref:He,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:E,children:Jt?Je(yl,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[K(So,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:Ll,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:xt}),K(bl,{id:"contact-map-list-handle",thickness:wl,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:`cursor-col-resize rounded transition-colors ${k.hoverMuted} focus:outline-none focus-visible:ring-2 ${k.focusVisibleRing} ${k.ringOffsetSurface} focus-visible:ring-offset-1`,"aria-label":c.listResizeHandle}),K(So,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:Ml,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:K(un,{placement:"pane",contact:Ke,searchTerm:r,enableHighlighting:o})})]}):Je(Hl,{children:[xt,Ke?K(vr,{isOpen:S,onClose:ae,title:c.detailHeading,children:K(un,{placement:"overlay",contact:Ke,searchTerm:r,enableHighlighting:o})}):null]})})};Wt();import{DirectoryTree as Xl}from"@aiquants/directory-tree";import{Panel as Do,PanelGroup as Yl,PanelResizeHandle as Ql}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Jl}from"@aiquants/virtualscroll";import Zl from"@heroicons/react/24/solid/FolderMinusIcon.js";import ec from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as Be,useEffect as gn,useMemo as Ze,useRef as Nr,useState as qt}from"react";import{createPortal as tc}from"react-dom";var ca=(e,t)=>e&&e.trim()||t;import{useEffect as Il,useRef as Cr,useState as Fl}from"react";var Ro=(e,t=250)=>{let[n,r]=Fl(e),i=Cr(null),o=Cr(e),a=Cr(null),u=Cr(!1);return Il(()=>{if(!u.current){u.current=!0,r(e),o.current=e;return}o.current=n,i.current=null;let d=c=>{i.current??(i.current=c);let p=c-i.current,f=Math.min(1,Math.max(0,p/t)),l=1-(1-f)**3,g=Math.max(0,Math.round(o.current+(e-o.current)*l));r(g),f<1&&(a.current=requestAnimationFrame(d))};return a.current=requestAnimationFrame(d),()=>{a.current!==null&&cancelAnimationFrame(a.current)}},[e,t]),Math.max(0,n)};Ht();import{useCallback as da,useEffect as ua,useMemo as Po,useRef as Bl,useSyncExternalStore as zl}from"react";ye();var Ul=250,Vl=4e3,xr=3,_o={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},$o=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,Tr=class{constructor(t,{workerSource:n,logger:r=st}){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>=xr){this.logger.error(`[TreeWorker] the tree Worker failed ${xr} times in a row; the tree stops updating until ${_o[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Ul*2**(this.consecutiveFailures-1),Vl);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${xr})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let r=this.lastSyncedNaming;r!==null&&this.syncRecords(this.lastSyncedRecords,r)},n)};if(typeof n!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${ie(n)}`);if(!Object.hasOwn(_o,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${ie(n)}`);this.workerFactory=t,this.workerSource=n,this.logger=r}updateState(){let t=this.postedCount>(this.latestSnapshot?.consumedRecords??0);this.state.snapshot===this.latestSnapshot&&this.state.isBuilding===t||(this.state={snapshot:this.latestSnapshot,isBuilding:t},this.notify())}notify(){for(let t of this.listeners)t()}ensureWorker(){if(this.consecutiveFailures>=xr||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||!$o(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let r=this.ensureWorker();if(!r)return;let i=this.workerNeedsReset,o=this.postedNaming===null||!$o(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,r.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),this.updateState()),t.length>this.postedCount){let a=t.slice(this.postedCount);this.postedCount=t.length,r.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:a}),this.updateState()}i&&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}}},Kl=e=>{if(e!==void 0)return new Worker(e,{type:"module"});let t=typeof import.meta<"u"?import.meta.url:void 0;if(t){let r=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(r,t),{type:"module"})}throw new Error("[contact-map] the tree Worker needs workerUrls.treeWorker in a build without import.meta.url (CommonJS)")},Gt=null,Oo=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),jl=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},Gl=e=>{if(ro(e),Gt===null){let t=new Tr(()=>Kl(e),{workerSource:"workerUrls.treeWorker"});return Gt={session:t,workerUrl:e},t}if(Gt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${Oo(Gt.workerUrl)} and cannot also load it from ${Oo(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return Gt.session},fp=()=>{Gt?.session.reset(),Gt=null},ql={snapshot:null,isBuilding:!1};function Ao(e,t=!1){let n=bt(),r=n.treeWorkerFactory,i=n.workerUrls?.treeWorker,{labels:o}=Pe(),a=o.uncategorizedCompany,u=o.noName,d=Po(()=>({uncategorizedCompany:a,unnamedPerson:u}),[a,u]),c=Bl(r);ua(()=>{c.current=r},[r]);let p=r!==void 0,f=p?void 0:i,l=Po(()=>p?new Tr(()=>jl(c.current)(),{workerSource:"treeWorkerFactory"}):null,[p]),g=da(()=>l===null?Gl(f):l,[l,f]),y=da(E=>g().subscribe(E),[g]),x=da(()=>g().getState(),[g]);return ua(()=>{let E=g();E.syncRecords(e,d),t&&E.finalize()},[g,e,t,d]),ua(()=>{if(l!==null)return()=>l.stop()},[l]),zl(y,x,()=>ql)}ye();fe();Ee();jr();ar();import{Fragment as mc,jsx as j,jsxs as $e}from"react/jsx-runtime";var fa=gr(Dn),nc=Dn.listPanelMinWidth,rc=Dn.detailPanelMinWidth,ac=Dn.handleThickness,Ip=fa.collapseThreshold,Fp=fa.expandThreshold,oc=(e,t)=>{let{searchQuery:n,enableHighlighting:r}=t,i=ca(e.full_name,t.noName),o=ca(e.title,""),a=j(Ne,{text:i,query:n,enabled:r});return o?$e("span",{className:"flex items-center gap-1.5",children:[j("span",{children:a}),j("span",{className:`${s.fgMuted} text-xs`,children:j(Ne,{text:o,query:n,enabled:r})})]}):a},ic="contact-map-tree h-full w-full",sc={hoverClassName:N.muted,directorySelectedClassName:`${Y.sky} ${k.treeNameSky}`,itemSelectedClassName:`${Y.sky} ${k.treeNameSky}`},ma="h-4 w-4 shrink-0 transition-colors duration-150",lc=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),kr=null,Wo=null,Hn=new Map,Ho="",Io=null,Fo=null,cc=(e,t,n,r,i)=>{let o=`${n?"icons":"plain"}#${r}#${i.noName}`;(o!==Ho||i.formatDirectoryName!==Io||t!==Fo)&&(Hn.clear(),Ho=o,Io=i.formatDirectoryName,Fo=t);let a={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},u=new Set;for(let d of e){u.add(d.absolutePath);let c=`${d.name}\0${d.memberCount}`,p=Hn.get(d.absolutePath);(!p||p.signature!==c)&&(p={signature:c,result:Uo([d],t,n,{searchQuery:"",enableHighlighting:!1,noName:i.noName,formatDirectoryName:i.formatDirectoryName})},Hn.set(d.absolutePath,p));let f=p.result;f.entries.length>0&&a.entries.push(f.entries[0]);for(let[l,g]of f.personPathMap){let y=a.personPathMap.get(l);if(y)for(let x of g)y.add(x);else a.personPathMap.set(l,new Set(g))}for(let[l,g]of f.contactByPath)a.contactByPath.set(l,g);for(let[l,g]of f.ancestorsByPath)a.ancestorsByPath.set(l,g);a.totalCount+=f.totalCount,!a.firstPerson&&f.firstPerson&&(a.firstPerson=f.firstPerson)}for(let d of Hn.keys())u.has(d)||Hn.delete(d);return a},pa=e=>e.isSelected||e.isItemSelected?m.sky:e.isExpanded&&e.isDirectory?s.fgSecondary:s.fgMuted,zo=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...zo(n.children)));return t},dc=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Uo=(e,t,n,r,i)=>{let o=new Map,a=new Map,u=new Map,d=0,c=null,p=(l,g)=>{let y=[...g,l.absolutePath];u.set(l.absolutePath,y);let x,E,T=l.type==="directory"?r.formatDirectoryName(l.name,dc(l)):l.name,U=j(Ne,{text:T,query:r.searchQuery,enabled:r.enableHighlighting});if(l.type==="file"&&l.personId){if(i&&!i.has(l.personId))return null;let z=t.get(l.personId);if(z){a.set(l.absolutePath,z),o.has(l.personId)||o.set(l.personId,new Set);let b=o.get(l.personId);b&&b.add(l.absolutePath),d++,c||(c={personId:l.personId,path:l.absolutePath}),n&&(E=h=>{let v=pa(h);return h.isSelected||h.isItemSelected||l.isPrimary&&(v=l.title?m.indigo:m.orange),j(n.person,{"aria-hidden":"true",className:`${ma} ${v}`})},l.title&&(U=oc(z,r))),U=j("span",{"data-contact-path":l.absolutePath,className:"block w-full",children:U})}}else if(l.children){let z=l.children.map(b=>p(b,y)).filter(b=>b!==null);if(i&&z.length===0)return null;if(x=z,n){let b=l.relativePath.startsWith("company:")?n.company:n.department;E=h=>j(b,{"aria-hidden":"true",className:`${ma} ${pa(h)}`})}}return{name:T,label:U,type:l.type,absolutePath:l.absolutePath,relativePath:l.relativePath,icon:E,children:x}};return{entries:e.map(l=>p(l,[])).filter(l=>l!==null),personPathMap:o,contactByPath:a,ancestorsByPath:u,firstPerson:c,totalCount:d}},uc=(e,t,n)=>{let r=new Set,i=new Set,o=new Map;t.forEach((p,f)=>{o.set(p.item.person_id,f)});for(let p of t){let f=p.item.person_id,l=e.personPathMap.get(f);if(l)for(let g of l){r.add(g);let y=e.ancestorsByPath.get(g);if(y){for(let x of y)r.add(x);n&&y.length>0&&i.add(y[0])}}}let a=new Map,u=p=>{let f=a.get(p.absolutePath);if(f!==void 0)return f;let l=1/0;if(p.type==="file"){let g=e.contactByPath.get(p.absolutePath);g&&(l=o.get(g.person_id)??1/0)}else if(p.children)for(let g of p.children)l=Math.min(l,u(g));return a.set(p.absolutePath,l),l},d=(p,f=0)=>p.filter(l=>n&&f===0&&i.has(l.absolutePath)?!0:r.has(l.absolutePath)).map(l=>n&&f===0&&i.has(l.absolutePath)?l:l.type==="directory"&&l.children?{...l,children:d(l.children,f+1)}:l).sort((l,g)=>f===0?u(l)-u(g):0),c=d(e.entries);return{...e,entries:c}},Bo=(e,t,n)=>{if(e===null)return null;let r=n.get(e);if(r===void 0)return null;if(t!==null&&r.has(t))return t;let i=r.values().next();return i.done?null:i.value},Vo=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:r,filteredItems:i,hasSearchTerm:o,isSearchInProgress:a,isSearchTabActive:u}=e,{locale:d,labels:c,treeLabels:p}=Pe(),f=c.noName,l=c.treeDirectoryName,g=Ze(()=>({noName:f,formatDirectoryName:l}),[f,l]),[y,x]=qt(null),[E,T]=qt(!1),{snapshot:U,isBuilding:z}=Ao(n,e.isStreamingComplete),b=U?.tree??null,h=U?.rebuildEpoch??0,v=Ze(()=>b?cc(b,r,y,h,g):null,[b,r,y,h,g]),M=Ze(()=>{if(!b)return null;if(!o)return v;let D;E||(D=new Set(i.map(pe=>pe.item.person_id)));let le=Uo(b,r,y,{...g,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},D);return uc(le,i,E)},[b,v,r,y,e.searchQuery,e.enableHighlighting,o,i,E,g]),H=Ze(()=>M||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[M]),S=o&&e.errorMessage!==null,[L,ae]=qt(H),I=Nr(!1);gn(()=>{if(!(a||S)){I.current=!!b,ae(H);return}!I.current&&b&&H.entries.length>0&&(I.current=!0,ae(H))},[H,b,a,S]);let be=o&&(a||S)?L:H,{entries:oe,personPathMap:W,contactByPath:A,totalCount:q}=be,me=Ze(()=>zo(oe),[oe]),[Se,Oe]=qt(()=>Wo??new Set),_t=Be(D=>!Se.has(D),[Se]),Xt=Be(D=>{Oe(le=>{let pe=new Set(le);return pe.has(D)?pe.delete(D):pe.add(D),pe})},[]),Ct=Be(D=>{D.length!==0&&Oe(le=>{let pe=new Set(le);for(let pt of D)pe.add(pt);return pe})},[]),Yt=Be(D=>{Oe(le=>{if(le.size===0)return le;let pe=!1,pt=new Set(le);for(let V of D)pt.delete(V)&&(pe=!0);return pe?pt:le})},[]);gn(()=>{Wo=Se},[Se]),gn(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[ve,Qt]=qt(null),[Ve,dt]=qt(null),[Ke,He]=qt(!1),Jt=Be(()=>He(!1),[]),xt=Nr(null),X=Nr(null),{normalizedViewportHeight:he,panelSizingStyle:Q}=la(u,X,xt),ut=Be(D=>{let le=A.get(D);return le?(ve!==le.person_id&&Qt(le.person_id),D!==Ve&&dt(D),!0):!1},[A,Ve,ve]),$t=Be(D=>{ut(D)&&He(!0)},[ut]),xn=Be(D=>{$t(D.entry.absolutePath)},[$t]),Tt=Be(D=>D instanceof Element?D.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:Ae,popupItem:Tn,handleClosePopup:Nn}=yr({ref:X,resolveItem:Tt,onSelect:ut}),tt=Be(D=>{if(!e.openEmailsWithGmail)return;let le=D.trim();if(!le||le==="-"||typeof window>"u")return;let pe=ft(le,!0);pe&&window.open(pe,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),Nt=Tn?A.get(Tn):null,nt=Ae&&Nt!==null&&Nt!==void 0;gn(()=>{Ae&&!Nt&&Nn()},[Ae,Nt,Nn]);let Ot=Ze(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Jl}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),kt=Ze(()=>lc(Ot,he,nt),[Ot,he,nt]);gn(()=>{let D=!1;return typeof window>"u"?()=>{D=!0}:kr?(x(kr),()=>{D=!0}):((async()=>{try{let[pe,pt,V,J]=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(D)return;let xe=pe.default,rt=pt.default,Rr=V.default,Ta=J.default;xe&&rt&&Rr&&Ta&&(kr={company:xe,department:rt,title:Rr,person:Ta},x(kr))}catch(pe){st.warn("Failed to load lucide icons",pe)}})(),()=>{D=!0})},[]);let At=Ze(()=>{if(!y)return;let D=J=>xe=>j(J,{"aria-hidden":"true",className:`${ma} ${pa(xe)}`}),le={company:D(y.company),department:D(y.department),title:D(y.title)},pe=D(y.person),pt=J=>J in le,V=J=>{let[xe]=J.entry.relativePath.split(":",1);return(pt(xe)?le[xe]:le.company)(J)};return{directory:V,directoryExpanded:V,file:pe}},[y]),Zt=Be(()=>{Oe(D=>D.size===0?D:new Set)},[]),Lr=Be(()=>{me.length>0&&Ct(me)},[me,Ct]),Et=Bo(ve,Ve,W);gn(()=>{let D=Bo(ve,Ve,W);if(D===null){ve!==null&&Qt(null),Ve!==null&&dt(null);return}D!==Ve&&dt(D)},[ve,Ve,W]);let je=Et===null?null:A.get(Et)??null,kn=e.isStreamingComplete,Mr=e.isStreamingFailed,Fn=kn&&n.length===0,Bn=(z||!b)&&!Fn,zn=Ro(q,250),mt=b!==null||Fn,en=$e("div",{className:"flex flex-wrap items-center gap-1.5",children:[$e("span",{className:`inline-flex h-5 items-center gap-1 rounded ${N.muted} px-1.5 font-medium font-mono ${w} ${s.fgSecondary}`,title:c.treeNodeCountTitle,children:[j("span",{children:"\u{1F333}"})," ",c.treeNodeCountLabel," ",mt?c.treeNodeCount(zn):"\u2026"]}),Mr&&!kn?$e("span",{className:`inline-flex h-5 items-center gap-1 rounded border ${$.rose} ${Y.rose} px-1.5 font-medium ${w} ${m.rose}`,title:c.treeStreamInterruptedTitle,children:[j("span",{className:`h-1.5 w-1.5 rounded-full ${qe.rose}`}),j("span",{children:"\u26D4"})," ",c.treeStreamInterrupted]}):kn?Bn?$e("span",{className:`inline-flex h-5 items-center gap-1 rounded border ${$.amber} ${Y.amber} px-1.5 font-medium ${w} ${m.amber}`,title:c.treeBuildingTitle,children:[$e("span",{className:"relative flex h-1.5 w-1.5",children:[j("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${qe.amber}`}),j("span",{className:`relative inline-flex h-1.5 w-1.5 rounded-full ${qe.amber}`})]}),j("span",{children:"\u{1F33F}"})," ",c.treeBuilding]}):$e("span",{className:`inline-flex h-5 items-center gap-1 rounded border ${$.emerald} ${Y.emerald} px-1.5 font-medium ${w} ${m.emerald}`,title:c.treeCompleteTitle,children:[j("span",{className:`h-1.5 w-1.5 rounded-full ${qe.emerald}`}),j("span",{children:"\u2705"})," ",c.treeComplete]}):$e("span",{className:`inline-flex h-5 items-center gap-1 rounded border ${$.sky} ${Y.sky} px-1.5 font-medium ${w} ${m.sky}`,title:c.treeStreamLoadingTitle,children:[$e("span",{className:"relative flex h-1.5 w-1.5",children:[j("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${qe.sky}`}),j("span",{className:`relative inline-flex h-1.5 w-1.5 rounded-full ${qe.sky}`})]}),j("span",{children:"\u23F3"})," ",c.treeStreamLoading]}),o&&$e("button",{type:"button",onClick:()=>T(!E),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${E?`${Y.blue} ${m.blue}`:`${s.fgMuted} ${k.hoverMuted}`}`,title:c.treeShowEntireCompanyTitle,children:[j("span",{children:"\u{1F3E2}"})," ",c.treeShowEntireCompany]}),me.length>0?$e("div",{className:"flex items-center gap-1",children:[j("button",{type:"button",onClick:Zt,className:`inline-flex h-11 w-11 items-center justify-center rounded border ${B.borderControl} ${N.surface} ${s.fgMuted} transition-colors ${k.hoverMuted} ${k.hoverFgSecondary}`,"aria-label":c.treeExpandAll,title:c.treeExpandAllTitle,children:j(ec,{className:"h-4 w-4"})}),j("button",{type:"button",onClick:Lr,className:`inline-flex h-11 w-11 items-center justify-center rounded border ${B.borderControl} ${N.surface} ${s.fgMuted} transition-colors ${k.hoverMuted} ${k.hoverFgSecondary}`,"aria-label":c.treeCollapseAll,title:c.treeCollapseAllTitle,children:j(Zl,{className:"h-4 w-4"})})]}):null]}),Un=Nr(null),{isTwoColumn:En}=br(Un,fa,{mediaQuery:"(min-width: 768px)"});Ke&&(En||je===null)&&He(!1);let Vn=Ze(()=>({toggle:Xt,isExpanded:_t,expandMultiple:Yt,collapseMultiple:Ct,isPending:a}),[Ct,Yt,_t,Xt,a]),Kn=Ze(()=>({onEntryClick:xn,selectedPath:Et}),[xn,Et]),wr=Ze(()=>({className:ic,lineColor:Oa,iconOverrides:At,showDirectoryIcons:!!At,showFileIcons:!!At,highlightStyles:sc,entryClassName:"rounded-md",nameClassName:"tracking-tight",directoryNameClassName:`font-normal ${s.fg}`,fileNameClassName:s.fgSecondary}),[At]),Ln=j("div",{ref:xt,className:`flex min-h-0 flex-1 flex-col rounded-xl border ${B.borderSubtle} ${N.surface} shadow-sm transition-colors`,children:j("div",{ref:X,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:oe.length>0?j(Xl,{entries:oe,expansion:Vn,selection:Kn,visual:wr,virtualScroll:kt,locale:d,labels:p}):j("div",{className:`flex h-full w-full items-center justify-center rounded-lg border ${B.borderSubtle} border-dashed ${N.surface} px-6 text-center ${s.fgMuted} text-sm transition-colors`,children:o?c.treeNoMatches:c.treeEmpty})})});return $e("div",{ref:Un,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Q,children:[t&&tc(en,t),En?$e(Yl,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[j(Do,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:nc,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:Ln}),j(Ql,{id:"contact-map-tree-handle",thickness:ac,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:`cursor-col-resize rounded transition-colors ${k.hoverMuted} focus:outline-none focus-visible:ring-2 ${k.focusVisibleRing} ${k.ringOffsetSurface} focus-visible:ring-offset-1`,"aria-label":c.treeResizeHandle}),j(Do,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:rc,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:j(un,{placement:"pane",contact:je,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):$e(mc,{children:[Ln,je?j(vr,{isOpen:Ke,onClose:Jt,title:c.detailHeading,children:j(un,{placement:"overlay",contact:je,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}):null]}),nt&&Nt&&j(er,{contactData:Nt,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:tt,onRequestClose:Nn})]})};import{jsx as In,jsxs as hn}from"react/jsx-runtime";var hc={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},yc=e=>e==="tree"?"tree":"list",Ko=({context:e})=>{let t=ne(),[n,r]=gc(),[i,o]=fc(null),a=yc(n.get(pn)),{setScrollableRef:u,onPointerDown:d,onPointerMove:c,onPointerUp:p,onPointerLeave:f,onPointerCancel:l,onClickCapture:g}=Rt(),y=pc(x=>{let E=x==="tree"?"tree":"list";if(E===a)return;let T=new URLSearchParams(typeof window<"u"?window.location.search:"");E==="list"?T.delete(pn):T.set(pn,E),r(T,{replace:!0})},[a,r]);return hn("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[hn("div",{className:"mt-1 mb-1.5 flex shrink-0 flex-wrap items-center gap-2",children:[hn("div",{ref:u,className:`flex space-x-1 overflow-x-auto text-nowrap rounded-lg ${N.muted} p-0.5 transition-colors`,style:hc,onPointerDown:d,onPointerMove:c,onPointerUp:p,onPointerLeave:f,onPointerCancel:l,onClickCapture:g,children:[hn("button",{type:"button","data-testid":"contact-map-tab-list","aria-pressed":a==="list",onClick:()=>y("list"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-2 ${C} transition-colors ${a==="list"?`${Te.blue} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u{1F4C4} ",t.listViewTab]}),hn("button",{type:"button","data-testid":"contact-map-tab-tree","aria-pressed":a==="tree",onClick:()=>y("tree"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-2 ${C} transition-colors ${a==="tree"?`${Te.green} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u{1F333} ",t.treeViewTab]})]}),In("div",{ref:o,className:"flex flex-wrap items-center gap-1.5"})]}),hn("div",{className:"flex h-full flex-1 flex-col",children:[In("div",{className:`${a==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:a==="list"?In(wo,{context:e}):null}),In("div",{className:`${a==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:a==="tree"?In(Vo,{context:e,controlsContainer:i}):null})]})]})};import{memo as vc}from"react";ye();fe();Ee();ye();fe();Ee();import{DEFAULT_FUZZY_SEARCH_OPTIONS as G}from"@aiquants/fuzzy-search";import{memo as bc,useId as We}from"react";import{jsx as O,jsxs as F}from"react/jsx-runtime";var ga=1e3,ha=bc(({searchOptions:e,setSearchOptions:t})=>{let n=ne(),r=`flex flex-col gap-1 rounded-md border ${N.surface} px-2 py-1 shadow-sm transition-colors`,i="text-xs font-semibold",o=e.sortBy==="relevance",a=We(),u=We(),d=We(),c=We(),p=We(),f=We(),l=We(),g=We(),y=We(),x=We(),E=We(),T=[];T.push(F("div",{className:`${r} ${$.green} border-l-4`,children:[F("div",{className:`${i} ${m.green}`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:a,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexNgramSize}),O("input",{id:a,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||G.ngramSize,onChange:b=>t(h=>({...h,ngramSize:parseInt(b.target.value,10)})),className:"h-11 w-full"}),F("span",{className:`${m.green} text-xs`,children:[n.currentValueLabel," ",e.ngramSize||G.ngramSize]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexNgramSizeHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:u,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexMinNgramOverlap}),O("input",{id:u,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||G.minNgramOverlap,onChange:b=>t(h=>({...h,minNgramOverlap:parseInt(b.target.value,10)})),className:"h-11 w-full"}),F("span",{className:`${m.green} text-xs`,children:[n.currentValueLabel," ",e.minNgramOverlap||G.minNgramOverlap]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexMinNgramOverlapHint})]})]},"index-build")),T.push(F("div",{className:`${r} ${$.blue} border-l-4`,children:[F("div",{className:`${i} ${m.blue}`,children:["\u{1F50D} ",n.indexCandidateHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:d,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexThreshold}),O("input",{id:d,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??G.indexWorkerOptions?.threshold,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,threshold:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.blue} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??G.indexWorkerOptions?.threshold]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexThresholdHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:p,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexNgramOverlapThreshold}),O("input",{id:p,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??G.indexWorkerOptions?.ngramOverlapThreshold,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,ngramOverlapThreshold:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.blue} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??G.indexWorkerOptions?.ngramOverlapThreshold]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),T.push(F("div",{className:`${r} ${$.cyan} border-l-4`,children:[F("div",{className:`${i} ${m.cyan}`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:c,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexStrategy}),F("select",{id:c,value:e.indexWorkerOptions?.strategy??G.indexWorkerOptions?.strategy??"hybrid",onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,strategy:b.target.value}})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,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:`${w} ${s.fgMuted} transition-colors`,children:n.indexStrategyHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:f,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexMinCandidatesRatio}),O("input",{id:f,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??G.indexWorkerOptions?.minCandidatesRatio,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,minCandidatesRatio:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.cyan} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??G.indexWorkerOptions?.minCandidatesRatio]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexMinCandidatesRatioHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:l,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexMaxCandidatesRatio}),O("input",{id:l,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??G.indexWorkerOptions?.maxCandidatesRatio,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,maxCandidatesRatio:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.cyan} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??G.indexWorkerOptions?.maxCandidatesRatio]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),T.push(F("div",{className:`${r} ${$.indigo} border-l-4`,children:[F("div",{className:`${i} ${m.indigo}`,children:["\u{1F521} ",n.scoreTuningHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:g,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexJaroWinklerPrefix}),O("input",{id:g,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??G.indexWorkerOptions?.jaroWinklerPrefix,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,jaroWinklerPrefix:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.indigo} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??G.indexWorkerOptions?.jaroWinklerPrefix]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexJaroWinklerPrefixHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:y,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.maxResults}),F("label",{className:`flex min-h-11 items-center gap-2 ${C} ${s.fgMuted}`,children:[O("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,maxResults:b.target.checked?void 0:ga}}))}),n.noLimit]}),O("input",{id:y,type:"range",min:ga,max:"10000",step:"1000",disabled:e.indexWorkerOptions?.maxResults===void 0,value:e.indexWorkerOptions?.maxResults===void 0?ga:e.indexWorkerOptions.maxResults,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,maxResults:parseInt(b.target.value,10)}})),className:"h-11 w-full disabled:cursor-not-allowed"}),F("span",{className:`${m.indigo} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexMaxResultsHint})]})]},"jaro")),T.push(F("div",{className:`${r} ${$.emerald} border-l-4`,children:[F("div",{className:`${i} ${m.emerald}`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:x,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.fieldWeight}),O("input",{id:x,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??G.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,relevanceFieldWeight:parseFloat(b.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),F("span",{className:`${m.emerald} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??G.indexWorkerOptions?.relevanceFieldWeight??.2]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexFieldWeightHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:E,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexPerfectMatchBonus}),O("input",{id:E,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??G.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(b.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),F("span",{className:`${m.emerald} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??G.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexPerfectMatchBonusHint})]}),!o&&O("p",{className:`${w} ${m.emerald}`,children:n.relevanceOnlyNotice})]},"relevance"));let U=We(),z=We();return T.push(F("div",{className:`${r} ${$.teal} border-l-4`,children:[F("div",{className:`${i} ${m.teal}`,children:["\u{1F524} ",n.indexContainmentHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:U,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexContainmentBase}),O("input",{id:U,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??G.indexWorkerOptions?.containmentScoreBase??.7,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,containmentScoreBase:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.teal} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??G.indexWorkerOptions?.containmentScoreBase??.7]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexContainmentBaseHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:z,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexContainmentCoverage}),O("input",{id:z,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??G.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,containmentCoverageWeight:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.teal} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??G.indexWorkerOptions?.containmentCoverageWeight??.3]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexContainmentCoverageHint})]})]},"containment")),F("section",{className:"space-y-3",children:[F("div",{className:"flex items-center justify-between gap-3",children:[F("div",{className:`flex items-center gap-2 font-semibold ${m.green} text-xs transition-colors`,children:[O("span",{children:"\u{1F4CA}"}),O("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),O("button",{type:"button",onClick:()=>t(b=>({...b,indexWorkerOptions:{threshold:G.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:G.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:G.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:G.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:G.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:void 0,relevanceFieldWeight:G.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:G.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:G.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:G.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:G.indexWorkerOptions?.strategy},ngramSize:G.ngramSize,minNgramOverlap:G.minNgramOverlap})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border ${$.green} ${Y.green} px-2 font-medium ${m.green} ${C} transition-colors ${k.hoverSurface}`,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:T})]})});ha.displayName="IndexWorkerSettings";ye();fe();Ee();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Me}from"@aiquants/fuzzy-search";import{memo as Sc,useId as yn}from"react";import{jsx as ue,jsxs as ge}from"react/jsx-runtime";var ya=1e3,ba=Sc(({searchOptions:e,setSearchOptions:t})=>{let n=ne(),r=`flex flex-col gap-1 rounded-md border ${N.surface} px-2 py-1 shadow-sm transition-colors`,i="text-xs font-semibold",o=e.sortBy==="relevance",a=yn(),u=yn(),d=yn(),c=yn(),p=yn(),f=yn(),l=[];return l.push(ge("div",{className:`${r} ${$.purple} border-l-4`,children:[ge("div",{className:`${i} ${m.purple}`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:a,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.levenshteinThreshold}),ue("input",{id:a,type:"range",min:"0.0",max:o?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??Me.levenshteinWorkerOptions?.threshold,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,threshold:parseFloat(g.target.value)}})),className:"h-11 w-full"}),ge("span",{className:`${m.purple} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??Me.levenshteinWorkerOptions?.threshold]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:o?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:u,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.levenshteinLengthSimilarity}),ue("input",{id:u,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??Me.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(g.target.value)}})),className:"h-11 w-full"}),ge("span",{className:`${m.purple} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??Me.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),l.push(ge("div",{className:`${r} ${$.pink} border-l-4`,children:[ge("div",{className:`${i} ${m.pink}`,children:["\u{1FA84} ",n.scoreTuningHeading]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:d,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.levenshteinLengthPenalty}),ue("input",{id:d,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??Me.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(g.target.value)}})),className:"h-11 w-full"}),ge("span",{className:`${m.pink} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??Me.levenshteinWorkerOptions?.lengthDiffPenalty]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),l.push(ge("div",{className:`${r} ${$.violet} border-l-4`,children:[ge("div",{className:`${i} ${m.violet}`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),ue("label",{htmlFor:c,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.maxResults}),ge("label",{className:`flex min-h-11 items-center gap-2 ${C} ${s.fgMuted}`,children:[ue("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,maxResults:g.target.checked?void 0:ya}}))}),n.noLimit]}),ue("input",{id:c,type:"range",min:ya,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?ya:e.levenshteinWorkerOptions.maxResults,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,maxResults:parseInt(g.target.value,10)}})),className:"h-11 w-full disabled:cursor-not-allowed"}),ge("span",{className:`${m.violet} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinMaxResultsHint})]},"max-results")),l.push(ge("div",{className:`${r} ${$.rose} border-l-4`,children:[ge("div",{className:`${i} ${m.rose}`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:p,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.fieldWeight}),ue("input",{id:p,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??Me.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(g.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),ge("span",{className:`${m.rose} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??Me.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinFieldWeightHint})]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:f,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.levenshteinPartialBonus}),ue("input",{id:f,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??Me.levenshteinWorkerOptions?.partialMatchBonus,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,partialMatchBonus:parseFloat(g.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),ge("span",{className:`${m.rose} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??Me.levenshteinWorkerOptions?.partialMatchBonus]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinPartialBonusHint})]}),!o&&ue("p",{className:`${w} ${m.rose}`,children:n.relevanceOnlyNotice})]},"relevance")),ge("section",{className:"space-y-3",children:[ge("div",{className:"flex items-center justify-between gap-3",children:[ge("div",{className:`flex items-center gap-2 font-semibold ${m.purple} text-xs transition-colors`,children:[ue("span",{children:"\u{1F4CF}"}),ue("span",{className:"tracking-wide",children:n.levenshteinSettingsHeading})]}),ue("button",{type:"button",onClick:()=>t(g=>({...g,levenshteinWorkerOptions:{threshold:Me.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:Me.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:Me.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:Me.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:Me.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border ${$.purple} ${Y.purple} px-2 font-medium ${m.purple} ${C} transition-colors ${k.hoverSurface}`,title:n.resetToDefaultsTitle,children:n.reset})]}),ue("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:l})]})});ba.displayName="LevenshteinWorkerSettings";import{jsx as ct,jsxs as lt}from"react/jsx-runtime";var Cc={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Sa=vc(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:i,setOpenEmailsWithGmail:o,activeTab:a,onTabChange:u})=>{let d=ne(),{setScrollableRef:c,onPointerDown:p,onPointerMove:f,onPointerUp:l,onPointerLeave:g,onPointerCancel:y,onClickCapture:x}=Rt();return lt("div",{className:`wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border ${$.blue} ${N.surface} p-1.5 shadow-md transition-colors`,children:[lt("div",{className:`mb-0.5 flex shrink-0 flex-col gap-1 rounded ${Y.blue} px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[lt("h3",{className:`font-semibold ${s.fgSecondary} text-xs transition-colors`,children:["\u2699\uFE0F ",d.searchSettings]}),ct("div",{className:"flex flex-wrap gap-1.5",children:lt("button",{type:"button",onClick:()=>t(E=>fr(E.workerUrls)),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded ${Te.red} px-1.5 ${C} ${s.onPrimary} transition-colors ${Bt.red}`,title:d.settingsResetAllTitle,children:["\u{1F504} ",d.settingsResetAll]})})]}),ct("div",{className:"mb-0 shrink-0",children:lt("div",{ref:c,role:"tablist","aria-label":d.settingsTabsLabel,className:`flex space-x-1 overflow-x-auto text-nowrap rounded-md ${N.muted} p-0.5 transition-colors`,style:Cc,onPointerDown:p,onPointerMove:f,onPointerUp:l,onPointerLeave:g,onPointerCancel:y,onClickCapture:x,children:[lt("button",{type:"button",role:"tab","aria-selected":a==="basic",onClick:()=>u("basic"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${a==="basic"?`${Te.blue} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u{1F527} ",d.settingsBasicTab]}),lt("button",{type:"button",role:"tab","aria-selected":a==="advanced",onClick:()=>u("advanced"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${a==="advanced"?`${Te.orange} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u26A1 ",d.settingsAdvancedTab]}),lt("button",{type:"button",role:"tab","aria-selected":a==="index",onClick:()=>u("index"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${a==="index"?`${Te.green} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u{1F4CA} ",d.indexWorkerName]}),lt("button",{type:"button",role:"tab","aria-selected":a==="levenshtein",onClick:()=>u("levenshtein"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${a==="levenshtein"?`${Te.purple} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u{1F4CF} ",d.levenshteinWorkerName]})]})}),lt("div",{className:"flex flex-col gap-1",children:[ct("div",{className:`${a==="basic"?"block":"hidden"}`,children:ct(zr,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:i,setOpenEmailsWithGmail:o})}),ct("div",{className:`${a==="advanced"?"block":"hidden"}`,children:ct(Br,{searchOptions:e,setSearchOptions:t})}),ct("div",{className:`${a==="index"?"block":"hidden"}`,children:ct(ha,{searchOptions:e,setSearchOptions:t})}),ct("div",{className:`${a==="levenshtein"?"block":"hidden"}`,children:ct(ba,{searchOptions:e,setSearchOptions:t})})]})]})});Sa.displayName="SearchOptionsPanel";import{memo as Nc,useCallback as kc}from"react";Ft();ye();fe();Ee();fe();import{memo as xc}from"react";import{jsxs as va}from"react/jsx-runtime";var _=xc(({label:e,value:t,unit:n,color:r=s.fgMuted})=>va("div",{className:`wrap-break-word flex min-w-0 flex-col overflow-hidden ${s.fgSecondary} transition-colors sm:flex-row sm:justify-between`,children:[va("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),va("span",{className:`font-medium ${r} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));_.displayName="StatItem";Ft();ye();fe();Ee();import{memo as Tc}from"react";import{jsx as P,jsxs as Z}from"react/jsx-runtime";var bn=Tc(({kind:e,icon:t,stats:n,color:r})=>{let{locale:i,labels:o}=Pe(),a=W=>ee(i,W);if(!n)return P("section",{className:`rounded-lg border ${B.borderSubtle} border-dashed ${N.surface} p-3 ${s.fgMuted} text-xs transition-colors`,children:o.statsNoData});let u=n.basic||{},d=n.workerSpecific||{},c=n.analysis||{},p=u.totalSearches??0,f=u.totalProcessingTime??0,l=u.averageSearchTime??0,g=u.lastSearchTime??0,y=u.errorCount??0,x=u.timestamp,E=c.fieldPerformance||{},T=c.performanceInsights||{},U=c.recentHistory||[],z=d.specificMetrics||{},b=d.operationCount??0,h=d.operationDistribution||{},v=e==="index",M=e==="levenshtein",H=v?o.indexWorkerName:o.levenshteinWorkerName,S=z,L=z,ae=`flex flex-col gap-1 rounded-lg border ${N.surface} p-3 shadow-sm transition-colors`,I="text-xs font-semibold transition-colors",be=W=>{if(!W)return;let A=new Date(W);return Number.isNaN(A.getTime())?void 0:o.statsTimestamp(A)},oe=[];if(oe.push(Z("div",{className:`${ae} ${$.blue} border-l-4`,children:[Z("div",{className:`${I} ${r}`,children:["\u{1F4CA} ",o.statsBasicHeading]}),P(_,{label:o.statTotalSearches,value:a(p),color:r}),P(_,{label:o.statAverageSearchTime,value:l.toFixed(2),unit:"ms",color:r}),P(_,{label:o.statTotalProcessingTime,value:f.toFixed(2),unit:"ms",color:r}),P(_,{label:o.statLastSearchTime,value:g.toFixed(2),unit:"ms",color:r}),P(_,{label:o.statErrorCount,value:y,color:y>0?m.red:r}),be(x)&&P(_,{label:o.statUpdatedAt,value:be(x),color:s.fgMuted})]},"basic")),b>0||Object.keys(h).length>0){let W=Object.entries(h).sort(([,A],[,q])=>(Number(q)||0)-(Number(A)||0)).slice(0,6);oe.push(Z("div",{className:`${ae} ${$.amber} border-l-4`,children:[Z("div",{className:`${I} ${m.amber}`,children:["\u{1F527} ",o.statsOperationsHeading]}),P(_,{label:o.statTotalOperations,value:a(b),color:m.amber}),W.length>0&&P("div",{className:"mt-1 space-y-1",children:W.map(([A,q])=>P(_,{label:A,value:a(Number(q)),unit:o.timesUnit(a(Number(q))),color:m.amber},A))})]},"operations"))}if(v&&(oe.push(Z("div",{className:`${ae} ${$.green} border-l-4`,children:[Z("div",{className:`${I} ${m.green}`,children:["\u{1F3D7}\uFE0F ",o.statsIndexHeading]}),P(_,{label:o.statIndexBuilds,value:a(S.totalIndexBuilds??0),color:m.green}),P(_,{label:o.statDataSize,value:a(S.currentDataSize??0),unit:o.itemsUnit(a(S.currentDataSize??0)),color:m.green}),P(_,{label:o.statLastBuildTime,value:(S.lastIndexTime??0).toFixed(2),unit:"ms",color:m.green})]},"index-core")),S.cacheSize&&oe.push(Z("div",{className:`${ae} ${$.emerald} border-l-4`,children:[Z("div",{className:`${I} ${m.emerald}`,children:["\u{1F4BE} ",o.statsCacheHeading]}),P(_,{label:o.statCacheNgram,value:a(S.cacheSize.ngram??0),color:m.emerald}),P(_,{label:o.statCacheWord,value:a(S.cacheSize.word??0),color:m.emerald}),P(_,{label:o.statCachePhonetic,value:a(S.cacheSize.phonetic??0),color:m.emerald})]},"index-cache")),S.indexMetadata)){let W=Object.entries(S.indexMetadata).slice(0,6);W.length>0&&oe.push(Z("div",{className:`${ae} ${$.teal} border-l-4`,children:[Z("div",{className:`${I} ${m.teal}`,children:["\u{1F4CB} ",o.statsIndexMetadataHeading]}),W.map(([A,q])=>{let me;if(typeof q=="number"){let Se=A.toLowerCase();Se.includes("time")&&!Se.includes("timestamp")?me=`${q.toFixed(2)}ms`:Se.includes("timestamp")||Se.includes("at")?me=be(q)??q.toString():me=a(q)}else me=String(q);return P(_,{label:A,value:me,color:m.teal},A)})]},"index-meta"))}if(M){if(oe.push(Z("div",{className:`${ae} ${$.purple} border-l-4`,children:[Z("div",{className:`${I} ${m.purple}`,children:["\u{1F522} ",o.statsCalculationsHeading]}),P(_,{label:o.statTotalCalculations,value:a(L.totalCalculations??0),color:m.purple}),P(_,{label:o.statDistanceCalculations,value:a(L.totalDistanceCalculations??0),color:m.purple}),P(_,{label:o.statAverageDistance,value:typeof L.averageDistance=="number"?L.averageDistance.toFixed(2):"0.00",color:m.purple}),P(_,{label:o.statMinDistance,value:L.minDistance??o.notAvailable,color:m.purple}),P(_,{label:o.statMaxDistance,value:L.maxDistance??0,color:m.purple})]},"lev-basic")),oe.push(Z("div",{className:`${ae} ${$.fuchsia} border-l-4`,children:[Z("div",{className:`${I} ${m.fuchsia}`,children:["\u{1F3AF} ",o.statsMatchesHeading]}),P(_,{label:o.statPartialMatches,value:a(L.partialMatches??0),color:m.fuchsia}),P(_,{label:o.statPerfectMatches,value:a(L.perfectMatches??0),color:m.fuchsia}),P(_,{label:o.statEarlyTerminations,value:a(L.earlyTerminations??0),color:m.fuchsia})]},"lev-match")),L.similarityThresholds&&oe.push(Z("div",{className:`${ae} ${$.rose} border-l-4`,children:[Z("div",{className:`${I} ${m.rose}`,children:["\u{1F4C8} ",o.statsSimilarityHeading]}),P(_,{label:o.statAbove80,value:a(L.similarityThresholds.above80??0),color:m.emerald}),P(_,{label:o.statAbove60,value:a(L.similarityThresholds.above60??0),color:m.lime}),P(_,{label:o.statAbove40,value:a(L.similarityThresholds.above40??0),color:m.orange}),P(_,{label:o.statBelow40,value:a(L.similarityThresholds.below40??0),color:m.red})]},"lev-similarity")),L.distanceDistribution){let W=Object.entries(L.distanceDistribution).sort(([,A],[,q])=>Number(q)-Number(A)).slice(0,6);W.length>0&&oe.push(Z("div",{className:`${ae} ${$.indigo} border-l-4`,children:[Z("div",{className:`${I} ${m.indigo}`,children:["\u{1F4CA} ",o.statsDistanceHeading]}),W.map(([A,q])=>P(_,{label:o.statDistance(A),value:a(Number(q)),unit:o.timesUnit(a(Number(q))),color:m.indigo},A))]},"lev-distance"))}if(L.queryLengthStats){let W=Object.entries(L.queryLengthStats).sort(([,A],[,q])=>(q.count??0)-(A.count??0)).slice(0,6);W.length>0&&oe.push(Z("div",{className:`${ae} ${$.violet} border-l-4`,children:[Z("div",{className:`${I} ${m.violet}`,children:["\u{1F4CF} ",o.statsQueryLengthHeading]}),W.map(([A,q])=>{let me=Number(q.count??0),Se=Number(q.averageScore??0);return P(_,{label:o.statQueryLength(A),value:o.statQueryLengthValue({count:me,averagePercent:(Se*100).toFixed(1)}),color:m.violet},A)})]},"lev-query-length"))}}if(Object.keys(E).length>0){let W=Object.entries(E).sort(([,A],[,q])=>(q.averageScore??0)-(A.averageScore??0)).slice(0,6);oe.push(Z("div",{className:`${ae} ${$.purple} border-l-4`,children:[Z("div",{className:`${I} ${m.purple}`,children:["\u{1F4CB} ",o.statsFieldPerformanceHeading]}),W.map(([A,q])=>{let me=q;return Z("div",{className:`space-y-1 rounded ${Y.purple} p-2 transition-colors`,children:[P("div",{className:`font-semibold ${m.purple} text-xs transition-colors`,children:A}),P(_,{label:o.statAverageScore,value:`${((me.averageScore??0)*100).toFixed(1)}%`,color:m.purple}),P(_,{label:o.statMatchCount,value:a(me.matchCount??0),unit:o.itemsUnit(a(me.matchCount??0)),color:m.purple}),P(_,{label:o.statBestWorstScore,value:`${((me.bestScore??0)*100).toFixed(1)}% / ${((me.worstScore??0)*100).toFixed(1)}%`,color:m.purple})]},A)})]},"field-performance"))}if(T.bestPerformingField||T.totalHistoryEntries||T.similarityDistribution){let W=(T.recentAverageResultCount??0).toFixed(1);oe.push(Z("div",{className:`${ae} ${$.blue} border-l-4`,children:[Z("div",{className:`${I} ${m.blue}`,children:["\u{1F50D} ",o.statsInsightsHeading]}),T.bestPerformingField&&P(_,{label:o.statBestField,value:T.bestPerformingField,color:m.blue}),P(_,{label:o.statRecentAverageTime,value:(T.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:m.blue}),P(_,{label:o.statRecentAverageResults,value:W,unit:o.itemsUnit(W),color:m.blue}),P(_,{label:o.statThroughput,value:(T.throughputPerSecond??0).toFixed(2),unit:o.throughputUnit,color:m.blue}),P(_,{label:o.statCommonQueryLength,value:a(T.mostCommonQueryLength??0),unit:o.charactersUnit(a(T.mostCommonQueryLength??0)),color:m.blue}),P(_,{label:o.statHistoryEntries,value:a(T.totalHistoryEntries??0),color:m.blue}),T.similarityDistribution&&Z("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[P(_,{label:o.statHighSimilarity,value:a(T.similarityDistribution.highSimilarity??0),color:m.emerald}),P(_,{label:o.statMediumSimilarity,value:a(T.similarityDistribution.mediumSimilarity??0),color:m.lime}),P(_,{label:o.statLowSimilarity,value:a(T.similarityDistribution.lowSimilarity??0),color:m.orange}),P(_,{label:o.statVeryLowSimilarity,value:a(T.similarityDistribution.veryLowSimilarity??0),color:m.red})]})]},"performance-insights"))}return U.length>0&&oe.push(Z("div",{className:`${ae} ${$.sky} border-l-4`,children:[Z("div",{className:`${I} ${m.sky}`,children:["\u{1F4C8} ",o.statsRecentHistoryHeading]}),U.slice(-3).reverse().map((W,A)=>Z("div",{className:`rounded ${Y.sky} p-2 transition-colors`,children:[P("div",{className:`font-medium ${m.sky} transition-colors`,children:W.operationType}),P("div",{className:`${m.sky} text-xs transition-colors`,children:o.statsHistoryEntry({processingTimeMs:W.processingTime.toFixed(2),resultCount:W.resultCount??0})}),be(W.timestamp)&&P("div",{className:`${w} ${m.sky} transition-colors`,children:be(W.timestamp)})]},`${W.operationType}-${W.timestamp??A}`))]},"recent-history")),Z("section",{className:"space-y-2",children:[Z("div",{className:`flex items-center gap-2 font-semibold text-xs ${r}`,children:[P("span",{children:t}),P("span",{className:"tracking-wide",children:H})]}),P("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:oe})]})});bn.displayName="WorkerStatsSection";import{jsx as Ue,jsxs as ze}from"react/jsx-runtime";var Ec={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ca=Nc(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:r,resetStats:i,rebuildIndex:o,isIndexBuilding:a,activeTab:u,onTabChange:d})=>{let{locale:c,labels:p}=Pe(),f=t.trim(),l=f?r:n,{setScrollableRef:g,onPointerDown:y,onPointerMove:x,onPointerUp:E,onPointerLeave:T,onPointerCancel:U,onClickCapture:z}=Rt(),b=u!=="index"||a,h=a?p.statsRebuildingTitle:u!=="index"?p.statsRebuildIndexTabOnlyTitle:p.statsRebuildTitle,v=b?`cursor-not-allowed ${N.muted} ${s.fgMuted}`:`${Te.blue} ${s.onPrimary} ${Bt.blue}`,M=a?`\u23F3 ${p.statsRebuilding}`:`\u{1F3D7}\uFE0F ${p.statsRebuild}`,H=kc(()=>{o().catch(()=>{})},[o]);return ze("div",{className:`wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border ${$.blue} ${N.surface} p-1.5 shadow-md transition-colors`,children:[ze("div",{className:`mb-0.5 flex shrink-0 flex-col gap-1 rounded ${Y.blue} px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[ze("h3",{className:`font-semibold ${s.fgSecondary} text-xs transition-colors`,children:["\u{1F4CA} ",p.searchStatistics]}),ze("div",{className:"flex flex-wrap gap-1.5",children:[Ue("button",{type:"button",onClick:H,disabled:b,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${v}`,title:h,children:M}),ze("button",{type:"button",onClick:i,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded ${Te.red} px-1.5 ${C} ${s.onPrimary} transition-colors ${Bt.red}`,title:p.statsResetTitle,children:["\u{1F504} ",p.reset]})]})]}),Ue("div",{className:"mb-0 shrink-0",children:ze("div",{ref:g,role:"tablist","aria-label":p.statsTabsLabel,className:`flex space-x-1 overflow-x-auto text-nowrap rounded-md ${N.muted} p-0.5 transition-colors`,style:Ec,onPointerDown:y,onPointerMove:x,onPointerUp:E,onPointerLeave:T,onPointerCancel:U,onClickCapture:z,children:[ze("button",{type:"button",role:"tab","aria-selected":u==="overview",onClick:()=>d("overview"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${u==="overview"?`${Te.blue} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u{1F4CB} ",p.statsOverviewTab]}),ze("button",{type:"button",role:"tab","aria-selected":u==="index",onClick:()=>d("index"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${u==="index"?`${Te.green} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u{1F4CA} ",p.statsIndexTab]}),ze("button",{type:"button",role:"tab","aria-selected":u==="levenshtein",onClick:()=>d("levenshtein"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${u==="levenshtein"?`${Te.purple} ${s.onPrimary}`:`${s.fgMuted} ${k.hoverSurface}`}`,children:["\u{1F4CF} ",p.statsLevenshteinTab]})]})}),ze("div",{className:"flex flex-col gap-1 pb-0.5",children:[ze("div",{className:`${u==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 ${s.fgMuted} text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:[Ue(_,{label:p.statTotalSearches,value:ee(c,e.totalSearches)}),Ue(_,{label:p.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),Ue(_,{label:p.statDataCount,value:ee(c,e.itemCount)}),Ue(_,{label:f?p.statResultCount:p.statDisplayedCount,value:ee(c,l)})]}),Ue("div",{className:`${u==="index"?"space-y-3":"hidden"} pr-1 ${s.fgMuted} text-xs transition-colors`,children:Ue(bn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:m.green})}),Ue("div",{className:`${u==="levenshtein"?"space-y-3":"hidden"} pr-1 ${s.fgMuted} text-xs transition-colors`,children:Ue(bn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:m.purple})}),ze("div",{className:"hidden",children:[Ue(bn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:m.green}),Ue(bn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:m.purple})]})]})]})});Ca.displayName="StatisticsPanel";import{Fragment as Yo,jsx as ce,jsxs as we}from"react/jsx-runtime";var Oc=/[\u200B\uFEFF]/g,xa=typeof window<"u",Jo=xa&&typeof document<"u",Er=(e,t=[],n=!1)=>{let r=Qo(e);r.current=e,vt(()=>{if(!(!xa||n&&!Jo))return r.current()},[n,...t])},jo=(e,t,n)=>{let[r,i]=et(()=>{let o=Go(a=>a.getItem(e));return o&&t.includes(o)?o:n});return Er(()=>{Go(o=>{o.setItem(e,r)})},[e,r]),[r,i]},Go=e=>{if(!xa)return null;try{return e(window.sessionStorage)}catch{return null}},qo=(e,t)=>{let[n,r]=et(e);return vt(()=>{let i=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(i)}},[e,t]),n},Ac="contact-map.settings-tab",Dc="contact-map.statistics-tab",Wc=["basic","advanced","index","levenshtein"],Hc=["overview","index","levenshtein"],Xo=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Ic={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Zo=({streamState:e,...t}={})=>e===void 0?ce(Fc,{...t}):ce(ei,{...t,streamState:e}),Fc=e=>{let{context:t}=pr();return ce(ei,{...e,streamState:t})},Bc={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},ei=e=>{let{streamState:t,onFooterVisibilityChange:n,children:r}=e,i=Re(e,"workerUrls"),o=bt(),{locale:a,labels:u}=Pe(),{contactMapRecords:d,contactMapRecordMap:c,isStreamingComplete:p,isStreamingFailed:f}=t,l=_c(),[g]=$c(),y=Qo(null),[x,E]=et(!0),[T,U]=et(o.openEmailsWithGmail??!1),{indexWorker:z,levenshteinWorker:b}=mn(o.workerUrls,i,Bc),[h,v]=et(()=>fr({indexWorker:z,levenshteinWorker:b})),[M,H]=et(g.get("q")||""),S=qo(M,h.debounceMs??Lc.debounceMs);vt(()=>{let V=g.get("q")||"";H(J=>J!==V?V:J)},[g]),vt(()=>{if(typeof window>"u")return;let V=new URL(window.location.href);(V.searchParams.get("q")||"")!==S&&(S?V.searchParams.set("q",S):V.searchParams.delete("q"),window.history.replaceState(window.history.state,"",V.toString()))},[S]);let[L,ae]=Pc(),[I,be]=et("search"),[oe,W]=jo(Ac,Wc,"basic"),[A,q]=jo(Dc,Hc,"overview"),{setScrollableRef:me,onPointerDown:Se,onPointerMove:Oe,onPointerUp:_t,onPointerLeave:Xt,onPointerCancel:Ct,onClickCapture:Yt}=Rt(),ve=Sn(()=>{if(!Jo)return;let V=y.current;!V||document.activeElement===V||window.requestAnimationFrame(()=>{try{V.focus({preventScroll:!0})}catch{}})},[]),Qt=Sn(V=>{let J=V;be(J),J==="search"&&ve()},[ve]),Ve=Pt(()=>({...h,debounceMs:0}),[h]),[dt,Ke]=et("union"),He=dt==="intersection",Jt=He?u.operatorAndTitle:u.operatorOrTitle,xt=Sn(V=>Mc(V,dt),[dt]),X=Pt(()=>({querySetsOf:xt}),[xt]),he=qo(d,p?0:800),{searchTerm:Q,setSearchTerm:ut,filteredItems:$t,resultTerm:xn,isSearching:Tt,isIndexBuilding:Ae,clearSearch:Tn,resetStats:Nn,performanceMetrics:tt,rebuildIndex:Nt,error:nt}=wc(he,Xo,Ve,X),Ot=Q.trim().length>0,[kt,At]=et(""),[Zt,Lr]=et(()=>Q),Et=Pt(()=>nr(M),[M]),je=Pt(()=>nr(S),[S]);vt(()=>{S===kt&&je===Q||ae(()=>{At(S),ut(je)})},[S,kt,je,Q,ut]);let kn=Sn(V=>{let xe=V.target.value.replace(Oc,"");H(xe)},[]),Mr=Sn(()=>{H(""),At(""),Tn(),ve()},[Tn,ve]),Fn=Sn(()=>{Ke(V=>V==="intersection"?"union":"intersection"),ve()},[ve]);Er(()=>{if(!(I==="search"&&l.state==="idle"&&!L))return;let J=document.activeElement;if(!!!(J?.matches('[role="tab"]')||J?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&J&&J!==document.body&&J!==y.current)return;let rt=window.requestAnimationFrame(()=>{ve()});return()=>{window.cancelAnimationFrame(rt)}},[I,l.state,L,ve],!0),Er(()=>{if(I!=="search")return;let V=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ve()}],[window,"pageshow",()=>{ve()}]];for(let[J,xe,rt]of V)J.addEventListener(xe,rt);return()=>{for(let[J,xe,rt]of V)J.removeEventListener(xe,rt)}},[I,ve],!0),vt(()=>(n&&n(I==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[I,n]),Er(()=>{let V=document.body,J=V.style.overflow;return I==="search"&&(V.style.overflow="hidden"),()=>{V.style.overflow=J}},[I],!0),vt(()=>{tt&&st.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:tt.totalSearches,averageSearchTime:tt.averageSearchTime,itemCount:tt.itemCount,resultsCount:tt.resultsCount,workersAvailable:!!tt.workerStats})},[tt]);let{isAwaitingDebounce:Bn,isAwaitingSearchTermSync:zn,isSearchInProgress:mt}=Pt(()=>{let V=Et!==je,J=je!==Q,xe=Q.trim().length>0||Et.trim().length>0;return{isAwaitingDebounce:V,isAwaitingSearchTermSync:J,isSearchInProgress:L||Tt||xn!==Q&&nt===null||xe&&Ae||V||J||Zt!==Q}},[Et,je,Q,xn,nt,L,Tt,Ae,Zt]),[en,Un]=et(Q);vt(()=>{en!==Q&&Un(Q)},[Q,en]),vt(()=>{Bn||zn||L||Tt||Ae||en===Q&&Zt!==Q&&Lr(Q)},[Q,Zt,Bn,zn,L,Tt,Ae,en]);let En=Pt(()=>Ga(kt,Xo),[kt]),Vn=Pt(()=>En($t),[En,$t]),Kn=Pt(()=>({contactMapRecords:d,contactMapRecordMap:c,filteredItems:Vn,searchQuery:kt,searchTerm:Q,isSearching:Tt,isIndexBuilding:Ae,isPending:L,hasSearchTerm:Ot,enableHighlighting:x,openEmailsWithGmail:T,isSearchInProgress:mt,isSearchTabActive:I==="search",errorMessage:nt??null,isStreamingComplete:p,isStreamingFailed:f}),[d,c,Vn,kt,Q,Tt,Ae,L,Ot,x,T,mt,I,nt,p,f]),wr=Ot?$t.length:d.length,Ln=ee(a,d.length),D=ee(a,$t.length),pe=`${`scrollbar-hidden ${N.subtle} ${s.fg}`}${I==="search"?" h-full min-h-0":""}`;return ce("div",{className:pe,children:we(sr,{value:I,onValueChange:Qt,className:`flex flex-col${I==="search"?" h-full min-h-0":""}`,children:[we(On,{ref:me,style:Ic,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 ${N.subtle} transition-colors ${s.fgSecondary}`,onPointerDown:Se,onPointerMove:Oe,onPointerUp:_t,onPointerLeave:Xt,onPointerCancel:Ct,onClickCapture:Yt,children:[we(Ut,{value:"search",className:`min-h-11 min-w-16 px-2 py-0 ${C} transition-colors sm:min-w-24 sm:px-2.5`,children:["\u{1F50D} ",u.searchTab]}),we(Ut,{value:"settings",className:`min-h-11 min-w-16 px-2 py-0 ${C} transition-colors sm:min-w-24 sm:px-2.5`,children:["\u2699\uFE0F ",u.searchSettings]}),we(Ut,{value:"statistics",className:`min-h-11 min-w-16 px-2 py-0 ${C} transition-colors sm:min-w-24 sm:px-2.5`,children:["\u{1F4CA} ",u.searchStatistics]})]}),ce(Vt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:we("div",{className:"flex h-full flex-col",children:[ce("div",{className:`rounded-md border ${B.borderSubtle} ${N.surface} shadow-sm transition-colors`,children:we("div",{className:"flex flex-col",children:[ce("div",{className:"relative",children:we("div",{className:"flex items-center gap-1 p-1",children:[we("button",{type:"button",onClick:Fn,"aria-pressed":He,title:Jt,className:`inline-flex min-h-11 min-w-11 items-center justify-center gap-0.5 rounded border px-1.5 font-semibold ${C} transition-colors sm:min-w-12 sm:px-2 ${He?`border-transparent ${Te.blue} ${s.onPrimary} ${Bt.blue}`:`${$a.amber} ${Y.amber} ${m.amber} ${k.hoverSurface}`}`,children:[ce("span",{children:He?u.operatorAnd:u.operatorOr}),ce("span",{className:`hidden ${w} sm:inline`,children:He?u.operatorAndHint:u.operatorOrHint})]}),ce("input",{ref:y,type:"text",value:M,onChange:kn,placeholder:u.searchPlaceholder,className:`min-h-11 flex-1 rounded border ${B.borderControl} border-solid px-2 pointer-coarse:text-base ${C} shadow-sm transition-colors ${k.focusBorder} focus:ring-1 ${k.focusRing} ${N.surface} ${s.fg}`}),M&&ce("button",{type:"button",onClick:Mr,className:`flex min-h-11 min-w-11 items-center justify-center gap-1 rounded border ${B.borderControl} px-1.5 ${C} transition-colors ${k.hoverFg} sm:px-2 ${s.fgMuted}`,title:mt?u.searchBusyTitle:u.clearSearch,"aria-label":mt?void 0:u.clearSearch,disabled:mt,children:mt?we(Yo,{children:[ce(Rc,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),ce("span",{className:"hidden sm:inline",children:u.searching})]}):"\u2715"})]})}),we("p",{className:`px-1.5 py-0.5 ${w} ${s.fgSecondary} transition-colors`,children:[u.registeredCountLabel," ",ce("span",{className:`font-semibold ${C} ${s.fg}`,children:Ln})," ",u.recordUnit(Ln),Ae?we("span",{className:`ml-1.5 inline-flex items-center rounded ${Y.blue} px-1.5 py-0.2 ${m.blue}`,children:["\u23F3 ",u.rebuildingIndex]}):null,nt?we("span",{className:`ml-1.5 inline-flex items-center rounded ${Y.rose} px-1.5 py-0.2 ${m.rose}`,children:["\u26A0\uFE0F ",u.errorLabel,ce("span",{className:"ml-1 break-all font-semibold",children:nt})]}):null,Ot&&we("span",{className:`ml-1.5 ${m.blue}`,children:["| ",u.resultCountLabel,mt?ce("span",{className:"ml-1 font-semibold",children:u.searching}):we(Yo,{children:[ce("span",{className:`ml-1 font-semibold ${C} ${s.fg}`,children:D}),ce("span",{className:"ml-0.5",children:u.resultUnit(D)})]})]})]}),ce("div",{className:"h-2.5 px-2 pb-1.5",children:Ae?ce(uo,{className:`h-1 ${Lt.progressTrack}`,indicatorClassName:qe.blue}):null})]})}),r?r(Kn):ce(Ko,{context:Kn})]})}),ce(Vt,{value:"settings",className:"mt-0",children:ce(Sa,{searchOptions:h,setSearchOptions:v,enableHighlighting:x,setEnableHighlighting:E,openEmailsWithGmail:T,setOpenEmailsWithGmail:U,activeTab:oe,onTabChange:W})}),ce(Vt,{value:"statistics",className:"mt-0",children:ce(Ca,{performanceMetrics:tt,searchTerm:Q,totalDataCount:d.length,resultsCount:wr,resetStats:Nn,rebuildIndex:Nt,isIndexBuilding:Ae,activeTab:A,onTabChange:q})})]})})};import{jsx as Cn,jsxs as ni}from"react/jsx-runtime";var zc=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let r=ne(),i=t===void 0?r.appTitle:t,{context:o,retryNow:a}=pr(),u=Cn(ta,{recordCount:o.contactMapRecords.length,companyCount:o.companyCount,phase:o.streamPhase,loadedCount:o.loadedCount,totalCount:o.totalCount,errorMessage:o.errorMessage,onRetry:a});return ni("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:i,annotation:u}):ni("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[Cn("h1",{className:"font-bold text-xl",children:i}),u]}),Cn("div",{className:"min-h-0 flex-1",children:Cn(Zo,{streamState:o,onFooterVisibilityChange:n})})]})},Lg=e=>{let t=bt(),n=Re(e,"streamEndpoint"),r=Re(e,"workerUrls"),i=Re(e,"locale"),o=Re(e,"labels"),a=ti(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:mn(t.workerUrls,r,{setting:"ContactMapAppView workerUrls"}),locale:i===void 0?t.locale:i,labels:o===void 0?t.labels:o}),[t,n,r,i,o]),u=i!==void 0,d=o!==void 0,c=ti(()=>({locale:u?"ContactMapAppView locale":"locale",labels:d?"ContactMapAppView labels":"labels"}),[u,d]);return Cn(ra,{config:a,chromeSurface:c,children:Cn(zc,{...e})})};Ft();ye();import{createShouldRevalidate as Uc}from"@aiquants/route-revalidation";var _g=Uc({submissions:"url",query:{ignore:[pn,"q"]}});export{Br as AdvancedSearchSettings,zr as BasicSearchSettings,gt as CONTACT_MAP_LABEL_CATALOGS,wn as CONTACT_MAP_LABEL_KEYS,qa as ContactDetailGrid,un as ContactDetailPanel,er as ContactDetailPopup,tr as ContactDetailRowLayout,ta as ContactMapAnnotation,Lg as ContactMapAppView,Os as ContactMapConfigProvider,wo as ContactMapSearchListView,Zo as ContactMapSearchPage,Ko as ContactMapSearchTabGroup,Vo as ContactMapSearchTreeView,dr as ContactMapStreamClient,Ne as HighlightedText,ha as IndexWorkerSettings,tp as LIST_COLLAPSE_THRESHOLD,Ml as LIST_DETAIL_PANEL_MIN_WIDTH,np as LIST_EXPAND_THRESHOLD,Ll as LIST_PANEL_MIN_WIDTH,wl as LIST_RESIZE_HANDLE_THICKNESS,ba as LevenshteinWorkerSettings,uo as Progress,Sa as SearchOptionsPanel,_ as StatItem,Ca as StatisticsPanel,vr as SwipeOverlay,Ip as TREE_COLLAPSE_THRESHOLD,rc as TREE_DETAIL_PANEL_MIN_WIDTH,Fp as TREE_EXPAND_THRESHOLD,nc as TREE_PANEL_MIN_WIDTH,ac as TREE_RESIZE_HANDLE_THICKNESS,sr as Tabs,Vt as TabsContent,On as TabsList,Ut as TabsTrigger,Tr as TreeWorkerSession,bn as WorkerStatsSection,ur as assertContactMapStreamEndpoint,ro as assertContactMapTreeWorkerUrl,Gu as assertContactMapWorkerUrls,lc as composeTreeVirtualScrollOptions,_g as contactMapShouldRevalidate,js as countContactMapCompanies,Hs as deserializeStreamRecord,Bs as getContactMapStreamClient,Gl as getTreeWorkerSession,mn as layerContactMapWorkerUrls,lm as resetContactMapStreamClientForTesting,fp as resetTreeWorkerSessionForTesting,Dr as resolveContactMapLabels,Ro as useAnimatedNumber,bt as useContactMapConfig,ne as useContactMapLabels,Ks as useContactMapStream,la as useContactPanelSizing,mo as useDynamicViewportHeight,Rt as useHorizontalDragScroll,yr as useLongPressPopup,Wl as useReportPopupVisibility,br as useResponsiveTwoColumnLayout,Dl as useRowPopupRegistry,pr as useStreamedContactMapContext,Ao as useTreeWorker};
|
|
1
|
+
var ri=Object.defineProperty;var Ee=(e,t)=>()=>(e&&(t=e(e=0)),t);var ai=(e,t)=>{for(var n in t)ri(e,n,{get:t[n],enumerable:!0})};var Ge,Dt,Na,tn,nn,Ln,ft,Ie,jn,Pr,_r,at,te,Wt=Ee(()=>{"use strict";Ge=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},Dt=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,Na=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let n of t){let r=Ge(e[n]);if(r)return{value:r,fieldKey:n}}return{value:null,fieldKey:null}},tn=e=>Na(e,["custom_email","email"]),nn=e=>Na(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),Ln=e=>{let t=Ge(e);if(!t)return null;let n=t.replace(/[^0-9+#*]/g,"");return n.length===0?null:`tel:${n}`},ft=(e,t)=>{let n=Ge(e);return n?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(n)}`:`mailto:${encodeURIComponent(n)}`:null},Ie=(e,t)=>String(e).padStart(t,"0"),jn=e=>`${Ie(e.getUTCFullYear(),4)}-${Ie(e.getUTCMonth()+1,2)}-${Ie(e.getUTCDate(),2)}`,Pr=e=>`${jn(e)} ${Ie(e.getUTCHours(),2)}:${Ie(e.getUTCMinutes(),2)}:${Ie(e.getUTCSeconds(),2)}`,_r=e=>`${Ie(e.getFullYear(),4)}-${Ie(e.getMonth()+1,2)}-${Ie(e.getDate(),2)} ${Ie(e.getHours(),2)}:${Ie(e.getMinutes(),2)}:${Ie(e.getSeconds(),2)}`,at=(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)},te=e=>e==null?"-":typeof e=="string"?Ge(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":String(e)});var ie,Ea,Ht=Ee(()=>{"use strict";ie=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":Ea(e);case"function":return Ea(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},Ea=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var rn,Re,an=Ee(()=>{"use strict";rn=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},Re=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var oi,Gn,$r=Ee(()=>{"use strict";oi=(e,t)=>{let n=Array.from({length:t.length+1},(r,i)=>i);for(let r=1;r<=e.length;r+=1){let i=[r];for(let o=1;o<=t.length;o+=1){let a=n[o-1]+(e[r-1]===t[o-1]?0:1);i.push(Math.min(n[o]+1,i[o-1]+1,a))}n=i}return n[t.length]},Gn=(e,t)=>{let n=e.toLowerCase();if(n.length>=3){let i=t.find(o=>o.toLowerCase().startsWith(n));if(i!==void 0)return i}let r;for(let i of t){let o=oi(n,i.toLowerCase());o<=Math.max(1,Math.floor(i.length/4))&&(r===void 0||o<r.distance)&&(r={key:i,distance:o})}return r?.key}});import{DIRECTORY_TREE_LABEL_CATALOGS as ka,DIRECTORY_TREE_LABEL_KEYS as Or,resolveDirectoryTreeLabels as ii}from"@aiquants/directory-tree";import{resolveVirtualScrollLocale as si,VIRTUAL_SCROLL_LABEL_KEYS as li}from"@aiquants/virtualscroll";var ci,ee,It,qn,La,wn,gt,di,Ma,wa,ui,Ar,mi,pi,fi,Dr,Wr,Hr,Ft=Ee(()=>{"use strict";Wt();Ht();an();$r();ci=Object.freeze({en:"en-US",ja:"ja-JP"}),ee=(e,t)=>t.toLocaleString(ci[e]),It=(e,t,n)=>e==="1"?t:n,qn=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`Streaming (${ee("en",e)} / ${ee("en",t)} \xB7 ${n}%)`,annotationStreamingCount:e=>`Streaming (${ee("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${ee("en",e)} received)`,annotationReconnecting:e=>`Reconnecting (${ee("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>It(e,"record","records"),companyUnit:e=>It(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=>It(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=>ee("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${ee("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:Pr,recordDate:jn,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:_r,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=ee("en",e);return`${n} ${It(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: ${ee("en",t)}`,timesUnit:e=>It(e," time"," times"),itemsUnit:e=>It(e," item"," items"),charactersUnit:e=>It(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 (${ee("ja",e)} / ${ee("ja",t)} \u4EF6\u30FB${n}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${ee("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${ee("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationReconnecting:e=>`\u518D\u63A5\u7D9A\u4E2D (${ee("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=>`${ee("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${ee("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:Pr,recordDate:jn,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:_r,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})=>`${ee("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: ${ee("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),La=Object.freeze(Object.keys(qn.en)),wn=Object.freeze([...Or,...La]),gt=Object.freeze({en:Object.freeze({...ka.en,...qn.en}),ja:Object.freeze({...ka.ja,...qn.ja})}),di=new Set(wn),Ma=Object.keys(gt).map(e=>JSON.stringify(e)).join(" or "),wa=Object.freeze({locale:"locale",labels:"labels"}),ui=(e,t,n)=>{e[t]=n},Ar=(e,t=wa.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${Ma} or left out; got ${ie(e)}`);if(e!==void 0&&!Object.hasOwn(gt,e))throw new RangeError(`[contact-map] ${t} must be ${Ma} or left out; got ${ie(e)}`);return si(e)},mi=(e,t,n,r)=>{if(typeof r=="function"){if(typeof n!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${ie(n)}`);return}if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${ie(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${ie(n)}`)},pi=(e,t,n)=>{let r=Object.create(null);for(let i of Object.getOwnPropertyNames(e)){if(!di.has(i)){let a=Gn(i,wn);throw new RangeError(`[contact-map] ${n} has a key that is not a label key (${a===void 0?"":`did you mean ${JSON.stringify(a)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${ie(i)}`)}let o=e[i];o!==void 0&&(mi(n,i,o,t[i]),r[i]=o)}return r},fi=e=>{let t={},n=!1;for(let r of Or){let i=e[r];i!==void 0&&(t[r]=i,n=!0)}return n?t:void 0},Dr=(e,t,n=wa)=>{let r=Ar(e,n.locale);if(t===void 0)return gt[r];if(!rn(t))throw new TypeError(`[contact-map] ${n.labels} must be a plain object or left out; got ${ie(t)}`);let i=pi(t,gt[r],n.labels),a={...ii(r,fi(i)),...qn[r]};for(let u of La){let d=i[u];d!==void 0&&ui(a,u,d)}return Object.freeze(a)},Wr=e=>{let t={};for(let n of Or)t[n]=e[n];return Object.freeze(t)},Hr=e=>{let t={};for(let n of li)t[n]=e[n];return Object.freeze(t)}});import{DIRECTORY_TREE_LABEL_KEYS as gi}from"@aiquants/directory-tree";import{VIRTUAL_SCROLL_LABEL_KEYS as hi}from"@aiquants/virtualscroll";import{createContext as yi,useContext as Pa,useMemo as Ra,useRef as bi}from"react";import{jsx as vi}from"react/jsx-runtime";var Si,Fr,Ir,_a,Pe,ne,ye=Ee(()=>{"use strict";Ft();Si=Object.freeze({locale:"en",labels:gt.en,treeLabels:Wr(gt.en),engineLabels:Hr(gt.en)}),Fr=yi(Si),Ir=(e,t)=>{let n=bi(null),r=n.current;return r!==null&&t.every(i=>r[i]===e[i])?r:(n.current=e,e)},_a=({locale:e,labels:t,surface:n,children:r})=>{let i=Ar(e,n.locale),o=Ra(()=>Dr(i,t,n),[i,t,n]),a=Ir(o,wn),u=Ir(Wr(a),gi),d=Ir(Hr(a),hi),c=Ra(()=>({locale:i,labels:a,treeLabels:u,engineLabels:d}),[i,a,u,d]);return vi(Fr.Provider,{value:c,children:r})},Pe=()=>Pa(Fr),ne=()=>Pa(Fr).labels});var s,N,B,m,X,$,qe,$a,Te,Bt,E,Mt,Oa,fe=Ee(()=>{"use strict";s={fg:"text-[color:light-dark(#0f172b,#f8fafc)]",fgSecondary:"text-[color:light-dark(#314158,#e2e8f0)]",fgMuted:"text-[color:light-dark(#44536a,#cad5e2)]",onPrimary:"text-[color:light-dark(#ffffff,#0f172b)]"},N={surface:"bg-[color:light-dark(#ffffff,#0f172b)]",subtle:"bg-[color:light-dark(#f8fafc,#1d293d)]",muted:"bg-[color:light-dark(#f1f5f9,#1d293d)]"},B={borderSubtle:"border-[color:light-dark(#e2e8f0,#314158)]",borderControl:"border-[color:light-dark(#62748e,#90a1b9)]"},m={amber:"text-[color:light-dark(#7b3306,#fee685)]",blue:"text-[color:light-dark(#193cb8,#bedbff)]",cyan:"text-[color:light-dark(#104e64,#a2f4fd)]",emerald:"text-[color:light-dark(#004f3b,#a4f4cf)]",fuchsia:"text-[color:light-dark(#8a0194,#f6cfff)]",green:"text-[color:light-dark(#0d542b,#b9f8cf)]",indigo:"text-[color:light-dark(#372aac,#c6d2ff)]",lime:"text-[color:light-dark(#35530e,#d8f999)]",orange:"text-[color:light-dark(#7e2a0c,#ffd6a7)]",pink:"text-[color:light-dark(#a3004c,#fccee8)]",purple:"text-[color:light-dark(#6e11b0,#e9d4ff)]",red:"text-[color:light-dark(#9f0712,#ffc9c9)]",rose:"text-[color:light-dark(#a50036,#ffccd3)]",sky:"text-[color:light-dark(#024a70,#b8e6fe)]",teal:"text-[color:light-dark(#0b4f4a,#96f7e4)]",violet:"text-[color:light-dark(#5d0ec0,#ddd6ff)]"},X={amber:"bg-[color:light-dark(#fffbeb,#461901)]",blue:"bg-[color:light-dark(#eff6ff,#162456)]",emerald:"bg-[color:light-dark(#ecfdf5,#002c22)]",green:"bg-[color:light-dark(#f0fdf4,#032e15)]",purple:"bg-[color:light-dark(#faf5ff,#3c0366)]",rose:"bg-[color:light-dark(#fff1f2,#4d0218)]",sky:"bg-[color:light-dark(#f0f9ff,#052f4a)]"},$={amber:"border-[color:light-dark(#fee685,#7b3306)]",blue:"border-[color:light-dark(#bedbff,#193cb8)]",cyan:"border-[color:light-dark(#a2f4fd,#104e64)]",emerald:"border-[color:light-dark(#a4f4cf,#004f3b)]",fuchsia:"border-[color:light-dark(#f6cfff,#8a0194)]",green:"border-[color:light-dark(#b9f8cf,#0d542b)]",indigo:"border-[color:light-dark(#c6d2ff,#372aac)]",pink:"border-[color:light-dark(#fccee8,#a3004c)]",purple:"border-[color:light-dark(#e9d4ff,#6e11b0)]",rose:"border-[color:light-dark(#ffccd3,#a50036)]",sky:"border-[color:light-dark(#b8e6fe,#024a70)]",teal:"border-[color:light-dark(#96f7e4,#0b4f4a)]",violet:"border-[color:light-dark(#ddd6ff,#5d0ec0)]"},qe={amber:"bg-[color:light-dark(#bb4d00,#fcbb00)]",blue:"bg-[color:light-dark(#155dfc,#51a2ff)]",emerald:"bg-[color:light-dark(#009966,#00d492)]",rose:"bg-[color:light-dark(#ec003f,#ff637e)]",sky:"bg-[color:light-dark(#0084d1,#00bcff)]"},$a={amber:"border-[color:light-dark(#bb4d00,#fcbb00)]"},Te={blue:"bg-[color:light-dark(#193cb8,#bedbff)]",green:"bg-[color:light-dark(#0d542b,#b9f8cf)]",orange:"bg-[color:light-dark(#7e2a0c,#ffd6a7)]",purple:"bg-[color:light-dark(#6e11b0,#e9d4ff)]",red:"bg-[color:light-dark(#9f0712,#ffc9c9)]"},Bt={blue:"hover:bg-[color:light-dark(#162456,#eff6ff)]",red:"hover:bg-[color:light-dark(#460809,#fef2f2)]"},E={hoverSurface:"hover:bg-[color:light-dark(#ffffff,#0f172b)]",hoverMuted:"hover:bg-[color:light-dark(#f1f5f9,#1d293d)]",hoverBlueTint:"hover:bg-[color:light-dark(#eff6ff,#162456)]",hoverRoseTint:"hover:bg-[color:light-dark(#fff1f2,#4d0218)]",hoverFg:"hover:text-[color:light-dark(#0f172b,#f8fafc)]",hoverFgSecondary:"hover:text-[color:light-dark(#314158,#e2e8f0)]",hoverBlueFg:"hover:text-[color:light-dark(#193cb8,#bedbff)]",hoverBlueAccentBorder:"hover:border-[color:light-dark(#155dfc,#51a2ff)]",focusRing:"focus:ring-[color:light-dark(#1447e6,#74d4ff)]",focusBorder:"focus:border-[color:light-dark(#1447e6,#74d4ff)]",focusVisibleRing:"focus-visible:ring-[color:light-dark(#1447e6,#74d4ff)]",focusVisibleOutline:"focus-visible:outline-[color:light-dark(#1447e6,#74d4ff)]",activeRowOutline:"in-focus-visible:data-[contact-map-row-active]:outline-[color:light-dark(#1447e6,#74d4ff)]",ringOffsetSurface:"ring-offset-[color:light-dark(#ffffff,#0f172b)]",selectedRing:"ring-[color:light-dark(#155dfc,#51a2ff)]",activeTabSurface:"data-[state=active]:bg-[color:light-dark(#ffffff,#0f172b)]",activeTabFg:"data-[state=active]:text-[color:light-dark(#0f172b,#f8fafc)]",activeTabBlueFg:"data-[state=active]:text-[color:light-dark(#193cb8,#bedbff)]",treeNameSky:"[&_.directory-tree-name]:text-[color:light-dark(#024a70,#b8e6fe)]"},Mt={mark:"bg-[color:light-dark(#fff085,#733e0a)]",progressTrack:"bg-[color:light-dark(#bedbff,#193cb8)]",scrim:"bg-[color:rgb(15_23_43/0.5)]"},Oa="#71829b"});var C,Lt,w,ke=Ee(()=>{"use strict";C="text-[length:var(--aqcm-font-size-body,0.8125rem)] leading-[var(--aqcm-line-height-body,1.25rem)]",Lt="text-[length:var(--aqcm-font-size-caption,0.6875rem)]",w=`${Lt} leading-[var(--aqcm-line-height-caption,1.25rem)]`});var Yn,Xn,Qn,Jn,Ur=Ee(()=>{"use strict";fe();Yn="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]",Xn=Object.freeze({right:"var(--aqcm-overlay-right, 0px)"}),Qn=`absolute inset-0 ${Mt.scrim}`,Jn=()=>!1});var Ti,Ni,wt,Da,Wa,sn,Rn=Ee(()=>{"use strict";fe();Ti="min-w-11 py-[max(0px,calc((2.75rem_-_1lh)_/_2))]",Ni=2,wt=`focus-visible:outline-2 ${E.focusVisibleOutline} focus-visible:outline-offset-2`,Da=`in-focus-visible:data-[contact-map-row-active]:outline-2 in-focus-visible:data-[contact-map-row-active]:-outline-offset-2 ${E.activeRowOutline}`,Wa=Ni,sn=`inline-block max-w-full underline-offset-2 hover:underline focus-visible:underline ${wt} ${Ti}`});import{clsx as Ei}from"clsx";import{twMerge as ki}from"tailwind-merge";function Me(...e){return ki(Ei(e))}var Pn=Ee(()=>{"use strict"});import{useOverlayDialog as Mi}from"@aiquants/swipe-overlay";import Li from"lucide-react/dist/esm/icons/check.js";import wi from"lucide-react/dist/esm/icons/copy.js";import Ri from"lucide-react/dist/esm/icons/x.js";import{useCallback as dn,useEffect as Ha,useId as Pi,useMemo as Zn,useRef as Ia,useState as _i}from"react";import{createPortal as $i}from"react-dom";import{jsx as re,jsxs as Ye}from"react/jsx-runtime";var Oi,De,Ai,Di,Wi,_n,cn,Hi,Ii,ln,Vr,Kr,er,jr=Ee(()=>{"use strict";Wt();ye();Ur();fe();Rn();ke();Pn();Oi=350,De=e=>e.stopPropagation(),Ai=Object.freeze({onClick:De,onDoubleClick:De,onContextMenu:De,onPointerDown:De,onPointerUp:De,onMouseDown:De,onMouseUp:De,onTouchStart:De,onTouchEnd:De,onKeyDown:De,onKeyUp:De,onFocus:De,onBlur:De}),Di=Me(Yn,"flex items-center justify-center px-4 py-6"),Wi=`relative max-h-full w-full max-w-md overflow-y-auto overscroll-contain rounded-lg border ${B.borderControl} ${N.surface} p-4 shadow-lg transition-colors`,_n=0,cn=null,Hi=()=>{let e=document.body.style;_n+=1,_n===1&&(cn={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},Ii=()=>{if(_n=Math.max(0,_n-1),_n>0||!cn)return;let e=document.body.style;e.userSelect=cn.userSelect,typeof cn.webkitUserSelect<"u"&&(e.webkitUserSelect=cn.webkitUserSelect),cn=null},ln=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Vr=(e,t)=>{let n=new Set;return e.reduce((r,i)=>{let o=typeof i.value=="string"?i.value.trim():"";if(!o)return r;let{normalized:a,key:u,entry:d}=t(o,i);return a&&!n.has(u)&&(n.add(u),r.push(d(a))),r},[])},Kr=({value:e,ariaLabel:t})=>{let[n,r]=_i(!1),i=Ia(null),o=dn(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 c=document.createElement("textarea");c.value=d,c.setAttribute("readonly",""),c.style.position="absolute",c.style.left="-9999px",document.body.appendChild(c),c.select(),c.setSelectionRange(0,c.value.length);let p=document.execCommand("copy");return document.body.removeChild(c),p},[]),a=dn(async d=>{d.preventDefault(),d.stopPropagation(),i.current!==null&&typeof window<"u"&&(window.clearTimeout(i.current),i.current=null);let c=await o(e);r(c),c&&typeof window<"u"&&(i.current=window.setTimeout(()=>{r(!1),i.current=null},1500))},[o,e]);Ha(()=>()=>{i.current!==null&&typeof window<"u"&&(window.clearTimeout(i.current),i.current=null)},[]);let u=n?Li:wi;return re("button",{type:"button",className:`inline-flex h-11 w-11 shrink-0 items-center justify-center rounded-md border ${B.borderControl} ${s.fgMuted} transition-colors ${E.hoverMuted} ${wt}`,onClick:a,"aria-label":t,title:t,children:re(u,{className:"h-3.5 w-3.5","aria-hidden":"true"})})},er=({contactData:e,openEmailsWithGmail:t,openGmailCompose:n,onRequestClose:r})=>{let i=ne(),o=Ia(null),a=Zn(()=>e.contacted_at?at(e.contacted_at,i.recordDate):null,[e.contacted_at,i.recordDate]),u=ln(e.full_name)??i.noName,d=ln(e.company_name),c=ln(e.department),p=ln(e.title),f=Zn(()=>Vr([{fieldKey:"company_name",label:i.fieldCompanyName,value:d},{fieldKey:"department",label:i.fieldDepartment,value:c},{fieldKey:"title",label:i.fieldTitle,value:p}],(v,{fieldKey:L,label:H})=>({normalized:v,key:`${L}-${v.toLowerCase()}`,entry:S=>({fieldKey:L,label:H,value:S})})),[d,c,p,i]),l=Zn(()=>Vr([{fieldKey:"custom_mobile_phone_number",label:i.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:i.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:i.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:i.popupCompanyPhone,value:e.company_phone_number}],(v,{fieldKey:L,label:H})=>{let S=Ln(v);return{normalized:ln(v),key:(S??v).toLowerCase(),entry:ae=>({fieldKey:L,label:H,value:ae,href:S})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,i]),g=Zn(()=>Vr([{fieldKey:"custom_email",label:i.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:i.popupEmail,value:e.email}],(v,{fieldKey:L,label:H})=>{let S=ln(v),M=ft(v,t),ae=!!M?.startsWith("https://mail.google.com");return{normalized:S,key:v.toLowerCase(),entry:I=>({fieldKey:L,label:H,value:I,href:M,isGmailLink:ae})}}),[e.custom_email,e.email,t,i]),y=l.length>0||g.length>0,x=Pi(),k=dn(()=>{r(),o.current=null},[r]),T=dn(v=>v.ownerDocument.getElementById(x),[x]),{dialogProps:U,backdropProps:z}=Mi({isOpen:!0,onClose:k,isCloseBlocked:Jn,initialFocus:T}),b=dn((v,L)=>{L.isGmailLink&&(v.preventDefault(),n(L.value))},[n]),h=dn((v,L)=>{if(!L.isGmailLink){o.current=null;return}let H=Date.now(),S=o.current;if(S&&S.email===L.value&&H-S.timestamp<=Oi){o.current=null,v.preventDefault(),n(L.value);return}o.current={email:L.value,timestamp:H}},[n]);return Ha(()=>(Hi(),Ii),[]),$i(Ye("dialog",{...U,...Ai,"data-contact-popup-root":"true","aria-labelledby":x,className:Di,style:Xn,children:[re("div",{...z,"data-contact-popup-backdrop":"",className:Qn}),Ye("div",{"data-contact-popup-card":"",className:Wi,children:[Ye("div",{className:"flex items-center justify-between gap-4",children:[re("h2",{id:x,tabIndex:-1,className:`wrap-break-word min-w-0 font-semibold ${s.fg} text-lg outline-none`,children:u}),re("button",{type:"button",className:`inline-flex shrink-0 items-center justify-center rounded-md p-3.5 ${s.fgMuted} transition-colors ${E.hoverMuted} ${wt}`,onClick:k,"aria-label":i.close,children:re(Ri,{className:"h-4 w-4","aria-hidden":"true"})})]}),f.length>0?re("div",{className:`mt-2 space-y-2 ${s.fgSecondary} text-sm`,children:f.map(v=>Ye("div",{className:"flex items-center gap-3",children:[re("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:v.value}),re(Kr,{value:v.value,ariaLabel:i.copyField(v.label)})]},v.fieldKey))}):null,Ye("div",{className:`mt-4 space-y-4 ${s.fgSecondary}`,children:[l.length>0?re("div",{children:re("ul",{className:"space-y-3 text-sm",children:l.map(v=>re("li",{className:"flex items-start gap-3",children:Ye("div",{className:"min-w-0 flex-1",children:[re("span",{className:`${s.fgMuted} text-xs`,children:v.label}),Ye("div",{className:"mt-1 flex items-center gap-3",children:[re("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:v.href?re("a",{href:v.href,className:`wrap-break-word ${m.blue} ${sn}`,children:v.value}):re("span",{className:`wrap-break-word ${s.fg}`,children:v.value})}),re(Kr,{value:v.value,ariaLabel:i.copyField(v.label)})]})]})},`${v.fieldKey}-${v.value}`))})}):null,g.length>0?re("div",{children:re("ul",{className:"space-y-3 text-sm",children:g.map(v=>re("li",{className:"flex items-start gap-3",children:Ye("div",{className:"min-w-0 flex-1",children:[re("span",{className:`${s.fgMuted} text-xs`,children:v.label}),Ye("div",{className:"mt-1 flex items-start gap-3",children:[Ye("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[v.href?re("a",{href:v.href,className:`wrap-break-word ${m.blue} ${sn}`,target:v.isGmailLink?"_blank":void 0,rel:v.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:L=>b(L,v),onTouchEnd:L=>h(L,v),children:v.value}):re("span",{className:`wrap-break-word ${s.fg}`,children:v.value}),v.isGmailLink?re("span",{className:`mt-1 block ${w} ${s.fgMuted}`,children:i.popupGmailHint}):null]}),re(Kr,{value:v.value,ariaLabel:i.copyField(v.label)})]})]})},`${v.fieldKey}-${v.value}`))})}):null,a?Ye("div",{className:`mt-2 flex items-center gap-2 ${s.fgMuted} text-sm`,children:[re("span",{className:"text-xs",children:i.popupLastContactDate}),re("span",{children:a})]}):null,y?null:re("p",{className:`${s.fgMuted} text-sm`,children:i.popupNoContactMethods})]})]})]}),document.body)}});import{jsx as _e,jsxs as $n}from"react/jsx-runtime";var tr,Gr=Ee(()=>{"use strict";fe();ke();tr=({fullName:e,title:t="-",companyName:n="-",department:r="-",phoneNumber:i="-",email:o="-",updatedAtText:a="-"})=>$n("div",{className:`flex h-full w-full flex-col justify-center gap-0.5 ${s.fg} 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]`,children:[$n("div",{className:"flex items-center gap-1 sm:hidden",children:[_e("div",{className:`flex-1 truncate font-medium ${s.fg} text-sm leading-tight`,children:e}),_e("div",{className:`shrink-0 whitespace-nowrap ${Lt} ${s.fgMuted}`,children:i})]}),_e("div",{className:"flex items-center gap-1 sm:hidden",children:_e("div",{className:`flex-1 truncate ${s.fgSecondary} text-xs leading-tight`,children:n})}),_e("div",{className:"block sm:hidden",children:_e("span",{className:`w-full truncate text-left ${Lt} ${s.fgSecondary} leading-tight`,children:r})}),$n("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[_e("span",{className:`truncate font-medium ${s.fg}`,children:e}),_e("span",{className:`truncate ${s.fgMuted} text-xs`,children:t})]}),$n("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[_e("span",{className:`truncate ${s.fg}`,children:n}),_e("span",{className:`truncate ${s.fgMuted} text-xs`,children:r})]}),$n("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[_e("span",{className:`truncate ${s.fgSecondary}`,children:i}),_e("span",{className:`truncate ${s.fgMuted} text-xs`,children:o})]}),_e("div",{className:`hidden items-end justify-end ${Lt} ${s.fgMuted} xl:flex`,children:_e("span",{className:"truncate",children:a})})]})});import{formatQuerySets as Fi,parseQuerySets as Bi}from"@aiquants/fuzzy-search";import{getNormalizedVariants as zi,normalizeText as Ui,romajiToKatakana as Vi}from"@aiquants/select-box";var za,Ki,ji,Gi,qi,Ua,Va,Yi,Xi,Qi,Ji,Zi,es,ts,ns,Ka,ja,Fa,Ba,nr,rs,as,qr,Ga,Yr=Ee(()=>{"use strict";za=/[]/g,Ki=/^[\s ]+|[\s ]+$/g,ji=/\s+/,Gi=/^[\p{Script=Latin}\s]+$/u,qi=/\p{Script=Latin}/u,Ua=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1,normalizeVariants:!1,ignoreSpaces:!1,ignoreSymbols:!1,ignoreLongVowels:!1}),Va="union",Yi=65377,Xi=65439,Qi=["\uFF9E","\uFF9F"],Ji=(()=>{let e=new Map;for(let t=Yi;t<=Xi;t+=1){let n=String.fromCharCode(t);e.set(n.normalize("NFKC"),n);for(let r of Qi){let i=(n+r).normalize("NFKC");i.length===1&&e.set(i,n+r)}}return e})(),Zi=/[-ヿ]/u,es=e=>{let t=Array.from(e,n=>Ji.get(n)??n).join("");return Zi.test(t)?null:t},ts=e=>Ui(e.replace(za,"").replace(Ki,""),Ua),ns=e=>{if(!Gi.test(e))return null;let t=Vi(e);return qi.test(t)?null:t},Ka=e=>e.split(ji).filter(Boolean),ja=e=>Bi(e,Va).sets.map(({query:t})=>t),Fa=e=>ja(e).flatMap(t=>Ka(t)),Ba=e=>Fi({combine:Va,sets:Array.from(new Set(e),t=>({query:t}))}),nr=e=>{let t=ja(e.replace(za,"")).map(r=>Ka(ts(r)).join(" ")).filter(r=>r!==""),n=[];for(let r of t){let i=ns(r);if(i===null)return Ba(t);n.push(i)}return Ba(n)},rs=e=>{let t=new Set([...Fa(e),...Fa(nr(e))]),n=new Set;for(let r of t)for(let i of zi(r,Ua)){let o=i.trim();if(!o)continue;n.add(o);let a=es(o);a!==null&&n.add(a)}return Array.from(n)},as=/[.*+?^${}()|[\]\\]/g,qr=e=>{let t=rs(e);if(t.length===0)return null;let n=t.map(r=>r.replace(as,"\\$&")).sort((r,i)=>i.length-r.length);return new RegExp(n.join("|"),"gi")},Ga=(e,t)=>{let n=qr(e);if(n===null)return i=>i;let r=i=>t.some(o=>{let a=i[o];return typeof a=="string"&&a.search(n)!==-1});return i=>{let o=[],a=[];for(let u of i)r(u.item)?o.push(u):a.push(u);return[...o,...a]}}});import{memo as os}from"react";import{Fragment as Xr,jsx as rr}from"react/jsx-runtime";var is,Ne,ar=Ee(()=>{"use strict";Yr();fe();is=`rounded ${Mt.mark} px-1 ${s.fg}`,Ne=os(({text:e,query:t,enabled:n=!0})=>{if(!(n&&t?.trim()&&e))return rr(Xr,{children:e});let r=qr(t);if(r===null)return rr(Xr,{children:e});let i=[],o=0,a=r.exec(e),u=0;for(;a;){let d=a[0],c=a.index;if(c>o&&i.push(e.substring(o,c)),d.length===0){r.lastIndex++,a=r.exec(e);continue}i.push(rr("mark",{className:is,children:d},`highlight-${c}-${u}`)),o=c+d.length,u+=1,a=r.exec(e)}return o<e.length&&i.push(e.substring(o)),rr(Xr,{children:i})});Ne.displayName="HighlightedText"});var Ya={};ai(Ya,{ContactDetailGrid:()=>qa,default:()=>ss});import{useMemo as Qr}from"react";import{Fragment as ls,jsx as Jr,jsxs as cs}from"react/jsx-runtime";var or,qa,ss,Xa=Ee(()=>{"use strict";Wt();ye();jr();Gr();ar();or=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},qa=({contactData:e,searchTerm:t,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:i,isPopupVisible:o,onRequestClose:a})=>{let u=ne(),d=Qr(()=>tn(e),[e]),c=Qr(()=>nn(e),[e]),p=d.value??"-",f=c.value??"-",l=Qr(()=>at(e.updated_at,u.recordDateTime),[e.updated_at,u.recordDateTime]),g=or(e.full_name)??u.noName,y=or(e.company_name),x=or(e.department),k=(T,U="-")=>Jr(Ne,{text:T??U,query:t,enabled:n});return cs(ls,{children:[Jr(tr,{fullName:k(g),title:k(or(e.title)),companyName:k(y),department:k(x),phoneNumber:f,email:k(p),updatedAtText:l}),o?Jr(er,{contactData:e,openEmailsWithGmail:r,openGmailCompose:i,onRequestClose:a}):null]})},ss=qa});ye();fe();ke();import{DEFAULT_FUZZY_SEARCH_OPTIONS as on}from"@aiquants/fuzzy-search";import{memo as Ci,useId as Aa}from"react";import{jsx as ot,jsxs as ht}from"react/jsx-runtime";var Br=Ci(({searchOptions:e,setSearchOptions:t})=>{let n=ne(),r=`flex flex-col gap-1 rounded-md border ${N.surface} px-2 py-1 shadow-sm transition-colors`,i="text-xs font-semibold",o=Aa(),a=Aa(),u=[];return u.push(ht("div",{className:`${r} ${$.sky} border-l-4`,children:[ht("div",{className:`${i} ${m.sky}`,children:["\u{1F4D8} ",n.advancedLearningHeading]}),ot("label",{htmlFor:o,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.advancedLearningLabel}),ot("input",{id:o,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||on.learningWeight,onChange:d=>t(c=>({...c,learningWeight:parseFloat(d.target.value)})),className:"h-11 w-full"}),ht("span",{className:`${m.sky} text-xs`,children:[n.currentValueLabel," ",e.learningWeight||on.learningWeight]}),ot("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.advancedLearningHint})]},"learning")),u.push(ht("div",{className:`${r} ${$.indigo} border-l-4`,children:[ht("div",{className:`${i} ${m.indigo}`,children:["\u23F1\uFE0F ",n.advancedDebounceHeading]}),ot("label",{htmlFor:a,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.advancedDebounceLabel}),ot("input",{id:a,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs??on.debounceMs,onChange:d=>t(c=>({...c,debounceMs:parseInt(d.target.value,10)})),className:"h-11 w-full"}),ht("span",{className:`${m.indigo} text-xs`,children:[n.currentValueLabel," ",e.debounceMs??on.debounceMs]}),ot("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.advancedDebounceHint})]},"debounce")),ht("section",{className:"space-y-3",children:[ht("div",{className:"flex items-center justify-between gap-3",children:[ht("div",{className:`flex items-center gap-2 font-semibold ${s.fgSecondary} text-xs transition-colors`,children:[ot("span",{children:"\u26A1"}),ot("span",{className:"tracking-wide",children:n.settingsAdvancedTab})]}),ot("button",{type:"button",onClick:()=>t(d=>({...d,learningWeight:on.learningWeight,debounceMs:on.debounceMs})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border ${B.borderControl} ${N.muted} px-2 font-medium ${s.fgSecondary} ${C} transition-colors ${E.hoverSurface}`,title:n.resetToDefaultsTitle,children:n.reset})]}),ot("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:u})]})});Br.displayName="AdvancedSearchSettings";ye();fe();ke();import{DEFAULT_FUZZY_SEARCH_OPTIONS as zt}from"@aiquants/fuzzy-search";import{memo as xi,useId as it}from"react";import{jsx as se,jsxs as de}from"react/jsx-runtime";var zr=xi(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:i,setOpenEmailsWithGmail:o})=>{let a=ne(),u=`flex flex-col gap-1 rounded-md border ${N.surface} px-2 py-1 shadow-sm transition-colors`,d="text-xs font-semibold",c=it(),p=it(),f=it(),l=it(),g=it(),y=it(),x=it(),k=it(),T=it(),U=it(),z=[];return z.push(de("div",{className:`${u} ${$.blue} border-l-4`,children:[de("div",{className:`${d} ${m.blue}`,children:["\u{1F3AF} ",a.basicThresholdHeading]}),se("label",{htmlFor:c,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicThresholdLabel}),se("input",{id:c,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??zt.threshold,onChange:b=>t(h=>({...h,threshold:parseFloat(b.target.value)})),className:"h-11 w-full"}),de("span",{className:`${m.blue} text-xs`,children:[a.currentValueLabel," ",e.threshold??zt.threshold]}),se("p",{className:`${w} ${s.fgMuted} transition-colors`,children:e.sortBy==="relevance"?a.basicThresholdRangeRelevance:a.basicThresholdRange})]},"threshold")),z.push(de("div",{className:`${u} ${$.amber} border-l-4`,children:[de("div",{className:`${d} ${m.amber}`,children:["\u{1FA84} ",a.basicDisplayHeading]}),de("label",{htmlFor:p,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:p,type:"checkbox",checked:e.caseSensitive??zt.caseSensitive,onChange:b=>t(h=>({...h,caseSensitive:b.target.checked})),className:"h-3 w-3"}),a.basicCaseSensitive]}),de("label",{htmlFor:f,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:f,type:"checkbox",checked:n,onChange:b=>r(b.target.checked),className:"h-3 w-3"}),a.basicHighlight]}),de("label",{htmlFor:l,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:l,type:"checkbox",checked:i,onChange:b=>o(b.target.checked),className:"h-3 w-3"}),a.basicOpenEmailsWithGmail]}),de("div",{className:"flex flex-col gap-1",children:[se("label",{htmlFor:g,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicMultiTermOperator}),de("select",{id:g,value:e.multiTermOperator??zt.multiTermOperator,onChange:b=>t(h=>({...h,multiTermOperator:b.target.value})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,children:[se("option",{value:"or",children:a.basicOperatorOr}),se("option",{value:"and",children:a.basicOperatorAnd})]}),se("p",{className:`${w} ${s.fgMuted} transition-colors`,children:a.basicMultiTermHint})]})]},"display")),z.push(de("div",{className:`${u} ${$.emerald} border-l-4`,children:[de("div",{className:`${d} ${m.emerald}`,children:["\u{1F4DA} ",a.basicSortHeading]}),de("div",{className:"flex flex-col gap-2",children:[se("label",{htmlFor:y,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicSortBy}),de("select",{id:y,value:e.sortBy||zt.sortBy,onChange:b=>t(h=>({...h,sortBy:b.target.value})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,children:[se("option",{value:"score",children:a.basicSortByScore}),se("option",{value:"relevance",children:a.basicSortByRelevance}),se("option",{value:"original",children:a.basicSortByOriginal})]})]}),de("div",{className:"flex flex-col gap-2",children:[se("label",{htmlFor:x,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicSortOrder}),de("select",{id:x,value:e.sortOrder||zt.sortOrder,onChange:b=>t(h=>({...h,sortOrder:b.target.value})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,children:[se("option",{value:"desc",children:a.basicSortDescending}),se("option",{value:"asc",children:a.basicSortAscending})]})]})]},"sorting")),z.push(de("div",{className:`${u} ${$.purple} border-l-4`,children:[de("div",{className:`${d} ${m.purple}`,children:["\u2699\uFE0F ",a.basicEngineHeading]}),se("label",{htmlFor:k,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:a.basicStrategy}),de("select",{id:k,value:e.parallelSearchStrategy||zt.parallelSearchStrategy,onChange:b=>t(h=>({...h,parallelSearchStrategy:b.target.value})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,children:[se("option",{value:"balanced",children:a.basicStrategyBalanced}),se("option",{value:"index-first",children:a.basicStrategyIndexFirst}),se("option",{value:"levenshtein-first",children:a.basicStrategyLevenshteinFirst})]}),de("div",{className:"mt-2 space-y-2",children:[de("label",{htmlFor:T,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:T,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:b=>t(h=>({...h,enableIndexFiltering:b.target.checked})),className:"h-3 w-3"}),a.basicIndexFiltering]}),de("label",{htmlFor:U,className:`flex min-h-11 items-center gap-2 ${s.fgSecondary} ${C} transition-colors`,children:[se("input",{id:U,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:b=>t(h=>({...h,enableLevenshtein:b.target.checked})),className:"h-3 w-3"}),a.basicLevenshtein]})]})]},"engine")),de("section",{className:"space-y-3",children:[de("div",{className:`flex items-center gap-2 font-semibold ${m.blue} text-xs transition-colors`,children:[se("span",{children:"\u{1F527}"}),se("span",{className:"tracking-wide",children:a.settingsBasicTab})]}),se("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:z})]})});zr.displayName="BasicSearchSettings";Wt();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as ds}from"@aiquants/swipe-overlay";import us from"lucide-react/dist/esm/icons/badge-check.js";import ms from"lucide-react/dist/esm/icons/building-2.js";import ps from"lucide-react/dist/esm/icons/calendar-clock.js";import fs from"lucide-react/dist/esm/icons/check.js";import gs from"lucide-react/dist/esm/icons/copy.js";import hs from"lucide-react/dist/esm/icons/id-card.js";import ys from"lucide-react/dist/esm/icons/mail.js";import bs from"lucide-react/dist/esm/icons/phone.js";import Ss from"lucide-react/dist/esm/icons/user-round.js";import{useCallback as vs,useEffect as Cs,useMemo as lr,useRef as xs,useState as Ts}from"react";var st={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)};ye();fe();fe();Pn();import*as Xe from"@radix-ui/react-tabs";import*as ir from"react";import{jsx as Zr}from"react/jsx-runtime";var sr=Xe.Root,On=ir.forwardRef(({className:e,...t},n)=>Zr(Xe.List,{ref:n,className:Me(`inline-flex h-10 items-center justify-center rounded-md ${N.muted} p-1 ${s.fgMuted}`,e),...t}));On.displayName=Xe.List.displayName;var Ut=ir.forwardRef(({className:e,...t},n)=>Zr(Xe.Trigger,{ref:n,className:Me(`inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ${E.ringOffsetSurface} transition-all focus-visible:outline-hidden focus-visible:ring-2 ${E.focusVisibleRing} focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 ${E.activeTabSurface} ${E.activeTabFg} data-[state=active]:shadow-2xs`,e),...t}));Ut.displayName=Xe.Trigger.displayName;var Vt=ir.forwardRef(({className:e,...t},n)=>Zr(Xe.Content,{ref:n,className:Me(`mt-2 ${E.ringOffsetSurface} focus-visible:outline-hidden focus-visible:ring-2 ${E.focusVisibleRing} focus-visible:ring-offset-2 data-[state=inactive]:hidden`,e),...t}));Vt.displayName=Xe.Content.displayName;Rn();ke();ar();import{jsx as R,jsxs as Ce}from"react/jsx-runtime";var Qa=`truncate font-semibold ${s.fg} ${C}`,Ja={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},Ns=({icon:e,label:t,value:n,fieldKey:r,copyValue:i,onCopy:o,isCopied:a,linkHref:u,searchTerm:d,enableHighlighting:c})=>{let p=ne(),f=!!(o&&r&&i),l=u?.startsWith("https://mail.google.com")?"_blank":void 0;return Ce("div",{className:`flex items-center justify-between gap-2 rounded-lg border ${B.borderSubtle} ${N.subtle} px-2.5 py-1.5 transition-colors`,children:[Ce("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[R("div",{className:`flex h-7 w-7 items-center justify-center rounded-full ${N.surface} ${s.fgMuted} transition-colors`,children:R(e,{size:14})}),Ce("div",{className:"min-w-0 flex-1",children:[R("div",{className:`font-medium ${w} ${s.fgMuted}`,children:t}),u?R("a",{href:u,className:`align-top ${Qa} ${sn}`,target:l,rel:l?"noopener noreferrer":void 0,children:R(Ne,{text:n,query:d??"",enabled:c})}):R("div",{className:Qa,children:R(Ne,{text:n,query:d??"",enabled:c})})]})]}),f?R("button",{type:"button",onClick:()=>o&&r&&i&&o(r,i,t),className:`inline-flex h-11 w-11 shrink-0 touch-manipulation items-center justify-center rounded-full border ${B.borderControl} ${N.surface} ${s.fgMuted} transition-colors ${E.hoverBlueAccentBorder} ${E.hoverBlueFg} ${wt}`,"aria-label":p.copyField(t),children:a?R(fs,{size:14}):R(gs,{size:14})}):null]})},Za=({items:e,searchTerm:t,enableHighlighting:n})=>R("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(r=>Ce("div",{className:`flex flex-col gap-0.5 rounded-md border ${B.borderSubtle} ${N.surface} px-2 py-1 transition-colors`,children:[R("dt",{className:`font-semibold ${w} ${s.fgMuted} uppercase tracking-wide`,children:r.label}),R("dd",{className:`wrap-break-word ${s.fg} text-xs`,children:R(Ne,{text:r.value,query:t??"",enabled:n})})]},r.fieldKey))}),ea=({title:e})=>R("h3",{className:`font-semibold ${s.fgSecondary} text-xs`,children:e}),Es=()=>{let e=ne();return Ce("div",{className:`flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border ${B.borderSubtle} border-dashed ${N.surface} p-4 text-center transition-colors`,children:[R("p",{className:`font-medium ${s.fgMuted} text-xs`,children:e.detailEmptyTitle}),R("p",{className:`${w} ${s.fgMuted}`,children:e.detailEmptyHint})]})},ks=Object.freeze({overlay:ds,pane:void 0}),un=({contact:e,placement:t,searchTerm:n,enableHighlighting:r,style:i,className:o=""})=>{let a=ne(),[u,d]=Ts(null),c=xs(null),p=lr(()=>({...Ja,...i}),[i]);Cs(()=>()=>{c.current!==null&&window.clearTimeout(c.current)},[]);let f=lr(()=>tn(e),[e]),l=lr(()=>nn(e),[e]),g=lr(()=>at(e?.contacted_at,a.recordDateTime),[e?.contacted_at,a.recordDateTime]),y=vs(async(S,M,ae)=>{try{await navigator.clipboard.writeText(M),d(S),c.current!==null&&window.clearTimeout(c.current),c.current=window.setTimeout(()=>{d(null)},2e3)}catch(I){st.error("Failed to copy contact detail",I)}},[]);if(!e)return R("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border ${B.borderSubtle} ${N.surface} shadow-sm transition-colors`,style:Ja,children:R(Es,{})});let x=[te(e.title),te(e.department)].filter(S=>S!=="-"),k=[x.join(" / "),te(e.company_name)].filter(S=>S&&S!=="-").join(" \u30FB ")||"-",T=Ge(e.full_name)??a.noName,U=[{fieldKey:"full_name",label:a.fieldFullName,value:T},{fieldKey:"full_name_reading",label:a.fieldFullNameReading,value:te(e.full_name_reading)},{fieldKey:"title",label:a.fieldTitle,value:te(e.title)},{fieldKey:"department",label:a.fieldDepartment,value:te(e.department)},{fieldKey:"company_name",label:a.fieldCompanyName,value:te(e.company_name)},{fieldKey:"company_name_reading",label:a.fieldCompanyNameReading,value:te(e.company_name_reading)},{fieldKey:"address",label:a.fieldAddress,value:te(e.address)},{fieldKey:"postal_code",label:a.fieldPostalCode,value:te(e.postal_code)},{fieldKey:"url",label:a.fieldUrl,value:te(e.url)}],z=[{label:a.fieldCustomEmail,value:te(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:a.fieldEmail,value:te(e.email),fieldKey:"email",rawValue:e.email}].filter(S=>S.value!=="-"),b=[{label:a.fieldCustomMobilePhone,value:te(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:a.fieldMobilePhone,value:te(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:a.fieldCompanyPhone,value:te(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:a.fieldCompanyFax,value:te(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(S=>S.value!=="-"),h=[{fieldKey:"person_id",label:"person_id",value:te(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:te(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:te(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:te(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:te(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:te(e.is_in_eight)},{fieldKey:"created_by",label:a.fieldCreatedBy,value:te(e.created_by)},{fieldKey:"created_at",label:a.fieldCreatedAt,value:at(e.created_at,a.recordDateTime)},{fieldKey:"updated_by",label:a.fieldUpdatedBy,value:te(e.updated_by)},{fieldKey:"updated_at",label:a.fieldUpdatedAt,value:at(e.updated_at,a.recordDateTime)}],v=[{rowKey:"person_id",icon:hs,label:"person_id",value:te(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:ys,label:a.summaryEmail,value:f.value??"-",fieldKey:"primary_email",copyValue:f.value,linkHref:ft(f.value,!1)},{rowKey:"primary_phone",icon:bs,label:a.summaryPhone,value:l.value??"-",fieldKey:"primary_phone",copyValue:l.value,linkHref:Ln(l.value)},{rowKey:"contacted_at",icon:ps,label:a.summaryLastContact,value:g}],L=[{sectionKey:"email",title:a.sectionEmail,emptyText:a.sectionEmailEmpty,entries:z,recommendedKey:f.fieldKey??null,resolveHref:S=>ft(S!=null?String(S):null,!1)},{sectionKey:"phone",title:a.sectionPhone,emptyText:a.sectionPhoneEmpty,entries:b,recommendedKey:l.fieldKey??null,resolveHref:S=>Ln(S!=null?String(S):null)}],H=[{value:"summary",label:a.detailTabSummary,content:Ce("div",{className:"flex flex-col gap-4",children:[Ce("div",{className:"flex flex-col gap-1",children:[Ce("div",{className:`flex items-center gap-2 ${s.fgMuted} text-sm`,children:[R(ms,{size:16}),R("span",{children:R(Ne,{text:te(e.company_name),query:n??"",enabled:r})})]}),x.length>0?R("div",{className:`${s.fgMuted} text-sm`,children:x.map((S,M)=>Ce("span",{children:[M>0&&" / ",R(Ne,{text:S,query:n??"",enabled:r})]},`header-line-${M}`))}):null]}),R("div",{className:"flex flex-col gap-3",children:v.map(S=>R(Ns,{icon:S.icon,label:S.label,value:S.value,fieldKey:S.fieldKey,copyValue:S.copyValue,onCopy:y,isCopied:S.fieldKey?u===S.fieldKey:!1,linkHref:S.linkHref,searchTerm:n,enableHighlighting:r},S.rowKey))})]})},{value:"basic",label:a.detailTabBasic,content:Ce("div",{className:"flex flex-col gap-3",children:[R(ea,{title:a.detailBasicProfile}),R(Za,{items:U,searchTerm:n,enableHighlighting:r})]})},{value:"contact",label:a.detailTabContact,content:R("div",{className:"flex flex-col gap-4",children:L.map(({sectionKey:S,title:M,emptyText:ae,entries:I,recommendedKey:be,resolveHref:oe})=>Ce("div",{className:"flex flex-col gap-2",children:[R(ea,{title:M}),I.length===0?R("p",{className:`${s.fgMuted} text-xs`,children:ae}):R("div",{className:"flex flex-col gap-2",children:I.map(W=>{let A=oe(W.rawValue),q=W.fieldKey===be;return Ce("div",{className:`flex items-center justify-between gap-2 rounded-lg border ${B.borderSubtle} ${N.surface} px-3 py-2 transition-colors`,children:[Ce("div",{className:"min-w-0 flex-1",children:[R("div",{className:`font-medium ${s.fgMuted} text-xs`,children:W.label}),R("div",{className:`wrap-break-word ${s.fg} text-sm`,children:A?R("a",{href:A,className:`text-inherit ${sn}`,children:R(Ne,{text:W.value,query:n??"",enabled:r})}):R(Ne,{text:W.value,query:n??"",enabled:r})})]}),q?Ce("span",{className:`inline-flex shrink-0 items-center gap-1 rounded-full ${X.emerald} px-2 py-0.5 font-semibold ${w} ${m.emerald} transition-colors`,children:[R(us,{size:14}),a.preferred]}):null]},W.fieldKey)})})]},S))})},{value:"meta",label:a.detailTabMeta,content:Ce("div",{className:"flex flex-col gap-3",children:[R(ea,{title:a.detailTabMeta}),R(Za,{items:h,searchTerm:n,enableHighlighting:r})]})}];return Ce("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border ${B.borderSubtle} ${N.surface} shadow-sm transition-colors ${o}`.trim(),style:p,children:[R("div",{className:`${B.borderSubtle} border-b px-3 py-1.5 transition-colors ${N.subtle}`,children:Ce("div",{className:"flex items-center gap-2",children:[R("div",{className:`flex h-8 w-8 items-center justify-center rounded-full ${X.blue} ${m.blue} transition-colors`,children:R(Ss,{size:16})}),Ce("div",{className:"min-w-0 flex-1",children:[R("div",{className:`truncate font-semibold ${s.fg} text-sm`,children:R(Ne,{text:T,query:n??"",enabled:r})}),R("div",{className:`truncate ${w} ${s.fgMuted}`,children:R(Ne,{text:k,query:n??"",enabled:r})})]})]})}),Ce(sr,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[R(On,{className:`grid h-auto grid-cols-4 gap-1 rounded-none ${B.borderSubtle} border-b ${N.subtle} px-2 py-1 transition-colors`,children:H.map(S=>R(Ut,{value:S.value,className:`flex min-h-11 min-w-0 touch-manipulation rounded-md px-1 py-1 font-semibold ${s.fgSecondary} ${C} transition-colors ${E.activeTabSurface} ${E.activeTabBlueFg}`,children:R("span",{className:"min-w-0 truncate",children:S.label})},S.value))}),H.map(S=>R(Vt,{value:S.value,className:`scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors ${s.fgSecondary}`,style:ks[t],children:S.content},S.value))]})]})};Ft();ye();fe();ke();import{memo as Ms}from"react";import{jsx as yt,jsxs as cr}from"react/jsx-runtime";var ta=Ms(({recordCount:e,companyCount:t,phase:n,loadedCount:r,totalCount:i,errorMessage:o,onRetry:a})=>{let{locale:u,labels:d}=Pe(),c=ee(u,e),p=ee(u,t);return cr("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[cr("span",{className:"flex items-baseline gap-1",children:[yt("span",{className:s.fgMuted,children:d.annotationTotalLabel}),yt("span",{className:s.fg,"data-testid":"contact-map-record-count",children:c}),yt("span",{className:s.fgMuted,children:d.recordUnit(c)})]}),cr("span",{className:"flex items-baseline gap-1",children:[yt("span",{className:s.fgMuted,children:d.annotationCompaniesLabel}),yt("span",{className:s.fg,"data-testid":"contact-map-company-count",children:p}),yt("span",{className:s.fgMuted,children:d.companyUnit(p)})]}),n==="streaming"||n==="idle"?yt("span",{"data-testid":"contact-map-stream-badge",className:`ml-2 inline-flex items-center gap-1.5 rounded-full ${X.blue} px-2 py-0.5 font-medium ${m.blue} text-xs`,children:i!==null&&i>0?d.annotationStreamingProgress({loaded:r,total:i,percent:Math.min(100,Math.round(r/i*100))}):d.annotationStreamingCount(r)}):null,n==="retrying"?yt("span",{"data-testid":"contact-map-reconnecting-badge",className:`ml-2 inline-flex items-center gap-1.5 rounded-full ${X.amber} px-2 py-0.5 font-medium ${m.amber} text-xs`,children:d.annotationReconnecting(r)}):null,n==="failed"||n==="auth-required"?cr("span",{"data-testid":"contact-map-error-badge",className:`ml-2 inline-flex items-center gap-1.5 rounded-full ${X.rose} px-2 py-0.5 font-medium ${m.rose} text-xs`,title:n==="failed"?o??void 0:void 0,children:["\u26D4 ",n==="auth-required"?d.annotationAuthRequired:d.annotationLoadFailed(r),a?yt("button",{type:"button","data-testid":"contact-map-retry-button",onClick:a,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border ${$.rose} ${N.surface} px-1.5 font-semibold ${C} ${m.rose} transition-colors ${E.hoverRoseTint}`,children:d.annotationRetry}):null]}):null]})});ta.displayName="ContactMapAnnotation";an();import{useMemo as ti}from"react";Ht();an();ye();import{createContext as ws,useContext as Rs,useMemo as Ps}from"react";Ht();an();$r();var Ls=["indexWorker","levenshteinWorker","treeWorker"];function eo(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 ${ie(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${ie(n)}`)}}var to={setting:"workerUrls"},no=(e,t)=>{if(e===void 0)return;let{setting:n,keys:r=Ls,hints:i={}}=t;if(!rn(e))throw new TypeError(`[contact-map] ${n} must be a plain object or left out; got ${ie(e)}`);let o=Object.getOwnPropertyNames(e).map(d=>({key:d,url:e[d]})),a=o.find(({key:d,url:c})=>c!==void 0&&!r.includes(d));if(a!==void 0){let d=Object.hasOwn(i,a.key)?i[a.key]:void 0,c=d===void 0?Gn(a.key,r):void 0;throw new RangeError(`[contact-map] ${n} has a key it does not take (it takes ${r.join(", ")}${d===void 0?"":`; ${d}`}${c===void 0?"":`; did you mean ${JSON.stringify(c)}?`}); got ${ie(a.key)}`)}let u=Object.create(null);for(let{key:d,url:c}of o){let p=d;eo(n,p,c),c!==void 0&&(u[p]=c)}return u};function Gu(e,t=to){no(e,t)}function ro(e){eo("workerUrls","treeWorker",e)}var mn=(e,t,n=to)=>{let r=no(t,n);return{indexWorker:r?.indexWorker===void 0?e?.indexWorker:r.indexWorker,levenshteinWorker:r?.levenshteinWorker===void 0?e?.levenshteinWorker:r.levenshteinWorker,treeWorker:r?.treeWorker===void 0?e?.treeWorker:r.treeWorker}};import{jsx as na}from"react/jsx-runtime";var ao=e=>{if(!rn(e))throw new TypeError(`[contact-map] config must be a plain object; got ${ie(e)}`);let t=e;return{streamEndpoint:Re(t,"streamEndpoint"),openEmailsWithGmail:Re(t,"openEmailsWithGmail"),treeWorkerFactory:Re(t,"treeWorkerFactory"),workerUrls:mn(void 0,Re(t,"workerUrls")),locale:Re(t,"locale"),labels:Re(t,"labels")}},oo=({workerUrls:e,...t})=>{let{indexWorker:n,levenshteinWorker:r,treeWorker:i}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:n,levenshteinWorker:r,treeWorker:i})}))},_s=oo(ao({})),io=ws(_s),$s=Object.freeze({locale:"locale",labels:"labels"});function ra({config:e,chromeSurface:t,children:n}){let{streamEndpoint:r,openEmailsWithGmail:i,treeWorkerFactory:o,workerUrls:a,locale:u,labels:d}=ao(e),{indexWorker:c,levenshteinWorker:p,treeWorker:f}=a,l=Ps(()=>oo({streamEndpoint:r,openEmailsWithGmail:i,treeWorkerFactory:o,workerUrls:{indexWorker:c,levenshteinWorker:p,treeWorker:f},locale:u,labels:d}),[r,i,o,c,p,f,u,d]);return na(io.Provider,{value:l,children:na(_a,{locale:u,labels:d,surface:t,children:n})})}function Os({config:e,children:t}){return na(ra,{config:e,chromeSurface:$s,children:t})}function bt(){return Rs(io)}import{useCallback as aa,useEffect as Fs,useMemo as mr,useSyncExternalStore as so}from"react";Ht();var As=1e3,Ds=3e4,Ws=6;function ur(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 ${ie(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${ie(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 ${ie(e)}`)}var Hs=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}),Is=e=>Array.isArray(e.records),dr=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?.()};ur(t.endpoint),this.fetchFn=t.fetchFn??((...n)=>fetch(...n)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??As,this.maxRetryDelayMs=t.maxRetryDelayMs??Ds,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Ws,this.logger=t.logger??st}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,r=await this.streamOnce();if(r==="aborted")return;if(r==="complete"){this.publishRecords({isComplete:!0,phase:"complete",error:null});return}if(r==="auth-required"){this.setState({phase:"auth-required",isLoading:!1,error:new Error("Authentication required")});return}if(r==="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 i=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 ${i}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(i),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(n=>{let r=setTimeout(()=>{this.wakeRetryWait=null,n()},t);this.wakeRetryWait=()=>{clearTimeout(r),this.wakeRetryWait=null,n()}})}buildStreamUrl(){if(!this.lastCursor)return this.endpoint;let t=this.endpoint.includes("?")?"&":"?",n=new URLSearchParams;return this.lastCursor.contacted_at!==null&&n.set("cursor_contacted_at",this.lastCursor.contacted_at),n.set("cursor_person_id",String(this.lastCursor.person_id)),`${this.endpoint}${t}${n.toString()}`}async streamOnce(){this.activeController=new AbortController;try{let t=await this.fetchFn(this.buildStreamUrl(),{signal:this.activeController.signal,credentials:"same-origin"});if(t.status===401||t.status===403)return"auth-required";if(t.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(),r=new TextDecoder,i="",o=!1,a=!1;for(;;){let{done:u,value:d}=await n.read();if(u)break;let c=r.decode(d,{stream:!0}),p=(i+c).split(`
|
|
2
|
+
`);i=p.pop()??"";let f=!1;for(let l of p){let g=l.trim();if(!g)continue;let y;try{y=JSON.parse(g)}catch(x){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",x);continue}if("type"in y&&y.type==="METADATA"){Number.isSafeInteger(y.total)&&y.total>=0&&this.setState({totalCount:y.total});continue}if(!Is(y)){this.logger.warn("[ContactMapStream] server reported error:","error"in y?y.error:""),a=!0;continue}for(let x of y.records)x&&typeof x.person_id=="number"&&(this.recordMap.set(x.person_id,Hs(x)),f=!0);y.nextCursor&&(this.lastCursor=y.nextCursor),y.isLast&&(o=!0)}f&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return a?(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 Qe=null,Bs=e=>{if(Qe!==null&&Qe.endpoint===e)return Qe;if(ur(e),Qe===null)return Qe=new dr({endpoint:e}),Qe;if(Qe.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Qe.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 Qe},lm=()=>{Qe?.dispose(),Qe=null},zs=new Map,Us={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Vs=()=>{let{streamEndpoint:e}=bt();return mr(()=>(ur(e),e),[e])};function Ks(){let e=Vs(),t=aa(()=>Bs(e),[e]);Fs(()=>{let a=t();a.start(),a.retryNow()},[t]);let n=aa(a=>t().subscribe(a),[t]),r=so(n,()=>t().getState(),()=>Us),i=so(n,()=>t().getRecordMap(),()=>zs),o=aa(()=>t().retryNow(),[t]);return mr(()=>({...r,recordMap:i,retryNow:o}),[r,i,o])}var js=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 pr(){let{records:e,recordMap:t,isComplete:n,phase:r,loadedCount:i,totalCount:o,error:a,retryNow:u}=Ks(),d=mr(()=>js(e),[e]);return{context:mr(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:r==="failed",streamPhase:r,loadedCount:i,companyCount:d,totalCount:o,errorMessage:a?.message??null}),[e,t,n,r,i,d,o,a]),retryNow:u}}ye();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Mc,parseQuerySets as Lc}from"@aiquants/fuzzy-search";import{useFuzzySearch as wc}from"@aiquants/fuzzy-search/react";import Rc from"lucide-react/dist/esm/icons/search.js";import{useCallback as Sn,useEffect as vt,useMemo as Pt,useRef as Qo,useState as et,useTransition as Pc}from"react";import{useNavigation as _c,useSearchParams as $c}from"react-router";Yr();an();import{useCallback as Kt,useEffect as Gs,useRef as lo}from"react";var Rt=e=>{let t=lo(null),n=lo({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),r=e?.dragThreshold??4,i=Kt(f=>{let l=f.currentTarget,g=f.deltaY;!l||g===0||(f.preventDefault(),l.scrollBy({left:g,behavior:"smooth"}))},[]),o=Kt(f=>{t.current?.removeEventListener("wheel",i),t.current=f,f?.addEventListener("wheel",i,{passive:!1})},[i]);Gs(()=>()=>{t.current&&t.current.removeEventListener("wheel",i)},[i]);let a=Kt(f=>{if(f.pointerType==="touch")return;let l=n.current;l.isPointerDown=!0,l.isDragging=!1,l.startX=f.clientX,l.scrollLeft=f.currentTarget.scrollLeft,l.pointerId=f.pointerId,l.hasCapture=!1,l.pointerType=f.pointerType},[]),u=Kt(f=>{let l=n.current;if(!l.isPointerDown||l.pointerType==="touch")return;let g=f.currentTarget,y=f.clientX-l.startX;!l.isDragging&&Math.abs(y)>r&&(l.isDragging=!0,l.hasCapture||(g.setPointerCapture?.(f.pointerId),l.hasCapture=!0)),l.isDragging&&(f.preventDefault(),g.scrollLeft=l.scrollLeft-y)},[r]),d=Kt(f=>{let l=n.current;if(l.pointerType==="touch")return;let g=f.currentTarget;l.isPointerDown&&l.hasCapture&&g.hasPointerCapture?.(f.pointerId)&&g.releasePointerCapture(f.pointerId),l.isDragging&&(l.didDrag=!0,window.setTimeout(()=>{l.didDrag=!1},0)),l.isPointerDown=!1,l.isDragging=!1,l.pointerId=0,l.hasCapture=!1},[]),c=Kt(f=>{d(f)},[d]),p=Kt(f=>{n.current.didDrag&&(f.preventDefault(),f.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:o,onPointerDown:a,onPointerMove:u,onPointerUp:c,onPointerLeave:c,onPointerCancel:c,onClickCapture:p}};Ft();ye();import{DEFAULT_FUZZY_SEARCH_OPTIONS as qs}from"@aiquants/fuzzy-search";var fr=e=>{let{indexWorkerOptions:t,levenshteinWorkerOptions:n,...r}=qs;return{...r,autoSearchOnIndexRebuild:!1,multiTermOperator:"and",workerUrls:e,indexWorkerOptions:{...t},levenshteinWorkerOptions:{...n}}};fe();fe();Pn();import{jsx as co}from"react/jsx-runtime";function uo({value:e,max:t=100,className:n,indicatorClassName:r,...i}){let o=e===void 0,a=o?0:Math.min(100,Math.max(0,e/t*100));return co("div",{role:"progressbar","aria-valuenow":o?void 0:a,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:Me(`relative h-2 w-full overflow-hidden rounded-full ${Mt.progressTrack}`,n),...i,children:co("div",{"data-slot":"progress-indicator",className:Me(`h-full rounded-full ${qe.blue} transition-[width] duration-300 ease-in-out will-change-transform`,o&&"w-1/3 animate-progress-indeterminate",r),style:o?void 0:{width:`${a}%`}})})}ke();var pn="view";import{useCallback as pc,useState as fc}from"react";import{useSearchParams as gc}from"react-router";ye();fe();ke();Wt();import{Panel as So,PanelGroup as yl,PanelResizeHandle as bl}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Sl,VirtualScroll as vl,virtualScrollItemElementId as Cl}from"@aiquants/virtualscroll";import{lazy as xl,memo as Tl,Suspense as Nl,useCallback as Fe,useEffect as ko,useId as vo,useLayoutEffect as Mo,useMemo as jt,useRef as fn,useState as Wn}from"react";var An={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},Dn={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function gr(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,n=t+e.scrollbarSafetyBuffer,r=n+e.hysteresisSafetyMargin,i=r-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:r,hysteresisWidth:i}}import{useCallback as Ys,useEffect as Xs,useState as Qs}from"react";var mo=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:r=4,minFallbackHeight:i=240}=t??{},[o,a]=Qs(600),u=Ys(()=>{if(typeof window>"u")return;let d=e.current;if(!d||d.offsetParent===null&&window.getComputedStyle(d).position!=="fixed")return;let c=M=>Number.parseFloat(M)||0,{top:p}=d.getBoundingClientRect(),f=d.parentElement?.getBoundingClientRect(),l=window.getComputedStyle(document.documentElement),g=c(l.getPropertyValue("--footer-height")),y=c(l.getPropertyValue("--header-height")),x=c(l.getPropertyValue("--scrollbar-height")),k=window.getComputedStyle(d),T=c(k.marginBottom),U=c(k.paddingBottom),z=window.innerHeight-g-x-r,b=f?Math.min(f.bottom,z):z,h=f?Math.max(f.top,y):y,v=Math.max(p,h),L=b-v-T-U,H=Number.isFinite(L)?Math.floor(L):0,S=H>0?H:i;S>0&&Number.isFinite(S)&&a(M=>Math.abs(M-S)>1?S:M)},[r,e,i]);return Xs(()=>{if(typeof window>"u")return;let d=null,c=null,p=null,f=null,l=()=>{d!==null&&window.cancelAnimationFrame(d),d=window.requestAnimationFrame(()=>{u()})};l(),c=window.setTimeout(()=>{l()},150);let g=e.current;return typeof ResizeObserver<"u"&&g&&(p=new ResizeObserver(()=>{l()}),p.observe(g),g.parentElement&&p.observe(g.parentElement)),n&&typeof MutationObserver<"u"&&(f=new MutationObserver(()=>{l()}),f.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",l),()=>{d!==null&&window.cancelAnimationFrame(d),c!==null&&window.clearTimeout(c),p&&p.disconnect(),f&&f.disconnect(),window.removeEventListener("resize",l)}},[e,n,u]),{viewportHeight:o,updateViewportHeight:u}};import{useCallback as St,useEffect as po,useRef as hr,useState as fo}from"react";var Js=600,go=8,yr=({ref:e,onSelect:t,resolveItem:n,item:r})=>{let[i,o]=fo(!1),[a,u]=fo(null),d=hr(null),c=hr(!1),p=hr(null),f=hr({onSelect:t,resolveItem:n,item:r});po(()=>{f.current={onSelect:t,resolveItem:n,item:r}},[t,n,r]);let l=St(()=>{typeof window>"u"||d.current!==null&&(window.clearTimeout(d.current),d.current=null)},[]),g=St(()=>{p.current&&(l(),p.current=null)},[l]),y=St(h=>{typeof window>"u"||h.button!==0&&h.pointerType==="mouse"||(l(),c.current=!1,p.current={x:h.clientX,y:h.clientY,pointerId:h.pointerId},d.current=window.setTimeout(()=>{let v=f.current,L=null;v.item!==void 0?L=v.item:v.resolveItem&&h.target&&(L=v.resolveItem(h.target)),L!==null&&(c.current=!0,v.onSelect?.(L),u(L),o(!0)),g()},Js))},[l,g]),x=St(h=>{p.current&&h.pointerId===p.current.pointerId&&(l(),p.current=null)},[l]),k=St(h=>{c.current&&(h.preventDefault(),h.stopPropagation(),h.type==="click"&&(c.current=!1))},[]),T=St(()=>{c.current=!1},[]),U=St(h=>{if(!p.current||h.pointerId!==p.current.pointerId)return;let v=Math.abs(h.clientX-p.current.x),L=Math.abs(h.clientY-p.current.y);(v>go||L>go)&&(l(),p.current=null)},[l]),z=St(h=>{(i||d.current!==null)&&(h.preventDefault(),h.stopPropagation())},[i]),b=St(()=>{o(!1),u(null),c.current=!1,p.current=null},[]);return po(()=>{let h=e.current;if(!(h&&typeof window<"u"))return;let v=[["pointerdown",y,void 0],["pointerup",x,void 0],["pointercancel",x,void 0],["pointermove",U,void 0],["pointerleave",x,void 0],["contextmenu",z,void 0]],L=[["mousedown",k,!0],["mouseup",k,!0],["click",k,!0],["pointerdown",T,!0],["keydown",T,!0],["contextmenu",z,!0],["pointerup",x,!0],["pointercancel",x,!0]];for(let[H,S,M]of v)h.addEventListener(H,S,M);for(let[H,S,M]of L)window.addEventListener(H,S,M);return()=>{for(let[H,S,M]of v)h.removeEventListener(H,S,M);for(let[H,S,M]of L)window.removeEventListener(H,S,M);l()}},[e,y,x,U,k,T,z,l]),{isPopupVisible:i,popupItem:a,handleClosePopup:b}};import{useCallback as Zs,useEffect as el,useState as ho,useSyncExternalStore as tl}from"react";function br(e,t,n){let r=n?.mediaQuery??"(min-width: 1024px)",i=tl(Zs(p=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let f=window.matchMedia(r);return f.addEventListener("change",p),()=>f.removeEventListener("change",p)},[r]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(r).matches:!0,()=>!1),[o,a]=ho(!1),[u,d]=ho(0);return el(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let p=e.current;if(!p)return;let f=new ResizeObserver(l=>{for(let g of l){if(g.target!==p)continue;let y=0;g.borderBoxSize&&g.borderBoxSize.length>0?y=g.borderBoxSize[0].inlineSize:y=g.contentRect.width,!(!Number.isFinite(y)||y<=0)&&(d(y),a(x=>x&&y>=t.expandThreshold?!1:!x&&y<t.collapseThreshold?!0:x))}});return f.observe(p),()=>f.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:i&&!o,isContainerNarrow:o,isMediaMatches:i,containerWidth:u}}ye();Ht();var yo=e=>e.isComposing||e.keyCode===229;var bo=(e,t)=>{if(al(t),e.altKey||e.ctrlKey||e.metaKey||e.shiftKey||yo(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 rl(e.key)?{kind:"move",index:t.startIndex,direction:1}:null;let r=t.activeIndex;switch(e.key){case"ArrowDown":return{kind:"move",index:Math.min(r+1,n),direction:1};case"ArrowUp":return{kind:"move",index:Math.max(r-1,0),direction:-1};case"PageDown":return{kind:"move",index:Math.min(r+t.pageSize,n),direction:1};case"PageUp":return{kind:"move",index:Math.max(r-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}},nl=new Set(["ArrowDown","ArrowUp","PageDown","PageUp","Home","End"]),rl=e=>nl.has(e),al=e=>{let{activeIndex:t,startIndex:n,itemCount:r,pageSize:i}=e;if(!Number.isInteger(r)||r<0)throw new RangeError(`[contact-map] listbox itemCount must be a non-negative integer; got ${ie(r)}`);if(!Number.isInteger(i)||i<1)throw new RangeError(`[contact-map] listbox pageSize must be an integer of at least 1; got ${ie(i)}`);let o=a=>Number.isInteger(a)&&a>=0&&a<r;if(r>0&&!o(n))throw new RangeError(`[contact-map] listbox startIndex must be an index below ${r}; got ${ie(n)}`);if(t!==null&&!o(t))throw new RangeError(`[contact-map] listbox activeIndex must be null or an index below ${r}; got ${ie(t)}`)};fe();ye();Ur();fe();Rn();Pn();import{SWIPE_OVERLAY_SCROLL_AREA_STYLE as ol,useOverlayPresence as il,useSwipeOverlayDialog as sl}from"@aiquants/swipe-overlay";import{useCallback as ll,useId as cl}from"react";import{jsx as Sr,jsxs as oa}from"react/jsx-runtime";var dl=Me(Yn,"flex overflow-hidden"),ul=Me(Qn,"motion-safe:transition-opacity motion-safe:duration-200"),ml=`relative ml-auto flex h-full w-full max-w-lg flex-col ${N.surface} shadow-xl motion-safe:transition-[transform] motion-safe:duration-200 motion-safe:ease-out`,pl=`flex shrink-0 items-center justify-between gap-3 ${B.borderSubtle} border-b px-3 py-2`,fl=`min-w-0 truncate font-semibold text-base ${s.fg} outline-none`,gl=`inline-flex min-h-11 min-w-11 shrink-0 touch-manipulation items-center justify-center rounded-full border ${B.borderControl} px-4 font-medium ${s.fgSecondary} text-sm ${E.hoverMuted} ${wt}`,hl="flex min-h-0 flex-1 flex-col overflow-y-auto p-3",vr=({isOpen:e,onClose:t,children:n,className:r,title:i})=>{let o=ne(),a=cl(),u=il(e),d=ll(y=>y.ownerDocument.getElementById(a),[a]),{dialogProps:c,backdropProps:p,panelProps:f,attemptClose:l,isSwiping:g}=sl({isOpen:e,onClose:t,isCloseBlocked:Jn,skipWhenTextSelected:!0,initialFocus:d});return u?oa("dialog",{...c,"data-testid":"contact-map-mobile-overlay","aria-labelledby":a,className:Me(dl,e&&!g?"pointer-events-auto":"pointer-events-none"),style:Xn,children:[Sr("div",{...p,"data-contact-map-overlay-backdrop":"",className:Me(ul,e?"opacity-100":"opacity-0")}),oa("div",{...f,"data-contact-map-overlay-panel":"",className:Me(ml,e?"pointer-events-auto":"pointer-events-none",r),children:[oa("div",{className:pl,children:[Sr("h2",{id:a,tabIndex:-1,className:fl,children:i===void 0?o.overlayTitle:i}),Sr("button",{type:"button",className:gl,onClick:()=>l(),children:o.close})]}),Sr("div",{"data-contact-map-overlay-body":"",className:hl,style:ol,children:n})]})]}):null};Rn();ke();Gr();import{Fragment as Hl,jsx as K,jsxs as Je}from"react/jsx-runtime";var El=xl(async()=>({default:(await Promise.resolve().then(()=>(Xa(),Ya))).default})),ia=64,Co="h-[64px]",xo=240,kl=4,sa=gr(An),Ml=An.listPanelMinWidth,Ll=An.detailPanelMinWidth,wl=An.handleThickness,tp=sa.collapseThreshold,np=sa.expandThreshold,Rl=({contactData:e})=>{let t=ne(),n=Ge(e?.full_name)??t.noName,r=Ge(e?.title)??"-",i=Ge(e?.company_name)??"-",o=Ge(e?.department)??"-",a=tn(e).value??"-",u=nn(e).value??"-",d=at(e?.updated_at,t.recordDateTime);return K(tr,{fullName:n,title:r,companyName:i,department:o,phoneNumber:u,email:a,updatedAtText:d})},Pl=e=>({"--contact-panel-height":`${e}px`}),_l=e=>typeof e=="object"&&e!==null&&"item"in e,$l=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,Ol=(e,t)=>{for(let n of e){let r=Dt(n);if(r?.person_id===t)return r}return null},To=(e,t)=>t!==null&&Dt(e)?.person_id===t,No=(e,t,n)=>{for(let r=t;r>=0&&r<e.length;r+=n){let i=Dt(e[r]);if(i!==null)return{index:r,personId:i.person_id}}return null},Eo=(e,t,n)=>{let r=No(e,t,n);return r!==null?r:No(e,t-n,n===1?-1:1)},la=(e,t,n)=>{let{viewportHeight:r}=mo(t,{enableMutationObserver:!0,bottomGap:kl,minFallbackHeight:xo}),[i,o]=Wn(0),a=Fe(()=>{let f=n.current,l=t.current;if(!(f&&l))return;let g=f.getBoundingClientRect(),y=l.getBoundingClientRect(),x=Math.ceil(y.top-g.top);Number.isFinite(x)&&x>0&&o(k=>Math.abs(k-x)>1?x:k)},[t,n]);Mo(()=>{if(!e)return;a();let f=requestAnimationFrame(a);return window.addEventListener("resize",a),()=>{cancelAnimationFrame(f),window.removeEventListener("resize",a)}},[e,a]);let u=r>0?r:xo,d=i>0?i:0,c=u+d,p=jt(()=>Pl(c),[c]);return{normalizedViewportHeight:u,normalizedDetailHeight:c,panelSizingStyle:p}},Al=new Set,Dl=()=>{let[e,t]=Wn(Al),n=Fe((r,i)=>{t(o=>{if(o.has(r)===i)return o;let a=new Set(o);return i?a.add(r):a.delete(r),a})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},Wl=(e,t,n)=>{let r=fn(n);Mo(()=>{r.current=n},[n]),ko(()=>{if(e!==null)return r.current(e,t),()=>{r.current(e,!1)}},[e,t])},Lo=Tl(({entry:e,index:t,itemCount:n,listboxId:r,isSelected:i,isActive:o,onSelect:a,onLongPressSelect:u,searchQuery:d,enableHighlighting:c,openEmailsWithGmail:p,openGmailCompose:f,onPopupVisibilityChange:l})=>{let g=ne(),y=fn(null),x=K("div",{className:Co}),k=_l(e)?e:null,T=Dt(e),{isPopupVisible:U,handleClosePopup:z}=yr({ref:y,onSelect:u,item:T?.person_id});if(Wl(T?.person_id??null,U,l),!e||!T)return x;let{person_id:b}=T,h=t%2===0?N.surface:N.subtle,v=`${X.blue} ring-1 ${E.selectedRing}`,L=i?v:h,H=["B","F"].map(S=>$l(S,S==="B"?k?.baseScore:k?.score)).filter(Boolean);return Je("div",{ref:y,id:Cl(r,b),className:`flex ${Co} w-full items-center overflow-hidden ${B.borderSubtle} border-b px-4 py-2 text-left transition-colors ${E.hoverBlueTint} ${L} ${Da}`,style:{height:ia},role:"option","aria-selected":i,"aria-posinset":t+1,"aria-setsize":n,"data-selected":i?"true":"false","data-contact-map-row-active":o?"":void 0,onClick:()=>a(b),children:[Je("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[K("div",{className:`whitespace-nowrap font-medium ${s.fgSecondary} text-xs leading-tight`,children:g.listRowNumber(t+1)}),K("div",{className:`truncate ${Lt} ${s.fgSecondary} leading-tight`,children:b}),K("div",{className:`flex items-center gap-1 whitespace-nowrap font-mono ${Lt} ${s.fgMuted} leading-tight`,children:H.length?H.map(S=>K("span",{children:S},S)):K("span",{children:"-"})})]}),K(Nl,{fallback:K(Rl,{contactData:T}),children:K(El,{contactData:T,searchTerm:d,enableHighlighting:c,openEmailsWithGmail:p,openGmailCompose:f,isPopupVisible:U,onRequestClose:z})})]})});Lo.displayName="ContactListRow";var wo=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:r,hasSearchTerm:i,enableHighlighting:o,openEmailsWithGmail:a,isSearchTabActive:u}=e,{locale:d,labels:c,engineLabels:p}=Pe(),f=fn(null),l=fn(null),[g,y]=Wn(null),{normalizedViewportHeight:x,panelSizingStyle:k}=la(u,l,f),{isAnyPopupVisible:T,handlePopupVisibilityChange:U}=Dl(),z=jt(()=>({enablePointerDrag:!T,enableKeyboardNavigation:!1}),[T]),b=jt(()=>i?n:t,[i,n,t]),[h,v]=Wn(null),L=Fe(Y=>{y(Y),v(Y)},[]),H=Fe(Y=>{if(!a)return;let he=Y.trim();if(!he||he==="-"||typeof window>"u")return;let Q=ft(he,!0);Q&&window.open(Q,"_blank","noopener,noreferrer")},[a]),[S,M]=Wn(!1),ae=Fe(()=>M(!1),[]),I=Fe(Y=>{L(Y),M(!0)},[L]),be=vo(),oe=vo(),W=fn(null),A=b.length,q=Fe((Y,he)=>K(Lo,{entry:Y,index:he,itemCount:A,listboxId:be,isSelected:To(Y,g),isActive:To(Y,h),onSelect:I,onLongPressSelect:L,searchQuery:r,enableHighlighting:o,openEmailsWithGmail:a,openGmailCompose:H,onPopupVisibilityChange:U}),[A,be,g,h,I,L,r,o,a,H,U]),me=jt(()=>{let Y=new Map;return b.forEach((he,Q)=>{let ut=Dt(he);ut!==null&&Y.set(ut.person_id,Q)}),Y},[b]),Se=h===null?null:me.get(h)??null,Oe=g===null?null:me.get(g)??null,_t=Math.max(1,Math.floor(x/ia)),Yt=Fe(Y=>{if(Y.target.id!==be)return;let he=bo(Y.nativeEvent,{activeIndex:Se,startIndex:Oe===null?0:Oe,itemCount:A,pageSize:_t});if(he===null)return;if(Y.preventDefault(),he.kind==="activate"){Se!==null&&h!==null&&I(h);return}let Q=Eo(b,he.index,he.direction);Q!==null&&(v(Q.personId),W.current?.scrollToIndex(Q.index,{align:"nearest"}))},[be,Se,Oe,A,_t,h,I,b]),Ct=Fe(Y=>{if(Y.target.id!==be||Se!==null||!Y.target.matches(":focus-visible"))return;let he=Eo(b,Oe===null?0:Oe,1);he!==null&&v(he.personId)},[be,Se,Oe,b]),Xt=jt(()=>({id:be,role:"listbox",tabIndex:0,"aria-label":c.listboxLabel,"aria-describedby":oe}),[be,c.listboxLabel,oe]),ve=Fe(Y=>b[Y],[b]),Qt=Fe(Y=>Dt(b[Y])?.person_id??`row-${Y}`,[b]),Ve=Fe(()=>ia,[]),dt=jt(()=>({enabled:!0,renderVisual:Sl}),[]),Ke=jt(()=>g===null?null:Ol(b,g),[g,b]);ko(()=>{g!==null&&!Ke&&y(null)},[g,Ke]);let He=fn(null),{isTwoColumn:Jt}=br(He,sa);S&&(Jt||Ke===null)&&M(!1);let xt=Je("div",{ref:f,className:"flex min-h-0 flex-1 flex-col gap-1",children:[K("div",{className:`hidden rounded-t-lg border ${B.borderSubtle} ${N.subtle} px-4 py-2 transition-colors sm:block`,children:Je("div",{className:"flex items-center",children:[Je("div",{className:`flex w-28 shrink-0 flex-col items-center gap-0.5 text-center ${w} ${s.fgSecondary} uppercase tracking-wider`,children:[K("span",{className:`font-semibold ${s.fg} text-xs`,children:c.columnNo}),K("span",{className:"leading-tight",children:c.columnId}),K("span",{className:"whitespace-nowrap leading-tight",children:c.columnScore})]}),Je("div",{className:`hidden w-full grid-cols-3 gap-2 font-medium ${s.fgSecondary} text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto]`,children:[Je("div",{className:"flex flex-col gap-0.5",children:[K("span",{children:c.columnName}),K("span",{className:`font-normal ${w} ${s.fgMuted} uppercase tracking-wider`,children:c.columnTitle})]}),Je("div",{className:"flex flex-col gap-0.5",children:[K("span",{children:c.columnCompany}),K("span",{className:`font-normal ${w} ${s.fgMuted} uppercase tracking-wider`,children:c.columnDepartment})]}),Je("div",{className:"flex flex-col gap-0.5",children:[K("span",{children:c.columnPhone}),K("span",{className:`font-normal ${w} ${s.fgMuted} uppercase tracking-wider`,children:c.columnEmail})]}),K("div",{className:"hidden items-end justify-end xl:flex",children:K("span",{className:`font-normal ${w} ${s.fgMuted} uppercase tracking-wider`,children:c.columnUpdatedAt})})]})]})}),K("p",{id:oe,hidden:!0,children:c.listKeyboardHelp}),K("div",{ref:l,className:"flex-1",onKeyDown:Yt,onFocus:Ct,children:K(vl,{ref:W,contentProps:Xt,activeItemIndex:A===0?void 0:Se,activeItemVisibleInset:Wa,itemCount:A,getItemKey:Qt,behaviorOptions:z,getItem:ve,getItemHeight:Ve,viewportSize:x,overscanCount:10,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:dt},locale:d,labels:p,className:`w-full rounded-b-lg border ${B.borderSubtle} border-t-0 ${N.surface} pr-0.75 transition-colors`,children:(Y,he)=>q(Y,he)})}),n.length===0&&i?K("div",{className:"py-8 text-center",children:K("p",{className:s.fgMuted,children:c.listNoSearchResults})}):null,A===0&&!i?K("div",{className:"py-8 text-center",children:K("p",{className:s.fgMuted,children:c.listNoData})}):null]});return K("div",{ref:He,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:k,children:Jt?Je(yl,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[K(So,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:Ml,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:xt}),K(bl,{id:"contact-map-list-handle",thickness:wl,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:`cursor-col-resize rounded transition-colors ${E.hoverMuted} focus:outline-none focus-visible:ring-2 ${E.focusVisibleRing} ${E.ringOffsetSurface} focus-visible:ring-offset-1`,"aria-label":c.listResizeHandle}),K(So,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:Ll,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:K(un,{placement:"pane",contact:Ke,searchTerm:r,enableHighlighting:o})})]}):Je(Hl,{children:[xt,Ke?K(vr,{isOpen:S,onClose:ae,title:c.detailHeading,children:K(un,{placement:"overlay",contact:Ke,searchTerm:r,enableHighlighting:o})}):null]})})};Wt();import{DirectoryTree as Yl}from"@aiquants/directory-tree";import{Panel as Do,PanelGroup as Xl,PanelResizeHandle as Ql}from"@aiquants/resize-panels";import{tapScrollCircleSampleVisual as Jl}from"@aiquants/virtualscroll";import Zl from"@heroicons/react/24/solid/FolderMinusIcon.js";import ec from"@heroicons/react/24/solid/FolderPlusIcon.js";import{useCallback as Be,useEffect as gn,useMemo as Ze,useRef as Nr,useState as qt}from"react";import{createPortal as tc}from"react-dom";var ca=(e,t)=>e&&e.trim()||t;import{useEffect as Il,useRef as Cr,useState as Fl}from"react";var Ro=(e,t=250)=>{let[n,r]=Fl(e),i=Cr(null),o=Cr(e),a=Cr(null),u=Cr(!1);return Il(()=>{if(!u.current){u.current=!0,r(e),o.current=e;return}o.current=n,i.current=null;let d=c=>{i.current??(i.current=c);let p=c-i.current,f=Math.min(1,Math.max(0,p/t)),l=1-(1-f)**3,g=Math.max(0,Math.round(o.current+(e-o.current)*l));r(g),f<1&&(a.current=requestAnimationFrame(d))};return a.current=requestAnimationFrame(d),()=>{a.current!==null&&cancelAnimationFrame(a.current)}},[e,t]),Math.max(0,n)};Ht();import{useCallback as da,useEffect as ua,useMemo as Po,useRef as Bl,useSyncExternalStore as zl}from"react";ye();var Ul=250,Vl=4e3,xr=3,_o={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},$o=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,Tr=class{constructor(t,{workerSource:n,logger:r=st}){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>=xr){this.logger.error(`[TreeWorker] the tree Worker failed ${xr} times in a row; the tree stops updating until ${_o[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Ul*2**(this.consecutiveFailures-1),Vl);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${xr})`,t),this.retryTimer!==null&&clearTimeout(this.retryTimer),this.retryTimer=setTimeout(()=>{this.retryTimer=null;let r=this.lastSyncedNaming;r!==null&&this.syncRecords(this.lastSyncedRecords,r)},n)};if(typeof n!="string")throw new TypeError(`[contact-map] TreeWorkerSession workerSource must be a string; got ${ie(n)}`);if(!Object.hasOwn(_o,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${ie(n)}`);this.workerFactory=t,this.workerSource=n,this.logger=r}updateState(){let t=this.postedCount>(this.latestSnapshot?.consumedRecords??0);this.state.snapshot===this.latestSnapshot&&this.state.isBuilding===t||(this.state={snapshot:this.latestSnapshot,isBuilding:t},this.notify())}notify(){for(let t of this.listeners)t()}ensureWorker(){if(this.consecutiveFailures>=xr||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||!$o(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let r=this.ensureWorker();if(!r)return;let i=this.workerNeedsReset,o=this.postedNaming===null||!$o(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,r.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),this.updateState()),t.length>this.postedCount){let a=t.slice(this.postedCount);this.postedCount=t.length,r.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:a}),this.updateState()}i&&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}}},Kl=e=>{if(e!==void 0)return new Worker(e,{type:"module"});let t=typeof import.meta<"u"?import.meta.url:void 0;if(t){let r=t.includes(".ts")?"../workers/treeWorker.ts":"./worker/treeWorker.mjs";return new Worker(new URL(r,t),{type:"module"})}throw new Error("[contact-map] the tree Worker needs workerUrls.treeWorker in a build without import.meta.url (CommonJS)")},Gt=null,Oo=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),jl=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},Gl=e=>{if(ro(e),Gt===null){let t=new Tr(()=>Kl(e),{workerSource:"workerUrls.treeWorker"});return Gt={session:t,workerUrl:e},t}if(Gt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${Oo(Gt.workerUrl)} and cannot also load it from ${Oo(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return Gt.session},fp=()=>{Gt?.session.reset(),Gt=null},ql={snapshot:null,isBuilding:!1};function Ao(e,t=!1){let n=bt(),r=n.treeWorkerFactory,i=n.workerUrls?.treeWorker,{labels:o}=Pe(),a=o.uncategorizedCompany,u=o.noName,d=Po(()=>({uncategorizedCompany:a,unnamedPerson:u}),[a,u]),c=Bl(r);ua(()=>{c.current=r},[r]);let p=r!==void 0,f=p?void 0:i,l=Po(()=>p?new Tr(()=>jl(c.current)(),{workerSource:"treeWorkerFactory"}):null,[p]),g=da(()=>l===null?Gl(f):l,[l,f]),y=da(k=>g().subscribe(k),[g]),x=da(()=>g().getState(),[g]);return ua(()=>{let k=g();k.syncRecords(e,d),t&&k.finalize()},[g,e,t,d]),ua(()=>{if(l!==null)return()=>l.stop()},[l]),zl(y,x,()=>ql)}ye();fe();ke();jr();ar();import{Fragment as mc,jsx as j,jsxs as $e}from"react/jsx-runtime";var fa=gr(Dn),nc=Dn.listPanelMinWidth,rc=Dn.detailPanelMinWidth,ac=Dn.handleThickness,Ip=fa.collapseThreshold,Fp=fa.expandThreshold,oc=(e,t)=>{let{searchQuery:n,enableHighlighting:r}=t,i=ca(e.full_name,t.noName),o=ca(e.title,""),a=j(Ne,{text:i,query:n,enabled:r});return o?$e("span",{className:"flex items-center gap-1.5",children:[j("span",{children:a}),j("span",{className:`${s.fgMuted} text-xs`,children:j(Ne,{text:o,query:n,enabled:r})})]}):a},ic="contact-map-tree h-full w-full",sc={hoverClassName:N.muted,directorySelectedClassName:`${X.sky} ${E.treeNameSky}`,itemSelectedClassName:`${X.sky} ${E.treeNameSky}`},ma="h-4 w-4 shrink-0 transition-colors duration-150",lc=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),Er=null,Wo=null,Hn=new Map,Ho="",Io=null,Fo=null,cc=(e,t,n,r,i)=>{let o=`${n?"icons":"plain"}#${r}#${i.noName}`;(o!==Ho||i.formatDirectoryName!==Io||t!==Fo)&&(Hn.clear(),Ho=o,Io=i.formatDirectoryName,Fo=t);let a={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},u=new Set;for(let d of e){u.add(d.absolutePath);let c=`${d.name}\0${d.memberCount}`,p=Hn.get(d.absolutePath);(!p||p.signature!==c)&&(p={signature:c,result:Uo([d],t,n,{searchQuery:"",enableHighlighting:!1,noName:i.noName,formatDirectoryName:i.formatDirectoryName})},Hn.set(d.absolutePath,p));let f=p.result;f.entries.length>0&&a.entries.push(f.entries[0]);for(let[l,g]of f.personPathMap){let y=a.personPathMap.get(l);if(y)for(let x of g)y.add(x);else a.personPathMap.set(l,new Set(g))}for(let[l,g]of f.contactByPath)a.contactByPath.set(l,g);for(let[l,g]of f.ancestorsByPath)a.ancestorsByPath.set(l,g);a.totalCount+=f.totalCount,!a.firstPerson&&f.firstPerson&&(a.firstPerson=f.firstPerson)}for(let d of Hn.keys())u.has(d)||Hn.delete(d);return a},pa=e=>e.isSelected||e.isItemSelected?m.sky:e.isExpanded&&e.isDirectory?s.fgSecondary:s.fgMuted,zo=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...zo(n.children)));return t},dc=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Uo=(e,t,n,r,i)=>{let o=new Map,a=new Map,u=new Map,d=0,c=null,p=(l,g)=>{let y=[...g,l.absolutePath];u.set(l.absolutePath,y);let x,k,T=l.type==="directory"?r.formatDirectoryName(l.name,dc(l)):l.name,U=j(Ne,{text:T,query:r.searchQuery,enabled:r.enableHighlighting});if(l.type==="file"&&l.personId){if(i&&!i.has(l.personId))return null;let z=t.get(l.personId);if(z){a.set(l.absolutePath,z),o.has(l.personId)||o.set(l.personId,new Set);let b=o.get(l.personId);b&&b.add(l.absolutePath),d++,c||(c={personId:l.personId,path:l.absolutePath}),n&&(k=h=>{let v=pa(h);return h.isSelected||h.isItemSelected||l.isPrimary&&(v=l.title?m.indigo:m.orange),j(n.person,{"aria-hidden":"true",className:`${ma} ${v}`})},l.title&&(U=oc(z,r))),U=j("span",{"data-contact-path":l.absolutePath,className:"block w-full",children:U})}}else if(l.children){let z=l.children.map(b=>p(b,y)).filter(b=>b!==null);if(i&&z.length===0)return null;if(x=z,n){let b=l.relativePath.startsWith("company:")?n.company:n.department;k=h=>j(b,{"aria-hidden":"true",className:`${ma} ${pa(h)}`})}}return{name:T,label:U,type:l.type,absolutePath:l.absolutePath,relativePath:l.relativePath,icon:k,children:x}};return{entries:e.map(l=>p(l,[])).filter(l=>l!==null),personPathMap:o,contactByPath:a,ancestorsByPath:u,firstPerson:c,totalCount:d}},uc=(e,t,n)=>{let r=new Set,i=new Set,o=new Map;t.forEach((p,f)=>{o.set(p.item.person_id,f)});for(let p of t){let f=p.item.person_id,l=e.personPathMap.get(f);if(l)for(let g of l){r.add(g);let y=e.ancestorsByPath.get(g);if(y){for(let x of y)r.add(x);n&&y.length>0&&i.add(y[0])}}}let a=new Map,u=p=>{let f=a.get(p.absolutePath);if(f!==void 0)return f;let l=1/0;if(p.type==="file"){let g=e.contactByPath.get(p.absolutePath);g&&(l=o.get(g.person_id)??1/0)}else if(p.children)for(let g of p.children)l=Math.min(l,u(g));return a.set(p.absolutePath,l),l},d=(p,f=0)=>p.filter(l=>n&&f===0&&i.has(l.absolutePath)?!0:r.has(l.absolutePath)).map(l=>n&&f===0&&i.has(l.absolutePath)?l:l.type==="directory"&&l.children?{...l,children:d(l.children,f+1)}:l).sort((l,g)=>f===0?u(l)-u(g):0),c=d(e.entries);return{...e,entries:c}},Bo=(e,t,n)=>{if(e===null)return null;let r=n.get(e);if(r===void 0)return null;if(t!==null&&r.has(t))return t;let i=r.values().next();return i.done?null:i.value},Vo=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:r,filteredItems:i,hasSearchTerm:o,isSearchInProgress:a,isSearchTabActive:u}=e,{locale:d,labels:c,treeLabels:p}=Pe(),f=c.noName,l=c.treeDirectoryName,g=Ze(()=>({noName:f,formatDirectoryName:l}),[f,l]),[y,x]=qt(null),[k,T]=qt(!1),{snapshot:U,isBuilding:z}=Ao(n,e.isStreamingComplete),b=U?.tree??null,h=U?.rebuildEpoch??0,v=Ze(()=>b?cc(b,r,y,h,g):null,[b,r,y,h,g]),L=Ze(()=>{if(!b)return null;if(!o)return v;let D;k||(D=new Set(i.map(pe=>pe.item.person_id)));let le=Uo(b,r,y,{...g,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},D);return uc(le,i,k)},[b,v,r,y,e.searchQuery,e.enableHighlighting,o,i,k,g]),H=Ze(()=>L||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[L]),S=o&&e.errorMessage!==null,[M,ae]=qt(H),I=Nr(!1);gn(()=>{if(!(a||S)){I.current=!!b,ae(H);return}!I.current&&b&&H.entries.length>0&&(I.current=!0,ae(H))},[H,b,a,S]);let be=o&&(a||S)?M:H,{entries:oe,personPathMap:W,contactByPath:A,totalCount:q}=be,me=Ze(()=>zo(oe),[oe]),[Se,Oe]=qt(()=>Wo??new Set),_t=Be(D=>!Se.has(D),[Se]),Yt=Be(D=>{Oe(le=>{let pe=new Set(le);return pe.has(D)?pe.delete(D):pe.add(D),pe})},[]),Ct=Be(D=>{D.length!==0&&Oe(le=>{let pe=new Set(le);for(let pt of D)pe.add(pt);return pe})},[]),Xt=Be(D=>{Oe(le=>{if(le.size===0)return le;let pe=!1,pt=new Set(le);for(let V of D)pt.delete(V)&&(pe=!0);return pe?pt:le})},[]);gn(()=>{Wo=Se},[Se]),gn(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[ve,Qt]=qt(null),[Ve,dt]=qt(null),[Ke,He]=qt(!1),Jt=Be(()=>He(!1),[]),xt=Nr(null),Y=Nr(null),{normalizedViewportHeight:he,panelSizingStyle:Q}=la(u,Y,xt),ut=Be(D=>{let le=A.get(D);return le?(ve!==le.person_id&&Qt(le.person_id),D!==Ve&&dt(D),!0):!1},[A,Ve,ve]),$t=Be(D=>{ut(D)&&He(!0)},[ut]),xn=Be(D=>{$t(D.entry.absolutePath)},[$t]),Tt=Be(D=>D instanceof Element?D.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:Ae,popupItem:Tn,handleClosePopup:Nn}=yr({ref:Y,resolveItem:Tt,onSelect:ut}),tt=Be(D=>{if(!e.openEmailsWithGmail)return;let le=D.trim();if(!le||le==="-"||typeof window>"u")return;let pe=ft(le,!0);pe&&window.open(pe,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),Nt=Tn?A.get(Tn):null,nt=Ae&&Nt!==null&&Nt!==void 0;gn(()=>{Ae&&!Nt&&Nn()},[Ae,Nt,Nn]);let Ot=Ze(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableArrowButtonTabStops:!1,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:Jl}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),Et=Ze(()=>lc(Ot,he,nt),[Ot,he,nt]);gn(()=>{let D=!1;return typeof window>"u"?()=>{D=!0}:Er?(x(Er),()=>{D=!0}):((async()=>{try{let[pe,pt,V,J]=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(D)return;let xe=pe.default,rt=pt.default,Rr=V.default,Ta=J.default;xe&&rt&&Rr&&Ta&&(Er={company:xe,department:rt,title:Rr,person:Ta},x(Er))}catch(pe){st.warn("Failed to load lucide icons",pe)}})(),()=>{D=!0})},[]);let At=Ze(()=>{if(!y)return;let D=J=>xe=>j(J,{"aria-hidden":"true",className:`${ma} ${pa(xe)}`}),le={company:D(y.company),department:D(y.department),title:D(y.title)},pe=D(y.person),pt=J=>J in le,V=J=>{let[xe]=J.entry.relativePath.split(":",1);return(pt(xe)?le[xe]:le.company)(J)};return{directory:V,directoryExpanded:V,file:pe}},[y]),Zt=Be(()=>{Oe(D=>D.size===0?D:new Set)},[]),Mr=Be(()=>{me.length>0&&Ct(me)},[me,Ct]),kt=Bo(ve,Ve,W);gn(()=>{let D=Bo(ve,Ve,W);if(D===null){ve!==null&&Qt(null),Ve!==null&&dt(null);return}D!==Ve&&dt(D)},[ve,Ve,W]);let je=kt===null?null:A.get(kt)??null,En=e.isStreamingComplete,Lr=e.isStreamingFailed,Fn=En&&n.length===0,Bn=(z||!b)&&!Fn,zn=Ro(q,250),mt=b!==null||Fn,en=$e("div",{className:"flex flex-wrap items-center gap-1.5",children:[$e("span",{className:`inline-flex h-5 items-center gap-1 rounded ${N.muted} px-1.5 font-medium font-mono ${w} ${s.fgSecondary}`,title:c.treeNodeCountTitle,children:[j("span",{children:"\u{1F333}"})," ",c.treeNodeCountLabel," ",mt?c.treeNodeCount(zn):"\u2026"]}),Lr&&!En?$e("span",{className:`inline-flex h-5 items-center gap-1 rounded border ${$.rose} ${X.rose} px-1.5 font-medium ${w} ${m.rose}`,title:c.treeStreamInterruptedTitle,children:[j("span",{className:`h-1.5 w-1.5 rounded-full ${qe.rose}`}),j("span",{children:"\u26D4"})," ",c.treeStreamInterrupted]}):En?Bn?$e("span",{className:`inline-flex h-5 items-center gap-1 rounded border ${$.amber} ${X.amber} px-1.5 font-medium ${w} ${m.amber}`,title:c.treeBuildingTitle,children:[$e("span",{className:"relative flex h-1.5 w-1.5",children:[j("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${qe.amber}`}),j("span",{className:`relative inline-flex h-1.5 w-1.5 rounded-full ${qe.amber}`})]}),j("span",{children:"\u{1F33F}"})," ",c.treeBuilding]}):$e("span",{className:`inline-flex h-5 items-center gap-1 rounded border ${$.emerald} ${X.emerald} px-1.5 font-medium ${w} ${m.emerald}`,title:c.treeCompleteTitle,children:[j("span",{className:`h-1.5 w-1.5 rounded-full ${qe.emerald}`}),j("span",{children:"\u2705"})," ",c.treeComplete]}):$e("span",{className:`inline-flex h-5 items-center gap-1 rounded border ${$.sky} ${X.sky} px-1.5 font-medium ${w} ${m.sky}`,title:c.treeStreamLoadingTitle,children:[$e("span",{className:"relative flex h-1.5 w-1.5",children:[j("span",{className:`absolute inline-flex h-full w-full animate-ping rounded-full ${qe.sky}`}),j("span",{className:`relative inline-flex h-1.5 w-1.5 rounded-full ${qe.sky}`})]}),j("span",{children:"\u23F3"})," ",c.treeStreamLoading]}),o&&$e("button",{type:"button",onClick:()=>T(!k),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${k?`${X.blue} ${m.blue}`:`${s.fgMuted} ${E.hoverMuted}`}`,title:c.treeShowEntireCompanyTitle,children:[j("span",{children:"\u{1F3E2}"})," ",c.treeShowEntireCompany]}),me.length>0?$e("div",{className:"flex items-center gap-1",children:[j("button",{type:"button",onClick:Zt,className:`inline-flex h-11 w-11 items-center justify-center rounded border ${B.borderControl} ${N.surface} ${s.fgMuted} transition-colors ${E.hoverMuted} ${E.hoverFgSecondary}`,"aria-label":c.treeExpandAll,title:c.treeExpandAllTitle,children:j(ec,{className:"h-4 w-4"})}),j("button",{type:"button",onClick:Mr,className:`inline-flex h-11 w-11 items-center justify-center rounded border ${B.borderControl} ${N.surface} ${s.fgMuted} transition-colors ${E.hoverMuted} ${E.hoverFgSecondary}`,"aria-label":c.treeCollapseAll,title:c.treeCollapseAllTitle,children:j(Zl,{className:"h-4 w-4"})})]}):null]}),Un=Nr(null),{isTwoColumn:kn}=br(Un,fa,{mediaQuery:"(min-width: 768px)"});Ke&&(kn||je===null)&&He(!1);let Vn=Ze(()=>({toggle:Yt,isExpanded:_t,expandMultiple:Xt,collapseMultiple:Ct,isPending:a}),[Ct,Xt,_t,Yt,a]),Kn=Ze(()=>({onEntryClick:xn,selectedPath:kt}),[xn,kt]),wr=Ze(()=>({className:ic,lineColor:Oa,iconOverrides:At,showDirectoryIcons:!!At,showFileIcons:!!At,highlightStyles:sc,entryClassName:"rounded-md",nameClassName:"tracking-tight",directoryNameClassName:`font-normal ${s.fg}`,fileNameClassName:s.fgSecondary}),[At]),Mn=j("div",{ref:xt,className:`flex min-h-0 flex-1 flex-col rounded-xl border ${B.borderSubtle} ${N.surface} shadow-sm transition-colors`,children:j("div",{ref:Y,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:oe.length>0?j(Yl,{entries:oe,expansion:Vn,selection:Kn,visual:wr,virtualScroll:Et,locale:d,labels:p}):j("div",{className:`flex h-full w-full items-center justify-center rounded-lg border ${B.borderSubtle} border-dashed ${N.surface} px-6 text-center ${s.fgMuted} text-sm transition-colors`,children:o?c.treeNoMatches:c.treeEmpty})})});return $e("div",{ref:Un,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:Q,children:[t&&tc(en,t),kn?$e(Xl,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[j(Do,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:nc,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:Mn}),j(Ql,{id:"contact-map-tree-handle",thickness:ac,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:`cursor-col-resize rounded transition-colors ${E.hoverMuted} focus:outline-none focus-visible:ring-2 ${E.focusVisibleRing} ${E.ringOffsetSurface} focus-visible:ring-offset-1`,"aria-label":c.treeResizeHandle}),j(Do,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:rc,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:j(un,{placement:"pane",contact:je,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):$e(mc,{children:[Mn,je?j(vr,{isOpen:Ke,onClose:Jt,title:c.detailHeading,children:j(un,{placement:"overlay",contact:je,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}):null]}),nt&&Nt&&j(er,{contactData:Nt,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:tt,onRequestClose:Nn})]})};import{jsx as In,jsxs as hn}from"react/jsx-runtime";var hc={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},yc=e=>e==="tree"?"tree":"list",Ko=({context:e})=>{let t=ne(),[n,r]=gc(),[i,o]=fc(null),a=yc(n.get(pn)),{setScrollableRef:u,onPointerDown:d,onPointerMove:c,onPointerUp:p,onPointerLeave:f,onPointerCancel:l,onClickCapture:g}=Rt(),y=pc(x=>{let k=x==="tree"?"tree":"list";if(k===a)return;let T=new URLSearchParams(typeof window<"u"?window.location.search:"");k==="list"?T.delete(pn):T.set(pn,k),r(T,{replace:!0})},[a,r]);return hn("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[hn("div",{className:"mt-1 mb-1.5 flex shrink-0 flex-wrap items-center gap-2",children:[hn("div",{ref:u,className:`flex space-x-1 overflow-x-auto text-nowrap rounded-lg ${N.muted} p-0.5 transition-colors`,style:hc,onPointerDown:d,onPointerMove:c,onPointerUp:p,onPointerLeave:f,onPointerCancel:l,onClickCapture:g,children:[hn("button",{type:"button","data-testid":"contact-map-tab-list","aria-pressed":a==="list",onClick:()=>y("list"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-2 ${C} transition-colors ${a==="list"?`${Te.blue} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u{1F4C4} ",t.listViewTab]}),hn("button",{type:"button","data-testid":"contact-map-tab-tree","aria-pressed":a==="tree",onClick:()=>y("tree"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-2 ${C} transition-colors ${a==="tree"?`${Te.green} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u{1F333} ",t.treeViewTab]})]}),In("div",{ref:o,className:"flex flex-wrap items-center gap-1.5"})]}),hn("div",{className:"flex h-full flex-1 flex-col",children:[In("div",{className:`${a==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:a==="list"?In(wo,{context:e}):null}),In("div",{className:`${a==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:a==="tree"?In(Vo,{context:e,controlsContainer:i}):null})]})]})};import{memo as vc}from"react";ye();fe();ke();ye();fe();ke();import{DEFAULT_FUZZY_SEARCH_OPTIONS as G}from"@aiquants/fuzzy-search";import{memo as bc,useId as We}from"react";import{jsx as O,jsxs as F}from"react/jsx-runtime";var ga=1e3,ha=bc(({searchOptions:e,setSearchOptions:t})=>{let n=ne(),r=`flex flex-col gap-1 rounded-md border ${N.surface} px-2 py-1 shadow-sm transition-colors`,i="text-xs font-semibold",o=e.sortBy==="relevance",a=We(),u=We(),d=We(),c=We(),p=We(),f=We(),l=We(),g=We(),y=We(),x=We(),k=We(),T=[];T.push(F("div",{className:`${r} ${$.green} border-l-4`,children:[F("div",{className:`${i} ${m.green}`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:a,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexNgramSize}),O("input",{id:a,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||G.ngramSize,onChange:b=>t(h=>({...h,ngramSize:parseInt(b.target.value,10)})),className:"h-11 w-full"}),F("span",{className:`${m.green} text-xs`,children:[n.currentValueLabel," ",e.ngramSize||G.ngramSize]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexNgramSizeHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:u,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexMinNgramOverlap}),O("input",{id:u,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||G.minNgramOverlap,onChange:b=>t(h=>({...h,minNgramOverlap:parseInt(b.target.value,10)})),className:"h-11 w-full"}),F("span",{className:`${m.green} text-xs`,children:[n.currentValueLabel," ",e.minNgramOverlap||G.minNgramOverlap]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexMinNgramOverlapHint})]})]},"index-build")),T.push(F("div",{className:`${r} ${$.blue} border-l-4`,children:[F("div",{className:`${i} ${m.blue}`,children:["\u{1F50D} ",n.indexCandidateHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:d,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexThreshold}),O("input",{id:d,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??G.indexWorkerOptions?.threshold,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,threshold:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.blue} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??G.indexWorkerOptions?.threshold]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexThresholdHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:p,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexNgramOverlapThreshold}),O("input",{id:p,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??G.indexWorkerOptions?.ngramOverlapThreshold,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,ngramOverlapThreshold:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.blue} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??G.indexWorkerOptions?.ngramOverlapThreshold]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),T.push(F("div",{className:`${r} ${$.cyan} border-l-4`,children:[F("div",{className:`${i} ${m.cyan}`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:c,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexStrategy}),F("select",{id:c,value:e.indexWorkerOptions?.strategy??G.indexWorkerOptions?.strategy??"hybrid",onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,strategy:b.target.value}})),className:`min-h-11 rounded border ${B.borderControl} px-2 pointer-coarse:text-base ${C} transition-colors ${N.surface} ${s.fg}`,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:`${w} ${s.fgMuted} transition-colors`,children:n.indexStrategyHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:f,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexMinCandidatesRatio}),O("input",{id:f,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??G.indexWorkerOptions?.minCandidatesRatio,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,minCandidatesRatio:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.cyan} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??G.indexWorkerOptions?.minCandidatesRatio]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexMinCandidatesRatioHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:l,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexMaxCandidatesRatio}),O("input",{id:l,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??G.indexWorkerOptions?.maxCandidatesRatio,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,maxCandidatesRatio:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.cyan} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??G.indexWorkerOptions?.maxCandidatesRatio]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),T.push(F("div",{className:`${r} ${$.indigo} border-l-4`,children:[F("div",{className:`${i} ${m.indigo}`,children:["\u{1F521} ",n.scoreTuningHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:g,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexJaroWinklerPrefix}),O("input",{id:g,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??G.indexWorkerOptions?.jaroWinklerPrefix,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,jaroWinklerPrefix:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.indigo} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??G.indexWorkerOptions?.jaroWinklerPrefix]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexJaroWinklerPrefixHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:y,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.maxResults}),F("label",{className:`flex min-h-11 items-center gap-2 ${C} ${s.fgMuted}`,children:[O("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,maxResults:b.target.checked?void 0:ga}}))}),n.noLimit]}),O("input",{id:y,type:"range",min:ga,max:"10000",step:"1000",disabled:e.indexWorkerOptions?.maxResults===void 0,value:e.indexWorkerOptions?.maxResults===void 0?ga:e.indexWorkerOptions.maxResults,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,maxResults:parseInt(b.target.value,10)}})),className:"h-11 w-full disabled:cursor-not-allowed"}),F("span",{className:`${m.indigo} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexMaxResultsHint})]})]},"jaro")),T.push(F("div",{className:`${r} ${$.emerald} border-l-4`,children:[F("div",{className:`${i} ${m.emerald}`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:x,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.fieldWeight}),O("input",{id:x,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??G.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,relevanceFieldWeight:parseFloat(b.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),F("span",{className:`${m.emerald} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??G.indexWorkerOptions?.relevanceFieldWeight??.2]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexFieldWeightHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:k,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexPerfectMatchBonus}),O("input",{id:k,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??G.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(b.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),F("span",{className:`${m.emerald} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??G.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexPerfectMatchBonusHint})]}),!o&&O("p",{className:`${w} ${m.emerald}`,children:n.relevanceOnlyNotice})]},"relevance"));let U=We(),z=We();return T.push(F("div",{className:`${r} ${$.teal} border-l-4`,children:[F("div",{className:`${i} ${m.teal}`,children:["\u{1F524} ",n.indexContainmentHeading]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:U,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexContainmentBase}),O("input",{id:U,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??G.indexWorkerOptions?.containmentScoreBase??.7,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,containmentScoreBase:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.teal} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??G.indexWorkerOptions?.containmentScoreBase??.7]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexContainmentBaseHint})]}),F("div",{className:"space-y-2",children:[O("label",{htmlFor:z,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.indexContainmentCoverage}),O("input",{id:z,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??G.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:b=>t(h=>({...h,indexWorkerOptions:{...h.indexWorkerOptions,containmentCoverageWeight:parseFloat(b.target.value)}})),className:"h-11 w-full"}),F("span",{className:`${m.teal} text-xs`,children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??G.indexWorkerOptions?.containmentCoverageWeight??.3]}),O("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.indexContainmentCoverageHint})]})]},"containment")),F("section",{className:"space-y-3",children:[F("div",{className:"flex items-center justify-between gap-3",children:[F("div",{className:`flex items-center gap-2 font-semibold ${m.green} text-xs transition-colors`,children:[O("span",{children:"\u{1F4CA}"}),O("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),O("button",{type:"button",onClick:()=>t(b=>({...b,indexWorkerOptions:{threshold:G.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:G.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:G.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:G.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:G.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:void 0,relevanceFieldWeight:G.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:G.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:G.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:G.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:G.indexWorkerOptions?.strategy},ngramSize:G.ngramSize,minNgramOverlap:G.minNgramOverlap})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border ${$.green} ${X.green} px-2 font-medium ${m.green} ${C} transition-colors ${E.hoverSurface}`,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:T})]})});ha.displayName="IndexWorkerSettings";ye();fe();ke();import{DEFAULT_FUZZY_SEARCH_OPTIONS as Le}from"@aiquants/fuzzy-search";import{memo as Sc,useId as yn}from"react";import{jsx as ue,jsxs as ge}from"react/jsx-runtime";var ya=1e3,ba=Sc(({searchOptions:e,setSearchOptions:t})=>{let n=ne(),r=`flex flex-col gap-1 rounded-md border ${N.surface} px-2 py-1 shadow-sm transition-colors`,i="text-xs font-semibold",o=e.sortBy==="relevance",a=yn(),u=yn(),d=yn(),c=yn(),p=yn(),f=yn(),l=[];return l.push(ge("div",{className:`${r} ${$.purple} border-l-4`,children:[ge("div",{className:`${i} ${m.purple}`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:a,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.levenshteinThreshold}),ue("input",{id:a,type:"range",min:"0.0",max:o?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??Le.levenshteinWorkerOptions?.threshold,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,threshold:parseFloat(g.target.value)}})),className:"h-11 w-full"}),ge("span",{className:`${m.purple} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??Le.levenshteinWorkerOptions?.threshold]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:o?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:u,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.levenshteinLengthSimilarity}),ue("input",{id:u,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??Le.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(g.target.value)}})),className:"h-11 w-full"}),ge("span",{className:`${m.purple} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??Le.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),l.push(ge("div",{className:`${r} ${$.pink} border-l-4`,children:[ge("div",{className:`${i} ${m.pink}`,children:["\u{1FA84} ",n.scoreTuningHeading]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:d,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.levenshteinLengthPenalty}),ue("input",{id:d,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??Le.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(g.target.value)}})),className:"h-11 w-full"}),ge("span",{className:`${m.pink} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??Le.levenshteinWorkerOptions?.lengthDiffPenalty]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),l.push(ge("div",{className:`${r} ${$.violet} border-l-4`,children:[ge("div",{className:`${i} ${m.violet}`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),ue("label",{htmlFor:c,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.maxResults}),ge("label",{className:`flex min-h-11 items-center gap-2 ${C} ${s.fgMuted}`,children:[ue("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,maxResults:g.target.checked?void 0:ya}}))}),n.noLimit]}),ue("input",{id:c,type:"range",min:ya,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?ya:e.levenshteinWorkerOptions.maxResults,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,maxResults:parseInt(g.target.value,10)}})),className:"h-11 w-full disabled:cursor-not-allowed"}),ge("span",{className:`${m.violet} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinMaxResultsHint})]},"max-results")),l.push(ge("div",{className:`${r} ${$.rose} border-l-4`,children:[ge("div",{className:`${i} ${m.rose}`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:p,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.fieldWeight}),ue("input",{id:p,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??Le.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(g.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),ge("span",{className:`${m.rose} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??Le.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinFieldWeightHint})]}),ge("div",{className:"space-y-2",children:[ue("label",{htmlFor:f,className:`font-medium ${C} ${s.fgMuted} transition-colors`,children:n.levenshteinPartialBonus}),ue("input",{id:f,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??Le.levenshteinWorkerOptions?.partialMatchBonus,onChange:g=>t(y=>({...y,levenshteinWorkerOptions:{...y.levenshteinWorkerOptions,partialMatchBonus:parseFloat(g.target.value)}})),disabled:!o,className:"h-11 w-full disabled:cursor-not-allowed"}),ge("span",{className:`${m.rose} text-xs`,children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??Le.levenshteinWorkerOptions?.partialMatchBonus]}),ue("p",{className:`${w} ${s.fgMuted} transition-colors`,children:n.levenshteinPartialBonusHint})]}),!o&&ue("p",{className:`${w} ${m.rose}`,children:n.relevanceOnlyNotice})]},"relevance")),ge("section",{className:"space-y-3",children:[ge("div",{className:"flex items-center justify-between gap-3",children:[ge("div",{className:`flex items-center gap-2 font-semibold ${m.purple} text-xs transition-colors`,children:[ue("span",{children:"\u{1F4CF}"}),ue("span",{className:"tracking-wide",children:n.levenshteinSettingsHeading})]}),ue("button",{type:"button",onClick:()=>t(g=>({...g,levenshteinWorkerOptions:{threshold:Le.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:Le.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:Le.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:Le.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:Le.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded border ${$.purple} ${X.purple} px-2 font-medium ${m.purple} ${C} transition-colors ${E.hoverSurface}`,title:n.resetToDefaultsTitle,children:n.reset})]}),ue("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:l})]})});ba.displayName="LevenshteinWorkerSettings";import{jsx as ct,jsxs as lt}from"react/jsx-runtime";var Cc={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Sa=vc(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:i,setOpenEmailsWithGmail:o,activeTab:a,onTabChange:u})=>{let d=ne(),{setScrollableRef:c,onPointerDown:p,onPointerMove:f,onPointerUp:l,onPointerLeave:g,onPointerCancel:y,onClickCapture:x}=Rt();return lt("div",{className:`wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border ${$.blue} ${N.surface} p-1.5 shadow-md transition-colors`,children:[lt("div",{className:`mb-0.5 flex shrink-0 flex-col gap-1 rounded ${X.blue} px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[lt("h3",{className:`font-semibold ${s.fgSecondary} text-xs transition-colors`,children:["\u2699\uFE0F ",d.searchSettings]}),ct("div",{className:"flex flex-wrap gap-1.5",children:lt("button",{type:"button",onClick:()=>t(k=>fr(k.workerUrls)),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded ${Te.red} px-1.5 ${C} ${s.onPrimary} transition-colors ${Bt.red}`,title:d.settingsResetAllTitle,children:["\u{1F504} ",d.settingsResetAll]})})]}),ct("div",{className:"mb-0 shrink-0",children:lt("div",{ref:c,role:"tablist","aria-label":d.settingsTabsLabel,className:`flex space-x-1 overflow-x-auto text-nowrap rounded-md ${N.muted} p-0.5 transition-colors`,style:Cc,onPointerDown:p,onPointerMove:f,onPointerUp:l,onPointerLeave:g,onPointerCancel:y,onClickCapture:x,children:[lt("button",{type:"button",role:"tab","aria-selected":a==="basic",onClick:()=>u("basic"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${a==="basic"?`${Te.blue} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u{1F527} ",d.settingsBasicTab]}),lt("button",{type:"button",role:"tab","aria-selected":a==="advanced",onClick:()=>u("advanced"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${a==="advanced"?`${Te.orange} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u26A1 ",d.settingsAdvancedTab]}),lt("button",{type:"button",role:"tab","aria-selected":a==="index",onClick:()=>u("index"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${a==="index"?`${Te.green} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u{1F4CA} ",d.indexWorkerName]}),lt("button",{type:"button",role:"tab","aria-selected":a==="levenshtein",onClick:()=>u("levenshtein"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${a==="levenshtein"?`${Te.purple} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u{1F4CF} ",d.levenshteinWorkerName]})]})}),lt("div",{className:"flex flex-col gap-1",children:[ct("div",{className:`${a==="basic"?"block":"hidden"}`,children:ct(zr,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:i,setOpenEmailsWithGmail:o})}),ct("div",{className:`${a==="advanced"?"block":"hidden"}`,children:ct(Br,{searchOptions:e,setSearchOptions:t})}),ct("div",{className:`${a==="index"?"block":"hidden"}`,children:ct(ha,{searchOptions:e,setSearchOptions:t})}),ct("div",{className:`${a==="levenshtein"?"block":"hidden"}`,children:ct(ba,{searchOptions:e,setSearchOptions:t})})]})]})});Sa.displayName="SearchOptionsPanel";import{memo as Nc,useCallback as Ec}from"react";Ft();ye();fe();ke();fe();import{memo as xc}from"react";import{jsxs as va}from"react/jsx-runtime";var _=xc(({label:e,value:t,unit:n,color:r=s.fgMuted})=>va("div",{className:`wrap-break-word flex min-w-0 flex-col overflow-hidden ${s.fgSecondary} transition-colors sm:flex-row sm:justify-between`,children:[va("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),va("span",{className:`font-medium ${r} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));_.displayName="StatItem";Ft();ye();fe();ke();import{memo as Tc}from"react";import{jsx as P,jsxs as Z}from"react/jsx-runtime";var bn=Tc(({kind:e,icon:t,stats:n,color:r})=>{let{locale:i,labels:o}=Pe(),a=W=>ee(i,W);if(!n)return P("section",{className:`rounded-lg border ${B.borderSubtle} border-dashed ${N.surface} p-3 ${s.fgMuted} text-xs transition-colors`,children:o.statsNoData});let u=n.basic||{},d=n.workerSpecific||{},c=n.analysis||{},p=u.totalSearches??0,f=u.totalProcessingTime??0,l=u.averageSearchTime??0,g=u.lastSearchTime??0,y=u.errorCount??0,x=u.timestamp,k=c.fieldPerformance||{},T=c.performanceInsights||{},U=c.recentHistory||[],z=d.specificMetrics||{},b=d.operationCount??0,h=d.operationDistribution||{},v=e==="index",L=e==="levenshtein",H=v?o.indexWorkerName:o.levenshteinWorkerName,S=z,M=z,ae=`flex flex-col gap-1 rounded-lg border ${N.surface} p-3 shadow-sm transition-colors`,I="text-xs font-semibold transition-colors",be=W=>{if(!W)return;let A=new Date(W);return Number.isNaN(A.getTime())?void 0:o.statsTimestamp(A)},oe=[];if(oe.push(Z("div",{className:`${ae} ${$.blue} border-l-4`,children:[Z("div",{className:`${I} ${r}`,children:["\u{1F4CA} ",o.statsBasicHeading]}),P(_,{label:o.statTotalSearches,value:a(p),color:r}),P(_,{label:o.statAverageSearchTime,value:l.toFixed(2),unit:"ms",color:r}),P(_,{label:o.statTotalProcessingTime,value:f.toFixed(2),unit:"ms",color:r}),P(_,{label:o.statLastSearchTime,value:g.toFixed(2),unit:"ms",color:r}),P(_,{label:o.statErrorCount,value:y,color:y>0?m.red:r}),be(x)&&P(_,{label:o.statUpdatedAt,value:be(x),color:s.fgMuted})]},"basic")),b>0||Object.keys(h).length>0){let W=Object.entries(h).sort(([,A],[,q])=>(Number(q)||0)-(Number(A)||0)).slice(0,6);oe.push(Z("div",{className:`${ae} ${$.amber} border-l-4`,children:[Z("div",{className:`${I} ${m.amber}`,children:["\u{1F527} ",o.statsOperationsHeading]}),P(_,{label:o.statTotalOperations,value:a(b),color:m.amber}),W.length>0&&P("div",{className:"mt-1 space-y-1",children:W.map(([A,q])=>P(_,{label:A,value:a(Number(q)),unit:o.timesUnit(a(Number(q))),color:m.amber},A))})]},"operations"))}if(v&&(oe.push(Z("div",{className:`${ae} ${$.green} border-l-4`,children:[Z("div",{className:`${I} ${m.green}`,children:["\u{1F3D7}\uFE0F ",o.statsIndexHeading]}),P(_,{label:o.statIndexBuilds,value:a(S.totalIndexBuilds??0),color:m.green}),P(_,{label:o.statDataSize,value:a(S.currentDataSize??0),unit:o.itemsUnit(a(S.currentDataSize??0)),color:m.green}),P(_,{label:o.statLastBuildTime,value:(S.lastIndexTime??0).toFixed(2),unit:"ms",color:m.green})]},"index-core")),S.cacheSize&&oe.push(Z("div",{className:`${ae} ${$.emerald} border-l-4`,children:[Z("div",{className:`${I} ${m.emerald}`,children:["\u{1F4BE} ",o.statsCacheHeading]}),P(_,{label:o.statCacheNgram,value:a(S.cacheSize.ngram??0),color:m.emerald}),P(_,{label:o.statCacheWord,value:a(S.cacheSize.word??0),color:m.emerald}),P(_,{label:o.statCachePhonetic,value:a(S.cacheSize.phonetic??0),color:m.emerald})]},"index-cache")),S.indexMetadata)){let W=Object.entries(S.indexMetadata).slice(0,6);W.length>0&&oe.push(Z("div",{className:`${ae} ${$.teal} border-l-4`,children:[Z("div",{className:`${I} ${m.teal}`,children:["\u{1F4CB} ",o.statsIndexMetadataHeading]}),W.map(([A,q])=>{let me;if(typeof q=="number"){let Se=A.toLowerCase();Se.includes("time")&&!Se.includes("timestamp")?me=`${q.toFixed(2)}ms`:Se.includes("timestamp")||Se.includes("at")?me=be(q)??q.toString():me=a(q)}else me=String(q);return P(_,{label:A,value:me,color:m.teal},A)})]},"index-meta"))}if(L){if(oe.push(Z("div",{className:`${ae} ${$.purple} border-l-4`,children:[Z("div",{className:`${I} ${m.purple}`,children:["\u{1F522} ",o.statsCalculationsHeading]}),P(_,{label:o.statTotalCalculations,value:a(M.totalCalculations??0),color:m.purple}),P(_,{label:o.statDistanceCalculations,value:a(M.totalDistanceCalculations??0),color:m.purple}),P(_,{label:o.statAverageDistance,value:typeof M.averageDistance=="number"?M.averageDistance.toFixed(2):"0.00",color:m.purple}),P(_,{label:o.statMinDistance,value:M.minDistance??o.notAvailable,color:m.purple}),P(_,{label:o.statMaxDistance,value:M.maxDistance??0,color:m.purple})]},"lev-basic")),oe.push(Z("div",{className:`${ae} ${$.fuchsia} border-l-4`,children:[Z("div",{className:`${I} ${m.fuchsia}`,children:["\u{1F3AF} ",o.statsMatchesHeading]}),P(_,{label:o.statPartialMatches,value:a(M.partialMatches??0),color:m.fuchsia}),P(_,{label:o.statPerfectMatches,value:a(M.perfectMatches??0),color:m.fuchsia}),P(_,{label:o.statEarlyTerminations,value:a(M.earlyTerminations??0),color:m.fuchsia})]},"lev-match")),M.similarityThresholds&&oe.push(Z("div",{className:`${ae} ${$.rose} border-l-4`,children:[Z("div",{className:`${I} ${m.rose}`,children:["\u{1F4C8} ",o.statsSimilarityHeading]}),P(_,{label:o.statAbove80,value:a(M.similarityThresholds.above80??0),color:m.emerald}),P(_,{label:o.statAbove60,value:a(M.similarityThresholds.above60??0),color:m.lime}),P(_,{label:o.statAbove40,value:a(M.similarityThresholds.above40??0),color:m.orange}),P(_,{label:o.statBelow40,value:a(M.similarityThresholds.below40??0),color:m.red})]},"lev-similarity")),M.distanceDistribution){let W=Object.entries(M.distanceDistribution).sort(([,A],[,q])=>Number(q)-Number(A)).slice(0,6);W.length>0&&oe.push(Z("div",{className:`${ae} ${$.indigo} border-l-4`,children:[Z("div",{className:`${I} ${m.indigo}`,children:["\u{1F4CA} ",o.statsDistanceHeading]}),W.map(([A,q])=>P(_,{label:o.statDistance(A),value:a(Number(q)),unit:o.timesUnit(a(Number(q))),color:m.indigo},A))]},"lev-distance"))}if(M.queryLengthStats){let W=Object.entries(M.queryLengthStats).sort(([,A],[,q])=>(q.count??0)-(A.count??0)).slice(0,6);W.length>0&&oe.push(Z("div",{className:`${ae} ${$.violet} border-l-4`,children:[Z("div",{className:`${I} ${m.violet}`,children:["\u{1F4CF} ",o.statsQueryLengthHeading]}),W.map(([A,q])=>{let me=Number(q.count??0),Se=Number(q.averageScore??0);return P(_,{label:o.statQueryLength(A),value:o.statQueryLengthValue({count:me,averagePercent:(Se*100).toFixed(1)}),color:m.violet},A)})]},"lev-query-length"))}}if(Object.keys(k).length>0){let W=Object.entries(k).sort(([,A],[,q])=>(q.averageScore??0)-(A.averageScore??0)).slice(0,6);oe.push(Z("div",{className:`${ae} ${$.purple} border-l-4`,children:[Z("div",{className:`${I} ${m.purple}`,children:["\u{1F4CB} ",o.statsFieldPerformanceHeading]}),W.map(([A,q])=>{let me=q;return Z("div",{className:`space-y-1 rounded ${X.purple} p-2 transition-colors`,children:[P("div",{className:`font-semibold ${m.purple} text-xs transition-colors`,children:A}),P(_,{label:o.statAverageScore,value:`${((me.averageScore??0)*100).toFixed(1)}%`,color:m.purple}),P(_,{label:o.statMatchCount,value:a(me.matchCount??0),unit:o.itemsUnit(a(me.matchCount??0)),color:m.purple}),P(_,{label:o.statBestWorstScore,value:`${((me.bestScore??0)*100).toFixed(1)}% / ${((me.worstScore??0)*100).toFixed(1)}%`,color:m.purple})]},A)})]},"field-performance"))}if(T.bestPerformingField||T.totalHistoryEntries||T.similarityDistribution){let W=(T.recentAverageResultCount??0).toFixed(1);oe.push(Z("div",{className:`${ae} ${$.blue} border-l-4`,children:[Z("div",{className:`${I} ${m.blue}`,children:["\u{1F50D} ",o.statsInsightsHeading]}),T.bestPerformingField&&P(_,{label:o.statBestField,value:T.bestPerformingField,color:m.blue}),P(_,{label:o.statRecentAverageTime,value:(T.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:m.blue}),P(_,{label:o.statRecentAverageResults,value:W,unit:o.itemsUnit(W),color:m.blue}),P(_,{label:o.statThroughput,value:(T.throughputPerSecond??0).toFixed(2),unit:o.throughputUnit,color:m.blue}),P(_,{label:o.statCommonQueryLength,value:a(T.mostCommonQueryLength??0),unit:o.charactersUnit(a(T.mostCommonQueryLength??0)),color:m.blue}),P(_,{label:o.statHistoryEntries,value:a(T.totalHistoryEntries??0),color:m.blue}),T.similarityDistribution&&Z("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[P(_,{label:o.statHighSimilarity,value:a(T.similarityDistribution.highSimilarity??0),color:m.emerald}),P(_,{label:o.statMediumSimilarity,value:a(T.similarityDistribution.mediumSimilarity??0),color:m.lime}),P(_,{label:o.statLowSimilarity,value:a(T.similarityDistribution.lowSimilarity??0),color:m.orange}),P(_,{label:o.statVeryLowSimilarity,value:a(T.similarityDistribution.veryLowSimilarity??0),color:m.red})]})]},"performance-insights"))}return U.length>0&&oe.push(Z("div",{className:`${ae} ${$.sky} border-l-4`,children:[Z("div",{className:`${I} ${m.sky}`,children:["\u{1F4C8} ",o.statsRecentHistoryHeading]}),U.slice(-3).reverse().map((W,A)=>Z("div",{className:`rounded ${X.sky} p-2 transition-colors`,children:[P("div",{className:`font-medium ${m.sky} transition-colors`,children:W.operationType}),P("div",{className:`${m.sky} text-xs transition-colors`,children:o.statsHistoryEntry({processingTimeMs:W.processingTime.toFixed(2),resultCount:W.resultCount??0})}),be(W.timestamp)&&P("div",{className:`${w} ${m.sky} transition-colors`,children:be(W.timestamp)})]},`${W.operationType}-${W.timestamp??A}`))]},"recent-history")),Z("section",{className:"space-y-2",children:[Z("div",{className:`flex items-center gap-2 font-semibold text-xs ${r}`,children:[P("span",{children:t}),P("span",{className:"tracking-wide",children:H})]}),P("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:oe})]})});bn.displayName="WorkerStatsSection";import{jsx as Ue,jsxs as ze}from"react/jsx-runtime";var kc={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ca=Nc(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:r,resetStats:i,rebuildIndex:o,isIndexBuilding:a,activeTab:u,onTabChange:d})=>{let{locale:c,labels:p}=Pe(),f=t.trim(),l=f?r:n,{setScrollableRef:g,onPointerDown:y,onPointerMove:x,onPointerUp:k,onPointerLeave:T,onPointerCancel:U,onClickCapture:z}=Rt(),b=u!=="index"||a,h=a?p.statsRebuildingTitle:u!=="index"?p.statsRebuildIndexTabOnlyTitle:p.statsRebuildTitle,v=b?`cursor-not-allowed ${N.muted} ${s.fgMuted}`:`${Te.blue} ${s.onPrimary} ${Bt.blue}`,L=a?`\u23F3 ${p.statsRebuilding}`:`\u{1F3D7}\uFE0F ${p.statsRebuild}`,H=Ec(()=>{o().catch(()=>{})},[o]);return ze("div",{className:`wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border ${$.blue} ${N.surface} p-1.5 shadow-md transition-colors`,children:[ze("div",{className:`mb-0.5 flex shrink-0 flex-col gap-1 rounded ${X.blue} px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between`,children:[ze("h3",{className:`font-semibold ${s.fgSecondary} text-xs transition-colors`,children:["\u{1F4CA} ",p.searchStatistics]}),ze("div",{className:"flex flex-wrap gap-1.5",children:[Ue("button",{type:"button",onClick:H,disabled:b,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${v}`,title:h,children:L}),ze("button",{type:"button",onClick:i,className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded ${Te.red} px-1.5 ${C} ${s.onPrimary} transition-colors ${Bt.red}`,title:p.statsResetTitle,children:["\u{1F504} ",p.reset]})]})]}),Ue("div",{className:"mb-0 shrink-0",children:ze("div",{ref:g,role:"tablist","aria-label":p.statsTabsLabel,className:`flex space-x-1 overflow-x-auto text-nowrap rounded-md ${N.muted} p-0.5 transition-colors`,style:kc,onPointerDown:y,onPointerMove:x,onPointerUp:k,onPointerLeave:T,onPointerCancel:U,onClickCapture:z,children:[ze("button",{type:"button",role:"tab","aria-selected":u==="overview",onClick:()=>d("overview"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${u==="overview"?`${Te.blue} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u{1F4CB} ",p.statsOverviewTab]}),ze("button",{type:"button",role:"tab","aria-selected":u==="index",onClick:()=>d("index"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${u==="index"?`${Te.green} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u{1F4CA} ",p.statsIndexTab]}),ze("button",{type:"button",role:"tab","aria-selected":u==="levenshtein",onClick:()=>d("levenshtein"),className:`inline-flex min-h-11 min-w-11 items-center justify-center rounded px-1.5 ${C} transition-colors ${u==="levenshtein"?`${Te.purple} ${s.onPrimary}`:`${s.fgMuted} ${E.hoverSurface}`}`,children:["\u{1F4CF} ",p.statsLevenshteinTab]})]})}),ze("div",{className:"flex flex-col gap-1 pb-0.5",children:[ze("div",{className:`${u==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 ${s.fgMuted} text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4`,children:[Ue(_,{label:p.statTotalSearches,value:ee(c,e.totalSearches)}),Ue(_,{label:p.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),Ue(_,{label:p.statDataCount,value:ee(c,e.itemCount)}),Ue(_,{label:f?p.statResultCount:p.statDisplayedCount,value:ee(c,l)})]}),Ue("div",{className:`${u==="index"?"space-y-3":"hidden"} pr-1 ${s.fgMuted} text-xs transition-colors`,children:Ue(bn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:m.green})}),Ue("div",{className:`${u==="levenshtein"?"space-y-3":"hidden"} pr-1 ${s.fgMuted} text-xs transition-colors`,children:Ue(bn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:m.purple})}),ze("div",{className:"hidden",children:[Ue(bn,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:m.green}),Ue(bn,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:m.purple})]})]})]})});Ca.displayName="StatisticsPanel";import{Fragment as Xo,jsx as ce,jsxs as we}from"react/jsx-runtime";var Oc=/[\u200B\uFEFF]/g,xa=typeof window<"u",Jo=xa&&typeof document<"u",kr=(e,t=[],n=!1)=>{let r=Qo(e);r.current=e,vt(()=>{if(!(!xa||n&&!Jo))return r.current()},[n,...t])},jo=(e,t,n)=>{let[r,i]=et(()=>{let o=Go(a=>a.getItem(e));return o&&t.includes(o)?o:n});return kr(()=>{Go(o=>{o.setItem(e,r)})},[e,r]),[r,i]},Go=e=>{if(!xa)return null;try{return e(window.sessionStorage)}catch{return null}},qo=(e,t)=>{let[n,r]=et(e);return vt(()=>{let i=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(i)}},[e,t]),n},Ac="contact-map.settings-tab",Dc="contact-map.statistics-tab",Wc=["basic","advanced","index","levenshtein"],Hc=["overview","index","levenshtein"],Yo=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],Ic={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Zo=({streamState:e,...t}={})=>e===void 0?ce(Fc,{...t}):ce(ei,{...t,streamState:e}),Fc=e=>{let{context:t}=pr();return ce(ei,{...e,streamState:t})},Bc={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},ei=e=>{let{streamState:t,onFooterVisibilityChange:n,children:r}=e,i=Re(e,"workerUrls"),o=bt(),{locale:a,labels:u}=Pe(),{contactMapRecords:d,contactMapRecordMap:c,isStreamingComplete:p,isStreamingFailed:f}=t,l=_c(),[g]=$c(),y=Qo(null),[x,k]=et(!0),[T,U]=et(o.openEmailsWithGmail??!1),{indexWorker:z,levenshteinWorker:b}=mn(o.workerUrls,i,Bc),[h,v]=et(()=>fr({indexWorker:z,levenshteinWorker:b})),[L,H]=et(g.get("q")||""),S=qo(L,h.debounceMs??Mc.debounceMs);vt(()=>{let V=g.get("q")||"";H(J=>J!==V?V:J)},[g]),vt(()=>{if(typeof window>"u")return;let V=new URL(window.location.href);(V.searchParams.get("q")||"")!==S&&(S?V.searchParams.set("q",S):V.searchParams.delete("q"),window.history.replaceState(window.history.state,"",V.toString()))},[S]);let[M,ae]=Pc(),[I,be]=et("search"),[oe,W]=jo(Ac,Wc,"basic"),[A,q]=jo(Dc,Hc,"overview"),{setScrollableRef:me,onPointerDown:Se,onPointerMove:Oe,onPointerUp:_t,onPointerLeave:Yt,onPointerCancel:Ct,onClickCapture:Xt}=Rt(),ve=Sn(()=>{if(!Jo)return;let V=y.current;!V||document.activeElement===V||window.requestAnimationFrame(()=>{try{V.focus({preventScroll:!0})}catch{}})},[]),Qt=Sn(V=>{let J=V;be(J),J==="search"&&ve()},[ve]),Ve=Pt(()=>({...h,debounceMs:0}),[h]),[dt,Ke]=et("union"),He=dt==="intersection",Jt=He?u.operatorAndTitle:u.operatorOrTitle,xt=Sn(V=>Lc(V,dt),[dt]),Y=Pt(()=>({querySetsOf:xt}),[xt]),he=qo(d,p?0:800),{searchTerm:Q,setSearchTerm:ut,filteredItems:$t,resultTerm:xn,isSearching:Tt,isIndexBuilding:Ae,clearSearch:Tn,resetStats:Nn,performanceMetrics:tt,rebuildIndex:Nt,error:nt}=wc(he,Yo,Ve,Y),Ot=Q.trim().length>0,[Et,At]=et(""),[Zt,Mr]=et(()=>Q),kt=Pt(()=>nr(L),[L]),je=Pt(()=>nr(S),[S]);vt(()=>{S===Et&&je===Q||ae(()=>{At(S),ut(je)})},[S,Et,je,Q,ut]);let En=Sn(V=>{let xe=V.target.value.replace(Oc,"");H(xe)},[]),Lr=Sn(()=>{H(""),At(""),Tn(),ve()},[Tn,ve]),Fn=Sn(()=>{Ke(V=>V==="intersection"?"union":"intersection"),ve()},[ve]);kr(()=>{if(!(I==="search"&&l.state==="idle"&&!M))return;let J=document.activeElement;if(!!!(J?.matches('[role="tab"]')||J?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&J&&J!==document.body&&J!==y.current)return;let rt=window.requestAnimationFrame(()=>{ve()});return()=>{window.cancelAnimationFrame(rt)}},[I,l.state,M,ve],!0),kr(()=>{if(I!=="search")return;let V=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ve()}],[window,"pageshow",()=>{ve()}]];for(let[J,xe,rt]of V)J.addEventListener(xe,rt);return()=>{for(let[J,xe,rt]of V)J.removeEventListener(xe,rt)}},[I,ve],!0),vt(()=>(n&&n(I==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[I,n]),kr(()=>{let V=document.body,J=V.style.overflow;return I==="search"&&(V.style.overflow="hidden"),()=>{V.style.overflow=J}},[I],!0),vt(()=>{tt&&st.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:tt.totalSearches,averageSearchTime:tt.averageSearchTime,itemCount:tt.itemCount,resultsCount:tt.resultsCount,workersAvailable:!!tt.workerStats})},[tt]);let{isAwaitingDebounce:Bn,isAwaitingSearchTermSync:zn,isSearchInProgress:mt}=Pt(()=>{let V=kt!==je,J=je!==Q,xe=Q.trim().length>0||kt.trim().length>0;return{isAwaitingDebounce:V,isAwaitingSearchTermSync:J,isSearchInProgress:M||Tt||xn!==Q&&nt===null||xe&&Ae||V||J||Zt!==Q}},[kt,je,Q,xn,nt,M,Tt,Ae,Zt]),[en,Un]=et(Q);vt(()=>{en!==Q&&Un(Q)},[Q,en]),vt(()=>{Bn||zn||M||Tt||Ae||en===Q&&Zt!==Q&&Mr(Q)},[Q,Zt,Bn,zn,M,Tt,Ae,en]);let kn=Pt(()=>Ga(Et,Yo),[Et]),Vn=Pt(()=>kn($t),[kn,$t]),Kn=Pt(()=>({contactMapRecords:d,contactMapRecordMap:c,filteredItems:Vn,searchQuery:Et,searchTerm:Q,isSearching:Tt,isIndexBuilding:Ae,isPending:M,hasSearchTerm:Ot,enableHighlighting:x,openEmailsWithGmail:T,isSearchInProgress:mt,isSearchTabActive:I==="search",errorMessage:nt??null,isStreamingComplete:p,isStreamingFailed:f}),[d,c,Vn,Et,Q,Tt,Ae,M,Ot,x,T,mt,I,nt,p,f]),wr=Ot?$t.length:d.length,Mn=ee(a,d.length),D=ee(a,$t.length),pe=`${`scrollbar-hidden ${N.subtle} ${s.fg}`}${I==="search"?" h-full min-h-0":""}`;return ce("div",{className:pe,children:we(sr,{value:I,onValueChange:Qt,className:`flex flex-col${I==="search"?" h-full min-h-0":""}`,children:[we(On,{ref:me,style:Ic,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 ${N.subtle} transition-colors ${s.fgSecondary}`,onPointerDown:Se,onPointerMove:Oe,onPointerUp:_t,onPointerLeave:Yt,onPointerCancel:Ct,onClickCapture:Xt,children:[we(Ut,{value:"search",className:`min-h-11 min-w-16 px-2 py-0 ${C} transition-colors sm:min-w-24 sm:px-2.5`,children:["\u{1F50D} ",u.searchTab]}),we(Ut,{value:"settings",className:`min-h-11 min-w-16 px-2 py-0 ${C} transition-colors sm:min-w-24 sm:px-2.5`,children:["\u2699\uFE0F ",u.searchSettings]}),we(Ut,{value:"statistics",className:`min-h-11 min-w-16 px-2 py-0 ${C} transition-colors sm:min-w-24 sm:px-2.5`,children:["\u{1F4CA} ",u.searchStatistics]})]}),ce(Vt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:we("div",{className:"flex h-full flex-col",children:[ce("div",{className:`rounded-md border ${B.borderSubtle} ${N.surface} shadow-sm transition-colors`,children:we("div",{className:"flex flex-col",children:[ce("div",{className:"relative",children:we("div",{className:"flex items-center gap-1 p-1",children:[we("button",{type:"button",onClick:Fn,"aria-pressed":He,title:Jt,className:`inline-flex min-h-11 min-w-11 items-center justify-center gap-0.5 rounded border px-1.5 font-semibold ${C} transition-colors sm:min-w-12 sm:px-2 ${He?`border-transparent ${Te.blue} ${s.onPrimary} ${Bt.blue}`:`${$a.amber} ${X.amber} ${m.amber} ${E.hoverSurface}`}`,children:[ce("span",{children:He?u.operatorAnd:u.operatorOr}),ce("span",{className:`hidden ${w} sm:inline`,children:He?u.operatorAndHint:u.operatorOrHint})]}),ce("input",{ref:y,type:"text",value:L,onChange:En,placeholder:u.searchPlaceholder,className:`min-h-11 flex-1 rounded border ${B.borderControl} border-solid px-2 pointer-coarse:text-base ${C} shadow-sm transition-colors ${E.focusBorder} focus:ring-1 ${E.focusRing} ${N.surface} ${s.fg}`}),L&&ce("button",{type:"button",onClick:Lr,className:`flex min-h-11 min-w-11 items-center justify-center gap-1 rounded border ${B.borderControl} px-1.5 ${C} transition-colors ${E.hoverFg} sm:px-2 ${s.fgMuted}`,title:mt?u.searchBusyTitle:u.clearSearch,"aria-label":mt?void 0:u.clearSearch,disabled:mt,children:mt?we(Xo,{children:[ce(Rc,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),ce("span",{className:"hidden sm:inline",children:u.searching})]}):"\u2715"})]})}),we("p",{className:`px-1.5 py-0.5 ${w} ${s.fgSecondary} transition-colors`,children:[u.registeredCountLabel," ",ce("span",{className:`font-semibold ${C} ${s.fg}`,children:Mn})," ",u.recordUnit(Mn),Ae?we("span",{className:`ml-1.5 inline-flex items-center rounded ${X.blue} px-1.5 py-0.2 ${m.blue}`,children:["\u23F3 ",u.rebuildingIndex]}):null,nt?we("span",{className:`ml-1.5 inline-flex items-center rounded ${X.rose} px-1.5 py-0.2 ${m.rose}`,children:["\u26A0\uFE0F ",u.errorLabel,ce("span",{className:"ml-1 break-all font-semibold",children:nt})]}):null,Ot&&we("span",{className:`ml-1.5 ${m.blue}`,children:["| ",u.resultCountLabel,mt?ce("span",{className:"ml-1 font-semibold",children:u.searching}):we(Xo,{children:[ce("span",{className:`ml-1 font-semibold ${C} ${s.fg}`,children:D}),ce("span",{className:"ml-0.5",children:u.resultUnit(D)})]})]})]}),ce("div",{className:"h-2.5 px-2 pb-1.5",children:Ae?ce(uo,{className:`h-1 ${Mt.progressTrack}`,indicatorClassName:qe.blue}):null})]})}),r?r(Kn):ce(Ko,{context:Kn})]})}),ce(Vt,{value:"settings",className:"mt-0",children:ce(Sa,{searchOptions:h,setSearchOptions:v,enableHighlighting:x,setEnableHighlighting:k,openEmailsWithGmail:T,setOpenEmailsWithGmail:U,activeTab:oe,onTabChange:W})}),ce(Vt,{value:"statistics",className:"mt-0",children:ce(Ca,{performanceMetrics:tt,searchTerm:Q,totalDataCount:d.length,resultsCount:wr,resetStats:Nn,rebuildIndex:Nt,isIndexBuilding:Ae,activeTab:A,onTabChange:q})})]})})};import{jsx as Cn,jsxs as ni}from"react/jsx-runtime";var zc=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let r=ne(),i=t===void 0?r.appTitle:t,{context:o,retryNow:a}=pr(),u=Cn(ta,{recordCount:o.contactMapRecords.length,companyCount:o.companyCount,phase:o.streamPhase,loadedCount:o.loadedCount,totalCount:o.totalCount,errorMessage:o.errorMessage,onRetry:a});return ni("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:i,annotation:u}):ni("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[Cn("h1",{className:"font-bold text-xl",children:i}),u]}),Cn("div",{className:"min-h-0 flex-1",children:Cn(Zo,{streamState:o,onFooterVisibilityChange:n})})]})},Mg=e=>{let t=bt(),n=Re(e,"streamEndpoint"),r=Re(e,"workerUrls"),i=Re(e,"locale"),o=Re(e,"labels"),a=ti(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:mn(t.workerUrls,r,{setting:"ContactMapAppView workerUrls"}),locale:i===void 0?t.locale:i,labels:o===void 0?t.labels:o}),[t,n,r,i,o]),u=i!==void 0,d=o!==void 0,c=ti(()=>({locale:u?"ContactMapAppView locale":"locale",labels:d?"ContactMapAppView labels":"labels"}),[u,d]);return Cn(ra,{config:a,chromeSurface:c,children:Cn(zc,{...e})})};Ft();ye();import{createShouldRevalidate as Uc}from"@aiquants/route-revalidation";var _g=Uc({submissions:"url",query:{ignore:[pn,"q"]}});export{Br as AdvancedSearchSettings,zr as BasicSearchSettings,gt as CONTACT_MAP_LABEL_CATALOGS,wn as CONTACT_MAP_LABEL_KEYS,qa as ContactDetailGrid,un as ContactDetailPanel,er as ContactDetailPopup,tr as ContactDetailRowLayout,ta as ContactMapAnnotation,Mg as ContactMapAppView,Os as ContactMapConfigProvider,wo as ContactMapSearchListView,Zo as ContactMapSearchPage,Ko as ContactMapSearchTabGroup,Vo as ContactMapSearchTreeView,dr as ContactMapStreamClient,Ne as HighlightedText,ha as IndexWorkerSettings,tp as LIST_COLLAPSE_THRESHOLD,Ll as LIST_DETAIL_PANEL_MIN_WIDTH,np as LIST_EXPAND_THRESHOLD,Ml as LIST_PANEL_MIN_WIDTH,wl as LIST_RESIZE_HANDLE_THICKNESS,ba as LevenshteinWorkerSettings,uo as Progress,Sa as SearchOptionsPanel,_ as StatItem,Ca as StatisticsPanel,vr as SwipeOverlay,Ip as TREE_COLLAPSE_THRESHOLD,rc as TREE_DETAIL_PANEL_MIN_WIDTH,Fp as TREE_EXPAND_THRESHOLD,nc as TREE_PANEL_MIN_WIDTH,ac as TREE_RESIZE_HANDLE_THICKNESS,sr as Tabs,Vt as TabsContent,On as TabsList,Ut as TabsTrigger,Tr as TreeWorkerSession,bn as WorkerStatsSection,ur as assertContactMapStreamEndpoint,ro as assertContactMapTreeWorkerUrl,Gu as assertContactMapWorkerUrls,lc as composeTreeVirtualScrollOptions,_g as contactMapShouldRevalidate,js as countContactMapCompanies,Hs as deserializeStreamRecord,Bs as getContactMapStreamClient,Gl as getTreeWorkerSession,mn as layerContactMapWorkerUrls,lm as resetContactMapStreamClientForTesting,fp as resetTreeWorkerSessionForTesting,Dr as resolveContactMapLabels,Ro as useAnimatedNumber,bt as useContactMapConfig,ne as useContactMapLabels,Ks as useContactMapStream,la as useContactPanelSizing,mo as useDynamicViewportHeight,Rt as useHorizontalDragScroll,yr as useLongPressPopup,Wl as useReportPopupVisibility,br as useResponsiveTwoColumnLayout,Dl as useRowPopupRegistry,pr as useStreamedContactMapContext,Ao as useTreeWorker};
|