1!function(){try{var e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="52476d50-7964-4f12-83e1-fcd7aa809361",e._sentryDebugIdIdentifier="sentry-dbid-52476d50-7964-4f12-83e1-fcd7aa809361")}catch(e){}}();"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[15681],{7216:(e,t,n)=>{let r;n.d(t,{At:()=>B,BJ:()=>U,Be:()=>J,Fm:()=>L,NZ:()=>M,O1:()=>W,Od:()=>V,SF:()=>O,Yh:()=>F,i:()=>I,ik:()=>T,oJ:()=>Y,uX:()=>Q,yV:()=>R});var l=n(12115),i=n(67266),o=n(38780),s=n(96885),a=n(18561),u=n(15785);let c={lists:[],status:"loading"},d={lists:[],status:"anon"},f=c,m=null,h=null,p=0,v=new Set,y=new Map,b=new Map,g=new Set,w=new Set;function x(){let e=!!m;null==h||h.abort(),h=null,m=null;let t=new AbortController;return g.add(t),e&&L(!0),t}function k(e){if(g.delete(e),!g.size){let e=[...w];for(let t of(w.clear(),e))t()}}function C(e){var t;let n=y.get(e);if(!n)return;for(let r of null!=(t=b.get(e))?t:[])n={...n,...r.edit(n)};let r=n;E({...f,lists:f.lists.map(t=>t.id===e?r:t)})}async function j(e,t,n){for(;t.length&&n===p;){let r=t[0];if(r.controller.signal.aborted)return;let l=y.get(e),i=l?r.edit(l):null,o=!1;try{if(i){let t=await fetch("/api/user/watchlists",{method:"PUT",signal:r.controller.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({listId:e,...i})});if(!t.ok)throw Error(await P(t,r.fallbackError))}if(n!==p||r.controller.signal.aborted)return;l&&i&&y.set(e,{...y.get(e),...i}),o=!!l}catch(e){if(n!==p||r.controller.signal.aborted)return;A((null==e?void 0:e.message)||r.fallbackError,"error")}if(n!==p||r.controller.signal.aborted)return;t.shift(),t.length||b.delete(e),C(e),r.resolve(o),k(r.controller)}}function E(e){for(let t of(f=e,(0,o.p9)(e.lists.map(e=>({_id:e.id,name:e.name,icon:e.icon,symbols:e.symbols,isDefault:e.isDefault}))),v))t()}function N(){return f}function S(e){return v.add(e),()=>{v.delete(e)}}function z(e){var t;let n=null!=(t=null==e?void 0:e._id)?t:null==e?void 0:e.id;return n?{id:String(n),name:String((null==e?void 0:e.name)||"Watchlist"),icon:"string"==typeof(null==e?void 0:e.icon)&&e.icon.trim()||a.PQ,background:"string"==typeof(null==e?void 0:e.background)&&e.background.trim()?e.background.trim().toLowerCase():null,symbols:Array.isArray(null==e?void 0:e.symbols)?e.symbols.map(e=>String(e||"").trim().toUpperCase()).filter(Boolean):[],isDefault:!!(null==e?void 0:e.isDefault)}:null}function A(e,t){try{window.dispatchEvent(new CustomEvent("tw-toast",{detail:{message:e,type:t}}))}catch(e){}}async function P(e,t){return D(await e.json().catch(()=>null),t)}function D(e,t){return("string"==typeof(null==e?void 0:e.error)?e.error.trim():"")||t}function L(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!r)return Promise.resolve();if(m)return m;if(!e&&"ready"===f.status)return Promise.resolve();let t=p;if(g.size)return new Promise(e=>w.add(e)).then(()=>{if(t===p)return L(e)});let n=new AbortController;h=n;let l=()=>t===p&&!n.signal.aborted,i=fetch("/api/user/watchlists?seed=0",{signal:n.signal}).then(async e=>{if(!l())return;if(401===e.status)return void E({lists:[],status:"anon"});if(!e.ok)return void E({...f,status:"failed"});let t=await e.json();if(!l())return;if(!Array.isArray(null==t?void 0:t.watchlists))return void E({...f,status:"failed"});let n=t.watchlists.map(z).filter(Boolean);for(let e of(y.clear(),n))y.set(e.id,e);E({lists:n,status:"ready"})}).catch(()=>{l()&&E({...f,status:"failed"})}).finally(()=>{m===i&&(m=null,h=null)});return m=i,i}async function _(e,t,n){let l;if(!r||!f.lists.some(t=>t.id===e))return!1;let i=p,o=b.get(e),s=null!=o?o:[],a=new Promise(e=>{l=e});return s.push({edit:"function"==typeof t?t:()=>t,fallbackError:n,controller:x(),resolve:l,done:a}),b.set(e,s),C(e),o||j(e,s,i),a}async function I(e,t,n){if(!r)return null;let l=p,o=e.trim();if(!o)return null;let s=n?n.trim().toUpperCase():"",c=x();try{let e=await fetch("/api/user/watchlists",{method:"POST",signal:c.signal,headers:{"Content-Type":"application/json"},body:JSON.stringify({name:o,icon:t||a.PQ,symbols:s?[s]:[]})});if(!e.ok){let t=await e.json().catch(()=>null);if(l===p&&403===e.status&&function(e){if((null==e?void 0:e.code)!=="limit_reached"||(null==e?void 0:e.resource)!=="watchlists")return!1;let t=(null==e?void 0:e.plan)==="free"||(null==e?void 0:e.plan)==="pro"?e.plan:null,n=t?(0,u.vk)({kind:"watchlists_cap",plan:t,trialOffered:!1,offer:null}):null;if(!n)return!1;try{window.dispatchEvent(new CustomEvent("tw-toast",{detail:{title:n.title,message:n.body,type:"info",action:{label:n.action.label,onPress:()=>window.dispatchEvent(new CustomEvent("wiz-open-upgrade",{detail:{plan:n.action.plan}}))}}}))}catch(e){}return!0}(t))return null;throw Error(D(t,"Could not create that list."))}let n=await e.json().catch(()=>null);if(l!==p)return null;let r=z(null==n?void 0:n.watchlist);if(!r)throw Error("Could not create that list.");return y.set(r.id,r),E({...f,lists:[...f.lists,r]}),(0,i.Vu)({action:"created",symbol:s||void 0}),r}catch(e){if(l!==p)return null;return A((null==e?void 0:e.message)||"Could not create that list.","error"),null}finally{k(c)}}async function M(e){var t,n,l;let i=p,o=f.lists,s=o.findIndex(t=>t.id===e);if(!r||s<0)return!1;if(o.length<=1)return A("You need at least one list.","error"),!1;let a=x(),u=null==(t=b.get(e))?void 0:t.map(e=>e.done);E({...f,lists:o.filter(t=>t.id!==e)});try{if((null==u?void 0:u.length)&&await Promise.all(u),i!==p)return!1;let t=await fetch("/api/user/watchlists?id=".concat(encodeURIComponent(e)),{method:"DELETE",signal:a.signal});if(!t.ok)throw Error(await P(t,"Could not delete that list."));let n=await t.json().catch(()=>null);if(i!==p)return!1;let r="string"==typeof(null==n?void 0:n.promotedDefaultId)?n.promotedDefaultId:null;if(y.delete(e),r){for(let[e,t]of y)y.set(e,{...t,isDefault:e===r});E({...f,lists:f.lists.map(e=>({...e,isDefault:e.id===r}))})}return!0}catch(r){if(i!==p)return!1;let t=y.get(e);if(t){let e=[...f.lists],r=null==(n=o.slice(s+1).find(t=>e.some(e=>e.id===t.id)))?void 0:n.id,i=null==(l=o.slice(0,s).reverse().find(t=>e.some(e=>e.id===t.id)))?void 0:l.id,a=r?e.findIndex(e=>e.id===r):i?e.findIndex(e=>e.id===i)+1:Math.min(s,e.length);e.splice(a,0,t),E({...f,lists:e})}return A((null==r?void 0:r.message)||"Could not delete that list.","error"),!1}finally{k(a)}}function O(e,t){let n=t.trim();return n?_(e,{name:n},"Could not rename that list."):Promise.resolve(!1)}function U(e,t){return _(e,{icon:t},"Could not change that list.")}function W(e,t){return _(e,{background:t},"Could not change that list.")}function T(e,t){let n=String(t||"").trim().toUpperCase(),r=f.lists.find(t=>
1t.id===e);if(!n||!r)return Promise.resolve(!1);if(r.symbols.includes(n)){var l;let t=null==(l=b.get(e))?void 0:l.at(-1);if(!t)return Promise.resolve(!0);let r=p;return t.done.then(()=>{var t;return r===p&&f.lists.some(t=>t.id===e)&&!!(null==(t=y.get(e))?void 0:t.symbols.includes(n))})}return(0,i.Vu)({action:"symbol_added",symbol:n}),_(e,e=>e.symbols.includes(n)?null:{symbols:[...e.symbols,n]},"Could not add ".concat(n,"."))}function F(e,t){let n=String(t||"").trim().toUpperCase(),r=f.lists.find(t=>t.id===e);return n&&r&&r.symbols.includes(n)?((0,i.Vu)({action:"symbol_removed",symbol:n}),_(e,e=>e.symbols.includes(n)?{symbols:e.symbols.filter(e=>e!==n)}:null,"Could not remove ".concat(n,"."))):Promise.resolve(!1)}function R(e,t,n){let r=f.lists.find(t=>t.id===e);return r&&Y(r.symbols,String(t||"").trim().toUpperCase(),n)?_(e,e=>{let r=Y(e.symbols,String(t||"").trim().toUpperCase(),n);return r?{symbols:r}:null},"Could not save the new order."):Promise.resolve(!1)}function B(e,t,n,r){let l=e.indexOf(n);if(-1===l)return -1;let i="after"===r?l+1:l,o=e.indexOf(t);return -1!==o&&o<i&&(i-=1),i}function Y(e,t,n){let r=e.indexOf(t);if(-1===r)return null;let l=Math.max(0,Math.min(e.length-1,Math.trunc(n)));if(!Number.isFinite(n)||r===l)return null;let i=[...e];return i.splice(r,1),i.splice(l,0,t),i}function J(e,t){let n=String(t||"").trim().toUpperCase();return n?e.filter(e=>e.symbols.includes(n)):[]}function V(){let e=(0,l.useSyncExternalStore)(S,N,()=>c),{userId:t,resolving:n}=Q();return((0,l.useEffect)(()=>{!n&&t&&L()},[t,n]),n)?c:r!==t?t?c:d:e}function Q(){var e;let{user:t,resolving:n}=(0,s.u)(),i=null!=(e=null==t?void 0:t.id)?e:null;return(0,l.useEffect)(()=>{if(!n){let e=r;if(r=i,e!==i){for(let e of(p+=1,g))e.abort();for(let e of(g.clear(),b.values()))for(let t of e)t.resolve(!1);for(let e of(b.clear(),y.clear(),w))e();w.clear(),null==h||h.abort(),h=null,m=null,E({lists:[],status:i?"loading":"anon"}),(0,o.xY)(),i&&L(!0)}}},[i,n]),{userId:i,resolving:n}}},15681:(e,t,n)=>{n.r(t),n.d(t,{WizWatchlistMenu:()=>v,WizWatchlistPicker:()=>p,default:()=>y});var r=n(95155),l=n(12115),i=n(47650),o=n(20063),s=n(5917),a=n(6191),u=n(39347),c=n(96885),d=n(89208),f=n(18561),m=n(49201),h=n(7216);function p(e){let{symbol:t,onDone:n,classes:i}=e,{lists:o,status:u}=(0,h.Od)(),[c,d]=(0,l.useState)(!1),[m,p]=(0,l.useState)(""),[v,y]=(0,l.useState)(!1),b=(0,l.useRef)(null),g=(t||"").trim().toUpperCase(),w=null!=i?i:null,x=(0,l.useMemo)(()=>new Set(o.filter(e=>e.symbols.includes(g)).map(e=>e.id)),[o,g]);(0,l.useEffect)(()=>{var e;c&&(null==(e=b.current)||e.focus())},[c]);let k=(0,l.useCallback)(async e=>{x.has(e)?await (0,h.Yh)(e,g):await (0,h.ik)(e,g)},[x,g]),C=(0,l.useCallback)(async()=>{let e=m.trim();if(!e||v)return;y(!0);let t=await (0,h.i)(e,void 0,g);y(!1),t&&(d(!1),p(""),null==n||n())},[m,v,g,n]);return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("p",{className:w?w.heading:"px-3 pb-1 pt-1.5 text-[10px] font-semibold text-theme-tertiary",children:[g," in your lists"]}),"loading"===u&&0===o.length&&(0,r.jsx)("p",{className:w?w.note:"px-3 py-2 text-[12px] text-theme-tertiary",children:"Loading your listsâ¦"}),"failed"===u&&0===o.length&&(0,r.jsxs)("div",{className:w?w.note:"px-3 py-2",children:[(0,r.jsx)("p",{className:w?void 0:"text-[12px] text-theme-secondary",children:"Could not load your lists."}),(0,r.jsx)("button",{type:"button",onClick:()=>(0,h.Fm)(!0),className:w?w.retry:"mt-1 text-[12px] font-semibold transition-opacity hover:opacity-80 focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--wiz-focus)]",style:w?void 0:{color:"var(--wiz-green-text)"},children:"Try again"})]}),"ready"===u&&0===o.length&&(0,r.jsx)("p",{className:w?w.note:"px-3 py-2 text-[12px] text-theme-tertiary",children:"No lists yet."}),o.length>0&&(0,r.jsx)("div",{className:w?"".concat(w.rows," custom-scrollbar"):"max-h-56 overflow-y-auto custom-scrollbar",children:o.map(e=>{let t=x.has(e.id);return(0,r.jsxs)("button",{type:"button",role:"menuitemcheckbox","aria-checked":t,onClick:()=>k(e.id),"data-checked":w?t:void 0,className:w?w.row:"flex w-full items-center gap-2.5 px-3 py-2 text-left text-[13px] text-theme-secondary transition-colors duration-150 ease-out hover:bg-[color:var(--bg-tertiary)] hover:text-theme-primary motion-reduce:transition-none focus:outline-none focus-visible:bg-[color:var(--bg-tertiary)] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--wiz-focus)]",children:[(0,r.jsx)("span",{"aria-hidden":"true",className:w?w.emoji:"shrink-0 text-[14px]",children:(0,f.os)(e.icon)}),(0,r.jsx)("span",{className:w?w.name:"min-w-0 flex-1 truncate",children:e.name}),w?(0,r.jsx)("span",{"aria-hidden":"true",className:w.box,children:t&&(0,r.jsx)(s.A,{size:14,strokeWidth:2.5})}):t&&(0,r.jsx)(s.A,{className:"h-3.5 w-3.5 shrink-0",style:{color:"var(--wiz-green-text)"},strokeWidth:2.5})]},e.id)})}),(0,r.jsx)("div",{className:w?w.footer:"mt-1 border-t border-theme-subtle pt-1",children:c?(0,r.jsxs)("div",{className:w?w.create:"flex items-center gap-1.5 px-2 py-1.5",children:[(0,r.jsx)("input",{ref:b,value:m,onChange:e=>p(e.target.value),onKeyDown:e=>{e.stopPropagation(),"Enter"===e.key&&(e.preventDefault(),C()),"Escape"===e.key&&(e.preventDefault(),d(!1),p(""))},maxLength:40,placeholder:"List name","aria-label":"New list name",className:w?w.input:"min-w-0 flex-1 rounded-lg border border-theme bg-theme-tertiary px-2 py-1.5 text-[12px] text-theme-primary placeholder:text-theme-tertiary focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--wiz-focus)]"}),(0,r.jsx)("button",{type:"button",onClick:C,disabled:!m.trim()||v,className:w?w.addList:"shrink-0 rounded-full px-2.5 py-1.5 text-[12px] font-bold transition-opacity hover:opacity-90 disabled:opacity-40 focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--wiz-focus)]",style:w?void 0:{backgroundColor:"var(--wiz-green-btn)",color:"var(--wiz-on-green)"},children:"Add"})]}):(0,r.jsxs)("button",{type:"button",role:"menuitem",onClick:()=>d(!0),className:w?"".concat(w.row," ").concat(w.newList):"flex w-full items-center gap-2.5 px-3 py-2 text-left text-[13px] text-theme-secondary transition-colors duration-150 ease-out hover:bg-[color:var(--bg-tertiary)] hover:text-theme-primary motion-reduce:transition-none focus:outline-none focus-visible:bg-[color:var(--bg-tertiary)] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[color:var(--wiz-focus)]",children:[w?(0,r.jsx)("span",{"aria-hidden":"true",className:w.emoji,children:(0,r.jsx)(a.A,{size:16,strokeWidth:2})}):(0,r.jsx)(a.A,{className:"h-3.5 w-3.5 shrink-0 text-theme-tertiary","aria-hidden":"true"}),"New list"]})})]})}function v(e){let{symbol:t,variant:n="icon",trigger:f="star",renderTrigger:v,align:y="right",className:b,label:g,onOpenChange:w,triggerRole:x,panelClasses:k}=e,C=(0,o.useRouter)(),{signedOut:j}=(0,c.u)(),{lists:E,status:N}=(0,h.Od)(),[S,z]=(0,l.useState)(!1),[A,P]=(0,l.useState)(null),D=(0,l.useRef)(null),L=(0,l.useRef)(null),_=(t||"").trim().toUpperCase(),I=k?272:232,M=(0,l.useMemo)(()=>E.some(e=>e.symbols.includes(_)),[E,_]);(0,l.useEffect)(()=>{null==w||w(S)},[S,w]);let O=(0,l.useCallback)(()=>{let e=D.current;if(!e)return;let t=e.getBoundingClientRect(),n="right"===y?t.right-I:t.left;n=Math.max(8,Math.min(n,window.innerWidth-I-8));let r=t.bottom+280>window.innerHeight&&t.top>300;P({left:n,top:t.bottom+6,bottom:window.innerHeight-t.top+6,up:r})},[y,I]);(0,l.useEffect)(()=>
1{if(!S)return;O();let e=e=>{"Escape"===e.key&&(e.stopPropagation(),z(!1))},t=e=>{var t,n;let r=e.target;(null==(t=D.current)?void 0:t.contains(r))||(null==(n=L.current)?void 0:n.contains(r))||z(!1)},n=()=>O();return window.addEventListener("scroll",n,!0),window.addEventListener("resize",n),window.addEventListener("keydown",e),document.addEventListener("mousedown",t),()=>{window.removeEventListener("scroll",n,!0),window.removeEventListener("resize",n),window.removeEventListener("keydown",e),document.removeEventListener("mousedown",t)}},[S,O]);let U=(0,l.useCallback)(e=>{if(e.stopPropagation(),e.preventDefault(),j)return void(0,d.v)("Add ".concat(_," to my watchlist"),e=>C.push(e));"failed"===N&&(0,h.Fm)(!0),z(e=>!e)},[j,_,C,N]),W=(0,l.useMemo)(()=>E.filter(e=>e.symbols.includes(_)).length,[E,_]),T=M?"".concat(_," is on ").concat(W," of your lists. Choose lists"):"Add ".concat(_," to a watchlist"),F="chip"===n?(0,r.jsxs)("button",{ref:D,type:"button",onClick:U,role:x,"aria-haspopup":"menu","aria-expanded":S,"aria-label":T,className:null!=b?b:"inline-flex h-8 shrink-0 items-center gap-1.5 rounded-full border border-theme px-3 text-[12px] font-semibold text-theme-secondary transition-colors duration-150 ease-out hover:bg-theme-overlay-hover hover:text-theme-primary motion-reduce:transition-none focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--wiz-focus)]",children:[(0,r.jsx)(u.A,{className:"h-3.5 w-3.5",style:M?{color:"var(--wiz-green-text)",fill:"var(--wiz-green-text)"}:void 0}),null!=g?g:M?"On a list":"Watchlist"]}):(0,r.jsx)("button",{ref:D,type:"button",onClick:U,role:x,"aria-haspopup":"menu","aria-expanded":S,"aria-label":T,className:null!=b?b:"grid h-8 w-8 shrink-0 place-items-center rounded-full text-theme-tertiary transition-[color,background-color,scale] duration-150 ease-out hover:bg-theme-overlay-hover hover:text-theme-primary active:scale-[0.94] motion-reduce:transition-none motion-reduce:active:scale-100 focus:outline-none focus-visible:ring-2 focus-visible:ring-[color:var(--wiz-focus)] [@media(pointer:coarse)]:h-11 [@media(pointer:coarse)]:w-11",children:v?v({watched:M,open:S,count:W}):"plus"===f?M?(0,r.jsx)(s.A,{className:"h-4 w-4",style:{color:"var(--wiz-green-text)"},strokeWidth:2}):(0,r.jsx)(a.A,{className:"h-4 w-4"}):(0,r.jsx)(u.A,{className:"h-4 w-4",style:M?{color:"var(--wiz-green-text)",fill:"var(--wiz-green-text)"}:void 0})});return(0,r.jsxs)(r.Fragment,{children:[F,S&&A&&"undefined"!=typeof document&&(0,i.createPortal)((0,r.jsx)("div",{ref:L,role:"menu","aria-label":"Watchlists for ".concat(_),onClick:e=>e.stopPropagation(),"data-theme":(0,m.I3)(),style:{...(0,m.L5)(),position:"fixed",left:A.left,width:I,...A.up?{bottom:A.bottom}:{top:A.top},boxShadow:"var(--wiz-shadow-float)"},className:k?k.panel:"z-[600] overflow-hidden rounded-lg border border-theme bg-theme-panel py-1",children:(0,r.jsx)(p,{symbol:_,classes:k})}),document.body)]})}let y=v},18561:(e,t,n)=>{n.d(t,{Nm:()=>r,PQ:()=>l,os:()=>i});let r=["\uD83D\uDCCB","\uD83D\uDD25","\uD83D\uDCB0","\uD83D\uDE80","\uD83D\uDC8E","\uD83D\uDC40","\uD83D\uDCC9","\uD83D\uDFE2","\uD83D\uDC51","â ï¸"],l="\uD83D\uDCCB";function i(e){return("string"==typeof e?e.trim():"")||l}},38780:(e,t,n)=>{n.d(t,{CU:()=>y,lj:()=>d,p9:()=>f,w1:()=>v,xY:()=>m});var r=n(12115);let l=[],i=!1,o=null,s=0,a=null,u=new Set;function c(){for(let e of u)e()}function d(){return l}function f(e){h(),l=Array.isArray(e)?e.map(e=>({_id:String(e._id),name:e.name,icon:e.icon,symbols:Array.isArray(e.symbols)?e.symbols:[],isDefault:!!e.isDefault})):[],i=!0,c()}function m(){h(),l=[],i=!1,c()}function h(){s+=1,null==a||a.abort(),a=null,o=null}function p(e){return u.add(e),()=>{u.delete(e)}}async function v(){if(i||o)return null!=o?o:Promise.resolve();let e=s,t=new AbortController;a=t;let n=fetch("/api/user/watchlists",{signal:t.signal}).then(e=>e.ok?e.json():{watchlists:[]}).then(n=>{e!==s||t.signal.aborted||f(Array.isArray(null==n?void 0:n.watchlists)?n.watchlists:[])}).catch(()=>{}).finally(()=>{o===n&&(o=null,a=null)});return o=n,n}function y(){return(0,r.useSyncExternalStore)(p,d,d)}}}]);
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.