PageSourceSearch

https://wiss.fm/_next/static/chunks/8339-c1d334aedf0e2e2e.js

js wiss.fm collected 2026-10-07 15:33:41 UTC 9,873 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8339],{88339:function(e,t,n){n.d(t,{mn:function(){return g},aC:function(){return E}});var r,o,a=n(57437),i=n(2265),c=n(99376),l=n(75099);(r=o||(o={})).ENTER_EMAIL="enter_email",r.ENTER_PHONE="enter_phone",r.VERIFY_CODE="verify_code",r.AUTHENTICATED="authenticated";var u=n(19325),s=n(6691);let h="auth_token",d=e=>{(0,u.setCookie)(h,e,180),fetch("/api/auth/cookie",{method:"POST"}).catch(()=>{})},f=()=>{(0,u.deleteCookie)(h)},m=(0,i.createContext)(void 0),y={isAuthenticated:!1,user:null,loading:!1,login:async()=>{},loginPhone:async()=>{},verifyCode:async()=>{},resend:async()=>{},logout:()=>{},clearError:()=>{},refreshAuth:async()=>{},authStep:o.ENTER_EMAIL,authMethod:"email",currentEmail:"",currentPhone:"",error:null,ssoRequest:null,resetToEmailStep:()=>{}},E=()=>{let e=(0,i.useContext)(m);return null!=e?e:y},w=e=>{let{children:t}=e,[n,r]=(0,i.useState)(!1),[y,E]=(0,i.useState)(null),[w,g]=(0,i.useState)(!0),[p,S]=(0,i.useState)(o.ENTER_EMAIL),[k,T]=(0,i.useState)("email"),[_,O]=(0,i.useState)(""),[C,v]=(0,i.useState)(""),[P,N]=(0,i.useState)(null),[b,I]=(0,i.useState)(null),[A,R]=(0,i.useState)(!1),x=(0,c.useRouter)(),j=(0,c.useSearchParams)(),U=(0,l.eQ)();(0,i.useEffect)(()=>{R(!0),(0,s.u)()},[]);let M=e=>{if(e instanceof Error)return e.message;if("string"==typeof e)try{let t=JSON.parse(e);if(t&&t.error)return t.error}catch(e){}return(null==e?void 0:e.toString())||"An unexpected error occurred"};(0,i.useEffect)(()=>{if(!A)return;let e=j.get("return_to"),t=j.get("site_name"),r=j.get("redirect");(e||t)&&I({return_to:e||void 0,site_name:t||void 0}),r&&sessionStorage.setItem("login_redirect",r);let o=j.get("code");!o||n||w||J(o)},[A,j,n,w]);let J=async e=>{g(!0),N(null);try{let t=await U.request("/auth/sso/redeem",{method:"POST",body:JSON.stringify({redirect_code:e,redirect_uri:window.location.href.split("?")[0]})});if(t.ok){let e=await t.json();e.token&&(d(e.token),E({email:e.email,phone:e.phone}),r(!0),S(o.AUTHENTICATED));let n=new URL(window.location.href);n.searchParams.delete("code"),x.replace(n.pathname+n.search)}else{let e=await t.text();N(M(e)||"SSO authentication failed");let n=new URL(window.location.href);n.searchParams.delete("code"),x.replace(n.pathname+n.search)}}catch(e){console.error("SSO callback error:",e),N("Failed to complete sign in")}finally{g(!1)}};(0,i.useEffect)(()=>{A&&L()},[A]);let L=async()=>{try{let e=(0,u.getCookie)(h);if(e){let t=await U.checkSession();t.authenticated?(d(e),E({email:t.email||"",phone:t.phone}),r(!0),S(o.AUTHENTICATED)):(f(),r(!1),S(o.ENTER_EMAIL))}else r(!1),S(o.ENTER_EMAIL)}catch(e){console.error("Auth check failed:",e),f(),r(!1),S(o.ENTER_EMAIL)}finally{g(!1)}},F=async e=>{N(null),g(!0);try{let t=(null==b?void 0:b.site_name)||"Civic Media";T("email"),await U.sendOTC(e,t),O(e),S(o.VERIFY_CODE)}catch(e){throw N(M(e)),e}finally{g(!1)}},D=async e=>{N(null),g(!0);try{let t=(null==b?void 0:b.site_name)||"Civic Media";T("phone"),await U.sendPhoneOTC(e,t),v(e),S(o.VERIFY_CODE)}catch(e){throw N(M(e)),e}finally{g(!1)}},q=async()=>{"phone"===k?await D(C):await F(_)},H=async e=>{N(null),g(!0);try{let t="phone"===k?await U.verifyPhoneOTC(C,e,null==b?void 0:b.return_to):await U.verifyOTC(_,e,null==b?void 0:b.return_to);if(t.token&&d(t.token),E({email:t.email,phone:t.phone}),r(!0),S(o.AUTHENTICATED),null==b?void 0:b.return_to)return;let n=sessionStorage.getItem("login_redirect");n?(sessionStorage.removeItem("login_redirect"),x.push(n)):x.push("/")}catch(e){throw N(M(e)),e}finally{g(!1)}},B=async()=>{await L()};return(0,a.jsx)(m.Provider,{value:{isAuthenticated:n,user:y,loading:w,login:F,loginPhone:D,verifyCode:H,resend:q,logout:function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];f(),E(null),r(!1),S(o.ENTER_EMAIL),O(""),N(null),I(null),e&&x.push("/")},authStep:p,authMethod:k,currentEmail:_,currentPhone:C,error:P,clearError:()=>N(null),ssoRequest:b,refreshAuth:B,resetToEmailStep:()=>{S("phone"===k?o.ENTER_PHONE:o.ENTER_EMAIL),N(null)}},children:t})},g=e=>{let{children:t}=e,[n,r]=(0,i.useState)(!1);return((0,i.useEffect)(()=>{r(!0)},[]),n)?(0,a.jsx)(w,{children:t}):(0,a.jsx)(a.Fragment,{children:t})}},75099:function(e,t,n){n.d(t,{Kq:function(){return d},Mg:function(){return f},NX:function(){return E},Uk:function(){return y},cU:function(){return h},eQ:function(){return u},mO:function(){return m}});var r=n(19325),o=n(70454),a=n(6691);let i=o.y,c="auth_token",l=function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t={"Content-Type":"application/json"};if(e){let e=(0,r.getCookie)(c);e&&(t.Authorization="Bearer ".concat(e))}return t},u=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:i;return{sendOTC:async(t,n)=>{let r={email:t,...(0,a.attributionPayload)()};n&&(r.site_name=n);let o=await fetch("".concat(e,"/auth/email/send-otc"),{method:"POST",headers:l(!1),body:JSON.stringify(r)});if(!o.ok)throw Error(await o.text()||"Failed to send code");return o.json()},verifyOTC:async(t,n,r)=>{let o={email:t,code:n,...(0,a.attributionPayload)()};r&&(o.return_to=r);let i=await fetch("".concat(e,"/auth/email/verify-otc"),{method:"POST",headers:l(!1),body:JSON.stringify(o)});if(!i.ok)throw Error(await i.text()||"Invalid code");return i.json()},sendPhoneOTC:async(t,n)=>{let r={number:t,...(0,a.attributionPayload)()};n&&(r.site_name=n);let o=await fetch("".concat(e,"/auth/phone/send-otc"),{method:"POST",headers:l(!1),body:JSON.stringify(r)});if(!o.ok)throw Error(await o.text()||"Failed to send SMS code");return o.json()},verifyPhoneOTC:async(t,n,r)=>{let o={number:t,code:n,...(0,a.attributionPayload)()};r&&(o.return_to=r);
1let i=await fetch("".concat(e,"/auth/phone/verify-otc"),{method:"POST",headers:l(!1),body:JSON.stringify(o)});if(!i.ok)throw Error(await i.text()||"Invalid SMS code");return i.json()},linkEmail:async(t,n)=>{let r=await fetch("".concat(e,"/auth/email/verify-otc"),{method:"POST",headers:l(!0),body:JSON.stringify({email:t,code:n,...(0,a.attributionPayload)()})});if(!r.ok)throw Error(await r.text()||"Could not link email address");return r.json()},linkPhone:async(t,n)=>{let r=await fetch("".concat(e,"/auth/phone/verify-otc"),{method:"POST",headers:l(!0),body:JSON.stringify({number:t,code:n,...(0,a.attributionPayload)()})});if(!r.ok)throw Error(await r.text()||"Could not link phone number");return r.json()},changeEmail:async function(t,n){let r=arguments.length>2&&void 0!==arguments[2]&&arguments[2],o=await fetch("".concat(e,"/auth/email/change"),{method:"POST",headers:l(!0),body:JSON.stringify({email:t,code:n,confirm:r})}),a=await o.json().catch(()=>({}));return o.ok?{ok:!0,email:a.email}:{ok:!1,confirm_required:a.confirm_required,error:a.error}},unlinkPhone:async()=>{let t=await fetch("".concat(e,"/auth/phone/unlink"),{method:"POST",headers:l(!0)});if(!t.ok)throw Error(await t.text()||"Failed to unlink phone number");return t.json()},unlinkEmail:async()=>{let t=await fetch("".concat(e,"/auth/email/unlink"),{method:"POST",headers:l(!0)});if(!t.ok)throw Error(await t.text()||"Failed to remove email address");return t.json()},checkSession:async()=>{try{let t=await fetch("".concat(e,"/auth/session"),{method:"GET",headers:l(!0)});if(!t.ok)return{authenticated:!1};return await t.json()}catch(e){return{authenticated:!1}}},handleRedirect:async(t,n)=>{let r=await fetch("".concat(e,"/auth/handle-redirect"),{method:"POST",headers:l(!1),body:JSON.stringify({redirect_code:t,redirect_uri:n})});if(!r.ok)throw Error(await r.text()||"Failed to exchange redirect code");return r.json()},request:async function(t){let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o="".concat(e).concat(t),a={"Content-Type":"application/json",...n.headers},i=(0,r.getCookie)(c);return i&&(a.Authorization="Bearer ".concat(i)),await fetch(o,{...n,headers:a})}}},s=u(),h=s.sendOTC;s.verifyOTC;let d=s.sendPhoneOTC;s.verifyPhoneOTC;let f=s.linkEmail,m=s.linkPhone,y=s.changeEmail;s.unlinkPhone;let E=s.unlinkEmail;s.checkSession,s.handleRedirect},70454:function(e,t,n){n.d(t,{y:function(){return r}});let r=n(40257).env.PUBAPI_URL||"https://api.civicmedia.us"},6691:function(e,t,n){n.d(t,{attributionPayload:function(){return c},u:function(){return i}});var r=n(19325);let o="cm_attribution",a=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"];function i(){if((0,r.getCookie)(o))return;let e=new URLSearchParams(window.location.search),t={};for(let n of a){let r=e.get(n);r&&(t[n]=r)}let n=document.referrer||"",i=n&&!n.includes(window.location.hostname)?n:"";if(0===Object.keys(t).length&&!i)return;let c={...Object.keys(t).length?{utm:t}:{},page:window.location.href,...i?{referrer:i}:{},at:new Date().toISOString()};(0,r.setCookie)(o,JSON.stringify(c),90)}function c(){let e=function(){let e=(0,r.getCookie)(o);if(!e)return null;try{return JSON.parse(decodeURIComponent(e))}catch(e){return null}}();if(!e)return{};let t={};return e.utm&&(t.utm=e.utm),e.page&&(t.page=e.page),e.referrer&&(t.referrer=e.referrer),t}},19325:function(e,t,n){n.r(t),n.d(t,{deleteCookie:function(){return a},getCookie:function(){return r},setCookie:function(){return o}});let r=e=>{if("undefined"==typeof document)return null;let t=document.cookie.split("; ");for(let n=0;n<t.length;n++){let r=t[n].split("=");if(r[0]===e)return r[1]}return null},o=function(e,t,n){let r=!(arguments.length>3)||void 0===arguments[3]||arguments[3],o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"Lax";if("undefined"==typeof document)return null;let a="".concat(e,"=").concat(encodeURIComponent(t),";");if(n){let e=new Date;e.setTime(e.getTime()+864e5*n),a+="expires=".concat(e.toUTCString(),";")}a+="path=/;",r&&(a+="Secure;"),a+="SameSite=".concat(o,";"),document.cookie=a},a=e=>{if("undefined"==typeof document)return null;document.cookie="".concat(e,"=; expires=Thu, 01 Jan 1970 00:00:00 UTC; path=/;")}}}]);

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.