feedkeeper 0.47.10 → 0.47.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,7 @@
1
1
  {
2
2
  "name": "feedkeeper",
3
- "version": "0.47.10",
3
+ "mcpName": "io.github.visualfusion/feedkeeper-core",
4
+ "version": "0.47.12",
4
5
  "description": "A lightweight, self-hosted RSS reader and remote MCP server for your news, blogs, and AI workflows.",
5
6
  "keywords": [
6
7
  "rss",
@@ -617,9 +617,13 @@ export function createMcpServerForUser(userId, scope) {
617
617
  if (scope === "write")
618
618
  server.registerTool("publish_edition", {
619
619
  title: "Publish curated newspaper edition",
620
- description: "Publishes an ordered selection of 1 to 24 article IDs as the user's official curated edition ('Deine Zeitung'). The published edition remains available until the next edition is published or expires. Pass the revision from get_edition as expectedRevision for optimistic concurrency, and a UUID requestId for idempotent retries. Does NOT alter underlying articles. Requires write scope.",
621
- annotations: writeAdditiveIdempotentAnnotations,
622
- inputSchema: publishEditionFields,
620
+ description: "Publishes an ordered selection of 1 to 24 article IDs as the user's official curated edition ('Deine Zeitung'), replacing the currently active edition, including its editorial content. The underlying articles are not altered. Confirm with the user before replacing an existing edition. Pass the revision from get_edition as expectedRevision for optimistic concurrency, and a UUID requestId for idempotent retries. Requires write scope.",
621
+ annotations: writeDestructiveAnnotations,
622
+ inputSchema: {
623
+ ...publishEditionFields,
624
+ expectedRevision: z.number().int().min(0).describe("Current edition revision from get_edition; required to prevent overwriting a newer edition"),
625
+ requestId: z.uuid().describe("Unique idempotency UUID for this publication; reuse when retrying"),
626
+ },
623
627
  }, async (input) => capabilityAction("editions", () => publishCuratedEdition(userId, input)));
624
628
  if (scope === "write")
625
629
  server.registerTool("dismiss_edition", {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@feedkeeper/server",
3
- "version": "0.47.10",
3
+ "version": "0.47.12",
4
4
  "private": true,
5
5
  "type": "module"
6
6
  }
@@ -91,7 +91,7 @@ function as(e,t){this.v=e,this.k=t}function os(e,t){(t==null||t>e.length)&&(t=e.
91
91
  In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}
92
92
  /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
93
93
  function us(e,t){return ss(e)||cs(e,t)||ds(e,t)||ls()}function ds(e,t){if(e){if(typeof e==`string`)return os(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?os(e,t):void 0}}function fs(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof as;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}fs.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},fs.prototype.next=function(e){return this._invoke(`next`,e)},fs.prototype.throw=function(e){return this._invoke(`throw`,e)},fs.prototype.return=function(e){return this._invoke(`return`,e)};var ps=Object.entries,ms=Object.setPrototypeOf,hs=Object.isFrozen,gs=Object.getPrototypeOf,_s=Object.getOwnPropertyDescriptor,vs=Object.freeze,ys=Object.seal,bs=Object.create,xs=typeof Reflect<`u`&&Reflect,Ss=xs.apply,Cs=xs.construct;vs||=function(e){return e},ys||=function(e){return e},Ss||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},Cs||=function(e){return new e(...[...arguments].slice(1))};var ws=Js(Array.prototype.forEach);Array.prototype.indexOf;var Ts=Js(Array.prototype.lastIndexOf),Es=Js(Array.prototype.pop),Ds=Js(Array.prototype.push),Os=Js(Array.prototype.slice),ks=Js(Array.prototype.splice),As=Array.isArray,js=Ys(Set),Ms=Js(Set.prototype.add),Ns=Js(Set.prototype.has),Ps=Js(String.prototype.toLowerCase),Fs=Js(String.prototype.toString),Is=Js(String.prototype.match),Ls=Js(String.prototype.replace),Rs=Js(String.prototype.indexOf),zs=Js(String.prototype.trim),Bs=Js(Number.prototype.toString),Vs=Js(Boolean.prototype.toString),Hs=typeof BigInt>`u`?null:Js(BigInt.prototype.toString),Us=typeof Symbol>`u`?null:Js(Symbol.prototype.toString),Ws=Js(Object.prototype.hasOwnProperty),Gs=Js(Object.prototype.toString),Ks=Js(RegExp.prototype.test),qs=Ys(TypeError);function Js(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return Ss(e,t,n)}}function Ys(e){return function(){return Cs(e,[...arguments])}}function G(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ps;if(ms&&ms(e,null),!As(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(hs(t)||(t[r]=e),i=e)}e[i]=!0}return e}function Xs(e){for(let t=0;t<e.length;t++)Ws(e,t)||(e[t]=null);return e}function Zs(e){let t=bs(null);for(let r of ps(e)){var n=us(r,2);let i=n[0],a=n[1];Ws(e,i)&&(t[i]=As(a)?Xs(a):a&&typeof a==`object`&&a.constructor===Object?Zs(a):a)}return t}function Qs(e){switch(typeof e){case`string`:return e;case`number`:return Bs(e);case`boolean`:return Vs(e);case`bigint`:return Hs?Hs(e):`0`;case`symbol`:return Us?Us(e):`Symbol()`;case`undefined`:return Gs(e);case`function`:case`object`:{if(e===null)return Gs(e);let t=e,n=$s(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Gs(e)}return Gs(e)}default:return Gs(e)}}function $s(e,t){for(;e!==null;){let n=_s(e,t);if(n){if(n.get)return Js(n.get);if(typeof n.value==`function`)return Js(n.value)}e=gs(e)}function n(){return null}return n}function ec(e,t){for(;e!==null;){let n=_s(e,t);if(n)return n.get?Js(n.get):null;e=gs(e)}return null}function tc(e){try{return Ks(e,``),!0}catch{return!1}}var nc=vs(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),rc=vs(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ic=vs([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),ac=vs([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),oc=vs(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),sc=vs([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),cc=vs([`#text`]),lc=vs(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),uc=vs(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),dc=vs(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),fc=vs([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),pc=ys(/{{[\w\W]*|^[\w\W]*}}/g),mc=ys(/<%[\w\W]*|^[\w\W]*%>/g),hc=ys(/\${[\w\W]*/g),gc=ys(/^data-[\-\w.\u00B7-\uFFFF]+$/),_c=ys(/^aria-[\-\w]+$/),vc=ys(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),yc=ys(/^(?:\w+script|data):/i),bc=ys(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),xc=ys(/^html$/i),Sc=ys(/^[a-z][.\w]*(-[.\w]+)+$/i),Cc=ys(/<[/\w!]/g),wc=ys(/<[/\w]/g),Tc=ys(/<\/no(script|embed|frames)/i),Ec=ys(/\/>/i),Dc={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Oc=vs(G({},[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`])),kc=function(){return typeof window>`u`?null:window},Ac=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},jc=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},Mc=function(e,t,n,r){return Ws(e,t)&&As(e[t])?G(r.base?Zs(r.base):{},e[t],r.transform):n},Nc=function(e,t,n){let r=Ws(e,t)?e[t]:void 0;return r&&typeof r==`object`?Zs(r):n()};function Pc(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:kc(),t=e=>Pc(e);if(t.version=`3.4.17`,t.removed=[],!e||!e.document||e.document.nodeType!==Dc.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=$s(d,`cloneNode`),p=$s(d,`remove`),m=$s(d,`removeAttributeNode`),h=$s(d,`nextSibling`),g=$s(d,`childNodes`),_=$s(d,`parentNode`),v=$s(d,`shadowRoot`),y=$s(d,`attributes`),b=o&&o.prototype?$s(o.prototype,`nodeType`):null,x=o&&o.prototype?$s(o.prototype,`nodeName`):null,S=o&&o.prototype?$s(o.prototype,`ownerDocument`):null,C=function(e){return b?b(e):e.nodeType},w=function(e){return x?x(e):e.nodeName},T=ec(d,`namespaceURI`),E=function(e){return T?T(e):e.namespaceURI};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let D,O=``,k,A=!1,j=0,ee=function(){if(j>0)throw qs(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},te=function(e){ee(),j++;try{return D.createHTML(e)}finally{j--}},ne=function(e){ee(),j++;try{return D.createScriptURL(e)}finally{j--}},re=function(){return A||=(k=Ac(u,i),!0),k},ie=n,ae=ie.implementation,oe=ie.createNodeIterator,se=ie.createDocumentFragment,ce=ie.getElementsByTagName,le=r.importNode,M=jc();t.isSupported=typeof ps==`function`&&typeof _==`function`&&ae&&ae.createHTMLDocument!==void 0;let ue=pc,de=mc,fe=hc,pe=gc,me=_c,he=yc,ge=bc,_e=Sc,N=vc,P=null,ve=G({},[...nc,...rc,...ic,...oc,...cc]),F=null,ye=G({},[...lc,...uc,...dc,...fc]),be=Object.seal(bs(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),xe=null,I=null,Se=Object.seal(bs(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),Ce=!0,we=!0,Te=!1,Ee=!0,De=!1,Oe=!0,ke=!1,Ae=!1,je=null,Me=null,Ne=!1,Pe=!1,Fe=!1,Ie=!1,Le=!0,Re=!1,ze=`user-content-`,Be=!0,Ve=!1,He=null,Ue={},We=null,Ge=G({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),Ke=null,qe=G({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Je=null,Ye=G({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Xe=`http://www.w3.org/1998/Math/MathML`,Ze=`http://www.w3.org/2000/svg`,L=`http://www.w3.org/1999/xhtml`,Qe=L,$e=!1,et=null,tt=G({},[Xe,Ze,L],Fs),nt=vs([`mi`,`mo`,`mn`,`ms`,`mtext`]),rt=G({},nt),it=vs([`annotation-xml`]),at=G({},it),ot=G({},[`title`,`style`,`font`,`a`,`script`]),st=null,ct=[`application/xhtml+xml`,`text/html`],lt=null,R=null,ut=n.createElement(`form`),dt=function(e){return e instanceof RegExp||e instanceof Function},ft=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(R&&R===e)return;e&&typeof e==`object`||(e={}),e=Zs(e),st=ct.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,lt=st===`application/xhtml+xml`?Fs:Ps,P=Mc(e,`ALLOWED_TAGS`,ve,{transform:lt}),F=Mc(e,`ALLOWED_ATTR`,ye,{transform:lt}),et=Mc(e,`ALLOWED_NAMESPACES`,tt,{transform:Fs}),Je=Mc(e,`ADD_URI_SAFE_ATTR`,Ye,{transform:lt,base:Ye}),Ke=Mc(e,`ADD_DATA_URI_TAGS`,qe,{transform:lt,base:qe}),We=Mc(e,`FORBID_CONTENTS`,Ge,{transform:lt}),xe=Mc(e,`FORBID_TAGS`,Zs({}),{transform:lt}),I=Mc(e,`FORBID_ATTR`,Zs({}),{transform:lt}),Ue=Ws(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?Zs(e.USE_PROFILES):e.USE_PROFILES:!1,Ce=e.ALLOW_ARIA_ATTR!==!1,we=e.ALLOW_DATA_ATTR!==!1,Te=e.ALLOW_UNKNOWN_PROTOCOLS||!1,Ee=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,De=e.SAFE_FOR_TEMPLATES||!1,Oe=e.SAFE_FOR_XML!==!1,ke=e.WHOLE_DOCUMENT||!1,Pe=e.RETURN_DOM||!1,Fe=e.RETURN_DOM_FRAGMENT||!1,Ie=e.RETURN_TRUSTED_TYPE||!1,Ne=e.FORCE_BODY||!1,Le=e.SANITIZE_DOM!==!1,Re=e.SANITIZE_NAMED_PROPS||!1,Be=e.KEEP_CONTENT!==!1,Ve=e.IN_PLACE||!1,N=tc(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:vc,Qe=typeof e.NAMESPACE==`string`?e.NAMESPACE:L,rt=Nc(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>G({},nt)),at=Nc(e,`HTML_INTEGRATION_POINTS`,()=>G({},it));let t=Nc(e,`CUSTOM_ELEMENT_HANDLING`,()=>bs(null));if(be=bs(null),Ws(t,`tagNameCheck`)&&dt(t.tagNameCheck)&&(be.tagNameCheck=t.tagNameCheck),Ws(t,`attributeNameCheck`)&&dt(t.attributeNameCheck)&&(be.attributeNameCheck=t.attributeNameCheck),Ws(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(be.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),ys(be),De&&(we=!1),Fe&&(Pe=!0),Ue&&(P=G({},cc),F=bs(null),Ue.html===!0&&(G(P,nc),G(F,lc)),Ue.svg===!0&&(G(P,rc),G(F,uc),G(F,fc)),Ue.svgFilters===!0&&(G(P,ic),G(F,uc),G(F,fc)),Ue.mathMl===!0&&(G(P,oc),G(F,dc),G(F,fc))),Se.tagCheck=null,Se.attributeCheck=null,Ws(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?Se.tagCheck=e.ADD_TAGS:As(e.ADD_TAGS)&&(P===ve&&(P=Zs(P)),G(P,e.ADD_TAGS,lt))),Ws(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?Se.attributeCheck=e.ADD_ATTR:As(e.ADD_ATTR)&&(F===ye&&(F=Zs(F)),G(F,e.ADD_ATTR,lt))),Ws(e,`ADD_FORBID_CONTENTS`)&&As(e.ADD_FORBID_CONTENTS)&&(We===Ge&&(We=Zs(We)),G(We,e.ADD_FORBID_CONTENTS,lt)),Be&&(P[`#text`]=!0),ke&&G(P,[`html`,`head`,`body`]),P.table&&(G(P,[`tbody`]),delete xe.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw qs(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw qs(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=D;D=e.TRUSTED_TYPES_POLICY;try{O=te(``)}catch(e){throw D=t,e}}else e.TRUSTED_TYPES_POLICY===null?(D=void 0,O=``):(D===void 0&&(D=re()),D&&typeof O==`string`&&(O=te(``)));vs&&vs(e),R=e},pt=G({},[...rc,...ic,...ac]),mt=G({},[...oc,...sc]),ht=function(e,t,n){return t.namespaceURI===L?e===`svg`:t.namespaceURI===Xe?e===`svg`&&(n===`annotation-xml`||rt[n]):!!pt[e]},gt=function(e,t,n){return t.namespaceURI===L?e===`math`:t.namespaceURI===Ze?e===`math`&&at[n]:!!mt[e]},_t=function(e,t,n){return t.namespaceURI===Ze&&!at[n]||t.namespaceURI===Xe&&!rt[n]?!1:!mt[e]&&(ot[e]||!pt[e])},vt=function(e){let t=E(e),n=Ps(w(e)),r=_(e),i,a;return r&&C(r)===Dc.element?(i={namespaceURI:E(r)},a=Ps(w(r))):(i={namespaceURI:Qe},a=`template`),et[t]?t===Ze?ht(n,i,a):t===Xe?gt(n,i,a):t===L?_t(n,i,a):!!(st===`application/xhtml+xml`&&et[t]):!1},yt=function(e){Ds(t.removed,{element:e});try{_(e).removeChild(e)}catch{if(p(e),!_(e))throw qs(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},bt=function(e,t,n){try{m(e,t)}catch{try{e.removeAttribute(n)}catch{}}},xt=function(e){Tt(e);let t=g(e);t&&ws(Os(t),e=>{try{p(e)}catch{}});let n=C(e)===Dc.element?y(e):null;if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&bt(e,r,i)}},St=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}Ds(t.removed,{attribute:r||null,from:n});try{r?m(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`){if(Pe||Fe)try{yt(n)}catch{}else try{n.setAttribute(e,``)}catch{}}},Ct=function(e){let t=y(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||F[lt(i)]||bt(e,r,i)}},wt=function(e,t){let n=arguments.length>2&&arguments[2]!==void 0&&arguments[2],r=[e];for(;r.length>0;){let e=r.pop();if(t(e)===!1)continue;if(n&&C(e)===Dc.element){let t=v(e);Bt(t)&&r.push(t)}let i=g(e);if(i)for(let e=i.length-1;e>=0;--e)r.push(i[e])}},Tt=function(e){wt(e,e=>{C(e)===Dc.element&&Ct(e)})},Et=function(e){let t=[];return wt(e,e=>{t.push(e)},!0),t},Dt=function(e,t){let n=js();ws(Et(e),e=>{C(e)===Dc.element&&Ms(n,e)}),ws(t,e=>{C(e)===Dc.element&&!Ns(n,e)&&Ct(e)})},Ot=function(e,n){let r=!1;return ws(t.removed,t=>{t.element&&(r||=t.element===e,Tt(t.element))}),Dt(e,n),r},kt=function(e,t){let n=He,r=null,i=()=>(r||(r=js(),ws(t,e=>{Ms(r,e)})),r);for(let t=0;;t++){let r=Et(e),a=[e],o=!1;if(ws(r,e=>{C(e)===Dc.documentFragment?Ds(a,e):!o&&!Ns(n,e)&&(o=Ns(i(),e))}),!o)return;if(t>=8)throw qs(`the tree kept changing during in-place sanitization; refusing to return it`);ws(a,(t,n)=>{At(t,n>0,e,i())})}},At=function(e,t,n,r){let i=Ft(e),a;for(;a=i.nextNode();)Ns(r,a)&&!Ns(He,a)&&(t&&Ht(M.uponSanitizeShadowNode,a,null),qt(a,n),en(a,n),Bt(a.content)&&tn(a.content))},jt=function(e){He&&Ms(He,e)},Mt=function(e,t){return Oe?e===`patchsrc`||e===`for`&&t!==`label`&&t!==`output`:!1},Nt=function(e){Oe&&wt(e,e=>{let t=C(e);if(t===Dc.processingInstruction||t===Dc.comment&&Ks(wc,e.data)){try{p(e)}catch{}return!1}if(t===Dc.element){let t=e,n=lt(w(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&Mt(`for`,n)&&t.removeAttribute(`for`)}catch{}}return!0})},Pt=function(e){let t=null,r=null;if(Ne)e=`<remove></remove>`+e;else{let t=Is(e,/^[\r\n\t ]+/);r=t&&t[0]}st===`application/xhtml+xml`&&Qe===L&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=D?te(e):e;if(Qe===L)try{t=new l().parseFromString(i,st)}catch{}if(!t||!t.documentElement){t=ae.createDocument(Qe,`template`,null);try{t.documentElement.innerHTML=$e?O:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Qe===L?ce.call(t,ke?`html`:`body`)[0]:ke?t.documentElement:a},Ft=function(e){let t=S?S(e):e.ownerDocument;return oe.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},It=function(e){return e=Ls(e,ue,` `),e=Ls(e,de,` `),e=Ls(e,fe,` `),e},Lt=function(e){Rt(e);let t=e.querySelectorAll?.call(e,`template`);t&&ws(t,e=>{Bt(e.content)&&Lt(e.content)})},Rt=function(e){e.normalize();let t=S?S(e):e.ownerDocument,n=oe.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=It(r.data),r=n.nextNode()},zt=function(e){let t=x?x(e):null;return typeof t!=`string`||lt(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==y(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==b(e)||e.childNodes!==g(e)},Bt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return b(e)===Dc.documentFragment}catch{return!1}},Vt=function(e){if(!b||typeof e!=`object`||!e)return!1;try{return typeof b(e)==`number`}catch{return!1}};function Ht(e,n,r){e.length!==0&&ws(e,e=>{e.call(t,n,r,R)})}let Ut=function(e,t){return!!(Oe&&e.hasChildNodes()&&!Vt(e.firstElementChild)&&Ks(Cc,e.textContent)&&Ks(Cc,e.innerHTML)||Oe&&Oc[t]&&C(e)===Dc.element&&E(e)===L&&(Vt(e.firstElementChild)||typeof e.textContent==`string`&&Ks(Cc,e.textContent))||e.nodeType===Dc.processingInstruction||Oe&&e.nodeType===Dc.comment&&Ks(wc,e.data))},Wt=function(e,t){return e instanceof RegExp?Ks(e,t):e instanceof Function&&!!e(t,...[...arguments].slice(2))},Gt=function(e,t,n){if(!xe[t]&&Xt(t)&&Wt(be.tagNameCheck,t))return!1;if(Be&&!We[t]&&!We[Ps(t)]){let t=_(e),r=g(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,h(e))}}}return yt(e),!0},z=function(e,t,n,r){return e.length===0?t:t===n||t===r?Zs(t):t},Kt=function(e,t){return e===t||_(e)!==null?!1:(Ve&&Tt(e),!0)},qt=function(e,n){if(jt(e),Ht(M.beforeSanitizeElements,e,null),Kt(e,n))return!0;if(zt(e))return yt(e),!0;let r=lt(w(e));if(P=z(M.uponSanitizeElement,P,ve,je),Ht(M.uponSanitizeElement,e,{tagName:r,allowedTags:P}),Kt(e,n))return!0;if(Ut(e,r))return yt(e),!0;if(xe[r]||!(Se.tagCheck instanceof Function&&Se.tagCheck(r))&&!P[r]){let t=Gt(e,r,n);return t===!1&&(Ht(M.afterSanitizeElements,e,null),Kt(e,n))?!0:t}if(C(e)===Dc.element&&!vt(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&Ks(Tc,e.innerHTML))return yt(e),!0;if(De&&e.nodeType===Dc.text){let n=It(e.textContent);e.textContent!==n&&(Ds(t.removed,{element:e.cloneNode()}),e.textContent=n)}return Ht(M.afterSanitizeElements,e,null),Kt(e,n)},Jt=function(e,t,r){if(I[t]||Mt(t,e)||Le&&(t===`id`||t===`name`)&&(r in n||r in ut))return!1;let i=F[t]||Se.attributeCheck instanceof Function&&Se.attributeCheck(t,e);return we&&Ks(pe,t)||Ce&&Ks(me,t)?!0:i?Je[t]||Ks(N,Ls(r,ge,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&Rs(r,`data:`)===0&&Ke[e]||Te&&!Ks(he,Ls(r,ge,``))?!0:!r:Xt(e)&&Wt(be.tagNameCheck,e)&&Wt(be.attributeNameCheck,t,e)||t===`is`&&be.allowCustomizedBuiltInElements&&Wt(be.tagNameCheck,r)},Yt=G({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),Xt=function(e){return!Yt[Ps(e)]&&Ks(_e,e)},Zt=function(e,t,n,r){if(D&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return te(r);case`TrustedScriptURL`:return ne(r)}return r},Qt=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),!zt(e)||(yt(e),!1)}catch{return St(t,e),!1}},$t=function(e,t){return Oe&&Ks(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,t)?!0:Ps(e)===`attributename`&&Is(t,`href`)!==null},en=function(e,n){if(Ht(M.beforeSanitizeAttributes,e,null),Kt(e,n))return;let r=e.attributes;if(!r||zt(e))return;F=z(M.uponSanitizeAttribute,F,ye,Me);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:F,forceKeepAttr:void 0},a=r.length,o=lt(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=lt(s),d=l,f=s===`value`?d:zs(d),p=!1;i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,Ht(M.uponSanitizeAttribute,e,i),f=i.attrValue,Re&&(u===`id`||u===`name`)&&Rs(f,ze)!==0&&(St(s,e,n),f=ze+f,p=!0),$t(s,f)?St(s,e,n):i.forceKeepAttr||(i.keepAttr?!Ee&&Ks(Ec,f)?St(s,e,n):(De&&(f=It(f)),Jt(o,u,f)?(f=Zt(o,u,c,f),f!==d&&Qt(e,s,c,f)&&p&&Es(t.removed)):St(s,e,n)):St(s,e,n))}Ht(M.afterSanitizeAttributes,e,null),Kt(e,n)},tn=function(e){let t=null,n=Ft(e);for(Ht(M.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if(Ht(M.uponSanitizeShadowNode,t,null),qt(t,e),en(t,e),Bt(t.content)&&tn(t.content),C(t)===Dc.element){let e=v(t);Bt(e)&&(nn(e),tn(e))}De&&Rt(e),Ht(M.afterSanitizeShadowDOM,e,null)},nn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){tn(e.shadow);continue}let n=e.node,r=C(n)===Dc.element,i=g(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=x?x(n):null;if(typeof e==`string`&&lt(e)===`template`){let e=n.content;Bt(e)&&t.push({node:e,shadow:null})}}if(r){let e=v(n);Bt(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if($e=!e,$e&&(e=`<!-->`),typeof e!=`string`&&!Vt(e)&&(e=Qs(e),typeof e!=`string`))throw qs(`dirty is not a string, aborting`);if(!t.isSupported)return e;Ae?(P=je,F=Me):ft(n),(M.uponSanitizeElement.length>0||M.uponSanitizeAttribute.length>0)&&(P=Zs(P)),M.uponSanitizeAttribute.length>0&&(F=Zs(F)),t.removed=[];let c=Ve&&typeof e!=`string`&&Vt(e),l=[],u=He;if(c){Nt(e);let t=w(e);if(typeof t==`string`){let n=lt(t);if(!P[n]||xe[n])throw xt(e),qs(`root node is forbidden and cannot be sanitized in-place`)}if(zt(e))throw xt(e),qs(`root node is clobbered and cannot be sanitized in-place`);l=Et(e),He=js()}else if(Vt(e))i=Pt(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===Dc.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),nn(i);else{if(!Pe&&!De&&!ke&&e.indexOf(`<`)===-1)return D&&Ie?te(e):e;if(i=Pt(e),!i)return Pe?null:Ie?O:``}i&&Ne&&yt(i.firstChild);let d=c?e:i;try{c&&nn(e);let t=Ft(d);for(;o=t.nextNode();)qt(o,d),en(o,d),Bt(o.content)&&tn(o.content);c&&kt(e,l)}catch(t){throw c&&(xt(e),Ot(e,l)),t}finally{He=u}if(c){if(Ot(e,l))throw qs(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return De&&Lt(e),e}if(Pe){if(De&&Lt(i),Fe)for(s=se.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(F.shadowroot||F.shadowrootmode)&&(s=le.call(r,s,!0)),s}let f=ke?i.outerHTML:i.innerHTML;return ke&&P[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&Ks(xc,i.ownerDocument.doctype.name)&&(f=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
94
- `+f),De&&(f=It(f)),D&&Ie?te(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ft(e),Ae=!0,je=P,Me=F},t.clearConfig=function(){R=null,Ae=!1,je=null,Me=null,D=k,O=``},t.isValidAttribute=function(e,t,n){R||ft({});let r=lt(e),i=lt(t);return typeof n==`string`&&($t(t,n)||!Ee&&Ks(Ec,n))?!1:Jt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Ws(M,e)&&Ds(M[e],t)},t.removeHook=function(e,t){if(Ws(M,e)){if(t!==void 0){let n=Ts(M[e],t);return n===-1?void 0:ks(M[e],n,1)[0]}return Es(M[e])}},t.removeHooks=function(e){Ws(M,e)&&(M[e]=[])},t.removeAllHooks=function(){M=jc()},t}var Fc=Pc();function Ic(e,t){try{let n=new URL(e,t||void 0);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}catch{return null}}function Lc(e){let t;try{t=new URL(e)}catch{return null}for(let[n,r]of t.searchParams){if(![`url`,`src`,`image`,`source`].includes(n.toLowerCase()))continue;let t=Ic(r);if(t&&t!==e)return t}let n;try{n=decodeURIComponent(t.pathname)}catch{n=t.pathname}for(let t of[`/https://`,`/http://`,`/https:/`,`/http:/`]){let r=n.indexOf(t);if(r===-1)continue;let i=Ic(n.slice(r+1).replace(/^(https?):\/(?!\/)/i,`$1://`));if(i&&i!==e)return i}return null}function Rc(e){let t=e;for(let e=0;e<3&&t;e++){let e=Lc(t);if(!e)break;t=e}return t}function zc(e){let t=Rc(e);if(!t)return``;try{return new URL(t).pathname.split(`/`).filter(Boolean).at(-1)?.toLowerCase()?.replace(/[-_]\d{2,4}x\d{2,4}(?=\.\w+$)/,``).replace(/[-_]w\d{2,4}(?:[-_][a-z]+[0-9.-]+)*(?=\.\w+$)/,``).replace(/\.(?:webp|jpeg)$/,`.jpg`)??``}catch{return``}}var Bc={USE_PROFILES:{html:!0},ALLOWED_ATTR:[`href`,`src`,`alt`,`title`,`width`,`height`,`data-media`,`data-source`],ALLOW_DATA_ATTR:!1,FORBID_TAGS:[`form`,`input`,`button`,`textarea`,`select`,`style`,`video`,`audio`,`source`]};function Vc(e,t){return e.getAttribute(`width`)===`1`&&e.getAttribute(`height`)===`1`||!!(t&&/feedsportal\.com|feedburner\.com|pixel\.wp\.com|statcounter\.com/i.test(t))}function Hc(e){let t=Number(e.getAttribute(`width`)),n=Number(e.getAttribute(`height`));return t>0&&t<160||n>0&&n<100}function Uc(e,t){if(!e)return null;let n=Fc.sanitize(e,Bc),r=new DOMParser().parseFromString(n,`text/html`);for(let e of r.querySelectorAll(`img`)){let n=r.createRange();if(n.selectNodeContents(r.body),n.setEndBefore(e),n.toString().trim().length>160)return null;let i=Ic(e.getAttribute(`src`)??``,t);if(i&&!Vc(e,i)&&!Hc(e))return i}return null}function Wc(e,t={}){if(!e)return``;let n=Fc.sanitize(e,Bc),r=new DOMParser().parseFromString(n,`text/html`),i=t.heroImageUrl?Ic(t.heroImageUrl,t.baseUrl):null,a=Rc(i),o=zc(a),s=r.body.textContent?.trim().length??0,c=null,l=null;Array.from(r.querySelectorAll(`img`)).forEach((e,n)=>{let u=Ic(e.getAttribute(`src`)??``,t.baseUrl),d=Rc(u),f=zc(d),p=!1;if(n===0&&i?.includes(`/archive/images/`)&&u?.includes(`/archive/images/`)){let t=r.createRange();t.selectNodeContents(r.body),t.setEndBefore(e),p=!t.toString().trim()}let m=!!(i&&u&&(u===i||a&&d===a||o&&f===o||p||n===0&&s<400)),h=!1;if(u&&u===l&&c){let t=r.createRange();t.setStartAfter(c),t.setEndBefore(e),h=!t.toString().trim()}if(!u||Vc(e,u)||m||h){let t=m?e.getAttribute(`alt`)?.trim():null,n=e.closest(`p`),r=e.closest(`figure`);e.remove(),r&&!r.querySelector(`img`)?r.remove():t&&t.length>=15&&n&&n.textContent?.trim()===t&&!n.querySelector(`img`)&&n.remove()}else e.setAttribute(`src`,u),e.removeAttribute(`loading`),c=e,l=u}),r.querySelectorAll(`a`).forEach(e=>{let n=Ic(e.getAttribute(`href`)??``,t.baseUrl);n?(e.setAttribute(`href`,n),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):e.removeAttribute(`href`)}),t.paywallLabel&&r.querySelectorAll(`a[data-media="paywall"]`).forEach(e=>{e.textContent=t.paywallLabel??``}),r.querySelectorAll(`p, div, figure, a, picture, source`).forEach(e=>{!e.textContent?.trim()&&!e.querySelector(`img`)&&e.remove()});let u=Array.from(r.body.childNodes);if(u.some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())&&!r.body.querySelector(`p`)){let e=r.createElement(`p`);u.forEach(t=>e.appendChild(t)),r.body.appendChild(e)}return Fc.sanitize(r.body.innerHTML,Bc)}function Gc(e){return e?Math.max(1,Math.ceil(e.trim().split(/\s+/).length/200)):1}var Kc=[{titleKey:`shortcuts.groups.library`,entries:[{keys:[`J`,`/`,`↓`],labelKey:`shortcuts.nextItem`},{keys:[`K`,`/`,`↑`],labelKey:`shortcuts.previousItem`},{keys:[`Enter`,`/`,`O`],labelKey:`shortcuts.openArticle`},{keys:[`M`],labelKey:`shortcuts.toggleRead`},{keys:[`S`],labelKey:`shortcuts.toggleSaved`},{keys:[`V`],labelKey:`shortcuts.openOriginal`},{keys:[`/`],labelKey:`shortcuts.search`},{keys:[`R`],labelKey:`shortcuts.refresh`},{keys:[`Shift`,`A`],labelKey:`shortcuts.markAllRead`},{keys:[`?`],labelKey:`shortcuts.showShortcuts`}]},{titleKey:`shortcuts.groups.article`,entries:[{keys:[`J`,`/`,`→`],labelKey:`shortcuts.nextArticle`},{keys:[`K`,`/`,`←`],labelKey:`shortcuts.previousArticle`},{keys:[`S`],labelKey:`shortcuts.toggleSaved`},{keys:[`M`],labelKey:`shortcuts.toggleRead`},{keys:[`V`],labelKey:`shortcuts.openOriginal`},{keys:[`R`],labelKey:`shortcuts.toggleFullText`},{keys:[`Esc`],labelKey:`shortcuts.close`}]}];function qc(e){if(!e||typeof e!=`object`)return!1;let t=e;if(t.isContentEditable)return!0;let n=t.tagName?.toUpperCase();return n===`INPUT`||n===`TEXTAREA`||n===`SELECT`}function Jc(e){return e.metaKey||e.ctrlKey||e.altKey}function Yc(e){if(!e)return!1;try{let t=new URL(e);return t.protocol!==`http:`&&t.protocol!==`https:`?!1:(window.open(t.href,`_blank`,`noopener,noreferrer`),!0)}catch{return!1}}var Xc=new Map;function Zc(e){let t=Xc.get(e);return t||(t=new Promise(t=>{let n=new Image;n.onload=()=>t(n.naturalWidth>0&&n.naturalHeight>0),n.onerror=()=>t(!1),n.src=e}),Xc.set(e,t)),t}function Qc(e){let t=5381n;for(let n of e)t=BigInt.asUintN(64,t*33n+BigInt(n.codePointAt(0)??0));return`hsl(${Number(t%360n)} 33% 43.5%)`}function $c({feedId:e,iconUrl:t,siteUrl:n,feedUrl:r,articleUrl:i,fallbackName:a,className:o}){let s=JSON.stringify([e,t,n,r,i]),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null);return(0,_.useEffect)(()=>{let a=!1;l(null);async function o(){if(e){let t=`/api/feeds/${e}/icon`;await Zc(t)?a||l({key:s,url:t}):a||d(s);return}let o=new Set;t&&/^https?:\/\//i.test(t)&&o.add(t);for(let e of[n,r,i])if(e)try{let t=new URL(e);(t.protocol===`https:`||t.protocol===`http:`)&&o.add(`${t.origin}/favicon.ico`)}catch{}for(let e of o)if(await Zc(e)){a||l({key:s,url:e});return}a||d(s)}return o(),()=>{a=!0}},[s]),!c||c.key!==s?a&&u===s?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`${o} inline-grid place-items-center font-semibold text-white`,style:{backgroundColor:Qc(a),fontSize:`0.58em`},children:Array.from(a.trim())[0]?.toUpperCase()??`?`}):null:(0,U.jsx)(`img`,{src:c.url,alt:``,className:o,loading:`lazy`,onError:()=>{Xc.set(c.url,Promise.resolve(!1)),l(null)}})}function el({text:e}){let t=(0,_.useMemo)(()=>!e||!No(e)?e:Qo(e).map((e,t)=>e.kind===`wbr`?(0,U.jsx)(`wbr`,{},t):e.kind===`nb`?(0,U.jsx)(`span`,{className:`nb`,children:e.value},t):(0,U.jsx)(_.Fragment,{children:e.value},t)),[e]);return(0,U.jsx)(U.Fragment,{children:t})}function tl(e){let t=Math.max(0,Math.round(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${r}:${String(i).padStart(2,`0`)}`}function nl(e){if(!e)return null;try{let t=new URL(e);if(t.protocol!==`https:`&&t.protocol!==`http:`)return null;let n=t.hostname.toLowerCase(),r=t.pathname.split(`/`).filter(Boolean),i=null;return n===`youtu.be`?i=r[0]??null:(n===`youtube.com`||n===`www.youtube.com`||n===`m.youtube.com`||n===`music.youtube.com`||n===`youtube-nocookie.com`||n===`www.youtube-nocookie.com`)&&(t.pathname===`/watch`?i=t.searchParams.get(`v`):r.length>=2&&[`embed`,`shorts`,`live`,`v`].includes(r[0])&&(i=r[1])),i&&/^[A-Za-z0-9_-]{6,32}$/.test(i)?i:null}catch{return null}}function rl({item:e}){let{t}=R(),n=vo(),r=(0,_.useRef)(null),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(null),l=(0,_.useRef)(0),u=e.enclosure_type?.toLowerCase().startsWith(`video/`)??!1,d=e.enclosure_url?null:nl(e.link);if((0,_.useEffect)(()=>{s(!1)},[e.id]),(0,_.useEffect)(()=>{let t=!0;if(a([]),c.current=null,l.current=0,e.chapters_url&&u)return H.itemChapters(e.id).then(e=>{t&&a(e.chapters)}).catch(()=>{t&&a([])}),()=>{t=!1}},[e.id,e.chapters_url,u]),d){let n=e.image_url&&!/^https?:\/\/(?:www\.)?youtube\.com\/v\//i.test(e.image_url)?e.image_url:`https://i.ytimg.com/vi/${d}/hqdefault.jpg`;return(0,U.jsx)(`div`,{className:`mb-6 rounded-xl border border-[var(--c-border)] bg-black overflow-hidden aspect-video relative`,children:o?(0,U.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${d}?autoplay=1&rel=0`,title:e.title??`YouTube Video`,className:`w-full h-full border-0`,referrerPolicy:`strict-origin-when-cross-origin`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0}):(0,U.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),"aria-label":t(`player.play`),className:`group relative w-full h-full block cursor-pointer`,children:[(0,U.jsx)(`img`,{src:n,alt:``,className:`w-full h-full object-cover group-hover:scale-[1.02] transition-transform duration-200`}),(0,U.jsx)(`span`,{className:`absolute inset-0 bg-black/20 group-hover:bg-black/30 transition-colors flex items-center justify-center`,children:(0,U.jsx)(`span`,{className:`w-16 h-16 rounded-full bg-black/60 backdrop-blur-md border border-white/25 text-white flex items-center justify-center shadow-lg group-hover:scale-105 transition-transform`,children:(0,U.jsx)(`svg`,{className:`w-7 h-7 translate-x-0.5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,U.jsx)(`polygon`,{points:`6 4 20 12 6 20 6 4`})})})})]})})}if(!e.enclosure_url)return null;if(!u){let r=n.currentItem?.id===e.id,a=r&&n.isPlaying,o=r&&n.duration>0?n.duration:e.enclosure_duration_seconds??0,s=r?n.currentTime:e.media_position&&!e.media_position.completed?e.media_position.positionSeconds:0,c=r?n.chapters:i;return(0,U.jsxs)(`div`,{className:`mb-6 rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>n.togglePlay(e),"aria-label":t(a?`player.pause`:`player.play`),className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[var(--c-blue3)] text-white hover:opacity-90 cursor-pointer`,children:a?(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,U.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,U.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}):(0,U.jsx)(`svg`,{className:`w-4 h-4 translate-x-0.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,U.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})})}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:o>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{type:`range`,min:0,max:o,value:Math.min(s,o),onChange:t=>{r||n.playItem(e),n.seek(Number(t.target.value))},className:`w-full accent-[var(--c-blue3)] cursor-pointer`}),(0,U.jsxs)(`div`,{className:`flex justify-between text-xs font-mono text-[var(--c-text-muted)]`,children:[(0,U.jsx)(`span`,{children:tl(s)}),(0,U.jsx)(`span`,{children:tl(o)})]})]}):(0,U.jsx)(`span`,{className:`text-sm text-[var(--c-text-muted)]`,children:t(`player.play`)})}),r&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>n.skip(30),className:`rounded-lg px-2 py-1 text-xs font-semibold text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,children:`+30s`})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--c-border)]/60`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-[0.06em] text-[var(--c-text-muted)] mb-2`,children:t(`reader.chapters`)}),(0,U.jsx)(`ul`,{className:`max-h-48 overflow-y-auto flex flex-col gap-1`,children:c.map((t,i)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{r||n.playItem(e),n.seek(t.startTime)},className:`w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-[var(--c-surface-hover)] flex items-center gap-3 transition-colors cursor-pointer`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-[var(--c-text-muted)] shrink-0`,children:tl(t.startTime)}),(0,U.jsx)(`span`,{className:`truncate text-[var(--c-text)]`,children:t.title})]})},`${t.startTime}-${i}`))})]})]})}let f=(t,n=!1)=>{let r=Number.isFinite(t.duration)&&t.duration>0?Math.round(t.duration):e.enclosure_duration_seconds??null,i=n?0:Math.max(0,Math.round(t.currentTime));l.current=Date.now(),H.setMediaPosition(e.id,{positionSeconds:i,durationSeconds:r,completed:n,updatedAt:new Date().toISOString()}).catch(()=>{})},p=t=>{if(c.current===e.id)return;c.current=e.id;let n=e.media_position;n&&!n.completed&&n.positionSeconds>0&&(!Number.isFinite(t.duration)||n.positionSeconds<t.duration-2)&&(t.currentTime=n.positionSeconds)},m=e=>{e.paused||Date.now()-l.current<1e4||f(e,!1)},h=e=>{let t=r.current;t&&(t.currentTime=e,t.play().catch(()=>{}))};return(0,U.jsxs)(`div`,{className:`mb-6 rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] p-4`,children:[(0,U.jsx)(`video`,{ref:r,controls:!0,preload:`metadata`,src:e.enclosure_url,onLoadedMetadata:e=>p(e.currentTarget),onTimeUpdate:e=>m(e.currentTarget),onPause:e=>f(e.currentTarget,!1),onEnded:e=>f(e.currentTarget,!0),className:`w-full rounded-lg max-h-96 bg-black`}),i.length>0&&(0,U.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--c-border)]/60`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-[0.06em] text-[var(--c-text-muted)] mb-2`,children:t(`reader.chapters`)}),(0,U.jsx)(`ul`,{className:`max-h-48 overflow-y-auto flex flex-col gap-1`,children:i.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>h(e.startTime),className:`w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-[var(--c-surface-hover)] flex items-center gap-3 transition-colors cursor-pointer`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-[var(--c-text-muted)] shrink-0`,children:tl(e.startTime)}),(0,U.jsx)(`span`,{className:`truncate text-[var(--c-text)]`,children:e.title})]})},`${e.startTime}-${t}`))})]})]})}function il({item:e,isOpen:t,onClose:n,onToggleBookmark:r,onToggleRead:i,onNext:a,onPrevious:o,onItemUpdated:s,hasNext:c=!1,hasPrev:l=!1,footerActions:u}){let{t:d,i18n:f}=R(),[p,m]=(0,_.useState)(61),h=(0,_.useRef)(null),g=(0,_.useCallback)(e=>{if(h.current?.disconnect(),!e)return;let t=()=>m(e.offsetHeight);t(),h.current=new ResizeObserver(t),h.current.observe(e)},[]),[v,y]=(0,_.useState)(!1),b=(0,_.useRef)(new Set),[x,S]=(0,_.useState)(new Set),C=e!==null&&x.has(e.id),w=(0,_.useRef)(e?.id??null);w.current=t?e?.id??null:null;let[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(null),k=e?.author||D,[A,j]=(0,_.useState)(null),[ee,te]=(0,_.useState)(!1),ne=e?.feed_full_text_mode===`never`,[re,ie]=(0,_.useState)(null),[ae,oe]=(0,_.useState)(!1),[se,ce]=(0,_.useState)(0),le=e?.link?Ic(e.link):null;(0,_.useEffect)(()=>{E(!!e?.full_content_html),j(null),te(!1),oe(!1)},[e?.id,e?.full_content_html]),(0,_.useEffect)(()=>{O(null)},[e?.id]);let M=!e?.enclosure_url&&!!nl(e?.link),ue=M||!!e?.enclosure_url;(0,_.useEffect)(()=>{t&&e&&le&&!ue&&localStorage.getItem(`feedkeeper_auto_reader_mode`)!==`false`&&!e.full_content_html&&!ne&&navigator.onLine&&de({silent:!0})},[t,e?.id]),(0,_.useEffect)(()=>{if(t){let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}}},[t]);let de=(0,_.useCallback)(async({silent:t=!1}={})=>{if(!e||b.current.has(e.id))return;if(e.full_content_html){E(e=>!e);return}if(!le)return;let n=e;b.current.add(n.id),S(new Set(b.current)),j(null),te(!1);try{let e=await H.extractContent(n.id),t={id:n.id,full_content_html:e.full_content_html};s?.(t),w.current===n.id&&(e.byline&&O(e.byline),E(!0))}catch(e){w.current===n.id&&(e instanceof Sa&&e.code===`consent_wall`?te(!0):!t&&e instanceof Sa&&e.status===0?j(d(`common.offlineAction`)):!t&&!(e instanceof Sa&&e.code===`full_text_disabled`)&&j(d(`reader.extractionFailed`)))}finally{b.current.delete(n.id),S(new Set(b.current))}},[e,le,d,s]);(0,_.useEffect)(()=>{if(!t||!e)return;let s=e;function u(e){document.querySelector(`[data-shortcuts-modal]`)||qc(e.target)||qc(document.activeElement)||Jc(e)||(e.key===`Escape`?(e.preventDefault(),n()):(e.key===`j`||e.key===`J`||e.key===`ArrowRight`)&&c&&a?(e.preventDefault(),a()):(e.key===`k`||e.key===`K`||e.key===`ArrowLeft`)&&l&&o?(e.preventDefault(),o()):e.key===`s`||e.key===`S`?(e.preventDefault(),r(s)):e.key===`m`||e.key===`M`?(e.preventDefault(),i(s)):e.key===`r`||e.key===`R`?(e.preventDefault(),de()):(e.key===`v`||e.key===`V`||e.key===`o`||e.key===`O`)&&le&&(e.preventDefault(),Yc(le)))}return window.addEventListener(`keydown`,u),()=>window.removeEventListener(`keydown`,u)},[t,e,le,c,l,a,o,n,r,i,de]);let fe=(0,_.useMemo)(()=>e?.published_at?new Date(e.published_at):null,[e?.published_at]),pe=(0,_.useMemo)(()=>fe?new Intl.DateTimeFormat(f.resolvedLanguage,{dateStyle:`medium`}).format(fe):``,[fe,f.resolvedLanguage]),me=(0,_.useMemo)(()=>fe?new Intl.DateTimeFormat(f.resolvedLanguage,{timeStyle:`short`}).format(fe):``,[fe,f.resolvedLanguage]),he=T?e?.full_content_html:e?.content_html,ge=(0,_.useMemo)(()=>e?.image_url??Uc(he??``,e?.link),[e?.image_url,he,e?.link]);(0,_.useEffect)(()=>{if(ie(null),!t||!ge)return;let e=!1,n=new Image;return n.onload=()=>{!e&&n.naturalWidth>0&&n.naturalHeight>0&&ie({src:ge,width:n.naturalWidth,height:n.naturalHeight})},n.src=ge,()=>{e=!0}},[t,ge]);let _e=re?.src===ge?re:null,N=_e!==null&&_e.width<=320&&_e.height<=240,P=(0,_.useMemo)(()=>e&&he?rs(Wc(he,{heroImageUrl:ge,baseUrl:e.link,paywallLabel:d(`reader.paywallRead`)})):``,[e,he,ge,d]),{readingTime:ve,wordCount:F}=(0,_.useMemo)(()=>{let t=(he??e?.content_snippet??``).replace(/<[^>]+>/g,` `).trim(),n=t?t.split(/\s+/).length:0;return{readingTime:Gc(t),wordCount:n}},[he,e?.content_snippet]);return!t||!e?null:(0,is.createPortal)((0,U.jsxs)(`div`,{className:`fixed inset-0 z-50 flex justify-end`,children:[(0,U.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-xs transition-opacity animate-fade-in`,onClick:n,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{className:`relative z-10 w-full sm:max-w-2xl md:max-w-3xl h-full h-[100dvh] bg-[var(--c-surface)] shadow-2xl flex flex-col border-0 sm:border-l border-[var(--c-border)] animate-drawer-in`,role:`dialog`,"aria-modal":`true`,"aria-label":e.title??d(`items.title`),children:[(0,U.jsxs)(`header`,{ref:g,className:`absolute inset-x-0 top-0 z-20 px-4 py-3 border-b border-[var(--c-border)] backdrop-blur-md transform-gpu flex items-center justify-between gap-3`,style:{paddingTop:`max(0.75rem, env(safe-area-inset-top, 0px))`,backgroundColor:`color-mix(in srgb, var(--c-surface) 85%, transparent)`},children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:[(0,U.jsx)($c,{feedId:e.feed_id,iconUrl:e.feed_icon_url,siteUrl:e.feed_site_url,feedUrl:e.feed_url,articleUrl:e.link,className:`h-3.5 w-3.5 shrink-0 rounded-xs object-contain`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.feed_title})]}),(0,U.jsx)(`button`,{type:`button`,onClick:n,title:d(`reader.close`),"aria-label":d(`reader.close`),className:`w-9 h-9 -mr-1 rounded-xl text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/60 active:scale-95 transition-all cursor-pointer flex items-center justify-center shrink-0`,children:(0,U.jsxs)(`svg`,{className:`w-6 h-6`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,U.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),(0,U.jsxs)(`main`,{className:`flex-1 overflow-y-auto overscroll-contain transform-gpu`,style:{paddingTop:p},children:[_e&&!N&&!(!e?.enclosure_url&&nl(e?.link))&&(0,U.jsx)(`img`,{src:_e.src,alt:``,className:`block w-full max-h-[380px] object-cover`,onError:()=>ie(null)}),(0,U.jsx)(`div`,{className:`px-5 sm:px-10 py-6 sm:py-8`,style:{paddingBottom:`max(2rem, env(safe-area-inset-bottom, 0px))`},children:(0,U.jsxs)(`article`,{className:`max-w-prose mx-auto`,children:[(0,U.jsxs)(`div`,{className:`flow-root`,children:[_e&&N&&(0,U.jsx)(`div`,{className:`float-right ml-4 mb-3 sm:ml-6 rounded-xl overflow-hidden border border-[var(--c-border)] bg-[var(--c-bg)] shadow-xs`,style:{width:_e.width,maxWidth:`42%`},children:(0,U.jsx)(`img`,{src:_e.src,alt:``,className:`block w-full h-auto`,onError:()=>ie(null)})}),(0,U.jsx)(`h1`,{lang:Po(e.title),className:`text-2xl sm:text-3xl font-bold font-['Manrope'] text-[var(--c-text)] leading-snug tracking-tight mb-3${Po(e.title)===`ja`?` ja-phrases`:``}`,children:e.title?le?(0,U.jsx)(`a`,{href:le,target:`_blank`,rel:`noopener noreferrer`,className:`hover:underline decoration-[var(--c-border)] underline-offset-4`,children:(0,U.jsx)(el,{text:e.title})}):(0,U.jsx)(el,{text:e.title}):null})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-[var(--c-text-muted)] pb-5 border-b border-[var(--c-border)] mb-6 font-medium`,children:[k&&(0,U.jsx)(`span`,{children:k}),pe&&(0,U.jsxs)(U.Fragment,{children:[k&&(0,U.jsx)(`span`,{children:`•`}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,U.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,U.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,U.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]}),(0,U.jsx)(`span`,{children:pe})]}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,U.jsx)(`polyline`,{points:`12 6 12 12 16 14`})]}),(0,U.jsx)(`span`,{children:me})]})]}),!ue&&!ee&&F>=40&&(T||!!e.full_content_html||ve>1)&&(0,U.jsxs)(U.Fragment,{children:[(k||pe)&&(0,U.jsx)(`span`,{children:`•`}),(0,U.jsx)(`span`,{children:d(`reader.readingTime`,{count:ve})})]})]}),(0,U.jsx)(rl,{item:e}),P?(0,U.jsx)(`div`,{className:`reader-content`,lang:Po(e.content_snippet??e.title),dangerouslySetInnerHTML:{__html:P}}):e.content_snippet?(0,U.jsx)(`div`,{className:`reader-content`,lang:Po(e.content_snippet),children:e.content_snippet.split(`
94
+ `+f),De&&(f=It(f)),D&&Ie?te(f):f},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};ft(e),Ae=!0,je=P,Me=F},t.clearConfig=function(){R=null,Ae=!1,je=null,Me=null,D=k,O=``},t.isValidAttribute=function(e,t,n){R||ft({});let r=lt(e),i=lt(t);return typeof n==`string`&&($t(t,n)||!Ee&&Ks(Ec,n))?!1:Jt(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&Ws(M,e)&&Ds(M[e],t)},t.removeHook=function(e,t){if(Ws(M,e)){if(t!==void 0){let n=Ts(M[e],t);return n===-1?void 0:ks(M[e],n,1)[0]}return Es(M[e])}},t.removeHooks=function(e){Ws(M,e)&&(M[e]=[])},t.removeAllHooks=function(){M=jc()},t}var Fc=Pc();function Ic(e,t){try{let n=new URL(e,t||void 0);return n.protocol===`http:`||n.protocol===`https:`?n.toString():null}catch{return null}}function Lc(e){let t;try{t=new URL(e)}catch{return null}for(let[n,r]of t.searchParams){if(![`url`,`src`,`image`,`source`].includes(n.toLowerCase()))continue;let t=Ic(r);if(t&&t!==e)return t}let n;try{n=decodeURIComponent(t.pathname)}catch{n=t.pathname}for(let t of[`/https://`,`/http://`,`/https:/`,`/http:/`]){let r=n.indexOf(t);if(r===-1)continue;let i=Ic(n.slice(r+1).replace(/^(https?):\/(?!\/)/i,`$1://`));if(i&&i!==e)return i}return null}function Rc(e){let t=e;for(let e=0;e<3&&t;e++){let e=Lc(t);if(!e)break;t=e}return t}function zc(e){let t=Rc(e);if(!t)return``;try{return new URL(t).pathname.split(`/`).filter(Boolean).at(-1)?.toLowerCase()?.replace(/[-_]\d{2,4}x\d{2,4}(?=\.\w+$)/,``).replace(/[-_]w\d{2,4}(?:[-_][a-z]+[0-9.-]+)*(?=\.\w+$)/,``).replace(/\.(?:webp|jpeg)$/,`.jpg`)??``}catch{return``}}var Bc={USE_PROFILES:{html:!0},ALLOWED_ATTR:[`href`,`src`,`alt`,`title`,`width`,`height`,`data-media`,`data-source`],FORBID_TAGS:[`form`,`input`,`button`,`textarea`,`select`,`style`,`video`,`audio`,`source`]};function Vc(e,t){return e.getAttribute(`width`)===`1`&&e.getAttribute(`height`)===`1`||!!(t&&/feedsportal\.com|feedburner\.com|pixel\.wp\.com|statcounter\.com/i.test(t))}function Hc(e){let t=Number(e.getAttribute(`width`)),n=Number(e.getAttribute(`height`));return t>0&&t<160||n>0&&n<100}function Uc(e,t){if(!e)return null;let n=Fc.sanitize(e,Bc),r=new DOMParser().parseFromString(n,`text/html`);r.querySelectorAll(`*`).forEach(e=>{for(let t of Array.from(e.attributes))t.name.startsWith(`data-`)&&(e.tagName!==`A`||t.name!==`data-media`&&t.name!==`data-source`)&&e.removeAttribute(t.name)});for(let e of r.querySelectorAll(`img`)){let n=r.createRange();if(n.selectNodeContents(r.body),n.setEndBefore(e),n.toString().trim().length>160)return null;let i=Ic(e.getAttribute(`src`)??``,t);if(i&&!Vc(e,i)&&!Hc(e))return i}return null}function Wc(e,t={}){if(!e)return``;let n=Fc.sanitize(e,Bc),r=new DOMParser().parseFromString(n,`text/html`);r.querySelectorAll(`*`).forEach(e=>{for(let t of Array.from(e.attributes))t.name.startsWith(`data-`)&&(e.tagName!==`A`||t.name!==`data-media`&&t.name!==`data-source`)&&e.removeAttribute(t.name)});let i=t.heroImageUrl?Ic(t.heroImageUrl,t.baseUrl):null,a=Rc(i),o=zc(a),s=r.body.textContent?.trim().length??0,c=null,l=null;Array.from(r.querySelectorAll(`img`)).forEach((e,n)=>{let u=Ic(e.getAttribute(`src`)??``,t.baseUrl),d=Rc(u),f=zc(d),p=!1;if(n===0&&i?.includes(`/archive/images/`)&&u?.includes(`/archive/images/`)){let t=r.createRange();t.selectNodeContents(r.body),t.setEndBefore(e),p=!t.toString().trim()}let m=!!(i&&u&&(u===i||a&&d===a||o&&f===o||p||n===0&&s<400)),h=!1;if(u&&u===l&&c){let t=r.createRange();t.setStartAfter(c),t.setEndBefore(e),h=!t.toString().trim()}if(!u||Vc(e,u)||m||h){let t=m?e.getAttribute(`alt`)?.trim():null,n=e.closest(`p`),r=e.closest(`figure`);e.remove(),r&&!r.querySelector(`img`)?r.remove():t&&t.length>=15&&n&&n.textContent?.trim()===t&&!n.querySelector(`img`)&&n.remove()}else e.setAttribute(`src`,u),e.removeAttribute(`loading`),c=e,l=u}),r.querySelectorAll(`a`).forEach(e=>{let n=Ic(e.getAttribute(`href`)??``,t.baseUrl);n?(e.setAttribute(`href`,n),e.setAttribute(`target`,`_blank`),e.setAttribute(`rel`,`noopener noreferrer`)):e.removeAttribute(`href`)}),t.paywallLabel&&r.querySelectorAll(`a[data-media="paywall"]`).forEach(e=>{e.textContent=t.paywallLabel??``}),r.querySelectorAll(`p, div, figure, a, picture, source`).forEach(e=>{!e.textContent?.trim()&&!e.querySelector(`img`)&&e.remove()});let u=Array.from(r.body.childNodes);if(u.some(e=>e.nodeType===Node.TEXT_NODE&&e.textContent?.trim())&&!r.body.querySelector(`p`)){let e=r.createElement(`p`);u.forEach(t=>e.appendChild(t)),r.body.appendChild(e)}return Fc.sanitize(r.body.innerHTML,Bc)}function Gc(e){return e?Math.max(1,Math.ceil(e.trim().split(/\s+/).length/200)):1}var Kc=[{titleKey:`shortcuts.groups.library`,entries:[{keys:[`J`,`/`,`↓`],labelKey:`shortcuts.nextItem`},{keys:[`K`,`/`,`↑`],labelKey:`shortcuts.previousItem`},{keys:[`Enter`,`/`,`O`],labelKey:`shortcuts.openArticle`},{keys:[`M`],labelKey:`shortcuts.toggleRead`},{keys:[`S`],labelKey:`shortcuts.toggleSaved`},{keys:[`V`],labelKey:`shortcuts.openOriginal`},{keys:[`/`],labelKey:`shortcuts.search`},{keys:[`R`],labelKey:`shortcuts.refresh`},{keys:[`Shift`,`A`],labelKey:`shortcuts.markAllRead`},{keys:[`?`],labelKey:`shortcuts.showShortcuts`}]},{titleKey:`shortcuts.groups.article`,entries:[{keys:[`J`,`/`,`→`],labelKey:`shortcuts.nextArticle`},{keys:[`K`,`/`,`←`],labelKey:`shortcuts.previousArticle`},{keys:[`S`],labelKey:`shortcuts.toggleSaved`},{keys:[`M`],labelKey:`shortcuts.toggleRead`},{keys:[`V`],labelKey:`shortcuts.openOriginal`},{keys:[`R`],labelKey:`shortcuts.toggleFullText`},{keys:[`Esc`],labelKey:`shortcuts.close`}]}];function qc(e){if(!e||typeof e!=`object`)return!1;let t=e;if(t.isContentEditable)return!0;let n=t.tagName?.toUpperCase();return n===`INPUT`||n===`TEXTAREA`||n===`SELECT`}function Jc(e){return e.metaKey||e.ctrlKey||e.altKey}function Yc(e){if(!e)return!1;try{let t=new URL(e);return t.protocol!==`http:`&&t.protocol!==`https:`?!1:(window.open(t.href,`_blank`,`noopener,noreferrer`),!0)}catch{return!1}}var Xc=new Map;function Zc(e){let t=Xc.get(e);return t||(t=new Promise(t=>{let n=new Image;n.onload=()=>t(n.naturalWidth>0&&n.naturalHeight>0),n.onerror=()=>t(!1),n.src=e}),Xc.set(e,t)),t}function Qc(e){let t=5381n;for(let n of e)t=BigInt.asUintN(64,t*33n+BigInt(n.codePointAt(0)??0));return`hsl(${Number(t%360n)} 33% 43.5%)`}function $c({feedId:e,iconUrl:t,siteUrl:n,feedUrl:r,articleUrl:i,fallbackName:a,className:o}){let s=JSON.stringify([e,t,n,r,i]),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(null);return(0,_.useEffect)(()=>{let a=!1;l(null);async function o(){if(e){let t=`/api/feeds/${e}/icon`;await Zc(t)?a||l({key:s,url:t}):a||d(s);return}let o=new Set;t&&/^https?:\/\//i.test(t)&&o.add(t);for(let e of[n,r,i])if(e)try{let t=new URL(e);(t.protocol===`https:`||t.protocol===`http:`)&&o.add(`${t.origin}/favicon.ico`)}catch{}for(let e of o)if(await Zc(e)){a||l({key:s,url:e});return}a||d(s)}return o(),()=>{a=!0}},[s]),!c||c.key!==s?a&&u===s?(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`${o} inline-grid place-items-center font-semibold text-white`,style:{backgroundColor:Qc(a),fontSize:`0.58em`},children:Array.from(a.trim())[0]?.toUpperCase()??`?`}):null:(0,U.jsx)(`img`,{src:c.url,alt:``,className:o,loading:`lazy`,onError:()=>{Xc.set(c.url,Promise.resolve(!1)),l(null)}})}function el({text:e}){let t=(0,_.useMemo)(()=>!e||!No(e)?e:Qo(e).map((e,t)=>e.kind===`wbr`?(0,U.jsx)(`wbr`,{},t):e.kind===`nb`?(0,U.jsx)(`span`,{className:`nb`,children:e.value},t):(0,U.jsx)(_.Fragment,{children:e.value},t)),[e]);return(0,U.jsx)(U.Fragment,{children:t})}function tl(e){let t=Math.max(0,Math.round(e)),n=Math.floor(t/3600),r=Math.floor(t%3600/60),i=t%60;return n>0?`${n}:${String(r).padStart(2,`0`)}:${String(i).padStart(2,`0`)}`:`${r}:${String(i).padStart(2,`0`)}`}function nl(e){if(!e)return null;try{let t=new URL(e);if(t.protocol!==`https:`&&t.protocol!==`http:`)return null;let n=t.hostname.toLowerCase(),r=t.pathname.split(`/`).filter(Boolean),i=null;return n===`youtu.be`?i=r[0]??null:(n===`youtube.com`||n===`www.youtube.com`||n===`m.youtube.com`||n===`music.youtube.com`||n===`youtube-nocookie.com`||n===`www.youtube-nocookie.com`)&&(t.pathname===`/watch`?i=t.searchParams.get(`v`):r.length>=2&&[`embed`,`shorts`,`live`,`v`].includes(r[0])&&(i=r[1])),i&&/^[A-Za-z0-9_-]{6,32}$/.test(i)?i:null}catch{return null}}function rl({item:e}){let{t}=R(),n=vo(),r=(0,_.useRef)(null),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(!1),c=(0,_.useRef)(null),l=(0,_.useRef)(0),u=e.enclosure_type?.toLowerCase().startsWith(`video/`)??!1,d=e.enclosure_url?null:nl(e.link);if((0,_.useEffect)(()=>{s(!1)},[e.id]),(0,_.useEffect)(()=>{let t=!0;if(a([]),c.current=null,l.current=0,e.chapters_url&&u)return H.itemChapters(e.id).then(e=>{t&&a(e.chapters)}).catch(()=>{t&&a([])}),()=>{t=!1}},[e.id,e.chapters_url,u]),d){let n=e.image_url&&!/^https?:\/\/(?:www\.)?youtube\.com\/v\//i.test(e.image_url)?e.image_url:`https://i.ytimg.com/vi/${d}/hqdefault.jpg`;return(0,U.jsx)(`div`,{className:`mb-6 rounded-xl border border-[var(--c-border)] bg-black overflow-hidden aspect-video relative`,children:o?(0,U.jsx)(`iframe`,{src:`https://www.youtube-nocookie.com/embed/${d}?autoplay=1&rel=0`,title:e.title??`YouTube Video`,className:`w-full h-full border-0`,referrerPolicy:`strict-origin-when-cross-origin`,allow:`accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture`,allowFullScreen:!0}):(0,U.jsxs)(`button`,{type:`button`,onClick:()=>s(!0),"aria-label":t(`player.play`),className:`group relative w-full h-full block cursor-pointer`,children:[(0,U.jsx)(`img`,{src:n,alt:``,className:`w-full h-full object-cover group-hover:scale-[1.02] transition-transform duration-200`}),(0,U.jsx)(`span`,{className:`absolute inset-0 bg-black/20 group-hover:bg-black/30 transition-colors flex items-center justify-center`,children:(0,U.jsx)(`span`,{className:`w-16 h-16 rounded-full bg-black/60 backdrop-blur-md border border-white/25 text-white flex items-center justify-center shadow-lg group-hover:scale-105 transition-transform`,children:(0,U.jsx)(`svg`,{className:`w-7 h-7 translate-x-0.5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,U.jsx)(`polygon`,{points:`6 4 20 12 6 20 6 4`})})})})]})})}if(!e.enclosure_url)return null;if(!u){let r=n.currentItem?.id===e.id,a=r&&n.isPlaying,o=r&&n.duration>0?n.duration:e.enclosure_duration_seconds??0,s=r?n.currentTime:e.media_position&&!e.media_position.completed?e.media_position.positionSeconds:0,c=r?n.chapters:i;return(0,U.jsxs)(`div`,{className:`mb-6 rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] p-4`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>n.togglePlay(e),"aria-label":t(a?`player.pause`:`player.play`),className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[var(--c-blue3)] text-white hover:opacity-90 cursor-pointer`,children:a?(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,U.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,U.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}):(0,U.jsx)(`svg`,{className:`w-4 h-4 translate-x-0.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,U.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})})}),(0,U.jsx)(`div`,{className:`min-w-0 flex-1`,children:o>0?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`input`,{type:`range`,min:0,max:o,value:Math.min(s,o),onChange:t=>{r||n.playItem(e),n.seek(Number(t.target.value))},className:`w-full accent-[var(--c-blue3)] cursor-pointer`}),(0,U.jsxs)(`div`,{className:`flex justify-between text-xs font-mono text-[var(--c-text-muted)]`,children:[(0,U.jsx)(`span`,{children:tl(s)}),(0,U.jsx)(`span`,{children:tl(o)})]})]}):(0,U.jsx)(`span`,{className:`text-sm text-[var(--c-text-muted)]`,children:t(`player.play`)})}),r&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>n.skip(30),className:`rounded-lg px-2 py-1 text-xs font-semibold text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,children:`+30s`})]}),c.length>0&&(0,U.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--c-border)]/60`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-[0.06em] text-[var(--c-text-muted)] mb-2`,children:t(`reader.chapters`)}),(0,U.jsx)(`ul`,{className:`max-h-48 overflow-y-auto flex flex-col gap-1`,children:c.map((t,i)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>{r||n.playItem(e),n.seek(t.startTime)},className:`w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-[var(--c-surface-hover)] flex items-center gap-3 transition-colors cursor-pointer`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-[var(--c-text-muted)] shrink-0`,children:tl(t.startTime)}),(0,U.jsx)(`span`,{className:`truncate text-[var(--c-text)]`,children:t.title})]})},`${t.startTime}-${i}`))})]})]})}let f=(t,n=!1)=>{let r=Number.isFinite(t.duration)&&t.duration>0?Math.round(t.duration):e.enclosure_duration_seconds??null,i=n?0:Math.max(0,Math.round(t.currentTime));l.current=Date.now(),H.setMediaPosition(e.id,{positionSeconds:i,durationSeconds:r,completed:n,updatedAt:new Date().toISOString()}).catch(()=>{})},p=t=>{if(c.current===e.id)return;c.current=e.id;let n=e.media_position;n&&!n.completed&&n.positionSeconds>0&&(!Number.isFinite(t.duration)||n.positionSeconds<t.duration-2)&&(t.currentTime=n.positionSeconds)},m=e=>{e.paused||Date.now()-l.current<1e4||f(e,!1)},h=e=>{let t=r.current;t&&(t.currentTime=e,t.play().catch(()=>{}))};return(0,U.jsxs)(`div`,{className:`mb-6 rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] p-4`,children:[(0,U.jsx)(`video`,{ref:r,controls:!0,preload:`metadata`,src:e.enclosure_url,onLoadedMetadata:e=>p(e.currentTarget),onTimeUpdate:e=>m(e.currentTarget),onPause:e=>f(e.currentTarget,!1),onEnded:e=>f(e.currentTarget,!0),className:`w-full rounded-lg max-h-96 bg-black`}),i.length>0&&(0,U.jsxs)(`div`,{className:`mt-3 pt-3 border-t border-[var(--c-border)]/60`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-[0.06em] text-[var(--c-text-muted)] mb-2`,children:t(`reader.chapters`)}),(0,U.jsx)(`ul`,{className:`max-h-48 overflow-y-auto flex flex-col gap-1`,children:i.map((e,t)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>h(e.startTime),className:`w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-[var(--c-surface-hover)] flex items-center gap-3 transition-colors cursor-pointer`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-[var(--c-text-muted)] shrink-0`,children:tl(e.startTime)}),(0,U.jsx)(`span`,{className:`truncate text-[var(--c-text)]`,children:e.title})]})},`${e.startTime}-${t}`))})]})]})}function il({item:e,isOpen:t,onClose:n,onToggleBookmark:r,onToggleRead:i,onNext:a,onPrevious:o,onItemUpdated:s,hasNext:c=!1,hasPrev:l=!1,footerActions:u}){let{t:d,i18n:f}=R(),[p,m]=(0,_.useState)(61),h=(0,_.useRef)(null),g=(0,_.useCallback)(e=>{if(h.current?.disconnect(),!e)return;let t=()=>m(e.offsetHeight);t(),h.current=new ResizeObserver(t),h.current.observe(e)},[]),[v,y]=(0,_.useState)(!1),b=(0,_.useRef)(new Set),[x,S]=(0,_.useState)(new Set),C=e!==null&&x.has(e.id),w=(0,_.useRef)(e?.id??null);w.current=t?e?.id??null:null;let[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(null),k=e?.author||D,[A,j]=(0,_.useState)(null),[ee,te]=(0,_.useState)(!1),ne=e?.feed_full_text_mode===`never`,[re,ie]=(0,_.useState)(null),[ae,oe]=(0,_.useState)(!1),[se,ce]=(0,_.useState)(0),le=e?.link?Ic(e.link):null;(0,_.useEffect)(()=>{E(!!e?.full_content_html),j(null),te(!1),oe(!1)},[e?.id,e?.full_content_html]),(0,_.useEffect)(()=>{O(null)},[e?.id]);let M=!e?.enclosure_url&&!!nl(e?.link),ue=M||!!e?.enclosure_url;(0,_.useEffect)(()=>{t&&e&&le&&!ue&&localStorage.getItem(`feedkeeper_auto_reader_mode`)!==`false`&&!e.full_content_html&&!ne&&navigator.onLine&&de({silent:!0})},[t,e?.id]),(0,_.useEffect)(()=>{if(t){let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}}},[t]);let de=(0,_.useCallback)(async({silent:t=!1}={})=>{if(!e||b.current.has(e.id))return;if(e.full_content_html){E(e=>!e);return}if(!le)return;let n=e;b.current.add(n.id),S(new Set(b.current)),j(null),te(!1);try{let e=await H.extractContent(n.id),t={id:n.id,full_content_html:e.full_content_html};s?.(t),w.current===n.id&&(e.byline&&O(e.byline),E(!0))}catch(e){w.current===n.id&&(e instanceof Sa&&e.code===`consent_wall`?te(!0):!t&&e instanceof Sa&&e.status===0?j(d(`common.offlineAction`)):!t&&!(e instanceof Sa&&e.code===`full_text_disabled`)&&j(d(`reader.extractionFailed`)))}finally{b.current.delete(n.id),S(new Set(b.current))}},[e,le,d,s]);(0,_.useEffect)(()=>{if(!t||!e)return;let s=e;function u(e){document.querySelector(`[data-shortcuts-modal]`)||qc(e.target)||qc(document.activeElement)||Jc(e)||(e.key===`Escape`?(e.preventDefault(),n()):(e.key===`j`||e.key===`J`||e.key===`ArrowRight`)&&c&&a?(e.preventDefault(),a()):(e.key===`k`||e.key===`K`||e.key===`ArrowLeft`)&&l&&o?(e.preventDefault(),o()):e.key===`s`||e.key===`S`?(e.preventDefault(),r(s)):e.key===`m`||e.key===`M`?(e.preventDefault(),i(s)):e.key===`r`||e.key===`R`?(e.preventDefault(),de()):(e.key===`v`||e.key===`V`||e.key===`o`||e.key===`O`)&&le&&(e.preventDefault(),Yc(le)))}return window.addEventListener(`keydown`,u),()=>window.removeEventListener(`keydown`,u)},[t,e,le,c,l,a,o,n,r,i,de]);let fe=(0,_.useMemo)(()=>e?.published_at?new Date(e.published_at):null,[e?.published_at]),pe=(0,_.useMemo)(()=>fe?new Intl.DateTimeFormat(f.resolvedLanguage,{dateStyle:`medium`}).format(fe):``,[fe,f.resolvedLanguage]),me=(0,_.useMemo)(()=>fe?new Intl.DateTimeFormat(f.resolvedLanguage,{timeStyle:`short`}).format(fe):``,[fe,f.resolvedLanguage]),he=T?e?.full_content_html:e?.content_html,ge=(0,_.useMemo)(()=>e?.image_url??Uc(he??``,e?.link),[e?.image_url,he,e?.link]);(0,_.useEffect)(()=>{if(ie(null),!t||!ge)return;let e=!1,n=new Image;return n.onload=()=>{!e&&n.naturalWidth>0&&n.naturalHeight>0&&ie({src:ge,width:n.naturalWidth,height:n.naturalHeight})},n.src=ge,()=>{e=!0}},[t,ge]);let _e=re?.src===ge?re:null,N=_e!==null&&_e.width<=320&&_e.height<=240,P=(0,_.useMemo)(()=>e&&he?rs(Wc(he,{heroImageUrl:ge,baseUrl:e.link,paywallLabel:d(`reader.paywallRead`)})):``,[e,he,ge,d]),{readingTime:ve,wordCount:F}=(0,_.useMemo)(()=>{let t=(he??e?.content_snippet??``).replace(/<[^>]+>/g,` `).trim(),n=t?t.split(/\s+/).length:0;return{readingTime:Gc(t),wordCount:n}},[he,e?.content_snippet]);return!t||!e?null:(0,is.createPortal)((0,U.jsxs)(`div`,{className:`fixed inset-0 z-50 flex justify-end`,children:[(0,U.jsx)(`div`,{className:`fixed inset-0 bg-black/60 backdrop-blur-xs transition-opacity animate-fade-in`,onClick:n,"aria-hidden":`true`}),(0,U.jsxs)(`div`,{className:`relative z-10 w-full sm:max-w-2xl md:max-w-3xl h-full h-[100dvh] bg-[var(--c-surface)] shadow-2xl flex flex-col border-0 sm:border-l border-[var(--c-border)] animate-drawer-in`,role:`dialog`,"aria-modal":`true`,"aria-label":e.title??d(`items.title`),children:[(0,U.jsxs)(`header`,{ref:g,className:`absolute inset-x-0 top-0 z-20 px-4 py-3 border-b border-[var(--c-border)] backdrop-blur-md transform-gpu flex items-center justify-between gap-3`,style:{paddingTop:`max(0.75rem, env(safe-area-inset-top, 0px))`,backgroundColor:`color-mix(in srgb, var(--c-surface) 85%, transparent)`},children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2 pr-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:[(0,U.jsx)($c,{feedId:e.feed_id,iconUrl:e.feed_icon_url,siteUrl:e.feed_site_url,feedUrl:e.feed_url,articleUrl:e.link,className:`h-3.5 w-3.5 shrink-0 rounded-xs object-contain`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.feed_title})]}),(0,U.jsx)(`button`,{type:`button`,onClick:n,title:d(`reader.close`),"aria-label":d(`reader.close`),className:`w-9 h-9 -mr-1 rounded-xl text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/60 active:scale-95 transition-all cursor-pointer flex items-center justify-center shrink-0`,children:(0,U.jsxs)(`svg`,{className:`w-6 h-6`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,U.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),(0,U.jsxs)(`main`,{className:`flex-1 overflow-y-auto overscroll-contain transform-gpu`,style:{paddingTop:p},children:[_e&&!N&&!(!e?.enclosure_url&&nl(e?.link))&&(0,U.jsx)(`img`,{src:_e.src,alt:``,className:`block w-full max-h-[380px] object-cover`,onError:()=>ie(null)}),(0,U.jsx)(`div`,{className:`px-5 sm:px-10 py-6 sm:py-8`,style:{paddingBottom:`max(2rem, env(safe-area-inset-bottom, 0px))`},children:(0,U.jsxs)(`article`,{className:`max-w-prose mx-auto`,children:[(0,U.jsxs)(`div`,{className:`flow-root`,children:[_e&&N&&(0,U.jsx)(`div`,{className:`float-right ml-4 mb-3 sm:ml-6 rounded-xl overflow-hidden border border-[var(--c-border)] bg-[var(--c-bg)] shadow-xs`,style:{width:_e.width,maxWidth:`42%`},children:(0,U.jsx)(`img`,{src:_e.src,alt:``,className:`block w-full h-auto`,onError:()=>ie(null)})}),(0,U.jsx)(`h1`,{lang:Po(e.title),className:`text-2xl sm:text-3xl font-bold font-['Manrope'] text-[var(--c-text)] leading-snug tracking-tight mb-3${Po(e.title)===`ja`?` ja-phrases`:``}`,children:e.title?le?(0,U.jsx)(`a`,{href:le,target:`_blank`,rel:`noopener noreferrer`,className:`hover:underline decoration-[var(--c-border)] underline-offset-4`,children:(0,U.jsx)(el,{text:e.title})}):(0,U.jsx)(el,{text:e.title}):null})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 text-xs text-[var(--c-text-muted)] pb-5 border-b border-[var(--c-border)] mb-6 font-medium`,children:[k&&(0,U.jsx)(`span`,{children:k}),pe&&(0,U.jsxs)(U.Fragment,{children:[k&&(0,U.jsx)(`span`,{children:`•`}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,U.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,U.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,U.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]}),(0,U.jsx)(`span`,{children:pe})]}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,U.jsx)(`polyline`,{points:`12 6 12 12 16 14`})]}),(0,U.jsx)(`span`,{children:me})]})]}),!ue&&!ee&&F>=40&&(T||!!e.full_content_html||ve>1)&&(0,U.jsxs)(U.Fragment,{children:[(k||pe)&&(0,U.jsx)(`span`,{children:`•`}),(0,U.jsx)(`span`,{children:d(`reader.readingTime`,{count:ve})})]})]}),(0,U.jsx)(rl,{item:e}),P?(0,U.jsx)(`div`,{className:`reader-content`,lang:Po(e.content_snippet??e.title),dangerouslySetInnerHTML:{__html:P}}):e.content_snippet?(0,U.jsx)(`div`,{className:`reader-content`,lang:Po(e.content_snippet),children:e.content_snippet.split(`
95
95
 
96
96
  `).map((e,t)=>(0,U.jsx)(`p`,{children:(0,U.jsx)(el,{text:e})},t))}):(0,U.jsx)(`p`,{className:`text-[var(--c-text-muted)] italic`,children:d(`items.noItems`)}),ee&&(0,U.jsxs)(`div`,{className:`mt-6 p-4 rounded-xl border border-[var(--c-border)] bg-[var(--c-bg)] text-sm text-[var(--c-text-muted)] flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,U.jsx)(`span`,{children:d(`reader.consentWall`)}),le&&(0,U.jsx)(`a`,{href:le,target:`_blank`,rel:`noreferrer noopener`,className:`btn-primary text-sm whitespace-nowrap self-start sm:self-center`,children:d(`reader.readOriginal`)})]}),A&&!M&&(0,U.jsxs)(`div`,{className:`mt-6 p-4 rounded-xl border border-[var(--c-border)] bg-[var(--c-bg)] text-sm text-[var(--c-text-muted)] flex flex-col sm:flex-row sm:items-center justify-between gap-3`,children:[(0,U.jsx)(`span`,{children:A}),le&&(0,U.jsx)(`a`,{href:le,target:`_blank`,rel:`noreferrer noopener`,className:`btn-secondary text-sm whitespace-nowrap self-start sm:self-center`,children:d(`reader.readOriginal`)})]}),(0,U.jsxs)(`div`,{className:`mt-12 pt-6 border-t border-[var(--c-border)]/60 flex items-center justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:o,disabled:!l,title:d(`reader.previous`),"aria-label":d(`reader.previous`),className:`w-10 h-10 rounded-xl border border-[var(--c-border)] flex items-center justify-center text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40 active:scale-95 disabled:opacity-30 disabled:cursor-not-allowed transition-all cursor-pointer`,children:(0,U.jsx)(`svg`,{className:`w-5 h-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`polyline`,{points:`15 18 9 12 15 6`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:a,disabled:!c,title:d(`reader.next`),"aria-label":d(`reader.next`),className:`w-10 h-10 rounded-xl border border-[var(--c-border)] flex items-center justify-center text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40 active:scale-95 disabled:opacity-30 disabled:cursor-not-allowed transition-all cursor-pointer`,children:(0,U.jsx)(`svg`,{className:`w-5 h-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`polyline`,{points:`9 18 15 12 9 6`})})})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2`,children:[le&&!ue&&(!ne||e.full_content_html)&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>void de(),disabled:C,title:d(T?`reader.togglePreview`:`reader.toggleFullText`),"aria-label":d(T?`reader.togglePreview`:`reader.toggleFullText`),className:`w-10 h-10 rounded-xl border flex items-center justify-center transition-all active:scale-95 cursor-pointer ${T?`bg-[var(--c-blue1)]/15 border-[var(--c-blue1)]/40 text-[var(--c-blue1)]`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40`}`,children:C?(0,U.jsx)(`svg`,{className:`w-4 h-4 animate-spin text-[var(--c-blue1)]`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`,strokeDasharray:`32`,strokeDashoffset:`12`})}):(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`path`,{d:`M2 3h6a4 4 0 0 1 4 4v14a3 3 0 0 0-3-3H2z`}),(0,U.jsx)(`path`,{d:`M22 3h-6a4 4 0 0 0-4 4v14a3 3 0 0 1 3-3h7z`})]})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(e),title:e.bookmarked?d(`reader.unbookmark`):d(`reader.bookmark`),"aria-label":e.bookmarked?d(`reader.unbookmark`):d(`reader.bookmark`),className:`w-10 h-10 rounded-xl border flex items-center justify-center transition-all active:scale-95 cursor-pointer ${e.bookmarked?`bg-amber-500/15 border-amber-500/40 text-amber-500`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500 hover:border-amber-500/30`}`,children:(0,U.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:e.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>i(e),title:e.read?d(`reader.markUnread`):d(`reader.markRead`),"aria-label":e.read?d(`reader.markUnread`):d(`reader.markRead`),className:`w-10 h-10 rounded-xl border flex items-center justify-center transition-all active:scale-95 cursor-pointer ${e.read?`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)]`:`border-[var(--c-border)] text-[var(--c-blue1)] hover:border-[var(--c-blue3)]`}`,children:(0,U.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:e.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2.2`,children:(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:async()=>{if(le)try{await navigator.clipboard.writeText(le),y(!0),setTimeout(()=>y(!1),2e3)}catch{}},title:d(v?`reader.linkCopied`:`reader.copyLink`),"aria-label":d(`reader.copyLink`),className:`w-10 h-10 rounded-xl border border-[var(--c-border)] flex items-center justify-center text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40 transition-all active:scale-95 cursor-pointer relative`,children:v?(0,U.jsx)(`svg`,{className:`w-4 h-4 text-emerald-500`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`polyline`,{points:`20 6 9 17 4 12`})}):(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`rect`,{x:`9`,y:`9`,width:`13`,height:`13`,rx:`2`,ry:`2`}),(0,U.jsx)(`path`,{d:`M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1`})]})}),le&&(0,U.jsx)(`a`,{href:le,target:`_blank`,rel:`noreferrer noopener`,title:d(`reader.openOriginal`),"aria-label":d(`reader.openOriginal`),className:`w-10 h-10 rounded-xl border border-[var(--c-border)] flex items-center justify-center text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40 transition-all active:scale-95`,children:(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`}),(0,U.jsx)(`polyline`,{points:`15 3 21 3 21 9`}),(0,U.jsx)(`line`,{x1:`10`,y1:`14`,x2:`21`,y2:`3`})]})}),u&&u.length>0&&u.map(e=>(0,U.jsx)(`button`,{type:`button`,onClick:()=>{ae||(oe(!0),Promise.resolve(e.onPress()).catch(console.error).finally(()=>{oe(!1),ce(e=>e+1)}))},disabled:ae,"aria-pressed":!!e.active,title:e.label,"aria-label":e.label,className:`w-10 h-10 rounded-xl border flex items-center justify-center transition-all active:scale-95 disabled:opacity-55 cursor-pointer ${e.active?`bg-[var(--c-blue3)]/15 border-[var(--c-blue3)] text-[var(--c-text)]`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:bg-[var(--c-border)]/40`}`,children:(0,U.jsx)(`svg`,{className:`w-4 h-4${e.rotate180?` rotate-180`:``}`,viewBox:`0 0 24 24`,fill:e.active?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`path`,{d:e.iconPath})})},`${e.id}-${se}`))]})]})]})})]})]})]}),document.body)}var al=`feedkeeper:extensions-changed`,ol=[`login`,`menu`,`page`],sl=/^[a-z0-9][a-z0-9-]{0,63}$/,cl=(e,t)=>typeof e==`string`&&e.trim().length>0&&e.length<=t,ll=e=>!!e&&typeof e==`object`&&!Array.isArray(e);function ul(e){return ll(e)?typeof e.id==`string`&&sl.test(e.id)&&cl(e.label,80)&&cl(e.description,300)&&cl(e.group,60)&&(e.shortLabel===void 0||cl(e.shortLabel,40))&&(e.icon===void 0||Array.isArray(e.icon)&&e.icon.length<=8&&e.icon.every(e=>typeof e==`string`&&e.length<=400))&&(e.admin===void 0||typeof e.admin==`boolean`)&&typeof e.mount==`function`:!1}function dl(e,t,n){let r=ll(e)&&ll(e.settings)?e.settings:{},i=new Set(Array.isArray(r.hidden)?r.hidden.filter(e=>typeof e==`string`&&t.includes(e)):[]),a=new Set(t),o=[];for(let e of Array.isArray(r.sections)?r.sections:[])ul(e)&&!a.has(e.id)&&(a.add(e.id),(!e.admin||n)&&o.push(e));return{hidden:i,sections:o}}function fl(e){let t=[];for(let n of e){let e=n.group??``,r=t.find(t=>t.group===e);r?r.sections.push(n):t.push({group:e,sections:[n]})}return t}function pl(e,t){if(typeof e==`string`)return e;if(!ll(e))return null;let n=t.toLowerCase();for(let t of[n,n.split(`-`)[0],`en`]){let n=Object.entries(e).find(([e])=>e.toLowerCase()===t)?.[1];if(typeof n==`string`)return n}return Object.values(e).find(e=>typeof e==`string`)??null}function ml(e){return/[\u0000-\u001f\\]/.test(e)||e.length>500?!1:/^\/(?![/\\])/.test(e)||/^https?:\/\/[^\s/]+/i.test(e)}function hl(e,t,n){let r=ll(e)&&Array.isArray(e.footerLinks)?e.footerLinks:[],i=[];for(let e of r.slice(0,8)){if(!ll(e))continue;let r=pl(e.label,t),a=pl(e.href,t);if(!r||!cl(r,60)||!a||!ml(a)||n&&Array.isArray(e.placements)&&!e.placements.some(e=>e===n&&ol.includes(e)))continue;let o=typeof e.icon==`string`&&ml(e.icon)?e.icon:null;i.push({label:r,href:a,newTab:e.newTab===!0||/^https?:/i.test(a),icon:o})}return i}function gl(e){let t=ll(e)?e.loginForm:void 0;return ll(t)&&typeof t.mount==`function`?t:null}function _l(e){let t=ll(e)?e.passwordCard:void 0;return!ll(t)||typeof t.mount!=`function`?null:{mount:t.mount,...typeof t.applies==`function`?{applies:t.applies}:{}}}function vl(e){let t=ll(e)?e.onboarding:void 0;return ll(t)&&typeof t.mount==`function`?t:null}function yl(e){if(typeof e!=`string`||e.length>500)return null;try{let t=new URL(e);return(t.protocol===`https:`||t.protocol===`http:`)&&!t.username&&!t.password?t.toString():null}catch{return null}}function bl(e,t,n){let r=ll(e)&&ll(e.starterPacks)?e.starterPacks:{},i=Array.isArray(r.packs)?r.packs:[],a=new Map;if(r.replace!==!0)for(let e of t)a.set(e.id,e);for(let e of i.slice(0,12))ll(e)&&typeof e.id==`string`&&sl.test(e.id)&&Array.isArray(e.feeds)&&a.set(e.id,e);let o=[];for(let e of a.values()){let t=pl(e.title,n);if(!t||!cl(t,60))continue;let r=[];for(let t of e.feeds.slice(0,20)){if(!ll(t)||!cl(t.title,80))continue;let e=yl(t.url);if(!e)continue;let i=pl(t.description,n);r.push({title:t.title,url:e,lang:typeof t.lang==`string`?t.lang.toLowerCase().split(`-`)[0]:``,description:i&&cl(i,200)?i:``})}r.length>0&&o.push({id:e.id,title:t,description:pl(e.description,n)??``,feeds:r})}return o}function xl(e){let t=ll(e)?e.articlesNotice:void 0;return!ll(t)||typeof t.mount!=`function`?null:{mount:t.mount,...typeof t.applies==`function`?{applies:t.applies}:{}}}function Sl(e,t){let n=ll(e)&&ll(e.meta)?e.meta:{},r=pl(n.title,t)?.trim()??null,i=pl(n.description,t)?.trim()??null;return{title:r&&cl(r,80)?r:null,description:i&&cl(i,300)?i:null}}function Cl(e,t){if(!ll(e)||!Array.isArray(e.pages))return[];let n=[],r=new Set;for(let i of e.pages){if(!ll(i)||typeof i.id!=`string`||!sl.test(i.id)||r.has(i.id))continue;let e=pl(i.label,t);if(cl(e,40)&&typeof i.mount==`function`&&!(!Array.isArray(i.icon)||!i.icon.length||i.icon.length>8||!i.icon.every(e=>cl(e,400)))&&(n.push({id:i.id,label:e,icon:i.icon,mount:i.mount}),r.add(i.id),n.length===3))break}return n}var wl=0;function Tl(e){let t=()=>{wl++,e()};return window.addEventListener(al,t),()=>window.removeEventListener(al,t)}function El(){return(0,_.useSyncExternalStore)(Tl,()=>wl),window.feedkeeperExtensions}function Dl(){let{pageId:e}=Sr(),{user:t}=mo(),{i18n:n}=R(),r=n.resolvedLanguage||`en`,i=Cl(El(),r).find(({id:t})=>t===e);return t&&i?(0,U.jsx)(Ol,{page:i,userId:t.id,language:r},t.id):null}function Ol({page:{mount:e},userId:t,language:n}){let r=(0,_.useRef)(null),[i,a]=(0,_.useState)(null);(0,_.useEffect)(()=>{if(!r.current)return;let i=r.current,o=!0,s;try{s=e(i,{userId:t,language:n,appendText:kl,openArticle:(e,t,n)=>{o&&a({item:e,onChange:t,actions:n})}})}catch(e){console.error(`Could not mount extension page`,e),i.replaceChildren()}return()=>{o=!1,typeof s==`function`&&s(),i.replaceChildren(),a(null)}},[e,t,n]);function o(e){i&&i.item.id===e.id&&(i.onChange(e),a(t=>t?.item.id===e.id?{...t,item:{...t.item,...e}}:t))}return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`div`,{ref:r}),i&&(0,U.jsx)(il,{item:i.item,isOpen:!0,onClose:()=>a(null),onItemUpdated:e=>o({...i.item,...e}),onToggleRead:e=>{Ca(`read`,e.id,!e.read).then(()=>{oo(),o({...e,read:!e.read})}).catch(console.error)},onToggleBookmark:e=>{Ca(`bookmark`,e.id,!e.bookmarked).then(()=>o({...e,bookmarked:!e.bookmarked})).catch(console.error)},footerActions:i.actions})]})}function kl(e,t){Po(t)&&(e.lang=`ja`);for(let n of Qo(t))if(n.kind===`wbr`)e.append(document.createElement(`wbr`));else if(n.kind===`nb`){let t=document.createElement(`span`);t.className=`nb`,t.textContent=n.value,e.append(t)}else e.append(n.value)}var Al=`M435.6,124.8l0,-73.2l-435.6,0l-0,816l92.4,-0l0,-381.6l325.2,0l-0,-74.4l-325.2,0l0,-286.8l343.2,0zM1065.6,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM1722,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM2396.4,830.4l0,-830.4l-90,0l0,278.4c-18,-8.4,-97.2,-39.6,-188.4,-39.6c-164.4,0,-262.8,106.8,-262.8,306c0,242.4,86.4,337.2,279.6,337.2c121.2,-0,216,-32.4,261.6,-51.6zm-90,-48c-21.6,12,-84,33.6,-171.6,33.6c-129.6,0,-188.4,-78,-188.4,-271.2c0,-159.6,63.6,-238.8,189.6,-238.8c72,0,146.4,28.8,170.4,38.4l0,438zM3187.2,867.6l-386.4,-427.2l355.2,-388.8l-120,0l-340.8,388.8l367.2,427.2l124.8,-0zm-494.4,-0l-0,-816l-92.4,0l0,816l92.4,-0zM3776.4,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM4432.8,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM5133.6,544.8c0,-210,-92.4,-306,-282,-306c-118.8,0,-231.6,36,-260.4,50.4l-0,832.8l90,0l0,-280.8c16.8,13.2,99.6,40.8,187.2,40.8c165.6,0,265.2,-92.4,265.2,-337.2zm-93.6,0c0,194.4,-57.6,271.2,-188.4,271.2c-69.6,0,-141.6,-25.2,-170.4,-37.2l0,-439.2c18,-8.4,81.6,-33.6,171.6,-33.6c120,0,187.2,68.4,187.2,238.8zM5792.4,576l0,-31.2c0,-198,-98.4,-306,-259.2,-306c-165.6,0,-264,105.6,-264,306c0,228,63.6,337.2,268.8,337.2c108,-0,200.4,-30,226.8,-46.8l0,-73.2c-16.8,16.8,-115.2,55.2,-205.2,55.2c-144,0,-199.2,-82.8,-201.6,-241.2l434.4,0zm-87.6,-60l-346.8,0c2.4,-136.8,62.4,-213.6,174,-213.6c112.8,0,170.4,91.2,172.8,213.6zM6256.8,313.2l0,-68.4c-9.6,-1.2,-50.4,-6,-66,-6c-106.8,0,-223.2,39.6,-240,48l-0,580.8l90,-0l0,-531.6c16.8,-6,90,-28.8,158.4,-28.8c14.4,0,45.6,3.6,57.6,6z`;function jl(){return(0,U.jsx)(`svg`,{className:`wordmark`,viewBox:`0 0 6257 1122`,role:`img`,"aria-label":`FeedKeeper`,children:(0,U.jsx)(`path`,{d:Al})})}function Ml({size:e=28}){return(0,U.jsxs)(`span`,{className:`brand-lockup`,style:{"--m":`${e}px`},children:[(0,U.jsx)(`img`,{src:`/logo.svg`,alt:``}),(0,U.jsx)(jl,{})]})}var Nl=({isActive:e})=>`relative z-10 flex h-full items-center gap-2 rounded-lg px-3 text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] ${e?`text-[var(--c-text)]`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`;function Pl({onItemsClick:e,pages:t}){let{t:n,i18n:r}=R(),i=hr(),a=(0,_.useRef)(null),[o,s]=(0,_.useState)(null),c=t.map(({id:e,label:t})=>e+t).join(`|`);return(0,_.useLayoutEffect)(()=>{let e=a.current;if(!e)return;let t=()=>{let t=e.querySelector(`a[aria-current="page"]`);s(t?{left:t.offsetLeft,width:t.offsetWidth}:null)};t();let n=new ResizeObserver(t);return e.querySelectorAll(`a`).forEach(e=>n.observe(e)),()=>n.disconnect()},[i.pathname,r.resolvedLanguage,c]),(0,U.jsxs)(`nav`,{ref:a,className:`relative hidden h-9 items-center rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] p-0.5 md:flex`,children:[o&&(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-0.5 left-0 rounded-lg border border-[var(--c-mobile-nav-active-border)] bg-[var(--c-mobile-nav-active)] shadow-sm transition-[transform,width] duration-300 ease-[cubic-bezier(0.25,1,0.5,1)] motion-reduce:transition-none`,style:{width:o.width,transform:`translateX(${o.left}px)`}}),t.map(({id:e,label:t,icon:n})=>(0,U.jsxs)(Ii,{to:`/extensions/${e}`,className:Nl,children:[(0,U.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:n.map(e=>(0,U.jsx)(`path`,{d:e},e))}),t]},e)),(0,U.jsxs)(Ii,{to:`/items`,onClick:e,className:Nl,children:[(0,U.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h12`})}),n(`nav.items`)]}),(0,U.jsxs)(Ii,{to:`/feeds`,className:Nl,children:[(0,U.jsxs)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:`M4 11a9 9 0 0 1 9 9`}),(0,U.jsx)(`path`,{d:`M4 4a16 16 0 0 1 16 16`}),(0,U.jsx)(`circle`,{cx:`5`,cy:`19`,r:`1`})]}),n(`nav.feeds`)]})]})}function Fl({label:e}){return(0,U.jsx)(`kbd`,{className:`inline-flex min-w-7 items-center justify-center rounded-md border border-[var(--c-border)] bg-[var(--c-surface-hover)] px-2 py-0.5 font-sans text-xs font-semibold text-[var(--c-text)] shadow-xs`,children:e})}function Il({isOpen:e,onClose:t}){let{t:n}=R(),r=(0,_.useId)();return(0,_.useEffect)(()=>{if(!e)return;let n=e=>{e.key===`Escape`&&(e.preventDefault(),e.stopPropagation(),t())};return window.addEventListener(`keydown`,n,!0),()=>window.removeEventListener(`keydown`,n,!0)},[e,t]),e?(0,U.jsx)(`div`,{"data-shortcuts-modal":`true`,className:`fixed inset-0 z-50 flex items-center justify-center p-4 bg-black/50 backdrop-blur-xs animate-fade-in`,onClick:e=>{e.target===e.currentTarget&&t()},children:(0,U.jsxs)(`div`,{role:`dialog`,"aria-modal":`true`,"aria-labelledby":r,className:`card w-full max-w-2xl max-h-[85vh] overflow-y-auto p-5 sm:p-6 shadow-2xl`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-4 border-b border-[var(--c-border)] pb-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{id:r,className:`text-lg font-semibold text-[var(--c-text)]`,children:n(`shortcuts.title`)}),(0,U.jsx)(`p`,{className:`mt-1 text-sm text-[var(--c-text-muted)]`,children:n(`shortcuts.subtitle`)})]}),(0,U.jsx)(`button`,{type:`button`,onClick:t,"aria-label":n(`common.close`),title:n(`common.close`),className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-lg border border-[var(--c-border)] text-[var(--c-text-muted)] transition-colors hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,children:(0,U.jsxs)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,U.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),(0,U.jsx)(`div`,{className:`mt-5 grid gap-6 sm:grid-cols-2`,children:Kc.map(e=>(0,U.jsxs)(`section`,{children:[(0,U.jsx)(`h3`,{className:`mb-2.5 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:n(e.titleKey)}),(0,U.jsx)(`ul`,{className:`divide-y divide-[var(--c-border)]`,children:e.entries.map(t=>(0,U.jsxs)(`li`,{className:`flex items-center justify-between gap-3 py-2`,children:[(0,U.jsx)(`span`,{className:`text-sm text-[var(--c-text)]`,children:n(t.labelKey)}),(0,U.jsx)(`span`,{className:`flex shrink-0 items-center gap-1`,children:t.keys.map((e,n)=>t.keys.length>1&&e===`/`?(0,U.jsx)(`span`,{className:`px-0.5 text-xs text-[var(--c-text-muted)]`,children:`/`},`${n}-${e}`):(0,U.jsx)(Fl,{label:e},`${n}-${e}`))})]},`${e.titleKey}:${t.labelKey}`))})]},e.titleKey))})]})}):null}var Ll=`fk_theme`,Rl=new Set,zl=(()=>{try{let e=localStorage.getItem(Ll);return e===`light`||e===`dark`?e:`system`}catch{return`system`}})();function Bl(e){return Rl.add(e),()=>Rl.delete(e)}function Vl(){return zl}function Hl(e){zl=e,e===`system`?document.documentElement.removeAttribute(`data-theme`):document.documentElement.setAttribute(`data-theme`,e);try{e===`system`?localStorage.removeItem(Ll):localStorage.setItem(Ll,e)}catch{}Rl.forEach(e=>e())}function Ul({standalone:e,hasPrompt:t,userAgent:n,maxTouchPoints:r}){if(e)return`installed`;if(t)return`prompt`;if(/iPhone|iPad|iPod/.test(n)||/Macintosh/.test(n)&&r>1)return`ios`;let i=/Safari\//.test(n)&&!/Chrome|Chromium|CriOS|FxiOS|Edg|OPR|Firefox/.test(n);return/Macintosh/.test(n)&&i?`mac-safari`:`unsupported`}var Wl=null,Gl=!1,Kl=new Set,ql=()=>Kl.forEach(e=>e());function Jl(){window.addEventListener(`beforeinstallprompt`,e=>{e.preventDefault(),Wl=e,ql()}),window.addEventListener(`appinstalled`,()=>{Wl=null,Gl=!0,ql()})}function Yl(e){Kl.add(e);let t=window.matchMedia(`(display-mode: standalone)`);return t.addEventListener(`change`,e),()=>{Kl.delete(e),t.removeEventListener(`change`,e)}}function Xl(){return Ul({standalone:Gl||window.matchMedia(`(display-mode: standalone)`).matches||navigator.standalone===!0,hasPrompt:Wl!==null,userAgent:navigator.userAgent,maxTouchPoints:navigator.maxTouchPoints??0})}async function Zl(){let e=Wl;if(!e)return;Wl=null,await e.prompt();let{outcome:t}=await e.userChoice;t===`accepted`&&(Gl=!0),ql()}function Ql(e,t){let n=e.trim().split(/\s+/).filter(Boolean);return n.length===0?t.charAt(0).toUpperCase()||`?`:(n[0].charAt(0)+(n.length>1?n[n.length-1].charAt(0):``)).toUpperCase()}function $l({user:e,className:t=``}){let n=Da(e),[r,i]=(0,_.useState)(null);return(0,U.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center overflow-hidden rounded-full border border-[var(--c-border)] bg-[var(--c-mobile-nav-active)] font-semibold tracking-wide text-[var(--c-text)] ${t}`,children:n&&r!==n?(0,U.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`,onError:()=>i(n)}):(0,U.jsx)(`span`,{"aria-hidden":`true`,children:Ql(e.display_name,e.email)})})}var eu={login:`mt-4 justify-center text-xs`,menu:`border-t border-[var(--c-border)] px-3 py-2.5 text-xs`,page:`mt-10 border-t border-[var(--c-border)] pt-4 text-xs`};function tu({placement:e}){let{t,i18n:n}=R(),r=hl(El(),n.resolvedLanguage||`en`,e);return r.length===0?null:(0,U.jsx)(`nav`,{"aria-label":t(`nav.footerLinks`),className:`flex flex-wrap items-center gap-x-3 gap-y-1 text-[var(--c-text-muted)] ${eu[e]}`,children:r.map((e,t)=>(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-3`,children:[t>0&&(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`opacity-50`,children:`•`}),(0,U.jsxs)(`a`,{href:e.href,...e.newTab?{target:`_blank`,rel:`noopener noreferrer`}:{},className:`transition-colors hover:text-[var(--c-text)] hover:underline`,children:[e.icon&&(0,U.jsx)(`img`,{src:e.icon,alt:``,width:14,height:14,className:`mr-1.5 inline-block align-[-2px]`}),e.label]})]},`${e.href}-${t}`))})}var nu={light:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`4`}),(0,U.jsx)(`path`,{d:`M12 2v2M12 20v2M4.93 4.93l1.41 1.41M17.66 17.66l1.41 1.41M2 12h2M20 12h2M4.93 19.07l1.41-1.41M17.66 6.34l1.41-1.41`})]}),dark:(0,U.jsx)(`path`,{d:`M21 12.79A9 9 0 1 1 11.21 3 7 7 0 0 0 21 12.79z`}),system:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 3a9 9 0 0 1 0 18Z`,fill:`currentColor`,stroke:`none`})]})},ru=`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium text-[var(--c-text)] transition-colors hover:bg-[var(--c-surface-hover)] focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] cursor-pointer`;function K({onOpenShortcuts:e}){let{t}=R(),{user:n,logout:r}=mo(),i=hr(),a=(0,_.useSyncExternalStore)(Bl,Vl),o=(0,_.useSyncExternalStore)(Yl,Xl),[s,c]=(0,_.useState)(!1),l=(0,_.useRef)(null),u=(0,_.useRef)(null),d=(0,_.useId)();if((0,_.useEffect)(()=>c(!1),[i.pathname]),(0,_.useEffect)(()=>{if(!s)return;let e=e=>{l.current?.contains(e.target)||c(!1)},t=e=>{e.key===`Escape`&&(c(!1),u.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[s]),!n)return null;let f={light:t(`settings.themeLight`),dark:t(`settings.themeDark`),system:t(`settings.themeSystem`)};return(0,U.jsxs)(`div`,{ref:l,className:`relative`,children:[(0,U.jsx)(`button`,{ref:u,type:`button`,onClick:()=>c(e=>!e),"aria-expanded":s,"aria-controls":d,"aria-label":t(`nav.account`),title:n.display_name||n.email,className:`flex rounded-full transition-shadow cursor-pointer focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--c-blue3)] ${s||i.pathname.startsWith(`/settings`)?`ring-2 ring-[var(--c-blue3)] ring-offset-2 ring-offset-[var(--c-surface)]`:`hover:ring-2 hover:ring-[var(--c-border)] hover:ring-offset-2 hover:ring-offset-[var(--c-surface)]`}`,children:(0,U.jsx)($l,{user:n,className:`h-9 w-9 text-xs`})}),s&&(0,U.jsxs)(`div`,{id:d,className:`card animate-fade-in absolute right-0 top-full z-50 mt-2 w-72 max-w-[calc(100vw-2rem)] p-1.5 shadow-xl`,style:{boxShadow:`0 16px 40px -12px rgba(0, 0, 0, 0.35)`},children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-3 pt-2 pb-3`,children:[(0,U.jsx)($l,{user:n,className:`h-10 w-10 text-sm`}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`truncate text-sm font-semibold text-[var(--c-text)]`,children:n.display_name||n.email}),n.display_name&&(0,U.jsx)(`p`,{className:`truncate text-xs text-[var(--c-text-muted)]`,children:n.email})]})]}),(0,U.jsxs)(`div`,{className:`border-t border-[var(--c-border)] px-3 py-3`,children:[(0,U.jsx)(`p`,{className:`mb-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:t(`settings.theme`)}),(0,U.jsx)(`div`,{className:`grid grid-cols-3 gap-1 rounded-xl border border-[var(--c-border)] p-0.5`,role:`group`,"aria-label":t(`settings.theme`),children:Object.keys(nu).map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>Hl(e),"aria-pressed":a===e,className:`flex h-8 items-center justify-center gap-1.5 rounded-lg text-xs font-medium transition-colors cursor-pointer focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] ${a===e?`border border-[var(--c-mobile-nav-active-border)] bg-[var(--c-mobile-nav-active)] text-[var(--c-text)] shadow-sm`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`,children:[(0,U.jsx)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:nu[e]}),f[e]]},e))})]}),(0,U.jsxs)(`div`,{className:`flex flex-col border-t border-[var(--c-border)] pt-1.5`,children:[(0,U.jsxs)(Ii,{to:`/settings`,className:`${ru} max-md:hidden`,children:[(0,U.jsxs)(`svg`,{className:`h-4 w-4 text-[var(--c-text-muted)]`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,U.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 1 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 1 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 1 1 4 0v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 1 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),t(`nav.settings`)]}),e&&(0,U.jsxs)(`button`,{type:`button`,className:`${ru} hidden md:flex justify-between`,onClick:()=>{c(!1),e()},children:[(0,U.jsxs)(`span`,{className:`flex items-center gap-3`,children:[(0,U.jsxs)(`svg`,{className:`h-4 w-4 text-[var(--c-text-muted)]`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`rect`,{x:`2`,y:`5`,width:`20`,height:`14`,rx:`2`}),(0,U.jsx)(`path`,{d:`M6 10h.01M10 10h.01M14 10h.01M18 10h.01M8 14h8`})]}),t(`shortcuts.title`)]}),(0,U.jsx)(`kbd`,{className:`rounded border border-[var(--c-border)] bg-[var(--c-surface-hover)] px-1.5 py-0.5 text-[11px] font-semibold text-[var(--c-text-muted)]`,children:`?`})]}),o===`prompt`&&(0,U.jsxs)(`button`,{type:`button`,className:ru,onClick:()=>{c(!1),Zl()},children:[(0,U.jsxs)(`svg`,{className:`h-4 w-4 text-[var(--c-text-muted)]`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:`M12 3v12M7 10l5 5 5-5`}),(0,U.jsx)(`path`,{d:`M5 21h14`})]}),t(`settings.installApp`)]}),(0,U.jsxs)(`button`,{type:`button`,className:`${ru} text-[var(--c-danger)]! hover:bg-[var(--c-danger-bg)]!`,onClick:()=>{c(!1),r()},children:[(0,U.jsxs)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`}),(0,U.jsx)(`polyline`,{points:`16 17 21 12 16 7`}),(0,U.jsx)(`line`,{x1:`21`,y1:`12`,x2:`9`,y2:`12`})]}),t(`nav.logout`)]})]}),(0,U.jsx)(tu,{placement:`menu`})]})]})}function iu(e){return window.addEventListener(`online`,e),window.addEventListener(`offline`,e),()=>{window.removeEventListener(`online`,e),window.removeEventListener(`offline`,e)}}function au(){return(0,_.useSyncExternalStore)(iu,()=>navigator.onLine,()=>!0)}function ou(){let{t:e}=R(),t=(0,_.useSyncExternalStore)(aa,B,()=>0);return au()?null:(0,U.jsxs)(`div`,{role:`status`,className:`border-b px-4 py-2 text-center text-sm text-[var(--c-text-muted)]`,style:{borderColor:`var(--c-border)`,backgroundColor:`var(--c-surface)`},children:[e(`common.offlineBanner`),t>0&&` ${e(`common.offlinePending`,{count:t})}`]})}function su(){let{t:e}=R(),{refresh:t}=mo();return(0,U.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col items-center justify-center gap-4 bg-[var(--c-bg)] px-6 text-center`,children:[(0,U.jsx)(`img`,{src:`/logo.svg`,alt:``,className:`h-12 w-12`}),(0,U.jsx)(`h1`,{className:`text-xl font-semibold`,style:{fontFamily:`Manrope, sans-serif`},children:e(`common.offlineTitle`)}),(0,U.jsx)(`p`,{className:`max-w-sm text-sm text-[var(--c-text-muted)]`,children:e(`common.offlineText`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void t(),className:`btn-primary`,children:e(`common.retry`)})]})}var cu=[],lu=1,uu=new Set,du=()=>uu.forEach(e=>e());function fu(e){return uu.add(e),()=>uu.delete(e)}function pu(){return cu}function mu(e){cu=cu.filter(t=>t.id!==e),du()}function hu(e,t){let n=lu++;cu=[...cu.slice(-2),{id:n,type:e,message:t}],du(),window.setTimeout(()=>mu(n),e===`error`?7e3:4e3)}var q={success:e=>hu(`success`,e),error:e=>hu(`error`,e),info:e=>hu(`info`,e)};function gu(){let{t:e}=R(),t=(0,_.useSyncExternalStore)(fu,pu);return(0,U.jsx)(`div`,{"aria-live":`polite`,className:`pointer-events-none fixed inset-x-0 bottom-[calc(6.5rem+env(safe-area-inset-bottom,0px))] z-[60] flex flex-col items-center gap-2 px-4 md:bottom-6`,children:t.map(t=>(0,U.jsxs)(`div`,{role:t.type===`error`?`alert`:`status`,className:`card animate-fade-in pointer-events-auto flex w-full max-w-md items-start gap-3 px-4 py-3 text-sm`,style:{boxShadow:`0 16px 40px -12px rgba(0, 0, 0, 0.35)`},children:[(0,U.jsx)(`span`,{className:`mt-0.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full text-white ${t.type===`error`?`bg-[var(--c-danger)]`:t.type===`info`?`bg-[var(--c-text-muted)]`:`bg-[var(--c-green3)]`}`,"aria-hidden":`true`,children:(0,U.jsx)(`svg`,{className:`h-3 w-3`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`3`,strokeLinecap:`round`,strokeLinejoin:`round`,children:t.type===`error`?(0,U.jsx)(`path`,{d:`M12 7v6M12 17h.01`}):t.type===`info`?(0,U.jsx)(`path`,{d:`M12 7h.01M12 11v6`}):(0,U.jsx)(`path`,{d:`m5 12 5 5 9-10`})})}),(0,U.jsx)(`p`,{className:`min-w-0 flex-1 text-[var(--c-text)]`,children:t.message}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>mu(t.id),"aria-label":e(`common.close`),className:`-mr-1 shrink-0 rounded p-0.5 text-[var(--c-text-muted)] hover:text-[var(--c-text)] cursor-pointer`,children:(0,U.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})})})]},t.id))})}var _u=[.75,1,1.25,1.5,2],vu=[null,15,30,60];function yu(){let{t:e}=R(),t=vo(),[n,r]=(0,_.useState)(!1),i=t.currentItem;if(!i)return null;let a=t.duration>0?t.duration:i.enclosure_duration_seconds??0,o=a>0?Math.min(100,Math.max(0,t.currentTime/a*100)):0;return(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{role:`region`,"aria-label":e(`player.nowPlaying`),className:`fixed bottom-[78px] md:bottom-4 left-3 right-3 md:left-auto md:right-6 md:w-[420px] z-40 rounded-2xl border border-[var(--c-border)] bg-[var(--c-surface)]/95 backdrop-blur-md shadow-xl overflow-hidden`,children:[(0,U.jsx)(`div`,{className:`h-0.5 w-full bg-[var(--c-border)]`,children:(0,U.jsx)(`div`,{className:`h-full bg-[var(--c-blue3)] transition-all duration-200`,style:{width:`${o}%`}})}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-3.5 py-2.5`,children:[(0,U.jsxs)(`button`,{type:`button`,onClick:()=>r(!0),className:`flex min-w-0 flex-1 items-center gap-3 text-left cursor-pointer`,children:[i.image_url?(0,U.jsx)(`img`,{src:i.image_url,alt:``,className:`h-10 w-10 rounded-lg object-cover shrink-0 border border-[var(--c-border)]`}):(0,U.jsx)(`div`,{className:`h-10 w-10 rounded-lg bg-[var(--c-surface-hover)] border border-[var(--c-border)] flex items-center justify-center shrink-0 text-[var(--c-text-muted)]`,children:(0,U.jsxs)(`svg`,{className:`w-5 h-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`path`,{d:`M3 18v-6a9 9 0 0 1 18 0v6`}),(0,U.jsx)(`path`,{d:`M21 19a2 2 0 0 1-2 2h-1a2 2 0 0 1-2-2v-3a2 2 0 0 1 2-2h3zM3 19a2 2 0 0 0 2 2h1a2 2 0 0 0 2-2v-3a2 2 0 0 0-2-2H3z`})]})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`div`,{className:`truncate text-sm font-semibold text-[var(--c-text)]`,children:i.title}),(0,U.jsxs)(`div`,{className:`truncate text-xs text-[var(--c-text-muted)]`,children:[i.feed_title??``,a>0?` · ${tl(t.currentTime)} / ${tl(a)}`:``]})]})]}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>t.skip(-15),"aria-label":e(`player.back15`),className:`hidden sm:flex h-8 w-8 items-center justify-center rounded-full text-xs font-semibold text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,children:`-15`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>t.togglePlay(),"aria-label":t.isPlaying?e(`player.pause`):e(`player.play`),className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-full bg-[var(--c-blue3)] text-white hover:opacity-90 cursor-pointer`,children:t.isPlaying?(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,U.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,U.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}):(0,U.jsx)(`svg`,{className:`w-4 h-4 translate-x-0.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,U.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>t.stop(),"aria-label":e(`common.close`),className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-full text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,children:(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,U.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,U.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})]}),n&&(0,U.jsx)(`div`,{className:`fixed inset-0 z-50 flex items-end sm:items-center justify-center bg-black/60 backdrop-blur-xs p-0 sm:p-4`,onClick:()=>r(!1),children:(0,U.jsxs)(`div`,{className:`w-full sm:max-w-md rounded-t-2xl sm:rounded-2xl border border-[var(--c-border)] bg-[var(--c-surface)] p-5 shadow-2xl max-h-[90vh] overflow-y-auto`,onClick:e=>e.stopPropagation(),children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between mb-4`,children:[(0,U.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-[0.08em] text-[var(--c-text-muted)]`,children:e(`player.nowPlaying`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(!1),"aria-label":e(`common.close`),className:`h-8 w-8 rounded-full flex items-center justify-center text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] cursor-pointer`,children:(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,children:[(0,U.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,U.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]}),i.image_url&&(0,U.jsx)(`div`,{className:`mb-4 flex justify-center`,children:(0,U.jsx)(`img`,{src:i.image_url,alt:``,className:`w-48 h-48 rounded-2xl object-cover border border-[var(--c-border)] shadow-md`})}),(0,U.jsx)(`h2`,{className:`text-lg font-bold text-[var(--c-text)] leading-snug text-center mb-1`,children:i.title}),(0,U.jsx)(`p`,{className:`text-sm text-[var(--c-text-muted)] text-center mb-5`,children:i.feed_title}),a>0&&(0,U.jsxs)(`div`,{className:`mb-4`,children:[(0,U.jsx)(`input`,{type:`range`,min:0,max:a,value:Math.min(t.currentTime,a),onChange:e=>t.seek(Number(e.target.value)),className:`w-full accent-[var(--c-blue3)] cursor-pointer`}),(0,U.jsxs)(`div`,{className:`flex justify-between text-xs font-mono text-[var(--c-text-muted)] mt-1`,children:[(0,U.jsx)(`span`,{children:tl(t.currentTime)}),(0,U.jsx)(`span`,{children:tl(a)})]})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-center gap-6 mb-5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>t.skip(-15),className:`px-3 py-1.5 rounded-lg text-sm font-semibold text-[var(--c-text)] hover:bg-[var(--c-surface-hover)] cursor-pointer`,children:`-15s`}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>t.togglePlay(),className:`flex h-12 w-12 items-center justify-center rounded-full bg-[var(--c-blue3)] text-white hover:opacity-90 cursor-pointer`,children:t.isPlaying?(0,U.jsxs)(`svg`,{className:`w-5 h-5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,U.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,U.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}):(0,U.jsx)(`svg`,{className:`w-5 h-5 translate-x-0.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,U.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>t.skip(30),className:`px-3 py-1.5 rounded-lg text-sm font-semibold text-[var(--c-text)] hover:bg-[var(--c-surface-hover)] cursor-pointer`,children:`+30s`})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-2 border-t border-[var(--c-border)] pt-4 mb-4`,children:[(0,U.jsx)(`div`,{className:`flex items-center gap-1`,children:_u.map(e=>(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t.setRate(e),className:`rounded-md px-2 py-1 text-xs font-semibold cursor-pointer ${t.playbackRate===e?`bg-[var(--c-blue3)] text-white`:`bg-[var(--c-surface-hover)] text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`,children:[e,`x`]},e))}),(0,U.jsx)(`div`,{className:`flex items-center gap-1`,children:vu.map(n=>{let r=n===null?t.sleepRemainingSec===null:t.sleepRemainingSec!==null&&Math.ceil(t.sleepRemainingSec/60)<=n&&Math.ceil(t.sleepRemainingSec/60)>(n===15?0:n===30?15:30);return(0,U.jsx)(`button`,{type:`button`,onClick:()=>t.setSleepTimer(n),className:`rounded-md px-2 py-1 text-xs font-medium cursor-pointer ${r?`bg-[var(--c-blue3)]/20 text-[var(--c-text)] border border-[var(--c-blue3)]/50`:`bg-[var(--c-surface-hover)] text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`,children:n===null?e(`player.sleepOff`):`${n}m`},String(n))})})]}),t.chapters.length>0&&(0,U.jsxs)(`div`,{className:`border-t border-[var(--c-border)] pt-3`,children:[(0,U.jsx)(`div`,{className:`text-xs font-semibold uppercase tracking-[0.06em] text-[var(--c-text-muted)] mb-2`,children:e(`reader.chapters`)}),(0,U.jsx)(`ul`,{className:`max-h-44 overflow-y-auto flex flex-col gap-1`,children:t.chapters.map((e,n)=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`button`,{type:`button`,onClick:()=>t.seek(e.startTime),className:`w-full text-left px-2 py-1.5 rounded-lg text-sm hover:bg-[var(--c-surface-hover)] flex items-center gap-3 cursor-pointer`,children:[(0,U.jsx)(`span`,{className:`font-mono text-xs text-[var(--c-text-muted)] shrink-0`,children:tl(e.startTime)}),(0,U.jsx)(`span`,{className:`truncate text-[var(--c-text)]`,children:e.title})]})},`${e.startTime}-${n}`))})]})]})})]})}function bu(){let{t:e,i18n:t}=R(),n=Cl(El(),t.resolvedLanguage||`en`),r=hr(),[i,a]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=e=>{qc(e.target)||Jc(e)||e.key===`?`&&(e.preventDefault(),a(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]),(0,_.useEffect)(()=>{let e=()=>void Ua(),t=()=>document.visibilityState===`visible`&&e();return e(),window.addEventListener(`online`,e),document.addEventListener(`visibilitychange`,t),()=>{window.removeEventListener(`online`,e),document.removeEventListener(`visibilitychange`,t)}},[]),(0,_.useEffect)(()=>{let e,t=()=>{window.clearTimeout(e),e=window.setTimeout(()=>void io(),800)},n=()=>document.visibilityState===`visible`&&t();t();let r=window.setInterval(t,12e4);window.addEventListener(`online`,t),document.addEventListener(`visibilitychange`,n);let i=so(t);return()=>{window.clearTimeout(e),window.clearInterval(r),window.removeEventListener(`online`,t),document.removeEventListener(`visibilitychange`,n),i()}},[]),(0,_.useEffect)(()=>{r.pathname!==`/items`&&(window.scrollTo({top:0,left:0,behavior:`instant`}),requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:`instant`})}))},[r.pathname]);let o=()=>{r.pathname===`/items`&&(Xa(),window.scrollTo({top:0,left:0,behavior:`smooth`}))},s=n.findIndex(({id:e})=>r.pathname===`/extensions/${e}`),c=s>=0?s:n.length+(r.pathname.startsWith(`/feeds`)?1:r.pathname.startsWith(`/settings`)?2:0);return(0,U.jsxs)(`div`,{className:`min-h-screen flex flex-col`,children:[(0,U.jsx)(`header`,{"data-app-header":!0,className:`sticky top-0 z-30 backdrop-blur-md border-b`,style:{borderColor:`var(--c-border)`,backgroundColor:`color-mix(in srgb, var(--c-surface) 85%, transparent)`,paddingTop:`env(safe-area-inset-top, 0px)`},children:(0,U.jsxs)(`div`,{className:`max-w-5xl mx-auto px-4 py-3 flex items-center justify-between gap-4`,children:[(0,U.jsx)(Ii,{to:`/items`,onClick:o,className:`flex items-center gap-2.5 shrink-0 hover:opacity-85 transition-opacity`,children:(0,U.jsx)(Ml,{size:28})}),(0,U.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,U.jsx)(Pl,{onItemsClick:o,pages:n}),(0,U.jsx)(K,{onOpenShortcuts:()=>a(!0)})]})]})}),(0,U.jsx)(ou,{}),(0,U.jsx)(`main`,{className:`flex-1 max-w-5xl w-full mx-auto px-4 pt-4 pb-24 md:py-6`,children:(0,U.jsx)(`div`,{className:`animate-page-fade`,children:(0,U.jsx)(Gr,{})},r.pathname)}),(0,U.jsx)(gu,{}),(0,U.jsx)(yu,{}),(0,U.jsx)(Il,{isOpen:i,onClose:()=>a(!1)}),(0,U.jsx)(`nav`,{className:`mobile-bottom-nav md:hidden fixed left-3 right-3 max-w-sm mx-auto z-40 pointer-events-auto no-drag select-none`,"aria-label":e(`nav.menu`),children:(0,U.jsxs)(`div`,{className:`relative flex items-center justify-between p-1.5 rounded-full border backdrop-blur-2xl backdrop-saturate-180 transition-all duration-300 no-drag select-none`,style:{backgroundColor:`color-mix(in srgb, var(--c-surface) 80%, transparent)`,borderColor:`var(--c-border)`,borderWidth:`1px`,boxShadow:`0 2px 12px -4px rgba(0, 0, 0, 0.3)`},onContextMenu:e=>e.preventDefault(),children:[(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`absolute top-1.5 bottom-1.5 left-1.5 rounded-full bg-[var(--c-mobile-nav-active)] border border-[var(--c-mobile-nav-active-border)] shadow-sm transition-transform duration-300 ease-[cubic-bezier(0.25,1,0.5,1)] pointer-events-none no-drag`,style:{width:`calc((100% - 0.75rem) / ${3+n.length})`,transform:`translateX(calc(${c} * 100%))`}}),n.map(({id:e,label:t,icon:n})=>(0,U.jsx)(Ii,{to:`/extensions/${e}`,draggable:!1,className:`relative z-10 flex-1 min-w-0 no-drag select-none`,children:({isActive:e})=>(0,U.jsxs)(`span`,{className:`h-[54px] w-full rounded-full flex flex-col items-center justify-center gap-0.5 ${e?`text-[var(--c-text)] font-semibold`:`text-[var(--c-text-muted)] font-medium`}`,children:[(0,U.jsx)(`svg`,{className:`w-5 h-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:n.map(e=>(0,U.jsx)(`path`,{d:e},e))}),(0,U.jsx)(`span`,{className:`text-[11px] leading-tight tracking-tight text-center`,children:t})]})},e)),(0,U.jsx)(Ii,{to:`/items`,onClick:o,draggable:!1,onDragStart:e=>e.preventDefault(),onContextMenu:e=>e.preventDefault(),className:`relative z-10 flex-1 min-w-0 no-drag select-none`,children:({isActive:t})=>(0,U.jsxs)(`div`,{className:`h-[54px] w-full rounded-full flex flex-col items-center justify-center gap-0.5 transition-colors duration-200 cursor-pointer no-drag select-none ${t?`text-[var(--c-text)] font-semibold`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)] font-medium`}`,children:[(0,U.jsx)(`svg`,{className:`w-5 h-5 transition-transform duration-200 pointer-events-none ${t?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`path`,{d:`M4 6h16M4 12h16M4 18h12`})}),(0,U.jsx)(`span`,{className:`text-[11px] leading-tight tracking-tight pointer-events-none select-none`,children:e(`nav.items`)})]})}),(0,U.jsx)(Ii,{to:`/feeds`,draggable:!1,onDragStart:e=>e.preventDefault(),onContextMenu:e=>e.preventDefault(),className:`relative z-10 flex-1 min-w-0 no-drag select-none`,children:({isActive:t})=>(0,U.jsxs)(`div`,{className:`h-[54px] w-full rounded-full flex flex-col items-center justify-center gap-0.5 transition-colors duration-200 cursor-pointer no-drag select-none ${t?`text-[var(--c-text)] font-semibold`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)] font-medium`}`,children:[(0,U.jsxs)(`svg`,{className:`w-5 h-5 transition-transform duration-200 pointer-events-none ${t?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`path`,{d:`M4 11a9 9 0 0 1 9 9`}),(0,U.jsx)(`path`,{d:`M4 4a16 16 0 0 1 16 16`}),(0,U.jsx)(`circle`,{cx:`5`,cy:`19`,r:`1`})]}),(0,U.jsx)(`span`,{className:`text-[11px] leading-tight tracking-tight pointer-events-none select-none`,children:e(`nav.feeds`)})]})}),(0,U.jsx)(Ii,{to:`/settings`,draggable:!1,onDragStart:e=>e.preventDefault(),onContextMenu:e=>e.preventDefault(),className:`relative z-10 flex-1 min-w-0 no-drag select-none`,children:({isActive:t})=>(0,U.jsxs)(`div`,{className:`h-[54px] w-full rounded-full flex flex-col items-center justify-center gap-0.5 transition-colors duration-200 cursor-pointer no-drag select-none ${t?`text-[var(--c-text)] font-semibold`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)] font-medium`}`,children:[(0,U.jsxs)(`svg`,{className:`w-5 h-5 transition-transform duration-200 pointer-events-none ${t?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`3`}),(0,U.jsx)(`path`,{d:`M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z`})]}),(0,U.jsx)(`span`,{className:`text-[11px] leading-tight tracking-tight pointer-events-none select-none`,children:e(`nav.settings`)})]})})]})})]})}function xu(){let{t:e}=R(),{refresh:t}=mo(),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(``),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(null),[u,d]=(0,_.useState)(!1);async function f(r){r.preventDefault(),d(!0),l(null);try{await H.onboard({email:n,password:o,displayName:i}),await t()}catch{l(e(`common.error`))}finally{d(!1)}}return(0,U.jsx)(`div`,{className:`min-h-screen flex items-center justify-center px-4`,children:(0,U.jsxs)(`div`,{className:`card p-8 w-full max-w-md`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col items-center mb-6 text-center`,children:[(0,U.jsx)(`h1`,{className:`mb-3`,children:(0,U.jsx)(Ml,{size:44})}),(0,U.jsx)(`p`,{className:`text-sm mt-1`,style:{color:`var(--c-text-muted)`},children:e(`onboarding.subtitle`)})]}),(0,U.jsxs)(`form`,{onSubmit:f,className:`flex flex-col gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{className:`text-sm font-medium block mb-1`,children:e(`onboarding.emailLabel`)}),(0,U.jsx)(`input`,{type:`email`,required:!0,className:`input`,value:n,onChange:e=>r(e.target.value)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{className:`text-sm font-medium block mb-1`,children:e(`onboarding.displayNameLabel`)}),(0,U.jsx)(`input`,{type:`text`,required:!0,className:`input`,value:i,onChange:e=>a(e.target.value)})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{className:`text-sm font-medium block mb-1`,children:e(`onboarding.passwordLabel`)}),(0,U.jsx)(`input`,{type:`password`,required:!0,minLength:10,className:`input`,value:o,onChange:e=>s(e.target.value)}),(0,U.jsx)(`p`,{className:`text-xs mt-1`,style:{color:`var(--c-text-muted)`},children:e(`onboarding.passwordHint`)})]}),c&&(0,U.jsx)(`p`,{className:`text-sm text-danger`,children:c}),(0,U.jsx)(`button`,{type:`submit`,disabled:u,className:`btn-primary`,children:e(`onboarding.submit`)})]}),(0,U.jsxs)(`div`,{className:`mt-6 pt-4 border-t text-sm`,style:{borderColor:`var(--c-border)`},children:[(0,U.jsx)(`p`,{className:`font-medium`,children:e(`onboarding.orUseCli`)}),(0,U.jsx)(`p`,{style:{color:`var(--c-text-muted)`},children:e(`onboarding.cliHint`)})]})]})})}function Su(e){let t=new Uint8Array(e),n=``;for(let e of t)n+=String.fromCharCode(e);return btoa(n).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=/g,``)}function Cu(e){let t=e.replace(/-/g,`+`).replace(/_/g,`/`),n=(4-t.length%4)%4,r=t.padEnd(t.length+n,`=`),i=atob(r),a=new ArrayBuffer(i.length),o=new Uint8Array(a);for(let e=0;e<i.length;e++)o[e]=i.charCodeAt(e);return a}function wu(){return Tu.stubThis(globalThis?.PublicKeyCredential!==void 0&&typeof globalThis.PublicKeyCredential==`function`)}var Tu={stubThis:e=>e};function Eu(e){let{id:t}=e;return{...e,id:Cu(t),transports:e.transports,type:e.type}}function Du(e){return e===`localhost`||/^((xn--[a-z0-9-]+|[a-z0-9]+(-[a-z0-9]+)*)\.)+([a-z]{2,}|xn--[a-z0-9-]+)$/i.test(e)}var Ou=class extends Error{constructor({message:e,code:t,cause:n,name:r}){super(e,{cause:n}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=r??n.name,this.code=t}};function ku({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Ou({message:`Registration ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`ConstraintError`){if(n.authenticatorSelection?.requireResidentKey===!0)return new Ou({message:`Discoverable credentials were required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_DISCOVERABLE_CREDENTIAL_SUPPORT`,cause:e});if(t.mediation===`conditional`&&n.authenticatorSelection?.userVerification===`required`)return new Ou({message:`User verification was required during automatic registration but it could not be performed`,code:`ERROR_AUTO_REGISTER_USER_VERIFICATION_FAILURE`,cause:e});if(n.authenticatorSelection?.userVerification===`required`)return new Ou({message:`User verification was required but no available authenticator supported it`,code:`ERROR_AUTHENTICATOR_MISSING_USER_VERIFICATION_SUPPORT`,cause:e})}else if(e.name===`InvalidStateError`)return new Ou({message:`The authenticator was previously registered`,code:`ERROR_AUTHENTICATOR_PREVIOUSLY_REGISTERED`,cause:e});else if(e.name===`NotAllowedError`)return new Ou({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`NotSupportedError`)return n.pubKeyCredParams.filter(e=>e.type===`public-key`).length===0?new Ou({message:`No entry in pubKeyCredParams was of type "public-key"`,code:`ERROR_MALFORMED_PUBKEYCREDPARAMS`,cause:e}):new Ou({message:`No available authenticator supported any of the specified pubKeyCredParams algorithms`,code:`ERROR_AUTHENTICATOR_NO_SUPPORTED_PUBKEYCREDPARAMS_ALG`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Du(t))return new Ou({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rp.id!==t)return new Ou({message:`The RP ID "${n.rp.id}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`TypeError`){if(n.user.id.byteLength<1||n.user.id.byteLength>64)return new Ou({message:`User ID was not between 1 and 64 characters`,code:`ERROR_INVALID_USER_ID_LENGTH`,cause:e})}else if(e.name===`UnknownError`)return new Ou({message:`The authenticator was unable to process the specified options, or could not create a new credential`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}var Au=new class{constructor(){Object.defineProperty(this,"controller",{enumerable:!0,configurable:!0,writable:!0,value:void 0})}createNewAbortSignal(){if(this.controller){let e=Error(`Cancelling existing WebAuthn API call for new one`);e.name=`AbortError`,this.controller.abort(e)}let e=new AbortController;return this.controller=e,e.signal}cancelCeremony(){if(this.controller){let e=Error(`Manually cancelling existing WebAuthn API call`);e.name=`AbortError`,this.controller.abort(e),this.controller=void 0}}},ju=[`cross-platform`,`platform`];function Mu(e){if(e&&!(ju.indexOf(e)<0))return e}async function Nu(e){!e.optionsJSON&&e.challenge&&(console.warn(`startRegistration() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useAutoRegister:n=!1}=e;if(!wu())throw Error(`WebAuthn is not supported in this browser`);let r={...t,challenge:Cu(t.challenge),user:{...t.user,id:Cu(t.user.id)},excludeCredentials:t.excludeCredentials?.map(Eu)},i={};n&&(i.mediation=`conditional`),i.publicKey=r,i.signal=Au.createNewAbortSignal();let a;try{a=await navigator.credentials.create(i)}catch(e){throw ku({error:e,options:i})}if(!a)throw Error(`Registration was not completed`);let{id:o,rawId:s,response:c,type:l}=a,u;typeof c.getTransports==`function`&&(u=c.getTransports());let d;if(typeof c.getPublicKeyAlgorithm==`function`)try{d=c.getPublicKeyAlgorithm()}catch(e){Pu(`getPublicKeyAlgorithm()`,e)}let f;if(typeof c.getPublicKey==`function`)try{let e=c.getPublicKey();e!==null&&(f=Su(e))}catch(e){Pu(`getPublicKey()`,e)}let p;if(typeof c.getAuthenticatorData==`function`)try{p=Su(c.getAuthenticatorData())}catch(e){Pu(`getAuthenticatorData()`,e)}return{id:o,rawId:Su(s),response:{attestationObject:Su(c.attestationObject),clientDataJSON:Su(c.clientDataJSON),transports:u,publicKeyAlgorithm:d,publicKey:f,authenticatorData:p},type:l,clientExtensionResults:a.getClientExtensionResults(),authenticatorAttachment:Mu(a.authenticatorAttachment)}}function Pu(e,t){console.warn(`The browser extension that intercepted this WebAuthn API call incorrectly implemented ${e}. You should report this error to them.\n`,t)}function Fu(){if(!wu())return Iu.stubThis(new Promise(e=>e(!1)));let e=globalThis.PublicKeyCredential;return e?.isConditionalMediationAvailable===void 0?Iu.stubThis(new Promise(e=>e(!1))):Iu.stubThis(e.isConditionalMediationAvailable())}var Iu={stubThis:e=>e};function Lu({error:e,options:t}){let{publicKey:n}=t;if(!n)throw Error(`options was missing required publicKey property`);if(e.name===`AbortError`){if(t.signal instanceof AbortSignal)return new Ou({message:`Authentication ceremony was sent an abort signal`,code:`ERROR_CEREMONY_ABORTED`,cause:e})}else if(e.name===`NotAllowedError`)return new Ou({message:e.message,code:`ERROR_PASSTHROUGH_SEE_CAUSE_PROPERTY`,cause:e});else if(e.name===`SecurityError`){let t=globalThis.location.hostname;if(!Du(t))return new Ou({message:`${globalThis.location.hostname} is an invalid domain`,code:`ERROR_INVALID_DOMAIN`,cause:e});if(n.rpId!==t)return new Ou({message:`The RP ID "${n.rpId}" is invalid for this domain`,code:`ERROR_INVALID_RP_ID`,cause:e})}else if(e.name===`UnknownError`)return new Ou({message:`The authenticator was unable to process the specified options, or could not create a new assertion signature`,code:`ERROR_AUTHENTICATOR_GENERAL_ERROR`,cause:e});return e}async function Ru(e){!e.optionsJSON&&e.challenge&&(console.warn(`startAuthentication() was not called correctly. It will try to continue with the provided options, but this call should be refactored to use the expected call structure instead. See https://simplewebauthn.dev/docs/packages/browser#typeerror-cannot-read-properties-of-undefined-reading-challenge for more information.`),e={optionsJSON:e});let{optionsJSON:t,useBrowserAutofill:n=!1,verifyBrowserAutofillInput:r=!0}=e;if(!wu())throw Error(`WebAuthn is not supported in this browser`);let i;t.allowCredentials?.length!==0&&(i=t.allowCredentials?.map(Eu));let a={...t,challenge:Cu(t.challenge),allowCredentials:i},o={};if(n){if(!await Fu())throw Error(`Browser does not support WebAuthn autofill`);if(document.querySelectorAll(`input[autocomplete$='webauthn']`).length<1&&r)throw Error('No <input> with "webauthn" as the only or last value in its `autocomplete` attribute was detected');o.mediation=`conditional`,a.allowCredentials=[]}o.publicKey=a,o.signal=Au.createNewAbortSignal();let s;try{s=await navigator.credentials.get(o)}catch(e){throw Lu({error:e,options:o})}if(!s)throw Error(`Authentication was not completed`);let{id:c,rawId:l,response:u,type:d}=s,f;return u.userHandle&&(f=Su(u.userHandle)),{id:c,rawId:Su(l),response:{authenticatorData:Su(u.authenticatorData),clientDataJSON:Su(u.clientDataJSON),signature:Su(u.signature),userHandle:f},type:d,clientExtensionResults:s.getClientExtensionResults(),authenticatorAttachment:Mu(s.authenticatorAttachment)}}async function zu(e,t,n=`POST`,r){let i=await fetch(`/api/auth/security${e}`,{method:n,signal:r,credentials:`same-origin`,headers:{"Content-Type":`application/json`},...t===void 0?{}:{body:JSON.stringify(t)}}),a=i.status===204?void 0:await i.json();if(!i.ok)throw new Sa(i.status,a.error,a);return a}async function Bu(){let e=await zu(`/reauth/passkey/options`,{}),t=await Ru({optionsJSON:e.publicKey});return(await zu(`/reauth/passkey/verify`,{challengeId:e.challengeId,credential:t})).reauthToken}async function Vu(e,t){let n=await zu(`/passkeys/register/options`,{reauthToken:e}),r=await Nu({optionsJSON:n.publicKey});await zu(`/passkeys/register/verify`,{challengeId:n.challengeId,credential:r,name:t})}function Hu(e){let t,n;function r(){t?.abort(),t=void 0,clearTimeout(n)}async function i(a=!0){if(t&&a)return;r();let o=new AbortController,{signal:s}=o;t=o;let c=!1;try{if(a){let t=await window.PublicKeyCredential?.isConditionalMediationAvailable?.().catch(()=>!1)??!1;if(s.aborted||(e.onAutofill(t),!t))return}let t=await zu(`/passkeys/options`,{},`POST`,s);if(s.aborted)return;a&&(n=setTimeout(()=>{r(),i()},24e4));let o=await navigator.credentials.get({signal:s,...a?{mediation:`conditional`}:{},publicKey:{...t.publicKey,extensions:t.publicKey.extensions,challenge:Cu(t.publicKey.challenge),allowCredentials:a?[]:t.publicKey.allowCredentials?.map(e=>({type:`public-key`,id:Cu(e.id),transports:e.transports}))}});if(s.aborted||!o)return;clearTimeout(n),c=!0,e.onSelect();let l=o.response,u={id:o.id,rawId:Su(o.rawId),type:o.type,clientExtensionResults:o.getClientExtensionResults(),response:{clientDataJSON:Su(l.clientDataJSON),authenticatorData:Su(l.authenticatorData),signature:Su(l.signature),userHandle:l.userHandle?Su(l.userHandle):null}};await zu(`/passkeys/verify`,{challengeId:t.challengeId,credential:u},`POST`,s),s.aborted||await e.onSuccess()}catch(t){s.aborted||(c||!a?e.onError(t):t instanceof Error&&t.name===`NotAllowedError`||e.onAutofill(!1))}finally{t===o&&(clearTimeout(n),t=void 0)}}return{start:i,stop:r}}function Uu({name:e,mount:t}){let n=(0,_.useRef)(null),r=R().i18n.resolvedLanguage;return(0,_.useEffect)(()=>{let r=n.current;if(!r)return;let i;try{i=t(r)}catch(t){console.error(`[extensions] "${e}" failed to open`,t)}return()=>{try{typeof i==`function`&&i()}catch(t){console.error(`[extensions] "${e}" failed to close`,t)}r.replaceChildren()}},[e,r]),(0,U.jsx)(`div`,{ref:n,className:`min-w-0`})}function Wu(){let{t:e}=R(),{refresh:t}=mo(),[n,r]=(0,_.useState)(``),[i,a]=(0,_.useState)(),[o,s]=(0,_.useState)(``),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(),f=(0,_.useRef)(void 0),[p,m]=(0,_.useState)(``),[h,g]=(0,_.useState)(null),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(!0),[S,C]=(0,_.useState)(`https://github.com/visualfusion/feedkeeper`),[w,T]=(0,_.useState)(null),E=gl(El()),D=E?.mount,O=(0,_.useEffectEvent)(async()=>{await j(),y(!1)}),k=(0,_.useEffectEvent)(()=>{g(e(`login.error`)),y(!1)});(0,_.useEffect)(()=>{if(!c||i||D)return;let e=Hu({onAutofill:d,onSelect:()=>{y(!0),g(null)},onSuccess:O,onError:k});f.current=e,e.start();let t=()=>{e.start()},n=()=>{e.stop(),y(!1)};return window.addEventListener(`pagehide`,n),window.addEventListener(`pageshow`,t),()=>{e.stop(),f.current=void 0,window.removeEventListener(`pagehide`,n),window.removeEventListener(`pageshow`,t)}},[c,i,D]),(0,_.useEffect)(()=>{zu(`/config`,void 0,`GET`).then(e=>l(e.passkeys)).catch(()=>{}),H.getConfig().then(e=>{e&&(x(e.showGithubLink),e.githubUrl&&C(e.githubUrl),e.loginSubtitle&&T(e.loginSubtitle))}).catch(()=>{})},[]);async function A(t){if(t.preventDefault(),!v){f.current?.stop(),y(!0),g(null);try{i?await zu(`/mfa`,{challengeId:i,code:o}):await H.login(n,p),await j()}catch(t){t instanceof Sa&&t.code===`mfa_required`?(a(t.data.challengeId),m(``)):(g(e(`login.error`)),f.current?.start())}finally{y(!1)}}}async function j(){let e=new URLSearchParams(window.location.search).get(`next`);e?.startsWith(`/oauth/authorize?`)?window.location.assign(e):await t()}return(0,U.jsxs)(`div`,{className:`min-h-screen flex flex-col items-center justify-center px-4`,children:[(0,U.jsxs)(`div`,{className:`card p-8 w-full max-w-sm`,children:[(0,U.jsxs)(`div`,{className:`flex flex-col items-center mb-6 text-center`,children:[(0,U.jsx)(`h1`,{className:`mb-3`,children:(0,U.jsx)(Ml,{size:44})}),(0,U.jsx)(`p`,{className:`text-xs mt-1`,style:{color:`var(--c-text-muted)`},children:w??e(`login.subtitle`)})]}),E?(0,U.jsx)(Uu,{name:`login-form`,mount:E.mount}):(0,U.jsxs)(`form`,{onSubmit:A,className:`flex flex-col gap-4`,children:[!i&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:`login-email`,className:`text-sm font-medium block mb-1`,children:e(`login.emailLabel`)}),(0,U.jsx)(`input`,{id:`login-email`,name:`username`,type:`email`,autoComplete:`username webauthn`,required:!0,autoFocus:!0,className:`input`,value:n,onChange:e=>r(e.target.value),onFocus:()=>{v||f.current?.start()}})]}),(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`label`,{htmlFor:`login-password`,className:`text-sm font-medium block mb-1`,children:e(`login.passwordLabel`)}),(0,U.jsx)(`input`,{type:`password`,id:`login-password`,name:`password`,autoComplete:`current-password`,required:!0,className:`input`,value:p,onChange:e=>m(e.target.value)})]})]}),i&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`label`,{htmlFor:`mfa-code`,children:e(`security.code`)}),(0,U.jsx)(`input`,{id:`mfa-code`,className:`input`,autoFocus:!0,autoComplete:`one-time-code`,value:o,onChange:e=>s(e.target.value),required:!0}),(0,U.jsx)(`button`,{type:`button`,className:`btn-secondary`,onClick:()=>{a(void 0),s(``)},children:e(`security.cancel`)})]}),c&&!i&&u===!1&&(0,U.jsx)(`button`,{type:`button`,className:`text-sm underline`,disabled:v,onClick:()=>void f.current?.start(!1),children:e(`security.signInPasskey`)}),h&&(0,U.jsx)(`p`,{className:`text-sm text-danger`,children:h}),(0,U.jsx)(`button`,{type:`submit`,disabled:v,className:`btn-primary`,children:e(`login.submit`)})]})]}),(0,U.jsx)(tu,{placement:`login`}),b&&(0,U.jsx)(`div`,{className:`mt-4 text-center`,children:(0,U.jsxs)(`a`,{href:S,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex items-center gap-1.5 text-xs text-[var(--c-text-muted)] hover:text-[var(--c-text)] transition-colors opacity-80 hover:opacity-100`,children:[(0,U.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,U.jsx)(`path`,{fillRule:`evenodd`,clipRule:`evenodd`,d:`M12 2C6.477 2 2 6.484 2 12.017c0 4.425 2.865 8.18 6.839 9.504.5.092.682-.217.682-.483 0-.237-.008-.868-.013-1.703-2.782.605-3.369-1.343-3.369-1.343-.454-1.158-1.11-1.466-1.11-1.466-.908-.62.069-.608.069-.608 1.003.07 1.53 1.032 1.53 1.032.892 1.53 2.341 1.088 2.91.832.092-.647.35-1.088.636-1.338-2.22-.253-4.555-1.113-4.555-4.951 0-1.093.39-1.988 1.029-2.688-.103-.253-.446-1.272.098-2.65 0 0 .84-.27 2.75 1.026A9.564 9.564 0 0112 6.844c.85.004 1.705.115 2.504.337 1.909-1.296 2.747-1.027 2.747-1.027.546 1.379.202 2.398.1 2.651.64.7 1.028 1.595 1.028 2.688 0 3.848-2.339 4.695-4.566 4.943.359.309.678.92.678 1.855 0 1.338-.012 2.419-.012 2.747 0 .268.18.58.688.482A10.019 10.019 0 0022 12.017C22 6.484 17.522 2 12 2z`})}),(0,U.jsx)(`span`,{children:e(`login.viewOnGithub`)})]})})]})}function Gu({className:e=``,size:t=`md`,center:n=!0}){let{t:r}=R(),i=(0,U.jsx)(`div`,{className:`rounded-full animate-spin border-[var(--c-border)] border-t-[var(--c-blue1)] dark:border-t-white/80 ${{sm:`w-5 h-5 border-2`,md:`w-8 h-8 border-[2.5px]`,lg:`w-10 h-10 border-3`}[t]} ${e}`,role:`status`,"aria-label":r(`common.loading`)});return n?(0,U.jsx)(`div`,{className:`flex-1 flex flex-col items-center justify-center min-h-[45vh] w-full py-12 animate-fade-in`,children:i}):i}function Ku({label:e,items:t,className:n=``}){let[r,i]=(0,_.useState)(!1),[a,o]=(0,_.useState)(!1),s=(0,_.useRef)(null),c=(0,_.useRef)(null),l=(0,_.useId)();return(0,_.useLayoutEffect)(()=>{if(!r||!c.current)return;let e=c.current.getBoundingClientRect();o(window.innerHeight-e.bottom<48*t.length+24)},[r,t.length]),(0,_.useEffect)(()=>{if(!r)return;let e=e=>{s.current?.contains(e.target)||i(!1)},t=e=>{e.key===`Escape`&&(i(!1),c.current?.focus())};return document.addEventListener(`pointerdown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`pointerdown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,U.jsxs)(`div`,{ref:s,className:`relative ${n}`,children:[(0,U.jsx)(`button`,{ref:c,type:`button`,onClick:e=>{e.stopPropagation(),i(e=>!e)},"aria-label":e,title:e,"aria-expanded":r,"aria-controls":l,className:`flex h-9 w-9 items-center justify-center rounded-lg text-[var(--c-text-muted)] transition-colors hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] cursor-pointer ${r?`bg-[var(--c-surface-hover)] text-[var(--c-text)]`:``}`,children:(0,U.jsxs)(`svg`,{className:`h-5 w-5`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`5`,cy:`12`,r:`1.8`}),(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`1.8`}),(0,U.jsx)(`circle`,{cx:`19`,cy:`12`,r:`1.8`})]})}),r&&(0,U.jsx)(`div`,{id:l,className:`card animate-fade-in absolute right-0 z-40 w-64 p-1.5 ${a?`bottom-full mb-2`:`top-full mt-2`}`,style:{boxShadow:`0 16px 40px -12px rgba(0, 0, 0, 0.35)`},children:t.map(e=>(0,U.jsxs)(`button`,{type:`button`,disabled:e.disabled,onClick:t=>{t.stopPropagation(),i(!1),e.onSelect()},className:`flex w-full items-center gap-3 rounded-lg px-3 py-2 text-left text-sm font-medium transition-colors disabled:opacity-50 cursor-pointer disabled:cursor-default ${e.danger?`text-[var(--c-danger)] hover:bg-[var(--c-danger-bg)]`:`text-[var(--c-text)] hover:bg-[var(--c-surface-hover)]`}`,children:[e.icon&&(0,U.jsx)(`span`,{className:`flex h-4 w-4 shrink-0 items-center justify-center ${e.danger?``:`text-[var(--c-text-muted)]`}`,children:e.icon}),e.label]},e.label))})]})}function qu(){let{user:e}=mo(),t=e?.capabilities;return{syncAllowed:!t||t.features.sync===!0,manageUrl:t?.manageUrl??null}}function Ju({value:e,onChange:t,options:n,placeholder:r,className:i=``,size:a=`md`,disabled:o=!1,ariaLabel:s}){let{t:c}=R(),[l,u]=(0,_.useState)(!1),[d,f]=(0,_.useState)(-1),p=(0,_.useRef)(null),m=(0,_.useRef)(null),h=(0,_.useId)(),g=n.find(t=>t.value===e);(0,_.useEffect)(()=>{function e(e){p.current&&!p.current.contains(e.target)&&u(!1)}if(l)return document.addEventListener(`pointerdown`,e),()=>document.removeEventListener(`pointerdown`,e)},[l]),(0,_.useEffect)(()=>{if(l){let t=n.findIndex(t=>t.value===e);f(t>=0?t:0)}},[l,e,n]),(0,_.useEffect)(()=>{if(l&&d>=0&&m.current){let e=m.current.querySelector(`[data-index="${d}"]`);e&&e.scrollIntoView({block:`nearest`})}},[d,l]);function v(e){o||(l?e.key===`Escape`?(e.preventDefault(),u(!1)):e.key===`ArrowDown`?(e.preventDefault(),f(e=>e<n.length-1?e+1:0)):e.key===`ArrowUp`?(e.preventDefault(),f(e=>e>0?e-1:n.length-1)):e.key===`Home`?(e.preventDefault(),f(0)):e.key===`End`?(e.preventDefault(),f(n.length-1)):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),d>=0&&d<n.length&&(t(n[d].value),u(!1))):(e.key===`ArrowDown`||e.key===`ArrowUp`||e.key===`Enter`||e.key===` `)&&(e.preventDefault(),u(!0)))}let y=[];n.forEach((e,t)=>{let n=e.group??null,r=y.find(e=>e.groupName===n);r||(r={groupName:n,items:[]},y.push(r)),r.items.push({opt:e,index:t})});let b=a===`sm`;return(0,U.jsxs)(`div`,{ref:p,className:`relative inline-block ${i}`,onKeyDown:v,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||u(!1)},children:[(0,U.jsxs)(`button`,{type:`button`,id:h,role:`combobox`,"aria-label":s,"aria-haspopup":`listbox`,"aria-expanded":l,"aria-controls":l?`${h}-listbox`:void 0,"aria-activedescendant":l&&d>=0?`${h}-option-${d}`:void 0,disabled:o,onClick:()=>!o&&u(e=>!e),className:`w-full flex items-center justify-between gap-2 text-left font-normal transition-colors cursor-pointer select-none rounded-lg border bg-[var(--c-surface)] text-[var(--c-text)] shadow-xs hover:border-[var(--c-blue3)] focus:outline-none focus:border-[var(--c-blue3)] ${l?`border-[var(--c-blue3)]`:`border-[var(--c-border)]`} ${b?`px-2.5 py-1 text-xs min-h-[30px]`:`px-3 py-1.5 text-sm min-h-[38px]`} ${o?`opacity-50 cursor-not-allowed`:``}`,children:[(0,U.jsx)(`span`,{className:`truncate flex items-center gap-1.5`,children:g?(0,U.jsxs)(U.Fragment,{children:[g.icon,(0,U.jsx)(`span`,{className:`truncate`,children:g.label}),g.badge!==void 0&&(0,U.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.2 rounded-full font-medium shrink-0`,style:{backgroundColor:`var(--c-border)`,color:`var(--c-text-muted)`},children:g.badge})]}):(0,U.jsx)(`span`,{style:{color:`var(--c-text-muted)`},children:r??`—`})}),(0,U.jsx)(`svg`,{className:`shrink-0 transition-transform duration-200 opacity-60 ${l?`rotate-180`:``} ${b?`w-3 h-3`:`w-3.5 h-3.5`}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,U.jsx)(`polyline`,{points:`6 9 12 15 18 9`})})]}),l&&(0,U.jsx)(`div`,{className:`absolute left-0 mt-1 w-full min-w-[180px] max-w-xs sm:max-w-none rounded-lg border border-[var(--c-border)] bg-[var(--c-surface)] shadow-lg z-50 overflow-hidden`,style:{backdropFilter:`blur(8px)`},children:(0,U.jsx)(`ul`,{ref:m,id:`${h}-listbox`,role:`listbox`,"aria-labelledby":h,className:`max-h-60 overflow-y-auto py-1 text-[var(--c-text)] focus:outline-none`,children:n.length===0?(0,U.jsx)(`li`,{className:`px-3 py-2 text-xs italic`,style:{color:`var(--c-text-muted)`},children:r??c(`common.noOptions`)}):y.map((n,r)=>(0,U.jsxs)(`li`,{role:`group`,"aria-label":n.groupName??void 0,children:[n.groupName&&(0,U.jsx)(`div`,{className:`px-3 pt-2 pb-1 text-[10px] font-semibold uppercase tracking-wider select-none border-t first:border-t-0`,style:{borderColor:`var(--c-border)`,color:`var(--c-text-muted)`},children:n.groupName}),(0,U.jsx)(`ul`,{role:`presentation`,children:n.items.map(({opt:n,index:r})=>{let i=n.value===e,a=r===d;return(0,U.jsxs)(`li`,{id:`${h}-option-${r}`,"data-index":r,role:`option`,"aria-selected":i,onClick:()=>{t(n.value),u(!1)},onMouseEnter:()=>f(r),className:`flex items-center justify-between gap-2 cursor-pointer select-none transition-colors ${b?`px-2.5 py-1.5 text-xs`:`px-3 py-2 text-sm`} ${a?`bg-[var(--c-border)]/40 text-[var(--c-text)]`:`text-[var(--c-text)]`} ${i?`font-medium bg-[var(--c-blue1)]/10`:``}`,children:[(0,U.jsxs)(`span`,{className:`truncate flex items-center gap-1.5`,children:[n.icon,(0,U.jsx)(`span`,{className:`truncate`,children:n.label}),n.badge!==void 0&&(0,U.jsx)(`span`,{className:`text-[10px] px-1.5 py-0.2 rounded-full font-medium shrink-0`,style:{backgroundColor:`var(--c-border)`,color:`var(--c-text-muted)`},children:n.badge})]}),i&&(0,U.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,style:{color:`var(--c-blue3)`},viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2.5`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`polyline`,{points:`20 6 9 17 4 12`})})]},n.value)})})]},n.groupName??`ungrouped-${r}`))})})]})}function Yu(e){if(!e)return!1;try{let t=new URL(e).hostname.toLowerCase();return t===`reddit.com`||t.endsWith(`.reddit.com`)}catch{return!1}}function Xu(e,t,n){let r=/^feed_http_(\d{3})$/.exec(t);if(r){let t=Number(r[1]);return t===404||t===410?e(`feeds.errors.notFound`,{status:t}):t===401||t===403?e(`feeds.errors.refused`,{status:t}):t===429?Yu(n)?e(`feeds.errors.redditLimited`):e(`feeds.errors.limited`):e(t>=400&&t<500&&t!==408&&t!==425?`feeds.errors.rejected`:`feeds.errors.unavailable`,{status:t})}return t===`feed_timeout`?e(`feeds.errors.timeout`):t===`feed_network_error`?e(`feeds.errors.network`):t===`feed_invalid_or_unavailable`?e(`feeds.errors.invalidFeed`):t}var Zu=[[`day`,864e5],[`hour`,36e5],[`minute`,6e4]];function J(e,t,n=Date.now()){let r=new Intl.RelativeTimeFormat(t,{numeric:`auto`}),i=e.getTime()-n;for(let[e,t]of Zu)if(Math.abs(i)>=t)return r.format(Math.round(i/t),e);return r.format(0,`minute`)}function Y({children:e,className:t=`h-4 w-4`}){return(0,U.jsx)(`svg`,{className:t,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:e})}var X=({className:e})=>(0,U.jsxs)(Y,{className:e,children:[(0,U.jsx)(`path`,{d:`M21 12a9 9 0 1 1-2.64-6.36`}),(0,U.jsx)(`path`,{d:`M21 3v6h-6`})]}),Z=()=>(0,U.jsx)(Y,{children:(0,U.jsx)(`path`,{d:`M2 12l4 4 6-7M10 16l2 0 8-9`})}),Qu=()=>(0,U.jsxs)(Y,{children:[(0,U.jsx)(`path`,{d:`M12 20h9`}),(0,U.jsx)(`path`,{d:`M16.5 3.5a2.12 2.12 0 0 1 3 3L7 19l-4 1 1-4Z`})]}),$u=()=>(0,U.jsx)(Y,{children:(0,U.jsx)(`path`,{d:`M3 6h18M8 6V4h8v2M19 6l-1 14H6L5 6`})}),ed=({className:e})=>(0,U.jsx)(Y,{className:e,children:(0,U.jsx)(`path`,{d:`M12 5v14M5 12h14`})}),td=()=>(0,U.jsxs)(Y,{children:[(0,U.jsx)(`path`,{d:`M12 15V3M7 8l5-5 5 5`}),(0,U.jsx)(`path`,{d:`M5 21h14`})]}),nd=()=>(0,U.jsxs)(Y,{children:[(0,U.jsx)(`path`,{d:`M12 3v12M7 10l5 5 5-5`}),(0,U.jsx)(`path`,{d:`M5 21h14`})]}),rd=()=>(0,U.jsx)(Y,{children:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`})}),id=()=>(0,U.jsxs)(Y,{className:`h-4 w-4`,children:[(0,U.jsx)(`circle`,{cx:`11`,cy:`11`,r:`7`}),(0,U.jsx)(`path`,{d:`m20 20-3.5-3.5`})]}),ad=()=>(0,U.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:[6,12,18].flatMap(e=>[9,15].map(t=>(0,U.jsx)(`circle`,{cx:t,cy:e,r:`1.5`},`${t}-${e}`)))}),od=()=>(0,U.jsx)(Y,{className:`h-5 w-5`,children:(0,U.jsx)(`path`,{d:`M18 6 6 18M6 6l12 12`})}),sd=()=>(0,U.jsxs)(Y,{className:`h-3.5 w-3.5 shrink-0`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`}),(0,U.jsx)(`path`,{d:`M12 8v4M12 16h.01`})]}),cd=({className:e=`h-3.5 w-3.5`})=>(0,U.jsxs)(Y,{className:e,children:[(0,U.jsx)(`path`,{d:`M18 8A6 6 0 0 0 6 8c0 7-3 9-3 9h18s-3-2-3-9`}),(0,U.jsx)(`path`,{d:`M13.73 21a2 2 0 0 1-3.46 0`})]});function ld(e,t){return t<60?e(`feeds.minutesShort`,{count:t}):e(`feeds.hoursShort`,{count:Math.round(t/60)})}function ud(e){try{return e?new URL(e).hostname.replace(/^www\./,``):null}catch{return null}}function dd({feed:e,folderOptions:t,intervalOptions:n,onClose:r,onSaved:i}){let{t:a}=R(),[o,s]=(0,_.useState)(e.label?.trim()||e.title?.trim()||e.url),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(e.folder_id??null),[f,p]=(0,_.useState)(e.poll_interval_minutes),[m,h]=(0,_.useState)(e.kind_override??`auto`),[g,v]=(0,_.useState)(e.full_text_mode!==`never`),[y,b]=(0,_.useState)(),[x,S]=(0,_.useState)(),[C,w]=(0,_.useState)(!1);async function T(){w(!0);try{await H.updateFeed(e.id,{...c?{label:o.trim()||null}:{},folderId:u,pollIntervalMinutes:f,fullTextMode:g?`auto`:`never`,kindOverride:m===`auto`?null:m,...y===void 0?{}:{notify:y},...x===void 0?{}:{badge:x}}),oo(),q.success(a(`feeds.changesSaved`)),r(),await i()}catch{q.error(a(`common.error`))}finally{w(!1)}}return(0,U.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-[var(--c-border)] bg-[var(--c-bg)]/60 px-4 py-4 sm:px-5`,children:[(0,U.jsxs)(`div`,{className:`grid grid-cols-1 gap-3 sm:grid-cols-3`,children:[(0,U.jsxs)(`label`,{className:`flex flex-col gap-1.5 text-xs font-medium text-[var(--c-text-muted)]`,children:[a(`feeds.labelPlaceholder`),(0,U.jsx)(`input`,{type:`text`,className:`input text-sm`,placeholder:e.title??e.url,value:o,onChange:e=>{s(e.target.value),l(!0)}})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs font-medium text-[var(--c-text-muted)]`,children:[a(`feeds.folder`),(0,U.jsx)(Ju,{value:u?String(u):``,onChange:e=>d(e?Number(e):null),options:t,className:`w-full`,placeholder:a(`feeds.noFolder`)})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs font-medium text-[var(--c-text-muted)]`,children:[a(`feeds.interval`),(0,U.jsx)(Ju,{value:String(f),onChange:e=>p(Number(e)),options:n,className:`w-full`})]}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-1.5 text-xs font-medium text-[var(--c-text-muted)]`,children:[a(`feeds.feedKind`),(0,U.jsx)(Ju,{value:m,onChange:h,options:[{value:`auto`,label:a(`feeds.kindAuto`)},{value:`article`,label:a(`feeds.kindArticle`)},{value:`audio`,label:a(`feeds.kindAudio`)},{value:`video`,label:a(`feeds.kindVideo`)}],className:`w-full`})]})]}),(0,U.jsxs)(`label`,{className:`flex cursor-pointer select-none items-start gap-2.5 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 rounded`,checked:g,onChange:e=>v(e.target.checked)}),(0,U.jsxs)(`span`,{children:[a(`feeds.fullText`),(0,U.jsx)(`span`,{className:`mt-0.5 block text-xs text-[var(--c-text-muted)]`,children:e.full_text_blocked_at?a(`feeds.fullTextBlocked`):a(`feeds.fullTextHint`)})]})]}),(0,U.jsxs)(`label`,{className:`flex cursor-pointer select-none items-start gap-2.5 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 rounded`,checked:y??e.notify!==0,onChange:e=>b(e.target.checked)}),(0,U.jsxs)(`span`,{children:[(()=>{let t=m===`auto`?e.detected_kind??`article`:m;return a(t===`audio`?`feeds.notifyAudio`:t===`video`?`feeds.notifyVideo`:`feeds.notify`)})(),(0,U.jsx)(`span`,{className:`mt-0.5 block text-xs text-[var(--c-text-muted)]`,children:a(`feeds.notifyHint`)})]})]}),(0,U.jsxs)(`label`,{className:`flex cursor-pointer select-none items-start gap-2.5 text-sm`,children:[(0,U.jsx)(`input`,{type:`checkbox`,className:`mt-0.5 rounded`,checked:x??e.badge!==0,onChange:e=>S(e.target.checked)}),(0,U.jsxs)(`span`,{children:[a(`feeds.badge`),(0,U.jsx)(`span`,{className:`mt-0.5 block text-xs text-[var(--c-text-muted)]`,children:(()=>{let t=m===`auto`?e.detected_kind??`article`:m;return a(t===`audio`?`feeds.badgeHintAudio`:t===`video`?`feeds.badgeHintVideo`:`feeds.badgeHint`)})()})]})]}),(0,U.jsx)(`p`,{className:`truncate font-mono text-xs text-[var(--c-text-muted)]`,title:e.url,children:e.url}),(0,U.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:r,className:`btn-secondary px-3 py-1.5 text-sm`,children:a(`common.cancel`)}),(0,U.jsx)(`button`,{type:`button`,onClick:T,disabled:C,className:`btn-primary px-4 py-1.5 text-sm`,children:a(`common.save`)})]})]})}function fd({feed:e,editing:t,refreshing:n,highlighted:r=!1,folderOptions:i,intervalOptions:a,onEdit:o,onRefresh:s,onMarkRead:c,onUnsubscribe:l,onSaved:u,drag:d}){let{t:f,i18n:p}=R(),{syncAllowed:m}=qu(),h=e.label??e.title??e.url,g=ud(e.site_url)??ud(e.url),v=(e.site_url?Ic(e.site_url):null)??(g?Ic(`https://${g}`):null),y=!!e.last_error,b=!e.last_polled_at,[x,S]=(0,_.useState)(!1),C=async()=>{if(!x&&e.suggested_url){S(!0);try{await H.acceptFeedMove(e.id),u(),oo()}catch(e){q.error(e instanceof Error?e.message:f(`common.error`))}finally{S(!1)}}},w=[{label:f(n?`feeds.refreshing`:`feeds.refreshFeed`),icon:(0,U.jsx)(X,{className:`h-4 w-4 ${n?`animate-spin`:``}`}),onSelect:s,disabled:n||!m},...e.unread_count>0?[{label:f(`feeds.markAllRead`),icon:(0,U.jsx)(Z,{}),onSelect:c}]:[],{label:f(`feeds.edit`),icon:(0,U.jsx)(Qu,{}),onSelect:()=>o(!t)},{label:f(`feeds.unsubscribe`),icon:(0,U.jsx)($u,{}),onSelect:l,danger:!0}];return(0,U.jsxs)(`li`,{id:`feed-${e.id}`,draggable:!!d&&!t,onDragStart:d?.onDragStart,onDragOver:d?.onDragOver,onDragEnd:d?.onDragEnd,onDrop:d?.onDrop,className:`group/feed relative scroll-mt-28 first:rounded-t-xl last:rounded-b-xl transition-[opacity,background-color] duration-700 ${r?`bg-[var(--c-mobile-nav-active)]`:``} ${d?.isDragging?`opacity-40`:``} ${d?.isDragOver?`shadow-[inset_0_2px_0_var(--c-blue3)]`:``}`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-3 px-4 py-3.5 sm:px-5`,children:[d&&(0,U.jsx)(`span`,{className:`-mr-1 flex shrink-0 cursor-grab touch-none text-[var(--c-text-muted)] opacity-50 transition-opacity hover:opacity-100 group-hover/feed:opacity-80 active:cursor-grabbing`,title:f(`feeds.dragHandle`),"aria-hidden":`true`,children:(0,U.jsx)(ad,{})}),(0,U.jsx)($c,{feedId:e.id,iconUrl:e.icon_url,siteUrl:e.site_url,feedUrl:e.url,fallbackName:h,className:`h-5 w-5 shrink-0 rounded object-contain text-xs leading-none`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex min-w-0 items-center gap-2`,children:[(y||b)&&(0,U.jsx)(`span`,{className:`h-2 w-2 shrink-0 rounded-full ${y?`bg-[var(--c-danger)]`:`bg-[var(--c-text-muted)]`}`,title:y?f(`feeds.statusFailing`,{count:e.consecutive_errors||1}):f(`feeds.statusPending`)}),(0,U.jsx)(Fi,{to:`/items?feed=${e.id}`,draggable:!1,className:`truncate font-semibold text-[var(--c-text)] hover:underline`,children:h}),e.notify!==0&&(0,U.jsx)(`span`,{className:`inline-flex shrink-0 items-center text-[var(--c-text-muted)]`,title:f(`feeds.notifyActive`),"aria-label":f(`feeds.notifyActive`),children:(0,U.jsx)(cd,{className:`h-3.5 w-3.5`})})]}),(0,U.jsxs)(`p`,{className:`mt-0.5 truncate text-xs text-[var(--c-text-muted)]`,children:[g&&v?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`a`,{href:v,target:`_blank`,rel:`nofollow noopener noreferrer`,draggable:!1,className:`hover:text-[var(--c-text)] hover:underline`,children:g}),` · `]}):g?`${g} · `:null,[f(`feeds.everyInterval`,{interval:ld(f,e.poll_interval_minutes)}),e.last_polled_at?f(`feeds.checkedAgo`,{time:J(new Date(e.last_polled_at),p.resolvedLanguage)}):f(`feeds.statusPending`)].join(` · `)]}),y&&(0,U.jsxs)(`p`,{className:`mt-1.5 flex items-start gap-1.5 text-xs text-[var(--c-danger)]`,title:e.last_error??void 0,children:[(0,U.jsx)(sd,{}),(0,U.jsx)(`span`,{className:`line-clamp-2`,children:Xu(f,e.last_error??``,e.url)})]}),e.suggested_url&&m&&(0,U.jsx)(`div`,{className:`mt-1.5 flex items-center gap-2`,children:(0,U.jsx)(`button`,{type:`button`,onClick:()=>void C(),disabled:x,title:e.suggested_url,className:`inline-flex items-center gap-1.5 rounded-md border border-[var(--c-blue3)]/50 bg-[var(--c-blue3)]/10 px-2.5 py-1 text-xs font-medium text-[var(--c-text)] hover:bg-[var(--c-blue3)]/20 transition-colors cursor-pointer disabled:opacity-50`,children:f(x?`feeds.acceptingSuggestedMove`:`feeds.acceptSuggestedMove`)})})]}),e.unread_count>0&&(0,U.jsx)(Fi,{to:`/items?feed=${e.id}`,draggable:!1,className:`shrink-0 rounded-full bg-[var(--c-mobile-nav-active)] px-2.5 py-0.5 text-xs font-semibold tabular-nums text-[var(--c-text)] hover:bg-[var(--c-border)]`,title:f(`feeds.unread`,{count:e.unread_count}),children:e.unread_count}),(0,U.jsx)(Ku,{label:f(`feeds.moreActions`),items:w,className:`-mr-2 shrink-0`})]}),t&&(0,U.jsx)(dd,{feed:e,folderOptions:i,intervalOptions:a,onClose:()=>o(!1),onSaved:u})]})}function pd(e,t){let n=t.toLowerCase().split(`-`)[0],r=e.feeds.filter(e=>e.lang===n||e.lang===``),i=n===`en`||n===`ja`&&r.length>0?[]:e.feeds.filter(e=>e.lang===`en`);return[...r,...i]}function md(e,t){let n=t.toLowerCase().split(`-`)[0],r=e=>e.lang===n||e.lang===``?0:e.lang===`en`?1:2;return[...e.feeds].sort((e,t)=>r(e)-r(t))}function hd({folderOptions:e,defaultFolderId:t,initialUrl:n=``,subscribedUrls:r=[],compact:i=!1,onClose:a,onAdded:o}){let{t:s}=R(),[c,l]=(0,_.useState)(n),[u,d]=(0,_.useState)(``),[f,p]=(0,_.useState)(t),[m,h]=(0,_.useState)(!1),[g,v]=(0,_.useState)([]),y=new Set(r.map(gd));async function b(e,t){h(!0),v([]);try{let n=await H.subscribeFeed(e,t,f);l(``),d(``),await o(n)}catch(e){e instanceof Sa&&e.code===`multiple_feeds_found`&&e.data&&typeof e.data==`object`&&`feeds`in e.data?v(e.data.feeds):e instanceof Sa&&e.code===`already_subscribed`?q.error(s(`feeds.alreadySubscribed`)):e instanceof Sa&&(e.code===`no_feeds_found`||e.code===`invalid_feed`)?q.error(s(`feeds.noFeedsFoundOnPage`)):q.error(s(`feeds.subscribeFailed`))}finally{h(!1)}}function x(e){e.preventDefault();let t=c.trim();t&&!/^https?:\/\//i.test(t)&&(t=t.startsWith(`//`)?`https:${t}`:`https://${t}`),b(t,u.trim()||null)}return(0,U.jsxs)(`section`,{className:i?`flex flex-col gap-4`:`card animate-fade-in flex flex-col gap-4 p-4 sm:p-5`,children:[!i&&(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold`,children:s(`feeds.addFeed`)}),(0,U.jsx)(`button`,{type:`button`,onClick:a,className:`rounded-lg p-1 text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,"aria-label":s(`common.close`),children:(0,U.jsx)(od,{})})]}),(0,U.jsxs)(`form`,{onSubmit:x,className:`flex flex-col gap-3 ${i?`sm:flex-row sm:items-start`:``}`,children:[(0,U.jsx)(`input`,{type:`text`,required:!0,autoFocus:!i,placeholder:s(`feeds.urlPlaceholder`),className:i?`input sm:flex-1`:`input`,value:c,onChange:e=>{l(e.target.value),g.length&&v([])}}),(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 sm:flex-row`,children:[!i&&(0,U.jsx)(`input`,{type:`text`,placeholder:s(`feeds.labelPlaceholder`),className:`input sm:flex-1`,value:u,onChange:e=>d(e.target.value)}),!i&&(0,U.jsx)(Ju,{value:f?String(f):``,onChange:e=>p(e?Number(e):null),options:e,className:`w-full sm:w-52`,placeholder:s(`feeds.noFolder`)}),(0,U.jsx)(`button`,{type:`submit`,disabled:m,className:`btn-primary whitespace-nowrap`,children:s(m?`feeds.subscribing`:`feeds.subscribe`)})]})]}),g.length>0&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,U.jsx)(`p`,{className:`text-sm text-[var(--c-text-muted)]`,children:s(`feeds.multipleFeedsFound`)}),(0,U.jsx)(`ul`,{className:`divide-y divide-[var(--c-border)] rounded-xl border border-[var(--c-border)]`,children:g.map(e=>{let t=y.has(gd(e.url));return(0,U.jsxs)(`li`,{className:`flex flex-col gap-2.5 px-3 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-3 ${t?`opacity-70`:``}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`p`,{className:`break-words text-sm font-medium`,children:e.title??e.url}),(0,U.jsx)(`p`,{className:`truncate text-xs text-[var(--c-text-muted)]`,children:e.url})]}),(0,U.jsx)(`button`,{type:`button`,disabled:m||t,onClick:()=>b(e.url,e.title||u.trim()||null),className:`btn-primary w-full shrink-0 whitespace-nowrap px-3 py-1.5 text-xs sm:w-auto`,children:s(t?`feeds.subscribed`:`feeds.subscribe`)})]},e.url)})})]})]})}function gd(e){return e.trim().replace(/\/+$/,``).toLowerCase()}function _d(){let{t:e}=R(),{manageUrl:t}=qu();return(0,U.jsxs)(`section`,{role:`status`,className:`card flex flex-col gap-2 p-4 sm:p-5`,"aria-labelledby":`plan-notice-title`,children:[(0,U.jsx)(`h2`,{id:`plan-notice-title`,className:`text-base font-semibold`,children:e(`plan.limitedTitle`)}),(0,U.jsx)(`p`,{className:`text-sm text-[var(--c-text-muted)]`,children:e(`plan.limitedText`)}),t&&(0,U.jsx)(`a`,{href:t,className:`btn-primary self-start`,style:{textDecoration:`none`},children:e(`plan.view`)})]})}var vd={news:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`}),(0,U.jsx)(`path`,{d:`M18 14h-8`}),(0,U.jsx)(`path`,{d:`M15 18h-5`}),(0,U.jsx)(`path`,{d:`M10 6h8v4h-8V6Z`})]}),technology:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`}),(0,U.jsx)(`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`}),(0,U.jsx)(`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`})]}),development:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`m18 16 4-4-4-4`}),(0,U.jsx)(`path`,{d:`m6 8-4 4 4 4`}),(0,U.jsx)(`path`,{d:`m14.5 4-5 16`})]}),science:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M10 2v7.527a2 2 0 0 1-.211.896L4.72 20.55a1 1 0 0 0 .9 1.45h12.76a1 1 0 0 0 .9-1.45l-5.069-10.127A2 2 0 0 1 14 9.527V2`}),(0,U.jsx)(`path`,{d:`M8.5 2h7`}),(0,U.jsx)(`path`,{d:`M7 16h10`})]}),design:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`circle`,{cx:`13.5`,cy:`6.5`,r:`.5`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`17.5`,cy:`10.5`,r:`.5`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`8.5`,cy:`7.5`,r:`.5`,fill:`currentColor`}),(0,U.jsx)(`circle`,{cx:`6.5`,cy:`12.5`,r:`.5`,fill:`currentColor`}),(0,U.jsx)(`path`,{d:`M12 2C6.5 2 2 6.5 2 12s4.5 10 10 10c.926 0 1.648-.746 1.648-1.688 0-.437-.18-.835-.437-1.125-.29-.289-.438-.652-.438-1.125a1.64 1.64 0 0 1 1.668-1.668h1.996c3.051 0 5.563-2.512 5.563-5.563C22 6.5 17.5 2 12 2Z`})]}),gaming:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`line`,{x1:`6`,x2:`10`,y1:`11`,y2:`11`}),(0,U.jsx)(`line`,{x1:`8`,x2:`8`,y1:`9`,y2:`13`}),(0,U.jsx)(`line`,{x1:`15`,x2:`15.01`,y1:`12`,y2:`12`}),(0,U.jsx)(`line`,{x1:`18`,x2:`18.01`,y1:`10`,y2:`10`}),(0,U.jsx)(`path`,{d:`M17.32 5H6.68a4 4 0 0 0-3.978 3.59c-.006.052-.01.101-.017.152C2.604 9.416 2 14.456 2 16a3 3 0 0 0 3 3c1 0 1.5-.5 2-1l1.414-1.414A2 2 0 0 1 9.828 16h4.344a2 2 0 0 1 1.414.586L17 18c.5.5 1 1 2 1a3 3 0 0 0 3-3c0-1.545-.604-6.584-.685-7.258-.007-.05-.011-.1-.017-.151A4 4 0 0 0 17.32 5z`})]}),business:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`polyline`,{points:`22 7 13.5 15.5 8.5 10.5 2 17`}),(0,U.jsx)(`polyline`,{points:`16 7 22 7 22 13`})]}),sport:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M6 9H4.5a2.5 2.5 0 0 1 0-5H6`}),(0,U.jsx)(`path`,{d:`M18 9h1.5a2.5 2.5 0 0 0 0-5H18`}),(0,U.jsx)(`path`,{d:`M4 22h16`}),(0,U.jsx)(`path`,{d:`M10 14.66V17c0 .55-.47.98-.97 1.21C7.85 18.75 7 20.24 7 22`}),(0,U.jsx)(`path`,{d:`M14 14.66V17c0 .55.47.98.97 1.21C16.15 18.75 17 20.24 17 22`}),(0,U.jsx)(`path`,{d:`M18 2H6v7a6 6 0 0 0 12 0V2Z`})]}),culture:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M20.2 6 3 11l-.9-2.4c-.3-1.1.3-2.2 1.3-2.5l13.5-4c1.1-.3 2.2.3 2.5 1.3Z`}),(0,U.jsx)(`path`,{d:`m6.2 5.3 3.1 3.9`}),(0,U.jsx)(`path`,{d:`m12.4 3.4 3.1 4`}),(0,U.jsx)(`path`,{d:`M3 11h18v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`})]})},yd=`M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M15.97 6.37c.62-.75 1.04-1.8 0.93-2.85-.9.04-1.99.6-2.63 1.35-.57.65-1.07 1.71-.93 2.73.99.08 2.02-.48 2.63-1.23Z`;function bd({id:e}){if(e===`apple`)return(0,U.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 24 24`,fill:`currentColor`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:yd})});let t=vd[e];return t?(0,U.jsx)(`svg`,{className:`w-3.5 h-3.5 shrink-0`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:t}):null}async function xd(e){try{let t=(await H.listFolders()).folders.find(t=>t.name===e);return t?t.id:(await H.createFolder(e)).id}catch{return null}}function Sd({onSubscribed:e}){let{t,i18n:n}=R(),{syncAllowed:r}=qu(),i=El(),a=vl(i),o=n.resolvedLanguage||`en`,[s,c]=(0,_.useState)([]),[l,u]=(0,_.useState)(!1),d=(0,_.useMemo)(()=>bl(i,s,o).map(e=>({...e,feeds:l?md(e,o):pd(e,o)})).filter(e=>e.feeds.length>0),[i,s,o,l]),[f,p]=(0,_.useState)(null),[m,h]=(0,_.useState)(new Set),[g,v]=(0,_.useState)(null),[y,b]=(0,_.useState)(!1),x=(0,_.useRef)(null),S=d.find(e=>e.id===f)??d[0]??null,C=d.reduce((e,t)=>e+t.feeds.filter(e=>m.has(e.url)).length,0),w=S!==null&&S.feeds.every(e=>m.has(e.url));(0,_.useEffect)(()=>{let e=!0;return H.feedLists(o).then(t=>{e&&c(t.lists)},()=>{e&&c([])}),()=>{e=!1}},[o]);function T(e){h(t=>{let n=new Set(t);return n.delete(e)||n.add(e),n})}function E(){S&&h(e=>{let t=new Set(e);for(let e of S.feeds)w?t.delete(e.url):t.add(e.url);return t})}async function D(){let n=[];for(let e of d)for(let t of e.feeds)m.has(t.url)&&n.push({url:t.url,label:t.title,folderName:e.title});if(n.length===0)return;v({done:0,total:n.length});let r=new Map;for(let e of new Set(n.map(e=>e.folderName)))r.set(e,await xd(e));let i=0,a=0,o=0,s=new Set,c=[...n];await Promise.all(Array.from({length:Math.min(3,n.length)},async()=>{for(let e=c.shift();e;e=c.shift()){try{await H.subscribeFeed(e.url,e.label||null,r.get(e.folderName)??null),i++,s.add(e.url)}catch(t){t instanceof Sa&&t.code===`already_subscribed`?(i++,s.add(e.url)):a++}v({done:++o,total:n.length})}})),v(null),h(e=>new Set([...e].filter(e=>!s.has(e)))),a>0?q.error(t(`welcome.packPartial`,{added:i,failed:a})):q.success(t(`welcome.packAdded`,{count:i})),i>0&&await e()}async function O(n){let r=n.target.files?.[0];if(r){b(!0);try{let n=await H.importOpml(await r.text());n.failed>0?q.error(t(`feeds.importPartial`,{imported:n.imported,skipped:n.skipped,failed:n.failed})):q.success(t(`feeds.importSuccess`,{imported:n.imported,skipped:n.skipped})),n.imported>0&&await e()}catch{q.error(t(`feeds.importFailed`))}finally{b(!1),x.current&&(x.current.value=``)}}}async function k(n){q.success(t(`feeds.subscribedToast`,{title:n.label||n.title||n.url})),await e()}let A=g!==null||y;return r?(0,U.jsxs)(`section`,{className:`card flex flex-col gap-6 p-5 sm:p-7 shadow-xs`,"aria-labelledby":`welcome-title`,children:[(0,U.jsx)(`div`,{className:`flex flex-col gap-2`,children:(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h2`,{id:`welcome-title`,className:`text-xl sm:text-2xl font-bold tracking-tight text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:t(`welcome.title`)}),(0,U.jsx)(`p`,{className:`max-w-xl text-xs sm:text-sm text-[var(--c-text-muted)] mt-0.5 leading-relaxed`,children:t(`welcome.intro`)})]})}),a&&(0,U.jsx)(Uu,{name:`onboarding`,mount:a.mount}),(0,U.jsxs)(`div`,{className:`grid grid-cols-1 gap-4`,children:[d.length>0&&(0,U.jsxs)(`div`,{className:`rounded-2xl border border-[var(--c-border)]/80 bg-[var(--c-surface-hover)]/25 p-4 sm:p-5 flex flex-col gap-3.5`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,U.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-[var(--c-blue1)]/10 text-[var(--c-blue1)] flex items-center justify-center shrink-0`,children:(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,U.jsx)(`polygon`,{points:`16.24 7.76 14.12 14.12 7.76 16.24 9.88 9.88 16.24 7.76`})]})}),(0,U.jsx)(`h3`,{className:`text-sm sm:text-base font-bold text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:t(`welcome.packsTitle`)})]}),(0,U.jsx)(`p`,{className:`text-xs sm:text-sm text-[var(--c-text-muted)] mt-1 ml-9.5`,children:t(`welcome.packsHint`)})]}),(0,U.jsx)(`div`,{className:`flex flex-wrap gap-2`,role:`group`,"aria-label":t(`welcome.packsTitle`),children:d.map(e=>{let t=e.feeds.filter(e=>m.has(e.url)).length,n=S?.id===e.id;return(0,U.jsxs)(`button`,{type:`button`,"aria-pressed":n,disabled:A,onClick:()=>p(e.id),className:`inline-flex items-center gap-2 rounded-full border px-3.5 py-1.5 text-xs sm:text-sm font-semibold cursor-pointer transition-all ${n?`border-[var(--c-blue1)] bg-[var(--c-blue1)] text-white shadow-xs`:`border-[var(--c-border)] bg-[var(--c-surface)] hover:border-[var(--c-blue3)] hover:bg-[var(--c-surface-hover)] text-[var(--c-text)]`}`,children:[(0,U.jsx)(bd,{id:e.id}),(0,U.jsx)(`span`,{children:e.title}),t>0&&(0,U.jsx)(`span`,{className:`rounded-full px-1.5 text-[0.625rem] font-bold leading-4 ${n?`bg-white/25 text-white`:`bg-[var(--c-blue1)] text-white`}`,children:t})]},e.id)})}),S&&(0,U.jsxs)(`div`,{className:`flex flex-col gap-3 pt-2 animate-fade-in border-t border-[var(--c-border)]/60`,children:[(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-x-4 gap-y-2`,children:[S.description&&(0,U.jsx)(`p`,{className:`text-xs sm:text-sm text-[var(--c-text-muted)]`,children:S.description}),(0,U.jsx)(`button`,{type:`button`,disabled:A,onClick:E,className:`text-xs sm:text-sm font-semibold text-[var(--c-blue1)] cursor-pointer hover:underline`,children:t(w?`welcome.deselectAll`:`welcome.selectAll`)})]}),(0,U.jsx)(`ul`,{className:`divide-y divide-[var(--c-border)] rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)]`,children:S.feeds.map(e=>(0,U.jsx)(`li`,{children:(0,U.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-3 px-3.5 py-2.5 hover:bg-[var(--c-surface-hover)]/50 transition-colors`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:m.has(e.url),disabled:A,onChange:()=>T(e.url),className:`mt-0.5 rounded accent-[var(--c-blue1)]`}),(0,U.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`span`,{className:`block truncate text-xs sm:text-sm font-medium`,children:e.title}),e.description&&(0,U.jsx)(`span`,{className:`block text-xs text-[var(--c-text-muted)] leading-snug`,children:e.description})]}),e.lang&&(0,U.jsx)(`span`,{className:`shrink-0 text-[0.625rem] font-bold uppercase tracking-wider px-1.5 py-0.5 rounded bg-[var(--c-surface-hover)] text-[var(--c-text-muted)]`,children:e.lang})]})},e.url))})]}),(0,U.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-3`,children:[(0,U.jsx)(`button`,{type:`button`,disabled:A||C===0,onClick:()=>void D(),className:`btn-primary self-start text-xs sm:text-sm font-semibold px-4 py-2`,children:g?t(`welcome.subscribingProgress`,{done:g.done,total:g.total}):t(`welcome.subscribePack`,{count:C})}),(0,U.jsxs)(`label`,{className:`inline-flex items-center gap-2 text-xs sm:text-sm text-[var(--c-text-muted)] cursor-pointer`,children:[(0,U.jsx)(`input`,{type:`checkbox`,checked:l,disabled:A,onChange:e=>u(e.target.checked),className:`rounded accent-[var(--c-blue1)]`}),t(`welcome.allLanguages`)]})]})]}),(0,U.jsxs)(`div`,{className:`rounded-2xl border border-[var(--c-border)]/80 bg-[var(--c-surface-hover)]/25 p-4 sm:p-5 flex flex-col gap-3.5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,U.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-[var(--c-blue1)]/10 text-[var(--c-blue1)] flex items-center justify-center shrink-0`,children:(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,U.jsx)(`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`}),(0,U.jsx)(`path`,{d:`M2 12h20`})]})}),(0,U.jsx)(`h3`,{className:`text-sm sm:text-base font-bold text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:t(`welcome.addTitle`)})]}),(0,U.jsx)(hd,{compact:!0,folderOptions:[],defaultFolderId:null,onClose:()=>{},onAdded:k})]}),(0,U.jsxs)(`div`,{className:`rounded-2xl border border-[var(--c-border)]/80 bg-[var(--c-surface-hover)]/25 p-4 sm:p-5 flex flex-col sm:flex-row sm:items-center justify-between gap-4`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,U.jsx)(`div`,{className:`w-7 h-7 rounded-lg bg-[var(--c-blue1)]/10 text-[var(--c-blue1)] flex items-center justify-center shrink-0`,children:(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:`M21 8v13H3V8`}),(0,U.jsx)(`path`,{d:`M1 3h22v5H1z`}),(0,U.jsx)(`path`,{d:`M10 12h4`})]})}),(0,U.jsx)(`h3`,{className:`text-sm sm:text-base font-bold text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:t(`welcome.importTitle`)})]}),(0,U.jsx)(`p`,{className:`text-xs sm:text-sm text-[var(--c-text-muted)] mt-1 ml-9.5`,children:t(`welcome.importHint`)})]}),(0,U.jsxs)(`button`,{type:`button`,disabled:A,onClick:()=>x.current?.click(),className:`btn-secondary inline-flex items-center gap-2 shrink-0 text-xs sm:text-sm font-semibold px-4 py-2`,children:[(0,U.jsx)(td,{}),t(y?`feeds.importing`:`feeds.importOpml`)]}),(0,U.jsx)(`input`,{type:`file`,ref:x,onChange:O,accept:`.opml,.xml,text/xml,application/xml`,className:`hidden`})]})]})]}):(0,U.jsx)(_d,{})}function Cd({folder:e,onRenamed:t}){let{t:n}=R(),[r,i]=(0,_.useState)(e.name);async function a(){let a=r.trim();if(!a||a===e.name)i(e.name);else try{await H.updateFolder(e.id,a),q.success(n(`feeds.folderRenamed`,{name:a})),await t()}catch{i(e.name),q.error(n(`common.error`))}}return(0,U.jsx)(`input`,{className:`input h-9 min-h-0 flex-1 border-transparent bg-transparent px-2 text-sm shadow-none hover:border-[var(--c-border)] focus:border-[var(--c-border)]`,value:r,onChange:e=>i(e.target.value),onBlur:()=>void a(),onKeyDown:t=>{t.key===`Enter`&&t.currentTarget.blur(),t.key===`Escape`&&i(e.name)}})}function wd({folders:e,onClose:t,onChanged:n}){let{t:r}=R(),{syncAllowed:i}=qu(),[a,o]=(0,_.useState)(``),[s,c]=(0,_.useState)(!1);async function l(e){if(e.preventDefault(),a.trim()){c(!0);try{await H.createFolder(a.trim()),q.success(r(`feeds.folderCreated`,{name:a.trim()})),o(``),await n()}catch{q.error(r(`common.error`))}finally{c(!1)}}}async function u(e){if(confirm(r(`feeds.deleteFolderConfirm`,{name:e.name})))try{await H.deleteFolder(e.id),q.success(r(`feeds.folderDeleted`,{name:e.name})),await n()}catch{q.error(r(`common.error`))}}return(0,U.jsxs)(`section`,{className:`card animate-fade-in flex flex-col gap-4 p-4 sm:p-5`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsx)(`h2`,{className:`text-base font-semibold`,children:r(`feeds.manageFolders`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs text-[var(--c-text-muted)]`,children:r(`feeds.renameFolderHint`)})]}),(0,U.jsx)(`button`,{type:`button`,onClick:t,className:`rounded-lg p-1 text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,"aria-label":r(`common.close`),children:(0,U.jsx)(od,{})})]}),e.length>0&&(0,U.jsx)(`ul`,{className:`divide-y divide-[var(--c-border)] rounded-xl border border-[var(--c-border)]`,children:e.map(e=>(0,U.jsxs)(`li`,{className:`flex items-center gap-2 px-2 py-1.5`,children:[(0,U.jsx)(Cd,{folder:e,onRenamed:n},e.name),(0,U.jsx)(`span`,{className:`shrink-0 text-xs tabular-nums text-[var(--c-text-muted)]`,children:r(`feeds.feedCount`,{count:e.feed_count??0})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>u(e),className:`rounded-lg p-2 text-[var(--c-text-muted)] hover:bg-[var(--c-danger-bg)] hover:text-[var(--c-danger)] cursor-pointer`,"aria-label":r(`common.delete`),title:r(`common.delete`),children:(0,U.jsx)($u,{})})]},e.id))}),(0,U.jsxs)(`form`,{onSubmit:l,className:`flex gap-2`,children:[(0,U.jsx)(`input`,{type:`text`,disabled:!i,placeholder:r(`feeds.newFolderPlaceholder`),className:`input flex-1`,value:a,onChange:e=>o(e.target.value)}),(0,U.jsx)(`button`,{type:`submit`,disabled:s||!i||!a.trim(),title:i?void 0:r(`plan.unavailable`),className:`btn-primary whitespace-nowrap`,children:r(`feeds.addFolder`)})]})]})}function Td(e,t,n){e.deferred?q.info(n(`feeds.refreshPendingToast`,{title:t})):e.error?q.error(n(`feeds.refreshFailedToast`,{title:t,error:Xu(n,e.error)})):q.success(n(`feeds.refreshedToast`,{title:t,count:e.newItems}))}function Ed(e,t){e.deferred?q.info(t(`feeds.refreshAllPendingToast`,{count:e.deferred,newItems:e.newItems})):e.errors||q.success(t(`feeds.refreshedAllToast`,{count:e.refreshed,newItems:e.newItems})),e.errors>0&&q.error(t(`feeds.failingCount`,{count:e.errors}))}var Dd=[5,15,30,60,180,360,720,1440],Od=`none`;function kd(e,t){return!t||[e.label,e.title,e.url,e.site_url].filter(Boolean).join(` `).toLowerCase().includes(t.toLowerCase())}function Ad(){let{t:e}=R(),[t,n]=(0,_.useState)([]),[r,i]=(0,_.useState)([]),[a,o]=(0,_.useState)(!0),[s,c]=(0,_.useState)(null),[l,u]=(0,_.useState)(null),[d,f]=(0,_.useState)(new Set),[p,m]=(0,_.useState)(!1),[h,g]=(0,_.useState)(``),[v,y]=Vi(),[b]=(0,_.useState)(()=>[v.get(`url`),v.get(`text`),v.get(`add`)].filter(Boolean).join(` `).match(/https?:\/\/[^\s]+/i)?.[0]??``);(0,_.useEffect)(()=>{(v.has(`add`)||v.has(`url`)||v.has(`text`))&&(j&&c(`add`),y({},{replace:!0}))},[]);let[x,S]=(0,_.useState)(`all`),[C,w]=(0,_.useState)(null),[T,E]=(0,_.useState)(!1),[D,O]=(0,_.useState)(null),k=(0,_.useRef)(null);async function A(){try{let[e,t]=await Promise.all([H.listFeeds(),H.listFolders().catch(()=>({folders:[]}))]);n(e),i(t.folders)}catch(e){console.error(`Failed to load feeds:`,e)}finally{o(!1)}}(0,_.useEffect)(()=>{A()},[]),(0,_.useEffect)(()=>{if(D===null)return;document.getElementById(`feed-${D}`)?.scrollIntoView({behavior:`smooth`,block:`center`});let e=window.setTimeout(()=>O(null),2500);return()=>window.clearTimeout(e)},[D,t]);let{syncAllowed:j}=qu(),ee=e=>(e.label??e.title??e.url).replace(/\s+/g,` `).trim();async function te(t){q.success(e(`feeds.subscribedToast`,{title:ee(t)})),g(``),S(`all`),await A(),O(t.id)}let ne=(0,_.useMemo)(()=>[{value:``,label:e(`feeds.noFolder`)},...r.map(e=>({value:String(e.id),label:e.name}))],[r,e]),re=(0,_.useMemo)(()=>Dd.map(t=>({value:String(t),label:ld(e,t)})),[e]),ie=(0,_.useMemo)(()=>{let n=new Map;for(let e of t){let t=e.folder_id??null;n.set(t,[...n.get(t)??[],e])}let i=[...r].sort((e,t)=>e.name.localeCompare(t.name)).map(e=>({key:`folder:${e.id}`,name:e.name,feeds:n.get(e.id)??[]}));return i.push({key:Od,name:e(`feeds.uncategorized`),feeds:n.get(null)??[]}),i.filter(e=>e.feeds.length>0)},[t,r,e]),ae=(0,_.useMemo)(()=>ie.filter(e=>x===`all`||x===`failing`||e.key===x).map(e=>({...e,feeds:e.feeds.filter(e=>kd(e,h)&&(x!==`failing`||!!e.last_error))})).filter(e=>e.feeds.length>0),[ie,x,h]),oe=t.reduce((e,t)=>e+t.unread_count,0),se=t.filter(e=>e.last_error).length,ce=!h&&x!==`failing`;(0,_.useEffect)(()=>{if(!C)return;let e=e=>e.preventDefault();return window.addEventListener(`dragover`,e),window.addEventListener(`drop`,e),()=>{window.removeEventListener(`dragover`,e),window.removeEventListener(`drop`,e)}},[C!==null]);async function le(){if(!C||C.from===C.over){w(null);return}let e=ie.map(e=>{if(e.key!==C.group)return e.feeds;let t=[...e.feeds],[n]=t.splice(C.from,1);return t.splice(C.over,0,n),t}).flat();n(e),w(null);try{await H.reorderFeeds(e.map(e=>e.id))}catch(e){console.error(`Failed to save feed order:`,e),await A()}}async function M(t){f(e=>new Set(e).add(t));try{let r=await H.refreshFeed(t);r.feed?n(e=>e.map(e=>e.id===t?r.feed:e)):await A(),Td(r,r.feed?ee(r.feed):``,e)}catch{q.error(e(`common.error`))}finally{f(e=>{let n=new Set(e);return n.delete(t),n})}}async function ue(){m(!0);try{let t=await H.refreshAllFeeds();await A(),Ed(t,e)}catch{q.error(e(`common.error`))}finally{m(!1)}}async function de(t){if(confirm(e(`feeds.unsubscribeConfirm`,{title:ee(t)})))try{await H.unsubscribeFeed(t.id),q.success(e(`feeds.unsubscribedToast`,{title:ee(t)})),await A()}catch{q.error(e(`common.error`))}}async function fe(t){try{await H.markAllRead(t.id),q.success(e(`feeds.markedReadToast`,{title:ee(t)})),await A()}catch{q.error(e(`common.error`))}}function pe(){let e=document.createElement(`a`);e.href=H.exportOpmlUrl(),e.download=`feedkeeper-subscriptions.opml`,e.click()}async function me(t){let n=t.target.files?.[0];if(n){E(!0);try{let t=await H.importOpml(await n.text());t.failed>0?q.error(e(`feeds.importPartial`,{imported:t.imported,skipped:t.skipped,failed:t.failed})):q.success(e(`feeds.importSuccess`,{imported:t.imported,skipped:t.skipped})),await A()}catch{q.error(e(`feeds.importFailed`))}finally{E(!1),k.current&&(k.current.value=``)}}}let he=[{key:`all`,label:e(`feeds.filterAll`),count:t.length},...ie.map(e=>({key:e.key,label:e.name,count:e.feeds.length})),...se>0?[{key:`failing`,label:e(`feeds.filterFailing`),count:se,danger:!0}]:[]];return(0,U.jsxs)(`div`,{className:`flex flex-col gap-6 pb-24`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`text-2xl font-semibold`,children:e(`feeds.title`)}),!a&&t.length>0&&(0,U.jsxs)(`p`,{className:`mt-1 text-sm text-[var(--c-text-muted)]`,children:[e(`feeds.feedCount`,{count:t.length}),` · `,e(`feeds.unread`,{count:oe}),se>0&&(0,U.jsxs)(U.Fragment,{children:[` · `,(0,U.jsx)(`button`,{type:`button`,onClick:()=>S(`failing`),className:`text-[var(--c-danger)] hover:underline cursor-pointer`,children:e(`feeds.failingCount`,{count:se})})]})]})]}),(0,U.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(a||t.length>0)&&(0,U.jsxs)(`button`,{type:`button`,disabled:!j,title:j?void 0:e(`plan.unavailable`),onClick:()=>c(s===`add`?null:`add`),className:`btn-primary inline-flex items-center gap-1.5 whitespace-nowrap`,children:[(0,U.jsx)(ed,{className:`h-4 w-4`}),(0,U.jsx)(`span`,{className:`hidden sm:inline`,children:e(`feeds.addFeed`)}),(0,U.jsx)(`span`,{className:`sm:hidden`,children:e(`feeds.addFeedShort`)})]}),(0,U.jsx)(Ku,{label:e(`feeds.moreActions`),items:[{label:e(p?`feeds.refreshing`:`feeds.refreshAll`),icon:(0,U.jsx)(X,{className:`h-4 w-4 ${p?`animate-spin`:``}`}),onSelect:ue,disabled:p||!j},{label:e(`feeds.manageFolders`),icon:(0,U.jsx)(rd,{}),onSelect:()=>c(`folders`)},{label:e(T?`feeds.importing`:`feeds.importOpml`),icon:(0,U.jsx)(td,{}),onSelect:()=>k.current?.click(),disabled:T||!j},{label:e(`feeds.exportOpml`),icon:(0,U.jsx)(nd,{}),onSelect:pe}]}),(0,U.jsx)(`input`,{type:`file`,ref:k,onChange:me,accept:`.opml,.xml,text/xml,application/xml`,className:`hidden`})]})]}),!j&&t.length>0&&(0,U.jsx)(_d,{}),s===`add`&&j&&(0,U.jsx)(hd,{folderOptions:ne,defaultFolderId:x.startsWith(`folder:`)?Number(x.slice(7)):null,initialUrl:b,subscribedUrls:t.map(e=>e.url),onClose:()=>c(null),onAdded:te}),s===`folders`&&(0,U.jsx)(wd,{folders:r,onClose:()=>c(null),onChanged:A}),a?(0,U.jsx)(Gu,{size:`lg`}):t.length===0?s!==`add`&&(0,U.jsx)(Sd,{onSubscribed:A}):(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`div`,{className:`flex flex-col gap-3`,children:[(0,U.jsxs)(`div`,{className:`relative`,children:[(0,U.jsx)(`span`,{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-[var(--c-text-muted)] opacity-60`,children:(0,U.jsx)(id,{})}),(0,U.jsx)(`input`,{type:`search`,value:h,onChange:e=>g(e.target.value),placeholder:e(`feeds.searchPlaceholder`),"aria-label":e(`feeds.searchPlaceholder`),className:`input pl-9`})]}),(0,U.jsx)(`div`,{className:`-mx-4 flex gap-2 overflow-x-auto px-4 pb-1 sm:mx-0 sm:flex-wrap sm:overflow-visible sm:px-0`,role:`group`,"aria-label":e(`feeds.folder`),children:he.map(e=>{let t=x===e.key;return(0,U.jsxs)(`button`,{type:`button`,onClick:()=>S(e.key),"aria-pressed":t,className:`inline-flex shrink-0 items-center gap-1.5 rounded-full border px-3 py-1.5 text-sm font-medium transition-colors cursor-pointer ${t?`border-[var(--c-mobile-nav-active-border)] bg-[var(--c-mobile-nav-active)] text-[var(--c-text)]`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)]`} ${e.danger&&!t?`text-[var(--c-danger)]`:``}`,children:[e.label,e.count!==void 0&&(0,U.jsx)(`span`,{className:`text-xs tabular-nums opacity-70`,children:e.count})]},e.key)})})]}),ae.length===0?(0,U.jsx)(`p`,{className:`text-sm text-[var(--c-text-muted)]`,children:e(`feeds.noMatches`)}):(0,U.jsx)(`div`,{className:`flex flex-col gap-6 animate-page-fade`,children:ae.map(t=>{let n=t.feeds.reduce((e,t)=>e+t.unread_count,0);return(0,U.jsxs)(`section`,{children:[(0,U.jsxs)(`div`,{className:`mb-2 flex items-baseline justify-between gap-3 px-1`,children:[(0,U.jsx)(`h2`,{className:`truncate text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:t.name}),(0,U.jsxs)(`span`,{className:`shrink-0 text-xs text-[var(--c-text-muted)]`,children:[e(`feeds.feedCount`,{count:t.feeds.length}),n>0&&` · ${e(`feeds.unread`,{count:n})}`]})]}),(0,U.jsx)(`ul`,{className:`card divide-y divide-[var(--c-border)]`,children:t.feeds.map((e,n)=>(0,U.jsx)(fd,{feed:e,editing:l===e.id,refreshing:d.has(e.id),highlighted:D===e.id,folderOptions:ne,intervalOptions:re,onEdit:t=>u(t?e.id:null),onRefresh:()=>void M(e.id),onMarkRead:()=>void fe(e),onUnsubscribe:()=>void de(e),onSaved:A,drag:ce&&t.feeds.length>1?{isDragging:C?.group===t.key&&C.from===n,isDragOver:C?.group===t.key&&C.over===n&&C.from!==n,onDragStart:r=>{r.dataTransfer.effectAllowed=`move`,r.dataTransfer.setData(`application/x-feedkeeper-feed`,String(e.id)),w({group:t.key,from:n,over:n})},onDragOver:e=>{C?.group===t.key&&(e.preventDefault(),C.over!==n&&w({...C,over:n}))},onDragEnd:()=>void le(),onDrop:e=>e.preventDefault()}:void 0},e.id))})]},t.key)})})]})]})}function jd(){let[e,t]=(0,_.useState)(()=>new Date);return(0,_.useEffect)(()=>{let n=new Date(e);n.setHours(24,0,1,0);let r=window.setTimeout(()=>t(new Date),n.getTime()-Date.now());return()=>window.clearTimeout(r)},[e]),e}function Md({className:e=``}){let{i18n:t}=R(),n=jd(),r=e=>new Intl.DateTimeFormat(t.resolvedLanguage,{weekday:`long`,day:`numeric`,month:`long`,...e?{year:`numeric`}:{}}).format(n);return(0,U.jsxs)(`time`,{dateTime:n.toLocaleDateString(`sv-SE`),className:`truncate text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)] ${e}`,children:[(0,U.jsx)(`span`,{className:`sm:hidden`,children:r(!1)}),(0,U.jsx)(`span`,{className:`hidden sm:inline`,children:r(!0)})]})}var Nd=650;function Pd(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`script, style, noscript, template, svg, [hidden], [aria-hidden='true']`).forEach(e=>e.remove()),t.content.querySelectorAll(`p, div, li, br, blockquote, section, article, h1, h2, h3, h4, h5, h6`).forEach(e=>e.after(` `)),t.content.textContent?.replace(/\s+/g,` `).trim()??``}function Fd(e){let t=e.full_content_html?.trim()?Pd(e.full_content_html):``,n=!t&&e.content_html?.trim()?Pd(e.content_html):``,r=e.content_snippet?.replace(/\s+/g,` `).trim()??``,i=t||(n.length>=r.length?n:r);return i?i.length<=Nd?i:Po(i)===`ja`?Fo(i,Nd):`${i.slice(0,Nd).trimEnd()}…`:null}function Id({item:e,className:t}){let n=(0,_.useMemo)(()=>Fd(e),[e]);if(!n)return null;let r=Po(n);return(0,U.jsx)(`p`,{className:r===`ja`?`${t} ja-phrases`:t,lang:r,children:(0,U.jsx)(el,{text:n})})}function Ld(e){let t=0,n=-5;return e.map((e,r)=>{let i=/^https?:\/\//i.test(e.image_url??``),a=(e.content_snippet?.trim().length??0)>=220,o=(i||a)&&r-n>=5&&t<=1;return t=(t+(o?2:1))%3,o&&(n=r),o})}function Rd(e){let t=e.map(()=>!1),n=[],r=0;return e.forEach((i,a)=>{n.push(a),r+=i?2:1,r===3&&(n.some(t=>e[t])&&n.forEach(n=>{t[n]=!e[n]}),n=[],r=0)}),t}function zd({url:e,featured:t}){let[n,r]=(0,_.useState)(`loading`);return!e||!/^https?:\/\//i.test(e)?null:(0,U.jsx)(`div`,{className:n===`hidden`?`hidden`:`overflow-hidden border-b border-[var(--c-border)] bg-[var(--c-bg)]`,children:(0,U.jsx)(`img`,{src:e,alt:``,loading:`lazy`,className:`w-full object-cover transition-transform duration-300 group-hover:scale-[1.025] ${t?`aspect-[3/2] lg:aspect-[16/9]`:`aspect-[3/2]`} ${n===`visible`?`opacity-100`:`opacity-0`}`,onLoad:e=>{let{naturalWidth:n,naturalHeight:i}=e.currentTarget;r(n>=(t?400:160)&&i>=(t?220:100)?`visible`:`hidden`)},onError:()=>r(`hidden`)})})}function Bd({item:e,featured:t,besideFeature:n,focused:r,onOpen:i,onBookmark:a,onRead:o}){let{t:s,i18n:c}=R(),l=e.published_at?new Date(e.published_at):null,u=l&&!Number.isNaN(l.getTime())?l:null,d=u?new Intl.DateTimeFormat(c.resolvedLanguage,{dateStyle:`medium`}).format(u):null,f=u?new Intl.DateTimeFormat(c.resolvedLanguage,{timeStyle:`short`}).format(u):null;return(0,U.jsx)(`li`,{"data-item-id":e.id,className:t?`lg:col-span-2`:``,children:(0,U.jsxs)(`article`,{className:`card group relative flex h-full flex-col overflow-hidden transition-colors duration-150 hover:border-[var(--c-blue3)] hover:bg-[var(--c-surface-hover)] ${r?`ring-2 ring-[var(--c-blue3)] border-[var(--c-blue3)] bg-[var(--c-surface-hover)]`:``}`,style:{opacity:e.read?.65:1},children:[(0,U.jsx)(`button`,{type:`button`,className:`absolute inset-0 z-10 rounded-xl focus-visible:outline-2 focus-visible:outline-offset-[-3px] focus-visible:outline-[var(--c-blue3)]`,"aria-label":e.title||e.feed_title||s(`items.title`),onClick:()=>i(e)}),(0,U.jsx)(zd,{url:e.image_url,featured:t},e.image_url??``),(0,U.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col ${t?`p-4 sm:p-5 lg:p-6`:`p-4 sm:p-5`}`,children:[(0,U.jsxs)(`div`,{className:`mb-3 flex min-w-0 items-center gap-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:[(0,U.jsx)($c,{feedId:e.feed_id,iconUrl:e.feed_icon_url,siteUrl:e.feed_site_url,feedUrl:e.feed_url,articleUrl:e.link,className:`h-3.5 w-3.5 shrink-0 rounded-xs object-contain`}),(0,U.jsx)(`span`,{className:`truncate`,children:e.feed_title}),(e.enclosure_url||nl(e.link))&&(0,U.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 rounded-full border border-[var(--c-border)] px-2 py-0.5 text-[11px] font-medium tracking-normal normal-case text-[var(--c-text-muted)] shrink-0`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:e.enclosure_type?.startsWith(`video/`)||!e.enclosure_url&&nl(e.link)?`▶`:`🎧`}),e.enclosure_duration_seconds?tl(e.enclosure_duration_seconds):e.enclosure_type?.startsWith(`video/`)||!e.enclosure_url&&nl(e.link)?`Video`:`Audio`]})]}),(0,U.jsx)(`h2`,{lang:Po(e.title||e.feed_title),className:`text-[var(--c-text)] ${t?`text-lg leading-snug lg:text-2xl lg:leading-tight`:`text-lg leading-snug`} font-semibold${Po(e.title||e.feed_title)===`ja`?` ja-phrases`:``}`,children:e.title||e.feed_title?(0,U.jsx)(el,{text:e.title||e.feed_title}):null}),(0,U.jsx)(Id,{item:e,className:`mt-3 text-sm leading-relaxed text-[var(--c-text-muted)] ${t?`line-clamp-3 lg:line-clamp-4`:n?`line-clamp-3 lg:line-clamp-12`:`line-clamp-3`}`}),(0,U.jsxs)(`div`,{className:`pointer-events-none relative z-20 mt-auto flex flex-wrap items-center gap-x-3 gap-y-2 pt-5 text-xs text-[var(--c-text-muted)]`,children:[d&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,title:f??void 0,children:[(0,U.jsxs)(`svg`,{className:`h-3.5 w-3.5 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`}),(0,U.jsx)(`path`,{d:`M8 2v4M16 2v4M3 10h18`})]}),d]}),f&&(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`svg`,{className:`h-3.5 w-3.5 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,U.jsx)(`path`,{d:`M12 6v6l4 2`})]}),f]}),(0,U.jsxs)(`div`,{className:`pointer-events-auto ml-auto flex items-center gap-1.5`,children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>a(e),title:e.bookmarked?s(`items.unbookmark`):s(`items.bookmark`),"aria-label":e.bookmarked?s(`items.unbookmark`):s(`items.bookmark`),className:`grid h-8 w-8 place-items-center rounded-lg border transition-colors ${e.bookmarked?`border-amber-500/40 bg-amber-500/15 text-amber-500`:`border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500`}`,children:(0,U.jsx)(`svg`,{className:`h-4 w-4`,viewBox:`0 0 24 24`,fill:e.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,U.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>o(e),title:e.read?s(`items.markUnread`):s(`items.markRead`),"aria-label":e.read?s(`items.markUnread`):s(`items.markRead`),className:`grid h-8 w-8 place-items-center rounded-lg border border-[var(--c-border)] transition-colors ${e.read?`text-[var(--c-text-muted)]`:`text-[var(--c-blue3)]`}`,children:(0,U.jsx)(`svg`,{className:`h-3.5 w-3.5`,viewBox:`0 0 24 24`,fill:e.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2.2`,"aria-hidden":`true`,children:(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})})]})]})]})]})})}function Vd({items:e,focusedItemId:t,onOpen:n,onBookmark:r,onRead:i}){let a=(0,_.useMemo)(()=>Ld(e),[e]),o=(0,_.useMemo)(()=>Rd(a),[a]);return(0,U.jsx)(`ul`,{className:`grid grid-cols-1 gap-4 sm:grid-cols-2 lg:grid-cols-3 sm:gap-5 animate-page-fade`,children:e.map((e,s)=>(0,U.jsx)(Bd,{item:e,featured:a[s],besideFeature:o[s],focused:t===e.id,onOpen:n,onBookmark:r,onRead:i},e.id))})}var Hd={"&amp;":`&`,"&lt;":`<`,"&gt;":`>`,"&quot;":`"`,"&#39;":`'`};function Ud(e){return e.replace(/<[^>]*>/g,` `).replace(/&(amp|lt|gt|quot|#39);/g,e=>Hd[e]??e).replace(/\s+/g,` `).trim()}function Wd({feed:e}){let{t}=R(),[n,r]=(0,_.useState)(!1),i=e.label?.trim()||e.title?.trim()||e.url,a=e.artwork_url||`/api/feeds/${e.id}/icon`,o=e.description?Ud(e.description):``;return(0,U.jsxs)(`div`,{className:`mb-6 flex items-start gap-4 rounded-2xl border border-[var(--c-border)] bg-[var(--c-surface)] p-4 sm:p-5`,children:[(0,U.jsx)(`img`,{src:a,alt:``,className:`h-20 w-20 sm:h-24 sm:w-24 rounded-xl object-cover shrink-0 border border-[var(--c-border)] bg-[var(--c-bg)]`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsx)(`h2`,{className:`text-lg sm:text-xl font-bold text-[var(--c-text)] leading-snug`,children:i}),o&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`p`,{className:`mt-1.5 text-sm text-[var(--c-text-muted)] ${n?``:`line-clamp-2`}`,children:o}),o.length>140&&(0,U.jsx)(`button`,{type:`button`,onClick:()=>r(e=>!e),className:`mt-1 text-xs font-medium text-[var(--c-blue3)] hover:underline cursor-pointer`,children:t(n?`common.showLess`:`common.showMore`)})]})]})]})}function Gd(e,t,n){let r=n&&n>0?n:e.enclosure_duration_seconds??0;if(r<=0)return 0;let i=t===void 0?e.media_position&&!e.media_position.completed?e.media_position.positionSeconds:0:t;return Math.min(1,Math.max(0,i/r))}function Kd({feed:e,items:t,focusedItemId:n,onOpen:r,onBookmark:i,onRead:a}){let{t:o,i18n:s}=R(),c=vo();return(0,U.jsx)(`ul`,{className:`flex flex-col gap-3 animate-page-fade`,children:t.map(t=>{let l=c.currentItem?.id===t.id,u=l&&c.isPlaying,d=l&&c.duration>0?c.duration:t.enclosure_duration_seconds??0,f=l?c.currentTime:t.media_position&&!t.media_position.completed?t.media_position.positionSeconds:0,p=Gd(t,l?c.currentTime:void 0,l?c.duration:void 0),m=t.published_at?new Date(t.published_at):null,h=n===t.id;return(0,U.jsxs)(`li`,{"data-item-id":t.id,onClick:()=>r(t),className:`card flex items-center gap-3.5 p-3.5 sm:p-4 transition-colors hover:bg-[var(--c-surface-hover)] hover:border-[var(--c-blue3)]/60 cursor-pointer ${h?`ring-2 ring-[var(--c-blue3)] border-[var(--c-blue3)] bg-[var(--c-surface-hover)]`:``}`,style:{opacity:t.read?.65:1},children:[t.enclosure_url&&(0,U.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),c.togglePlay(t)},"aria-label":o(u?`player.pause`:`player.play`),className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-full bg-[var(--c-blue3)] text-white hover:opacity-90 cursor-pointer`,children:u?(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`currentColor`,children:[(0,U.jsx)(`rect`,{x:`6`,y:`4`,width:`4`,height:`16`,rx:`1`}),(0,U.jsx)(`rect`,{x:`14`,y:`4`,width:`4`,height:`16`,rx:`1`})]}):(0,U.jsx)(`svg`,{className:`w-4 h-4 translate-x-0.5`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,U.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})})}),(t.image_url||e?.artwork_url||t.feed_id)&&(0,U.jsx)(`img`,{src:t.image_url||e?.artwork_url||`/api/feeds/${t.feed_id}/icon`,alt:``,className:`h-12 w-12 rounded-lg object-cover shrink-0 border border-[var(--c-border)] bg-[var(--c-bg)]`,loading:`lazy`}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,U.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-[var(--c-text-muted)] mb-0.5`,children:[m&&(0,U.jsx)(`span`,{children:J(m,s.resolvedLanguage)}),d>0&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`span`,{children:`·`}),(0,U.jsx)(`span`,{className:`font-mono`,children:f>5&&d>f?o(`player.timeRemaining`,{time:tl(d-f)}):tl(d)})]})]}),(0,U.jsx)(`h3`,{className:`text-sm sm:text-base font-semibold text-[var(--c-text)] line-clamp-2`,children:t.title}),p>0&&(0,U.jsx)(`div`,{className:`mt-2 h-1 w-full max-w-xs rounded-full bg-[var(--c-border)] overflow-hidden`,children:(0,U.jsx)(`div`,{className:`h-full bg-[var(--c-blue3)]`,style:{width:`${p*100}%`}})})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-1 shrink-0`,onClick:e=>e.stopPropagation(),children:[(0,U.jsx)(`button`,{type:`button`,onClick:()=>i(t),"aria-label":o(`items.bookmark`),className:`p-1.5 rounded-lg hover:bg-[var(--c-surface-hover)] cursor-pointer ${t.bookmarked?`text-amber-500`:`text-[var(--c-text-muted)]`}`,children:(0,U.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:t.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,U.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>a(t),"aria-label":t.read?o(`items.markUnread`):o(`items.markRead`),className:`p-1.5 rounded-lg text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] cursor-pointer`,children:(0,U.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:t.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2`,children:(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`6`})})})]})]},t.id)})})}function qd({items:e,focusedItemId:t,onOpen:n,onBookmark:r}){let{t:i,i18n:a}=R();return(0,U.jsx)(`div`,{className:`grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-4 sm:gap-5 animate-page-fade`,children:e.map(e=>{let o=e.published_at?new Date(e.published_at):null,s=e.enclosure_duration_seconds??0,c=Gd(e),l=t===e.id;return(0,U.jsxs)(`article`,{"data-item-id":e.id,onClick:()=>n(e),className:`card overflow-hidden flex flex-col cursor-pointer transition-colors hover:border-[var(--c-blue3)]/60 ${l?`ring-2 ring-[var(--c-blue3)] border-[var(--c-blue3)]`:``}`,style:{opacity:e.read?.65:1},children:[(0,U.jsxs)(`div`,{className:`relative aspect-video w-full bg-black overflow-hidden`,children:[e.image_url?(0,U.jsx)(`img`,{src:e.image_url,alt:``,className:`w-full h-full object-cover`,loading:`lazy`}):(0,U.jsx)(`div`,{className:`w-full h-full flex items-center justify-center text-white/60`,children:(0,U.jsx)(`svg`,{className:`w-10 h-10`,viewBox:`0 0 24 24`,fill:`currentColor`,children:(0,U.jsx)(`polygon`,{points:`5 3 19 12 5 21 5 3`})})}),s>0&&(0,U.jsx)(`span`,{className:`absolute bottom-2 right-2 rounded-md bg-black/80 px-1.5 py-0.5 font-mono text-[11px] font-semibold text-white`,children:tl(s)}),c>0&&(0,U.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0 h-1 bg-white/25`,children:(0,U.jsx)(`div`,{className:`h-full bg-[var(--c-blue3)]`,style:{width:`${c*100}%`}})})]}),(0,U.jsxs)(`div`,{className:`p-3.5 flex-1 flex flex-col justify-between gap-2`,children:[(0,U.jsx)(`h3`,{className:`text-sm font-semibold text-[var(--c-text)] line-clamp-2 leading-snug min-h-[2.45rem]`,children:e.title}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between text-xs text-[var(--c-text-muted)]`,children:[(0,U.jsx)(`span`,{children:o?J(o,a.resolvedLanguage):``}),(0,U.jsx)(`button`,{type:`button`,onClick:t=>{t.stopPropagation(),r(e)},"aria-label":i(`items.bookmark`),className:`p-1 rounded hover:bg-[var(--c-surface-hover)] cursor-pointer ${e.bookmarked?`text-amber-500`:``}`,children:(0,U.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:e.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,children:(0,U.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})})]})]})]},e.id)})})}var Jd=68,Yd=92,Xd=`input, select, textarea, [contenteditable='true'], [data-no-pull]`;function Zd(){let e=e=>{e.preventDefault(),e.stopPropagation()};window.addEventListener(`click`,e,{capture:!0,once:!0}),window.setTimeout(()=>window.removeEventListener(`click`,e,{capture:!0}),400)}function Qd({children:e,disabled:t=!1,onRefresh:n}){let{t:r}=R(),i=(0,_.useRef)(null),a=(0,_.useRef)(0),[o,s]=(0,_.useState)(0),[c,l]=(0,_.useState)(!1),[u,d]=(0,_.useState)(!1),[f,p]=(0,_.useState)(!1),m=(0,_.useCallback)(()=>{u||(p(!1),d(!0),s(56),n().catch(()=>p(!0)).finally(()=>{d(!1),s(0)}))},[u,n]);(0,_.useEffect)(()=>{let e=i.current;if(!e)return;let n=null;function r(){n=null,a.current=0,l(!1),s(0)}function o(e){t||u||e.touches.length!==1||window.scrollY>1||!window.matchMedia(`(any-pointer: coarse)`).matches||document.body.style.overflow===`hidden`||e.target.closest(Xd)||(n={x:e.touches[0].clientX,y:e.touches[0].clientY})}function c(e){if(!n||e.touches.length!==1)return;let t=e.touches[0].clientX-n.x,i=e.touches[0].clientY-n.y;if(window.scrollY>1||Math.abs(t)>Math.abs(i)){r();return}if(i<=0){a.current=0,s(0);return}e.preventDefault();let o=Math.min(Yd,i*.72);a.current=o,l(!0),s(o)}function d(){if(!n)return;let e=a.current>=Jd;a.current>8&&Zd(),r(),e&&m()}return e.addEventListener(`touchstart`,o,{passive:!0}),e.addEventListener(`touchmove`,c,{passive:!1}),e.addEventListener(`touchend`,d),e.addEventListener(`touchcancel`,r),()=>{e.removeEventListener(`touchstart`,o),e.removeEventListener(`touchmove`,c),e.removeEventListener(`touchend`,d),e.removeEventListener(`touchcancel`,r)}},[t,u,n,m]);let h=u?1:Math.min(1,o/Jd);return(0,U.jsxs)(`div`,{ref:i,children:[(0,U.jsx)(`button`,{type:`button`,className:`sr-only focus:not-sr-only sm:hidden`,onClick:m,disabled:t||u,children:r(`items.refresh`)}),(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`relative flex items-center justify-center overflow-hidden`,style:{height:o,transition:c?`none`:`height 220ms ease-out`},children:(0,U.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full border border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text)] shadow-sm`,style:{opacity:Math.min(1,o/30),transform:`scale(${.65+h*.35})`},children:(0,U.jsxs)(`svg`,{className:`h-5 w-5 ${u?`animate-spin motion-reduce:animate-none`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,style:u?void 0:{transform:`rotate(${h*270}deg)`},children:[(0,U.jsx)(`path`,{d:`M18 7a8 8 0 1 0 2 5`,pathLength:`100`,strokeDasharray:`${h*100} 100`}),(0,U.jsx)(`path`,{d:`M18 3v4h-4`,opacity:h})]})})}),u&&(0,U.jsx)(`span`,{className:`sr-only`,role:`status`,children:r(`items.refreshing`)}),f&&(0,U.jsx)(`p`,{className:`mb-3 text-center text-sm text-[var(--c-danger)]`,role:`alert`,children:r(`items.refreshFailed`)}),e]})}function $d(){let{user:e}=mo(),t=xl(El()),[n,r]=(0,_.useState)(!1),i=!!e?.intro_dismissed_at;return(0,_.useEffect)(()=>{let n=!0;if(r(!1),t&&e&&i)return Promise.resolve(!t.applies||t.applies({id:e.id,email:e.email,display_name:e.display_name??null})).then(e=>{n&&r(e===!0)}).catch(()=>{n&&r(!1)}),()=>{n=!1}},[t?.mount,t?.applies,e?.id,i]),!t||!n?null:(0,U.jsx)(Uu,{name:`articles-notice`,mount:t.mount})}function ef(){let{t:e}=R(),{user:t,setCurrentUser:n}=mo(),[r,i]=(0,_.useState)(!1);if(!t||t.intro_dismissed_at)return null;async function a(){i(!0);try{n(await H.dismissIntro())}catch{i(!1)}}let o=[{key:`views`,className:`hidden sm:flex`,icon:(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`}),(0,U.jsx)(`path`,{d:`M18 14h-8`}),(0,U.jsx)(`path`,{d:`M15 18h-5`}),(0,U.jsx)(`path`,{d:`M10 6h8v4h-8V6Z`})]})},{key:`unread`,solid:!0,icon:(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})},{key:`star`,icon:(0,U.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})},{key:`folders`,icon:(0,U.jsx)(`path`,{d:`M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2Z`})}];return(0,U.jsxs)(`section`,{className:`card animate-fade-in flex flex-col gap-5 p-5 sm:p-7 shadow-xs`,"aria-labelledby":`intro-title`,children:[(0,U.jsxs)(`div`,{className:`flex items-start justify-between gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h2`,{id:`intro-title`,className:`text-xl sm:text-2xl font-bold tracking-tight text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:e(`intro.title`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs sm:text-sm leading-relaxed text-[var(--c-text-muted)]`,children:e(`intro.subtitle`)})]}),(0,U.jsx)(`button`,{type:`button`,onClick:a,disabled:r,"aria-label":e(`common.close`),className:`shrink-0 rounded-lg p-1 text-[var(--c-text-muted)] hover:bg-[var(--c-surface-hover)] hover:text-[var(--c-text)] cursor-pointer`,children:(0,U.jsx)(od,{})})]}),(0,U.jsx)(`ul`,{className:`grid gap-3 sm:grid-cols-2`,children:o.map(t=>(0,U.jsxs)(`li`,{className:`flex items-start gap-3.5 rounded-2xl border border-[var(--c-border)]/80 bg-[var(--c-surface-hover)]/25 p-4 ${t.className??``}`,children:[(0,U.jsx)(`div`,{className:`flex h-9 w-9 shrink-0 items-center justify-center rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text)]`,children:(0,U.jsx)(`svg`,{className:t.solid?`h-3.5 w-3.5`:`h-4 w-4`,viewBox:`0 0 24 24`,fill:t.solid?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:t.solid?2.2:2,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:t.icon})}),(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h3`,{className:`text-sm sm:text-base font-bold text-[var(--c-text)]`,style:{fontFamily:`Manrope, sans-serif`},children:e(`intro.${t.key}Title`)}),(0,U.jsx)(`p`,{className:`mt-0.5 text-xs sm:text-sm leading-relaxed text-[var(--c-text-muted)]`,children:e(`intro.${t.key}Text`)})]})]},t.key))}),(0,U.jsx)(`button`,{type:`button`,onClick:a,disabled:r,className:`btn-primary self-start`,children:e(`intro.done`)})]})}var tf=50;function nf(){return(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`circle`,{cx:`11`,cy:`11`,r:`8`}),(0,U.jsx)(`line`,{x1:`21`,y1:`21`,x2:`16.65`,y2:`16.65`})]})}var rf=`(max-width: 639px)`;function af(){return(0,_.useSyncExternalStore)(e=>{let t=window.matchMedia(rf);return t.addEventListener(`change`,e),()=>t.removeEventListener(`change`,e)},()=>window.matchMedia(rf).matches)}function of(){let{t:e,i18n:t}=R(),[n,r]=Vi(),[i,a]=(0,_.useState)([]),[o,s]=(0,_.useState)(!1),[c,l]=(0,_.useState)(!1),{syncAllowed:u}=qu(),[d,f]=(0,_.useState)([]),[p,m]=(0,_.useState)([]),[h,g]=(0,_.useState)(!0),[v,y]=(0,_.useState)(!1),[b,x]=(0,_.useState)(!1),[S,C]=(0,_.useState)(!1),[w,T]=(0,_.useState)(!1),E=(0,_.useRef)(0),D=(0,_.useRef)(0),O=(0,_.useRef)(!1),[k,A]=(0,_.useState)(null),[j,ee]=(0,_.useState)(!1),[te,ne]=(0,_.useState)(()=>{try{return localStorage.getItem(`feedkeeper_items_view`)===`newspaper`?`newspaper`:`list`}catch{return`list`}}),re=af()?`newspaper`:te;function ie(e){if(e!==te){Xa(),ne(e),window.scrollTo({top:0,behavior:`instant`});try{localStorage.setItem(`feedkeeper_items_view`,e)}catch{}}}let ae=`feedkeeper_filter_scope`,oe=`feedkeeper_filter_unread`,se=`feedkeeper_filter_bookmarked`,ce=n.get(`article`),le=(()=>{let e=n.get(`feed`);if(e)return`feed:${e}`;let t=n.get(`folder`);if(t)return`folder:${t}`;try{let e=localStorage.getItem(ae);if(e)return e}catch{}return``})(),M=(()=>{try{let e=localStorage.getItem(oe);if(e!==null)return e===`true`}catch{}return!0})(),ue=(()=>{if(n.get(`saved`)===`1`)return!0;if(n.get(`article`))return!1;try{let e=localStorage.getItem(se);if(e!==null)return e===`true`}catch{}return!1})(),[de,fe]=(0,_.useState)(le),[pe,me]=(0,_.useState)(M),[he,ge]=(0,_.useState)(ue),_e=pe&&!he,[N,P]=(0,_.useState)(``),[ve,F]=(0,_.useState)(!1),ye=(0,_.useRef)(null),be=(0,_.useRef)(null),xe=(0,_.useRef)(null),[I,Se]=(0,_.useState)(61),[Ce,we]=(0,_.useState)(!1);(0,_.useEffect)(()=>{let e=document.querySelector(`[data-app-header]`);if(!e)return;let t=new ResizeObserver(()=>Se(e.getBoundingClientRect().height));return t.observe(e),()=>t.disconnect()},[]),(0,_.useEffect)(()=>{function e(){let e=xe.current?.getBoundingClientRect().top;we(window.scrollY>0&&e!==void 0&&e<=I+1)}return e(),window.addEventListener(`scroll`,e,{passive:!0}),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`scroll`,e),window.removeEventListener(`resize`,e)}},[I]),(0,_.useEffect)(()=>{ve&&ye.current?.focus()},[ve]),(0,_.useEffect)(()=>{let e=window.matchMedia(`(min-width: 640px)`),t=()=>{e.matches&&F(!1)};return e.addEventListener(`change`,t),()=>e.removeEventListener(`change`,t)},[]);function Te(){F(!1),requestAnimationFrame(()=>be.current?.focus())}function Ee(e){Xa(),P(e)}function De(){Xa(),me(e=>{let t=!e;try{localStorage.setItem(oe,String(t))}catch{}return t})}function Oe(){Xa(),ge(e=>{let t=!e;try{localStorage.setItem(se,String(t))}catch{}return t})}(0,_.useEffect)(()=>{if(h||O.current)return;let e=Ja(),t=requestAnimationFrame(()=>{e>0&&window.scrollTo({top:e,behavior:`instant`}),O.current=!0});return()=>cancelAnimationFrame(t)},[h]),(0,_.useEffect)(()=>{function e(){O.current&&document.body.style.overflow!==`hidden`&&Ya(window.scrollY)}return window.addEventListener(`scroll`,e,{passive:!0}),()=>{O.current&&document.body.style.overflow!==`hidden`&&Ya(window.scrollY),window.removeEventListener(`scroll`,e)}},[]),(0,_.useEffect)(()=>{let e=n.get(`feed`),t=n.get(`folder`);if(e){let t=`feed:${e}`;t!==de&&Xa(),fe(t);try{localStorage.setItem(ae,t)}catch{}}else if(t){let e=`folder:${t}`;e!==de&&Xa(),fe(e);try{localStorage.setItem(ae,e)}catch{}}else if(le&&!n.toString()){let e=new URLSearchParams(n);le.startsWith(`feed:`)?e.set(`feed`,le.slice(5)):le.startsWith(`folder:`)&&e.set(`folder`,le.slice(7)),r(e,{replace:!0})}},[n]);function ke(e){Xa(),fe(e);try{e?localStorage.setItem(ae,e):localStorage.removeItem(ae)}catch{}let t=new URLSearchParams(n);t.delete(`feed`),t.delete(`folder`),e.startsWith(`feed:`)?t.set(`feed`,e.slice(5)):e.startsWith(`folder:`)&&t.set(`folder`,e.slice(7)),r(t,{replace:!0})}(0,_.useEffect)(()=>{Promise.all([H.listFeeds(),H.listFolders().then(e=>({...e,ok:!0})).catch(()=>({folders:[],ok:!1}))]).then(([e,t])=>{a(e),f(t.folders),l(t.ok),s(!0)}).catch(e=>console.error(`Failed to load initial feeds/folders:`,e))},[]),(0,_.useEffect)(()=>{o&&de&&(de.startsWith(`feed:`)?!i.some(e=>`feed:${e.id}`===de):de.startsWith(`folder:`)&&c&&!d.some(e=>`folder:${e.id}`===de))&&ke(``)},[o,c,i,d,de]);let Ae=de.startsWith(`feed:`)?Number(de.slice(5)):void 0,je=Ae===void 0?void 0:i.find(e=>e.id===Ae),Me=je?je.kind_override??je.detected_kind??`article`:`article`,Ne=de.startsWith(`folder:`)?Number(de.slice(7)):void 0,Pe=!N&&!he&&Ae===void 0&&Ne===void 0,Fe=Pe&&i.length>0&&i.every(e=>!e.last_polled_at);async function Ie(){try{let[e,t]=await Promise.all([H.listFeeds(),H.listFolders().then(e=>({...e,ok:!0})).catch(()=>({folders:[],ok:!1}))]);return e.length===0&&(n.has(`folder`)||n.has(`feed`))&&(r({},{replace:!0}),fe(``)),a(e),f(t.folders),l(t.ok),s(!0),e}catch(e){return console.error(`Failed to reload feeds:`,e),null}}async function Le(){await Ie(),await Re(),oo()}async function Re(){let e=++E.current;g(!0),y(!1),C(!1),x(!1);try{let t=await H.listItems({feedId:Ae,folderId:Ne,unreadOnly:_e,bookmarkedOnly:he,search:N||void 0,limit:tf});e===E.current&&(m(t),D.current=t.length,T(t.length===tf))}catch(t){e===E.current&&(console.error(`Failed to load items:`,t),y(!0))}finally{e===E.current&&g(!1)}}async function ze(){if(b||!w)return;let e=E.current,t=_e||he?p.filter(e=>(!_e||!e.read)&&(!he||e.bookmarked)).length:D.current;x(!0),C(!1);try{let n=await H.listItems({feedId:Ae,folderId:Ne,unreadOnly:_e,bookmarkedOnly:he,search:N||void 0,limit:tf,offset:t});e===E.current&&(D.current=t+n.length,m(e=>{let t=new Set(e.map(e=>e.id));return[...e,...n.filter(e=>!t.has(e.id))]}),T(n.length===tf))}catch(t){e===E.current&&(console.error(`Failed to load more items:`,t),C(!0))}finally{e===E.current&&x(!1)}}let Be=(0,_.useRef)(ze);Be.current=ze;let Ve=(0,_.useRef)(null);(0,_.useEffect)(()=>{let e=Ve.current;if(!e||!w||S||b||v)return;let t=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&Be.current()},{rootMargin:`600px 0px`});return t.observe(e),()=>t.disconnect()},[w,S,b,v,p.length]),(0,_.useEffect)(()=>{m([]),g(!0),T(!1),x(!1);let e=setTimeout(()=>{Re()},200);return()=>{clearTimeout(e),E.current++}},[de,pe,he,N]),(0,_.useEffect)(()=>{if(!Fe)return;let e=0,t=setInterval(()=>{e++,Ie().then(e=>{e?.some(e=>e.last_polled_at)&&Re()}),e>=45&&clearInterval(t)},4e3);return()=>clearInterval(t)},[Fe]);let He=(0,_.useRef)(null);(0,_.useEffect)(()=>{if(ce){let e=p.find(e=>e.id===Number(ce));A(e??null),e&&!e.read&&He.current!==e.id&&(He.current=e.id,H.markRead(e.id).then(oo).catch(()=>{}),m(t=>t.map(t=>t.id===e.id?{...t,read:!0}:t)))}else A(null)},[ce,p]);function Ue(e,t=!1){t||nt(null),A(e),e.read||(H.markRead(e.id).then(oo).catch(()=>{}),m(t=>t.map(t=>t.id===e.id?{...t,read:!0}:t)),A({...e,read:!0}));let i=new URLSearchParams(n);i.set(`article`,String(e.id)),r(i)}function We(){A(null);let e=new URLSearchParams(n);e.delete(`article`),r(e)}let Ge=k?p.findIndex(e=>e.id===k.id):-1,Ke=Ge>=0&&Ge<p.length-1,qe=Ge>0;function Je(){Ke&&Ue(p[Ge+1])}function Ye(){qe&&Ue(p[Ge-1])}async function Xe(t){try{await t()}catch(t){if(!(t instanceof Sa&&t.status===0))throw t;q.error(e(`common.offlineAction`))}}async function Ze(e){let t=!e.read;e.read?await H.markUnread(e.id):await H.markRead(e.id),oo(),m(n=>n.map(n=>n.id===e.id?{...n,read:t}:n)),k?.id===e.id&&A(e=>e?{...e,read:t}:null)}async function L(e){let t=!e.bookmarked;e.bookmarked?await H.unbookmarkItem(e.id):await H.bookmarkItem(e.id),window.setTimeout(()=>void Wa({force:!0}),t?2e4:0),m(n=>he&&!t&&k?.id!==e.id?n.filter(t=>t.id!==e.id):n.map(n=>n.id===e.id?{...n,bookmarked:t}:n)),k?.id===e.id&&A(e=>e?{...e,bookmarked:t}:null)}async function Qe(){await Xe(async()=>{await H.markAllRead({feedId:Ae,folderId:Ne}),await Re(),oo()})}let[$e,et]=(0,_.useState)(!1),[tt,nt]=(0,_.useState)(null),rt=(0,_.useRef)(null);async function it(){et(!0);try{let t=await H.refreshAllFeeds();await Re(),Ed(t,e)}catch{q.error(e(`items.refreshFailed`))}finally{et(!1)}}(0,_.useEffect)(()=>{k||tt==null||document.querySelector(`[data-item-id="${tt}"]`)?.scrollIntoView?.({block:`nearest`,behavior:`smooth`})},[tt,k]),(0,_.useEffect)(()=>{if(k)return;function e(e){if(document.querySelector(`[role="dialog"], [data-shortcuts-modal]`)||qc(e.target)||qc(document.activeElement)||Jc(e))return;if(e.key===`/`){e.preventDefault(),rt.current&&rt.current.offsetParent!==null?(rt.current.focus(),rt.current.select()):F(!0);return}if((e.key===`r`||e.key===`R`)&&!$e&&u){e.preventDefault(),it();return}if(e.key===`A`&&e.shiftKey){e.preventDefault(),Qe();return}if(p.length===0)return;let t=tt==null?-1:p.findIndex(e=>e.id===tt),n=t>=0?p[t]:null;if(e.key===`j`||e.key===`J`||e.key===`ArrowDown`){e.preventDefault();let n=t<0?0:Math.min(t+1,p.length-1);nt(p[n].id)}else if(e.key===`k`||e.key===`K`||e.key===`ArrowUp`){e.preventDefault();let n=t<=0?0:t-1;nt(p[n].id)}else(e.key===`Enter`||e.key===`o`||e.key===`O`)&&n?(e.preventDefault(),Ue(n,!0)):(e.key===`m`||e.key===`M`)&&n?(e.preventDefault(),Ze(n)):(e.key===`s`||e.key===`S`)&&n?(e.preventDefault(),L(n)):(e.key===`v`||e.key===`V`)&&n&&(e.preventDefault(),Yc(n.link))}return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)});let at=new Intl.DateTimeFormat(t.resolvedLanguage,{dateStyle:`medium`}),ot=new Intl.DateTimeFormat(t.resolvedLanguage,{timeStyle:`short`}),st=(0,_.useMemo)(()=>{let t=[{value:``,label:e(`items.allFeeds`)}];if(d.length>0)for(let n of d)t.push({value:`folder:${n.id}`,label:n.name,group:e(`feeds.folderGroup`),badge:n.unread_count});for(let n of i){let r=n.label??n.title??n.url;t.push({value:`feed:${n.id}`,label:r,group:e(`feeds.feedGroup`),badge:n.unread_count,icon:(0,U.jsx)($c,{feedId:n.id,iconUrl:n.icon_url,siteUrl:n.site_url,feedUrl:n.url,fallbackName:r,className:`w-4 h-4 rounded-xs shrink-0 object-contain`})})}return t},[d,i,e]),ct=de?st.find(e=>e.value===de)?.label??e(`items.title`):e(`items.allFeeds`);function lt(e){m(t=>t.map(t=>t.id===e.id?{...t,...e}:t)),A(t=>t?.id===e.id?{...t,...e}:t)}let ut=(0,U.jsxs)(`div`,{className:`flex flex-col gap-5 sm:gap-6`,children:[(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-2 sm:gap-3`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`h1`,{className:`sr-only`,children:ct}),(0,U.jsx)(Md,{className:`block`})]}),(0,U.jsxs)(`div`,{className:`flex items-center gap-2 sm:gap-3 min-w-0`,children:[(!je||!!N||Me!==`audio`&&Me!==`video`)&&(0,U.jsxs)(`div`,{className:`relative hidden h-11 w-[220px] shrink-0 grid-cols-2 rounded-xl border border-[var(--c-border)] bg-[var(--c-surface)] p-1 sm:grid`,role:`group`,"aria-label":e(`items.viewMode`),children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-y-1 left-1 w-[calc((100%-0.5rem)/2)] rounded-lg border border-[var(--c-mobile-nav-active-border)] bg-[var(--c-mobile-nav-active)] shadow-sm transition-transform duration-300 ease-[cubic-bezier(0.25,1,0.5,1)] motion-reduce:transition-none`,style:{transform:te===`newspaper`?`translateX(100%)`:`translateX(0)`}}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>ie(`list`),title:e(`items.listView`),"aria-label":e(`items.listView`),"aria-pressed":te===`list`,className:`relative z-10 flex h-full min-w-0 items-center justify-center gap-1.5 rounded-lg text-xs sm:text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] ${te===`list`?`text-[var(--c-text)]`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`,children:[(0,U.jsxs)(`svg`,{className:`h-4 w-4 transition-transform duration-200 motion-reduce:transition-none ${te===`list`?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:`M8 6h12M8 12h12M8 18h12`}),(0,U.jsx)(`circle`,{cx:`4`,cy:`6`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,U.jsx)(`circle`,{cx:`4`,cy:`12`,r:`1`,fill:`currentColor`,stroke:`none`}),(0,U.jsx)(`circle`,{cx:`4`,cy:`18`,r:`1`,fill:`currentColor`,stroke:`none`})]}),(0,U.jsx)(`span`,{className:`hidden sm:inline`,children:e(`items.listView`)})]}),(0,U.jsxs)(`button`,{type:`button`,onClick:()=>ie(`newspaper`),title:e(`items.newspaperView`),"aria-label":e(`items.newspaperView`),"aria-pressed":te===`newspaper`,className:`relative z-10 flex h-full min-w-0 items-center justify-center gap-1.5 rounded-lg text-xs sm:text-sm font-medium transition-colors focus-visible:outline-2 focus-visible:outline-[var(--c-blue3)] ${te===`newspaper`?`text-[var(--c-text)]`:`text-[var(--c-text-muted)] hover:text-[var(--c-text)]`}`,children:[(0,U.jsxs)(`svg`,{className:`h-4 w-4 transition-transform duration-200 motion-reduce:transition-none ${te===`newspaper`?`scale-105`:``}`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`path`,{d:`M4 22h16a2 2 0 0 0 2-2V4a2 2 0 0 0-2-2H8a2 2 0 0 0-2 2v16a2 2 0 0 1-2 2Zm0 0a2 2 0 0 1-2-2v-9c0-1.1.9-2 2-2h2`}),(0,U.jsx)(`path`,{d:`M18 14h-8`}),(0,U.jsx)(`path`,{d:`M15 18h-5`}),(0,U.jsx)(`path`,{d:`M10 6h8v4h-8V6Z`})]}),(0,U.jsx)(`span`,{className:`hidden sm:inline`,children:e(`items.newspaperView`)})]})]}),(0,U.jsx)(`button`,{type:`button`,onClick:it,disabled:$e||!u,title:e(u?$e?`items.refreshing`:`items.refresh`:`plan.unavailable`),"aria-label":e($e?`items.refreshing`:`items.refresh`),className:`btn-secondary hidden h-11 w-11 shrink-0 items-center justify-center p-0! sm:flex`,children:(0,U.jsx)(X,{className:`h-5 w-5 ${$e?`animate-spin motion-reduce:animate-none`:``}`})}),(0,U.jsx)(`button`,{type:`button`,onClick:Qe,title:e(`feeds.markAllRead`),"aria-label":e(`feeds.markAllRead`),className:`btn-secondary flex h-11 w-11 shrink-0 items-center justify-center p-0!`,children:(0,U.jsx)(`svg`,{className:`h-5 w-5`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,U.jsx)(`path`,{d:`M3 12l4 4 6-7M11 16l3 0 7-8`})})})]})]}),(0,U.jsxs)(`div`,{ref:xe,className:`sticky z-20 py-2`,style:{top:I},children:[Ce&&(0,U.jsx)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute -top-px bottom-0 left-1/2 w-screen -translate-x-1/2 border-y border-[var(--c-border)] backdrop-blur-md`,style:{backgroundColor:`color-mix(in srgb, var(--c-surface) 85%, transparent)`}}),(0,U.jsxs)(`div`,{className:`items-toolbar relative z-10 flex items-center gap-2 sm:gap-3 ${ve?`items-toolbar-open`:``}`,children:[(0,U.jsx)(`div`,{className:`items-toolbar-scope min-w-0 flex-1 sm:flex-none sm:w-64`,inert:ve,children:(0,U.jsx)(Ju,{value:de,onChange:ke,options:st,className:`w-full`,placeholder:e(`items.allFeeds`)})}),(0,U.jsxs)(`div`,{className:`relative hidden sm:block flex-1 min-w-0`,children:[(0,U.jsx)(`input`,{ref:rt,type:`search`,placeholder:e(`items.searchPlaceholder`),"aria-label":e(`items.searchPlaceholder`),className:`input w-full pl-9 pr-3`,value:N,onChange:e=>Ee(e.target.value),onFocus:()=>ee(!0),onBlur:()=>ee(!1)}),(0,U.jsx)(`span`,{className:`absolute left-3 top-1/2 -translate-y-1/2 pointer-events-none opacity-45 text-[var(--c-text-muted)]`,children:(0,U.jsx)(nf,{})})]}),(0,U.jsxs)(`div`,{className:`items-toolbar-search relative h-[38px] min-w-0 overflow-hidden sm:hidden`,children:[(0,U.jsx)(`button`,{ref:be,type:`button`,onClick:()=>F(!0),"aria-label":e(`items.searchPlaceholder`),"aria-controls":`mobile-article-search`,"aria-expanded":ve,title:e(`items.searchPlaceholder`),"aria-hidden":ve,tabIndex:ve?-1:0,className:`absolute inset-y-0 left-0 z-10 flex w-[38px] items-center justify-center rounded-lg border transition-opacity duration-150 ${ve?`pointer-events-none opacity-0`:N?`border-[var(--c-blue3)] bg-[var(--c-surface-hover)] text-[var(--c-text)] opacity-100`:`border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text-muted)] opacity-100`}`,children:(0,U.jsx)(nf,{})}),(0,U.jsxs)(`div`,{className:`flex h-full min-w-0 items-center gap-2 transition-opacity duration-200 ${ve?`opacity-100 delay-75`:`pointer-events-none opacity-0`}`,inert:!ve,children:[(0,U.jsx)(`span`,{className:`pointer-events-none absolute left-3 top-1/2 -translate-y-1/2 text-[var(--c-text-muted)] opacity-60`,children:(0,U.jsx)(nf,{})}),(0,U.jsx)(`input`,{id:`mobile-article-search`,ref:ye,type:`search`,placeholder:e(`items.searchPlaceholder`),"aria-label":e(`items.searchPlaceholder`),className:`input min-w-0 flex-1 pl-9`,value:N,onChange:e=>Ee(e.target.value),onFocus:()=>ee(!0),onBlur:()=>ee(!1),onKeyDown:e=>{e.key===`Escape`&&Te()}}),(0,U.jsx)(`button`,{type:`button`,onClick:Te,"aria-label":e(`common.close`),title:e(`common.close`),className:`w-[38px] h-[38px] rounded-lg border border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text-muted)] flex items-center justify-center shrink-0 cursor-pointer`,children:(0,U.jsxs)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,"aria-hidden":`true`,children:[(0,U.jsx)(`line`,{x1:`18`,y1:`6`,x2:`6`,y2:`18`}),(0,U.jsx)(`line`,{x1:`6`,y1:`6`,x2:`18`,y2:`18`})]})})]})]}),(0,U.jsxs)(`div`,{className:`items-toolbar-filters flex items-center gap-1.5 sm:gap-2 shrink-0`,inert:ve,children:[(0,U.jsx)(`button`,{type:`button`,onClick:Oe,title:e(he?`items.all`:`items.bookmarkedOnly`),"aria-label":e(`items.bookmarkedOnly`),"aria-pressed":he,className:`w-[38px] h-[38px] rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${he?`bg-amber-500/15 border-amber-500/40 text-amber-500`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500 hover:border-amber-500/30`}`,children:(0,U.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:he?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:De,disabled:he,title:e(he?`items.unreadIgnoredInSaved`:pe?`items.all`:`items.unreadOnly`),"aria-label":e(`items.unreadOnly`),"aria-pressed":_e,className:`w-[38px] h-[38px] rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer disabled:cursor-default disabled:opacity-40 ${_e?`bg-[var(--c-surface-hover)] border-[var(--c-blue3)] text-[var(--c-text)] shadow-xs`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:border-[var(--c-blue3)]`}`,children:(0,U.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:_e?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2.2`,children:(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})})]})]}),(j||ve||N.trim().length>0)&&(0,U.jsx)(`div`,{className:`relative z-10 mt-2 flex flex-wrap items-center gap-1.5 sm:pl-[calc(16rem+0.75rem)]`,children:[{token:`has:audio`,label:e(`items.filterAudio`)},{token:`has:video`,label:e(`items.filterVideo`)},{token:`has:notes`,label:e(`items.filterNotes`)}].map(({token:e,label:t})=>{let n=RegExp(`(?:^|\\s)${e}(?:\\s|$)`,`i`).test(N);return(0,U.jsx)(`button`,{type:`button`,"aria-pressed":n,onMouseDown:e=>e.preventDefault(),onClick:()=>{let t=N.replace(RegExp(`(?:^|\\s)${e}(?=\\s|$)`,`gi`),` `).replace(/\s+/g,` `).trim();Ee(n?t:t?`${t} ${e}`:e)},className:`rounded-full border px-2.5 py-0.5 text-xs font-medium transition-colors cursor-pointer ${n?`border-[var(--c-blue3)] bg-[var(--c-blue3)]/15 text-[var(--c-text)]`:`border-[var(--c-border)] bg-[var(--c-surface)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:border-[var(--c-blue3)]/60`}`,children:t},e)})})]}),o&&i.length>0&&!u&&(0,U.jsx)(_d,{}),o&&i.length>0&&!v&&(0,U.jsx)(ef,{}),o&&i.length>0&&!v&&(0,U.jsx)($d,{}),p.length>0&&je?.last_error&&(0,U.jsxs)(`div`,{role:`status`,className:`mb-4 flex items-center gap-2 rounded-lg border px-3.5 py-2.5 text-sm text-[var(--c-danger)]`,style:{borderColor:`var(--c-border)`,background:`var(--c-surface)`},children:[(0,U.jsx)(sd,{}),(0,U.jsx)(`span`,{children:Xu(e,je.last_error,je.url)})]}),v?(0,U.jsxs)(`div`,{role:`alert`,className:`flex flex-col items-start gap-3`,children:[(0,U.jsx)(`p`,{style:{color:`var(--c-text-muted)`},children:e(`items.loadFailed`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>void Re(),className:`btn-secondary`,children:e(`common.retry`)})]}):h&&p.length===0?(0,U.jsx)(Gu,{size:`lg`}):p.length===0&&o&&i.length===0?(0,U.jsx)(Sd,{onSubscribed:Le}):p.length===0&&Fe?(0,U.jsxs)(`div`,{role:`status`,className:`card flex flex-col items-center gap-3 px-6 py-12 text-center`,children:[(0,U.jsx)(Gu,{size:`lg`}),(0,U.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`welcome.fetchingTitle`)}),(0,U.jsx)(`p`,{className:`max-w-sm text-sm text-[var(--c-text-muted)]`,children:e(`welcome.fetchingHint`)})]}):p.length===0&&!N&&!he&&je?.last_error?(0,U.jsxs)(`div`,{role:`status`,className:`card flex flex-col items-center gap-3 px-6 py-12 text-center`,children:[(0,U.jsx)(`div`,{className:`flex h-10 w-10 items-center justify-center rounded-full bg-[var(--c-danger)]/10 text-[var(--c-danger)]`,children:(0,U.jsx)(sd,{})}),(0,U.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`items.feedUnavailableTitle`)}),(0,U.jsx)(`p`,{className:`max-w-md text-sm text-[var(--c-text-muted)]`,children:Xu(e,je.last_error,je.url)})]}):p.length===0&&Pe&&_e&&i.length>0?(0,U.jsxs)(`div`,{className:`card flex flex-col items-center gap-3 px-6 py-12 text-center`,children:[(0,U.jsx)(`h2`,{className:`text-lg font-semibold`,children:e(`items.allReadTitle`)}),(0,U.jsx)(`p`,{className:`max-w-sm text-sm text-[var(--c-text-muted)]`,children:e(`items.allReadHint`)}),(0,U.jsx)(`button`,{type:`button`,onClick:()=>me(!1),className:`btn-secondary mt-1`,children:e(`items.all`)})]}):p.length===0?(0,U.jsx)(`p`,{style:{color:`var(--c-text-muted)`},children:e(he&&!N?`items.noSaved`:N?`items.noResults`:`items.noItems`)}):je&&!N&&Me===`audio`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Wd,{feed:je}),(0,U.jsx)(Kd,{feed:je,items:p,focusedItemId:tt,onOpen:Ue,onBookmark:L,onRead:Ze})]}):je&&!N&&Me===`video`?(0,U.jsxs)(U.Fragment,{children:[(0,U.jsx)(Wd,{feed:je}),(0,U.jsx)(qd,{items:p,focusedItemId:tt,onOpen:Ue,onBookmark:L})]}):re===`newspaper`?(0,U.jsx)(Vd,{items:p,focusedItemId:tt,onOpen:Ue,onBookmark:L,onRead:Ze}):(0,U.jsx)(`ul`,{className:`flex flex-col gap-4 sm:gap-5 animate-page-fade`,children:p.map(t=>{let n=t.published_at?new Date(t.published_at):null,r=tt===t.id;return(0,U.jsx)(`li`,{"data-item-id":t.id,onClick:()=>Ue(t),className:`card overflow-hidden p-4 sm:p-0 transition-colors duration-150 hover:bg-[var(--c-surface-hover)] hover:border-[var(--c-blue3)]/60 cursor-pointer group/card ${r?`ring-2 ring-[var(--c-blue3)] border-[var(--c-blue3)] bg-[var(--c-surface-hover)]`:``}`,style:{opacity:t.read?.6:1},children:(0,U.jsxs)(`div`,{className:`flex flex-col sm:flex-row sm:items-stretch justify-between gap-3 sm:gap-0`,children:[t.image_url&&(0,U.jsx)(`div`,{className:`order-first w-[calc(100%+2rem)] -mx-4 -mt-4 sm:m-0 sm:w-52 sm:min-w-52 h-48 sm:h-auto sm:self-stretch overflow-hidden shrink-0 border-b sm:border-b-0 sm:border-r bg-[var(--c-bg)] group transition-opacity hover:opacity-90 block`,style:{borderColor:`var(--c-border)`},children:(0,U.jsx)(`img`,{src:t.image_url,alt:``,className:`w-full h-full object-cover group-hover:scale-105 transition-transform duration-200`,loading:`lazy`,onError:e=>{let t=e.currentTarget.parentElement;t&&(t.style.display=`none`)}})}),(0,U.jsxs)(`div`,{className:`min-w-0 flex-1 sm:p-5 sm:pr-3 flex flex-col justify-between`,children:[(0,U.jsxs)(`div`,{children:[(0,U.jsxs)(`div`,{className:`mb-3 flex min-w-0 items-center gap-2 text-xs font-semibold tracking-[0.08em] uppercase text-[var(--c-text-muted)]`,children:[(0,U.jsx)($c,{feedId:t.feed_id,iconUrl:t.feed_icon_url,siteUrl:t.feed_site_url,feedUrl:t.feed_url,articleUrl:t.link,className:`w-3.5 h-3.5 rounded-xs shrink-0 object-contain`}),(0,U.jsx)(`span`,{className:`truncate`,children:t.feed_title}),(t.enclosure_url||nl(t.link))&&(0,U.jsxs)(`span`,{className:`ml-auto inline-flex items-center gap-1 rounded-full border border-[var(--c-border)] px-2 py-0.5 text-[11px] font-medium tracking-normal normal-case text-[var(--c-text-muted)] shrink-0`,children:[(0,U.jsx)(`span`,{"aria-hidden":`true`,children:t.enclosure_type?.startsWith(`video/`)||!t.enclosure_url&&nl(t.link)?`▶`:`🎧`}),t.enclosure_duration_seconds?tl(t.enclosure_duration_seconds):t.enclosure_type?.startsWith(`video/`)||!t.enclosure_url&&nl(t.link)?`Video`:`Audio`]})]}),(0,U.jsx)(`h2`,{lang:Po(t.title),className:`text-lg leading-snug font-semibold text-[var(--c-text)]${Po(t.title)===`ja`?` ja-phrases`:``}`,children:t.title?(0,U.jsx)(el,{text:t.title}):null}),(0,U.jsx)(Id,{item:t,className:`mt-3 text-sm leading-relaxed line-clamp-3 text-[var(--c-text-muted)]`})]}),(0,U.jsxs)(`div`,{className:`flex items-center justify-between gap-3 text-xs pt-5`,style:{color:`var(--c-text-muted)`},children:[(0,U.jsx)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 min-w-0`,children:n&&(0,U.jsxs)(U.Fragment,{children:[(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`rect`,{x:`3`,y:`4`,width:`18`,height:`18`,rx:`2`,ry:`2`}),(0,U.jsx)(`line`,{x1:`16`,y1:`2`,x2:`16`,y2:`6`}),(0,U.jsx)(`line`,{x1:`8`,y1:`2`,x2:`8`,y2:`6`}),(0,U.jsx)(`line`,{x1:`3`,y1:`10`,x2:`21`,y2:`10`})]}),(0,U.jsx)(`span`,{children:at.format(n)})]}),(0,U.jsxs)(`span`,{className:`inline-flex items-center gap-1.5`,children:[(0,U.jsxs)(`svg`,{className:`w-3.5 h-3.5 shrink-0 opacity-70`,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:[(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`10`}),(0,U.jsx)(`polyline`,{points:`12 6 12 12 16 14`})]}),(0,U.jsx)(`span`,{children:ot.format(n)})]})]})}),(0,U.jsxs)(`div`,{className:`flex sm:hidden items-center gap-2 shrink-0`,onClick:e=>e.stopPropagation(),children:[(0,U.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),L(t)},title:t.bookmarked?e(`items.unbookmark`):e(`items.bookmark`),"aria-label":t.bookmarked?e(`items.unbookmark`):e(`items.bookmark`),className:`w-8 h-8 rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${t.bookmarked?`bg-amber-500/15 border-amber-500/40 text-amber-500`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500 hover:border-amber-500/30`}`,children:(0,U.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:t.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),Ze(t)},title:t.read?e(`items.markUnread`):e(`items.markRead`),"aria-label":t.read?e(`items.markUnread`):e(`items.markRead`),className:`w-8 h-8 rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${t.read?`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:border-[var(--c-blue3)]`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-blue1)] hover:border-[var(--c-blue3)]`}`,children:(0,U.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:t.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2.2`,children:(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})})]})]})]}),(0,U.jsxs)(`div`,{className:`hidden sm:flex items-center gap-2 pt-5 pr-5 shrink-0 self-start`,onClick:e=>e.stopPropagation(),children:[(0,U.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),L(t)},title:t.bookmarked?e(`items.unbookmark`):e(`items.bookmark`),"aria-label":t.bookmarked?e(`items.unbookmark`):e(`items.bookmark`),className:`w-9 h-9 rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${t.bookmarked?`bg-amber-500/15 border-amber-500/40 text-amber-500`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-amber-500 hover:border-amber-500/30`}`,children:(0,U.jsx)(`svg`,{className:`w-4 h-4`,viewBox:`0 0 24 24`,fill:t.bookmarked?`currentColor`:`none`,stroke:`currentColor`,strokeWidth:`2`,strokeLinecap:`round`,strokeLinejoin:`round`,children:(0,U.jsx)(`polygon`,{points:`12 2 15.09 8.26 22 9.27 17 14.14 18.18 21.02 12 17.77 5.82 21.02 7 14.14 2 9.27 8.91 8.26 12 2`})})}),(0,U.jsx)(`button`,{type:`button`,onClick:e=>{e.stopPropagation(),Ze(t)},title:t.read?e(`items.markUnread`):e(`items.markRead`),"aria-label":t.read?e(`items.markUnread`):e(`items.markRead`),className:`w-9 h-9 rounded-lg border flex items-center justify-center shrink-0 transition-colors cursor-pointer ${t.read?`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-text-muted)] hover:text-[var(--c-text)] hover:border-[var(--c-blue3)]`:`bg-[var(--c-surface)] border-[var(--c-border)] text-[var(--c-blue1)] hover:border-[var(--c-blue3)]`}`,children:(0,U.jsx)(`svg`,{className:`w-3.5 h-3.5`,viewBox:`0 0 24 24`,fill:t.read?`none`:`currentColor`,stroke:`currentColor`,strokeWidth:`2.2`,children:(0,U.jsx)(`circle`,{cx:`12`,cy:`12`,r:`9`})})})]})]})},t.id)})}),!v&&p.length>0&&(w||S)&&(S?(0,U.jsx)(`button`,{type:`button`,onClick:()=>{ze()},className:`btn-secondary self-center`,children:e(`common.retry`)}):(0,U.jsx)(`div`,{ref:Ve,className:`flex min-h-12 items-center justify-center`,children:b&&(0,U.jsx)(Gu,{size:`sm`})})),(0,U.jsx)(il,{item:k,isOpen:!!k,onClose:We,onToggleBookmark:L,onToggleRead:Ze,onNext:Je,onPrevious:Ye,onItemUpdated:lt,hasNext:Ke,hasPrev:qe})]});return(0,U.jsx)(Qd,{disabled:h||!u||!!k||ve,onRefresh:it,children:ut})}function sf(e,t){let n=Math.min(e,t);return{sx:Math.round((e-n)/2),sy:Math.round((t-n)/2),size:n}}async function cf(e){let t=await createImageBitmap(e);try{let{sx:e,sy:n,size:r}=sf(t.width,t.height),i=document.createElement(`canvas`);i.width=256,i.height=256;let a=i.getContext(`2d`);if(!a)throw Error(`canvas_unavailable`);return a.fillStyle=`#ffffff`,a.fillRect(0,0,256,256),a.imageSmoothingQuality=`high`,a.drawImage(t,e,n,r,r,0,0,256,256),await new Promise((e,t)=>{i.toBlob(n=>n?e(n):t(Error(`encode_failed`)),`image/jpeg`,.88)})}finally{t.close()}}function lf({title:e,description:t,children:n,footer:r}){return(0,U.jsxs)(`section`,{className:`card`,children:[(e||t)&&(0,U.jsxs)(`header`,{className:`px-5 pt-5 pb-1 sm:px-6`,children:[e&&(0,U.jsx)(`h3`,{className:`text-base font-semibold`,children:e}),t&&(0,U.jsx)(`p`,{className:`mt-1 text-sm text-[var(--c-text-muted)]`,children:t})]}),(0,U.jsx)(`div`,{className:`divide-y divide-[var(--c-border)]`,children:n}),r&&(0,U.jsx)(`footer`,{className:`flex flex-wrap items-center justify-end gap-3 border-t border-[var(--c-border)] px-5 py-4 sm:px-6`,children:r})]})}function uf({label:e,hint:t,htmlFor:n,children:r,stacked:i=!1,inline:a=!1}){return(0,U.jsxs)(`div`,{className:`flex gap-3 px-5 py-4 sm:px-6 ${i?`flex-col`:a?`flex-row items-center justify-between gap-4 sm:gap-6`:`flex-col sm:flex-row sm:items-center sm:justify-between sm:gap-6`}`,children:[(0,U.jsxs)(`div`,{className:`min-w-0`,children:[(0,U.jsx)(`label`,{htmlFor:n,className:`text-sm font-medium`,children:e}),t&&(0,U.jsx)(`p`,{className:`mt-0.5 text-sm text-[var(--c-text-muted)]`,children:t})]}),r&&(0,U.jsx)(`div`,{className:i?``:`shrink-0`,children:r})]})}function df({children:e}){return(0,U.jsx)(`div`,{className:`px-5 py-4 sm:px-6`,children:e})}function ff({id:e,checked:t,onChange:n,label:r}){return(0,U.jsxs)(`label`,{className:`relative inline-flex cursor-pointer items-center`,children:[(0,U.jsx)(`input`,{id:e,type:`checkbox`,className:`peer sr-only`,checked:t,onChange:e=>n(e.target.checked),"aria-label":r}),(0,U.jsx)(`span`,{className:`h-6 w-11 rounded-full bg-[var(--c-border)] transition-colors peer-checked:bg-[var(--c-blue1)] peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 peer-focus-visible:outline-[var(--c-blue3)] after:absolute after:left-[2px] after:top-[2px] after:h-5 after:w-5 after:rounded-full after:bg-white after:shadow-sm after:transition-transform after:content-[''] peer-checked:after:translate-x-5`})]})}function Q({message:e}){return e?(0,U.jsx)(`p`,{role:`status`,className:`text-sm ${e.type===`error`?`text-danger`:`text-[var(--c-green3)]`}`,children:e.text}):null}function pf({title:e,description:t}){return(0,U.jsxs)(`div`,{className:`mb-5`,children:[(0,U.jsx)(`h2`,{className:`text-xl font-semibold`,children:e}),t&&(0,U.jsx)(`p`,{className:`mt-1 text-sm text-[var(--c-text-muted)]`,children:t})]})}var mf=o(((e,t)=>{t.exports=function(){return typeof Promise==`function`&&Promise.prototype&&Promise.prototype.then}})),hf=o((e=>{var t,n=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];e.getSymbolSize=function(e){if(!e)throw Error(`"version" cannot be null or undefined`);if(e<1||e>40)throw Error(`"version" should be in range from 1 to 40`);return e*4+17},e.getSymbolTotalCodewords=function(e){return n[e]},e.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t},e.setToSJISFunction=function(e){if(typeof e!=`function`)throw Error(`"toSJISFunc" is not a valid function.`);t=e},e.isKanjiModeEnabled=function(){return t!==void 0},e.toSJIS=function(e){return t(e)}})),gf=o((e=>{e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`l`:case`low`:return e.L;case`m`:case`medium`:return e.M;case`q`:case`quartile`:return e.Q;case`h`:case`high`:return e.H;default:throw Error(`Unknown EC Level: `+t)}}e.isValid=function(e){return e&&e.bit!==void 0&&e.bit>=0&&e.bit<4},e.from=function(n,r){if(e.isValid(n))return n;try{return t(n)}catch{return r}}})),_f=o(((e,t)=>{function n(){this.buffer=[],this.length=0}n.prototype={get:function(e){let t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)==1},put:function(e,t){for(let n=0;n<t;n++)this.putBit((e>>>t-n-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(e){let t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}},t.exports=n})),vf=o(((e,t)=>{function n(e){if(!e||e<1)throw Error(`BitMatrix size must be defined and greater than 0`);this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}n.prototype.set=function(e,t,n,r){let i=e*this.size+t;this.data[i]=n,r&&(this.reservedBit[i]=!0)},n.prototype.get=function(e,t){return this.data[e*this.size+t]},n.prototype.xor=function(e,t,n){this.data[e*this.size+t]^=n},n.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]},t.exports=n})),yf=o((e=>{var t=hf().getSymbolSize;e.getRowColCoords=function(e){if(e===1)return[];let n=Math.floor(e/7)+2,r=t(e),i=r===145?26:Math.ceil((r-13)/(2*n-2))*2,a=[r-7];for(let e=1;e<n-1;e++)a[e]=a[e-1]-i;return a.push(6),a.reverse()},e.getPositions=function(t){let n=[],r=e.getRowColCoords(t),i=r.length;for(let e=0;e<i;e++)for(let t=0;t<i;t++)e===0&&t===0||e===0&&t===i-1||e===i-1&&t===0||n.push([r[e],r[t]]);return n}})),bf=o((e=>{var t=hf().getSymbolSize,n=7;e.getPositions=function(e){let r=t(e);return[[0,0],[r-n,0],[0,r-n]]}})),xf=o((e=>{e.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var t={N1:3,N2:3,N3:40,N4:10};e.isValid=function(e){return e!=null&&e!==``&&!isNaN(e)&&e>=0&&e<=7},e.from=function(t){return e.isValid(t)?parseInt(t,10):void 0},e.getPenaltyN1=function(e){let n=e.size,r=0,i=0,a=0,o=null,s=null;for(let c=0;c<n;c++){i=a=0,o=s=null;for(let l=0;l<n;l++){let n=e.get(c,l);n===o?i++:(i>=5&&(r+=t.N1+(i-5)),o=n,i=1),n=e.get(l,c),n===s?a++:(a>=5&&(r+=t.N1+(a-5)),s=n,a=1)}i>=5&&(r+=t.N1+(i-5)),a>=5&&(r+=t.N1+(a-5))}return r},e.getPenaltyN2=function(e){let n=e.size,r=0;for(let t=0;t<n-1;t++)for(let i=0;i<n-1;i++){let n=e.get(t,i)+e.get(t,i+1)+e.get(t+1,i)+e.get(t+1,i+1);(n===4||n===0)&&r++}return r*t.N2},e.getPenaltyN3=function(e){let n=e.size,r=0,i=0,a=0;for(let t=0;t<n;t++){i=a=0;for(let o=0;o<n;o++)i=i<<1&2047|e.get(t,o),o>=10&&(i===1488||i===93)&&r++,a=a<<1&2047|e.get(o,t),o>=10&&(a===1488||a===93)&&r++}return r*t.N3},e.getPenaltyN4=function(e){let n=0,r=e.data.length;for(let t=0;t<r;t++)n+=e.data[t];return Math.abs(Math.ceil(n*100/r/5)-10)*t.N4};function n(t,n,r){switch(t){case e.Patterns.PATTERN000:return(n+r)%2==0;case e.Patterns.PATTERN001:return n%2==0;case e.Patterns.PATTERN010:return r%3==0;case e.Patterns.PATTERN011:return(n+r)%3==0;case e.Patterns.PATTERN100:return(Math.floor(n/2)+Math.floor(r/3))%2==0;case e.Patterns.PATTERN101:return n*r%2+n*r%3==0;case e.Patterns.PATTERN110:return(n*r%2+n*r%3)%2==0;case e.Patterns.PATTERN111:return(n*r%3+(n+r)%2)%2==0;default:throw Error(`bad maskPattern:`+t)}}e.applyMask=function(e,t){let r=t.size;for(let i=0;i<r;i++)for(let a=0;a<r;a++)t.isReserved(a,i)||t.xor(a,i,n(e,a,i))},e.getBestMask=function(t,n){let r=Object.keys(e.Patterns).length,i=0,a=1/0;for(let o=0;o<r;o++){n(o),e.applyMask(o,t);let r=e.getPenaltyN1(t)+e.getPenaltyN2(t)+e.getPenaltyN3(t)+e.getPenaltyN4(t);e.applyMask(o,t),r<a&&(a=r,i=o)}return i}})),Sf=o((e=>{var t=gf(),n=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],r=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];e.getBlocksCount=function(e,r){switch(r){case t.L:return n[(e-1)*4+0];case t.M:return n[(e-1)*4+1];case t.Q:return n[(e-1)*4+2];case t.H:return n[(e-1)*4+3];default:return}},e.getTotalCodewordsCount=function(e,n){switch(n){case t.L:return r[(e-1)*4+0];case t.M:return r[(e-1)*4+1];case t.Q:return r[(e-1)*4+2];case t.H:return r[(e-1)*4+3];default:return}}})),Cf=o((e=>{var t=new Uint8Array(512),n=new Uint8Array(256);(function(){let e=1;for(let r=0;r<255;r++)t[r]=e,n[e]=r,e<<=1,e&256&&(e^=285);for(let e=255;e<512;e++)t[e]=t[e-255]})(),e.log=function(e){if(e<1)throw Error(`log(`+e+`)`);return n[e]},e.exp=function(e){return t[e]},e.mul=function(e,r){return e===0||r===0?0:t[n[e]+n[r]]}})),wf=o((e=>{var t=Cf();e.mul=function(e,n){let r=new Uint8Array(e.length+n.length-1);for(let i=0;i<e.length;i++)for(let a=0;a<n.length;a++)r[i+a]^=t.mul(e[i],n[a]);return r},e.mod=function(e,n){let r=new Uint8Array(e);for(;r.length-n.length>=0;){let e=r[0];for(let i=0;i<n.length;i++)r[i]^=t.mul(n[i],e);let i=0;for(;i<r.length&&r[i]===0;)i++;r=r.slice(i)}return r},e.generateECPolynomial=function(n){let r=new Uint8Array([1]);for(let i=0;i<n;i++)r=e.mul(r,new Uint8Array([1,t.exp(i)]));return r}})),Tf=o(((e,t)=>{var n=wf();function r(e){this.genPoly=void 0,this.degree=e,this.degree&&this.initialize(this.degree)}r.prototype.initialize=function(e){this.degree=e,this.genPoly=n.generateECPolynomial(this.degree)},r.prototype.encode=function(e){if(!this.genPoly)throw Error(`Encoder not initialized`);let t=new Uint8Array(e.length+this.degree);t.set(e);let r=n.mod(t,this.genPoly),i=this.degree-r.length;if(i>0){let e=new Uint8Array(this.degree);return e.set(r,i),e}return r},t.exports=r})),Ef=o((e=>{e.isValid=function(e){return!isNaN(e)&&e>=1&&e<=40}})),Df=o((e=>{var t=`[0-9]+`,n=`[A-Z $%*+\\-./:]+`,r=`(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+`;r=r.replace(/u/g,`\\u`);var i=`(?:(?![A-Z0-9 $%*+\\-./:]|`+r+`)(?:.|[\r
97
97
  ]))+`;e.KANJI=new RegExp(r,`g`),e.BYTE_KANJI=RegExp(`[^A-Z0-9 $%*+\\-./:]+`,`g`),e.BYTE=new RegExp(i,`g`),e.NUMERIC=new RegExp(t,`g`),e.ALPHANUMERIC=new RegExp(n,`g`);var a=RegExp(`^`+r+`$`),o=RegExp(`^[0-9]+$`),s=RegExp(`^[A-Z0-9 $%*+\\-./:]+$`);e.testKanji=function(e){return a.test(e)},e.testNumeric=function(e){return o.test(e)},e.testAlphanumeric=function(e){return s.test(e)}})),Of=o((e=>{var t=Ef(),n=Df();e.NUMERIC={id:`Numeric`,bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:`Alphanumeric`,bit:2,ccBits:[9,11,13]},e.BYTE={id:`Byte`,bit:4,ccBits:[8,16,16]},e.KANJI={id:`Kanji`,bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(e,n){if(!e.ccBits)throw Error(`Invalid mode: `+e);if(!t.isValid(n))throw Error(`Invalid version: `+n);return n>=1&&n<10?e.ccBits[0]:n<27?e.ccBits[1]:e.ccBits[2]},e.getBestModeForData=function(t){return n.testNumeric(t)?e.NUMERIC:n.testAlphanumeric(t)?e.ALPHANUMERIC:n.testKanji(t)?e.KANJI:e.BYTE},e.toString=function(e){if(e&&e.id)return e.id;throw Error(`Invalid mode`)},e.isValid=function(e){return e&&e.bit&&e.ccBits};function r(t){if(typeof t!=`string`)throw Error(`Param is not a string`);switch(t.toLowerCase()){case`numeric`:return e.NUMERIC;case`alphanumeric`:return e.ALPHANUMERIC;case`kanji`:return e.KANJI;case`byte`:return e.BYTE;default:throw Error(`Unknown mode: `+t)}}e.from=function(t,n){if(e.isValid(t))return t;try{return r(t)}catch{return n}}})),kf=o((e=>{var t=hf(),n=Sf(),r=gf(),i=Of(),a=Ef(),o=7973,s=t.getBCHDigit(o);function c(t,n,r){for(let i=1;i<=40;i++)if(n<=e.getCapacity(i,r,t))return i}function l(e,t){return i.getCharCountIndicator(e,t)+4}function u(e,t){let n=0;return e.forEach(function(e){let r=l(e.mode,t);n+=r+e.getBitsLength()}),n}function d(t,n){for(let r=1;r<=40;r++)if(u(t,r)<=e.getCapacity(r,n,i.MIXED))return r}e.from=function(e,t){return a.isValid(e)?parseInt(e,10):t},e.getCapacity=function(e,r,o){if(!a.isValid(e))throw Error(`Invalid QR Code version`);o===void 0&&(o=i.BYTE);let s=(t.getSymbolTotalCodewords(e)-n.getTotalCodewordsCount(e,r))*8;if(o===i.MIXED)return s;let c=s-l(o,e);switch(o){case i.NUMERIC:return Math.floor(c/10*3);case i.ALPHANUMERIC:return Math.floor(c/11*2);case i.KANJI:return Math.floor(c/13);case i.BYTE:default:return Math.floor(c/8)}},e.getBestVersionForData=function(e,t){let n,i=r.from(t,r.M);if(Array.isArray(e)){if(e.length>1)return d(e,i);if(e.length===0)return 1;n=e[0]}else n=e;return c(n.mode,n.getLength(),i)},e.getEncodedBits=function(e){if(!a.isValid(e)||e<7)throw Error(`Invalid QR Code version`);let n=e<<12;for(;t.getBCHDigit(n)-s>=0;)n^=o<<t.getBCHDigit(n)-s;return e<<12|n}})),Af=o((e=>{var t=hf(),n=1335,r=21522,i=t.getBCHDigit(n);e.getEncodedBits=function(e,a){let o=e.bit<<3|a,s=o<<10;for(;t.getBCHDigit(s)-i>=0;)s^=n<<t.getBCHDigit(s)-i;return(o<<10|s)^r}})),jf=o(((e,t)=>{var n=Of();function r(e){this.mode=n.NUMERIC,this.data=e.toString()}r.getBitsLength=function(e){return 10*Math.floor(e/3)+(e%3?e%3*3+1:0)},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){let t,n,r;for(t=0;t+3<=this.data.length;t+=3)n=this.data.substr(t,3),r=parseInt(n,10),e.put(r,10);let i=this.data.length-t;i>0&&(n=this.data.substr(t),r=parseInt(n,10),e.put(r,i*3+1))},t.exports=r})),Mf=o(((e,t)=>{var n=Of(),r=`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ $%*+-./:`.split(``);function i(e){this.mode=n.ALPHANUMERIC,this.data=e}i.getBitsLength=function(e){return 11*Math.floor(e/2)+e%2*6},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t+2<=this.data.length;t+=2){let n=r.indexOf(this.data[t])*45;n+=r.indexOf(this.data[t+1]),e.put(n,11)}this.data.length%2&&e.put(r.indexOf(this.data[t]),6)},t.exports=i})),Nf=o(((e,t)=>{var n=Of();function r(e){this.mode=n.BYTE,this.data=typeof e==`string`?new TextEncoder().encode(e):new Uint8Array(e)}r.getBitsLength=function(e){return e*8},r.prototype.getLength=function(){return this.data.length},r.prototype.getBitsLength=function(){return r.getBitsLength(this.data.length)},r.prototype.write=function(e){for(let t=0,n=this.data.length;t<n;t++)e.put(this.data[t],8)},t.exports=r})),Pf=o(((e,t)=>{var n=Of(),r=hf();function i(e){this.mode=n.KANJI,this.data=e}i.getBitsLength=function(e){return e*13},i.prototype.getLength=function(){return this.data.length},i.prototype.getBitsLength=function(){return i.getBitsLength(this.data.length)},i.prototype.write=function(e){let t=0;for(;t<this.data.length;t++){let n=r.toSJIS(this.data[t]);if(n>=33088&&n<=40956)n-=33088;else if(n>=57408&&n<=60351)n-=49472;else throw Error(`Invalid SJIS character: `+this.data[t]+`
@@ -30,7 +30,7 @@
30
30
  <meta name="twitter:image" content="/logo.svg" />
31
31
  <!-- Inline so the splash paints before any script or stylesheet loads -->
32
32
  <style>html{background:#f8fafc}html[data-theme=dark]{background:#0b0f17}@media (prefers-color-scheme:dark){html:not([data-theme=light]){background:#0b0f17}}#splash{z-index:100;background:inherit;justify-content:center;align-items:center;transition:opacity .3s;display:flex;position:fixed;inset:0}#splash img{width:62px;height:62px;animation:.4s both splash-in}#splash.splash-hidden{opacity:0;pointer-events:none}@keyframes splash-in{0%{opacity:0;transform:scale(.92)}}@media (prefers-reduced-motion:reduce){#splash,#splash img{transition:none;animation:none}}</style>
33
- <script type="module" crossorigin src="/assets/index-DmT8Ba1V.js"></script>
33
+ <script type="module" crossorigin src="/assets/index-CNv7c7dh.js"></script>
34
34
  <link rel="stylesheet" crossorigin href="/assets/index-B4KVPQ6_.css">
35
35
  </head>
36
36
  <body>
package/web/dist/sw.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // FeedKeeper service worker. Built into dist/sw.js, where the placeholder below is
2
2
  // replaced with a hash of the build's file names so every release gets its own app cache.
3
- const BUILD_ID = "38f1e3fc9947";
3
+ const BUILD_ID = "ca5700e714e7";
4
4
  const STATIC_CACHE = `fk-static-${BUILD_ID}`;
5
5
  const API_CACHE = "fk-api";
6
6
  let privateGeneration = 0;