1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6939],{40384:function(t,e,n){"use strict";n.d(e,{m5:function(){return o},u7:function(){return r},Kk:function(){return f}});var o,r,i=n(1717),c=n(56669),a=n.n(c),l=n(60042),u=n.n(l),s=n(99197),d=n.n(s),b=n(73535),m=n(24246);!function(t){t.DESTRUCTIVE="DESTRUCTIVE",t.NEUTRAL="NEUTRAL",t.BLUE="BLUE",t.BLACK="BLACK",t.GREEN="GREEN",t.GOLD="GOLD",t.BLUE_GREY="BLUE_GREY",t.FACEBOOK="FACEBOOK",t.TWITTER="TWITTER",t.WHITE="WHITE",t.PLATINUM="PLATINUM",t.LOBBY_MEMBERSHIP="LOBBY_MEMBERSHIP",t.EMERALD_MEMBERSHIP="EMERALD_MEMBERSHIP",t.EMERALD_MEMBERSHIP_SUBSCRIBE="EMERALD_MEMBERSHIP_SUBSCRIBE",t.REGULAR_BLACK="REGULAR_BLACK",t.SIGNUP="SIGNUP"}(o||(o={})),function(t){t.BUTTON="button",t.SUBMIT="submit",t.RESET="reset"}(r||(r={}));var f=function(t){var e,n=t.title,c=t.onClick,l=t.loading,s=t.link,f=t.type,_=void 0===f?o.NEUTRAL:f,p=t.style,h=t.classModifier,v=t.styleClass,g=t.disabled,w=t.buttonActionType,x=void 0===w?r.BUTTON:w,y=(0,m.jsxs)("button",{className:u()(a()["action-button"],(e={},(0,i.Z)(e,v,!!v),(0,i.Z)(e,a()[h],!!h),(0,i.Z)(e,a()["action-button--black"],_===o.REGULAR_BLACK),(0,i.Z)(e,a()["action-button--red"],_===o.DESTRUCTIVE),(0,i.Z)(e,a()["action-button--blue"],_===o.BLUE),(0,i.Z)(e,a()["action-button--gold"],_===o.GOLD),(0,i.Z)(e,a()["action-button--gold"],_===o.GREEN),(0,i.Z)(e,a()["action-button--black"],_===o.BLACK),(0,i.Z)(e,a()["action-button--blue-grey"],_===o.BLUE_GREY),(0,i.Z)(e,a()["action-button--facebook"],_===o.FACEBOOK),(0,i.Z)(e,a()["action-button--twitter"],_===o.TWITTER),(0,i.Z)(e,a()["action-button--white"],_===o.WHITE),(0,i.Z)(e,a()["action-button--platinum"],_===o.PLATINUM),(0,i.Z)(e,a()["action-button--lobby"],_===o.LOBBY_MEMBERSHIP),(0,i.Z)(e,a()["action-button--emerald"],_===o.EMERALD_MEMBERSHIP),(0,i.Z)(e,a()["action-button--emerald--subscribe"],_===o.EMERALD_MEMBERSHIP_SUBSCRIBE),(0,i.Z)(e,a()["action-button--loading"],l),(0,i.Z)(e,a()["action-button--lobby"],_===o.SIGNUP),e)),onClick:c,style:p,disabled:g,type:x,children:[(0,m.jsx)("span",{className:a()["action-button__title"],children:n}),l&&(0,m.jsx)("div",{className:a()["action-button-spinner-container"],children:(0,m.jsx)(d(),{color:"white",size:20})})]});return s?(0,m.jsx)(b.r,{to:s,children:y}):y}},66197:function(t,e,n){"use strict";n.d(e,{q:function(){return u}});var o=n(1717),r=n(56669),i=n.n(r),c=n(60042),a=n.n(c),l=n(24246),u=function(t){var e,n=t.classModifier,r=t.alignment,c=void 0===r?"left":r,u=t.children;return(0,l.jsx)("div",{className:a()(i()["button-container"],(e={},(0,o.Z)(e,i()[n],!!n),(0,o.Z)(e,i()["button-container--align-right"],"right"===c),(0,o.Z)(e,i()["button-container--align-left"],"left"===c),(0,o.Z)(e,i()["button-container--align-center"],"center"===c),e)),children:u})}},25778:function(t,e,n){"use strict";n.d(e,{L:function(){return v}});var o=n(1717),r=n(38566),i=n(27806),c=n.n(i),a=n(27378),l=n(60042),u=n.n(l),s=n(60659),d=n(88273),b=n(3129),m=n(33345),f=n(50301),_=n(54409),p=n(68745),h=n(24246),v=function(t){var e,n=t.book,i=t.className,l=t.canRemove,v=void 0!==l&&l,g=(0,a.useState)(!1),w=g[0],x=g[1],y=(0,b.Fv)(),E=(0,r.Z)(y,1)[0],k=(0,b.Ih)(),C=(0,r.Z)(k,1)[0],B=(0,m.Mg)(),O=(0,f.s)(),j=(0,_.Oy)(),I=!n.license&&n.pricing.strategy!==s.NZ.CHAPTERS,L=(0,a.useMemo)((function(){return I?n.pricing&&n.pricing.price?"Unlock Book | ".concat(p.u.formatUSD(n.pricing.price)):"Unlock Book":w&&n.you_liked&&v?"Remove from Library":n.you_liked?"In Library":"Add to Library"}),[w,n,v,I]),N=(0,a.useCallback)((function(){B({user:j,amount:n.pricing.price,lobbyOption:!0,lobbyRequired:n.pricing.strategy===s.NZ.GOLD_RESTRICTED,onConfirm:function(){return E(n).then((function(){return null}))}})}),[n,B,E]),R=(0,a.useCallback)((function(){return x(!0)}),[]),S=(0,a.useCallback)((function(){return x(!1)}),[]),A=(0,m.H$)((function(){I?N():n.you_liked?O({type:d.nK.CONFIRM,destructive:!0,text:"Are you sure you want to remove this book from your library?",buttonText:"Remove from Library",title:"Remove Book",onConfirm:function(){return C(n)}}):C(n),x(!1)}),[N,n,C,O,I]);return(0,h.jsx)("div",{className:u()("".concat(c()["book-button"]," ").concat(c()[i]),(e={},(0,o.Z)(e,c()["book-button--selected"],n.you_liked),(0,o.Z)(e,c()["book-button--gold"],I),e)),onMouseOver:R,onMouseLeave:S,onClick:A,children:L})}},79370:function(t,e,n){"use strict";n.d(e,{e:function(){return m}});var o=n(1717),r=n(38566),i=n(85265),c=n.n(i),a=n(27378),l=n(60042),u=n.n(l),s=n(52077),d=n(33345),b=n(24246),m=function(t){var e=t.user,n=(0,a.useState)(!1),i=n[0],l=n[1],m=(0,s.Os)(),f=(0,r.Z)(m,1)[0],_=(0,a.useMemo)((function(){return i&&e.you_follow?"Unfollow":e.you_follow?"Following":"Follow"}),[i,e]),p=(0,a.useCallback)((function(){return l(!0)}),[]),h=(0,a.useCallback)((function(){return l(!1)}),[]),v=(0,d.H$)((function(){f(e),l(!1)}),[e,f]);return(0,b.jsx)("div",{className:u()(c()["follow-button"],(0,o.Z)({},c()["follow-button--selected"],e.you_follow)),onMouseOver:p,onMouseLeave:h,onClick:v,children:_})}},27942:function(t,e,n){"use strict";n.d(e,{Y:function(){return s}});var o=n(38566),r=n(21584),i=n.n(r),c=n(27378),a=n(99135),l=n(23194),u=n(24246),s=function(t){var e=t.portal,n=t.className,r=(0,c.useState)(!1),s=r[0],d=r[1],b=(0,l.f)(),m=(0,o.Z)(b,1)[0],f=(0,c.useMemo)((function(){return s&&e.you_subscribe?"Unfollow":e.you_subscribe?"Following":"Follow"}),[s,e]),_=(0,c.useCallback)((function(){return d(!0)}),[]),p=(0,c.useCallback)((function(){return d(!1)}),[]),h=(0,c.useCallback)((function(){m(e),d(!1)}),[e,m]),v={};return(0,a.oo)(e.colors.primary)&&(v=e.you_subscribe?{color:"white",backgroundColor:e.colors.primary,borderColor:e.colors.primary}:v),(0,u.jsx)("div",{className:"".concat(i()["portal-follow-button"]," ").concat(n),onMouseOver:_,onMouseLeave:p,onClick:h,style:v,children:f})}},16675:function(t,e,n){"use strict";var o=n(1717),r=n(6952),i=n(38566),c=n(88742),a=n.n(c),l=n(72470),u=n(65978),s=n(69016),d=n(60042),b=n.n(d),m=n(27378),f=n(33345),_=n(44255),p=n.n(_),h=n(20598),v=n(61582),g=n(54409),w=n(24246);function x(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function y(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};
1e%2?x(Object(n),!0).forEach((function(e){(0,o.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):x(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}e.Z=(0,u.Z)((function(t){var e,n,c,l=t.user,u=(0,m.useState)(!1),d=u[0],_=u[1],x=(0,g.Oy)(),E=null!==(e=null===(n=l.subscriptionToAuthor)||void 0===n?void 0:n.status)&&void 0!==e?e:"INACTIVE",k=(0,s.Z)(),C=(0,h.BR)(),B=(0,i.Z)(C,2),O=B[0],j=B[1],I=(0,h.s)(),L=function(){O("Your payment is being processed."),window.location.reload()},N=(0,f.H$)((0,r.Z)(a().mark((function t(){var e,n,o;return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:o={name:"Author subscription",type:"SUBSCRIPTION",plans:null===l||void 0===l?void 0:l.subscriptionPlans,details:{authorId:null===l||void 0===l?void 0:l.id,authorName:null===l||void 0===l?void 0:l.username,authorAvatar:(null===l||void 0===l||null===(e=l.image)||void 0===e||null===(n=e.thumb)||void 0===n?void 0:n.url)||""}},t.t0=E,t.next="ACTIVE"===t.t0?4:"CANCELED"===t.t0?6:10;break;case 4:return I({type:v.nK.SUBSCRIBED_TO_CANCEL,subscription:l.subscriptionToAuthor,author:l}),t.abrupt("break",13);case 6:if(l.id!==(null===x||void 0===x?void 0:x.id)){t.next=8;break}return t.abrupt("return",j("You can not subscribe to yourself"));case 8:return k({style:"resubscription",item:y(y({},o),{},{type:"RESUBSCRIPTION"}),currentSubscription:null===l||void 0===l?void 0:l.subscriptionToAuthor,onPurchaseConfirm:L,onPurchaseCancel:function(){return 0}}),t.abrupt("break",13);case 10:if(l.id!==(null===x||void 0===x?void 0:x.id)){t.next=12;break}return t.abrupt("return",j("You can not subscribe to yourself"));case 12:k({style:"subscription",item:o,onPurchaseConfirm:function(){O("Your subscription payment is being processed."),window.location.reload()},onPurchaseCancel:function(){return 0}});case 13:_(!1);case 14:case"end":return t.stop()}}),t)}))),[l]),R=(0,m.useMemo)((function(){return d&&"ACTIVE"===E?"Unsubscribe":"ACTIVE"===E?"Subscribed":"CANCELED"===E?"RESUBSCRIBE":"SUBSCRIBE"}),[d,E]);return(0,w.jsx)("div",{className:b()(p()["subscribe-button"],(c={},(0,o.Z)(c,p()["subscribe-button--subscribed"],"ACTIVE"===E),(0,o.Z)(c,p()["subscribe-button--resubscribe"],"CANCELED"===E),c)),onMouseOver:function(){return _(!0)},onMouseLeave:function(){return _(!1)},onClick:N,children:R})}),l.T.SUBSCRIBE_TO_AUTHOR)},31439:function(t,e,n){"use strict";n.d(e,{D:function(){return E}});var o=n(6952),r=n(38566),i=n(88742),c=n.n(i),a=n(8813),l=n.n(a),u=n(27378),s=n(60659),d=n(99135),b=n(40384),m=n(16974),f=n(73535),_=n(68745),p=n(33345),h=n(86677),v=n(54409),g=n(71607),w=n(30481),x=n(52077),y=n(24246),E=function(t){var e=t.challenge,n=(0,h.useRouter)(),i=(0,v.Oy)(),a=(0,p.F4)(),E=w.Z.isProd?s.Th.BLACK_PURPLE:s.Th.BLACK_PURPLE_DEV,k=(0,u.useRef)(null),C=(0,x.X8)(),B=(0,r.Z)(C,2),O=B[0],j=B[1],I="black_restricted"===e.subscription_status;(0,u.useEffect)((function(){k.current="mobile"===window.PLATFORM&&"ios"===window.OS}),[]),(0,u.useEffect)((function(){var t=function(){var t=(0,o.Z)(c().mark((function t(e){var n;return c().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,"upgrade_completed"!==(n=JSON.parse(e.data)).type){t.next=6;break}return t.next=5,O(n.plan);case 5:window.location.reload();case 6:t.next=11;break;case 8:t.prev=8,t.t0=t.catch(0),console.error("Invalid JSON from postMessage",t.t0);case 11:case"end":return t.stop()}}),t,null,[[0,8]])})));return function(e){return t.apply(this,arguments)}}();return window.addEventListener("message",t),function(){return window.removeEventListener("message",t)}}),[j]);var L=function(t){var e,n;k.current?null===(e=window)||void 0===e||null===(n=e.ReactNativeWebView)||void 0===n||n.postMessage(JSON.stringify({type:"iap",event:"upgrade-green-to-black",email:i.email.toLowerCase(),username:i.username,planId:g.c[t].iosPlanId})):function(t){a(t)}(t)},N=(0,p.H$)((function(){(null!==e&&void 0!==e&&e.is_emerald||(null===e||void 0===e?void 0:e.prize)>0||I)&&(null===i||void 0===i?void 0:i.subscription_status)!==s.yh.BLACK_PURPLE?L(E):n.replace("/write?challengeId=".concat(e.id))}),[i]);return(0,y.jsxs)("div",{className:l()["challenge-view"],children:[(0,y.jsx)(f.r,{to:"/challenge/".concat(e.id),className:l()["challenge-view-l
1ink"]}),(0,y.jsxs)("div",{className:l()["challenge-view-content"],children:[e.is_featured&&(0,y.jsx)("div",{className:l()["challenge-view-featured"],children:"Featured"}),(0,y.jsx)("div",{className:l()["challenge-view-title"],children:e.prompt}),!!e.description&&(0,y.jsx)("div",{className:l()["challenge-view-text"],children:e.description}),(0,y.jsxs)("div",{className:l()["challenge-view-info"],children:["".concat((0,d.zV)(e)," \u2022 Created by "),(0,y.jsx)(f.r,{to:"/".concat(e.author.username),children:e.author.username}),!!e.portal&&(0,y.jsxs)(y.Fragment,{children:[" in ",(0,y.jsx)(f.r,{to:"/portal/".concat(e.portal.slug),style:{color:e.portal.colors.primary},children:e.portal.title})]})]})]}),(0,y.jsxs)("div",{className:l()["challenge-view-enter"],children:[(0,y.jsx)(m.SE,{className:l()["challenge-view-icon"]}),!e.should_resolve&&(0,y.jsx)(b.Kk,{title:"Enter",type:b.m5.BLUE,onClick:N}),!!e.prize&&!e.is_emerald&&(0,y.jsx)("div",{className:l()["challenge-view-prize"],children:_.u.formatUSD(e.prize)})]})]})}},41504:function(t,e,n){"use strict";n.d(e,{x:function(){return B}});var o=n(1717),r=n(6952),i=n(38566),c=n(88742),a=n.n(c),l=n(63711),u=n.n(l),s=n(27378),d=n(60042),b=n.n(d),m=n(88273),f=n(2264),_=n(87950),p=n(16974),h=n(94699),v=n(73535),g=n(24246),w=function(t){var e=t.comment,n=t.onDelete,o=t.toggleReply,r=e.author;return(0,g.jsx)(h.h,{user:r,classModifier:"comment",children:(0,g.jsxs)("div",{className:u()["comment-user-label-content"],children:[(0,g.jsx)(v.r,{to:"/".concat(r.username),children:r.username}),(0,g.jsxs)("span",{className:u()["comment-user-label-time"],children:[!e.comment&&(0,g.jsxs)(g.Fragment,{children:["\xa0",(0,g.jsx)(p.RA,{className:u()["reply-icon"],onClick:o})]}),!!n&&(0,g.jsxs)("span",{className:u()["delete-icon"],children:["\xa0","\u2022 ",(0,g.jsx)(p.XH,{onClick:n})]})]})]})})},x=n(18842),y=n(50301),E=n(54409),k=n(79769),C=n(27105),B=function t(e){var n=e.comment,c=e.post,l=e.viewRef,d=e.selected,p=(0,s.useState)(!0),h=p[0],v=p[1],B=(0,s.useContext)(k.w),O=B.selectedId,j=B.setSelectedId,I=(0,E.Oy)(),L=(0,x.X0)(),N=(0,i.Z)(L,1)[0],R=(0,y.s)(),S=(0,C.n7)(c.id).refetch,A=n.id===O,P=I&&(I.id===n.author.id||I.id===c.author.id),D=(0,s.useCallback)((function(){R({type:m.nK.CONFIRM,title:"Delete Comment.",text:"Are you sure you want to delete this comment?",destructive:!0,onConfirm:function(){var t=(0,r.Z)(a().mark((function t(){return a().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,N(n);case 2:return t.next=4,S();case 4:case"end":return t.stop()}}),t)})));return function(){return t.apply(this,arguments)}}()})}),[n,N,R]),T=(0,s.useCallback)((function(t){t.preventDefault(),v(!1)}),[]),M=(0,s.useCallback)((function(){return j((function(t){return t===n.id?void 0:n.id}))}),[j,n]),U=(0,s.useMemo)((function(){return f.v.renderComment(n.text,h,T)}),[n.text,h,T]);return(0,g.jsxs)("div",{id:"comment".concat(n.id),className:b()(u()["comment-view"],(0,o.Z)({},u()["comment-view--selected"],d||A)),ref:l,children:[(0,g.jsx)(w,{comment:n,onDelete:P&&D,toggleReply:M}),(0,g.jsx)("div",{className:u()["comment-view-text"],children:U}),!!n.replies&&(0,g.jsx)("div",{className:u()["comment-view-replies"],children:n.replies.map((function(e){return(0,g.jsx)(t,{comment:e,post:c},e.id)}))}),A&&(0,g.jsx)(_._,{post:c,comment:n,onSubmit:M,classModifier:"comment-input--reply"})]})}},36853:function(t,e,n){"use strict";n.d(e,{Z:function(){return m}});var o=n(1717),r=n(19160),i=n.n(r),c=n(60042),a=n.n(c),l=n(24246),u=function(t){var e=t.headers.map((function(t){var e;return(0,l.jsx)("th",{id:t.id,className:a()(i()["table-container"],(e={},(0,o.Z)(e,i()["th-high-relevance"],1===t.relevance),(0,o.Z)(e,i()["th-unique-relevance"],2===t.relevance),e)),children:t.title},"".concat(t.title))}));return(0,l.jsx)("thead",{children:(0,l.jsx)("tr",{children:e})})},s=n(38566),d=function(t){var e=t.bodyData.map((function(t,e){var n=Object.entries(t).map((function(t){var e=(0,s.Z)(t,2),n=e[0],o=e[1];return(0,l.jsx)("td",{children:o},n)}));return(0,l.jsx)("tr",{children:n},e)}));return(0,l.jsx)("tbody",{children:e})},b=n(75096),m=function(t){var e=t.tableHeaders,n=t.tableBodyData,r=t.emptyText,c=t.stylesClass;return(0,l.jsxs)("div",{className:a()(i()["table-container"],(0,o.Z)({},c,!c)),children:[(0,l.jsxs)("table",{children:[(0,l.jsx)(u,{headers:e}),(0,l.jsx)(d,{bodyData:n})]}),!n.length&&(0,l.jsx)("div",{className:i()["empty-data"],children:(0,l.jsx)(b.h,{text:r})})]})}},79769:function(t,e,n){"use strict";n.d(e,{w:function(){return i},o:function(){return c}});var o=n(27378),r=n(24246),i=o.createContext(null),c=function(t){var e=t.children,n=(0,o.useState)(),c=n[0],a=n[1],l=(0,o.useMemo)((function(){return{selectedId:c,setSelectedId:a}}),[c,a]);return(0,r.jsx)(i.Provider,{value:l,children:e})}},20212:function(t,e,n){"use strict";n.d(e,{QU:function(){return o},I9:function(){return j},wi:function(){return I}});var o,r=n(38566),i=n(1717),c=n(27378),a=n(14591),l=n(57704),u=n(60659),s=n(88273),d=n(55539),b=n(92985),m=n(2264),f=n(99135),_=n(48964),p=n(18842),h=n(50301),v=n(54409),g=n(68745),w=n(16062),x=n(34499),y=n(24246);function E(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function k(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};
1e%2?E(Object(n),!0).forEach((function(e){(0,i.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):E(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}function C(){return{portal:null,post:null,challenge:null,draft:null,book:null,options:{visibility:u.Gi.PUBLIC,status:u.$4.PUBLISHED,pricing_strategy:u.YN.FREE,price:0,font:"garamond"},title:"",editor:l.EditorState.createEmpty(),hasImage:!1,audioUrl:null,hasAudio:!1,showLocalRecovery:d.r.has(),wordCount:0,saveStatus:o.NONE,removeFromBook:!1,isAiUsed:!1}}function B(t,e){switch(e.type){case"LoadFromPost":var n=e.post,r=t.options;return k(k({},t),{},{post:n,title:n.title||"",hasImage:!!n.image,hasAudio:!!n.audio,editor:O(n.text),options:{visibility:n.visibility||r.visibility,status:u.$4.PUBLISHED,pricing_strategy:n.pricing.strategy||r.pricing_strategy,price:g.u.creditToUSD(n.pricing.base_price)||r.price,font:r.font},wordCount:R(n.text),saveStatus:o.EDITING,book:n.book,challenge:n.challenge,portal:n.portal,isAiUsed:n.isAiUsed});case"LoadFromBook":var i=e.book;return k(k({},t),{},{book:i,options:k(k({},t.options),{},{pricing_strategy:t.post?t.options.pricing_strategy:u.YN.MATCH_BOOK})});case"RemoveFromBook":return k(k({},t),{},{book:null,removeFromBook:!0,options:k(k({},t.options),{},{pricing_strategy:t.options.pricing_strategy===u.YN.MATCH_BOOK?u.YN.FREE:t.options.pricing_strategy})});case"LoadFromDraft":return k(k({},t),{},{title:e.draft.title,editor:O(e.draft.text),showLocalRecovery:!1,wordCount:R(e.draft.text),draft:e.draft,saveStatus:o.SAVED});case"LoadFromChallenge":return k(k({},t),{},{challenge:e.challenge});case"LoadFromPortal":return k(k({},t),{},{portal:e.portal});case"LoadFromLocalDraft":return k(k({},t),{},{title:e.draft.title,editor:O(e.draft.text),showLocalRecovery:!1,wordCount:R(e.draft.text)});case"ClearLocalDraft":return k(k({},t),{},{showLocalRecovery:!1});case"TitleChanged":return k(k({},t),{},{title:e.title});case"EditorChanged":return k(k({},t),{},{editor:e.editor,wordCount:R(L(e.editor))});case"ImageChanged":return k(k({},t),{},{hasImage:e.hasImage});case"IsAiUsed":return k(k({},t),{},{isAiUsed:e.isAiUsed});case"FontChanged":return k(k({},t),{},{options:k(k({},t.options),{},{font:e.font})});case"OptionsChanged":return k(k({},t),{},{options:k(k({},t.options),e.options)});case"AudioChanged":return k(k({},t),{},{hasAudio:e.hasAudio,audioUrl:e.audioUrl});case"SetPortal":return k(k({},t),{},{portal:e.portal});case"SetDraft":return k(k({},t),{},{draft:e.draft,saveStatus:o.SAVED});case"Reset":return d.r.remove(),C();default:return t}}function O(t){var e=m.v.renderPost({text:t,with_empty_lines:!0,with_hashtags:!1,with_links:!1,static_markup:!0}),n=(0,a.h4)({htmlToBlock:function(t,e){if(e.className.indexOf("align-center")>-1)return{type:"",data:(0,i.Z)({},_.Hb,"CENTER")}}})(e);return l.EditorState.createWithContent(n)}!function(t){t.NONE="NONE",t.SAVING="SAVING",t.SAVED="SAVED",t.EDITING="EDITING"}(o||(o={}));var j=c.createContext(null),I=function(t){var e=t.portal,n=t.post,o=t.draft,i=t.challenge,a=t.book,l=t.children,m=(0,c.useReducer)(B,C()),g=m[0],E=m[1],k=(0,c.useRef)(),O=(0,v.Oy)(),I=(0,p.fj)(),N=(0,r.Z)(I,2),S=N[0],A=N[1],P=(0,p.jy)(),D=(0,r.Z)(P,2),T=D[0],M=D[1],U=(0,p.ZL)(),Z=((0,r.Z)(U,1)[0],(0,p.Z8)()),F=(0,r.Z)(Z,1)[0],V=(0,p.Wk)(),K=(0,r.Z)(V,1)[0],H=(0,h.ol)(),G=(0,r.Z)(H,2),Y=G[0],W=G[1],z=(0,h.BR)(),J=(0,r.Z)(z,2),q=J[0],$=J[1],Q=(0,h.eR)(),X=(0,c.useRef)(null),tt=(0,c.useRef)(null);(0,c.useEffect)((function(){n&&E({type:"LoadFromPost",post:n})}),[n,E]),(0,c.useEffect)((function(){e&&E({type:"LoadFromPortal",portal:e})}),[e,E]),(0,c.useEffect)((function(){i&&E({type:"LoadFromChallenge",challenge:i})}),[i,E]),(0,c.useEffect)((function(){a&&E({type:"LoadFromBook",book:a})}),[a,E]);var et=(0,c.useCallback)((function(){E({type:"EditorChanged",editor:_.EA.toggleInlineStyle(g.editor,"BOLD")})}),[g.editor,E]),nt=(0,c.useCallback)((function(){E({type:"EditorChanged",editor:_.EA.toggleInlineStyle(g.editor,"ITALIC")})}),[g.editor,E]),ot=(0,c.useCallback)((function(){E({type:"EditorChanged",editor:_.EA.toggleInlineStyle(g.editor,"UNDERLINE")})}),[g.editor,E]),rt=(0,c.useCallback)((function(){E({type:"EditorChanged",editor:_.EA.toggleInlineStyle(g.editor,"CENTER")})}),[g.editor,E]),it=(0,c.useCallback)((function(){if(!g.post){var t=L(g.editor);g.draft?K({id:g.draft.id,text:t,title:g.title}).then((function(){d.r.remove()})).catch((function(){$("There was a problem saving your draft. Check your internet connection.")})):d.r.save({text:t,title:g.title})}}),[g.draft,g.editor,g.title,g.post,$]);(0,c.useEffect)((function(){var t=g.editor.getCurrentContent().hasText();return clearTimeout(k.current),!g.post&&t&&(k.current=setTimeout(it,2e3)),function(){return clearTimeout(k.current)}}),[g.editor,it,g.post]);var ct=(0,c.useCallback)((function(){var t=d.r.load();t&&E({type:"LoadFromLocalDraft",draft:t})}),[]),at=(0,c.useCallback)((function(){d.r.remove(),E({type:"ClearLocalDraft"})}),[E]),lt=(0,c.useCallback)((function(){var t,e=L(g.editor);if(!e.trim())return $("Nothing to save.");g.draft||o?g.draft&&K({id:g.draft.id,text:e,title:g.title}).then((function(){d.r.remove(),q("Your work has been saved to Drafts!")})).catch((function(){$("There was a problem saving your draft. Check your internet connection.")})):F({text:e,title:g.title,postId:(null===(t=g.post)||void 0===t?void 0:t.id)||null}).then((function(t){return E({type:"SetDraft",draft:t}),at(),q("Your work has been saved to Drafts!")}))}),[g.editor,g.draft,g.title,$,E,at]),ut=(0,c.useCallback)((function(){X.current&&X.current.selectImage()}),[]),st=(0,c.useCallback)((function(t,e){tt.current=e,E({type:"AudioChanged",hasAudio:!!e,audioUrl:t})}),[E]),dt=(0,c.useCallback)((function(t){E({type:"IsAiUsed",isAiUsed:t})}),[E]),bt=(0,c.useCallback)((function(t){E({type:"FontChanged",font:t})}),[E]),mt=(0,c.useCallback)((function(){E({type:"Reset"}),Q("/write")}),[Q,E]),ft=(0,c.useCallback)((function(){Y({type:s.nK.PORTAL_SELECT,onSelect:function(t){E({type:"SetPortal",portal:t})}})}),[Y,E]),_t=(0,c.useCallback)((function(){Y({type:s.nK.DRAFT_SELECT})}),[Y]),pt=(0,c.useCallback)((function(){Y({type:s.nK.PUBLISH_OPTIONS})}),[g.options,Y]),ht=(0,c.useCallback)((function(){var t,e,n,o,r={title:g.title,text:L(g.editor),image:g.hasImage?X.current.getBlob():null,audio:g.hasAudio?tt.current:null,challenge_id:g.challenge&&g.challenge.id,portal_id:g.portal&&g.portal.id,status:g.options.status,visibility:g.options.visibility,font:g.options.font,pricing_strategy:g.options.pricing_strategy,price:g.options.price,book_id:g.book&&g.book.id,remove_from_book:g.removeFromBook,isAiUsed:g.isAiUsed};if(r.visibility!==u.Gi.SUBSCRIBERS&&(null===(t=g.portal)||void 0===t?void 0:t.t
1itle)!==w.aJ||O.subscription_status==u.yh.BLACK_PURPLE)return(g.post||null!==(e=g.draft)&&void 0!==e&&e.postId?T({id:(null===(n=g.post)||void 0===n?void 0:n.id)||(null===(o=g.draft)||void 0===o?void 0:o.postId),params:r}):S(r)).then((function(t){at(),g.post?q("Edits saved."):(E({type:"Reset"}),Q((0,b.uR)(t))),g.draft&&K({id:g.draft.id,text:t.text,title:t.title,postId:t.id})})).catch($);$("Only Prose Black authors can post in the Emerald Lounge.")}),[S,T,g,q,$,Q,E,at]),vt=(0,c.useCallback)((function(){var t=function(t,e){var n=L(t.editor),o=R(n);if((0,x.$)(n,e.is_admin)||(0,x.$)(t.title,e.is_admin))return(0,f.xo)("No URLs allowed (spam policy).");if("subscribers"===t.options.visibility&&!e.subscriptionPlans.length)return(0,f.xo)("You must be subscribed to publish to subscribers.");if(!n.trim())return(0,f.xo)("Nothing to publish.");if(t.challenge){if(t.challenge.min_words&&t.challenge.min_words>o)return(0,f.xo)("Your challenge entry must be at least ".concat(t.challenge.min_words," words."));if(t.challenge.max_words&&t.challenge.max_words<o)return(0,f.xo)("Your challenge entry must be at most ".concat(t.challenge.min_words," words."))}return{valid:!0}}(g,O).error;t?$(t):ht()}),[Y,W,ht,g,$,O]);return(0,y.jsx)(j.Provider,{value:{state:g,dispatch:E,onSaveDraft:lt,onAttachImage:ut,onAttachPortal:ft,onLoadDraft:_t,onNewPost:mt,onPublish:vt,onShowOptions:pt,onLoadLocalDraft:ct,onDeleteLocalDraft:at,onBold:et,onCenter:rt,onItalic:nt,onUnderline:ot,onAudioChange:st,imageEditorRef:X,loading:A||M,onAiUsed:dt,onFontChanged:bt},children:l})};function L(t){var e=t.getCurrentContent(),n="",o=0,r=e.getBlockMap().count();return e.getBlockMap().forEach((function(t,e){n+=function(t){for(var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=t.getText(),o=t.getCharacterList(),r=[],i="",c=0;c<n.length;c++){var a=n.charAt(c),l=o.get(c);i+=N(l,r,"BOLD","prsmkdwn-b"),i+=N(l,r,"ITALIC","prsmkdwn-i"),i+=N(l,r,"UNDERLINE","prsmkdwn-u"),i+=a}r.length&&(r.includes("BOLD")&&(i+="*/prsmkdwn-b*"),r.includes("ITALIC")&&(i+="*/prsmkdwn-i*"),r.includes("UNDERLINE")&&(i+="*/prsmkdwn-u*"));var u=t.getData();if(u.has(_.Hb)){switch(u.get(_.Hb)){case"CENTER":i="*prsmkdwn-jc*".concat(i,"*/prsmkdwn-jc*")}}return i+(e?"\n":"")}(t,o<r-1),o++})),n}function N(t,e,n,o){if(t.hasStyle(n)&&!e.includes(n))return e.push(n),"*".concat(o,"*");if(!t.hasStyle(n)&&e.includes(n)){var r=e.indexOf(n);return e.splice(r,1),"*/".concat(o,"*")}return""}function R(t){return(t=t.trim()).length?(t=(t=(t=t.replace(/\n/g," ")).replace(/(^\s*)|(\s*$)/gi,"")).replace(/[ ]{2,}/gi," ")).split(" ").length:0}},48028:function(t,e,n){"use strict";n.d(e,{x:function(){return I}});var o=n(1717),r=n(31750),i=n(76335),c=n.n(i),a=n(2777),l=n(92788),u=n.n(l),s=n(27378),d=n(60042),b=n.n(d),m=n(69400),f=n(61492),_=n(42569),p=n(74300),h=n(24246);function v(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function g(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?v(Object(n),!0).forEach((function(e){(0,o.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):v(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var w=function(t){var e=t.referenceElement,n=t.placement,r=t.show,i=t.close,c=t.reversed,a=t.children,l=(0,s.useState)(null),d=l[0],v=l[1],w=(0,m.D)(e,d,{placement:n}),x=w.styles,y=w.attributes,E=(0,s.useCallback)((function(t){r&&d&&(d.contains(t.target)||e.contains(t.target)||i())}),[r,d,e,i]);(0,p.mR)("mousedown",E);var k=(0,_.Yz)(r,null,{from:{opacity:0,transform:"scale(0.7)"},enter:{opacity:1,transform:"scale(1.0)"},leave:{opacity:0,transform:"scale(0.7)"},config:{tension:400,friction:28}});return(0,h.jsx)(h.Fragment,{children:k.map((function(t){var e=t.item,n=t.key,r=t.props;return e&&(0,h.jsx)(f.Z,{children:(0,h.jsx)("div",g(g({ref:v,className:u()["context-menu-container"],style:x.popper},y.popper),{},{children:(0,h.jsx)(_.q.div,{className:b()(u()["context-menu"],(0,o.Z)({},u()["context-menu--reversed"],c)),style:r,children:a})}))},n)}))})},x=n(86017),y=n.n(x),E=n(16974),k=function(t){var e=t.item,n=e.title,r=e.onClick,i=e.icon,c=e.gold,a=t.hideMenu,l=(0,s.useCallback)((function(){a&&a(),r&&r()}),[r,a]);return(0,h.jsxs)("div",{className:b()(y()["context-menu-item"],(0,o.Z)({},y()["context-menu-item--gold"],c)),onClick:l,children:[!!i&&(0,h.jsx)("div",{className:y()["context-menu-icon-container"],children:(0,h.jsx)(i,{className:y()["context-menu-icon"]})}),(0,h.jsx)("div",{className:y()["context-menu-text"],children:n})]})},C=function(t){var e,n=t.title,r=t.checked,i=t.setChecked,c=t.gold,a=(0,s.useCallback)((function(){return i((function(t){return!t}))}),[i]);return(0,h.jsx)("div",{className:b()(y()["context-checkbox-item"],(e={},(0,o.Z)(e,y()["context-checkbox-item--checked"],r),(0,o.Z)(e,y()["context-checkbox-item--gold"],c),e)),children:(0,h.jsx)(k,{item:{title:n,icon:E.nQ,onClick:a}})})},B=["items"];function O(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(t);e&&(o=o.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,o)}return n}function j(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};
1e%2?O(Object(n),!0).forEach((function(e){(0,o.Z)(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):O(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}var I=function(t){var e=t.items,n=(0,r.Z)(t,B);return(0,h.jsx)(w,j(j({},n),{},{children:e.map((function(t,e){var o=t;if(o.setChecked)return(0,h.jsx)(C,j({},o),e);var r=t,i=(0,h.jsx)(k,{item:t,hideMenu:n.close},e);return r.link?(0,h.jsx)(a.L,{to:r.link,className:c()["context-item-link"],children:i},e):i}))}))}},56669:function(t){t.exports={"action-button":"actionButton_action-button__22mKb","action-button--black":"actionButton_action-button--black__1mQqE","action-button--red":"actionButton_action-button--red__3-Ur4","action-button--gold":"actionButton_action-button--gold__3vvgo","action-button--blue":"actionButton_action-button--blue__1ePPU","action-button--blue-grey":"actionButton_action-button--blue-grey__3dj5W","action-button--platinum":"actionButton_action-button--platinum__27B_2",slide:"actionButton_slide__1lr86","action-button--facebook":"actionButton_action-button--facebook__38Dgr","action-button--twitter":"actionButton_action-button--twitter__2B-AN","action-button--white":"actionButton_action-button--white__mWmaf","action-button--lobby":"actionButton_action-button--lobby__2EmBz","action-button--emerald":"actionButton_action-button--emerald__Sebbq","action-button--emerald--subscribe":"actionButton_action-button--emerald--subscribe__24dhd","action-button--loading":"actionButton_action-button--loading__1qEem","action-button__title":"actionButton_action-button__title__DRxL0","action-button--login":"actionButton_action-button--login__1KK2m","action-button--age-confirm":"actionButton_action-button--age-confirm__KcPBa","action-button--write":"actionButton_action-button--write__3tNPd","action-button--challenge-header":"actionButton_action-button--challenge-header__168cJ","action-button--gold-modal":"actionButton_action-button--gold-modal__3r4ee","action-button-spinner-container":"actionButton_action-button-spinner-container__1AKDF","button-container":"actionButton_button-container__3l0Ah","button-container--vertical":"actionButton_button-container--vertical__1joeF","button-container--simple-page":"actionButton_button-container--simple-page__186rY","button-container--post-view-locked":"actionButton_button-container--post-view-locked__tnDik","button-container--align-left":"actionButton_button-container--align-left__2WcAX","button-container--align-right":"actionButton_button-container--align-right__3SKwf","button-container--align-center":"actionButton_button-container--align-center__2dJhQ"}},27806:function(t){t.exports={"book-button":"bookButton_book-button__2pQau","book-button--selected":"bookButton_book-button--selected__3Z4vb","book-button--gold":"bookButton_book-button--gold__14sSd",slide:"bookButton_slide__2lTa3"}},85265:function(t){t.exports={"follow-button":"followButton_follow-button__2CQEW","follow-button--selected":"followButton_follow-button--selected__31-S4",slide:"followButton_slide__3w86m"}},21584:function(t){t.exports={"portal-follow-button":"portalFollowButton_portal-follow-button__2G_xM","portal-follow-button--selected":"portalFollowButton_portal-follow-button--selected__3V6DI",slide:"portalFollowButton_slide__2u3tT"}},44255:function(t){t.exports={"subscribe-button":"subscribeButton_subscribe-button__1RUzq","subscribe-button--subscribed":"subscribeButton_subscribe-button--subscribed__1PuLt","subscribe-button--resubscribe":"subscribeButton_subscribe-button--resubscribe__2_NhT",slide:"subscribeButton_slide__3rd9u"}},8813:function(t){t.exports={"challenge-view":"challengeView_challenge-view__1wZTn","challenge-view-icon":"challengeView_challenge-view-icon__1nYKw","challenge-view-link":"challengeView_challenge-view-link__1I0Rs","challenge-view-content":"challengeView_challenge-view-content__3xNeB","challenge-view-title":"challengeView_challenge-view-title__355WF","challenge-view-text":"challengeView_challenge-view-text__1ppph","challenge-view-info":"challengeView_challenge-view-info__Hx5kl","challenge-view-enter":"challengeView_challenge-view-enter__1SPMH","action-button":"challengeView_action-button__2Tva_","challenge-view-prize":"challengeView_challenge-view-prize__T9hw-","challenge-view-featured":"challengeView_challenge-view-featured__oPghE",slide:"challengeView_slide__3u0dJ"}},63711:function(t){t.exports={"comment-view":"commentView_comment-view__3zZJD","comment-view--selected":"commentView_comment-view--selected__1Fg8U","comment-user-label-content":"commentView_comment-user-label-content__23BvW","comment-view-replies":"commentView_comment-view-replies__22Z2W","user-label__image":"commentView_user-label__image__1yJ7k","user-label__image-link":"commentView_user-label__image-link__1WkM6","comment-view-text":"commentView_comment-view-text__2wJDi","delete-icon":"commentView_delete-icon__1bJDp","reply-icon":"commentView_reply-icon__2WGbt","comment-user-label-time":"commentView_comment-user-label-time__2vlMV",slide:"commentView_slide__-vd6b"}},19160:function(t){t.exports={"table-container":"table_table-container__Wb91d","th-high-relevance":"table_th-high-relevance__3NkPE","th-unique-relevance":"table_th-unique-relevance__2R6EQ","empty-data":"table_empty-data__2XdPn",slide:"table_slide__kBAfn"}},92788:function(t){t.exports={"context-menu-container":"baseContextMenu_context-menu-container__2FgKA","context-menu":"baseContextMenu_context-menu__1qiZ7","context-menu--reversed":"baseContextMenu_context-menu--reversed__2CvfD","context-menu-item":"baseContextMenu_context-menu-item__2xONm",slide:"baseContextMenu_slide__3cLvs"}},76335:function(t){t.exports={slide:"contextMenu_slide__3t_4J"}},86017:function(t){t.exports={"context-menu-item":"contextMenuItem_context-menu-item__173wE","context-menu-item--gold":"contextMenuItem_context-menu-item--gold__3oKgp","context-menu-icon":"contextMenuItem_context-menu-icon__3BSh8","context-item-link":"contextMenuItem_context-item-link__1Ee5h","context-menu-text":"contextMenuItem_context-menu-text__3eoe_","context-menu-icon-container":"contextMenuItem_context-menu-icon-container__2hOub","context-checkbox-item":"contextMenuItem_context-checkbox-item__3Xjno","context-checkbox-item--checked":"contextMenuItem_context-checkbox-item--checked__1O5xn","context-checkbox-item--gold":"contextMenuItem_context-checkbox-item--gold__3kM2P",slide:"contextMenuItem_slide__2F1rr"}}}]);
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.