1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3115],{24863:function(){},82963:function(){},72401:function(e,t,a){"use strict";a.d(t,{g:function(){return P}});var r=a(51198),s=a(85712),n=a(93420),l=a(73928),i=a(54822),o=a(5800),d=a(1063),c=a(35599),m=a(23161),u=a(87315),p=a(91139),h=a(2108),x=a(60756),f=a(82415),g=a(66888),v=a(80862),y=a(43265);function b(e){let t="string"==typeof e?y.ij(e,{type:"string"}):y.ij(e,{type:"array"}),a=t.SheetNames[0],r=t.Sheets[a];if(!r)return{headers:[],rows:[]};let s=y.P6.sheet_to_json(r,{header:1,raw:!1,defval:""});if(0===s.length)return{headers:[],rows:[]};let n=s[0].map(e=>String(null!=e?e:"").trim()).filter(Boolean),l=[];for(let e=1;e<s.length;e++){let t=s[e];if(!t||t.every(e=>""===String(null!=e?e:"").trim()))continue;let a={};n.forEach((e,r)=>{var s;a[e]=String(null!==(s=t[r])&&void 0!==s?s:"").trim()}),l.push(a)}return{headers:n,rows:l}}let w={teams:[{key:"name",label:"Team Name",required:!0,aliases:["team name","team","name"],examples:["Robo Pioneers","TechNova"],hint:"Unique within its league. Re-importing the same name updates that team."},{key:"league",label:"League",required:!0,aliases:["league","league title","competition"],examples:["",""],hint:'Must exactly match a league on this event â see the "Leagues" sheet.'},{key:"affiliation",label:"Affiliation",required:!1,aliases:["affiliation","university","organization","school"],examples:["Shiraz University","SPGC"],hint:"University, school or company the team represents."},{key:"contact_email",label:"Contact Email",required:!1,aliases:["contact email","email","team email"],examples:["[email protected]","[email protected]"],hint:"Team contact address. Does not create an account."},{key:"contact_phone",label:"Contact Phone",required:!1,aliases:["contact phone","phone","phone number"],examples:["+98 912 000 0000","+98 913 111 1111"]},{key:"country",label:"Country",required:!1,aliases:["country"],examples:["Iran","Iran"]},{key:"city",label:"City",required:!1,aliases:["city"],examples:["Shiraz","Tehran"]},{key:"state",label:"State",required:!1,aliases:["state","province"],examples:["Fars","Tehran"]},{key:"zip",label:"Zip",required:!1,aliases:["zip","zip code","postal code"],examples:["71346","14155"]}],members:[{key:"email",label:"Email",required:!0,aliases:["email","e-mail","member email"],examples:["[email protected]","[email protected]"],hint:"Used to match an existing account. A new account is created if none exists."},{key:"name",label:"Full Name",required:!0,aliases:["name","full name","member name"],examples:["Sara Ahmadi","Ali Rezaei"],hint:"Only used when creating a new account; existing profiles are never overwritten."},{key:"team",label:"Team Name",required:!0,aliases:["team","team name"],examples:["Robo Pioneers","TechNova"],hint:"The team must already exist in this event â import teams first."},{key:"league",label:"League",required:!1,aliases:["league","league title"],examples:["",""],hint:"Only needed when two teams share the same name in different leagues."},{key:"member_type",label:"Member Type",required:!1,aliases:["member type","role","type","position"],examples:["",""],hint:'Must exactly match a value on the "Member types" sheet.'},{key:"country",label:"Country",required:!1,aliases:["country"],examples:["Iran","Iran"]},{key:"dob",label:"Date of Birth",required:!1,aliases:["dob","date of birth","birthdate","birth date"],examples:["2005-04-17","2006-11-02"],hint:"Use YYYY-MM-DD to avoid day/month ambiguity."}],awards:[{key:"team",label:"Team Name",required:!0,aliases:["team","team name"],examples:["Robo Pioneers","TechNova"],hint:"The team must already exist in this event."},{key:"league",label:"League",required:!1,aliases:["league","league title"],examples:["",""],hint:"Only needed when two teams share the same name in different leagues."},{key:"award_title",label:"Award Title",required:!0,aliases:["award title","award","title","prize"],examples:["1st Place","2nd Place Technical Challenge"],hint:"A team that already has an award with this exact title is skipped."}]},j=e=>e.trim().toLowerCase().replace(/\s+/g," "),N={teams:"Teams",members:"Members",awards:"Awards"};function k(e,t,a){let r=t.length>0?t.map(e=>[e]):[[a]],s=y.P6.aoa_to_sheet([[e],...r]);return s["!cols"]=[{wch:46}],s}function C(e,t){let a=URL.createObjectURL(e),r=document.createElement("a");r.href=a,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(a)}function _(e,t,a){let r=function(e,t){var a,r;let s=y.P6.book_new();return y.P6.book_append_sheet(s,function(e,t){let a=w[e],r=a.map(e=>e.label),s=y.P6.aoa_to_sheet([r,...function(e,t){var a,r;let s=w[e],n=null!==(a=null==t?void 0:t.leagues)&&void 0!==a?a:[],l=null!==(r=null==t?void 0:t.memberTypes)&&void 0!==r?r:[];return[0,1].map(e=>s.map(t=>{var a,r,s,i,o,d;return"league"===t.key?null!==(s=null!==(r=n[e])&&void 0!==r?r:n[0])&&void 0!==s?s:"League title":"member_type"===t.key?null!==(o=null!==(i=l[e])&&void 0!==i?i:l[0])&&void 0!==o?o:"Member type":null!==(d=null===(a=t.examples)||void 0===a?void 0:a[e])&&void 0!==d?d:""}))}(e,t)]);return s["!cols"]=a.map(e=>({wch:Math.max(e.label.length+4,18)}
1)),s}(e,t),N[e]),y.P6.book_append_sheet(s,function(e){let t=[["Column","Required","Notes"],...w[e].map(e=>{var t;return[e.label,e.required?"Yes":"Optional",null!==(t=e.hint)&&void 0!==t?t:""]})],a=y.P6.aoa_to_sheet(t);return a["!cols"]=[{wch:20},{wch:10},{wch:72}],a}(e),"Columns"),w[e].some(e=>"league"===e.key)&&y.P6.book_append_sheet(s,k("League",null!==(a=null==t?void 0:t.leagues)&&void 0!==a?a:[],"No leagues configured on this event yet"),"Leagues"),"members"===e&&y.P6.book_append_sheet(s,k("Member type",null!==(r=null==t?void 0:t.memberTypes)&&void 0!==r?r:[],"No member types configured"),"Member types"),s}(e,a),s=new Date().toISOString().slice(0,10),n="AVIS-".concat(N[e],"-Import-Template-").concat(s);if("csv"===t){C(new Blob([y.P6.sheet_to_csv(r.Sheets[N[e]])],{type:"text/csv;charset=utf-8;"}),"".concat(n,".csv"));return}C(new Blob([y.cW(r,{bookType:"xlsx",type:"array"})],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),"".concat(n,".xlsx"))}var S=a(7349),T=a(87898);let z={teams:"Teams",members:"Members",awards:"Awards"};function P(e){var t;let{eventId:a,kind:y,trigger:N,onImported:k}=e,{userInfo:C}=(0,S.Z)(e=>e),P=s.useMemo(()=>(null==C?void 0:C.token)?{Authorization:"Bearer ".concat(C.token)}:void 0,[null==C?void 0:C.token]),[R,q]=s.useState(!1),[A,M]=s.useState("source"),[D,E]=s.useState(!1),[I,Z]=s.useState(""),[O,B]=s.useState(null),[L,U]=s.useState({}),[G,V]=s.useState(null),[F,Y]=s.useState(null),H=s.useRef(null),$=w[y];s.useEffect(()=>{if(!R||F)return;let e=!0;return fetch("/api/event/".concat(a,"/import/reference"),{headers:P}).then(e=>e.ok?e.json():null).then(t=>{e&&t&&Y(t)}).catch(e=>console.error("Error loading import reference data:",e)),()=>{e=!1}},[R,a,F]);let K=()=>{M("source"),E(!1),Z(""),B(null),U({}),V(null)},Q=e=>{q(e),e||K()},W=e=>{if(0===e.headers.length||0===e.rows.length){v.A.error("That file has no readable rows");return}B(e),U(function(e,t){let a={},r=t.map(e=>({raw:e,normalized:j(e)}));for(let t of w[e]){let e=r.find(e=>t.aliases.includes(e.normalized));e&&(a[t.key]=e.raw)}return a}(y,e.headers)),M("mapping")},J=async e=>{E(!0);try{let t=await e.arrayBuffer();W(b(t))}catch(e){v.A.error("Could not read that file")}finally{E(!1)}},X=async()=>{if(I.trim()){E(!0);try{let e=await fetch("/api/event/".concat(a,"/import/sheet?url=").concat(encodeURIComponent(I.trim())),{headers:P});if(!e.ok){let t=await e.json().catch(()=>null);throw Error((null==t?void 0:t.error)||"Failed to load the Google Sheet")}let t=await e.text();W(b(t))}catch(e){v.A.error((null==e?void 0:e.message)||"Failed to load the Google Sheet")}finally{E(!1)}}},ee=$.filter(e=>e.required&&!L[e.key]),et=async()=>{if(O){E(!0);try{let e=await fetch("/api/event/".concat(a,"/import/commit"),{method:"POST",headers:{"Content-Type":"application/json",...null!=P?P:{}},body:JSON.stringify({kind:y,mapping:L,rows:O.rows})}),t=await e.json();if(!e.ok)throw Error((null==t?void 0:t.error)||"Import failed");V(t.results),M("result");let{created:r=0,updated:s=0}=t.summary||{};r+s>0&&(v.A.success("Imported ".concat(r+s," ").concat(z[y].toLowerCase())),null==k||k())}catch(e){v.A.error((null==e?void 0:e.message)||"Import failed")}finally{E(!1)}}},ea=s.useMemo(()=>G?G.reduce((e,t)=>(e[t.status]++,e),{created:0,updated:0,skipped:0,error:0}):null,[G]);return(0,r.jsxs)(n.Vq,{open:R,onOpenChange:Q,children:[(0,r.jsx)(n.hg,{asChild:!0,children:N}),(0,r.jsxs)(n.cZ,{className:"flex h-[88vh] w-[96vw] max-w-6xl flex-col gap-0 overflow-hidden p-0 sm:max-w-6xl",children:[(0,r.jsxs)(n.fK,{className:"shrink-0 space-y-1 border-b px-6 py-4 text-left",children:[(0,r.jsxs)(n.$N,{children:["Import ",z[y]]}),(0,r.jsxs)(n.Be,{children:["source"===A&&"Upload an Excel or CSV file, or paste a public Google Sheets link.","mapping"===A&&"Match your spreadsheet columns to the ".concat(z[y].toLowerCase()," fields, then review the preview."),"result"===A&&"Here is what happened to each row."]})]}),"source"===A&&(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-8",children:(0,r.jsxs)("div",{className:"mx-auto flex w-full max-w-xl flex-col gap-6",children:[(0,r.jsxs)("div",{className:"rounded-lg border bg-muted/30 p-4",children:[(0,r.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Required format"}),(0,r.jsxs)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:["One row per ","teams"===y?"team":"members"===y?"member":"award",", with a header row on top. Extra columns are ignored."]})]}),(0,r.jsxs)("div",{className:"flex shrink-0 gap-2",children:[(0,r.jsxs)(l.z,{variant:"outline",size:"sm",onClick:()=>_(y,"xlsx",null!=F?F:void 0),children:[(0,r.jsx)(u.Z,{className:"mr-2 h-4 w-4"}),"Excel"]}),(0,r.jsxs)(l.z,{variant:"outline",size:"sm",onClick:()=>_(y,"csv",null!=F?F:void 0),children:[(0,r.jsx)(u.Z,{className:"mr-2 h-4 w-4"}),"CSV"]})]})]}),(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-1.5",children:$.map(e=>(0,r.jsxs)(d.C,{variant:e.required?"default":"secondary",className:"text-[11px] font-normal",children:[e.label,e.required&&" *"]},e.key))}),(0,r.jsxs)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:["* required. The Excel template also lists this event's valid",$.some(e=>"league"===e.key)?" league":"","members"===y?" and member type":""," values."]}),F&&F.leagues.length>0&&$.some(e=>
1"league"===e.key)&&(0,r.jsxs)("p",{className:"mt-2 text-[11px] text-muted-foreground",children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:"Leagues:"})," ",F.leagues.join(" \xb7 ")]}),F&&"members"===y&&F.memberTypes.length>0&&(0,r.jsxs)("p",{className:"mt-1 text-[11px] text-muted-foreground",children:[(0,r.jsx)("span",{className:"font-medium text-foreground",children:"Member types:"})," ",F.memberTypes.join(" \xb7 ")]})]}),(0,r.jsxs)("div",{className:"flex cursor-pointer flex-col items-center justify-center gap-3 rounded-xl border-2 border-dashed p-12 text-center transition-colors hover:border-primary/50 hover:bg-muted/50",onClick:()=>{var e;return null===(e=H.current)||void 0===e?void 0:e.click()},onDragOver:e=>e.preventDefault(),onDrop:e=>{var t;e.preventDefault();let a=null===(t=e.dataTransfer.files)||void 0===t?void 0:t[0];a&&J(a)},children:[D?(0,r.jsx)(p.Z,{className:"h-10 w-10 animate-spin text-muted-foreground"}):(0,r.jsx)(h.Z,{className:"h-10 w-10 text-muted-foreground"}),(0,r.jsxs)("p",{className:"text-sm",children:[(0,r.jsx)("span",{className:"font-medium text-primary",children:"Click to upload"})," or drag and drop"]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:".xlsx, .xls or .csv"}),(0,r.jsx)("input",{ref:H,type:"file",accept:".xlsx,.xls,.csv",className:"hidden",onChange:e=>{var t;let a=null===(t=e.target.files)||void 0===t?void 0:t[0];a&&J(a),e.target.value=""}})]}),(0,r.jsxs)("div",{className:"flex items-center gap-3 text-xs text-muted-foreground",children:[(0,r.jsx)("div",{className:"h-px flex-1 bg-border"}),"OR",(0,r.jsx)("div",{className:"h-px flex-1 bg-border"})]}),(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsx)(o._,{children:"Google Sheets link"}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)(i.I,{placeholder:"https://docs.google.com/spreadsheets/d/...",value:I,onChange:e=>Z(e.target.value),onKeyDown:e=>{"Enter"===e.key&&X()}}),(0,r.jsx)(l.z,{variant:"outline",onClick:X,disabled:D||!I.trim(),children:D?(0,r.jsx)(p.Z,{className:"h-4 w-4 animate-spin"}):(0,r.jsx)(x.Z,{className:"h-4 w-4"})})]}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"The sheet must be shared as âAnyone with the link can viewâ."})]})]})}),"mapping"===A&&O&&(0,r.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col overflow-y-auto lg:grid lg:grid-cols-[340px_1fr] lg:overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex min-w-0 shrink-0 flex-col border-b lg:min-h-0 lg:shrink lg:border-b-0 lg:border-r",children:[(0,r.jsxs)("div",{className:"shrink-0 px-6 py-3",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Match your columns"}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:[O.rows.length," row",1===O.rows.length?"":"s"," detected"]})]}),(0,r.jsx)("div",{className:"space-y-3 px-6 pb-6 lg:min-h-0 lg:flex-1 lg:overflow-y-auto",children:$.map(e=>(0,r.jsxs)("div",{className:"space-y-1",children:[(0,r.jsxs)(o._,{className:"flex items-center gap-1 text-xs",children:[e.label,e.required&&(0,r.jsx)("span",{className:"text-destructive",children:"*"})]}),(0,r.jsxs)(c.Ph,{value:L[e.key]||"__none__",onValueChange:t=>U(a=>({...a,[e.key]:"__none__"===t?"":t})),children:[(0,r.jsx)(c.i4,{className:(0,T.cn)("h-9",e.required&&!L[e.key]&&"border-destructive"),children:(0,r.jsx)(c.ki,{placeholder:"Not mapped"})}),(0,r.jsxs)(c.Bw,{children:[(0,r.jsx)(c.Ql,{value:"__none__",children:"Not mapped"}),O.headers.map(e=>(0,r.jsx)(c.Ql,{value:e,children:e},e))]})]})]},e.key))})]}),(0,r.jsxs)("div",{className:"flex min-w-0 flex-col lg:min-h-0",children:[(0,r.jsxs)("div",{className:"shrink-0 px-6 py-3",children:[(0,r.jsx)("p",{className:"text-sm font-medium",children:"Preview"}),(0,r.jsxs)("p",{className:"text-xs text-muted-foreground",children:["First ",Math.min(25,O.rows.length)," of ",O.rows.length," row",1===O.rows.length?"":"s",", as they will be imported"]})]}),(0,r.jsx)("div",{className:"overflow-x-auto px-6 pb-6 lg:min-h-0 lg:flex-1 lg:overflow-auto",children:(0,r.jsx)("div",{className:"w-max min-w-full rounded-md border [&>div]:overflow-visible",children:(0,r.jsxs)(m.iA,{children:[(0,r.jsx)(m.xD,{className:"sticky top-0 z-10 bg-muted",children:(0,r.jsx)(m.SC,{children:$.map(e=>(0,r.jsxs)(m.ss,{className:"whitespace-nowrap",children:[e.label,e.required&&(0,r.jsx)("span",{className:"text-destructive",children:" *"})]},e.key))})}),(0,r.jsx)(m.RM,{children:O.rows.slice(0,25).map((e,t)=>(0,r.jsx)(m.SC,{children:$.map(t=>{let a=L[t.key]?e[L[t.key]]:"";return(0,r.jsx)(m.pj,{className:(0,T.cn)("whitespace-nowrap text-xs",!a&&"text-muted-foreground"),children:a||"â"},t.key)})},t))})]})})})]})]}),"result"===A&&ea&&(0,r.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-6 py-6",children:(0,r.jsxs)("div",{className:"mx-auto w-full max-w-3xl space-y-6",children:[(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-4",children:[(0,r.jsxs)("div",{className:"rounded-lg border p-4 text-center",children:[(0,r.jsx)("p",{className:"text-2xl font-semibold text-green-600",children:ea.created}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Created"})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-4 text-center",children:[(0,r.jsx)("p",{className:"text-2xl font-semibold text-blue-600",children:ea.updated}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Updated"})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-4 text-center",children:[(0,r.jsx)("p",{className:"text-2xl font-semibold text-muted-foreground",children:ea.skipped}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Skipped"})]}),(0,r.jsxs)("div",{className:"rounded-lg border p-4 text-center",children:[(0,r.jsx)("p",{className:"text-2xl font-semibold text-destructive",children:ea.error}),(0,r.jsx)("p",{className:"text-xs text-muted-foreground",children:"Errors"})]})]}),G&&G.some(e=>"error"===e.status||"skipped"===e.status)?(0,r.jsx)("div",{className:"overflow-x-auto rounded-md border",children:(0,r.jsxs)(m.iA,{children:[(0,r.jsx)(m.xD,{className:"sticky top-0 bg-muted/50",children:(0,r.jsxs)(m.SC,{children:[(0,r.jsx)(m.ss,{className:"w-20",children:"Row"}),(0,r.jsx)(m.ss,{className:"w-28",children:"Status"}),(0,r.jsx)(m.ss,{children:"Message"})]})}),(0,r.jsx)(m.RM,{children:G.filter(e=>"error"===e.status||"skipped"===e.status).map((e,t)=>(0,r.jsxs)(m.SC,{children:[(0,r.jsx)(m.pj,{className:"text-xs",children:e.row}
1),(0,r.jsx)(m.pj,{children:(0,r.jsx)(d.C,{variant:"error"===e.status?"destructive":"secondary",className:"text-xs",children:e.status})}),(0,r.jsx)(m.pj,{className:"text-xs",children:e.message})]},t))})]})}):(0,r.jsx)("p",{className:"text-center text-sm text-muted-foreground",children:"Every row was imported without problems."})]})}),(0,r.jsxs)(n.cN,{className:"shrink-0 items-center gap-2 border-t px-6 py-4 sm:justify-between",children:[(0,r.jsx)("p",{className:"hidden text-xs text-muted-foreground sm:block",children:"mapping"===A&&ee.length>0&&(0,r.jsxs)("span",{className:"flex items-center gap-1.5 text-destructive",children:[(0,r.jsx)(f.Z,{className:"h-3.5 w-3.5"}),"Map ",ee.map(e=>e.label).join(", ")," to continue."]})}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:["source"===A&&(0,r.jsx)(l.z,{variant:"outline",onClick:()=>Q(!1),children:"Cancel"}),"mapping"===A&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.z,{variant:"outline",onClick:()=>M("source"),children:"Back"}),(0,r.jsx)(l.z,{onClick:et,disabled:D||ee.length>0,children:D?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(p.Z,{className:"mr-2 h-4 w-4 animate-spin"})," Importingâ¦"]}):"Import ".concat(null!==(t=null==O?void 0:O.rows.length)&&void 0!==t?t:""," row").concat((null==O?void 0:O.rows.length)===1?"":"s")})]}),"result"===A&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(l.z,{variant:"outline",onClick:K,children:"Import another file"}),(0,r.jsxs)(l.z,{onClick:()=>Q(!1),children:[(0,r.jsx)(g.Z,{className:"mr-2 h-4 w-4"})," Done"]})]})]})]})]})]})}},66068:function(e,t,a){"use strict";a.d(t,{a3:function(){return i},zt:function(){return c}});var r=a(51198),s=a(85712),n=a(97565);let l=e=>"".concat(e,"mm");function i(e){return"page"===e.batch.mode?1:Math.max(1,e.batch.columns*e.batch.rows)}function o(e){return"page"===e.batch.mode?{width:e.page.width,height:e.page.height}:{width:e.batch.sheetWidth,height:e.batch.sheetHeight}}function d(e){let{doc:t,records:a,mode:s}=e,{width:i,height:d}=o(t);if("page"===t.batch.mode)return(0,r.jsx)("div",{className:"print-sheet",style:{width:l(i),height:l(d),position:"relative",overflow:"hidden"},children:a[0]?(0,r.jsx)(n.eB,{document:t,record:a[0],mode:s,bare:!0}):null});let{columns:c,rows:m,marginTop:u,marginLeft:p,gapX:h,gapY:x,showCutMarks:f}=t.batch;return(0,r.jsx)("div",{className:"print-sheet",style:{width:l(i),height:l(d),position:"relative",overflow:"hidden"},children:(0,r.jsx)("div",{style:{position:"absolute",top:l(u),left:l(p),display:"grid",gridTemplateColumns:"repeat(".concat(c,", ").concat(l(t.page.width),")"),gridTemplateRows:"repeat(".concat(m,", ").concat(l(t.page.height),")"),columnGap:l(h),rowGap:l(x)},children:Array.from({length:c*m}).map((e,i)=>{let o=a[i];return(0,r.jsx)("div",{style:{position:"relative",width:l(t.page.width),height:l(t.page.height),overflow:"hidden",outline:f?"0.1mm dashed rgba(0,0,0,0.25)":void 0,outlineOffset:"-0.05mm"},children:o?(0,r.jsx)(n.eB,{document:t,record:o,mode:s,bare:!0}):null},i)})})})}async function c(e,t){var s,n,l;let d=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{},{createRoot:c}=await Promise.resolve().then(a.t.bind(a,11218,19)),{width:u,height:p}=o(e),h=function(e,t){let a=i(e),r=[];for(let e=0;e<t.length;e+=a)r.push(t.slice(e,e+a));return r.length?r:[[]]}(e,t),x=null!==(s=d.mode)&&void 0!==s?s:"print",f=e.fonts.filter(Boolean),g=f.length?'<link rel="stylesheet" href="https://fonts.googleapis.com/css2?'.concat(f.map(e=>"family=".concat(encodeURIComponent(e).replace(/%20/g,"+"),":wght@300;400;500;600;700;800")).join("&"),'&display=swap">'):"",v='<!doctype html><html><head><meta charset="utf-8">\n<title>'.concat(null!==(n=d.title)&&void 0!==n?n:"Print","</title>\n").concat(g,"\n<style>\n @page { size: ").concat(u,"mm ").concat(p,'mm; margin: 0; }\n * { box-sizing: border-box; }\n html, body { margin: 0; padding: 0; background: #fff; }\n .print-sheet {\n background: #fff;\n break-after: page;\n page-break-after: always;\n -webkit-print-color-adjust: exact;\n print-color-adjust: exact;\n }\n .print-sheet:last-child { break-after: auto; page-break-after: auto; }\n img { display: block; }\n</style></head><body><div id="print-root"></div></body></html>'),y=window.document.createElement("iframe");y.setAttribute("aria-hidden","true"),y.style.cssText="position:fixed;left:-10000px;top:0;width:1200px;height:900px;border:0;pointer-events:none;",window.document.body.appendChild(y);let b=(e,t)=>Promise.race([e,new Promise(e=>setTimeout(e,t))]),w=e=>{try{null==e||e.unmount()}catch(e){}y.remove()};try{await new Promise(e=>{y.onload=()=>e();let t=y.contentDocument;t.open(),t.write(v),t.close()});let t=y.contentWindow,a=y.contentDocument.getElementById("print-root"),s=c(a);await b(new Promise(t=>{s.render((0,r.jsx)(m,{doc:e,sheets:h,mode:x,onReady:t}))}),5e3);try{let e=null===(l=y.contentDocument.fonts)||void 0===l?void 0:l.ready;e&&await b(e,8e3)}catch(e){}await b(Promise.all(Array.from(y.contentDocument.images).map(e=>e.complete?Promise.resolve():new Promise(t=>{e.onload=()=>t(),e.onerror=()=>t()}
1))),15e3),await b(new Promise(t=>{s.render((0,r.jsx)(m,{doc:e,sheets:h,mode:x,onReady:t,pass:2}))}),5e3),t.focus(),t.print(),window.setTimeout(()=>w(s),6e4)}catch(e){throw w(),e}}function m(e){let{doc:t,sheets:a,mode:n,onReady:l,pass:i=1}=e;return s.useEffect(()=>{let e=setTimeout(l,0);return()=>clearTimeout(e)},[l,i]),(0,r.jsx)(r.Fragment,{children:a.map((e,a)=>(0,r.jsx)(d,{doc:t,records:e,mode:n},"".concat(i,"-").concat(a)))})}},59994:function(e,t,a){"use strict";a.d(t,{F:function(){return c}});var r=a(85712),s=a(80862),n=a(22236),l=a(64048),i=a(27980),o=a(20121),d=a(66068);function c(e){let{scope:t,eventId:a,templatesHref:c}=e,[m,u]=r.useState(!1),p=null!=t?t:{event:a},h=(0,l.IO)(p);return{print:r.useCallback(async(e,t)=>{if(!t.length){s.A.error("Select at least one row first");return}u(!0);try{var a,r,m;let u=await (0,n.hi)("GET","print-templates?".concat(h,"&entity=").concat(e)),x=null!==(r=null==u?void 0:u.data)&&void 0!==r?r:[],f=null!==(m=x.find(e=>e.is_default))&&void 0!==m?m:x[0];if(!f){s.A.error("No ".concat((0,i.Hv)(e).label.toLowerCase()," template yet"),{description:"Design one first, then print straight from this grid.",action:{label:"Open designer",onClick:()=>window.open(c,"_blank")}});return}let[g,v]=await Promise.all([(0,n.hi)("GET","print-templates/".concat(f.id)),(0,l.YP)(e,p,t)]);if(!v.length){s.A.error("Could not resolve any of the selected records");return}await (0,d.zt)((0,o.H)(null==g?void 0:null===(a=g.data)||void 0===a?void 0:a.document),v.map(e=>e.record),{title:"".concat((0,i.Hv)(e).label," â ").concat(v.length)})}catch(e){s.A.error((0,l.N3)(e,"Could not prepare the print run"))}finally{u(!1)}},[h,c]),busy:m}}t.Z=c},1063:function(e,t,a){"use strict";a.d(t,{C:function(){return i}});var r=a(51198);a(85712);var s=a(37463),n=a(87898);let l=(0,s.j)("inline-flex items-center rounded-full border px-2.5 py-0.5 text-xs font-semibold transition-colors focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2",{variants:{variant:{default:"border-transparent bg-primary text-primary-foreground hover:bg-primary/80",secondary:"border-transparent bg-secondary text-secondary-foreground hover:bg-secondary/80",destructive:"border-transparent bg-destructive text-destructive-foreground hover:bg-destructive/80",outline:"text-foreground",success:"border-transparent bg-green-500 text-white hover:bg-green-500/80"}},defaultVariants:{variant:"default"}});function i(e){let{className:t,variant:a,...s}=e;return(0,r.jsx)("div",{className:(0,n.cn)(l({variant:a}),t),...s})}},93420:function(e,t,a){"use strict";a.d(t,{$N:function(){return x},Be:function(){return f},GG:function(){return c},Vq:function(){return i},cN:function(){return h},cZ:function(){return u},fK:function(){return p},hg:function(){return o}});var r=a(51198),s=a(85712),n=a(92089),l=a(87898);let i=n.fC,o=n.xz,d=n.h_,c=n.x8,m=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.aV,{ref:t,className:(0,l.cn)("fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 backdrop-blur-sm",a),...s})});m.displayName=n.aV.displayName;let u=s.forwardRef((e,t)=>{let{className:a,children:s,...i}=e;return(0,r.jsxs)(d,{children:[(0,r.jsx)(m,{}),(0,r.jsx)(n.VY,{ref:t,className:(0,l.cn)("fixed left-[50%] top-[50%] z-[99999999999] grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",a),...i,children:s})]})});u.displayName=n.VY.displayName;let p=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,l.cn)("flex flex-col space-y-1.5 text-center sm:text-left",t),...a})};p.displayName="DialogHeader";let h=e=>{let{className:t,...a}=e;return(0,r.jsx)("div",{className:(0,l.cn)("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",t),...a})};h.displayName="DialogFooter";let x=s.forwardRef((e,t)=>
1{let{className:a,...s}=e;return(0,r.jsx)(n.Dx,{ref:t,className:(0,l.cn)("text-lg font-semibold leading-none tracking-tight",a),...s})});x.displayName=n.Dx.displayName;let f=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.dk,{ref:t,className:(0,l.cn)("text-sm text-muted-foreground",a),...s})});f.displayName=n.dk.displayName},54822:function(e,t,a){"use strict";a.d(t,{I:function(){return l}});var r=a(51198),s=a(85712),n=a(87898);let l=s.forwardRef((e,t)=>{let{className:a,type:s,englishOnly:l,...i}=e;return(0,r.jsx)("input",{type:s,className:(0,n.cn)("flex h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background file:border-0 file:bg-transparent file:text-sm file:font-medium placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50",a),ref:t,...i})});l.displayName="Input"},5800:function(e,t,a){"use strict";a.d(t,{_:function(){return d}});var r=a(51198),s=a(85712),n=a(39578),l=a(37463),i=a(87898);let o=(0,l.j)("text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70"),d=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.f,{ref:t,className:(0,i.cn)(o(),a),...s})});d.displayName=n.f.displayName},35599:function(e,t,a){"use strict";a.d(t,{Bw:function(){return x},Ph:function(){return c},Ql:function(){return f},i4:function(){return u},ki:function(){return m}});var r=a(51198),s=a(85712),n=a(44393),l=a(43089),i=a(55665),o=a(83418),d=a(87898);let c=n.fC;n.ZA;let m=n.B4,u=s.forwardRef((e,t)=>{let{className:a,children:s,...i}=e;return(0,r.jsxs)(n.xz,{ref:t,className:(0,d.cn)("flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm r
1ing-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",a),...i,children:[s,(0,r.jsx)(n.JO,{asChild:!0,children:(0,r.jsx)(l.Z,{className:"h-4 w-4 opacity-50"})})]})});u.displayName=n.xz.displayName;let p=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.u_,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,r.jsx)(i.Z,{className:"h-4 w-4"})})});p.displayName=n.u_.displayName;let h=s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.$G,{ref:t,className:(0,d.cn)("flex cursor-default items-center justify-center py-1",a),...s,children:(0,r.jsx)(l.Z,{className:"h-4 w-4"})})});h.displayName=n.$G.displayName;let x=s.forwardRef((e,t)=>{let{className:a,children:s,position:l="popper",...i}=e;return(0,r.jsx)(n.h_,{children:(0,r.jsxs)(n.VY,{ref:t,className:(0,d.cn)("relative z-[99999999999] max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2","popper"===l&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",a),position:l,...i,children:[(0,r.jsx)(p,{}),(0,r.jsx)(n.l_,{className:(0,d.cn)("p-1","popper"===l&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:s}),(0,r.jsx)(h,{})]})})});x.displayName=n.VY.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.__,{ref:t,className:(0,d.cn)("py-1.5 pl-8 pr-2 text-sm font-semibold",a),...s})}).displayName=n.__.displayName;let f=s.forwardRef((e,t)=>{let{className:a,children:s,...l}=e;return(0,r.jsxs)(n.ck,{ref:t,className:(0,d.cn)("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",a),...l,children:[(0,r.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:(0,r.jsx)(n.wU,{children:(0,r.jsx)(o.Z,{className:"h-4 w-4"})})}),(0,r.jsx)(n.eT,{children:s})]})});f.displayName=n.ck.displayName,s.forwardRef((e,t)=>{let{className:a,...s}=e;return(0,r.jsx)(n.Z0,{ref:t,className:(0,d.cn)("-mx-1 my-1 h-px bg-muted",a),...s})}).displayName=n.Z0.displayName},64048:function(e,t,a){"use strict";a.d(t,{IO:function(){return n},N3:function(){return s},YP:function(){return l}});var r=a(22236);function s(e,t){if("string"==typeof e&&e)return e;if(e&&"object"==typeof e){let t=e.message;if("string"==typeof t&&t)return t}return t}function n(e){return null!=e.conference?"conference=".concat(e.conference):"event=".concat(e.event)}async function l(e,t,a){var s;let n=await (0,r.hi)("POST","print/data",{entity:e,..."string"==typeof t?{event:t}:t,ids:a});return null!==(s=null==n?void 0:n.data)&&void 0!==s?s:[]}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.