import{em as e,e as t}from"./cec18ad9a-DiLjrOUd.js";import{h as n}from"./cdd5b9598-juLasKsB.js";import{r}from"./vendor-react-AXa6hZO5.js";import{u as i}from"./vendor-intl-BdADXLLt.js";const o=["email","email address","email_address","e-mail"],a=["role"],s=["seat_tier","seat tier","seat","tier"];function l(e){const t=[];let n="",r=!1;for(let i=0;i<e.length;i++){const o=e[i];'"'===o?r&&'"'===e[i+1]?(n+='"',i++):r=!r:","!==o||r?n+=o:(t.push(n),n="")}return t.push(n),t.map(e=>e.trim())}function c(e,t){return e.findIndex(e=>t.includes(e))}function d({source:d,onParsed:m}){const u=i(),{addError:p}=n(),{track:f}=t(),k=r.useRef(null),g=r.useRef(!0),b=r.useRef(m);r.useEffect(()=>{b.current=m},[m]),r.useEffect(()=>(g.current=!0,()=>{g.current=!1}),[]);const v=r.useCallback(async t=>{if(!/\.csv$/i.test(t.name)&&"text/csv"!==t.type)return void p(u.formatMessage({defaultMessage:"Please choose a .csv file.",id:"fiUP5zDImT"}));const n=await t.text();if(!g.current)return;const{rows:r,skipped:i}=function(t){const n=t.replace(/^﻿/,"").split(/\r\n|\r|\n/).filter(e=>e.trim().length>0);if(0===n.length)return{emails:[],rows:[],skipped:[]};const r=l(n[0]).map(e=>e.toLowerCase()),i=c(r,o),d=-1!==i,m=d?i:0,u=d?c(r,a):-1,p=d?c(r,s):-1,f=d?n.slice(1):n,k=[],g=[],b=new Set;return f.forEach((t,n)=>{const r=n+(d?2:1),i=l(t),o=i[m]??"";if(0===o.length)return void g.push({row:r,value:o,reason:"empty"});const a=o.toLowerCase();if(!e(o))return void g.push({row:r,value:o,reason:"invalid_email"});if(b.has(a))return void g.push({row:r,value:o,reason:"duplicate_in_file"});b.add(a);const s=-1!==u&&i[u]||void 0,c=-1!==p&&i[p]||void 0;k.push({email:o,role:s,seatTier:c})}),{emails:k.map(e=>e.email),rows:k,skipped:g}}(n);if(0===r.length)return p(u.formatMessage({defaultMessage:"No valid email addresses were found in that CSV file.",id:"M/hk1LFpsi"})),void f({event_key:"claudeai.csv_invite.file_uploaded",source:d,email_count:0,skipped_count:i.length});const m=r.length>500,k=m?r.slice(0,500):r;m&&p(u.formatMessage({defaultMessage:"Only the first {max} rows were imported.",id:"AB2EVdRKmB"},{max:500})),f({event_key:"claudeai.csv_invite.file_uploaded",source:d,email_count:k.length,skipped_count:i.length,capped:m,has_role_column:k.some(e=>void 0!==e.role),has_seat_tier_column:k.some(e=>void 0!==e.seatTier)}),b.current({rows:k,emails:k.map(e=>e.email),fileName:t.name})},[p,u,d,f]),h=r.useCallback(e=>{const t=e.dataTransfer?.files?.[0];t&&v(t)},[v]),x=r.useCallback(e=>{const t=e.target.files?.[0];t&&v(t),e.target.value=""},[v]),w=r.useCallback(()=>{k.current?.click()},[]);return{fileInputRef:k,openFilePicker:w,handleDrop:h,handleInputChange:x}}
/*!-----------------------------------------------------------------------------
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Version: 0.52.2(404545bded1df6ffa41ea0af4e8ddb219018c6c1)
 * Released under the MIT license
 * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt
 *-----------------------------------------------------------------------------*/var m={wordPattern:/(#?-?\d*\.\d\w*%?)|((::|[@#.!:])?[\w-?]+%?)|::|[@#.!:]/g,comments:{blockComment:["/*","*/"]},brackets:[["{","}"],["[","]"],["(",")"]],autoClosingPairs:[{open:"{",close:"}",notIn:["string","comment"]},{open:"[",close:"]",notIn:["string","comment"]},{open:"(",close:")",notIn:["string","comment"]},{open:'"',close:'"',notIn:["string","comment"]},{open:"'",close:"'",notIn:["string","comment"]}],surroundingPairs:[{open:"{",close:"}"},{open:"[",close:"]"},{open:"(",close:")"},{open:'"',close:'"'},{open:"'",close:"'"}],folding:{markers:{start:new RegExp("^\\s*\\/\\*\\s*#region\\b\\s*(.*?)\\s*\\*\\/"),end:new RegExp("^\\s*\\/\\*\\s*#endregion\\b.*\\*\\/")}}};const u=Object.freeze(Object.defineProperty({__proto__:null,conf:m,language:{defaultToken:"",tokenPostfix:".css",ws:"[ \t\n\r\f]*",identifier:"-?-?([a-zA-Z]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))([\\w\\-]|(\\\\(([0-9a-fA-F]{1,6}\\s?)|[^[0-9a-fA-F])))*",brackets:[{open:"{",close:"}",token:"delimiter.bracket"},{open:"[",close:"]",token:"delimiter.bracket"},{open:"(",close:")",token:"delimiter.parenthesis"},{open:"<",close:">",token:"delimiter.angle"}],tokenizer:{root:[{include:"@selector"}],selector:[{include:"@comments"},{include:"@import"},{include:"@strings"},["[@](keyframes|-webkit-keyframes|-moz-keyframes|-o-keyframes)",{token:"keyword",next:"@keyframedeclaration"}],["[@](page|content|font-face|-moz-document)",{token:"keyword"}],["[@](charset|namespace)",{token:"keyword",next:"@declarationbody"}],["(url-prefix)(\\()",["attribute.value",{token:"delimiter.parenthesis",next:"@urldeclaration"}]],["(url)(\\()",["attribute.value",{token:"delimiter.parenthesis",next:"@urldeclaration"}]],{include:"@selectorname"},["[\\*]","tag"],["[>\\+,]","delimiter"],["\\[",{token:"delimiter.bracket",next:"@selectorattribute"}],["{",{token:"delimiter.bracket",next:"@selectorbody"}]],selectorbody:[{include:"@comments"},["[*_]?@identifier@ws:(?=(\\s|\\d|[^{;}]*[;}]))","attribute.name","@rulevalue"],["}",{token:"delimiter.bracket",next:"@pop"}]],selectorname:[["(\\.|#(?=[^{])|%|(@identifier)|:)+","tag"]],selectorattribute:[{include:"@term"},["]",{token:"delimiter.bracket",next:"@pop"}]],term:[{include:"@comments"},["(url-prefix)(\\()",["attribute.value",{token:"delimiter.parenthesis",next:"@urldeclaration"}]],["(url)(\\()",["attribute.value",{token:"delimiter.parenthesis",next:"@urldeclaration"}]],{include:"@functioninvocation"},{include:"@numbers"},{include:"@name"},{include:"@strings"},["([<>=\\+\\-\\*\\/\\^\\|\\~,])","delimiter"],[",","delimiter"]],rulevalue:[{include:"@comments"},{include:"@strings"},{include:"@term"},["!important","keyword"],[";","delimiter","@pop"],["(?=})",{token:"",next:"@pop"}]],warndebug:[["[@](warn|debug)",{token:"keyword",next:"@declarationbody"}]],import:[["[@](import)",{token:"keyword",next:"@declarationbody"}]],urldeclaration:[{include:"@strings"},["[^)\r\n]+","string"],["\\)",{token:"delimiter.parenthesis",next:"@pop"}]],parenthizedterm:[{include:"@term"},["\\)",{token:"delimiter.parenthesis",next:"@pop"}]],declarationbody:[{include:"@term"},[";","delimiter","@pop"],["(?=})",{token:"",next:"@pop"}]],comments:[["\\/\\*","comment","@comment"],["\\/\\/+.*","comment"]],comment:[["\\*\\/","comment","@pop"],[/[^*/]+/,"comment"],[/./,"comment"]],name:[["@identifier","attribute.value"]],numbers:[["-?(\\d*\\.)?\\d+([eE][\\-+]?\\d+)?",{token:"attribute.value.number",next:"@units"}],["#[0-9a-fA-F_]+(?!\\w)","attribute.value.hex"]],units:[["(em|ex|ch|rem|fr|vmin|vmax|vw|vh|vm|cm|mm|in|px|pt|pc|deg|grad|rad|turn|s|ms|Hz|kHz|%)?","attribute.value.unit","@pop"]],keyframedeclaration:[["@identifier","attribute.value"],["{",{token:"delimiter.bracket",switchTo:"@keyframebody"}]],keyframebody:[{include:"@term"},["{",{token:"delimiter.bracket",next:"@selectorbody"}],["}",{token:"delimiter.bracket",next:"@pop"}]],functioninvocation:[["@identifier\\(",{token:"attribute.value",next:"@functionarguments"}]],functionarguments:[["\\$@identifier@ws:","attribute.name"],["[,]","delimiter"],{include:"@term"},["\\)",{token:"attribute.value",next:"@pop"}]],strings:[['~?"',{token:"string",next:"@stringenddoublequote"}],["~?'",{token:"string",next:"@stringendquote"}]],stringenddoublequote:[["\\\\.","string"],['"',{token:"string",next:"@pop"}],[/[^\\"]+/,"string"],[".","string"]],stringendquote:[["\\\\.","string"],["'",{token:"string",next:"@pop"}],[/[^\\']+/,"string"],[".","string"]]}}},Symbol.toStringTag,{value:"Module"}));export{u as c,d as u};
