@aiquants/contact-map 0.12.0 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -1
- package/dist/client.d.mts +2 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.js +2 -2
- package/dist/client.mjs +2 -2
- package/package.json +6 -5
package/dist/client.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Bo=Object.create;var Nn=Object.defineProperty;var Uo=Object.getOwnPropertyDescriptor;var $o=Object.getOwnPropertyNames;var Vo=Object.getPrototypeOf,Ko=Object.prototype.hasOwnProperty;var De=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ja=(e,t)=>{for(var n in t)Nn(e,n,{get:t[n],enumerable:!0})},Za=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of $o(t))!Ko.call(e,s)&&s!==n&&Nn(e,s,{get:()=>t[s],enumerable:!(r=Uo(t,s))||r.enumerable});return e};var de=(e,t,n)=>(n=e!=null?Bo(Vo(e)):{},Za(t||!e||!e.__esModule?Nn(n,"default",{value:e,enumerable:!0}):n,e)),jo=e=>Za(Nn({},"__esModule",{value:!0}),e);var He,Mn,er,Lt,Et,Yt,Qe,We,Pn,ma,ga,Be,Z,yt=De(()=>{"use strict";He=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},Mn=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,er=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let n of t){let r=He(e[n]);if(r)return{value:r,fieldKey:n}}return{value:null,fieldKey:null}},Lt=e=>er(e,["custom_email","email"]),Et=e=>er(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),Yt=e=>{let t=He(e);if(!t)return null;let n=t.replace(/[^0-9+#*]/g,"");return n.length===0?null:`tel:${n}`},Qe=(e,t)=>{let n=He(e);return n?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(n)}`:`mailto:${encodeURIComponent(n)}`:null},We=(e,t)=>String(e).padStart(t,"0"),Pn=e=>`${We(e.getUTCFullYear(),4)}-${We(e.getUTCMonth()+1,2)}-${We(e.getUTCDate(),2)}`,ma=e=>`${Pn(e)} ${We(e.getUTCHours(),2)}:${We(e.getUTCMinutes(),2)}:${We(e.getUTCSeconds(),2)}`,ga=e=>`${We(e.getFullYear(),4)}-${We(e.getMonth()+1,2)}-${We(e.getDate(),2)} ${We(e.getHours(),2)}:${We(e.getMinutes(),2)}:${We(e.getSeconds(),2)}`,Be=(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)},Z=e=>e==null?"-":typeof e=="string"?He(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":String(e)});var se,tr,Ot=De(()=>{"use strict";se=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":tr(e);case"function":return tr(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},tr=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var Dt,ke,Wt=De(()=>{"use strict";Dt=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},ke=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var qo,Rn,ha=De(()=>{"use strict";qo=(e,t)=>{let n=Array.from({length:t.length+1},(r,s)=>s);for(let r=1;r<=e.length;r+=1){let s=[r];for(let a=1;a<=t.length;a+=1){let o=n[a-1]+(e[r-1]===t[a-1]?0:1);s.push(Math.min(n[a]+1,s[a-1]+1,o))}n=s}return n[t.length]},Rn=(e,t)=>{let n=e.toLowerCase();if(n.length>=3){let s=t.find(a=>a.toLowerCase().startsWith(n));if(s!==void 0)return s}let r;for(let s of t){let a=qo(n,s.toLowerCase());a<=Math.max(1,Math.floor(s.length/4))&&(r===void 0||a<r.distance)&&(r={key:s,distance:a})}return r?.key}});var Ye,En,Go,X,bt,Ln,ar,Ht,Ue,Qo,nr,rr,Yo,fa,Xo,Jo,Zo,On,ya,ba,xt=De(()=>{"use strict";Ye=require("@aiquants/directory-tree"),En=require("@aiquants/virtualscroll");yt();Ot();Wt();ha();Go=Object.freeze({en:"en-US",ja:"ja-JP"}),X=(e,t)=>t.toLocaleString(Go[e]),bt=(e,t,n)=>e==="1"?t:n,Ln=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`Streaming (${X("en",e)} / ${X("en",t)} \xB7 ${n}%)`,annotationStreamingCount:e=>`Streaming (${X("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${X("en",e)} received)`,annotationReconnecting:e=>`Reconnecting (${X("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>bt(e,"record","records"),companyUnit:e=>bt(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=>bt(e,"match","matches"),listViewTab:"List",treeViewTab:"Tree",columnNo:"No",columnId:"ID",columnScore:"Score",columnName:"Name",columnTitle:"Title",columnCompany:"Company",columnDepartment:"Department",columnPhone:"Phone",columnEmail:"Email",columnUpdatedAt:"Updated",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"No search results found",listNoData:"No data",listResizeHandle:"Resize the border between the contact list and the detail pane",detailHeading:"Contact details",close:"Close",noName:"(No Name)",treeNodeCountTitle:"Number of nodes built in the tree view",treeNodeCountLabel:"Nodes:",treeNodeCount:e=>X("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${X("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:ma,recordDate:Pn,popupCustomMobilePhone:"Mobile (custom)",popupMobilePhone:"Mobile",popupCustomCompanyPhone:"Company phone (custom)",popupCompanyPhone:"Company phone",popupCustomEmail:"Email (custom)",popupEmail:"Email",popupGmailHint:"Double-click or double-tap to open Gmail",popupLastContactDate:"Last contact:",popupNoContactMethods:"No contact information to display",overlayTitle:"Details",overlayBackdrop:"Tap the background to close",settingsResetAllTitle:"Reset all settings",settingsResetAll:"Reset all",settingsTabsLabel:"Search option tabs",settingsBasicTab:"Basic settings",settingsAdvancedTab:"Advanced settings",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"Current:",resetToDefaultsTitle:"Reset to defaults",reset:"Reset",relevanceOnlyNotice:"Editable only when sorting by relevance",relevanceWeightsHeading:"Relevance score weights",fieldWeight:"Field weight",scoreTuningHeading:"Score tuning",maxResults:"Maximum results",noLimit:"No limit",basicThresholdHeading:"Final similarity threshold",basicThresholdLabel:"Adjust the minimum score",basicThresholdRangeRelevance:"In relevance mode a score can exceed 1.0 (range: 0.0-1.5)",basicThresholdRange:"Range: 0.0-1.0",basicDisplayHeading:"Display options",basicCaseSensitive:"Case-sensitive",basicHighlight:"Highlight matches",basicOpenEmailsWithGmail:"Open email addresses in Gmail compose",basicMultiTermOperator:"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",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:ga,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=X("en",e);return`${n} ${bt(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: ${X("en",t)}`,timesUnit:e=>bt(e," time"," times"),itemsUnit:e=>bt(e," item"," items"),charactersUnit:e=>bt(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 (${X("ja",e)} / ${X("ja",t)} \u4EF6\u30FB${n}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${X("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${X("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationReconnecting:e=>`\u518D\u63A5\u7D9A\u4E2D (${X("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationAuthRequired:"\u30BB\u30C3\u30B7\u30E7\u30F3\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u76F4\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044",annotationRetry:"\u518D\u8A66\u884C",recordUnit:()=>"\u4EF6",companyUnit:()=>"\u793E",searchTab:"\u3042\u3044\u307E\u3044\u691C\u7D22",searchSettings:"\u691C\u7D22\u8A2D\u5B9A",searchStatistics:"\u691C\u7D22\u7D71\u8A08",operatorAndTitle:"AND \u691C\u7D22 (\u3059\u3079\u3066\u4E00\u81F4)",operatorOrTitle:"OR \u691C\u7D22 (\u3044\u305A\u308C\u304B\u4E00\u81F4)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"\u5168\u8A9E\u4E00\u81F4",operatorOrHint:"\u3044\u305A\u308C\u304B\u4E00\u81F4",searchPlaceholder:"\u3042\u3044\u307E\u3044\u691C\u7D22...",searchBusyTitle:"\u691C\u7D22\u51E6\u7406\u4E2D",clearSearch:"\u691C\u7D22\u3092\u30AF\u30EA\u30A2",searching:"\u691C\u7D22\u4E2D...",registeredCountLabel:"\u767B\u9332\u4EF6\u6570:",rebuildingIndex:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D...",errorLabel:"\u30A8\u30E9\u30FC:",resultCountLabel:"\u691C\u7D22\u7D50\u679C:",resultUnit:()=>"\u4EF6",listViewTab:"\u4E00\u89A7",treeViewTab:"\u30C4\u30EA\u30FC",columnNo:"No",columnId:"ID",columnScore:"\u30B9\u30B3\u30A2",columnName:"\u6C0F\u540D",columnTitle:"\u5F79\u8077",columnCompany:"\u4F1A\u793E\u540D",columnDepartment:"\u90E8\u7F72",columnPhone:"\u96FB\u8A71\u756A\u53F7",columnEmail:"\u30E1\u30FC\u30EB",columnUpdatedAt:"\u66F4\u65B0\u65E5\u6642",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"\u691C\u7D22\u7D50\u679C\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",listNoData:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",listResizeHandle:"\u9023\u7D61\u5148\u4E00\u89A7\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",detailHeading:"\u9023\u7D61\u5148\u8A73\u7D30",close:"\u9589\u3058\u308B",noName:"\u540D\u524D\u672A\u8A2D\u5B9A",treeNodeCountTitle:"\u30C4\u30EA\u30FC\u30D3\u30E5\u30FC\u3067\u69CB\u7BC9\u3055\u308C\u305F\u5168\u30CE\u30FC\u30C9\u6570",treeNodeCountLabel:"\u30CE\u30FC\u30C9:",treeNodeCount:e=>`${X("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${X("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:ma,recordDate:Pn,popupCustomMobilePhone:"\u643A\u5E2F\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupMobilePhone:"\u643A\u5E2F\u96FB\u8A71",popupCustomCompanyPhone:"\u4F1A\u793E\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupCompanyPhone:"\u4F1A\u793E\u96FB\u8A71",popupCustomEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9 (\u30AB\u30B9\u30BF\u30E0)",popupEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",popupGmailHint:"\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u4E8C\u5EA6\u30BF\u30C3\u30D7\u3067 Gmail \u3092\u958B\u304D\u307E\u3059",popupLastContactDate:"\u6700\u7D42\u30B3\u30F3\u30BF\u30AF\u30C8\u65E5:",popupNoContactMethods:"\u8868\u793A\u3067\u304D\u308B\u9023\u7D61\u5148\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093",overlayTitle:"\u8A73\u7D30",overlayBackdrop:"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",settingsResetAllTitle:"\u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u30EA\u30BB\u30C3\u30C8",settingsResetAll:"\u3059\u3079\u3066\u30EA\u30BB\u30C3\u30C8",settingsTabsLabel:"\u691C\u7D22\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A\u30BF\u30D6",settingsBasicTab:"\u57FA\u672C\u8A2D\u5B9A",settingsAdvancedTab:"\u8A73\u7D30\u8A2D\u5B9A",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"\u73FE\u5728\u5024:",resetToDefaultsTitle:"\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u306B\u30EA\u30BB\u30C3\u30C8",reset:"\u30EA\u30BB\u30C3\u30C8",relevanceOnlyNotice:"Relevance \u30BD\u30FC\u30C8\u6642\u306E\u307F\u5909\u66F4\u53EF\u80FD",relevanceWeightsHeading:"Relevance \u30B9\u30B3\u30A2\u91CD\u307F",fieldWeight:"\u30D5\u30A3\u30FC\u30EB\u30C9\u91CD\u307F",scoreTuningHeading:"\u30B9\u30B3\u30A2\u8ABF\u6574",maxResults:"\u6700\u5927\u7D50\u679C\u6570",noLimit:"\u4E0A\u9650\u306A\u3057",basicThresholdHeading:"\u6700\u7D42\u985E\u4F3C\u5EA6\u95BE\u5024",basicThresholdLabel:"\u30B9\u30B3\u30A2\u306E\u4E0B\u9650\u3092\u8ABF\u6574",basicThresholdRangeRelevance:"Relevance \u30E2\u30FC\u30C9\u3067\u306F\u30B9\u30B3\u30A2\u304C 1.0 \u3092\u8D85\u3048\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059 (\u7BC4\u56F2: 0.0-1.5)",basicThresholdRange:"\u7BC4\u56F2: 0.0-1.0",basicDisplayHeading:"\u8868\u793A\u30AA\u30D7\u30B7\u30E7\u30F3",basicCaseSensitive:"\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225",basicHighlight:"\u30CF\u30A4\u30E9\u30A4\u30C8\u8868\u793A",basicOpenEmailsWithGmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 Gmail \u306E\u4F5C\u6210\u753B\u9762\u3067\u958B\u304F",basicMultiTermOperator:"\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",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:ga,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})=>`${X("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: ${X("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),ar=Object.freeze(Object.keys(Ln.en)),Ht=Object.freeze([...Ye.DIRECTORY_TREE_LABEL_KEYS,...ar]),Ue=Object.freeze({en:Object.freeze({...Ye.DIRECTORY_TREE_LABEL_CATALOGS.en,...Ln.en}),ja:Object.freeze({...Ye.DIRECTORY_TREE_LABEL_CATALOGS.ja,...Ln.ja})}),Qo=new Set(Ht),nr=Object.keys(Ue).map(e=>JSON.stringify(e)).join(" or "),rr=Object.freeze({locale:"locale",labels:"labels"}),Yo=(e,t,n)=>{e[t]=n},fa=(e,t=rr.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${nr} or left out; got ${se(e)}`);if(e!==void 0&&!Object.hasOwn(Ue,e))throw new RangeError(`[contact-map] ${t} must be ${nr} or left out; got ${se(e)}`);return(0,En.resolveVirtualScrollLocale)(e)},Xo=(e,t,n,r)=>{if(typeof r=="function"){if(typeof n!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${se(n)}`);return}if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${se(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${se(n)}`)},Jo=(e,t,n)=>{let r=Object.create(null);for(let s of Object.getOwnPropertyNames(e)){if(!Qo.has(s)){let o=Rn(s,Ht);throw new RangeError(`[contact-map] ${n} has a key that is not a label key (${o===void 0?"":`did you mean ${JSON.stringify(o)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${se(s)}`)}let a=e[s];a!==void 0&&(Xo(n,s,a,t[s]),r[s]=a)}return r},Zo=e=>{let t={},n=!1;for(let r of Ye.DIRECTORY_TREE_LABEL_KEYS){let s=e[r];s!==void 0&&(t[r]=s,n=!0)}return n?t:void 0},On=(e,t,n=rr)=>{let r=fa(e,n.locale);if(t===void 0)return Ue[r];if(!Dt(t))throw new TypeError(`[contact-map] ${n.labels} must be a plain object or left out; got ${se(t)}`);let s=Jo(t,Ue[r],n.labels),o={...(0,Ye.resolveDirectoryTreeLabels)(r,Zo(s)),...Ln[r]};for(let d of ar){let l=s[d];l!==void 0&&Yo(o,d,l)}return Object.freeze(o)},ya=e=>{let t={};for(let n of Ye.DIRECTORY_TREE_LABEL_KEYS)t[n]=e[n];return Object.freeze(t)},ba=e=>{let t={};for(let n of En.VIRTUAL_SCROLL_LABEL_KEYS)t[n]=e[n];return Object.freeze(t)}});var or,sr,$e,lr,es,va,xa,ir,Se,J,ce=De(()=>{"use strict";or=require("@aiquants/directory-tree"),sr=require("@aiquants/virtualscroll"),$e=require("react");xt();lr=require("react/jsx-runtime"),es=Object.freeze({locale:"en",labels:Ue.en,treeLabels:ya(Ue.en),engineLabels:ba(Ue.en)}),va=(0,$e.createContext)(es),xa=(e,t)=>{let n=(0,$e.useRef)(null),r=n.current;return r!==null&&t.every(s=>r[s]===e[s])?r:(n.current=e,e)},ir=({locale:e,labels:t,surface:n,children:r})=>{let s=fa(e,n.locale),a=(0,$e.useMemo)(()=>On(s,t,n),[s,t,n]),o=xa(a,Ht),d=xa(ya(o),or.DIRECTORY_TREE_LABEL_KEYS),l=xa(ba(o),sr.VIRTUAL_SCROLL_LABEL_KEYS),c=(0,$e.useMemo)(()=>({locale:s,labels:o,treeLabels:d,engineLabels:l}),[s,o,d,l]);return(0,lr.jsx)(va.Provider,{value:c,children:r})},Se=()=>(0,$e.useContext)(va),J=()=>(0,$e.useContext)(va).labels});var Hn,Ca=De(()=>{"use strict";Hn=e=>e.isComposing||e.keyCode===229});var ur,pr,mr,te,gr,B,ts,dr,Jt,At,ns,as,_t,ka,cr,Sa,Zt,Ta=De(()=>{"use strict";ur=de(require("lucide-react/dist/esm/icons/check.js")),pr=de(require("lucide-react/dist/esm/icons/copy.js")),mr=de(require("lucide-react/dist/esm/icons/x.js")),te=require("react"),gr=require("react-dom");yt();ce();Ca();B=require("react/jsx-runtime"),ts=350,dr=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],Jt=0,At=null,ns=()=>{let e=document.body.style;Jt+=1,Jt===1&&(At={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},as=()=>{if(Jt=Math.max(0,Jt-1),Jt>0||!At)return;let e=document.body.style;e.userSelect=At.userSelect,typeof At.webkitUserSelect<"u"&&(e.webkitUserSelect=At.webkitUserSelect),At=null},_t=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},ka=(e,t)=>{let n=new Set;return e.reduce((r,s)=>{let a=typeof s.value=="string"?s.value.trim():"";if(!a)return r;let{normalized:o,key:d,entry:l}=t(a,s);return o&&!n.has(d)&&(n.add(d),r.push(l(o))),r},[])},cr=(e,t)=>e===t,Sa=({value:e,ariaLabel:t,size:n="md"})=>{let[r,s]=(0,te.useState)(!1),a=(0,te.useRef)(null),o=(0,te.useCallback)(async u=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(u),!0}catch{}if(typeof document>"u")return!1;let i=document.createElement("textarea");i.value=u,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),i.setSelectionRange(0,i.value.length);let p=document.execCommand("copy");return document.body.removeChild(i),p},[]),d=(0,te.useCallback)(async u=>{u.preventDefault(),u.stopPropagation(),a.current!==null&&typeof window<"u"&&(window.clearTimeout(a.current),a.current=null);let i=await o(e);s(i),i&&typeof window<"u"&&(a.current=window.setTimeout(()=>{s(!1),a.current=null},1500))},[o,e]);(0,te.useEffect)(()=>()=>{a.current!==null&&typeof window<"u"&&(window.clearTimeout(a.current),a.current=null)},[]);let l=n==="sm"?"h-6 w-6":"h-7 w-7",c=n==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=r?ur.default:pr.default;return(0,B.jsx)("button",{type:"button",className:`inline-flex ${l} shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-200 dark:text-slate-300`,onClick:d,"aria-label":t,title:t,children:(0,B.jsx)(m,{className:c,"aria-hidden":"true"})})},Zt=({contactData:e,openEmailsWithGmail:t,openGmailCompose:n,onRequestClose:r})=>{let s=J(),[a,o]=(0,te.useState)(null);(0,te.useEffect)(()=>{o(document.body)},[]);let d=(0,te.useRef)(null),l=(0,te.useRef)(null),c=(0,te.useMemo)(()=>e.contacted_at?Be(e.contacted_at,s.recordDate):null,[e.contacted_at,s.recordDate]),m=_t(e.full_name)??s.noName,u=_t(e.company_name),i=_t(e.department),p=_t(e.title),f=(0,te.useMemo)(()=>ka([{fieldKey:"company_name",label:s.fieldCompanyName,value:u},{fieldKey:"department",label:s.fieldDepartment,value:i},{fieldKey:"title",label:s.fieldTitle,value:p}],(h,{fieldKey:v,label:F})=>({normalized:h,key:`${v}-${h.toLowerCase()}`,entry:P=>({fieldKey:v,label:F,value:P})})),[u,i,p,s]),T=(0,te.useMemo)(()=>ka([{fieldKey:"custom_mobile_phone_number",label:s.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:s.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:s.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:s.popupCompanyPhone,value:e.company_phone_number}],(h,{fieldKey:v,label:F})=>{let P=Yt(h);return{normalized:_t(h),key:(P??h).toLowerCase(),entry:L=>({fieldKey:v,label:F,value:L,href:P})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,s]),S=(0,te.useMemo)(()=>ka([{fieldKey:"custom_email",label:s.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:s.popupEmail,value:e.email}],(h,{fieldKey:v,label:F})=>{let P=_t(h),ae=Qe(h,t),L=!!ae?.startsWith("https://mail.google.com");return{normalized:P,key:h.toLowerCase(),entry:E=>({fieldKey:v,label:F,value:E,href:ae,isGmailLink:L})}}),[e.custom_email,e.email,t,s]),w=T.length>0||S.length>0,V=(0,te.useMemo)(()=>`contact-methods-${e.person_id}`,[e.person_id]),H=(0,te.useCallback)(h=>{r(h),l.current=null},[r]),y=(0,te.useCallback)(h=>{h.stopPropagation(),cr(h.target,h.currentTarget)&&H()},[H]),g=(0,te.useCallback)(h=>{h.stopPropagation(),cr(h.target,h.currentTarget)&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),H())},[H]),$=(0,te.useCallback)(h=>{h.stopPropagation(),H()},[H]),q=(0,te.useCallback)((h,v)=>{v.isGmailLink&&(h.preventDefault(),n(v.value))},[n]),k=(0,te.useCallback)((h,v)=>{if(!v.isGmailLink){l.current=null;return}let F=Date.now(),P=l.current;if(P&&P.email===v.value&&F-P.timestamp<=ts){l.current=null,h.preventDefault(),n(v.value);return}l.current={email:v.value,timestamp:F}},[n]);return(0,te.useEffect)(()=>{let h=[];if(typeof window<"u"){let v=F=>{if(F.key==="Escape"&&!Hn(F)){H();return}if(F.key==="Tab"&&d.current){let P=d.current.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(P.length===0)return;let ae=P[0],L=P[P.length-1];F.shiftKey?document.activeElement===ae&&(F.preventDefault(),L.focus()):document.activeElement===L&&(F.preventDefault(),ae.focus())}};window.addEventListener("keydown",v),h.push(()=>window.removeEventListener("keydown",v))}if(typeof document<"u"){let v=d.current;if(v){let L=E=>{E.stopPropagation()};for(let E of dr)v.addEventListener(E,L);h.push(()=>{for(let E of dr)v.removeEventListener(E,L)})}let F=L=>{let E=d.current;return E&&L instanceof Node?E.contains(L):!1},P=L=>{F(L.target)||H({suppressLongPress:!0,cancelLongPressTimer:!0})},ae=["pointerdown","wheel","touchmove"];for(let L of ae)document.addEventListener(L,P,!0);h.push(()=>{for(let L of ae)document.removeEventListener(L,P,!0)}),ns(),h.push(as)}return()=>{for(let v of h)v()}},[H,a]),a?(0,gr.createPortal)((0,B.jsx)("div",{"data-contact-popup-root":"true",className:"fixed top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-black/50 px-4 py-6",style:{right:"var(--aqcm-overlay-right, 0px)",transition:"right 0.5s"},role:"dialog","aria-modal":"true","aria-labelledby":V,tabIndex:-1,onClick:y,onKeyDown:g,children:(0,B.jsxs)("div",{ref:d,className:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-lg transition-colors dark:border-transparent dark:bg-slate-900 dark:shadow-slate-950/40 dark:ring-1 dark:ring-white/70",children:[(0,B.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h2",{id:V,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),f.length>0?(0,B.jsx)("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:f.map(h=>(0,B.jsxs)("div",{className:"flex items-center gap-3",children:[(0,B.jsx)("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.value}),(0,B.jsx)(Sa,{value:h.value,ariaLabel:s.copyField(h.label),size:"sm"})]},h.fieldKey))}):null]}),(0,B.jsx)("button",{type:"button",className:"rounded-md p-0.5 text-slate-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring focus-visible:ring-blue-200 dark:text-slate-300 dark:hover:bg-slate-800/70",onClick:$,"aria-label":s.close,children:(0,B.jsx)(mr.default,{className:"h-4 w-4","aria-hidden":"true"})})]}),(0,B.jsxs)("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[T.length>0?(0,B.jsx)("div",{children:(0,B.jsx)("ul",{className:"space-y-3 text-sm",children:T.map(h=>(0,B.jsx)("li",{className:"flex items-start gap-3",children:(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsx)("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),(0,B.jsxs)("div",{className:"mt-1 flex items-center gap-3",children:[(0,B.jsx)("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.href?(0,B.jsx)("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",children:h.value}):(0,B.jsx)("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value})}),(0,B.jsx)(Sa,{value:h.value,ariaLabel:s.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,S.length>0?(0,B.jsx)("div",{children:(0,B.jsx)("ul",{className:"space-y-3 text-sm",children:S.map(h=>(0,B.jsx)("li",{className:"flex items-start gap-3",children:(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsx)("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),(0,B.jsxs)("div",{className:"mt-1 flex items-start gap-3",children:[(0,B.jsxs)("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[h.href?(0,B.jsx)("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",target:h.isGmailLink?"_blank":void 0,rel:h.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:v=>q(v,h),onTouchEnd:v=>k(v,h),children:h.value}):(0,B.jsx)("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value}),h.isGmailLink?(0,B.jsx)("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:s.popupGmailHint}):null]}),(0,B.jsx)(Sa,{value:h.value,ariaLabel:s.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,c?(0,B.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[(0,B.jsx)("span",{className:"text-xs",children:s.popupLastContactDate}),(0,B.jsx)("span",{children:c})]}):null,w?null:(0,B.jsx)("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:s.popupNoContactMethods})]})]})}),a):null}});var pe,en,wa=De(()=>{"use strict";pe=require("react/jsx-runtime"),en=({fullName:e,title:t="-",companyName:n="-",department:r="-",phoneNumber:s="-",email:a="-",updatedAtText:o="-"})=>(0,pe.jsxs)("div",{className:"flex h-full w-full flex-col justify-center gap-0.5 text-slate-800 text-xs leading-tight transition-colors sm:grid sm:grid-cols-3 sm:gap-2 sm:text-sm xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[(0,pe.jsxs)("div",{className:"flex items-center gap-1 sm:hidden",children:[(0,pe.jsx)("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),(0,pe.jsx)("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:s})]}),(0,pe.jsx)("div",{className:"flex items-center gap-1 sm:hidden",children:(0,pe.jsx)("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:n})}),(0,pe.jsx)("div",{className:"block sm:hidden",children:(0,pe.jsx)("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:r})}),(0,pe.jsxs)("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[(0,pe.jsx)("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),(0,pe.jsx)("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),(0,pe.jsxs)("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[(0,pe.jsx)("span",{className:"truncate text-slate-800 dark:text-slate-100",children:n}),(0,pe.jsx)("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:r})]}),(0,pe.jsxs)("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[(0,pe.jsx)("span",{className:"truncate text-slate-700 dark:text-slate-200",children:s}),(0,pe.jsx)("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:a})]}),(0,pe.jsx)("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:(0,pe.jsx)("span",{className:"truncate",children:o})})]})});var _n,It,yr,rs,os,ss,is,br,xr,ls,ds,cs,us,ps,ms,gs,hs,vr,Cr,hr,fr,An,fs,ys,Na,kr,Ma=De(()=>{"use strict";_n=require("@aiquants/fuzzy-search"),It=require("@aiquants/select-box"),yr=/[]/g,rs=/^[\s ]+|[\s ]+$/g,os=/\s+/,ss=/^[\p{Script=Latin}\s]+$/u,is=/\p{Script=Latin}/u,br=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1,normalizeVariants:!1,ignoreSpaces:!1,ignoreSymbols:!1,ignoreLongVowels:!1}),xr="union",ls=65377,ds=65439,cs=["\uFF9E","\uFF9F"],us=(()=>{let e=new Map;for(let t=ls;t<=ds;t+=1){let n=String.fromCharCode(t);e.set(n.normalize("NFKC"),n);for(let r of cs){let s=(n+r).normalize("NFKC");s.length===1&&e.set(s,n+r)}}return e})(),ps=/[-ヿ]/u,ms=e=>{let t=Array.from(e,n=>us.get(n)??n).join("");return ps.test(t)?null:t},gs=e=>(0,It.normalizeText)(e.replace(yr,"").replace(rs,""),br),hs=e=>{if(!ss.test(e))return null;let t=(0,It.romajiToKatakana)(e);return is.test(t)?null:t},vr=e=>e.split(os).filter(Boolean),Cr=e=>(0,_n.parseQuerySets)(e,xr).sets.map(({query:t})=>t),hr=e=>Cr(e).flatMap(t=>vr(t)),fr=e=>(0,_n.formatQuerySets)({combine:xr,sets:Array.from(new Set(e),t=>({query:t}))}),An=e=>{let t=Cr(e.replace(yr,"")).map(r=>vr(gs(r)).join(" ")).filter(r=>r!==""),n=[];for(let r of t){let s=hs(r);if(s===null)return fr(t);n.push(s)}return fr(n)},fs=e=>{let t=new Set([...hr(e),...hr(An(e))]),n=new Set;for(let r of t)for(let s of(0,It.getNormalizedVariants)(r,br)){let a=s.trim();if(!a)continue;n.add(a);let o=ms(a);o!==null&&n.add(o)}return Array.from(n)},ys=/[.*+?^${}()|[\]\\]/g,Na=e=>{let t=fs(e);if(t.length===0)return null;let n=t.map(r=>r.replace(ys,"\\$&")).sort((r,s)=>s.length-r.length);return new RegExp(n.join("|"),"gi")},kr=(e,t)=>{let n=Na(e);if(n===null)return s=>s;let r=s=>t.some(a=>{let o=s[a];return typeof o=="string"&&o.search(n)!==-1});return s=>{let a=[],o=[];for(let d of s)r(d.item)?a.push(d):o.push(d);return[...a,...o]}}});var Sr,Xe,bs,he,In=De(()=>{"use strict";Sr=require("react");Ma();Xe=require("react/jsx-runtime"),bs="rounded bg-yellow-200 px-1 text-gray-900 dark:bg-yellow-900 dark:text-yellow-100",he=(0,Sr.memo)(({text:e,query:t,enabled:n=!0})=>{if(!(n&&t?.trim()&&e))return(0,Xe.jsx)(Xe.Fragment,{children:e});let r=Na(t);if(r===null)return(0,Xe.jsx)(Xe.Fragment,{children:e});let s=[],a=0,o=r.exec(e),d=0;for(;o;){let l=o[0],c=o.index;if(c>a&&s.push(e.substring(a,c)),l.length===0){r.lastIndex++,o=r.exec(e);continue}s.push((0,Xe.jsx)("mark",{className:bs,children:l},`highlight-${c}-${d}`)),a=c+l.length,d+=1,o=r.exec(e)}return a<e.length&&s.push(e.substring(a)),(0,Xe.jsx)(Xe.Fragment,{children:s})});he.displayName="HighlightedText"});var Tr={};Ja(Tr,{ContactDetailGrid:()=>Pa,default:()=>xs});var zn,ut,Fn,Pa,xs,wr=De(()=>{"use strict";zn=require("react");yt();ce();Ta();wa();In();ut=require("react/jsx-runtime"),Fn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Pa=({contactData:e,searchTerm:t,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:s,isPopupVisible:a,onRequestClose:o})=>{let d=J(),l=(0,zn.useMemo)(()=>Lt(e),[e]),c=(0,zn.useMemo)(()=>Et(e),[e]),m=l.value??"-",u=c.value??"-",i=(0,zn.useMemo)(()=>Be(e.updated_at,d.recordDateTime),[e.updated_at,d.recordDateTime]),p=Fn(e.full_name)??d.noName,f=Fn(e.company_name),T=Fn(e.department),S=(w,V="-")=>(0,ut.jsx)(he,{text:w??V,query:t,enabled:n});return(0,ut.jsxs)(ut.Fragment,{children:[(0,ut.jsx)(en,{fullName:S(p),title:S(Fn(e.title)),companyName:S(f),department:S(T),phoneNumber:u,email:S(m),updatedAtText:i}),a?(0,ut.jsx)(Zt,{contactData:e,openEmailsWithGmail:r,openGmailCompose:s,onRequestClose:o}):null]})},xs=Pa});var vi={};Ja(vi,{AdvancedSearchSettings:()=>Dn,BasicSearchSettings:()=>Wn,CONTACT_MAP_LABEL_CATALOGS:()=>Ue,CONTACT_MAP_LABEL_KEYS:()=>Ht,ContactDetailGrid:()=>Pa,ContactDetailPanel:()=>Je,ContactDetailPopup:()=>Zt,ContactDetailRowLayout:()=>en,ContactMapAnnotation:()=>$n,ContactMapAppView:()=>bi,ContactMapConfigProvider:()=>jr,ContactMapSearchListView:()=>_a,ContactMapSearchPage:()=>Qa,ContactMapSearchTabGroup:()=>Ka,ContactMapSearchTreeView:()=>$a,ContactMapStreamClient:()=>nn,HighlightedText:()=>he,IndexWorkerSettings:()=>Zn,LIST_COLLAPSE_THRESHOLD:()=>As,LIST_DETAIL_PANEL_MIN_WIDTH:()=>ao,LIST_EXPAND_THRESHOLD:()=>Is,LIST_PANEL_MIN_WIDTH:()=>no,LIST_RESIZE_HANDLE_THICKNESS:()=>ro,LevenshteinWorkerSettings:()=>ea,Progress:()=>Da,SearchOptionsPanel:()=>ta,StatItem:()=>O,StatisticsPanel:()=>ra,SwipeOverlay:()=>un,TREE_COLLAPSE_THRESHOLD:()=>Xs,TREE_DETAIL_PANEL_MIN_WIDTH:()=>To,TREE_EXPAND_THRESHOLD:()=>Js,TREE_PANEL_MIN_WIDTH:()=>So,TREE_RESIZE_HANDLE_THICKNESS:()=>wo,Tabs:()=>tn,TabsContent:()=>mt,TabsList:()=>Ft,TabsTrigger:()=>pt,TreeWorkerSession:()=>pn,WorkerStatsSection:()=>Nt,assertContactMapStreamEndpoint:()=>an,assertContactMapTreeWorkerUrl:()=>La,assertContactMapWorkerUrls:()=>Ss,composeTreeVirtualScrollOptions:()=>No,contactMapShouldRevalidate:()=>xi,countContactMapCompanies:()=>Yr,deserializeStreamRecord:()=>qr,getContactMapStreamClient:()=>Gr,getTreeWorkerSession:()=>mo,layerContactMapWorkerUrls:()=>kt,resetContactMapStreamClientForTesting:()=>Ls,resetTreeWorkerSessionForTesting:()=>Qs,resolveContactMapLabels:()=>On,useAnimatedNumber:()=>Ia,useContactMapConfig:()=>Ke,useContactMapLabels:()=>J,useContactMapStream:()=>Qr,useContactPanelSizing:()=>Qn,useDynamicViewportHeight:()=>Wa,useHorizontalDragScroll:()=>Ze,useLongPressPopup:()=>ln,useReportPopupVisibility:()=>so,useResponsiveTwoColumnLayout:()=>dn,useRowPopupRegistry:()=>oo,useStreamedContactMapContext:()=>rn,useTreeWorker:()=>Fa});module.exports=jo(vi);var vt=require("@aiquants/fuzzy-search"),Xt=require("react");ce();var ue=require("react/jsx-runtime"),Dn=(0,Xt.memo)(({searchOptions:e,setSearchOptions:t})=>{let n=J(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=(0,Xt.useId)(),o=(0,Xt.useId)(),d=[];return d.push((0,ue.jsxs)("div",{className:`${r} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[(0,ue.jsxs)("div",{className:`${s} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",n.advancedLearningHeading]}),(0,ue.jsx)("label",{htmlFor:a,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedLearningLabel}),(0,ue.jsx)("input",{id:a,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||vt.DEFAULT_FUZZY_SEARCH_OPTIONS.learningWeight,onChange:l=>t(c=>({...c,learningWeight:parseFloat(l.target.value)})),className:"w-full"}),(0,ue.jsxs)("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[n.currentValueLabel," ",e.learningWeight||vt.DEFAULT_FUZZY_SEARCH_OPTIONS.learningWeight]}),(0,ue.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedLearningHint})]},"learning")),d.push((0,ue.jsxs)("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[(0,ue.jsxs)("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",n.advancedDebounceHeading]}),(0,ue.jsx)("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedDebounceLabel}),(0,ue.jsx)("input",{id:o,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs??vt.DEFAULT_FUZZY_SEARCH_OPTIONS.debounceMs,onChange:l=>t(c=>({...c,debounceMs:parseInt(l.target.value,10)})),className:"w-full"}),(0,ue.jsxs)("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.debounceMs??vt.DEFAULT_FUZZY_SEARCH_OPTIONS.debounceMs]}),(0,ue.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedDebounceHint})]},"debounce")),(0,ue.jsxs)("section",{className:"space-y-3",children:[(0,ue.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,ue.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,ue.jsx)("span",{children:"\u26A1"}),(0,ue.jsx)("span",{className:"tracking-wide",children:n.settingsAdvancedTab})]}),(0,ue.jsx)("button",{type:"button",onClick:()=>t(l=>({...l,learningWeight:vt.DEFAULT_FUZZY_SEARCH_OPTIONS.learningWeight,debounceMs:vt.DEFAULT_FUZZY_SEARCH_OPTIONS.debounceMs})),className:"rounded border border-gray-300 bg-gray-100 px-2 py-1 font-medium text-gray-700 text-xs transition-colors hover:bg-gray-200 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-200 dark:hover:bg-slate-700/70",title:n.resetToDefaultsTitle,children:n.reset})]}),(0,ue.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:d})]})});Dn.displayName="AdvancedSearchSettings";var ct=require("@aiquants/fuzzy-search"),Me=require("react");ce();var R=require("react/jsx-runtime"),Wn=(0,Me.memo)(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a})=>{let o=J(),d="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",c=(0,Me.useId)(),m=(0,Me.useId)(),u=(0,Me.useId)(),i=(0,Me.useId)(),p=(0,Me.useId)(),f=(0,Me.useId)(),T=(0,Me.useId)(),S=(0,Me.useId)(),w=(0,Me.useId)(),V=(0,Me.useId)(),H=[];return H.push((0,R.jsxs)("div",{className:`${d} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[(0,R.jsxs)("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",o.basicThresholdHeading]}),(0,R.jsx)("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicThresholdLabel}),(0,R.jsx)("input",{id:c,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??ct.DEFAULT_FUZZY_SEARCH_OPTIONS.threshold,onChange:y=>t(g=>({...g,threshold:parseFloat(y.target.value)})),className:"w-full"}),(0,R.jsxs)("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[o.currentValueLabel," ",e.threshold??ct.DEFAULT_FUZZY_SEARCH_OPTIONS.threshold]}),(0,R.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?o.basicThresholdRangeRelevance:o.basicThresholdRange})]},"threshold")),H.push((0,R.jsxs)("div",{className:`${d} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[(0,R.jsxs)("div",{className:`${l} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",o.basicDisplayHeading]}),(0,R.jsxs)("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:m,type:"checkbox",checked:e.caseSensitive??ct.DEFAULT_FUZZY_SEARCH_OPTIONS.caseSensitive,onChange:y=>t(g=>({...g,caseSensitive:y.target.checked})),className:"h-3 w-3"}),o.basicCaseSensitive]}),(0,R.jsxs)("label",{htmlFor:u,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:u,type:"checkbox",checked:n,onChange:y=>r(y.target.checked),className:"h-3 w-3"}),o.basicHighlight]}),(0,R.jsxs)("label",{htmlFor:i,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:i,type:"checkbox",checked:s,onChange:y=>a(y.target.checked),className:"h-3 w-3"}),o.basicOpenEmailsWithGmail]}),(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicMultiTermOperator}),(0,R.jsxs)("select",{id:p,value:e.multiTermOperator??ct.DEFAULT_FUZZY_SEARCH_OPTIONS.multiTermOperator,onChange:y=>t(g=>({...g,multiTermOperator:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,R.jsx)("option",{value:"or",children:o.basicOperatorOr}),(0,R.jsx)("option",{value:"and",children:o.basicOperatorAnd})]}),(0,R.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:o.basicMultiTermHint})]})]},"display")),H.push((0,R.jsxs)("div",{className:`${d} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[(0,R.jsxs)("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",o.basicSortHeading]}),(0,R.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,R.jsx)("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortBy}),(0,R.jsxs)("select",{id:f,value:e.sortBy||ct.DEFAULT_FUZZY_SEARCH_OPTIONS.sortBy,onChange:y=>t(g=>({...g,sortBy:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,R.jsx)("option",{value:"score",children:o.basicSortByScore}),(0,R.jsx)("option",{value:"relevance",children:o.basicSortByRelevance}),(0,R.jsx)("option",{value:"original",children:o.basicSortByOriginal})]})]}),(0,R.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,R.jsx)("label",{htmlFor:T,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortOrder}),(0,R.jsxs)("select",{id:T,value:e.sortOrder||ct.DEFAULT_FUZZY_SEARCH_OPTIONS.sortOrder,onChange:y=>t(g=>({...g,sortOrder:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,R.jsx)("option",{value:"desc",children:o.basicSortDescending}),(0,R.jsx)("option",{value:"asc",children:o.basicSortAscending})]})]})]},"sorting")),H.push((0,R.jsxs)("div",{className:`${d} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[(0,R.jsxs)("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",o.basicEngineHeading]}),(0,R.jsx)("label",{htmlFor:S,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicStrategy}),(0,R.jsxs)("select",{id:S,value:e.parallelSearchStrategy||ct.DEFAULT_FUZZY_SEARCH_OPTIONS.parallelSearchStrategy,onChange:y=>t(g=>({...g,parallelSearchStrategy:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,R.jsx)("option",{value:"balanced",children:o.basicStrategyBalanced}),(0,R.jsx)("option",{value:"index-first",children:o.basicStrategyIndexFirst}),(0,R.jsx)("option",{value:"levenshtein-first",children:o.basicStrategyLevenshteinFirst})]}),(0,R.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,R.jsxs)("label",{htmlFor:w,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:w,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:y=>t(g=>({...g,enableIndexFiltering:y.target.checked})),className:"h-3 w-3"}),o.basicIndexFiltering]}),(0,R.jsxs)("label",{htmlFor:V,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:V,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:y=>t(g=>({...g,enableLevenshtein:y.target.checked})),className:"h-3 w-3"}),o.basicLevenshtein]})]})]},"engine")),(0,R.jsxs)("section",{className:"space-y-3",children:[(0,R.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[(0,R.jsx)("span",{children:"\u{1F527}"}),(0,R.jsx)("span",{className:"tracking-wide",children:o.settingsBasicTab})]}),(0,R.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:H})]})});Wn.displayName="BasicSearchSettings";var Lr=de(require("lucide-react/dist/esm/icons/badge-check.js")),Er=de(require("lucide-react/dist/esm/icons/building-2.js")),Or=de(require("lucide-react/dist/esm/icons/calendar-clock.js")),Dr=de(require("lucide-react/dist/esm/icons/check.js")),Wr=de(require("lucide-react/dist/esm/icons/copy.js")),Hr=de(require("lucide-react/dist/esm/icons/id-card.js")),_r=de(require("lucide-react/dist/esm/icons/mail.js")),Ar=de(require("lucide-react/dist/esm/icons/phone.js")),Ir=de(require("lucide-react/dist/esm/icons/user-round.js")),Pe=require("react");yt();var Ve={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)};ce();var _e=de(require("@radix-ui/react-tabs")),Bn=de(require("react"));var Nr=require("clsx"),Mr=require("tailwind-merge");function Ct(...e){return(0,Mr.twMerge)((0,Nr.clsx)(e))}var Un=require("react/jsx-runtime"),tn=_e.Root,Ft=Bn.forwardRef(({className:e,...t},n)=>(0,Un.jsx)(_e.List,{ref:n,className:Ct("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Ft.displayName=_e.List.displayName;var pt=Bn.forwardRef(({className:e,...t},n)=>(0,Un.jsx)(_e.Trigger,{ref:n,className:Ct("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-2xs",e),...t}));pt.displayName=_e.Trigger.displayName;var mt=Bn.forwardRef(({className:e,...t},n)=>(0,Un.jsx)(_e.Content,{ref:n,className:Ct("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",e),...t}));mt.displayName=_e.Content.displayName;In();var C=require("react/jsx-runtime"),Pr={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},vs=({icon:e,label:t,value:n,fieldKey:r,copyValue:s,onCopy:a,isCopied:o,linkHref:d,searchTerm:l,enableHighlighting:c})=>{let m=J(),u=!!(a&&r&&s),i=d?.startsWith("https://mail.google.com")?"_blank":void 0;return(0,C.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[(0,C.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,C.jsx)("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-white text-slate-500 transition-colors dark:bg-slate-800 dark:text-slate-200",children:(0,C.jsx)(e,{size:14})}),(0,C.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,C.jsx)("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),(0,C.jsx)("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:d?(0,C.jsx)("a",{href:d,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",target:i,rel:i?"noopener noreferrer":void 0,children:(0,C.jsx)(he,{text:n,query:l??"",enabled:c})}):(0,C.jsx)(he,{text:n,query:l??"",enabled:c})})]})]}),u?(0,C.jsx)("button",{type:"button",onClick:()=>a&&r&&s&&a(r,s,t),className:"inline-flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-500 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:border-blue-400 dark:hover:text-blue-300","aria-label":m.copyField(t),children:o?(0,C.jsx)(Dr.default,{size:14}):(0,C.jsx)(Wr.default,{size:14})}):null]})},Rr=({items:e,searchTerm:t,enableHighlighting:n})=>(0,C.jsx)("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(r=>(0,C.jsxs)("div",{className:"flex flex-col gap-0.5 rounded-md border border-slate-200 bg-white/60 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[(0,C.jsx)("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:r.label}),(0,C.jsx)("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:(0,C.jsx)(he,{text:r.value,query:t??"",enabled:n})})]},r.fieldKey))}),Ra=({title:e})=>(0,C.jsx)("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),Cs=()=>{let e=J();return(0,C.jsxs)("div",{className:"flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-slate-300 border-dashed bg-white/60 p-4 text-center transition-colors dark:border-slate-700 dark:bg-slate-900/40",children:[(0,C.jsx)("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),(0,C.jsx)("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},Je=({contact:e,searchTerm:t,enableHighlighting:n,style:r,className:s=""})=>{let a=J(),[o,d]=(0,Pe.useState)(null),l=(0,Pe.useRef)(null),c=(0,Pe.useMemo)(()=>({...Pr,...r}),[r]);(0,Pe.useEffect)(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=(0,Pe.useMemo)(()=>Lt(e),[e]),u=(0,Pe.useMemo)(()=>Et(e),[e]),i=(0,Pe.useMemo)(()=>Be(e?.contacted_at,a.recordDateTime),[e?.contacted_at,a.recordDateTime]),p=(0,Pe.useCallback)(async(k,h,v)=>{try{await navigator.clipboard.writeText(h),d(k),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{d(null)},2e3)}catch(F){Ve.error("Failed to copy contact detail",F)}},[]);if(!e)return(0,C.jsx)("div",{className:"flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",style:Pr,children:(0,C.jsx)(Cs,{})});let f=[Z(e.title),Z(e.department)].filter(k=>k!=="-"),T=[f.join(" / "),Z(e.company_name)].filter(k=>k&&k!=="-").join(" \u30FB ")||"-",S=He(e.full_name)??a.noName,w=[{fieldKey:"full_name",label:a.fieldFullName,value:S},{fieldKey:"full_name_reading",label:a.fieldFullNameReading,value:Z(e.full_name_reading)},{fieldKey:"title",label:a.fieldTitle,value:Z(e.title)},{fieldKey:"department",label:a.fieldDepartment,value:Z(e.department)},{fieldKey:"company_name",label:a.fieldCompanyName,value:Z(e.company_name)},{fieldKey:"company_name_reading",label:a.fieldCompanyNameReading,value:Z(e.company_name_reading)},{fieldKey:"address",label:a.fieldAddress,value:Z(e.address)},{fieldKey:"postal_code",label:a.fieldPostalCode,value:Z(e.postal_code)},{fieldKey:"url",label:a.fieldUrl,value:Z(e.url)}],V=[{label:a.fieldCustomEmail,value:Z(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:a.fieldEmail,value:Z(e.email),fieldKey:"email",rawValue:e.email}].filter(k=>k.value!=="-"),H=[{label:a.fieldCustomMobilePhone,value:Z(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:a.fieldMobilePhone,value:Z(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:a.fieldCompanyPhone,value:Z(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:a.fieldCompanyFax,value:Z(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(k=>k.value!=="-"),y=[{fieldKey:"person_id",label:"person_id",value:Z(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:Z(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:Z(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:Z(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:Z(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:Z(e.is_in_eight)},{fieldKey:"created_by",label:a.fieldCreatedBy,value:Z(e.created_by)},{fieldKey:"created_at",label:a.fieldCreatedAt,value:Be(e.created_at,a.recordDateTime)},{fieldKey:"updated_by",label:a.fieldUpdatedBy,value:Z(e.updated_by)},{fieldKey:"updated_at",label:a.fieldUpdatedAt,value:Be(e.updated_at,a.recordDateTime)}],g=[{rowKey:"person_id",icon:Hr.default,label:"person_id",value:Z(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:_r.default,label:a.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:Qe(m.value,!1)},{rowKey:"primary_phone",icon:Ar.default,label:a.summaryPhone,value:u.value??"-",fieldKey:"primary_phone",copyValue:u.value,linkHref:Yt(u.value)},{rowKey:"contacted_at",icon:Or.default,label:a.summaryLastContact,value:i}],$=[{sectionKey:"email",title:a.sectionEmail,emptyText:a.sectionEmailEmpty,entries:V,recommendedKey:m.fieldKey??null,resolveHref:k=>Qe(k!=null?String(k):null,!1)},{sectionKey:"phone",title:a.sectionPhone,emptyText:a.sectionPhoneEmpty,entries:H,recommendedKey:u.fieldKey??null,resolveHref:k=>Yt(k!=null?String(k):null)}],q=[{value:"summary",label:a.detailTabSummary,content:(0,C.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,C.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,C.jsxs)("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[(0,C.jsx)(Er.default,{size:16}),(0,C.jsx)("span",{children:(0,C.jsx)(he,{text:Z(e.company_name),query:t??"",enabled:n})})]}),f.length>0?(0,C.jsx)("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:f.map((k,h)=>(0,C.jsxs)("span",{children:[h>0&&" / ",(0,C.jsx)(he,{text:k,query:t??"",enabled:n})]},`header-line-${h}`))}):null]}),(0,C.jsx)("div",{className:"flex flex-col gap-3",children:g.map(k=>(0,C.jsx)(vs,{icon:k.icon,label:k.label,value:k.value,fieldKey:k.fieldKey,copyValue:k.copyValue,onCopy:p,isCopied:k.fieldKey?o===k.fieldKey:!1,linkHref:k.linkHref,searchTerm:t,enableHighlighting:n},k.rowKey))})]})},{value:"basic",label:a.detailTabBasic,content:(0,C.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,C.jsx)(Ra,{title:a.detailBasicProfile}),(0,C.jsx)(Rr,{items:w,searchTerm:t,enableHighlighting:n})]})},{value:"contact",label:a.detailTabContact,content:(0,C.jsx)("div",{className:"flex flex-col gap-4",children:$.map(({sectionKey:k,title:h,emptyText:v,entries:F,recommendedKey:P,resolveHref:ae})=>(0,C.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,C.jsx)(Ra,{title:h}),F.length===0?(0,C.jsx)("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:v}):(0,C.jsx)("div",{className:"flex flex-col gap-2",children:F.map(L=>{let E=ae(L.rawValue),I=L.fieldKey===P;return(0,C.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:L.label}),(0,C.jsx)("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:E?(0,C.jsx)("a",{href:E,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:(0,C.jsx)(he,{text:L.value,query:t??"",enabled:n})}):(0,C.jsx)(he,{text:L.value,query:t??"",enabled:n})})]}),I?(0,C.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-700 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[(0,C.jsx)(Lr.default,{size:14}),a.preferred]}):null]},L.fieldKey)})})]},k))})},{value:"meta",label:a.detailTabMeta,content:(0,C.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,C.jsx)(Ra,{title:a.detailTabMeta}),(0,C.jsx)(Rr,{items:y,searchTerm:t,enableHighlighting:n})]})}];return(0,C.jsxs)("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950 ${s}`.trim(),style:c,children:[(0,C.jsx)("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-50 text-blue-600 transition-colors dark:bg-sky-900/40 dark:text-sky-300",children:(0,C.jsx)(Ir.default,{size:16})}),(0,C.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,C.jsx)("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:(0,C.jsx)(he,{text:S,query:t??"",enabled:n})}),(0,C.jsx)("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:(0,C.jsx)(he,{text:T,query:t??"",enabled:n})})]})]})}),(0,C.jsxs)(tn,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[(0,C.jsx)(Ft,{className:"flex gap-1.5 border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:q.map(k=>(0,C.jsx)(pt,{value:k.value,className:"rounded-md px-1.5 py-0.5 font-semibold text-[11px] transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-600 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300",children:k.label},k.value))}),q.map(k=>(0,C.jsx)(mt,{value:k.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:k.content},k.value))]})]})};var Fr=require("react");xt();ce();var ve=require("react/jsx-runtime"),$n=(0,Fr.memo)(({recordCount:e,companyCount:t,phase:n,loadedCount:r,totalCount:s,errorMessage:a,onRetry:o})=>{let{locale:d,labels:l}=Se(),c=X(d,e),m=X(d,t);return(0,ve.jsxs)("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[(0,ve.jsxs)("span",{className:"flex items-baseline gap-1",children:[(0,ve.jsx)("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationTotalLabel}),(0,ve.jsx)("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:c}),(0,ve.jsx)("span",{className:"text-slate-600 dark:text-slate-300",children:l.recordUnit(c)})]}),(0,ve.jsxs)("span",{className:"flex items-baseline gap-1",children:[(0,ve.jsx)("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationCompaniesLabel}),(0,ve.jsx)("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),(0,ve.jsx)("span",{className:"text-slate-600 dark:text-slate-300",children:l.companyUnit(m)})]}),n==="streaming"||n==="idle"?(0,ve.jsx)("span",{"data-testid":"contact-map-stream-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-blue-50 px-2 py-0.5 font-medium text-blue-700 text-xs dark:bg-blue-900/30 dark:text-blue-300",children:s!==null&&s>0?l.annotationStreamingProgress({loaded:r,total:s,percent:Math.min(100,Math.round(r/s*100))}):l.annotationStreamingCount(r)}):null,n==="retrying"?(0,ve.jsx)("span",{"data-testid":"contact-map-reconnecting-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-amber-50 px-2 py-0.5 font-medium text-amber-900 text-xs dark:bg-amber-900/30 dark:text-amber-200",children:l.annotationReconnecting(r)}):null,n==="failed"||n==="auth-required"?(0,ve.jsxs)("span",{"data-testid":"contact-map-error-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-rose-50 px-2 py-0.5 font-medium text-rose-700 text-xs dark:bg-rose-900/30 dark:text-rose-300",title:n==="failed"?a??void 0:void 0,children:["\u26D4 ",n==="auth-required"?l.annotationAuthRequired:l.annotationLoadFailed(r),o?(0,ve.jsx)("button",{type:"button","data-testid":"contact-map-retry-button",onClick:o,className:"rounded border border-rose-300 bg-white px-1.5 py-0.5 font-semibold text-rose-700 transition-colors hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900",children:l.annotationRetry}):null]}):null]})});$n.displayName="ContactMapAnnotation";var Ya=require("react");Wt();var zt=require("react");Ot();Wt();ce();Ot();Wt();ha();var ks=["indexWorker","levenshteinWorker","treeWorker"];function zr(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 ${se(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${se(n)}`)}}var Br={setting:"workerUrls"},Ur=(e,t)=>{if(e===void 0)return;let{setting:n,keys:r=ks,hints:s={}}=t;if(!Dt(e))throw new TypeError(`[contact-map] ${n} must be a plain object or left out; got ${se(e)}`);let a=Object.getOwnPropertyNames(e).map(l=>({key:l,url:e[l]})),o=a.find(({key:l,url:c})=>c!==void 0&&!r.includes(l));if(o!==void 0){let l=Object.hasOwn(s,o.key)?s[o.key]:void 0,c=l===void 0?Rn(o.key,r):void 0;throw new RangeError(`[contact-map] ${n} has a key it does not take (it takes ${r.join(", ")}${l===void 0?"":`; ${l}`}${c===void 0?"":`; did you mean ${JSON.stringify(c)}?`}); got ${se(o.key)}`)}let d=Object.create(null);for(let{key:l,url:c}of a){let m=l;zr(n,m,c),c!==void 0&&(d[m]=c)}return d};function Ss(e,t=Br){Ur(e,t)}function La(e){zr("workerUrls","treeWorker",e)}var kt=(e,t,n=Br)=>{let r=Ur(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}};var Vn=require("react/jsx-runtime"),$r=e=>{if(!Dt(e))throw new TypeError(`[contact-map] config must be a plain object; got ${se(e)}`);let t=e;return{streamEndpoint:ke(t,"streamEndpoint"),openEmailsWithGmail:ke(t,"openEmailsWithGmail"),treeWorkerFactory:ke(t,"treeWorkerFactory"),workerUrls:kt(void 0,ke(t,"workerUrls")),locale:ke(t,"locale"),labels:ke(t,"labels")}},Vr=({workerUrls:e,...t})=>{let{indexWorker:n,levenshteinWorker:r,treeWorker:s}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:n,levenshteinWorker:r,treeWorker:s})}))},Ts=Vr($r({})),Kr=(0,zt.createContext)(Ts),ws=Object.freeze({locale:"locale",labels:"labels"});function Ea({config:e,chromeSurface:t,children:n}){let{streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:a,workerUrls:o,locale:d,labels:l}=$r(e),{indexWorker:c,levenshteinWorker:m,treeWorker:u}=o,i=(0,zt.useMemo)(()=>Vr({streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:a,workerUrls:{indexWorker:c,levenshteinWorker:m,treeWorker:u},locale:d,labels:l}),[r,s,a,c,m,u,d,l]);return(0,Vn.jsx)(Kr.Provider,{value:i,children:(0,Vn.jsx)(ir,{locale:d,labels:l,surface:t,children:n})})}function jr({config:e,children:t}){return(0,Vn.jsx)(Ea,{config:e,chromeSurface:ws,children:t})}function Ke(){return(0,zt.useContext)(Kr)}var Te=require("react");Ot();var Ns=1e3,Ms=3e4,Ps=6;function an(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 ${se(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${se(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 ${se(e)}`)}var qr=e=>({...e,contacted_at:e.contacted_at?new Date(e.contacted_at):null,created_at:e.created_at?new Date(e.created_at):void 0,updated_at:e.updated_at?new Date(e.updated_at):void 0}),Rs=e=>Array.isArray(e.records),nn=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?.()};an(t.endpoint),this.fetchFn=t.fetchFn??((...n)=>fetch(...n)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??Ns,this.maxRetryDelayMs=t.maxRetryDelayMs??Ms,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Ps,this.logger=t.logger??Ve}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 s=Math.min(this.initialRetryDelayMs*2**(this.consecutiveFailures-1),this.maxRetryDelayMs);if(this.setState({phase:"retrying",isLoading:this.recordMap.size===0}),this.logger.warn(`[ContactMapStream] retrying in ${s}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(s),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(n=>{let 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,s="",a=!1,o=!1;for(;;){let{done:d,value:l}=await n.read();if(d)break;let c=r.decode(l,{stream:!0}),m=(s+c).split(`
|
|
2
|
-
`);s=m.pop()??"";let u=!1;for(let i of m){let p=i.trim();if(!p)continue;let f;try{f=JSON.parse(p)}catch(T){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",T);continue}if("type"in f&&f.type==="METADATA"){Number.isSafeInteger(f.total)&&f.total>=0&&this.setState({totalCount:f.total});continue}if(!Rs(f)){this.logger.warn("[ContactMapStream] server reported error:","error"in f?f.error:""),o=!0;continue}for(let T of f.records)T&&typeof T.person_id=="number"&&(this.recordMap.set(T.person_id,qr(T)),u=!0);f.nextCursor&&(this.lastCursor=f.nextCursor),f.isLast&&(a=!0)}u&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return o?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):a?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let n=t instanceof Error?t:new Error(String(t));return this.setState({error:n}),"retryable"}finally{this.activeController=null}}};var Ae=null,Gr=e=>{if(Ae!==null&&Ae.endpoint===e)return Ae;if(an(e),Ae===null)return Ae=new nn({endpoint:e}),Ae;if(Ae.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Ae.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 Ae},Ls=()=>{Ae?.dispose(),Ae=null},Es=new Map,Os={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Ds=()=>{let{streamEndpoint:e}=Ke();return(0,Te.useMemo)(()=>(an(e),e),[e])};function Qr(){let e=Ds(),t=(0,Te.useCallback)(()=>Gr(e),[e]);(0,Te.useEffect)(()=>{let o=t();o.start(),o.retryNow()},[t]);let n=(0,Te.useCallback)(o=>t().subscribe(o),[t]),r=(0,Te.useSyncExternalStore)(n,()=>t().getState(),()=>Os),s=(0,Te.useSyncExternalStore)(n,()=>t().getRecordMap(),()=>Es),a=(0,Te.useCallback)(()=>t().retryNow(),[t]);return(0,Te.useMemo)(()=>({...r,recordMap:s,retryNow:a}),[r,s,a])}var Yr=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 rn(){let{records:e,recordMap:t,isComplete:n,phase:r,loadedCount:s,totalCount:a,error:o,retryNow:d}=Qr(),l=(0,Te.useMemo)(()=>Yr(e),[e]);return{context:(0,Te.useMemo)(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:r==="failed",streamPhase:r,loadedCount:s,companyCount:l,totalCount:a,errorMessage:o?.message??null}),[e,t,n,r,s,l,a,o]),retryNow:d}}ce();var sa=require("@aiquants/fuzzy-search"),Ao=require("@aiquants/fuzzy-search/react"),Io=de(require("lucide-react/dist/esm/icons/search.js")),z=require("react"),ia=require("react-router");Ma();Wt();var Re=require("react"),Ze=e=>{let t=(0,Re.useRef)(null),n=(0,Re.useRef)({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),r=e?.dragThreshold??4,s=(0,Re.useCallback)(u=>{let i=u.currentTarget,p=u.deltaY;!i||p===0||(u.preventDefault(),i.scrollBy({left:p,behavior:"smooth"}))},[]),a=(0,Re.useCallback)(u=>{t.current?.removeEventListener("wheel",s),t.current=u,u?.addEventListener("wheel",s,{passive:!1})},[s]);(0,Re.useEffect)(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let o=(0,Re.useCallback)(u=>{if(u.pointerType==="touch")return;let i=n.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=u.clientX,i.scrollLeft=u.currentTarget.scrollLeft,i.pointerId=u.pointerId,i.hasCapture=!1,i.pointerType=u.pointerType},[]),d=(0,Re.useCallback)(u=>{let i=n.current;if(!i.isPointerDown||i.pointerType==="touch")return;let p=u.currentTarget,f=u.clientX-i.startX;!i.isDragging&&Math.abs(f)>r&&(i.isDragging=!0,i.hasCapture||(p.setPointerCapture?.(u.pointerId),i.hasCapture=!0)),i.isDragging&&(u.preventDefault(),p.scrollLeft=i.scrollLeft-f)},[r]),l=(0,Re.useCallback)(u=>{let i=n.current;if(i.pointerType==="touch")return;let p=u.currentTarget;i.isPointerDown&&i.hasCapture&&p.hasPointerCapture?.(u.pointerId)&&p.releasePointerCapture(u.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),c=(0,Re.useCallback)(u=>{l(u)},[l]),m=(0,Re.useCallback)(u=>{n.current.didDrag&&(u.preventDefault(),u.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:a,onPointerDown:o,onPointerMove:d,onPointerUp:c,onPointerLeave:c,onPointerCancel:c,onClickCapture:m}};xt();ce();var Xr=require("@aiquants/fuzzy-search"),Kn=e=>{let{indexWorkerOptions:t,levenshteinWorkerOptions:n,...r}=Xr.DEFAULT_FUZZY_SEARCH_OPTIONS;return{...r,autoSearchOnIndexRebuild:!1,multiTermOperator:"and",workerUrls:e,indexWorkerOptions:{...t},levenshteinWorkerOptions:{...n}}};var Oa=require("react/jsx-runtime");function Da({value:e,max:t=100,className:n,indicatorClassName:r,...s}){let a=e===void 0,o=a?0:Math.min(100,Math.max(0,e/t*100));return(0,Oa.jsx)("div",{role:"progressbar","aria-valuenow":a?void 0:o,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:Ct("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...s,children:(0,Oa.jsx)("div",{"data-slot":"progress-indicator",className:Ct("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",a&&"w-1/3 animate-progress-indeterminate",r),style:a?void 0:{width:`${o}%`}})})}var Jn=require("react"),Ro=require("react-router");ce();var St=require("@aiquants/resize-panels"),Gn=require("@aiquants/virtualscroll"),U=require("react");yt();var on={listPanelMinWidth:320,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35},sn={listPanelMinWidth:280,detailPanelMinWidth:260,handleThickness:10,listPaddingAndBorder:0,detailPaddingAndBorder:0,scrollbarSafetyBuffer:20,hysteresisSafetyMargin:35};function jn(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,n=t+e.scrollbarSafetyBuffer,r=n+e.hysteresisSafetyMargin,s=r-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:r,hysteresisWidth:s}}var Bt=require("react"),Wa=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:r=4,minFallbackHeight:s=240}=t??{},[a,o]=(0,Bt.useState)(600),d=(0,Bt.useCallback)(()=>{if(typeof window>"u")return;let l=e.current;if(!l||l.offsetParent===null&&window.getComputedStyle(l).position!=="fixed")return;let c=v=>Number.parseFloat(v)||0,{top:m}=l.getBoundingClientRect(),u=l.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),p=c(i.getPropertyValue("--footer-height")),f=c(i.getPropertyValue("--header-height")),T=c(i.getPropertyValue("--scrollbar-height")),S=window.getComputedStyle(l),w=c(S.marginBottom),V=c(S.paddingBottom),H=window.innerHeight-p-T-r,y=u?Math.min(u.bottom,H):H,g=u?Math.max(u.top,f):f,$=Math.max(m,g),q=y-$-w-V,k=Number.isFinite(q)?Math.floor(q):0,h=k>0?k:s;h>0&&Number.isFinite(h)&&o(v=>Math.abs(v-h)>1?h:v)},[r,e,s]);return(0,Bt.useEffect)(()=>{if(typeof window>"u")return;let l=null,c=null,m=null,u=null,i=()=>{l!==null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{d()})};i(),c=window.setTimeout(()=>{i()},150);let p=e.current;return typeof ResizeObserver<"u"&&p&&(m=new ResizeObserver(()=>{i()}),m.observe(p),p.parentElement&&m.observe(p.parentElement)),n&&typeof MutationObserver<"u"&&(u=new MutationObserver(()=>{i()}),u.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{l!==null&&window.cancelAnimationFrame(l),c!==null&&window.clearTimeout(c),m&&m.disconnect(),u&&u.disconnect(),window.removeEventListener("resize",i)}},[e,n,d]),{viewportHeight:a,updateViewportHeight:d}};var me=require("react"),Ws=600,Jr=8,ln=({ref:e,onSelect:t,resolveItem:n,item:r})=>{let[s,a]=(0,me.useState)(!1),[o,d]=(0,me.useState)(null),l=(0,me.useRef)(null),c=(0,me.useRef)(!1),m=(0,me.useRef)(!1),u=(0,me.useRef)(null),i=(0,me.useRef)({onSelect:t,resolveItem:n,item:r});(0,me.useEffect)(()=>{i.current={onSelect:t,resolveItem:n,item:r}},[t,n,r]);let p=(0,me.useCallback)(()=>{typeof window>"u"||l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),f=(0,me.useCallback)(()=>{u.current&&(p(),m.current=!1,u.current=null)},[p]),T=(0,me.useCallback)(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(p(),m.current=!1,c.current=!1,u.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},l.current=window.setTimeout(()=>{let $=i.current,q=null;$.item!==void 0?q=$.item:$.resolveItem&&g.target&&(q=$.resolveItem(g.target)),q!==null&&(c.current=!0,$.onSelect?.(q),d(q),a(!0)),f()},Ws))},[p,f]),S=(0,me.useCallback)(g=>{u.current&&g.pointerId===u.current.pointerId&&(p(),u.current=null,m.current=!1)},[p]),w=(0,me.useCallback)(g=>{c.current&&(g.preventDefault(),g.stopPropagation(),c.current=!1)},[]),V=(0,me.useCallback)(g=>{if(!u.current||g.pointerId!==u.current.pointerId)return;let $=Math.abs(g.clientX-u.current.x),q=Math.abs(g.clientY-u.current.y);($>Jr||q>Jr)&&(p(),u.current=null)},[p]),H=(0,me.useCallback)(g=>{(s||l.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),y=(0,me.useCallback)(g=>{g?.cancelLongPressTimer&&p(),g?.suppressLongPress&&(m.current=!0),a(!1),d(null),c.current=!1,u.current=null},[p]);return(0,me.useEffect)(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let $=[["pointerdown",T,void 0],["pointerup",S,void 0],["pointercancel",S,void 0],["pointermove",V,void 0],["pointerleave",S,void 0],["click",w,!0],["contextmenu",H,void 0]],q=[["contextmenu",H,!0],["pointerup",S,!0],["pointercancel",S,!0]];for(let[k,h,v]of $)g.addEventListener(k,h,v);for(let[k,h,v]of q)window.addEventListener(k,h,v);return()=>{for(let[k,h,v]of $)g.removeEventListener(k,h,v);for(let[k,h,v]of q)window.removeEventListener(k,h,v);p()}},[e,T,S,V,w,H,p]),{isPopupVisible:s,popupItem:o,handleClosePopup:y}};var et=require("react");function dn(e,t,n){let r=n?.mediaQuery??"(min-width: 1024px)",s=(0,et.useSyncExternalStore)((0,et.useCallback)(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let u=window.matchMedia(r);return u.addEventListener("change",m),()=>u.removeEventListener("change",m)},[r]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(r).matches:!0,()=>!1),[a,o]=(0,et.useState)(!1),[d,l]=(0,et.useState)(0);return(0,et.useEffect)(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let u=new ResizeObserver(i=>{for(let p of i){if(p.target!==m)continue;let f=0;p.borderBoxSize&&p.borderBoxSize.length>0?f=p.borderBoxSize[0].inlineSize:f=p.contentRect.width,!(!Number.isFinite(f)||f<=0)&&(l(f),o(T=>T&&f>=t.expandThreshold?!1:!T&&f<t.collapseThreshold?!0:T))}});return u.observe(m),()=>u.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!a,isContainerNarrow:a,isMediaMatches:s,containerWidth:d}}ce();var qn=require("@aiquants/swipe-overlay"),Ut=require("react");ce();Ca();var cn=require("react/jsx-runtime"),un=({isOpen:e,onClose:t,children:n,className:r="",title:s})=>{let a=J(),o=(0,Ut.useRef)(null),{overlayRef:d,overlayStyle:l,attemptClose:c}=(0,qn.useSwipeToDismissOverlay)({isOpen:e,onClose:t,isCloseBlocked:(0,Ut.useCallback)(()=>!1,[]),skipWhenTextSelected:!0}),m=(0,qn.useTapClick)(()=>c());return(0,Ut.useEffect)(()=>{!e&&o.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?(0,cn.jsxs)("div",{ref:o,"data-testid":"contact-map-mobile-overlay",className:`fixed top-0 bottom-0 left-0 z-50 flex touch-manipulation transition-[visibility] duration-200 ${e?"pointer-events-auto visible":"pointer-events-none invisible"}`,style:{right:"var(--aqcm-overlay-right, 0px)",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[(0,cn.jsx)("button",{type:"button","aria-label":a.overlayBackdrop,className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...m}),(0,cn.jsx)("aside",{role:"dialog","aria-modal":"true","aria-label":s===void 0?a.overlayTitle:s,style:l,ref:d,className:`relative ml-auto flex h-full w-full max-w-lg transform touch-pan-y flex-col bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900 ${r}`,onKeyDown:u=>{u.key==="Escape"&&!Hn(u.nativeEvent)&&(u.stopPropagation(),c())},children:n})]}):null};wa();var M=require("react/jsx-runtime"),Hs=(0,U.lazy)(async()=>({default:(await Promise.resolve().then(()=>(wr(),Tr))).default})),to=64,Zr="h-[64px]",eo=240,_s=4,Ha=jn(on),no=on.listPanelMinWidth,ao=on.detailPanelMinWidth,ro=on.handleThickness,As=Ha.collapseThreshold,Is=Ha.expandThreshold,Fs=({contactData:e})=>{let t=J(),n=He(e?.full_name)??t.noName,r=He(e?.title)??"-",s=He(e?.company_name)??"-",a=He(e?.department)??"-",o=Lt(e).value??"-",d=Et(e).value??"-",l=Be(e?.updated_at,t.recordDateTime);return(0,M.jsx)(en,{fullName:n,title:r,companyName:s,department:a,phoneNumber:d,email:o,updatedAtText:l})},zs=e=>({"--contact-panel-height":`${e}px`}),Bs=e=>typeof e=="object"&&e!==null&&"item"in e,Us=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,$s=(e,t)=>{for(let n of e){let r=Mn(n);if(r?.person_id===t)return r}return null},Qn=(e,t,n)=>{let{viewportHeight:r}=Wa(t,{enableMutationObserver:!0,bottomGap:_s,minFallbackHeight:eo}),[s,a]=(0,U.useState)(0),o=(0,U.useCallback)(()=>{let u=n.current,i=t.current;if(!(u&&i))return;let p=u.getBoundingClientRect(),f=i.getBoundingClientRect(),T=Math.ceil(f.top-p.top);Number.isFinite(T)&&T>0&&a(S=>Math.abs(S-T)>1?T:S)},[t,n]);(0,U.useLayoutEffect)(()=>{if(!e)return;o();let u=requestAnimationFrame(o);return window.addEventListener("resize",o),()=>{cancelAnimationFrame(u),window.removeEventListener("resize",o)}},[e,o]);let d=r>0?r:eo,l=s>0?s:0,c=d+l,m=(0,U.useMemo)(()=>zs(c),[c]);return{normalizedViewportHeight:d,normalizedDetailHeight:c,panelSizingStyle:m}},Vs=new Set,oo=()=>{let[e,t]=(0,U.useState)(Vs),n=(0,U.useCallback)((r,s)=>{t(a=>{if(a.has(r)===s)return a;let o=new Set(a);return s?o.add(r):o.delete(r),o})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},so=(e,t,n)=>{let r=(0,U.useRef)(n);(0,U.useLayoutEffect)(()=>{r.current=n},[n]),(0,U.useEffect)(()=>{if(e!==null)return r.current(e,t),()=>{r.current(e,!1)}},[e,t])},io=(0,U.memo)(({entry:e,index:t,selectedPersonId:n,onSelect:r,searchQuery:s,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:d,onPopupVisibilityChange:l})=>{let c=J(),m=(0,U.useRef)(null),u=(0,M.jsx)("div",{className:Zr}),i=Bs(e)?e:null,p=Mn(e),{isPopupVisible:f,handleClosePopup:T}=ln({ref:m,onSelect:r,item:p?.person_id});if(so(p?.person_id??null,f,l),!e||!p)return u;let{person_id:S}=p,w=n===S,V=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",y=w?"border-blue-300 bg-blue-50 ring-1 ring-blue-200 dark:border-blue-500 dark:bg-blue-500/20 dark:ring-blue-500/40":V,g=["B","F"].map($=>Us($,$==="B"?i?.baseScore:i?.score)).filter(Boolean);return(0,M.jsxs)("div",{ref:m,className:`flex ${Zr} w-full items-center overflow-hidden border-gray-200 border-b px-4 py-2 text-left transition-colors hover:bg-blue-50 dark:border-slate-700 dark:hover:bg-blue-500/10 ${y}`,style:{height:to},role:"button","aria-pressed":w,"data-selected":w?"true":"false",onClick:()=>r(S),children:[(0,M.jsxs)("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[(0,M.jsx)("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:c.listRowNumber(t+1)}),(0,M.jsx)("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:S}),(0,M.jsx)("div",{className:"flex items-center gap-1 whitespace-nowrap font-mono text-[11px] text-slate-600 leading-tight dark:text-slate-300",children:g.length?g.map($=>(0,M.jsx)("span",{children:$},$)):(0,M.jsx)("span",{children:"-"})})]}),(0,M.jsx)(U.Suspense,{fallback:(0,M.jsx)(Fs,{contactData:p}),children:(0,M.jsx)(Hs,{contactData:p,searchTerm:s,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:d,isPopupVisible:f,onRequestClose:T})})]})});io.displayName="ContactListRow";var _a=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:r,hasSearchTerm:s,enableHighlighting:a,openEmailsWithGmail:o,isSearchTabActive:d}=e,{locale:l,labels:c,engineLabels:m}=Se(),u=(0,U.useRef)(null),i=(0,U.useRef)(null),[p,f]=(0,U.useState)(null),{normalizedViewportHeight:T,panelSizingStyle:S}=Qn(d,i,u),{isAnyPopupVisible:w,handlePopupVisibilityChange:V}=oo(),H=(0,U.useMemo)(()=>({enablePointerDrag:!w,enableKeyboardNavigation:!w}),[w]),y=(0,U.useMemo)(()=>s?n:t,[s,n,t]),g=(0,U.useCallback)(le=>{f(le)},[]),$=(0,U.useCallback)(le=>{if(!o)return;let Ee=le.trim();if(!Ee||Ee==="-"||typeof window>"u")return;let gt=Qe(Ee,!0);gt&&window.open(gt,"_blank","noopener,noreferrer")},[o]),[q,k]=(0,U.useState)(!1),h=(0,U.useCallback)(le=>{g(le),k(!0)},[g]),v=(0,U.useCallback)((le,Ee)=>(0,M.jsx)(io,{entry:le,index:Ee,selectedPersonId:p,onSelect:h,searchQuery:r,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:$,onPopupVisibilityChange:V}),[p,h,r,a,o,$,V]),F=(0,U.useCallback)(le=>y[le],[y]),P=(0,U.useCallback)(le=>Mn(y[le])?.person_id??`row-${le}`,[y]),ae=(0,U.useCallback)(()=>to,[]),L=y.length,E=(0,U.useMemo)(()=>({enabled:!0,renderVisual:Gn.tapScrollCircleSampleVisual}),[]),I=(0,U.useMemo)(()=>p===null?null:$s(y,p),[p,y]);(0,U.useEffect)(()=>{p!==null&&!I&&f(null)},[p,I]);let G=(0,U.useRef)(null),{isTwoColumn:oe}=dn(G,Ha),ye=(0,M.jsxs)("div",{ref:u,className:"flex min-h-0 flex-1 flex-col gap-1",children:[(0,M.jsx)("div",{className:"hidden rounded-t-lg border border-gray-200 bg-gray-50 px-4 py-2 transition-colors sm:block dark:border-slate-700 dark:bg-slate-900/70",children:(0,M.jsxs)("div",{className:"flex items-center",children:[(0,M.jsxs)("div",{className:"flex w-28 shrink-0 flex-col items-center gap-0.5 text-center text-[11px] text-slate-700 uppercase tracking-wider dark:text-slate-200",children:[(0,M.jsx)("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:c.columnNo}),(0,M.jsx)("span",{className:"leading-tight",children:c.columnId}),(0,M.jsx)("span",{className:"whitespace-nowrap leading-tight",children:c.columnScore})]}),(0,M.jsxs)("div",{className:"hidden w-full grid-cols-3 gap-2 font-medium text-slate-700 text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[(0,M.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,M.jsx)("span",{children:c.columnName}),(0,M.jsx)("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnTitle})]}),(0,M.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,M.jsx)("span",{children:c.columnCompany}),(0,M.jsx)("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnDepartment})]}),(0,M.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,M.jsx)("span",{children:c.columnPhone}),(0,M.jsx)("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnEmail})]}),(0,M.jsx)("div",{className:"hidden items-end justify-end xl:flex",children:(0,M.jsx)("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnUpdatedAt})})]})]})}),(0,M.jsx)("div",{ref:i,className:"flex-1",children:(0,M.jsx)(Gn.VirtualScroll,{itemCount:L,getItemKey:P,behaviorOptions:H,getItem:F,getItemHeight:ae,viewportSize:T,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:E},locale:l,labels:m,className:"w-full rounded-b-lg border border-gray-200 border-t-0 bg-white pr-0.75 transition-colors dark:border-slate-700 dark:bg-slate-950",children:(le,Ee)=>v(le,Ee)})}),n.length===0&&s?(0,M.jsx)("div",{className:"py-8 text-center",children:(0,M.jsx)("p",{className:"text-slate-600 dark:text-slate-300",children:c.listNoSearchResults})}):null,L===0&&!s?(0,M.jsx)("div",{className:"py-8 text-center",children:(0,M.jsx)("p",{className:"text-slate-600 dark:text-slate-300",children:c.listNoData})}):null]});return(0,M.jsx)("div",{ref:G,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:S,children:oe?(0,M.jsxs)(St.PanelGroup,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[(0,M.jsx)(St.Panel,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:no,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ye}),(0,M.jsx)(St.PanelResizeHandle,{id:"contact-map-list-handle",thickness:ro,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":c.listResizeHandle}),(0,M.jsx)(St.Panel,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:ao,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:(0,M.jsx)(Je,{contact:I,searchTerm:r,enableHighlighting:a})})]}):(0,M.jsxs)(M.Fragment,{children:[ye,(0,M.jsx)("div",{className:"hidden","aria-hidden":"true",children:(0,M.jsx)(Je,{contact:I,searchTerm:r,enableHighlighting:a})}),I?(0,M.jsx)(un,{isOpen:q,onClose:()=>k(!1),className:"z-50 bg-white dark:bg-slate-900",children:(0,M.jsxs)("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[(0,M.jsxs)("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[(0,M.jsx)("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:c.detailHeading}),(0,M.jsx)("button",{type:"button",onClick:()=>k(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:c.close})]}),(0,M.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:(0,M.jsx)(Je,{contact:I,searchTerm:r,enableHighlighting:a})})]})}):null]})})};var bo=require("@aiquants/directory-tree"),wt=require("@aiquants/resize-panels"),xo=require("@aiquants/virtualscroll"),vo=de(require("@heroicons/react/24/solid/FolderMinusIcon.js")),Co=de(require("@heroicons/react/24/solid/FolderPlusIcon.js")),_=require("react"),ko=require("react-dom");yt();var Aa=(e,t)=>e&&e.trim()||t;var tt=require("react"),Ia=(e,t=250)=>{let[n,r]=(0,tt.useState)(e),s=(0,tt.useRef)(null),a=(0,tt.useRef)(e),o=(0,tt.useRef)(null),d=(0,tt.useRef)(!1);return(0,tt.useEffect)(()=>{if(!d.current){d.current=!0,r(e),a.current=e;return}a.current=n,s.current=null;let l=c=>{s.current??(s.current=c);let m=c-s.current,u=Math.min(1,Math.max(0,m/t)),i=1-(1-u)**3,p=Math.max(0,Math.round(a.current+(e-a.current)*i));r(p),u<1&&(o.current=requestAnimationFrame(l))};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current)}},[e,t]),Math.max(0,n)};var Ce=require("react");Ot();ce();var po={},Ks=250,js=4e3,Yn=3,lo={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},co=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,pn=class{constructor(t,{workerSource:n,logger:r=Ve}){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>=Yn){this.logger.error(`[TreeWorker] the tree Worker failed ${Yn} times in a row; the tree stops updating until ${lo[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Ks*2**(this.consecutiveFailures-1),js);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${Yn})`,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 ${se(n)}`);if(!Object.hasOwn(lo,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${se(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>=Yn||this.retryTimer!==null)return null;if(!this.worker)try{this.worker=this.workerFactory(),this.workerNeedsReset=!0,this.worker.onerror=this.handleFailure,this.worker.onmessageerror=this.handleFailure,this.worker.onmessage=this.handleMessage}catch(t){return this.handleFailure(t),null}return this.worker}syncRecords(t,n){this.finalizeRequest!==null&&(t.length<this.finalizeRequest.recordCount||this.finalizeRequest.naming===null||!co(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let r=this.ensureWorker();if(!r)return;let s=this.workerNeedsReset,a=this.postedNaming===null||!co(this.postedNaming,n);if((this.workerNeedsReset||a||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=n,r.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),this.updateState()),t.length>this.postedCount){let o=t.slice(this.postedCount);this.postedCount=t.length,r.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:o}),this.updateState()}s&&this.finalizeRequest!==null&&this.finalize()}finalize(){this.finalizeRequest={recordCount:this.lastSyncedRecords.length,naming:this.lastSyncedNaming},!(this.worker===null||this.finalizedPostedCount===this.postedCount)&&(this.finalizedPostedCount=this.postedCount,this.worker.postMessage({type:"FINALIZE_TREE",generation:this.generation}))}cancelWorker(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.worker?.terminate(),this.worker=null,this.postedCount=0,this.postedNaming=null,this.finalizedPostedCount=null}stop(){this.cancelWorker(),this.consecutiveFailures=0,this.updateState()}reset(){this.cancelWorker(),this.listeners.clear(),this.latestSnapshot=null,this.lastSyncedRecords=[],this.lastSyncedNaming=null,this.consecutiveFailures=0,this.finalizeRequest=null,this.state={snapshot:null,isBuilding:!1}}},qs=e=>{if(e!==void 0)return new Worker(e,{type:"module"});let t=typeof po<"u"?po.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)")},Tt=null,uo=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),Gs=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},mo=e=>{if(La(e),Tt===null){let t=new pn(()=>qs(e),{workerSource:"workerUrls.treeWorker"});return Tt={session:t,workerUrl:e},t}if(Tt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${uo(Tt.workerUrl)} and cannot also load it from ${uo(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return Tt.session},Qs=()=>{Tt?.session.reset(),Tt=null},Ys={snapshot:null,isBuilding:!1};function Fa(e,t=!1){let n=Ke(),r=n.treeWorkerFactory,s=n.workerUrls?.treeWorker,{labels:a}=Se(),o=a.uncategorizedCompany,d=a.noName,l=(0,Ce.useMemo)(()=>({uncategorizedCompany:o,unnamedPerson:d}),[o,d]),c=(0,Ce.useRef)(r);(0,Ce.useEffect)(()=>{c.current=r},[r]);let m=r!==void 0,u=m?void 0:s,i=(0,Ce.useMemo)(()=>m?new pn(()=>Gs(c.current)(),{workerSource:"treeWorkerFactory"}):null,[m]),p=(0,Ce.useCallback)(()=>i===null?mo(u):i,[i,u]),f=(0,Ce.useCallback)(S=>p().subscribe(S),[p]),T=(0,Ce.useCallback)(()=>p().getState(),[p]);return(0,Ce.useEffect)(()=>{let S=p();S.syncRecords(e,l),t&&S.finalize()},[p,e,t,l]),(0,Ce.useEffect)(()=>{if(i!==null)return()=>i.stop()},[i]),(0,Ce.useSyncExternalStore)(f,T,()=>Ys)}ce();Ta();In();var N=require("react/jsx-runtime"),Ua=jn(sn),So=sn.listPanelMinWidth,To=sn.detailPanelMinWidth,wo=sn.handleThickness,Xs=Ua.collapseThreshold,Js=Ua.expandThreshold,Zs=(e,t)=>{let{searchQuery:n,enableHighlighting:r}=t,s=Aa(e.full_name,t.noName),a=Aa(e.title,""),o=(0,N.jsx)(he,{text:s,query:n,enabled:r});return a?(0,N.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,N.jsx)("span",{children:o}),(0,N.jsx)("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:(0,N.jsx)(he,{text:a,query:n,enabled:r})})]}):o},ei="contact-map-tree h-full w-full",ti={hoverClassName:"bg-slate-100/70 dark:bg-slate-800/60",directorySelectedClassName:"bg-sky-100/55 dark:bg-sky-900/40 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300",itemSelectedClassName:"bg-sky-100/70 dark:bg-sky-900/55 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300"},za="h-4 w-4 shrink-0 transition-colors duration-150",No=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),Xn=null,go=null,mn=new Map,ho="",fo=null,yo=null,ni=(e,t,n,r,s)=>{let a=`${n?"icons":"plain"}#${r}#${s.noName}`;(a!==ho||s.formatDirectoryName!==fo||t!==yo)&&(mn.clear(),ho=a,fo=s.formatDirectoryName,yo=t);let o={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},d=new Set;for(let l of e){d.add(l.absolutePath);let c=`${l.name}\0${l.memberCount}`,m=mn.get(l.absolutePath);(!m||m.signature!==c)&&(m={signature:c,result:Po([l],t,n,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},mn.set(l.absolutePath,m));let u=m.result;u.entries.length>0&&o.entries.push(u.entries[0]);for(let[i,p]of u.personPathMap){let f=o.personPathMap.get(i);if(f)for(let T of p)f.add(T);else o.personPathMap.set(i,new Set(p))}for(let[i,p]of u.contactByPath)o.contactByPath.set(i,p);for(let[i,p]of u.ancestorsByPath)o.ancestorsByPath.set(i,p);o.totalCount+=u.totalCount,!o.firstPerson&&u.firstPerson&&(o.firstPerson=u.firstPerson)}for(let l of mn.keys())d.has(l)||mn.delete(l);return o},Ba=e=>e.isSelected||e.isItemSelected?"text-sky-600 dark:text-sky-300":e.isExpanded&&e.isDirectory?"text-slate-600 dark:text-slate-200":"text-slate-500 dark:text-slate-400",Mo=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...Mo(n.children)));return t},ai=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Po=(e,t,n,r,s)=>{let a=new Map,o=new Map,d=new Map,l=0,c=null,m=(i,p)=>{let f=[...p,i.absolutePath];d.set(i.absolutePath,f);let T,S,w=i.type==="directory"?r.formatDirectoryName(i.name,ai(i)):i.name,V=(0,N.jsx)(he,{text:w,query:r.searchQuery,enabled:r.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let H=t.get(i.personId);if(H){o.set(i.absolutePath,H),a.has(i.personId)||a.set(i.personId,new Set);let y=a.get(i.personId);y&&y.add(i.absolutePath),l++,c||(c={personId:i.personId,path:i.absolutePath}),n&&(S=g=>{let $=Ba(g);return g.isSelected||g.isItemSelected||i.isPrimary&&($=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),(0,N.jsx)(n.person,{"aria-hidden":"true",className:`${za} ${$}`})},i.title&&(V=Zs(H,r))),V=(0,N.jsx)("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:V})}}else if(i.children){let H=i.children.map(y=>m(y,f)).filter(y=>y!==null);if(s&&H.length===0)return null;if(T=H,n){let y=i.relativePath.startsWith("company:")?n.company:n.department;S=g=>(0,N.jsx)(y,{"aria-hidden":"true",className:`${za} ${Ba(g)}`})}}return{name:w,label:V,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:S,children:T}};return{entries:e.map(i=>m(i,[])).filter(i=>i!==null),personPathMap:a,contactByPath:o,ancestorsByPath:d,firstPerson:c,totalCount:l}},ri=(e,t,n)=>{let r=new Set,s=new Set,a=new Map;t.forEach((m,u)=>{a.set(m.item.person_id,u)});for(let m of t){let u=m.item.person_id,i=e.personPathMap.get(u);if(i)for(let p of i){r.add(p);let f=e.ancestorsByPath.get(p);if(f){for(let T of f)r.add(T);n&&f.length>0&&s.add(f[0])}}}let o=new Map,d=m=>{let u=o.get(m.absolutePath);if(u!==void 0)return u;let i=1/0;if(m.type==="file"){let p=e.contactByPath.get(m.absolutePath);p&&(i=a.get(p.person_id)??1/0)}else if(m.children)for(let p of m.children)i=Math.min(i,d(p));return o.set(m.absolutePath,i),i},l=(m,u=0)=>m.filter(i=>n&&u===0&&s.has(i.absolutePath)?!0:r.has(i.absolutePath)).map(i=>n&&u===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:l(i.children,u+1)}:i).sort((i,p)=>u===0?d(i)-d(p):0),c=l(e.entries);return{...e,entries:c}},$a=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:r,filteredItems:s,hasSearchTerm:a,isSearchInProgress:o,isSearchTabActive:d}=e,{locale:l,labels:c,treeLabels:m}=Se(),u=c.noName,i=c.treeDirectoryName,p=(0,_.useMemo)(()=>({noName:u,formatDirectoryName:i}),[u,i]),[f,T]=(0,_.useState)(null),[S,w]=(0,_.useState)(!1),{snapshot:V,isBuilding:H}=Fa(n,e.isStreamingComplete),y=V?.tree??null,g=V?.rebuildEpoch??0,$=(0,_.useMemo)(()=>y?ni(y,r,f,g,p):null,[y,r,f,g,p]),q=(0,_.useMemo)(()=>{if(!y)return null;if(!a)return $;let W;S||(W=new Set(s.map(ee=>ee.item.person_id)));let Q=Po(y,r,f,{...p,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},W);return ri(Q,s,S)},[y,$,r,f,e.searchQuery,e.enableHighlighting,a,s,S,p]),k=(0,_.useMemo)(()=>q||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[q]),h=a&&e.errorMessage!==null,[v,F]=(0,_.useState)(k),P=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!(o||h)){P.current=!!y,F(k);return}!P.current&&y&&k.entries.length>0&&(P.current=!0,F(k))},[k,y,o,h]);let ae=a&&(o||h)?v:k,{entries:L,personPathMap:E,contactByPath:I,totalCount:G}=ae,oe=(0,_.useMemo)(()=>Mo(L),[L]),[ye,le]=(0,_.useState)(()=>go??new Set),Ee=(0,_.useCallback)(W=>!ye.has(W),[ye]),gt=(0,_.useCallback)(W=>{le(Q=>{let ee=new Set(Q);return ee.has(W)?ee.delete(W):ee.add(W),ee})},[]),Mt=(0,_.useCallback)(W=>{W.length!==0&&le(Q=>{let ee=new Set(Q);for(let Oe of W)ee.add(Oe);return ee})},[]),gn=(0,_.useCallback)(W=>{le(Q=>{if(Q.size===0)return Q;let ee=!1,Oe=new Set(Q);for(let K of W)Oe.delete(K)&&(ee=!0);return ee?Oe:Q})},[]);(0,_.useEffect)(()=>{go=ye},[ye]),(0,_.useEffect)(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[ge,$t]=(0,_.useState)(null),[we,at]=(0,_.useState)(null),[hn,qe]=(0,_.useState)(!1),[la,fn]=(0,_.useState)(!1),yn=(0,_.useRef)(null),Vt=(0,_.useRef)(null),{normalizedViewportHeight:re,panelSizingStyle:bn}=Qn(d,Vt,yn),rt=(0,_.useCallback)(W=>{let Q=I.get(W);Q&&(ge!==Q.person_id&&$t(Q.person_id),W!==we&&at(W),qe(!0))},[I,we,ge]),Kt=(0,_.useCallback)(W=>{rt(W.entry.absolutePath)},[rt]),ot=(0,_.useCallback)(W=>W instanceof Element?W.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:Ne,popupItem:jt,handleClosePopup:qt}=ln({ref:Vt,resolveItem:ot,onSelect:rt}),Ie=(0,_.useCallback)(W=>{if(!e.openEmailsWithGmail)return;let Q=W.trim();if(!Q||Q==="-"||typeof window>"u")return;let ee=Qe(Q,!0);ee&&window.open(ee,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),st=jt?I.get(jt):null,Fe=Ne&&st!==null&&st!==void 0;(0,_.useEffect)(()=>{Ne&&!st&&qt()},[Ne,st,qt]);let ht=(0,_.useMemo)(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:xo.tapScrollCircleSampleVisual}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),it=(0,_.useMemo)(()=>No(ht,re,Fe),[ht,re,Fe]);(0,_.useEffect)(()=>{let W=!1;return typeof window>"u"?()=>{W=!0}:Xn?(T(Xn),()=>{W=!0}):((async()=>{try{let[ee,Oe,K,Y]=await Promise.all([import("lucide-react/dist/esm/icons/building-2.js"),import("lucide-react/dist/esm/icons/users-round.js"),import("lucide-react/dist/esm/icons/id-card.js"),import("lucide-react/dist/esm/icons/user-round.js")]);if(W)return;let fe=ee.default,ze=Oe.default,pa=K.default,Xa=Y.default;fe&&ze&&pa&&Xa&&(Xn={company:fe,department:ze,title:pa,person:Xa},T(Xn))}catch(ee){Ve.warn("Failed to load lucide icons",ee)}})(),()=>{W=!0})},[]);let ft=(0,_.useMemo)(()=>{if(!f)return;let W=Y=>fe=>(0,N.jsx)(Y,{"aria-hidden":"true",className:`${za} ${Ba(fe)}`}),Q={company:W(f.company),department:W(f.department),title:W(f.title)},ee=W(f.person),Oe=Y=>Y in Q,K=Y=>{let[fe]=Y.entry.relativePath.split(":",1);return(Oe(fe)?Q[fe]:Q.company)(Y)};return{directory:K,directoryExpanded:K,file:ee}},[f]),Pt=(0,_.useCallback)(()=>{le(W=>W.size===0?W:new Set)},[]),da=(0,_.useCallback)(()=>{oe.length>0&&Mt(oe)},[oe,Mt]);(0,_.useEffect)(()=>{if(typeof window>"u")return;let W=document.documentElement,Q=window.matchMedia("(prefers-color-scheme: dark)"),ee=()=>fn(W.classList.contains("dark")||Q.matches);ee(),Q.addEventListener("change",ee);let Oe=new MutationObserver(ee);return Oe.observe(W,{attributes:!0,attributeFilter:["class"]}),()=>{Q.removeEventListener("change",ee),Oe.disconnect()}},[]),(0,_.useEffect)(()=>{if(G===0){ge!==null&&$t(null),we!==null&&at(null);return}if(ge!==null){let W=E.get(ge);if(W){if(we&&W.has(we))return;let Q=W.values().next().value;Q&&at(Q);return}}ge!==null&&$t(null),we!==null&&at(null)},[G,ge,we,E]);let lt=we?I.get(we)??null:null,Ge=la?"#475569":"#94A3B8",Gt=e.isStreamingComplete,ca=e.isStreamingFailed,xn=Gt&&n.length===0,vn=(H||!y)&&!xn,Cn=Ia(G,250),dt=y!==null||xn,Rt=(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono text-[10px] text-slate-700 dark:bg-slate-800 dark:text-slate-200",title:c.treeNodeCountTitle,children:[(0,N.jsx)("span",{className:"text-[10px]",children:"\u{1F333}"})," ",c.treeNodeCountLabel," ",dt?c.treeNodeCount(Cn):"\u2026"]}),ca&&!Gt?(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium text-[10px] text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300",title:c.treeStreamInterruptedTitle,children:[(0,N.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),(0,N.jsx)("span",{className:"text-[10px]",children:"\u26D4"})," ",c.treeStreamInterrupted]}):Gt?vn?(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium text-[10px] text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:c.treeBuildingTitle,children:[(0,N.jsxs)("span",{className:"relative flex h-1.5 w-1.5",children:[(0,N.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),(0,N.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),(0,N.jsx)("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",c.treeBuilding]}):(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium text-[10px] text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300",title:c.treeCompleteTitle,children:[(0,N.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),(0,N.jsx)("span",{className:"text-[10px]",children:"\u2705"})," ",c.treeComplete]}):(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium text-[10px] text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300",title:c.treeStreamLoadingTitle,children:[(0,N.jsxs)("span",{className:"relative flex h-1.5 w-1.5",children:[(0,N.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),(0,N.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),(0,N.jsx)("span",{className:"text-[10px]",children:"\u23F3"})," ",c.treeStreamLoading]}),a&&(0,N.jsxs)("button",{type:"button",onClick:()=>w(!S),className:`inline-flex h-5 items-center rounded px-1.5 text-[10px] transition-colors ${S?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800"}`,title:c.treeShowEntireCompanyTitle,children:[(0,N.jsx)("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",c.treeShowEntireCompany]}),oe.length>0?(0,N.jsxs)("div",{className:"flex items-center gap-1",children:[(0,N.jsx)("button",{type:"button",onClick:Pt,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":c.treeExpandAll,title:c.treeExpandAllTitle,children:(0,N.jsx)(Co.default,{className:"h-3 w-3"})}),(0,N.jsx)("button",{type:"button",onClick:da,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":c.treeCollapseAll,title:c.treeCollapseAllTitle,children:(0,N.jsx)(vo.default,{className:"h-3 w-3"})})]}):null]}),kn=(0,_.useRef)(null),{isTwoColumn:Sn}=dn(kn,Ua,{mediaQuery:"(min-width: 768px)"}),Tn=(0,_.useMemo)(()=>({toggle:gt,isExpanded:Ee,expandMultiple:gn,collapseMultiple:Mt,isPending:o}),[Mt,gn,Ee,gt,o]),wn=(0,_.useMemo)(()=>({onEntryClick:Kt,selectedPath:we}),[Kt,we]),ua=(0,_.useMemo)(()=>({className:ei,lineColor:Ge,iconOverrides:ft,showDirectoryIcons:!!ft,showFileIcons:!!ft,highlightStyles:ti,entryClassName:"rounded-md px-1 py-0.5",nameClassName:"text-xs tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[Ge,ft]),Qt=(0,N.jsx)("div",{ref:yn,className:"flex min-h-0 flex-1 flex-col rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",children:(0,N.jsx)("div",{ref:Vt,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:L.length>0?(0,N.jsx)(bo.DirectoryTree,{entries:L,expansion:Tn,selection:wn,visual:ua,virtualScroll:it,locale:l,labels:m}):(0,N.jsx)("div",{className:"flex h-full w-full items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white/70 px-6 text-center text-slate-500 text-sm transition-colors dark:border-slate-700 dark:bg-slate-900/50 dark:text-slate-300",children:a?c.treeNoMatches:c.treeEmpty})})});return(0,N.jsxs)("div",{ref:kn,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:bn,children:[t&&(0,ko.createPortal)(Rt,t),Sn?(0,N.jsxs)(wt.PanelGroup,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[(0,N.jsx)(wt.Panel,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:So,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:Qt}),(0,N.jsx)(wt.PanelResizeHandle,{id:"contact-map-tree-handle",thickness:wo,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":c.treeResizeHandle}),(0,N.jsx)(wt.Panel,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:To,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:(0,N.jsx)(Je,{contact:lt??null,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):(0,N.jsxs)(N.Fragment,{children:[Qt,(0,N.jsx)("div",{className:"hidden","aria-hidden":"true",children:(0,N.jsx)(Je,{contact:lt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}),hn&<?(0,N.jsx)(un,{isOpen:hn,onClose:()=>qe(!1),className:"z-50 bg-white dark:bg-slate-900",children:(0,N.jsxs)("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[(0,N.jsx)("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:c.detailHeading}),(0,N.jsx)("button",{type:"button",onClick:()=>qe(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:c.close})]}),(0,N.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:(0,N.jsx)(Je,{contact:lt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]})}):null]}),Fe&&st&&(0,N.jsx)(Zt,{contactData:st,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:Ie,onRequestClose:qt})]})};var Le=require("react/jsx-runtime"),Va="view",oi={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},si=e=>e==="tree"?"tree":"list",Ka=({context:e})=>{let t=J(),[n,r]=(0,Ro.useSearchParams)(),[s,a]=(0,Jn.useState)(null),o=si(n.get(Va)),{setScrollableRef:d,onPointerDown:l,onPointerMove:c,onPointerUp:m,onPointerLeave:u,onPointerCancel:i,onClickCapture:p}=Ze(),f=(0,Jn.useCallback)(T=>{let S=T==="tree"?"tree":"list";if(S===o)return;let w=new URLSearchParams(typeof window<"u"?window.location.search:"");S==="list"?w.delete(Va):w.set(Va,S),r(w,{replace:!0})},[o,r]);return(0,Le.jsxs)("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[(0,Le.jsxs)("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[(0,Le.jsxs)("div",{ref:d,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-lg bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:oi,onPointerDown:l,onPointerMove:c,onPointerUp:m,onPointerLeave:u,onPointerCancel:i,onClickCapture:p,children:[(0,Le.jsxs)("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>f("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="list"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4C4} ",t.listViewTab]}),(0,Le.jsxs)("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>f("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="tree"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F333} ",t.treeViewTab]})]}),(0,Le.jsx)("div",{ref:a,className:"flex items-center gap-1.5"})]}),(0,Le.jsxs)("div",{className:"flex h-full flex-1 flex-col",children:[(0,Le.jsx)("div",{className:`${o==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="list"?(0,Le.jsx)(_a,{context:e}):null}),(0,Le.jsx)("div",{className:`${o==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="tree"?(0,Le.jsx)($a,{context:e,controlsContainer:s}):null})]})]})};var Lo=require("react");ce();var j=require("@aiquants/fuzzy-search"),be=require("react");ce();var b=require("react/jsx-runtime"),ja=1e3,Zn=(0,be.memo)(({searchOptions:e,setSearchOptions:t})=>{let n=J(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=e.sortBy==="relevance",o=(0,be.useId)(),d=(0,be.useId)(),l=(0,be.useId)(),c=(0,be.useId)(),m=(0,be.useId)(),u=(0,be.useId)(),i=(0,be.useId)(),p=(0,be.useId)(),f=(0,be.useId)(),T=(0,be.useId)(),S=(0,be.useId)(),w=[];w.push((0,b.jsxs)("div",{className:`${r} border-green-200 border-l-4 dark:border-green-400/60`,children:[(0,b.jsxs)("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramSize}),(0,b.jsx)("input",{id:o,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||j.DEFAULT_FUZZY_SEARCH_OPTIONS.ngramSize,onChange:y=>t(g=>({...g,ngramSize:parseInt(y.target.value,10)})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.ngramSize||j.DEFAULT_FUZZY_SEARCH_OPTIONS.ngramSize]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramSizeHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinNgramOverlap}),(0,b.jsx)("input",{id:d,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||j.DEFAULT_FUZZY_SEARCH_OPTIONS.minNgramOverlap,onChange:y=>t(g=>({...g,minNgramOverlap:parseInt(y.target.value,10)})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.minNgramOverlap||j.DEFAULT_FUZZY_SEARCH_OPTIONS.minNgramOverlap]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinNgramOverlapHint})]})]},"index-build")),w.push((0,b.jsxs)("div",{className:`${r} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[(0,b.jsxs)("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.indexCandidateHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexThreshold}),(0,b.jsx)("input",{id:l,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.threshold,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.threshold]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexThresholdHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramOverlapThreshold}),(0,b.jsx)("input",{id:m,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.ngramOverlapThreshold,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.ngramOverlapThreshold]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),w.push((0,b.jsxs)("div",{className:`${r} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[(0,b.jsxs)("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexStrategy}),(0,b.jsxs)("select",{id:c,value:e.indexWorkerOptions?.strategy??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.strategy??"hybrid",onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:y.target.value}})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,b.jsx)("option",{value:"fast",children:n.indexStrategyFast}),(0,b.jsx)("option",{value:"accurate",children:n.indexStrategyAccurate}),(0,b.jsx)("option",{value:"hybrid",children:n.indexStrategyHybrid})]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexStrategyHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinCandidatesRatio}),(0,b.jsx)("input",{id:u,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.minCandidatesRatio,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.minCandidatesRatio]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinCandidatesRatioHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:i,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMaxCandidatesRatio}),(0,b.jsx)("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.maxCandidatesRatio,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.maxCandidatesRatio]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),w.push((0,b.jsxs)("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[(0,b.jsxs)("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",n.scoreTuningHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexJaroWinklerPrefix}),(0,b.jsx)("input",{id:p,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.jaroWinklerPrefix,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.jaroWinklerPrefix]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexJaroWinklerPrefixHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),(0,b.jsxs)("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[(0,b.jsx)("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:y.target.checked?void 0:ja}}))}),n.noLimit]}),(0,b.jsx)("input",{id:f,type:"range",min:ja,max:"10000",step:"1000",disabled:e.indexWorkerOptions?.maxResults===void 0,value:e.indexWorkerOptions?.maxResults===void 0?ja:e.indexWorkerOptions.maxResults,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(y.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),(0,b.jsxs)("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxResultsHint})]})]},"jaro")),w.push((0,b.jsxs)("div",{className:`${r} border-emerald-200 border-l-4 ${a?"":"opacity-50"} dark:border-emerald-400/60`,children:[(0,b.jsxs)("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:T,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),(0,b.jsx)("input",{id:T,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(y.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),(0,b.jsxs)("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevanceFieldWeight??.2]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexFieldWeightHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:S,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexPerfectMatchBonus}),(0,b.jsx)("input",{id:S,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(y.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),(0,b.jsxs)("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexPerfectMatchBonusHint})]}),!a&&(0,b.jsx)("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:n.relevanceOnlyNotice})]},"relevance"));let V=(0,be.useId)(),H=(0,be.useId)();return w.push((0,b.jsxs)("div",{className:`${r} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[(0,b.jsxs)("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",n.indexContainmentHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:V,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentBase}),(0,b.jsx)("input",{id:V,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentScoreBase??.7,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentScoreBase??.7]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentBaseHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:H,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentCoverage}),(0,b.jsx)("input",{id:H,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentCoverageWeight??.3]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentCoverageHint})]})]},"containment")),(0,b.jsxs)("section",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[(0,b.jsx)("span",{children:"\u{1F4CA}"}),(0,b.jsx)("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),(0,b.jsx)("button",{type:"button",onClick:()=>t(y=>({...y,indexWorkerOptions:{threshold:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:void 0,relevanceFieldWeight:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.strategy},ngramSize:j.DEFAULT_FUZZY_SEARCH_OPTIONS.ngramSize,minNgramOverlap:j.DEFAULT_FUZZY_SEARCH_OPTIONS.minNgramOverlap})),className:"rounded border border-green-300 bg-green-100 px-2 py-1 font-medium text-green-700 text-xs transition-colors hover:bg-green-200 dark:border-green-400/60 dark:bg-green-900/20 dark:text-green-200 dark:hover:bg-green-800/30",title:n.resetToDefaultsTitle,children:n.reset})]}),(0,b.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:w})]})});Zn.displayName="IndexWorkerSettings";var xe=require("@aiquants/fuzzy-search"),nt=require("react");ce();var D=require("react/jsx-runtime"),qa=1e3,ea=(0,nt.memo)(({searchOptions:e,setSearchOptions:t})=>{let n=J(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=e.sortBy==="relevance",o=(0,nt.useId)(),d=(0,nt.useId)(),l=(0,nt.useId)(),c=(0,nt.useId)(),m=(0,nt.useId)(),u=(0,nt.useId)(),i=[];return i.push((0,D.jsxs)("div",{className:`${r} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[(0,D.jsxs)("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinThreshold}),(0,D.jsx)("input",{id:o,type:"range",min:"0.0",max:a?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.threshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,threshold:parseFloat(p.target.value)}})),className:"w-full"}),(0,D.jsxs)("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.threshold]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinLengthSimilarity}),(0,D.jsx)("input",{id:d,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(p.target.value)}})),className:"w-full"}),(0,D.jsxs)("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push((0,D.jsxs)("div",{className:`${r} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[(0,D.jsxs)("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",n.scoreTuningHeading]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinLengthPenalty}),(0,D.jsx)("input",{id:l,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(p.target.value)}})),className:"w-full"}),(0,D.jsxs)("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthDiffPenalty]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push((0,D.jsxs)("div",{className:`${r} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[(0,D.jsxs)("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),(0,D.jsx)("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),(0,D.jsxs)("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[(0,D.jsx)("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:p.target.checked?void 0:qa}}))}),n.noLimit]}),(0,D.jsx)("input",{id:c,type:"range",min:qa,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?qa:e.levenshteinWorkerOptions.maxResults,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:parseInt(p.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),(0,D.jsxs)("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinMaxResultsHint})]},"max-results")),i.push((0,D.jsxs)("div",{className:`${r} border-rose-200 border-l-4 ${a?"":"opacity-50"} dark:border-rose-400/60`,children:[(0,D.jsxs)("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),(0,D.jsx)("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(p.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),(0,D.jsxs)("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinFieldWeightHint})]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinPartialBonus}),(0,D.jsx)("input",{id:u,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.partialMatchBonus,onChange:p=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,partialMatchBonus:parseFloat(p.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),(0,D.jsxs)("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.partialMatchBonus]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinPartialBonusHint})]}),!a&&(0,D.jsx)("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:n.relevanceOnlyNotice})]},"relevance")),(0,D.jsxs)("section",{className:"space-y-3",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[(0,D.jsx)("span",{children:"\u{1F4CF}"}),(0,D.jsx)("span",{className:"tracking-wide",children:n.levenshteinSettingsHeading})]}),(0,D.jsx)("button",{type:"button",onClick:()=>t(p=>({...p,levenshteinWorkerOptions:{threshold:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:"rounded border border-purple-300 bg-purple-100 px-2 py-1 font-medium text-purple-700 text-xs transition-colors hover:bg-purple-200 dark:border-purple-400/60 dark:bg-purple-900/20 dark:text-purple-200 dark:hover:bg-purple-800/30",title:n.resetToDefaultsTitle,children:n.reset})]}),(0,D.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});ea.displayName="LevenshteinWorkerSettings";var ie=require("react/jsx-runtime"),ii={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},ta=(0,Lo.memo)(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a,activeTab:o,onTabChange:d})=>{let l=J(),{setScrollableRef:c,onPointerDown:m,onPointerMove:u,onPointerUp:i,onPointerLeave:p,onPointerCancel:f,onClickCapture:T}=Ze();return(0,ie.jsxs)("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[(0,ie.jsxs)("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[(0,ie.jsxs)("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",l.searchSettings]}),(0,ie.jsx)("div",{className:"flex flex-wrap gap-1.5",children:(0,ie.jsxs)("button",{type:"button",onClick:()=>t(S=>Kn(S.workerUrls)),className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:l.settingsResetAllTitle,children:["\u{1F504} ",l.settingsResetAll]})})]}),(0,ie.jsx)("div",{className:"mb-0 shrink-0",children:(0,ie.jsxs)("div",{ref:c,role:"tablist","aria-label":l.settingsTabsLabel,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:ii,onPointerDown:m,onPointerMove:u,onPointerUp:i,onPointerLeave:p,onPointerCancel:f,onClickCapture:T,children:[(0,ie.jsxs)("button",{type:"button",role:"tab","aria-selected":o==="basic",onClick:()=>d("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",l.settingsBasicTab]}),(0,ie.jsxs)("button",{type:"button",role:"tab","aria-selected":o==="advanced",onClick:()=>d("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",l.settingsAdvancedTab]}),(0,ie.jsxs)("button",{type:"button",role:"tab","aria-selected":o==="index",onClick:()=>d("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",l.indexWorkerName]}),(0,ie.jsxs)("button",{type:"button",role:"tab","aria-selected":o==="levenshtein",onClick:()=>d("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",l.levenshteinWorkerName]})]})}),(0,ie.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ie.jsx)("div",{className:`${o==="basic"?"block":"hidden"}`,children:(0,ie.jsx)(Wn,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a})}),(0,ie.jsx)("div",{className:`${o==="advanced"?"block":"hidden"}`,children:(0,ie.jsx)(Dn,{searchOptions:e,setSearchOptions:t})}),(0,ie.jsx)("div",{className:`${o==="index"?"block":"hidden"}`,children:(0,ie.jsx)(Zn,{searchOptions:e,setSearchOptions:t})}),(0,ie.jsx)("div",{className:`${o==="levenshtein"?"block":"hidden"}`,children:(0,ie.jsx)(ea,{searchOptions:e,setSearchOptions:t})})]})]})});ta.displayName="SearchOptionsPanel";var aa=require("react");xt();ce();var Eo=require("react"),na=require("react/jsx-runtime"),O=(0,Eo.memo)(({label:e,value:t,unit:n,color:r="text-gray-600 dark:text-slate-300"})=>(0,na.jsxs)("div",{className:"wrap-break-word flex min-w-0 flex-col overflow-hidden text-gray-700 transition-colors sm:flex-row sm:justify-between dark:text-slate-200",children:[(0,na.jsxs)("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),(0,na.jsxs)("span",{className:`font-medium ${r} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));O.displayName="StatItem";var Oo=require("react");xt();ce();var x=require("react/jsx-runtime"),Nt=(0,Oo.memo)(({kind:e,icon:t,stats:n,color:r})=>{let{locale:s,labels:a}=Se(),o=E=>X(s,E);if(!n)return(0,x.jsx)("section",{className:"rounded-lg border border-gray-200 border-dashed bg-white/40 p-3 text-gray-400 text-xs transition-colors dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:a.statsNoData});let d=n.basic||{},l=n.workerSpecific||{},c=n.analysis||{},m=d.totalSearches??0,u=d.totalProcessingTime??0,i=d.averageSearchTime??0,p=d.lastSearchTime??0,f=d.errorCount??0,T=d.timestamp,S=c.fieldPerformance||{},w=c.performanceInsights||{},V=c.recentHistory||[],H=l.specificMetrics||{},y=l.operationCount??0,g=l.operationDistribution||{},$=e==="index",q=e==="levenshtein",k=$?a.indexWorkerName:a.levenshteinWorkerName,h=H,v=H,F="flex flex-col gap-1 rounded-lg border border-gray-200 bg-white/80 p-3 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",P="text-xs font-semibold transition-colors",ae=E=>{if(!E)return;let I=new Date(E);return Number.isNaN(I.getTime())?void 0:a.statsTimestamp(I)},L=[];if(L.push((0,x.jsxs)("div",{className:`${F} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[(0,x.jsxs)("div",{className:`${P} ${r}`,children:["\u{1F4CA} ",a.statsBasicHeading]}),(0,x.jsx)(O,{label:a.statTotalSearches,value:o(m),color:r}),(0,x.jsx)(O,{label:a.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:r}),(0,x.jsx)(O,{label:a.statTotalProcessingTime,value:u.toFixed(2),unit:"ms",color:r}),(0,x.jsx)(O,{label:a.statLastSearchTime,value:p.toFixed(2),unit:"ms",color:r}),(0,x.jsx)(O,{label:a.statErrorCount,value:f,color:f>0?"text-red-600 dark:text-red-400":r}),ae(T)&&(0,x.jsx)(O,{label:a.statUpdatedAt,value:ae(T),color:"text-gray-500 dark:text-slate-400"})]},"basic")),y>0||Object.keys(g).length>0){let E=Object.entries(g).sort(([,I],[,G])=>(Number(G)||0)-(Number(I)||0)).slice(0,6);L.push((0,x.jsxs)("div",{className:`${F} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",a.statsOperationsHeading]}),(0,x.jsx)(O,{label:a.statTotalOperations,value:o(y),color:"text-amber-700 dark:text-amber-300"}),E.length>0&&(0,x.jsx)("div",{className:"mt-1 space-y-1",children:E.map(([I,G])=>(0,x.jsx)(O,{label:I,value:o(Number(G)),unit:a.timesUnit(o(Number(G))),color:"text-amber-700 dark:text-amber-300"},I))})]},"operations"))}if($&&(L.push((0,x.jsxs)("div",{className:`${F} border-green-200 border-l-4 dark:border-green-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.statsIndexHeading]}),(0,x.jsx)(O,{label:a.statIndexBuilds,value:o(h.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),(0,x.jsx)(O,{label:a.statDataSize,value:o(h.currentDataSize??0),unit:a.itemsUnit(o(h.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),(0,x.jsx)(O,{label:a.statLastBuildTime,value:(h.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),h.cacheSize&&L.push((0,x.jsxs)("div",{className:`${F} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",a.statsCacheHeading]}),(0,x.jsx)(O,{label:a.statCacheNgram,value:o(h.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),(0,x.jsx)(O,{label:a.statCacheWord,value:o(h.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),(0,x.jsx)(O,{label:a.statCachePhonetic,value:o(h.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),h.indexMetadata)){let E=Object.entries(h.indexMetadata).slice(0,6);E.length>0&&L.push((0,x.jsxs)("div",{className:`${F} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",a.statsIndexMetadataHeading]}),E.map(([I,G])=>{let oe;if(typeof G=="number"){let ye=I.toLowerCase();ye.includes("time")&&!ye.includes("timestamp")?oe=`${G.toFixed(2)}ms`:ye.includes("timestamp")||ye.includes("at")?oe=ae(G)??G.toString():oe=o(G)}else oe=String(G);return(0,x.jsx)(O,{label:I,value:oe,color:"text-teal-700 dark:text-teal-300"},I)})]},"index-meta"))}if(q){if(L.push((0,x.jsxs)("div",{className:`${F} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",a.statsCalculationsHeading]}),(0,x.jsx)(O,{label:a.statTotalCalculations,value:o(v.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statDistanceCalculations,value:o(v.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statAverageDistance,value:typeof v.averageDistance=="number"?v.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statMinDistance,value:v.minDistance??a.notAvailable,color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statMaxDistance,value:v.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),L.push((0,x.jsxs)("div",{className:`${F} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",a.statsMatchesHeading]}),(0,x.jsx)(O,{label:a.statPartialMatches,value:o(v.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),(0,x.jsx)(O,{label:a.statPerfectMatches,value:o(v.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),(0,x.jsx)(O,{label:a.statEarlyTerminations,value:o(v.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),v.similarityThresholds&&L.push((0,x.jsxs)("div",{className:`${F} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",a.statsSimilarityHeading]}),(0,x.jsx)(O,{label:a.statAbove80,value:o(v.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),(0,x.jsx)(O,{label:a.statAbove60,value:o(v.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),(0,x.jsx)(O,{label:a.statAbove40,value:o(v.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),(0,x.jsx)(O,{label:a.statBelow40,value:o(v.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),v.distanceDistribution){let E=Object.entries(v.distanceDistribution).sort(([,I],[,G])=>Number(G)-Number(I)).slice(0,6);E.length>0&&L.push((0,x.jsxs)("div",{className:`${F} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[(0,x.jsxs)("div",{className:`${P} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",a.statsDistanceHeading]}),E.map(([I,G])=>(0,x.jsx)(O,{label:a.statDistance(I),value:o(Number(G)),unit:a.timesUnit(o(Number(G))),color:"text-indigo-700 dark:text-indigo-300"},I))]},"lev-distance"))}if(v.queryLengthStats){let E=Object.entries(v.queryLengthStats).sort(([,I],[,G])=>(G.count??0)-(I.count??0)).slice(0,6);E.length>0&&L.push((0,x.jsxs)("div",{className:`${F} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",a.statsQueryLengthHeading]}),E.map(([I,G])=>{let oe=Number(G.count??0),ye=Number(G.averageScore??0);return(0,x.jsx)(O,{label:a.statQueryLength(I),value:a.statQueryLengthValue({count:oe,averagePercent:(ye*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},I)})]},"lev-query-length"))}}if(Object.keys(S).length>0){let E=Object.entries(S).sort(([,I],[,G])=>(G.averageScore??0)-(I.averageScore??0)).slice(0,6);L.push((0,x.jsxs)("div",{className:`${F} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",a.statsFieldPerformanceHeading]}),E.map(([I,G])=>{let oe=G;return(0,x.jsxs)("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[(0,x.jsx)("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:I}),(0,x.jsx)(O,{label:a.statAverageScore,value:`${((oe.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statMatchCount,value:o(oe.matchCount??0),unit:a.itemsUnit(o(oe.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statBestWorstScore,value:`${((oe.bestScore??0)*100).toFixed(1)}% / ${((oe.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},I)})]},"field-performance"))}if(w.bestPerformingField||w.totalHistoryEntries||w.similarityDistribution){let E=(w.recentAverageResultCount??0).toFixed(1);L.push((0,x.jsxs)("div",{className:`${F} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.statsInsightsHeading]}),w.bestPerformingField&&(0,x.jsx)(O,{label:a.statBestField,value:w.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statRecentAverageTime,value:(w.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statRecentAverageResults,value:E,unit:a.itemsUnit(E),color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statThroughput,value:(w.throughputPerSecond??0).toFixed(2),unit:a.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statCommonQueryLength,value:o(w.mostCommonQueryLength??0),unit:a.charactersUnit(o(w.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statHistoryEntries,value:o(w.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),w.similarityDistribution&&(0,x.jsxs)("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[(0,x.jsx)(O,{label:a.statHighSimilarity,value:o(w.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),(0,x.jsx)(O,{label:a.statMediumSimilarity,value:o(w.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),(0,x.jsx)(O,{label:a.statLowSimilarity,value:o(w.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),(0,x.jsx)(O,{label:a.statVeryLowSimilarity,value:o(w.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return V.length>0&&L.push((0,x.jsxs)("div",{className:`${F} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",a.statsRecentHistoryHeading]}),V.slice(-3).reverse().map((E,I)=>(0,x.jsxs)("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[(0,x.jsx)("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:E.operationType}),(0,x.jsx)("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:a.statsHistoryEntry({processingTimeMs:E.processingTime.toFixed(2),resultCount:E.resultCount??0})}),ae(E.timestamp)&&(0,x.jsx)("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:ae(E.timestamp)})]},`${E.operationType}-${E.timestamp??I}`))]},"recent-history")),(0,x.jsxs)("section",{className:"space-y-2",children:[(0,x.jsxs)("div",{className:`flex items-center gap-2 font-semibold text-xs ${r}`,children:[(0,x.jsx)("span",{children:t}),(0,x.jsx)("span",{className:"tracking-wide",children:k})]}),(0,x.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:L})]})});Nt.displayName="WorkerStatsSection";var ne=require("react/jsx-runtime"),li={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},ra=(0,aa.memo)(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:r,resetStats:s,rebuildIndex:a,isIndexBuilding:o,activeTab:d,onTabChange:l})=>{let{locale:c,labels:m}=Se(),u=t.trim(),i=u?r:n,{setScrollableRef:p,onPointerDown:f,onPointerMove:T,onPointerUp:S,onPointerLeave:w,onPointerCancel:V,onClickCapture:H}=Ze(),y=d!=="index"||o,g=o?m.statsRebuildingTitle:d!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,$=y?"cursor-not-allowed bg-gray-300 text-gray-500 dark:bg-slate-700 dark:text-slate-400":"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-500 dark:hover:bg-blue-600",q=o?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`,k=(0,aa.useCallback)(()=>{a().catch(()=>{})},[a]);return(0,ne.jsxs)("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[(0,ne.jsxs)("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[(0,ne.jsxs)("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),(0,ne.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,ne.jsx)("button",{type:"button",onClick:k,disabled:y,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${$}`,title:g,children:q}),(0,ne.jsxs)("button",{type:"button",onClick:s,className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:m.statsResetTitle,children:["\u{1F504} ",m.reset]})]})]}),(0,ne.jsx)("div",{className:"mb-0 shrink-0",children:(0,ne.jsxs)("div",{ref:p,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:li,onPointerDown:f,onPointerMove:T,onPointerUp:S,onPointerLeave:w,onPointerCancel:V,onClickCapture:H,children:[(0,ne.jsxs)("button",{type:"button",onClick:()=>l("overview"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="overview"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CB} ",m.statsOverviewTab]}),(0,ne.jsxs)("button",{type:"button",onClick:()=>l("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",m.statsIndexTab]}),(0,ne.jsxs)("button",{type:"button",onClick:()=>l("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",m.statsLevenshteinTab]})]})}),(0,ne.jsxs)("div",{className:"flex flex-col gap-1 pb-0.5",children:[(0,ne.jsxs)("div",{className:`${d==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 text-gray-600 text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 dark:text-slate-300`,children:[(0,ne.jsx)(O,{label:m.statTotalSearches,value:X(c,e.totalSearches)}),(0,ne.jsx)(O,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),(0,ne.jsx)(O,{label:m.statDataCount,value:X(c,e.itemCount)}),(0,ne.jsx)(O,{label:u?m.statResultCount:m.statDisplayedCount,value:X(c,i)})]}),(0,ne.jsx)("div",{className:`${d==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:(0,ne.jsx)(Nt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),(0,ne.jsx)("div",{className:`${d==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:(0,ne.jsx)(Nt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),(0,ne.jsxs)("div",{className:"hidden",children:[(0,ne.jsx)(Nt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),(0,ne.jsx)(Nt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});ra.displayName="StatisticsPanel";var A=require("react/jsx-runtime"),di=/[\u200B\uFEFF]/g,Ga=typeof window<"u",Fo=Ga&&typeof document<"u",oa=(e,t=[],n=!1)=>{let r=(0,z.useRef)(e);r.current=e,(0,z.useEffect)(()=>{if(!(!Ga||n&&!Fo))return r.current()},[n,...t])},Do=(e,t,n)=>{let[r,s]=(0,z.useState)(()=>{let a=Wo(o=>o.getItem(e));return a&&t.includes(a)?a:n});return oa(()=>{Wo(a=>{a.setItem(e,r)})},[e,r]),[r,s]},Wo=e=>{if(!Ga)return null;try{return e(window.sessionStorage)}catch{return null}},Ho=(e,t)=>{let[n,r]=(0,z.useState)(e);return(0,z.useEffect)(()=>{let s=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},ci="contact-map.settings-tab",ui="contact-map.statistics-tab",pi=["basic","advanced","index","levenshtein"],mi=["overview","index","levenshtein"],_o=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],gi={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Qa=({streamState:e,...t}={})=>e===void 0?(0,A.jsx)(hi,{...t}):(0,A.jsx)(zo,{...t,streamState:e}),hi=e=>{let{context:t}=rn();return(0,A.jsx)(zo,{...e,streamState:t})},fi={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},zo=e=>{let{streamState:t,onFooterVisibilityChange:n,children:r}=e,s=ke(e,"workerUrls"),a=Ke(),{locale:o,labels:d}=Se(),{contactMapRecords:l,contactMapRecordMap:c,isStreamingComplete:m,isStreamingFailed:u}=t,i=(0,ia.useNavigation)(),[p]=(0,ia.useSearchParams)(),f=(0,z.useRef)(null),[T,S]=(0,z.useState)(!0),[w,V]=(0,z.useState)(a.openEmailsWithGmail??!1),{indexWorker:H,levenshteinWorker:y}=kt(a.workerUrls,s,fi),[g,$]=(0,z.useState)(()=>Kn({indexWorker:H,levenshteinWorker:y})),[q,k]=(0,z.useState)(p.get("q")||""),h=Ho(q,g.debounceMs??sa.DEFAULT_FUZZY_SEARCH_OPTIONS.debounceMs);(0,z.useEffect)(()=>{let K=p.get("q")||"";k(Y=>Y!==K?K:Y)},[p]),(0,z.useEffect)(()=>{if(typeof window>"u")return;let K=new URL(window.location.href);(K.searchParams.get("q")||"")!==h&&(h?K.searchParams.set("q",h):K.searchParams.delete("q"),window.history.replaceState(window.history.state,"",K.toString()))},[h]);let[v,F]=(0,z.useTransition)(),[P,ae]=(0,z.useState)("search"),[L,E]=Do(ci,pi,"basic"),[I,G]=Do(ui,mi,"overview"),{setScrollableRef:oe,onPointerDown:ye,onPointerMove:le,onPointerUp:Ee,onPointerLeave:gt,onPointerCancel:Mt,onClickCapture:gn}=Ze(),ge=(0,z.useCallback)(()=>{if(!Fo)return;let K=f.current;!K||document.activeElement===K||window.requestAnimationFrame(()=>{try{K.focus({preventScroll:!0})}catch{}})},[]),$t=(0,z.useCallback)(K=>{let Y=K;ae(Y),Y==="search"&&ge()},[ge]),we=(0,z.useMemo)(()=>({...g,debounceMs:0}),[g]),[at,hn]=(0,z.useState)("union"),qe=at==="intersection",la=qe?d.operatorAndTitle:d.operatorOrTitle,fn=(0,z.useCallback)(K=>(0,sa.parseQuerySets)(K,at),[at]),yn=(0,z.useMemo)(()=>({querySetsOf:fn}),[fn]),Vt=Ho(l,m?0:800),{searchTerm:re,setSearchTerm:bn,filteredItems:rt,resultTerm:Kt,isSearching:ot,isIndexBuilding:Ne,clearSearch:jt,resetStats:qt,performanceMetrics:Ie,rebuildIndex:st,error:Fe}=(0,Ao.useFuzzySearch)(Vt,_o,we,yn),ht=re.trim().length>0,[it,ft]=(0,z.useState)(""),[Pt,da]=(0,z.useState)(()=>re),lt=(0,z.useMemo)(()=>An(q),[q]),Ge=(0,z.useMemo)(()=>An(h),[h]);(0,z.useEffect)(()=>{h===it&&Ge===re||F(()=>{ft(h),bn(Ge)})},[h,it,Ge,re,bn]);let Gt=(0,z.useCallback)(K=>{let fe=K.target.value.replace(di,"");k(fe)},[]),ca=(0,z.useCallback)(()=>{k(""),ft(""),jt(),ge()},[jt,ge]),xn=(0,z.useCallback)(()=>{hn(K=>K==="intersection"?"union":"intersection"),ge()},[ge]);oa(()=>{if(!(P==="search"&&i.state==="idle"&&!v))return;let Y=document.activeElement;if(!!!(Y?.matches('[role="tab"]')||Y?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&Y&&Y!==document.body&&Y!==f.current)return;let ze=window.requestAnimationFrame(()=>{ge()});return()=>{window.cancelAnimationFrame(ze)}},[P,i.state,v,ge],!0),oa(()=>{if(P!=="search")return;let K=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ge()}],[window,"pageshow",()=>{ge()}]];for(let[Y,fe,ze]of K)Y.addEventListener(fe,ze);return()=>{for(let[Y,fe,ze]of K)Y.removeEventListener(fe,ze)}},[P,ge],!0),(0,z.useEffect)(()=>(n&&n(P==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[P,n]),oa(()=>{let K=document.body,Y=K.style.overflow;return P==="search"&&(K.style.overflow="hidden"),()=>{K.style.overflow=Y}},[P],!0),(0,z.useEffect)(()=>{Ie&&Ve.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:Ie.totalSearches,averageSearchTime:Ie.averageSearchTime,itemCount:Ie.itemCount,resultsCount:Ie.resultsCount,workersAvailable:!!Ie.workerStats})},[Ie]);let{isAwaitingDebounce:vn,isAwaitingSearchTermSync:Cn,isSearchInProgress:dt}=(0,z.useMemo)(()=>{let K=lt!==Ge,Y=Ge!==re,fe=re.trim().length>0||lt.trim().length>0;return{isAwaitingDebounce:K,isAwaitingSearchTermSync:Y,isSearchInProgress:v||ot||Kt!==re&&Fe===null||fe&&Ne||K||Y||Pt!==re}},[lt,Ge,re,Kt,Fe,v,ot,Ne,Pt]),[Rt,kn]=(0,z.useState)(re);(0,z.useEffect)(()=>{Rt!==re&&kn(re)},[re,Rt]),(0,z.useEffect)(()=>{vn||Cn||v||ot||Ne||Rt===re&&Pt!==re&&da(re)},[re,Pt,vn,Cn,v,ot,Ne,Rt]);let Sn=(0,z.useMemo)(()=>kr(it,_o),[it]),Tn=(0,z.useMemo)(()=>Sn(rt),[Sn,rt]),wn=(0,z.useMemo)(()=>({contactMapRecords:l,contactMapRecordMap:c,filteredItems:Tn,searchQuery:it,searchTerm:re,isSearching:ot,isIndexBuilding:Ne,isPending:v,hasSearchTerm:ht,enableHighlighting:T,openEmailsWithGmail:w,isSearchInProgress:dt,isSearchTabActive:P==="search",errorMessage:Fe??null,isStreamingComplete:m,isStreamingFailed:u}),[l,c,Tn,it,re,ot,Ne,v,ht,T,w,dt,P,Fe,m,u]),ua=ht?rt.length:l.length,Qt=X(o,l.length),W=X(o,rt.length);return(0,A.jsx)("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${P==="search"?" h-full min-h-0":""}`,children:(0,A.jsxs)(tn,{value:P,onValueChange:$t,className:`flex flex-col${P==="search"?" h-full min-h-0":""}`,children:[(0,A.jsxs)(Ft,{ref:oe,style:gi,className:"scrollbar-none mt-0 mb-1 flex w-full touch-pan-x flex-nowrap overflow-x-auto overflow-y-hidden rounded-md bg-slate-50 transition-colors dark:bg-slate-900/70 dark:text-slate-200",onPointerDown:ye,onPointerMove:le,onPointerUp:Ee,onPointerLeave:gt,onPointerCancel:Mt,onClickCapture:gn,children:[(0,A.jsxs)(pt,{value:"search",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F50D} ",d.searchTab]}),(0,A.jsxs)(pt,{value:"settings",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u2699\uFE0F ",d.searchSettings]}),(0,A.jsxs)(pt,{value:"statistics",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F4CA} ",d.searchStatistics]})]}),(0,A.jsx)(mt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:(0,A.jsxs)("div",{className:"flex h-full flex-col",children:[(0,A.jsx)("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:(0,A.jsxs)("div",{className:"flex flex-col",children:[(0,A.jsx)("div",{className:"relative",children:(0,A.jsxs)("div",{className:"flex items-center gap-1 p-1",children:[(0,A.jsxs)("button",{type:"button",onClick:xn,"aria-pressed":qe,title:la,className:`inline-flex min-w-9 items-center justify-center gap-0.5 rounded border px-1.5 py-0.5 font-semibold text-[10px] transition-colors sm:min-w-12 sm:px-2 sm:py-0.5 sm:text-xs ${qe?"border-blue-500 bg-blue-600 text-white hover:bg-blue-700 dark:border-blue-400 dark:bg-blue-500 dark:hover:bg-blue-600":"border-amber-400 bg-amber-100 text-amber-800 hover:bg-amber-200 dark:border-amber-500/70 dark:bg-amber-300/20 dark:text-amber-200 dark:hover:bg-amber-300/30"}`,children:[(0,A.jsx)("span",{className:"text-[10px] sm:text-xs",children:qe?d.operatorAnd:d.operatorOr}),(0,A.jsx)("span",{className:"hidden text-[10px] sm:inline",children:qe?d.operatorAndHint:d.operatorOrHint})]}),(0,A.jsx)("input",{ref:f,type:"text",value:q,onChange:Gt,placeholder:d.searchPlaceholder,className:"flex-1 rounded border border-gray-300 border-solid px-2 py-0.5 text-xs shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none"}),q&&(0,A.jsx)("button",{type:"button",onClick:ca,className:"flex items-center justify-center gap-1 rounded border border-gray-300 px-1.5 py-0.5 text-[10px] transition-colors hover:text-gray-700 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100",title:dt?d.searchBusyTitle:d.clearSearch,disabled:dt,children:dt?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Io.default,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),(0,A.jsx)("span",{className:"hidden sm:inline",children:d.searching})]}):"\u2715"})]})}),(0,A.jsxs)("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[d.registeredCountLabel," ",(0,A.jsx)("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:Qt})," ",d.recordUnit(Qt),Ne?(0,A.jsxs)("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",d.rebuildingIndex]}):null,Fe?(0,A.jsxs)("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",d.errorLabel,(0,A.jsx)("span",{className:"ml-1 break-all font-semibold",children:Fe})]}):null,ht&&(0,A.jsxs)("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",d.resultCountLabel,dt?(0,A.jsx)("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:d.searching}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:W}),(0,A.jsx)("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:d.resultUnit(W)})]})]})]}),(0,A.jsx)("div",{className:"h-2.5 px-2 pb-1.5",children:Ne?(0,A.jsx)(Da,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),r?r(wn):(0,A.jsx)(Ka,{context:wn})]})}),(0,A.jsx)(mt,{value:"settings",className:"mt-0",children:(0,A.jsx)(ta,{searchOptions:g,setSearchOptions:$,enableHighlighting:T,setEnableHighlighting:S,openEmailsWithGmail:w,setOpenEmailsWithGmail:V,activeTab:L,onTabChange:E})}),(0,A.jsx)(mt,{value:"statistics",className:"mt-0",children:(0,A.jsx)(ra,{performanceMetrics:Ie,searchTerm:re,totalDataCount:l.length,resultsCount:ua,resetStats:qt,rebuildIndex:st,isIndexBuilding:Ne,activeTab:I,onTabChange:G})})]})})};var je=require("react/jsx-runtime"),yi=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let r=J(),s=t===void 0?r.appTitle:t,{context:a,retryNow:o}=rn(),d=(0,je.jsx)($n,{recordCount:a.contactMapRecords.length,companyCount:a.companyCount,phase:a.streamPhase,loadedCount:a.loadedCount,totalCount:a.totalCount,errorMessage:a.errorMessage,onRetry:o});return(0,je.jsxs)("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:s,annotation:d}):(0,je.jsxs)("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[(0,je.jsx)("h1",{className:"font-bold text-xl",children:s}),d]}),(0,je.jsx)("div",{className:"min-h-0 flex-1",children:(0,je.jsx)(Qa,{streamState:a,onFooterVisibilityChange:n})})]})},bi=e=>{let t=Ke(),n=ke(e,"streamEndpoint"),r=ke(e,"workerUrls"),s=ke(e,"locale"),a=ke(e,"labels"),o=(0,Ya.useMemo)(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:kt(t.workerUrls,r,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:a===void 0?t.labels:a}),[t,n,r,s,a]),d=s!==void 0,l=a!==void 0,c=(0,Ya.useMemo)(()=>({locale:d?"ContactMapAppView locale":"locale",labels:l?"ContactMapAppView labels":"labels"}),[d,l]);return(0,je.jsx)(Ea,{config:o,chromeSurface:c,children:(0,je.jsx)(yi,{...e})})};xt();ce();function xi(){return!1}0&&(module.exports={AdvancedSearchSettings,BasicSearchSettings,CONTACT_MAP_LABEL_CATALOGS,CONTACT_MAP_LABEL_KEYS,ContactDetailGrid,ContactDetailPanel,ContactDetailPopup,ContactDetailRowLayout,ContactMapAnnotation,ContactMapAppView,ContactMapConfigProvider,ContactMapSearchListView,ContactMapSearchPage,ContactMapSearchTabGroup,ContactMapSearchTreeView,ContactMapStreamClient,HighlightedText,IndexWorkerSettings,LIST_COLLAPSE_THRESHOLD,LIST_DETAIL_PANEL_MIN_WIDTH,LIST_EXPAND_THRESHOLD,LIST_PANEL_MIN_WIDTH,LIST_RESIZE_HANDLE_THICKNESS,LevenshteinWorkerSettings,Progress,SearchOptionsPanel,StatItem,StatisticsPanel,SwipeOverlay,TREE_COLLAPSE_THRESHOLD,TREE_DETAIL_PANEL_MIN_WIDTH,TREE_EXPAND_THRESHOLD,TREE_PANEL_MIN_WIDTH,TREE_RESIZE_HANDLE_THICKNESS,Tabs,TabsContent,TabsList,TabsTrigger,TreeWorkerSession,WorkerStatsSection,assertContactMapStreamEndpoint,assertContactMapTreeWorkerUrl,assertContactMapWorkerUrls,composeTreeVirtualScrollOptions,contactMapShouldRevalidate,countContactMapCompanies,deserializeStreamRecord,getContactMapStreamClient,getTreeWorkerSession,layerContactMapWorkerUrls,resetContactMapStreamClientForTesting,resetTreeWorkerSessionForTesting,resolveContactMapLabels,useAnimatedNumber,useContactMapConfig,useContactMapLabels,useContactMapStream,useContactPanelSizing,useDynamicViewportHeight,useHorizontalDragScroll,useLongPressPopup,useReportPopupVisibility,useResponsiveTwoColumnLayout,useRowPopupRegistry,useStreamedContactMapContext,useTreeWorker});
|
|
1
|
+
"use strict";var $o=Object.create;var Pn=Object.defineProperty;var Vo=Object.getOwnPropertyDescriptor;var Ko=Object.getOwnPropertyNames;var jo=Object.getPrototypeOf,Go=Object.prototype.hasOwnProperty;var De=(e,t)=>()=>(e&&(t=e(e=0)),t);var Za=(e,t)=>{for(var n in t)Pn(e,n,{get:t[n],enumerable:!0})},er=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ko(t))!Go.call(e,s)&&s!==n&&Pn(e,s,{get:()=>t[s],enumerable:!(r=Vo(t,s))||r.enumerable});return e};var de=(e,t,n)=>(n=e!=null?$o(jo(e)):{},er(t||!e||!e.__esModule?Pn(n,"default",{value:e,enumerable:!0}):n,e)),qo=e=>er(Pn({},"__esModule",{value:!0}),e);var He,Rn,tr,Lt,Et,Jt,Qe,We,Ln,ha,fa,Be,Z,yt=De(()=>{"use strict";He=e=>{if(typeof e!="string")return null;let t=e.trim();return t.length>0?t:null},Rn=e=>!e||typeof e!="object"?null:"item"in e?e.item??null:"person_id"in e?e:null,tr=(e,t)=>{if(!e)return{value:null,fieldKey:null};for(let n of t){let r=He(e[n]);if(r)return{value:r,fieldKey:n}}return{value:null,fieldKey:null}},Lt=e=>tr(e,["custom_email","email"]),Et=e=>tr(e,["custom_mobile_phone_number","mobile_phone_number","company_phone_number"]),Jt=e=>{let t=He(e);if(!t)return null;let n=t.replace(/[^0-9+#*]/g,"");return n.length===0?null:`tel:${n}`},Qe=(e,t)=>{let n=He(e);return n?t?`https://mail.google.com/mail/?view=cm&fs=1&to=${encodeURIComponent(n)}`:`mailto:${encodeURIComponent(n)}`:null},We=(e,t)=>String(e).padStart(t,"0"),Ln=e=>`${We(e.getUTCFullYear(),4)}-${We(e.getUTCMonth()+1,2)}-${We(e.getUTCDate(),2)}`,ha=e=>`${Ln(e)} ${We(e.getUTCHours(),2)}:${We(e.getUTCMinutes(),2)}:${We(e.getUTCSeconds(),2)}`,fa=e=>`${We(e.getFullYear(),4)}-${We(e.getMonth()+1,2)}-${We(e.getDate(),2)} ${We(e.getHours(),2)}:${We(e.getMinutes(),2)}:${We(e.getSeconds(),2)}`,Be=(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)},Z=e=>e==null?"-":typeof e=="string"?He(e)??"-":typeof e=="number"?Number.isFinite(e)?String(e):"-":String(e)});var se,nr,Ot=De(()=>{"use strict";se=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":nr(e);case"function":return nr(e);case"number":return Object.is(e,-0)?"-0":String(e);default:return String(e)}},nr=e=>{try{return Object.prototype.toString.call(e)}catch{return"[object ?]"}}});var Dt,ke,Wt=De(()=>{"use strict";Dt=e=>{if(typeof e!="object"||e===null)return!1;try{let t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}catch{return!1}},ke=(e,t)=>Object.hasOwn(e,t)?e[t]:void 0});var Qo,En,ya=De(()=>{"use strict";Qo=(e,t)=>{let n=Array.from({length:t.length+1},(r,s)=>s);for(let r=1;r<=e.length;r+=1){let s=[r];for(let a=1;a<=t.length;a+=1){let o=n[a-1]+(e[r-1]===t[a-1]?0:1);s.push(Math.min(n[a]+1,s[a-1]+1,o))}n=s}return n[t.length]},En=(e,t)=>{let n=e.toLowerCase();if(n.length>=3){let s=t.find(a=>a.toLowerCase().startsWith(n));if(s!==void 0)return s}let r;for(let s of t){let a=Qo(n,s.toLowerCase());a<=Math.max(1,Math.floor(s.length/4))&&(r===void 0||a<r.distance)&&(r={key:s,distance:a})}return r?.key}});var Ye,Dn,Yo,X,bt,On,rr,Ht,Ue,Xo,ar,or,Jo,ba,Zo,es,ts,Wn,xa,va,xt=De(()=>{"use strict";Ye=require("@aiquants/directory-tree"),Dn=require("@aiquants/virtualscroll");yt();Ot();Wt();ya();Yo=Object.freeze({en:"en-US",ja:"ja-JP"}),X=(e,t)=>t.toLocaleString(Yo[e]),bt=(e,t,n)=>e==="1"?t:n,On=Object.freeze({en:Object.freeze({appTitle:"Contact Map",annotationTotalLabel:"Total:",annotationCompaniesLabel:"Companies:",annotationStreamingProgress:({loaded:e,total:t,percent:n})=>`Streaming (${X("en",e)} / ${X("en",t)} \xB7 ${n}%)`,annotationStreamingCount:e=>`Streaming (${X("en",e)} loaded)`,annotationLoadFailed:e=>`Failed to load (${X("en",e)} received)`,annotationReconnecting:e=>`Reconnecting (${X("en",e)} received)`,annotationAuthRequired:"Session expired: sign in again, then retry",annotationRetry:"Retry",recordUnit:e=>bt(e,"record","records"),companyUnit:e=>bt(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=>bt(e,"match","matches"),listViewTab:"List",treeViewTab:"Tree",columnNo:"No",columnId:"ID",columnScore:"Score",columnName:"Name",columnTitle:"Title",columnCompany:"Company",columnDepartment:"Department",columnPhone:"Phone",columnEmail:"Email",columnUpdatedAt:"Updated",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"No search results found",listNoData:"No data",listResizeHandle:"Resize the border between the contact list and the detail pane",detailHeading:"Contact details",close:"Close",noName:"(No Name)",treeNodeCountTitle:"Number of nodes built in the tree view",treeNodeCountLabel:"Nodes:",treeNodeCount:e=>X("en",e),uncategorizedCompany:"Uncategorized",treeDirectoryName:(e,t)=>`${e} (${X("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:ha,recordDate:Ln,popupCustomMobilePhone:"Mobile (custom)",popupMobilePhone:"Mobile",popupCustomCompanyPhone:"Company phone (custom)",popupCompanyPhone:"Company phone",popupCustomEmail:"Email (custom)",popupEmail:"Email",popupGmailHint:"Double-click or double-tap to open Gmail",popupLastContactDate:"Last contact:",popupNoContactMethods:"No contact information to display",overlayTitle:"Details",overlayBackdrop:"Tap the background to close",settingsResetAllTitle:"Reset all settings",settingsResetAll:"Reset all",settingsTabsLabel:"Search option tabs",settingsBasicTab:"Basic settings",settingsAdvancedTab:"Advanced settings",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"Current:",resetToDefaultsTitle:"Reset to defaults",reset:"Reset",relevanceOnlyNotice:"Editable only when sorting by relevance",relevanceWeightsHeading:"Relevance score weights",fieldWeight:"Field weight",scoreTuningHeading:"Score tuning",maxResults:"Maximum results",noLimit:"No limit",basicThresholdHeading:"Final similarity threshold",basicThresholdLabel:"Adjust the minimum score",basicThresholdRangeRelevance:"In relevance mode a score can exceed 1.0 (range: 0.0-1.5)",basicThresholdRange:"Range: 0.0-1.0",basicDisplayHeading:"Display options",basicCaseSensitive:"Case-sensitive",basicHighlight:"Highlight matches",basicOpenEmailsWithGmail:"Open email addresses in Gmail compose",basicMultiTermOperator:"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",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:fa,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=X("en",e);return`${n} ${bt(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: ${X("en",t)}`,timesUnit:e=>bt(e," time"," times"),itemsUnit:e=>bt(e," item"," items"),charactersUnit:e=>bt(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 (${X("ja",e)} / ${X("ja",t)} \u4EF6\u30FB${n}%)`,annotationStreamingCount:e=>`\u30B9\u30C8\u30EA\u30FC\u30DF\u30F3\u30B0\u8AAD\u307F\u8FBC\u307F\u4E2D (${X("ja",e)} \u4EF6)`,annotationLoadFailed:e=>`\u8AAD\u307F\u8FBC\u307F\u306B\u5931\u6557\u3057\u307E\u3057\u305F (${X("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationReconnecting:e=>`\u518D\u63A5\u7D9A\u4E2D (${X("ja",e)} \u4EF6\u53D7\u4FE1\u6E08)`,annotationAuthRequired:"\u30BB\u30C3\u30B7\u30E7\u30F3\u304C\u5207\u308C\u307E\u3057\u305F\u3002\u30B5\u30A4\u30F3\u30A4\u30F3\u3057\u76F4\u3057\u3066\u304B\u3089\u518D\u8A66\u884C\u3057\u3066\u304F\u3060\u3055\u3044",annotationRetry:"\u518D\u8A66\u884C",recordUnit:()=>"\u4EF6",companyUnit:()=>"\u793E",searchTab:"\u3042\u3044\u307E\u3044\u691C\u7D22",searchSettings:"\u691C\u7D22\u8A2D\u5B9A",searchStatistics:"\u691C\u7D22\u7D71\u8A08",operatorAndTitle:"AND \u691C\u7D22 (\u3059\u3079\u3066\u4E00\u81F4)",operatorOrTitle:"OR \u691C\u7D22 (\u3044\u305A\u308C\u304B\u4E00\u81F4)",operatorAnd:"AND",operatorOr:"OR",operatorAndHint:"\u5168\u8A9E\u4E00\u81F4",operatorOrHint:"\u3044\u305A\u308C\u304B\u4E00\u81F4",searchPlaceholder:"\u3042\u3044\u307E\u3044\u691C\u7D22...",searchBusyTitle:"\u691C\u7D22\u51E6\u7406\u4E2D",clearSearch:"\u691C\u7D22\u3092\u30AF\u30EA\u30A2",searching:"\u691C\u7D22\u4E2D...",registeredCountLabel:"\u767B\u9332\u4EF6\u6570:",rebuildingIndex:"\u30A4\u30F3\u30C7\u30C3\u30AF\u30B9\u518D\u69CB\u7BC9\u4E2D...",errorLabel:"\u30A8\u30E9\u30FC:",resultCountLabel:"\u691C\u7D22\u7D50\u679C:",resultUnit:()=>"\u4EF6",listViewTab:"\u4E00\u89A7",treeViewTab:"\u30C4\u30EA\u30FC",columnNo:"No",columnId:"ID",columnScore:"\u30B9\u30B3\u30A2",columnName:"\u6C0F\u540D",columnTitle:"\u5F79\u8077",columnCompany:"\u4F1A\u793E\u540D",columnDepartment:"\u90E8\u7F72",columnPhone:"\u96FB\u8A71\u756A\u53F7",columnEmail:"\u30E1\u30FC\u30EB",columnUpdatedAt:"\u66F4\u65B0\u65E5\u6642",listRowNumber:e=>`No. ${e}`,listNoSearchResults:"\u691C\u7D22\u7D50\u679C\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093",listNoData:"\u30C7\u30FC\u30BF\u304C\u3042\u308A\u307E\u305B\u3093",listResizeHandle:"\u9023\u7D61\u5148\u4E00\u89A7\u3068\u8A73\u7D30\u30DA\u30A4\u30F3\u306E\u5883\u754C\u306E\u30B5\u30A4\u30BA\u5909\u66F4\u30CF\u30F3\u30C9\u30EB",detailHeading:"\u9023\u7D61\u5148\u8A73\u7D30",close:"\u9589\u3058\u308B",noName:"\u540D\u524D\u672A\u8A2D\u5B9A",treeNodeCountTitle:"\u30C4\u30EA\u30FC\u30D3\u30E5\u30FC\u3067\u69CB\u7BC9\u3055\u308C\u305F\u5168\u30CE\u30FC\u30C9\u6570",treeNodeCountLabel:"\u30CE\u30FC\u30C9:",treeNodeCount:e=>`${X("ja",e)} \u500B`,uncategorizedCompany:"\u672A\u5206\u985E",treeDirectoryName:(e,t)=>`${e} (${X("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:ha,recordDate:Ln,popupCustomMobilePhone:"\u643A\u5E2F\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupMobilePhone:"\u643A\u5E2F\u96FB\u8A71",popupCustomCompanyPhone:"\u4F1A\u793E\u96FB\u8A71 (\u30AB\u30B9\u30BF\u30E0)",popupCompanyPhone:"\u4F1A\u793E\u96FB\u8A71",popupCustomEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9 (\u30AB\u30B9\u30BF\u30E0)",popupEmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9",popupGmailHint:"\u30C0\u30D6\u30EB\u30AF\u30EA\u30C3\u30AF\u307E\u305F\u306F\u4E8C\u5EA6\u30BF\u30C3\u30D7\u3067 Gmail \u3092\u958B\u304D\u307E\u3059",popupLastContactDate:"\u6700\u7D42\u30B3\u30F3\u30BF\u30AF\u30C8\u65E5:",popupNoContactMethods:"\u8868\u793A\u3067\u304D\u308B\u9023\u7D61\u5148\u60C5\u5831\u304C\u3042\u308A\u307E\u305B\u3093",overlayTitle:"\u8A73\u7D30",overlayBackdrop:"\u80CC\u666F\u3092\u30BF\u30C3\u30D7\u3057\u3066\u9589\u3058\u308B",settingsResetAllTitle:"\u3059\u3079\u3066\u306E\u8A2D\u5B9A\u3092\u30EA\u30BB\u30C3\u30C8",settingsResetAll:"\u3059\u3079\u3066\u30EA\u30BB\u30C3\u30C8",settingsTabsLabel:"\u691C\u7D22\u30AA\u30D7\u30B7\u30E7\u30F3\u8A2D\u5B9A\u30BF\u30D6",settingsBasicTab:"\u57FA\u672C\u8A2D\u5B9A",settingsAdvancedTab:"\u8A73\u7D30\u8A2D\u5B9A",indexWorkerName:"Index Worker",levenshteinWorkerName:"Levenshtein Worker",currentValueLabel:"\u73FE\u5728\u5024:",resetToDefaultsTitle:"\u30C7\u30D5\u30A9\u30EB\u30C8\u5024\u306B\u30EA\u30BB\u30C3\u30C8",reset:"\u30EA\u30BB\u30C3\u30C8",relevanceOnlyNotice:"Relevance \u30BD\u30FC\u30C8\u6642\u306E\u307F\u5909\u66F4\u53EF\u80FD",relevanceWeightsHeading:"Relevance \u30B9\u30B3\u30A2\u91CD\u307F",fieldWeight:"\u30D5\u30A3\u30FC\u30EB\u30C9\u91CD\u307F",scoreTuningHeading:"\u30B9\u30B3\u30A2\u8ABF\u6574",maxResults:"\u6700\u5927\u7D50\u679C\u6570",noLimit:"\u4E0A\u9650\u306A\u3057",basicThresholdHeading:"\u6700\u7D42\u985E\u4F3C\u5EA6\u95BE\u5024",basicThresholdLabel:"\u30B9\u30B3\u30A2\u306E\u4E0B\u9650\u3092\u8ABF\u6574",basicThresholdRangeRelevance:"Relevance \u30E2\u30FC\u30C9\u3067\u306F\u30B9\u30B3\u30A2\u304C 1.0 \u3092\u8D85\u3048\u308B\u5834\u5408\u304C\u3042\u308A\u307E\u3059 (\u7BC4\u56F2: 0.0-1.5)",basicThresholdRange:"\u7BC4\u56F2: 0.0-1.0",basicDisplayHeading:"\u8868\u793A\u30AA\u30D7\u30B7\u30E7\u30F3",basicCaseSensitive:"\u5927\u6587\u5B57\u5C0F\u6587\u5B57\u3092\u533A\u5225",basicHighlight:"\u30CF\u30A4\u30E9\u30A4\u30C8\u8868\u793A",basicOpenEmailsWithGmail:"\u30E1\u30FC\u30EB\u30A2\u30C9\u30EC\u30B9\u3092 Gmail \u306E\u4F5C\u6210\u753B\u9762\u3067\u958B\u304F",basicMultiTermOperator:"\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",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:fa,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})=>`${X("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: ${X("ja",t)} \u4EF6`,timesUnit:()=>" \u56DE",itemsUnit:()=>" \u4EF6",charactersUnit:()=>" \u6587\u5B57",throughputUnit:" ops/\u79D2"})}),rr=Object.freeze(Object.keys(On.en)),Ht=Object.freeze([...Ye.DIRECTORY_TREE_LABEL_KEYS,...rr]),Ue=Object.freeze({en:Object.freeze({...Ye.DIRECTORY_TREE_LABEL_CATALOGS.en,...On.en}),ja:Object.freeze({...Ye.DIRECTORY_TREE_LABEL_CATALOGS.ja,...On.ja})}),Xo=new Set(Ht),ar=Object.keys(Ue).map(e=>JSON.stringify(e)).join(" or "),or=Object.freeze({locale:"locale",labels:"labels"}),Jo=(e,t,n)=>{e[t]=n},ba=(e,t=or.locale)=>{if(e!==void 0&&typeof e!="string")throw new TypeError(`[contact-map] ${t} must be ${ar} or left out; got ${se(e)}`);if(e!==void 0&&!Object.hasOwn(Ue,e))throw new RangeError(`[contact-map] ${t} must be ${ar} or left out; got ${se(e)}`);return(0,Dn.resolveVirtualScrollLocale)(e)},Zo=(e,t,n,r)=>{if(typeof r=="function"){if(typeof n!="function")throw new TypeError(`[contact-map] ${e}.${t} must be a function; got ${se(n)}`);return}if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string; got ${se(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${se(n)}`)},es=(e,t,n)=>{let r=Object.create(null);for(let s of Object.getOwnPropertyNames(e)){if(!Xo.has(s)){let o=En(s,Ht);throw new RangeError(`[contact-map] ${n} has a key that is not a label key (${o===void 0?"":`did you mean ${JSON.stringify(o)}? `}CONTACT_MAP_LABEL_KEYS lists every key); got ${se(s)}`)}let a=e[s];a!==void 0&&(Zo(n,s,a,t[s]),r[s]=a)}return r},ts=e=>{let t={},n=!1;for(let r of Ye.DIRECTORY_TREE_LABEL_KEYS){let s=e[r];s!==void 0&&(t[r]=s,n=!0)}return n?t:void 0},Wn=(e,t,n=or)=>{let r=ba(e,n.locale);if(t===void 0)return Ue[r];if(!Dt(t))throw new TypeError(`[contact-map] ${n.labels} must be a plain object or left out; got ${se(t)}`);let s=es(t,Ue[r],n.labels),o={...(0,Ye.resolveDirectoryTreeLabels)(r,ts(s)),...On[r]};for(let d of rr){let l=s[d];l!==void 0&&Jo(o,d,l)}return Object.freeze(o)},xa=e=>{let t={};for(let n of Ye.DIRECTORY_TREE_LABEL_KEYS)t[n]=e[n];return Object.freeze(t)},va=e=>{let t={};for(let n of Dn.VIRTUAL_SCROLL_LABEL_KEYS)t[n]=e[n];return Object.freeze(t)}});var sr,ir,$e,dr,ns,ka,Ca,lr,Se,J,ce=De(()=>{"use strict";sr=require("@aiquants/directory-tree"),ir=require("@aiquants/virtualscroll"),$e=require("react");xt();dr=require("react/jsx-runtime"),ns=Object.freeze({locale:"en",labels:Ue.en,treeLabels:xa(Ue.en),engineLabels:va(Ue.en)}),ka=(0,$e.createContext)(ns),Ca=(e,t)=>{let n=(0,$e.useRef)(null),r=n.current;return r!==null&&t.every(s=>r[s]===e[s])?r:(n.current=e,e)},lr=({locale:e,labels:t,surface:n,children:r})=>{let s=ba(e,n.locale),a=(0,$e.useMemo)(()=>Wn(s,t,n),[s,t,n]),o=Ca(a,Ht),d=Ca(xa(o),sr.DIRECTORY_TREE_LABEL_KEYS),l=Ca(va(o),ir.VIRTUAL_SCROLL_LABEL_KEYS),c=(0,$e.useMemo)(()=>({locale:s,labels:o,treeLabels:d,engineLabels:l}),[s,o,d,l]);return(0,dr.jsx)(ka.Provider,{value:c,children:r})},Se=()=>(0,$e.useContext)(ka),J=()=>(0,$e.useContext)(ka).labels});var An,Sa=De(()=>{"use strict";An=e=>e.isComposing||e.keyCode===229});var ur,mr,gr,te,hr,B,as,cr,en,At,rs,os,_t,Ta,pr,wa,tn,Na=De(()=>{"use strict";ur=de(require("lucide-react/dist/esm/icons/check.js")),mr=de(require("lucide-react/dist/esm/icons/copy.js")),gr=de(require("lucide-react/dist/esm/icons/x.js")),te=require("react"),hr=require("react-dom");yt();ce();Sa();B=require("react/jsx-runtime"),as=350,cr=["dblclick","pointerdown","pointerup","mousedown","mouseup","touchstart","touchend","contextmenu"],en=0,At=null,rs=()=>{let e=document.body.style;en+=1,en===1&&(At={userSelect:e.userSelect,webkitUserSelect:e.webkitUserSelect}),e.userSelect="none",typeof e.webkitUserSelect<"u"&&(e.webkitUserSelect="none")},os=()=>{if(en=Math.max(0,en-1),en>0||!At)return;let e=document.body.style;e.userSelect=At.userSelect,typeof At.webkitUserSelect<"u"&&(e.webkitUserSelect=At.webkitUserSelect),At=null},_t=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},Ta=(e,t)=>{let n=new Set;return e.reduce((r,s)=>{let a=typeof s.value=="string"?s.value.trim():"";if(!a)return r;let{normalized:o,key:d,entry:l}=t(a,s);return o&&!n.has(d)&&(n.add(d),r.push(l(o))),r},[])},pr=(e,t)=>e===t,wa=({value:e,ariaLabel:t,size:n="md"})=>{let[r,s]=(0,te.useState)(!1),a=(0,te.useRef)(null),o=(0,te.useCallback)(async p=>{if(typeof navigator<"u"&&navigator.clipboard?.writeText)try{return await navigator.clipboard.writeText(p),!0}catch{}if(typeof document>"u")return!1;let i=document.createElement("textarea");i.value=p,i.setAttribute("readonly",""),i.style.position="absolute",i.style.left="-9999px",document.body.appendChild(i),i.select(),i.setSelectionRange(0,i.value.length);let u=document.execCommand("copy");return document.body.removeChild(i),u},[]),d=(0,te.useCallback)(async p=>{p.preventDefault(),p.stopPropagation(),a.current!==null&&typeof window<"u"&&(window.clearTimeout(a.current),a.current=null);let i=await o(e);s(i),i&&typeof window<"u"&&(a.current=window.setTimeout(()=>{s(!1),a.current=null},1500))},[o,e]);(0,te.useEffect)(()=>()=>{a.current!==null&&typeof window<"u"&&(window.clearTimeout(a.current),a.current=null)},[]);let l=n==="sm"?"h-6 w-6":"h-7 w-7",c=n==="sm"?"h-3.5 w-3.5":"h-4 w-4",m=r?ur.default:mr.default;return(0,B.jsx)("button",{type:"button",className:`inline-flex ${l} shrink-0 items-center justify-center rounded-md border border-gray-200 text-slate-600 transition-colors hover:bg-gray-100 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-blue-200 dark:text-slate-300`,onClick:d,"aria-label":t,title:t,children:(0,B.jsx)(m,{className:c,"aria-hidden":"true"})})},tn=({contactData:e,openEmailsWithGmail:t,openGmailCompose:n,onRequestClose:r})=>{let s=J(),[a,o]=(0,te.useState)(null);(0,te.useEffect)(()=>{o(document.body)},[]);let d=(0,te.useRef)(null),l=(0,te.useRef)(null),c=(0,te.useMemo)(()=>e.contacted_at?Be(e.contacted_at,s.recordDate):null,[e.contacted_at,s.recordDate]),m=_t(e.full_name)??s.noName,p=_t(e.company_name),i=_t(e.department),u=_t(e.title),f=(0,te.useMemo)(()=>Ta([{fieldKey:"company_name",label:s.fieldCompanyName,value:p},{fieldKey:"department",label:s.fieldDepartment,value:i},{fieldKey:"title",label:s.fieldTitle,value:u}],(h,{fieldKey:v,label:F})=>({normalized:h,key:`${v}-${h.toLowerCase()}`,entry:P=>({fieldKey:v,label:F,value:P})})),[p,i,u,s]),T=(0,te.useMemo)(()=>Ta([{fieldKey:"custom_mobile_phone_number",label:s.popupCustomMobilePhone,value:e.custom_mobile_phone_number},{fieldKey:"mobile_phone_number",label:s.popupMobilePhone,value:e.mobile_phone_number},{fieldKey:"custom_company_phone_number",label:s.popupCustomCompanyPhone,value:e.custom_company_phone_number},{fieldKey:"company_phone_number",label:s.popupCompanyPhone,value:e.company_phone_number}],(h,{fieldKey:v,label:F})=>{let P=Jt(h);return{normalized:_t(h),key:(P??h).toLowerCase(),entry:L=>({fieldKey:v,label:F,value:L,href:P})}}),[e.custom_mobile_phone_number,e.mobile_phone_number,e.custom_company_phone_number,e.company_phone_number,s]),S=(0,te.useMemo)(()=>Ta([{fieldKey:"custom_email",label:s.popupCustomEmail,value:e.custom_email},{fieldKey:"email",label:s.popupEmail,value:e.email}],(h,{fieldKey:v,label:F})=>{let P=_t(h),ae=Qe(h,t),L=!!ae?.startsWith("https://mail.google.com");return{normalized:P,key:h.toLowerCase(),entry:E=>({fieldKey:v,label:F,value:E,href:ae,isGmailLink:L})}}),[e.custom_email,e.email,t,s]),w=T.length>0||S.length>0,V=(0,te.useMemo)(()=>`contact-methods-${e.person_id}`,[e.person_id]),H=(0,te.useCallback)(h=>{r(h),l.current=null},[r]),y=(0,te.useCallback)(h=>{h.stopPropagation(),pr(h.target,h.currentTarget)&&H()},[H]),g=(0,te.useCallback)(h=>{h.stopPropagation(),pr(h.target,h.currentTarget)&&(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),H())},[H]),$=(0,te.useCallback)(h=>{h.stopPropagation(),H()},[H]),G=(0,te.useCallback)((h,v)=>{v.isGmailLink&&(h.preventDefault(),n(v.value))},[n]),k=(0,te.useCallback)((h,v)=>{if(!v.isGmailLink){l.current=null;return}let F=Date.now(),P=l.current;if(P&&P.email===v.value&&F-P.timestamp<=as){l.current=null,h.preventDefault(),n(v.value);return}l.current={email:v.value,timestamp:F}},[n]);return(0,te.useEffect)(()=>{let h=[];if(typeof window<"u"){let v=F=>{if(F.key==="Escape"&&!An(F)){H();return}if(F.key==="Tab"&&d.current){let P=d.current.querySelectorAll('a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])');if(P.length===0)return;let ae=P[0],L=P[P.length-1];F.shiftKey?document.activeElement===ae&&(F.preventDefault(),L.focus()):document.activeElement===L&&(F.preventDefault(),ae.focus())}};window.addEventListener("keydown",v),h.push(()=>window.removeEventListener("keydown",v))}if(typeof document<"u"){let v=d.current;if(v){let L=E=>{E.stopPropagation()};for(let E of cr)v.addEventListener(E,L);h.push(()=>{for(let E of cr)v.removeEventListener(E,L)})}let F=L=>{let E=d.current;return E&&L instanceof Node?E.contains(L):!1},P=L=>{F(L.target)||H({suppressLongPress:!0,cancelLongPressTimer:!0})},ae=["pointerdown","wheel","touchmove"];for(let L of ae)document.addEventListener(L,P,!0);h.push(()=>{for(let L of ae)document.removeEventListener(L,P,!0)}),rs(),h.push(os)}return()=>{for(let v of h)v()}},[H,a]),a?(0,hr.createPortal)((0,B.jsx)("div",{"data-contact-popup-root":"true",className:"fixed top-0 right-0 bottom-0 left-0 z-50 flex items-center justify-center bg-black/50 px-4 py-6",style:{right:"var(--aqcm-overlay-right, 0px)",transition:"right 0.5s"},role:"dialog","aria-modal":"true","aria-labelledby":V,tabIndex:-1,onClick:y,onKeyDown:g,children:(0,B.jsxs)("div",{ref:d,className:"w-full max-w-md rounded-lg border border-slate-200 bg-white p-4 shadow-lg transition-colors dark:border-transparent dark:bg-slate-900 dark:shadow-slate-950/40 dark:ring-1 dark:ring-white/70",children:[(0,B.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,B.jsxs)("div",{children:[(0,B.jsx)("h2",{id:V,className:"font-semibold text-gray-900 text-lg dark:text-slate-100",children:m}),f.length>0?(0,B.jsx)("div",{className:"mt-2 space-y-2 text-slate-700 text-sm dark:text-slate-200",children:f.map(h=>(0,B.jsxs)("div",{className:"flex items-center gap-3",children:[(0,B.jsx)("p",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.value}),(0,B.jsx)(wa,{value:h.value,ariaLabel:s.copyField(h.label),size:"sm"})]},h.fieldKey))}):null]}),(0,B.jsx)("button",{type:"button",className:"rounded-md p-0.5 text-slate-600 transition-colors hover:bg-gray-100 focus:outline-none focus-visible:ring focus-visible:ring-blue-200 dark:text-slate-300 dark:hover:bg-slate-800/70",onClick:$,"aria-label":s.close,children:(0,B.jsx)(gr.default,{className:"h-4 w-4","aria-hidden":"true"})})]}),(0,B.jsxs)("div",{className:"mt-4 space-y-4 text-slate-700 dark:text-slate-200",children:[T.length>0?(0,B.jsx)("div",{children:(0,B.jsx)("ul",{className:"space-y-3 text-sm",children:T.map(h=>(0,B.jsx)("li",{className:"flex items-start gap-3",children:(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsx)("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),(0,B.jsxs)("div",{className:"mt-1 flex items-center gap-3",children:[(0,B.jsx)("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:h.href?(0,B.jsx)("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",children:h.value}):(0,B.jsx)("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value})}),(0,B.jsx)(wa,{value:h.value,ariaLabel:s.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,S.length>0?(0,B.jsx)("div",{children:(0,B.jsx)("ul",{className:"space-y-3 text-sm",children:S.map(h=>(0,B.jsx)("li",{className:"flex items-start gap-3",children:(0,B.jsxs)("div",{className:"flex-1",children:[(0,B.jsx)("span",{className:"text-slate-600 text-xs dark:text-slate-300",children:h.label}),(0,B.jsxs)("div",{className:"mt-1 flex items-start gap-3",children:[(0,B.jsxs)("div",{className:"wrap-break-word min-w-0 flex-1 whitespace-normal",children:[h.href?(0,B.jsx)("a",{href:h.href,className:"wrap-break-word text-blue-600 underline-offset-2 transition-colors hover:underline focus:underline focus:outline-none dark:text-blue-300",target:h.isGmailLink?"_blank":void 0,rel:h.isGmailLink?"noopener noreferrer":void 0,onDoubleClick:v=>G(v,h),onTouchEnd:v=>k(v,h),children:h.value}):(0,B.jsx)("span",{className:"wrap-break-word text-slate-800 dark:text-slate-100",children:h.value}),h.isGmailLink?(0,B.jsx)("span",{className:"mt-1 block text-[11px] text-slate-500 dark:text-slate-400",children:s.popupGmailHint}):null]}),(0,B.jsx)(wa,{value:h.value,ariaLabel:s.copyField(h.label),size:"sm"})]})]})},`${h.fieldKey}-${h.value}`))})}):null,c?(0,B.jsxs)("div",{className:"mt-2 flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[(0,B.jsx)("span",{className:"text-xs",children:s.popupLastContactDate}),(0,B.jsx)("span",{children:c})]}):null,w?null:(0,B.jsx)("p",{className:"text-slate-600 text-sm dark:text-slate-300",children:s.popupNoContactMethods})]})]})}),a):null}});var ue,nn,Ma=De(()=>{"use strict";ue=require("react/jsx-runtime"),nn=({fullName:e,title:t="-",companyName:n="-",department:r="-",phoneNumber:s="-",email:a="-",updatedAtText:o="-"})=>(0,ue.jsxs)("div",{className:"flex h-full w-full flex-col justify-center gap-0.5 text-slate-800 text-xs leading-tight transition-colors sm:grid sm:grid-cols-3 sm:gap-2 sm:text-sm xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[(0,ue.jsxs)("div",{className:"flex items-center gap-1 sm:hidden",children:[(0,ue.jsx)("div",{className:"flex-1 truncate font-medium text-gray-900 text-sm leading-tight dark:text-slate-100",children:e}),(0,ue.jsx)("div",{className:"shrink-0 whitespace-nowrap text-[11px] text-slate-600 dark:text-slate-300",children:s})]}),(0,ue.jsx)("div",{className:"flex items-center gap-1 sm:hidden",children:(0,ue.jsx)("div",{className:"flex-1 truncate text-slate-700 text-xs leading-tight dark:text-slate-200",children:n})}),(0,ue.jsx)("div",{className:"block sm:hidden",children:(0,ue.jsx)("span",{className:"w-full truncate text-left text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:r})}),(0,ue.jsxs)("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[(0,ue.jsx)("span",{className:"truncate font-medium text-gray-900 dark:text-slate-100",children:e}),(0,ue.jsx)("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:t})]}),(0,ue.jsxs)("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[(0,ue.jsx)("span",{className:"truncate text-slate-800 dark:text-slate-100",children:n}),(0,ue.jsx)("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:r})]}),(0,ue.jsxs)("div",{className:"hidden flex-col gap-0.5 truncate sm:flex",children:[(0,ue.jsx)("span",{className:"truncate text-slate-700 dark:text-slate-200",children:s}),(0,ue.jsx)("span",{className:"truncate text-slate-600 text-xs dark:text-slate-300",children:a})]}),(0,ue.jsx)("div",{className:"hidden items-end justify-end text-[11px] text-slate-600 xl:flex dark:text-slate-300",children:(0,ue.jsx)("span",{className:"truncate",children:o})})]})});var In,It,br,ss,is,ls,ds,xr,vr,cs,ps,us,ms,gs,hs,fs,ys,Cr,kr,fr,yr,Fn,bs,xs,Pa,Sr,Ra=De(()=>{"use strict";In=require("@aiquants/fuzzy-search"),It=require("@aiquants/select-box"),br=/[]/g,ss=/^[\s ]+|[\s ]+$/g,is=/\s+/,ls=/^[\p{Script=Latin}\s]+$/u,ds=/\p{Script=Latin}/u,xr=Object.freeze({convertWidth:!0,convertKana:!0,convertCase:!0,convertRomaji:!1,normalizeVariants:!1,ignoreSpaces:!1,ignoreSymbols:!1,ignoreLongVowels:!1}),vr="union",cs=65377,ps=65439,us=["\uFF9E","\uFF9F"],ms=(()=>{let e=new Map;for(let t=cs;t<=ps;t+=1){let n=String.fromCharCode(t);e.set(n.normalize("NFKC"),n);for(let r of us){let s=(n+r).normalize("NFKC");s.length===1&&e.set(s,n+r)}}return e})(),gs=/[-ヿ]/u,hs=e=>{let t=Array.from(e,n=>ms.get(n)??n).join("");return gs.test(t)?null:t},fs=e=>(0,It.normalizeText)(e.replace(br,"").replace(ss,""),xr),ys=e=>{if(!ls.test(e))return null;let t=(0,It.romajiToKatakana)(e);return ds.test(t)?null:t},Cr=e=>e.split(is).filter(Boolean),kr=e=>(0,In.parseQuerySets)(e,vr).sets.map(({query:t})=>t),fr=e=>kr(e).flatMap(t=>Cr(t)),yr=e=>(0,In.formatQuerySets)({combine:vr,sets:Array.from(new Set(e),t=>({query:t}))}),Fn=e=>{let t=kr(e.replace(br,"")).map(r=>Cr(fs(r)).join(" ")).filter(r=>r!==""),n=[];for(let r of t){let s=ys(r);if(s===null)return yr(t);n.push(s)}return yr(n)},bs=e=>{let t=new Set([...fr(e),...fr(Fn(e))]),n=new Set;for(let r of t)for(let s of(0,It.getNormalizedVariants)(r,xr)){let a=s.trim();if(!a)continue;n.add(a);let o=hs(a);o!==null&&n.add(o)}return Array.from(n)},xs=/[.*+?^${}()|[\]\\]/g,Pa=e=>{let t=bs(e);if(t.length===0)return null;let n=t.map(r=>r.replace(xs,"\\$&")).sort((r,s)=>s.length-r.length);return new RegExp(n.join("|"),"gi")},Sr=(e,t)=>{let n=Pa(e);if(n===null)return s=>s;let r=s=>t.some(a=>{let o=s[a];return typeof o=="string"&&o.search(n)!==-1});return s=>{let a=[],o=[];for(let d of s)r(d.item)?a.push(d):o.push(d);return[...a,...o]}}});var Tr,Xe,vs,he,zn=De(()=>{"use strict";Tr=require("react");Ra();Xe=require("react/jsx-runtime"),vs="rounded bg-yellow-200 px-1 text-gray-900 dark:bg-yellow-900 dark:text-yellow-100",he=(0,Tr.memo)(({text:e,query:t,enabled:n=!0})=>{if(!(n&&t?.trim()&&e))return(0,Xe.jsx)(Xe.Fragment,{children:e});let r=Pa(t);if(r===null)return(0,Xe.jsx)(Xe.Fragment,{children:e});let s=[],a=0,o=r.exec(e),d=0;for(;o;){let l=o[0],c=o.index;if(c>a&&s.push(e.substring(a,c)),l.length===0){r.lastIndex++,o=r.exec(e);continue}s.push((0,Xe.jsx)("mark",{className:vs,children:l},`highlight-${c}-${d}`)),a=c+l.length,d+=1,o=r.exec(e)}return a<e.length&&s.push(e.substring(a)),(0,Xe.jsx)(Xe.Fragment,{children:s})});he.displayName="HighlightedText"});var wr={};Za(wr,{ContactDetailGrid:()=>La,default:()=>Cs});var Un,pt,Bn,La,Cs,Nr=De(()=>{"use strict";Un=require("react");yt();ce();Na();Ma();zn();pt=require("react/jsx-runtime"),Bn=e=>{let t=typeof e=="string"?e.trim():"";return t.length>0?t:null},La=({contactData:e,searchTerm:t,enableHighlighting:n,openEmailsWithGmail:r,openGmailCompose:s,isPopupVisible:a,onRequestClose:o})=>{let d=J(),l=(0,Un.useMemo)(()=>Lt(e),[e]),c=(0,Un.useMemo)(()=>Et(e),[e]),m=l.value??"-",p=c.value??"-",i=(0,Un.useMemo)(()=>Be(e.updated_at,d.recordDateTime),[e.updated_at,d.recordDateTime]),u=Bn(e.full_name)??d.noName,f=Bn(e.company_name),T=Bn(e.department),S=(w,V="-")=>(0,pt.jsx)(he,{text:w??V,query:t,enabled:n});return(0,pt.jsxs)(pt.Fragment,{children:[(0,pt.jsx)(nn,{fullName:S(u),title:S(Bn(e.title)),companyName:S(f),department:S(T),phoneNumber:p,email:S(m),updatedAtText:i}),a?(0,pt.jsx)(tn,{contactData:e,openEmailsWithGmail:r,openGmailCompose:s,onRequestClose:o}):null]})},Cs=La});var ki={};Za(ki,{AdvancedSearchSettings:()=>Hn,BasicSearchSettings:()=>_n,CONTACT_MAP_LABEL_CATALOGS:()=>Ue,CONTACT_MAP_LABEL_KEYS:()=>Ht,ContactDetailGrid:()=>La,ContactDetailPanel:()=>Je,ContactDetailPopup:()=>tn,ContactDetailRowLayout:()=>nn,ContactMapAnnotation:()=>Kn,ContactMapAppView:()=>vi,ContactMapConfigProvider:()=>Gr,ContactMapSearchListView:()=>Ia,ContactMapSearchPage:()=>Ya,ContactMapSearchTabGroup:()=>ja,ContactMapSearchTreeView:()=>Ka,ContactMapStreamClient:()=>rn,HighlightedText:()=>he,IndexWorkerSettings:()=>ta,LIST_COLLAPSE_THRESHOLD:()=>Fs,LIST_DETAIL_PANEL_MIN_WIDTH:()=>ro,LIST_EXPAND_THRESHOLD:()=>zs,LIST_PANEL_MIN_WIDTH:()=>ao,LIST_RESIZE_HANDLE_THICKNESS:()=>oo,LevenshteinWorkerSettings:()=>na,Progress:()=>Ha,SearchOptionsPanel:()=>aa,StatItem:()=>O,StatisticsPanel:()=>sa,SwipeOverlay:()=>mn,TREE_COLLAPSE_THRESHOLD:()=>Zs,TREE_DETAIL_PANEL_MIN_WIDTH:()=>wo,TREE_EXPAND_THRESHOLD:()=>ei,TREE_PANEL_MIN_WIDTH:()=>To,TREE_RESIZE_HANDLE_THICKNESS:()=>No,Tabs:()=>an,TabsContent:()=>mt,TabsList:()=>Ft,TabsTrigger:()=>ut,TreeWorkerSession:()=>gn,WorkerStatsSection:()=>Nt,assertContactMapStreamEndpoint:()=>on,assertContactMapTreeWorkerUrl:()=>Oa,assertContactMapWorkerUrls:()=>ws,composeTreeVirtualScrollOptions:()=>Mo,contactMapShouldRevalidate:()=>Ci,countContactMapCompanies:()=>Xr,deserializeStreamRecord:()=>qr,getContactMapStreamClient:()=>Qr,getTreeWorkerSession:()=>go,layerContactMapWorkerUrls:()=>kt,resetContactMapStreamClientForTesting:()=>Os,resetTreeWorkerSessionForTesting:()=>Xs,resolveContactMapLabels:()=>Wn,useAnimatedNumber:()=>za,useContactMapConfig:()=>Ke,useContactMapLabels:()=>J,useContactMapStream:()=>Yr,useContactPanelSizing:()=>Xn,useDynamicViewportHeight:()=>_a,useHorizontalDragScroll:()=>Ze,useLongPressPopup:()=>cn,useReportPopupVisibility:()=>io,useResponsiveTwoColumnLayout:()=>pn,useRowPopupRegistry:()=>so,useStreamedContactMapContext:()=>sn,useTreeWorker:()=>Ba});module.exports=qo(ki);var vt=require("@aiquants/fuzzy-search"),Zt=require("react");ce();var pe=require("react/jsx-runtime"),Hn=(0,Zt.memo)(({searchOptions:e,setSearchOptions:t})=>{let n=J(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=(0,Zt.useId)(),o=(0,Zt.useId)(),d=[];return d.push((0,pe.jsxs)("div",{className:`${r} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[(0,pe.jsxs)("div",{className:`${s} text-sky-700 dark:text-sky-300`,children:["\u{1F4D8} ",n.advancedLearningHeading]}),(0,pe.jsx)("label",{htmlFor:a,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedLearningLabel}),(0,pe.jsx)("input",{id:a,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.learningWeight||vt.DEFAULT_FUZZY_SEARCH_OPTIONS.learningWeight,onChange:l=>t(c=>({...c,learningWeight:parseFloat(l.target.value)})),className:"w-full"}),(0,pe.jsxs)("span",{className:"text-sky-600 text-xs dark:text-sky-300",children:[n.currentValueLabel," ",e.learningWeight||vt.DEFAULT_FUZZY_SEARCH_OPTIONS.learningWeight]}),(0,pe.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedLearningHint})]},"learning")),d.push((0,pe.jsxs)("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-400/60`,children:[(0,pe.jsxs)("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u23F1\uFE0F ",n.advancedDebounceHeading]}),(0,pe.jsx)("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.advancedDebounceLabel}),(0,pe.jsx)("input",{id:o,type:"range",min:"100",max:"1000",step:"50",value:e.debounceMs??vt.DEFAULT_FUZZY_SEARCH_OPTIONS.debounceMs,onChange:l=>t(c=>({...c,debounceMs:parseInt(l.target.value,10)})),className:"w-full"}),(0,pe.jsxs)("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.debounceMs??vt.DEFAULT_FUZZY_SEARCH_OPTIONS.debounceMs]}),(0,pe.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.advancedDebounceHint})]},"debounce")),(0,pe.jsxs)("section",{className:"space-y-3",children:[(0,pe.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,pe.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,pe.jsx)("span",{children:"\u26A1"}),(0,pe.jsx)("span",{className:"tracking-wide",children:n.settingsAdvancedTab})]}),(0,pe.jsx)("button",{type:"button",onClick:()=>t(l=>({...l,learningWeight:vt.DEFAULT_FUZZY_SEARCH_OPTIONS.learningWeight,debounceMs:vt.DEFAULT_FUZZY_SEARCH_OPTIONS.debounceMs})),className:"rounded border border-gray-300 bg-gray-100 px-2 py-1 font-medium text-gray-700 text-xs transition-colors hover:bg-gray-200 dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-200 dark:hover:bg-slate-700/70",title:n.resetToDefaultsTitle,children:n.reset})]}),(0,pe.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2",children:d})]})});Hn.displayName="AdvancedSearchSettings";var ct=require("@aiquants/fuzzy-search"),Me=require("react");ce();var R=require("react/jsx-runtime"),_n=(0,Me.memo)(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a})=>{let o=J(),d="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",l="text-xs font-semibold",c=(0,Me.useId)(),m=(0,Me.useId)(),p=(0,Me.useId)(),i=(0,Me.useId)(),u=(0,Me.useId)(),f=(0,Me.useId)(),T=(0,Me.useId)(),S=(0,Me.useId)(),w=(0,Me.useId)(),V=(0,Me.useId)(),H=[];return H.push((0,R.jsxs)("div",{className:`${d} border-blue-200 border-l-4 dark:border-blue-500/50`,children:[(0,R.jsxs)("div",{className:`${l} text-blue-700 dark:text-blue-300`,children:["\u{1F3AF} ",o.basicThresholdHeading]}),(0,R.jsx)("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicThresholdLabel}),(0,R.jsx)("input",{id:c,type:"range",min:"0.0",max:e.sortBy==="relevance"?"1.5":"1.0",step:"0.05",value:e.threshold??ct.DEFAULT_FUZZY_SEARCH_OPTIONS.threshold,onChange:y=>t(g=>({...g,threshold:parseFloat(y.target.value)})),className:"w-full"}),(0,R.jsxs)("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[o.currentValueLabel," ",e.threshold??ct.DEFAULT_FUZZY_SEARCH_OPTIONS.threshold]}),(0,R.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:e.sortBy==="relevance"?o.basicThresholdRangeRelevance:o.basicThresholdRange})]},"threshold")),H.push((0,R.jsxs)("div",{className:`${d} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[(0,R.jsxs)("div",{className:`${l} text-amber-700 dark:text-amber-300`,children:["\u{1FA84} ",o.basicDisplayHeading]}),(0,R.jsxs)("label",{htmlFor:m,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:m,type:"checkbox",checked:e.caseSensitive??ct.DEFAULT_FUZZY_SEARCH_OPTIONS.caseSensitive,onChange:y=>t(g=>({...g,caseSensitive:y.target.checked})),className:"h-3 w-3"}),o.basicCaseSensitive]}),(0,R.jsxs)("label",{htmlFor:p,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:p,type:"checkbox",checked:n,onChange:y=>r(y.target.checked),className:"h-3 w-3"}),o.basicHighlight]}),(0,R.jsxs)("label",{htmlFor:i,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:i,type:"checkbox",checked:s,onChange:y=>a(y.target.checked),className:"h-3 w-3"}),o.basicOpenEmailsWithGmail]}),(0,R.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,R.jsx)("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicMultiTermOperator}),(0,R.jsxs)("select",{id:u,value:e.multiTermOperator??ct.DEFAULT_FUZZY_SEARCH_OPTIONS.multiTermOperator,onChange:y=>t(g=>({...g,multiTermOperator:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,R.jsx)("option",{value:"or",children:o.basicOperatorOr}),(0,R.jsx)("option",{value:"and",children:o.basicOperatorAnd})]}),(0,R.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:o.basicMultiTermHint})]})]},"display")),H.push((0,R.jsxs)("div",{className:`${d} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[(0,R.jsxs)("div",{className:`${l} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4DA} ",o.basicSortHeading]}),(0,R.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,R.jsx)("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortBy}),(0,R.jsxs)("select",{id:f,value:e.sortBy||ct.DEFAULT_FUZZY_SEARCH_OPTIONS.sortBy,onChange:y=>t(g=>({...g,sortBy:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,R.jsx)("option",{value:"score",children:o.basicSortByScore}),(0,R.jsx)("option",{value:"relevance",children:o.basicSortByRelevance}),(0,R.jsx)("option",{value:"original",children:o.basicSortByOriginal})]})]}),(0,R.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,R.jsx)("label",{htmlFor:T,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicSortOrder}),(0,R.jsxs)("select",{id:T,value:e.sortOrder||ct.DEFAULT_FUZZY_SEARCH_OPTIONS.sortOrder,onChange:y=>t(g=>({...g,sortOrder:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,R.jsx)("option",{value:"desc",children:o.basicSortDescending}),(0,R.jsx)("option",{value:"asc",children:o.basicSortAscending})]})]})]},"sorting")),H.push((0,R.jsxs)("div",{className:`${d} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[(0,R.jsxs)("div",{className:`${l} text-purple-700 dark:text-purple-300`,children:["\u2699\uFE0F ",o.basicEngineHeading]}),(0,R.jsx)("label",{htmlFor:S,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:o.basicStrategy}),(0,R.jsxs)("select",{id:S,value:e.parallelSearchStrategy||ct.DEFAULT_FUZZY_SEARCH_OPTIONS.parallelSearchStrategy,onChange:y=>t(g=>({...g,parallelSearchStrategy:y.target.value})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,R.jsx)("option",{value:"balanced",children:o.basicStrategyBalanced}),(0,R.jsx)("option",{value:"index-first",children:o.basicStrategyIndexFirst}),(0,R.jsx)("option",{value:"levenshtein-first",children:o.basicStrategyLevenshteinFirst})]}),(0,R.jsxs)("div",{className:"mt-2 space-y-2",children:[(0,R.jsxs)("label",{htmlFor:w,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:w,type:"checkbox",checked:e.enableIndexFiltering!==!1,onChange:y=>t(g=>({...g,enableIndexFiltering:y.target.checked})),className:"h-3 w-3"}),o.basicIndexFiltering]}),(0,R.jsxs)("label",{htmlFor:V,className:"flex items-center gap-2 text-gray-700 text-xs transition-colors dark:text-slate-200",children:[(0,R.jsx)("input",{id:V,type:"checkbox",checked:e.enableLevenshtein!==!1,onChange:y=>t(g=>({...g,enableLevenshtein:y.target.checked})),className:"h-3 w-3"}),o.basicLevenshtein]})]})]},"engine")),(0,R.jsxs)("section",{className:"space-y-3",children:[(0,R.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-blue-700 text-xs transition-colors dark:text-sky-400",children:[(0,R.jsx)("span",{children:"\u{1F527}"}),(0,R.jsx)("span",{className:"tracking-wide",children:o.settingsBasicTab})]}),(0,R.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:H})]})});_n.displayName="BasicSearchSettings";var Er=de(require("lucide-react/dist/esm/icons/badge-check.js")),Or=de(require("lucide-react/dist/esm/icons/building-2.js")),Dr=de(require("lucide-react/dist/esm/icons/calendar-clock.js")),Wr=de(require("lucide-react/dist/esm/icons/check.js")),Hr=de(require("lucide-react/dist/esm/icons/copy.js")),_r=de(require("lucide-react/dist/esm/icons/id-card.js")),Ar=de(require("lucide-react/dist/esm/icons/mail.js")),Ir=de(require("lucide-react/dist/esm/icons/phone.js")),Fr=de(require("lucide-react/dist/esm/icons/user-round.js")),Pe=require("react");yt();var Ve={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)};ce();var _e=de(require("@radix-ui/react-tabs")),$n=de(require("react"));var Mr=require("clsx"),Pr=require("tailwind-merge");function Ct(...e){return(0,Pr.twMerge)((0,Mr.clsx)(e))}var Vn=require("react/jsx-runtime"),an=_e.Root,Ft=$n.forwardRef(({className:e,...t},n)=>(0,Vn.jsx)(_e.List,{ref:n,className:Ct("inline-flex h-10 items-center justify-center rounded-md bg-muted p-1 text-muted-foreground",e),...t}));Ft.displayName=_e.List.displayName;var ut=$n.forwardRef(({className:e,...t},n)=>(0,Vn.jsx)(_e.Trigger,{ref:n,className:Ct("inline-flex items-center justify-center whitespace-nowrap rounded-sm px-3 py-1.5 font-medium text-sm ring-offset-background transition-all focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:bg-background data-[state=active]:text-foreground data-[state=active]:shadow-2xs",e),...t}));ut.displayName=_e.Trigger.displayName;var mt=$n.forwardRef(({className:e,...t},n)=>(0,Vn.jsx)(_e.Content,{ref:n,className:Ct("mt-2 ring-offset-background focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 data-[state=inactive]:hidden",e),...t}));mt.displayName=_e.Content.displayName;zn();var C=require("react/jsx-runtime"),Rr={height:"var(--contact-panel-height, 100%)",maxHeight:"100%"},ks=({icon:e,label:t,value:n,fieldKey:r,copyValue:s,onCopy:a,isCopied:o,linkHref:d,searchTerm:l,enableHighlighting:c})=>{let m=J(),p=!!(a&&r&&s),i=d?.startsWith("https://mail.google.com")?"_blank":void 0;return(0,C.jsxs)("div",{className:"flex items-center justify-between gap-2 rounded-lg border border-slate-200 bg-slate-50 px-2.5 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[(0,C.jsxs)("div",{className:"flex min-w-0 flex-1 items-center gap-2",children:[(0,C.jsx)("div",{className:"flex h-7 w-7 items-center justify-center rounded-full bg-white text-slate-500 transition-colors dark:bg-slate-800 dark:text-slate-200",children:(0,C.jsx)(e,{size:14})}),(0,C.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,C.jsx)("div",{className:"font-medium text-[10px] text-slate-500 dark:text-slate-400",children:t}),(0,C.jsx)("div",{className:"truncate font-semibold text-slate-900 text-xs dark:text-slate-100",children:d?(0,C.jsx)("a",{href:d,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",target:i,rel:i?"noopener noreferrer":void 0,children:(0,C.jsx)(he,{text:n,query:l??"",enabled:c})}):(0,C.jsx)(he,{text:n,query:l??"",enabled:c})})]})]}),p?(0,C.jsx)("button",{type:"button",onClick:()=>a&&r&&s&&a(r,s,t),className:"inline-flex h-6 w-6 items-center justify-center rounded-full border border-slate-200 bg-white text-slate-500 transition-colors hover:border-blue-400 hover:text-blue-500 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:border-blue-400 dark:hover:text-blue-300","aria-label":m.copyField(t),children:o?(0,C.jsx)(Wr.default,{size:14}):(0,C.jsx)(Hr.default,{size:14})}):null]})},Lr=({items:e,searchTerm:t,enableHighlighting:n})=>(0,C.jsx)("dl",{className:"grid grid-cols-1 gap-x-3 gap-y-1.5 sm:grid-cols-2",children:e.map(r=>(0,C.jsxs)("div",{className:"flex flex-col gap-0.5 rounded-md border border-slate-200 bg-white/60 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[(0,C.jsx)("dt",{className:"font-semibold text-[10px] text-slate-500 uppercase tracking-wide dark:text-slate-400",children:r.label}),(0,C.jsx)("dd",{className:"wrap-break-word text-slate-900 text-xs dark:text-slate-100",children:(0,C.jsx)(he,{text:r.value,query:t??"",enabled:n})})]},r.fieldKey))}),Ea=({title:e})=>(0,C.jsx)("h3",{className:"font-semibold text-slate-700 text-xs dark:text-slate-200",children:e}),Ss=()=>{let e=J();return(0,C.jsxs)("div",{className:"flex h-full min-h-40 w-full flex-1 flex-col items-center justify-center gap-2 rounded-xl border border-slate-300 border-dashed bg-white/60 p-4 text-center transition-colors dark:border-slate-700 dark:bg-slate-900/40",children:[(0,C.jsx)("p",{className:"font-medium text-slate-600 text-xs dark:text-slate-200",children:e.detailEmptyTitle}),(0,C.jsx)("p",{className:"text-[11px] text-slate-500 dark:text-slate-400",children:e.detailEmptyHint})]})},Je=({contact:e,searchTerm:t,enableHighlighting:n,style:r,className:s=""})=>{let a=J(),[o,d]=(0,Pe.useState)(null),l=(0,Pe.useRef)(null),c=(0,Pe.useMemo)(()=>({...Rr,...r}),[r]);(0,Pe.useEffect)(()=>()=>{l.current!==null&&window.clearTimeout(l.current)},[]);let m=(0,Pe.useMemo)(()=>Lt(e),[e]),p=(0,Pe.useMemo)(()=>Et(e),[e]),i=(0,Pe.useMemo)(()=>Be(e?.contacted_at,a.recordDateTime),[e?.contacted_at,a.recordDateTime]),u=(0,Pe.useCallback)(async(k,h,v)=>{try{await navigator.clipboard.writeText(h),d(k),l.current!==null&&window.clearTimeout(l.current),l.current=window.setTimeout(()=>{d(null)},2e3)}catch(F){Ve.error("Failed to copy contact detail",F)}},[]);if(!e)return(0,C.jsx)("div",{className:"flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",style:Rr,children:(0,C.jsx)(Ss,{})});let f=[Z(e.title),Z(e.department)].filter(k=>k!=="-"),T=[f.join(" / "),Z(e.company_name)].filter(k=>k&&k!=="-").join(" \u30FB ")||"-",S=He(e.full_name)??a.noName,w=[{fieldKey:"full_name",label:a.fieldFullName,value:S},{fieldKey:"full_name_reading",label:a.fieldFullNameReading,value:Z(e.full_name_reading)},{fieldKey:"title",label:a.fieldTitle,value:Z(e.title)},{fieldKey:"department",label:a.fieldDepartment,value:Z(e.department)},{fieldKey:"company_name",label:a.fieldCompanyName,value:Z(e.company_name)},{fieldKey:"company_name_reading",label:a.fieldCompanyNameReading,value:Z(e.company_name_reading)},{fieldKey:"address",label:a.fieldAddress,value:Z(e.address)},{fieldKey:"postal_code",label:a.fieldPostalCode,value:Z(e.postal_code)},{fieldKey:"url",label:a.fieldUrl,value:Z(e.url)}],V=[{label:a.fieldCustomEmail,value:Z(e.custom_email),fieldKey:"custom_email",rawValue:e.custom_email},{label:a.fieldEmail,value:Z(e.email),fieldKey:"email",rawValue:e.email}].filter(k=>k.value!=="-"),H=[{label:a.fieldCustomMobilePhone,value:Z(e.custom_mobile_phone_number),fieldKey:"custom_mobile_phone_number",rawValue:e.custom_mobile_phone_number},{label:a.fieldMobilePhone,value:Z(e.mobile_phone_number),fieldKey:"mobile_phone_number",rawValue:e.mobile_phone_number},{label:a.fieldCompanyPhone,value:Z(e.company_phone_number),fieldKey:"company_phone_number",rawValue:e.company_phone_number},{label:a.fieldCompanyFax,value:Z(e.company_fax_number),fieldKey:"company_fax_number",rawValue:e.company_fax_number}].filter(k=>k.value!=="-"),y=[{fieldKey:"person_id",label:"person_id",value:Z(e.person_id)},{fieldKey:"person_id_redirect_to",label:"person_id_redirect_to",value:Z(e.person_id_redirect_to)},{fieldKey:"is_active",label:"is_active",value:Z(e.is_active)},{fieldKey:"is_contact_synced",label:"is_contact_synced",value:Z(e.is_contact_synced)},{fieldKey:"is_incomplete",label:"is_incomplete",value:Z(e.is_incomplete)},{fieldKey:"is_in_eight",label:"is_in_eight",value:Z(e.is_in_eight)},{fieldKey:"created_by",label:a.fieldCreatedBy,value:Z(e.created_by)},{fieldKey:"created_at",label:a.fieldCreatedAt,value:Be(e.created_at,a.recordDateTime)},{fieldKey:"updated_by",label:a.fieldUpdatedBy,value:Z(e.updated_by)},{fieldKey:"updated_at",label:a.fieldUpdatedAt,value:Be(e.updated_at,a.recordDateTime)}],g=[{rowKey:"person_id",icon:_r.default,label:"person_id",value:Z(e.person_id),fieldKey:"person_id",copyValue:String(e.person_id)},{rowKey:"primary_email",icon:Ar.default,label:a.summaryEmail,value:m.value??"-",fieldKey:"primary_email",copyValue:m.value,linkHref:Qe(m.value,!1)},{rowKey:"primary_phone",icon:Ir.default,label:a.summaryPhone,value:p.value??"-",fieldKey:"primary_phone",copyValue:p.value,linkHref:Jt(p.value)},{rowKey:"contacted_at",icon:Dr.default,label:a.summaryLastContact,value:i}],$=[{sectionKey:"email",title:a.sectionEmail,emptyText:a.sectionEmailEmpty,entries:V,recommendedKey:m.fieldKey??null,resolveHref:k=>Qe(k!=null?String(k):null,!1)},{sectionKey:"phone",title:a.sectionPhone,emptyText:a.sectionPhoneEmpty,entries:H,recommendedKey:p.fieldKey??null,resolveHref:k=>Jt(k!=null?String(k):null)}],G=[{value:"summary",label:a.detailTabSummary,content:(0,C.jsxs)("div",{className:"flex flex-col gap-4",children:[(0,C.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,C.jsxs)("div",{className:"flex items-center gap-2 text-slate-600 text-sm dark:text-slate-300",children:[(0,C.jsx)(Or.default,{size:16}),(0,C.jsx)("span",{children:(0,C.jsx)(he,{text:Z(e.company_name),query:t??"",enabled:n})})]}),f.length>0?(0,C.jsx)("div",{className:"text-slate-600 text-sm dark:text-slate-300",children:f.map((k,h)=>(0,C.jsxs)("span",{children:[h>0&&" / ",(0,C.jsx)(he,{text:k,query:t??"",enabled:n})]},`header-line-${h}`))}):null]}),(0,C.jsx)("div",{className:"flex flex-col gap-3",children:g.map(k=>(0,C.jsx)(ks,{icon:k.icon,label:k.label,value:k.value,fieldKey:k.fieldKey,copyValue:k.copyValue,onCopy:u,isCopied:k.fieldKey?o===k.fieldKey:!1,linkHref:k.linkHref,searchTerm:t,enableHighlighting:n},k.rowKey))})]})},{value:"basic",label:a.detailTabBasic,content:(0,C.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,C.jsx)(Ea,{title:a.detailBasicProfile}),(0,C.jsx)(Lr,{items:w,searchTerm:t,enableHighlighting:n})]})},{value:"contact",label:a.detailTabContact,content:(0,C.jsx)("div",{className:"flex flex-col gap-4",children:$.map(({sectionKey:k,title:h,emptyText:v,entries:F,recommendedKey:P,resolveHref:ae})=>(0,C.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,C.jsx)(Ea,{title:h}),F.length===0?(0,C.jsx)("p",{className:"text-slate-500 text-xs dark:text-slate-400",children:v}):(0,C.jsx)("div",{className:"flex flex-col gap-2",children:F.map(L=>{let E=ae(L.rawValue),I=L.fieldKey===P;return(0,C.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-slate-200 bg-white px-3 py-2 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:[(0,C.jsxs)("div",{children:[(0,C.jsx)("div",{className:"font-medium text-slate-500 text-xs dark:text-slate-400",children:L.label}),(0,C.jsx)("div",{className:"text-slate-900 text-sm dark:text-slate-100",children:E?(0,C.jsx)("a",{href:E,className:"text-inherit underline-offset-2 hover:underline focus:underline focus:outline-none",children:(0,C.jsx)(he,{text:L.value,query:t??"",enabled:n})}):(0,C.jsx)(he,{text:L.value,query:t??"",enabled:n})})]}),I?(0,C.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full bg-emerald-100 px-2 py-0.5 font-semibold text-[11px] text-emerald-700 transition-colors dark:bg-emerald-300/20 dark:text-emerald-200",children:[(0,C.jsx)(Er.default,{size:14}),a.preferred]}):null]},L.fieldKey)})})]},k))})},{value:"meta",label:a.detailTabMeta,content:(0,C.jsxs)("div",{className:"flex flex-col gap-3",children:[(0,C.jsx)(Ea,{title:a.detailTabMeta}),(0,C.jsx)(Lr,{items:y,searchTerm:t,enableHighlighting:n})]})}];return(0,C.jsxs)("div",{className:`flex h-full min-h-0 w-full flex-col overflow-hidden rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950 ${s}`.trim(),style:c,children:[(0,C.jsx)("div",{className:"border-slate-200 border-b px-3 py-1.5 transition-colors dark:border-slate-700 dark:bg-slate-900/50",children:(0,C.jsxs)("div",{className:"flex items-center gap-2",children:[(0,C.jsx)("div",{className:"flex h-8 w-8 items-center justify-center rounded-full bg-blue-50 text-blue-600 transition-colors dark:bg-sky-900/40 dark:text-sky-300",children:(0,C.jsx)(Fr.default,{size:16})}),(0,C.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,C.jsx)("div",{className:"truncate font-semibold text-slate-900 text-sm dark:text-slate-100",children:(0,C.jsx)(he,{text:S,query:t??"",enabled:n})}),(0,C.jsx)("div",{className:"truncate text-[11px] text-slate-600 dark:text-slate-300",children:(0,C.jsx)(he,{text:T,query:t??"",enabled:n})})]})]})}),(0,C.jsxs)(an,{defaultValue:"summary",className:"flex flex-1 flex-col overflow-hidden",children:[(0,C.jsx)(Ft,{className:"flex gap-1.5 border-slate-200 border-b bg-slate-50 px-2 py-1 transition-colors dark:border-slate-700 dark:bg-slate-900/60",children:G.map(k=>(0,C.jsx)(ut,{value:k.value,className:"rounded-md px-1.5 py-0.5 font-semibold text-[11px] transition-colors data-[state=active]:bg-white data-[state=active]:text-blue-600 dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-sky-300",children:k.label},k.value))}),G.map(k=>(0,C.jsx)(mt,{value:k.value,className:"scrollbar-thin flex-1 overflow-y-auto px-2.5 py-2 transition-colors dark:text-slate-200",children:k.content},k.value))]})]})};var zr=require("react");xt();ce();var ve=require("react/jsx-runtime"),Kn=(0,zr.memo)(({recordCount:e,companyCount:t,phase:n,loadedCount:r,totalCount:s,errorMessage:a,onRetry:o})=>{let{locale:d,labels:l}=Se(),c=X(d,e),m=X(d,t);return(0,ve.jsxs)("div",{"data-testid":"contact-map-annotation",className:"flex flex-wrap items-center gap-2 leading-1 transition-colors",role:"status",children:[(0,ve.jsxs)("span",{className:"flex items-baseline gap-1",children:[(0,ve.jsx)("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationTotalLabel}),(0,ve.jsx)("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-record-count",children:c}),(0,ve.jsx)("span",{className:"text-slate-600 dark:text-slate-300",children:l.recordUnit(c)})]}),(0,ve.jsxs)("span",{className:"flex items-baseline gap-1",children:[(0,ve.jsx)("span",{className:"text-slate-600 dark:text-slate-300",children:l.annotationCompaniesLabel}),(0,ve.jsx)("span",{className:"text-slate-800 dark:text-slate-200","data-testid":"contact-map-company-count",children:m}),(0,ve.jsx)("span",{className:"text-slate-600 dark:text-slate-300",children:l.companyUnit(m)})]}),n==="streaming"||n==="idle"?(0,ve.jsx)("span",{"data-testid":"contact-map-stream-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-blue-50 px-2 py-0.5 font-medium text-blue-700 text-xs dark:bg-blue-900/30 dark:text-blue-300",children:s!==null&&s>0?l.annotationStreamingProgress({loaded:r,total:s,percent:Math.min(100,Math.round(r/s*100))}):l.annotationStreamingCount(r)}):null,n==="retrying"?(0,ve.jsx)("span",{"data-testid":"contact-map-reconnecting-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-amber-50 px-2 py-0.5 font-medium text-amber-900 text-xs dark:bg-amber-900/30 dark:text-amber-200",children:l.annotationReconnecting(r)}):null,n==="failed"||n==="auth-required"?(0,ve.jsxs)("span",{"data-testid":"contact-map-error-badge",className:"ml-2 inline-flex items-center gap-1.5 rounded-full bg-rose-50 px-2 py-0.5 font-medium text-rose-700 text-xs dark:bg-rose-900/30 dark:text-rose-300",title:n==="failed"?a??void 0:void 0,children:["\u26D4 ",n==="auth-required"?l.annotationAuthRequired:l.annotationLoadFailed(r),o?(0,ve.jsx)("button",{type:"button","data-testid":"contact-map-retry-button",onClick:o,className:"rounded border border-rose-300 bg-white px-1.5 py-0.5 font-semibold text-rose-700 transition-colors hover:bg-rose-100 dark:border-rose-700 dark:bg-rose-950 dark:text-rose-200 dark:hover:bg-rose-900",children:l.annotationRetry}):null]}):null]})});Kn.displayName="ContactMapAnnotation";var Xa=require("react");Wt();var zt=require("react");Ot();Wt();ce();Ot();Wt();ya();var Ts=["indexWorker","levenshteinWorker","treeWorker"];function Br(e,t,n){if(n!==void 0){if(typeof n!="string")throw new TypeError(`[contact-map] ${e}.${t} must be a string or left out (pass url.href for a URL object); got ${se(n)}`);if(n.trim()==="")throw new RangeError(`[contact-map] ${e}.${t} must not be empty or blank; got ${se(n)}`)}}var Ur={setting:"workerUrls"},$r=(e,t)=>{if(e===void 0)return;let{setting:n,keys:r=Ts,hints:s={}}=t;if(!Dt(e))throw new TypeError(`[contact-map] ${n} must be a plain object or left out; got ${se(e)}`);let a=Object.getOwnPropertyNames(e).map(l=>({key:l,url:e[l]})),o=a.find(({key:l,url:c})=>c!==void 0&&!r.includes(l));if(o!==void 0){let l=Object.hasOwn(s,o.key)?s[o.key]:void 0,c=l===void 0?En(o.key,r):void 0;throw new RangeError(`[contact-map] ${n} has a key it does not take (it takes ${r.join(", ")}${l===void 0?"":`; ${l}`}${c===void 0?"":`; did you mean ${JSON.stringify(c)}?`}); got ${se(o.key)}`)}let d=Object.create(null);for(let{key:l,url:c}of a){let m=l;Br(n,m,c),c!==void 0&&(d[m]=c)}return d};function ws(e,t=Ur){$r(e,t)}function Oa(e){Br("workerUrls","treeWorker",e)}var kt=(e,t,n=Ur)=>{let r=$r(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}};var jn=require("react/jsx-runtime"),Vr=e=>{if(!Dt(e))throw new TypeError(`[contact-map] config must be a plain object; got ${se(e)}`);let t=e;return{streamEndpoint:ke(t,"streamEndpoint"),openEmailsWithGmail:ke(t,"openEmailsWithGmail"),treeWorkerFactory:ke(t,"treeWorkerFactory"),workerUrls:kt(void 0,ke(t,"workerUrls")),locale:ke(t,"locale"),labels:ke(t,"labels")}},Kr=({workerUrls:e,...t})=>{let{indexWorker:n,levenshteinWorker:r,treeWorker:s}=e;return Object.freeze(Object.assign(Object.create(null),t,{workerUrls:Object.freeze({indexWorker:n,levenshteinWorker:r,treeWorker:s})}))},Ns=Kr(Vr({})),jr=(0,zt.createContext)(Ns),Ms=Object.freeze({locale:"locale",labels:"labels"});function Da({config:e,chromeSurface:t,children:n}){let{streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:a,workerUrls:o,locale:d,labels:l}=Vr(e),{indexWorker:c,levenshteinWorker:m,treeWorker:p}=o,i=(0,zt.useMemo)(()=>Kr({streamEndpoint:r,openEmailsWithGmail:s,treeWorkerFactory:a,workerUrls:{indexWorker:c,levenshteinWorker:m,treeWorker:p},locale:d,labels:l}),[r,s,a,c,m,p,d,l]);return(0,jn.jsx)(jr.Provider,{value:i,children:(0,jn.jsx)(lr,{locale:d,labels:l,surface:t,children:n})})}function Gr({config:e,children:t}){return(0,jn.jsx)(Da,{config:e,chromeSurface:Ms,children:t})}function Ke(){return(0,zt.useContext)(jr)}var Te=require("react");Ot();var Ps=1e3,Rs=3e4,Ls=6;function on(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 ${se(e)}`);if(/[\s\p{Cc}#]/u.test(e))throw new RangeError(`[contact-map] streamEndpoint must not contain whitespace, control characters or "#"; got ${se(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 ${se(e)}`)}var qr=e=>({...e,contacted_at:e.contacted_at?new Date(e.contacted_at):null,created_at:e.created_at?new Date(e.created_at):void 0,updated_at:e.updated_at?new Date(e.updated_at):void 0}),Es=e=>Array.isArray(e.records),rn=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?.()};on(t.endpoint),this.fetchFn=t.fetchFn??((...n)=>fetch(...n)),this.endpoint=t.endpoint,this.initialRetryDelayMs=t.initialRetryDelayMs??Ps,this.maxRetryDelayMs=t.maxRetryDelayMs??Rs,this.maxConsecutiveFailures=t.maxConsecutiveFailures??Ls,this.logger=t.logger??Ve}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 s=Math.min(this.initialRetryDelayMs*2**(this.consecutiveFailures-1),this.maxRetryDelayMs);if(this.setState({phase:"retrying",isLoading:this.recordMap.size===0}),this.logger.warn(`[ContactMapStream] retrying in ${s}ms (attempt ${this.consecutiveFailures})`),await this.waitBeforeRetry(s),this.disposed)return;this.setState({phase:"streaming"})}}waitBeforeRetry(t){return new Promise(n=>{let 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,s="",a=!1,o=!1;for(;;){let{done:d,value:l}=await n.read();if(d)break;let c=r.decode(l,{stream:!0}),m=(s+c).split(`
|
|
2
|
+
`);s=m.pop()??"";let p=!1;for(let i of m){let u=i.trim();if(!u)continue;let f;try{f=JSON.parse(u)}catch(T){this.logger.warn("[ContactMapStream] failed to parse NDJSON line:",T);continue}if("type"in f&&f.type==="METADATA"){Number.isSafeInteger(f.total)&&f.total>=0&&this.setState({totalCount:f.total});continue}if(!Es(f)){this.logger.warn("[ContactMapStream] server reported error:","error"in f?f.error:""),o=!0;continue}for(let T of f.records)T&&typeof T.person_id=="number"&&(this.recordMap.set(T.person_id,qr(T)),p=!0);f.nextCursor&&(this.lastCursor=f.nextCursor),f.isLast&&(a=!0)}p&&(this.consecutiveFailures=0,this.publishRecords({error:null}))}return o?(this.setState({error:new Error("Stream interrupted by server error")}),"retryable"):a?"complete":(this.setState({error:new Error("Stream ended before completion")}),"retryable")}catch(t){if(t instanceof Error&&t.name==="AbortError")return"aborted";let n=t instanceof Error?t:new Error(String(t));return this.setState({error:n}),"retryable"}finally{this.activeController=null}}};var Ae=null,Qr=e=>{if(Ae!==null&&Ae.endpoint===e)return Ae;if(on(e),Ae===null)return Ae=new rn({endpoint:e}),Ae;if(Ae.endpoint!==e)throw new Error(`[contact-map] the stream client already streams from ${JSON.stringify(Ae.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 Ae},Os=()=>{Ae?.dispose(),Ae=null},Ds=new Map,Ws={records:[],loadedCount:0,totalCount:null,isLoading:!0,isComplete:!1,phase:"idle",error:null},Hs=()=>{let{streamEndpoint:e}=Ke();return(0,Te.useMemo)(()=>(on(e),e),[e])};function Yr(){let e=Hs(),t=(0,Te.useCallback)(()=>Qr(e),[e]);(0,Te.useEffect)(()=>{let o=t();o.start(),o.retryNow()},[t]);let n=(0,Te.useCallback)(o=>t().subscribe(o),[t]),r=(0,Te.useSyncExternalStore)(n,()=>t().getState(),()=>Ws),s=(0,Te.useSyncExternalStore)(n,()=>t().getRecordMap(),()=>Ds),a=(0,Te.useCallback)(()=>t().retryNow(),[t]);return(0,Te.useMemo)(()=>({...r,recordMap:s,retryNow:a}),[r,s,a])}var Xr=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 sn(){let{records:e,recordMap:t,isComplete:n,phase:r,loadedCount:s,totalCount:a,error:o,retryNow:d}=Yr(),l=(0,Te.useMemo)(()=>Xr(e),[e]);return{context:(0,Te.useMemo)(()=>({contactMapRecords:e,contactMapRecordMap:t,isStreamingComplete:n,isStreamingFailed:r==="failed",streamPhase:r,loadedCount:s,companyCount:l,totalCount:a,errorMessage:o?.message??null}),[e,t,n,r,s,l,a,o]),retryNow:d}}ce();var la=require("@aiquants/fuzzy-search"),Io=require("@aiquants/fuzzy-search/react"),Fo=de(require("lucide-react/dist/esm/icons/search.js")),z=require("react"),da=require("react-router");Ra();Wt();var Re=require("react"),Ze=e=>{let t=(0,Re.useRef)(null),n=(0,Re.useRef)({isPointerDown:!1,isDragging:!1,startX:0,scrollLeft:0,pointerId:0,hasCapture:!1,didDrag:!1,pointerType:""}),r=e?.dragThreshold??4,s=(0,Re.useCallback)(p=>{let i=p.currentTarget,u=p.deltaY;!i||u===0||(p.preventDefault(),i.scrollBy({left:u,behavior:"smooth"}))},[]),a=(0,Re.useCallback)(p=>{t.current?.removeEventListener("wheel",s),t.current=p,p?.addEventListener("wheel",s,{passive:!1})},[s]);(0,Re.useEffect)(()=>()=>{t.current&&t.current.removeEventListener("wheel",s)},[s]);let o=(0,Re.useCallback)(p=>{if(p.pointerType==="touch")return;let i=n.current;i.isPointerDown=!0,i.isDragging=!1,i.startX=p.clientX,i.scrollLeft=p.currentTarget.scrollLeft,i.pointerId=p.pointerId,i.hasCapture=!1,i.pointerType=p.pointerType},[]),d=(0,Re.useCallback)(p=>{let i=n.current;if(!i.isPointerDown||i.pointerType==="touch")return;let u=p.currentTarget,f=p.clientX-i.startX;!i.isDragging&&Math.abs(f)>r&&(i.isDragging=!0,i.hasCapture||(u.setPointerCapture?.(p.pointerId),i.hasCapture=!0)),i.isDragging&&(p.preventDefault(),u.scrollLeft=i.scrollLeft-f)},[r]),l=(0,Re.useCallback)(p=>{let i=n.current;if(i.pointerType==="touch")return;let u=p.currentTarget;i.isPointerDown&&i.hasCapture&&u.hasPointerCapture?.(p.pointerId)&&u.releasePointerCapture(p.pointerId),i.isDragging&&(i.didDrag=!0,window.setTimeout(()=>{i.didDrag=!1},0)),i.isPointerDown=!1,i.isDragging=!1,i.pointerId=0,i.hasCapture=!1},[]),c=(0,Re.useCallback)(p=>{l(p)},[l]),m=(0,Re.useCallback)(p=>{n.current.didDrag&&(p.preventDefault(),p.stopPropagation(),n.current.didDrag=!1)},[]);return{setScrollableRef:a,onPointerDown:o,onPointerMove:d,onPointerUp:c,onPointerLeave:c,onPointerCancel:c,onClickCapture:m}};xt();ce();var Jr=require("@aiquants/fuzzy-search"),Gn=e=>{let{indexWorkerOptions:t,levenshteinWorkerOptions:n,...r}=Jr.DEFAULT_FUZZY_SEARCH_OPTIONS;return{...r,autoSearchOnIndexRebuild:!1,multiTermOperator:"and",workerUrls:e,indexWorkerOptions:{...t},levenshteinWorkerOptions:{...n}}};var Wa=require("react/jsx-runtime");function Ha({value:e,max:t=100,className:n,indicatorClassName:r,...s}){let a=e===void 0,o=a?0:Math.min(100,Math.max(0,e/t*100));return(0,Wa.jsx)("div",{role:"progressbar","aria-valuenow":a?void 0:o,"aria-valuemin":0,"aria-valuemax":100,"data-slot":"progress",className:Ct("relative h-2 w-full overflow-hidden rounded-full bg-primary/20",n),...s,children:(0,Wa.jsx)("div",{"data-slot":"progress-indicator",className:Ct("h-full rounded-full bg-primary transition-[width] duration-300 ease-in-out will-change-transform",a&&"w-1/3 animate-progress-indeterminate",r),style:a?void 0:{width:`${o}%`}})})}var Bt="view";var ea=require("react"),Lo=require("react-router");ce();var St=require("@aiquants/resize-panels"),Yn=require("@aiquants/virtualscroll"),U=require("react");yt();var ln={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 qn(e){let t=e.listPanelMinWidth+e.detailPanelMinWidth+e.handleThickness+e.listPaddingAndBorder+e.detailPaddingAndBorder,n=t+e.scrollbarSafetyBuffer,r=n+e.hysteresisSafetyMargin,s=r-n;return{physicalMinWidth:t,collapseThreshold:n,expandThreshold:r,hysteresisWidth:s}}var Ut=require("react"),_a=(e,t)=>{let{enableMutationObserver:n=!1,bottomGap:r=4,minFallbackHeight:s=240}=t??{},[a,o]=(0,Ut.useState)(600),d=(0,Ut.useCallback)(()=>{if(typeof window>"u")return;let l=e.current;if(!l||l.offsetParent===null&&window.getComputedStyle(l).position!=="fixed")return;let c=v=>Number.parseFloat(v)||0,{top:m}=l.getBoundingClientRect(),p=l.parentElement?.getBoundingClientRect(),i=window.getComputedStyle(document.documentElement),u=c(i.getPropertyValue("--footer-height")),f=c(i.getPropertyValue("--header-height")),T=c(i.getPropertyValue("--scrollbar-height")),S=window.getComputedStyle(l),w=c(S.marginBottom),V=c(S.paddingBottom),H=window.innerHeight-u-T-r,y=p?Math.min(p.bottom,H):H,g=p?Math.max(p.top,f):f,$=Math.max(m,g),G=y-$-w-V,k=Number.isFinite(G)?Math.floor(G):0,h=k>0?k:s;h>0&&Number.isFinite(h)&&o(v=>Math.abs(v-h)>1?h:v)},[r,e,s]);return(0,Ut.useEffect)(()=>{if(typeof window>"u")return;let l=null,c=null,m=null,p=null,i=()=>{l!==null&&window.cancelAnimationFrame(l),l=window.requestAnimationFrame(()=>{d()})};i(),c=window.setTimeout(()=>{i()},150);let u=e.current;return typeof ResizeObserver<"u"&&u&&(m=new ResizeObserver(()=>{i()}),m.observe(u),u.parentElement&&m.observe(u.parentElement)),n&&typeof MutationObserver<"u"&&(p=new MutationObserver(()=>{i()}),p.observe(document.body,{attributes:!0,childList:!0,subtree:!0})),window.addEventListener("resize",i),()=>{l!==null&&window.cancelAnimationFrame(l),c!==null&&window.clearTimeout(c),m&&m.disconnect(),p&&p.disconnect(),window.removeEventListener("resize",i)}},[e,n,d]),{viewportHeight:a,updateViewportHeight:d}};var me=require("react"),_s=600,Zr=8,cn=({ref:e,onSelect:t,resolveItem:n,item:r})=>{let[s,a]=(0,me.useState)(!1),[o,d]=(0,me.useState)(null),l=(0,me.useRef)(null),c=(0,me.useRef)(!1),m=(0,me.useRef)(!1),p=(0,me.useRef)(null),i=(0,me.useRef)({onSelect:t,resolveItem:n,item:r});(0,me.useEffect)(()=>{i.current={onSelect:t,resolveItem:n,item:r}},[t,n,r]);let u=(0,me.useCallback)(()=>{typeof window>"u"||l.current!==null&&(window.clearTimeout(l.current),l.current=null)},[]),f=(0,me.useCallback)(()=>{p.current&&(u(),m.current=!1,p.current=null)},[u]),T=(0,me.useCallback)(g=>{typeof window>"u"||g.button!==0&&g.pointerType==="mouse"||(u(),m.current=!1,c.current=!1,p.current={x:g.clientX,y:g.clientY,pointerId:g.pointerId},l.current=window.setTimeout(()=>{let $=i.current,G=null;$.item!==void 0?G=$.item:$.resolveItem&&g.target&&(G=$.resolveItem(g.target)),G!==null&&(c.current=!0,$.onSelect?.(G),d(G),a(!0)),f()},_s))},[u,f]),S=(0,me.useCallback)(g=>{p.current&&g.pointerId===p.current.pointerId&&(u(),p.current=null,m.current=!1)},[u]),w=(0,me.useCallback)(g=>{c.current&&(g.preventDefault(),g.stopPropagation(),c.current=!1)},[]),V=(0,me.useCallback)(g=>{if(!p.current||g.pointerId!==p.current.pointerId)return;let $=Math.abs(g.clientX-p.current.x),G=Math.abs(g.clientY-p.current.y);($>Zr||G>Zr)&&(u(),p.current=null)},[u]),H=(0,me.useCallback)(g=>{(s||l.current!==null)&&(g.preventDefault(),g.stopPropagation())},[s]),y=(0,me.useCallback)(g=>{g?.cancelLongPressTimer&&u(),g?.suppressLongPress&&(m.current=!0),a(!1),d(null),c.current=!1,p.current=null},[u]);return(0,me.useEffect)(()=>{let g=e.current;if(!(g&&typeof window<"u"))return;let $=[["pointerdown",T,void 0],["pointerup",S,void 0],["pointercancel",S,void 0],["pointermove",V,void 0],["pointerleave",S,void 0],["click",w,!0],["contextmenu",H,void 0]],G=[["contextmenu",H,!0],["pointerup",S,!0],["pointercancel",S,!0]];for(let[k,h,v]of $)g.addEventListener(k,h,v);for(let[k,h,v]of G)window.addEventListener(k,h,v);return()=>{for(let[k,h,v]of $)g.removeEventListener(k,h,v);for(let[k,h,v]of G)window.removeEventListener(k,h,v);u()}},[e,T,S,V,w,H,u]),{isPopupVisible:s,popupItem:o,handleClosePopup:y}};var et=require("react");function pn(e,t,n){let r=n?.mediaQuery??"(min-width: 1024px)",s=(0,et.useSyncExternalStore)((0,et.useCallback)(m=>{if(typeof window>"u"||typeof window.matchMedia!="function")return()=>{};let p=window.matchMedia(r);return p.addEventListener("change",m),()=>p.removeEventListener("change",m)},[r]),()=>typeof window<"u"&&typeof window.matchMedia=="function"?window.matchMedia(r).matches:!0,()=>!1),[a,o]=(0,et.useState)(!1),[d,l]=(0,et.useState)(0);return(0,et.useEffect)(()=>{if(typeof window>"u"||typeof ResizeObserver>"u")return;let m=e.current;if(!m)return;let p=new ResizeObserver(i=>{for(let u of i){if(u.target!==m)continue;let f=0;u.borderBoxSize&&u.borderBoxSize.length>0?f=u.borderBoxSize[0].inlineSize:f=u.contentRect.width,!(!Number.isFinite(f)||f<=0)&&(l(f),o(T=>T&&f>=t.expandThreshold?!1:!T&&f<t.collapseThreshold?!0:T))}});return p.observe(m),()=>p.disconnect()},[e,t.collapseThreshold,t.expandThreshold]),{isTwoColumn:s&&!a,isContainerNarrow:a,isMediaMatches:s,containerWidth:d}}ce();var Qn=require("@aiquants/swipe-overlay"),$t=require("react");ce();Sa();var un=require("react/jsx-runtime"),mn=({isOpen:e,onClose:t,children:n,className:r="",title:s})=>{let a=J(),o=(0,$t.useRef)(null),{overlayRef:d,overlayStyle:l,attemptClose:c}=(0,Qn.useSwipeToDismissOverlay)({isOpen:e,onClose:t,isCloseBlocked:(0,$t.useCallback)(()=>!1,[]),skipWhenTextSelected:!0}),m=(0,Qn.useTapClick)(()=>c());return(0,$t.useEffect)(()=>{!e&&o.current?.contains(document.activeElement)&&document.activeElement.blur()},[e]),e?(0,un.jsxs)("div",{ref:o,"data-testid":"contact-map-mobile-overlay",className:`fixed top-0 bottom-0 left-0 z-50 flex touch-manipulation transition-[visibility] duration-200 ${e?"pointer-events-auto visible":"pointer-events-none invisible"}`,style:{right:"var(--aqcm-overlay-right, 0px)",transition:"right 0.5s, visibility 0.2s"},"aria-hidden":!e,children:[(0,un.jsx)("button",{type:"button","aria-label":a.overlayBackdrop,className:`absolute inset-0 touch-manipulation bg-slate-900/50 transition-opacity duration-200 focus:outline-none ${e?"opacity-100":"opacity-0"}`,...m}),(0,un.jsx)("aside",{role:"dialog","aria-modal":"true","aria-label":s===void 0?a.overlayTitle:s,style:l,ref:d,className:`relative ml-auto flex h-full w-full max-w-lg transform touch-pan-y flex-col bg-white shadow-xl transition-transform duration-200 ease-out dark:bg-slate-900 ${r}`,onKeyDown:p=>{p.key==="Escape"&&!An(p.nativeEvent)&&(p.stopPropagation(),c())},children:n})]}):null};Ma();var M=require("react/jsx-runtime"),As=(0,U.lazy)(async()=>({default:(await Promise.resolve().then(()=>(Nr(),wr))).default})),no=64,eo="h-[64px]",to=240,Is=4,Aa=qn(ln),ao=ln.listPanelMinWidth,ro=ln.detailPanelMinWidth,oo=ln.handleThickness,Fs=Aa.collapseThreshold,zs=Aa.expandThreshold,Bs=({contactData:e})=>{let t=J(),n=He(e?.full_name)??t.noName,r=He(e?.title)??"-",s=He(e?.company_name)??"-",a=He(e?.department)??"-",o=Lt(e).value??"-",d=Et(e).value??"-",l=Be(e?.updated_at,t.recordDateTime);return(0,M.jsx)(nn,{fullName:n,title:r,companyName:s,department:a,phoneNumber:d,email:o,updatedAtText:l})},Us=e=>({"--contact-panel-height":`${e}px`}),$s=e=>typeof e=="object"&&e!==null&&"item"in e,Vs=(e,t)=>t!==void 0?`${e}:${t.toFixed(3)}`:void 0,Ks=(e,t)=>{for(let n of e){let r=Rn(n);if(r?.person_id===t)return r}return null},Xn=(e,t,n)=>{let{viewportHeight:r}=_a(t,{enableMutationObserver:!0,bottomGap:Is,minFallbackHeight:to}),[s,a]=(0,U.useState)(0),o=(0,U.useCallback)(()=>{let p=n.current,i=t.current;if(!(p&&i))return;let u=p.getBoundingClientRect(),f=i.getBoundingClientRect(),T=Math.ceil(f.top-u.top);Number.isFinite(T)&&T>0&&a(S=>Math.abs(S-T)>1?T:S)},[t,n]);(0,U.useLayoutEffect)(()=>{if(!e)return;o();let p=requestAnimationFrame(o);return window.addEventListener("resize",o),()=>{cancelAnimationFrame(p),window.removeEventListener("resize",o)}},[e,o]);let d=r>0?r:to,l=s>0?s:0,c=d+l,m=(0,U.useMemo)(()=>Us(c),[c]);return{normalizedViewportHeight:d,normalizedDetailHeight:c,panelSizingStyle:m}},js=new Set,so=()=>{let[e,t]=(0,U.useState)(js),n=(0,U.useCallback)((r,s)=>{t(a=>{if(a.has(r)===s)return a;let o=new Set(a);return s?o.add(r):o.delete(r),o})},[]);return{isAnyPopupVisible:e.size>0,handlePopupVisibilityChange:n}},io=(e,t,n)=>{let r=(0,U.useRef)(n);(0,U.useLayoutEffect)(()=>{r.current=n},[n]),(0,U.useEffect)(()=>{if(e!==null)return r.current(e,t),()=>{r.current(e,!1)}},[e,t])},lo=(0,U.memo)(({entry:e,index:t,selectedPersonId:n,onSelect:r,searchQuery:s,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:d,onPopupVisibilityChange:l})=>{let c=J(),m=(0,U.useRef)(null),p=(0,M.jsx)("div",{className:eo}),i=$s(e)?e:null,u=Rn(e),{isPopupVisible:f,handleClosePopup:T}=cn({ref:m,onSelect:r,item:u?.person_id});if(io(u?.person_id??null,f,l),!e||!u)return p;let{person_id:S}=u,w=n===S,V=t%2===0?"bg-white dark:bg-slate-900":"bg-gray-50 dark:bg-slate-900/70",y=w?"border-blue-300 bg-blue-50 ring-1 ring-blue-200 dark:border-blue-500 dark:bg-blue-500/20 dark:ring-blue-500/40":V,g=["B","F"].map($=>Vs($,$==="B"?i?.baseScore:i?.score)).filter(Boolean);return(0,M.jsxs)("div",{ref:m,className:`flex ${eo} w-full items-center overflow-hidden border-gray-200 border-b px-4 py-2 text-left transition-colors hover:bg-blue-50 dark:border-slate-700 dark:hover:bg-blue-500/10 ${y}`,style:{height:no},role:"button","aria-pressed":w,"data-selected":w?"true":"false",onClick:()=>r(S),children:[(0,M.jsxs)("div",{className:"hidden w-28 shrink-0 flex-col items-center gap-0.5 text-center sm:flex",children:[(0,M.jsx)("div",{className:"whitespace-nowrap font-medium text-slate-700 text-xs leading-tight dark:text-slate-200",children:c.listRowNumber(t+1)}),(0,M.jsx)("div",{className:"truncate text-[11px] text-slate-700 leading-tight dark:text-slate-200",children:S}),(0,M.jsx)("div",{className:"flex items-center gap-1 whitespace-nowrap font-mono text-[11px] text-slate-600 leading-tight dark:text-slate-300",children:g.length?g.map($=>(0,M.jsx)("span",{children:$},$)):(0,M.jsx)("span",{children:"-"})})]}),(0,M.jsx)(U.Suspense,{fallback:(0,M.jsx)(Bs,{contactData:u}),children:(0,M.jsx)(As,{contactData:u,searchTerm:s,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:d,isPopupVisible:f,onRequestClose:T})})]})});lo.displayName="ContactListRow";var Ia=({context:e})=>{let{contactMapRecords:t,filteredItems:n,searchQuery:r,hasSearchTerm:s,enableHighlighting:a,openEmailsWithGmail:o,isSearchTabActive:d}=e,{locale:l,labels:c,engineLabels:m}=Se(),p=(0,U.useRef)(null),i=(0,U.useRef)(null),[u,f]=(0,U.useState)(null),{normalizedViewportHeight:T,panelSizingStyle:S}=Xn(d,i,p),{isAnyPopupVisible:w,handlePopupVisibilityChange:V}=so(),H=(0,U.useMemo)(()=>({enablePointerDrag:!w,enableKeyboardNavigation:!w}),[w]),y=(0,U.useMemo)(()=>s?n:t,[s,n,t]),g=(0,U.useCallback)(le=>{f(le)},[]),$=(0,U.useCallback)(le=>{if(!o)return;let Ee=le.trim();if(!Ee||Ee==="-"||typeof window>"u")return;let gt=Qe(Ee,!0);gt&&window.open(gt,"_blank","noopener,noreferrer")},[o]),[G,k]=(0,U.useState)(!1),h=(0,U.useCallback)(le=>{g(le),k(!0)},[g]),v=(0,U.useCallback)((le,Ee)=>(0,M.jsx)(lo,{entry:le,index:Ee,selectedPersonId:u,onSelect:h,searchQuery:r,enableHighlighting:a,openEmailsWithGmail:o,openGmailCompose:$,onPopupVisibilityChange:V}),[u,h,r,a,o,$,V]),F=(0,U.useCallback)(le=>y[le],[y]),P=(0,U.useCallback)(le=>Rn(y[le])?.person_id??`row-${le}`,[y]),ae=(0,U.useCallback)(()=>no,[]),L=y.length,E=(0,U.useMemo)(()=>({enabled:!0,renderVisual:Yn.tapScrollCircleSampleVisual}),[]),I=(0,U.useMemo)(()=>u===null?null:Ks(y,u),[u,y]);(0,U.useEffect)(()=>{u!==null&&!I&&f(null)},[u,I]);let q=(0,U.useRef)(null),{isTwoColumn:oe}=pn(q,Aa),ye=(0,M.jsxs)("div",{ref:p,className:"flex min-h-0 flex-1 flex-col gap-1",children:[(0,M.jsx)("div",{className:"hidden rounded-t-lg border border-gray-200 bg-gray-50 px-4 py-2 transition-colors sm:block dark:border-slate-700 dark:bg-slate-900/70",children:(0,M.jsxs)("div",{className:"flex items-center",children:[(0,M.jsxs)("div",{className:"flex w-28 shrink-0 flex-col items-center gap-0.5 text-center text-[11px] text-slate-700 uppercase tracking-wider dark:text-slate-200",children:[(0,M.jsx)("span",{className:"font-semibold text-slate-900 text-xs dark:text-slate-100",children:c.columnNo}),(0,M.jsx)("span",{className:"leading-tight",children:c.columnId}),(0,M.jsx)("span",{className:"whitespace-nowrap leading-tight",children:c.columnScore})]}),(0,M.jsxs)("div",{className:"hidden w-full grid-cols-3 gap-2 font-medium text-slate-700 text-xs uppercase tracking-wider transition-colors sm:grid xl:grid-cols-[minmax(0,1fr)_minmax(0,1fr)_minmax(0,1fr)_auto] dark:text-slate-200",children:[(0,M.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,M.jsx)("span",{children:c.columnName}),(0,M.jsx)("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnTitle})]}),(0,M.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,M.jsx)("span",{children:c.columnCompany}),(0,M.jsx)("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnDepartment})]}),(0,M.jsxs)("div",{className:"flex flex-col gap-0.5",children:[(0,M.jsx)("span",{children:c.columnPhone}),(0,M.jsx)("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnEmail})]}),(0,M.jsx)("div",{className:"hidden items-end justify-end xl:flex",children:(0,M.jsx)("span",{className:"font-normal text-[10px] text-slate-600 uppercase tracking-wider dark:text-slate-300",children:c.columnUpdatedAt})})]})]})}),(0,M.jsx)("div",{ref:i,className:"flex-1",children:(0,M.jsx)(Yn.VirtualScroll,{itemCount:L,getItemKey:P,behaviorOptions:H,getItem:F,getItemHeight:ae,viewportSize:T,overscanCount:10,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:E},locale:l,labels:m,className:"w-full rounded-b-lg border border-gray-200 border-t-0 bg-white pr-0.75 transition-colors dark:border-slate-700 dark:bg-slate-950",children:(le,Ee)=>v(le,Ee)})}),n.length===0&&s?(0,M.jsx)("div",{className:"py-8 text-center",children:(0,M.jsx)("p",{className:"text-slate-600 dark:text-slate-300",children:c.listNoSearchResults})}):null,L===0&&!s?(0,M.jsx)("div",{className:"py-8 text-center",children:(0,M.jsx)("p",{className:"text-slate-600 dark:text-slate-300",children:c.listNoData})}):null]});return(0,M.jsx)("div",{ref:q,"data-testid":"contact-map-list-root",className:"flex min-h-0 flex-1 flex-col",style:S,children:oe?(0,M.jsxs)(St.PanelGroup,{id:"contact-map-list-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-list-panel-group",children:[(0,M.jsx)(St.Panel,{id:"contact-map-list-pane",defaultSize:{value:68,unit:"percentage"},minSize:{value:ao,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:ye}),(0,M.jsx)(St.PanelResizeHandle,{id:"contact-map-list-handle",thickness:oo,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":c.listResizeHandle}),(0,M.jsx)(St.Panel,{id:"contact-map-list-detail-pane",defaultSize:{value:32,unit:"percentage"},minSize:{value:ro,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:(0,M.jsx)(Je,{contact:I,searchTerm:r,enableHighlighting:a})})]}):(0,M.jsxs)(M.Fragment,{children:[ye,(0,M.jsx)("div",{className:"hidden","aria-hidden":"true",children:(0,M.jsx)(Je,{contact:I,searchTerm:r,enableHighlighting:a})}),I?(0,M.jsx)(mn,{isOpen:G,onClose:()=>k(!1),className:"z-50 bg-white dark:bg-slate-900",children:(0,M.jsxs)("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[(0,M.jsxs)("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[(0,M.jsx)("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:c.detailHeading}),(0,M.jsx)("button",{type:"button",onClick:()=>k(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:c.close})]}),(0,M.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:(0,M.jsx)(Je,{contact:I,searchTerm:r,enableHighlighting:a})})]})}):null]})})};var xo=require("@aiquants/directory-tree"),wt=require("@aiquants/resize-panels"),vo=require("@aiquants/virtualscroll"),Co=de(require("@heroicons/react/24/solid/FolderMinusIcon.js")),ko=de(require("@heroicons/react/24/solid/FolderPlusIcon.js")),_=require("react"),So=require("react-dom");yt();var Fa=(e,t)=>e&&e.trim()||t;var tt=require("react"),za=(e,t=250)=>{let[n,r]=(0,tt.useState)(e),s=(0,tt.useRef)(null),a=(0,tt.useRef)(e),o=(0,tt.useRef)(null),d=(0,tt.useRef)(!1);return(0,tt.useEffect)(()=>{if(!d.current){d.current=!0,r(e),a.current=e;return}a.current=n,s.current=null;let l=c=>{s.current??(s.current=c);let m=c-s.current,p=Math.min(1,Math.max(0,m/t)),i=1-(1-p)**3,u=Math.max(0,Math.round(a.current+(e-a.current)*i));r(u),p<1&&(o.current=requestAnimationFrame(l))};return o.current=requestAnimationFrame(l),()=>{o.current!==null&&cancelAnimationFrame(o.current)}},[e,t]),Math.max(0,n)};var Ce=require("react");Ot();ce();var mo={},Gs=250,qs=4e3,Jn=3,co={treeWorkerFactory:"the view remounts","workerUrls.treeWorker":"the page reloads"},po=(e,t)=>e.uncategorizedCompany===t.uncategorizedCompany&&e.unnamedPerson===t.unnamedPerson,gn=class{constructor(t,{workerSource:n,logger:r=Ve}){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>=Jn){this.logger.error(`[TreeWorker] the tree Worker failed ${Jn} times in a row; the tree stops updating until ${co[this.workerSource]} (check ${this.workerSource})`,t);return}let n=Math.min(Gs*2**(this.consecutiveFailures-1),qs);this.logger.warn(`[TreeWorker] the tree Worker failed; retrying in ${n}ms (failure ${this.consecutiveFailures} of ${Jn})`,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 ${se(n)}`);if(!Object.hasOwn(co,n))throw new RangeError(`[contact-map] TreeWorkerSession workerSource must be "treeWorkerFactory" or "workerUrls.treeWorker"; got ${se(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>=Jn||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||!po(this.finalizeRequest.naming,n))&&(this.finalizeRequest=null),this.lastSyncedRecords=t,this.lastSyncedNaming=n;let r=this.ensureWorker();if(!r)return;let s=this.workerNeedsReset,a=this.postedNaming===null||!po(this.postedNaming,n);if((this.workerNeedsReset||a||t.length<this.postedCount)&&(this.generation+=1,this.postedCount=0,this.finalizedPostedCount=null,this.workerNeedsReset=!1,this.postedNaming=n,r.postMessage({type:"RESET_TREE",generation:this.generation,epochBase:this.latestSnapshot?.rebuildEpoch??0,naming:n}),this.updateState()),t.length>this.postedCount){let o=t.slice(this.postedCount);this.postedCount=t.length,r.postMessage({type:"APPEND_RECORDS",generation:this.generation,records:o}),this.updateState()}s&&this.finalizeRequest!==null&&this.finalize()}finalize(){this.finalizeRequest={recordCount:this.lastSyncedRecords.length,naming:this.lastSyncedNaming},!(this.worker===null||this.finalizedPostedCount===this.postedCount)&&(this.finalizedPostedCount=this.postedCount,this.worker.postMessage({type:"FINALIZE_TREE",generation:this.generation}))}cancelWorker(){this.retryTimer!==null&&(clearTimeout(this.retryTimer),this.retryTimer=null),this.worker?.terminate(),this.worker=null,this.postedCount=0,this.postedNaming=null,this.finalizedPostedCount=null}stop(){this.cancelWorker(),this.consecutiveFailures=0,this.updateState()}reset(){this.cancelWorker(),this.listeners.clear(),this.latestSnapshot=null,this.lastSyncedRecords=[],this.lastSyncedNaming=null,this.consecutiveFailures=0,this.finalizeRequest=null,this.state={snapshot:null,isBuilding:!1}}},Qs=e=>{if(e!==void 0)return new Worker(e,{type:"module"});let t=typeof mo<"u"?mo.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)")},Tt=null,uo=e=>e===void 0?"the bundled Worker file (workerUrls.treeWorker unset)":JSON.stringify(e),Ys=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},go=e=>{if(Oa(e),Tt===null){let t=new gn(()=>Qs(e),{workerSource:"workerUrls.treeWorker"});return Tt={session:t,workerUrl:e},t}if(Tt.workerUrl!==e)throw new Error(`[contact-map] the tree session already loads its Worker from ${uo(Tt.workerUrl)} and cannot also load it from ${uo(e)}; give every contact-map view in the browser tab the same workerUrls.treeWorker, on every route (after changing it, reload the page)`);return Tt.session},Xs=()=>{Tt?.session.reset(),Tt=null},Js={snapshot:null,isBuilding:!1};function Ba(e,t=!1){let n=Ke(),r=n.treeWorkerFactory,s=n.workerUrls?.treeWorker,{labels:a}=Se(),o=a.uncategorizedCompany,d=a.noName,l=(0,Ce.useMemo)(()=>({uncategorizedCompany:o,unnamedPerson:d}),[o,d]),c=(0,Ce.useRef)(r);(0,Ce.useEffect)(()=>{c.current=r},[r]);let m=r!==void 0,p=m?void 0:s,i=(0,Ce.useMemo)(()=>m?new gn(()=>Ys(c.current)(),{workerSource:"treeWorkerFactory"}):null,[m]),u=(0,Ce.useCallback)(()=>i===null?go(p):i,[i,p]),f=(0,Ce.useCallback)(S=>u().subscribe(S),[u]),T=(0,Ce.useCallback)(()=>u().getState(),[u]);return(0,Ce.useEffect)(()=>{let S=u();S.syncRecords(e,l),t&&S.finalize()},[u,e,t,l]),(0,Ce.useEffect)(()=>{if(i!==null)return()=>i.stop()},[i]),(0,Ce.useSyncExternalStore)(f,T,()=>Js)}ce();Na();zn();var N=require("react/jsx-runtime"),Va=qn(dn),To=dn.listPanelMinWidth,wo=dn.detailPanelMinWidth,No=dn.handleThickness,Zs=Va.collapseThreshold,ei=Va.expandThreshold,ti=(e,t)=>{let{searchQuery:n,enableHighlighting:r}=t,s=Fa(e.full_name,t.noName),a=Fa(e.title,""),o=(0,N.jsx)(he,{text:s,query:n,enabled:r});return a?(0,N.jsxs)("span",{className:"flex items-center gap-1.5",children:[(0,N.jsx)("span",{children:o}),(0,N.jsx)("span",{className:"text-slate-400 text-xs dark:text-slate-500",children:(0,N.jsx)(he,{text:a,query:n,enabled:r})})]}):o},ni="contact-map-tree h-full w-full",ai={hoverClassName:"bg-slate-100/70 dark:bg-slate-800/60",directorySelectedClassName:"bg-sky-100/55 dark:bg-sky-900/40 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300",itemSelectedClassName:"bg-sky-100/70 dark:bg-sky-900/55 [&_.directory-tree-name]:text-sky-700 dark:[&_.directory-tree-name]:text-sky-300"},Ua="h-4 w-4 shrink-0 transition-colors duration-150",Mo=(e,t,n)=>({...e,viewportHeightOverride:t,behaviorOptions:{...e.behaviorOptions,enablePointerDrag:!n}}),Zn=null,ho=null,hn=new Map,fo="",yo=null,bo=null,ri=(e,t,n,r,s)=>{let a=`${n?"icons":"plain"}#${r}#${s.noName}`;(a!==fo||s.formatDirectoryName!==yo||t!==bo)&&(hn.clear(),fo=a,yo=s.formatDirectoryName,bo=t);let o={entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},d=new Set;for(let l of e){d.add(l.absolutePath);let c=`${l.name}\0${l.memberCount}`,m=hn.get(l.absolutePath);(!m||m.signature!==c)&&(m={signature:c,result:Ro([l],t,n,{searchQuery:"",enableHighlighting:!1,noName:s.noName,formatDirectoryName:s.formatDirectoryName})},hn.set(l.absolutePath,m));let p=m.result;p.entries.length>0&&o.entries.push(p.entries[0]);for(let[i,u]of p.personPathMap){let f=o.personPathMap.get(i);if(f)for(let T of u)f.add(T);else o.personPathMap.set(i,new Set(u))}for(let[i,u]of p.contactByPath)o.contactByPath.set(i,u);for(let[i,u]of p.ancestorsByPath)o.ancestorsByPath.set(i,u);o.totalCount+=p.totalCount,!o.firstPerson&&p.firstPerson&&(o.firstPerson=p.firstPerson)}for(let l of hn.keys())d.has(l)||hn.delete(l);return o},$a=e=>e.isSelected||e.isItemSelected?"text-sky-600 dark:text-sky-300":e.isExpanded&&e.isDirectory?"text-slate-600 dark:text-slate-200":"text-slate-500 dark:text-slate-400",Po=e=>{let t=[];for(let n of e)n.type==="directory"&&(t.push(n.absolutePath),n.children&&t.push(...Po(n.children)));return t},oi=e=>{if(e.memberCount===void 0)throw new Error(`[contact-map] directory entry ${e.absolutePath} has no memberCount`);return e.memberCount},Ro=(e,t,n,r,s)=>{let a=new Map,o=new Map,d=new Map,l=0,c=null,m=(i,u)=>{let f=[...u,i.absolutePath];d.set(i.absolutePath,f);let T,S,w=i.type==="directory"?r.formatDirectoryName(i.name,oi(i)):i.name,V=(0,N.jsx)(he,{text:w,query:r.searchQuery,enabled:r.enableHighlighting});if(i.type==="file"&&i.personId){if(s&&!s.has(i.personId))return null;let H=t.get(i.personId);if(H){o.set(i.absolutePath,H),a.has(i.personId)||a.set(i.personId,new Set);let y=a.get(i.personId);y&&y.add(i.absolutePath),l++,c||(c={personId:i.personId,path:i.absolutePath}),n&&(S=g=>{let $=$a(g);return g.isSelected||g.isItemSelected||i.isPrimary&&($=i.title?"text-indigo-600 dark:text-indigo-400":"text-orange-500 dark:text-orange-400"),(0,N.jsx)(n.person,{"aria-hidden":"true",className:`${Ua} ${$}`})},i.title&&(V=ti(H,r))),V=(0,N.jsx)("span",{"data-contact-path":i.absolutePath,className:"block w-full",children:V})}}else if(i.children){let H=i.children.map(y=>m(y,f)).filter(y=>y!==null);if(s&&H.length===0)return null;if(T=H,n){let y=i.relativePath.startsWith("company:")?n.company:n.department;S=g=>(0,N.jsx)(y,{"aria-hidden":"true",className:`${Ua} ${$a(g)}`})}}return{name:w,label:V,type:i.type,absolutePath:i.absolutePath,relativePath:i.relativePath,icon:S,children:T}};return{entries:e.map(i=>m(i,[])).filter(i=>i!==null),personPathMap:a,contactByPath:o,ancestorsByPath:d,firstPerson:c,totalCount:l}},si=(e,t,n)=>{let r=new Set,s=new Set,a=new Map;t.forEach((m,p)=>{a.set(m.item.person_id,p)});for(let m of t){let p=m.item.person_id,i=e.personPathMap.get(p);if(i)for(let u of i){r.add(u);let f=e.ancestorsByPath.get(u);if(f){for(let T of f)r.add(T);n&&f.length>0&&s.add(f[0])}}}let o=new Map,d=m=>{let p=o.get(m.absolutePath);if(p!==void 0)return p;let i=1/0;if(m.type==="file"){let u=e.contactByPath.get(m.absolutePath);u&&(i=a.get(u.person_id)??1/0)}else if(m.children)for(let u of m.children)i=Math.min(i,d(u));return o.set(m.absolutePath,i),i},l=(m,p=0)=>m.filter(i=>n&&p===0&&s.has(i.absolutePath)?!0:r.has(i.absolutePath)).map(i=>n&&p===0&&s.has(i.absolutePath)?i:i.type==="directory"&&i.children?{...i,children:l(i.children,p+1)}:i).sort((i,u)=>p===0?d(i)-d(u):0),c=l(e.entries);return{...e,entries:c}},Ka=({context:e,controlsContainer:t})=>{let{contactMapRecords:n,contactMapRecordMap:r,filteredItems:s,hasSearchTerm:a,isSearchInProgress:o,isSearchTabActive:d}=e,{locale:l,labels:c,treeLabels:m}=Se(),p=c.noName,i=c.treeDirectoryName,u=(0,_.useMemo)(()=>({noName:p,formatDirectoryName:i}),[p,i]),[f,T]=(0,_.useState)(null),[S,w]=(0,_.useState)(!1),{snapshot:V,isBuilding:H}=Ba(n,e.isStreamingComplete),y=V?.tree??null,g=V?.rebuildEpoch??0,$=(0,_.useMemo)(()=>y?ri(y,r,f,g,u):null,[y,r,f,g,u]),G=(0,_.useMemo)(()=>{if(!y)return null;if(!a)return $;let W;S||(W=new Set(s.map(ee=>ee.item.person_id)));let Q=Ro(y,r,f,{...u,searchQuery:e.searchQuery,enableHighlighting:e.enableHighlighting},W);return si(Q,s,S)},[y,$,r,f,e.searchQuery,e.enableHighlighting,a,s,S,u]),k=(0,_.useMemo)(()=>G||{entries:[],personPathMap:new Map,contactByPath:new Map,ancestorsByPath:new Map,firstPerson:null,totalCount:0},[G]),h=a&&e.errorMessage!==null,[v,F]=(0,_.useState)(k),P=(0,_.useRef)(!1);(0,_.useEffect)(()=>{if(!(o||h)){P.current=!!y,F(k);return}!P.current&&y&&k.entries.length>0&&(P.current=!0,F(k))},[k,y,o,h]);let ae=a&&(o||h)?v:k,{entries:L,personPathMap:E,contactByPath:I,totalCount:q}=ae,oe=(0,_.useMemo)(()=>Po(L),[L]),[ye,le]=(0,_.useState)(()=>ho??new Set),Ee=(0,_.useCallback)(W=>!ye.has(W),[ye]),gt=(0,_.useCallback)(W=>{le(Q=>{let ee=new Set(Q);return ee.has(W)?ee.delete(W):ee.add(W),ee})},[]),Mt=(0,_.useCallback)(W=>{W.length!==0&&le(Q=>{let ee=new Set(Q);for(let Oe of W)ee.add(Oe);return ee})},[]),fn=(0,_.useCallback)(W=>{le(Q=>{if(Q.size===0)return Q;let ee=!1,Oe=new Set(Q);for(let K of W)Oe.delete(K)&&(ee=!0);return ee?Oe:Q})},[]);(0,_.useEffect)(()=>{ho=ye},[ye]),(0,_.useEffect)(()=>{if(!(typeof window>"u"))try{window.localStorage.removeItem("contact-map.tree-expanded")}catch{}},[]);let[ge,Kt]=(0,_.useState)(null),[we,at]=(0,_.useState)(null),[yn,Ge]=(0,_.useState)(!1),[ca,bn]=(0,_.useState)(!1),xn=(0,_.useRef)(null),jt=(0,_.useRef)(null),{normalizedViewportHeight:re,panelSizingStyle:vn}=Xn(d,jt,xn),rt=(0,_.useCallback)(W=>{let Q=I.get(W);Q&&(ge!==Q.person_id&&Kt(Q.person_id),W!==we&&at(W),Ge(!0))},[I,we,ge]),Gt=(0,_.useCallback)(W=>{rt(W.entry.absolutePath)},[rt]),ot=(0,_.useCallback)(W=>W instanceof Element?W.closest("[data-contact-path]")?.getAttribute("data-contact-path")??null:null,[]),{isPopupVisible:Ne,popupItem:qt,handleClosePopup:Qt}=cn({ref:jt,resolveItem:ot,onSelect:rt}),Ie=(0,_.useCallback)(W=>{if(!e.openEmailsWithGmail)return;let Q=W.trim();if(!Q||Q==="-"||typeof window>"u")return;let ee=Qe(Q,!0);ee&&window.open(ee,"_blank","noopener,noreferrer")},[e.openEmailsWithGmail]),st=qt?I.get(qt):null,Fe=Ne&&st!==null&&st!==void 0;(0,_.useEffect)(()=>{Ne&&!st&&Qt()},[Ne,st,Qt]);let ht=(0,_.useMemo)(()=>({overscanCount:16,callbackThrottleMs:16,scrollBarOptions:{width:8,enableScrollToTopBottomButtons:!0,tapScrollCircleOptions:{enabled:!0,renderVisual:vo.tapScrollCircleSampleVisual}},behaviorOptions:{resetOnGetItemHeightChange:!1},preserveScrollAnchor:!0}),[]),it=(0,_.useMemo)(()=>Mo(ht,re,Fe),[ht,re,Fe]);(0,_.useEffect)(()=>{let W=!1;return typeof window>"u"?()=>{W=!0}:Zn?(T(Zn),()=>{W=!0}):((async()=>{try{let[ee,Oe,K,Y]=await Promise.all([import("lucide-react/dist/esm/icons/building-2.js"),import("lucide-react/dist/esm/icons/users-round.js"),import("lucide-react/dist/esm/icons/id-card.js"),import("lucide-react/dist/esm/icons/user-round.js")]);if(W)return;let fe=ee.default,ze=Oe.default,ga=K.default,Ja=Y.default;fe&&ze&&ga&&Ja&&(Zn={company:fe,department:ze,title:ga,person:Ja},T(Zn))}catch(ee){Ve.warn("Failed to load lucide icons",ee)}})(),()=>{W=!0})},[]);let ft=(0,_.useMemo)(()=>{if(!f)return;let W=Y=>fe=>(0,N.jsx)(Y,{"aria-hidden":"true",className:`${Ua} ${$a(fe)}`}),Q={company:W(f.company),department:W(f.department),title:W(f.title)},ee=W(f.person),Oe=Y=>Y in Q,K=Y=>{let[fe]=Y.entry.relativePath.split(":",1);return(Oe(fe)?Q[fe]:Q.company)(Y)};return{directory:K,directoryExpanded:K,file:ee}},[f]),Pt=(0,_.useCallback)(()=>{le(W=>W.size===0?W:new Set)},[]),pa=(0,_.useCallback)(()=>{oe.length>0&&Mt(oe)},[oe,Mt]);(0,_.useEffect)(()=>{if(typeof window>"u")return;let W=document.documentElement,Q=window.matchMedia("(prefers-color-scheme: dark)"),ee=()=>bn(W.classList.contains("dark")||Q.matches);ee(),Q.addEventListener("change",ee);let Oe=new MutationObserver(ee);return Oe.observe(W,{attributes:!0,attributeFilter:["class"]}),()=>{Q.removeEventListener("change",ee),Oe.disconnect()}},[]),(0,_.useEffect)(()=>{if(q===0){ge!==null&&Kt(null),we!==null&&at(null);return}if(ge!==null){let W=E.get(ge);if(W){if(we&&W.has(we))return;let Q=W.values().next().value;Q&&at(Q);return}}ge!==null&&Kt(null),we!==null&&at(null)},[q,ge,we,E]);let lt=we?I.get(we)??null:null,qe=ca?"#475569":"#94A3B8",Yt=e.isStreamingComplete,ua=e.isStreamingFailed,Cn=Yt&&n.length===0,kn=(H||!y)&&!Cn,Sn=za(q,250),dt=y!==null||Cn,Rt=(0,N.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded bg-slate-100 px-1.5 font-medium font-mono text-[10px] text-slate-700 dark:bg-slate-800 dark:text-slate-200",title:c.treeNodeCountTitle,children:[(0,N.jsx)("span",{className:"text-[10px]",children:"\u{1F333}"})," ",c.treeNodeCountLabel," ",dt?c.treeNodeCount(Sn):"\u2026"]}),ua&&!Yt?(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-rose-200 bg-rose-50 px-1.5 font-medium text-[10px] text-rose-700 dark:border-rose-800 dark:bg-rose-950/60 dark:text-rose-300",title:c.treeStreamInterruptedTitle,children:[(0,N.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-rose-500"}),(0,N.jsx)("span",{className:"text-[10px]",children:"\u26D4"})," ",c.treeStreamInterrupted]}):Yt?kn?(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-amber-200 bg-amber-50 px-1.5 font-medium text-[10px] text-amber-700 dark:border-amber-800 dark:bg-amber-950/60 dark:text-amber-300",title:c.treeBuildingTitle,children:[(0,N.jsxs)("span",{className:"relative flex h-1.5 w-1.5",children:[(0,N.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-amber-400 opacity-75"}),(0,N.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-amber-500"})]}),(0,N.jsx)("span",{className:"text-[10px]",children:"\u{1F33F}"})," ",c.treeBuilding]}):(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-emerald-200 bg-emerald-50 px-1.5 font-medium text-[10px] text-emerald-700 dark:border-emerald-800 dark:bg-emerald-950/60 dark:text-emerald-300",title:c.treeCompleteTitle,children:[(0,N.jsx)("span",{className:"h-1.5 w-1.5 rounded-full bg-emerald-500"}),(0,N.jsx)("span",{className:"text-[10px]",children:"\u2705"})," ",c.treeComplete]}):(0,N.jsxs)("span",{className:"inline-flex h-5 items-center gap-1 rounded border border-sky-200 bg-sky-50 px-1.5 font-medium text-[10px] text-sky-700 dark:border-sky-800 dark:bg-sky-950/60 dark:text-sky-300",title:c.treeStreamLoadingTitle,children:[(0,N.jsxs)("span",{className:"relative flex h-1.5 w-1.5",children:[(0,N.jsx)("span",{className:"absolute inline-flex h-full w-full animate-ping rounded-full bg-sky-400 opacity-75"}),(0,N.jsx)("span",{className:"relative inline-flex h-1.5 w-1.5 rounded-full bg-sky-500"})]}),(0,N.jsx)("span",{className:"text-[10px]",children:"\u23F3"})," ",c.treeStreamLoading]}),a&&(0,N.jsxs)("button",{type:"button",onClick:()=>w(!S),className:`inline-flex h-5 items-center rounded px-1.5 text-[10px] transition-colors ${S?"bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300":"text-slate-500 hover:bg-slate-100 dark:text-slate-400 dark:hover:bg-slate-800"}`,title:c.treeShowEntireCompanyTitle,children:[(0,N.jsx)("span",{className:"text-[10px]",children:"\u{1F3E2}"})," ",c.treeShowEntireCompany]}),oe.length>0?(0,N.jsxs)("div",{className:"flex items-center gap-1",children:[(0,N.jsx)("button",{type:"button",onClick:Pt,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":c.treeExpandAll,title:c.treeExpandAllTitle,children:(0,N.jsx)(ko.default,{className:"h-3 w-3"})}),(0,N.jsx)("button",{type:"button",onClick:pa,className:"inline-flex h-5 w-5 items-center justify-center rounded border border-slate-300 bg-white text-slate-500 transition-colors hover:bg-slate-100 hover:text-slate-700 dark:border-slate-600 dark:bg-slate-800 dark:text-slate-200 dark:hover:bg-slate-700 dark:hover:text-slate-100","aria-label":c.treeCollapseAll,title:c.treeCollapseAllTitle,children:(0,N.jsx)(Co.default,{className:"h-3 w-3"})})]}):null]}),Tn=(0,_.useRef)(null),{isTwoColumn:wn}=pn(Tn,Va,{mediaQuery:"(min-width: 768px)"}),Nn=(0,_.useMemo)(()=>({toggle:gt,isExpanded:Ee,expandMultiple:fn,collapseMultiple:Mt,isPending:o}),[Mt,fn,Ee,gt,o]),Mn=(0,_.useMemo)(()=>({onEntryClick:Gt,selectedPath:we}),[Gt,we]),ma=(0,_.useMemo)(()=>({className:ni,lineColor:qe,iconOverrides:ft,showDirectoryIcons:!!ft,showFileIcons:!!ft,highlightStyles:ai,entryClassName:"rounded-md px-1 py-0.5",nameClassName:"text-xs tracking-tight",directoryNameClassName:"font-normal text-slate-800 dark:text-slate-100",fileNameClassName:"text-slate-700 dark:text-slate-200"}),[qe,ft]),Xt=(0,N.jsx)("div",{ref:xn,className:"flex min-h-0 flex-1 flex-col rounded-xl border border-slate-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-950",children:(0,N.jsx)("div",{ref:jt,className:"flex min-h-0 flex-1 flex-col overflow-hidden p-2",children:L.length>0?(0,N.jsx)(xo.DirectoryTree,{entries:L,expansion:Nn,selection:Mn,visual:ma,virtualScroll:it,locale:l,labels:m}):(0,N.jsx)("div",{className:"flex h-full w-full items-center justify-center rounded-lg border border-slate-300 border-dashed bg-white/70 px-6 text-center text-slate-500 text-sm transition-colors dark:border-slate-700 dark:bg-slate-900/50 dark:text-slate-300",children:a?c.treeNoMatches:c.treeEmpty})})});return(0,N.jsxs)("div",{ref:Tn,"data-testid":"contact-map-tree-root",className:"flex min-h-0 flex-1 flex-col",style:vn,children:[t&&(0,So.createPortal)(Rt,t),wn?(0,N.jsxs)(wt.PanelGroup,{id:"contact-map-tree-panels",direction:"horizontal",className:"flex min-h-0 w-full flex-1","data-testid":"contact-map-tree-panel-group",children:[(0,N.jsx)(wt.Panel,{id:"contact-map-tree-pane",defaultSize:{value:60,unit:"percentage"},minSize:{value:To,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col",children:Xt}),(0,N.jsx)(wt.PanelResizeHandle,{id:"contact-map-tree-handle",thickness:No,indicator:{visible:!0,thickness:6,length:32,barThickness:2,barLength:16},className:"cursor-col-resize rounded transition-colors hover:bg-slate-200/60 focus:outline-none focus-visible:ring-2 focus-visible:ring-blue-500 focus-visible:ring-offset-1 dark:hover:bg-slate-700/60","aria-label":c.treeResizeHandle}),(0,N.jsx)(wt.Panel,{id:"contact-map-tree-detail-pane",defaultSize:{value:40,unit:"percentage"},minSize:{value:wo,unit:"pixels"},maxSize:{value:600,unit:"pixels"},contentOverflow:"hidden",className:"flex min-h-0 flex-col pl-1",children:(0,N.jsx)(Je,{contact:lt??null,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]}):(0,N.jsxs)(N.Fragment,{children:[Xt,(0,N.jsx)("div",{className:"hidden","aria-hidden":"true",children:(0,N.jsx)(Je,{contact:lt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})}),yn&<?(0,N.jsx)(mn,{isOpen:yn,onClose:()=>Ge(!1),className:"z-50 bg-white dark:bg-slate-900",children:(0,N.jsxs)("div",{className:"flex h-full flex-col overflow-hidden p-3 sm:p-4",children:[(0,N.jsxs)("div",{className:"mb-2 flex items-center justify-between border-b pr-10 pb-2 dark:border-slate-700",children:[(0,N.jsx)("h3",{className:"font-semibold text-slate-900 text-sm dark:text-slate-100",children:c.detailHeading}),(0,N.jsx)("button",{type:"button",onClick:()=>Ge(!1),className:"rounded px-2.5 py-1 font-medium text-slate-600 text-xs hover:bg-slate-100 dark:text-slate-300 dark:hover:bg-slate-800",children:c.close})]}),(0,N.jsx)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto",style:{height:"100%"},children:(0,N.jsx)(Je,{contact:lt,searchTerm:e.searchQuery,enableHighlighting:e.enableHighlighting})})]})}):null]}),Fe&&st&&(0,N.jsx)(tn,{contactData:st,openEmailsWithGmail:e.openEmailsWithGmail,openGmailCompose:Ie,onRequestClose:Qt})]})};var Le=require("react/jsx-runtime"),ii={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},li=e=>e==="tree"?"tree":"list",ja=({context:e})=>{let t=J(),[n,r]=(0,Lo.useSearchParams)(),[s,a]=(0,ea.useState)(null),o=li(n.get(Bt)),{setScrollableRef:d,onPointerDown:l,onPointerMove:c,onPointerUp:m,onPointerLeave:p,onPointerCancel:i,onClickCapture:u}=Ze(),f=(0,ea.useCallback)(T=>{let S=T==="tree"?"tree":"list";if(S===o)return;let w=new URLSearchParams(typeof window<"u"?window.location.search:"");S==="list"?w.delete(Bt):w.set(Bt,S),r(w,{replace:!0})},[o,r]);return(0,Le.jsxs)("div",{"data-testid":"contact-map-search-tab-group",className:"flex h-full flex-1 flex-col",children:[(0,Le.jsxs)("div",{className:"mt-1 mb-1.5 flex shrink-0 items-center gap-2",children:[(0,Le.jsxs)("div",{ref:d,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-lg bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:ii,onPointerDown:l,onPointerMove:c,onPointerUp:m,onPointerLeave:p,onPointerCancel:i,onClickCapture:u,children:[(0,Le.jsxs)("button",{type:"button","data-testid":"contact-map-tab-list",onClick:()=>f("list"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="list"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4C4} ",t.listViewTab]}),(0,Le.jsxs)("button",{type:"button","data-testid":"contact-map-tab-tree",onClick:()=>f("tree"),className:`rounded px-2 py-0.5 text-xs transition-colors ${o==="tree"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F333} ",t.treeViewTab]})]}),(0,Le.jsx)("div",{ref:a,className:"flex items-center gap-1.5"})]}),(0,Le.jsxs)("div",{className:"flex h-full flex-1 flex-col",children:[(0,Le.jsx)("div",{className:`${o==="list"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="list"?(0,Le.jsx)(Ia,{context:e}):null}),(0,Le.jsx)("div",{className:`${o==="tree"?"flex h-full flex-1 flex-col":"hidden"}`,children:o==="tree"?(0,Le.jsx)(Ka,{context:e,controlsContainer:s}):null})]})]})};var Eo=require("react");ce();var j=require("@aiquants/fuzzy-search"),be=require("react");ce();var b=require("react/jsx-runtime"),Ga=1e3,ta=(0,be.memo)(({searchOptions:e,setSearchOptions:t})=>{let n=J(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=e.sortBy==="relevance",o=(0,be.useId)(),d=(0,be.useId)(),l=(0,be.useId)(),c=(0,be.useId)(),m=(0,be.useId)(),p=(0,be.useId)(),i=(0,be.useId)(),u=(0,be.useId)(),f=(0,be.useId)(),T=(0,be.useId)(),S=(0,be.useId)(),w=[];w.push((0,b.jsxs)("div",{className:`${r} border-green-200 border-l-4 dark:border-green-400/60`,children:[(0,b.jsxs)("div",{className:`${s} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",n.indexBuildHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramSize}),(0,b.jsx)("input",{id:o,type:"range",min:"1",max:"4",step:"1",value:e.ngramSize||j.DEFAULT_FUZZY_SEARCH_OPTIONS.ngramSize,onChange:y=>t(g=>({...g,ngramSize:parseInt(y.target.value,10)})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.ngramSize||j.DEFAULT_FUZZY_SEARCH_OPTIONS.ngramSize]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramSizeHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinNgramOverlap}),(0,b.jsx)("input",{id:d,type:"range",min:"1",max:"5",step:"1",value:e.minNgramOverlap||j.DEFAULT_FUZZY_SEARCH_OPTIONS.minNgramOverlap,onChange:y=>t(g=>({...g,minNgramOverlap:parseInt(y.target.value,10)})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-green-600 text-xs dark:text-green-300",children:[n.currentValueLabel," ",e.minNgramOverlap||j.DEFAULT_FUZZY_SEARCH_OPTIONS.minNgramOverlap]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinNgramOverlapHint})]})]},"index-build")),w.push((0,b.jsxs)("div",{className:`${r} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[(0,b.jsxs)("div",{className:`${s} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",n.indexCandidateHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexThreshold}),(0,b.jsx)("input",{id:l,type:"range",min:"0.0",max:"1.0",step:"0.05",value:e.indexWorkerOptions?.threshold??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.threshold,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,threshold:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.threshold??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.threshold]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexThresholdHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexNgramOverlapThreshold}),(0,b.jsx)("input",{id:m,type:"range",min:"0.1",max:"0.9",step:"0.1",value:e.indexWorkerOptions?.ngramOverlapThreshold??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.ngramOverlapThreshold,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,ngramOverlapThreshold:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-blue-600 text-xs dark:text-blue-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.ngramOverlapThreshold??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.ngramOverlapThreshold]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexNgramOverlapThresholdHint})]})]},"candidate-control")),w.push((0,b.jsxs)("div",{className:`${r} border-cyan-200 border-l-4 dark:border-cyan-400/60`,children:[(0,b.jsxs)("div",{className:`${s} text-cyan-700 dark:text-cyan-300`,children:["\u{1F9ED} ",n.indexStrategyHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexStrategy}),(0,b.jsxs)("select",{id:c,value:e.indexWorkerOptions?.strategy??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.strategy??"hybrid",onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,strategy:y.target.value}})),className:"rounded border border-gray-300 px-2 py-1 text-xs transition-colors dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100",children:[(0,b.jsx)("option",{value:"fast",children:n.indexStrategyFast}),(0,b.jsx)("option",{value:"accurate",children:n.indexStrategyAccurate}),(0,b.jsx)("option",{value:"hybrid",children:n.indexStrategyHybrid})]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexStrategyHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMinCandidatesRatio}),(0,b.jsx)("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.minCandidatesRatio??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.minCandidatesRatio,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,minCandidatesRatio:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.minCandidatesRatio??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.minCandidatesRatio]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMinCandidatesRatioHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:i,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexMaxCandidatesRatio}),(0,b.jsx)("input",{id:i,type:"range",min:"0.3",max:"0.8",step:"0.1",value:e.indexWorkerOptions?.maxCandidatesRatio??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.maxCandidatesRatio,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxCandidatesRatio:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-cyan-600 text-xs dark:text-cyan-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxCandidatesRatio??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.maxCandidatesRatio]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxCandidatesRatioHint})]})]},"strategy")),w.push((0,b.jsxs)("div",{className:`${r} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[(0,b.jsxs)("div",{className:`${s} text-indigo-700 dark:text-indigo-300`,children:["\u{1F521} ",n.scoreTuningHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:u,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexJaroWinklerPrefix}),(0,b.jsx)("input",{id:u,type:"range",min:"0.05",max:"0.25",step:"0.05",value:e.indexWorkerOptions?.jaroWinklerPrefix??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.jaroWinklerPrefix,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,jaroWinklerPrefix:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.jaroWinklerPrefix??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.jaroWinklerPrefix]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexJaroWinklerPrefixHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:f,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),(0,b.jsxs)("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[(0,b.jsx)("input",{type:"checkbox",checked:e.indexWorkerOptions?.maxResults===void 0,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:y.target.checked?void 0:Ga}}))}),n.noLimit]}),(0,b.jsx)("input",{id:f,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:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,maxResults:parseInt(y.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),(0,b.jsxs)("span",{className:"text-indigo-600 text-xs dark:text-indigo-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.maxResults===void 0?n.noLimit:e.indexWorkerOptions.maxResults]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexMaxResultsHint})]})]},"jaro")),w.push((0,b.jsxs)("div",{className:`${r} border-emerald-200 border-l-4 ${a?"":"opacity-50"} dark:border-emerald-400/60`,children:[(0,b.jsxs)("div",{className:`${s} text-emerald-700 dark:text-emerald-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:T,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),(0,b.jsx)("input",{id:T,type:"range",min:"0",max:"1",step:"0.05",value:e.indexWorkerOptions?.relevanceFieldWeight??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevanceFieldWeight??.2,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevanceFieldWeight:parseFloat(y.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),(0,b.jsxs)("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevanceFieldWeight??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevanceFieldWeight??.2]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexFieldWeightHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:S,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexPerfectMatchBonus}),(0,b.jsx)("input",{id:S,type:"range",min:"0",max:"0.3",step:"0.1",value:e.indexWorkerOptions?.relevancePerfectMatchBonus??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevancePerfectMatchBonus??.1,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,relevancePerfectMatchBonus:parseFloat(y.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),(0,b.jsxs)("span",{className:"text-emerald-600 text-xs dark:text-emerald-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.relevancePerfectMatchBonus??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevancePerfectMatchBonus??.1]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexPerfectMatchBonusHint})]}),!a&&(0,b.jsx)("p",{className:"text-[11px] text-emerald-600 dark:text-emerald-300",children:n.relevanceOnlyNotice})]},"relevance"));let V=(0,be.useId)(),H=(0,be.useId)();return w.push((0,b.jsxs)("div",{className:`${r} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[(0,b.jsxs)("div",{className:`${s} text-teal-700 dark:text-teal-300`,children:["\u{1F524} ",n.indexContainmentHeading]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:V,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentBase}),(0,b.jsx)("input",{id:V,type:"range",min:"0.0",max:"0.7",step:"0.05",value:e.indexWorkerOptions?.containmentScoreBase??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentScoreBase??.7,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentScoreBase:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentScoreBase??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentScoreBase??.7]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentBaseHint})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:H,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.indexContainmentCoverage}),(0,b.jsx)("input",{id:H,type:"range",min:"0.0",max:"0.3",step:"0.05",value:e.indexWorkerOptions?.containmentCoverageWeight??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentCoverageWeight??.3,onChange:y=>t(g=>({...g,indexWorkerOptions:{...g.indexWorkerOptions,containmentCoverageWeight:parseFloat(y.target.value)}})),className:"w-full"}),(0,b.jsxs)("span",{className:"text-teal-600 text-xs dark:text-teal-300",children:[n.currentValueLabel," ",e.indexWorkerOptions?.containmentCoverageWeight??j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentCoverageWeight??.3]}),(0,b.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.indexContainmentCoverageHint})]})]},"containment")),(0,b.jsxs)("section",{className:"space-y-3",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-green-700 text-xs transition-colors dark:text-green-300",children:[(0,b.jsx)("span",{children:"\u{1F4CA}"}),(0,b.jsx)("span",{className:"tracking-wide",children:n.indexSettingsHeading})]}),(0,b.jsx)("button",{type:"button",onClick:()=>t(y=>({...y,indexWorkerOptions:{threshold:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.threshold||.4,ngramOverlapThreshold:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.ngramOverlapThreshold||.3,minCandidatesRatio:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.minCandidatesRatio||.1,maxCandidatesRatio:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.maxCandidatesRatio||.5,jaroWinklerPrefix:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.jaroWinklerPrefix||.1,maxResults:void 0,relevanceFieldWeight:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevanceFieldWeight||.2,relevancePerfectMatchBonus:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.relevancePerfectMatchBonus||.1,containmentScoreBase:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentScoreBase||.7,containmentCoverageWeight:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.containmentCoverageWeight||.3,strategy:j.DEFAULT_FUZZY_SEARCH_OPTIONS.indexWorkerOptions?.strategy},ngramSize:j.DEFAULT_FUZZY_SEARCH_OPTIONS.ngramSize,minNgramOverlap:j.DEFAULT_FUZZY_SEARCH_OPTIONS.minNgramOverlap})),className:"rounded border border-green-300 bg-green-100 px-2 py-1 font-medium text-green-700 text-xs transition-colors hover:bg-green-200 dark:border-green-400/60 dark:bg-green-900/20 dark:text-green-200 dark:hover:bg-green-800/30",title:n.resetToDefaultsTitle,children:n.reset})]}),(0,b.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:w})]})});ta.displayName="IndexWorkerSettings";var xe=require("@aiquants/fuzzy-search"),nt=require("react");ce();var D=require("react/jsx-runtime"),qa=1e3,na=(0,nt.memo)(({searchOptions:e,setSearchOptions:t})=>{let n=J(),r="flex flex-col gap-1 rounded-md border border-gray-200 bg-white/80 px-2 py-1 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",s="text-xs font-semibold",a=e.sortBy==="relevance",o=(0,nt.useId)(),d=(0,nt.useId)(),l=(0,nt.useId)(),c=(0,nt.useId)(),m=(0,nt.useId)(),p=(0,nt.useId)(),i=[];return i.push((0,D.jsxs)("div",{className:`${r} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[(0,D.jsxs)("div",{className:`${s} text-purple-700 dark:text-purple-300`,children:["\u{1F9EE} ",n.levenshteinCandidateHeading]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:o,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinThreshold}),(0,D.jsx)("input",{id:o,type:"range",min:"0.0",max:a?"1.5":"1.0",step:"0.05",value:e.levenshteinWorkerOptions?.threshold??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.threshold,onChange:u=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,threshold:parseFloat(u.target.value)}})),className:"w-full"}),(0,D.jsxs)("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.threshold??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.threshold]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:a?n.levenshteinThresholdHintRelevance:n.levenshteinThresholdHint})]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:d,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinLengthSimilarity}),(0,D.jsx)("input",{id:d,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.lengthSimilarityThreshold??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthSimilarityThreshold,onChange:u=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthSimilarityThreshold:parseFloat(u.target.value)}})),className:"w-full"}),(0,D.jsxs)("span",{className:"text-purple-600 text-xs dark:text-purple-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthSimilarityThreshold??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthSimilarityThreshold]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthSimilarityHint})]})]},"threshold")),i.push((0,D.jsxs)("div",{className:`${r} border-pink-200 border-l-4 dark:border-pink-400/60`,children:[(0,D.jsxs)("div",{className:`${s} text-pink-700 dark:text-pink-300`,children:["\u{1FA84} ",n.scoreTuningHeading]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:l,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinLengthPenalty}),(0,D.jsx)("input",{id:l,type:"range",min:"0.5",max:"2.0",step:"0.1",value:e.levenshteinWorkerOptions?.lengthDiffPenalty??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthDiffPenalty,onChange:u=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,lengthDiffPenalty:parseFloat(u.target.value)}})),className:"w-full"}),(0,D.jsxs)("span",{className:"text-pink-600 text-xs dark:text-pink-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.lengthDiffPenalty??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthDiffPenalty]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinLengthPenaltyHint})]})]},"penalty")),i.push((0,D.jsxs)("div",{className:`${r} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[(0,D.jsxs)("div",{className:`${s} text-violet-700 dark:text-violet-300`,children:["\u{1F4E6} ",n.levenshteinResultsHeading]}),(0,D.jsx)("label",{htmlFor:c,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.maxResults}),(0,D.jsxs)("label",{className:"flex items-center gap-2 text-[11px] text-gray-600 dark:text-slate-300",children:[(0,D.jsx)("input",{type:"checkbox",checked:e.levenshteinWorkerOptions?.maxResults===void 0,onChange:u=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:u.target.checked?void 0:qa}}))}),n.noLimit]}),(0,D.jsx)("input",{id:c,type:"range",min:qa,max:"10000",step:"1000",disabled:e.levenshteinWorkerOptions?.maxResults===void 0,value:e.levenshteinWorkerOptions?.maxResults===void 0?qa:e.levenshteinWorkerOptions.maxResults,onChange:u=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,maxResults:parseInt(u.target.value,10)}})),className:"w-full disabled:cursor-not-allowed"}),(0,D.jsxs)("span",{className:"text-violet-600 text-xs dark:text-violet-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.maxResults===void 0?n.noLimit:e.levenshteinWorkerOptions.maxResults]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinMaxResultsHint})]},"max-results")),i.push((0,D.jsxs)("div",{className:`${r} border-rose-200 border-l-4 ${a?"":"opacity-50"} dark:border-rose-400/60`,children:[(0,D.jsxs)("div",{className:`${s} text-rose-700 dark:text-rose-300`,children:["\u{1F3AF} ",n.relevanceWeightsHeading]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:m,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.fieldWeight}),(0,D.jsx)("input",{id:m,type:"range",min:"0",max:"1",step:"0.05",value:e.levenshteinWorkerOptions?.relevanceFieldWeight??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.relevanceFieldWeight??.15,onChange:u=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,relevanceFieldWeight:parseFloat(u.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),(0,D.jsxs)("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.relevanceFieldWeight??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.relevanceFieldWeight??.15]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinFieldWeightHint})]}),(0,D.jsxs)("div",{className:"space-y-2",children:[(0,D.jsx)("label",{htmlFor:p,className:"font-medium text-[11px] text-gray-600 transition-colors dark:text-slate-300",children:n.levenshteinPartialBonus}),(0,D.jsx)("input",{id:p,type:"range",min:"0.05",max:"0.3",step:"0.05",value:e.levenshteinWorkerOptions?.partialMatchBonus??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.partialMatchBonus,onChange:u=>t(f=>({...f,levenshteinWorkerOptions:{...f.levenshteinWorkerOptions,partialMatchBonus:parseFloat(u.target.value)}})),disabled:!a,className:"w-full disabled:cursor-not-allowed"}),(0,D.jsxs)("span",{className:"text-rose-600 text-xs dark:text-rose-300",children:[n.currentValueLabel," ",e.levenshteinWorkerOptions?.partialMatchBonus??xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.partialMatchBonus]}),(0,D.jsx)("p",{className:"text-[11px] text-gray-500 transition-colors dark:text-slate-400",children:n.levenshteinPartialBonusHint})]}),!a&&(0,D.jsx)("p",{className:"text-[11px] text-rose-600 dark:text-rose-300",children:n.relevanceOnlyNotice})]},"relevance")),(0,D.jsxs)("section",{className:"space-y-3",children:[(0,D.jsxs)("div",{className:"flex items-center justify-between gap-3",children:[(0,D.jsxs)("div",{className:"flex items-center gap-2 font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:[(0,D.jsx)("span",{children:"\u{1F4CF}"}),(0,D.jsx)("span",{className:"tracking-wide",children:n.levenshteinSettingsHeading})]}),(0,D.jsx)("button",{type:"button",onClick:()=>t(u=>({...u,levenshteinWorkerOptions:{threshold:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.threshold||.3,lengthSimilarityThreshold:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthSimilarityThreshold||.1,partialMatchBonus:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.partialMatchBonus||.1,lengthDiffPenalty:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.lengthDiffPenalty||1,maxResults:void 0,relevanceFieldWeight:xe.DEFAULT_FUZZY_SEARCH_OPTIONS.levenshteinWorkerOptions?.relevanceFieldWeight||.15}})),className:"rounded border border-purple-300 bg-purple-100 px-2 py-1 font-medium text-purple-700 text-xs transition-colors hover:bg-purple-200 dark:border-purple-400/60 dark:bg-purple-900/20 dark:text-purple-200 dark:hover:bg-purple-800/30",title:n.resetToDefaultsTitle,children:n.reset})]}),(0,D.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:i})]})});na.displayName="LevenshteinWorkerSettings";var ie=require("react/jsx-runtime"),di={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},aa=(0,Eo.memo)(({searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a,activeTab:o,onTabChange:d})=>{let l=J(),{setScrollableRef:c,onPointerDown:m,onPointerMove:p,onPointerUp:i,onPointerLeave:u,onPointerCancel:f,onClickCapture:T}=Ze();return(0,ie.jsxs)("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[(0,ie.jsxs)("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[(0,ie.jsxs)("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u2699\uFE0F ",l.searchSettings]}),(0,ie.jsx)("div",{className:"flex flex-wrap gap-1.5",children:(0,ie.jsxs)("button",{type:"button",onClick:()=>t(S=>Gn(S.workerUrls)),className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:l.settingsResetAllTitle,children:["\u{1F504} ",l.settingsResetAll]})})]}),(0,ie.jsx)("div",{className:"mb-0 shrink-0",children:(0,ie.jsxs)("div",{ref:c,role:"tablist","aria-label":l.settingsTabsLabel,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:di,onPointerDown:m,onPointerMove:p,onPointerUp:i,onPointerLeave:u,onPointerCancel:f,onClickCapture:T,children:[(0,ie.jsxs)("button",{type:"button",role:"tab","aria-selected":o==="basic",onClick:()=>d("basic"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="basic"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F527} ",l.settingsBasicTab]}),(0,ie.jsxs)("button",{type:"button",role:"tab","aria-selected":o==="advanced",onClick:()=>d("advanced"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="advanced"?"bg-orange-500 text-white dark:bg-orange-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u26A1 ",l.settingsAdvancedTab]}),(0,ie.jsxs)("button",{type:"button",role:"tab","aria-selected":o==="index",onClick:()=>d("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",l.indexWorkerName]}),(0,ie.jsxs)("button",{type:"button",role:"tab","aria-selected":o==="levenshtein",onClick:()=>d("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${o==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",l.levenshteinWorkerName]})]})}),(0,ie.jsxs)("div",{className:"flex flex-col gap-1",children:[(0,ie.jsx)("div",{className:`${o==="basic"?"block":"hidden"}`,children:(0,ie.jsx)(_n,{searchOptions:e,setSearchOptions:t,enableHighlighting:n,setEnableHighlighting:r,openEmailsWithGmail:s,setOpenEmailsWithGmail:a})}),(0,ie.jsx)("div",{className:`${o==="advanced"?"block":"hidden"}`,children:(0,ie.jsx)(Hn,{searchOptions:e,setSearchOptions:t})}),(0,ie.jsx)("div",{className:`${o==="index"?"block":"hidden"}`,children:(0,ie.jsx)(ta,{searchOptions:e,setSearchOptions:t})}),(0,ie.jsx)("div",{className:`${o==="levenshtein"?"block":"hidden"}`,children:(0,ie.jsx)(na,{searchOptions:e,setSearchOptions:t})})]})]})});aa.displayName="SearchOptionsPanel";var oa=require("react");xt();ce();var Oo=require("react"),ra=require("react/jsx-runtime"),O=(0,Oo.memo)(({label:e,value:t,unit:n,color:r="text-gray-600 dark:text-slate-300"})=>(0,ra.jsxs)("div",{className:"wrap-break-word flex min-w-0 flex-col overflow-hidden text-gray-700 transition-colors sm:flex-row sm:justify-between dark:text-slate-200",children:[(0,ra.jsxs)("span",{className:"wrap-break-word overflow-hidden text-left",children:[e,":"]}),(0,ra.jsxs)("span",{className:`font-medium ${r} min-w-0 overflow-hidden break-all transition-colors sm:ml-2`,children:[t,n]})]}));O.displayName="StatItem";var Do=require("react");xt();ce();var x=require("react/jsx-runtime"),Nt=(0,Do.memo)(({kind:e,icon:t,stats:n,color:r})=>{let{locale:s,labels:a}=Se(),o=E=>X(s,E);if(!n)return(0,x.jsx)("section",{className:"rounded-lg border border-gray-200 border-dashed bg-white/40 p-3 text-gray-400 text-xs transition-colors dark:border-slate-700 dark:bg-slate-900/40 dark:text-slate-400",children:a.statsNoData});let d=n.basic||{},l=n.workerSpecific||{},c=n.analysis||{},m=d.totalSearches??0,p=d.totalProcessingTime??0,i=d.averageSearchTime??0,u=d.lastSearchTime??0,f=d.errorCount??0,T=d.timestamp,S=c.fieldPerformance||{},w=c.performanceInsights||{},V=c.recentHistory||[],H=l.specificMetrics||{},y=l.operationCount??0,g=l.operationDistribution||{},$=e==="index",G=e==="levenshtein",k=$?a.indexWorkerName:a.levenshteinWorkerName,h=H,v=H,F="flex flex-col gap-1 rounded-lg border border-gray-200 bg-white/80 p-3 shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/70 dark:shadow-none",P="text-xs font-semibold transition-colors",ae=E=>{if(!E)return;let I=new Date(E);return Number.isNaN(I.getTime())?void 0:a.statsTimestamp(I)},L=[];if(L.push((0,x.jsxs)("div",{className:`${F} border-blue-200 border-l-4 dark:border-blue-500/60`,children:[(0,x.jsxs)("div",{className:`${P} ${r}`,children:["\u{1F4CA} ",a.statsBasicHeading]}),(0,x.jsx)(O,{label:a.statTotalSearches,value:o(m),color:r}),(0,x.jsx)(O,{label:a.statAverageSearchTime,value:i.toFixed(2),unit:"ms",color:r}),(0,x.jsx)(O,{label:a.statTotalProcessingTime,value:p.toFixed(2),unit:"ms",color:r}),(0,x.jsx)(O,{label:a.statLastSearchTime,value:u.toFixed(2),unit:"ms",color:r}),(0,x.jsx)(O,{label:a.statErrorCount,value:f,color:f>0?"text-red-600 dark:text-red-400":r}),ae(T)&&(0,x.jsx)(O,{label:a.statUpdatedAt,value:ae(T),color:"text-gray-500 dark:text-slate-400"})]},"basic")),y>0||Object.keys(g).length>0){let E=Object.entries(g).sort(([,I],[,q])=>(Number(q)||0)-(Number(I)||0)).slice(0,6);L.push((0,x.jsxs)("div",{className:`${F} border-amber-200 border-l-4 dark:border-amber-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-amber-600 dark:text-amber-300`,children:["\u{1F527} ",a.statsOperationsHeading]}),(0,x.jsx)(O,{label:a.statTotalOperations,value:o(y),color:"text-amber-700 dark:text-amber-300"}),E.length>0&&(0,x.jsx)("div",{className:"mt-1 space-y-1",children:E.map(([I,q])=>(0,x.jsx)(O,{label:I,value:o(Number(q)),unit:a.timesUnit(o(Number(q))),color:"text-amber-700 dark:text-amber-300"},I))})]},"operations"))}if($&&(L.push((0,x.jsxs)("div",{className:`${F} border-green-200 border-l-4 dark:border-green-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-green-700 dark:text-green-300`,children:["\u{1F3D7}\uFE0F ",a.statsIndexHeading]}),(0,x.jsx)(O,{label:a.statIndexBuilds,value:o(h.totalIndexBuilds??0),color:"text-green-700 dark:text-green-300"}),(0,x.jsx)(O,{label:a.statDataSize,value:o(h.currentDataSize??0),unit:a.itemsUnit(o(h.currentDataSize??0)),color:"text-green-700 dark:text-green-300"}),(0,x.jsx)(O,{label:a.statLastBuildTime,value:(h.lastIndexTime??0).toFixed(2),unit:"ms",color:"text-green-700 dark:text-green-300"})]},"index-core")),h.cacheSize&&L.push((0,x.jsxs)("div",{className:`${F} border-emerald-200 border-l-4 dark:border-emerald-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-emerald-700 dark:text-emerald-300`,children:["\u{1F4BE} ",a.statsCacheHeading]}),(0,x.jsx)(O,{label:a.statCacheNgram,value:o(h.cacheSize.ngram??0),color:"text-emerald-700 dark:text-emerald-300"}),(0,x.jsx)(O,{label:a.statCacheWord,value:o(h.cacheSize.word??0),color:"text-emerald-700 dark:text-emerald-300"}),(0,x.jsx)(O,{label:a.statCachePhonetic,value:o(h.cacheSize.phonetic??0),color:"text-emerald-700 dark:text-emerald-300"})]},"index-cache")),h.indexMetadata)){let E=Object.entries(h.indexMetadata).slice(0,6);E.length>0&&L.push((0,x.jsxs)("div",{className:`${F} border-teal-200 border-l-4 dark:border-teal-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-teal-700 dark:text-teal-300`,children:["\u{1F4CB} ",a.statsIndexMetadataHeading]}),E.map(([I,q])=>{let oe;if(typeof q=="number"){let ye=I.toLowerCase();ye.includes("time")&&!ye.includes("timestamp")?oe=`${q.toFixed(2)}ms`:ye.includes("timestamp")||ye.includes("at")?oe=ae(q)??q.toString():oe=o(q)}else oe=String(q);return(0,x.jsx)(O,{label:I,value:oe,color:"text-teal-700 dark:text-teal-300"},I)})]},"index-meta"))}if(G){if(L.push((0,x.jsxs)("div",{className:`${F} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-purple-700 dark:text-purple-300`,children:["\u{1F522} ",a.statsCalculationsHeading]}),(0,x.jsx)(O,{label:a.statTotalCalculations,value:o(v.totalCalculations??0),color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statDistanceCalculations,value:o(v.totalDistanceCalculations??0),color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statAverageDistance,value:typeof v.averageDistance=="number"?v.averageDistance.toFixed(2):"0.00",color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statMinDistance,value:v.minDistance??a.notAvailable,color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statMaxDistance,value:v.maxDistance??0,color:"text-purple-700 dark:text-purple-300"})]},"lev-basic")),L.push((0,x.jsxs)("div",{className:`${F} border-fuchsia-200 border-l-4 dark:border-fuchsia-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-fuchsia-700 dark:text-fuchsia-300`,children:["\u{1F3AF} ",a.statsMatchesHeading]}),(0,x.jsx)(O,{label:a.statPartialMatches,value:o(v.partialMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),(0,x.jsx)(O,{label:a.statPerfectMatches,value:o(v.perfectMatches??0),color:"text-fuchsia-700 dark:text-fuchsia-300"}),(0,x.jsx)(O,{label:a.statEarlyTerminations,value:o(v.earlyTerminations??0),color:"text-fuchsia-700 dark:text-fuchsia-300"})]},"lev-match")),v.similarityThresholds&&L.push((0,x.jsxs)("div",{className:`${F} border-rose-200 border-l-4 dark:border-rose-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-rose-700 dark:text-rose-300`,children:["\u{1F4C8} ",a.statsSimilarityHeading]}),(0,x.jsx)(O,{label:a.statAbove80,value:o(v.similarityThresholds.above80??0),color:"text-emerald-700 dark:text-emerald-300"}),(0,x.jsx)(O,{label:a.statAbove60,value:o(v.similarityThresholds.above60??0),color:"text-lime-700 dark:text-lime-300"}),(0,x.jsx)(O,{label:a.statAbove40,value:o(v.similarityThresholds.above40??0),color:"text-orange-600 dark:text-orange-300"}),(0,x.jsx)(O,{label:a.statBelow40,value:o(v.similarityThresholds.below40??0),color:"text-red-600 dark:text-red-400"})]},"lev-similarity")),v.distanceDistribution){let E=Object.entries(v.distanceDistribution).sort(([,I],[,q])=>Number(q)-Number(I)).slice(0,6);E.length>0&&L.push((0,x.jsxs)("div",{className:`${F} border-indigo-200 border-l-4 dark:border-indigo-500/60`,children:[(0,x.jsxs)("div",{className:`${P} text-indigo-700 dark:text-indigo-300`,children:["\u{1F4CA} ",a.statsDistanceHeading]}),E.map(([I,q])=>(0,x.jsx)(O,{label:a.statDistance(I),value:o(Number(q)),unit:a.timesUnit(o(Number(q))),color:"text-indigo-700 dark:text-indigo-300"},I))]},"lev-distance"))}if(v.queryLengthStats){let E=Object.entries(v.queryLengthStats).sort(([,I],[,q])=>(q.count??0)-(I.count??0)).slice(0,6);E.length>0&&L.push((0,x.jsxs)("div",{className:`${F} border-violet-200 border-l-4 dark:border-violet-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-violet-700 dark:text-violet-300`,children:["\u{1F4CF} ",a.statsQueryLengthHeading]}),E.map(([I,q])=>{let oe=Number(q.count??0),ye=Number(q.averageScore??0);return(0,x.jsx)(O,{label:a.statQueryLength(I),value:a.statQueryLengthValue({count:oe,averagePercent:(ye*100).toFixed(1)}),color:"text-violet-700 dark:text-violet-300"},I)})]},"lev-query-length"))}}if(Object.keys(S).length>0){let E=Object.entries(S).sort(([,I],[,q])=>(q.averageScore??0)-(I.averageScore??0)).slice(0,6);L.push((0,x.jsxs)("div",{className:`${F} border-purple-200 border-l-4 dark:border-purple-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-purple-700 dark:text-purple-300`,children:["\u{1F4CB} ",a.statsFieldPerformanceHeading]}),E.map(([I,q])=>{let oe=q;return(0,x.jsxs)("div",{className:"space-y-1 rounded bg-purple-50/60 p-2 transition-colors dark:bg-slate-900/50",children:[(0,x.jsx)("div",{className:"font-semibold text-purple-700 text-xs transition-colors dark:text-purple-300",children:I}),(0,x.jsx)(O,{label:a.statAverageScore,value:`${((oe.averageScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statMatchCount,value:o(oe.matchCount??0),unit:a.itemsUnit(o(oe.matchCount??0)),color:"text-purple-700 dark:text-purple-300"}),(0,x.jsx)(O,{label:a.statBestWorstScore,value:`${((oe.bestScore??0)*100).toFixed(1)}% / ${((oe.worstScore??0)*100).toFixed(1)}%`,color:"text-purple-700 dark:text-purple-300"})]},I)})]},"field-performance"))}if(w.bestPerformingField||w.totalHistoryEntries||w.similarityDistribution){let E=(w.recentAverageResultCount??0).toFixed(1);L.push((0,x.jsxs)("div",{className:`${F} border-blue-200 border-l-4 dark:border-blue-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-blue-700 dark:text-blue-300`,children:["\u{1F50D} ",a.statsInsightsHeading]}),w.bestPerformingField&&(0,x.jsx)(O,{label:a.statBestField,value:w.bestPerformingField,color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statRecentAverageTime,value:(w.recentAverageProcessingTime??0).toFixed(2),unit:"ms",color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statRecentAverageResults,value:E,unit:a.itemsUnit(E),color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statThroughput,value:(w.throughputPerSecond??0).toFixed(2),unit:a.throughputUnit,color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statCommonQueryLength,value:o(w.mostCommonQueryLength??0),unit:a.charactersUnit(o(w.mostCommonQueryLength??0)),color:"text-blue-700 dark:text-blue-300"}),(0,x.jsx)(O,{label:a.statHistoryEntries,value:o(w.totalHistoryEntries??0),color:"text-blue-700 dark:text-blue-300"}),w.similarityDistribution&&(0,x.jsxs)("div",{className:"mt-1 grid grid-cols-2 gap-1",children:[(0,x.jsx)(O,{label:a.statHighSimilarity,value:o(w.similarityDistribution.highSimilarity??0),color:"text-emerald-700 dark:text-emerald-300"}),(0,x.jsx)(O,{label:a.statMediumSimilarity,value:o(w.similarityDistribution.mediumSimilarity??0),color:"text-lime-700 dark:text-lime-300"}),(0,x.jsx)(O,{label:a.statLowSimilarity,value:o(w.similarityDistribution.lowSimilarity??0),color:"text-orange-600 dark:text-orange-300"}),(0,x.jsx)(O,{label:a.statVeryLowSimilarity,value:o(w.similarityDistribution.veryLowSimilarity??0),color:"text-red-600 dark:text-red-400"})]})]},"performance-insights"))}return V.length>0&&L.push((0,x.jsxs)("div",{className:`${F} border-sky-200 border-l-4 dark:border-sky-400/60`,children:[(0,x.jsxs)("div",{className:`${P} text-sky-700 dark:text-sky-300`,children:["\u{1F4C8} ",a.statsRecentHistoryHeading]}),V.slice(-3).reverse().map((E,I)=>(0,x.jsxs)("div",{className:"rounded bg-sky-50/70 p-2 transition-colors dark:bg-slate-900/50",children:[(0,x.jsx)("div",{className:"font-medium text-sky-700 transition-colors dark:text-sky-300",children:E.operationType}),(0,x.jsx)("div",{className:"text-sky-600 text-xs transition-colors dark:text-sky-200",children:a.statsHistoryEntry({processingTimeMs:E.processingTime.toFixed(2),resultCount:E.resultCount??0})}),ae(E.timestamp)&&(0,x.jsx)("div",{className:"text-[10px] text-sky-500 transition-colors dark:text-sky-200",children:ae(E.timestamp)})]},`${E.operationType}-${E.timestamp??I}`))]},"recent-history")),(0,x.jsxs)("section",{className:"space-y-2",children:[(0,x.jsxs)("div",{className:`flex items-center gap-2 font-semibold text-xs ${r}`,children:[(0,x.jsx)("span",{children:t}),(0,x.jsx)("span",{className:"tracking-wide",children:k})]}),(0,x.jsx)("div",{className:"grid grid-cols-1 gap-2 sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4",children:L})]})});Nt.displayName="WorkerStatsSection";var ne=require("react/jsx-runtime"),ci={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},sa=(0,oa.memo)(({performanceMetrics:e,searchTerm:t,totalDataCount:n,resultsCount:r,resetStats:s,rebuildIndex:a,isIndexBuilding:o,activeTab:d,onTabChange:l})=>{let{locale:c,labels:m}=Se(),p=t.trim(),i=p?r:n,{setScrollableRef:u,onPointerDown:f,onPointerMove:T,onPointerUp:S,onPointerLeave:w,onPointerCancel:V,onClickCapture:H}=Ze(),y=d!=="index"||o,g=o?m.statsRebuildingTitle:d!=="index"?m.statsRebuildIndexTabOnlyTitle:m.statsRebuildTitle,$=y?"cursor-not-allowed bg-gray-300 text-gray-500 dark:bg-slate-700 dark:text-slate-400":"bg-blue-500 text-white hover:bg-blue-600 dark:bg-blue-500 dark:hover:bg-blue-600",G=o?`\u23F3 ${m.statsRebuilding}`:`\u{1F3D7}\uFE0F ${m.statsRebuild}`,k=(0,oa.useCallback)(()=>{a().catch(()=>{})},[a]);return(0,ne.jsxs)("div",{className:"wrap-break-word flex w-full flex-col gap-1.5 rounded-lg border border-blue-300 bg-white p-1.5 shadow-md transition-colors dark:border-blue-500/40 dark:bg-slate-900/80 dark:shadow-blue-900/30",children:[(0,ne.jsxs)("div",{className:"mb-0.5 flex shrink-0 flex-col gap-1 rounded bg-blue-50 px-1.5 py-0.5 transition-colors sm:flex-row sm:items-center sm:justify-between dark:bg-blue-900/30",children:[(0,ne.jsxs)("h3",{className:"font-semibold text-gray-700 text-xs transition-colors dark:text-slate-100",children:["\u{1F4CA} ",m.searchStatistics]}),(0,ne.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[(0,ne.jsx)("button",{type:"button",onClick:k,disabled:y,className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${$}`,title:g,children:G}),(0,ne.jsxs)("button",{type:"button",onClick:s,className:"rounded bg-red-500 px-1.5 py-0.5 text-[10px] text-white transition-colors hover:bg-red-600 dark:hover:bg-red-700",title:m.statsResetTitle,children:["\u{1F504} ",m.reset]})]})]}),(0,ne.jsx)("div",{className:"mb-0 shrink-0",children:(0,ne.jsxs)("div",{ref:u,className:"flex space-x-1 overflow-x-auto text-nowrap rounded-md bg-gray-100 p-0.5 transition-colors dark:bg-slate-800/80",style:ci,onPointerDown:f,onPointerMove:T,onPointerUp:S,onPointerLeave:w,onPointerCancel:V,onClickCapture:H,children:[(0,ne.jsxs)("button",{type:"button",onClick:()=>l("overview"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="overview"?"bg-blue-500 text-white dark:bg-blue-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CB} ",m.statsOverviewTab]}),(0,ne.jsxs)("button",{type:"button",onClick:()=>l("index"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="index"?"bg-green-500 text-white dark:bg-green-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CA} ",m.statsIndexTab]}),(0,ne.jsxs)("button",{type:"button",onClick:()=>l("levenshtein"),className:`rounded px-1.5 py-0.5 text-[10px] transition-colors ${d==="levenshtein"?"bg-purple-500 text-white dark:bg-purple-500":"text-gray-600 hover:bg-gray-200 dark:text-slate-300 dark:hover:bg-slate-700/70"}`,children:["\u{1F4CF} ",m.statsLevenshteinTab]})]})}),(0,ne.jsxs)("div",{className:"flex flex-col gap-1 pb-0.5",children:[(0,ne.jsxs)("div",{className:`${d==="overview"?"grid":"hidden"} grid-cols-1 gap-2 pr-1 text-gray-600 text-xs transition-colors sm:grid-cols-2 xl:grid-cols-3 2xl:grid-cols-4 dark:text-slate-300`,children:[(0,ne.jsx)(O,{label:m.statTotalSearches,value:X(c,e.totalSearches)}),(0,ne.jsx)(O,{label:m.statAverageSearchTime,value:e.averageSearchTime.toFixed(1),unit:"ms"}),(0,ne.jsx)(O,{label:m.statDataCount,value:X(c,e.itemCount)}),(0,ne.jsx)(O,{label:p?m.statResultCount:m.statDisplayedCount,value:X(c,i)})]}),(0,ne.jsx)("div",{className:`${d==="index"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:(0,ne.jsx)(Nt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"})}),(0,ne.jsx)("div",{className:`${d==="levenshtein"?"space-y-3":"hidden"} pr-1 text-gray-600 text-xs transition-colors dark:text-slate-300`,children:(0,ne.jsx)(Nt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})}),(0,ne.jsxs)("div",{className:"hidden",children:[(0,ne.jsx)(Nt,{kind:"index",icon:"\u{1F4CA}",stats:e.workerStats?.index,color:"text-green-600 dark:text-green-300"}),(0,ne.jsx)(Nt,{kind:"levenshtein",icon:"\u{1F4CF}",stats:e.workerStats?.levenshtein,color:"text-purple-600 dark:text-purple-300"})]})]})]})});sa.displayName="StatisticsPanel";var A=require("react/jsx-runtime"),pi=/[\u200B\uFEFF]/g,Qa=typeof window<"u",zo=Qa&&typeof document<"u",ia=(e,t=[],n=!1)=>{let r=(0,z.useRef)(e);r.current=e,(0,z.useEffect)(()=>{if(!(!Qa||n&&!zo))return r.current()},[n,...t])},Wo=(e,t,n)=>{let[r,s]=(0,z.useState)(()=>{let a=Ho(o=>o.getItem(e));return a&&t.includes(a)?a:n});return ia(()=>{Ho(a=>{a.setItem(e,r)})},[e,r]),[r,s]},Ho=e=>{if(!Qa)return null;try{return e(window.sessionStorage)}catch{return null}},_o=(e,t)=>{let[n,r]=(0,z.useState)(e);return(0,z.useEffect)(()=>{let s=setTimeout(()=>{r(e)},t);return()=>{clearTimeout(s)}},[e,t]),n},ui="contact-map.settings-tab",mi="contact-map.statistics-tab",gi=["basic","advanced","index","levenshtein"],hi=["overview","index","levenshtein"],Ao=["full_name","company_name","department","title","email","company_phone_number","mobile_phone_number"],fi={WebkitOverflowScrolling:"touch",msOverflowStyle:"none",scrollbarWidth:"none"},Ya=({streamState:e,...t}={})=>e===void 0?(0,A.jsx)(yi,{...t}):(0,A.jsx)(Bo,{...t,streamState:e}),yi=e=>{let{context:t}=sn();return(0,A.jsx)(Bo,{...e,streamState:t})},bi={setting:"ContactMapSearchPage workerUrls",keys:["indexWorker","levenshteinWorker"],hints:{treeWorker:"set treeWorker on ContactMapConfigProvider or ContactMapAppView"}},Bo=e=>{let{streamState:t,onFooterVisibilityChange:n,children:r}=e,s=ke(e,"workerUrls"),a=Ke(),{locale:o,labels:d}=Se(),{contactMapRecords:l,contactMapRecordMap:c,isStreamingComplete:m,isStreamingFailed:p}=t,i=(0,da.useNavigation)(),[u]=(0,da.useSearchParams)(),f=(0,z.useRef)(null),[T,S]=(0,z.useState)(!0),[w,V]=(0,z.useState)(a.openEmailsWithGmail??!1),{indexWorker:H,levenshteinWorker:y}=kt(a.workerUrls,s,bi),[g,$]=(0,z.useState)(()=>Gn({indexWorker:H,levenshteinWorker:y})),[G,k]=(0,z.useState)(u.get("q")||""),h=_o(G,g.debounceMs??la.DEFAULT_FUZZY_SEARCH_OPTIONS.debounceMs);(0,z.useEffect)(()=>{let K=u.get("q")||"";k(Y=>Y!==K?K:Y)},[u]),(0,z.useEffect)(()=>{if(typeof window>"u")return;let K=new URL(window.location.href);(K.searchParams.get("q")||"")!==h&&(h?K.searchParams.set("q",h):K.searchParams.delete("q"),window.history.replaceState(window.history.state,"",K.toString()))},[h]);let[v,F]=(0,z.useTransition)(),[P,ae]=(0,z.useState)("search"),[L,E]=Wo(ui,gi,"basic"),[I,q]=Wo(mi,hi,"overview"),{setScrollableRef:oe,onPointerDown:ye,onPointerMove:le,onPointerUp:Ee,onPointerLeave:gt,onPointerCancel:Mt,onClickCapture:fn}=Ze(),ge=(0,z.useCallback)(()=>{if(!zo)return;let K=f.current;!K||document.activeElement===K||window.requestAnimationFrame(()=>{try{K.focus({preventScroll:!0})}catch{}})},[]),Kt=(0,z.useCallback)(K=>{let Y=K;ae(Y),Y==="search"&&ge()},[ge]),we=(0,z.useMemo)(()=>({...g,debounceMs:0}),[g]),[at,yn]=(0,z.useState)("union"),Ge=at==="intersection",ca=Ge?d.operatorAndTitle:d.operatorOrTitle,bn=(0,z.useCallback)(K=>(0,la.parseQuerySets)(K,at),[at]),xn=(0,z.useMemo)(()=>({querySetsOf:bn}),[bn]),jt=_o(l,m?0:800),{searchTerm:re,setSearchTerm:vn,filteredItems:rt,resultTerm:Gt,isSearching:ot,isIndexBuilding:Ne,clearSearch:qt,resetStats:Qt,performanceMetrics:Ie,rebuildIndex:st,error:Fe}=(0,Io.useFuzzySearch)(jt,Ao,we,xn),ht=re.trim().length>0,[it,ft]=(0,z.useState)(""),[Pt,pa]=(0,z.useState)(()=>re),lt=(0,z.useMemo)(()=>Fn(G),[G]),qe=(0,z.useMemo)(()=>Fn(h),[h]);(0,z.useEffect)(()=>{h===it&&qe===re||F(()=>{ft(h),vn(qe)})},[h,it,qe,re,vn]);let Yt=(0,z.useCallback)(K=>{let fe=K.target.value.replace(pi,"");k(fe)},[]),ua=(0,z.useCallback)(()=>{k(""),ft(""),qt(),ge()},[qt,ge]),Cn=(0,z.useCallback)(()=>{yn(K=>K==="intersection"?"union":"intersection"),ge()},[ge]);ia(()=>{if(!(P==="search"&&i.state==="idle"&&!v))return;let Y=document.activeElement;if(!!!(Y?.matches('[role="tab"]')||Y?.closest('[role="tablist"]')?.getAttribute("role")==="tablist")&&Y&&Y!==document.body&&Y!==f.current)return;let ze=window.requestAnimationFrame(()=>{ge()});return()=>{window.cancelAnimationFrame(ze)}},[P,i.state,v,ge],!0),ia(()=>{if(P!=="search")return;let K=[[document,"visibilitychange",()=>{document.visibilityState==="visible"&&ge()}],[window,"pageshow",()=>{ge()}]];for(let[Y,fe,ze]of K)Y.addEventListener(fe,ze);return()=>{for(let[Y,fe,ze]of K)Y.removeEventListener(fe,ze)}},[P,ge],!0),(0,z.useEffect)(()=>(n&&n(P==="search"?"mobile-hidden":"visible"),()=>{n&&n("visible")}),[P,n]),ia(()=>{let K=document.body,Y=K.style.overflow;return P==="search"&&(K.style.overflow="hidden"),()=>{K.style.overflow=Y}},[P],!0),(0,z.useEffect)(()=>{Ie&&Ve.info("\u{1F4CA} [STATE] \u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u6307\u6A19\u304C\u66F4\u65B0\u3055\u308C\u307E\u3057\u305F:",{totalSearches:Ie.totalSearches,averageSearchTime:Ie.averageSearchTime,itemCount:Ie.itemCount,resultsCount:Ie.resultsCount,workersAvailable:!!Ie.workerStats})},[Ie]);let{isAwaitingDebounce:kn,isAwaitingSearchTermSync:Sn,isSearchInProgress:dt}=(0,z.useMemo)(()=>{let K=lt!==qe,Y=qe!==re,fe=re.trim().length>0||lt.trim().length>0;return{isAwaitingDebounce:K,isAwaitingSearchTermSync:Y,isSearchInProgress:v||ot||Gt!==re&&Fe===null||fe&&Ne||K||Y||Pt!==re}},[lt,qe,re,Gt,Fe,v,ot,Ne,Pt]),[Rt,Tn]=(0,z.useState)(re);(0,z.useEffect)(()=>{Rt!==re&&Tn(re)},[re,Rt]),(0,z.useEffect)(()=>{kn||Sn||v||ot||Ne||Rt===re&&Pt!==re&&pa(re)},[re,Pt,kn,Sn,v,ot,Ne,Rt]);let wn=(0,z.useMemo)(()=>Sr(it,Ao),[it]),Nn=(0,z.useMemo)(()=>wn(rt),[wn,rt]),Mn=(0,z.useMemo)(()=>({contactMapRecords:l,contactMapRecordMap:c,filteredItems:Nn,searchQuery:it,searchTerm:re,isSearching:ot,isIndexBuilding:Ne,isPending:v,hasSearchTerm:ht,enableHighlighting:T,openEmailsWithGmail:w,isSearchInProgress:dt,isSearchTabActive:P==="search",errorMessage:Fe??null,isStreamingComplete:m,isStreamingFailed:p}),[l,c,Nn,it,re,ot,Ne,v,ht,T,w,dt,P,Fe,m,p]),ma=ht?rt.length:l.length,Xt=X(o,l.length),W=X(o,rt.length);return(0,A.jsx)("div",{className:`scrollbar-hidden bg-slate-50 text-slate-900 dark:bg-slate-900 dark:text-slate-100${P==="search"?" h-full min-h-0":""}`,children:(0,A.jsxs)(an,{value:P,onValueChange:Kt,className:`flex flex-col${P==="search"?" h-full min-h-0":""}`,children:[(0,A.jsxs)(Ft,{ref:oe,style:fi,className:"scrollbar-none mt-0 mb-1 flex w-full touch-pan-x flex-nowrap overflow-x-auto overflow-y-hidden rounded-md bg-slate-50 transition-colors dark:bg-slate-900/70 dark:text-slate-200",onPointerDown:ye,onPointerMove:le,onPointerUp:Ee,onPointerLeave:gt,onPointerCancel:Mt,onClickCapture:fn,children:[(0,A.jsxs)(ut,{value:"search",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F50D} ",d.searchTab]}),(0,A.jsxs)(ut,{value:"settings",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u2699\uFE0F ",d.searchSettings]}),(0,A.jsxs)(ut,{value:"statistics",className:"min-w-16 px-2 py-0.5 text-xs transition-colors sm:min-w-24 sm:px-2.5 sm:py-0.5 sm:text-xs dark:text-slate-300 dark:data-[state=active]:bg-slate-800 dark:data-[state=active]:text-slate-100",children:["\u{1F4CA} ",d.searchStatistics]})]}),(0,A.jsx)(mt,{value:"search",className:"mt-0 flex h-full min-h-0 flex-col overflow-hidden",children:(0,A.jsxs)("div",{className:"flex h-full flex-col",children:[(0,A.jsx)("div",{className:"rounded-md border border-gray-200 bg-white shadow-sm transition-colors dark:border-slate-700 dark:bg-slate-900/80 dark:shadow-none",children:(0,A.jsxs)("div",{className:"flex flex-col",children:[(0,A.jsx)("div",{className:"relative",children:(0,A.jsxs)("div",{className:"flex items-center gap-1 p-1",children:[(0,A.jsxs)("button",{type:"button",onClick:Cn,"aria-pressed":Ge,title:ca,className:`inline-flex min-w-9 items-center justify-center gap-0.5 rounded border px-1.5 py-0.5 font-semibold text-[10px] transition-colors sm:min-w-12 sm:px-2 sm:py-0.5 sm:text-xs ${Ge?"border-blue-500 bg-blue-600 text-white hover:bg-blue-700 dark:border-blue-400 dark:bg-blue-500 dark:hover:bg-blue-600":"border-amber-400 bg-amber-100 text-amber-800 hover:bg-amber-200 dark:border-amber-500/70 dark:bg-amber-300/20 dark:text-amber-200 dark:hover:bg-amber-300/30"}`,children:[(0,A.jsx)("span",{className:"text-[10px] sm:text-xs",children:Ge?d.operatorAnd:d.operatorOr}),(0,A.jsx)("span",{className:"hidden text-[10px] sm:inline",children:Ge?d.operatorAndHint:d.operatorOrHint})]}),(0,A.jsx)("input",{ref:f,type:"text",value:G,onChange:Yt,placeholder:d.searchPlaceholder,className:"flex-1 rounded border border-gray-300 border-solid px-2 py-0.5 text-xs shadow-sm transition-colors focus:border-blue-500 focus:ring-1 focus:ring-blue-500 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-950 dark:text-slate-100 dark:shadow-none"}),G&&(0,A.jsx)("button",{type:"button",onClick:ua,className:"flex items-center justify-center gap-1 rounded border border-gray-300 px-1.5 py-0.5 text-[10px] transition-colors hover:text-gray-700 sm:px-2 sm:py-0.5 sm:text-xs dark:border-slate-600 dark:bg-slate-800/70 dark:text-slate-300 dark:hover:text-slate-100",title:dt?d.searchBusyTitle:d.clearSearch,disabled:dt,children:dt?(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(Fo.default,{"aria-hidden":"true",className:"h-3 w-3 animate-spin sm:h-3.5 sm:w-3.5"}),(0,A.jsx)("span",{className:"hidden sm:inline",children:d.searching})]}):"\u2715"})]})}),(0,A.jsxs)("p",{className:"px-1.5 py-0.5 text-[10px] text-slate-700 leading-snug transition-colors sm:text-[11px] dark:text-slate-200",children:[d.registeredCountLabel," ",(0,A.jsx)("span",{className:"font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:Xt})," ",d.recordUnit(Xt),Ne?(0,A.jsxs)("span",{className:"ml-1.5 inline-flex items-center rounded bg-blue-50 px-1.5 py-0.2 text-[10px] text-blue-700 sm:text-[11px] dark:bg-blue-900/40 dark:text-blue-200",children:["\u23F3 ",d.rebuildingIndex]}):null,Fe?(0,A.jsxs)("span",{className:"ml-1.5 inline-flex items-center rounded bg-rose-50 px-1.5 py-0.2 text-[10px] text-rose-700 sm:text-[11px] dark:bg-rose-900/40 dark:text-rose-200",children:["\u26A0\uFE0F ",d.errorLabel,(0,A.jsx)("span",{className:"ml-1 break-all font-semibold",children:Fe})]}):null,ht&&(0,A.jsxs)("span",{className:"ml-1.5 text-[10px] text-blue-600 sm:text-[11px] dark:text-sky-400",children:["| ",d.resultCountLabel,dt?(0,A.jsx)("span",{className:"ml-1 font-semibold text-[10px] sm:text-[11px]",children:d.searching}):(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)("span",{className:"ml-1 font-semibold text-[11px] text-slate-900 sm:text-xs dark:text-white",children:W}),(0,A.jsx)("span",{className:"ml-0.5 text-[10px] sm:text-[11px]",children:d.resultUnit(W)})]})]})]}),(0,A.jsx)("div",{className:"h-2.5 px-2 pb-1.5",children:Ne?(0,A.jsx)(Ha,{className:"h-1 bg-blue-200 dark:bg-blue-800",indicatorClassName:"bg-blue-500 dark:bg-blue-400"}):null})]})}),r?r(Mn):(0,A.jsx)(ja,{context:Mn})]})}),(0,A.jsx)(mt,{value:"settings",className:"mt-0",children:(0,A.jsx)(aa,{searchOptions:g,setSearchOptions:$,enableHighlighting:T,setEnableHighlighting:S,openEmailsWithGmail:w,setOpenEmailsWithGmail:V,activeTab:L,onTabChange:E})}),(0,A.jsx)(mt,{value:"statistics",className:"mt-0",children:(0,A.jsx)(sa,{performanceMetrics:Ie,searchTerm:re,totalDataCount:l.length,resultsCount:ma,resetStats:Qt,rebuildIndex:st,isIndexBuilding:Ne,activeTab:I,onTabChange:q})})]})})};var je=require("react/jsx-runtime"),xi=({renderHeader:e,title:t,onFooterVisibilityChange:n})=>{let r=J(),s=t===void 0?r.appTitle:t,{context:a,retryNow:o}=sn(),d=(0,je.jsx)(Kn,{recordCount:a.contactMapRecords.length,companyCount:a.companyCount,phase:a.streamPhase,loadedCount:a.loadedCount,totalCount:a.totalCount,errorMessage:a.errorMessage,onRetry:o});return(0,je.jsxs)("div",{"data-testid":"contact-map-app-view",className:"flex h-full w-full flex-col",children:[e?e({title:s,annotation:d}):(0,je.jsxs)("div",{"data-testid":"contact-map-default-header",className:"mb-2 flex items-center justify-between",children:[(0,je.jsx)("h1",{className:"font-bold text-xl",children:s}),d]}),(0,je.jsx)("div",{className:"min-h-0 flex-1",children:(0,je.jsx)(Ya,{streamState:a,onFooterVisibilityChange:n})})]})},vi=e=>{let t=Ke(),n=ke(e,"streamEndpoint"),r=ke(e,"workerUrls"),s=ke(e,"locale"),a=ke(e,"labels"),o=(0,Xa.useMemo)(()=>({...t,streamEndpoint:n===void 0?t.streamEndpoint:n,workerUrls:kt(t.workerUrls,r,{setting:"ContactMapAppView workerUrls"}),locale:s===void 0?t.locale:s,labels:a===void 0?t.labels:a}),[t,n,r,s,a]),d=s!==void 0,l=a!==void 0,c=(0,Xa.useMemo)(()=>({locale:d?"ContactMapAppView locale":"locale",labels:l?"ContactMapAppView labels":"labels"}),[d,l]);return(0,je.jsx)(Da,{config:o,chromeSurface:c,children:(0,je.jsx)(xi,{...e})})};xt();ce();var Uo=require("@aiquants/route-revalidation");var Ci=(0,Uo.createShouldRevalidate)({submissions:"url",query:{ignore:[Bt,"q"]}});0&&(module.exports={AdvancedSearchSettings,BasicSearchSettings,CONTACT_MAP_LABEL_CATALOGS,CONTACT_MAP_LABEL_KEYS,ContactDetailGrid,ContactDetailPanel,ContactDetailPopup,ContactDetailRowLayout,ContactMapAnnotation,ContactMapAppView,ContactMapConfigProvider,ContactMapSearchListView,ContactMapSearchPage,ContactMapSearchTabGroup,ContactMapSearchTreeView,ContactMapStreamClient,HighlightedText,IndexWorkerSettings,LIST_COLLAPSE_THRESHOLD,LIST_DETAIL_PANEL_MIN_WIDTH,LIST_EXPAND_THRESHOLD,LIST_PANEL_MIN_WIDTH,LIST_RESIZE_HANDLE_THICKNESS,LevenshteinWorkerSettings,Progress,SearchOptionsPanel,StatItem,StatisticsPanel,SwipeOverlay,TREE_COLLAPSE_THRESHOLD,TREE_DETAIL_PANEL_MIN_WIDTH,TREE_EXPAND_THRESHOLD,TREE_PANEL_MIN_WIDTH,TREE_RESIZE_HANDLE_THICKNESS,Tabs,TabsContent,TabsList,TabsTrigger,TreeWorkerSession,WorkerStatsSection,assertContactMapStreamEndpoint,assertContactMapTreeWorkerUrl,assertContactMapWorkerUrls,composeTreeVirtualScrollOptions,contactMapShouldRevalidate,countContactMapCompanies,deserializeStreamRecord,getContactMapStreamClient,getTreeWorkerSession,layerContactMapWorkerUrls,resetContactMapStreamClientForTesting,resetTreeWorkerSessionForTesting,resolveContactMapLabels,useAnimatedNumber,useContactMapConfig,useContactMapLabels,useContactMapStream,useContactPanelSizing,useDynamicViewportHeight,useHorizontalDragScroll,useLongPressPopup,useReportPopupVisibility,useResponsiveTwoColumnLayout,useRowPopupRegistry,useStreamedContactMapContext,useTreeWorker});
|