Repository navigation
Expand file tree
/
Copy pathinitiative.js
More file actions
32 lines (30 loc) · 9.23 KB
/
Copy pathinitiative.js
File metadata and controls
32 lines (30 loc) · 9.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
"use strict";(()=>{var C={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor","stroke-width":2,"stroke-linecap":"round","stroke-linejoin":"round"};var q=([e,a,r])=>{let t=document.createElementNS("http://www.w3.org/2000/svg",e);return Object.keys(a).forEach(f=>{t.setAttribute(f,String(a[f]))}),r?.length&&r.forEach(f=>{let x=q(f);t.appendChild(x)}),t},v=(e,a={})=>{let t={...C,...a};return q(["svg",t,e])};var U=(...e)=>e.filter((a,r,t)=>!!a&&a.trim()!==""&&t.indexOf(a)===r).join(" ").trim();var O=e=>{for(let a in e)if(a.startsWith("aria-")||a==="role"||a==="title")return!0;return!1};var H=e=>{let a="",r=!1;for(let t of e){if(t==="-"||t==="_"||t<=" "){r=a.length>0;continue}a.length===0?a+=t.toLowerCase():a+=r?t.toUpperCase():t,r=!1}return a};var E=e=>{let a=H(e);return a.charAt(0).toUpperCase()+a.slice(1)};var $=e=>Array.from(e.attributes).reduce((a,r)=>(a[r.name]=r.value,a),{}),G=e=>typeof e=="string"?e:!e||!e.class?"":e.class&&typeof e.class=="string"?e.class.split(" "):e.class&&Array.isArray(e.class)?e.class:"",g=(e,{nameAttr:a,icons:r,attrs:t})=>{let f=e.getAttribute(a);if(f==null)return;let x=E(f),l=r[x];if(!l)return console.warn(`${e.outerHTML} icon name was not found in the provided icons object.`);let s=$(e),d=O(s)?{}:{"aria-hidden":"true"},R={...C,"data-lucide":f,...d,...t,...s},X=G(s),N=G(t),b=U("lucide",`lucide-${f}`,...X,...N);b&&Object.assign(R,{class:b});let K=v(l,R);return e.parentNode?.replaceChild(K,e)};var S=[["path",{d:"m7 7 10 10"}],["path",{d:"M17 7v10H7"}]];var k=[["path",{d:"M7 7h10v10"}],["path",{d:"M7 17 17 7"}]];var w=[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2"}]];var P=[["path",{d:"M12 15V3"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"}],["path",{d:"m7 10 5 5 5-5"}]];var A=[["path",{d:"m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7"}],["rect",{x:"2",y:"4",width:"20",height:"16",rx:"2"}]];var L=[["path",{d:"M4 5h16"}],["path",{d:"M4 12h16"}],["path",{d:"M4 19h16"}]];var M=[["path",{d:"M18 6 6 18"}],["path",{d:"m6 6 12 12"}]];var B=({icons:e={},nameAttr:a="data-lucide",attrs:r={},root:t=document,inTemplates:f}={})=>{if(!Object.values(e).length)throw new Error(`Please provide an icons object.
If you want to use all the icons you can import it like:
\`import { createIcons, icons } from 'lucide';
lucide.createIcons({icons});\``);if(typeof t>"u")throw new Error("`createIcons()` only works in a browser environment.");if(Array.from(t.querySelectorAll(`[${a}]`)).forEach(l=>g(l,{nameAttr:a,icons:e,attrs:r})),f&&Array.from(t.querySelectorAll("template")).forEach(s=>B({icons:e,nameAttr:a,attrs:r,root:s.content,inTemplates:f})),a==="data-lucide"){let l=t.querySelectorAll("[icon-name]");l.length>0&&(console.warn("[Lucide] Some icons were found with the now deprecated icon-name attribute. These will still be replaced for backwards compatibility, but will no longer be supported in v1.0 and you should switch to data-lucide"),Array.from(l).forEach(s=>g(s,{nameAttr:"icon-name",icons:e,attrs:r})))}};var Z="https://github.com/HuggingMath/TheoremOS",j=`${Z}/issues/new`,Te=`${j}?template=early-access.yml`;var I=e=>e.toLowerCase().startsWith("en")?"en":"zh";function V(){for(let e of document.querySelectorAll("a.lang-link")){let a=()=>{e.hash=location.hash};for(let r of["click","auxclick","contextmenu"])e.addEventListener(r,a)}}document.documentElement.classList.add("js");var W=I(document.documentElement.lang)==="en",o=W?{open:"Open navigation",close:"Close navigation",name:"Enter your name.",email:"Enter a valid email address.",choices:"Choose at least one area.",message:"Tell us a little about your idea; spaces alone do not count.",copied:"Email text copied. You can paste it into your email app.",copyFailed:"Copy was unavailable. The email text is selected; copy it manually or download it.",subject:"TheoremOS collaboration",to:"To",subjectLabel:"Subject",greeting:"Hello TheoremOS,",nameLabel:"Name",emailLabel:"Contact email",institution:"Institution",role:"Role",areas:"Areas of interest",idea:"My idea",optionalMissing:"Not provided"}:{open:"\u6253\u5F00\u5BFC\u822A",close:"\u5173\u95ED\u5BFC\u822A",name:"\u8BF7\u586B\u5199\u59D3\u540D\u3002",email:"\u8BF7\u586B\u5199\u6709\u6548\u7684\u90AE\u7BB1\u5730\u5740\u3002",choices:"\u8BF7\u81F3\u5C11\u9009\u62E9\u4E00\u4E2A\u53C2\u4E0E\u65B9\u5411\u3002",message:"\u8BF7\u7B80\u8981\u4ECB\u7ECD\u4F60\u7684\u60F3\u6CD5\u6216\u5EFA\u8BAE\u3002",copied:"\u90AE\u4EF6\u5168\u6587\u5DF2\u590D\u5236\uFF0C\u53EF\u7C98\u8D34\u5230\u90AE\u4EF6\u5BA2\u6237\u7AEF\u3002",copyFailed:"\u81EA\u52A8\u590D\u5236\u5931\u8D25\u3002\u90AE\u4EF6\u5168\u6587\u5DF2\u9009\u4E2D\uFF0C\u4F60\u53EF\u4EE5\u624B\u52A8\u590D\u5236\u6216\u4E0B\u8F7D\u6587\u672C\u3002",subject:"TheoremOS \u5171\u5EFA\u4EA4\u6D41",to:"\u6536\u4EF6\u4EBA",subjectLabel:"\u4E3B\u9898",greeting:"\u4F60\u597D\uFF0CTheoremOS\uFF1A",nameLabel:"\u59D3\u540D",emailLabel:"\u8054\u7CFB\u90AE\u7BB1",institution:"\u6240\u5728\u673A\u6784",role:"\u8EAB\u4EFD\u6216\u7814\u7A76\u65B9\u5411",areas:"\u53C2\u4E0E\u65B9\u5411",idea:"\u60F3\u6CD5\u6216\u5EFA\u8BAE",optionalMissing:"\u672A\u586B\u5199"};B({icons:{ArrowUpRight:k,ArrowDownRight:S,Menu:L,X:M,Copy:w,Download:P,Mail:A}});V();var n=document.querySelector(".menu-toggle"),F=document.getElementById("mobile-nav"),h=e=>{n.setAttribute("aria-expanded",String(e)),n.setAttribute("aria-label",e?o.close:o.open),F.hidden=!e};n.addEventListener("click",()=>h(n.getAttribute("aria-expanded")!=="true"));F.addEventListener("click",e=>{e.target.closest("a")&&h(!1)});document.addEventListener("keydown",e=>{e.key==="Escape"&&!F.hidden&&(h(!1),n.focus())});matchMedia("(max-width: 900px)").addEventListener("change",e=>{e.matches||h(!1)});var z=()=>{for(let e of document.querySelectorAll(".initiative-toc a"))e.hash===location.hash?e.setAttribute("aria-current","location"):e.removeAttribute("aria-current")};window.addEventListener("hashchange",z);z();var p=document.querySelector("[data-initiative-form]"),u=document.querySelector("[data-initiative-preview]"),J=u.querySelector("h3"),i=u.querySelector("[data-email-text]"),Q=u.querySelector("[data-open-email]"),Y=u.querySelector("[data-long-email]"),D=u.querySelector("[data-copy-status]"),c=[...p.querySelectorAll('input[name="area"]')],m={name:p.querySelector('[name="name"]'),email:p.querySelector('[name="email"]'),message:p.querySelector('[name="message"]')},_=(e,a="")=>{let r=document.getElementById(`initiative-${e}-error`);r.textContent=a,r.hidden=!a;for(let t of e==="choices"?c:[m[e]])a?t.setAttribute("aria-invalid","true"):t.removeAttribute("aria-invalid")},T=e=>{let a="";return e==="choices"?a=c.some(r=>r.checked)?"":o.choices:m[e].value.trim()?e==="email"&&!m.email.validity.valid&&(a=o.email):a=o[e],_(e,a),!a};for(let e of["name","email","message"])m[e].addEventListener("input",()=>{m[e].hasAttribute("aria-invalid")&&T(e)});for(let e of c)e.addEventListener("change",()=>{e.hasAttribute("aria-invalid")&&T("choices")});var y="liuzhenhao@westlake.edu.cn";p.addEventListener("submit",e=>{e.preventDefault(),m.email.value=m.email.value.trim();let a=["name","email","choices","message"].filter(d=>!T(d));if(a.length){(a[0]==="choices"?c[0]:m[a[0]]).focus();return}let r=d=>p.elements.namedItem(d).value.trim(),t=c.filter(d=>d.checked).map(d=>d.labels[0].textContent.trim()),f=`${o.subject} \xB7 ${r("name")}`,x=[o.greeting,"",`${o.nameLabel}: ${r("name")}`,`${o.emailLabel}: ${r("email")}`,`${o.institution}: ${r("institution")||o.optionalMissing}`,`${o.role}: ${r("role")||o.optionalMissing}`,`${o.areas}: ${t.join(" / ")}`,"",`${o.idea}:`,r("message")].join(`
`),l=`mailto:${y}?subject=${encodeURIComponent(f)}&body=${encodeURIComponent(x)}`,s=l.length>7500;Q.href=s?`mailto:${y}?subject=${encodeURIComponent(f)}`:l,Y.hidden=!s,i.value=`${o.to}: ${y}
${o.subjectLabel}: ${f}
${x}`,D.textContent="",p.hidden=!0,u.hidden=!1,J.focus()});u.querySelector("[data-edit-email]").addEventListener("click",()=>{u.hidden=!0,p.hidden=!1,m.name.focus()});u.querySelector("[data-copy-email]").addEventListener("click",async()=>{try{await navigator.clipboard.writeText(i.value),D.textContent=o.copied}catch{i.focus(),i.select(),D.textContent=o.copyFailed}});u.querySelector("[data-download-email]").addEventListener("click",()=>{let e=URL.createObjectURL(new Blob([i.value],{type:"text/plain;charset=utf-8"})),a=document.createElement("a");a.href=e,a.download=`theoremos-initiative-${W?"en":"zh"}.txt`,a.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)});p.hidden=!1;document.documentElement.dataset.initiativeReady="true";})();
/*! Bundled license information:
lucide/dist/esm/defaultAttributes.mjs:
lucide/dist/esm/createElement.mjs:
lucide/dist/esm/shared/src/utils/mergeClasses.mjs:
lucide/dist/esm/shared/src/utils/hasA11yProp.mjs:
lucide/dist/esm/shared/src/utils/toCamelCase.mjs:
lucide/dist/esm/shared/src/utils/toPascalCase.mjs:
lucide/dist/esm/replaceElement.mjs:
lucide/dist/esm/icons/arrow-down-right.mjs:
lucide/dist/esm/icons/arrow-up-right.mjs:
lucide/dist/esm/icons/copy.mjs:
lucide/dist/esm/icons/download.mjs:
lucide/dist/esm/icons/mail.mjs:
lucide/dist/esm/icons/menu.mjs:
lucide/dist/esm/icons/x.mjs:
lucide/dist/esm/lucide.mjs:
(**
* @license lucide v1.57.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*)
*/