Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor Get Resources into Filterable Resource List PBR component #1363

Merged
merged 21 commits into from
Dec 11, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
0a4c172
Squashed 'extensions/src/platform-get-resources/' content from commit…
rolfheij-sil Nov 28, 2024
1ecaf80
Merge commit '0a4c172b09a54b38e8b6197a2f7a06f34038726b' as 'extension…
rolfheij-sil Nov 28, 2024
a298d87
Move Get Resources to core (and rename from Download Resources)
rolfheij-sil Nov 28, 2024
b985c01
Squashed 'extensions/src/platform-home/' content from commit 93d4b0a63
rolfheij-sil Nov 28, 2024
07c58af
Merge commit 'b985c01d7536a1ac5207388e47ef74723ece22d2' as 'extension…
rolfheij-sil Nov 28, 2024
bb091b7
Create Home extension (inspired by Get Resources)
rolfheij-sil Nov 28, 2024
cb4c4b2
Cleanup home webview
rolfheij-sil Nov 28, 2024
83d7953
Merge branch 'add-multiselect-to-combobox' into 1290-v2-resources-and…
rolfheij-sil Dec 2, 2024
e49c702
Update package-lock.json
rolfheij-sil Dec 2, 2024
5b9fb08
Update links to core
rolfheij-sil Dec 2, 2024
de55698
Merge branch 'add-multiselect-to-combobox' into 1290-v2-resources-and…
rolfheij-sil Dec 2, 2024
7174608
Ignore stupid error
rolfheij-sil Dec 2, 2024
6599f25
Merge branch 'add-multiselect-to-combobox' into 1290-v2-resources-and…
rolfheij-sil Dec 5, 2024
a851fd0
Merge branch 'add-multiselect-to-combobox' into 1290-v2-resources-and…
rolfheij-sil Dec 5, 2024
7e0d2b2
Merge branch 'add-multiselect-to-combobox' into 1290-v2-resources-and…
rolfheij-sil Dec 5, 2024
78a2248
Merge branch 'add-multiselect-to-combobox' into 1290-v2-resources-and…
rolfheij-sil Dec 5, 2024
bcff07c
Extract Get Resources out into reusable component
rolfheij-sil Dec 6, 2024
4ee32f7
Merge branch 'main' into 1290-v2-resources-and-home-extension
rolfheij-sil Dec 6, 2024
7e9335d
Review comments
rolfheij-sil Dec 10, 2024
e3fe74f
Merge branch 'main' into 1290-v2-resources-and-home-extension
rolfheij-sil Dec 10, 2024
4bd06a6
Merge branch 'main' into 1290-v2-resources-and-home-extension
rolfheij-sil Dec 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Update package-lock.json
rolfheij-sil committed Dec 2, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit e49c7026d60654241cf873c79bba7a2ceff93a22
Original file line number Diff line number Diff line change
@@ -10,7 +10,6 @@ import {
Loader,
Search,
} from 'lucide-react';
import type { DblResourceData, ResourceType } from 'platform-get-resources';
import {
Button,
Card,
@@ -37,6 +36,7 @@ import {
TableRow,
} from 'platform-bible-react';
import { getErrorMessage } from 'platform-bible-utils';
import type { DblResourceData, ResourceType } from 'platform-get-resources';
import { useEffect, useMemo, useState } from 'react';

const LOCALIZED_STRING_KEYS: LocalizeKey[] = [
288 changes: 288 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.


Unchanged files with check annotations Beta

declare module 'platform-get-resources' {
import { DataProviderDataType, IDataProvider } from '@papi/core';

Check failure on line 2 in extensions/src/platform-get-resources/src/types/platform-get-resources.d.ts

GitHub Actions / Build on ubuntu-latest, .Net 8.0.x

Cannot find module '@papi/core' or its corresponding type declarations.
export type ResourceType = 'DBL' | 'EnhancedResource' | 'XmlResource' | 'SourceLanguageResource';
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),v=require("react"),Q=require("lucide-react"),ot=require("clsx"),Ki=require("tailwind-merge"),Gs=require("@radix-ui/react-dropdown-menu"),W=require("platform-bible-utils"),Ji=require("@radix-ui/react-slot"),Nn=require("class-variance-authority"),Zi=require("@radix-ui/react-label"),Qi=require("@radix-ui/react-radio-group"),el=require("@radix-ui/react-popover"),je=require("cmdk"),tl=require("@radix-ui/react-dialog"),Ne=require("@tanstack/react-table"),nl=require("@radix-ui/react-select"),rl=require("@radix-ui/react-checkbox"),ol=require("@radix-ui/react-toggle-group"),sl=require("@radix-ui/react-toggle"),al=require("@radix-ui/react-tabs"),il=require("@radix-ui/react-separator"),Ar=require("@mui/styled-engine"),Ie=require("@mui/material"),sn=require("react-dom"),Us=require("sonner"),ll=require("@radix-ui/react-slider"),cl=require("@radix-ui/react-switch"),dl=require("markdown-to-jsx");function ke(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const M=ke(v),pe=ke(Gs),qs=ke(Zi),hn=ke(Qi),gn=ke(el),Xe=ke(tl),ge=ke(nl),Br=ke(rl),er=ke(ol),Hs=ke(sl),Oe=ke(al),Xs=ke(il),ul=ke(sn),an=ke(ll),Vr=ke(cl);const pl=Ki.extendTailwindMerge({prefix:"tw-"});function S(...e){return pl(ot.clsx(e))}const qt=v.forwardRef(({className:e,type:t,...n},r)=>a.jsx("input",{type:t,className:S("pr-twp tw-flex tw-h-10 tw-rounded-md tw-border tw-border-input tw-bg-background tw-px-3 tw-py-2 tw-text-sm tw-ring-offset-background file:tw-border-0 file:tw-bg-transparent file:tw-text-sm file:tw-font-medium file:tw-text-foreground placeholder:tw-text-muted-foreground focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2 disabled:tw-cursor-not-allowed disabled:tw-opacity-50",e),ref:r,...n}));qt.displayName="Input";const wl=v.forwardRef(({handleSearch:e,handleKeyDown:t,handleOnClick:n,handleSubmit:r,...o},s)=>a.jsxs("div",{className:"tw-relative",children:[a.jsx(qt,{...o,type:"text",className:"tw-box-border tw-gap-2.5 tw-rounded-lg tw-border tw-border-solid tw-bg-background tw-py-2 tw-pl-4 tw-pr-3 tw-font-medium tw-shadow-none tw-outline-none",onChange:i=>e(i.target.value),onKeyDown:i=>{i.key==="Enter"&&r(),t(i)},onClick:n,ref:s}),a.jsx(Q.History,{className:"tw-absolute tw-right-3 tw-top-1/2 tw-h-4 tw-w-4 tw--translate-y-1/2 tw-transform tw-cursor-pointer tw-text-muted-foreground",onClick:()=>{console.log("back in history")}})]}));var fl=Object.defineProperty,ml=(e,t,n)=>t in e?fl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,ne=(e,t,n)=>ml(e,typeof t!="symbol"?t+"":t,n);const gt=["GEN","EXO","LEV","NUM","DEU","JOS","JDG","RUT","1SA","2SA","1KI","2KI","1CH","2CH","EZR","NEH","EST","JOB","PSA","PRO","ECC","SNG","ISA","JER","LAM","EZK","DAN","HOS","JOL","AMO","OBA","JON","MIC","NAM","HAB","ZEP","HAG","ZEC","MAL","MAT","MRK","LUK","JHN","ACT","ROM","1CO","2CO","GAL","EPH","PHP","COL","1TH","2TH","1TI","2TI","TIT","PHM","HEB","JAS","1PE","2PE","1JN","2JN","3JN","JUD","REV","TOB","JDT","ESG","WIS","SIR","BAR","LJE","S3Y","SUS","BEL","1MA","2MA","3MA","4MA","1ES","2ES","MAN","PS2","ODA","PSS","JSA","JDB","TBS","SST","DNT","BLT","XXA","XXB","XXC","XXD","XXE","XXF","XXG","FRT","BAK","OTH","3ES","EZA","5EZ","6EZ","INT","CNC","GLO","TDX","NDX","DAG","PS3","2BA","LBA","JUB","ENO","1MQ","2MQ","3MQ","REP","4BA","LAO"],Jr=["XXA","XXB","XXC","XXD","XXE","XXF","XXG","FRT","BAK","OTH","INT","CNC","GLO","TDX","NDX"],Ys=["Genesis","Exodus","Leviticus","Numbers","Deuteronomy","Joshua","Judges","Ruth","1 Samuel","2 Samuel","1 Kings","2 Kings","1 Chronicles","2 Chronicles","Ezra","Nehemiah","Esther (Hebrew)","Job","Psalms","Proverbs","Ecclesiastes","Song of Songs","Isaiah","Jeremiah","Lamentations","Ezekiel","Daniel (Hebrew)","Hosea","Joel","Amos","Obadiah","Jonah","Micah","Nahum","Habakkuk","Zephaniah","Haggai","Zechariah","Malachi","Matthew","Mark","Luke","John","Acts","Romans","1 Corinthians","2 Corinthians","Galatians","Ephesians","Philippians","Colossians","1 Thessalonians","2 Thessalonians","1 Timothy","2 Timothy","Titus","Philemon","Hebrews","James","1 Peter","2 Peter","1 John","2 John","3 John","Jude","Revelation","Tobit","Judith","Esther Greek","Wisdom of Solomon","Sirach (Ecclesiasticus)","Baruch","Letter of Jeremiah","Song of 3 Young Men","Susanna","Bel and the Dragon","1 Maccabees","2 Maccabees","3 Maccabees","4 Maccabees","1 Esdras (Greek)","2 Esdras (Latin)","Prayer of Manasseh","Psalm 151","Odes","Psalms of Solomon","Joshua A. *obsolete*","Judges B. *obsolete*","Tobit S. *obsolete*","Susanna Th. *obsolete*","Daniel Th. *obsolete*","Bel Th. *obsolete*","Extra A","Extra B","Extra C","Extra D","Extra E","Extra F","Extra G","Front Matter","Back Matter","Other Matter","3 Ezra *obsolete*","Apocalypse of Ezra","5 Ezra (Latin Prologue)","6 Ezra (Latin Epilogue)","Introduction","Concordance ","Glossary ","Topical Index","Names Index","Daniel Greek","Psalms 152-155","2 Baruch (Apocalypse)","Letter of Baruch","Jubilees","Enoch","1 Meqabyan","2 Meqabyan","3 Meqabyan","Reproof (Proverbs 25-31)","4 Baruch (Rest of Baruch)","Laodiceans"],Wo=Sl();function Ht(e,t=!0){return t&&(e=e.toUpperCase()),e in Wo?Wo[e]:0}function Zr(e){return Ht(e)>0}function hl(e){const t=typeof e=="string"?Ht(e):e;return t>=40&&t<=66}function gl(e){return(typeof e=="string"?Ht(e):e)<=39}function Ws(e){return e<=66}function bl(e){const t=typeof e=="string"?Ht(e):e;return Zs(t)&&!Ws(t)}function*vl(){for(let e=1;e<=gt.length;e++)yield e}const yl=1,Ks=gt.length;function xl(){return["XXA","XXB","XXC","XXD","XXE","XXF","XXG"]}function Qr(e,t="***"){const n=e-1;return n<0||n>=gt.length?t:gt[n]}function Js(e){return e<=0||e>Ks?"******":Ys[e-1]}function Nl(e){return Js(Ht(e))}function Zs(e){const t=typeof e=="number"?Qr(e):e;return Zr(t)&&!Jr.includes(t)}function kl(e){const t=typeof e=="number"?Qr(e):e;return Zr(t)&&Jr.includes(t)}function El(e){return Ys[e-1].includes("*obsolete*")}function Sl(){const e={};for(let t=0;t<gt.length;t++)e[gt[t]]=t+1;return e}const se={allBookIds:gt,nonCanonicalIds:Jr,bookIdToNumber:Ht,isBookIdValid:Zr,isBookNT:hl,isBookOT:gl,isBookOTNT:Ws,isBookDC:bl,allBookNumbers:vl,firstBook:yl,lastBook:Ks,extraBooks:xl,bookNumberToId:Qr,bookNumberToEnglishName:Js,bookIdToEnglishName:Nl,isCanonical:Zs,isExtraMaterial:kl,isObsolete:El};var qe=(e=>(e[e.Unknown=0]="Unknown",e[e.Original=1]="Original",e[e.Septuagint=2]="Septuagint",e[e.Vulgate=3]="Vulgate",e[e.English=4]="English",e[e.RussianProtestant=5]="RussianProtestant",e[e.RussianOrthodox=6]="RussianOrthodox",e))(qe||{});const Pe=class{constructor(t){if(ne(this,"name"),ne(this,"fullPath"),ne(this,"isPresent"),ne(this,"hasVerseSegments"),ne(this,"isCustomized"),ne(this,"baseVersification"),ne(this,"scriptureBooks"),ne(this,"_type"),t==null)throw new Error("Argument undefined");typeof t=="string"?(this.name=t,this._type=qe[t]):(this._type=t,this.name=qe[t])}get type(){return this._type}equals(t){return!t.type||!this.type?!1:t.type===this.type}};ne(Pe,"Original",new Pe(qe.Original)),ne(Pe,"Septuagint",new Pe(qe.Septuagint)),ne(Pe,"Vulgate",new Pe(qe.Vulgate)),ne(Pe,"English",new Pe(qe.English)),ne(Pe,"RussianProtestant",new Pe(qe.RussianProtestant)),ne(Pe,"RussianOrthodox",new Pe(qe.RussianOrthodox));let ut=Pe;function Ko(e,t){const n=t[0];for(let r=1;r<t.length;r++)e=e.split(t[r]).join(n);return e.split(n)}var Qs=(e=>(e[e.Valid=0]="Valid",e[e.UnknownVersification=1]="UnknownVersification",e[e.OutOfRange=2]="OutOfRange",e[e.VerseOutOfOrder=3]="VerseOutOfOrder",e[e.VerseRepeated=4]="VerseRepeated",e))(Qs||{});const Se=class re{constructor(t,n,r,o){if(ne(this,"firstChapter"),ne(this,"lastChapter"),ne(this,"lastVerse"),ne(this,"hasSegmentsDefined"),ne(this,"text"),ne(this,"BBBCCCVVVS"),ne(this,"longHashCode"),ne(this,"versification"),ne(this,"rtlMark","‏"),ne(this,"_bookNum",0),ne(this,"_chapterNum",0),ne(this,"_verseNum",0),ne(this,"_verse"),r==null&&o==null)if(t!=null&&typeof t=="string"){const s=t,i=n!=null&&n instanceof ut?n:void 0;this.setEmpty(i),this.parse(s)}else if(t!=null&&typeof t=="number"){const s=n!=null&&n instanceof ut?n:void 0;this.setEmpty(s),this._verseNum=t%re.chapterDigitShifter,this._chapterNum=Math.floor(t%re.bookDigitShifter/re.chapterDigitShifter),this._bookNum=Math.floor(t/re.bookDigitShifter)}else if(n==null)if(t!=null&&t instanceof re){const s=t;this._bookNum=s.bookNum,this._chapterNum=s.chapterNum,this._verseNum=s.verseNum,this._verse=s.verse,this.versification=s.versification}else{if(t==null)return;const s=t instanceof ut?t:re.defaultVersification;this.setEmpty(s)}else throw new Error("VerseRef constructor not supported.");else if(t!=null&&n!=null&&r!=null)if(typeof t=="string"&&typeof n=="string"&&typeof r=="string")this.setEmpty(o),this.updateInternal(t,n,r);else if(typeof t=="number"&&typeof n=="number"&&typeof r=="number")this._bookNum=t,this._chapterNum=n,this._verseNum=r,this.versification=o??re.defaultVersification;else throw new Error("VerseRef constructor not supported.");else throw new Error("VerseRef constructor not supported.")}static isVerseParseable(t){return t.length>0&&"0123456789".includes(t[0])&&!t.endsWith(this.verseRangeSeparator)&&!t.endsWith(this.verseSequenceIndicator)}static tryParse(t){let n;try{return n=new re(t),{success:!0,verseRef:n}}catch(r){if(r instanceof en)return n=new re,{success:!1,verseRef:n};throw r}}static getBBBCCCVVV(t,n,r){return t%re.bcvMaxValue*re.bookDigitShifter+(n>=0?n%re.bcvMaxValue*re.chapterDigitShifter:0)+(r>=0?r%re.bcvMaxValue:0)}static fromJSON(t){const{book:n,chapterNum:r,verseNum:o,verse:s,versificationStr:i}=t,l=s||o.toString();let c;return i&&(c=new ut(i)),n?new re(n,r.toString(),l,c):new re}static tryGetVerseNum(t){let n;if(!t)return n=-1,{success:!0,vNum:n};n=0;let r;for(let o=0;o<t.length;o++){if(r=t[o],r<"0"||r>"9")return o===0&&(n=-1),{success:!1,vNum:n};if(n=n*10+ +r-0,n>re.bcvMaxValue)return n=-1,{success:!1,vNum:n}}return{success:!0,vNum:n}}get isDefault(){return this.bookNum===0&&this.chapterNum===0&&this.verseNum===0&&this.versification==null}get hasMultiple(){return this._verse!=null&&(this._verse.includes(re.verseRangeSeparator)||this._verse.includes(re.verseSequenceIndicator))}get book(){return se.bookNumberToId(this.bookNum,"")}set book(t){this.bookNum=se.bookIdToNumber(t)}get chapter(){return this.isDefault||this._chapterNum<0?"":this._chapterNum.toString()}set chapter(t){const n=+t;this._chapterNum=Number.isInteger(n)?n:-1}get verse(){return this._verse!=null?this._verse:this.isDefault||this._verseNum<0?"":this._verseNum.toString()}set verse(t){const{success:n,vNum:r}=re.tryGetVerseNum(t);this._verse=n?void 0:t.replace(this.rtlMark,""),this._verseNum=r,!(this._verseNum>=0)&&({vNum:this._verseNum}=re.tryGetVerseNum(this._verse))}get bookNum(){return this._bookNum}set bookNum(t){if(t<=0||t>se.lastBook)throw new en("BookNum must be greater than zero and less than or equal to last book");this._bookNum=t}get chapterNum(){return this._chapterNum}set chapterNum(t){this.chapterNum=t}get verseNum(){return this._verseNum}set verseNum(t){this._verseNum=t}get versificationStr(){var t;return(t=this.versification)==null?void 0:t.name}set versificationStr(t){this.versification=this.versification!=null?new ut(t):void 0}get valid(){return this.validStatus===0}get validStatus(){return this.validateVerse(re.verseRangeSeparators,re.verseSequenceIndicators)}get BBBCCC(){return re.getBBBCCCVVV(this._bookNum,this._chapterNum,0)}get BBBCCCVVV(){return re.getBBBCCCVVV(this._bookNum,this._chapterNum,this._verseNum)}get isExcluded(){return!1}parse(t){if(t=t.replace(this.rtlMark,""),t.includes("/")){const s=t.split("/");if(t=s[0],s.length>1)try{const i=+s[1].trim();this.versification=new ut(qe[i])}catch{throw new en("Invalid reference : "+t)}}const n=t.trim().split(" ");if(n.length!==2)throw new en("Invalid reference : "+t);const r=n[1].split(":"),o=+r[0];if(r.length!==2||se.bookIdToNumber(n[0])===0||!Number.isInteger(o)||o<0||!re.isVerseParseable(r[1]))throw new en("Invalid reference : "+t);this.updateInternal(n[0],r[0],r[1])}simplify(){this._verse=void 0}clone(){return new re(this)}toString(){const t=this.book;return t===""?"":`${t} ${this.chapter}:${this.verse}`}toJSON(){let t=this.verse;(t===""||t===this.verseNum.toString())&&(t=void 0);const n={book:this.book,chapterNum:this.chapterNum,verseNum:this.verseNum,verse:t,versificationStr:this.versificationStr};return t||delete n.verse,n}equals(t){return t instanceof re?t._bookNum===this._bookNum&&t._chapterNum===this._chapterNum&&t._verseNum===this._verseNum&&t.verse===this.verse&&(t.versification==null&&this.versification==null||t.versification!=null&&this.versification!=null&&t.versification.equals(this.versification)):!1}allVerses(t=!1,n=re.verseRangeSeparators,r=re.verseSequenceIndicators){if(this._verse==null||this.chapterNum<=0)return[this.clone()];const o=[],s=Ko(this._verse,r);for(const i of s.map(l=>Ko(l,n))){const l=this.clone();l.verse=i[0];const c=l.verseNum;if(o.push(l),i.length>1){const d=this.clone();if(d.verse=i[1],!t)for(let u=c+1;u<d.verseNum;u++){const h=new re(this._bookNum,this._chapterNum,u,this.versification);this.isExcluded||o.push(h)}o.push(d)}}return o}validateVerse(t,n){if(!this.verse)return this.internalValid;let r=0;for(const o of this.allVerses(!0,t,n)){const s=o.internalValid;if(s!==0)return s;const i=o.BBBCCCVVV;if(r>i)return 3;if(r===i)return 4;r=i}return 0}get internalValid(){return this.versification==null?1:this._bookNum<=0||this._bookNum>se.lastBook?2:(se.isCanonical(this._bookNum),0)}setEmpty(t=re.defaultVersification){this._bookNum=0,this._chapterNum=-1,this._verse=void 0,this.versification=t}updateInternal(t,n,r){this.bookNum=se.bookIdToNumber(t),this.chapter=n,this.verse=r}};ne(Se,"defaultVersification",ut.English),ne(Se,"verseRangeSeparator","-"),ne(Se,"verseSequenceIndicator",","),ne(Se,"verseRangeSeparators",[Se.verseRangeSeparator]),ne(Se,"verseSequenceIndicators",[Se.verseSequenceIndicator]),ne(Se,"chapterDigitShifter",1e3),ne(Se,"bookDigitShifter",Se.chapterDigitShifter*Se.chapterDigitShifter),ne(Se,"bcvMaxValue",Se.chapterDigitShifter-1),ne(Se,"ValidStatusType",Qs);class en extends Error{}const tr=pe.Root,eo=pe.Trigger,ea=pe.Group,Tl=pe.Portal,Cl=pe.Sub,jl=pe.RadioGroup,ta=v.forwardRef(({className:e,inset:t,children:n,...r},o)=>a.jsxs(pe.SubTrigger,{ref:o,className:S("tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none focus:tw-bg-accent data-[state=open]:tw-bg-accent",t&&"tw-pl-8",e),...r,children:[n,a.jsx(Q.ChevronRight,{className:"tw-ml-auto tw-h-4 tw-w-4"})]}));ta.displayName=pe.SubTrigger.displayName;const na=v.forwardRef(({className:e,...t},n)=>a.jsx(pe.SubContent,{ref:n,className:S("tw-z-50 tw-min-w-[8rem] tw-overflow-hidden tw-rounded-md tw-border tw-bg-popover tw-p-1 tw-text-popover-foreground tw-shadow-lg data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",e),...t}));na.displayName=pe.SubContent.displayName;const kn=v.forwardRef(({className:e,sideOffset:t=4,...n},r)=>a.jsx(pe.Portal,{children:a.jsx(pe.Content,{ref:r,sideOffset:t,className:S("pr-twp tw-z-50 tw-min-w-[8rem] tw-overflow-hidden tw-rounded-md tw-border tw-bg-popover tw-p-1 tw-text-popover-foreground tw-shadow-md data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",e),...n})}));kn.displayName=pe.Content.displayName;const to=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(pe.Item,{ref:r,className:S("tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-accent data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",t&&"tw-pl-8",e),...n}));to.displayName=pe.Item.displayName;const nr=v.forwardRef(({className:e,children:t,checked:n,...r},o)=>a.jsxs(pe.CheckboxItem,{ref:o,className:S("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-accent focus:tw-text-accent-foreground data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",e),checked:n,...r,children:[a.jsx("span",{className:"tw-absolute tw-left-2 tw-flex tw-h-3.5 tw-w-3.5 tw-items-center tw-justify-center",children:a.jsx(pe.ItemIndicator,{children:a.jsx(Q.Check,{className:"tw-h-4 tw-w-4"})})}),t]}));nr.displayName=pe.CheckboxItem.displayName;const no=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(pe.RadioItem,{ref:r,className:S("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none tw-transition-colors focus:tw-bg-accent focus:tw-text-accent-foreground data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",e),...n,children:[a.jsx("span",{className:"tw-absolute tw-left-2 tw-flex tw-h-3.5 tw-w-3.5 tw-items-center tw-justify-center",children:a.jsx(pe.ItemIndicator,{children:a.jsx(Q.Circle,{className:"tw-h-2 tw-w-2 tw-fill-current"})})}),t]}));no.displayName=pe.RadioItem.displayName;const Xt=v.forwardRef(({className:e,inset:t,...n},r)=>a.jsx(pe.Label,{ref:r,className:S("tw-px-2 tw-py-1.5 tw-text-sm tw-font-semibold",t&&"tw-pl-8",e),...n}));Xt.displayName=pe.Label.displayName;const En=v.forwardRef(({className:e,...t},n)=>a.jsx(pe.Separator,{ref:n,className:S("tw--mx-1 tw-my-1 tw-h-px tw-bg-muted",e),...t}));En.displayName=pe.Separator.displayName;function ra({className:e,...t}){return a.jsx("span",{className:S("tw-ml-auto tw-text-xs tw-tracking-widest tw-opacity-60",e),...t})}ra.displayName="DropdownMenuShortcut";const Ol=v.forwardRef(({bookId:e,handleSelectBook:t,isSelected:n,handleHighlightBook:r,handleKeyDown:o,bookType:s,children:i},l)=>a.jsxs(to,{ref:l,textValue:e,className:S("tw-mx-1 tw-px-1 tw-font-normal tw-text-foreground/80",{"tw-bg-amber-50 tw-text-yellow-900 data-[highlighted]:tw-bg-amber-100":n}),onSelect:c=>{c.preventDefault(),t()},onKeyDown:c=>{o(c)},onFocus:r,onMouseMove:r,children:[a.jsx("span",{className:S("tw-border-b-0 tw-border-l-2 tw-border-r-0 tw-border-t-0 tw-border-solid tw-px-2",{"tw-font-bold":n,"tw-border-l-red-200":s.toLowerCase()==="ot","tw-border-l-purple-200":s.toLowerCase()==="nt","tw-border-l-indigo-200":s.toLowerCase()==="dc"}),children:se.bookIdToEnglishName(e)}),n&&a.jsx("div",{children:i})]},e));function Rl({handleSelectChapter:e,endChapter:t,activeChapter:n,highlightedChapter:r,handleHighlightedChapter:o}){const s=Array.from({length:t},(l,c)=>c+1),i=v.useCallback(l=>{o(l)},[o]);return a.jsx("div",{className:S("tw-flex tw-flex-wrap tw-items-start tw-justify-start tw-self-stretch"),children:s.map(l=>a.jsx("div",{className:S("tw-box-content tw-flex tw-h-4 tw-w-4 tw-cursor-pointer tw-items-center tw-justify-end tw-rounded-md tw-p-2 tw-text-amber-800",{"tw-font-semibold tw-text-amber-900":l===n,"tw-bg-amber-200":l===r}),onClick:c=>{c.preventDefault(),c.stopPropagation(),e(l)},role:"button",onKeyDown:c=>{c.key==="Enter"&&e(l)},tabIndex:0,onMouseMove:()=>i(l),children:l},l))})}function Pl({handleSort:e,handleLocationHistory:t,handleBookmarks:n}){return a.jsxs(Xt,{className:"tw-flex tw-justify-between",children:[a.jsx("p",{className:"tw-inline-block tw-align-middle",children:"Go To"}),a.jsxs("div",{className:"tw-flex tw-items-center",children:[a.jsx(Q.ArrowDownWideNarrow,{onClick:e,className:"tw-m-2 tw-h-4 tw-w-4 tw-cursor-pointer tw-gap-2"}),a.jsx(Q.Clock,{onClick:t,className:"tw-m-2 tw-h-4 tw-w-4 tw-cursor-pointer tw-gap-2"}),a.jsx(Q.Bookmark,{onClick:n,className:"tw-m-2 tw-h-4 tw-w-4 tw-cursor-pointer tw-gap-2"})]})]})}const un=se.allBookIds,_l={OT:"Old Testament",NT:"New Testament",DC:"Deuterocanon"},Jo=["OT","NT","DC"],Il=32+32+32,$l=[/^(\w+)$/i,/^(\w+)(?:\s(\d+))$/i,/^(\w+)(?:\s(\d+):(\d+))$/i],Ml=e=>({OT:un.filter(n=>se.isBookOT(n)),NT:un.filter(n=>se.isBookNT(n)),DC:un.filter(n=>se.isBookDC(n))})[e],tn=e=>W.getChaptersForBook(se.bookIdToNumber(e));function Dl(){return un.map(t=>se.bookIdToEnglishName(t))}function Al(e){return Dl().includes(e)}function Bl(e){const t=e.toLowerCase().replace(/^\w/,n=>n.toUpperCase());if(Al(t))return un.find(r=>se.bookIdToEnglishName(r)===t)}function Vl({scrRef:e,handleSubmit:t}){const[n,r]=v.useState(""),[o,s]=v.useState(se.bookNumberToId(e.bookNum)),[i,l]=v.useState(e.chapterNum??0),[c,d]=v.useState(se.bookNumberToId(e.bookNum)),[u,h]=v.useState(!1),[w,b]=v.useState(u),x=v.useRef(void 0),f=v.useRef(void 0),m=v.useRef(void 0),N=v.useCallback(k=>Ml(k).filter(D=>{const $=se.bookIdToEnglishName(D).toLowerCase(),J=n.replace(/[^a-zA-Z]/g,"").toLowerCase();return $.includes(J)||D.toLowerCase().includes(J)}),[n]),I=k=>{r(k)},j=v.useRef(!1),E=v.useCallback(k=>{if(j.current){j.current=!1;return}h(k)},[]),g=v.useCallback((k,D,$,J)=>{if(l(se.bookNumberToId(e.bookNum)!==k?1:e.chapterNum),D||tn(k)===-1){t({bookNum:se.bookIdToNumber(k),chapterNum:$||1,verseNum:J||1}),h(!1),r("");return}s(o!==k?k:""),h(!D)},[t,e.bookNum,e.chapterNum,o]),P=k=>{k<=0||k>tn(o)||g(o,!0,k)},V=v.useCallback(()=>{$l.forEach(k=>{const D=n.match(k);if(D){const[$,J=void 0,Y=void 0]=D.slice(1),z=Bl($);(se.isBookIdValid($)||z)&&g(z??$,!0,J?parseInt(J,10):1,Y?parseInt(Y,10):1)}})},[g,n]),U=v.useCallback(k=>{u?(k.key==="ArrowDown"||k.key==="ArrowUp")&&(typeof m<"u"&&m.current!==null?m.current.focus():typeof f<"u"&&f.current!==null&&f.current.focus(),k.preventDefault()):h(!0)},[u]),T=k=>{const{key:D}=k;D==="ArrowRight"||D==="ArrowLeft"||D==="ArrowDown"||D==="ArrowUp"||D==="Enter"||(x.current.dispatchEvent(new KeyboardEvent("keydown",{key:D})),x.current.focus())},R=k=>{const{key:D}=k;if(c===o){if(D==="Enter"){k.preventDefault(),g(o,!0,i);return}let $=0;if(D==="ArrowRight")if(i<tn(c))$=1;else{k.preventDefault();return}else if(D==="ArrowLeft")if(i>1)$=-1;else{k.preventDefault();return}else D==="ArrowDown"?$=6:D==="ArrowUp"&&($=-6);i+$<=0||i+$>tn(c)?l(0):$!==0&&(l(i+$),k.preventDefault())}};return v.useEffect(()=>{o===c?o===se.bookNumberToId(e.bookNum)?l(e.chapterNum):l(1):l(0)},[c,e.bookNum,e.chapterNum,o]),v.useLayoutEffect(()=>{b(u)},[u]),v.useLayoutEffect(()=>{const k=setTimeout(()=>{if(w&&f.current&&m.current){const $=m.current.offsetTop-Il;f.current.scrollTo({top:$,behavior:"instant"})}},10);return()=>{clearTimeout(k)}},[w]),a.jsx("div",{className:"pr-twp tw-flex",children:a.jsxs(tr,{modal:!1,open:u,onOpenChange:E,children:[a.jsx(eo,{asChild:!0,children:a.jsx(wl,{ref:x,value:n,handleSearch:I,handleKeyDown:U,handleOnClick:()=>{s(se.bookNumberToId(e.bookNum)),d(se.bookNumberToId(e.bookNum)),l(e.chapterNum>0?e.chapterNum:0),h(!0),x.current.focus()},onFocus:()=>{j.current=!0},handleSubmit:V,placeholder:`${se.bookNumberToEnglishName(e.bookNum)} ${e.chapterNum}:${e.verseNum}`})}),a.jsxs(kn,{className:"tw-m-1 tw-overflow-y-auto tw-p-0 tw-font-normal tw-text-foreground/80",style:{width:"233px",maxHeight:"500px",zIndex:"250"},onKeyDown:T,align:"start",ref:f,children:[a.jsx(Pl,{handleSort:()=>console.log("sorting"),handleLocationHistory:()=>console.log("location history"),handleBookmarks:()=>console.log("bookmarks")}),Jo.map((k,D)=>N(k).length>0&&a.jsxs("div",{children:[a.jsx(Xt,{className:"tw-font-semibold tw-text-foreground/80",children:_l[k]}),N(k).map($=>a.jsx("div",{children:a.jsx(Ol,{bookId:$,handleSelectBook:()=>g($,!1),isSelected:o===$,handleHighlightBook:()=>d($),handleKeyDown:R,bookType:k,ref:J=>{o===$&&(m.current=J)},children:a.jsx(Rl,{handleSelectChapter:P,endChapter:tn($),activeChapter:e.bookNum===se.bookIdToNumber($)?e.chapterNum:0,highlightedChapter:i,handleHighlightedChapter:J=>{l(J)}})})},$)),Jo.length-1!==D?a.jsx(En,{}):void 0]},k))]})]})})}const oa=Nn.cva("pr-twp tw-inline-flex tw-items-center tw-justify-center tw-whitespace-nowrap tw-rounded-md tw-text-sm tw-font-medium tw-ring-offset-background tw-transition-colors focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2 disabled:tw-pointer-events-none disabled:tw-opacity-50",{variants:{variant:{default:"tw-bg-primary tw-text-primary-foreground hover:tw-bg-primary/90",destructive:"tw-bg-destructive tw-text-destructive-foreground hover:tw-bg-destructive/90",outline:"tw-border tw-border-input tw-bg-background hover:tw-bg-accent hover:tw-text-accent-foreground",secondary:"tw-bg-secondary tw-text-secondary-foreground hover:tw-bg-secondary/80",ghost:"hover:tw-bg-accent hover:tw-text-accent-foreground",link:"tw-text-primary tw-underline-offset-4 hover:tw-underline"},size:{default:"tw-h-10 tw-px-4 tw-py-2",sm:"tw-h-9 tw-rounded-md tw-px-3",lg:"tw-h-11 tw-rounded-md tw-px-8",icon:"tw-h-10 tw-w-10"}},defaultVariants:{variant:"default",size:"default"}}),fe=v.forwardRef(({className:e,variant:t,size:n,asChild:r=!1,...o},s)=>{const i=r?Ji.Slot:"button";return a.jsx(i,{className:S(oa({variant:t,size:n,className:e})),ref:s,...o})});fe.displayName="Button";const Ll=Nn.cva("tw-text-sm tw-font-medium tw-leading-none peer-disabled:tw-cursor-not-allowed peer-disabled:tw-opacity-70"),Ue=v.forwardRef(({className:e,...t},n)=>a.jsx(qs.Root,{ref:n,className:S("pr-twp",Ll(),e),...t}));Ue.displayName=qs.Root.displayName;const ro=v.forwardRef(({className:e,...t},n)=>a.jsx(hn.Root,{className:S("pr-twp tw-grid tw-gap-2",e),...t,ref:n}));ro.displayName=hn.Root.displayName;const Hn=v.forwardRef(({className:e,...t},n)=>a.jsx(hn.Item,{ref:n,className:S("pr-twp tw-aspect-square tw-h-4 tw-w-4 tw-rounded-full tw-border tw-border-primary tw-text-primary tw-ring-offset-background focus:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2 disabled:tw-cursor-not-allowed disabled:tw-opacity-50",e),...t,children:a.jsx(hn.Indicator,{className:"tw-flex tw-items-center tw-justify-center",children:a.jsx(Q.Circle,{className:"tw-h-2.5 tw-w-2.5 tw-fill-current tw-text-current"})})}));Hn.displayName=hn.Item.displayName;const Fl=gn.Root,zl=gn.Trigger,sa=v.forwardRef(({className:e,align:t="center",sideOffset:n=4,...r},o)=>a.jsx(gn.Portal,{children:a.jsx(gn.Content,{ref:o,align:t,sideOffset:n,className:S("pr-twp tw-z-50 tw-w-72 tw-rounded-md tw-border tw-bg-popover tw-p-4 tw-text-popover-foreground tw-shadow-md tw-outline-none data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",e),...r})}));sa.displayName=gn.Content.displayName;const Gl=Xe.Portal,aa=v.forwardRef(({className:e,...t},n)=>a.jsx(Xe.Overlay,{ref:n,className:S("tw-fixed tw-inset-0 tw-z-50 tw-bg-black/80 data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0",e),...t}));aa.displayName=Xe.Overlay.displayName;const Ul=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(Gl,{children:[a.jsx(aa,{}),a.jsxs(Xe.Content,{ref:r,className:S("pr-twp tw-fixed tw-left-[50%] tw-top-[50%] tw-z-50 tw-grid tw-w-full tw-max-w-lg tw-translate-x-[-50%] tw-translate-y-[-50%] tw-gap-4 tw-border tw-bg-background tw-p-6 tw-shadow-lg tw-duration-200 data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[state=closed]:tw-slide-out-to-left-1/2 data-[state=closed]:tw-slide-out-to-top-[48%] data-[state=open]:tw-slide-in-from-left-1/2 data-[state=open]:tw-slide-in-from-top-[48%] sm:tw-rounded-lg",e),...n,children:[t,a.jsxs(Xe.Close,{className:"tw-absolute tw-right-4 tw-top-4 tw-rounded-sm tw-opacity-70 tw-ring-offset-background tw-transition-opacity hover:tw-opacity-100 focus:tw-outline-none focus:tw-ring-2 focus:tw-ring-ring focus:tw-ring-offset-2 disabled:tw-pointer-events-none data-[state=open]:tw-bg-accent data-[state=open]:tw-text-muted-foreground",children:[a.jsx(Q.X,{className:"tw-h-4 tw-w-4"}),a.jsx("span",{className:"tw-sr-only",children:"Close"})]})]})]}));Ul.displayName=Xe.Content.displayName;const ql=v.forwardRef(({className:e,...t},n)=>a.jsx(Xe.Title,{ref:n,className:S("tw-text-lg tw-font-semibold tw-leading-none tw-tracking-tight",e),...t}));ql.displayName=Xe.Title.displayName;const Hl=v.forwardRef(({className:e,...t},n)=>a.jsx(Xe.Description,{ref:n,className:S("tw-text-sm tw-text-muted-foreground",e),...t}));Hl.displayName=Xe.Description.displayName;const ia=v.forwardRef(({className:e,...t},n)=>a.jsx(je.Command,{ref:n,className:S("tw-flex tw-h-full tw-w-full tw-flex-col tw-overflow-hidden tw-rounded-md tw-bg-popover tw-text-popover-foreground",e),...t}));ia.displayName=je.Command.displayName;const la=v.forwardRef(({className:e,...t},n)=>a.jsxs("div",{className:"tw-flex tw-items-center tw-border-b tw-px-3",children:[a.jsx(Q.Search,{className:"tw-me-2 tw-h-4 tw-w-4 tw-shrink-0 tw-opacity-50"}),a.jsx(je.Command.Input,{ref:n,className:S("tw-flex tw-h-11 tw-w-full tw-rounded-md tw-bg-transparent tw-py-3 tw-text-sm tw-outline-none placeholder:tw-text-muted-foreground disabled:tw-cursor-not-allowed disabled:tw-opacity-50",e),...t})]}));la.displayName=je.Command.Input.displayName;const ca=v.forwardRef(({className:e,...t},n)=>a.jsx(je.Command.List,{ref:n,className:S("tw-max-h-[300px] tw-overflow-y-auto tw-overflow-x-hidden",e),...t}));ca.displayName=je.Command.List.displayName;const da=v.forwardRef((e,t)=>a.jsx(je.Command.Empty,{ref:t,className:"tw-py-6 tw-text-center tw-text-sm",...e}));da.displayName=je.Command.Empty.displayName;const Xl=v.forwardRef(({className:e,...t},n)=>a.jsx(je.Command.Group,{ref:n,className:S("tw-overflow-hidden tw-p-1 tw-text-foreground [&_[cmdk-group-heading]]:tw-px-2 [&_[cmdk-group-heading]]:tw-py-1.5 [&_[cmdk-group-heading]]:tw-text-xs [&_[cmdk-group-heading]]:tw-font-medium [&_[cmdk-group-heading]]:tw-text-muted-foreground",e),...t}));Xl.displayName=je.Command.Group.displayName;const Yl=v.forwardRef(({className:e,...t},n)=>a.jsx(je.Command.Separator,{ref:n,className:S("tw--mx-1 tw-h-px tw-bg-border",e),...t}));Yl.displayName=je.Command.Separator.displayName;const ua=v.forwardRef(({className:e,...t},n)=>a.jsx(je.Command.Item,{ref:n,className:S("tw-relative tw-flex tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-px-2 tw-py-1.5 tw-text-sm tw-outline-none data-[disabled=true]:tw-pointer-events-none data-[selected=true]:tw-bg-accent data-[selected=true]:tw-text-accent-foreground data-[disabled=true]:tw-opacity-50",e),...t}));ua.displayName=je.Command.Item.displayName;function Wl(e){return typeof e=="string"?e:typeof e=="number"?e.toString():e.label}function Lr({id:e,options:t=[],className:n,value:r,onChange:o=()=>{},getOptionLabel:s=Wl,icon:i=void 0,buttonPlaceholder:l="",textPlaceholder:c="",commandEmptyMessage:d="No option found",buttonVariant:u="outline",alignDropDown:h="start",dir:w="ltr",isDisabled:b=!1,...x}){const[f,m]=v.useState(!1);return a.jsxs(Fl,{open:f,onOpenChange:m,...x,children:[a.jsx(zl,{asChild:!0,children:a.jsxs(fe,{variant:u,role:"combobox","aria-expanded":f,id:e,className:S("tw-flex tw-w-[200px] tw-items-center tw-justify-between tw-overflow-hidden",n),disabled:b,children:[a.jsxs("div",{className:"tw-flex tw-flex-1 tw-items-center tw-overflow-hidden",children:[i&&a.jsx("div",{className:"tw-pr-2",children:i}),a.jsx("span",{className:"tw-overflow-hidden tw-text-ellipsis tw-whitespace-nowrap",children:r?s(r):l})]}),a.jsx(Q.ChevronsUpDown,{className:"tw-ms-2 tw-h-4 tw-w-4 tw-shrink-0 tw-opacity-50"})]})}),a.jsx(sa,{align:h,className:"tw-w-[200px] tw-p-0",dir:w,children:a.jsxs(ia,{children:[a.jsx(la,{dir:w,placeholder:c,className:"tw-text-inherit"}),a.jsx(da,{children:d}),a.jsx(ca,{children:t.map(N=>a.jsxs(ua,{value:s(N),onSelect:()=>{o(N),m(!1)},children:[a.jsx(Q.Check,{className:S("tw-me-2 tw-h-4 tw-w-4",{"tw-opacity-0":!r||s(r)!==s(N)})}),s(N)]},s(N)))})]})})]})}function pa({startChapter:e,endChapter:t,handleSelectStartChapter:n,handleSelectEndChapter:r,isDisabled:o=!1,chapterCount:s}){const i=v.useMemo(()=>Array.from({length:s},(d,u)=>u+1),[s]),l=d=>{n(d),d>t&&r(d)},c=d=>{r(d),d<e&&n(d)};return a.jsxs(a.Fragment,{children:[a.jsx(Ue,{htmlFor:"start-chapters-combobox",children:"Chapters"}),a.jsx(Lr,{isDisabled:o,onChange:l,className:"tw-ml-2 tw-mr-2 tw-w-20",options:i,getOptionLabel:d=>d.toString(),value:e},"start chapter"),a.jsx(Ue,{htmlFor:"end-chapters-combobox",children:"to"}),a.jsx(Lr,{isDisabled:o,onChange:c,className:"tw-ml-2 tw-w-20",options:i,getOptionLabel:d=>d.toString(),value:t},"end chapter")]})}var wa=(e=>(e.CURRENT_BOOK="current book",e.CHOOSE_BOOKS="choose books",e))(wa||{});const Kl=Object.freeze(["%webView_bookSelector_currentBook%","%webView_bookSelector_choose%","%webView_bookSelector_chooseBooks%"]),kr=(e,t)=>e[t]??t;function Jl({handleBookSelectionModeChange:e,currentBookName:t,onSelectBooks:n,selectedBookIds:r,chapterCount:o,endChapter:s,handleSelectEndChapter:i,startChapter:l,handleSelectStartChapter:c,localizedStrings:d}){const u=kr(d,"%webView_bookSelector_currentBook%"),h=kr(d,"%webView_bookSelector_choose%"),w=kr(d,"%webView_bookSelector_chooseBooks%"),[b,x]=v.useState("current book"),f=m=>{x(m),e(m)};return a.jsx(ro,{className:"pr-twp tw-flex",value:b,onValueChange:m=>f(m),children:a.jsxs("div",{className:"tw-flex tw-w-full tw-flex-col tw-gap-4",children:[a.jsxs("div",{className:"tw-grid tw-grid-cols-[25%,25%,50%]",children:[a.jsxs("div",{className:"tw-flex tw-items-center",children:[a.jsx(Hn,{value:"current book"}),a.jsx(Ue,{className:"tw-ml-1",children:u})]}),a.jsx(Ue,{className:"tw-flex tw-items-center",children:t}),a.jsx("div",{className:"tw-flex tw-items-center tw-justify-end",children:a.jsx(pa,{isDisabled:b==="choose books",handleSelectStartChapter:c,handleSelectEndChapter:i,chapterCount:o,startChapter:l,endChapter:s})})]}),a.jsxs("div",{className:"tw-grid tw-grid-cols-[25%,50%,25%]",children:[a.jsxs("div",{className:"tw-flex tw-items-center",children:[a.jsx(Hn,{value:"choose books"}),a.jsx(Ue,{className:"tw-ml-1",children:w})]}),a.jsx(Ue,{className:"tw-flex tw-items-center",children:r.map(m=>se.bookIdToEnglishName(m)).join(", ")}),a.jsx(fe,{disabled:b==="current book",onClick:()=>n(),children:h})]})]})})}function Zl({table:e}){return a.jsxs(tr,{children:[a.jsx(Gs.DropdownMenuTrigger,{asChild:!0,children:a.jsxs(fe,{variant:"outline",size:"sm",className:"tw-ml-auto tw-hidden tw-h-8 lg:tw-flex",children:[a.jsx(Q.FilterIcon,{className:"tw-mr-2 tw-h-4 tw-w-4"}),"View"]})}),a.jsxs(kn,{align:"end",className:"tw-w-[150px]",children:[a.jsx(Xt,{children:"Toggle columns"}),a.jsx(En,{}),e.getAllColumns().filter(t=>t.getCanHide()).map(t=>a.jsx(nr,{className:"tw-capitalize",checked:t.getIsVisible(),onCheckedChange:n=>t.toggleVisibility(!!n),children:t.id},t.id))]})]})}const Dt=ge.Root,fa=ge.Group,At=ge.Value,bt=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(ge.Trigger,{ref:r,className:S("tw-flex tw-h-10 tw-w-full tw-items-center tw-justify-between tw-rounded-md tw-border tw-border-input tw-bg-background tw-px-3 tw-py-2 tw-text-sm tw-ring-offset-background placeholder:tw-text-muted-foreground focus:tw-outline-none focus:tw-ring-2 focus:tw-ring-ring focus:tw-ring-offset-2 disabled:tw-cursor-not-allowed disabled:tw-opacity-50 [&>span]:tw-line-clamp-1",e),...n,children:[t,a.jsx(ge.Icon,{asChild:!0,children:a.jsx(Q.ChevronDown,{className:"tw-h-4 tw-w-4 tw-opacity-50"})})]}));bt.displayName=ge.Trigger.displayName;const oo=v.forwardRef(({className:e,...t},n)=>a.jsx(ge.ScrollUpButton,{ref:n,className:S("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",e),...t,children:a.jsx(Q.ChevronUp,{className:"tw-h-4 tw-w-4"})}));oo.displayName=ge.ScrollUpButton.displayName;const so=v.forwardRef(({className:e,...t},n)=>a.jsx(ge.ScrollDownButton,{ref:n,className:S("tw-flex tw-cursor-default tw-items-center tw-justify-center tw-py-1",e),...t,children:a.jsx(Q.ChevronDown,{className:"tw-h-4 tw-w-4"})}));so.displayName=ge.ScrollDownButton.displayName;const vt=v.forwardRef(({className:e,children:t,position:n="popper",...r},o)=>a.jsx(ge.Portal,{children:a.jsxs(ge.Content,{ref:o,className:S("pr-twp tw-relative tw-z-50 tw-max-h-96 tw-min-w-[8rem] tw-overflow-hidden tw-rounded-md tw-border tw-bg-popover tw-text-popover-foreground tw-shadow-md data-[state=open]:tw-animate-in data-[state=closed]:tw-animate-out data-[state=closed]:tw-fade-out-0 data-[state=open]:tw-fade-in-0 data-[state=closed]:tw-zoom-out-95 data-[state=open]:tw-zoom-in-95 data-[side=bottom]:tw-slide-in-from-top-2 data-[side=left]:tw-slide-in-from-right-2 data-[side=right]:tw-slide-in-from-left-2 data-[side=top]:tw-slide-in-from-bottom-2",n==="popper"&&"data-[side=bottom]:tw-translate-y-1 data-[side=left]:tw--translate-x-1 data-[side=right]:tw-translate-x-1 data-[side=top]:tw--translate-y-1",e),position:n,...r,children:[a.jsx(oo,{}),a.jsx(ge.Viewport,{className:S("tw-p-1",n==="popper"&&"tw-h-[var(--radix-select-trigger-height)] tw-w-full tw-min-w-[var(--radix-select-trigger-width)]"),children:t}),a.jsx(so,{})]})}));vt.displayName=ge.Content.displayName;const ma=v.forwardRef(({className:e,...t},n)=>a.jsx(ge.Label,{ref:n,className:S("tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-font-semibold",e),...t}));ma.displayName=ge.Label.displayName;const De=v.forwardRef(({className:e,children:t,...n},r)=>a.jsxs(ge.Item,{ref:r,className:S("tw-relative tw-flex tw-w-full tw-cursor-default tw-select-none tw-items-center tw-rounded-sm tw-py-1.5 tw-pl-8 tw-pr-2 tw-text-sm tw-outline-none focus:tw-bg-accent focus:tw-text-accent-foreground data-[disabled]:tw-pointer-events-none data-[disabled]:tw-opacity-50",e),...n,children:[a.jsx("span",{className:"tw-absolute tw-left-2 tw-flex tw-h-3.5 tw-w-3.5 tw-items-center tw-justify-center",children:a.jsx(ge.ItemIndicator,{children:a.jsx(Q.Check,{className:"tw-h-4 tw-w-4"})})}),a.jsx(ge.ItemText,{children:t})]}));De.displayName=ge.Item.displayName;const ha=v.forwardRef(({className:e,...t},n)=>a.jsx(ge.Separator,{ref:n,className:S("tw--mx-1 tw-my-1 tw-h-px tw-bg-muted",e),...t}));ha.displayName=ge.Separator.displayName;function Ql({table:e}){return a.jsx("div",{className:"tw-flex tw-items-center tw-justify-between tw-px-2 tw-pb-3 tw-pt-3",children:a.jsxs("div",{className:"tw-flex tw-items-center tw-space-x-6 lg:tw-space-x-8",children:[a.jsxs("div",{className:"tw-flex-1 tw-text-sm tw-text-muted-foreground",children:[e.getFilteredSelectedRowModel().rows.length," of"," ",e.getFilteredRowModel().rows.length," row(s) selected"]}),a.jsxs("div",{className:"tw-flex tw-items-center tw-space-x-2",children:[a.jsx("p",{className:"tw-text-nowrap tw-text-sm tw-font-medium",children:"Rows per page"}),a.jsxs(Dt,{value:`${e.getState().pagination.pageSize}`,onValueChange:t=>{e.setPageSize(Number(t))},children:[a.jsx(bt,{className:"tw-h-8 tw-w-[70px]",children:a.jsx(At,{placeholder:e.getState().pagination.pageSize})}),a.jsx(vt,{side:"top",children:[10,20,30,40,50].map(t=>a.jsx(De,{value:`${t}`,children:t},t))})]})]}),a.jsxs("div",{className:"tw-flex tw-w-[100px] tw-items-center tw-justify-center tw-text-sm tw-font-medium",children:["Page ",e.getState().pagination.pageIndex+1," of ",e.getPageCount()]}),a.jsxs("div",{className:"tw-flex tw-items-center tw-space-x-2",children:[a.jsxs(fe,{variant:"outline",size:"icon",className:"tw-hidden tw-h-8 tw-w-8 tw-p-0 lg:tw-flex",onClick:()=>e.setPageIndex(0),disabled:!e.getCanPreviousPage(),children:[a.jsx("span",{className:"tw-sr-only",children:"Go to first page"}),a.jsx(Q.ArrowLeftIcon,{className:"tw-h-4 tw-w-4"})]}),a.jsxs(fe,{variant:"outline",size:"icon",className:"tw-h-8 tw-w-8 tw-p-0",onClick:()=>e.previousPage(),disabled:!e.getCanPreviousPage(),children:[a.jsx("span",{className:"tw-sr-only",children:"Go to previous page"}),a.jsx(Q.ChevronLeftIcon,{className:"tw-h-4 tw-w-4"})]}),a.jsxs(fe,{variant:"outline",size:"icon",className:"tw-h-8 tw-w-8 tw-p-0",onClick:()=>e.nextPage(),disabled:!e.getCanNextPage(),children:[a.jsx("span",{className:"tw-sr-only",children:"Go to next page"}),a.jsx(Q.ChevronRightIcon,{className:"tw-h-4 tw-w-4"})]}),a.jsxs(fe,{variant:"outline",size:"icon",className:"tw-hidden tw-h-8 tw-w-8 tw-p-0 lg:tw-flex",onClick:()=>e.setPageIndex(e.getPageCount()-1),disabled:!e.getCanNextPage(),children:[a.jsx("span",{className:"tw-sr-only",children:"Go to last page"}),a.jsx(Q.ArrowRightIcon,{className:"tw-h-4 tw-w-4"})]})]})]})})}const Sn=v.forwardRef(({className:e,stickyHeader:t,...n},r)=>a.jsx("div",{className:S("pr-twp tw-relative tw-w-full",{"tw-overflow-auto":!t}),children:a.jsx("table",{ref:r,className:S("tw-w-full tw-caption-bottom tw-text-sm",e),...n})}));Sn.displayName="Table";const Tn=v.forwardRef(({className:e,stickyHeader:t,...n},r)=>a.jsx("thead",{ref:r,className:S({"tw-sticky tw-top-[-1px] tw-bg-background tw-drop-shadow-sm":t},"[&_tr]:tw-border-b",e),...n}));Tn.displayName="TableHeader";const Cn=v.forwardRef(({className:e,...t},n)=>a.jsx("tbody",{ref:n,className:S("[&_tr:last-child]:tw-border-0",e),...t}));Cn.displayName="TableBody";const ga=v.forwardRef(({className:e,...t},n)=>a.jsx("tfoot",{ref:n,className:S("tw-border-t tw-bg-muted/50 tw-font-medium [&>tr]:last:tw-border-b-0",e),...t}));ga.displayName="TableFooter";const Ze=v.forwardRef(({className:e,...t},n)=>a.jsx("tr",{ref:n,className:S("tw-border-b tw-transition-colors hover:tw-bg-muted/50 data-[state=selected]:tw-bg-muted",e),...t}));Ze.displayName="TableRow";const Bt=v.forwardRef(({className:e,...t},n)=>a.jsx("th",{ref:n,className:S("tw-h-12 tw-px-4 tw-text-start tw-align-middle tw-font-medium tw-text-muted-foreground [&:has([role=checkbox])]:tw-pe-0",e),...t}));Bt.displayName="TableHead";const yt=v.forwardRef(({className:e,...t},n)=>a.jsx("td",{ref:n,className:S("tw-p-4 tw-align-middle [&:has([role=checkbox])]:tw-pe-0",e),...t}));yt.displayName="TableCell";const ba=v.forwardRef(({className:e,...t},n)=>a.jsx("caption",{ref:n,className:S("tw-mt-4 tw-text-sm tw-text-muted-foreground",e),...t}));ba.displayName="TableCaption";function va({columns:e,data:t,enablePagination:n=!1,showPaginationControls:r=!1,showColumnVisibilityControls:o=!1,stickyHeader:s=!1,onRowClickHandler:i=()=>{}}){var m;const[l,c]=v.useState([]),[d,u]=v.useState([]),[h,w]=v.useState({}),[b,x]=v.useState({}),f=Ne.useReactTable({data:t,columns:e,getCoreRowModel:Ne.getCoreRowModel(),...n&&{getPaginationRowModel:Ne.getPaginationRowModel()},onSortingChange:c,getSortedRowModel:Ne.getSortedRowModel(),onColumnFiltersChange:u,getFilteredRowModel:Ne.getFilteredRowModel(),onColumnVisibilityChange:w,onRowSelectionChange:x,state:{sorting:l,columnFilters:d,columnVisibility:h,rowSelection:b}});return a.jsxs("div",{className:"pr-twp",children:[o&&a.jsx(Zl,{table:f}),a.jsxs(Sn,{stickyHeader:s,children:[a.jsx(Tn,{stickyHeader:s,children:f.getHeaderGroups().map(N=>a.jsx(Ze,{children:N.headers.map(I=>a.jsx(Bt,{children:I.isPlaceholder?void 0:Ne.flexRender(I.column.columnDef.header,I.getContext())},I.id))},N.id))}),a.jsx(Cn,{children:(m=f.getRowModel().rows)!=null&&m.length?f.getRowModel().rows.map(N=>a.jsx(Ze,{onClick:()=>i(N,f),"data-state":N.getIsSelected()&&"selected",children:N.getVisibleCells().map(I=>a.jsx(yt,{children:Ne.flexRender(I.column.columnDef.cell,I.getContext())},I.id))},N.id)):a.jsx(Ze,{children:a.jsx(yt,{colSpan:e.length,className:"tw-h-24 tw-text-center",children:"No results."})})})]}),n&&a.jsxs("div",{className:"tw-flex tw-items-center tw-justify-end tw-space-x-2 tw-py-4",children:[a.jsx(fe,{variant:"outline",size:"sm",onClick:()=>f.previousPage(),disabled:!f.getCanPreviousPage(),children:"Previous"}),a.jsx(fe,{variant:"outline",size:"sm",onClick:()=>f.nextPage(),disabled:!f.getCanNextPage(),children:"Next"})]}),n&&r&&a.jsx(Ql,{table:f})]})}function ec({occurrenceData:e,setScriptureReference:t,localizedStrings:n}){const r=n["%webView_inventory_occurrences_table_header_reference%"],o=n["%webView_inventory_occurrences_table_header_occurrence%"],s=v.useMemo(()=>{const i=[];return e.forEach(l=>{i.some(c=>W.deepEqual(c,l))||i.push(l)}),i},[e]);return a.jsxs(Sn,{stickyHeader:!0,children:[a.jsx(Tn,{stickyHeader:!0,children:a.jsxs(Ze,{children:[a.jsx(Bt,{children:r}),a.jsx(Bt,{children:o})]})}),a.jsx(Cn,{children:s.length>0&&s.map(i=>a.jsxs(Ze,{onClick:()=>{t(i.reference)},children:[a.jsx(yt,{children:`${se.bookNumberToEnglishName(i.reference.bookNum)} ${i.reference.chapterNum}:${i.reference.verseNum}`}),a.jsx(yt,{children:i.text})]},`${i.reference.bookNum} ${i.reference.chapterNum}:${i.reference.verseNum}-${i.text}`))})]})}const rr=v.forwardRef(({className:e,...t},n)=>a.jsx(Br.Root,{ref:n,className:S("tw-peer pr-twp tw-h-4 tw-w-4 tw-shrink-0 tw-rounded-sm tw-border tw-border-primary tw-ring-offset-background focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2 disabled:tw-cursor-not-allowed disabled:tw-opacity-50 data-[state=checked]:tw-bg-primary data-[state=checked]:tw-text-primary-foreground",e),...t,children:a.jsx(Br.Indicator,{className:S("tw-flex tw-items-center tw-justify-center tw-text-current"),children:a.jsx(Q.Check,{className:"tw-h-4 tw-w-4"})})}));rr.displayName=Br.Root.displayName;const ya=e=>e.split(/(?:\r?\n|\r)|(?=(?:\\(?:v|c|id)))/g),Fr=e=>{const t=/^\\[vc]\s+(\d+)/,n=e.match(t);if(n)return+n[1]},xa=e=>{const t=e.match(/^\\id\s+([A-Za-z]+)/);return t?se.bookIdToNumber(t[1]):0},Na=(e,t,n)=>n.includes(e)?"unapproved":t.includes(e)?"approved":"unknown",ka=Nn.cva("pr-twp tw-inline-flex tw-items-center tw-justify-center tw-rounded-md tw-text-sm tw-font-medium tw-ring-offset-background tw-transition-colors hover:tw-bg-muted hover:tw-text-muted-foreground focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2 disabled:tw-pointer-events-none disabled:tw-opacity-50 data-[state=on]:tw-bg-accent data-[state=on]:tw-text-accent-foreground",{variants:{variant:{default:"tw-bg-transparent",outline:"tw-border tw-border-input tw-bg-transparent hover:tw-bg-accent hover:tw-text-accent-foreground"},size:{default:"tw-h-10 tw-px-3",sm:"tw-h-9 tw-px-2.5",lg:"tw-h-11 tw-px-5"}},defaultVariants:{variant:"default",size:"default"}}),tc=v.forwardRef(({className:e,variant:t,size:n,...r},o)=>a.jsx(Hs.Root,{ref:o,className:S(ka({variant:t,size:n,className:e})),...r}));tc.displayName=Hs.Root.displayName;const Ea=v.createContext({size:"default",variant:"default"}),ao=v.forwardRef(({className:e,variant:t,size:n,children:r,...o},s)=>a.jsx(er.Root,{ref:s,className:S("pr-twp tw-flex tw-items-center tw-justify-center tw-gap-1",e),...o,children:a.jsx(Ea.Provider,{value:{variant:t,size:n},children:r})}));ao.displayName=er.Root.displayName;const pn=v.forwardRef(({className:e,children:t,variant:n,size:r,...o},s)=>{const i=v.useContext(Ea);return a.jsx(er.Item,{ref:s,className:S(ka({variant:i.variant||n,size:i.size||r}),e),...o,children:t})});pn.displayName=er.Item.displayName;const or=e=>e==="asc"?a.jsx(Q.ArrowUpIcon,{className:"tw-ms-2 tw-h-4 tw-w-4"}):e==="desc"?a.jsx(Q.ArrowDownIcon,{className:"tw-ms-2 tw-h-4 tw-w-4"}):a.jsx(Q.ArrowUpDownIcon,{className:"tw-ms-2 tw-h-4 tw-w-4"}),nc=e=>({accessorKey:"item",accessorFn:t=>t.items[0],header:({column:t})=>a.jsxs(fe,{variant:"ghost",onClick:()=>t.toggleSorting(void 0),children:[e,or(t.getIsSorted())]})}),rc=(e,t)=>({accessorKey:`item${t}`,accessorFn:n=>n.items[t],header:({column:n})=>a.jsxs(fe,{variant:"ghost",onClick:()=>n.toggleSorting(void 0),children:[e,or(n.getIsSorted())]})}),oc=e=>({accessorKey:"count",header:({column:t})=>a.jsx("div",{className:"tw-flex tw-justify-end tw-tabular-nums",children:a.jsxs(fe,{variant:"ghost",onClick:()=>t.toggleSorting(void 0),children:[e,or(t.getIsSorted())]})}),cell:({row:t})=>a.jsx("div",{className:"tw-flex tw-justify-end",children:t.getValue("count")})}),Er=(e,t,n,r,o,s)=>{let i=[...n];e.forEach(c=>{t==="approved"?i.includes(c)||i.push(c):i=i.filter(d=>d!==c)}),r(i);let l=[...o];e.forEach(c=>{t==="unapproved"?l.includes(c)||l.push(c):l=l.filter(d=>d!==c)}),s(l)},sc=(e,t,n,r,o)=>({accessorKey:"status",header:({column:s})=>a.jsx("div",{className:"tw-flex tw-justify-center",children:a.jsxs(fe,{variant:"ghost",onClick:()=>s.toggleSorting(void 0),children:[e,or(s.getIsSorted())]})}),cell:({row:s})=>{const i=s.getValue("status"),l=s.getValue("item");return a.jsxs(ao,{value:i,variant:"outline",type:"single",children:[a.jsx(pn,{onClick:()=>Er([l],"approved",t,n,r,o),value:"approved",children:a.jsx(Q.CircleCheckIcon,{})}),a.jsx(pn,{onClick:()=>Er([l],"unapproved",t,n,r,o),value:"unapproved",children:a.jsx(Q.CircleXIcon,{})}),a.jsx(pn,{onClick:()=>Er([l],"unknown",t,n,r,o),value:"unknown",children:a.jsx(Q.CircleHelpIcon,{})})]})}}),ac=Object.freeze(["%webView_inventory_all%","%webView_inventory_approved%","%webView_inventory_unapproved%","%webView_inventory_unknown%","%webView_inventory_scope_currentBook%","%webView_inventory_scope_chapter%","%webView_inventory_scope_verse%","%webView_inventory_filter_text%","%webView_inventory_show_additional_items%","%webView_inventory_occurrences_table_header_reference%","%webView_inventory_occurrences_table_header_occurrence%"]),ic=(e,t,n)=>{let r=e;return t!=="all"&&(r=r.filter(o=>t==="approved"&&o.status==="approved"||t==="unapproved"&&o.status==="unapproved"||t==="unknown"&&o.status==="unknown")),n!==""&&(r=r.filter(o=>o.items[0].includes(n))),r},lc=(e,t,n,r,o)=>{if(!e)return[];const s=[];let i=t.bookNum,l=t.chapterNum,c=t.verseNum;return ya(e).forEach(u=>{u.startsWith("\\id")&&(i=xa(u),l=0,c=0),u.startsWith("\\c")&&(l=Fr(u),c=0),u.startsWith("\\v")&&(c=Fr(u),l===0&&(l=t.chapterNum));let h=o.exec(u)??void 0;for(;h;){const w=[];h.forEach(m=>w.push(m));const b=h.index,x=s.find(m=>W.deepEqual(m.items,w)),f={reference:{bookNum:i!==void 0?i:-1,chapterNum:l!==void 0?l:-1,verseNum:c!==void 0?c:-1},text:W.substring(u,Math.max(0,b-25),Math.min(b+25,u.length))};if(x)x.count+=1,x.occurrences.push(f);else{const m={items:w,count:1,status:Na(w[0],n,r),occurrences:[f]};s.push(m)}h=o.exec(u)??void 0}}),s},Je=(e,t)=>e[t]??t;function cc({scriptureReference:e,setScriptureReference:t,localizedStrings:n,extractItems:r,additionalItemsLabels:o,approvedItems:s,unapprovedItems:i,text:l,scope:c,onScopeChange:d,columns:u}){const h=Je(n,"%webView_inventory_all%"),w=Je(n,"%webView_inventory_approved%"),b=Je(n,"%webView_inventory_unapproved%"),x=Je(n,"%webView_inventory_unknown%"),f=Je(n,"%webView_inventory_scope_currentBook%"),m=Je(n,"%webView_inventory_scope_chapter%"),N=Je(n,"%webView_inventory_scope_verse%"),I=Je(n,"%webView_inventory_filter_text%"),j=Je(n,"%webView_inventory_show_additional_items%"),[E,g]=v.useState(!1),[P,V]=v.useState("all"),[U,T]=v.useState(""),[R,k]=v.useState([]),D=v.useMemo(()=>l?r instanceof RegExp?lc(l,e,s,i,r):r(l,e,s,i):[],[l,r,e,s,i]),$=v.useMemo(()=>{if(E)return D;const y=[];return D.forEach(C=>{const L=C.items[0],F=y.find(B=>B.items[0]===L);F?(F.count+=C.count,F.occurrences=F.occurrences.concat(C.occurrences)):y.push({items:[L],count:C.count,occurrences:C.occurrences,status:C.status})}),y},[E,D]),J=v.useMemo(()=>ic($,P,U),[$,P,U]),Y=v.useMemo(()=>{var L,F;if(!E)return u;const y=(L=o==null?void 0:o.tableHeaders)==null?void 0:L.length;if(!y)return u;const C=[];for(let B=0;B<y;B++)C.push(rc(((F=o==null?void 0:o.tableHeaders)==null?void 0:F[B])||"Additional Item",B+1));return[...C,...u]},[o==null?void 0:o.tableHeaders,u,E]);v.useEffect(()=>{k([])},[J]);const z=(y,C)=>{C.setRowSelection(()=>{const L={};return L[y.index]=!0,L}),k(y.original.items)},te=y=>{if(y==="book"||y==="chapter"||y==="verse")d(y);else throw new Error(`Invalid scope value: ${y}`)},ae=y=>{if(y==="all"||y==="approved"||y==="unapproved"||y==="unknown")V(y);else throw new Error(`Invalid status filter value: ${y}`)},oe=v.useMemo(()=>{if($.length===0||R.length===0)return[];const y=$.filter(C=>W.deepEqual(E?C.items:[C.items[0]],R));if(y.length>1)throw new Error("Selected item is not unique");return y[0].occurrences},[R,E,$]);return a.jsxs("div",{className:"pr-twp tw-flex tw-h-full tw-flex-col",children:[a.jsxs("div",{className:"tw-flex tw-items-stretch",children:[a.jsxs(Dt,{onValueChange:y=>ae(y),defaultValue:P,children:[a.jsx(bt,{className:"tw-m-1",children:a.jsx(At,{placeholder:"Select filter"})}),a.jsxs(vt,{children:[a.jsx(De,{value:"all",children:h}),a.jsx(De,{value:"approved",children:w}),a.jsx(De,{value:"unapproved",children:b}),a.jsx(De,{value:"unknown",children:x})]})]}),a.jsxs(Dt,{onValueChange:y=>te(y),defaultValue:c,children:[a.jsx(bt,{className:"tw-m-1",children:a.jsx(At,{placeholder:"Select scope"})}),a.jsxs(vt,{children:[a.jsx(De,{value:"book",children:f}),a.jsx(De,{value:"chapter",children:m}),a.jsx(De,{value:"verse",children:N})]})]}),a.jsx(qt,{className:"tw-m-1 tw-rounded-md tw-border",placeholder:I,value:U,onChange:y=>{T(y.target.value)}}),o&&a.jsxs("div",{className:"tw-m-1 tw-flex tw-items-center tw-rounded-md tw-border",children:[a.jsx(rr,{className:"tw-m-1",checked:E,onCheckedChange:y=>{k([]),g(y)}}),a.jsx(Ue,{className:"tw-m-1 tw-flex-shrink-0 tw-whitespace-nowrap",children:(o==null?void 0:o.checkboxText)??j})]})]}),a.jsx("div",{className:"tw-m-1 tw-flex-1 tw-overflow-auto tw-rounded-md tw-border",children:a.jsx(va,{columns:Y,data:J,onRowClickHandler:z,stickyHeader:!0})}),oe.length>0&&a.jsx("div",{className:"tw-m-1 tw-flex-1 tw-overflow-auto tw-rounded-md tw-border",children:a.jsx(ec,{occurrenceData:oe,setScriptureReference:t,localizedStrings:n})})]})}function Sa({onSearch:e,placeholder:t,isFullWidth:n,className:r}){const[o,s]=v.useState(""),i=l=>{s(l),e(l)};return a.jsxs("div",{className:"tw-relative",children:[a.jsx(Q.Search,{className:"tw-absolute tw-left-3 tw-top-1/2 tw-h-4 tw-w-4 tw--translate-y-1/2 tw-transform tw-opacity-50"}),a.jsx(qt,{className:S("tw-flex tw-h-10 tw-w-full tw-text-ellipsis tw-rounded-md tw-border tw-border-input tw-bg-background tw-py-2 tw-pe-3 tw-ps-9 tw-text-sm tw-ring-offset-background file:tw-border-0 file:tw-bg-transparent file:tw-text-sm file:tw-font-medium placeholder:tw-text-muted-foreground focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-[color:hsl(240,5%,64.9%)] focus-visible:tw-ring-offset-2 disabled:tw-cursor-not-allowed disabled:tw-opacity-50",{"tw-w-full":n},{"tw-pe-9":o},r),placeholder:t,value:o,onChange:l=>i(l.target.value)}),o&&a.jsxs(fe,{variant:"ghost",size:"icon",className:"tw-absolute tw-right-0 tw-top-1/2 tw-h-7 tw--translate-y-1/2 tw-transform hover:tw-bg-transparent",children:[a.jsx(Q.X,{className:"tw-h-4 tw-w-4",onClick:()=>{i("")}}),a.jsx("span",{className:"tw-sr-only",children:"Clear"})]})]})}const io=v.forwardRef(({className:e,...t},n)=>a.jsx(Oe.Root,{orientation:"vertical",ref:n,className:S("tw-flex tw-gap-1 tw-rounded-md tw-text-muted-foreground",e),...t}));io.displayName=Oe.List.displayName;const lo=v.forwardRef(({className:e,...t},n)=>a.jsx(Oe.List,{ref:n,className:S("tw-flex-fit tw-mlk-items-center tw-w-[124px] tw-justify-center tw-rounded-md tw-bg-muted tw-p-1 tw-text-muted-foreground",e),...t}));lo.displayName=Oe.List.displayName;const Ta=v.forwardRef(({className:e,...t},n)=>a.jsx(Oe.Trigger,{ref:n,...t,className:S("overflow-clip tw-inline-flex tw-w-[116px] tw-cursor-pointer tw-items-center tw-justify-center tw-break-words tw-rounded-sm tw-border-0 tw-bg-muted tw-px-3 tw-py-1.5 tw-text-sm tw-font-medium tw-text-inherit tw-ring-offset-background tw-transition-all hover:tw-text-foreground focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2 disabled:tw-pointer-events-none disabled:tw-opacity-50 data-[state=active]:tw-bg-background data-[state=active]:tw-text-foreground data-[state=active]:tw-shadow-sm",e)})),co=v.forwardRef(({className:e,...t},n)=>a.jsx(Oe.Content,{ref:n,className:S("tw-ms-5 tw-flex-grow tw-text-foreground tw-ring-offset-background focus-visible:tw-outline-none focus-visible:tw-ring-2 focus-visible:tw-ring-ring focus-visible:tw-ring-offset-2",e),...t}));co.displayName=Oe.Content.displayName;function dc({tabList:e,onSearch:t,searchPlaceholder:n,headerTitle:r,isSearchBarFullWidth:o=!1,direction:s="ltr"}){return a.jsxs("div",{className:"pr-twp",children:[a.jsxs("div",{className:"tw-sticky tw-top-0 tw-space-y-2 tw-pb-2",children:[r?a.jsx("h1",{children:r}):"",a.jsx(Sa,{isFullWidth:o,onSearch:t,placeholder:n})]}),a.jsxs(io,{dir:s,children:[a.jsx(lo,{children:e.map(i=>a.jsx(Ta,{value:i.value,children:i.value},i.key))}),e.map(i=>a.jsx(co,{value:i.value,children:i.content},i.key))]})]})}const rt="scrBook",uc="scrRef",pt="source",pc="details",wc="Scripture Reference",fc="Scripture Book",Ca="Type",mc="Details";function hc(e,t){const n=t??!1;return[{accessorFn:r=>`${se.bookNumberToId(r.start.bookNum)} ${r.start.chapterNum}:${r.start.verseNum}`,id:rt,header:(e==null?void 0:e.scriptureReferenceColumnName)??wc,cell:r=>{const o=r.row.original;return r.row.getIsGrouped()?se.bookNumberToEnglishName(o.start.bookNum):r.row.groupingColumnId===rt?W.formatScrRef(o.start):void 0},getGroupingValue:r=>r.start.bookNum,sortingFn:(r,o)=>W.compareScrRefs(r.original.start,o.original.start),enableGrouping:!0},{accessorFn:r=>W.formatScrRef(r.start),id:uc,header:void 0,cell:r=>{const o=r.row.original;return r.row.getIsGrouped()?void 0:W.formatScrRef(o.start)},sortingFn:(r,o)=>W.compareScrRefs(r.original.start,o.original.start),enableGrouping:!1},{accessorFn:r=>r.source.displayName,id:pt,header:n?(e==null?void 0:e.typeColumnName)??Ca:void 0,cell:r=>n||r.row.getIsGrouped()?r.getValue():void 0,getGroupingValue:r=>r.source.id,sortingFn:(r,o)=>r.original.source.displayName.localeCompare(o.original.source.displayName),enableGrouping:!0},{accessorFn:r=>r.detail,id:pc,header:(e==null?void 0:e.detailsColumnName)??mc,cell:r=>r.getValue(),enableGrouping:!1}]}const gc=e=>{if(!("offset"in e.start))throw new Error("No offset available in range start");if(e.end&&!("offset"in e.end))throw new Error("No offset available in range end");const{offset:t}=e.start;let n=0;return e.end&&({offset:n}=e.end),!e.end||W.compareScrRefs(e.start,e.end)===0?`${W.scrRefToBBBCCCVVV(e.start)}+${t}`:`${W.scrRefToBBBCCCVVV(e.start)}+${t}-${W.scrRefToBBBCCCVVV(e.end)}+${n}`},Zo=e=>`${gc({start:e.start,end:e.end})} ${e.source.displayName} ${e.detail}`;function bc({sources:e,showColumnHeaders:t=!1,showSourceColumn:n=!1,scriptureReferenceColumnName:r,scriptureBookGroupName:o,typeColumnName:s,detailsColumnName:i,onRowSelected:l,direction:c="ltr"}){const[d,u]=v.useState([]),[h,w]=v.useState([{id:rt,desc:!1}]),[b,x]=v.useState({}),f=v.useMemo(()=>e.flatMap(T=>T.data.map(R=>({...R,source:T.source}))),[e]),m=v.useMemo(()=>hc({scriptureReferenceColumnName:r,typeColumnName:s,detailsColumnName:i},n),[r,s,i,n]);v.useEffect(()=>{d.includes(pt)?w([{id:pt,desc:!1},{id:rt,desc:!1}]):w([{id:rt,desc:!1}])},[d]);const N=Ne.useReactTable({data:f,columns:m,state:{grouping:d,sorting:h,rowSelection:b},onGroupingChange:u,onSortingChange:w,onRowSelectionChange:x,getExpandedRowModel:Ne.getExpandedRowModel(),getGroupedRowModel:Ne.getGroupedRowModel(),getCoreRowModel:Ne.getCoreRowModel(),getSortedRowModel:Ne.getSortedRowModel(),getRowId:Zo,autoResetExpanded:!1,enableMultiRowSelection:!1,enableSubRowSelection:!1});v.useEffect(()=>{if(l){const T=N.getSelectedRowModel().rowsById,R=Object.keys(T);if(R.length===1){const k=f.find(D=>Zo(D)===R[0])||void 0;k&&l(k)}}},[b,f,l,N]);const I=o??fc,j=s??Ca,E=[{label:"No Grouping",value:[]},{label:`Group by ${I}`,value:[rt]},{label:`Group by ${j}`,value:[pt]},{label:`Group by ${I} and ${j}`,value:[rt,pt]},{label:`Group by ${j} and ${I}`,value:[pt,rt]}],g=T=>{u(JSON.parse(T))},P=(T,R)=>{!T.getIsGrouped()&&!T.getIsSelected()&&T.getToggleSelectedHandler()(R)},V=(T,R)=>T.getIsGrouped()?"":S("banded-row",R%2===0?"even":"odd"),U=(T,R,k)=>{if(!((T==null?void 0:T.length)===0||R.depth<k.column.getGroupedIndex())){if(R.getIsGrouped())switch(R.depth){case 1:return"tw-ps-4";default:return}switch(R.depth){case 1:return"tw-ps-8";case 2:return"tw-ps-12";default:return}}};return a.jsxs("div",{className:"pr-twp tw-flex tw-h-full tw-w-full tw-flex-col",children:[!t&&a.jsxs(Dt,{value:JSON.stringify(d),onValueChange:T=>{g(T)},children:[a.jsx(bt,{className:"tw-mb-1 tw-mt-2",children:a.jsx(At,{})}),a.jsx(vt,{position:"item-aligned",children:a.jsx(fa,{children:E.map(T=>a.jsx(De,{value:JSON.stringify(T.value),children:T.label},T.label))})})]}),a.jsxs(Sn,{className:"tw-relative tw-flex tw-flex-col tw-overflow-y-auto tw-p-0",children:[t&&a.jsx(Tn,{children:N.getHeaderGroups().map(T=>a.jsx(Ze,{children:T.headers.filter(R=>R.column.columnDef.header).map(R=>a.jsx(Bt,{colSpan:R.colSpan,className:"top-0 tw-sticky",children:R.isPlaceholder?void 0:a.jsxs("div",{children:[R.column.getCanGroup()?a.jsx(fe,{variant:"ghost",title:`Toggle grouping by ${R.column.columnDef.header}`,onClick:R.column.getToggleGroupingHandler(),type:"button",children:R.column.getIsGrouped()?"🛑":"👊 "}):void 0," ",Ne.flexRender(R.column.columnDef.header,R.getContext())]})},R.id))},T.id))}),a.jsx(Cn,{children:N.getRowModel().rows.map((T,R)=>a.jsx(Ze,{"data-state":T.getIsSelected()?"selected":"",className:S(V(T,R)),onClick:k=>P(T,k),children:T.getVisibleCells().map(k=>{if(!(k.getIsPlaceholder()||k.column.columnDef.enableGrouping&&!k.getIsGrouped()&&(k.column.columnDef.id!==pt||!n)))return a.jsx(yt,{className:S(k.column.columnDef.id,"tw-p-[1px]",U(d,T,k)),children:(()=>k.getIsGrouped()?a.jsxs(fe,{variant:"link",onClick:T.getToggleExpandedHandler(),type:"button",children:[T.getIsExpanded()&&a.jsx(Q.ChevronDown,{}),!T.getIsExpanded()&&(c==="ltr"?a.jsx(Q.ChevronRight,{}):a.jsx(Q.ChevronLeft,{}))," ",Ne.flexRender(k.column.columnDef.cell,k.getContext())," (",T.subRows.length,")"]}):Ne.flexRender(k.column.columnDef.cell,k.getContext()))()},k.id)})},T.id))})]})]})}const Sr={[W.getLocalizeKeyForScrollGroupId("undefined")]:"Ø",[W.getLocalizeKeyForScrollGroupId(0)]:"A",[W.getLocalizeKeyForScrollGroupId(1)]:"B",[W.getLocalizeKeyForScrollGroupId(2)]:"C",[W.getLocalizeKeyForScrollGroupId(3)]:"D",[W.getLocalizeKeyForScrollGroupId(4)]:"E",[W.getLocalizeKeyForScrollGroupId(5)]:"F",[W.getLocalizeKeyForScrollGroupId(6)]:"G",[W.getLocalizeKeyForScrollGroupId(7)]:"H",[W.getLocalizeKeyForScrollGroupId(8)]:"I",[W.getLocalizeKeyForScrollGroupId(9)]:"J",[W.getLocalizeKeyForScrollGroupId(10)]:"K",[W.getLocalizeKeyForScrollGroupId(11)]:"L",[W.getLocalizeKeyForScrollGroupId(12)]:"M",[W.getLocalizeKeyForScrollGroupId(13)]:"N",[W.getLocalizeKeyForScrollGroupId(14)]:"O",[W.getLocalizeKeyForScrollGroupId(15)]:"P",[W.getLocalizeKeyForScrollGroupId(16)]:"Q",[W.getLocalizeKeyForScrollGroupId(17)]:"R",[W.getLocalizeKeyForScrollGroupId(18)]:"S",[W.getLocalizeKeyForScrollGroupId(19)]:"T",[W.getLocalizeKeyForScrollGroupId(20)]:"U",[W.getLocalizeKeyForScrollGroupId(21)]:"V",[W.getLocalizeKeyForScrollGroupId(22)]:"W",[W.getLocalizeKeyForScrollGroupId(23)]:"X",[W.getLocalizeKeyForScrollGroupId(24)]:"Y",[W.getLocalizeKeyForScrollGroupId(25)]:"Z"};function vc({availableScrollGroupIds:e,scrollGroupId:t,onChangeScrollGroupId:n,localizedStrings:r={}}){const o={...Sr,...Object.fromEntries(Object.entries(r).map(([s,i])=>[s,s===i&&s in Sr?Sr[s]:i]))};return a.jsxs(Dt,{value:`${t}`,onValueChange:s=>n(s==="undefined"?void 0:parseInt(s,10)),children:[a.jsx(bt,{className:"pr-twp tw-w-auto",children:a.jsx(At,{placeholder:o[W.getLocalizeKeyForScrollGroupId(t)]??t})}),a.jsx(vt,{style:{zIndex:250},children:e.map(s=>a.jsx(De,{value:`${s}`,children:o[W.getLocalizeKeyForScrollGroupId(s)]},`${s}`))})]})}const uo=v.forwardRef(({className:e,orientation:t="horizontal",decorative:n=!0,...r},o)=>a.jsx(Xs.Root,{ref:o,decorative:n,orientation:t,className:S("pr-twp tw-shrink-0 tw-bg-border",t==="horizontal"?"tw-h-[1px] tw-w-full":"tw-h-full tw-w-[1px]",e),...r}));uo.displayName=Xs.Root.displayName;function yc({children:e}){return a.jsx("div",{className:"pr-twp tw-grid",children:e})}function xc({primary:e,secondary:t,children:n,isLoading:r=!1,loadingMessage:o}){return a.jsxs("div",{className:"tw-flex tw-items-center tw-justify-between tw-space-x-4 tw-py-2",children:[a.jsxs("div",{children:[a.jsx("p",{className:"tw-text-sm tw-font-medium tw-leading-none",children:e}),a.jsx("p",{className:"tw-whitespace-normal tw-break-words tw-text-sm tw-text-muted-foreground",children:t})]}),r?a.jsx("p",{className:"tw-text-sm tw-text-muted-foreground",children:o}):a.jsx("div",{children:n})]})}function Nc({primary:e,secondary:t,includeSeparator:n=!1}){return a.jsxs("div",{className:"tw-space-y-4 tw-py-2",children:[a.jsxs("div",{children:[a.jsx("h3",{className:"tw-text-lg tw-font-medium",children:e}),a.jsx("p",{className:"tw-text-sm tw-text-muted-foreground",children:t})]}),n?a.jsx(uo,{}):""]})}function kc({id:e,className:t,listItems:n,selectedListItems:r,handleSelectListItem:o,createLabel:s}){return a.jsx("div",{id:e,className:t,children:n.map(i=>a.jsxs("div",{className:"tw-m-2 tw-flex tw-items-center",children:[a.jsx(rr,{className:"tw-mr-2 tw-align-middle",checked:r.includes(i),onCheckedChange:l=>o(i,l)}),a.jsx(Ue,{children:s?s(i):i})]},i))})}function Ec(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function Sc(e){if(e.__esModule)return e;var t=e.default;if(typeof t=="function"){var n=function r(){return this instanceof r?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};n.prototype=t.prototype}else n={};return Object.defineProperty(n,"__esModule",{value:!0}),Object.keys(e).forEach(function(r){var o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(n,r,o.get?o:{enumerable:!0,get:function(){return e[r]}})}),n}var po={},ja={exports:{}};(function(e){function t(n){return n&&n.__esModule?n:{default:n}}e.exports=t,e.exports.__esModule=!0,e.exports.default=e.exports})(ja);var Tc=ja.exports,Tr={};function wo(e,t){return process.env.NODE_ENV==="production"?()=>null:function(...r){return e(...r)||t(...r)}}function O(){return O=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var n=arguments[t];for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&(e[r]=n[r])}return e},O.apply(this,arguments)}function mt(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return(t===null||t===Object.prototype||Object.getPrototypeOf(t)===null)&&!(Symbol.toStringTag in e)&&!(Symbol.iterator in e)}function Oa(e){if(!mt(e))return e;const t={};return Object.keys(e).forEach(n=>{t[n]=Oa(e[n])}),t}function Qe(e,t,n={clone:!0}){const r=n.clone?O({},e):e;return mt(e)&&mt(t)&&Object.keys(t).forEach(o=>{o!=="__proto__"&&(mt(t[o])&&o in e&&mt(e[o])?r[o]=Qe(e[o],t[o],n):n.clone?r[o]=mt(t[o])?Oa(t[o]):t[o]:r[o]=t[o])}),r}var zr={exports:{}},Bn={exports:{}},ie={};/** @license React v16.13.1

Check warning

Code scanning / CodeQL

Prototype-polluting function Medium

Properties are copied from
t
to
r
without guarding against prototype pollution.

Check warning

Code scanning / CodeQL

Prototype-polluting function Medium

Properties are copied from
t
to
r
without guarding against prototype pollution.
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
}) {
const r = n.clone ? R({}, e) : e;
return ht(e) && ht(t) && Object.keys(t).forEach((o) => {
o !== "__proto__" && (ht(t[o]) && o in e && ht(e[o]) ? r[o] = Ze(e[o], t[o], n) : n.clone ? r[o] = ht(t[o]) ? Ri(t[o]) : t[o] : r[o] = t[o]);

Check warning

Code scanning / CodeQL

Prototype-polluting function Medium

Properties are copied from
t
to
r
without guarding against prototype pollution.

Check warning

Code scanning / CodeQL

Prototype-polluting function Medium

Properties are copied from
t
to
r
without guarding against prototype pollution.
}), r;
}
var Hr = { exports: {} }, Mn = { exports: {} }, ie = {};